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 29 0a 69 dot-locking).
01c0: 28 69 6d 70 6f 72 74 20 28 70 72 65 66 69 78 20 (import (prefix
01d0: 73 71 6c 69 74 65 33 20 73 71 6c 69 74 65 33 3a sqlite3 sqlite3:
01e0: 29 29 0a 0a 28 64 65 63 6c 61 72 65 20 28 75 6e ))..(declare (un
01f0: 69 74 20 72 75 6e 73 29 29 0a 28 64 65 63 6c 61 it runs)).(decla
0200: 72 65 20 28 75 73 65 73 20 64 62 29 29 0a 28 64 re (uses db)).(d
0210: 65 63 6c 61 72 65 20 28 75 73 65 73 20 63 6f 6d eclare (uses com
0220: 6d 6f 6e 29 29 0a 28 64 65 63 6c 61 72 65 20 28 mon)).(declare (
0230: 75 73 65 73 20 69 74 65 6d 73 29 29 0a 28 64 65 uses items)).(de
0240: 63 6c 61 72 65 20 28 75 73 65 73 20 72 75 6e 63 clare (uses runc
0250: 6f 6e 66 69 67 29 29 0a 28 64 65 63 6c 61 72 65 onfig)).(declare
0260: 20 28 75 73 65 73 20 74 65 73 74 73 29 29 0a 28 (uses tests)).(
0270: 64 65 63 6c 61 72 65 20 28 75 73 65 73 20 73 65 declare (uses se
0280: 72 76 65 72 29 29 0a 0a 28 69 6e 63 6c 75 64 65 rver))..(include
0290: 20 22 63 6f 6d 6d 6f 6e 5f 72 65 63 6f 72 64 73 "common_records
02a0: 2e 73 63 6d 22 29 0a 28 69 6e 63 6c 75 64 65 20 .scm").(include
02b0: 22 6b 65 79 5f 72 65 63 6f 72 64 73 2e 73 63 6d "key_records.scm
02c0: 22 29 0a 28 69 6e 63 6c 75 64 65 20 22 64 62 5f ").(include "db_
02d0: 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 0a 28 69 records.scm").(i
02e0: 6e 63 6c 75 64 65 20 22 72 75 6e 5f 72 65 63 6f nclude "run_reco
02f0: 72 64 73 2e 73 63 6d 22 29 0a 28 69 6e 63 6c 75 rds.scm").(inclu
0300: 64 65 20 22 74 65 73 74 5f 72 65 63 6f 72 64 73 de "test_records
0310: 2e 73 63 6d 22 29 0a 0a 3b 3b 20 72 75 6e 73 3a .scm")..;; runs:
0320: 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74 74 get-runs-by-patt
0330: 0a 3b 3b 20 67 65 74 20 72 75 6e 73 20 62 79 20 .;; get runs by
0340: 6c 69 73 74 20 6f 66 20 63 72 69 74 65 72 69 61 list of criteria
0350: 0a 3b 3b 20 72 65 67 69 73 74 65 72 20 61 20 74 .;; register a t
0360: 65 73 74 20 72 75 6e 20 77 69 74 68 20 74 68 65 est run with the
0370: 20 64 62 0a 3b 3b 0a 3b 3b 20 55 73 65 3a 20 28 db.;;.;; Use: (
0380: 64 62 2d 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d db-get-value-by-
0390: 68 65 61 64 65 72 20 28 64 62 3a 67 65 74 2d 68 header (db:get-h
03a0: 65 61 64 65 72 20 72 75 6e 69 6e 66 6f 29 28 64 eader runinfo)(d
03b0: 62 3a 67 65 74 2d 72 6f 77 20 72 75 6e 69 6e 66 b:get-row runinf
03c0: 6f 29 29 0a 3b 3b 20 20 74 6f 20 65 78 74 72 61 o)).;; to extra
03d0: 63 74 20 69 6e 66 6f 20 66 72 6f 6d 20 74 68 65 ct info from the
03e0: 20 73 74 72 75 63 74 75 72 65 20 72 65 74 75 72 structure retur
03f0: 6e 65 64 0a 3b 3b 0a 28 64 65 66 69 6e 65 20 28 ned.;;.(define (
0400: 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 runs:get-runs-by
0410: 2d 70 61 74 74 20 64 62 20 6b 65 79 73 20 72 75 -patt db keys ru
0420: 6e 6e 61 6d 65 70 61 74 74 20 2e 20 70 61 72 61 nnamepatt . para
0430: 6d 73 29 20 3b 3b 20 74 65 73 74 2d 6e 61 6d 65 ms) ;; test-name
0440: 29 0a 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 76 ). (let* ((keyv
0450: 61 6c 6c 73 74 20 28 6b 65 79 73 2d 3e 76 61 6c allst (keys->val
0460: 6c 69 73 74 20 6b 65 79 73 29 29 0a 09 20 28 74 list keys)).. (t
0470: 6d 70 20 20 20 20 20 20 28 72 75 6e 73 3a 67 65 mp (runs:ge
0480: 74 2d 73 74 64 2d 72 75 6e 2d 66 69 65 6c 64 73 t-std-run-fields
0490: 20 6b 65 79 73 20 27 28 22 69 64 22 20 22 72 75 keys '("id" "ru
04a0: 6e 6e 61 6d 65 22 20 22 73 74 61 74 65 22 20 22 nname" "state" "
04b0: 73 74 61 74 75 73 22 20 22 6f 77 6e 65 72 22 20 status" "owner"
04c0: 22 65 76 65 6e 74 5f 74 69 6d 65 22 29 29 29 0a "event_time"))).
04d0: 09 20 28 6b 65 79 73 74 72 20 20 20 28 63 61 72 . (keystr (car
04e0: 20 74 6d 70 29 29 0a 09 20 28 68 65 61 64 65 72 tmp)).. (header
04f0: 20 20 20 28 63 61 64 72 20 74 6d 70 29 29 0a 09 (cadr tmp))..
0500: 20 28 72 65 73 20 20 20 20 20 27 28 29 29 0a 09 (res '())..
0510: 20 28 6b 65 79 2d 70 61 74 74 20 22 22 29 29 0a (key-patt "")).
0520: 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 28 6c (for-each (l
0530: 61 6d 62 64 61 20 28 6b 65 79 76 61 6c 29 0a 09 ambda (keyval)..
0540: 09 28 6c 65 74 2a 20 28 28 6b 65 79 20 20 20 20 .(let* ((key
0550: 28 76 65 63 74 6f 72 2d 72 65 66 20 6b 65 79 76 (vector-ref keyv
0560: 61 6c 20 30 29 29 0a 09 09 20 20 20 20 20 20 20 al 0))...
0570: 28 66 75 6c 6b 65 79 20 28 63 6f 6e 63 20 22 3a (fulkey (conc ":
0580: 22 20 6b 65 79 29 29 0a 09 09 20 20 20 20 20 20 " key))...
0590: 20 28 70 61 74 74 20 20 20 28 61 72 67 73 3a 67 (patt (args:g
05a0: 65 74 2d 61 72 67 20 66 75 6c 6b 65 79 29 29 29 et-arg fulkey)))
05b0: 0a 09 09 20 20 28 69 66 20 70 61 74 74 0a 09 09 ... (if patt...
05c0: 20 20 20 20 20 20 28 73 65 74 21 20 6b 65 79 2d (set! key-
05d0: 70 61 74 74 20 28 63 6f 6e 63 20 6b 65 79 2d 70 patt (conc key-p
05e0: 61 74 74 20 22 20 41 4e 44 20 22 20 6b 65 79 20 att " AND " key
05f0: 22 20 6c 69 6b 65 20 27 22 20 70 61 74 74 20 22 " like '" patt "
0600: 27 22 29 29 0a 09 09 20 20 20 20 20 20 28 62 65 '"))... (be
0610: 67 69 6e 0a 09 09 09 28 64 65 62 75 67 3a 70 72 gin....(debug:pr
0620: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 73 65 int 0 "ERROR: se
0630: 61 72 63 68 69 6e 67 20 66 6f 72 20 72 75 6e 73 arching for runs
0640: 20 77 69 74 68 20 6e 6f 20 70 61 74 74 65 72 6e with no pattern
0650: 20 73 65 74 20 66 6f 72 20 22 20 66 75 6c 6b 65 set for " fulke
0660: 79 29 0a 09 09 09 28 65 78 69 74 20 36 29 29 29 y)....(exit 6)))
0670: 29 29 0a 09 20 20 20 20 20 20 6b 65 79 73 29 0a )).. keys).
0680: 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66 6f 72 (sqlite3:for
0690: 2d 65 61 63 68 2d 72 6f 77 20 0a 20 20 20 20 20 -each-row .
06a0: 28 6c 61 6d 62 64 61 20 28 61 20 2e 20 72 29 0a (lambda (a . r).
06b0: 20 20 20 20 20 20 20 28 73 65 74 21 20 72 65 73 (set! res
06c0: 20 28 63 6f 6e 73 20 28 6c 69 73 74 2d 3e 76 65 (cons (list->ve
06d0: 63 74 6f 72 20 28 63 6f 6e 73 20 61 20 72 29 29 ctor (cons a r))
06e0: 20 72 65 73 29 29 29 0a 20 20 20 20 20 64 62 20 res))). db
06f0: 0a 20 20 20 20 20 28 63 6f 6e 63 20 22 53 45 4c . (conc "SEL
0700: 45 43 54 20 22 20 6b 65 79 73 74 72 20 22 20 46 ECT " keystr " F
0710: 52 4f 4d 20 72 75 6e 73 20 57 48 45 52 45 20 72 ROM runs WHERE r
0720: 75 6e 6e 61 6d 65 20 6c 69 6b 65 20 3f 20 22 20 unname like ? "
0730: 6b 65 79 2d 70 61 74 74 20 22 3b 22 29 0a 20 20 key-patt ";").
0740: 20 20 20 72 75 6e 6e 61 6d 65 70 61 74 74 29 0a runnamepatt).
0750: 20 20 20 20 28 76 65 63 74 6f 72 20 68 65 61 64 (vector head
0760: 65 72 20 72 65 73 29 29 29 0a 0a 3b 3b 20 3b 3b er res)))..;; ;;
0770: 20 54 4f 44 4f 3a 20 43 6f 6e 76 65 72 67 65 20 TODO: Converge
0780: 74 68 69 73 20 77 69 74 68 20 64 62 3a 67 65 74 this with db:get
0790: 2d 74 65 73 74 2d 69 6e 66 6f 0a 3b 3b 20 28 64 -test-info.;; (d
07a0: 65 66 69 6e 65 20 28 72 75 6e 73 3a 67 65 74 2d efine (runs:get-
07b0: 74 65 73 74 2d 69 6e 66 6f 20 64 62 20 72 75 6e test-info db run
07c0: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 -id test-name it
07d0: 65 6d 2d 70 61 74 68 29 0a 3b 3b 20 20 20 28 6c em-path).;; (l
07e0: 65 74 20 28 28 72 65 73 20 23 66 29 29 20 3b 3b et ((res #f)) ;;
07f0: 20 28 76 65 63 74 6f 72 20 23 66 20 23 66 20 23 (vector #f #f #
0800: 66 20 23 66 20 23 66 20 23 66 29 29 29 0a 3b 3b f #f #f #f))).;;
0810: 20 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66 6f (sqlite3:fo
0820: 72 2d 65 61 63 68 2d 72 6f 77 20 0a 3b 3b 20 20 r-each-row .;;
0830: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 69 64 20 (lambda (id
0840: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
0850: 20 73 74 61 74 65 20 73 74 61 74 75 73 29 0a 3b state status).;
0860: 3b 20 20 20 20 20 20 20 20 28 73 65 74 21 20 72 ; (set! r
0870: 65 73 20 28 76 65 63 74 6f 72 20 69 64 20 72 75 es (vector id ru
0880: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 73 n-id test-name s
0890: 74 61 74 65 20 73 74 61 74 75 73 20 69 74 65 6d tate status item
08a0: 2d 70 61 74 68 29 29 29 0a 3b 3b 20 20 20 20 20 -path))).;;
08b0: 20 64 62 20 22 53 45 4c 45 43 54 20 69 64 2c 72 db "SELECT id,r
08c0: 75 6e 5f 69 64 2c 74 65 73 74 6e 61 6d 65 2c 73 un_id,testname,s
08d0: 74 61 74 65 2c 73 74 61 74 75 73 20 46 52 4f 4d tate,status FROM
08e0: 20 74 65 73 74 73 20 57 48 45 52 45 20 72 75 6e tests WHERE run
08f0: 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 _id=? AND testna
0900: 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 me=? AND item_pa
0910: 74 68 3d 3f 3b 22 0a 3b 3b 20 20 20 20 20 20 72 th=?;".;; r
0920: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 un-id test-name
0930: 69 74 65 6d 2d 70 61 74 68 29 0a 3b 3b 20 20 20 item-path).;;
0940: 20 20 72 65 73 29 29 0a 0a 28 64 65 66 69 6e 65 res))..(define
0950: 20 28 72 75 6e 73 3a 74 65 73 74 2d 67 65 74 2d (runs:test-get-
0960: 66 75 6c 6c 2d 70 61 74 68 20 74 65 73 74 29 0a full-path test).
0970: 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 (let* ((testna
0980: 6d 65 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d me (db:test-get-
0990: 74 65 73 74 6e 61 6d 65 20 20 20 74 65 73 74 29 testname test)
09a0: 29 0a 09 20 28 69 74 65 6d 70 61 74 68 20 28 64 ).. (itempath (d
09b0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d b:test-get-item-
09c0: 70 61 74 68 20 74 65 73 74 29 29 29 0a 20 20 20 path test))).
09d0: 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 (conc testname
09e0: 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65 6d (if (equal? item
09f0: 70 61 74 68 20 22 22 29 20 22 22 20 28 63 6f 6e path "") "" (con
0a00: 63 20 22 28 22 20 69 74 65 6d 70 61 74 68 20 22 c "(" itempath "
0a10: 29 22 29 29 29 29 29 0a 0a 0a 28 64 65 66 69 6e )")))))...(defin
0a20: 65 20 28 73 65 74 2d 6d 65 67 61 74 65 73 74 2d e (set-megatest-
0a30: 65 6e 76 2d 76 61 72 73 20 64 62 20 72 75 6e 2d env-vars db run-
0a40: 69 64 29 0a 20 20 28 6c 65 74 20 28 28 6b 65 79 id). (let ((key
0a50: 73 20 28 64 62 2d 67 65 74 2d 6b 65 79 73 20 64 s (db-get-keys d
0a60: 62 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 b))). (for-ea
0a70: 63 68 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 29 ch (lambda (key)
0a80: 0a 09 09 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d ...(sqlite3:for-
0a90: 65 61 63 68 2d 72 6f 77 0a 09 09 20 28 6c 61 6d each-row... (lam
0aa0: 62 64 61 20 28 76 61 6c 29 0a 09 09 20 20 20 28 bda (val)... (
0ab0: 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 73 debug:print 2 "s
0ac0: 65 74 65 6e 76 20 22 20 28 6b 65 79 3a 67 65 74 etenv " (key:get
0ad0: 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79 29 20 -fieldname key)
0ae0: 22 20 22 20 76 61 6c 29 0a 09 09 20 20 20 28 73 " " val)... (s
0af0: 65 74 65 6e 76 20 28 6b 65 79 3a 67 65 74 2d 66 etenv (key:get-f
0b00: 69 65 6c 64 6e 61 6d 65 20 6b 65 79 29 20 76 61 ieldname key) va
0b10: 6c 29 29 0a 09 09 20 64 62 20 0a 09 09 20 28 63 l))... db ... (c
0b20: 6f 6e 63 20 22 53 45 4c 45 43 54 20 22 20 28 6b onc "SELECT " (k
0b30: 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 ey:get-fieldname
0b40: 20 6b 65 79 29 20 22 20 46 52 4f 4d 20 72 75 6e key) " FROM run
0b50: 73 20 57 48 45 52 45 20 69 64 3d 3f 3b 22 29 0a s WHERE id=?;").
0b60: 09 09 20 72 75 6e 2d 69 64 29 29 0a 09 20 20 20 .. run-id))..
0b70: 20 20 20 6b 65 79 73 29 0a 20 20 20 20 3b 3b 20 keys). ;;
0b80: 4c 65 74 73 20 75 73 65 20 74 68 69 73 20 61 73 Lets use this as
0b90: 20 61 6e 20 6f 70 70 6f 72 74 75 6e 69 74 79 20 an opportunity
0ba0: 74 6f 20 70 75 74 20 4d 54 5f 52 55 4e 4e 41 4d to put MT_RUNNAM
0bb0: 45 20 69 6e 20 74 68 65 20 65 6e 76 69 72 6f 6e E in the environ
0bc0: 6d 65 6e 74 0a 20 20 20 20 28 73 71 6c 69 74 65 ment. (sqlite
0bd0: 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 0a 20 3:for-each-row.
0be0: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 72 75 6e (lambda (run
0bf0: 6e 61 6d 65 29 0a 20 20 20 20 20 20 20 28 73 65 name). (se
0c00: 74 65 6e 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 tenv "MT_RUNNAME
0c10: 22 20 72 75 6e 6e 61 6d 65 29 29 0a 20 20 20 20 " runname)).
0c20: 20 64 62 0a 20 20 20 20 20 22 53 45 4c 45 43 54 db. "SELECT
0c30: 20 72 75 6e 6e 61 6d 65 20 46 52 4f 4d 20 72 75 runname FROM ru
0c40: 6e 73 20 57 48 45 52 45 20 69 64 3d 3f 3b 22 0a ns WHERE id=?;".
0c50: 20 20 20 20 20 72 75 6e 2d 69 64 29 0a 20 20 20 run-id).
0c60: 20 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 73 65 ))..(define (se
0c70: 74 2d 69 74 65 6d 2d 65 6e 76 2d 76 61 72 73 20 t-item-env-vars
0c80: 69 74 65 6d 64 61 74 29 0a 20 20 28 66 6f 72 2d itemdat). (for-
0c90: 65 61 63 68 20 28 6c 61 6d 62 64 61 20 28 69 74 each (lambda (it
0ca0: 65 6d 29 0a 09 20 20 20 20 20 20 28 64 65 62 75 em).. (debu
0cb0: 67 3a 70 72 69 6e 74 20 32 20 22 73 65 74 65 6e g:print 2 "seten
0cc0: 76 20 22 20 28 63 61 72 20 69 74 65 6d 29 20 22 v " (car item) "
0cd0: 20 22 20 28 63 61 64 72 20 69 74 65 6d 29 29 0a " (cadr item)).
0ce0: 09 20 20 20 20 20 20 28 73 65 74 65 6e 76 20 28 . (setenv (
0cf0: 63 61 72 20 69 74 65 6d 29 20 28 63 61 64 72 20 car item) (cadr
0d00: 69 74 65 6d 29 29 29 0a 09 20 20 20 20 69 74 65 item))).. ite
0d10: 6d 64 61 74 29 29 0a 0a 28 64 65 66 69 6e 65 20 mdat))..(define
0d20: 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f (runs:can-run-mo
0d30: 72 65 2d 74 65 73 74 73 20 64 62 20 74 65 73 74 re-tests db test
0d40: 2d 72 65 63 6f 72 64 29 0a 20 20 28 6c 65 74 2a -record). (let*
0d50: 20 28 28 74 63 6f 6e 66 69 67 20 20 20 20 20 20 ((tconfig
0d60: 20 20 20 20 20 20 20 20 20 20 20 28 74 65 73 74 (test
0d70: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d s:testqueue-get-
0d80: 74 65 73 74 63 6f 6e 66 69 67 20 74 65 73 74 2d testconfig test-
0d90: 72 65 63 6f 72 64 29 29 0a 09 20 28 6a 6f 62 67 record)).. (jobg
0da0: 72 6f 75 70 20 20 20 20 20 20 20 20 20 20 20 20 roup
0db0: 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b (config-look
0dc0: 75 70 20 74 63 6f 6e 66 69 67 20 22 72 65 71 75 up tconfig "requ
0dd0: 69 72 65 6d 65 6e 74 73 22 20 22 6a 6f 62 67 72 irements" "jobgr
0de0: 6f 75 70 22 29 29 0a 09 20 28 6e 75 6d 2d 72 75 oup")).. (num-ru
0df0: 6e 6e 69 6e 67 20 20 20 20 20 20 20 20 20 20 20 nning
0e00: 20 20 28 64 62 3a 67 65 74 2d 63 6f 75 6e 74 2d (db:get-count-
0e10: 74 65 73 74 73 2d 72 75 6e 6e 69 6e 67 20 64 62 tests-running db
0e20: 29 29 0a 09 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e )).. (num-runnin
0e30: 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 28 64 g-in-jobgroup (d
0e40: 62 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 65 73 74 b:get-count-test
0e50: 73 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 s-running-in-job
0e60: 67 72 6f 75 70 20 64 62 20 6a 6f 62 67 72 6f 75 group db jobgrou
0e70: 70 29 29 0a 09 20 28 6d 61 78 2d 63 6f 6e 63 75 p)).. (max-concu
0e80: 72 72 65 6e 74 2d 6a 6f 62 73 20 20 20 20 20 28 rrent-jobs (
0e90: 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 config-lookup *c
0ea0: 6f 6e 66 69 67 64 61 74 2a 20 22 73 65 74 75 70 onfigdat* "setup
0eb0: 22 20 20 20 20 20 22 6d 61 78 5f 63 6f 6e 63 75 " "max_concu
0ec0: 72 72 65 6e 74 5f 6a 6f 62 73 22 29 29 0a 09 20 rrent_jobs"))..
0ed0: 28 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 (job-group-limit
0ee0: 20 20 20 20 20 20 20 20 20 28 63 6f 6e 66 69 67 (config
0ef0: 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 -lookup *configd
0f00: 61 74 2a 20 22 6a 6f 62 67 72 6f 75 70 73 22 20 at* "jobgroups"
0f10: 6a 6f 62 67 72 6f 75 70 29 29 29 0a 20 20 20 20 jobgroup))).
0f20: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 (debug:print 2 "
0f30: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a max-concurrent-j
0f40: 6f 62 73 3a 20 22 20 6d 61 78 2d 63 6f 6e 63 75 obs: " max-concu
0f50: 72 72 65 6e 74 2d 6a 6f 62 73 20 22 2c 20 6e 75 rrent-jobs ", nu
0f60: 6d 2d 72 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d m-running: " num
0f70: 2d 72 75 6e 6e 69 6e 67 29 0a 20 20 20 20 28 69 -running). (i
0f80: 66 20 28 6e 6f 74 20 28 65 71 3f 20 30 20 2a 67 f (not (eq? 0 *g
0f90: 6c 6f 62 61 6c 65 78 69 74 73 74 61 74 75 73 2a lobalexitstatus*
0fa0: 29 29 0a 09 23 66 0a 09 28 6c 65 74 20 28 28 63 ))..#f..(let ((c
0fb0: 61 6e 2d 6e 6f 74 2d 72 75 6e 2d 6d 6f 72 65 20 an-not-run-more
0fc0: 28 63 6f 6e 64 0a 09 09 09 09 20 3b 3b 20 69 66 (cond..... ;; if
0fd0: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d max-concurrent-
0fe0: 6a 6f 62 73 20 69 73 20 73 65 74 20 61 6e 64 20 jobs is set and
0ff0: 74 68 65 20 6e 75 6d 62 65 72 20 72 75 6e 6e 69 the number runni
1000: 6e 67 20 69 73 20 67 72 65 61 74 65 72 20 0a 09 ng is greater ..
1010: 09 09 09 20 3b 3b 20 74 68 61 6e 20 69 74 20 74 ... ;; than it t
1020: 68 61 6e 20 63 61 6e 6e 6f 74 20 72 75 6e 20 6d han cannot run m
1030: 6f 72 65 20 6a 6f 62 73 0a 09 09 09 09 20 28 28 ore jobs..... ((
1040: 61 6e 64 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 and max-concurre
1050: 6e 74 2d 6a 6f 62 73 0a 09 09 09 09 20 20 20 20 nt-jobs.....
1060: 20 20 20 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 (string->numb
1070: 65 72 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e er max-concurren
1080: 74 2d 6a 6f 62 73 29 0a 09 09 09 09 20 20 20 20 t-jobs).....
1090: 20 20 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e 69 (>= num-runni
10a0: 6e 67 20 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 ng (string->numb
10b0: 65 72 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e er max-concurren
10c0: 74 2d 6a 6f 62 73 29 29 29 0a 09 09 09 09 20 20 t-jobs))).....
10d0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
10e0: 57 41 52 4e 49 4e 47 3a 20 4d 61 78 20 72 75 6e WARNING: Max run
10f0: 6e 69 6e 67 20 6a 6f 62 73 20 65 78 63 65 65 64 ning jobs exceed
1100: 65 64 2c 20 63 75 72 72 65 6e 74 20 6e 75 6d 62 ed, current numb
1110: 65 72 20 72 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 er running: " nu
1120: 6d 2d 72 75 6e 6e 69 6e 67 20 0a 09 09 09 09 09 m-running ......
1130: 20 20 20 20 20 20 20 22 2c 20 6d 61 78 5f 63 6f ", max_co
1140: 6e 63 75 72 72 65 6e 74 5f 6a 6f 62 73 3a 20 22 ncurrent_jobs: "
1150: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d max-concurrent-
1160: 6a 6f 62 73 29 0a 09 09 09 09 20 20 23 74 29 0a jobs)..... #t).
1170: 09 09 09 09 20 3b 3b 20 69 66 20 6a 6f 62 2d 67 .... ;; if job-g
1180: 72 6f 75 70 2d 6c 69 6d 69 74 20 69 73 20 73 65 roup-limit is se
1190: 74 20 61 6e 64 20 6e 75 6d 62 65 72 20 6f 66 20 t and number of
11a0: 6a 6f 62 73 20 69 6e 20 74 68 65 20 67 72 6f 75 jobs in the grou
11b0: 70 20 69 73 20 67 72 65 61 74 65 72 0a 09 09 09 p is greater....
11c0: 09 20 3b 3b 20 74 68 61 6e 20 74 68 65 20 6c 69 . ;; than the li
11d0: 6d 69 74 20 74 68 65 6e 20 63 61 6e 6e 6f 74 20 mit then cannot
11e0: 72 75 6e 20 6d 6f 72 65 20 6a 6f 62 73 20 6f 66 run more jobs of
11f0: 20 74 68 69 73 20 6b 69 6e 64 0a 09 09 09 09 20 this kind.....
1200: 28 28 61 6e 64 20 6a 6f 62 2d 67 72 6f 75 70 2d ((and job-group-
1210: 6c 69 6d 69 74 0a 09 09 09 09 20 20 20 20 20 20 limit.....
1220: 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 (>= num-running
1230: 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 6a 6f 62 -in-jobgroup job
1240: 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 29 29 0a 09 -group-limit))..
1250: 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e ... (debug:prin
1260: 74 20 31 20 22 57 41 52 4e 49 4e 47 3a 20 6e 75 t 1 "WARNING: nu
1270: 6d 62 65 72 20 6f 66 20 6a 6f 62 73 20 22 20 6e mber of jobs " n
1280: 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f um-running-in-jo
1290: 62 67 72 6f 75 70 20 0a 09 09 09 09 09 20 20 20 bgroup ......
12a0: 20 20 20 20 22 20 69 6e 20 22 20 6a 6f 62 67 72 " in " jobgr
12b0: 6f 75 70 20 22 20 65 78 63 65 65 64 65 64 2c 20 oup " exceeded,
12c0: 77 69 6c 6c 20 6e 6f 74 20 72 75 6e 20 22 20 28 will not run " (
12d0: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d tests:testqueue-
12e0: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 get-testname tes
12f0: 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 09 09 20 t-record)).....
1300: 20 23 74 29 0a 09 09 09 09 20 28 65 6c 73 65 20 #t)..... (else
1310: 23 66 29 29 29 29 0a 09 20 20 28 6e 6f 74 20 63 #f)))).. (not c
1320: 61 6e 2d 6e 6f 74 2d 72 75 6e 2d 6d 6f 72 65 29 an-not-run-more)
1330: 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d ))))..;;========
1340: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1350: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1360: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1370: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b ==============.;
1380: 3b 20 4e 65 77 20 6d 65 74 68 6f 64 6f 6c 6f 67 ; New methodolog
1390: 79 2e 20 54 68 65 73 65 20 72 6f 75 74 69 6e 65 y. These routine
13a0: 73 20 77 69 6c 6c 20 72 65 70 6c 61 63 65 20 74 s will replace t
13b0: 68 65 20 61 62 6f 76 65 20 69 6e 20 74 69 6d 65 he above in time
13c0: 2e 20 46 6f 72 0a 3b 3b 20 6e 6f 77 20 74 68 65 . For.;; now the
13d0: 20 63 6f 64 65 20 69 73 20 64 75 70 6c 69 63 61 code is duplica
13e0: 74 65 64 2e 20 54 68 69 73 20 73 74 75 66 66 20 ted. This stuff
13f0: 69 73 20 69 6e 69 74 69 61 6c 6c 79 20 75 73 65 is initially use
1400: 64 20 69 6e 20 74 68 65 20 6d 6f 6e 69 74 6f 72 d in the monitor
1410: 0a 3b 3b 20 62 61 73 65 64 20 63 6f 64 65 2e 0a .;; based code..
1420: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;;==============
1430: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1440: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1450: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1460: 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 72 65 67 ========..;; reg
1470: 69 73 74 65 72 20 61 20 74 65 73 74 20 72 75 6e ister a test run
1480: 20 77 69 74 68 20 74 68 65 20 64 62 0a 28 64 65 with the db.(de
1490: 66 69 6e 65 20 28 72 75 6e 73 3a 72 65 67 69 73 fine (runs:regis
14a0: 74 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 ter-run db keys
14b0: 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d keyvallst runnam
14c0: 65 20 73 74 61 74 65 20 73 74 61 74 75 73 20 75 e state status u
14d0: 73 65 72 29 0a 20 20 28 64 65 62 75 67 3a 70 72 ser). (debug:pr
14e0: 69 6e 74 20 33 20 22 72 75 6e 73 3a 72 65 67 69 int 3 "runs:regi
14f0: 73 74 65 72 2d 72 75 6e 2c 20 6b 65 79 73 3a 20 ster-run, keys:
1500: 22 20 6b 65 79 73 20 22 20 6b 65 79 76 61 6c 6c " keys " keyvall
1510: 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 20 st: " keyvallst
1520: 22 20 72 75 6e 6e 61 6d 65 3a 20 22 20 72 75 6e " runname: " run
1530: 6e 61 6d 65 20 22 20 73 74 61 74 65 3a 20 22 20 name " state: "
1540: 73 74 61 74 65 20 22 20 73 74 61 74 75 73 3a 20 state " status:
1550: 22 20 73 74 61 74 75 73 20 22 20 75 73 65 72 3a " status " user:
1560: 20 22 20 75 73 65 72 29 0a 20 20 28 6c 65 74 2a " user). (let*
1570: 20 28 28 6b 65 79 73 74 72 20 20 20 20 28 6b 65 ((keystr (ke
1580: 79 73 2d 3e 6b 65 79 73 74 72 20 6b 65 79 73 29 ys->keystr keys)
1590: 29 0a 09 20 28 63 6f 6d 6d 61 20 20 20 20 20 28 ).. (comma (
15a0: 69 66 20 28 3e 20 28 6c 65 6e 67 74 68 20 6b 65 if (> (length ke
15b0: 79 73 29 20 30 29 20 22 2c 22 20 22 22 29 29 0a ys) 0) "," "")).
15c0: 09 20 28 61 6e 64 73 74 72 20 20 20 20 28 69 66 . (andstr (if
15d0: 20 28 3e 20 28 6c 65 6e 67 74 68 20 6b 65 79 73 (> (length keys
15e0: 29 20 30 29 20 22 20 41 4e 44 20 22 20 22 22 29 ) 0) " AND " "")
15f0: 29 0a 09 20 28 76 61 6c 73 6c 6f 74 73 20 20 28 ).. (valslots (
1600: 6b 65 79 73 2d 3e 76 61 6c 73 6c 6f 74 73 20 6b keys->valslots k
1610: 65 79 73 29 29 20 3b 3b 20 3f 2c 3f 2c 3f 20 2e eys)) ;; ?,?,? .
1620: 2e 2e 0a 09 20 28 6b 65 79 76 61 6c 73 20 20 20 .... (keyvals
1630: 28 6d 61 70 20 63 61 64 72 20 6b 65 79 76 61 6c (map cadr keyval
1640: 6c 73 74 29 29 0a 09 20 28 61 6c 6c 76 61 6c 73 lst)).. (allvals
1650: 20 20 20 28 61 70 70 65 6e 64 20 28 6c 69 73 74 (append (list
1660: 20 72 75 6e 6e 61 6d 65 20 73 74 61 74 65 20 73 runname state s
1670: 74 61 74 75 73 20 75 73 65 72 29 20 6b 65 79 76 tatus user) keyv
1680: 61 6c 73 29 29 0a 09 20 28 71 72 79 76 61 6c 73 als)).. (qryvals
1690: 20 20 20 28 61 70 70 65 6e 64 20 28 6c 69 73 74 (append (list
16a0: 20 72 75 6e 6e 61 6d 65 29 20 6b 65 79 76 61 6c runname) keyval
16b0: 73 29 29 0a 09 20 28 6b 65 79 3d 3f 73 74 72 20 s)).. (key=?str
16c0: 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 (string-intersp
16d0: 65 72 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 erse (map (lambd
16e0: 61 20 28 6b 29 28 63 6f 6e 63 20 28 6b 65 79 3a a (k)(conc (key:
16f0: 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 29 get-fieldname k)
1700: 20 22 3d 3f 22 29 29 20 6b 65 79 73 29 20 22 20 "=?")) keys) "
1710: 41 4e 44 20 22 29 29 29 0a 20 20 20 20 28 64 65 AND "))). (de
1720: 62 75 67 3a 70 72 69 6e 74 20 33 20 22 6b 65 79 bug:print 3 "key
1730: 73 3a 20 22 20 6b 65 79 73 20 22 20 61 6c 6c 76 s: " keys " allv
1740: 61 6c 73 3a 20 22 20 61 6c 6c 76 61 6c 73 20 22 als: " allvals "
1750: 20 6b 65 79 76 61 6c 73 3a 20 22 20 6b 65 79 76 keyvals: " keyv
1760: 61 6c 73 29 0a 20 20 20 20 28 64 65 62 75 67 3a als). (debug:
1770: 70 72 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 75 print 2 "NOTE: u
1780: 73 69 6e 67 20 74 61 72 67 65 74 20 22 20 28 73 sing target " (s
1790: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 tring-interspers
17a0: 65 20 6b 65 79 76 61 6c 73 20 22 2f 22 29 20 22 e keyvals "/") "
17b0: 20 66 6f 72 20 74 68 69 73 20 72 75 6e 22 29 0a for this run").
17c0: 20 20 20 20 28 69 66 20 28 61 6e 64 20 72 75 6e (if (and run
17d0: 6e 61 6d 65 20 28 6e 75 6c 6c 3f 20 28 66 69 6c name (null? (fil
17e0: 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29 28 ter (lambda (x)(
17f0: 6e 6f 74 20 78 29 29 20 6b 65 79 76 61 6c 73 29 not x)) keyvals)
1800: 29 29 20 3b 3b 20 74 68 65 72 65 20 6d 75 73 74 )) ;; there must
1810: 20 62 65 20 61 20 62 65 74 74 65 72 20 77 61 79 be a better way
1820: 20 74 6f 20 22 61 70 70 6c 79 20 61 6e 64 22 0a to "apply and".
1830: 09 28 6c 65 74 20 28 28 72 65 73 20 23 66 29 29 .(let ((res #f))
1840: 0a 09 20 20 28 61 70 70 6c 79 20 73 71 6c 69 74 .. (apply sqlit
1850: 65 33 3a 65 78 65 63 75 74 65 20 64 62 20 28 63 e3:execute db (c
1860: 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 49 onc "INSERT OR I
1870: 47 4e 4f 52 45 20 49 4e 54 4f 20 72 75 6e 73 20 GNORE INTO runs
1880: 28 72 75 6e 6e 61 6d 65 2c 73 74 61 74 65 2c 73 (runname,state,s
1890: 74 61 74 75 73 2c 6f 77 6e 65 72 2c 65 76 65 6e tatus,owner,even
18a0: 74 5f 74 69 6d 65 22 20 63 6f 6d 6d 61 20 6b 65 t_time" comma ke
18b0: 79 73 74 72 20 22 29 20 56 41 4c 55 45 53 20 28 ystr ") VALUES (
18c0: 3f 2c 3f 2c 3f 2c 3f 2c 73 74 72 66 74 69 6d 65 ?,?,?,?,strftime
18d0: 28 27 25 73 27 2c 27 6e 6f 77 27 29 22 20 63 6f ('%s','now')" co
18e0: 6d 6d 61 20 76 61 6c 73 6c 6f 74 73 20 22 29 3b mma valslots ");
18f0: 22 29 0a 09 09 20 61 6c 6c 76 61 6c 73 29 0a 09 ")... allvals)..
1900: 20 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 33 (apply sqlite3
1910: 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 20 0a 09 :for-each-row ..
1920: 20 20 20 28 6c 61 6d 62 64 61 20 28 69 64 29 0a (lambda (id).
1930: 09 20 20 20 20 20 28 73 65 74 21 20 72 65 73 20 . (set! res
1940: 69 64 29 29 0a 09 20 20 20 64 62 0a 09 20 20 20 id)).. db..
1950: 28 6c 65 74 20 28 28 71 72 79 20 28 63 6f 6e 63 (let ((qry (conc
1960: 20 22 53 45 4c 45 43 54 20 69 64 20 46 52 4f 4d "SELECT id FROM
1970: 20 72 75 6e 73 20 57 48 45 52 45 20 28 72 75 6e runs WHERE (run
1980: 6e 61 6d 65 3d 3f 20 22 20 61 6e 64 73 74 72 20 name=? " andstr
1990: 6b 65 79 3d 3f 73 74 72 20 22 29 3b 22 29 29 29 key=?str ");")))
19a0: 0a 09 20 20 20 20 20 3b 28 64 65 62 75 67 3a 70 .. ;(debug:p
19b0: 72 69 6e 74 20 34 20 22 71 72 79 3a 20 22 20 71 rint 4 "qry: " q
19c0: 72 79 29 20 0a 09 20 20 20 20 20 71 72 79 29 0a ry) .. qry).
19d0: 09 20 20 20 71 72 79 76 61 6c 73 29 0a 09 20 20 . qryvals)..
19e0: 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 (sqlite3:execute
19f0: 20 64 62 20 22 55 50 44 41 54 45 20 72 75 6e 73 db "UPDATE runs
1a00: 20 53 45 54 20 73 74 61 74 65 3d 3f 2c 73 74 61 SET state=?,sta
1a10: 74 75 73 3d 3f 20 57 48 45 52 45 20 69 64 3d 3f tus=? WHERE id=?
1a20: 3b 22 20 73 74 61 74 65 20 73 74 61 74 75 73 20 ;" state status
1a30: 72 65 73 29 0a 09 20 20 72 65 73 29 20 0a 09 28 res).. res) ..(
1a40: 62 65 67 69 6e 0a 09 20 20 28 64 65 62 75 67 3a begin.. (debug:
1a50: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 print 0 "ERROR:
1a60: 43 61 6c 6c 65 64 20 77 69 74 68 6f 75 74 20 61 Called without a
1a70: 6c 6c 20 6e 65 63 65 73 73 61 72 79 20 6b 65 79 ll necessary key
1a80: 73 22 29 0a 09 20 20 23 66 29 29 29 29 0a 0a 3b s").. #f))))..;
1a90: 3b 20 54 68 69 73 20 69 73 20 61 20 64 75 70 6c ; This is a dupl
1aa0: 69 63 61 74 65 20 6f 66 20 72 75 6e 2d 74 65 73 icate of run-tes
1ab0: 74 73 20 28 77 68 69 63 68 20 68 61 73 20 62 65 ts (which has be
1ac0: 65 6e 20 64 65 70 72 65 63 61 74 65 64 29 2e 20 en deprecated).
1ad0: 55 73 65 20 74 68 69 73 20 6f 6e 65 20 69 6e 73 Use this one ins
1ae0: 74 65 61 64 20 6f 66 20 72 75 6e 20 74 65 73 74 tead of run test
1af0: 73 2e 0a 3b 3b 20 6b 65 79 76 61 6c 73 0a 28 64 s..;; keyvals.(d
1b00: 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 75 6e 2d efine (runs:run-
1b10: 74 65 73 74 73 20 64 62 20 74 61 72 67 65 74 20 tests db target
1b20: 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d 70 61 74 runname test-pat
1b30: 74 73 20 69 74 65 6d 2d 70 61 74 74 73 20 75 73 ts item-patts us
1b40: 65 72 20 66 6c 61 67 73 29 0a 20 20 28 6c 65 74 er flags). (let
1b50: 2a 20 28 28 6b 65 79 73 20 20 20 20 20 20 20 20 * ((keys
1b60: 28 64 62 2d 67 65 74 2d 6b 65 79 73 20 64 62 29 (db-get-keys db)
1b70: 29 0a 09 20 28 6b 65 79 76 61 6c 6c 73 74 20 20 ).. (keyvallst
1b80: 20 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 3e 6b (keys:target->k
1b90: 65 79 76 61 6c 20 6b 65 79 73 20 74 61 72 67 65 eyval keys targe
1ba0: 74 29 29 0a 09 20 28 72 75 6e 2d 69 64 20 20 20 t)).. (run-id
1bb0: 20 20 20 28 72 75 6e 73 3a 72 65 67 69 73 74 65 (runs:registe
1bc0: 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 r-run db keys ke
1bd0: 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 yvallst runname
1be0: 22 6e 65 77 22 20 22 6e 2f 61 22 20 75 73 65 72 "new" "n/a" user
1bf0: 29 29 20 20 3b 3b 20 20 74 65 73 74 2d 6e 61 6d )) ;; test-nam
1c00: 65 29 29 29 0a 09 20 28 64 65 66 65 72 72 65 64 e))).. (deferred
1c10: 20 20 20 20 27 28 29 29 20 3b 3b 20 64 65 6c 61 '()) ;; dela
1c20: 79 20 72 75 6e 6e 69 6e 67 20 74 68 65 73 65 20 y running these
1c30: 73 69 6e 63 65 20 74 68 65 79 20 68 61 76 65 20 since they have
1c40: 61 20 77 61 69 74 6f 6e 20 63 6c 61 75 73 65 0a a waiton clause.
1c50: 09 20 3b 3b 20 6b 65 65 70 67 6f 69 6e 67 20 69 . ;; keepgoing i
1c60: 73 20 74 68 65 20 64 65 66 61 63 74 6f 20 6d 6f s the defacto mo
1c70: 64 61 6c 69 74 79 20 6e 6f 77 2c 20 77 69 6c 6c dality now, will
1c80: 20 61 64 64 20 68 69 74 2d 6e 2d 72 75 6e 20 61 add hit-n-run a
1c90: 20 62 69 74 20 6c 61 74 65 72 0a 09 20 3b 3b 20 bit later.. ;;
1ca0: 28 6b 65 65 70 67 6f 69 6e 67 20 20 20 28 68 61 (keepgoing (ha
1cb0: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 sh-table-ref/def
1cc0: 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 65 ault flags "-kee
1cd0: 70 67 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 28 pgoing" #f)).. (
1ce0: 74 65 73 74 2d 6e 61 6d 65 73 20 20 27 28 29 29 test-names '())
1cf0: 0a 09 20 28 72 75 6e 63 6f 6e 66 69 67 66 20 20 .. (runconfigf
1d00: 20 28 63 6f 6e 63 20 20 2a 74 6f 70 70 61 74 68 (conc *toppath
1d10: 2a 20 22 2f 72 75 6e 63 6f 6e 66 69 67 73 2e 63 * "/runconfigs.c
1d20: 6f 6e 66 69 67 22 29 29 0a 09 20 28 72 65 71 75 onfig")).. (requ
1d30: 69 72 65 64 2d 74 65 73 74 73 20 27 28 29 29 0a ired-tests '()).
1d40: 09 20 28 74 65 73 74 2d 72 65 63 6f 72 64 73 20 . (test-records
1d50: 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 (make-hash-table
1d60: 29 29 29 0a 0a 20 20 20 20 28 73 65 74 2d 6d 65 ))).. (set-me
1d70: 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 gatest-env-vars
1d80: 64 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 db run-id) ;; th
1d90: 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 ese may be neede
1da0: 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 d by the launchi
1db0: 6e 67 20 70 72 6f 63 65 73 73 0a 0a 20 20 20 20 ng process..
1dc0: 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 (if (file-exists
1dd0: 3f 20 72 75 6e 63 6f 6e 66 69 67 66 29 0a 09 28 ? runconfigf)..(
1de0: 73 65 74 75 70 2d 65 6e 76 2d 64 65 66 61 75 6c setup-env-defaul
1df0: 74 73 20 64 62 20 72 75 6e 63 6f 6e 66 69 67 66 ts db runconfigf
1e00: 20 72 75 6e 2d 69 64 20 2a 61 6c 72 65 61 64 79 run-id *already
1e10: 2d 73 65 65 6e 2d 72 75 6e 63 6f 6e 66 69 67 2d -seen-runconfig-
1e20: 69 6e 66 6f 2a 20 22 70 72 65 2d 6c 61 75 6e 63 info* "pre-launc
1e30: 68 2d 65 6e 76 2d 76 61 72 73 22 29 0a 09 28 64 h-env-vars")..(d
1e40: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 ebug:print 0 "WA
1e50: 52 4e 49 4e 47 3a 20 59 6f 75 20 64 6f 20 6e 6f RNING: You do no
1e60: 74 20 68 61 76 65 20 61 20 72 75 6e 20 63 6f 6e t have a run con
1e70: 66 69 67 20 66 69 6c 65 3a 20 22 20 72 75 6e 63 fig file: " runc
1e80: 6f 6e 66 69 67 66 29 29 0a 20 20 20 20 0a 20 20 onfigf)). .
1e90: 20 20 3b 3b 20 6c 6f 6f 6b 20 75 70 20 61 6c 6c ;; look up all
1ea0: 20 74 65 73 74 73 20 6d 61 74 63 68 69 6e 67 20 tests matching
1eb0: 74 68 65 20 63 6f 6d 6d 61 20 73 65 70 61 72 61 the comma separa
1ec0: 74 65 64 20 6c 69 73 74 20 6f 66 20 67 6c 6f 62 ted list of glob
1ed0: 73 20 69 6e 0a 20 20 20 20 3b 3b 20 74 65 73 74 s in. ;; test
1ee0: 2d 70 61 74 74 73 20 28 75 73 69 6e 67 20 25 20 -patts (using %
1ef0: 61 73 20 77 69 6c 64 63 61 72 64 29 0a 20 20 20 as wildcard).
1f00: 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 (for-each .
1f10: 20 28 6c 61 6d 62 64 61 20 28 70 61 74 74 29 0a (lambda (patt).
1f20: 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 74 65 (let ((te
1f30: 73 74 73 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20 sts (glob (conc
1f40: 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74 *toppath* "/test
1f50: 73 2f 22 20 28 73 74 72 69 6e 67 2d 74 72 61 6e s/" (string-tran
1f60: 73 6c 61 74 65 20 70 61 74 74 20 22 25 22 20 22 slate patt "%" "
1f70: 2a 22 29 29 29 29 29 0a 09 20 28 73 65 74 21 20 *"))))).. (set!
1f80: 74 65 73 74 73 20 28 66 69 6c 74 65 72 20 28 6c tests (filter (l
1f90: 61 6d 62 64 61 20 28 74 65 73 74 29 28 66 69 6c ambda (test)(fil
1fa0: 65 2d 65 78 69 73 74 73 3f 20 28 63 6f 6e 63 20 e-exists? (conc
1fb0: 74 65 73 74 20 22 2f 74 65 73 74 63 6f 6e 66 69 test "/testconfi
1fc0: 67 22 29 29 29 20 74 65 73 74 73 29 29 0a 09 20 g"))) tests))..
1fd0: 28 73 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 (set! test-names
1fe0: 20 28 61 70 70 65 6e 64 20 74 65 73 74 2d 6e 61 (append test-na
1ff0: 6d 65 73 20 0a 09 09 09 09 20 20 28 6d 61 70 20 mes ..... (map
2000: 28 6c 61 6d 62 64 61 20 28 74 65 73 74 70 29 0a (lambda (testp).
2010: 09 09 09 09 09 20 28 6c 61 73 74 20 28 73 74 72 ..... (last (str
2020: 69 6e 67 2d 73 70 6c 69 74 20 74 65 73 74 70 20 ing-split testp
2030: 22 2f 22 29 29 29 0a 09 09 09 09 20 20 20 20 20 "/"))).....
2040: 20 20 74 65 73 74 73 29 29 29 29 29 0a 20 20 20 tests))))).
2050: 20 20 28 69 66 20 74 65 73 74 2d 70 61 74 74 73 (if test-patts
2060: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 74 (string-split t
2070: 65 73 74 2d 70 61 74 74 73 20 22 2c 22 29 28 6c est-patts ",")(l
2080: 69 73 74 20 22 25 22 29 29 29 0a 0a 20 20 20 20 ist "%")))..
2090: 20 3b 3b 20 6e 6f 77 20 72 65 6d 6f 76 65 20 64 ;; now remove d
20a0: 75 70 6c 69 63 61 74 65 73 0a 20 20 20 20 28 73 uplicates. (s
20b0: 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 28 et! test-names (
20c0: 64 65 6c 65 74 65 2d 64 75 70 6c 69 63 61 74 65 delete-duplicate
20d0: 73 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 0a s test-names))..
20e0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
20f0: 20 30 20 22 49 4e 46 4f 3a 20 74 65 73 74 20 6e 0 "INFO: test n
2100: 61 6d 65 73 20 22 20 74 65 73 74 2d 6e 61 6d 65 ames " test-name
2110: 73 29 0a 0a 20 20 20 20 3b 3b 20 6f 6e 20 74 68 s).. ;; on th
2120: 65 20 66 69 72 73 74 20 70 61 73 73 20 6f 72 20 e first pass or
2130: 63 61 6c 6c 20 74 6f 20 72 75 6e 2d 74 65 73 74 call to run-test
2140: 73 20 73 65 74 20 46 41 49 4c 53 20 74 6f 20 4e s set FAILS to N
2150: 4f 54 5f 53 54 41 52 54 45 44 20 69 66 0a 20 20 OT_STARTED if.
2160: 20 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 20 ;; -keepgoing
2170: 69 73 20 73 70 65 63 69 66 69 65 64 0a 20 20 20 is specified.
2180: 20 28 69 66 20 28 65 71 3f 20 2a 70 61 73 73 6e (if (eq? *passn
2190: 75 6d 2a 20 30 29 0a 09 28 62 65 67 69 6e 0a 09 um* 0)..(begin..
21a0: 20 20 3b 3b 20 68 61 76 65 20 74 6f 20 64 65 6c ;; have to del
21b0: 65 74 65 20 74 65 73 74 20 72 65 63 6f 72 64 73 ete test records
21c0: 20 77 68 65 72 65 20 4e 4f 54 5f 53 54 41 52 54 where NOT_START
21d0: 45 44 20 73 69 6e 63 65 20 74 68 65 79 20 63 61 ED since they ca
21e0: 6e 20 63 61 75 73 65 20 2d 6b 65 65 70 67 6f 69 n cause -keepgoi
21f0: 6e 67 20 74 6f 20 0a 09 20 20 3b 3b 20 67 65 74 ng to .. ;; get
2200: 20 73 74 75 63 6b 20 64 75 65 20 74 6f 20 62 65 stuck due to be
2210: 63 6f 6d 69 6e 67 20 69 6e 61 63 63 65 73 73 69 coming inaccessi
2220: 62 6c 65 20 66 72 6f 6d 20 61 20 66 61 69 6c 65 ble from a faile
2230: 64 20 74 65 73 74 2e 20 49 2e 65 2e 20 69 66 20 d test. I.e. if
2240: 74 65 73 74 20 42 20 64 65 70 65 6e 64 73 20 0a test B depends .
2250: 09 20 20 3b 3b 20 6f 6e 20 74 65 73 74 20 41 20 . ;; on test A
2260: 62 75 74 20 74 65 73 74 20 42 20 72 65 61 63 68 but test B reach
2270: 65 64 20 74 68 65 20 70 6f 69 6e 74 20 6f 6e 20 ed the point on
2280: 62 65 69 6e 67 20 72 65 67 69 73 74 65 72 65 64 being registered
2290: 20 61 73 20 4e 4f 54 5f 53 54 41 52 54 45 44 20 as NOT_STARTED
22a0: 61 6e 64 20 74 65 73 74 0a 09 20 20 3b 3b 20 41 and test.. ;; A
22b0: 20 66 61 69 6c 65 64 20 66 6f 72 20 73 6f 6d 65 failed for some
22c0: 20 72 65 61 73 6f 6e 20 74 68 65 6e 20 6f 6e 20 reason then on
22d0: 72 65 2d 72 75 6e 20 75 73 69 6e 67 20 2d 6b 65 re-run using -ke
22e0: 65 70 67 6f 69 6e 67 20 74 68 65 20 72 75 6e 20 epgoing the run
22f0: 63 61 6e 20 6e 65 76 65 72 20 63 6f 6d 70 6c 65 can never comple
2300: 74 65 2e 0a 09 20 20 28 64 62 3a 64 65 6c 65 74 te... (db:delet
2310: 65 2d 74 65 73 74 73 2d 69 6e 2d 73 74 61 74 65 e-tests-in-state
2320: 20 64 62 20 72 75 6e 2d 69 64 20 22 4e 4f 54 5f db run-id "NOT_
2330: 53 54 41 52 54 45 44 22 29 0a 09 20 20 28 72 64 STARTED").. (rd
2340: 62 3a 73 65 74 2d 74 65 73 74 73 2d 73 74 61 74 b:set-tests-stat
2350: 65 2d 73 74 61 74 75 73 20 64 62 20 72 75 6e 2d e-status db run-
2360: 69 64 20 74 65 73 74 2d 6e 61 6d 65 73 20 23 66 id test-names #f
2370: 20 22 46 41 49 4c 22 20 22 4e 4f 54 5f 53 54 41 "FAIL" "NOT_STA
2380: 52 54 45 44 22 20 22 46 41 49 4c 22 29 29 29 0a RTED" "FAIL"))).
2390: 0a 20 20 20 20 3b 3b 20 6e 6f 77 20 61 64 64 20 . ;; now add
23a0: 6e 6f 6e 2d 64 69 72 65 63 74 6c 79 20 72 65 66 non-directly ref
23b0: 65 72 65 6e 63 65 64 20 64 65 70 65 6e 64 65 6e erenced dependen
23c0: 63 69 65 73 20 28 69 2e 65 2e 20 77 61 69 74 6f cies (i.e. waito
23d0: 6e 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 n). (if (not
23e0: 28 6e 75 6c 6c 3f 20 74 65 73 74 2d 6e 61 6d 65 (null? test-name
23f0: 73 29 29 0a 09 28 6c 65 74 20 6c 6f 6f 70 20 28 s))..(let loop (
2400: 28 68 65 64 20 28 63 61 72 20 74 65 73 74 2d 6e (hed (car test-n
2410: 61 6d 65 73 29 29 0a 09 09 20 20 20 28 74 61 6c ames))... (tal
2420: 20 28 63 64 72 20 74 65 73 74 2d 6e 61 6d 65 73 (cdr test-names
2430: 29 29 29 20 20 20 20 20 20 20 20 20 3b 3b 20 27 ))) ;; '
2440: 72 65 74 75 72 6e 2d 70 72 6f 63 73 20 74 65 6c return-procs tel
2450: 6c 73 20 74 68 65 20 63 6f 6e 66 69 67 20 72 65 ls the config re
2460: 61 64 65 72 20 74 6f 20 70 72 65 70 20 72 75 6e ader to prep run
2470: 6e 69 6e 67 20 73 79 73 74 65 6d 20 62 75 74 20 ning system but
2480: 72 65 74 75 72 6e 20 61 20 70 72 6f 63 0a 09 20 return a proc..
2490: 20 28 6c 65 74 2a 20 28 28 63 6f 6e 66 69 67 20 (let* ((config
24a0: 20 28 74 65 73 74 3a 67 65 74 2d 74 65 73 74 63 (test:get-testc
24b0: 6f 6e 66 69 67 20 68 65 64 20 27 72 65 74 75 72 onfig hed 'retur
24c0: 6e 2d 70 72 6f 63 73 29 29 0a 09 09 20 28 77 61 n-procs))... (wa
24d0: 69 74 6f 6e 73 20 28 73 74 72 69 6e 67 2d 73 70 itons (string-sp
24e0: 6c 69 74 20 28 6c 65 74 20 28 28 77 20 28 63 6f lit (let ((w (co
24f0: 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66 nfig-lookup conf
2500: 69 67 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73 ig "requirements
2510: 22 20 22 77 61 69 74 6f 6e 22 29 29 29 0a 09 09 " "waiton")))...
2520: 09 09 09 20 20 28 69 66 20 77 20 77 20 22 22 29 ... (if w w "")
2530: 29 29 29 29 0a 09 20 20 20 20 3b 3b 20 28 69 74 )))).. ;; (it
2540: 65 6d 73 20 20 20 28 69 74 65 6d 73 3a 67 65 74 ems (items:get
2550: 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 -items-from-conf
2560: 69 67 20 63 6f 6e 66 69 67 29 29 29 0a 09 20 20 ig config)))..
2570: 20 20 28 69 66 20 28 6e 6f 74 20 28 68 61 73 68 (if (not (hash
2580: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 -table-ref/defau
2590: 6c 74 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 lt test-records
25a0: 68 65 64 20 23 66 29 29 0a 09 09 28 68 61 73 68 hed #f))...(hash
25b0: 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 65 73 74 -table-set! test
25c0: 2d 72 65 63 6f 72 64 73 0a 09 09 09 09 20 68 65 -records..... he
25d0: 64 20 28 76 65 63 74 6f 72 20 68 65 64 20 20 20 d (vector hed
25e0: 20 20 3b 3b 20 30 0a 09 09 09 09 09 20 20 20 20 ;; 0......
25f0: 20 63 6f 6e 66 69 67 20 20 3b 3b 20 31 0a 09 09 config ;; 1...
2600: 09 09 09 20 20 20 20 20 77 61 69 74 6f 6e 73 20 ... waitons
2610: 3b 3b 20 32 0a 09 09 09 09 09 20 20 20 20 20 28 ;; 2...... (
2620: 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 63 6f config-lookup co
2630: 6e 66 69 67 20 22 72 65 71 75 69 72 65 6d 65 6e nfig "requiremen
2640: 74 73 22 20 22 70 72 69 6f 72 69 74 79 22 29 20 ts" "priority")
2650: 20 20 20 20 3b 3b 20 70 72 69 6f 72 69 74 79 20 ;; priority
2660: 33 0a 09 09 09 09 09 20 20 20 20 20 28 6c 65 74 3...... (let
2670: 20 28 28 69 74 65 6d 73 20 20 20 20 20 20 28 68 ((items (h
2680: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 ash-table-ref/de
2690: 66 61 75 6c 74 20 63 6f 6e 66 69 67 20 22 69 74 fault config "it
26a0: 65 6d 73 22 20 23 66 29 29 20 3b 3b 20 69 74 65 ems" #f)) ;; ite
26b0: 6d 73 20 34 0a 09 09 09 09 09 09 20 20 20 28 69 ms 4....... (i
26c0: 74 65 6d 73 74 61 62 6c 65 20 28 68 61 73 68 2d temstable (hash-
26d0: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c table-ref/defaul
26e0: 74 20 63 6f 6e 66 69 67 20 22 69 74 65 6d 73 74 t config "itemst
26f0: 61 62 6c 65 22 20 23 66 29 29 29 20 0a 09 09 09 able" #f))) ....
2700: 09 09 20 20 20 20 20 20 20 3b 3b 20 69 66 20 65 .. ;; if e
2710: 69 74 68 65 72 20 69 74 65 6d 73 20 6f 72 20 69 ither items or i
2720: 74 65 6d 73 20 74 61 62 6c 65 20 69 73 20 61 20 tems table is a
2730: 70 72 6f 63 20 72 65 74 75 72 6e 20 69 74 20 73 proc return it s
2740: 6f 20 74 65 73 74 20 72 75 6e 6e 69 6e 67 0a 09 o test running..
2750: 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20 70 72 .... ;; pr
2760: 6f 63 65 73 73 20 63 61 6e 20 6b 6e 6f 77 20 74 ocess can know t
2770: 6f 20 63 61 6c 6c 20 69 74 65 6d 73 3a 67 65 74 o call items:get
2780: 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 -items-from-conf
2790: 69 67 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b ig...... ;
27a0: 3b 20 69 66 20 65 69 74 68 65 72 20 69 73 20 61 ; if either is a
27b0: 20 6c 69 73 74 20 61 6e 64 20 6e 6f 6e 65 20 69 list and none i
27c0: 73 20 61 20 70 72 6f 63 20 67 6f 20 61 68 65 61 s a proc go ahea
27d0: 64 20 61 6e 64 20 63 61 6c 6c 20 67 65 74 2d 69 d and call get-i
27e0: 74 65 6d 73 0a 09 09 09 09 09 20 20 20 20 20 20 tems......
27f0: 20 3b 3b 20 6f 74 68 65 72 77 69 73 65 20 72 65 ;; otherwise re
2800: 74 75 72 6e 20 23 66 20 2d 20 74 68 69 73 20 69 turn #f - this i
2810: 73 20 6e 6f 74 20 61 6e 20 69 74 65 72 61 74 65 s not an iterate
2820: 64 20 74 65 73 74 0a 09 09 09 09 09 20 20 20 20 d test......
2830: 20 20 20 28 63 6f 6e 64 0a 09 09 09 09 09 09 28 (cond.......(
2840: 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d (procedure? item
2850: 73 29 20 20 20 20 20 20 0a 09 09 09 09 09 09 20 s) .......
2860: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 (debug:print 4 "
2870: 49 4e 46 4f 3a 20 69 74 65 6d 73 20 69 73 20 61 INFO: items is a
2880: 20 70 72 6f 63 65 64 75 72 65 2c 20 77 69 6c 6c procedure, will
2890: 20 63 61 6c 63 20 6c 61 74 65 72 22 29 0a 09 09 calc later")...
28a0: 09 09 09 09 20 69 74 65 6d 73 29 20 20 20 20 20 .... items)
28b0: 20 20 20 20 20 20 20 3b 3b 20 63 61 6c 63 20 6c ;; calc l
28c0: 61 74 65 72 0a 09 09 09 09 09 09 28 28 70 72 6f ater.......((pro
28d0: 63 65 64 75 72 65 3f 20 69 74 65 6d 73 74 61 62 cedure? itemstab
28e0: 6c 65 29 0a 09 09 09 09 09 09 20 28 64 65 62 75 le)....... (debu
28f0: 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a g:print 4 "INFO:
2900: 20 69 74 65 6d 73 74 61 62 6c 65 20 69 73 20 61 itemstable is a
2910: 20 70 72 6f 63 65 64 75 72 65 2c 20 77 69 6c 6c procedure, will
2920: 20 63 61 6c 63 20 6c 61 74 65 72 22 29 0a 09 09 calc later")...
2930: 09 09 09 09 20 69 74 65 6d 73 74 61 62 6c 65 29 .... itemstable)
2940: 20 20 20 20 20 20 20 3b 3b 20 63 61 6c 63 20 6c ;; calc l
2950: 61 74 65 72 0a 09 09 09 09 09 09 28 28 66 69 6c ater.......((fil
2960: 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29 0a ter (lambda (x).
2970: 09 09 09 09 09 09 09 20 20 20 28 6c 65 74 20 28 ....... (let (
2980: 28 76 61 6c 20 28 63 61 72 20 78 29 29 29 0a 09 (val (car x)))..
2990: 09 09 09 09 09 09 20 20 20 20 20 28 69 66 20 28 ...... (if (
29a0: 70 72 6f 63 65 64 75 72 65 3f 20 76 61 6c 29 20 procedure? val)
29b0: 76 61 6c 20 23 66 29 29 29 0a 09 09 09 09 09 09 val #f))).......
29c0: 09 20 28 61 70 70 65 6e 64 20 28 69 66 20 28 6c . (append (if (l
29d0: 69 73 74 3f 20 69 74 65 6d 73 29 20 69 74 65 6d ist? items) item
29e0: 73 20 27 28 29 29 0a 09 09 09 09 09 09 09 09 20 s '()).........
29f0: 28 69 66 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 (if (list? items
2a00: 74 61 62 6c 65 29 20 69 74 65 6d 73 74 61 62 6c table) itemstabl
2a10: 65 20 27 28 29 29 29 29 0a 09 09 09 09 09 09 20 e '()))).......
2a20: 27 68 61 76 65 2d 70 72 6f 63 65 64 75 72 65 29 'have-procedure)
2a30: 0a 09 09 09 09 09 09 28 28 6f 72 20 28 6c 69 73 .......((or (lis
2a40: 74 3f 20 69 74 65 6d 73 29 28 6c 69 73 74 3f 20 t? items)(list?
2a50: 69 74 65 6d 73 74 61 62 6c 65 29 29 20 3b 3b 20 itemstable)) ;;
2a60: 63 61 6c 63 20 6e 6f 77 0a 09 09 09 09 09 09 20 calc now.......
2a70: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 (debug:print 4 "
2a80: 49 4e 46 4f 3a 20 69 74 65 6d 73 20 61 6e 64 20 INFO: items and
2a90: 69 74 65 6d 73 74 61 62 6c 65 20 61 72 65 20 6c itemstable are l
2aa0: 69 73 74 73 2c 20 63 61 6c 63 20 6e 6f 77 5c 6e ists, calc now\n
2ab0: 22 0a 09 09 09 09 09 09 09 20 20 20 20 20 20 22 "........ "
2ac0: 20 20 20 20 69 74 65 6d 73 3a 20 22 20 69 74 65 items: " ite
2ad0: 6d 73 20 22 20 69 74 65 6d 73 74 61 62 6c 65 3a ms " itemstable:
2ae0: 20 22 20 69 74 65 6d 73 74 61 62 6c 65 29 0a 09 " itemstable)..
2af0: 09 09 09 09 09 20 28 69 74 65 6d 73 3a 67 65 74 ..... (items:get
2b00: 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 -items-from-conf
2b10: 69 67 20 63 6f 6e 66 69 67 29 29 0a 09 09 09 09 ig config)).....
2b20: 09 09 28 65 6c 73 65 20 23 66 29 29 29 20 20 20 ..(else #f)))
2b30: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2b40: 20 20 20 20 20 20 20 20 3b 3b 20 6e 6f 74 20 69 ;; not i
2b50: 74 65 72 61 74 65 64 0a 09 09 09 09 09 20 20 20 terated......
2b60: 20 20 23 66 20 20 20 20 20 20 3b 3b 20 69 74 65 #f ;; ite
2b70: 6d 73 64 61 74 20 35 0a 09 09 09 09 09 20 20 20 msdat 5......
2b80: 20 20 3b 3b 20 23 66 20 20 20 20 20 20 3b 3b 20 ;; #f ;;
2b90: 73 70 61 72 65 0a 09 09 09 09 09 20 20 20 20 20 spare......
2ba0: 29 29 29 0a 09 20 20 20 20 28 66 6f 72 2d 65 61 ))).. (for-ea
2bb0: 63 68 20 0a 09 20 20 20 20 20 28 6c 61 6d 62 64 ch .. (lambd
2bc0: 61 20 28 77 61 69 74 6f 6e 29 0a 09 20 20 20 20 a (waiton)..
2bd0: 20 20 20 28 69 66 20 28 61 6e 64 20 77 61 69 74 (if (and wait
2be0: 6f 6e 20 28 6e 6f 74 20 28 6d 65 6d 62 65 72 20 on (not (member
2bf0: 77 61 69 74 6f 6e 20 74 65 73 74 2d 6e 61 6d 65 waiton test-name
2c00: 73 29 29 29 0a 09 09 20 20 20 28 62 65 67 69 6e s)))... (begin
2c10: 0a 09 09 20 20 20 20 20 28 73 65 74 21 20 72 65 ... (set! re
2c20: 71 75 69 72 65 64 2d 74 65 73 74 73 20 28 63 6f quired-tests (co
2c30: 6e 73 20 77 61 69 74 6f 6e 20 72 65 71 75 69 72 ns waiton requir
2c40: 65 64 2d 74 65 73 74 73 29 29 0a 09 09 20 20 20 ed-tests))...
2c50: 20 20 28 73 65 74 21 20 74 65 73 74 2d 6e 61 6d (set! test-nam
2c60: 65 73 20 28 63 6f 6e 73 20 77 61 69 74 6f 6e 20 es (cons waiton
2c70: 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 29 29 20 test-names)))))
2c80: 3b 3b 20 77 61 73 20 61 6e 20 61 70 70 65 6e 64 ;; was an append
2c90: 2c 20 6e 6f 77 20 61 20 63 6f 6e 73 0a 09 20 20 , now a cons..
2ca0: 20 20 20 77 61 69 74 6f 6e 73 29 0a 09 20 20 20 waitons)..
2cb0: 20 28 6c 65 74 20 28 28 72 65 6d 74 65 73 74 73 (let ((remtests
2cc0: 20 28 64 65 6c 65 74 65 2d 64 75 70 6c 69 63 61 (delete-duplica
2cd0: 74 65 73 20 28 61 70 70 65 6e 64 20 77 61 69 74 tes (append wait
2ce0: 6f 6e 73 20 74 61 6c 29 29 29 29 0a 09 20 20 20 ons tal))))..
2cf0: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c (if (not (nul
2d00: 6c 3f 20 72 65 6d 74 65 73 74 73 29 29 0a 09 09 l? remtests))...
2d10: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 72 65 6d (loop (car rem
2d20: 74 65 73 74 73 29 28 63 64 72 20 72 65 6d 74 65 tests)(cdr remte
2d30: 73 74 73 29 29 29 29 29 29 29 0a 0a 20 20 20 20 sts)))))))..
2d40: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 (if (not (null?
2d50: 72 65 71 75 69 72 65 64 2d 74 65 73 74 73 29 29 required-tests))
2d60: 0a 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 ..(debug:print 1
2d70: 20 22 49 4e 46 4f 3a 20 41 64 64 69 6e 67 20 22 "INFO: Adding "
2d80: 20 72 65 71 75 69 72 65 64 2d 74 65 73 74 73 20 required-tests
2d90: 22 20 74 6f 20 74 68 65 20 72 75 6e 20 71 75 65 " to the run que
2da0: 75 65 22 29 29 0a 20 20 20 20 3b 3b 20 4e 4f 54 ue")). ;; NOT
2db0: 45 3a 20 74 68 65 73 65 20 61 72 65 20 61 6c 6c E: these are all
2dc0: 20 70 61 72 65 6e 74 20 74 65 73 74 73 2c 20 69 parent tests, i
2dd0: 74 65 6d 73 20 61 72 65 20 6e 6f 74 20 65 78 70 tems are not exp
2de0: 61 6e 64 65 64 20 79 65 74 2e 0a 20 20 20 20 28 anded yet.. (
2df0: 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d 71 runs:run-tests-q
2e00: 75 65 75 65 20 64 62 20 72 75 6e 2d 69 64 20 72 ueue db run-id r
2e10: 75 6e 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f unname test-reco
2e20: 72 64 73 20 6b 65 79 76 61 6c 6c 73 74 20 66 6c rds keyvallst fl
2e30: 61 67 73 29 0a 20 20 20 20 28 64 65 62 75 67 3a ags). (debug:
2e40: 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 41 print 4 "INFO: A
2e50: 6c 6c 20 64 6f 6e 65 20 62 79 20 68 65 72 65 22 ll done by here"
2e60: 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 )))..(define (ru
2e70: 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d 71 75 65 ns:run-tests-que
2e80: 75 65 20 64 62 20 72 75 6e 2d 69 64 20 72 75 6e ue db run-id run
2e90: 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 name test-record
2ea0: 73 20 6b 65 79 76 61 6c 6c 73 74 20 66 6c 61 67 s keyvallst flag
2eb0: 73 29 0a 20 20 20 20 3b 3b 20 41 74 20 74 68 69 s). ;; At thi
2ec0: 73 20 70 6f 69 6e 74 20 74 68 65 20 6c 69 73 74 s point the list
2ed0: 20 6f 66 20 70 61 72 65 6e 74 20 74 65 73 74 73 of parent tests
2ee0: 20 69 73 20 65 78 70 61 6e 64 65 64 20 0a 20 20 is expanded .
2ef0: 20 20 3b 3b 20 4e 42 2f 2f 20 53 68 6f 75 6c 64 ;; NB// Should
2f00: 20 65 78 70 61 6e 64 20 69 74 65 6d 73 20 68 65 expand items he
2f10: 72 65 20 61 6e 64 20 74 68 65 6e 20 69 6e 73 65 re and then inse
2f20: 72 74 20 69 6e 74 6f 20 74 68 65 20 72 75 6e 20 rt into the run
2f30: 71 75 65 75 65 2e 0a 20 20 28 64 65 62 75 67 3a queue.. (debug:
2f40: 70 72 69 6e 74 20 35 20 22 74 65 73 74 2d 72 65 print 5 "test-re
2f50: 63 6f 72 64 73 3a 20 22 20 74 65 73 74 2d 72 65 cords: " test-re
2f60: 63 6f 72 64 73 20 22 2c 20 6b 65 79 76 61 6c 6c cords ", keyvall
2f70: 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 29 st: " keyvallst)
2f80: 0a 20 20 28 6c 65 74 20 28 28 73 6f 72 74 65 64 . (let ((sorted
2f90: 2d 74 65 73 74 2d 6e 61 6d 65 73 20 28 74 65 73 -test-names (tes
2fa0: 74 73 3a 73 6f 72 74 2d 62 79 2d 70 72 69 6f 72 ts:sort-by-prior
2fb0: 69 74 79 2d 61 6e 64 2d 77 61 69 74 6f 6e 20 74 ity-and-waiton t
2fc0: 65 73 74 2d 72 65 63 6f 72 64 73 29 29 0a 09 28 est-records))..(
2fd0: 69 74 65 6d 2d 70 61 74 74 73 20 20 20 20 20 20 item-patts
2fe0: 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 (hash-table-re
2ff0: 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 f/default flags
3000: 22 2d 69 74 65 6d 70 61 74 74 22 20 23 66 29 29 "-itempatt" #f))
3010: 29 0a 20 20 20 20 28 6c 65 74 20 6c 6f 6f 70 20 ). (let loop
3020: 28 3b 20 28 6e 75 6d 74 69 6d 65 73 20 30 29 20 (; (numtimes 0)
3030: 3b 3b 20 73 68 6f 75 6c 64 6e 27 74 20 6e 65 65 ;; shouldn't nee
3040: 64 20 74 68 69 73 0a 09 20 20 20 20 20 20 20 28 d this.. (
3050: 68 65 64 20 20 20 20 20 20 20 20 20 28 63 61 72 hed (car
3060: 20 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d sorted-test-nam
3070: 65 73 29 29 0a 09 20 20 20 20 20 20 20 28 74 61 es)).. (ta
3080: 6c 20 20 20 20 20 20 20 20 20 28 63 64 72 20 73 l (cdr s
3090: 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 orted-test-names
30a0: 29 29 29 0a 20 20 20 20 20 20 28 6c 65 74 2a 20 ))). (let*
30b0: 28 28 74 65 73 74 2d 72 65 63 6f 72 64 20 28 68 ((test-record (h
30c0: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 20 74 65 ash-table-ref te
30d0: 73 74 2d 72 65 63 6f 72 64 73 20 68 65 64 29 29 st-records hed))
30e0: 0a 09 20 20 20 20 20 28 74 63 6f 6e 66 69 67 20 .. (tconfig
30f0: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 (tests:testq
3100: 75 65 75 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e ueue-get-testcon
3110: 66 69 67 20 74 65 73 74 2d 72 65 63 6f 72 64 29 fig test-record)
3120: 29 0a 09 20 20 20 20 20 28 77 61 69 74 6f 6e 73 ).. (waitons
3130: 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 (tests:test
3140: 71 75 65 75 65 2d 67 65 74 2d 77 61 69 74 6f 6e queue-get-waiton
3150: 73 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 s test-record
3160: 29 29 0a 09 20 20 20 20 20 28 70 72 69 6f 72 69 )).. (priori
3170: 74 79 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 ty (tests:tes
3180: 74 71 75 65 75 65 2d 67 65 74 2d 70 72 69 6f 72 tqueue-get-prior
3190: 69 74 79 20 20 20 74 65 73 74 2d 72 65 63 6f 72 ity test-recor
31a0: 64 29 29 0a 09 20 20 20 20 20 28 69 74 65 6d 64 d)).. (itemd
31b0: 61 74 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 at (tests:te
31c0: 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d stqueue-get-item
31d0: 64 61 74 20 20 20 20 74 65 73 74 2d 72 65 63 6f dat test-reco
31e0: 72 64 29 29 0a 09 20 20 20 20 20 28 69 74 65 6d rd)).. (item
31f0: 73 20 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 s (tests:t
3200: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 estqueue-get-ite
3210: 6d 73 20 20 20 20 20 20 74 65 73 74 2d 72 65 63 ms test-rec
3220: 6f 72 64 29 29 0a 09 20 20 20 20 20 28 69 74 65 ord)).. (ite
3230: 6d 2d 70 61 74 68 20 20 20 28 69 74 65 6d 2d 6c m-path (item-l
3240: 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 ist->path itemda
3250: 74 29 29 29 0a 09 28 64 65 62 75 67 3a 70 72 69 t)))..(debug:pri
3260: 6e 74 20 36 0a 09 09 20 20 20 20 20 22 69 74 65 nt 6... "ite
3270: 6d 64 61 74 3a 20 20 20 20 20 22 20 69 74 65 6d mdat: " item
3280: 64 61 74 0a 09 09 20 20 20 20 20 22 5c 6e 20 20 dat... "\n
3290: 69 74 65 6d 73 3a 20 20 20 20 20 22 20 69 74 65 items: " ite
32a0: 6d 73 0a 09 09 20 20 20 20 20 22 5c 6e 20 20 69 ms... "\n i
32b0: 74 65 6d 2d 70 61 74 68 3a 20 22 20 69 74 65 6d tem-path: " item
32c0: 2d 70 61 74 68 29 0a 09 28 63 6f 6e 64 0a 09 20 -path)..(cond..
32d0: 28 28 6e 6f 74 20 69 74 65 6d 73 29 20 3b 3b 20 ((not items) ;;
32e0: 77 68 65 6e 20 66 61 6c 73 65 20 74 68 65 20 74 when false the t
32f0: 65 73 74 20 69 73 20 6f 6b 20 74 6f 20 62 65 20 est is ok to be
3300: 68 61 6e 64 65 64 20 6f 66 66 20 74 6f 20 6c 61 handed off to la
3310: 75 6e 63 68 20 28 62 75 74 20 6e 6f 74 20 62 65 unch (but not be
3320: 66 6f 72 65 29 0a 09 20 20 28 6c 65 74 20 28 28 fore).. (let ((
3330: 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 20 20 have-resources
3340: 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f (runs:can-run-mo
3350: 72 65 2d 74 65 73 74 73 20 64 62 20 74 65 73 74 re-tests db test
3360: 2d 72 65 63 6f 72 64 29 29 20 3b 3b 20 6c 6f 6f -record)) ;; loo
3370: 6b 20 61 74 20 74 68 65 20 74 65 73 74 20 6a 6f k at the test jo
3380: 62 67 72 6f 75 70 20 61 6e 64 20 74 6f 74 20 6a bgroup and tot j
3390: 6f 62 73 20 72 75 6e 6e 69 6e 67 0a 09 09 28 70 obs running...(p
33a0: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 28 rereqs-not-met (
33b0: 64 62 3a 67 65 74 2d 70 72 65 72 65 71 73 2d 6e db:get-prereqs-n
33c0: 6f 74 2d 6d 65 74 20 64 62 20 72 75 6e 2d 69 64 ot-met db run-id
33d0: 20 77 61 69 74 6f 6e 73 20 69 74 65 6d 2d 70 61 waitons item-pa
33e0: 74 68 29 29 29 0a 09 20 20 20 20 3b 3b 20 44 6f th))).. ;; Do
33f0: 6e 27 74 20 6b 6e 6f 77 20 61 74 20 74 68 69 73 n't know at this
3400: 20 74 69 6d 65 20 69 66 20 74 68 65 20 74 65 73 time if the tes
3410: 74 20 68 61 76 65 20 62 65 65 6e 20 6c 61 75 6e t have been laun
3420: 63 68 65 64 20 61 74 20 73 6f 6d 65 20 74 69 6d ched at some tim
3430: 65 20 69 6e 20 74 68 65 20 70 61 73 74 0a 09 20 e in the past..
3440: 20 20 20 3b 3b 20 69 2e 65 2e 20 69 73 20 74 68 ;; i.e. is th
3450: 69 73 20 61 20 72 65 2d 6c 61 75 6e 63 68 3f 0a is a re-launch?.
3460: 09 20 20 20 20 28 69 66 20 28 61 6e 64 20 68 61 . (if (and ha
3470: 76 65 2d 72 65 73 6f 75 72 63 65 73 0a 09 09 20 ve-resources...
3480: 20 20 20 20 28 6e 75 6c 6c 3f 20 70 72 65 72 65 (null? prere
3490: 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 09 09 3b qs-not-met))...;
34a0: 3b 20 6e 6f 20 6c 6f 6f 70 20 2d 20 64 72 6f 70 ; no loop - drop
34b0: 20 74 68 6f 75 67 68 20 61 6e 64 20 75 73 65 20 though and use
34c0: 74 68 65 20 6c 6f 6f 70 20 61 74 20 74 68 65 20 the loop at the
34d0: 62 6f 74 74 6f 6d 20 0a 09 09 28 72 75 6e 3a 74 bottom ...(run:t
34e0: 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 72 75 est db run-id ru
34f0: 6e 6e 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20 nname keyvallst
3500: 74 65 73 74 2d 72 65 63 6f 72 64 20 66 6c 61 67 test-record flag
3510: 73 20 23 66 29 0a 09 09 3b 3b 20 65 6c 73 65 20 s #f)...;; else
3520: 74 68 65 20 72 75 6e 20 69 73 20 73 74 75 63 6b the run is stuck
3530: 2c 20 74 65 6d 70 6f 72 61 72 69 6c 79 20 6f 72 , temporarily or
3540: 20 70 65 72 6d 61 6e 65 6e 74 6c 79 0a 09 09 28 permanently...(
3550: 6c 65 74 20 28 28 6e 65 77 74 61 6c 20 28 61 70 let ((newtal (ap
3560: 70 65 6e 64 20 74 61 6c 20 28 6c 69 73 74 20 68 pend tal (list h
3570: 65 64 29 29 29 29 0a 09 09 20 20 3b 3b 20 63 6f ed))))... ;; co
3580: 75 6c 64 6e 27 74 20 72 75 6e 2c 20 74 61 6b 65 uldn't run, take
3590: 20 61 20 62 72 65 61 74 68 65 72 0a 09 09 20 20 a breather...
35a0: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 34 (thread-sleep! 4
35b0: 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 )... (loop (car
35c0: 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 newtal)(cdr new
35d0: 74 61 6c 29 29 29 29 29 29 0a 09 20 0a 09 20 3b tal)))))).. .. ;
35e0: 3b 20 63 61 73 65 20 77 68 65 72 65 20 61 6e 20 ; case where an
35f0: 69 74 65 6d 73 20 63 61 6d 65 20 69 6e 20 61 73 items came in as
3600: 20 61 20 6c 69 73 74 20 62 65 65 6e 20 70 72 6f a list been pro
3610: 63 65 73 73 65 64 0a 09 20 28 28 61 6e 64 20 28 cessed.. ((and (
3620: 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 20 20 20 list? items)
3630: 20 3b 3b 20 74 68 75 73 20 77 65 20 6b 6e 6f 77 ;; thus we know
3640: 20 6f 75 72 20 69 74 65 6d 73 20 61 72 65 20 61 our items are a
3650: 6c 72 65 61 64 79 20 63 61 6c 63 75 6c 61 74 65 lready calculate
3660: 64 0a 09 20 20 20 20 20 20 20 28 6e 6f 74 20 20 d.. (not
3670: 20 69 74 65 6d 64 61 74 29 29 20 3b 3b 20 61 6e itemdat)) ;; an
3680: 64 20 6e 6f 74 20 79 65 74 20 65 78 70 61 6e 64 d not yet expand
3690: 65 64 20 69 6e 74 6f 20 74 68 65 20 6c 69 73 74 ed into the list
36a0: 20 6f 66 20 74 68 69 6e 67 73 20 74 6f 20 62 65 of things to be
36b0: 20 64 6f 6e 65 0a 09 20 20 28 69 66 20 28 3e 3d done.. (if (>=
36c0: 20 2a 76 65 72 62 6f 73 69 74 79 2a 20 31 29 28 *verbosity* 1)(
36d0: 70 70 20 69 74 65 6d 73 29 29 0a 09 20 20 3b 3b pp items)).. ;;
36e0: 20 28 69 66 20 28 3e 3d 20 2a 76 65 72 62 6f 73 (if (>= *verbos
36f0: 69 74 79 2a 20 35 29 0a 09 20 20 3b 3b 20 20 20 ity* 5).. ;;
3700: 20 20 28 62 65 67 69 6e 0a 09 20 20 3b 3b 20 20 (begin.. ;;
3710: 20 20 20 20 20 28 70 72 69 6e 74 20 22 69 74 65 (print "ite
3720: 6d 73 3a 20 22 29 20 20 20 20 20 28 70 70 20 28 ms: ") (pp (
3730: 69 74 65 6d 2d 61 73 73 6f 63 2d 3e 69 74 65 6d item-assoc->item
3740: 2d 6c 69 73 74 20 69 74 65 6d 73 29 29 0a 09 20 -list items))..
3750: 20 3b 3b 20 20 20 20 20 20 20 28 70 72 69 6e 74 ;; (print
3760: 20 22 69 74 65 6d 73 74 61 62 6c 65 3a 20 22 29 "itemstable: ")
3770: 28 70 70 20 28 69 74 65 6d 2d 74 61 62 6c 65 2d (pp (item-table-
3780: 3e 69 74 65 6d 2d 6c 69 73 74 20 69 74 65 6d 73 >item-list items
3790: 74 61 62 6c 65 29 29 29 29 0a 09 20 20 28 66 6f table)))).. (fo
37a0: 72 2d 65 61 63 68 0a 09 20 20 20 28 6c 61 6d 62 r-each.. (lamb
37b0: 64 61 20 28 6d 79 2d 69 74 65 6d 64 61 74 29 0a da (my-itemdat).
37c0: 09 20 20 20 20 20 28 6c 65 74 2a 20 28 28 6e 65 . (let* ((ne
37d0: 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 28 6c w-test-record (l
37e0: 65 74 20 28 28 6e 65 77 72 65 63 20 28 6d 61 6b et ((newrec (mak
37f0: 65 2d 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 e-tests:testqueu
3800: 65 29 29 29 0a 09 09 09 09 20 20 20 20 20 20 20 e))).....
3810: 28 76 65 63 74 6f 72 2d 63 6f 70 79 21 20 74 65 (vector-copy! te
3820: 73 74 2d 72 65 63 6f 72 64 20 6e 65 77 72 65 63 st-record newrec
3830: 29 0a 09 09 09 09 20 20 20 20 20 20 20 6e 65 77 )..... new
3840: 72 65 63 29 29 0a 09 09 20 20 20 20 28 6d 79 2d rec))... (my-
3850: 69 74 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d item-path (item-
3860: 6c 69 73 74 2d 3e 70 61 74 68 20 6d 79 2d 69 74 list->path my-it
3870: 65 6d 64 61 74 29 29 0a 09 09 20 20 20 20 28 69 emdat))... (i
3880: 74 65 6d 2d 6d 61 74 63 68 65 73 20 28 69 66 20 tem-matches (if
3890: 69 74 65 6d 2d 70 61 74 74 73 20 20 20 20 20 20 item-patts
38a0: 20 3b 3b 20 68 65 72 65 20 77 65 20 61 72 65 20 ;; here we are
38b0: 66 69 6c 74 65 72 69 6e 67 20 66 6f 72 20 6d 61 filtering for ma
38c0: 74 63 68 65 73 20 77 69 74 68 20 2d 69 74 65 6d tches with -item
38d0: 70 61 74 74 0a 09 09 09 09 20 20 20 20 20 20 28 patt..... (
38e0: 6c 65 74 20 28 28 72 65 73 20 23 66 29 29 09 20 let ((res #f)).
38f0: 3b 3b 20 6c 6f 6f 6b 20 74 68 72 6f 75 67 68 20 ;; look through
3900: 61 6c 6c 20 74 68 65 20 69 74 65 6d 2d 70 61 74 all the item-pat
3910: 74 73 20 69 66 20 64 65 66 69 6e 65 64 2c 20 66 ts if defined, f
3920: 6f 72 6d 61 74 20 69 73 20 70 61 74 74 31 2c 70 ormat is patt1,p
3930: 61 74 74 32 2c 70 61 74 74 33 20 2e 2e 2e 20 77 att2,patt3 ... w
3940: 69 6c 64 63 61 72 64 20 69 73 20 25 0a 09 09 09 ildcard is %....
3950: 09 09 28 66 6f 72 2d 65 61 63 68 20 0a 09 09 09 ..(for-each ....
3960: 09 09 20 28 6c 61 6d 62 64 61 20 28 70 61 74 74 .. (lambda (patt
3970: 29 0a 09 09 09 09 09 20 20 20 28 69 66 20 28 73 )...... (if (s
3980: 74 72 69 6e 67 2d 73 65 61 72 63 68 20 28 67 6c tring-search (gl
3990: 6f 62 2d 3e 72 65 67 65 78 70 0a 09 09 09 09 09 ob->regexp......
39a0: 09 09 20 20 20 20 20 20 20 28 73 74 72 69 6e 67 .. (string
39b0: 2d 74 72 61 6e 73 6c 61 74 65 20 70 61 74 74 20 -translate patt
39c0: 22 25 22 20 22 2a 22 29 29 0a 09 09 09 09 09 09 "%" "*")).......
39d0: 09 20 20 20 20 20 20 69 74 65 6d 2d 70 61 74 68 . item-path
39e0: 29 0a 09 09 09 09 09 20 20 20 20 20 20 20 28 73 )...... (s
39f0: 65 74 21 20 72 65 73 20 23 74 29 29 29 0a 09 09 et! res #t)))...
3a00: 09 09 09 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 ... (string-spli
3a10: 74 20 69 74 65 6d 2d 70 61 74 74 73 20 22 2c 22 t item-patts ","
3a20: 29 29 0a 09 09 09 09 09 72 65 73 29 0a 09 09 09 ))......res)....
3a30: 09 20 20 20 20 20 20 23 74 29 29 29 0a 09 20 20 . #t)))..
3a40: 20 20 20 20 20 28 69 66 20 69 74 65 6d 2d 6d 61 (if item-ma
3a50: 74 63 68 65 73 20 3b 3b 20 79 65 73 2c 20 77 65 tches ;; yes, we
3a60: 20 77 61 6e 74 20 74 6f 20 70 72 6f 63 65 73 73 want to process
3a70: 20 74 68 69 73 20 69 74 65 6d 0a 09 09 20 20 20 this item...
3a80: 28 6c 65 74 20 28 28 6e 65 77 74 65 73 74 6e 61 (let ((newtestna
3a90: 6d 65 20 28 63 6f 6e 63 20 68 65 64 20 22 2f 22 me (conc hed "/"
3aa0: 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68 29 29 29 my-item-path)))
3ab0: 20 0a 09 09 20 20 20 20 20 28 74 65 73 74 73 3a ... (tests:
3ac0: 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 testqueue-set-it
3ad0: 65 6d 73 21 20 20 20 6e 65 77 2d 74 65 73 74 2d ems! new-test-
3ae0: 72 65 63 6f 72 64 20 23 66 29 0a 09 09 20 20 20 record #f)...
3af0: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 (tests:testque
3b00: 75 65 2d 73 65 74 2d 69 74 65 6d 64 61 74 21 20 ue-set-itemdat!
3b10: 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 new-test-record
3b20: 6d 79 2d 69 74 65 6d 64 61 74 29 0a 09 09 20 20 my-itemdat)...
3b30: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 (hash-table-s
3b40: 65 74 21 20 74 65 73 74 2d 72 65 63 6f 72 64 73 et! test-records
3b50: 20 6e 65 77 74 65 73 74 6e 61 6d 65 20 6e 65 77 newtestname new
3b60: 2d 74 65 73 74 2d 72 65 63 6f 72 64 29 0a 09 09 -test-record)...
3b70: 20 20 20 20 20 28 73 65 74 21 20 74 61 6c 20 28 (set! tal (
3b80: 63 6f 6e 73 20 6e 65 77 74 65 73 74 6e 61 6d 65 cons newtestname
3b90: 20 74 61 6c 29 29 29 29 29 29 20 3b 3b 20 73 69 tal)))))) ;; si
3ba0: 6e 63 65 20 74 68 65 73 65 20 61 72 65 20 69 74 nce these are it
3bb0: 65 6d 69 7a 65 64 20 63 72 65 61 74 65 20 6e 65 emized create ne
3bc0: 77 20 74 65 73 74 20 6e 61 6d 65 73 20 74 65 73 w test names tes
3bd0: 74 6e 61 6d 65 2f 69 74 65 6d 70 61 74 68 0a 09 tname/itempath..
3be0: 20 20 20 69 74 65 6d 73 29 0a 09 20 20 28 6c 6f items).. (lo
3bf0: 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 op (car tal)(cdr
3c00: 20 74 61 6c 29 29 29 0a 0a 09 20 3b 3b 20 69 66 tal)))... ;; if
3c10: 20 69 74 65 6d 73 20 69 73 20 61 20 70 72 6f 63 items is a proc
3c20: 20 74 68 65 6e 20 6e 65 65 64 20 74 6f 20 72 75 then need to ru
3c30: 6e 20 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d n items:get-item
3c40: 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 2c 20 67 s-from-config, g
3c50: 65 74 20 74 68 65 20 6c 69 73 74 20 61 6e 64 20 et the list and
3c60: 6c 6f 6f 70 20 0a 09 20 3b 3b 20 20 20 20 2d 20 loop .. ;; -
3c70: 62 75 74 20 6f 6e 6c 79 20 64 6f 20 74 68 61 74 but only do that
3c80: 20 69 66 20 72 65 73 6f 75 72 63 65 73 20 65 78 if resources ex
3c90: 69 73 74 20 74 6f 20 6b 69 63 6b 20 6f 66 66 20 ist to kick off
3ca0: 74 68 65 20 6a 6f 62 0a 09 20 28 28 6f 72 20 28 the job.. ((or (
3cb0: 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73 procedure? items
3cc0: 29 28 65 71 3f 20 69 74 65 6d 73 20 27 68 61 76 )(eq? items 'hav
3cd0: 65 2d 70 72 6f 63 65 64 75 72 65 29 29 0a 09 20 e-procedure))..
3ce0: 20 28 69 66 20 28 61 6e 64 20 28 72 75 6e 73 3a (if (and (runs:
3cf0: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 can-run-more-tes
3d00: 74 73 20 64 62 20 74 65 73 74 2d 72 65 63 6f 72 ts db test-recor
3d10: 64 29 0a 09 09 20 20 20 28 6e 75 6c 6c 3f 20 28 d)... (null? (
3d20: 64 62 3a 67 65 74 2d 70 72 65 72 65 71 73 2d 6e db:get-prereqs-n
3d30: 6f 74 2d 6d 65 74 20 64 62 20 72 75 6e 2d 69 64 ot-met db run-id
3d40: 20 77 61 69 74 6f 6e 73 20 69 74 65 6d 2d 70 61 waitons item-pa
3d50: 74 68 29 29 29 0a 09 20 20 20 20 20 20 28 6c 65 th))).. (le
3d60: 74 20 28 28 74 65 73 74 2d 6e 61 6d 65 20 28 74 t ((test-name (t
3d70: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 ests:testqueue-g
3d80: 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 et-testname test
3d90: 2d 72 65 63 6f 72 64 29 29 29 0a 09 09 28 73 65 -record)))...(se
3da0: 74 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 tenv "MT_TEST_NA
3db0: 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b ME" test-name) ;
3dc0: 3b 20 0a 09 09 28 73 65 74 65 6e 76 20 22 4d 54 ; ...(setenv "MT
3dd0: 5f 52 55 4e 4e 41 4d 45 22 20 20 20 72 75 6e 6e _RUNNAME" runn
3de0: 61 6d 65 29 0a 09 09 28 73 65 74 2d 6d 65 67 61 ame)...(set-mega
3df0: 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 64 62 test-env-vars db
3e00: 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73 run-id) ;; thes
3e10: 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64 20 e may be needed
3e20: 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e 67 by the launching
3e30: 20 70 72 6f 63 65 73 73 0a 09 09 28 6c 65 74 20 process...(let
3e40: 28 28 69 74 65 6d 73 2d 6c 69 73 74 20 28 69 74 ((items-list (it
3e50: 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 ems:get-items-fr
3e60: 6f 6d 2d 63 6f 6e 66 69 67 20 74 63 6f 6e 66 69 om-config tconfi
3e70: 67 29 29 29 0a 09 09 20 20 28 69 66 20 28 6c 69 g)))... (if (li
3e80: 73 74 3f 20 69 74 65 6d 73 2d 6c 69 73 74 29 0a st? items-list).
3e90: 09 09 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 .. (begin..
3ea0: 09 09 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 ..(tests:testque
3eb0: 75 65 2d 73 65 74 2d 69 74 65 6d 73 21 20 74 65 ue-set-items! te
3ec0: 73 74 2d 72 65 63 6f 72 64 20 69 74 65 6d 73 2d st-record items-
3ed0: 6c 69 73 74 29 0a 09 09 09 28 6c 6f 6f 70 20 68 list)....(loop h
3ee0: 65 64 20 74 61 6c 29 29 0a 09 09 20 20 20 20 20 ed tal))...
3ef0: 20 28 62 65 67 69 6e 0a 09 09 09 28 64 65 62 75 (begin....(debu
3f00: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 g:print 0 "ERROR
3f10: 3a 20 54 68 65 20 70 72 6f 63 20 66 72 6f 6d 20 : The proc from
3f20: 72 65 61 64 69 6e 67 20 74 68 65 20 73 65 74 75 reading the setu
3f30: 70 20 64 69 64 20 6e 6f 74 20 79 69 65 6c 64 20 p did not yield
3f40: 61 20 6c 69 73 74 20 2d 20 70 6c 65 61 73 65 20 a list - please
3f50: 72 65 70 6f 72 74 20 74 68 69 73 22 29 0a 09 09 report this")...
3f60: 09 28 65 78 69 74 20 31 29 29 29 29 29 0a 09 20 .(exit 1)))))..
3f70: 20 20 20 20 20 28 6c 65 74 20 28 28 6e 65 77 74 (let ((newt
3f80: 61 6c 20 28 61 70 70 65 6e 64 20 74 61 6c 20 28 al (append tal (
3f90: 6c 69 73 74 20 68 65 64 29 29 29 29 0a 09 09 3b list hed))))...;
3fa0: 3b 20 69 66 20 63 61 6e 27 74 20 72 75 6e 20 6d ; if can't run m
3fb0: 6f 72 65 20 74 65 73 74 73 2c 20 6c 65 74 73 20 ore tests, lets
3fc0: 74 61 6b 65 20 61 20 62 72 65 61 74 68 65 72 0a take a breather.
3fd0: 09 09 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 ..(thread-sleep!
3fe0: 20 31 29 0a 09 09 28 6c 6f 6f 70 20 28 63 61 72 1)...(loop (car
3ff0: 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 newtal)(cdr new
4000: 74 61 6c 29 29 29 29 29 0a 0a 09 20 3b 3b 20 74 tal)))))... ;; t
4010: 68 69 73 20 63 61 73 65 20 73 68 6f 75 6c 64 20 his case should
4020: 6e 6f 74 20 68 61 70 70 65 6e 2c 20 61 64 64 65 not happen, adde
4030: 64 20 74 6f 20 68 65 6c 70 20 63 61 74 63 68 20 d to help catch
4040: 61 6e 79 20 62 75 67 73 0a 09 20 28 28 61 6e 64 any bugs.. ((and
4050: 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 69 (list? items) i
4060: 74 65 6d 64 61 74 29 0a 09 20 20 28 64 65 62 75 temdat).. (debu
4070: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 g:print 0 "ERROR
4080: 3a 20 53 68 6f 75 6c 64 20 6e 6f 74 20 68 61 76 : Should not hav
4090: 65 20 61 20 6c 69 73 74 20 6f 66 20 69 74 65 6d e a list of item
40a0: 73 20 69 6e 20 61 20 74 65 73 74 20 61 6e 64 20 s in a test and
40b0: 74 68 65 20 69 74 65 6d 73 70 61 74 68 20 73 65 the itemspath se
40c0: 74 20 2d 20 70 6c 65 61 73 65 20 72 65 70 6f 72 t - please repor
40d0: 74 20 74 68 69 73 22 29 0a 09 20 20 28 65 78 69 t this").. (exi
40e0: 74 20 31 29 29 29 29 0a 09 0a 20 20 20 20 20 20 t 1))))...
40f0: 3b 3b 20 77 65 20 67 65 74 20 68 65 72 65 20 6f ;; we get here o
4100: 6e 20 22 64 72 6f 70 20 74 68 72 6f 75 67 68 22 n "drop through"
4110: 20 2d 20 6c 6f 6f 70 20 66 6f 72 20 6e 65 78 74 - loop for next
4120: 20 74 65 73 74 20 69 6e 20 71 75 65 75 65 0a 20 test in queue.
4130: 20 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 (if (null?
4140: 74 61 6c 29 0a 09 20 20 28 62 65 67 69 6e 0a 09 tal).. (begin..
4150: 20 20 20 20 3b 3b 20 46 49 58 4d 45 21 21 21 21 ;; FIXME!!!!
4160: 20 54 48 49 53 20 53 48 4f 55 4c 44 20 4e 4f 54 THIS SHOULD NOT
4170: 20 52 45 51 55 49 52 45 20 41 4e 20 45 58 49 54 REQUIRE AN EXIT
4180: 21 21 21 21 21 21 21 0a 09 20 20 20 20 28 64 65 !!!!!!!.. (de
4190: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 bug:print 1 "INF
41a0: 4f 3a 20 41 6c 6c 20 74 65 73 74 73 20 6c 61 75 O: All tests lau
41b0: 6e 63 68 65 64 2c 20 65 78 69 74 69 6e 67 22 29 nched, exiting")
41c0: 0a 09 20 20 20 20 28 65 78 69 74 20 30 29 29 0a .. (exit 0)).
41d0: 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 . (loop (car ta
41e0: 6c 29 28 63 64 72 20 74 61 6c 29 29 29 29 29 29 l)(cdr tal))))))
41f0: 0a 0a 3b 3b 20 70 61 72 65 6e 74 2d 74 65 73 74 ..;; parent-test
4200: 20 69 73 20 74 68 65 72 65 20 61 73 20 61 20 70 is there as a p
4210: 6c 61 63 65 68 6f 6c 64 65 72 20 66 6f 72 20 77 laceholder for w
4220: 68 65 6e 20 70 61 72 65 6e 74 2d 74 65 73 74 73 hen parent-tests
4230: 20 63 61 6e 20 62 65 20 72 75 6e 20 61 73 20 61 can be run as a
4240: 20 73 65 74 75 70 20 73 74 65 70 0a 28 64 65 66 setup step.(def
4250: 69 6e 65 20 28 72 75 6e 3a 74 65 73 74 20 64 62 ine (run:test db
4260: 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 run-id runname
4270: 6b 65 79 76 61 6c 6c 73 74 20 74 65 73 74 2d 72 keyvallst test-r
4280: 65 63 6f 72 64 20 66 6c 61 67 73 20 70 61 72 65 ecord flags pare
4290: 6e 74 2d 74 65 73 74 29 0a 20 20 3b 3b 20 41 6c nt-test). ;; Al
42a0: 6c 20 74 68 65 73 65 20 76 61 72 73 20 6d 69 67 l these vars mig
42b0: 68 74 20 62 65 20 72 65 66 65 72 65 6e 63 65 64 ht be referenced
42c0: 20 62 79 20 74 68 65 20 74 65 73 74 63 6f 6e 66 by the testconf
42d0: 69 67 20 66 69 6c 65 20 72 65 61 64 65 72 0a 20 ig file reader.
42e0: 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 6e 61 (let* ((test-na
42f0: 6d 65 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 me (tests:tes
4300: 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e tqueue-get-testn
4310: 61 6d 65 20 20 20 74 65 73 74 2d 72 65 63 6f 72 ame test-recor
4320: 64 29 29 0a 09 20 28 74 65 73 74 2d 77 61 69 74 d)).. (test-wait
4330: 6f 6e 73 20 28 74 65 73 74 73 3a 74 65 73 74 71 ons (tests:testq
4340: 75 65 75 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73 ueue-get-waitons
4350: 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 test-record)
4360: 29 0a 09 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 ).. (test-conf
4370: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 (tests:testque
4380: 75 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 ue-get-testconfi
4390: 67 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a g test-record)).
43a0: 09 20 28 69 74 65 6d 64 61 74 20 20 20 20 20 20 . (itemdat
43b0: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 (tests:testqueue
43c0: 2d 67 65 74 2d 69 74 65 6d 64 61 74 20 20 20 20 -get-itemdat
43d0: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 test-record))..
43e0: 28 74 65 73 74 2d 70 61 74 68 20 20 20 20 28 63 (test-path (c
43f0: 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f onc *toppath* "/
4400: 74 65 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d tests/" test-nam
4410: 65 29 29 20 3b 3b 20 63 6f 75 6c 64 20 75 73 65 e)) ;; could use
4420: 20 74 65 73 74 3a 67 65 74 2d 74 65 73 74 63 6f test:get-testco
4430: 6e 66 69 67 20 68 65 72 65 20 2e 2e 2e 0a 09 20 nfig here .....
4440: 28 66 6f 72 63 65 20 20 20 20 20 20 20 20 28 68 (force (h
4450: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 ash-table-ref/de
4460: 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 66 6f fault flags "-fo
4470: 72 63 65 22 20 23 66 29 29 0a 09 20 28 72 65 72 rce" #f)).. (rer
4480: 75 6e 20 20 20 20 20 20 20 20 28 68 61 73 68 2d un (hash-
4490: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c table-ref/defaul
44a0: 74 20 66 6c 61 67 73 20 22 2d 72 65 72 75 6e 22 t flags "-rerun"
44b0: 20 23 66 29 29 0a 09 20 28 6b 65 65 70 67 6f 69 #f)).. (keepgoi
44c0: 6e 67 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c ng (hash-tabl
44d0: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c e-ref/default fl
44e0: 61 67 73 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 ags "-keepgoing"
44f0: 20 23 66 29 29 0a 09 20 28 69 74 65 6d 2d 70 61 #f)).. (item-pa
4500: 74 68 20 20 20 20 20 22 22 29 29 0a 20 20 20 20 th "")).
4510: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 35 0a 09 (debug:print 5..
4520: 09 20 22 74 65 73 74 2d 63 6f 6e 66 69 67 3a 20 . "test-config:
4530: 22 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61 " (hash-table->a
4540: 6c 69 73 74 20 74 65 73 74 2d 63 6f 6e 66 29 0a list test-conf).
4550: 09 09 20 22 5c 6e 20 20 20 69 74 65 6d 64 61 74 .. "\n itemdat
4560: 3a 20 22 20 69 74 65 6d 64 61 74 0a 09 09 20 29 : " itemdat... )
4570: 0a 20 20 20 20 3b 3b 20 73 65 74 74 69 6e 67 20 . ;; setting
4580: 69 74 65 6d 64 61 74 20 74 6f 20 61 20 6c 69 73 itemdat to a lis
4590: 74 20 69 66 20 69 74 20 69 73 20 23 66 0a 20 20 t if it is #f.
45a0: 20 20 28 69 66 20 28 6e 6f 74 20 69 74 65 6d 64 (if (not itemd
45b0: 61 74 29 28 73 65 74 21 20 69 74 65 6d 64 61 74 at)(set! itemdat
45c0: 20 27 28 29 29 29 0a 20 20 20 20 28 73 65 74 21 '())). (set!
45d0: 20 69 74 65 6d 2d 70 61 74 68 20 28 69 74 65 6d item-path (item
45e0: 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d -list->path item
45f0: 64 61 74 29 29 0a 20 20 20 20 28 64 65 62 75 67 dat)). (debug
4600: 3a 70 72 69 6e 74 20 32 20 22 41 74 74 65 6d 70 :print 2 "Attemp
4610: 74 69 6e 67 20 74 6f 20 6c 61 75 6e 63 68 20 74 ting to launch t
4620: 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 est " test-name
4630: 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 20 "/" item-path).
4640: 20 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 54 (setenv "MT_T
4650: 45 53 54 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e EST_NAME" test-n
4660: 61 6d 65 29 20 3b 3b 20 0a 20 20 20 20 28 73 65 ame) ;; . (se
4670: 74 65 6e 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 tenv "MT_RUNNAME
4680: 22 20 20 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20 " runname).
4690: 20 28 73 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 (set-megatest-e
46a0: 6e 76 2d 76 61 72 73 20 64 62 20 72 75 6e 2d 69 nv-vars db run-i
46b0: 64 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 d) ;; these may
46c0: 62 65 20 6e 65 65 64 65 64 20 62 79 20 74 68 65 be needed by the
46d0: 20 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 launching proce
46e0: 73 73 0a 20 20 20 20 28 63 68 61 6e 67 65 2d 64 ss. (change-d
46f0: 69 72 65 63 74 6f 72 79 20 2a 74 6f 70 70 61 74 irectory *toppat
4700: 68 2a 29 0a 0a 20 20 20 20 3b 3b 20 48 65 72 65 h*).. ;; Here
4710: 20 69 73 20 77 68 65 72 65 20 74 68 65 20 74 65 is where the te
4720: 73 74 5f 6d 65 74 61 20 74 61 62 6c 65 20 69 73 st_meta table is
4730: 20 62 65 73 74 20 75 70 64 61 74 65 64 0a 20 20 best updated.
4740: 20 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 (runs:update-t
4750: 65 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74 est_meta db test
4760: 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 -name test-conf)
4770: 0a 20 20 20 20 0a 20 20 20 20 3b 3b 20 28 6c 61 . . ;; (la
4780: 6d 62 64 61 20 28 69 74 65 6d 64 61 74 29 20 3b mbda (itemdat) ;
4790: 3b 3b 20 28 28 72 69 70 65 6e 65 73 73 20 22 6f ;; ((ripeness "o
47a0: 76 65 72 72 69 70 65 22 29 20 28 74 65 6d 70 65 verripe") (tempe
47b0: 72 61 74 75 72 65 20 22 63 6f 6f 6c 22 29 20 28 rature "cool") (
47c0: 73 65 61 73 6f 6e 20 22 73 75 6d 6d 65 72 22 29 season "summer")
47d0: 29 0a 20 20 20 20 28 6c 65 74 2a 20 28 28 6e 65 ). (let* ((ne
47e0: 77 2d 74 65 73 74 2d 70 61 74 68 20 28 73 74 72 w-test-path (str
47f0: 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 ing-intersperse
4800: 28 63 6f 6e 73 20 74 65 73 74 2d 70 61 74 68 20 (cons test-path
4810: 28 6d 61 70 20 63 61 64 72 20 69 74 65 6d 64 61 (map cadr itemda
4820: 74 29 29 20 22 2f 22 29 29 0a 09 20 20 20 28 6e t)) "/")).. (n
4830: 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 28 69 66 ew-test-name (if
4840: 20 28 65 71 75 61 6c 3f 20 69 74 65 6d 2d 70 61 (equal? item-pa
4850: 74 68 20 22 22 29 20 74 65 73 74 2d 6e 61 6d 65 th "") test-name
4860: 20 28 63 6f 6e 63 20 74 65 73 74 2d 6e 61 6d 65 (conc test-name
4870: 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 "/" item-path))
4880: 29 20 3b 3b 20 6a 75 73 74 20 6e 65 65 64 20 69 ) ;; just need i
4890: 74 20 74 6f 20 62 65 20 75 6e 69 71 75 65 0a 09 t to be unique..
48a0: 20 20 20 28 74 65 73 74 64 61 74 20 20 20 20 20 (testdat
48b0: 20 20 28 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 (db:get-test-i
48c0: 6e 66 6f 20 64 62 20 72 75 6e 2d 69 64 20 74 65 nfo db run-id te
48d0: 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 st-name item-pat
48e0: 68 29 29 29 0a 20 20 20 20 20 20 28 69 66 20 28 h))). (if (
48f0: 6e 6f 74 20 74 65 73 74 64 61 74 29 0a 09 20 20 not testdat)..
4900: 28 62 65 67 69 6e 0a 09 20 20 20 20 3b 3b 20 65 (begin.. ;; e
4910: 6e 73 75 72 65 20 74 68 61 74 20 74 68 65 20 70 nsure that the p
4920: 61 74 68 20 65 78 69 73 74 73 20 62 65 66 6f 72 ath exists befor
4930: 65 20 72 65 67 69 73 74 65 72 69 6e 67 20 74 68 e registering th
4940: 65 20 74 65 73 74 0a 09 20 20 20 20 28 73 79 73 e test.. (sys
4950: 74 65 6d 20 28 63 6f 6e 63 20 22 6d 6b 64 69 72 tem (conc "mkdir
4960: 20 2d 70 20 22 20 6e 65 77 2d 74 65 73 74 2d 70 -p " new-test-p
4970: 61 74 68 29 29 0a 09 20 20 20 20 28 72 65 67 69 ath)).. (regi
4980: 73 74 65 72 2d 74 65 73 74 20 64 62 20 72 75 6e ster-test db run
4990: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 -id test-name it
49a0: 65 6d 2d 70 61 74 68 29 0a 09 20 20 20 20 28 73 em-path).. (s
49b0: 65 74 21 20 74 65 73 74 64 61 74 20 28 64 62 3a et! testdat (db:
49c0: 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 get-test-info db
49d0: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
49e0: 65 20 69 74 65 6d 2d 70 61 74 68 29 29 29 29 0a e item-path)))).
49f0: 20 20 20 20 20 20 28 63 68 61 6e 67 65 2d 64 69 (change-di
4a00: 72 65 63 74 6f 72 79 20 74 65 73 74 2d 70 61 74 rectory test-pat
4a10: 68 29 0a 20 20 20 20 20 20 28 63 61 73 65 20 28 h). (case (
4a20: 69 66 20 66 6f 72 63 65 20 3b 3b 20 28 61 72 67 if force ;; (arg
4a30: 73 3a 67 65 74 2d 61 72 67 20 22 2d 66 6f 72 63 s:get-arg "-forc
4a40: 65 22 29 0a 09 09 27 4e 4f 54 5f 53 54 41 52 54 e")...'NOT_START
4a50: 45 44 0a 09 09 28 69 66 20 74 65 73 74 64 61 74 ED...(if testdat
4a60: 0a 09 09 20 20 20 20 28 73 74 72 69 6e 67 2d 3e ... (string->
4a70: 73 79 6d 62 6f 6c 20 28 74 65 73 74 3a 67 65 74 symbol (test:get
4a80: 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 29 -state testdat))
4a90: 0a 09 09 20 20 20 20 27 66 61 69 6c 65 64 2d 74 ... 'failed-t
4aa0: 6f 2d 69 6e 73 65 72 74 29 29 0a 09 28 28 66 61 o-insert))..((fa
4ab0: 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 72 74 29 0a iled-to-insert).
4ac0: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 . (debug:print 0
4ad0: 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 "ERROR: Failed
4ae0: 74 6f 20 69 6e 73 65 72 74 20 74 68 65 20 72 65 to insert the re
4af0: 63 6f 72 64 20 69 6e 74 6f 20 74 68 65 20 64 62 cord into the db
4b00: 22 29 29 0a 09 28 28 4e 4f 54 5f 53 54 41 52 54 "))..((NOT_START
4b10: 45 44 20 43 4f 4d 50 4c 45 54 45 44 29 0a 09 20 ED COMPLETED)..
4b20: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 36 20 22 (debug:print 6 "
4b30: 47 6f 74 20 68 65 72 65 2c 20 22 20 28 74 65 73 Got here, " (tes
4b40: 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 t:get-state test
4b50: 64 61 74 29 29 0a 09 20 28 6c 65 74 20 28 28 72 dat)).. (let ((r
4b60: 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20 unflag #f))..
4b70: 28 63 6f 6e 64 0a 09 20 20 20 20 3b 3b 20 2d 66 (cond.. ;; -f
4b80: 6f 72 63 65 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 orce, run no mat
4b90: 74 65 72 20 77 68 61 74 0a 09 20 20 20 20 28 66 ter what.. (f
4ba0: 6f 72 63 65 20 28 73 65 74 21 20 72 75 6e 66 6c orce (set! runfl
4bb0: 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 ag #t)).. ;;
4bc0: 4e 4f 54 5f 53 54 41 52 54 45 44 2c 20 72 75 6e NOT_STARTED, run
4bd0: 20 6e 6f 20 6d 61 74 74 65 72 20 77 68 61 74 0a no matter what.
4be0: 09 20 20 20 20 28 28 65 71 75 61 6c 3f 20 28 74 . ((equal? (t
4bf0: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 est:get-state te
4c00: 73 74 64 61 74 29 20 22 4e 4f 54 5f 53 54 41 52 stdat) "NOT_STAR
4c10: 54 45 44 22 29 28 73 65 74 21 20 72 75 6e 66 6c TED")(set! runfl
4c20: 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 ag #t)).. ;;
4c30: 6e 6f 74 20 2d 72 65 72 75 6e 20 61 6e 64 20 50 not -rerun and P
4c40: 41 53 53 2c 20 57 41 52 4e 20 6f 72 20 43 48 45 ASS, WARN or CHE
4c50: 43 4b 2c 20 64 6f 20 6e 6f 20 72 75 6e 0a 09 20 CK, do no run..
4c60: 20 20 20 28 28 61 6e 64 20 28 6f 72 20 28 6e 6f ((and (or (no
4c70: 74 20 72 65 72 75 6e 29 0a 09 09 20 20 20 20 20 t rerun)...
4c80: 20 6b 65 65 70 67 6f 69 6e 67 29 0a 09 09 20 20 keepgoing)...
4c90: 3b 3b 20 52 65 71 75 69 72 65 20 74 6f 20 66 6f ;; Require to fo
4ca0: 72 63 65 20 72 65 2d 72 75 6e 20 66 6f 72 20 43 rce re-run for C
4cb0: 4f 4d 50 4c 45 54 45 44 20 6f 72 20 2a 61 6e 79 OMPLETED or *any
4cc0: 74 68 69 6e 67 2a 20 2b 20 50 41 53 53 2c 57 41 thing* + PASS,WA
4cd0: 52 4e 20 6f 72 20 43 48 45 43 4b 0a 09 09 20 20 RN or CHECK...
4ce0: 28 6f 72 20 28 6d 65 6d 62 65 72 20 28 74 65 73 (or (member (tes
4cf0: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 t:get-status tes
4d00: 74 64 61 74 29 20 27 28 22 50 41 53 53 22 20 22 tdat) '("PASS" "
4d10: 57 41 52 4e 22 20 22 43 48 45 43 4b 22 29 29 0a WARN" "CHECK")).
4d20: 09 09 20 20 20 20 20 20 28 6d 65 6d 62 65 72 20 .. (member
4d30: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 (test:get-state
4d40: 20 74 65 73 74 64 61 74 29 20 27 28 22 43 4f 4d testdat) '("COM
4d50: 50 4c 45 54 45 44 22 29 29 29 29 20 0a 09 20 20 PLETED")))) ..
4d60: 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 (set! runflag
4d70: 20 23 66 29 29 0a 09 20 20 20 20 3b 3b 20 2d 72 #f)).. ;; -r
4d80: 65 72 75 6e 20 61 6e 64 20 73 74 61 74 75 73 20 erun and status
4d90: 69 73 20 6f 6e 65 20 6f 66 20 74 68 65 20 73 70 is one of the sp
4da0: 65 63 69 66 65 64 2c 20 72 75 6e 20 69 74 0a 09 ecifed, run it..
4db0: 20 20 20 20 28 28 61 6e 64 20 72 65 72 75 6e 0a ((and rerun.
4dc0: 09 09 20 20 28 6c 65 74 20 28 28 72 65 72 75 6e .. (let ((rerun
4dd0: 6c 73 74 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 lst (string-spli
4de0: 74 20 72 65 72 75 6e 20 22 2c 22 29 29 29 20 3b t rerun ","))) ;
4df0: 3b 20 46 41 49 4c 2c 0a 09 09 20 20 20 20 28 6d ; FAIL,... (m
4e00: 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d ember (test:get-
4e10: 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20 status testdat)
4e20: 72 65 72 75 6e 6c 73 74 29 29 29 0a 09 20 20 20 rerunlst)))..
4e30: 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 (set! runflag
4e40: 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 2d 6b 65 #t)).. ;; -ke
4e50: 65 70 67 6f 69 6e 67 2c 20 64 6f 20 6e 6f 74 20 epgoing, do not
4e60: 72 65 72 75 6e 20 46 41 49 4c 0a 09 20 20 20 20 rerun FAIL..
4e70: 28 28 61 6e 64 20 6b 65 65 70 67 6f 69 6e 67 0a ((and keepgoing.
4e80: 09 09 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 .. (member (tes
4e90: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 t:get-status tes
4ea0: 74 64 61 74 29 20 27 28 22 46 41 49 4c 22 29 29 tdat) '("FAIL"))
4eb0: 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 75 ).. (set! ru
4ec0: 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20 20 nflag #f))..
4ed0: 28 28 61 6e 64 20 28 6e 6f 74 20 72 65 72 75 6e ((and (not rerun
4ee0: 29 0a 09 09 20 20 28 6d 65 6d 62 65 72 20 28 74 )... (member (t
4ef0: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 est:get-status t
4f00: 65 73 74 64 61 74 29 20 27 28 22 46 41 49 4c 22 estdat) '("FAIL"
4f10: 20 22 6e 2f 61 22 29 29 29 0a 09 20 20 20 20 20 "n/a")))..
4f20: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 (set! runflag #t
4f30: 29 29 0a 09 20 20 20 20 28 65 6c 73 65 20 28 73 )).. (else (s
4f40: 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 et! runflag #f))
4f50: 29 0a 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 ).. (debug:pri
4f60: 6e 74 20 36 20 22 52 55 4e 4e 49 4e 47 20 3d 3e nt 6 "RUNNING =>
4f70: 20 72 75 6e 66 6c 61 67 3a 20 22 20 72 75 6e 66 runflag: " runf
4f80: 6c 61 67 20 22 20 53 54 41 54 45 3a 20 22 20 28 lag " STATE: " (
4f90: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 test:get-state t
4fa0: 65 73 74 64 61 74 29 20 22 20 53 54 41 54 55 53 estdat) " STATUS
4fb0: 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 : " (test:get-st
4fc0: 61 74 75 73 20 74 65 73 74 64 61 74 29 29 0a 09 atus testdat))..
4fd0: 20 20 20 28 69 66 20 28 6e 6f 74 20 72 75 6e 66 (if (not runf
4fe0: 6c 61 67 29 0a 09 20 20 20 20 20 20 20 28 69 66 lag).. (if
4ff0: 20 28 6e 6f 74 20 70 61 72 65 6e 74 2d 74 65 73 (not parent-tes
5000: 74 29 0a 09 09 20 20 20 28 64 65 62 75 67 3a 70 t)... (debug:p
5010: 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 4e 6f rint 1 "NOTE: No
5020: 74 20 73 74 61 72 74 69 6e 67 20 74 65 73 74 20 t starting test
5030: 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 " new-test-name
5040: 22 20 61 73 20 69 74 20 69 73 20 73 74 61 74 65 " as it is state
5050: 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73 \"" (test:get-s
5060: 74 61 74 65 20 74 65 73 74 64 61 74 29 20 0a 09 tate testdat) ..
5070: 09 09 09 22 5c 22 20 61 6e 64 20 73 74 61 74 75 ..."\" and statu
5080: 73 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d s \"" (test:get-
5090: 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20 status testdat)
50a0: 22 5c 22 2c 20 75 73 65 20 2d 72 65 72 75 6e 20 "\", use -rerun
50b0: 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 \"" (test:get-st
50c0: 61 74 65 20 74 65 73 74 64 61 74 29 20 22 5c 22 ate testdat) "\"
50d0: 20 6f 72 20 2d 66 6f 72 63 65 20 74 6f 20 6f 76 or -force to ov
50e0: 65 72 72 69 64 65 22 29 29 0a 09 20 20 20 20 20 erride"))..
50f0: 20 20 3b 3b 20 4e 4f 54 45 3a 20 4e 6f 20 6c 6f ;; NOTE: No lo
5100: 6e 67 65 72 20 62 65 20 63 68 65 63 6b 69 6e 67 nger be checking
5110: 20 70 72 65 72 65 71 75 69 73 69 74 65 73 20 68 prerequisites h
5120: 65 72 65 21 20 57 69 6c 6c 20 6e 65 76 65 72 20 ere! Will never
5130: 67 65 74 20 68 65 72 65 20 75 6e 6c 65 73 73 20 get here unless
5140: 70 72 65 72 65 71 73 20 61 72 65 0a 09 20 20 20 prereqs are..
5150: 20 20 20 20 3b 3b 20 20 20 20 20 20 20 61 6c 72 ;; alr
5160: 65 61 64 79 20 6d 65 74 2e 0a 09 20 20 20 20 20 eady met...
5170: 20 20 28 69 66 20 28 6e 6f 74 20 28 6c 61 75 6e (if (not (laun
5180: 63 68 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69 ch-test db run-i
5190: 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d 63 d runname test-c
51a0: 6f 6e 66 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 onf keyvallst te
51b0: 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 70 61 74 st-name test-pat
51c0: 68 20 69 74 65 6d 64 61 74 20 66 6c 61 67 73 29 h itemdat flags)
51d0: 29 0a 09 09 20 20 20 28 62 65 67 69 6e 0a 09 09 )... (begin...
51e0: 20 20 20 20 20 28 70 72 69 6e 74 20 22 45 52 52 (print "ERR
51f0: 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c 61 OR: Failed to la
5200: 75 6e 63 68 20 74 68 65 20 74 65 73 74 2e 20 45 unch the test. E
5210: 78 69 74 69 6e 67 20 61 73 20 73 6f 6f 6e 20 61 xiting as soon a
5220: 73 20 70 6f 73 73 69 62 6c 65 22 29 0a 09 09 20 s possible")...
5230: 20 20 20 20 28 73 65 74 21 20 2a 67 6c 6f 62 61 (set! *globa
5240: 6c 65 78 69 74 73 74 61 74 75 73 2a 20 31 29 20 lexitstatus* 1)
5250: 3b 3b 20 0a 09 09 20 20 20 20 20 28 70 72 6f 63 ;; ... (proc
5260: 65 73 73 2d 73 69 67 6e 61 6c 20 28 63 75 72 72 ess-signal (curr
5270: 65 6e 74 2d 70 72 6f 63 65 73 73 2d 69 64 29 20 ent-process-id)
5280: 73 69 67 6e 61 6c 2f 6b 69 6c 6c 29 29 29 29 29 signal/kill)))))
5290: 29 0a 09 28 28 4b 49 4c 4c 45 44 29 20 0a 09 20 )..((KILLED) ..
52a0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
52b0: 4e 4f 54 45 3a 20 22 20 6e 65 77 2d 74 65 73 74 NOTE: " new-test
52c0: 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72 65 61 -name " is alrea
52d0: 64 79 20 72 75 6e 6e 69 6e 67 20 6f 72 20 77 61 dy running or wa
52e0: 73 20 65 78 70 6c 69 63 74 6c 79 20 6b 69 6c 6c s explictly kill
52f0: 65 64 2c 20 75 73 65 20 2d 66 6f 72 63 65 20 74 ed, use -force t
5300: 6f 20 6c 61 75 6e 63 68 20 69 74 2e 22 29 29 0a o launch it.")).
5310: 09 28 28 4c 41 55 4e 43 48 45 44 20 52 45 4d 4f .((LAUNCHED REMO
5320: 54 45 48 4f 53 54 53 54 41 52 54 20 52 55 4e 4e TEHOSTSTART RUNN
5330: 49 4e 47 29 20 20 0a 09 20 28 69 66 20 28 3e 20 ING) .. (if (>
5340: 28 2d 20 28 63 75 72 72 65 6e 74 2d 73 65 63 6f (- (current-seco
5350: 6e 64 73 29 28 2b 20 28 64 62 3a 74 65 73 74 2d nds)(+ (db:test-
5360: 67 65 74 2d 65 76 65 6e 74 5f 74 69 6d 65 20 74 get-event_time t
5370: 65 73 74 64 61 74 29 0a 09 09 09 09 20 20 20 20 estdat).....
5380: 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d (db:test-get-
5390: 72 75 6e 5f 64 75 72 61 74 69 6f 6e 20 74 65 73 run_duration tes
53a0: 74 64 61 74 29 29 29 0a 09 09 36 30 30 29 20 3b tdat)))...600) ;
53b0: 3b 20 69 2e 65 2e 20 6e 6f 20 75 70 64 61 74 65 ; i.e. no update
53c0: 20 66 6f 72 20 6d 6f 72 65 20 74 68 61 6e 20 36 for more than 6
53d0: 30 30 20 73 65 63 6f 6e 64 73 0a 09 20 20 20 20 00 seconds..
53e0: 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 20 (begin..
53f0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
5400: 57 41 52 4e 49 4e 47 3a 20 54 65 73 74 20 22 20 WARNING: Test "
5410: 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 70 70 65 test-name " appe
5420: 61 72 73 20 74 6f 20 62 65 20 64 65 61 64 2e 20 ars to be dead.
5430: 46 6f 72 63 69 6e 67 20 69 74 20 74 6f 20 73 74 Forcing it to st
5440: 61 74 65 20 49 4e 43 4f 4d 50 4c 45 54 45 20 61 ate INCOMPLETE a
5450: 6e 64 20 73 74 61 74 75 73 20 53 54 55 43 4b 2f nd status STUCK/
5460: 44 45 41 44 22 29 0a 09 20 20 20 20 20 20 20 28 DEAD").. (
5470: 74 65 73 74 2d 73 65 74 2d 73 74 61 74 75 73 21 test-set-status!
5480: 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d db run-id test-
5490: 6e 61 6d 65 20 22 49 4e 43 4f 4d 50 4c 45 54 45 name "INCOMPLETE
54a0: 22 20 22 53 54 55 43 4b 2f 44 45 41 44 22 20 69 " "STUCK/DEAD" i
54b0: 74 65 6d 64 61 74 20 22 54 65 73 74 20 69 73 20 temdat "Test is
54c0: 73 74 75 63 6b 20 6f 72 20 64 65 61 64 22 20 23 stuck or dead" #
54d0: 66 29 29 0a 09 20 20 20 20 20 28 64 65 62 75 67 f)).. (debug
54e0: 3a 70 72 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 :print 2 "NOTE:
54f0: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 73 " test-name " is
5500: 20 61 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e 67 already running
5510: 22 29 29 29 0a 09 28 65 6c 73 65 20 20 20 20 20 ")))..(else
5520: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
5530: 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 "ERROR: Failed
5540: 74 6f 20 6c 61 75 6e 63 68 20 74 65 73 74 20 22 to launch test "
5550: 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 new-test-name "
5560: 2e 20 55 6e 72 65 63 6f 67 6e 69 73 65 64 20 73 . Unrecognised s
5570: 74 61 74 65 20 22 20 28 74 65 73 74 3a 67 65 74 tate " (test:get
5580: 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 29 -state testdat))
5590: 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d )))))..;;=======
55a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
55b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
55c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
55d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a ===============.
55e0: 3b 3b 20 45 4e 44 20 4f 46 20 4e 45 57 20 53 54 ;; END OF NEW ST
55f0: 55 46 46 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d UFF.;;==========
5600: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5610: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5620: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5630: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 ============..(d
5640: 65 66 69 6e 65 20 28 67 65 74 2d 64 69 72 2d 75 efine (get-dir-u
5650: 70 2d 6e 20 64 69 72 20 2e 20 70 61 72 61 6d 73 p-n dir . params
5660: 29 20 0a 20 20 28 6c 65 74 20 28 28 64 70 61 72 ) . (let ((dpar
5670: 74 73 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 ts (string-spli
5680: 74 20 64 69 72 20 22 2f 22 29 29 0a 09 28 63 6f t dir "/"))..(co
5690: 75 6e 74 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f unt (if (null?
56a0: 20 70 61 72 61 6d 73 29 20 31 20 28 63 61 72 20 params) 1 (car
56b0: 70 61 72 61 6d 73 29 29 29 29 0a 20 20 20 20 28 params)))). (
56c0: 63 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 6e 67 conc "/" (string
56d0: 2d 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09 20 -intersperse ..
56e0: 20 20 20 20 20 20 28 74 61 6b 65 20 64 70 61 72 (take dpar
56f0: 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 ts (- (length dp
5700: 61 72 74 73 29 20 63 6f 75 6e 74 29 29 0a 09 20 arts) count))..
5710: 20 20 20 20 20 20 22 2f 22 29 29 29 29 0a 3b 3b "/")))).;;
5720: 20 52 65 6d 6f 76 65 20 72 75 6e 73 0a 3b 3b 20 Remove runs.;;
5730: 66 69 65 6c 64 73 20 61 72 65 20 70 61 73 73 69 fields are passi
5740: 6e 67 20 69 6e 20 74 68 72 6f 75 67 68 20 0a 28 ng in through .(
5750: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 65 6d define (runs:rem
5760: 6f 76 65 2d 72 75 6e 73 20 64 62 20 72 75 6e 6e ove-runs db runn
5770: 61 6d 65 70 61 74 74 20 74 65 73 74 70 61 74 74 amepatt testpatt
5780: 20 69 74 65 6d 70 61 74 74 29 0a 20 20 28 6c 65 itempatt). (le
5790: 74 2a 20 28 28 6b 65 79 73 20 20 20 20 20 20 20 t* ((keys
57a0: 20 28 64 62 2d 67 65 74 2d 6b 65 79 73 20 64 62 (db-get-keys db
57b0: 29 29 0a 09 20 28 72 75 6e 64 61 74 20 20 20 20 )).. (rundat
57c0: 20 20 28 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 (runs:get-runs
57d0: 2d 62 79 2d 70 61 74 74 20 64 62 20 6b 65 79 73 -by-patt db keys
57e0: 20 72 75 6e 6e 61 6d 65 70 61 74 74 29 29 0a 09 runnamepatt))..
57f0: 20 28 68 65 61 64 65 72 20 20 20 20 20 20 28 76 (header (v
5800: 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 ector-ref rundat
5810: 20 30 29 29 0a 09 20 28 72 75 6e 73 20 20 20 20 0)).. (runs
5820: 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 (vector-ref
5830: 72 75 6e 64 61 74 20 31 29 29 29 0a 20 20 20 20 rundat 1))).
5840: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
5850: 48 65 61 64 65 72 3a 20 22 20 68 65 61 64 65 72 Header: " header
5860: 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 0a ). (for-each.
5870: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 72 75 (lambda (ru
5880: 6e 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 n). (let (
5890: 28 72 75 6e 6b 65 79 20 28 73 74 72 69 6e 67 2d (runkey (string-
58a0: 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61 70 intersperse (map
58b0: 20 28 6c 61 6d 62 64 61 20 28 6b 29 0a 09 09 09 (lambda (k)....
58c0: 09 09 09 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 ...(db:get-value
58d0: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 -by-header run h
58e0: 65 61 64 65 72 20 28 76 65 63 74 6f 72 2d 72 65 eader (vector-re
58f0: 66 20 6b 20 30 29 29 29 20 6b 65 79 73 29 20 22 f k 0))) keys) "
5900: 2f 22 29 29 0a 09 20 20 20 20 20 28 64 69 72 73 /")).. (dirs
5910: 2d 74 6f 2d 72 65 6d 6f 76 65 20 28 6d 61 6b 65 -to-remove (make
5920: 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 09 -hash-table)))..
5930: 20 28 6c 65 74 2a 20 28 28 72 75 6e 2d 69 64 20 (let* ((run-id
5940: 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 (db:get-value-by
5950: 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 -header run head
5960: 65 72 20 22 69 64 22 29 20 29 0a 09 09 28 74 65 er "id") )...(te
5970: 73 74 73 20 20 28 64 62 2d 67 65 74 2d 74 65 73 sts (db-get-tes
5980: 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 ts-for-run db (d
5990: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 b:get-value-by-h
59a0: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 eader run header
59b0: 20 22 69 64 22 29 20 74 65 73 74 70 61 74 74 20 "id") testpatt
59c0: 69 74 65 6d 70 61 74 74 20 27 28 29 20 27 28 29 itempatt '() '()
59d0: 29 29 0a 09 09 28 6c 61 73 74 74 70 61 74 68 20 ))...(lasttpath
59e0: 22 2f 64 6f 65 73 2f 6e 6f 74 2f 65 78 69 73 74 "/does/not/exist
59f0: 2f 49 2f 68 6f 70 65 22 29 29 0a 0a 09 20 20 20 /I/hope"))...
5a00: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 (if (not (null?
5a10: 74 65 73 74 73 29 29 0a 09 20 20 20 20 20 20 20 tests))..
5a20: 28 62 65 67 69 6e 0a 09 09 20 28 64 65 62 75 67 (begin... (debug
5a30: 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 :print 1 "Removi
5a40: 6e 67 20 74 65 73 74 73 20 66 6f 72 20 72 75 6e ng tests for run
5a50: 3a 20 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28 : " runkey " " (
5a60: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d db:get-value-by-
5a70: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 header run heade
5a80: 72 20 22 72 75 6e 6e 61 6d 65 22 29 29 0a 09 09 r "runname"))...
5a90: 20 28 66 6f 72 2d 65 61 63 68 0a 09 09 20 20 28 (for-each... (
5aa0: 6c 61 6d 62 64 61 20 28 74 65 73 74 29 0a 09 09 lambda (test)...
5ab0: 20 20 20 20 28 6c 65 74 2a 20 28 28 69 74 65 6d (let* ((item
5ac0: 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 -path (db:test-g
5ad0: 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 et-item-path tes
5ae0: 74 29 29 0a 09 09 09 20 20 20 28 74 65 73 74 2d t)).... (test-
5af0: 6e 61 6d 65 20 28 64 62 3a 74 65 73 74 2d 67 65 name (db:test-ge
5b00: 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29 t-testname test)
5b10: 29 0a 09 09 09 20 20 20 28 72 75 6e 2d 64 69 72 ).... (run-dir
5b20: 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d (db:test-get-
5b30: 72 75 6e 64 69 72 20 74 65 73 74 29 29 29 0a 09 rundir test)))..
5b40: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 . (debug:pr
5b50: 69 6e 74 20 31 20 22 20 20 22 20 28 64 62 3a 74 int 1 " " (db:t
5b60: 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 est-get-testname
5b70: 20 74 65 73 74 29 20 22 20 69 64 3a 20 22 20 28 test) " id: " (
5b80: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 db:test-get-id t
5b90: 65 73 74 29 20 22 20 22 20 69 74 65 6d 2d 70 61 est) " " item-pa
5ba0: 74 68 29 0a 09 09 20 20 20 20 20 20 28 64 62 3a th)... (db:
5bb0: 64 65 6c 65 74 65 2d 74 65 73 74 2d 72 65 63 6f delete-test-reco
5bc0: 72 64 73 20 64 62 20 28 64 62 3a 74 65 73 74 2d rds db (db:test-
5bd0: 67 65 74 2d 69 64 20 74 65 73 74 29 29 0a 09 09 get-id test))...
5be0: 20 20 20 20 20 20 28 69 66 20 28 3e 20 28 73 74 (if (> (st
5bf0: 72 69 6e 67 2d 6c 65 6e 67 74 68 20 72 75 6e 2d ring-length run-
5c00: 64 69 72 29 20 35 29 20 3b 3b 20 62 61 64 20 68 dir) 5) ;; bad h
5c10: 65 75 72 69 73 74 69 63 20 62 75 74 20 73 68 6f euristic but sho
5c20: 75 6c 64 20 70 72 65 76 65 6e 74 20 2f 74 6d 70 uld prevent /tmp
5c30: 20 2f 68 6f 6d 65 20 65 74 63 2e 0a 09 09 09 20 /home etc.....
5c40: 20 28 6c 65 74 20 28 28 66 75 6c 6c 70 61 74 68 (let ((fullpath
5c50: 20 72 75 6e 2d 64 69 72 29 29 20 3b 3b 20 22 2f run-dir)) ;; "/
5c60: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 " (db:test-get-i
5c70: 74 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29 29 tem-path test)))
5c80: 29 0a 09 09 09 20 20 20 20 28 73 65 74 21 20 6c ).... (set! l
5c90: 61 73 74 74 70 61 74 68 20 66 75 6c 6c 70 61 74 asttpath fullpat
5ca0: 68 29 0a 09 09 09 20 20 20 20 28 68 61 73 68 2d h).... (hash-
5cb0: 74 61 62 6c 65 2d 73 65 74 21 20 64 69 72 73 2d table-set! dirs-
5cc0: 74 6f 2d 72 65 6d 6f 76 65 20 66 75 6c 6c 70 61 to-remove fullpa
5cd0: 74 68 20 23 74 29 0a 09 09 09 20 20 20 20 3b 3b th #t).... ;;
5ce0: 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 77 The following w
5cf0: 61 73 20 74 68 65 20 73 61 66 65 20 64 65 6c 65 as the safe dele
5d00: 74 65 20 63 6f 64 65 20 62 75 74 20 69 74 20 77 te code but it w
5d10: 61 73 20 6e 6f 74 20 62 65 69 6e 67 20 65 78 65 as not being exe
5d20: 63 74 75 74 65 64 2e 0a 09 09 09 20 20 20 20 3b ctuted..... ;
5d30: 3b 20 28 6c 65 74 2a 20 28 28 64 69 72 73 2d 63 ; (let* ((dirs-c
5d40: 6f 75 6e 74 20 28 2b 20 31 20 28 6c 65 6e 67 74 ount (+ 1 (lengt
5d50: 68 20 6b 65 79 73 29 28 6c 65 6e 67 74 68 20 28 h keys)(length (
5d60: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 69 74 65 string-split ite
5d70: 6d 2d 70 61 74 68 20 22 2f 22 29 29 29 29 0a 09 m-path "/"))))..
5d80: 09 09 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20 .. ;;
5d90: 28 64 69 72 2d 74 6f 2d 72 65 6d 20 28 67 65 74 (dir-to-rem (get
5da0: 2d 64 69 72 2d 75 70 2d 6e 20 66 75 6c 6c 70 61 -dir-up-n fullpa
5db0: 74 68 20 64 69 72 73 2d 63 6f 75 6e 74 29 29 0a th dirs-count)).
5dc0: 09 09 09 20 20 20 20 3b 3b 20 20 20 20 20 20 20 ... ;;
5dd0: 20 28 72 65 6d 61 69 6e 69 6e 67 64 20 28 73 74 (remainingd (st
5de0: 72 69 6e 67 2d 73 75 62 73 74 69 74 75 74 65 20 ring-substitute
5df0: 28 72 65 67 65 78 70 20 28 63 6f 6e 63 20 22 5e (regexp (conc "^
5e00: 22 20 64 69 72 2d 74 6f 2d 72 65 6d 20 22 2f 22 " dir-to-rem "/"
5e10: 29 29 20 22 22 20 66 75 6c 6c 70 61 74 68 29 29 )) "" fullpath))
5e20: 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 20 20 20 .... ;;
5e30: 20 20 28 63 6d 64 20 28 63 6f 6e 63 20 22 63 64 (cmd (conc "cd
5e40: 20 22 20 64 69 72 2d 74 6f 2d 72 65 6d 20 22 3b " dir-to-rem ";
5e50: 20 72 6d 64 69 72 20 2d 70 20 22 20 72 65 6d 61 rmdir -p " rema
5e60: 69 6e 69 6e 67 64 20 29 29 29 0a 09 09 09 20 20 iningd )))....
5e70: 20 20 3b 3b 20 20 20 28 69 66 20 28 66 69 6c 65 ;; (if (file
5e80: 2d 65 78 69 73 74 73 3f 20 66 75 6c 6c 70 61 74 -exists? fullpat
5e90: 68 29 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 20 h).... ;;
5ea0: 20 20 20 28 62 65 67 69 6e 0a 09 09 09 20 20 20 (begin....
5eb0: 20 3b 3b 20 20 20 20 20 20 20 20 20 28 64 65 62 ;; (deb
5ec0: 75 67 3a 70 72 69 6e 74 20 31 20 63 6d 64 29 0a ug:print 1 cmd).
5ed0: 09 09 09 20 20 20 20 3b 3b 20 20 20 20 20 20 20 ... ;;
5ee0: 20 20 28 73 79 73 74 65 6d 20 63 6d 64 29 29 29 (system cmd)))
5ef0: 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 29 29 0a .... ;; )).
5f00: 09 09 09 20 20 20 20 29 29 29 29 0a 09 09 20 20 ... ))))...
5f10: 20 20 74 65 73 74 73 29 29 29 0a 0a 09 20 20 20 tests)))...
5f20: 3b 3b 20 6c 6f 6f 6b 20 74 68 6f 75 67 68 20 74 ;; look though t
5f30: 68 65 20 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 he dirs-to-remov
5f40: 65 20 66 6f 72 20 63 61 6e 64 69 64 61 74 65 73 e for candidates
5f50: 20 66 6f 72 20 72 65 6d 6f 76 61 6c 2e 20 44 6f for removal. Do
5f60: 20 74 68 69 73 20 61 66 74 65 72 20 64 65 6c 65 this after dele
5f70: 74 69 6e 67 20 74 68 65 20 72 65 63 6f 72 64 73 ting the records
5f80: 0a 09 20 20 20 3b 3b 20 66 6f 72 20 65 61 63 68 .. ;; for each
5f90: 20 74 65 73 74 20 69 6e 20 63 61 73 65 20 77 65 test in case we
5fa0: 20 67 65 74 20 6b 69 6c 6c 65 64 2e 20 54 68 61 get killed. Tha
5fb0: 74 20 73 68 6f 75 6c 64 20 6d 69 6e 69 6d 69 7a t should minimiz
5fc0: 65 20 74 68 65 20 64 65 74 72 69 74 75 73 20 6c e the detritus l
5fd0: 65 66 74 20 6f 6e 20 64 69 73 6b 0a 09 20 20 20 eft on disk..
5fe0: 3b 3b 20 70 72 6f 63 65 73 73 20 74 68 65 20 64 ;; process the d
5ff0: 69 72 73 20 66 72 6f 6d 20 6c 6f 6e 67 65 73 74 irs from longest
6000: 20 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 74 string length t
6010: 6f 20 73 68 6f 72 74 65 73 74 0a 09 20 20 20 28 o shortest.. (
6020: 66 6f 72 2d 65 61 63 68 20 0a 09 20 20 20 20 28 for-each .. (
6030: 6c 61 6d 62 64 61 20 28 64 69 72 2d 74 6f 2d 72 lambda (dir-to-r
6040: 65 6d 6f 76 65 29 0a 09 20 20 20 20 20 20 28 69 emove).. (i
6050: 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 f (file-exists?
6060: 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 29 0a 09 dir-to-remove)..
6070: 09 20 20 28 6c 65 74 20 28 28 64 69 72 2d 69 6e . (let ((dir-in
6080: 2d 64 62 20 27 28 29 29 29 0a 09 09 20 20 20 20 -db '()))...
6090: 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 (sqlite3:for-eac
60a0: 68 2d 72 6f 77 0a 09 09 20 20 20 20 20 28 6c 61 h-row... (la
60b0: 6d 62 64 61 20 28 64 69 72 29 0a 09 09 20 20 20 mbda (dir)...
60c0: 20 20 20 20 28 73 65 74 21 20 64 69 72 2d 69 6e (set! dir-in
60d0: 2d 64 62 20 28 63 6f 6e 73 20 64 69 72 20 64 69 -db (cons dir di
60e0: 72 2d 69 6e 2d 64 62 29 29 29 0a 09 09 20 20 20 r-in-db)))...
60f0: 20 20 64 62 20 22 53 45 4c 45 43 54 20 72 75 6e db "SELECT run
6100: 64 69 72 20 46 52 4f 4d 20 74 65 73 74 73 20 57 dir FROM tests W
6110: 48 45 52 45 20 72 75 6e 64 69 72 20 4c 49 4b 45 HERE rundir LIKE
6120: 20 3f 3b 22 20 0a 09 09 20 20 20 20 20 28 63 6f ?;" ... (co
6130: 6e 63 20 22 25 22 20 64 69 72 2d 74 6f 2d 72 65 nc "%" dir-to-re
6140: 6d 6f 76 65 20 22 25 22 29 29 20 3b 3b 20 79 65 move "%")) ;; ye
6150: 73 2c 20 49 27 6d 20 67 6f 69 6e 67 20 74 6f 20 s, I'm going to
6160: 62 61 69 6c 20 69 66 20 74 68 65 72 65 20 69 73 bail if there is
6170: 20 61 6e 79 74 68 69 6e 67 20 6c 69 6b 65 20 74 anything like t
6180: 68 69 73 20 64 69 72 20 69 6e 20 74 68 65 20 64 his dir in the d
6190: 62 0a 09 09 20 20 20 20 28 69 66 20 28 6e 75 6c b... (if (nul
61a0: 6c 3f 20 64 69 72 2d 69 6e 2d 64 62 29 0a 09 09 l? dir-in-db)...
61b0: 09 28 62 65 67 69 6e 0a 09 09 09 20 20 28 64 65 .(begin.... (de
61c0: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 52 65 6d bug:print 2 "Rem
61d0: 6f 76 69 6e 67 20 64 69 72 65 63 74 6f 72 79 20 oving directory
61e0: 77 69 74 68 20 7a 65 72 6f 20 64 62 20 72 65 66 with zero db ref
61f0: 65 72 65 6e 63 65 73 3a 20 22 20 64 69 72 2d 74 erences: " dir-t
6200: 6f 2d 72 65 6d 6f 76 65 29 0a 09 09 09 20 20 28 o-remove).... (
6210: 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d system (conc "rm
6220: 20 2d 72 66 20 22 20 64 69 72 2d 74 6f 2d 72 65 -rf " dir-to-re
6230: 6d 6f 76 65 29 29 0a 09 09 09 20 20 28 68 61 73 move)).... (has
6240: 68 2d 74 61 62 6c 65 2d 64 65 6c 65 74 65 21 20 h-table-delete!
6250: 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 64 dirs-to-remove d
6260: 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 29 29 0a 09 ir-to-remove))..
6270: 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 ..(debug:print 2
6280: 20 22 53 6b 69 70 70 69 6e 67 20 72 65 6d 6f 76 "Skipping remov
6290: 61 6c 20 6f 66 20 22 20 64 69 72 2d 74 6f 2d 72 al of " dir-to-r
62a0: 65 6d 6f 76 65 20 22 20 66 6f 72 20 6e 6f 77 20 emove " for now
62b0: 61 73 20 69 74 20 73 74 69 6c 6c 20 68 61 73 20 as it still has
62c0: 72 65 66 65 72 65 6e 63 65 73 20 69 6e 20 74 68 references in th
62d0: 65 20 64 61 74 61 62 61 73 65 22 29 29 29 29 29 e database")))))
62e0: 0a 09 20 20 20 20 28 73 6f 72 74 20 28 68 61 73 .. (sort (has
62f0: 68 2d 74 61 62 6c 65 2d 6b 65 79 73 20 64 69 72 h-table-keys dir
6300: 73 2d 74 6f 2d 72 65 6d 6f 76 65 29 20 28 6c 61 s-to-remove) (la
6310: 6d 62 64 61 20 28 61 20 62 29 28 3e 20 28 73 74 mbda (a b)(> (st
6320: 72 69 6e 67 2d 6c 65 6e 67 74 68 20 61 29 28 73 ring-length a)(s
6330: 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 62 29 29 tring-length b))
6340: 29 29 29 0a 0a 09 20 20 20 3b 3b 20 72 65 6d 6f )))... ;; remo
6350: 76 65 20 74 68 65 20 72 75 6e 20 69 66 20 7a 65 ve the run if ze
6360: 72 6f 20 74 65 73 74 73 20 72 65 6d 61 69 6e 0a ro tests remain.
6370: 09 20 20 20 28 6c 65 74 20 28 28 72 65 6d 74 65 . (let ((remte
6380: 73 74 73 20 28 64 62 2d 67 65 74 2d 74 65 73 74 sts (db-get-test
6390: 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 62 s-for-run db (db
63a0: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 :get-value-by-he
63b0: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 ader run header
63c0: 22 69 64 22 29 20 23 66 20 23 66 20 27 28 29 20 "id") #f #f '()
63d0: 27 28 29 29 29 29 0a 09 20 20 20 20 20 28 69 66 '()))).. (if
63e0: 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 (null? remtests
63f0: 29 20 3b 3b 20 6e 6f 20 6d 6f 72 65 20 74 65 73 ) ;; no more tes
6400: 74 73 20 72 65 6d 61 69 6e 69 6e 67 0a 09 09 20 ts remaining...
6410: 28 6c 65 74 2a 20 28 28 64 70 61 72 74 73 20 20 (let* ((dparts
6420: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 6c 61 (string-split la
6430: 73 74 74 70 61 74 68 20 22 2f 22 29 29 0a 09 09 sttpath "/"))...
6440: 09 28 72 75 6e 70 61 74 68 20 28 63 6f 6e 63 20 .(runpath (conc
6450: 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 "/" (string-inte
6460: 72 73 70 65 72 73 65 20 0a 09 09 09 09 09 20 20 rsperse ......
6470: 20 20 28 74 61 6b 65 20 64 70 61 72 74 73 20 28 (take dparts (
6480: 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73 - (length dparts
6490: 29 20 31 29 29 0a 09 09 09 09 09 20 20 20 20 22 ) 1))...... "
64a0: 2f 22 29 29 29 29 0a 09 09 20 20 20 28 64 65 62 /"))))... (deb
64b0: 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f ug:print 1 "Remo
64c0: 76 69 6e 67 20 72 75 6e 3a 20 22 20 72 75 6e 6b ving run: " runk
64d0: 65 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76 ey " " (db:get-v
64e0: 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 alue-by-header r
64f0: 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61 un header "runna
6500: 6d 65 22 29 29 0a 09 09 20 20 20 28 64 62 3a 64 me"))... (db:d
6510: 65 6c 65 74 65 2d 72 75 6e 20 64 62 20 72 75 6e elete-run db run
6520: 2d 69 64 29 0a 09 09 20 20 20 3b 3b 20 6e 65 65 -id)... ;; nee
6530: 64 20 74 6f 20 66 69 67 75 72 65 20 6f 75 74 20 d to figure out
6540: 74 68 65 20 70 61 74 68 20 74 6f 20 74 68 65 20 the path to the
6550: 72 75 6e 20 64 69 72 20 61 6e 64 20 72 65 6d 6f run dir and remo
6560: 76 65 20 69 74 20 69 66 20 65 6d 70 74 79 0a 09 ve it if empty..
6570: 09 20 20 20 3b 3b 20 20 20 20 28 69 66 20 28 6e . ;; (if (n
6580: 75 6c 6c 3f 20 28 67 6c 6f 62 20 28 63 6f 6e 63 ull? (glob (conc
6590: 20 72 75 6e 70 61 74 68 20 22 2f 2a 22 29 29 29 runpath "/*")))
65a0: 0a 09 09 20 20 20 3b 3b 20 20 20 20 20 20 20 20 ... ;;
65b0: 28 62 65 67 69 6e 0a 09 09 20 20 20 3b 3b 20 09 (begin... ;; .
65c0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 (debug:print 1
65d0: 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 20 64 69 "Removing run di
65e0: 72 20 22 20 72 75 6e 70 61 74 68 29 0a 09 09 20 r " runpath)...
65f0: 20 20 3b 3b 20 09 20 28 73 79 73 74 65 6d 20 28 ;; . (system (
6600: 63 6f 6e 63 20 22 72 6d 64 69 72 20 2d 70 20 22 conc "rmdir -p "
6610: 20 72 75 6e 70 61 74 68 29 29 29 29 0a 09 09 20 runpath))))...
6620: 20 20 29 29 29 29 0a 09 20 29 29 0a 20 20 20 20 )))).. )).
6630: 20 72 75 6e 73 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d runs)))..;;====
6640: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6650: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6660: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6670: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6680: 3d 3d 0a 3b 3b 20 52 6f 75 74 69 6e 65 73 20 66 ==.;; Routines f
6690: 6f 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 or manipulating
66a0: 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d runs.;;=========
66b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
66c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
66d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
66e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b =============..;
66f0: 3b 20 53 69 6e 63 65 20 6d 61 6e 79 20 63 61 6c ; Since many cal
6700: 6c 73 20 74 6f 20 61 20 72 75 6e 20 72 65 71 75 ls to a run requ
6710: 69 72 65 20 70 72 65 74 74 79 20 6d 75 63 68 20 ire pretty much
6720: 74 68 65 20 73 61 6d 65 20 73 65 74 75 70 20 0a the same setup .
6730: 3b 3b 20 74 68 69 73 20 77 72 61 70 70 65 72 20 ;; this wrapper
6740: 69 73 20 75 73 65 64 20 74 6f 20 72 65 64 75 63 is used to reduc
6750: 65 20 74 68 65 20 72 65 70 6c 69 63 61 74 69 6f e the replicatio
6760: 6e 20 6f 66 20 63 6f 64 65 0a 28 64 65 66 69 6e n of code.(defin
6770: 65 20 28 67 65 6e 65 72 61 6c 2d 72 75 6e 2d 63 e (general-run-c
6780: 61 6c 6c 20 73 77 69 74 63 68 6e 61 6d 65 20 61 all switchname a
6790: 63 74 69 6f 6e 2d 64 65 73 63 20 70 72 6f 63 29 ction-desc proc)
67a0: 0a 20 20 28 6c 65 74 20 28 28 72 75 6e 6e 61 6d . (let ((runnam
67b0: 65 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 e (args:get-arg
67c0: 22 3a 72 75 6e 6e 61 6d 65 22 29 29 0a 09 28 74 ":runname"))..(t
67d0: 61 72 67 65 74 20 20 28 69 66 20 28 61 72 67 73 arget (if (args
67e0: 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 :get-arg "-targe
67f0: 74 22 29 0a 09 09 20 20 20 20 20 28 61 72 67 73 t")... (args
6800: 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 :get-arg "-targe
6810: 74 22 29 0a 09 09 20 20 20 20 20 28 61 72 67 73 t")... (args
6820: 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 :get-arg "-reqta
6830: 72 67 22 29 29 29 29 0a 20 20 20 20 28 63 6f 6e rg")))). (con
6840: 64 0a 20 20 20 20 20 28 28 6e 6f 74 20 74 61 72 d. ((not tar
6850: 67 65 74 29 0a 20 20 20 20 20 20 28 64 65 62 75 get). (debu
6860: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 g:print 0 "ERROR
6870: 3a 20 4d 69 73 73 69 6e 67 20 72 65 71 75 69 72 : Missing requir
6880: 65 64 20 70 61 72 61 6d 65 74 65 72 20 66 6f 72 ed parameter for
6890: 20 22 20 73 77 69 74 63 68 6e 61 6d 65 20 22 2c " switchname ",
68a0: 20 79 6f 75 20 6d 75 73 74 20 73 70 65 63 69 66 you must specif
68b0: 79 20 74 68 65 20 74 61 72 67 65 74 20 77 69 74 y the target wit
68c0: 68 20 2d 74 61 72 67 65 74 22 29 0a 20 20 20 20 h -target").
68d0: 20 20 28 65 78 69 74 20 33 29 29 0a 20 20 20 20 (exit 3)).
68e0: 20 28 28 6e 6f 74 20 72 75 6e 6e 61 6d 65 29 0a ((not runname).
68f0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 (debug:pri
6900: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 4d 69 73 nt 0 "ERROR: Mis
6910: 73 69 6e 67 20 72 65 71 75 69 72 65 64 20 70 61 sing required pa
6920: 72 61 6d 65 74 65 72 20 66 6f 72 20 22 20 73 77 rameter for " sw
6930: 69 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20 itchname ", you
6940: 6d 75 73 74 20 73 70 65 63 69 66 79 20 74 68 65 must specify the
6950: 20 72 75 6e 20 6e 61 6d 65 20 77 69 74 68 20 3a run name with :
6960: 72 75 6e 6e 61 6d 65 20 72 75 6e 6e 61 6d 65 22 runname runname"
6970: 29 0a 20 20 20 20 20 20 28 65 78 69 74 20 33 29 ). (exit 3)
6980: 29 0a 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20 ). (else.
6990: 20 20 20 28 6c 65 74 20 28 28 64 62 20 20 20 23 (let ((db #
69a0: 66 29 0a 09 20 20 20 20 28 6b 65 79 73 20 23 66 f).. (keys #f
69b0: 29 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 73 65 ))..(if (not (se
69c0: 74 75 70 2d 66 6f 72 2d 72 75 6e 29 29 0a 09 20 tup-for-run))..
69d0: 20 20 20 28 62 65 67 69 6e 20 0a 09 20 20 20 20 (begin ..
69e0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
69f0: 20 22 46 61 69 6c 65 64 20 74 6f 20 73 65 74 75 "Failed to setu
6a00: 70 2c 20 65 78 69 74 69 6e 67 22 29 0a 09 20 20 p, exiting")..
6a10: 20 20 20 20 28 65 78 69 74 20 31 29 29 29 0a 09 (exit 1)))..
6a20: 28 73 65 74 21 20 64 62 20 20 20 28 6f 70 65 6e (set! db (open
6a30: 2d 64 62 29 29 0a 09 28 73 65 74 21 20 6b 65 79 -db))..(set! key
6a40: 73 20 28 64 62 2d 67 65 74 2d 6b 65 79 73 20 64 s (db-get-keys d
6a50: 62 29 29 0a 09 3b 3b 20 68 61 76 65 20 65 6e 6f b))..;; have eno
6a60: 75 67 68 20 74 6f 20 70 72 6f 63 65 73 73 20 2d ugh to process -
6a70: 74 61 72 67 65 74 20 6f 72 20 2d 72 65 71 74 61 target or -reqta
6a80: 72 67 20 68 65 72 65 0a 09 28 69 66 20 28 61 72 rg here..(if (ar
6a90: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 gs:get-arg "-req
6aa0: 74 61 72 67 22 29 0a 09 20 20 20 20 28 6c 65 74 targ").. (let
6ab0: 2a 20 28 28 72 75 6e 63 6f 6e 66 69 67 66 20 28 * ((runconfigf (
6ac0: 63 6f 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a 20 conc *toppath*
6ad0: 22 2f 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e "/runconfigs.con
6ae0: 66 69 67 22 29 29 20 3b 3b 20 44 4f 20 4e 4f 54 fig")) ;; DO NOT
6af0: 20 45 56 41 4c 55 41 54 45 20 41 4c 4c 20 0a 09 EVALUATE ALL ..
6b00: 09 20 20 20 28 72 75 6e 63 6f 6e 66 69 67 20 20 . (runconfig
6b10: 28 72 65 61 64 2d 63 6f 6e 66 69 67 20 72 75 6e (read-config run
6b20: 63 6f 6e 66 69 67 66 20 23 66 20 23 66 20 65 6e configf #f #f en
6b30: 76 69 72 6f 6e 2d 70 61 74 74 3a 20 23 66 29 29 viron-patt: #f))
6b40: 29 20 0a 09 20 20 20 20 20 20 28 69 66 20 28 68 ) .. (if (h
6b50: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 ash-table-ref/de
6b60: 66 61 75 6c 74 20 72 75 6e 63 6f 6e 66 69 67 20 fault runconfig
6b70: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d (args:get-arg "-
6b80: 72 65 71 74 61 72 67 22 29 20 23 66 29 0a 09 09 reqtarg") #f)...
6b90: 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 73 (keys:target-s
6ba0: 65 74 2d 61 72 67 73 20 6b 65 79 73 20 28 61 72 et-args keys (ar
6bb0: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 gs:get-arg "-req
6bc0: 74 61 72 67 22 29 20 61 72 67 73 3a 61 72 67 2d targ") args:arg-
6bd0: 68 61 73 68 29 0a 09 09 20 20 28 62 65 67 69 6e hash)... (begin
6be0: 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 ... (debug:pr
6bf0: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 5b 22 int 0 "ERROR: ["
6c00: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
6c10: 2d 72 65 71 74 61 72 67 22 29 20 22 5d 20 6e 6f -reqtarg") "] no
6c20: 74 20 66 6f 75 6e 64 20 69 6e 20 22 20 72 75 6e t found in " run
6c30: 63 6f 6e 66 69 67 66 29 0a 09 09 20 20 20 20 28 configf)... (
6c40: 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 sqlite3:finalize
6c50: 21 20 64 62 29 0a 09 09 20 20 20 20 28 65 78 69 ! db)... (exi
6c60: 74 20 31 29 29 29 29 0a 09 20 20 20 20 28 69 66 t 1)))).. (if
6c70: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
6c80: 2d 74 61 72 67 65 74 22 29 0a 09 09 28 6b 65 79 -target")...(key
6c90: 73 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 72 67 s:target-set-arg
6ca0: 73 20 6b 65 79 73 20 28 61 72 67 73 3a 67 65 74 s keys (args:get
6cb0: 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 20 61 -arg "-target" a
6cc0: 72 67 73 3a 61 72 67 2d 68 61 73 68 29 20 61 72 rgs:arg-hash) ar
6cd0: 67 73 3a 61 72 67 2d 68 61 73 68 29 29 29 0a 09 gs:arg-hash)))..
6ce0: 28 69 66 20 28 6e 6f 74 20 28 63 61 72 20 2a 63 (if (not (car *c
6cf0: 6f 6e 66 69 67 69 6e 66 6f 2a 29 29 0a 09 20 20 onfiginfo*))..
6d00: 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 (begin..
6d10: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
6d20: 45 52 52 4f 52 3a 20 41 74 74 65 6d 70 74 65 64 ERROR: Attempted
6d30: 20 74 6f 20 22 20 61 63 74 69 6f 6e 2d 64 65 73 to " action-des
6d40: 63 20 22 20 62 75 74 20 72 75 6e 20 61 72 65 61 c " but run area
6d50: 20 63 6f 6e 66 69 67 20 66 69 6c 65 20 6e 6f 74 config file not
6d60: 20 66 6f 75 6e 64 22 29 0a 09 20 20 20 20 20 20 found")..
6d70: 28 65 78 69 74 20 31 29 29 0a 09 20 20 20 20 3b (exit 1)).. ;
6d80: 3b 20 45 78 74 72 61 63 74 20 6f 75 74 20 73 74 ; Extract out st
6d90: 75 66 66 20 6e 65 65 64 65 64 20 69 6e 20 6d 6f uff needed in mo
6da0: 73 74 20 6f 72 20 6d 61 6e 79 20 63 61 6c 6c 73 st or many calls
6db0: 0a 09 20 20 20 20 3b 3b 20 68 65 72 65 20 74 68 .. ;; here th
6dc0: 65 6e 20 63 61 6c 6c 20 70 72 6f 63 0a 09 20 20 en call proc..
6dd0: 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 6e 61 6d (let* ((keynam
6de0: 65 73 20 20 20 28 6d 61 70 20 6b 65 79 3a 67 65 es (map key:ge
6df0: 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79 73 t-fieldname keys
6e00: 29 29 0a 09 09 20 20 20 28 6b 65 79 76 61 6c 6c ))... (keyvall
6e10: 73 74 20 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69 st (keys->valli
6e20: 73 74 20 6b 65 79 73 20 23 74 29 29 29 0a 09 20 st keys #t)))..
6e30: 20 20 20 20 20 28 70 72 6f 63 20 64 62 20 74 61 (proc db ta
6e40: 72 67 65 74 20 72 75 6e 6e 61 6d 65 20 6b 65 79 rget runname key
6e50: 73 20 6b 65 79 6e 61 6d 65 73 20 6b 65 79 76 61 s keynames keyva
6e60: 6c 6c 73 74 29 29 29 0a 09 28 73 71 6c 69 74 65 llst)))..(sqlite
6e70: 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 29 0a 3:finalize! db).
6e80: 09 28 73 65 74 21 20 2a 64 69 64 73 6f 6d 65 74 .(set! *didsomet
6e90: 68 69 6e 67 2a 20 23 74 29 29 29 29 29 29 0a 0a hing* #t))))))..
6ea0: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;;==============
6eb0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6ec0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6ed0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6ee0: 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 6c 6c ========.;; Roll
6ef0: 75 70 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d up runs.;;======
6f00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6f10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6f20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6f30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6f40: 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74 68 65 20 ..;; Update the
6f50: 74 65 73 74 5f 6d 65 74 61 20 74 61 62 6c 65 20 test_meta table
6f60: 66 6f 72 20 74 68 69 73 20 74 65 73 74 0a 28 64 for this test.(d
6f70: 65 66 69 6e 65 20 28 72 75 6e 73 3a 75 70 64 61 efine (runs:upda
6f80: 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20 te-test_meta db
6f90: 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 test-name test-c
6fa0: 6f 6e 66 29 0a 20 20 28 6c 65 74 20 28 28 63 75 onf). (let ((cu
6fb0: 72 72 72 65 63 6f 72 64 20 28 64 62 3a 74 65 73 rrrecord (db:tes
6fc0: 74 6d 65 74 61 2d 67 65 74 2d 72 65 63 6f 72 64 tmeta-get-record
6fd0: 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 db test-name)))
6fe0: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 63 75 . (if (not cu
6ff0: 72 72 72 65 63 6f 72 64 29 0a 09 28 62 65 67 69 rrrecord)..(begi
7000: 6e 0a 09 20 20 28 73 65 74 21 20 63 75 72 72 72 n.. (set! currr
7010: 65 63 6f 72 64 20 28 6d 61 6b 65 2d 76 65 63 74 ecord (make-vect
7020: 6f 72 20 31 30 20 23 66 29 29 0a 09 20 20 28 64 or 10 #f)).. (d
7030: 62 3a 74 65 73 74 6d 65 74 61 2d 61 64 64 2d 72 b:testmeta-add-r
7040: 65 63 6f 72 64 20 64 62 20 74 65 73 74 2d 6e 61 ecord db test-na
7050: 6d 65 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 me))). (for-e
7060: 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 ach . (lambd
7070: 61 20 28 6b 65 79 29 0a 20 20 20 20 20 20 20 28 a (key). (
7080: 6c 65 74 2a 20 28 28 69 64 78 20 28 63 61 64 72 let* ((idx (cadr
7090: 20 6b 65 79 29 29 0a 09 20 20 20 20 20 20 28 66 key)).. (f
70a0: 6c 64 20 28 63 61 72 20 20 6b 65 79 29 29 0a 09 ld (car key))..
70b0: 20 20 20 20 20 20 28 76 61 6c 20 28 63 6f 6e 66 (val (conf
70c0: 69 67 2d 6c 6f 6f 6b 75 70 20 74 65 73 74 2d 63 ig-lookup test-c
70d0: 6f 6e 66 20 22 74 65 73 74 5f 6d 65 74 61 22 20 onf "test_meta"
70e0: 66 6c 64 29 29 29 0a 09 20 3b 3b 20 28 64 65 62 fld))).. ;; (deb
70f0: 75 67 3a 70 72 69 6e 74 20 35 20 22 69 64 78 3a ug:print 5 "idx:
7100: 20 22 20 69 64 78 20 22 20 66 6c 64 3a 20 22 20 " idx " fld: "
7110: 66 6c 64 20 22 20 76 61 6c 3a 20 22 20 76 61 6c fld " val: " val
7120: 29 0a 09 20 28 69 66 20 28 61 6e 64 20 76 61 6c ).. (if (and val
7130: 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 28 76 (not (equal? (v
7140: 65 63 74 6f 72 2d 72 65 66 20 63 75 72 72 72 65 ector-ref currre
7150: 63 6f 72 64 20 69 64 78 29 20 76 61 6c 29 29 29 cord idx) val)))
7160: 0a 09 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20 .. (begin..
7170: 20 20 20 20 20 20 28 70 72 69 6e 74 20 22 55 70 (print "Up
7180: 64 61 74 69 6e 67 20 22 20 74 65 73 74 2d 6e 61 dating " test-na
7190: 6d 65 20 22 20 22 20 66 6c 64 20 22 20 74 6f 20 me " " fld " to
71a0: 22 20 76 61 6c 29 0a 09 20 20 20 20 20 20 20 28 " val).. (
71b0: 64 62 3a 74 65 73 74 6d 65 74 61 2d 75 70 64 61 db:testmeta-upda
71c0: 74 65 2d 66 69 65 6c 64 20 64 62 20 74 65 73 74 te-field db test
71d0: 2d 6e 61 6d 65 20 66 6c 64 20 76 61 6c 29 29 29 -name fld val)))
71e0: 29 29 0a 20 20 20 20 20 27 28 28 22 61 75 74 68 )). '(("auth
71f0: 6f 72 22 20 32 29 28 22 6f 77 6e 65 72 22 20 33 or" 2)("owner" 3
7200: 29 28 22 64 65 73 63 72 69 70 74 69 6f 6e 22 20 )("description"
7210: 34 29 28 22 72 65 76 69 65 77 65 64 22 20 35 29 4)("reviewed" 5)
7220: 28 22 74 61 67 73 22 20 39 29 29 29 29 29 0a 0a ("tags" 9)))))..
7230: 3b 3b 20 55 70 64 61 74 65 20 74 65 73 74 5f 6d ;; Update test_m
7240: 65 74 61 20 66 6f 72 20 61 6c 6c 20 74 65 73 74 eta for all test
7250: 73 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a s.(define (runs:
7260: 75 70 64 61 74 65 2d 61 6c 6c 2d 74 65 73 74 5f update-all-test_
7270: 6d 65 74 61 20 64 62 29 0a 20 20 28 6c 65 74 20 meta db). (let
7280: 28 28 74 65 73 74 2d 6e 61 6d 65 73 20 28 67 65 ((test-names (ge
7290: 74 2d 61 6c 6c 2d 6c 65 67 61 6c 2d 74 65 73 74 t-all-legal-test
72a0: 73 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 s))). (for-ea
72b0: 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 ch . (lambda
72c0: 20 28 74 65 73 74 2d 6e 61 6d 65 29 0a 20 20 20 (test-name).
72d0: 20 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 (let* ((test
72e0: 2d 70 61 74 68 20 20 20 20 28 63 6f 6e 63 20 2a -path (conc *
72f0: 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 toppath* "/tests
7300: 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29 29 0a 09 /" test-name))..
7310: 20 20 20 20 20 20 28 74 65 73 74 2d 63 6f 6e 66 (test-conf
7320: 69 67 66 20 28 63 6f 6e 63 20 74 65 73 74 2d 70 igf (conc test-p
7330: 61 74 68 20 22 2f 74 65 73 74 63 6f 6e 66 69 67 ath "/testconfig
7340: 22 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 ")).. (test
7350: 65 78 69 73 74 73 20 20 20 28 61 6e 64 20 28 66 exists (and (f
7360: 69 6c 65 2d 65 78 69 73 74 73 3f 20 74 65 73 74 ile-exists? test
7370: 2d 63 6f 6e 66 69 67 66 29 28 66 69 6c 65 2d 72 -configf)(file-r
7380: 65 61 64 2d 61 63 63 65 73 73 3f 20 74 65 73 74 ead-access? test
7390: 2d 63 6f 6e 66 69 67 66 29 29 29 0a 09 20 20 20 -configf)))..
73a0: 20 20 20 3b 3b 20 72 65 61 64 20 63 6f 6e 66 69 ;; read confi
73b0: 67 73 20 77 69 74 68 20 74 72 69 63 6b 73 20 74 gs with tricks t
73c0: 75 72 6e 65 64 20 6f 66 66 20 28 69 2e 65 2e 20 urned off (i.e.
73d0: 6e 6f 20 73 79 73 74 65 6d 29 0a 09 20 20 20 20 no system)..
73e0: 20 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 20 (test-conf
73f0: 28 69 66 20 74 65 73 74 65 78 69 73 74 73 20 28 (if testexists (
7400: 72 65 61 64 2d 63 6f 6e 66 69 67 20 74 65 73 74 read-config test
7410: 2d 63 6f 6e 66 69 67 66 20 23 66 20 23 66 29 28 -configf #f #f)(
7420: 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 make-hash-table)
7430: 29 29 29 0a 09 20 28 72 75 6e 73 3a 75 70 64 61 ))).. (runs:upda
7440: 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20 te-test_meta db
7450: 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 test-name test-c
7460: 6f 6e 66 29 29 29 0a 20 20 20 20 20 74 65 73 74 onf))). test
7470: 2d 6e 61 6d 65 73 29 29 29 0a 0a 3b 3b 20 54 68 -names)))..;; Th
7480: 69 73 20 63 6f 75 6c 64 20 70 72 6f 62 61 62 6c is could probabl
7490: 79 20 62 65 20 72 65 66 61 63 74 6f 72 65 64 20 y be refactored
74a0: 69 6e 74 6f 20 6f 6e 65 20 63 6f 6d 70 6c 65 78 into one complex
74b0: 20 71 75 65 72 79 20 2e 2e 2e 0a 28 64 65 66 69 query ....(defi
74c0: 6e 65 20 28 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d ne (runs:rollup-
74d0: 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 run db keys keyv
74e0: 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 75 73 allst runname us
74f0: 65 72 29 20 3b 3b 20 77 61 73 20 74 61 72 67 65 er) ;; was targe
7500: 74 2c 20 6e 6f 77 20 6b 65 79 76 61 6c 6c 73 74 t, now keyvallst
7510: 0a 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 . (debug:print
7520: 34 20 22 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 4 "runs:rollup-r
7530: 75 6e 2c 20 6b 65 79 73 3a 20 22 20 6b 65 79 73 un, keys: " keys
7540: 20 22 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 " keyvallst: "
7550: 6b 65 79 76 61 6c 6c 73 74 20 22 20 3a 72 75 6e keyvallst " :run
7560: 6e 61 6d 65 20 22 20 72 75 6e 6e 61 6d 65 20 22 name " runname "
7570: 20 75 73 65 72 3a 20 22 20 75 73 65 72 29 0a 20 user: " user).
7580: 20 28 6c 65 74 2a 20 28 3b 20 28 6b 65 79 76 61 (let* (; (keyva
7590: 6c 6c 6c 73 74 20 20 20 20 20 20 28 6b 65 79 73 lllst (keys
75a0: 3a 74 61 72 67 65 74 2d 3e 6b 65 79 76 61 6c 20 :target->keyval
75b0: 6b 65 79 73 20 74 61 72 67 65 74 29 29 0a 09 20 keys target))..
75c0: 28 6e 65 77 2d 72 75 6e 2d 69 64 20 20 20 20 20 (new-run-id
75d0: 20 28 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d (runs:register-
75e0: 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 run db keys keyv
75f0: 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e allst runname "n
7600: 65 77 22 20 22 6e 2f 61 22 20 75 73 65 72 29 29 ew" "n/a" user))
7610: 0a 09 20 28 70 72 65 76 2d 74 65 73 74 73 20 20 .. (prev-tests
7620: 20 20 20 20 28 74 65 73 74 3a 67 65 74 2d 6d 61 (test:get-ma
7630: 74 63 68 69 6e 67 2d 70 72 65 76 69 6f 75 73 2d tching-previous-
7640: 74 65 73 74 2d 72 75 6e 2d 72 65 63 6f 72 64 73 test-run-records
7650: 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 22 db new-run-id "
7660: 25 22 20 22 25 22 29 29 0a 09 20 28 63 75 72 72 %" "%")).. (curr
7670: 2d 74 65 73 74 73 20 20 20 20 20 20 28 64 62 2d -tests (db-
7680: 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 get-tests-for-ru
7690: 6e 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 n db new-run-id
76a0: 22 25 22 20 22 25 22 20 27 28 29 20 27 28 29 29 "%" "%" '() '())
76b0: 29 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73 2d ).. (curr-tests-
76c0: 68 61 73 68 20 28 6d 61 6b 65 2d 68 61 73 68 2d hash (make-hash-
76d0: 74 61 62 6c 65 29 29 29 0a 20 20 20 20 28 64 62 table))). (db
76e0: 3a 75 70 64 61 74 65 2d 72 75 6e 2d 65 76 65 6e :update-run-even
76f0: 74 5f 74 69 6d 65 20 64 62 20 6e 65 77 2d 72 75 t_time db new-ru
7700: 6e 2d 69 64 29 0a 20 20 20 20 3b 3b 20 69 6e 64 n-id). ;; ind
7710: 65 78 20 74 68 65 20 61 6c 72 65 61 64 79 20 73 ex the already s
7720: 61 76 65 64 20 74 65 73 74 73 20 62 79 20 74 65 aved tests by te
7730: 73 74 6e 61 6d 65 20 61 6e 64 20 69 74 65 6d 64 stname and itemd
7740: 61 74 20 69 6e 20 63 75 72 72 2d 74 65 73 74 73 at in curr-tests
7750: 2d 68 61 73 68 0a 20 20 20 20 28 66 6f 72 2d 65 -hash. (for-e
7760: 61 63 68 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 ach. (lambda
7770: 20 28 74 65 73 74 64 61 74 29 0a 20 20 20 20 20 (testdat).
7780: 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 (let* ((testna
7790: 6d 65 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 me (db:test-get
77a0: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 64 61 -testname testda
77b0: 74 29 29 0a 09 20 20 20 20 20 20 28 69 74 65 6d t)).. (item
77c0: 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 -path (db:test-g
77d0: 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 et-item-path tes
77e0: 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 66 tdat)).. (f
77f0: 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 ull-name (conc t
7800: 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d estname "/" item
7810: 2d 70 61 74 68 29 29 29 0a 09 20 28 68 61 73 68 -path))).. (hash
7820: 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72 72 -table-set! curr
7830: 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c -tests-hash full
7840: 2d 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29 29 -name testdat)))
7850: 0a 20 20 20 20 20 63 75 72 72 2d 74 65 73 74 73 . curr-tests
7860: 29 0a 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 4e ). ;; NOPE: N
7870: 6f 6e 2d 6f 70 74 69 6d 61 6c 20 61 70 70 72 6f on-optimal appro
7880: 61 63 68 2e 20 54 72 79 20 74 68 69 73 20 69 6e ach. Try this in
7890: 73 74 65 61 64 2e 0a 20 20 20 20 3b 3b 20 20 20 stead.. ;;
78a0: 31 2e 20 74 65 73 74 73 20 61 72 65 20 72 65 63 1. tests are rec
78b0: 65 69 76 65 64 20 69 6e 20 61 20 6c 69 73 74 2c eived in a list,
78c0: 20 6d 6f 73 74 20 72 65 63 65 6e 74 20 66 69 72 most recent fir
78d0: 73 74 0a 20 20 20 20 3b 3b 20 20 20 32 2e 20 72 st. ;; 2. r
78e0: 65 70 6c 61 63 65 20 74 68 65 20 72 6f 6c 6c 75 eplace the rollu
78f0: 70 20 74 65 73 74 20 77 69 74 68 20 74 68 65 20 p test with the
7900: 6e 65 77 20 2a 61 6c 77 61 79 73 2a 0a 20 20 20 new *always*.
7910: 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 (for-each .
7920: 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 64 61 (lambda (testda
7930: 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 t). (let*
7940: 28 28 74 65 73 74 6e 61 6d 65 20 20 28 64 62 3a ((testname (db:
7950: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d test-get-testnam
7960: 65 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 e testdat))..
7970: 20 20 20 28 69 74 65 6d 2d 70 61 74 68 20 28 64 (item-path (d
7980: 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d b:test-get-item-
7990: 70 61 74 68 20 74 65 73 74 64 61 74 29 29 0a 09 path testdat))..
79a0: 20 20 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 (full-name
79b0: 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 (conc testname
79c0: 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 0a "/" item-path)).
79d0: 09 20 20 20 20 20 20 28 70 72 65 76 2d 74 65 73 . (prev-tes
79e0: 74 2d 64 61 74 20 28 68 61 73 68 2d 74 61 62 6c t-dat (hash-tabl
79f0: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63 75 e-ref/default cu
7a00: 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 rr-tests-hash fu
7a10: 6c 6c 2d 6e 61 6d 65 20 23 66 29 29 0a 09 20 20 ll-name #f))..
7a20: 20 20 20 20 28 74 65 73 74 2d 73 74 65 70 73 20 (test-steps
7a30: 20 20 20 20 20 28 64 62 3a 67 65 74 2d 73 74 65 (db:get-ste
7a40: 70 73 2d 66 6f 72 2d 74 65 73 74 20 64 62 20 28 ps-for-test db (
7a50: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 db:test-get-id t
7a60: 65 73 74 64 61 74 29 29 29 0a 09 20 20 20 20 20 estdat)))..
7a70: 20 28 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 (new-test-recor
7a80: 64 20 23 66 29 29 0a 09 20 3b 3b 20 72 65 70 6c d #f)).. ;; repl
7a90: 61 63 65 20 74 68 65 73 65 20 77 69 74 68 20 69 ace these with i
7aa0: 6e 73 65 72 74 20 2e 2e 2e 20 73 65 6c 65 63 74 nsert ... select
7ab0: 0a 09 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 .. (apply sqlite
7ac0: 33 3a 65 78 65 63 75 74 65 20 0a 09 09 64 62 20 3:execute ...db
7ad0: 0a 09 09 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 ...(conc "INSERT
7ae0: 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f OR REPLACE INTO
7af0: 20 74 65 73 74 73 20 28 72 75 6e 5f 69 64 2c 74 tests (run_id,t
7b00: 65 73 74 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 estname,state,st
7b10: 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c atus,event_time,
7b20: 68 6f 73 74 2c 63 70 75 6c 6f 61 64 2c 64 69 73 host,cpuload,dis
7b30: 6b 66 72 65 65 2c 75 6e 61 6d 65 2c 72 75 6e 64 kfree,uname,rund
7b40: 69 72 2c 69 74 65 6d 5f 70 61 74 68 2c 72 75 6e ir,item_path,run
7b50: 5f 64 75 72 61 74 69 6f 6e 2c 66 69 6e 61 6c 5f _duration,final_
7b60: 6c 6f 67 66 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a logf,comment) ".
7b70: 09 09 20 20 20 20 20 20 22 56 41 4c 55 45 53 20 .. "VALUES
7b80: 28 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f (?,?,?,?,?,?,?,?
7b90: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 29 3b 22 29 ,?,?,?,?,?,?);")
7ba0: 0a 09 09 6e 65 77 2d 72 75 6e 2d 69 64 20 28 63 ...new-run-id (c
7bb0: 64 64 72 20 28 76 65 63 74 6f 72 2d 3e 6c 69 73 ddr (vector->lis
7bc0: 74 20 74 65 73 74 64 61 74 29 29 29 0a 09 20 28 t testdat))).. (
7bd0: 73 65 74 21 20 6e 65 77 2d 74 65 73 74 64 61 74 set! new-testdat
7be0: 20 28 63 61 72 20 28 64 62 2d 67 65 74 2d 74 65 (car (db-get-te
7bf0: 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e sts-for-run db n
7c00: 65 77 2d 72 75 6e 2d 69 64 20 74 65 73 74 6e 61 ew-run-id testna
7c10: 6d 65 20 69 74 65 6d 2d 70 61 74 68 20 27 28 29 me item-path '()
7c20: 20 27 28 29 29 29 29 0a 09 20 28 68 61 73 68 2d '()))).. (hash-
7c30: 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72 72 2d table-set! curr-
7c40: 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d tests-hash full-
7c50: 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74 64 61 74 name new-testdat
7c60: 29 20 3b 3b 20 74 68 69 73 20 63 6f 75 6c 64 20 ) ;; this could
7c70: 62 65 20 63 6f 6e 66 75 73 69 6e 67 2c 20 77 68 be confusing, wh
7c80: 69 63 68 20 72 65 63 6f 72 64 20 73 68 6f 75 6c ich record shoul
7c90: 64 20 67 6f 20 69 6e 74 6f 20 74 68 65 20 6c 6f d go into the lo
7ca0: 6f 6b 75 70 20 74 61 62 6c 65 3f 0a 09 20 3b 3b okup table?.. ;;
7cb0: 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74 Now duplicate t
7cc0: 68 65 20 74 65 73 74 20 73 74 65 70 73 0a 09 20 he test steps..
7cd0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 (debug:print 4 "
7ce0: 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 73 20 Copying records
7cf0: 69 6e 20 74 65 73 74 5f 73 74 65 70 73 20 66 72 in test_steps fr
7d00: 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62 om test_id=" (db
7d10: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 :test-get-id tes
7d20: 74 64 61 74 29 20 22 20 74 6f 20 22 20 28 64 62 tdat) " to " (db
7d30: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 :test-get-id new
7d40: 2d 74 65 73 74 64 61 74 29 29 0a 09 20 28 73 71 -testdat)).. (sq
7d50: 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09 lite3:execute ..
7d60: 20 20 64 62 20 0a 09 20 20 28 63 6f 6e 63 20 22 db .. (conc "
7d70: 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 INSERT OR REPLAC
7d80: 45 20 49 4e 54 4f 20 74 65 73 74 5f 73 74 65 70 E INTO test_step
7d90: 73 20 28 74 65 73 74 5f 69 64 2c 73 74 65 70 6e s (test_id,stepn
7da0: 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 ame,state,status
7db0: 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d ,event_time,comm
7dc0: 65 6e 74 29 20 22 0a 09 09 22 53 45 4c 45 43 54 ent) "..."SELECT
7dd0: 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d " (db:test-get-
7de0: 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20 id new-testdat)
7df0: 22 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 74 65 ",stepname,state
7e00: 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 ,status,event_ti
7e10: 6d 65 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 me,comment FROM
7e20: 74 65 73 74 5f 73 74 65 70 73 20 57 48 45 52 45 test_steps WHERE
7e30: 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 test_id=?;")..
7e40: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 (db:test-get-id
7e50: 20 74 65 73 74 64 61 74 29 29 0a 09 20 3b 3b 20 testdat)).. ;;
7e60: 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74 68 Now duplicate th
7e70: 65 20 74 65 73 74 20 64 61 74 61 0a 09 20 28 64 e test data.. (d
7e80: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 43 6f ebug:print 4 "Co
7e90: 70 79 69 6e 67 20 72 65 63 6f 72 64 73 20 69 6e pying records in
7ea0: 20 74 65 73 74 5f 64 61 74 61 20 66 72 6f 6d 20 test_data from
7eb0: 74 65 73 74 5f 69 64 3d 22 20 28 64 62 3a 74 65 test_id=" (db:te
7ec0: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 st-get-id testda
7ed0: 74 29 20 22 20 74 6f 20 22 20 28 64 62 3a 74 65 t) " to " (db:te
7ee0: 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 st-get-id new-te
7ef0: 73 74 64 61 74 29 29 0a 09 20 28 73 71 6c 69 74 stdat)).. (sqlit
7f00: 65 33 3a 65 78 65 63 75 74 65 20 0a 09 20 20 64 e3:execute .. d
7f10: 62 20 0a 09 20 20 28 63 6f 6e 63 20 22 49 4e 53 b .. (conc "INS
7f20: 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49 ERT OR REPLACE I
7f30: 4e 54 4f 20 74 65 73 74 5f 64 61 74 61 20 28 74 NTO test_data (t
7f40: 65 73 74 5f 69 64 2c 63 61 74 65 67 6f 72 79 2c est_id,category,
7f50: 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65 variable,value,e
7f60: 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 xpected,tol,unit
7f70: 73 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 22 s,comment) "..."
7f80: 53 45 4c 45 43 54 20 22 20 28 64 62 3a 74 65 73 SELECT " (db:tes
7f90: 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 t-get-id new-tes
7fa0: 74 64 61 74 29 20 22 2c 63 61 74 65 67 6f 72 79 tdat) ",category
7fb0: 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c ,variable,value,
7fc0: 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 expected,tol,uni
7fd0: 74 73 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 ts,comment FROM
7fe0: 74 65 73 74 5f 64 61 74 61 20 57 48 45 52 45 20 test_data WHERE
7ff0: 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 test_id=?;")..
8000: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 (db:test-get-id
8010: 74 65 73 74 64 61 74 29 29 0a 09 20 29 29 0a 20 testdat)).. )).
8020: 20 20 20 20 70 72 65 76 2d 74 65 73 74 73 29 29 prev-tests))
8030: 29 0a 09 20 0a 20 20 20 20 20 0a ).. . .