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 3b 3b 20 4e e test.. ;; N
4950: 4f 50 45 3a 20 43 61 6e 6e 6f 74 21 20 44 6f 6e OPE: Cannot! Don
4960: 27 74 20 6b 6e 6f 77 20 79 65 74 20 77 68 69 63 't know yet whic
4970: 68 20 64 69 73 6b 20 61 72 65 61 20 77 69 6c 6c h disk area will
4980: 20 62 65 20 61 73 73 69 67 6e 65 64 2e 2e 2e 2e be assigned....
4990: 0a 09 20 20 20 20 3b 3b 20 28 73 79 73 74 65 6d .. ;; (system
49a0: 20 28 63 6f 6e 63 20 22 6d 6b 64 69 72 20 2d 70 (conc "mkdir -p
49b0: 20 22 20 6e 65 77 2d 74 65 73 74 2d 70 61 74 68 " new-test-path
49c0: 29 29 0a 09 20 20 20 20 28 72 65 67 69 73 74 65 )).. (registe
49d0: 72 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 r-test db run-id
49e0: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d test-name item-
49f0: 70 61 74 68 29 0a 09 20 20 20 20 28 73 65 74 21 path).. (set!
4a00: 20 74 65 73 74 64 61 74 20 28 64 62 3a 67 65 74 testdat (db:get
4a10: 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 20 72 75 -test-info db ru
4a20: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 n-id test-name i
4a30: 74 65 6d 2d 70 61 74 68 29 29 29 29 0a 20 20 20 tem-path)))).
4a40: 20 20 20 28 63 68 61 6e 67 65 2d 64 69 72 65 63 (change-direc
4a50: 74 6f 72 79 20 74 65 73 74 2d 70 61 74 68 29 0a tory test-path).
4a60: 20 20 20 20 20 20 28 63 61 73 65 20 28 69 66 20 (case (if
4a70: 66 6f 72 63 65 20 3b 3b 20 28 61 72 67 73 3a 67 force ;; (args:g
4a80: 65 74 2d 61 72 67 20 22 2d 66 6f 72 63 65 22 29 et-arg "-force")
4a90: 0a 09 09 27 4e 4f 54 5f 53 54 41 52 54 45 44 0a ...'NOT_STARTED.
4aa0: 09 09 28 69 66 20 74 65 73 74 64 61 74 0a 09 09 ..(if testdat...
4ab0: 20 20 20 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d (string->sym
4ac0: 62 6f 6c 20 28 74 65 73 74 3a 67 65 74 2d 73 74 bol (test:get-st
4ad0: 61 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 09 ate testdat))...
4ae0: 20 20 20 20 27 66 61 69 6c 65 64 2d 74 6f 2d 69 'failed-to-i
4af0: 6e 73 65 72 74 29 29 0a 09 28 28 66 61 69 6c 65 nsert))..((faile
4b00: 64 2d 74 6f 2d 69 6e 73 65 72 74 29 0a 09 20 28 d-to-insert).. (
4b10: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 debug:print 0 "E
4b20: 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 RROR: Failed to
4b30: 69 6e 73 65 72 74 20 74 68 65 20 72 65 63 6f 72 insert the recor
4b40: 64 20 69 6e 74 6f 20 74 68 65 20 64 62 22 29 29 d into the db"))
4b50: 0a 09 28 28 4e 4f 54 5f 53 54 41 52 54 45 44 20 ..((NOT_STARTED
4b60: 43 4f 4d 50 4c 45 54 45 44 29 0a 09 20 28 64 65 COMPLETED).. (de
4b70: 62 75 67 3a 70 72 69 6e 74 20 36 20 22 47 6f 74 bug:print 6 "Got
4b80: 20 68 65 72 65 2c 20 22 20 28 74 65 73 74 3a 67 here, " (test:g
4b90: 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 et-state testdat
4ba0: 29 29 0a 09 20 28 6c 65 74 20 28 28 72 75 6e 66 )).. (let ((runf
4bb0: 6c 61 67 20 23 66 29 29 0a 09 20 20 20 28 63 6f lag #f)).. (co
4bc0: 6e 64 0a 09 20 20 20 20 3b 3b 20 2d 66 6f 72 63 nd.. ;; -forc
4bd0: 65 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 e, run no matter
4be0: 20 77 68 61 74 0a 09 20 20 20 20 28 66 6f 72 63 what.. (forc
4bf0: 65 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 e (set! runflag
4c00: 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 4e 4f 54 #t)).. ;; NOT
4c10: 5f 53 54 41 52 54 45 44 2c 20 72 75 6e 20 6e 6f _STARTED, run no
4c20: 20 6d 61 74 74 65 72 20 77 68 61 74 0a 09 20 20 matter what..
4c30: 20 20 28 28 65 71 75 61 6c 3f 20 28 74 65 73 74 ((equal? (test
4c40: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 :get-state testd
4c50: 61 74 29 20 22 4e 4f 54 5f 53 54 41 52 54 45 44 at) "NOT_STARTED
4c60: 22 29 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 ")(set! runflag
4c70: 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 6e 6f 74 #t)).. ;; not
4c80: 20 2d 72 65 72 75 6e 20 61 6e 64 20 50 41 53 53 -rerun and PASS
4c90: 2c 20 57 41 52 4e 20 6f 72 20 43 48 45 43 4b 2c , WARN or CHECK,
4ca0: 20 64 6f 20 6e 6f 20 72 75 6e 0a 09 20 20 20 20 do no run..
4cb0: 28 28 61 6e 64 20 28 6f 72 20 28 6e 6f 74 20 72 ((and (or (not r
4cc0: 65 72 75 6e 29 0a 09 09 20 20 20 20 20 20 6b 65 erun)... ke
4cd0: 65 70 67 6f 69 6e 67 29 0a 09 09 20 20 3b 3b 20 epgoing)... ;;
4ce0: 52 65 71 75 69 72 65 20 74 6f 20 66 6f 72 63 65 Require to force
4cf0: 20 72 65 2d 72 75 6e 20 66 6f 72 20 43 4f 4d 50 re-run for COMP
4d00: 4c 45 54 45 44 20 6f 72 20 2a 61 6e 79 74 68 69 LETED or *anythi
4d10: 6e 67 2a 20 2b 20 50 41 53 53 2c 57 41 52 4e 20 ng* + PASS,WARN
4d20: 6f 72 20 43 48 45 43 4b 0a 09 09 20 20 28 6f 72 or CHECK... (or
4d30: 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 (member (test:g
4d40: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 et-status testda
4d50: 74 29 20 27 28 22 50 41 53 53 22 20 22 57 41 52 t) '("PASS" "WAR
4d60: 4e 22 20 22 43 48 45 43 4b 22 29 29 0a 09 09 20 N" "CHECK"))...
4d70: 20 20 20 20 20 28 6d 65 6d 62 65 72 20 28 74 65 (member (te
4d80: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 20 74 65 st:get-state te
4d90: 73 74 64 61 74 29 20 27 28 22 43 4f 4d 50 4c 45 stdat) '("COMPLE
4da0: 54 45 44 22 29 29 29 29 20 0a 09 20 20 20 20 20 TED")))) ..
4db0: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 (set! runflag #f
4dc0: 29 29 0a 09 20 20 20 20 3b 3b 20 2d 72 65 72 75 )).. ;; -reru
4dd0: 6e 20 61 6e 64 20 73 74 61 74 75 73 20 69 73 20 n and status is
4de0: 6f 6e 65 20 6f 66 20 74 68 65 20 73 70 65 63 69 one of the speci
4df0: 66 65 64 2c 20 72 75 6e 20 69 74 0a 09 20 20 20 fed, run it..
4e00: 20 28 28 61 6e 64 20 72 65 72 75 6e 0a 09 09 20 ((and rerun...
4e10: 20 28 6c 65 74 20 28 28 72 65 72 75 6e 6c 73 74 (let ((rerunlst
4e20: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 72 (string-split r
4e30: 65 72 75 6e 20 22 2c 22 29 29 29 20 3b 3b 20 46 erun ","))) ;; F
4e40: 41 49 4c 2c 0a 09 09 20 20 20 20 28 6d 65 6d 62 AIL,... (memb
4e50: 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 er (test:get-sta
4e60: 74 75 73 20 74 65 73 74 64 61 74 29 20 72 65 72 tus testdat) rer
4e70: 75 6e 6c 73 74 29 29 29 0a 09 20 20 20 20 20 28 unlst))).. (
4e80: 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 set! runflag #t)
4e90: 29 0a 09 20 20 20 20 3b 3b 20 2d 6b 65 65 70 67 ).. ;; -keepg
4ea0: 6f 69 6e 67 2c 20 64 6f 20 6e 6f 74 20 72 65 72 oing, do not rer
4eb0: 75 6e 20 46 41 49 4c 0a 09 20 20 20 20 28 28 61 un FAIL.. ((a
4ec0: 6e 64 20 6b 65 65 70 67 6f 69 6e 67 0a 09 09 20 nd keepgoing...
4ed0: 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 (member (test:g
4ee0: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 et-status testda
4ef0: 74 29 20 27 28 22 46 41 49 4c 22 29 29 29 0a 09 t) '("FAIL")))..
4f00: 20 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c (set! runfl
4f10: 61 67 20 23 66 29 29 0a 09 20 20 20 20 28 28 61 ag #f)).. ((a
4f20: 6e 64 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a 09 nd (not rerun)..
4f30: 09 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 . (member (test
4f40: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 :get-status test
4f50: 64 61 74 29 20 27 28 22 46 41 49 4c 22 20 22 6e dat) '("FAIL" "n
4f60: 2f 61 22 29 29 29 0a 09 20 20 20 20 20 28 73 65 /a"))).. (se
4f70: 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a t! runflag #t)).
4f80: 09 20 20 20 20 28 65 6c 73 65 20 28 73 65 74 21 . (else (set!
4f90: 20 72 75 6e 66 6c 61 67 20 23 66 29 29 29 0a 09 runflag #f)))..
4fa0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
4fb0: 36 20 22 52 55 4e 4e 49 4e 47 20 3d 3e 20 72 75 6 "RUNNING => ru
4fc0: 6e 66 6c 61 67 3a 20 22 20 72 75 6e 66 6c 61 67 nflag: " runflag
4fd0: 20 22 20 53 54 41 54 45 3a 20 22 20 28 74 65 73 " STATE: " (tes
4fe0: 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 t:get-state test
4ff0: 64 61 74 29 20 22 20 53 54 41 54 55 53 3a 20 22 dat) " STATUS: "
5000: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 (test:get-statu
5010: 73 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 s testdat))..
5020: 28 69 66 20 28 6e 6f 74 20 72 75 6e 66 6c 61 67 (if (not runflag
5030: 29 0a 09 20 20 20 20 20 20 20 28 69 66 20 28 6e ).. (if (n
5040: 6f 74 20 70 61 72 65 6e 74 2d 74 65 73 74 29 0a ot parent-test).
5050: 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e .. (debug:prin
5060: 74 20 31 20 22 4e 4f 54 45 3a 20 4e 6f 74 20 73 t 1 "NOTE: Not s
5070: 74 61 72 74 69 6e 67 20 74 65 73 74 20 22 20 6e tarting test " n
5080: 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 ew-test-name " a
5090: 73 20 69 74 20 69 73 20 73 74 61 74 65 20 5c 22 s it is state \"
50a0: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 " (test:get-stat
50b0: 65 20 74 65 73 74 64 61 74 29 20 0a 09 09 09 09 e testdat) .....
50c0: 22 5c 22 20 61 6e 64 20 73 74 61 74 75 73 20 5c "\" and status \
50d0: 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 "" (test:get-sta
50e0: 74 75 73 20 74 65 73 74 64 61 74 29 20 22 5c 22 tus testdat) "\"
50f0: 2c 20 75 73 65 20 2d 72 65 72 75 6e 20 5c 22 22 , use -rerun \""
5100: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 (test:get-state
5110: 20 74 65 73 74 64 61 74 29 20 22 5c 22 20 6f 72 testdat) "\" or
5120: 20 2d 66 6f 72 63 65 20 74 6f 20 6f 76 65 72 72 -force to overr
5130: 69 64 65 22 29 29 0a 09 20 20 20 20 20 20 20 3b ide")).. ;
5140: 3b 20 4e 4f 54 45 3a 20 4e 6f 20 6c 6f 6e 67 65 ; NOTE: No longe
5150: 72 20 62 65 20 63 68 65 63 6b 69 6e 67 20 70 72 r be checking pr
5160: 65 72 65 71 75 69 73 69 74 65 73 20 68 65 72 65 erequisites here
5170: 21 20 57 69 6c 6c 20 6e 65 76 65 72 20 67 65 74 ! Will never get
5180: 20 68 65 72 65 20 75 6e 6c 65 73 73 20 70 72 65 here unless pre
5190: 72 65 71 73 20 61 72 65 0a 09 20 20 20 20 20 20 reqs are..
51a0: 20 3b 3b 20 20 20 20 20 20 20 61 6c 72 65 61 64 ;; alread
51b0: 79 20 6d 65 74 2e 0a 09 20 20 20 20 20 20 20 28 y met... (
51c0: 69 66 20 28 6e 6f 74 20 28 6c 61 75 6e 63 68 2d if (not (launch-
51d0: 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 72 test db run-id r
51e0: 75 6e 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 unname test-conf
51f0: 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 73 74 2d keyvallst test-
5200: 6e 61 6d 65 20 74 65 73 74 2d 70 61 74 68 20 69 name test-path i
5210: 74 65 6d 64 61 74 20 66 6c 61 67 73 29 29 0a 09 temdat flags))..
5220: 09 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 . (begin...
5230: 20 20 28 70 72 69 6e 74 20 22 45 52 52 4f 52 3a (print "ERROR:
5240: 20 46 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 Failed to launc
5250: 68 20 74 68 65 20 74 65 73 74 2e 20 45 78 69 74 h the test. Exit
5260: 69 6e 67 20 61 73 20 73 6f 6f 6e 20 61 73 20 70 ing as soon as p
5270: 6f 73 73 69 62 6c 65 22 29 0a 09 09 20 20 20 20 ossible")...
5280: 20 28 73 65 74 21 20 2a 67 6c 6f 62 61 6c 65 78 (set! *globalex
5290: 69 74 73 74 61 74 75 73 2a 20 31 29 20 3b 3b 20 itstatus* 1) ;;
52a0: 0a 09 09 20 20 20 20 20 28 70 72 6f 63 65 73 73 ... (process
52b0: 2d 73 69 67 6e 61 6c 20 28 63 75 72 72 65 6e 74 -signal (current
52c0: 2d 70 72 6f 63 65 73 73 2d 69 64 29 20 73 69 67 -process-id) sig
52d0: 6e 61 6c 2f 6b 69 6c 6c 29 29 29 29 29 29 0a 09 nal/kill))))))..
52e0: 28 28 4b 49 4c 4c 45 44 29 20 0a 09 20 28 64 65 ((KILLED) .. (de
52f0: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 bug:print 1 "NOT
5300: 45 3a 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 E: " new-test-na
5310: 6d 65 20 22 20 69 73 20 61 6c 72 65 61 64 79 20 me " is already
5320: 72 75 6e 6e 69 6e 67 20 6f 72 20 77 61 73 20 65 running or was e
5330: 78 70 6c 69 63 74 6c 79 20 6b 69 6c 6c 65 64 2c xplictly killed,
5340: 20 75 73 65 20 2d 66 6f 72 63 65 20 74 6f 20 6c use -force to l
5350: 61 75 6e 63 68 20 69 74 2e 22 29 29 0a 09 28 28 aunch it."))..((
5360: 4c 41 55 4e 43 48 45 44 20 52 45 4d 4f 54 45 48 LAUNCHED REMOTEH
5370: 4f 53 54 53 54 41 52 54 20 52 55 4e 4e 49 4e 47 OSTSTART RUNNING
5380: 29 20 20 0a 09 20 28 69 66 20 28 3e 20 28 2d 20 ) .. (if (> (-
5390: 28 63 75 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73 (current-seconds
53a0: 29 28 2b 20 28 64 62 3a 74 65 73 74 2d 67 65 74 )(+ (db:test-get
53b0: 2d 65 76 65 6e 74 5f 74 69 6d 65 20 74 65 73 74 -event_time test
53c0: 64 61 74 29 0a 09 09 09 09 20 20 20 20 20 20 20 dat).....
53d0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e (db:test-get-run
53e0: 5f 64 75 72 61 74 69 6f 6e 20 74 65 73 74 64 61 _duration testda
53f0: 74 29 29 29 0a 09 09 36 30 30 29 20 3b 3b 20 69 t)))...600) ;; i
5400: 2e 65 2e 20 6e 6f 20 75 70 64 61 74 65 20 66 6f .e. no update fo
5410: 72 20 6d 6f 72 65 20 74 68 61 6e 20 36 30 30 20 r more than 600
5420: 73 65 63 6f 6e 64 73 0a 09 20 20 20 20 20 28 62 seconds.. (b
5430: 65 67 69 6e 0a 09 20 20 20 20 20 20 20 28 64 65 egin.. (de
5440: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 bug:print 0 "WAR
5450: 4e 49 4e 47 3a 20 54 65 73 74 20 22 20 74 65 73 NING: Test " tes
5460: 74 2d 6e 61 6d 65 20 22 20 61 70 70 65 61 72 73 t-name " appears
5470: 20 74 6f 20 62 65 20 64 65 61 64 2e 20 46 6f 72 to be dead. For
5480: 63 69 6e 67 20 69 74 20 74 6f 20 73 74 61 74 65 cing it to state
5490: 20 49 4e 43 4f 4d 50 4c 45 54 45 20 61 6e 64 20 INCOMPLETE and
54a0: 73 74 61 74 75 73 20 53 54 55 43 4b 2f 44 45 41 status STUCK/DEA
54b0: 44 22 29 0a 09 20 20 20 20 20 20 20 28 74 65 73 D").. (tes
54c0: 74 2d 73 65 74 2d 73 74 61 74 75 73 21 20 64 62 t-set-status! db
54d0: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
54e0: 65 20 22 49 4e 43 4f 4d 50 4c 45 54 45 22 20 22 e "INCOMPLETE" "
54f0: 53 54 55 43 4b 2f 44 45 41 44 22 20 69 74 65 6d STUCK/DEAD" item
5500: 64 61 74 20 22 54 65 73 74 20 69 73 20 73 74 75 dat "Test is stu
5510: 63 6b 20 6f 72 20 64 65 61 64 22 20 23 66 29 29 ck or dead" #f))
5520: 0a 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 .. (debug:pr
5530: 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 22 20 74 int 2 "NOTE: " t
5540: 65 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c est-name " is al
5550: 72 65 61 64 79 20 72 75 6e 6e 69 6e 67 22 29 29 ready running"))
5560: 29 0a 09 28 65 6c 73 65 20 20 20 20 20 20 20 28 )..(else (
5570: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 debug:print 0 "E
5580: 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 RROR: Failed to
5590: 6c 61 75 6e 63 68 20 74 65 73 74 20 22 20 6e 65 launch test " ne
55a0: 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 2e 20 55 w-test-name ". U
55b0: 6e 72 65 63 6f 67 6e 69 73 65 64 20 73 74 61 74 nrecognised stat
55c0: 65 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 e " (test:get-st
55d0: 61 74 65 20 74 65 73 74 64 61 74 29 29 29 29 29 ate testdat)))))
55e0: 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ))..;;==========
55f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
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 0a 3b 3b 20 ============.;;
5630: 45 4e 44 20 4f 46 20 4e 45 57 20 53 54 55 46 46 END OF NEW STUFF
5640: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d .;;=============
5650: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5660: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5670: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5680: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 =========..(defi
5690: 6e 65 20 28 67 65 74 2d 64 69 72 2d 75 70 2d 6e ne (get-dir-up-n
56a0: 20 64 69 72 20 2e 20 70 61 72 61 6d 73 29 20 0a dir . params) .
56b0: 20 20 28 6c 65 74 20 28 28 64 70 61 72 74 73 20 (let ((dparts
56c0: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 64 (string-split d
56d0: 69 72 20 22 2f 22 29 29 0a 09 28 63 6f 75 6e 74 ir "/"))..(count
56e0: 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 70 61 (if (null? pa
56f0: 72 61 6d 73 29 20 31 20 28 63 61 72 20 70 61 72 rams) 1 (car par
5700: 61 6d 73 29 29 29 29 0a 20 20 20 20 28 63 6f 6e ams)))). (con
5710: 63 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e c "/" (string-in
5720: 74 65 72 73 70 65 72 73 65 20 0a 09 20 20 20 20 tersperse ..
5730: 20 20 20 28 74 61 6b 65 20 64 70 61 72 74 73 20 (take dparts
5740: 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 (- (length dpart
5750: 73 29 20 63 6f 75 6e 74 29 29 0a 09 20 20 20 20 s) count))..
5760: 20 20 20 22 2f 22 29 29 29 29 0a 3b 3b 20 52 65 "/")))).;; Re
5770: 6d 6f 76 65 20 72 75 6e 73 0a 3b 3b 20 66 69 65 move runs.;; fie
5780: 6c 64 73 20 61 72 65 20 70 61 73 73 69 6e 67 20 lds are passing
5790: 69 6e 20 74 68 72 6f 75 67 68 20 0a 28 64 65 66 in through .(def
57a0: 69 6e 65 20 28 72 75 6e 73 3a 72 65 6d 6f 76 65 ine (runs:remove
57b0: 2d 72 75 6e 73 20 64 62 20 72 75 6e 6e 61 6d 65 -runs db runname
57c0: 70 61 74 74 20 74 65 73 74 70 61 74 74 20 69 74 patt testpatt it
57d0: 65 6d 70 61 74 74 29 0a 20 20 28 6c 65 74 2a 20 empatt). (let*
57e0: 28 28 6b 65 79 73 20 20 20 20 20 20 20 20 28 64 ((keys (d
57f0: 62 2d 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a b-get-keys db)).
5800: 09 20 28 72 75 6e 64 61 74 20 20 20 20 20 20 28 . (rundat (
5810: 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 runs:get-runs-by
5820: 2d 70 61 74 74 20 64 62 20 6b 65 79 73 20 72 75 -patt db keys ru
5830: 6e 6e 61 6d 65 70 61 74 74 29 29 0a 09 20 28 68 nnamepatt)).. (h
5840: 65 61 64 65 72 20 20 20 20 20 20 28 76 65 63 74 eader (vect
5850: 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 30 29 or-ref rundat 0)
5860: 29 0a 09 20 28 72 75 6e 73 20 20 20 20 20 20 20 ).. (runs
5870: 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e (vector-ref run
5880: 64 61 74 20 31 29 29 29 0a 20 20 20 20 28 64 65 dat 1))). (de
5890: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 48 65 61 bug:print 1 "Hea
58a0: 64 65 72 3a 20 22 20 68 65 61 64 65 72 29 0a 20 der: " header).
58b0: 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 (for-each.
58c0: 20 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a (lambda (run).
58d0: 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 75 (let ((ru
58e0: 6e 6b 65 79 20 28 73 74 72 69 6e 67 2d 69 6e 74 nkey (string-int
58f0: 65 72 73 70 65 72 73 65 20 28 6d 61 70 20 28 6c ersperse (map (l
5900: 61 6d 62 64 61 20 28 6b 29 0a 09 09 09 09 09 09 ambda (k).......
5910: 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 (db:get-value-by
5920: 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 -header run head
5930: 65 72 20 28 76 65 63 74 6f 72 2d 72 65 66 20 6b er (vector-ref k
5940: 20 30 29 29 29 20 6b 65 79 73 29 20 22 2f 22 29 0))) keys) "/")
5950: 29 0a 09 20 20 20 20 20 28 64 69 72 73 2d 74 6f ).. (dirs-to
5960: 2d 72 65 6d 6f 76 65 20 28 6d 61 6b 65 2d 68 61 -remove (make-ha
5970: 73 68 2d 74 61 62 6c 65 29 29 29 0a 09 20 28 6c sh-table))).. (l
5980: 65 74 2a 20 28 28 72 75 6e 2d 69 64 20 28 64 62 et* ((run-id (db
5990: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 :get-value-by-he
59a0: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 ader run header
59b0: 22 69 64 22 29 20 29 0a 09 09 28 74 65 73 74 73 "id") )...(tests
59c0: 20 20 28 64 62 2d 67 65 74 2d 74 65 73 74 73 2d (db-get-tests-
59d0: 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 62 3a 67 for-run db (db:g
59e0: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 et-value-by-head
59f0: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 er run header "i
5a00: 64 22 29 20 74 65 73 74 70 61 74 74 20 69 74 65 d") testpatt ite
5a10: 6d 70 61 74 74 20 27 28 29 20 27 28 29 29 29 0a mpatt '() '())).
5a20: 09 09 28 6c 61 73 74 74 70 61 74 68 20 22 2f 64 ..(lasttpath "/d
5a30: 6f 65 73 2f 6e 6f 74 2f 65 78 69 73 74 2f 49 2f oes/not/exist/I/
5a40: 68 6f 70 65 22 29 29 0a 0a 09 20 20 20 28 69 66 hope"))... (if
5a50: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 73 (not (null? tes
5a60: 74 73 29 29 0a 09 20 20 20 20 20 20 20 28 62 65 ts)).. (be
5a70: 67 69 6e 0a 09 09 20 28 64 65 62 75 67 3a 70 72 gin... (debug:pr
5a80: 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 int 1 "Removing
5a90: 74 65 73 74 73 20 66 6f 72 20 72 75 6e 3a 20 22 tests for run: "
5aa0: 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a runkey " " (db:
5ab0: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 get-value-by-hea
5ac0: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 der run header "
5ad0: 72 75 6e 6e 61 6d 65 22 29 29 0a 09 09 20 28 66 runname"))... (f
5ae0: 6f 72 2d 65 61 63 68 0a 09 09 20 20 28 6c 61 6d or-each... (lam
5af0: 62 64 61 20 28 74 65 73 74 29 0a 09 09 20 20 20 bda (test)...
5b00: 20 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d 70 61 (let* ((item-pa
5b10: 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d th (db:test-get-
5b20: 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29 item-path test))
5b30: 0a 09 09 09 20 20 20 28 74 65 73 74 2d 6e 61 6d .... (test-nam
5b40: 65 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 e (db:test-get-t
5b50: 65 73 74 6e 61 6d 65 20 74 65 73 74 29 29 0a 09 estname test))..
5b60: 09 09 20 20 20 28 72 75 6e 2d 64 69 72 20 20 20 .. (run-dir
5b70: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e (db:test-get-run
5b80: 64 69 72 20 74 65 73 74 29 29 29 0a 09 09 20 20 dir test)))...
5b90: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
5ba0: 20 31 20 22 20 20 22 20 28 64 62 3a 74 65 73 74 1 " " (db:test
5bb0: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 -get-testname te
5bc0: 73 74 29 20 22 20 69 64 3a 20 22 20 28 64 62 3a st) " id: " (db:
5bd0: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 test-get-id test
5be0: 29 20 22 20 22 20 69 74 65 6d 2d 70 61 74 68 29 ) " " item-path)
5bf0: 0a 09 09 20 20 20 20 20 20 28 64 62 3a 64 65 6c ... (db:del
5c00: 65 74 65 2d 74 65 73 74 2d 72 65 63 6f 72 64 73 ete-test-records
5c10: 20 64 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74 db (db:test-get
5c20: 2d 69 64 20 74 65 73 74 29 29 0a 09 09 20 20 20 -id test))...
5c30: 20 20 20 28 69 66 20 28 3e 20 28 73 74 72 69 6e (if (> (strin
5c40: 67 2d 6c 65 6e 67 74 68 20 72 75 6e 2d 64 69 72 g-length run-dir
5c50: 29 20 35 29 20 3b 3b 20 62 61 64 20 68 65 75 72 ) 5) ;; bad heur
5c60: 69 73 74 69 63 20 62 75 74 20 73 68 6f 75 6c 64 istic but should
5c70: 20 70 72 65 76 65 6e 74 20 2f 74 6d 70 20 2f 68 prevent /tmp /h
5c80: 6f 6d 65 20 65 74 63 2e 0a 09 09 09 20 20 28 6c ome etc..... (l
5c90: 65 74 20 28 28 66 75 6c 6c 70 61 74 68 20 72 75 et ((fullpath ru
5ca0: 6e 2d 64 69 72 29 29 20 3b 3b 20 22 2f 22 20 28 n-dir)) ;; "/" (
5cb0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d db:test-get-item
5cc0: 2d 70 61 74 68 20 74 65 73 74 29 29 29 29 0a 09 -path test))))..
5cd0: 09 09 20 20 20 20 28 73 65 74 21 20 6c 61 73 74 .. (set! last
5ce0: 74 70 61 74 68 20 66 75 6c 6c 70 61 74 68 29 0a tpath fullpath).
5cf0: 09 09 09 20 20 20 20 28 68 61 73 68 2d 74 61 62 ... (hash-tab
5d00: 6c 65 2d 73 65 74 21 20 64 69 72 73 2d 74 6f 2d le-set! dirs-to-
5d10: 72 65 6d 6f 76 65 20 66 75 6c 6c 70 61 74 68 20 remove fullpath
5d20: 23 74 29 0a 09 09 09 20 20 20 20 3b 3b 20 54 68 #t).... ;; Th
5d30: 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 77 61 73 20 e following was
5d40: 74 68 65 20 73 61 66 65 20 64 65 6c 65 74 65 20 the safe delete
5d50: 63 6f 64 65 20 62 75 74 20 69 74 20 77 61 73 20 code but it was
5d60: 6e 6f 74 20 62 65 69 6e 67 20 65 78 65 63 74 75 not being exectu
5d70: 74 65 64 2e 0a 09 09 09 20 20 20 20 3b 3b 20 28 ted..... ;; (
5d80: 6c 65 74 2a 20 28 28 64 69 72 73 2d 63 6f 75 6e let* ((dirs-coun
5d90: 74 20 28 2b 20 31 20 28 6c 65 6e 67 74 68 20 6b t (+ 1 (length k
5da0: 65 79 73 29 28 6c 65 6e 67 74 68 20 28 73 74 72 eys)(length (str
5db0: 69 6e 67 2d 73 70 6c 69 74 20 69 74 65 6d 2d 70 ing-split item-p
5dc0: 61 74 68 20 22 2f 22 29 29 29 29 0a 09 09 09 20 ath "/"))))....
5dd0: 20 20 20 3b 3b 20 20 20 20 20 20 20 20 28 64 69 ;; (di
5de0: 72 2d 74 6f 2d 72 65 6d 20 28 67 65 74 2d 64 69 r-to-rem (get-di
5df0: 72 2d 75 70 2d 6e 20 66 75 6c 6c 70 61 74 68 20 r-up-n fullpath
5e00: 64 69 72 73 2d 63 6f 75 6e 74 29 29 0a 09 09 09 dirs-count))....
5e10: 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20 28 72 ;; (r
5e20: 65 6d 61 69 6e 69 6e 67 64 20 28 73 74 72 69 6e emainingd (strin
5e30: 67 2d 73 75 62 73 74 69 74 75 74 65 20 28 72 65 g-substitute (re
5e40: 67 65 78 70 20 28 63 6f 6e 63 20 22 5e 22 20 64 gexp (conc "^" d
5e50: 69 72 2d 74 6f 2d 72 65 6d 20 22 2f 22 29 29 20 ir-to-rem "/"))
5e60: 22 22 20 66 75 6c 6c 70 61 74 68 29 29 0a 09 09 "" fullpath))...
5e70: 09 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20 28 . ;; (
5e80: 63 6d 64 20 28 63 6f 6e 63 20 22 63 64 20 22 20 cmd (conc "cd "
5e90: 64 69 72 2d 74 6f 2d 72 65 6d 20 22 3b 20 72 6d dir-to-rem "; rm
5ea0: 64 69 72 20 2d 70 20 22 20 72 65 6d 61 69 6e 69 dir -p " remaini
5eb0: 6e 67 64 20 29 29 29 0a 09 09 09 20 20 20 20 3b ngd ))).... ;
5ec0: 3b 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 ; (if (file-ex
5ed0: 69 73 74 73 3f 20 66 75 6c 6c 70 61 74 68 29 0a ists? fullpath).
5ee0: 09 09 09 20 20 20 20 3b 3b 20 20 20 20 20 20 20 ... ;;
5ef0: 28 62 65 67 69 6e 0a 09 09 09 20 20 20 20 3b 3b (begin.... ;;
5f00: 20 20 20 20 20 20 20 20 20 28 64 65 62 75 67 3a (debug:
5f10: 70 72 69 6e 74 20 31 20 63 6d 64 29 0a 09 09 09 print 1 cmd)....
5f20: 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20 20 28 ;; (
5f30: 73 79 73 74 65 6d 20 63 6d 64 29 29 29 0a 09 09 system cmd)))...
5f40: 09 20 20 20 20 3b 3b 20 20 20 29 29 0a 09 09 09 . ;; ))....
5f50: 20 20 20 20 29 29 29 29 0a 09 09 20 20 20 20 74 ))))... t
5f60: 65 73 74 73 29 29 29 0a 0a 09 20 20 20 3b 3b 20 ests)))... ;;
5f70: 6c 6f 6f 6b 20 74 68 6f 75 67 68 20 74 68 65 20 look though the
5f80: 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 66 dirs-to-remove f
5f90: 6f 72 20 63 61 6e 64 69 64 61 74 65 73 20 66 6f or candidates fo
5fa0: 72 20 72 65 6d 6f 76 61 6c 2e 20 44 6f 20 74 68 r removal. Do th
5fb0: 69 73 20 61 66 74 65 72 20 64 65 6c 65 74 69 6e is after deletin
5fc0: 67 20 74 68 65 20 72 65 63 6f 72 64 73 0a 09 20 g the records..
5fd0: 20 20 3b 3b 20 66 6f 72 20 65 61 63 68 20 74 65 ;; for each te
5fe0: 73 74 20 69 6e 20 63 61 73 65 20 77 65 20 67 65 st in case we ge
5ff0: 74 20 6b 69 6c 6c 65 64 2e 20 54 68 61 74 20 73 t killed. That s
6000: 68 6f 75 6c 64 20 6d 69 6e 69 6d 69 7a 65 20 74 hould minimize t
6010: 68 65 20 64 65 74 72 69 74 75 73 20 6c 65 66 74 he detritus left
6020: 20 6f 6e 20 64 69 73 6b 0a 09 20 20 20 3b 3b 20 on disk.. ;;
6030: 70 72 6f 63 65 73 73 20 74 68 65 20 64 69 72 73 process the dirs
6040: 20 66 72 6f 6d 20 6c 6f 6e 67 65 73 74 20 73 74 from longest st
6050: 72 69 6e 67 20 6c 65 6e 67 74 68 20 74 6f 20 73 ring length to s
6060: 68 6f 72 74 65 73 74 0a 09 20 20 20 28 66 6f 72 hortest.. (for
6070: 2d 65 61 63 68 20 0a 09 20 20 20 20 28 6c 61 6d -each .. (lam
6080: 62 64 61 20 28 64 69 72 2d 74 6f 2d 72 65 6d 6f bda (dir-to-remo
6090: 76 65 29 0a 09 20 20 20 20 20 20 28 69 66 20 28 ve).. (if (
60a0: 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 64 69 72 file-exists? dir
60b0: 2d 74 6f 2d 72 65 6d 6f 76 65 29 0a 09 09 20 20 -to-remove)...
60c0: 28 6c 65 74 20 28 28 64 69 72 2d 69 6e 2d 64 62 (let ((dir-in-db
60d0: 20 27 28 29 29 29 0a 09 09 20 20 20 20 28 73 71 '()))... (sq
60e0: 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 lite3:for-each-r
60f0: 6f 77 0a 09 09 20 20 20 20 20 28 6c 61 6d 62 64 ow... (lambd
6100: 61 20 28 64 69 72 29 0a 09 09 20 20 20 20 20 20 a (dir)...
6110: 20 28 73 65 74 21 20 64 69 72 2d 69 6e 2d 64 62 (set! dir-in-db
6120: 20 28 63 6f 6e 73 20 64 69 72 20 64 69 72 2d 69 (cons dir dir-i
6130: 6e 2d 64 62 29 29 29 0a 09 09 20 20 20 20 20 64 n-db)))... d
6140: 62 20 22 53 45 4c 45 43 54 20 72 75 6e 64 69 72 b "SELECT rundir
6150: 20 46 52 4f 4d 20 74 65 73 74 73 20 57 48 45 52 FROM tests WHER
6160: 45 20 72 75 6e 64 69 72 20 4c 49 4b 45 20 3f 3b E rundir LIKE ?;
6170: 22 20 0a 09 09 20 20 20 20 20 28 63 6f 6e 63 20 " ... (conc
6180: 22 25 22 20 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 "%" dir-to-remov
6190: 65 20 22 25 22 29 29 20 3b 3b 20 79 65 73 2c 20 e "%")) ;; yes,
61a0: 49 27 6d 20 67 6f 69 6e 67 20 74 6f 20 62 61 69 I'm going to bai
61b0: 6c 20 69 66 20 74 68 65 72 65 20 69 73 20 61 6e l if there is an
61c0: 79 74 68 69 6e 67 20 6c 69 6b 65 20 74 68 69 73 ything like this
61d0: 20 64 69 72 20 69 6e 20 74 68 65 20 64 62 0a 09 dir in the db..
61e0: 09 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 . (if (null?
61f0: 64 69 72 2d 69 6e 2d 64 62 29 0a 09 09 09 28 62 dir-in-db)....(b
6200: 65 67 69 6e 0a 09 09 09 20 20 28 64 65 62 75 67 egin.... (debug
6210: 3a 70 72 69 6e 74 20 32 20 22 52 65 6d 6f 76 69 :print 2 "Removi
6220: 6e 67 20 64 69 72 65 63 74 6f 72 79 20 77 69 74 ng directory wit
6230: 68 20 7a 65 72 6f 20 64 62 20 72 65 66 65 72 65 h zero db refere
6240: 6e 63 65 73 3a 20 22 20 64 69 72 2d 74 6f 2d 72 nces: " dir-to-r
6250: 65 6d 6f 76 65 29 0a 09 09 09 20 20 28 73 79 73 emove).... (sys
6260: 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 20 2d 72 tem (conc "rm -r
6270: 66 20 22 20 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 f " dir-to-remov
6280: 65 29 29 0a 09 09 09 20 20 28 68 61 73 68 2d 74 e)).... (hash-t
6290: 61 62 6c 65 2d 64 65 6c 65 74 65 21 20 64 69 72 able-delete! dir
62a0: 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 64 69 72 2d s-to-remove dir-
62b0: 74 6f 2d 72 65 6d 6f 76 65 29 29 0a 09 09 09 28 to-remove))....(
62c0: 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 53 debug:print 2 "S
62d0: 6b 69 70 70 69 6e 67 20 72 65 6d 6f 76 61 6c 20 kipping removal
62e0: 6f 66 20 22 20 64 69 72 2d 74 6f 2d 72 65 6d 6f of " dir-to-remo
62f0: 76 65 20 22 20 66 6f 72 20 6e 6f 77 20 61 73 20 ve " for now as
6300: 69 74 20 73 74 69 6c 6c 20 68 61 73 20 72 65 66 it still has ref
6310: 65 72 65 6e 63 65 73 20 69 6e 20 74 68 65 20 64 erences in the d
6320: 61 74 61 62 61 73 65 22 29 29 29 29 29 0a 09 20 atabase")))))..
6330: 20 20 20 28 73 6f 72 74 20 28 68 61 73 68 2d 74 (sort (hash-t
6340: 61 62 6c 65 2d 6b 65 79 73 20 64 69 72 73 2d 74 able-keys dirs-t
6350: 6f 2d 72 65 6d 6f 76 65 29 20 28 6c 61 6d 62 64 o-remove) (lambd
6360: 61 20 28 61 20 62 29 28 3e 20 28 73 74 72 69 6e a (a b)(> (strin
6370: 67 2d 6c 65 6e 67 74 68 20 61 29 28 73 74 72 69 g-length a)(stri
6380: 6e 67 2d 6c 65 6e 67 74 68 20 62 29 29 29 29 29 ng-length b)))))
6390: 0a 0a 09 20 20 20 3b 3b 20 72 65 6d 6f 76 65 20 ... ;; remove
63a0: 74 68 65 20 72 75 6e 20 69 66 20 7a 65 72 6f 20 the run if zero
63b0: 74 65 73 74 73 20 72 65 6d 61 69 6e 0a 09 20 20 tests remain..
63c0: 20 28 6c 65 74 20 28 28 72 65 6d 74 65 73 74 73 (let ((remtests
63d0: 20 28 64 62 2d 67 65 74 2d 74 65 73 74 73 2d 66 (db-get-tests-f
63e0: 6f 72 2d 72 75 6e 20 64 62 20 28 64 62 3a 67 65 or-run db (db:ge
63f0: 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 t-value-by-heade
6400: 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 r run header "id
6410: 22 29 20 23 66 20 23 66 20 27 28 29 20 27 28 29 ") #f #f '() '()
6420: 29 29 29 0a 09 20 20 20 20 20 28 69 66 20 28 6e ))).. (if (n
6430: 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29 20 3b ull? remtests) ;
6440: 3b 20 6e 6f 20 6d 6f 72 65 20 74 65 73 74 73 20 ; no more tests
6450: 72 65 6d 61 69 6e 69 6e 67 0a 09 09 20 28 6c 65 remaining... (le
6460: 74 2a 20 28 28 64 70 61 72 74 73 20 20 28 73 74 t* ((dparts (st
6470: 72 69 6e 67 2d 73 70 6c 69 74 20 6c 61 73 74 74 ring-split lastt
6480: 70 61 74 68 20 22 2f 22 29 29 0a 09 09 09 28 72 path "/"))....(r
6490: 75 6e 70 61 74 68 20 28 63 6f 6e 63 20 22 2f 22 unpath (conc "/"
64a0: 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 (string-intersp
64b0: 65 72 73 65 20 0a 09 09 09 09 09 20 20 20 20 28 erse ...... (
64c0: 74 61 6b 65 20 64 70 61 72 74 73 20 28 2d 20 28 take dparts (- (
64d0: 6c 65 6e 67 74 68 20 64 70 61 72 74 73 29 20 31 length dparts) 1
64e0: 29 29 0a 09 09 09 09 09 20 20 20 20 22 2f 22 29 ))...... "/")
64f0: 29 29 29 0a 09 09 20 20 20 28 64 65 62 75 67 3a )))... (debug:
6500: 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e print 1 "Removin
6510: 67 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 g run: " runkey
6520: 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 " " (db:get-valu
6530: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 e-by-header run
6540: 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 header "runname"
6550: 29 29 0a 09 09 20 20 20 28 64 62 3a 64 65 6c 65 ))... (db:dele
6560: 74 65 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 te-run db run-id
6570: 29 0a 09 09 20 20 20 3b 3b 20 6e 65 65 64 20 74 )... ;; need t
6580: 6f 20 66 69 67 75 72 65 20 6f 75 74 20 74 68 65 o figure out the
6590: 20 70 61 74 68 20 74 6f 20 74 68 65 20 72 75 6e path to the run
65a0: 20 64 69 72 20 61 6e 64 20 72 65 6d 6f 76 65 20 dir and remove
65b0: 69 74 20 69 66 20 65 6d 70 74 79 0a 09 09 20 20 it if empty...
65c0: 20 3b 3b 20 20 20 20 28 69 66 20 28 6e 75 6c 6c ;; (if (null
65d0: 3f 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20 72 75 ? (glob (conc ru
65e0: 6e 70 61 74 68 20 22 2f 2a 22 29 29 29 0a 09 09 npath "/*")))...
65f0: 20 20 20 3b 3b 20 20 20 20 20 20 20 20 28 62 65 ;; (be
6600: 67 69 6e 0a 09 09 20 20 20 3b 3b 20 09 20 28 64 gin... ;; . (d
6610: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 ebug:print 1 "Re
6620: 6d 6f 76 69 6e 67 20 72 75 6e 20 64 69 72 20 22 moving run dir "
6630: 20 72 75 6e 70 61 74 68 29 0a 09 09 20 20 20 3b runpath)... ;
6640: 3b 20 09 20 28 73 79 73 74 65 6d 20 28 63 6f 6e ; . (system (con
6650: 63 20 22 72 6d 64 69 72 20 2d 70 20 22 20 72 75 c "rmdir -p " ru
6660: 6e 70 61 74 68 29 29 29 29 0a 09 09 20 20 20 29 npath))))... )
6670: 29 29 29 0a 09 20 29 29 0a 20 20 20 20 20 72 75 ))).. )). ru
6680: 6e 73 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d ns)))..;;=======
6690: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
66a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
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 0a ===============.
66d0: 3b 3b 20 52 6f 75 74 69 6e 65 73 20 66 6f 72 20 ;; Routines for
66e0: 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 72 75 6e manipulating run
66f0: 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d s.;;============
6700: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6710: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6720: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6730: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 53 ==========..;; S
6740: 69 6e 63 65 20 6d 61 6e 79 20 63 61 6c 6c 73 20 ince many calls
6750: 74 6f 20 61 20 72 75 6e 20 72 65 71 75 69 72 65 to a run require
6760: 20 70 72 65 74 74 79 20 6d 75 63 68 20 74 68 65 pretty much the
6770: 20 73 61 6d 65 20 73 65 74 75 70 20 0a 3b 3b 20 same setup .;;
6780: 74 68 69 73 20 77 72 61 70 70 65 72 20 69 73 20 this wrapper is
6790: 75 73 65 64 20 74 6f 20 72 65 64 75 63 65 20 74 used to reduce t
67a0: 68 65 20 72 65 70 6c 69 63 61 74 69 6f 6e 20 6f he replication o
67b0: 66 20 63 6f 64 65 0a 28 64 65 66 69 6e 65 20 28 f code.(define (
67c0: 67 65 6e 65 72 61 6c 2d 72 75 6e 2d 63 61 6c 6c general-run-call
67d0: 20 73 77 69 74 63 68 6e 61 6d 65 20 61 63 74 69 switchname acti
67e0: 6f 6e 2d 64 65 73 63 20 70 72 6f 63 29 0a 20 20 on-desc proc).
67f0: 28 6c 65 74 20 28 28 72 75 6e 6e 61 6d 65 20 28 (let ((runname (
6800: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 3a 72 args:get-arg ":r
6810: 75 6e 6e 61 6d 65 22 29 29 0a 09 28 74 61 72 67 unname"))..(targ
6820: 65 74 20 20 28 69 66 20 28 61 72 67 73 3a 67 65 et (if (args:ge
6830: 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 29 t-arg "-target")
6840: 0a 09 09 20 20 20 20 20 28 61 72 67 73 3a 67 65 ... (args:ge
6850: 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 29 t-arg "-target")
6860: 0a 09 09 20 20 20 20 20 28 61 72 67 73 3a 67 65 ... (args:ge
6870: 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 t-arg "-reqtarg"
6880: 29 29 29 29 0a 20 20 20 20 28 63 6f 6e 64 0a 20 )))). (cond.
6890: 20 20 20 20 28 28 6e 6f 74 20 74 61 72 67 65 74 ((not target
68a0: 29 0a 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 ). (debug:p
68b0: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 4d rint 0 "ERROR: M
68c0: 69 73 73 69 6e 67 20 72 65 71 75 69 72 65 64 20 issing required
68d0: 70 61 72 61 6d 65 74 65 72 20 66 6f 72 20 22 20 parameter for "
68e0: 73 77 69 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f switchname ", yo
68f0: 75 20 6d 75 73 74 20 73 70 65 63 69 66 79 20 74 u must specify t
6900: 68 65 20 74 61 72 67 65 74 20 77 69 74 68 20 2d he target with -
6910: 74 61 72 67 65 74 22 29 0a 20 20 20 20 20 20 28 target"). (
6920: 65 78 69 74 20 33 29 29 0a 20 20 20 20 20 28 28 exit 3)). ((
6930: 6e 6f 74 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20 not runname).
6940: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
6950: 30 20 22 45 52 52 4f 52 3a 20 4d 69 73 73 69 6e 0 "ERROR: Missin
6960: 67 20 72 65 71 75 69 72 65 64 20 70 61 72 61 6d g required param
6970: 65 74 65 72 20 66 6f 72 20 22 20 73 77 69 74 63 eter for " switc
6980: 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d 75 73 hname ", you mus
6990: 74 20 73 70 65 63 69 66 79 20 74 68 65 20 72 75 t specify the ru
69a0: 6e 20 6e 61 6d 65 20 77 69 74 68 20 3a 72 75 6e n name with :run
69b0: 6e 61 6d 65 20 72 75 6e 6e 61 6d 65 22 29 0a 20 name runname").
69c0: 20 20 20 20 20 28 65 78 69 74 20 33 29 29 0a 20 (exit 3)).
69d0: 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20 (else.
69e0: 28 6c 65 74 20 28 28 64 62 20 20 20 23 66 29 0a (let ((db #f).
69f0: 09 20 20 20 20 28 6b 65 79 73 20 23 66 29 29 0a . (keys #f)).
6a00: 09 28 69 66 20 28 6e 6f 74 20 28 73 65 74 75 70 .(if (not (setup
6a10: 2d 66 6f 72 2d 72 75 6e 29 29 0a 09 20 20 20 20 -for-run))..
6a20: 28 62 65 67 69 6e 20 0a 09 20 20 20 20 20 20 28 (begin .. (
6a30: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 46 debug:print 0 "F
6a40: 61 69 6c 65 64 20 74 6f 20 73 65 74 75 70 2c 20 ailed to setup,
6a50: 65 78 69 74 69 6e 67 22 29 0a 09 20 20 20 20 20 exiting")..
6a60: 20 28 65 78 69 74 20 31 29 29 29 0a 09 28 73 65 (exit 1)))..(se
6a70: 74 21 20 64 62 20 20 20 28 6f 70 65 6e 2d 64 62 t! db (open-db
6a80: 29 29 0a 09 28 73 65 74 21 20 6b 65 79 73 20 28 ))..(set! keys (
6a90: 64 62 2d 67 65 74 2d 6b 65 79 73 20 64 62 29 29 db-get-keys db))
6aa0: 0a 09 3b 3b 20 68 61 76 65 20 65 6e 6f 75 67 68 ..;; have enough
6ab0: 20 74 6f 20 70 72 6f 63 65 73 73 20 2d 74 61 72 to process -tar
6ac0: 67 65 74 20 6f 72 20 2d 72 65 71 74 61 72 67 20 get or -reqtarg
6ad0: 68 65 72 65 0a 09 28 69 66 20 28 61 72 67 73 3a here..(if (args:
6ae0: 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 get-arg "-reqtar
6af0: 67 22 29 0a 09 20 20 20 20 28 6c 65 74 2a 20 28 g").. (let* (
6b00: 28 72 75 6e 63 6f 6e 66 69 67 66 20 28 63 6f 6e (runconfigf (con
6b10: 63 20 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72 c *toppath* "/r
6b20: 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67 unconfigs.config
6b30: 22 29 29 20 3b 3b 20 44 4f 20 4e 4f 54 20 45 56 ")) ;; DO NOT EV
6b40: 41 4c 55 41 54 45 20 41 4c 4c 20 0a 09 09 20 20 ALUATE ALL ...
6b50: 20 28 72 75 6e 63 6f 6e 66 69 67 20 20 28 72 65 (runconfig (re
6b60: 61 64 2d 63 6f 6e 66 69 67 20 72 75 6e 63 6f 6e ad-config runcon
6b70: 66 69 67 66 20 23 66 20 23 66 20 65 6e 76 69 72 figf #f #f envir
6b80: 6f 6e 2d 70 61 74 74 3a 20 23 66 29 29 29 20 0a on-patt: #f))) .
6b90: 09 20 20 20 20 20 20 28 69 66 20 28 68 61 73 68 . (if (hash
6ba0: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 -table-ref/defau
6bb0: 6c 74 20 72 75 6e 63 6f 6e 66 69 67 20 28 61 72 lt runconfig (ar
6bc0: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 gs:get-arg "-req
6bd0: 74 61 72 67 22 29 20 23 66 29 0a 09 09 20 20 28 targ") #f)... (
6be0: 6b 65 79 73 3a 74 61 72 67 65 74 2d 73 65 74 2d keys:target-set-
6bf0: 61 72 67 73 20 6b 65 79 73 20 28 61 72 67 73 3a args keys (args:
6c00: 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 get-arg "-reqtar
6c10: 67 22 29 20 61 72 67 73 3a 61 72 67 2d 68 61 73 g") args:arg-has
6c20: 68 29 0a 09 09 20 20 28 62 65 67 69 6e 0a 09 09 h)... (begin...
6c30: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
6c40: 20 30 20 22 45 52 52 4f 52 3a 20 5b 22 20 28 61 0 "ERROR: [" (a
6c50: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 rgs:get-arg "-re
6c60: 71 74 61 72 67 22 29 20 22 5d 20 6e 6f 74 20 66 qtarg") "] not f
6c70: 6f 75 6e 64 20 69 6e 20 22 20 72 75 6e 63 6f 6e ound in " runcon
6c80: 66 69 67 66 29 0a 09 09 20 20 20 20 28 73 71 6c figf)... (sql
6c90: 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 ite3:finalize! d
6ca0: 62 29 0a 09 09 20 20 20 20 28 65 78 69 74 20 31 b)... (exit 1
6cb0: 29 29 29 29 0a 09 20 20 20 20 28 69 66 20 28 61 )))).. (if (a
6cc0: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 rgs:get-arg "-ta
6cd0: 72 67 65 74 22 29 0a 09 09 28 6b 65 79 73 3a 74 rget")...(keys:t
6ce0: 61 72 67 65 74 2d 73 65 74 2d 61 72 67 73 20 6b arget-set-args k
6cf0: 65 79 73 20 28 61 72 67 73 3a 67 65 74 2d 61 72 eys (args:get-ar
6d00: 67 20 22 2d 74 61 72 67 65 74 22 20 61 72 67 73 g "-target" args
6d10: 3a 61 72 67 2d 68 61 73 68 29 20 61 72 67 73 3a :arg-hash) args:
6d20: 61 72 67 2d 68 61 73 68 29 29 29 0a 09 28 69 66 arg-hash)))..(if
6d30: 20 28 6e 6f 74 20 28 63 61 72 20 2a 63 6f 6e 66 (not (car *conf
6d40: 69 67 69 6e 66 6f 2a 29 29 0a 09 20 20 20 20 28 iginfo*)).. (
6d50: 62 65 67 69 6e 0a 09 20 20 20 20 20 20 28 64 65 begin.. (de
6d60: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 bug:print 0 "ERR
6d70: 4f 52 3a 20 41 74 74 65 6d 70 74 65 64 20 74 6f OR: Attempted to
6d80: 20 22 20 61 63 74 69 6f 6e 2d 64 65 73 63 20 22 " action-desc "
6d90: 20 62 75 74 20 72 75 6e 20 61 72 65 61 20 63 6f but run area co
6da0: 6e 66 69 67 20 66 69 6c 65 20 6e 6f 74 20 66 6f nfig file not fo
6db0: 75 6e 64 22 29 0a 09 20 20 20 20 20 20 28 65 78 und").. (ex
6dc0: 69 74 20 31 29 29 0a 09 20 20 20 20 3b 3b 20 45 it 1)).. ;; E
6dd0: 78 74 72 61 63 74 20 6f 75 74 20 73 74 75 66 66 xtract out stuff
6de0: 20 6e 65 65 64 65 64 20 69 6e 20 6d 6f 73 74 20 needed in most
6df0: 6f 72 20 6d 61 6e 79 20 63 61 6c 6c 73 0a 09 20 or many calls..
6e00: 20 20 20 3b 3b 20 68 65 72 65 20 74 68 65 6e 20 ;; here then
6e10: 63 61 6c 6c 20 70 72 6f 63 0a 09 20 20 20 20 28 call proc.. (
6e20: 6c 65 74 2a 20 28 28 6b 65 79 6e 61 6d 65 73 20 let* ((keynames
6e30: 20 20 28 6d 61 70 20 6b 65 79 3a 67 65 74 2d 66 (map key:get-f
6e40: 69 65 6c 64 6e 61 6d 65 20 6b 65 79 73 29 29 0a ieldname keys)).
6e50: 09 09 20 20 20 28 6b 65 79 76 61 6c 6c 73 74 20 .. (keyvallst
6e60: 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69 73 74 20 (keys->vallist
6e70: 6b 65 79 73 20 23 74 29 29 29 0a 09 20 20 20 20 keys #t)))..
6e80: 20 20 28 70 72 6f 63 20 64 62 20 74 61 72 67 65 (proc db targe
6e90: 74 20 72 75 6e 6e 61 6d 65 20 6b 65 79 73 20 6b t runname keys k
6ea0: 65 79 6e 61 6d 65 73 20 6b 65 79 76 61 6c 6c 73 eynames keyvalls
6eb0: 74 29 29 29 0a 09 28 73 71 6c 69 74 65 33 3a 66 t)))..(sqlite3:f
6ec0: 69 6e 61 6c 69 7a 65 21 20 64 62 29 0a 09 28 73 inalize! db)..(s
6ed0: 65 74 21 20 2a 64 69 64 73 6f 6d 65 74 68 69 6e et! *didsomethin
6ee0: 67 2a 20 23 74 29 29 29 29 29 29 0a 0a 3b 3b 3d g* #t))))))..;;=
6ef0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
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 0a 3b 3b 20 52 6f 6c 6c 75 70 20 =====.;; Rollup
6f40: 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d runs.;;=========
6f50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6f60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6f70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6f80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b =============..;
6f90: 3b 20 55 70 64 61 74 65 20 74 68 65 20 74 65 73 ; Update the tes
6fa0: 74 5f 6d 65 74 61 20 74 61 62 6c 65 20 66 6f 72 t_meta table for
6fb0: 20 74 68 69 73 20 74 65 73 74 0a 28 64 65 66 69 this test.(defi
6fc0: 6e 65 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d ne (runs:update-
6fd0: 74 65 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73 test_meta db tes
6fe0: 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 t-name test-conf
6ff0: 29 0a 20 20 28 6c 65 74 20 28 28 63 75 72 72 72 ). (let ((currr
7000: 65 63 6f 72 64 20 28 64 62 3a 74 65 73 74 6d 65 ecord (db:testme
7010: 74 61 2d 67 65 74 2d 72 65 63 6f 72 64 20 64 62 ta-get-record db
7020: 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 test-name))).
7030: 20 20 28 69 66 20 28 6e 6f 74 20 63 75 72 72 72 (if (not currr
7040: 65 63 6f 72 64 29 0a 09 28 62 65 67 69 6e 0a 09 ecord)..(begin..
7050: 20 20 28 73 65 74 21 20 63 75 72 72 72 65 63 6f (set! currreco
7060: 72 64 20 28 6d 61 6b 65 2d 76 65 63 74 6f 72 20 rd (make-vector
7070: 31 30 20 23 66 29 29 0a 09 20 20 28 64 62 3a 74 10 #f)).. (db:t
7080: 65 73 74 6d 65 74 61 2d 61 64 64 2d 72 65 63 6f estmeta-add-reco
7090: 72 64 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 29 rd db test-name)
70a0: 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 )). (for-each
70b0: 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 . (lambda (
70c0: 6b 65 79 29 0a 20 20 20 20 20 20 20 28 6c 65 74 key). (let
70d0: 2a 20 28 28 69 64 78 20 28 63 61 64 72 20 6b 65 * ((idx (cadr ke
70e0: 79 29 29 0a 09 20 20 20 20 20 20 28 66 6c 64 20 y)).. (fld
70f0: 28 63 61 72 20 20 6b 65 79 29 29 0a 09 20 20 20 (car key))..
7100: 20 20 20 28 76 61 6c 20 28 63 6f 6e 66 69 67 2d (val (config-
7110: 6c 6f 6f 6b 75 70 20 74 65 73 74 2d 63 6f 6e 66 lookup test-conf
7120: 20 22 74 65 73 74 5f 6d 65 74 61 22 20 66 6c 64 "test_meta" fld
7130: 29 29 29 0a 09 20 3b 3b 20 28 64 65 62 75 67 3a ))).. ;; (debug:
7140: 70 72 69 6e 74 20 35 20 22 69 64 78 3a 20 22 20 print 5 "idx: "
7150: 69 64 78 20 22 20 66 6c 64 3a 20 22 20 66 6c 64 idx " fld: " fld
7160: 20 22 20 76 61 6c 3a 20 22 20 76 61 6c 29 0a 09 " val: " val)..
7170: 20 28 69 66 20 28 61 6e 64 20 76 61 6c 20 28 6e (if (and val (n
7180: 6f 74 20 28 65 71 75 61 6c 3f 20 28 76 65 63 74 ot (equal? (vect
7190: 6f 72 2d 72 65 66 20 63 75 72 72 72 65 63 6f 72 or-ref currrecor
71a0: 64 20 69 64 78 29 20 76 61 6c 29 29 29 0a 09 20 d idx) val)))..
71b0: 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 (begin..
71c0: 20 20 20 28 70 72 69 6e 74 20 22 55 70 64 61 74 (print "Updat
71d0: 69 6e 67 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 ing " test-name
71e0: 22 20 22 20 66 6c 64 20 22 20 74 6f 20 22 20 76 " " fld " to " v
71f0: 61 6c 29 0a 09 20 20 20 20 20 20 20 28 64 62 3a al).. (db:
7200: 74 65 73 74 6d 65 74 61 2d 75 70 64 61 74 65 2d testmeta-update-
7210: 66 69 65 6c 64 20 64 62 20 74 65 73 74 2d 6e 61 field db test-na
7220: 6d 65 20 66 6c 64 20 76 61 6c 29 29 29 29 29 0a me fld val))))).
7230: 20 20 20 20 20 27 28 28 22 61 75 74 68 6f 72 22 '(("author"
7240: 20 32 29 28 22 6f 77 6e 65 72 22 20 33 29 28 22 2)("owner" 3)("
7250: 64 65 73 63 72 69 70 74 69 6f 6e 22 20 34 29 28 description" 4)(
7260: 22 72 65 76 69 65 77 65 64 22 20 35 29 28 22 74 "reviewed" 5)("t
7270: 61 67 73 22 20 39 29 29 29 29 29 0a 0a 3b 3b 20 ags" 9)))))..;;
7280: 55 70 64 61 74 65 20 74 65 73 74 5f 6d 65 74 61 Update test_meta
7290: 20 66 6f 72 20 61 6c 6c 20 74 65 73 74 73 0a 28 for all tests.(
72a0: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 75 70 64 define (runs:upd
72b0: 61 74 65 2d 61 6c 6c 2d 74 65 73 74 5f 6d 65 74 ate-all-test_met
72c0: 61 20 64 62 29 0a 20 20 28 6c 65 74 20 28 28 74 a db). (let ((t
72d0: 65 73 74 2d 6e 61 6d 65 73 20 28 67 65 74 2d 61 est-names (get-a
72e0: 6c 6c 2d 6c 65 67 61 6c 2d 74 65 73 74 73 29 29 ll-legal-tests))
72f0: 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 ). (for-each
7300: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74 . (lambda (t
7310: 65 73 74 2d 6e 61 6d 65 29 0a 20 20 20 20 20 20 est-name).
7320: 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 70 61 (let* ((test-pa
7330: 74 68 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f 70 th (conc *top
7340: 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 20 path* "/tests/"
7350: 74 65 73 74 2d 6e 61 6d 65 29 29 0a 09 20 20 20 test-name))..
7360: 20 20 20 28 74 65 73 74 2d 63 6f 6e 66 69 67 66 (test-configf
7370: 20 28 63 6f 6e 63 20 74 65 73 74 2d 70 61 74 68 (conc test-path
7380: 20 22 2f 74 65 73 74 63 6f 6e 66 69 67 22 29 29 "/testconfig"))
7390: 0a 09 20 20 20 20 20 20 28 74 65 73 74 65 78 69 .. (testexi
73a0: 73 74 73 20 20 20 28 61 6e 64 20 28 66 69 6c 65 sts (and (file
73b0: 2d 65 78 69 73 74 73 3f 20 74 65 73 74 2d 63 6f -exists? test-co
73c0: 6e 66 69 67 66 29 28 66 69 6c 65 2d 72 65 61 64 nfigf)(file-read
73d0: 2d 61 63 63 65 73 73 3f 20 74 65 73 74 2d 63 6f -access? test-co
73e0: 6e 66 69 67 66 29 29 29 0a 09 20 20 20 20 20 20 nfigf)))..
73f0: 3b 3b 20 72 65 61 64 20 63 6f 6e 66 69 67 73 20 ;; read configs
7400: 77 69 74 68 20 74 72 69 63 6b 73 20 74 75 72 6e with tricks turn
7410: 65 64 20 6f 66 66 20 28 69 2e 65 2e 20 6e 6f 20 ed off (i.e. no
7420: 73 79 73 74 65 6d 29 0a 09 20 20 20 20 20 20 28 system).. (
7430: 74 65 73 74 2d 63 6f 6e 66 20 20 20 20 28 69 66 test-conf (if
7440: 20 74 65 73 74 65 78 69 73 74 73 20 28 72 65 61 testexists (rea
7450: 64 2d 63 6f 6e 66 69 67 20 74 65 73 74 2d 63 6f d-config test-co
7460: 6e 66 69 67 66 20 23 66 20 23 66 29 28 6d 61 6b nfigf #f #f)(mak
7470: 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 29 e-hash-table))))
7480: 0a 09 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d .. (runs:update-
7490: 74 65 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73 test_meta db tes
74a0: 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 t-name test-conf
74b0: 29 29 29 0a 20 20 20 20 20 74 65 73 74 2d 6e 61 ))). test-na
74c0: 6d 65 73 29 29 29 0a 0a 3b 3b 20 54 68 69 73 20 mes)))..;; This
74d0: 63 6f 75 6c 64 20 70 72 6f 62 61 62 6c 79 20 62 could probably b
74e0: 65 20 72 65 66 61 63 74 6f 72 65 64 20 69 6e 74 e refactored int
74f0: 6f 20 6f 6e 65 20 63 6f 6d 70 6c 65 78 20 71 75 o one complex qu
7500: 65 72 79 20 2e 2e 2e 0a 28 64 65 66 69 6e 65 20 ery ....(define
7510: 28 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e (runs:rollup-run
7520: 20 64 62 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c db keys keyvall
7530: 73 74 20 72 75 6e 6e 61 6d 65 20 75 73 65 72 29 st runname user)
7540: 20 3b 3b 20 77 61 73 20 74 61 72 67 65 74 2c 20 ;; was target,
7550: 6e 6f 77 20 6b 65 79 76 61 6c 6c 73 74 0a 20 20 now keyvallst.
7560: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 (debug:print 4 "
7570: 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 2c runs:rollup-run,
7580: 20 6b 65 79 73 3a 20 22 20 6b 65 79 73 20 22 20 keys: " keys "
7590: 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65 79 keyvallst: " key
75a0: 76 61 6c 6c 73 74 20 22 20 3a 72 75 6e 6e 61 6d vallst " :runnam
75b0: 65 20 22 20 72 75 6e 6e 61 6d 65 20 22 20 75 73 e " runname " us
75c0: 65 72 3a 20 22 20 75 73 65 72 29 0a 20 20 28 6c er: " user). (l
75d0: 65 74 2a 20 28 3b 20 28 6b 65 79 76 61 6c 6c 6c et* (; (keyvalll
75e0: 73 74 20 20 20 20 20 20 28 6b 65 79 73 3a 74 61 st (keys:ta
75f0: 72 67 65 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 79 rget->keyval key
7600: 73 20 74 61 72 67 65 74 29 29 0a 09 20 28 6e 65 s target)).. (ne
7610: 77 2d 72 75 6e 2d 69 64 20 20 20 20 20 20 28 72 w-run-id (r
7620: 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75 6e uns:register-run
7630: 20 64 62 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c db keys keyvall
7640: 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e 65 77 22 st runname "new"
7650: 20 22 6e 2f 61 22 20 75 73 65 72 29 29 0a 09 20 "n/a" user))..
7660: 28 70 72 65 76 2d 74 65 73 74 73 20 20 20 20 20 (prev-tests
7670: 20 28 74 65 73 74 3a 67 65 74 2d 6d 61 74 63 68 (test:get-match
7680: 69 6e 67 2d 70 72 65 76 69 6f 75 73 2d 74 65 73 ing-previous-tes
7690: 74 2d 72 75 6e 2d 72 65 63 6f 72 64 73 20 64 62 t-run-records db
76a0: 20 6e 65 77 2d 72 75 6e 2d 69 64 20 22 25 22 20 new-run-id "%"
76b0: 22 25 22 29 29 0a 09 20 28 63 75 72 72 2d 74 65 "%")).. (curr-te
76c0: 73 74 73 20 20 20 20 20 20 28 64 62 2d 67 65 74 sts (db-get
76d0: 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 -tests-for-run d
76e0: 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 22 25 22 b new-run-id "%"
76f0: 20 22 25 22 20 27 28 29 20 27 28 29 29 29 0a 09 "%" '() '()))..
7700: 20 28 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 (curr-tests-has
7710: 68 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 h (make-hash-tab
7720: 6c 65 29 29 29 0a 20 20 20 20 28 64 62 3a 75 70 le))). (db:up
7730: 64 61 74 65 2d 72 75 6e 2d 65 76 65 6e 74 5f 74 date-run-event_t
7740: 69 6d 65 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 ime db new-run-i
7750: 64 29 0a 20 20 20 20 3b 3b 20 69 6e 64 65 78 20 d). ;; index
7760: 74 68 65 20 61 6c 72 65 61 64 79 20 73 61 76 65 the already save
7770: 64 20 74 65 73 74 73 20 62 79 20 74 65 73 74 6e d tests by testn
7780: 61 6d 65 20 61 6e 64 20 69 74 65 6d 64 61 74 20 ame and itemdat
7790: 69 6e 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 in curr-tests-ha
77a0: 73 68 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 sh. (for-each
77b0: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74 . (lambda (t
77c0: 65 73 74 64 61 74 29 0a 20 20 20 20 20 20 20 28 estdat). (
77d0: 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 20 let* ((testname
77e0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 (db:test-get-te
77f0: 73 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29 stname testdat))
7800: 0a 09 20 20 20 20 20 20 28 69 74 65 6d 2d 70 61 .. (item-pa
7810: 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d th (db:test-get-
7820: 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 64 61 item-path testda
7830: 74 29 29 0a 09 20 20 20 20 20 20 28 66 75 6c 6c t)).. (full
7840: 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 -name (conc test
7850: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 name "/" item-pa
7860: 74 68 29 29 29 0a 09 20 28 68 61 73 68 2d 74 61 th))).. (hash-ta
7870: 62 6c 65 2d 73 65 74 21 20 63 75 72 72 2d 74 65 ble-set! curr-te
7880: 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 sts-hash full-na
7890: 6d 65 20 74 65 73 74 64 61 74 29 29 29 0a 20 20 me testdat))).
78a0: 20 20 20 63 75 72 72 2d 74 65 73 74 73 29 0a 20 curr-tests).
78b0: 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 4e 6f 6e 2d ;; NOPE: Non-
78c0: 6f 70 74 69 6d 61 6c 20 61 70 70 72 6f 61 63 68 optimal approach
78d0: 2e 20 54 72 79 20 74 68 69 73 20 69 6e 73 74 65 . Try this inste
78e0: 61 64 2e 0a 20 20 20 20 3b 3b 20 20 20 31 2e 20 ad.. ;; 1.
78f0: 74 65 73 74 73 20 61 72 65 20 72 65 63 65 69 76 tests are receiv
7900: 65 64 20 69 6e 20 61 20 6c 69 73 74 2c 20 6d 6f ed in a list, mo
7910: 73 74 20 72 65 63 65 6e 74 20 66 69 72 73 74 0a st recent first.
7920: 20 20 20 20 3b 3b 20 20 20 32 2e 20 72 65 70 6c ;; 2. repl
7930: 61 63 65 20 74 68 65 20 72 6f 6c 6c 75 70 20 74 ace the rollup t
7940: 65 73 74 20 77 69 74 68 20 74 68 65 20 6e 65 77 est with the new
7950: 20 2a 61 6c 77 61 79 73 2a 0a 20 20 20 20 28 66 *always*. (f
7960: 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c or-each . (l
7970: 61 6d 62 64 61 20 28 74 65 73 74 64 61 74 29 0a ambda (testdat).
7980: 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74 (let* ((t
7990: 65 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 65 73 estname (db:tes
79a0: 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 t-get-testname t
79b0: 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 estdat))..
79c0: 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74 (item-path (db:t
79d0: 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 est-get-item-pat
79e0: 68 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 h testdat))..
79f0: 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 63 (full-name (c
7a00: 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22 onc testname "/"
7a10: 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 20 20 item-path))..
7a20: 20 20 20 20 28 70 72 65 76 2d 74 65 73 74 2d 64 (prev-test-d
7a30: 61 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 at (hash-table-r
7a40: 65 66 2f 64 65 66 61 75 6c 74 20 63 75 72 72 2d ef/default curr-
7a50: 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d tests-hash full-
7a60: 6e 61 6d 65 20 23 66 29 29 0a 09 20 20 20 20 20 name #f))..
7a70: 20 28 74 65 73 74 2d 73 74 65 70 73 20 20 20 20 (test-steps
7a80: 20 20 28 64 62 3a 67 65 74 2d 73 74 65 70 73 2d (db:get-steps-
7a90: 66 6f 72 2d 74 65 73 74 20 64 62 20 28 64 62 3a for-test db (db:
7aa0: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 test-get-id test
7ab0: 64 61 74 29 29 29 0a 09 20 20 20 20 20 20 28 6e dat))).. (n
7ac0: 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 23 ew-test-record #
7ad0: 66 29 29 0a 09 20 3b 3b 20 72 65 70 6c 61 63 65 f)).. ;; replace
7ae0: 20 74 68 65 73 65 20 77 69 74 68 20 69 6e 73 65 these with inse
7af0: 72 74 20 2e 2e 2e 20 73 65 6c 65 63 74 0a 09 20 rt ... select..
7b00: 28 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a 65 (apply sqlite3:e
7b10: 78 65 63 75 74 65 20 0a 09 09 64 62 20 0a 09 09 xecute ...db ...
7b20: 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 (conc "INSERT OR
7b30: 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 REPLACE INTO te
7b40: 73 74 73 20 28 72 75 6e 5f 69 64 2c 74 65 73 74 sts (run_id,test
7b50: 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 name,state,statu
7b60: 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 68 6f 73 s,event_time,hos
7b70: 74 2c 63 70 75 6c 6f 61 64 2c 64 69 73 6b 66 72 t,cpuload,diskfr
7b80: 65 65 2c 75 6e 61 6d 65 2c 72 75 6e 64 69 72 2c ee,uname,rundir,
7b90: 69 74 65 6d 5f 70 61 74 68 2c 72 75 6e 5f 64 75 item_path,run_du
7ba0: 72 61 74 69 6f 6e 2c 66 69 6e 61 6c 5f 6c 6f 67 ration,final_log
7bb0: 66 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20 f,comment) "...
7bc0: 20 20 20 20 20 22 56 41 4c 55 45 53 20 28 3f 2c "VALUES (?,
7bd0: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c ?,?,?,?,?,?,?,?,
7be0: 3f 2c 3f 2c 3f 2c 3f 2c 3f 29 3b 22 29 0a 09 09 ?,?,?,?,?);")...
7bf0: 6e 65 77 2d 72 75 6e 2d 69 64 20 28 63 64 64 72 new-run-id (cddr
7c00: 20 28 76 65 63 74 6f 72 2d 3e 6c 69 73 74 20 74 (vector->list t
7c10: 65 73 74 64 61 74 29 29 29 0a 09 20 28 73 65 74 estdat))).. (set
7c20: 21 20 6e 65 77 2d 74 65 73 74 64 61 74 20 28 63 ! new-testdat (c
7c30: 61 72 20 28 64 62 2d 67 65 74 2d 74 65 73 74 73 ar (db-get-tests
7c40: 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77 2d -for-run db new-
7c50: 72 75 6e 2d 69 64 20 74 65 73 74 6e 61 6d 65 20 run-id testname
7c60: 69 74 65 6d 2d 70 61 74 68 20 27 28 29 20 27 28 item-path '() '(
7c70: 29 29 29 29 0a 09 20 28 68 61 73 68 2d 74 61 62 )))).. (hash-tab
7c80: 6c 65 2d 73 65 74 21 20 63 75 72 72 2d 74 65 73 le-set! curr-tes
7c90: 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d ts-hash full-nam
7ca0: 65 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20 3b e new-testdat) ;
7cb0: 3b 20 74 68 69 73 20 63 6f 75 6c 64 20 62 65 20 ; this could be
7cc0: 63 6f 6e 66 75 73 69 6e 67 2c 20 77 68 69 63 68 confusing, which
7cd0: 20 72 65 63 6f 72 64 20 73 68 6f 75 6c 64 20 67 record should g
7ce0: 6f 20 69 6e 74 6f 20 74 68 65 20 6c 6f 6f 6b 75 o into the looku
7cf0: 70 20 74 61 62 6c 65 3f 0a 09 20 3b 3b 20 4e 6f p table?.. ;; No
7d00: 77 20 64 75 70 6c 69 63 61 74 65 20 74 68 65 20 w duplicate the
7d10: 74 65 73 74 20 73 74 65 70 73 0a 09 20 28 64 65 test steps.. (de
7d20: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 43 6f 70 bug:print 4 "Cop
7d30: 79 69 6e 67 20 72 65 63 6f 72 64 73 20 69 6e 20 ying records in
7d40: 74 65 73 74 5f 73 74 65 70 73 20 66 72 6f 6d 20 test_steps from
7d50: 74 65 73 74 5f 69 64 3d 22 20 28 64 62 3a 74 65 test_id=" (db:te
7d60: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 st-get-id testda
7d70: 74 29 20 22 20 74 6f 20 22 20 28 64 62 3a 74 65 t) " to " (db:te
7d80: 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 st-get-id new-te
7d90: 73 74 64 61 74 29 29 0a 09 20 28 73 71 6c 69 74 stdat)).. (sqlit
7da0: 65 33 3a 65 78 65 63 75 74 65 20 0a 09 20 20 64 e3:execute .. d
7db0: 62 20 0a 09 20 20 28 63 6f 6e 63 20 22 49 4e 53 b .. (conc "INS
7dc0: 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49 ERT OR REPLACE I
7dd0: 4e 54 4f 20 74 65 73 74 5f 73 74 65 70 73 20 28 NTO test_steps (
7de0: 74 65 73 74 5f 69 64 2c 73 74 65 70 6e 61 6d 65 test_id,stepname
7df0: 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c 65 76 ,state,status,ev
7e00: 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 ent_time,comment
7e10: 29 20 22 0a 09 09 22 53 45 4c 45 43 54 20 22 20 ) "..."SELECT "
7e20: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 (db:test-get-id
7e30: 6e 65 77 2d 74 65 73 74 64 61 74 29 20 22 2c 73 new-testdat) ",s
7e40: 74 65 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 tepname,state,st
7e50: 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c atus,event_time,
7e60: 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 comment FROM tes
7e70: 74 5f 73 74 65 70 73 20 57 48 45 52 45 20 74 65 t_steps WHERE te
7e80: 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 28 64 st_id=?;").. (d
7e90: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 b:test-get-id te
7ea0: 73 74 64 61 74 29 29 0a 09 20 3b 3b 20 4e 6f 77 stdat)).. ;; Now
7eb0: 20 64 75 70 6c 69 63 61 74 65 20 74 68 65 20 74 duplicate the t
7ec0: 65 73 74 20 64 61 74 61 0a 09 20 28 64 65 62 75 est data.. (debu
7ed0: 67 3a 70 72 69 6e 74 20 34 20 22 43 6f 70 79 69 g:print 4 "Copyi
7ee0: 6e 67 20 72 65 63 6f 72 64 73 20 69 6e 20 74 65 ng records in te
7ef0: 73 74 5f 64 61 74 61 20 66 72 6f 6d 20 74 65 73 st_data from tes
7f00: 74 5f 69 64 3d 22 20 28 64 62 3a 74 65 73 74 2d t_id=" (db:test-
7f10: 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 20 get-id testdat)
7f20: 22 20 74 6f 20 22 20 28 64 62 3a 74 65 73 74 2d " to " (db:test-
7f30: 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 get-id new-testd
7f40: 61 74 29 29 0a 09 20 28 73 71 6c 69 74 65 33 3a at)).. (sqlite3:
7f50: 65 78 65 63 75 74 65 20 0a 09 20 20 64 62 20 0a execute .. db .
7f60: 09 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 . (conc "INSERT
7f70: 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f OR REPLACE INTO
7f80: 20 74 65 73 74 5f 64 61 74 61 20 28 74 65 73 74 test_data (test
7f90: 5f 69 64 2c 63 61 74 65 67 6f 72 79 2c 76 61 72 _id,category,var
7fa0: 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65 iable,value,expe
7fb0: 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 cted,tol,units,c
7fc0: 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 22 53 45 4c omment) "..."SEL
7fd0: 45 43 54 20 22 20 28 64 62 3a 74 65 73 74 2d 67 ECT " (db:test-g
7fe0: 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 et-id new-testda
7ff0: 74 29 20 22 2c 63 61 74 65 67 6f 72 79 2c 76 61 t) ",category,va
8000: 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70 riable,value,exp
8010: 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c ected,tol,units,
8020: 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 comment FROM tes
8030: 74 5f 64 61 74 61 20 57 48 45 52 45 20 74 65 73 t_data WHERE tes
8040: 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 28 64 62 t_id=?;").. (db
8050: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 :test-get-id tes
8060: 74 64 61 74 29 29 0a 09 20 29 29 0a 20 20 20 20 tdat)).. )).
8070: 20 70 72 65 76 2d 74 65 73 74 73 29 29 29 0a 09 prev-tests)))..
8080: 20 0a 20 20 20 20 20 0a . .