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 28 64 65 66 69 er res)))..(defi
0770: 6e 65 20 28 72 75 6e 73 3a 74 65 73 74 2d 67 65 ne (runs:test-ge
0780: 74 2d 66 75 6c 6c 2d 70 61 74 68 20 74 65 73 74 t-full-path test
0790: 29 0a 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 ). (let* ((test
07a0: 6e 61 6d 65 20 28 64 62 3a 74 65 73 74 2d 67 65 name (db:test-ge
07b0: 74 2d 74 65 73 74 6e 61 6d 65 20 20 20 74 65 73 t-testname tes
07c0: 74 29 29 0a 09 20 28 69 74 65 6d 70 61 74 68 20 t)).. (itempath
07d0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 (db:test-get-ite
07e0: 6d 2d 70 61 74 68 20 74 65 73 74 29 29 29 0a 20 m-path test))).
07f0: 20 20 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d (conc testnam
0800: 65 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 e (if (equal? it
0810: 65 6d 70 61 74 68 20 22 22 29 20 22 22 20 28 63 empath "") "" (c
0820: 6f 6e 63 20 22 28 22 20 69 74 65 6d 70 61 74 68 onc "(" itempath
0830: 20 22 29 22 29 29 29 29 29 0a 0a 0a 28 64 65 66 ")")))))...(def
0840: 69 6e 65 20 28 73 65 74 2d 6d 65 67 61 74 65 73 ine (set-megates
0850: 74 2d 65 6e 76 2d 76 61 72 73 20 64 62 20 72 75 t-env-vars db ru
0860: 6e 2d 69 64 29 0a 20 20 28 6c 65 74 20 28 28 6b n-id). (let ((k
0870: 65 79 73 20 28 72 64 62 3a 67 65 74 2d 6b 65 79 eys (rdb:get-key
0880: 73 20 64 62 29 29 29 0a 20 20 20 20 28 66 6f 72 s db))). (for
0890: 2d 65 61 63 68 20 28 6c 61 6d 62 64 61 20 28 6b -each (lambda (k
08a0: 65 79 29 0a 09 09 28 73 71 6c 69 74 65 33 3a 66 ey)...(sqlite3:f
08b0: 6f 72 2d 65 61 63 68 2d 72 6f 77 0a 09 09 20 28 or-each-row... (
08c0: 6c 61 6d 62 64 61 20 28 76 61 6c 29 0a 09 09 20 lambda (val)...
08d0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 (debug:print 2
08e0: 20 22 73 65 74 65 6e 76 20 22 20 28 6b 65 79 3a "setenv " (key:
08f0: 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 get-fieldname ke
0900: 79 29 20 22 20 22 20 76 61 6c 29 0a 09 09 20 20 y) " " val)...
0910: 20 28 73 65 74 65 6e 76 20 28 6b 65 79 3a 67 65 (setenv (key:ge
0920: 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79 29 t-fieldname key)
0930: 20 76 61 6c 29 29 0a 09 09 20 64 62 20 0a 09 09 val))... db ...
0940: 20 28 63 6f 6e 63 20 22 53 45 4c 45 43 54 20 22 (conc "SELECT "
0950: 20 28 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e (key:get-fieldn
0960: 61 6d 65 20 6b 65 79 29 20 22 20 46 52 4f 4d 20 ame key) " FROM
0970: 72 75 6e 73 20 57 48 45 52 45 20 69 64 3d 3f 3b runs WHERE id=?;
0980: 22 29 0a 09 09 20 72 75 6e 2d 69 64 29 29 0a 09 ")... run-id))..
0990: 20 20 20 20 20 20 6b 65 79 73 29 0a 20 20 20 20 keys).
09a0: 3b 3b 20 4c 65 74 73 20 75 73 65 20 74 68 69 73 ;; Lets use this
09b0: 20 61 73 20 61 6e 20 6f 70 70 6f 72 74 75 6e 69 as an opportuni
09c0: 74 79 20 74 6f 20 70 75 74 20 4d 54 5f 52 55 4e ty to put MT_RUN
09d0: 4e 41 4d 45 20 69 6e 20 74 68 65 20 65 6e 76 69 NAME in the envi
09e0: 72 6f 6e 6d 65 6e 74 0a 20 20 20 20 28 73 71 6c ronment. (sql
09f0: 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f ite3:for-each-ro
0a00: 77 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 w. (lambda (
0a10: 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20 20 20 20 runname).
0a20: 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e 4e (setenv "MT_RUNN
0a30: 41 4d 45 22 20 72 75 6e 6e 61 6d 65 29 29 0a 20 AME" runname)).
0a40: 20 20 20 20 64 62 0a 20 20 20 20 20 22 53 45 4c db. "SEL
0a50: 45 43 54 20 72 75 6e 6e 61 6d 65 20 46 52 4f 4d ECT runname FROM
0a60: 20 72 75 6e 73 20 57 48 45 52 45 20 69 64 3d 3f runs WHERE id=?
0a70: 3b 22 0a 20 20 20 20 20 72 75 6e 2d 69 64 29 0a ;". run-id).
0a80: 20 20 20 20 29 29 0a 0a 28 64 65 66 69 6e 65 20 ))..(define
0a90: 28 73 65 74 2d 69 74 65 6d 2d 65 6e 76 2d 76 61 (set-item-env-va
0aa0: 72 73 20 69 74 65 6d 64 61 74 29 0a 20 20 28 66 rs itemdat). (f
0ab0: 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 61 20 or-each (lambda
0ac0: 28 69 74 65 6d 29 0a 09 20 20 20 20 20 20 28 64 (item).. (d
0ad0: 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 73 65 ebug:print 2 "se
0ae0: 74 65 6e 76 20 22 20 28 63 61 72 20 69 74 65 6d tenv " (car item
0af0: 29 20 22 20 22 20 28 63 61 64 72 20 69 74 65 6d ) " " (cadr item
0b00: 29 29 0a 09 20 20 20 20 20 20 28 73 65 74 65 6e )).. (seten
0b10: 76 20 28 63 61 72 20 69 74 65 6d 29 20 28 63 61 v (car item) (ca
0b20: 64 72 20 69 74 65 6d 29 29 29 0a 09 20 20 20 20 dr item)))..
0b30: 69 74 65 6d 64 61 74 29 29 0a 0a 28 64 65 66 69 itemdat))..(defi
0b40: 6e 65 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e ne (runs:can-run
0b50: 2d 6d 6f 72 65 2d 74 65 73 74 73 20 64 62 20 74 -more-tests db t
0b60: 65 73 74 2d 72 65 63 6f 72 64 29 0a 20 20 28 6c est-record). (l
0b70: 65 74 2a 20 28 28 74 63 6f 6e 66 69 67 20 20 20 et* ((tconfig
0b80: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 74 (t
0b90: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 ests:testqueue-g
0ba0: 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 74 65 et-testconfig te
0bb0: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 6a st-record)).. (j
0bc0: 6f 62 67 72 6f 75 70 20 20 20 20 20 20 20 20 20 obgroup
0bd0: 20 20 20 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c (config-l
0be0: 6f 6f 6b 75 70 20 74 63 6f 6e 66 69 67 20 22 72 ookup tconfig "r
0bf0: 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 6a 6f equirements" "jo
0c00: 62 67 72 6f 75 70 22 29 29 0a 09 20 28 6e 75 6d bgroup")).. (num
0c10: 2d 72 75 6e 6e 69 6e 67 20 20 20 20 20 20 20 20 -running
0c20: 20 20 20 20 20 28 64 62 3a 67 65 74 2d 63 6f 75 (db:get-cou
0c30: 6e 74 2d 74 65 73 74 73 2d 72 75 6e 6e 69 6e 67 nt-tests-running
0c40: 20 64 62 29 29 0a 09 20 28 6e 75 6d 2d 72 75 6e db)).. (num-run
0c50: 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 ning-in-jobgroup
0c60: 20 28 64 62 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 (db:get-count-t
0c70: 65 73 74 73 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d ests-running-in-
0c80: 6a 6f 62 67 72 6f 75 70 20 64 62 20 6a 6f 62 67 jobgroup db jobg
0c90: 72 6f 75 70 29 29 0a 09 20 28 6d 61 78 2d 63 6f roup)).. (max-co
0ca0: 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 20 20 ncurrent-jobs
0cb0: 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 (config-lookup
0cc0: 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 73 65 *configdat* "se
0cd0: 74 75 70 22 20 20 20 20 20 22 6d 61 78 5f 63 6f tup" "max_co
0ce0: 6e 63 75 72 72 65 6e 74 5f 6a 6f 62 73 22 29 29 ncurrent_jobs"))
0cf0: 0a 09 20 28 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 .. (job-group-li
0d00: 6d 69 74 20 20 20 20 20 20 20 20 20 28 63 6f 6e mit (con
0d10: 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 fig-lookup *conf
0d20: 69 67 64 61 74 2a 20 22 6a 6f 62 67 72 6f 75 70 igdat* "jobgroup
0d30: 73 22 20 6a 6f 62 67 72 6f 75 70 29 29 29 0a 20 s" jobgroup))).
0d40: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
0d50: 32 20 22 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 2 "max-concurren
0d60: 74 2d 6a 6f 62 73 3a 20 22 20 6d 61 78 2d 63 6f t-jobs: " max-co
0d70: 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 22 2c ncurrent-jobs ",
0d80: 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 3a 20 22 20 num-running: "
0d90: 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 0a 20 20 20 num-running).
0da0: 20 28 69 66 20 28 6e 6f 74 20 28 65 71 3f 20 30 (if (not (eq? 0
0db0: 20 2a 67 6c 6f 62 61 6c 65 78 69 74 73 74 61 74 *globalexitstat
0dc0: 75 73 2a 29 29 0a 09 23 66 0a 09 28 6c 65 74 20 us*))..#f..(let
0dd0: 28 28 63 61 6e 2d 6e 6f 74 2d 72 75 6e 2d 6d 6f ((can-not-run-mo
0de0: 72 65 20 28 63 6f 6e 64 0a 09 09 09 09 20 3b 3b re (cond..... ;;
0df0: 20 69 66 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 if max-concurre
0e00: 6e 74 2d 6a 6f 62 73 20 69 73 20 73 65 74 20 61 nt-jobs is set a
0e10: 6e 64 20 74 68 65 20 6e 75 6d 62 65 72 20 72 75 nd the number ru
0e20: 6e 6e 69 6e 67 20 69 73 20 67 72 65 61 74 65 72 nning is greater
0e30: 20 0a 09 09 09 09 20 3b 3b 20 74 68 61 6e 20 69 ..... ;; than i
0e40: 74 20 74 68 61 6e 20 63 61 6e 6e 6f 74 20 72 75 t than cannot ru
0e50: 6e 20 6d 6f 72 65 20 6a 6f 62 73 0a 09 09 09 09 n more jobs.....
0e60: 20 28 28 61 6e 64 20 6d 61 78 2d 63 6f 6e 63 75 ((and max-concu
0e70: 72 72 65 6e 74 2d 6a 6f 62 73 0a 09 09 09 09 20 rrent-jobs.....
0e80: 20 20 20 20 20 20 28 73 74 72 69 6e 67 2d 3e 6e (string->n
0e90: 75 6d 62 65 72 20 6d 61 78 2d 63 6f 6e 63 75 72 umber max-concur
0ea0: 72 65 6e 74 2d 6a 6f 62 73 29 0a 09 09 09 09 20 rent-jobs).....
0eb0: 20 20 20 20 20 20 28 3e 3d 20 6e 75 6d 2d 72 75 (>= num-ru
0ec0: 6e 6e 69 6e 67 20 28 73 74 72 69 6e 67 2d 3e 6e nning (string->n
0ed0: 75 6d 62 65 72 20 6d 61 78 2d 63 6f 6e 63 75 72 umber max-concur
0ee0: 72 65 6e 74 2d 6a 6f 62 73 29 29 29 0a 09 09 09 rent-jobs)))....
0ef0: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 . (debug:print
0f00: 30 20 22 57 41 52 4e 49 4e 47 3a 20 4d 61 78 20 0 "WARNING: Max
0f10: 72 75 6e 6e 69 6e 67 20 6a 6f 62 73 20 65 78 63 running jobs exc
0f20: 65 65 64 65 64 2c 20 63 75 72 72 65 6e 74 20 6e eeded, current n
0f30: 75 6d 62 65 72 20 72 75 6e 6e 69 6e 67 3a 20 22 umber running: "
0f40: 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 0a 09 09 num-running ...
0f50: 09 09 09 20 20 20 20 20 20 20 22 2c 20 6d 61 78 ... ", max
0f60: 5f 63 6f 6e 63 75 72 72 65 6e 74 5f 6a 6f 62 73 _concurrent_jobs
0f70: 3a 20 22 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 : " max-concurre
0f80: 6e 74 2d 6a 6f 62 73 29 0a 09 09 09 09 20 20 23 nt-jobs)..... #
0f90: 74 29 0a 09 09 09 09 20 3b 3b 20 69 66 20 6a 6f t)..... ;; if jo
0fa0: 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 20 69 73 b-group-limit is
0fb0: 20 73 65 74 20 61 6e 64 20 6e 75 6d 62 65 72 20 set and number
0fc0: 6f 66 20 6a 6f 62 73 20 69 6e 20 74 68 65 20 67 of jobs in the g
0fd0: 72 6f 75 70 20 69 73 20 67 72 65 61 74 65 72 0a roup is greater.
0fe0: 09 09 09 09 20 3b 3b 20 74 68 61 6e 20 74 68 65 .... ;; than the
0ff0: 20 6c 69 6d 69 74 20 74 68 65 6e 20 63 61 6e 6e limit then cann
1000: 6f 74 20 72 75 6e 20 6d 6f 72 65 20 6a 6f 62 73 ot run more jobs
1010: 20 6f 66 20 74 68 69 73 20 6b 69 6e 64 0a 09 09 of this kind...
1020: 09 09 20 28 28 61 6e 64 20 6a 6f 62 2d 67 72 6f .. ((and job-gro
1030: 75 70 2d 6c 69 6d 69 74 0a 09 09 09 09 20 20 20 up-limit.....
1040: 20 20 20 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e (>= num-runn
1050: 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 ing-in-jobgroup
1060: 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 29 job-group-limit)
1070: 29 0a 09 09 09 09 20 20 28 64 65 62 75 67 3a 70 )..... (debug:p
1080: 72 69 6e 74 20 31 20 22 57 41 52 4e 49 4e 47 3a rint 1 "WARNING:
1090: 20 6e 75 6d 62 65 72 20 6f 66 20 6a 6f 62 73 20 number of jobs
10a0: 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e " num-running-in
10b0: 2d 6a 6f 62 67 72 6f 75 70 20 0a 09 09 09 09 09 -jobgroup ......
10c0: 20 20 20 20 20 20 20 22 20 69 6e 20 22 20 6a 6f " in " jo
10d0: 62 67 72 6f 75 70 20 22 20 65 78 63 65 65 64 65 bgroup " exceede
10e0: 64 2c 20 77 69 6c 6c 20 6e 6f 74 20 72 75 6e 20 d, will not run
10f0: 22 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 " (tests:testque
1100: 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 ue-get-testname
1110: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 test-record))...
1120: 09 09 20 20 23 74 29 0a 09 09 09 09 20 28 65 6c .. #t)..... (el
1130: 73 65 20 23 66 29 29 29 29 0a 09 20 20 28 6e 6f se #f)))).. (no
1140: 74 20 63 61 6e 2d 6e 6f 74 2d 72 75 6e 2d 6d 6f t can-not-run-mo
1150: 72 65 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d re)))))..;;=====
1160: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1170: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1180: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1190: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
11a0: 3d 0a 3b 3b 20 4e 65 77 20 6d 65 74 68 6f 64 6f =.;; New methodo
11b0: 6c 6f 67 79 2e 20 54 68 65 73 65 20 72 6f 75 74 logy. These rout
11c0: 69 6e 65 73 20 77 69 6c 6c 20 72 65 70 6c 61 63 ines will replac
11d0: 65 20 74 68 65 20 61 62 6f 76 65 20 69 6e 20 74 e the above in t
11e0: 69 6d 65 2e 20 46 6f 72 0a 3b 3b 20 6e 6f 77 20 ime. For.;; now
11f0: 74 68 65 20 63 6f 64 65 20 69 73 20 64 75 70 6c the code is dupl
1200: 69 63 61 74 65 64 2e 20 54 68 69 73 20 73 74 75 icated. This stu
1210: 66 66 20 69 73 20 69 6e 69 74 69 61 6c 6c 79 20 ff is initially
1220: 75 73 65 64 20 69 6e 20 74 68 65 20 6d 6f 6e 69 used in the moni
1230: 74 6f 72 0a 3b 3b 20 62 61 73 65 64 20 63 6f 64 tor.;; based cod
1240: 65 2e 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d e..;;===========
1250: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1260: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1270: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1280: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 ===========..;;
1290: 72 65 67 69 73 74 65 72 20 61 20 74 65 73 74 20 register a test
12a0: 72 75 6e 20 77 69 74 68 20 74 68 65 20 64 62 0a run with the db.
12b0: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 65 (define (runs:re
12c0: 67 69 73 74 65 72 2d 72 75 6e 20 64 62 20 6b 65 gister-run db ke
12d0: 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e ys keyvallst run
12e0: 6e 61 6d 65 20 73 74 61 74 65 20 73 74 61 74 75 name state statu
12f0: 73 20 75 73 65 72 29 0a 20 20 28 64 65 62 75 67 s user). (debug
1300: 3a 70 72 69 6e 74 20 33 20 22 72 75 6e 73 3a 72 :print 3 "runs:r
1310: 65 67 69 73 74 65 72 2d 72 75 6e 2c 20 6b 65 79 egister-run, key
1320: 73 3a 20 22 20 6b 65 79 73 20 22 20 6b 65 79 76 s: " keys " keyv
1330: 61 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c allst: " keyvall
1340: 73 74 20 22 20 72 75 6e 6e 61 6d 65 3a 20 22 20 st " runname: "
1350: 72 75 6e 6e 61 6d 65 20 22 20 73 74 61 74 65 3a runname " state:
1360: 20 22 20 73 74 61 74 65 20 22 20 73 74 61 74 75 " state " statu
1370: 73 3a 20 22 20 73 74 61 74 75 73 20 22 20 75 73 s: " status " us
1380: 65 72 3a 20 22 20 75 73 65 72 29 0a 20 20 28 6c er: " user). (l
1390: 65 74 2a 20 28 28 6b 65 79 73 74 72 20 20 20 20 et* ((keystr
13a0: 28 6b 65 79 73 2d 3e 6b 65 79 73 74 72 20 6b 65 (keys->keystr ke
13b0: 79 73 29 29 0a 09 20 28 63 6f 6d 6d 61 20 20 20 ys)).. (comma
13c0: 20 20 28 69 66 20 28 3e 20 28 6c 65 6e 67 74 68 (if (> (length
13d0: 20 6b 65 79 73 29 20 30 29 20 22 2c 22 20 22 22 keys) 0) "," ""
13e0: 29 29 0a 09 20 28 61 6e 64 73 74 72 20 20 20 20 )).. (andstr
13f0: 28 69 66 20 28 3e 20 28 6c 65 6e 67 74 68 20 6b (if (> (length k
1400: 65 79 73 29 20 30 29 20 22 20 41 4e 44 20 22 20 eys) 0) " AND "
1410: 22 22 29 29 0a 09 20 28 76 61 6c 73 6c 6f 74 73 "")).. (valslots
1420: 20 20 28 6b 65 79 73 2d 3e 76 61 6c 73 6c 6f 74 (keys->valslot
1430: 73 20 6b 65 79 73 29 29 20 3b 3b 20 3f 2c 3f 2c s keys)) ;; ?,?,
1440: 3f 20 2e 2e 2e 0a 09 20 28 6b 65 79 76 61 6c 73 ? ..... (keyvals
1450: 20 20 20 28 6d 61 70 20 63 61 64 72 20 6b 65 79 (map cadr key
1460: 76 61 6c 6c 73 74 29 29 0a 09 20 28 61 6c 6c 76 vallst)).. (allv
1470: 61 6c 73 20 20 20 28 61 70 70 65 6e 64 20 28 6c als (append (l
1480: 69 73 74 20 72 75 6e 6e 61 6d 65 20 73 74 61 74 ist runname stat
1490: 65 20 73 74 61 74 75 73 20 75 73 65 72 29 20 6b e status user) k
14a0: 65 79 76 61 6c 73 29 29 0a 09 20 28 71 72 79 76 eyvals)).. (qryv
14b0: 61 6c 73 20 20 20 28 61 70 70 65 6e 64 20 28 6c als (append (l
14c0: 69 73 74 20 72 75 6e 6e 61 6d 65 29 20 6b 65 79 ist runname) key
14d0: 76 61 6c 73 29 29 0a 09 20 28 6b 65 79 3d 3f 73 vals)).. (key=?s
14e0: 74 72 20 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 tr (string-inte
14f0: 72 73 70 65 72 73 65 20 28 6d 61 70 20 28 6c 61 rsperse (map (la
1500: 6d 62 64 61 20 28 6b 29 28 63 6f 6e 63 20 28 6b mbda (k)(conc (k
1510: 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 ey:get-fieldname
1520: 20 6b 29 20 22 3d 3f 22 29 29 20 6b 65 79 73 29 k) "=?")) keys)
1530: 20 22 20 41 4e 44 20 22 29 29 29 0a 20 20 20 20 " AND "))).
1540: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 33 20 22 (debug:print 3 "
1550: 6b 65 79 73 3a 20 22 20 6b 65 79 73 20 22 20 61 keys: " keys " a
1560: 6c 6c 76 61 6c 73 3a 20 22 20 61 6c 6c 76 61 6c llvals: " allval
1570: 73 20 22 20 6b 65 79 76 61 6c 73 3a 20 22 20 6b s " keyvals: " k
1580: 65 79 76 61 6c 73 29 0a 20 20 20 20 28 64 65 62 eyvals). (deb
1590: 75 67 3a 70 72 69 6e 74 20 32 20 22 4e 4f 54 45 ug:print 2 "NOTE
15a0: 3a 20 75 73 69 6e 67 20 74 61 72 67 65 74 20 22 : using target "
15b0: 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 (string-intersp
15c0: 65 72 73 65 20 6b 65 79 76 61 6c 73 20 22 2f 22 erse keyvals "/"
15d0: 29 20 22 20 66 6f 72 20 74 68 69 73 20 72 75 6e ) " for this run
15e0: 22 29 0a 20 20 20 20 28 69 66 20 28 61 6e 64 20 "). (if (and
15f0: 72 75 6e 6e 61 6d 65 20 28 6e 75 6c 6c 3f 20 28 runname (null? (
1600: 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 filter (lambda (
1610: 78 29 28 6e 6f 74 20 78 29 29 20 6b 65 79 76 61 x)(not x)) keyva
1620: 6c 73 29 29 29 20 3b 3b 20 74 68 65 72 65 20 6d ls))) ;; there m
1630: 75 73 74 20 62 65 20 61 20 62 65 74 74 65 72 20 ust be a better
1640: 77 61 79 20 74 6f 20 22 61 70 70 6c 79 20 61 6e way to "apply an
1650: 64 22 0a 09 28 6c 65 74 20 28 28 72 65 73 20 23 d"..(let ((res #
1660: 66 29 29 0a 09 20 20 28 61 70 70 6c 79 20 73 71 f)).. (apply sq
1670: 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 lite3:execute db
1680: 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f (conc "INSERT O
1690: 52 20 49 47 4e 4f 52 45 20 49 4e 54 4f 20 72 75 R IGNORE INTO ru
16a0: 6e 73 20 28 72 75 6e 6e 61 6d 65 2c 73 74 61 74 ns (runname,stat
16b0: 65 2c 73 74 61 74 75 73 2c 6f 77 6e 65 72 2c 65 e,status,owner,e
16c0: 76 65 6e 74 5f 74 69 6d 65 22 20 63 6f 6d 6d 61 vent_time" comma
16d0: 20 6b 65 79 73 74 72 20 22 29 20 56 41 4c 55 45 keystr ") VALUE
16e0: 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c 73 74 72 66 74 S (?,?,?,?,strft
16f0: 69 6d 65 28 27 25 73 27 2c 27 6e 6f 77 27 29 22 ime('%s','now')"
1700: 20 63 6f 6d 6d 61 20 76 61 6c 73 6c 6f 74 73 20 comma valslots
1710: 22 29 3b 22 29 0a 09 09 20 61 6c 6c 76 61 6c 73 ");")... allvals
1720: 29 0a 09 20 20 28 61 70 70 6c 79 20 73 71 6c 69 ).. (apply sqli
1730: 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 te3:for-each-row
1740: 20 0a 09 20 20 20 28 6c 61 6d 62 64 61 20 28 69 .. (lambda (i
1750: 64 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 d).. (set! r
1760: 65 73 20 69 64 29 29 0a 09 20 20 20 64 62 0a 09 es id)).. db..
1770: 20 20 20 28 6c 65 74 20 28 28 71 72 79 20 28 63 (let ((qry (c
1780: 6f 6e 63 20 22 53 45 4c 45 43 54 20 69 64 20 46 onc "SELECT id F
1790: 52 4f 4d 20 72 75 6e 73 20 57 48 45 52 45 20 28 ROM runs WHERE (
17a0: 72 75 6e 6e 61 6d 65 3d 3f 20 22 20 61 6e 64 73 runname=? " ands
17b0: 74 72 20 6b 65 79 3d 3f 73 74 72 20 22 29 3b 22 tr key=?str ");"
17c0: 29 29 29 0a 09 20 20 20 20 20 3b 28 64 65 62 75 ))).. ;(debu
17d0: 67 3a 70 72 69 6e 74 20 34 20 22 71 72 79 3a 20 g:print 4 "qry:
17e0: 22 20 71 72 79 29 20 0a 09 20 20 20 20 20 71 72 " qry) .. qr
17f0: 79 29 0a 09 20 20 20 71 72 79 76 61 6c 73 29 0a y).. qryvals).
1800: 09 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 . (sqlite3:exec
1810: 75 74 65 20 64 62 20 22 55 50 44 41 54 45 20 72 ute db "UPDATE r
1820: 75 6e 73 20 53 45 54 20 73 74 61 74 65 3d 3f 2c uns SET state=?,
1830: 73 74 61 74 75 73 3d 3f 20 57 48 45 52 45 20 69 status=? WHERE i
1840: 64 3d 3f 3b 22 20 73 74 61 74 65 20 73 74 61 74 d=?;" state stat
1850: 75 73 20 72 65 73 29 0a 09 20 20 72 65 73 29 20 us res).. res)
1860: 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 64 65 62 ..(begin.. (deb
1870: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f ug:print 0 "ERRO
1880: 52 3a 20 43 61 6c 6c 65 64 20 77 69 74 68 6f 75 R: Called withou
1890: 74 20 61 6c 6c 20 6e 65 63 65 73 73 61 72 79 20 t all necessary
18a0: 6b 65 79 73 22 29 0a 09 20 20 23 66 29 29 29 29 keys").. #f))))
18b0: 0a 0a 3b 3b 20 54 68 69 73 20 69 73 20 61 20 64 ..;; This is a d
18c0: 75 70 6c 69 63 61 74 65 20 6f 66 20 72 75 6e 2d uplicate of run-
18d0: 74 65 73 74 73 20 28 77 68 69 63 68 20 68 61 73 tests (which has
18e0: 20 62 65 65 6e 20 64 65 70 72 65 63 61 74 65 64 been deprecated
18f0: 29 2e 20 55 73 65 20 74 68 69 73 20 6f 6e 65 20 ). Use this one
1900: 69 6e 73 74 65 61 64 20 6f 66 20 72 75 6e 20 74 instead of run t
1910: 65 73 74 73 2e 0a 3b 3b 20 6b 65 79 76 61 6c 73 ests..;; keyvals
1920: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 .(define (runs:r
1930: 75 6e 2d 74 65 73 74 73 20 64 62 20 74 61 72 67 un-tests db targ
1940: 65 74 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d et runname test-
1950: 70 61 74 74 73 20 69 74 65 6d 2d 70 61 74 74 73 patts item-patts
1960: 20 75 73 65 72 20 66 6c 61 67 73 29 0a 20 20 28 user flags). (
1970: 6c 65 74 2a 20 28 28 6b 65 79 73 20 20 20 20 20 let* ((keys
1980: 20 20 20 28 72 64 62 3a 67 65 74 2d 6b 65 79 73 (rdb:get-keys
1990: 20 64 62 29 29 0a 09 20 28 6b 65 79 76 61 6c 6c db)).. (keyvall
19a0: 73 74 20 20 20 28 6b 65 79 73 3a 74 61 72 67 65 st (keys:targe
19b0: 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 79 73 20 74 t->keyval keys t
19c0: 61 72 67 65 74 29 29 0a 09 20 28 72 75 6e 2d 69 arget)).. (run-i
19d0: 64 20 20 20 20 20 20 28 72 75 6e 73 3a 72 65 67 d (runs:reg
19e0: 69 73 74 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 ister-run db key
19f0: 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e s keyvallst runn
1a00: 61 6d 65 20 22 6e 65 77 22 20 22 6e 2f 61 22 20 ame "new" "n/a"
1a10: 75 73 65 72 29 29 20 20 3b 3b 20 20 74 65 73 74 user)) ;; test
1a20: 2d 6e 61 6d 65 29 29 29 0a 09 20 28 64 65 66 65 -name))).. (defe
1a30: 72 72 65 64 20 20 20 20 27 28 29 29 20 3b 3b 20 rred '()) ;;
1a40: 64 65 6c 61 79 20 72 75 6e 6e 69 6e 67 20 74 68 delay running th
1a50: 65 73 65 20 73 69 6e 63 65 20 74 68 65 79 20 68 ese since they h
1a60: 61 76 65 20 61 20 77 61 69 74 6f 6e 20 63 6c 61 ave a waiton cla
1a70: 75 73 65 0a 09 20 3b 3b 20 6b 65 65 70 67 6f 69 use.. ;; keepgoi
1a80: 6e 67 20 69 73 20 74 68 65 20 64 65 66 61 63 74 ng is the defact
1a90: 6f 20 6d 6f 64 61 6c 69 74 79 20 6e 6f 77 2c 20 o modality now,
1aa0: 77 69 6c 6c 20 61 64 64 20 68 69 74 2d 6e 2d 72 will add hit-n-r
1ab0: 75 6e 20 61 20 62 69 74 20 6c 61 74 65 72 0a 09 un a bit later..
1ac0: 20 3b 3b 20 28 6b 65 65 70 67 6f 69 6e 67 20 20 ;; (keepgoing
1ad0: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 (hash-table-ref
1ae0: 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 /default flags "
1af0: 2d 6b 65 65 70 67 6f 69 6e 67 22 20 23 66 29 29 -keepgoing" #f))
1b00: 0a 09 20 28 74 65 73 74 2d 6e 61 6d 65 73 20 20 .. (test-names
1b10: 27 28 29 29 0a 09 20 28 72 75 6e 63 6f 6e 66 69 '()).. (runconfi
1b20: 67 66 20 20 20 28 63 6f 6e 63 20 20 2a 74 6f 70 gf (conc *top
1b30: 70 61 74 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 69 path* "/runconfi
1b40: 67 73 2e 63 6f 6e 66 69 67 22 29 29 0a 09 20 28 gs.config")).. (
1b50: 72 65 71 75 69 72 65 64 2d 74 65 73 74 73 20 27 required-tests '
1b60: 28 29 29 0a 09 20 28 74 65 73 74 2d 72 65 63 6f ()).. (test-reco
1b70: 72 64 73 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 rds (make-hash-t
1b80: 61 62 6c 65 29 29 29 0a 0a 20 20 20 20 28 73 65 able))).. (se
1b90: 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 t-megatest-env-v
1ba0: 61 72 73 20 64 62 20 72 75 6e 2d 69 64 29 20 3b ars db run-id) ;
1bb0: 3b 20 74 68 65 73 65 20 6d 61 79 20 62 65 20 6e ; these may be n
1bc0: 65 65 64 65 64 20 62 79 20 74 68 65 20 6c 61 75 eeded by the lau
1bd0: 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 73 0a 0a nching process..
1be0: 20 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 (if (file-ex
1bf0: 69 73 74 73 3f 20 72 75 6e 63 6f 6e 66 69 67 66 ists? runconfigf
1c00: 29 0a 09 28 73 65 74 75 70 2d 65 6e 76 2d 64 65 )..(setup-env-de
1c10: 66 61 75 6c 74 73 20 64 62 20 72 75 6e 63 6f 6e faults db runcon
1c20: 66 69 67 66 20 72 75 6e 2d 69 64 20 2a 61 6c 72 figf run-id *alr
1c30: 65 61 64 79 2d 73 65 65 6e 2d 72 75 6e 63 6f 6e eady-seen-runcon
1c40: 66 69 67 2d 69 6e 66 6f 2a 20 22 70 72 65 2d 6c fig-info* "pre-l
1c50: 61 75 6e 63 68 2d 65 6e 76 2d 76 61 72 73 22 29 aunch-env-vars")
1c60: 0a 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 ..(debug:print 0
1c70: 20 22 57 41 52 4e 49 4e 47 3a 20 59 6f 75 20 64 "WARNING: You d
1c80: 6f 20 6e 6f 74 20 68 61 76 65 20 61 20 72 75 6e o not have a run
1c90: 20 63 6f 6e 66 69 67 20 66 69 6c 65 3a 20 22 20 config file: "
1ca0: 72 75 6e 63 6f 6e 66 69 67 66 29 29 0a 20 20 20 runconfigf)).
1cb0: 20 0a 20 20 20 20 3b 3b 20 6c 6f 6f 6b 20 75 70 . ;; look up
1cc0: 20 61 6c 6c 20 74 65 73 74 73 20 6d 61 74 63 68 all tests match
1cd0: 69 6e 67 20 74 68 65 20 63 6f 6d 6d 61 20 73 65 ing the comma se
1ce0: 70 61 72 61 74 65 64 20 6c 69 73 74 20 6f 66 20 parated list of
1cf0: 67 6c 6f 62 73 20 69 6e 0a 20 20 20 20 3b 3b 20 globs in. ;;
1d00: 74 65 73 74 2d 70 61 74 74 73 20 28 75 73 69 6e test-patts (usin
1d10: 67 20 25 20 61 73 20 77 69 6c 64 63 61 72 64 29 g % as wildcard)
1d20: 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a . (for-each .
1d30: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 70 61 (lambda (pa
1d40: 74 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 tt). (let
1d50: 28 28 74 65 73 74 73 20 28 67 6c 6f 62 20 28 63 ((tests (glob (c
1d60: 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f onc *toppath* "/
1d70: 74 65 73 74 73 2f 22 20 28 73 74 72 69 6e 67 2d tests/" (string-
1d80: 74 72 61 6e 73 6c 61 74 65 20 70 61 74 74 20 22 translate patt "
1d90: 25 22 20 22 2a 22 29 29 29 29 29 0a 09 20 28 73 %" "*"))))).. (s
1da0: 65 74 21 20 74 65 73 74 73 20 28 66 69 6c 74 65 et! tests (filte
1db0: 72 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 29 r (lambda (test)
1dc0: 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 28 63 (file-exists? (c
1dd0: 6f 6e 63 20 74 65 73 74 20 22 2f 74 65 73 74 63 onc test "/testc
1de0: 6f 6e 66 69 67 22 29 29 29 20 74 65 73 74 73 29 onfig"))) tests)
1df0: 29 0a 09 20 28 73 65 74 21 20 74 65 73 74 2d 6e ).. (set! test-n
1e00: 61 6d 65 73 20 28 61 70 70 65 6e 64 20 74 65 73 ames (append tes
1e10: 74 2d 6e 61 6d 65 73 20 0a 09 09 09 09 20 20 28 t-names ..... (
1e20: 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 74 65 73 map (lambda (tes
1e30: 74 70 29 0a 09 09 09 09 09 20 28 6c 61 73 74 20 tp)...... (last
1e40: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 74 65 (string-split te
1e50: 73 74 70 20 22 2f 22 29 29 29 0a 09 09 09 09 20 stp "/"))).....
1e60: 20 20 20 20 20 20 74 65 73 74 73 29 29 29 29 29 tests)))))
1e70: 0a 20 20 20 20 20 28 69 66 20 74 65 73 74 2d 70 . (if test-p
1e80: 61 74 74 73 20 28 73 74 72 69 6e 67 2d 73 70 6c atts (string-spl
1e90: 69 74 20 74 65 73 74 2d 70 61 74 74 73 20 22 2c it test-patts ",
1ea0: 22 29 28 6c 69 73 74 20 22 25 22 29 29 29 0a 0a ")(list "%")))..
1eb0: 20 20 20 20 20 3b 3b 20 6e 6f 77 20 72 65 6d 6f ;; now remo
1ec0: 76 65 20 64 75 70 6c 69 63 61 74 65 73 0a 20 20 ve duplicates.
1ed0: 20 20 28 73 65 74 21 20 74 65 73 74 2d 6e 61 6d (set! test-nam
1ee0: 65 73 20 28 64 65 6c 65 74 65 2d 64 75 70 6c 69 es (delete-dupli
1ef0: 63 61 74 65 73 20 74 65 73 74 2d 6e 61 6d 65 73 cates test-names
1f00: 29 29 0a 0a 20 20 20 20 28 64 65 62 75 67 3a 70 )).. (debug:p
1f10: 72 69 6e 74 20 30 20 22 49 4e 46 4f 3a 20 74 65 rint 0 "INFO: te
1f20: 73 74 20 6e 61 6d 65 73 20 22 20 74 65 73 74 2d st names " test-
1f30: 6e 61 6d 65 73 29 0a 0a 20 20 20 20 3b 3b 20 6f names).. ;; o
1f40: 6e 20 74 68 65 20 66 69 72 73 74 20 70 61 73 73 n the first pass
1f50: 20 6f 72 20 63 61 6c 6c 20 74 6f 20 72 75 6e 2d or call to run-
1f60: 74 65 73 74 73 20 73 65 74 20 46 41 49 4c 53 20 tests set FAILS
1f70: 74 6f 20 4e 4f 54 5f 53 54 41 52 54 45 44 20 69 to NOT_STARTED i
1f80: 66 0a 20 20 20 20 3b 3b 20 2d 6b 65 65 70 67 6f f. ;; -keepgo
1f90: 69 6e 67 20 69 73 20 73 70 65 63 69 66 69 65 64 ing is specified
1fa0: 0a 20 20 20 20 28 69 66 20 28 65 71 3f 20 2a 70 . (if (eq? *p
1fb0: 61 73 73 6e 75 6d 2a 20 30 29 0a 09 28 62 65 67 assnum* 0)..(beg
1fc0: 69 6e 0a 09 20 20 3b 3b 20 68 61 76 65 20 74 6f in.. ;; have to
1fd0: 20 64 65 6c 65 74 65 20 74 65 73 74 20 72 65 63 delete test rec
1fe0: 6f 72 64 73 20 77 68 65 72 65 20 4e 4f 54 5f 53 ords where NOT_S
1ff0: 54 41 52 54 45 44 20 73 69 6e 63 65 20 74 68 65 TARTED since the
2000: 79 20 63 61 6e 20 63 61 75 73 65 20 2d 6b 65 65 y can cause -kee
2010: 70 67 6f 69 6e 67 20 74 6f 20 0a 09 20 20 3b 3b pgoing to .. ;;
2020: 20 67 65 74 20 73 74 75 63 6b 20 64 75 65 20 74 get stuck due t
2030: 6f 20 62 65 63 6f 6d 69 6e 67 20 69 6e 61 63 63 o becoming inacc
2040: 65 73 73 69 62 6c 65 20 66 72 6f 6d 20 61 20 66 essible from a f
2050: 61 69 6c 65 64 20 74 65 73 74 2e 20 49 2e 65 2e ailed test. I.e.
2060: 20 69 66 20 74 65 73 74 20 42 20 64 65 70 65 6e if test B depen
2070: 64 73 20 0a 09 20 20 3b 3b 20 6f 6e 20 74 65 73 ds .. ;; on tes
2080: 74 20 41 20 62 75 74 20 74 65 73 74 20 42 20 72 t A but test B r
2090: 65 61 63 68 65 64 20 74 68 65 20 70 6f 69 6e 74 eached the point
20a0: 20 6f 6e 20 62 65 69 6e 67 20 72 65 67 69 73 74 on being regist
20b0: 65 72 65 64 20 61 73 20 4e 4f 54 5f 53 54 41 52 ered as NOT_STAR
20c0: 54 45 44 20 61 6e 64 20 74 65 73 74 0a 09 20 20 TED and test..
20d0: 3b 3b 20 41 20 66 61 69 6c 65 64 20 66 6f 72 20 ;; A failed for
20e0: 73 6f 6d 65 20 72 65 61 73 6f 6e 20 74 68 65 6e some reason then
20f0: 20 6f 6e 20 72 65 2d 72 75 6e 20 75 73 69 6e 67 on re-run using
2100: 20 2d 6b 65 65 70 67 6f 69 6e 67 20 74 68 65 20 -keepgoing the
2110: 72 75 6e 20 63 61 6e 20 6e 65 76 65 72 20 63 6f run can never co
2120: 6d 70 6c 65 74 65 2e 0a 09 20 20 28 64 62 3a 64 mplete... (db:d
2130: 65 6c 65 74 65 2d 74 65 73 74 73 2d 69 6e 2d 73 elete-tests-in-s
2140: 74 61 74 65 20 64 62 20 72 75 6e 2d 69 64 20 22 tate db run-id "
2150: 4e 4f 54 5f 53 54 41 52 54 45 44 22 29 0a 09 20 NOT_STARTED")..
2160: 20 28 72 64 62 3a 73 65 74 2d 74 65 73 74 73 2d (rdb:set-tests-
2170: 73 74 61 74 65 2d 73 74 61 74 75 73 20 64 62 20 state-status db
2180: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
2190: 73 20 23 66 20 22 46 41 49 4c 22 20 22 4e 4f 54 s #f "FAIL" "NOT
21a0: 5f 53 54 41 52 54 45 44 22 20 22 46 41 49 4c 22 _STARTED" "FAIL"
21b0: 29 29 29 0a 0a 20 20 20 20 3b 3b 20 6e 6f 77 20 ))).. ;; now
21c0: 61 64 64 20 6e 6f 6e 2d 64 69 72 65 63 74 6c 79 add non-directly
21d0: 20 72 65 66 65 72 65 6e 63 65 64 20 64 65 70 65 referenced depe
21e0: 6e 64 65 6e 63 69 65 73 20 28 69 2e 65 2e 20 77 ndencies (i.e. w
21f0: 61 69 74 6f 6e 29 0a 20 20 20 20 28 69 66 20 28 aiton). (if (
2200: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 73 74 2d not (null? test-
2210: 6e 61 6d 65 73 29 29 0a 09 28 6c 65 74 20 6c 6f names))..(let lo
2220: 6f 70 20 28 28 68 65 64 20 28 63 61 72 20 74 65 op ((hed (car te
2230: 73 74 2d 6e 61 6d 65 73 29 29 0a 09 09 20 20 20 st-names))...
2240: 28 74 61 6c 20 28 63 64 72 20 74 65 73 74 2d 6e (tal (cdr test-n
2250: 61 6d 65 73 29 29 29 20 20 20 20 20 20 20 20 20 ames)))
2260: 3b 3b 20 27 72 65 74 75 72 6e 2d 70 72 6f 63 73 ;; 'return-procs
2270: 20 74 65 6c 6c 73 20 74 68 65 20 63 6f 6e 66 69 tells the confi
2280: 67 20 72 65 61 64 65 72 20 74 6f 20 70 72 65 70 g reader to prep
2290: 20 72 75 6e 6e 69 6e 67 20 73 79 73 74 65 6d 20 running system
22a0: 62 75 74 20 72 65 74 75 72 6e 20 61 20 70 72 6f but return a pro
22b0: 63 0a 09 20 20 28 6c 65 74 2a 20 28 28 63 6f 6e c.. (let* ((con
22c0: 66 69 67 20 20 28 74 65 73 74 3a 67 65 74 2d 74 fig (test:get-t
22d0: 65 73 74 63 6f 6e 66 69 67 20 68 65 64 20 27 72 estconfig hed 'r
22e0: 65 74 75 72 6e 2d 70 72 6f 63 73 29 29 0a 09 09 eturn-procs))...
22f0: 20 28 77 61 69 74 6f 6e 73 20 28 73 74 72 69 6e (waitons (strin
2300: 67 2d 73 70 6c 69 74 20 28 6c 65 74 20 28 28 77 g-split (let ((w
2310: 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 (config-lookup
2320: 63 6f 6e 66 69 67 20 22 72 65 71 75 69 72 65 6d config "requirem
2330: 65 6e 74 73 22 20 22 77 61 69 74 6f 6e 22 29 29 ents" "waiton"))
2340: 29 0a 09 09 09 09 09 20 20 28 69 66 20 77 20 77 )...... (if w w
2350: 20 22 22 29 29 29 29 29 0a 09 20 20 20 20 3b 3b ""))))).. ;;
2360: 20 28 69 74 65 6d 73 20 20 20 28 69 74 65 6d 73 (items (items
2370: 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d :get-items-from-
2380: 63 6f 6e 66 69 67 20 63 6f 6e 66 69 67 29 29 29 config config)))
2390: 0a 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 .. (if (not (
23a0: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 hash-table-ref/d
23b0: 65 66 61 75 6c 74 20 74 65 73 74 2d 72 65 63 6f efault test-reco
23c0: 72 64 73 20 68 65 64 20 23 66 29 29 0a 09 09 28 rds hed #f))...(
23d0: 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 hash-table-set!
23e0: 74 65 73 74 2d 72 65 63 6f 72 64 73 0a 09 09 09 test-records....
23f0: 09 20 68 65 64 20 28 76 65 63 74 6f 72 20 68 65 . hed (vector he
2400: 64 20 20 20 20 20 3b 3b 20 30 0a 09 09 09 09 09 d ;; 0......
2410: 20 20 20 20 20 63 6f 6e 66 69 67 20 20 3b 3b 20 config ;;
2420: 31 0a 09 09 09 09 09 20 20 20 20 20 77 61 69 74 1...... wait
2430: 6f 6e 73 20 3b 3b 20 32 0a 09 09 09 09 09 20 20 ons ;; 2......
2440: 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 (config-looku
2450: 70 20 63 6f 6e 66 69 67 20 22 72 65 71 75 69 72 p config "requir
2460: 65 6d 65 6e 74 73 22 20 22 70 72 69 6f 72 69 74 ements" "priorit
2470: 79 22 29 20 20 20 20 20 3b 3b 20 70 72 69 6f 72 y") ;; prior
2480: 69 74 79 20 33 0a 09 09 09 09 09 20 20 20 20 20 ity 3......
2490: 28 6c 65 74 20 28 28 69 74 65 6d 73 20 20 20 20 (let ((items
24a0: 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 (hash-table-re
24b0: 66 2f 64 65 66 61 75 6c 74 20 63 6f 6e 66 69 67 f/default config
24c0: 20 22 69 74 65 6d 73 22 20 23 66 29 29 20 3b 3b "items" #f)) ;;
24d0: 20 69 74 65 6d 73 20 34 0a 09 09 09 09 09 09 20 items 4.......
24e0: 20 20 28 69 74 65 6d 73 74 61 62 6c 65 20 28 68 (itemstable (h
24f0: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 ash-table-ref/de
2500: 66 61 75 6c 74 20 63 6f 6e 66 69 67 20 22 69 74 fault config "it
2510: 65 6d 73 74 61 62 6c 65 22 20 23 66 29 29 29 20 emstable" #f)))
2520: 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20 ...... ;;
2530: 69 66 20 65 69 74 68 65 72 20 69 74 65 6d 73 20 if either items
2540: 6f 72 20 69 74 65 6d 73 20 74 61 62 6c 65 20 69 or items table i
2550: 73 20 61 20 70 72 6f 63 20 72 65 74 75 72 6e 20 s a proc return
2560: 69 74 20 73 6f 20 74 65 73 74 20 72 75 6e 6e 69 it so test runni
2570: 6e 67 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b ng...... ;
2580: 3b 20 70 72 6f 63 65 73 73 20 63 61 6e 20 6b 6e ; process can kn
2590: 6f 77 20 74 6f 20 63 61 6c 6c 20 69 74 65 6d 73 ow to call items
25a0: 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d :get-items-from-
25b0: 63 6f 6e 66 69 67 0a 09 09 09 09 09 20 20 20 20 config......
25c0: 20 20 20 3b 3b 20 69 66 20 65 69 74 68 65 72 20 ;; if either
25d0: 69 73 20 61 20 6c 69 73 74 20 61 6e 64 20 6e 6f is a list and no
25e0: 6e 65 20 69 73 20 61 20 70 72 6f 63 20 67 6f 20 ne is a proc go
25f0: 61 68 65 61 64 20 61 6e 64 20 63 61 6c 6c 20 67 ahead and call g
2600: 65 74 2d 69 74 65 6d 73 0a 09 09 09 09 09 20 20 et-items......
2610: 20 20 20 20 20 3b 3b 20 6f 74 68 65 72 77 69 73 ;; otherwis
2620: 65 20 72 65 74 75 72 6e 20 23 66 20 2d 20 74 68 e return #f - th
2630: 69 73 20 69 73 20 6e 6f 74 20 61 6e 20 69 74 65 is is not an ite
2640: 72 61 74 65 64 20 74 65 73 74 0a 09 09 09 09 09 rated test......
2650: 20 20 20 20 20 20 20 28 63 6f 6e 64 0a 09 09 09 (cond....
2660: 09 09 09 28 28 70 72 6f 63 65 64 75 72 65 3f 20 ...((procedure?
2670: 69 74 65 6d 73 29 20 20 20 20 20 20 0a 09 09 09 items) ....
2680: 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 ... (debug:print
2690: 20 34 20 22 49 4e 46 4f 3a 20 69 74 65 6d 73 20 4 "INFO: items
26a0: 69 73 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20 is a procedure,
26b0: 77 69 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72 22 will calc later"
26c0: 29 0a 09 09 09 09 09 09 20 69 74 65 6d 73 29 20 )....... items)
26d0: 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 63 61 ;; ca
26e0: 6c 63 20 6c 61 74 65 72 0a 09 09 09 09 09 09 28 lc later.......(
26f0: 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d (procedure? item
2700: 73 74 61 62 6c 65 29 0a 09 09 09 09 09 09 20 28 stable)....... (
2710: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 debug:print 4 "I
2720: 4e 46 4f 3a 20 69 74 65 6d 73 74 61 62 6c 65 20 NFO: itemstable
2730: 69 73 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20 is a procedure,
2740: 77 69 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72 22 will calc later"
2750: 29 0a 09 09 09 09 09 09 20 69 74 65 6d 73 74 61 )....... itemsta
2760: 62 6c 65 29 20 20 20 20 20 20 20 3b 3b 20 63 61 ble) ;; ca
2770: 6c 63 20 6c 61 74 65 72 0a 09 09 09 09 09 09 28 lc later.......(
2780: 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 (filter (lambda
2790: 28 78 29 0a 09 09 09 09 09 09 09 20 20 20 28 6c (x)........ (l
27a0: 65 74 20 28 28 76 61 6c 20 28 63 61 72 20 78 29 et ((val (car x)
27b0: 29 29 0a 09 09 09 09 09 09 09 20 20 20 20 20 28 ))........ (
27c0: 69 66 20 28 70 72 6f 63 65 64 75 72 65 3f 20 76 if (procedure? v
27d0: 61 6c 29 20 76 61 6c 20 23 66 29 29 29 0a 09 09 al) val #f)))...
27e0: 09 09 09 09 09 20 28 61 70 70 65 6e 64 20 28 69 ..... (append (i
27f0: 66 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 f (list? items)
2800: 69 74 65 6d 73 20 27 28 29 29 0a 09 09 09 09 09 items '())......
2810: 09 09 09 20 28 69 66 20 28 6c 69 73 74 3f 20 69 ... (if (list? i
2820: 74 65 6d 73 74 61 62 6c 65 29 20 69 74 65 6d 73 temstable) items
2830: 74 61 62 6c 65 20 27 28 29 29 29 29 0a 09 09 09 table '())))....
2840: 09 09 09 20 27 68 61 76 65 2d 70 72 6f 63 65 64 ... 'have-proced
2850: 75 72 65 29 0a 09 09 09 09 09 09 28 28 6f 72 20 ure).......((or
2860: 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 28 6c 69 (list? items)(li
2870: 73 74 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 29 st? itemstable))
2880: 20 3b 3b 20 63 61 6c 63 20 6e 6f 77 0a 09 09 09 ;; calc now....
2890: 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 ... (debug:print
28a0: 20 34 20 22 49 4e 46 4f 3a 20 69 74 65 6d 73 20 4 "INFO: items
28b0: 61 6e 64 20 69 74 65 6d 73 74 61 62 6c 65 20 61 and itemstable a
28c0: 72 65 20 6c 69 73 74 73 2c 20 63 61 6c 63 20 6e re lists, calc n
28d0: 6f 77 5c 6e 22 0a 09 09 09 09 09 09 09 20 20 20 ow\n"........
28e0: 20 20 20 22 20 20 20 20 69 74 65 6d 73 3a 20 22 " items: "
28f0: 20 69 74 65 6d 73 20 22 20 69 74 65 6d 73 74 61 items " itemsta
2900: 62 6c 65 3a 20 22 20 69 74 65 6d 73 74 61 62 6c ble: " itemstabl
2910: 65 29 0a 09 09 09 09 09 09 20 28 69 74 65 6d 73 e)....... (items
2920: 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d :get-items-from-
2930: 63 6f 6e 66 69 67 20 63 6f 6e 66 69 67 29 29 0a config config)).
2940: 09 09 09 09 09 09 28 65 6c 73 65 20 23 66 29 29 ......(else #f))
2950: 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 )
2960: 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 6e ;; n
2970: 6f 74 20 69 74 65 72 61 74 65 64 0a 09 09 09 09 ot iterated.....
2980: 09 20 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b . #f ;;
2990: 20 69 74 65 6d 73 64 61 74 20 35 0a 09 09 09 09 itemsdat 5.....
29a0: 09 20 20 20 20 20 3b 3b 20 23 66 20 20 20 20 20 . ;; #f
29b0: 20 3b 3b 20 73 70 61 72 65 0a 09 09 09 09 09 20 ;; spare......
29c0: 20 20 20 20 29 29 29 0a 09 20 20 20 20 28 66 6f ))).. (fo
29d0: 72 2d 65 61 63 68 20 0a 09 20 20 20 20 20 28 6c r-each .. (l
29e0: 61 6d 62 64 61 20 28 77 61 69 74 6f 6e 29 0a 09 ambda (waiton)..
29f0: 20 20 20 20 20 20 20 28 69 66 20 28 61 6e 64 20 (if (and
2a00: 77 61 69 74 6f 6e 20 28 6e 6f 74 20 28 6d 65 6d waiton (not (mem
2a10: 62 65 72 20 77 61 69 74 6f 6e 20 74 65 73 74 2d ber waiton test-
2a20: 6e 61 6d 65 73 29 29 29 0a 09 09 20 20 20 28 62 names)))... (b
2a30: 65 67 69 6e 0a 09 09 20 20 20 20 20 28 73 65 74 egin... (set
2a40: 21 20 72 65 71 75 69 72 65 64 2d 74 65 73 74 73 ! required-tests
2a50: 20 28 63 6f 6e 73 20 77 61 69 74 6f 6e 20 72 65 (cons waiton re
2a60: 71 75 69 72 65 64 2d 74 65 73 74 73 29 29 0a 09 quired-tests))..
2a70: 09 20 20 20 20 20 28 73 65 74 21 20 74 65 73 74 . (set! test
2a80: 2d 6e 61 6d 65 73 20 28 63 6f 6e 73 20 77 61 69 -names (cons wai
2a90: 74 6f 6e 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 ton test-names))
2aa0: 29 29 29 20 3b 3b 20 77 61 73 20 61 6e 20 61 70 ))) ;; was an ap
2ab0: 70 65 6e 64 2c 20 6e 6f 77 20 61 20 63 6f 6e 73 pend, now a cons
2ac0: 0a 09 20 20 20 20 20 77 61 69 74 6f 6e 73 29 0a .. waitons).
2ad0: 09 20 20 20 20 28 6c 65 74 20 28 28 72 65 6d 74 . (let ((remt
2ae0: 65 73 74 73 20 28 64 65 6c 65 74 65 2d 64 75 70 ests (delete-dup
2af0: 6c 69 63 61 74 65 73 20 28 61 70 70 65 6e 64 20 licates (append
2b00: 77 61 69 74 6f 6e 73 20 74 61 6c 29 29 29 29 0a waitons tal)))).
2b10: 09 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 . (if (not
2b20: 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29 (null? remtests)
2b30: 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 )... (loop (car
2b40: 20 72 65 6d 74 65 73 74 73 29 28 63 64 72 20 72 remtests)(cdr r
2b50: 65 6d 74 65 73 74 73 29 29 29 29 29 29 29 0a 0a emtests)))))))..
2b60: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 (if (not (nu
2b70: 6c 6c 3f 20 72 65 71 75 69 72 65 64 2d 74 65 73 ll? required-tes
2b80: 74 73 29 29 0a 09 28 64 65 62 75 67 3a 70 72 69 ts))..(debug:pri
2b90: 6e 74 20 31 20 22 49 4e 46 4f 3a 20 41 64 64 69 nt 1 "INFO: Addi
2ba0: 6e 67 20 22 20 72 65 71 75 69 72 65 64 2d 74 65 ng " required-te
2bb0: 73 74 73 20 22 20 74 6f 20 74 68 65 20 72 75 6e sts " to the run
2bc0: 20 71 75 65 75 65 22 29 29 0a 20 20 20 20 3b 3b queue")). ;;
2bd0: 20 4e 4f 54 45 3a 20 74 68 65 73 65 20 61 72 65 NOTE: these are
2be0: 20 61 6c 6c 20 70 61 72 65 6e 74 20 74 65 73 74 all parent test
2bf0: 73 2c 20 69 74 65 6d 73 20 61 72 65 20 6e 6f 74 s, items are not
2c00: 20 65 78 70 61 6e 64 65 64 20 79 65 74 2e 0a 20 expanded yet..
2c10: 20 20 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 (runs:run-tes
2c20: 74 73 2d 71 75 65 75 65 20 64 62 20 72 75 6e 2d ts-queue db run-
2c30: 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d id runname test-
2c40: 72 65 63 6f 72 64 73 20 6b 65 79 76 61 6c 6c 73 records keyvalls
2c50: 74 20 66 6c 61 67 73 29 0a 20 20 20 20 28 64 65 t flags). (de
2c60: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 bug:print 4 "INF
2c70: 4f 3a 20 41 6c 6c 20 64 6f 6e 65 20 62 79 20 68 O: All done by h
2c80: 65 72 65 22 29 29 29 0a 0a 28 64 65 66 69 6e 65 ere")))..(define
2c90: 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 (runs:run-tests
2ca0: 2d 71 75 65 75 65 20 64 62 20 72 75 6e 2d 69 64 -queue db run-id
2cb0: 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d 72 65 runname test-re
2cc0: 63 6f 72 64 73 20 6b 65 79 76 61 6c 6c 73 74 20 cords keyvallst
2cd0: 66 6c 61 67 73 29 0a 20 20 20 20 3b 3b 20 41 74 flags). ;; At
2ce0: 20 74 68 69 73 20 70 6f 69 6e 74 20 74 68 65 20 this point the
2cf0: 6c 69 73 74 20 6f 66 20 70 61 72 65 6e 74 20 74 list of parent t
2d00: 65 73 74 73 20 69 73 20 65 78 70 61 6e 64 65 64 ests is expanded
2d10: 20 0a 20 20 20 20 3b 3b 20 4e 42 2f 2f 20 53 68 . ;; NB// Sh
2d20: 6f 75 6c 64 20 65 78 70 61 6e 64 20 69 74 65 6d ould expand item
2d30: 73 20 68 65 72 65 20 61 6e 64 20 74 68 65 6e 20 s here and then
2d40: 69 6e 73 65 72 74 20 69 6e 74 6f 20 74 68 65 20 insert into the
2d50: 72 75 6e 20 71 75 65 75 65 2e 0a 20 20 28 64 65 run queue.. (de
2d60: 62 75 67 3a 70 72 69 6e 74 20 35 20 22 74 65 73 bug:print 5 "tes
2d70: 74 2d 72 65 63 6f 72 64 73 3a 20 22 20 74 65 73 t-records: " tes
2d80: 74 2d 72 65 63 6f 72 64 73 20 22 2c 20 6b 65 79 t-records ", key
2d90: 76 61 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c vallst: " keyval
2da0: 6c 73 74 29 0a 20 20 28 6c 65 74 20 28 28 73 6f lst). (let ((so
2db0: 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 20 rted-test-names
2dc0: 28 74 65 73 74 73 3a 73 6f 72 74 2d 62 79 2d 70 (tests:sort-by-p
2dd0: 72 69 6f 72 69 74 79 2d 61 6e 64 2d 77 61 69 74 riority-and-wait
2de0: 6f 6e 20 74 65 73 74 2d 72 65 63 6f 72 64 73 29 on test-records)
2df0: 29 0a 09 28 69 74 65 6d 2d 70 61 74 74 73 20 20 )..(item-patts
2e00: 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c (hash-tabl
2e10: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c e-ref/default fl
2e20: 61 67 73 20 22 2d 69 74 65 6d 70 61 74 74 22 20 ags "-itempatt"
2e30: 23 66 29 29 29 0a 20 20 20 20 28 6c 65 74 20 6c #f))). (let l
2e40: 6f 6f 70 20 28 3b 20 28 6e 75 6d 74 69 6d 65 73 oop (; (numtimes
2e50: 20 30 29 20 3b 3b 20 73 68 6f 75 6c 64 6e 27 74 0) ;; shouldn't
2e60: 20 6e 65 65 64 20 74 68 69 73 0a 09 20 20 20 20 need this..
2e70: 20 20 20 28 68 65 64 20 20 20 20 20 20 20 20 20 (hed
2e80: 28 63 61 72 20 73 6f 72 74 65 64 2d 74 65 73 74 (car sorted-test
2e90: 2d 6e 61 6d 65 73 29 29 0a 09 20 20 20 20 20 20 -names))..
2ea0: 20 28 74 61 6c 20 20 20 20 20 20 20 20 20 28 63 (tal (c
2eb0: 64 72 20 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e dr sorted-test-n
2ec0: 61 6d 65 73 29 29 29 0a 20 20 20 20 20 20 28 6c ames))). (l
2ed0: 65 74 2a 20 28 28 74 65 73 74 2d 72 65 63 6f 72 et* ((test-recor
2ee0: 64 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 d (hash-table-re
2ef0: 66 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 68 f test-records h
2f00: 65 64 29 29 0a 09 20 20 20 20 20 28 74 63 6f 6e ed)).. (tcon
2f10: 66 69 67 20 20 20 20 20 28 74 65 73 74 73 3a 74 fig (tests:t
2f20: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 estqueue-get-tes
2f30: 74 63 6f 6e 66 69 67 20 74 65 73 74 2d 72 65 63 tconfig test-rec
2f40: 6f 72 64 29 29 0a 09 20 20 20 20 20 28 77 61 69 ord)).. (wai
2f50: 74 6f 6e 73 20 20 20 20 20 28 74 65 73 74 73 3a tons (tests:
2f60: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 77 61 testqueue-get-wa
2f70: 69 74 6f 6e 73 20 20 20 20 74 65 73 74 2d 72 65 itons test-re
2f80: 63 6f 72 64 29 29 0a 09 20 20 20 20 20 28 70 72 cord)).. (pr
2f90: 69 6f 72 69 74 79 20 20 20 20 28 74 65 73 74 73 iority (tests
2fa0: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 70 :testqueue-get-p
2fb0: 72 69 6f 72 69 74 79 20 20 20 74 65 73 74 2d 72 riority test-r
2fc0: 65 63 6f 72 64 29 29 0a 09 20 20 20 20 20 28 69 ecord)).. (i
2fd0: 74 65 6d 64 61 74 20 20 20 20 20 28 74 65 73 74 temdat (test
2fe0: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d s:testqueue-get-
2ff0: 69 74 65 6d 64 61 74 20 20 20 20 74 65 73 74 2d itemdat test-
3000: 72 65 63 6f 72 64 29 29 0a 09 20 20 20 20 20 28 record)).. (
3010: 69 74 65 6d 73 20 20 20 20 20 20 20 28 74 65 73 items (tes
3020: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 ts:testqueue-get
3030: 2d 69 74 65 6d 73 20 20 20 20 20 20 74 65 73 74 -items test
3040: 2d 72 65 63 6f 72 64 29 29 0a 09 20 20 20 20 20 -record))..
3050: 28 69 74 65 6d 2d 70 61 74 68 20 20 20 28 69 74 (item-path (it
3060: 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 em-list->path it
3070: 65 6d 64 61 74 29 29 29 0a 09 28 64 65 62 75 67 emdat)))..(debug
3080: 3a 70 72 69 6e 74 20 36 0a 09 09 20 20 20 20 20 :print 6...
3090: 22 69 74 65 6d 64 61 74 3a 20 20 20 20 20 22 20 "itemdat: "
30a0: 69 74 65 6d 64 61 74 0a 09 09 20 20 20 20 20 22 itemdat... "
30b0: 5c 6e 20 20 69 74 65 6d 73 3a 20 20 20 20 20 22 \n items: "
30c0: 20 69 74 65 6d 73 0a 09 09 20 20 20 20 20 22 5c items... "\
30d0: 6e 20 20 69 74 65 6d 2d 70 61 74 68 3a 20 22 20 n item-path: "
30e0: 69 74 65 6d 2d 70 61 74 68 29 0a 09 28 63 6f 6e item-path)..(con
30f0: 64 0a 09 20 28 28 6e 6f 74 20 69 74 65 6d 73 29 d.. ((not items)
3100: 20 3b 3b 20 77 68 65 6e 20 66 61 6c 73 65 20 74 ;; when false t
3110: 68 65 20 74 65 73 74 20 69 73 20 6f 6b 20 74 6f he test is ok to
3120: 20 62 65 20 68 61 6e 64 65 64 20 6f 66 66 20 74 be handed off t
3130: 6f 20 6c 61 75 6e 63 68 20 28 62 75 74 20 6e 6f o launch (but no
3140: 74 20 62 65 66 6f 72 65 29 0a 09 20 20 28 6c 65 t before).. (le
3150: 74 20 28 28 68 61 76 65 2d 72 65 73 6f 75 72 63 t ((have-resourc
3160: 65 73 20 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75 es (runs:can-ru
3170: 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 64 62 20 n-more-tests db
3180: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 20 3b 3b test-record)) ;;
3190: 20 6c 6f 6f 6b 20 61 74 20 74 68 65 20 74 65 73 look at the tes
31a0: 74 20 6a 6f 62 67 72 6f 75 70 20 61 6e 64 20 74 t jobgroup and t
31b0: 6f 74 20 6a 6f 62 73 20 72 75 6e 6e 69 6e 67 0a ot jobs running.
31c0: 09 09 28 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d ..(prereqs-not-m
31d0: 65 74 20 28 64 62 3a 67 65 74 2d 70 72 65 72 65 et (db:get-prere
31e0: 71 73 2d 6e 6f 74 2d 6d 65 74 20 64 62 20 72 75 qs-not-met db ru
31f0: 6e 2d 69 64 20 77 61 69 74 6f 6e 73 20 69 74 65 n-id waitons ite
3200: 6d 2d 70 61 74 68 29 29 29 0a 09 20 20 20 20 3b m-path))).. ;
3210: 3b 20 44 6f 6e 27 74 20 6b 6e 6f 77 20 61 74 20 ; Don't know at
3220: 74 68 69 73 20 74 69 6d 65 20 69 66 20 74 68 65 this time if the
3230: 20 74 65 73 74 20 68 61 76 65 20 62 65 65 6e 20 test have been
3240: 6c 61 75 6e 63 68 65 64 20 61 74 20 73 6f 6d 65 launched at some
3250: 20 74 69 6d 65 20 69 6e 20 74 68 65 20 70 61 73 time in the pas
3260: 74 0a 09 20 20 20 20 3b 3b 20 69 2e 65 2e 20 69 t.. ;; i.e. i
3270: 73 20 74 68 69 73 20 61 20 72 65 2d 6c 61 75 6e s this a re-laun
3280: 63 68 3f 0a 09 20 20 20 20 28 69 66 20 28 61 6e ch?.. (if (an
3290: 64 20 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 d have-resources
32a0: 0a 09 09 20 20 20 20 20 28 6e 75 6c 6c 3f 20 70 ... (null? p
32b0: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 rereqs-not-met))
32c0: 0a 09 09 3b 3b 20 6e 6f 20 6c 6f 6f 70 20 2d 20 ...;; no loop -
32d0: 64 72 6f 70 20 74 68 6f 75 67 68 20 61 6e 64 20 drop though and
32e0: 75 73 65 20 74 68 65 20 6c 6f 6f 70 20 61 74 20 use the loop at
32f0: 74 68 65 20 62 6f 74 74 6f 6d 20 0a 09 09 28 72 the bottom ...(r
3300: 75 6e 3a 74 65 73 74 20 64 62 20 72 75 6e 2d 69 un:test db run-i
3310: 64 20 72 75 6e 6e 61 6d 65 20 6b 65 79 76 61 6c d runname keyval
3320: 6c 73 74 20 74 65 73 74 2d 72 65 63 6f 72 64 20 lst test-record
3330: 66 6c 61 67 73 20 23 66 29 0a 09 09 3b 3b 20 65 flags #f)...;; e
3340: 6c 73 65 20 74 68 65 20 72 75 6e 20 69 73 20 73 lse the run is s
3350: 74 75 63 6b 2c 20 74 65 6d 70 6f 72 61 72 69 6c tuck, temporaril
3360: 79 20 6f 72 20 70 65 72 6d 61 6e 65 6e 74 6c 79 y or permanently
3370: 0a 09 09 28 6c 65 74 20 28 28 6e 65 77 74 61 6c ...(let ((newtal
3380: 20 28 61 70 70 65 6e 64 20 74 61 6c 20 28 6c 69 (append tal (li
3390: 73 74 20 68 65 64 29 29 29 29 0a 09 09 20 20 3b st hed))))... ;
33a0: 3b 20 63 6f 75 6c 64 6e 27 74 20 72 75 6e 2c 20 ; couldn't run,
33b0: 74 61 6b 65 20 61 20 62 72 65 61 74 68 65 72 0a take a breather.
33c0: 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 .. (thread-slee
33d0: 70 21 20 34 29 0a 09 09 20 20 28 6c 6f 6f 70 20 p! 4)... (loop
33e0: 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 (car newtal)(cdr
33f0: 20 6e 65 77 74 61 6c 29 29 29 29 29 29 0a 09 20 newtal))))))..
3400: 0a 09 20 3b 3b 20 63 61 73 65 20 77 68 65 72 65 .. ;; case where
3410: 20 61 6e 20 69 74 65 6d 73 20 63 61 6d 65 20 69 an items came i
3420: 6e 20 61 73 20 61 20 6c 69 73 74 20 62 65 65 6e n as a list been
3430: 20 70 72 6f 63 65 73 73 65 64 0a 09 20 28 28 61 processed.. ((a
3440: 6e 64 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 nd (list? items)
3450: 20 20 20 20 20 3b 3b 20 74 68 75 73 20 77 65 20 ;; thus we
3460: 6b 6e 6f 77 20 6f 75 72 20 69 74 65 6d 73 20 61 know our items a
3470: 72 65 20 61 6c 72 65 61 64 79 20 63 61 6c 63 75 re already calcu
3480: 6c 61 74 65 64 0a 09 20 20 20 20 20 20 20 28 6e lated.. (n
3490: 6f 74 20 20 20 69 74 65 6d 64 61 74 29 29 20 3b ot itemdat)) ;
34a0: 3b 20 61 6e 64 20 6e 6f 74 20 79 65 74 20 65 78 ; and not yet ex
34b0: 70 61 6e 64 65 64 20 69 6e 74 6f 20 74 68 65 20 panded into the
34c0: 6c 69 73 74 20 6f 66 20 74 68 69 6e 67 73 20 74 list of things t
34d0: 6f 20 62 65 20 64 6f 6e 65 0a 09 20 20 28 69 66 o be done.. (if
34e0: 20 28 3e 3d 20 2a 76 65 72 62 6f 73 69 74 79 2a (>= *verbosity*
34f0: 20 31 29 28 70 70 20 69 74 65 6d 73 29 29 0a 09 1)(pp items))..
3500: 20 20 3b 3b 20 28 69 66 20 28 3e 3d 20 2a 76 65 ;; (if (>= *ve
3510: 72 62 6f 73 69 74 79 2a 20 35 29 0a 09 20 20 3b rbosity* 5).. ;
3520: 3b 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 ; (begin..
3530: 3b 3b 20 20 20 20 20 20 20 28 70 72 69 6e 74 20 ;; (print
3540: 22 69 74 65 6d 73 3a 20 22 29 20 20 20 20 20 28 "items: ") (
3550: 70 70 20 28 69 74 65 6d 2d 61 73 73 6f 63 2d 3e pp (item-assoc->
3560: 69 74 65 6d 2d 6c 69 73 74 20 69 74 65 6d 73 29 item-list items)
3570: 29 0a 09 20 20 3b 3b 20 20 20 20 20 20 20 28 70 ).. ;; (p
3580: 72 69 6e 74 20 22 69 74 65 6d 73 74 61 62 6c 65 rint "itemstable
3590: 3a 20 22 29 28 70 70 20 28 69 74 65 6d 2d 74 61 : ")(pp (item-ta
35a0: 62 6c 65 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 69 ble->item-list i
35b0: 74 65 6d 73 74 61 62 6c 65 29 29 29 29 0a 09 20 temstable))))..
35c0: 20 28 66 6f 72 2d 65 61 63 68 0a 09 20 20 20 28 (for-each.. (
35d0: 6c 61 6d 62 64 61 20 28 6d 79 2d 69 74 65 6d 64 lambda (my-itemd
35e0: 61 74 29 0a 09 20 20 20 20 20 28 6c 65 74 2a 20 at).. (let*
35f0: 28 28 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 ((new-test-recor
3600: 64 20 28 6c 65 74 20 28 28 6e 65 77 72 65 63 20 d (let ((newrec
3610: 28 6d 61 6b 65 2d 74 65 73 74 73 3a 74 65 73 74 (make-tests:test
3620: 71 75 65 75 65 29 29 29 0a 09 09 09 09 20 20 20 queue))).....
3630: 20 20 20 20 28 76 65 63 74 6f 72 2d 63 6f 70 79 (vector-copy
3640: 21 20 74 65 73 74 2d 72 65 63 6f 72 64 20 6e 65 ! test-record ne
3650: 77 72 65 63 29 0a 09 09 09 09 20 20 20 20 20 20 wrec).....
3660: 20 6e 65 77 72 65 63 29 29 0a 09 09 20 20 20 20 newrec))...
3670: 28 6d 79 2d 69 74 65 6d 2d 70 61 74 68 20 28 69 (my-item-path (i
3680: 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 6d tem-list->path m
3690: 79 2d 69 74 65 6d 64 61 74 29 29 0a 09 09 20 20 y-itemdat))...
36a0: 20 20 28 69 74 65 6d 2d 6d 61 74 63 68 65 73 20 (item-matches
36b0: 28 69 66 20 69 74 65 6d 2d 70 61 74 74 73 20 20 (if item-patts
36c0: 20 20 20 20 20 3b 3b 20 68 65 72 65 20 77 65 20 ;; here we
36d0: 61 72 65 20 66 69 6c 74 65 72 69 6e 67 20 66 6f are filtering fo
36e0: 72 20 6d 61 74 63 68 65 73 20 77 69 74 68 20 2d r matches with -
36f0: 69 74 65 6d 70 61 74 74 0a 09 09 09 09 20 20 20 itempatt.....
3700: 20 20 20 28 6c 65 74 20 28 28 72 65 73 20 23 66 (let ((res #f
3710: 29 29 09 20 3b 3b 20 6c 6f 6f 6b 20 74 68 72 6f )). ;; look thro
3720: 75 67 68 20 61 6c 6c 20 74 68 65 20 69 74 65 6d ugh all the item
3730: 2d 70 61 74 74 73 20 69 66 20 64 65 66 69 6e 65 -patts if define
3740: 64 2c 20 66 6f 72 6d 61 74 20 69 73 20 70 61 74 d, format is pat
3750: 74 31 2c 70 61 74 74 32 2c 70 61 74 74 33 20 2e t1,patt2,patt3 .
3760: 2e 2e 20 77 69 6c 64 63 61 72 64 20 69 73 20 25 .. wildcard is %
3770: 0a 09 09 09 09 09 28 66 6f 72 2d 65 61 63 68 20 ......(for-each
3780: 0a 09 09 09 09 09 20 28 6c 61 6d 62 64 61 20 28 ...... (lambda (
3790: 70 61 74 74 29 0a 09 09 09 09 09 20 20 20 28 69 patt)...... (i
37a0: 66 20 28 73 74 72 69 6e 67 2d 73 65 61 72 63 68 f (string-search
37b0: 20 28 67 6c 6f 62 2d 3e 72 65 67 65 78 70 0a 09 (glob->regexp..
37c0: 09 09 09 09 09 09 20 20 20 20 20 20 20 28 73 74 ...... (st
37d0: 72 69 6e 67 2d 74 72 61 6e 73 6c 61 74 65 20 70 ring-translate p
37e0: 61 74 74 20 22 25 22 20 22 2a 22 29 29 0a 09 09 att "%" "*"))...
37f0: 09 09 09 09 09 20 20 20 20 20 20 69 74 65 6d 2d ..... item-
3800: 70 61 74 68 29 0a 09 09 09 09 09 20 20 20 20 20 path)......
3810: 20 20 28 73 65 74 21 20 72 65 73 20 23 74 29 29 (set! res #t))
3820: 29 0a 09 09 09 09 09 20 28 73 74 72 69 6e 67 2d )...... (string-
3830: 73 70 6c 69 74 20 69 74 65 6d 2d 70 61 74 74 73 split item-patts
3840: 20 22 2c 22 29 29 0a 09 09 09 09 09 72 65 73 29 ","))......res)
3850: 0a 09 09 09 09 20 20 20 20 20 20 23 74 29 29 29 ..... #t)))
3860: 0a 09 20 20 20 20 20 20 20 28 69 66 20 69 74 65 .. (if ite
3870: 6d 2d 6d 61 74 63 68 65 73 20 3b 3b 20 79 65 73 m-matches ;; yes
3880: 2c 20 77 65 20 77 61 6e 74 20 74 6f 20 70 72 6f , we want to pro
3890: 63 65 73 73 20 74 68 69 73 20 69 74 65 6d 0a 09 cess this item..
38a0: 09 20 20 20 28 6c 65 74 20 28 28 6e 65 77 74 65 . (let ((newte
38b0: 73 74 6e 61 6d 65 20 28 63 6f 6e 63 20 68 65 64 stname (conc hed
38c0: 20 22 2f 22 20 6d 79 2d 69 74 65 6d 2d 70 61 74 "/" my-item-pat
38d0: 68 29 29 29 20 0a 09 09 20 20 20 20 20 28 74 65 h))) ... (te
38e0: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65 sts:testqueue-se
38f0: 74 2d 69 74 65 6d 73 21 20 20 20 6e 65 77 2d 74 t-items! new-t
3900: 65 73 74 2d 72 65 63 6f 72 64 20 23 66 29 0a 09 est-record #f)..
3910: 09 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 . (tests:tes
3920: 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 64 tqueue-set-itemd
3930: 61 74 21 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 at! new-test-rec
3940: 6f 72 64 20 6d 79 2d 69 74 65 6d 64 61 74 29 0a ord my-itemdat).
3950: 09 09 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 .. (hash-tab
3960: 6c 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 63 le-set! test-rec
3970: 6f 72 64 73 20 6e 65 77 74 65 73 74 6e 61 6d 65 ords newtestname
3980: 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 new-test-record
3990: 29 0a 09 09 20 20 20 20 20 28 73 65 74 21 20 74 )... (set! t
39a0: 61 6c 20 28 63 6f 6e 73 20 6e 65 77 74 65 73 74 al (cons newtest
39b0: 6e 61 6d 65 20 74 61 6c 29 29 29 29 29 29 20 3b name tal)))))) ;
39c0: 3b 20 73 69 6e 63 65 20 74 68 65 73 65 20 61 72 ; since these ar
39d0: 65 20 69 74 65 6d 69 7a 65 64 20 63 72 65 61 74 e itemized creat
39e0: 65 20 6e 65 77 20 74 65 73 74 20 6e 61 6d 65 73 e new test names
39f0: 20 74 65 73 74 6e 61 6d 65 2f 69 74 65 6d 70 61 testname/itempa
3a00: 74 68 0a 09 20 20 20 69 74 65 6d 73 29 0a 09 20 th.. items)..
3a10: 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 (loop (car tal)
3a20: 28 63 64 72 20 74 61 6c 29 29 29 0a 0a 09 20 3b (cdr tal)))... ;
3a30: 3b 20 69 66 20 69 74 65 6d 73 20 69 73 20 61 20 ; if items is a
3a40: 70 72 6f 63 20 74 68 65 6e 20 6e 65 65 64 20 74 proc then need t
3a50: 6f 20 72 75 6e 20 69 74 65 6d 73 3a 67 65 74 2d o run items:get-
3a60: 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 items-from-confi
3a70: 67 2c 20 67 65 74 20 74 68 65 20 6c 69 73 74 20 g, get the list
3a80: 61 6e 64 20 6c 6f 6f 70 20 0a 09 20 3b 3b 20 20 and loop .. ;;
3a90: 20 20 2d 20 62 75 74 20 6f 6e 6c 79 20 64 6f 20 - but only do
3aa0: 74 68 61 74 20 69 66 20 72 65 73 6f 75 72 63 65 that if resource
3ab0: 73 20 65 78 69 73 74 20 74 6f 20 6b 69 63 6b 20 s exist to kick
3ac0: 6f 66 66 20 74 68 65 20 6a 6f 62 0a 09 20 28 28 off the job.. ((
3ad0: 6f 72 20 28 70 72 6f 63 65 64 75 72 65 3f 20 69 or (procedure? i
3ae0: 74 65 6d 73 29 28 65 71 3f 20 69 74 65 6d 73 20 tems)(eq? items
3af0: 27 68 61 76 65 2d 70 72 6f 63 65 64 75 72 65 29 'have-procedure)
3b00: 29 0a 09 20 20 28 69 66 20 28 61 6e 64 20 28 72 ).. (if (and (r
3b10: 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 uns:can-run-more
3b20: 2d 74 65 73 74 73 20 64 62 20 74 65 73 74 2d 72 -tests db test-r
3b30: 65 63 6f 72 64 29 0a 09 09 20 20 20 28 6e 75 6c ecord)... (nul
3b40: 6c 3f 20 28 64 62 3a 67 65 74 2d 70 72 65 72 65 l? (db:get-prere
3b50: 71 73 2d 6e 6f 74 2d 6d 65 74 20 64 62 20 72 75 qs-not-met db ru
3b60: 6e 2d 69 64 20 77 61 69 74 6f 6e 73 20 69 74 65 n-id waitons ite
3b70: 6d 2d 70 61 74 68 29 29 29 0a 09 20 20 20 20 20 m-path)))..
3b80: 20 28 6c 65 74 20 28 28 74 65 73 74 2d 6e 61 6d (let ((test-nam
3b90: 65 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 e (tests:testque
3ba0: 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 ue-get-testname
3bb0: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 29 0a 09 test-record)))..
3bc0: 09 28 73 65 74 65 6e 76 20 22 4d 54 5f 54 45 53 .(setenv "MT_TES
3bd0: 54 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d T_NAME" test-nam
3be0: 65 29 20 3b 3b 20 0a 09 09 28 73 65 74 65 6e 76 e) ;; ...(setenv
3bf0: 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20 "MT_RUNNAME"
3c00: 72 75 6e 6e 61 6d 65 29 0a 09 09 28 73 65 74 2d runname)...(set-
3c10: 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 megatest-env-var
3c20: 73 20 64 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20 s db run-id) ;;
3c30: 74 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65 these may be nee
3c40: 64 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63 ded by the launc
3c50: 68 69 6e 67 20 70 72 6f 63 65 73 73 0a 09 09 28 hing process...(
3c60: 6c 65 74 20 28 28 69 74 65 6d 73 2d 6c 69 73 74 let ((items-list
3c70: 20 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d (items:get-item
3c80: 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 74 63 s-from-config tc
3c90: 6f 6e 66 69 67 29 29 29 0a 09 09 20 20 28 69 66 onfig)))... (if
3ca0: 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 2d 6c 69 (list? items-li
3cb0: 73 74 29 0a 09 09 20 20 20 20 20 20 28 62 65 67 st)... (beg
3cc0: 69 6e 0a 09 09 09 28 74 65 73 74 73 3a 74 65 73 in....(tests:tes
3cd0: 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 73 tqueue-set-items
3ce0: 21 20 74 65 73 74 2d 72 65 63 6f 72 64 20 69 74 ! test-record it
3cf0: 65 6d 73 2d 6c 69 73 74 29 0a 09 09 09 28 6c 6f ems-list)....(lo
3d00: 6f 70 20 68 65 64 20 74 61 6c 29 29 0a 09 09 20 op hed tal))...
3d10: 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09 28 (begin....(
3d20: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 debug:print 0 "E
3d30: 52 52 4f 52 3a 20 54 68 65 20 70 72 6f 63 20 66 RROR: The proc f
3d40: 72 6f 6d 20 72 65 61 64 69 6e 67 20 74 68 65 20 rom reading the
3d50: 73 65 74 75 70 20 64 69 64 20 6e 6f 74 20 79 69 setup did not yi
3d60: 65 6c 64 20 61 20 6c 69 73 74 20 2d 20 70 6c 65 eld a list - ple
3d70: 61 73 65 20 72 65 70 6f 72 74 20 74 68 69 73 22 ase report this"
3d80: 29 0a 09 09 09 28 65 78 69 74 20 31 29 29 29 29 )....(exit 1))))
3d90: 29 0a 09 20 20 20 20 20 20 28 6c 65 74 20 28 28 ).. (let ((
3da0: 6e 65 77 74 61 6c 20 28 61 70 70 65 6e 64 20 74 newtal (append t
3db0: 61 6c 20 28 6c 69 73 74 20 68 65 64 29 29 29 29 al (list hed))))
3dc0: 0a 09 09 3b 3b 20 69 66 20 63 61 6e 27 74 20 72 ...;; if can't r
3dd0: 75 6e 20 6d 6f 72 65 20 74 65 73 74 73 2c 20 6c un more tests, l
3de0: 65 74 73 20 74 61 6b 65 20 61 20 62 72 65 61 74 ets take a breat
3df0: 68 65 72 0a 09 09 28 74 68 72 65 61 64 2d 73 6c her...(thread-sl
3e00: 65 65 70 21 20 31 29 0a 09 09 28 6c 6f 6f 70 20 eep! 1)...(loop
3e10: 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 (car newtal)(cdr
3e20: 20 6e 65 77 74 61 6c 29 29 29 29 29 0a 0a 09 20 newtal)))))...
3e30: 3b 3b 20 74 68 69 73 20 63 61 73 65 20 73 68 6f ;; this case sho
3e40: 75 6c 64 20 6e 6f 74 20 68 61 70 70 65 6e 2c 20 uld not happen,
3e50: 61 64 64 65 64 20 74 6f 20 68 65 6c 70 20 63 61 added to help ca
3e60: 74 63 68 20 61 6e 79 20 62 75 67 73 0a 09 20 28 tch any bugs.. (
3e70: 28 61 6e 64 20 28 6c 69 73 74 3f 20 69 74 65 6d (and (list? item
3e80: 73 29 20 69 74 65 6d 64 61 74 29 0a 09 20 20 28 s) itemdat).. (
3e90: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 debug:print 0 "E
3ea0: 52 52 4f 52 3a 20 53 68 6f 75 6c 64 20 6e 6f 74 RROR: Should not
3eb0: 20 68 61 76 65 20 61 20 6c 69 73 74 20 6f 66 20 have a list of
3ec0: 69 74 65 6d 73 20 69 6e 20 61 20 74 65 73 74 20 items in a test
3ed0: 61 6e 64 20 74 68 65 20 69 74 65 6d 73 70 61 74 and the itemspat
3ee0: 68 20 73 65 74 20 2d 20 70 6c 65 61 73 65 20 72 h set - please r
3ef0: 65 70 6f 72 74 20 74 68 69 73 22 29 0a 09 20 20 eport this")..
3f00: 28 65 78 69 74 20 31 29 29 29 29 0a 09 0a 20 20 (exit 1))))...
3f10: 20 20 20 20 3b 3b 20 77 65 20 67 65 74 20 68 65 ;; we get he
3f20: 72 65 20 6f 6e 20 22 64 72 6f 70 20 74 68 72 6f re on "drop thro
3f30: 75 67 68 22 20 2d 20 6c 6f 6f 70 20 66 6f 72 20 ugh" - loop for
3f40: 6e 65 78 74 20 74 65 73 74 20 69 6e 20 71 75 65 next test in que
3f50: 75 65 0a 20 20 20 20 20 20 28 69 66 20 28 6e 75 ue. (if (nu
3f60: 6c 6c 3f 20 74 61 6c 29 0a 09 20 20 28 62 65 67 ll? tal).. (beg
3f70: 69 6e 0a 09 20 20 20 20 3b 3b 20 46 49 58 4d 45 in.. ;; FIXME
3f80: 21 21 21 21 20 54 48 49 53 20 53 48 4f 55 4c 44 !!!! THIS SHOULD
3f90: 20 4e 4f 54 20 52 45 51 55 49 52 45 20 41 4e 20 NOT REQUIRE AN
3fa0: 45 58 49 54 21 21 21 21 21 21 21 0a 09 20 20 20 EXIT!!!!!!!..
3fb0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 (debug:print 1
3fc0: 22 49 4e 46 4f 3a 20 41 6c 6c 20 74 65 73 74 73 "INFO: All tests
3fd0: 20 6c 61 75 6e 63 68 65 64 2c 20 65 78 69 74 69 launched, exiti
3fe0: 6e 67 22 29 0a 09 20 20 20 20 28 65 78 69 74 20 ng").. (exit
3ff0: 30 29 29 0a 09 20 20 28 6c 6f 6f 70 20 28 63 61 0)).. (loop (ca
4000: 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 29 r tal)(cdr tal))
4010: 29 29 29 29 0a 0a 3b 3b 20 70 61 72 65 6e 74 2d ))))..;; parent-
4020: 74 65 73 74 20 69 73 20 74 68 65 72 65 20 61 73 test is there as
4030: 20 61 20 70 6c 61 63 65 68 6f 6c 64 65 72 20 66 a placeholder f
4040: 6f 72 20 77 68 65 6e 20 70 61 72 65 6e 74 2d 74 or when parent-t
4050: 65 73 74 73 20 63 61 6e 20 62 65 20 72 75 6e 20 ests can be run
4060: 61 73 20 61 20 73 65 74 75 70 20 73 74 65 70 0a as a setup step.
4070: 28 64 65 66 69 6e 65 20 28 72 75 6e 3a 74 65 73 (define (run:tes
4080: 74 20 64 62 20 72 75 6e 2d 69 64 20 72 75 6e 6e t db run-id runn
4090: 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 ame keyvallst te
40a0: 73 74 2d 72 65 63 6f 72 64 20 66 6c 61 67 73 20 st-record flags
40b0: 70 61 72 65 6e 74 2d 74 65 73 74 29 0a 20 20 3b parent-test). ;
40c0: 3b 20 41 6c 6c 20 74 68 65 73 65 20 76 61 72 73 ; All these vars
40d0: 20 6d 69 67 68 74 20 62 65 20 72 65 66 65 72 65 might be refere
40e0: 6e 63 65 64 20 62 79 20 74 68 65 20 74 65 73 74 nced by the test
40f0: 63 6f 6e 66 69 67 20 66 69 6c 65 20 72 65 61 64 config file read
4100: 65 72 0a 20 20 28 6c 65 74 2a 20 28 28 74 65 73 er. (let* ((tes
4110: 74 2d 6e 61 6d 65 20 20 20 20 28 74 65 73 74 73 t-name (tests
4120: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 :testqueue-get-t
4130: 65 73 74 6e 61 6d 65 20 20 20 74 65 73 74 2d 72 estname test-r
4140: 65 63 6f 72 64 29 29 0a 09 20 28 74 65 73 74 2d ecord)).. (test-
4150: 77 61 69 74 6f 6e 73 20 28 74 65 73 74 73 3a 74 waitons (tests:t
4160: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 77 61 69 estqueue-get-wai
4170: 74 6f 6e 73 20 20 20 20 74 65 73 74 2d 72 65 63 tons test-rec
4180: 6f 72 64 29 29 0a 09 20 28 74 65 73 74 2d 63 6f ord)).. (test-co
4190: 6e 66 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 nf (tests:tes
41a0: 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 63 tqueue-get-testc
41b0: 6f 6e 66 69 67 20 74 65 73 74 2d 72 65 63 6f 72 onfig test-recor
41c0: 64 29 29 0a 09 20 28 69 74 65 6d 64 61 74 20 20 d)).. (itemdat
41d0: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 (tests:testq
41e0: 75 65 75 65 2d 67 65 74 2d 69 74 65 6d 64 61 74 ueue-get-itemdat
41f0: 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 test-record)
4200: 29 0a 09 20 28 74 65 73 74 2d 70 61 74 68 20 20 ).. (test-path
4210: 20 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 (conc *toppath
4220: 2a 20 22 2f 74 65 73 74 73 2f 22 20 74 65 73 74 * "/tests/" test
4230: 2d 6e 61 6d 65 29 29 20 3b 3b 20 63 6f 75 6c 64 -name)) ;; could
4240: 20 75 73 65 20 74 65 73 74 3a 67 65 74 2d 74 65 use test:get-te
4250: 73 74 63 6f 6e 66 69 67 20 68 65 72 65 20 2e 2e stconfig here ..
4260: 2e 0a 09 20 28 66 6f 72 63 65 20 20 20 20 20 20 ... (force
4270: 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 (hash-table-re
4280: 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 f/default flags
4290: 22 2d 66 6f 72 63 65 22 20 23 66 29 29 0a 09 20 "-force" #f))..
42a0: 28 72 65 72 75 6e 20 20 20 20 20 20 20 20 28 68 (rerun (h
42b0: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 ash-table-ref/de
42c0: 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 72 65 fault flags "-re
42d0: 72 75 6e 22 20 23 66 29 29 0a 09 20 28 6b 65 65 run" #f)).. (kee
42e0: 70 67 6f 69 6e 67 20 20 20 20 28 68 61 73 68 2d pgoing (hash-
42f0: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c table-ref/defaul
4300: 74 20 66 6c 61 67 73 20 22 2d 6b 65 65 70 67 6f t flags "-keepgo
4310: 69 6e 67 22 20 23 66 29 29 0a 09 20 28 69 74 65 ing" #f)).. (ite
4320: 6d 2d 70 61 74 68 20 20 20 20 20 22 22 29 29 0a m-path "")).
4330: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
4340: 20 35 0a 09 09 20 22 74 65 73 74 2d 63 6f 6e 66 5... "test-conf
4350: 69 67 3a 20 22 20 28 68 61 73 68 2d 74 61 62 6c ig: " (hash-tabl
4360: 65 2d 3e 61 6c 69 73 74 20 74 65 73 74 2d 63 6f e->alist test-co
4370: 6e 66 29 0a 09 09 20 22 5c 6e 20 20 20 69 74 65 nf)... "\n ite
4380: 6d 64 61 74 3a 20 22 20 69 74 65 6d 64 61 74 0a mdat: " itemdat.
4390: 09 09 20 29 0a 20 20 20 20 3b 3b 20 73 65 74 74 .. ). ;; sett
43a0: 69 6e 67 20 69 74 65 6d 64 61 74 20 74 6f 20 61 ing itemdat to a
43b0: 20 6c 69 73 74 20 69 66 20 69 74 20 69 73 20 23 list if it is #
43c0: 66 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 69 f. (if (not i
43d0: 74 65 6d 64 61 74 29 28 73 65 74 21 20 69 74 65 temdat)(set! ite
43e0: 6d 64 61 74 20 27 28 29 29 29 0a 20 20 20 20 28 mdat '())). (
43f0: 73 65 74 21 20 69 74 65 6d 2d 70 61 74 68 20 28 set! item-path (
4400: 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 item-list->path
4410: 69 74 65 6d 64 61 74 29 29 0a 20 20 20 20 28 64 itemdat)). (d
4420: 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 41 74 ebug:print 2 "At
4430: 74 65 6d 70 74 69 6e 67 20 74 6f 20 6c 61 75 6e tempting to laun
4440: 63 68 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e ch test " test-n
4450: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 ame "/" item-pat
4460: 68 29 0a 20 20 20 20 28 73 65 74 65 6e 76 20 22 h). (setenv "
4470: 4d 54 5f 54 45 53 54 5f 4e 41 4d 45 22 20 74 65 MT_TEST_NAME" te
4480: 73 74 2d 6e 61 6d 65 29 20 3b 3b 20 0a 20 20 20 st-name) ;; .
4490: 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e (setenv "MT_RUN
44a0: 4e 41 4d 45 22 20 20 20 72 75 6e 6e 61 6d 65 29 NAME" runname)
44b0: 0a 20 20 20 20 28 73 65 74 2d 6d 65 67 61 74 65 . (set-megate
44c0: 73 74 2d 65 6e 76 2d 76 61 72 73 20 64 62 20 72 st-env-vars db r
44d0: 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73 65 20 un-id) ;; these
44e0: 6d 61 79 20 62 65 20 6e 65 65 64 65 64 20 62 79 may be needed by
44f0: 20 74 68 65 20 6c 61 75 6e 63 68 69 6e 67 20 70 the launching p
4500: 72 6f 63 65 73 73 0a 20 20 20 20 28 63 68 61 6e rocess. (chan
4510: 67 65 2d 64 69 72 65 63 74 6f 72 79 20 2a 74 6f ge-directory *to
4520: 70 70 61 74 68 2a 29 0a 0a 20 20 20 20 3b 3b 20 ppath*).. ;;
4530: 48 65 72 65 20 69 73 20 77 68 65 72 65 20 74 68 Here is where th
4540: 65 20 74 65 73 74 5f 6d 65 74 61 20 74 61 62 6c e test_meta tabl
4550: 65 20 69 73 20 62 65 73 74 20 75 70 64 61 74 65 e is best update
4560: 64 0a 20 20 20 20 28 72 75 6e 73 3a 75 70 64 61 d. (runs:upda
4570: 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20 te-test_meta db
4580: 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 test-name test-c
4590: 6f 6e 66 29 0a 20 20 20 20 0a 20 20 20 20 3b 3b onf). . ;;
45a0: 20 28 6c 61 6d 62 64 61 20 28 69 74 65 6d 64 61 (lambda (itemda
45b0: 74 29 20 3b 3b 3b 20 28 28 72 69 70 65 6e 65 73 t) ;;; ((ripenes
45c0: 73 20 22 6f 76 65 72 72 69 70 65 22 29 20 28 74 s "overripe") (t
45d0: 65 6d 70 65 72 61 74 75 72 65 20 22 63 6f 6f 6c emperature "cool
45e0: 22 29 20 28 73 65 61 73 6f 6e 20 22 73 75 6d 6d ") (season "summ
45f0: 65 72 22 29 29 0a 20 20 20 20 28 6c 65 74 2a 20 er")). (let*
4600: 28 28 6e 65 77 2d 74 65 73 74 2d 70 61 74 68 20 ((new-test-path
4610: 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 (string-interspe
4620: 72 73 65 20 28 63 6f 6e 73 20 74 65 73 74 2d 70 rse (cons test-p
4630: 61 74 68 20 28 6d 61 70 20 63 61 64 72 20 69 74 ath (map cadr it
4640: 65 6d 64 61 74 29 29 20 22 2f 22 29 29 0a 09 20 emdat)) "/"))..
4650: 20 20 28 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 (new-test-name
4660: 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65 (if (equal? ite
4670: 6d 2d 70 61 74 68 20 22 22 29 20 74 65 73 74 2d m-path "") test-
4680: 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 2d name (conc test-
4690: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 name "/" item-pa
46a0: 74 68 29 29 29 20 3b 3b 20 6a 75 73 74 20 6e 65 th))) ;; just ne
46b0: 65 64 20 69 74 20 74 6f 20 62 65 20 75 6e 69 71 ed it to be uniq
46c0: 75 65 0a 09 20 20 20 28 74 65 73 74 64 61 74 20 ue.. (testdat
46d0: 20 20 20 20 20 20 28 72 64 62 3a 67 65 74 2d 74 (rdb:get-t
46e0: 65 73 74 2d 69 6e 66 6f 20 64 62 20 72 75 6e 2d est-info db run-
46f0: 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 id test-name ite
4700: 6d 2d 70 61 74 68 29 29 29 0a 20 20 20 20 20 20 m-path))).
4710: 28 69 66 20 28 6e 6f 74 20 74 65 73 74 64 61 74 (if (not testdat
4720: 29 0a 09 20 20 28 62 65 67 69 6e 0a 09 20 20 20 ).. (begin..
4730: 20 3b 3b 20 65 6e 73 75 72 65 20 74 68 61 74 20 ;; ensure that
4740: 74 68 65 20 70 61 74 68 20 65 78 69 73 74 73 20 the path exists
4750: 62 65 66 6f 72 65 20 72 65 67 69 73 74 65 72 69 before registeri
4760: 6e 67 20 74 68 65 20 74 65 73 74 0a 09 20 20 20 ng the test..
4770: 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 (system (conc "
4780: 6d 6b 64 69 72 20 2d 70 20 22 20 6e 65 77 2d 74 mkdir -p " new-t
4790: 65 73 74 2d 70 61 74 68 29 29 0a 09 20 20 20 20 est-path))..
47a0: 28 72 74 65 73 74 73 3a 72 65 67 69 73 74 65 72 (rtests:register
47b0: 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 -test db run-id
47c0: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 test-name item-p
47d0: 61 74 68 29 0a 09 20 20 20 20 28 73 65 74 21 20 ath).. (set!
47e0: 74 65 73 74 64 61 74 20 28 72 64 62 3a 67 65 74 testdat (rdb:get
47f0: 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 20 72 75 -test-info db ru
4800: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 n-id test-name i
4810: 74 65 6d 2d 70 61 74 68 29 29 29 29 0a 20 20 20 tem-path)))).
4820: 20 20 20 28 63 68 61 6e 67 65 2d 64 69 72 65 63 (change-direc
4830: 74 6f 72 79 20 74 65 73 74 2d 70 61 74 68 29 0a tory test-path).
4840: 20 20 20 20 20 20 28 63 61 73 65 20 28 69 66 20 (case (if
4850: 66 6f 72 63 65 20 3b 3b 20 28 61 72 67 73 3a 67 force ;; (args:g
4860: 65 74 2d 61 72 67 20 22 2d 66 6f 72 63 65 22 29 et-arg "-force")
4870: 0a 09 09 27 4e 4f 54 5f 53 54 41 52 54 45 44 0a ...'NOT_STARTED.
4880: 09 09 28 69 66 20 74 65 73 74 64 61 74 0a 09 09 ..(if testdat...
4890: 20 20 20 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d (string->sym
48a0: 62 6f 6c 20 28 74 65 73 74 3a 67 65 74 2d 73 74 bol (test:get-st
48b0: 61 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 09 ate testdat))...
48c0: 20 20 20 20 27 66 61 69 6c 65 64 2d 74 6f 2d 69 'failed-to-i
48d0: 6e 73 65 72 74 29 29 0a 09 28 28 66 61 69 6c 65 nsert))..((faile
48e0: 64 2d 74 6f 2d 69 6e 73 65 72 74 29 0a 09 20 28 d-to-insert).. (
48f0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 debug:print 0 "E
4900: 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 RROR: Failed to
4910: 69 6e 73 65 72 74 20 74 68 65 20 72 65 63 6f 72 insert the recor
4920: 64 20 69 6e 74 6f 20 74 68 65 20 64 62 22 29 29 d into the db"))
4930: 0a 09 28 28 4e 4f 54 5f 53 54 41 52 54 45 44 20 ..((NOT_STARTED
4940: 43 4f 4d 50 4c 45 54 45 44 29 0a 09 20 28 64 65 COMPLETED).. (de
4950: 62 75 67 3a 70 72 69 6e 74 20 36 20 22 47 6f 74 bug:print 6 "Got
4960: 20 68 65 72 65 2c 20 22 20 28 74 65 73 74 3a 67 here, " (test:g
4970: 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 et-state testdat
4980: 29 29 0a 09 20 28 6c 65 74 20 28 28 72 75 6e 66 )).. (let ((runf
4990: 6c 61 67 20 23 66 29 29 0a 09 20 20 20 28 63 6f lag #f)).. (co
49a0: 6e 64 0a 09 20 20 20 20 3b 3b 20 2d 66 6f 72 63 nd.. ;; -forc
49b0: 65 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 e, run no matter
49c0: 20 77 68 61 74 0a 09 20 20 20 20 28 66 6f 72 63 what.. (forc
49d0: 65 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 e (set! runflag
49e0: 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 4e 4f 54 #t)).. ;; NOT
49f0: 5f 53 54 41 52 54 45 44 2c 20 72 75 6e 20 6e 6f _STARTED, run no
4a00: 20 6d 61 74 74 65 72 20 77 68 61 74 0a 09 20 20 matter what..
4a10: 20 20 28 28 65 71 75 61 6c 3f 20 28 74 65 73 74 ((equal? (test
4a20: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 :get-state testd
4a30: 61 74 29 20 22 4e 4f 54 5f 53 54 41 52 54 45 44 at) "NOT_STARTED
4a40: 22 29 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 ")(set! runflag
4a50: 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 6e 6f 74 #t)).. ;; not
4a60: 20 2d 72 65 72 75 6e 20 61 6e 64 20 50 41 53 53 -rerun and PASS
4a70: 2c 20 57 41 52 4e 20 6f 72 20 43 48 45 43 4b 2c , WARN or CHECK,
4a80: 20 64 6f 20 6e 6f 20 72 75 6e 0a 09 20 20 20 20 do no run..
4a90: 28 28 61 6e 64 20 28 6f 72 20 28 6e 6f 74 20 72 ((and (or (not r
4aa0: 65 72 75 6e 29 0a 09 09 20 20 20 20 20 20 6b 65 erun)... ke
4ab0: 65 70 67 6f 69 6e 67 29 0a 09 09 20 20 3b 3b 20 epgoing)... ;;
4ac0: 52 65 71 75 69 72 65 20 74 6f 20 66 6f 72 63 65 Require to force
4ad0: 20 72 65 2d 72 75 6e 20 66 6f 72 20 43 4f 4d 50 re-run for COMP
4ae0: 4c 45 54 45 44 20 6f 72 20 2a 61 6e 79 74 68 69 LETED or *anythi
4af0: 6e 67 2a 20 2b 20 50 41 53 53 2c 57 41 52 4e 20 ng* + PASS,WARN
4b00: 6f 72 20 43 48 45 43 4b 0a 09 09 20 20 28 6f 72 or CHECK... (or
4b10: 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 (member (test:g
4b20: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 et-status testda
4b30: 74 29 20 27 28 22 50 41 53 53 22 20 22 57 41 52 t) '("PASS" "WAR
4b40: 4e 22 20 22 43 48 45 43 4b 22 29 29 0a 09 09 20 N" "CHECK"))...
4b50: 20 20 20 20 20 28 6d 65 6d 62 65 72 20 28 74 65 (member (te
4b60: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 20 74 65 st:get-state te
4b70: 73 74 64 61 74 29 20 27 28 22 43 4f 4d 50 4c 45 stdat) '("COMPLE
4b80: 54 45 44 22 29 29 29 29 20 0a 09 20 20 20 20 20 TED")))) ..
4b90: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 (set! runflag #f
4ba0: 29 29 0a 09 20 20 20 20 3b 3b 20 2d 72 65 72 75 )).. ;; -reru
4bb0: 6e 20 61 6e 64 20 73 74 61 74 75 73 20 69 73 20 n and status is
4bc0: 6f 6e 65 20 6f 66 20 74 68 65 20 73 70 65 63 69 one of the speci
4bd0: 66 65 64 2c 20 72 75 6e 20 69 74 0a 09 20 20 20 fed, run it..
4be0: 20 28 28 61 6e 64 20 72 65 72 75 6e 0a 09 09 20 ((and rerun...
4bf0: 20 28 6c 65 74 20 28 28 72 65 72 75 6e 6c 73 74 (let ((rerunlst
4c00: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 72 (string-split r
4c10: 65 72 75 6e 20 22 2c 22 29 29 29 20 3b 3b 20 46 erun ","))) ;; F
4c20: 41 49 4c 2c 0a 09 09 20 20 20 20 28 6d 65 6d 62 AIL,... (memb
4c30: 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 er (test:get-sta
4c40: 74 75 73 20 74 65 73 74 64 61 74 29 20 72 65 72 tus testdat) rer
4c50: 75 6e 6c 73 74 29 29 29 0a 09 20 20 20 20 20 28 unlst))).. (
4c60: 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 set! runflag #t)
4c70: 29 0a 09 20 20 20 20 3b 3b 20 2d 6b 65 65 70 67 ).. ;; -keepg
4c80: 6f 69 6e 67 2c 20 64 6f 20 6e 6f 74 20 72 65 72 oing, do not rer
4c90: 75 6e 20 46 41 49 4c 0a 09 20 20 20 20 28 28 61 un FAIL.. ((a
4ca0: 6e 64 20 6b 65 65 70 67 6f 69 6e 67 0a 09 09 20 nd keepgoing...
4cb0: 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 (member (test:g
4cc0: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 et-status testda
4cd0: 74 29 20 27 28 22 46 41 49 4c 22 29 29 29 0a 09 t) '("FAIL")))..
4ce0: 20 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c (set! runfl
4cf0: 61 67 20 23 66 29 29 0a 09 20 20 20 20 28 28 61 ag #f)).. ((a
4d00: 6e 64 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a 09 nd (not rerun)..
4d10: 09 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 . (member (test
4d20: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 :get-status test
4d30: 64 61 74 29 20 27 28 22 46 41 49 4c 22 20 22 6e dat) '("FAIL" "n
4d40: 2f 61 22 29 29 29 0a 09 20 20 20 20 20 28 73 65 /a"))).. (se
4d50: 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a t! runflag #t)).
4d60: 09 20 20 20 20 28 65 6c 73 65 20 28 73 65 74 21 . (else (set!
4d70: 20 72 75 6e 66 6c 61 67 20 23 66 29 29 29 0a 09 runflag #f)))..
4d80: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
4d90: 36 20 22 52 55 4e 4e 49 4e 47 20 3d 3e 20 72 75 6 "RUNNING => ru
4da0: 6e 66 6c 61 67 3a 20 22 20 72 75 6e 66 6c 61 67 nflag: " runflag
4db0: 20 22 20 53 54 41 54 45 3a 20 22 20 28 74 65 73 " STATE: " (tes
4dc0: 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 t:get-state test
4dd0: 64 61 74 29 20 22 20 53 54 41 54 55 53 3a 20 22 dat) " STATUS: "
4de0: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 (test:get-statu
4df0: 73 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 s testdat))..
4e00: 28 69 66 20 28 6e 6f 74 20 72 75 6e 66 6c 61 67 (if (not runflag
4e10: 29 0a 09 20 20 20 20 20 20 20 28 69 66 20 28 6e ).. (if (n
4e20: 6f 74 20 70 61 72 65 6e 74 2d 74 65 73 74 29 0a ot parent-test).
4e30: 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e .. (debug:prin
4e40: 74 20 31 20 22 4e 4f 54 45 3a 20 4e 6f 74 20 73 t 1 "NOTE: Not s
4e50: 74 61 72 74 69 6e 67 20 74 65 73 74 20 22 20 6e tarting test " n
4e60: 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 ew-test-name " a
4e70: 73 20 69 74 20 69 73 20 73 74 61 74 65 20 5c 22 s it is state \"
4e80: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 " (test:get-stat
4e90: 65 20 74 65 73 74 64 61 74 29 20 0a 09 09 09 09 e testdat) .....
4ea0: 22 5c 22 20 61 6e 64 20 73 74 61 74 75 73 20 5c "\" and status \
4eb0: 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 "" (test:get-sta
4ec0: 74 75 73 20 74 65 73 74 64 61 74 29 20 22 5c 22 tus testdat) "\"
4ed0: 2c 20 75 73 65 20 2d 72 65 72 75 6e 20 5c 22 22 , use -rerun \""
4ee0: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 (test:get-state
4ef0: 20 74 65 73 74 64 61 74 29 20 22 5c 22 20 6f 72 testdat) "\" or
4f00: 20 2d 66 6f 72 63 65 20 74 6f 20 6f 76 65 72 72 -force to overr
4f10: 69 64 65 22 29 29 0a 09 20 20 20 20 20 20 20 3b ide")).. ;
4f20: 3b 20 4e 4f 54 45 3a 20 4e 6f 20 6c 6f 6e 67 65 ; NOTE: No longe
4f30: 72 20 62 65 20 63 68 65 63 6b 69 6e 67 20 70 72 r be checking pr
4f40: 65 72 65 71 75 69 73 69 74 65 73 20 68 65 72 65 erequisites here
4f50: 21 20 57 69 6c 6c 20 6e 65 76 65 72 20 67 65 74 ! Will never get
4f60: 20 68 65 72 65 20 75 6e 6c 65 73 73 20 70 72 65 here unless pre
4f70: 72 65 71 73 20 61 72 65 0a 09 20 20 20 20 20 20 reqs are..
4f80: 20 3b 3b 20 20 20 20 20 20 20 61 6c 72 65 61 64 ;; alread
4f90: 79 20 6d 65 74 2e 0a 09 20 20 20 20 20 20 20 28 y met... (
4fa0: 69 66 20 28 6e 6f 74 20 28 6c 61 75 6e 63 68 2d if (not (launch-
4fb0: 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 72 test db run-id r
4fc0: 75 6e 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 unname test-conf
4fd0: 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 73 74 2d keyvallst test-
4fe0: 6e 61 6d 65 20 74 65 73 74 2d 70 61 74 68 20 69 name test-path i
4ff0: 74 65 6d 64 61 74 20 66 6c 61 67 73 29 29 0a 09 temdat flags))..
5000: 09 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 . (begin...
5010: 20 20 28 70 72 69 6e 74 20 22 45 52 52 4f 52 3a (print "ERROR:
5020: 20 46 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 Failed to launc
5030: 68 20 74 68 65 20 74 65 73 74 2e 20 45 78 69 74 h the test. Exit
5040: 69 6e 67 20 61 73 20 73 6f 6f 6e 20 61 73 20 70 ing as soon as p
5050: 6f 73 73 69 62 6c 65 22 29 0a 09 09 20 20 20 20 ossible")...
5060: 20 28 73 65 74 21 20 2a 67 6c 6f 62 61 6c 65 78 (set! *globalex
5070: 69 74 73 74 61 74 75 73 2a 20 31 29 20 3b 3b 20 itstatus* 1) ;;
5080: 0a 09 09 20 20 20 20 20 28 70 72 6f 63 65 73 73 ... (process
5090: 2d 73 69 67 6e 61 6c 20 28 63 75 72 72 65 6e 74 -signal (current
50a0: 2d 70 72 6f 63 65 73 73 2d 69 64 29 20 73 69 67 -process-id) sig
50b0: 6e 61 6c 2f 6b 69 6c 6c 29 29 29 29 29 29 0a 09 nal/kill))))))..
50c0: 28 28 4b 49 4c 4c 45 44 29 20 0a 09 20 28 64 65 ((KILLED) .. (de
50d0: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 bug:print 1 "NOT
50e0: 45 3a 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 E: " new-test-na
50f0: 6d 65 20 22 20 69 73 20 61 6c 72 65 61 64 79 20 me " is already
5100: 72 75 6e 6e 69 6e 67 20 6f 72 20 77 61 73 20 65 running or was e
5110: 78 70 6c 69 63 74 6c 79 20 6b 69 6c 6c 65 64 2c xplictly killed,
5120: 20 75 73 65 20 2d 66 6f 72 63 65 20 74 6f 20 6c use -force to l
5130: 61 75 6e 63 68 20 69 74 2e 22 29 29 0a 09 28 28 aunch it."))..((
5140: 4c 41 55 4e 43 48 45 44 20 52 45 4d 4f 54 45 48 LAUNCHED REMOTEH
5150: 4f 53 54 53 54 41 52 54 20 52 55 4e 4e 49 4e 47 OSTSTART RUNNING
5160: 29 20 20 0a 09 20 28 69 66 20 28 3e 20 28 2d 20 ) .. (if (> (-
5170: 28 63 75 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73 (current-seconds
5180: 29 28 2b 20 28 64 62 3a 74 65 73 74 2d 67 65 74 )(+ (db:test-get
5190: 2d 65 76 65 6e 74 5f 74 69 6d 65 20 74 65 73 74 -event_time test
51a0: 64 61 74 29 0a 09 09 09 09 20 20 20 20 20 20 20 dat).....
51b0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e (db:test-get-run
51c0: 5f 64 75 72 61 74 69 6f 6e 20 74 65 73 74 64 61 _duration testda
51d0: 74 29 29 29 0a 09 09 36 30 30 29 20 3b 3b 20 69 t)))...600) ;; i
51e0: 2e 65 2e 20 6e 6f 20 75 70 64 61 74 65 20 66 6f .e. no update fo
51f0: 72 20 6d 6f 72 65 20 74 68 61 6e 20 36 30 30 20 r more than 600
5200: 73 65 63 6f 6e 64 73 0a 09 20 20 20 20 20 28 62 seconds.. (b
5210: 65 67 69 6e 0a 09 20 20 20 20 20 20 20 28 64 65 egin.. (de
5220: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 bug:print 0 "WAR
5230: 4e 49 4e 47 3a 20 54 65 73 74 20 22 20 74 65 73 NING: Test " tes
5240: 74 2d 6e 61 6d 65 20 22 20 61 70 70 65 61 72 73 t-name " appears
5250: 20 74 6f 20 62 65 20 64 65 61 64 2e 20 46 6f 72 to be dead. For
5260: 63 69 6e 67 20 69 74 20 74 6f 20 73 74 61 74 65 cing it to state
5270: 20 49 4e 43 4f 4d 50 4c 45 54 45 20 61 6e 64 20 INCOMPLETE and
5280: 73 74 61 74 75 73 20 53 54 55 43 4b 2f 44 45 41 status STUCK/DEA
5290: 44 22 29 0a 09 20 20 20 20 20 20 20 28 74 65 73 D").. (tes
52a0: 74 2d 73 65 74 2d 73 74 61 74 75 73 21 20 64 62 t-set-status! db
52b0: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
52c0: 65 20 22 49 4e 43 4f 4d 50 4c 45 54 45 22 20 22 e "INCOMPLETE" "
52d0: 53 54 55 43 4b 2f 44 45 41 44 22 20 69 74 65 6d STUCK/DEAD" item
52e0: 64 61 74 20 22 54 65 73 74 20 69 73 20 73 74 75 dat "Test is stu
52f0: 63 6b 20 6f 72 20 64 65 61 64 22 20 23 66 29 29 ck or dead" #f))
5300: 0a 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 .. (debug:pr
5310: 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 22 20 74 int 2 "NOTE: " t
5320: 65 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c est-name " is al
5330: 72 65 61 64 79 20 72 75 6e 6e 69 6e 67 22 29 29 ready running"))
5340: 29 0a 09 28 65 6c 73 65 20 20 20 20 20 20 20 28 )..(else (
5350: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 debug:print 0 "E
5360: 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 RROR: Failed to
5370: 6c 61 75 6e 63 68 20 74 65 73 74 20 22 20 6e 65 launch test " ne
5380: 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 2e 20 55 w-test-name ". U
5390: 6e 72 65 63 6f 67 6e 69 73 65 64 20 73 74 61 74 nrecognised stat
53a0: 65 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 e " (test:get-st
53b0: 61 74 65 20 74 65 73 74 64 61 74 29 29 29 29 29 ate testdat)))))
53c0: 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ))..;;==========
53d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
53e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
53f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5400: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 ============.;;
5410: 45 4e 44 20 4f 46 20 4e 45 57 20 53 54 55 46 46 END OF NEW STUFF
5420: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d .;;=============
5430: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5440: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5450: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5460: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 =========..(defi
5470: 6e 65 20 28 67 65 74 2d 64 69 72 2d 75 70 2d 6e ne (get-dir-up-n
5480: 20 64 69 72 20 2e 20 70 61 72 61 6d 73 29 20 0a dir . params) .
5490: 20 20 28 6c 65 74 20 28 28 64 70 61 72 74 73 20 (let ((dparts
54a0: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 64 (string-split d
54b0: 69 72 20 22 2f 22 29 29 0a 09 28 63 6f 75 6e 74 ir "/"))..(count
54c0: 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 70 61 (if (null? pa
54d0: 72 61 6d 73 29 20 31 20 28 63 61 72 20 70 61 72 rams) 1 (car par
54e0: 61 6d 73 29 29 29 29 0a 20 20 20 20 28 63 6f 6e ams)))). (con
54f0: 63 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e c "/" (string-in
5500: 74 65 72 73 70 65 72 73 65 20 0a 09 20 20 20 20 tersperse ..
5510: 20 20 20 28 74 61 6b 65 20 64 70 61 72 74 73 20 (take dparts
5520: 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 (- (length dpart
5530: 73 29 20 63 6f 75 6e 74 29 29 0a 09 20 20 20 20 s) count))..
5540: 20 20 20 22 2f 22 29 29 29 29 0a 3b 3b 20 52 65 "/")))).;; Re
5550: 6d 6f 76 65 20 72 75 6e 73 0a 3b 3b 20 66 69 65 move runs.;; fie
5560: 6c 64 73 20 61 72 65 20 70 61 73 73 69 6e 67 20 lds are passing
5570: 69 6e 20 74 68 72 6f 75 67 68 20 0a 28 64 65 66 in through .(def
5580: 69 6e 65 20 28 72 75 6e 73 3a 72 65 6d 6f 76 65 ine (runs:remove
5590: 2d 72 75 6e 73 20 64 62 20 72 75 6e 6e 61 6d 65 -runs db runname
55a0: 70 61 74 74 20 74 65 73 74 70 61 74 74 20 69 74 patt testpatt it
55b0: 65 6d 70 61 74 74 29 0a 20 20 28 6c 65 74 2a 20 empatt). (let*
55c0: 28 28 6b 65 79 73 20 20 20 20 20 20 20 20 28 72 ((keys (r
55d0: 64 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 db:get-keys db))
55e0: 0a 09 20 28 72 75 6e 64 61 74 20 20 20 20 20 20 .. (rundat
55f0: 28 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 (runs:get-runs-b
5600: 79 2d 70 61 74 74 20 64 62 20 6b 65 79 73 20 72 y-patt db keys r
5610: 75 6e 6e 61 6d 65 70 61 74 74 29 29 0a 09 20 28 unnamepatt)).. (
5620: 68 65 61 64 65 72 20 20 20 20 20 20 28 76 65 63 header (vec
5630: 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 30 tor-ref rundat 0
5640: 29 29 0a 09 20 28 72 75 6e 73 20 20 20 20 20 20 )).. (runs
5650: 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 (vector-ref ru
5660: 6e 64 61 74 20 31 29 29 29 0a 20 20 20 20 28 64 ndat 1))). (d
5670: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 48 65 ebug:print 1 "He
5680: 61 64 65 72 3a 20 22 20 68 65 61 64 65 72 29 0a ader: " header).
5690: 20 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 (for-each.
56a0: 20 20 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 29 (lambda (run)
56b0: 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 . (let ((r
56c0: 75 6e 6b 65 79 20 28 73 74 72 69 6e 67 2d 69 6e unkey (string-in
56d0: 74 65 72 73 70 65 72 73 65 20 28 6d 61 70 20 28 tersperse (map (
56e0: 6c 61 6d 62 64 61 20 28 6b 29 0a 09 09 09 09 09 lambda (k)......
56f0: 09 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 .(db:get-value-b
5700: 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 y-header run hea
5710: 64 65 72 20 28 76 65 63 74 6f 72 2d 72 65 66 20 der (vector-ref
5720: 6b 20 30 29 29 29 20 6b 65 79 73 29 20 22 2f 22 k 0))) keys) "/"
5730: 29 29 0a 09 20 20 20 20 20 28 64 69 72 73 2d 74 )).. (dirs-t
5740: 6f 2d 72 65 6d 6f 76 65 20 28 6d 61 6b 65 2d 68 o-remove (make-h
5750: 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 09 20 28 ash-table))).. (
5760: 6c 65 74 2a 20 28 28 72 75 6e 2d 69 64 20 28 64 let* ((run-id (d
5770: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 b:get-value-by-h
5780: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 eader run header
5790: 20 22 69 64 22 29 20 29 0a 09 09 28 74 65 73 74 "id") )...(test
57a0: 73 20 20 28 72 64 62 3a 67 65 74 2d 74 65 73 74 s (rdb:get-test
57b0: 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 62 s-for-run db (db
57c0: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 :get-value-by-he
57d0: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 ader run header
57e0: 22 69 64 22 29 20 74 65 73 74 70 61 74 74 20 69 "id") testpatt i
57f0: 74 65 6d 70 61 74 74 20 27 28 29 20 27 28 29 29 tempatt '() '())
5800: 29 0a 09 09 28 6c 61 73 74 74 70 61 74 68 20 22 )...(lasttpath "
5810: 2f 64 6f 65 73 2f 6e 6f 74 2f 65 78 69 73 74 2f /does/not/exist/
5820: 49 2f 68 6f 70 65 22 29 29 0a 0a 09 20 20 20 28 I/hope"))... (
5830: 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 if (not (null? t
5840: 65 73 74 73 29 29 0a 09 20 20 20 20 20 20 20 28 ests)).. (
5850: 62 65 67 69 6e 0a 09 09 20 28 64 65 62 75 67 3a begin... (debug:
5860: 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e print 1 "Removin
5870: 67 20 74 65 73 74 73 20 66 6f 72 20 72 75 6e 3a g tests for run:
5880: 20 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64 " runkey " " (d
5890: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 b:get-value-by-h
58a0: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 eader run header
58b0: 20 22 72 75 6e 6e 61 6d 65 22 29 29 0a 09 09 20 "runname"))...
58c0: 28 66 6f 72 2d 65 61 63 68 0a 09 09 20 20 28 6c (for-each... (l
58d0: 61 6d 62 64 61 20 28 74 65 73 74 29 0a 09 09 20 ambda (test)...
58e0: 20 20 20 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d (let* ((item-
58f0: 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 path (db:test-ge
5900: 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 t-item-path test
5910: 29 29 0a 09 09 09 20 20 20 28 74 65 73 74 2d 6e )).... (test-n
5920: 61 6d 65 20 28 64 62 3a 74 65 73 74 2d 67 65 74 ame (db:test-get
5930: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29 29 -testname test))
5940: 0a 09 09 09 20 20 20 28 72 75 6e 2d 64 69 72 20 .... (run-dir
5950: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 (db:test-get-r
5960: 75 6e 64 69 72 20 74 65 73 74 29 29 29 0a 09 09 undir test)))...
5970: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 (debug:pri
5980: 6e 74 20 31 20 22 20 20 22 20 28 64 62 3a 74 65 nt 1 " " (db:te
5990: 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 st-get-testname
59a0: 74 65 73 74 29 20 22 20 69 64 3a 20 22 20 28 64 test) " id: " (d
59b0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 b:test-get-id te
59c0: 73 74 29 20 22 20 22 20 69 74 65 6d 2d 70 61 74 st) " " item-pat
59d0: 68 29 0a 09 09 20 20 20 20 20 20 28 72 64 62 3a h)... (rdb:
59e0: 64 65 6c 65 74 65 2d 74 65 73 74 2d 72 65 63 6f delete-test-reco
59f0: 72 64 73 20 64 62 20 28 64 62 3a 74 65 73 74 2d rds db (db:test-
5a00: 67 65 74 2d 69 64 20 74 65 73 74 29 29 0a 09 09 get-id test))...
5a10: 20 20 20 20 20 20 28 69 66 20 28 3e 20 28 73 74 (if (> (st
5a20: 72 69 6e 67 2d 6c 65 6e 67 74 68 20 72 75 6e 2d ring-length run-
5a30: 64 69 72 29 20 35 29 20 3b 3b 20 62 61 64 20 68 dir) 5) ;; bad h
5a40: 65 75 72 69 73 74 69 63 20 62 75 74 20 73 68 6f euristic but sho
5a50: 75 6c 64 20 70 72 65 76 65 6e 74 20 2f 74 6d 70 uld prevent /tmp
5a60: 20 2f 68 6f 6d 65 20 65 74 63 2e 0a 09 09 09 20 /home etc.....
5a70: 20 28 6c 65 74 20 28 28 66 75 6c 6c 70 61 74 68 (let ((fullpath
5a80: 20 72 75 6e 2d 64 69 72 29 29 20 3b 3b 20 22 2f run-dir)) ;; "/
5a90: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 " (db:test-get-i
5aa0: 74 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29 29 tem-path test)))
5ab0: 29 0a 09 09 09 20 20 20 20 28 73 65 74 21 20 6c ).... (set! l
5ac0: 61 73 74 74 70 61 74 68 20 66 75 6c 6c 70 61 74 asttpath fullpat
5ad0: 68 29 0a 09 09 09 20 20 20 20 28 68 61 73 68 2d h).... (hash-
5ae0: 74 61 62 6c 65 2d 73 65 74 21 20 64 69 72 73 2d table-set! dirs-
5af0: 74 6f 2d 72 65 6d 6f 76 65 20 66 75 6c 6c 70 61 to-remove fullpa
5b00: 74 68 20 23 74 29 0a 09 09 09 20 20 20 20 3b 3b th #t).... ;;
5b10: 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 77 The following w
5b20: 61 73 20 74 68 65 20 73 61 66 65 20 64 65 6c 65 as the safe dele
5b30: 74 65 20 63 6f 64 65 20 62 75 74 20 69 74 20 77 te code but it w
5b40: 61 73 20 6e 6f 74 20 62 65 69 6e 67 20 65 78 65 as not being exe
5b50: 63 74 75 74 65 64 2e 0a 09 09 09 20 20 20 20 3b ctuted..... ;
5b60: 3b 20 28 6c 65 74 2a 20 28 28 64 69 72 73 2d 63 ; (let* ((dirs-c
5b70: 6f 75 6e 74 20 28 2b 20 31 20 28 6c 65 6e 67 74 ount (+ 1 (lengt
5b80: 68 20 6b 65 79 73 29 28 6c 65 6e 67 74 68 20 28 h keys)(length (
5b90: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 69 74 65 string-split ite
5ba0: 6d 2d 70 61 74 68 20 22 2f 22 29 29 29 29 0a 09 m-path "/"))))..
5bb0: 09 09 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20 .. ;;
5bc0: 28 64 69 72 2d 74 6f 2d 72 65 6d 20 28 67 65 74 (dir-to-rem (get
5bd0: 2d 64 69 72 2d 75 70 2d 6e 20 66 75 6c 6c 70 61 -dir-up-n fullpa
5be0: 74 68 20 64 69 72 73 2d 63 6f 75 6e 74 29 29 0a th dirs-count)).
5bf0: 09 09 09 20 20 20 20 3b 3b 20 20 20 20 20 20 20 ... ;;
5c00: 20 28 72 65 6d 61 69 6e 69 6e 67 64 20 28 73 74 (remainingd (st
5c10: 72 69 6e 67 2d 73 75 62 73 74 69 74 75 74 65 20 ring-substitute
5c20: 28 72 65 67 65 78 70 20 28 63 6f 6e 63 20 22 5e (regexp (conc "^
5c30: 22 20 64 69 72 2d 74 6f 2d 72 65 6d 20 22 2f 22 " dir-to-rem "/"
5c40: 29 29 20 22 22 20 66 75 6c 6c 70 61 74 68 29 29 )) "" fullpath))
5c50: 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 20 20 20 .... ;;
5c60: 20 20 28 63 6d 64 20 28 63 6f 6e 63 20 22 63 64 (cmd (conc "cd
5c70: 20 22 20 64 69 72 2d 74 6f 2d 72 65 6d 20 22 3b " dir-to-rem ";
5c80: 20 72 6d 64 69 72 20 2d 70 20 22 20 72 65 6d 61 rmdir -p " rema
5c90: 69 6e 69 6e 67 64 20 29 29 29 0a 09 09 09 20 20 iningd )))....
5ca0: 20 20 3b 3b 20 20 20 28 69 66 20 28 66 69 6c 65 ;; (if (file
5cb0: 2d 65 78 69 73 74 73 3f 20 66 75 6c 6c 70 61 74 -exists? fullpat
5cc0: 68 29 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 20 h).... ;;
5cd0: 20 20 20 28 62 65 67 69 6e 0a 09 09 09 20 20 20 (begin....
5ce0: 20 3b 3b 20 20 20 20 20 20 20 20 20 28 64 65 62 ;; (deb
5cf0: 75 67 3a 70 72 69 6e 74 20 31 20 63 6d 64 29 0a ug:print 1 cmd).
5d00: 09 09 09 20 20 20 20 3b 3b 20 20 20 20 20 20 20 ... ;;
5d10: 20 20 28 73 79 73 74 65 6d 20 63 6d 64 29 29 29 (system cmd)))
5d20: 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 29 29 0a .... ;; )).
5d30: 09 09 09 20 20 20 20 29 29 29 29 0a 09 09 20 20 ... ))))...
5d40: 20 20 74 65 73 74 73 29 29 29 0a 0a 09 20 20 20 tests)))...
5d50: 3b 3b 20 6c 6f 6f 6b 20 74 68 6f 75 67 68 20 74 ;; look though t
5d60: 68 65 20 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 he dirs-to-remov
5d70: 65 20 66 6f 72 20 63 61 6e 64 69 64 61 74 65 73 e for candidates
5d80: 20 66 6f 72 20 72 65 6d 6f 76 61 6c 2e 20 44 6f for removal. Do
5d90: 20 74 68 69 73 20 61 66 74 65 72 20 64 65 6c 65 this after dele
5da0: 74 69 6e 67 20 74 68 65 20 72 65 63 6f 72 64 73 ting the records
5db0: 0a 09 20 20 20 3b 3b 20 66 6f 72 20 65 61 63 68 .. ;; for each
5dc0: 20 74 65 73 74 20 69 6e 20 63 61 73 65 20 77 65 test in case we
5dd0: 20 67 65 74 20 6b 69 6c 6c 65 64 2e 20 54 68 61 get killed. Tha
5de0: 74 20 73 68 6f 75 6c 64 20 6d 69 6e 69 6d 69 7a t should minimiz
5df0: 65 20 74 68 65 20 64 65 74 72 69 74 75 73 20 6c e the detritus l
5e00: 65 66 74 20 6f 6e 20 64 69 73 6b 0a 09 20 20 20 eft on disk..
5e10: 3b 3b 20 70 72 6f 63 65 73 73 20 74 68 65 20 64 ;; process the d
5e20: 69 72 73 20 66 72 6f 6d 20 6c 6f 6e 67 65 73 74 irs from longest
5e30: 20 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 74 string length t
5e40: 6f 20 73 68 6f 72 74 65 73 74 0a 09 20 20 20 28 o shortest.. (
5e50: 66 6f 72 2d 65 61 63 68 20 0a 09 20 20 20 20 28 for-each .. (
5e60: 6c 61 6d 62 64 61 20 28 64 69 72 2d 74 6f 2d 72 lambda (dir-to-r
5e70: 65 6d 6f 76 65 29 0a 09 20 20 20 20 20 20 28 69 emove).. (i
5e80: 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 f (file-exists?
5e90: 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 29 0a 09 dir-to-remove)..
5ea0: 09 20 20 28 6c 65 74 20 28 28 64 69 72 2d 69 6e . (let ((dir-in
5eb0: 2d 64 62 20 27 28 29 29 29 0a 09 09 20 20 20 20 -db '()))...
5ec0: 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 (sqlite3:for-eac
5ed0: 68 2d 72 6f 77 0a 09 09 20 20 20 20 20 28 6c 61 h-row... (la
5ee0: 6d 62 64 61 20 28 64 69 72 29 0a 09 09 20 20 20 mbda (dir)...
5ef0: 20 20 20 20 28 73 65 74 21 20 64 69 72 2d 69 6e (set! dir-in
5f00: 2d 64 62 20 28 63 6f 6e 73 20 64 69 72 20 64 69 -db (cons dir di
5f10: 72 2d 69 6e 2d 64 62 29 29 29 0a 09 09 20 20 20 r-in-db)))...
5f20: 20 20 64 62 20 22 53 45 4c 45 43 54 20 72 75 6e db "SELECT run
5f30: 64 69 72 20 46 52 4f 4d 20 74 65 73 74 73 20 57 dir FROM tests W
5f40: 48 45 52 45 20 72 75 6e 64 69 72 20 4c 49 4b 45 HERE rundir LIKE
5f50: 20 3f 3b 22 20 0a 09 09 20 20 20 20 20 28 63 6f ?;" ... (co
5f60: 6e 63 20 22 25 22 20 64 69 72 2d 74 6f 2d 72 65 nc "%" dir-to-re
5f70: 6d 6f 76 65 20 22 25 22 29 29 20 3b 3b 20 79 65 move "%")) ;; ye
5f80: 73 2c 20 49 27 6d 20 67 6f 69 6e 67 20 74 6f 20 s, I'm going to
5f90: 62 61 69 6c 20 69 66 20 74 68 65 72 65 20 69 73 bail if there is
5fa0: 20 61 6e 79 74 68 69 6e 67 20 6c 69 6b 65 20 74 anything like t
5fb0: 68 69 73 20 64 69 72 20 69 6e 20 74 68 65 20 64 his dir in the d
5fc0: 62 0a 09 09 20 20 20 20 28 69 66 20 28 6e 75 6c b... (if (nul
5fd0: 6c 3f 20 64 69 72 2d 69 6e 2d 64 62 29 0a 09 09 l? dir-in-db)...
5fe0: 09 28 62 65 67 69 6e 0a 09 09 09 20 20 28 64 65 .(begin.... (de
5ff0: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 52 65 6d bug:print 2 "Rem
6000: 6f 76 69 6e 67 20 64 69 72 65 63 74 6f 72 79 20 oving directory
6010: 77 69 74 68 20 7a 65 72 6f 20 64 62 20 72 65 66 with zero db ref
6020: 65 72 65 6e 63 65 73 3a 20 22 20 64 69 72 2d 74 erences: " dir-t
6030: 6f 2d 72 65 6d 6f 76 65 29 0a 09 09 09 20 20 28 o-remove).... (
6040: 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d system (conc "rm
6050: 20 2d 72 66 20 22 20 64 69 72 2d 74 6f 2d 72 65 -rf " dir-to-re
6060: 6d 6f 76 65 29 29 0a 09 09 09 20 20 28 68 61 73 move)).... (has
6070: 68 2d 74 61 62 6c 65 2d 64 65 6c 65 74 65 21 20 h-table-delete!
6080: 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 64 dirs-to-remove d
6090: 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 29 29 0a 09 ir-to-remove))..
60a0: 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 ..(debug:print 2
60b0: 20 22 53 6b 69 70 70 69 6e 67 20 72 65 6d 6f 76 "Skipping remov
60c0: 61 6c 20 6f 66 20 22 20 64 69 72 2d 74 6f 2d 72 al of " dir-to-r
60d0: 65 6d 6f 76 65 20 22 20 66 6f 72 20 6e 6f 77 20 emove " for now
60e0: 61 73 20 69 74 20 73 74 69 6c 6c 20 68 61 73 20 as it still has
60f0: 72 65 66 65 72 65 6e 63 65 73 20 69 6e 20 74 68 references in th
6100: 65 20 64 61 74 61 62 61 73 65 22 29 29 29 29 29 e database")))))
6110: 0a 09 20 20 20 20 28 73 6f 72 74 20 28 68 61 73 .. (sort (has
6120: 68 2d 74 61 62 6c 65 2d 6b 65 79 73 20 64 69 72 h-table-keys dir
6130: 73 2d 74 6f 2d 72 65 6d 6f 76 65 29 20 28 6c 61 s-to-remove) (la
6140: 6d 62 64 61 20 28 61 20 62 29 28 3e 20 28 73 74 mbda (a b)(> (st
6150: 72 69 6e 67 2d 6c 65 6e 67 74 68 20 61 29 28 73 ring-length a)(s
6160: 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 62 29 29 tring-length b))
6170: 29 29 29 0a 0a 09 20 20 20 3b 3b 20 72 65 6d 6f )))... ;; remo
6180: 76 65 20 74 68 65 20 72 75 6e 20 69 66 20 7a 65 ve the run if ze
6190: 72 6f 20 74 65 73 74 73 20 72 65 6d 61 69 6e 0a ro tests remain.
61a0: 09 20 20 20 28 6c 65 74 20 28 28 72 65 6d 74 65 . (let ((remte
61b0: 73 74 73 20 28 72 64 62 3a 67 65 74 2d 74 65 73 sts (rdb:get-tes
61c0: 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 ts-for-run db (d
61d0: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 b:get-value-by-h
61e0: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 eader run header
61f0: 20 22 69 64 22 29 20 23 66 20 23 66 20 27 28 29 "id") #f #f '()
6200: 20 27 28 29 29 29 29 0a 09 20 20 20 20 20 28 69 '()))).. (i
6210: 66 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 f (null? remtest
6220: 73 29 20 3b 3b 20 6e 6f 20 6d 6f 72 65 20 74 65 s) ;; no more te
6230: 73 74 73 20 72 65 6d 61 69 6e 69 6e 67 0a 09 09 sts remaining...
6240: 20 28 6c 65 74 2a 20 28 28 64 70 61 72 74 73 20 (let* ((dparts
6250: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 6c (string-split l
6260: 61 73 74 74 70 61 74 68 20 22 2f 22 29 29 0a 09 asttpath "/"))..
6270: 09 09 28 72 75 6e 70 61 74 68 20 28 63 6f 6e 63 ..(runpath (conc
6280: 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 "/" (string-int
6290: 65 72 73 70 65 72 73 65 20 0a 09 09 09 09 09 20 ersperse ......
62a0: 20 20 20 28 74 61 6b 65 20 64 70 61 72 74 73 20 (take dparts
62b0: 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 (- (length dpart
62c0: 73 29 20 31 29 29 0a 09 09 09 09 09 20 20 20 20 s) 1))......
62d0: 22 2f 22 29 29 29 29 0a 09 09 20 20 20 28 64 65 "/"))))... (de
62e0: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d bug:print 1 "Rem
62f0: 6f 76 69 6e 67 20 72 75 6e 3a 20 22 20 72 75 6e oving run: " run
6300: 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d key " " (db:get-
6310: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 value-by-header
6320: 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e run header "runn
6330: 61 6d 65 22 29 29 0a 09 09 20 20 20 28 64 62 3a ame"))... (db:
6340: 64 65 6c 65 74 65 2d 72 75 6e 20 64 62 20 72 75 delete-run db ru
6350: 6e 2d 69 64 29 0a 09 09 20 20 20 3b 3b 20 6e 65 n-id)... ;; ne
6360: 65 64 20 74 6f 20 66 69 67 75 72 65 20 6f 75 74 ed to figure out
6370: 20 74 68 65 20 70 61 74 68 20 74 6f 20 74 68 65 the path to the
6380: 20 72 75 6e 20 64 69 72 20 61 6e 64 20 72 65 6d run dir and rem
6390: 6f 76 65 20 69 74 20 69 66 20 65 6d 70 74 79 0a ove it if empty.
63a0: 09 09 20 20 20 3b 3b 20 20 20 20 28 69 66 20 28 .. ;; (if (
63b0: 6e 75 6c 6c 3f 20 28 67 6c 6f 62 20 28 63 6f 6e null? (glob (con
63c0: 63 20 72 75 6e 70 61 74 68 20 22 2f 2a 22 29 29 c runpath "/*"))
63d0: 29 0a 09 09 20 20 20 3b 3b 20 20 20 20 20 20 20 )... ;;
63e0: 20 28 62 65 67 69 6e 0a 09 09 20 20 20 3b 3b 20 (begin... ;;
63f0: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 . (debug:print 1
6400: 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 20 64 "Removing run d
6410: 69 72 20 22 20 72 75 6e 70 61 74 68 29 0a 09 09 ir " runpath)...
6420: 20 20 20 3b 3b 20 09 20 28 73 79 73 74 65 6d 20 ;; . (system
6430: 28 63 6f 6e 63 20 22 72 6d 64 69 72 20 2d 70 20 (conc "rmdir -p
6440: 22 20 72 75 6e 70 61 74 68 29 29 29 29 0a 09 09 " runpath))))...
6450: 20 20 20 29 29 29 29 0a 09 20 29 29 0a 20 20 20 )))).. )).
6460: 20 20 72 75 6e 73 29 29 29 0a 0a 3b 3b 3d 3d 3d runs)))..;;===
6470: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6480: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6490: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
64a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
64b0: 3d 3d 3d 0a 3b 3b 20 52 6f 75 74 69 6e 65 73 20 ===.;; Routines
64c0: 66 6f 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 for manipulating
64d0: 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d runs.;;========
64e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
64f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6500: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6510: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a ==============..
6520: 3b 3b 20 53 69 6e 63 65 20 6d 61 6e 79 20 63 61 ;; Since many ca
6530: 6c 6c 73 20 74 6f 20 61 20 72 75 6e 20 72 65 71 lls to a run req
6540: 75 69 72 65 20 70 72 65 74 74 79 20 6d 75 63 68 uire pretty much
6550: 20 74 68 65 20 73 61 6d 65 20 73 65 74 75 70 20 the same setup
6560: 0a 3b 3b 20 74 68 69 73 20 77 72 61 70 70 65 72 .;; this wrapper
6570: 20 69 73 20 75 73 65 64 20 74 6f 20 72 65 64 75 is used to redu
6580: 63 65 20 74 68 65 20 72 65 70 6c 69 63 61 74 69 ce the replicati
6590: 6f 6e 20 6f 66 20 63 6f 64 65 0a 28 64 65 66 69 on of code.(defi
65a0: 6e 65 20 28 67 65 6e 65 72 61 6c 2d 72 75 6e 2d ne (general-run-
65b0: 63 61 6c 6c 20 73 77 69 74 63 68 6e 61 6d 65 20 call switchname
65c0: 61 63 74 69 6f 6e 2d 64 65 73 63 20 70 72 6f 63 action-desc proc
65d0: 29 0a 20 20 28 6c 65 74 20 28 28 72 75 6e 6e 61 ). (let ((runna
65e0: 6d 65 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 me (args:get-arg
65f0: 20 22 3a 72 75 6e 6e 61 6d 65 22 29 29 0a 09 28 ":runname"))..(
6600: 74 61 72 67 65 74 20 20 28 69 66 20 28 61 72 67 target (if (arg
6610: 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 s:get-arg "-targ
6620: 65 74 22 29 0a 09 09 20 20 20 20 20 28 61 72 67 et")... (arg
6630: 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 s:get-arg "-targ
6640: 65 74 22 29 0a 09 09 20 20 20 20 20 28 61 72 67 et")... (arg
6650: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 s:get-arg "-reqt
6660: 61 72 67 22 29 29 29 29 0a 20 20 20 20 28 63 6f arg")))). (co
6670: 6e 64 0a 20 20 20 20 20 28 28 6e 6f 74 20 74 61 nd. ((not ta
6680: 72 67 65 74 29 0a 20 20 20 20 20 20 28 64 65 62 rget). (deb
6690: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f ug:print 0 "ERRO
66a0: 52 3a 20 4d 69 73 73 69 6e 67 20 72 65 71 75 69 R: Missing requi
66b0: 72 65 64 20 70 61 72 61 6d 65 74 65 72 20 66 6f red parameter fo
66c0: 72 20 22 20 73 77 69 74 63 68 6e 61 6d 65 20 22 r " switchname "
66d0: 2c 20 79 6f 75 20 6d 75 73 74 20 73 70 65 63 69 , you must speci
66e0: 66 79 20 74 68 65 20 74 61 72 67 65 74 20 77 69 fy the target wi
66f0: 74 68 20 2d 74 61 72 67 65 74 22 29 0a 20 20 20 th -target").
6700: 20 20 20 28 65 78 69 74 20 33 29 29 0a 20 20 20 (exit 3)).
6710: 20 20 28 28 6e 6f 74 20 72 75 6e 6e 61 6d 65 29 ((not runname)
6720: 0a 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 . (debug:pr
6730: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 4d 69 int 0 "ERROR: Mi
6740: 73 73 69 6e 67 20 72 65 71 75 69 72 65 64 20 70 ssing required p
6750: 61 72 61 6d 65 74 65 72 20 66 6f 72 20 22 20 73 arameter for " s
6760: 77 69 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75 witchname ", you
6770: 20 6d 75 73 74 20 73 70 65 63 69 66 79 20 74 68 must specify th
6780: 65 20 72 75 6e 20 6e 61 6d 65 20 77 69 74 68 20 e run name with
6790: 3a 72 75 6e 6e 61 6d 65 20 72 75 6e 6e 61 6d 65 :runname runname
67a0: 22 29 0a 20 20 20 20 20 20 28 65 78 69 74 20 33 "). (exit 3
67b0: 29 29 0a 20 20 20 20 20 28 65 6c 73 65 0a 20 20 )). (else.
67c0: 20 20 20 20 28 6c 65 74 20 28 28 64 62 20 20 20 (let ((db
67d0: 23 66 29 0a 09 20 20 20 20 28 6b 65 79 73 20 23 #f).. (keys #
67e0: 66 29 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 73 f))..(if (not (s
67f0: 65 74 75 70 2d 66 6f 72 2d 72 75 6e 29 29 0a 09 etup-for-run))..
6800: 20 20 20 20 28 62 65 67 69 6e 20 0a 09 20 20 20 (begin ..
6810: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
6820: 30 20 22 46 61 69 6c 65 64 20 74 6f 20 73 65 74 0 "Failed to set
6830: 75 70 2c 20 65 78 69 74 69 6e 67 22 29 0a 09 20 up, exiting")..
6840: 20 20 20 20 20 28 65 78 69 74 20 31 29 29 29 0a (exit 1))).
6850: 09 28 73 65 74 21 20 64 62 20 20 20 28 6f 70 65 .(set! db (ope
6860: 6e 2d 64 62 29 29 0a 09 28 69 66 20 28 6e 6f 74 n-db))..(if (not
6870: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
6880: 2d 73 65 72 76 65 72 22 29 29 0a 09 20 20 20 20 -server"))..
6890: 28 73 65 72 76 65 72 3a 63 6c 69 65 6e 74 2d 73 (server:client-s
68a0: 65 74 75 70 20 64 62 29 29 0a 09 28 73 65 74 21 etup db))..(set!
68b0: 20 6b 65 79 73 20 28 72 64 62 3a 67 65 74 2d 6b keys (rdb:get-k
68c0: 65 79 73 20 64 62 29 29 0a 09 3b 3b 20 68 61 76 eys db))..;; hav
68d0: 65 20 65 6e 6f 75 67 68 20 74 6f 20 70 72 6f 63 e enough to proc
68e0: 65 73 73 20 2d 74 61 72 67 65 74 20 6f 72 20 2d ess -target or -
68f0: 72 65 71 74 61 72 67 20 68 65 72 65 0a 09 28 69 reqtarg here..(i
6900: 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 f (args:get-arg
6910: 22 2d 72 65 71 74 61 72 67 22 29 0a 09 20 20 20 "-reqtarg")..
6920: 20 28 6c 65 74 2a 20 28 28 72 75 6e 63 6f 6e 66 (let* ((runconf
6930: 69 67 66 20 28 63 6f 6e 63 20 20 2a 74 6f 70 70 igf (conc *topp
6940: 61 74 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 69 67 ath* "/runconfig
6950: 73 2e 63 6f 6e 66 69 67 22 29 29 20 3b 3b 20 44 s.config")) ;; D
6960: 4f 20 4e 4f 54 20 45 56 41 4c 55 41 54 45 20 41 O NOT EVALUATE A
6970: 4c 4c 20 0a 09 09 20 20 20 28 72 75 6e 63 6f 6e LL ... (runcon
6980: 66 69 67 20 20 28 72 65 61 64 2d 63 6f 6e 66 69 fig (read-confi
6990: 67 20 72 75 6e 63 6f 6e 66 69 67 66 20 23 66 20 g runconfigf #f
69a0: 23 66 20 65 6e 76 69 72 6f 6e 2d 70 61 74 74 3a #f environ-patt:
69b0: 20 23 66 29 29 29 20 0a 09 20 20 20 20 20 20 28 #f))) .. (
69c0: 69 66 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 if (hash-table-r
69d0: 65 66 2f 64 65 66 61 75 6c 74 20 72 75 6e 63 6f ef/default runco
69e0: 6e 66 69 67 20 28 61 72 67 73 3a 67 65 74 2d 61 nfig (args:get-a
69f0: 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 20 23 rg "-reqtarg") #
6a00: 66 29 0a 09 09 20 20 28 6b 65 79 73 3a 74 61 72 f)... (keys:tar
6a10: 67 65 74 2d 73 65 74 2d 61 72 67 73 20 6b 65 79 get-set-args key
6a20: 73 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 s (args:get-arg
6a30: 22 2d 72 65 71 74 61 72 67 22 29 20 61 72 67 73 "-reqtarg") args
6a40: 3a 61 72 67 2d 68 61 73 68 29 0a 09 09 20 20 28 :arg-hash)... (
6a50: 62 65 67 69 6e 0a 09 09 20 20 20 20 28 64 65 62 begin... (deb
6a60: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f ug:print 0 "ERRO
6a70: 52 3a 20 5b 22 20 28 61 72 67 73 3a 67 65 74 2d R: [" (args:get-
6a80: 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 20 arg "-reqtarg")
6a90: 22 5d 20 6e 6f 74 20 66 6f 75 6e 64 20 69 6e 20 "] not found in
6aa0: 22 20 72 75 6e 63 6f 6e 66 69 67 66 29 0a 09 09 " runconfigf)...
6ab0: 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66 69 6e (sqlite3:fin
6ac0: 61 6c 69 7a 65 21 20 64 62 29 0a 09 09 20 20 20 alize! db)...
6ad0: 20 28 65 78 69 74 20 31 29 29 29 29 0a 09 20 20 (exit 1))))..
6ae0: 20 20 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d (if (args:get-
6af0: 61 72 67 20 22 2d 74 61 72 67 65 74 22 29 0a 09 arg "-target")..
6b00: 09 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 73 65 .(keys:target-se
6b10: 74 2d 61 72 67 73 20 6b 65 79 73 20 28 61 72 67 t-args keys (arg
6b20: 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 s:get-arg "-targ
6b30: 65 74 22 20 61 72 67 73 3a 61 72 67 2d 68 61 73 et" args:arg-has
6b40: 68 29 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68 h) args:arg-hash
6b50: 29 29 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 63 )))..(if (not (c
6b60: 61 72 20 2a 63 6f 6e 66 69 67 69 6e 66 6f 2a 29 ar *configinfo*)
6b70: 29 0a 09 20 20 20 20 28 62 65 67 69 6e 0a 09 20 ).. (begin..
6b80: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e (debug:prin
6b90: 74 20 30 20 22 45 52 52 4f 52 3a 20 41 74 74 65 t 0 "ERROR: Atte
6ba0: 6d 70 74 65 64 20 74 6f 20 22 20 61 63 74 69 6f mpted to " actio
6bb0: 6e 2d 64 65 73 63 20 22 20 62 75 74 20 72 75 6e n-desc " but run
6bc0: 20 61 72 65 61 20 63 6f 6e 66 69 67 20 66 69 6c area config fil
6bd0: 65 20 6e 6f 74 20 66 6f 75 6e 64 22 29 0a 09 20 e not found")..
6be0: 20 20 20 20 20 28 65 78 69 74 20 31 29 29 0a 09 (exit 1))..
6bf0: 20 20 20 20 3b 3b 20 45 78 74 72 61 63 74 20 6f ;; Extract o
6c00: 75 74 20 73 74 75 66 66 20 6e 65 65 64 65 64 20 ut stuff needed
6c10: 69 6e 20 6d 6f 73 74 20 6f 72 20 6d 61 6e 79 20 in most or many
6c20: 63 61 6c 6c 73 0a 09 20 20 20 20 3b 3b 20 68 65 calls.. ;; he
6c30: 72 65 20 74 68 65 6e 20 63 61 6c 6c 20 70 72 6f re then call pro
6c40: 63 0a 09 20 20 20 20 28 6c 65 74 2a 20 28 28 6b c.. (let* ((k
6c50: 65 79 6e 61 6d 65 73 20 20 20 28 6d 61 70 20 6b eynames (map k
6c60: 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 ey:get-fieldname
6c70: 20 6b 65 79 73 29 29 0a 09 09 20 20 20 28 6b 65 keys))... (ke
6c80: 79 76 61 6c 6c 73 74 20 20 28 6b 65 79 73 2d 3e yvallst (keys->
6c90: 76 61 6c 6c 69 73 74 20 6b 65 79 73 20 23 74 29 vallist keys #t)
6ca0: 29 29 0a 09 20 20 20 20 20 20 28 70 72 6f 63 20 )).. (proc
6cb0: 64 62 20 74 61 72 67 65 74 20 72 75 6e 6e 61 6d db target runnam
6cc0: 65 20 6b 65 79 73 20 6b 65 79 6e 61 6d 65 73 20 e keys keynames
6cd0: 6b 65 79 76 61 6c 6c 73 74 29 29 29 0a 09 28 73 keyvallst)))..(s
6ce0: 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 qlite3:finalize!
6cf0: 20 64 62 29 0a 09 28 73 65 74 21 20 2a 64 69 64 db)..(set! *did
6d00: 73 6f 6d 65 74 68 69 6e 67 2a 20 23 74 29 29 29 something* #t)))
6d10: 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d )))..;;=========
6d20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6d30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6d40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6d50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b =============.;;
6d60: 20 52 6f 6c 6c 75 70 20 72 75 6e 73 0a 3b 3b 3d Rollup runs.;;=
6d70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6d80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6d90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6da0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6db0: 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 55 70 64 61 74 65 =====..;; Update
6dc0: 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61 20 74 the test_meta t
6dd0: 61 62 6c 65 20 66 6f 72 20 74 68 69 73 20 74 65 able for this te
6de0: 73 74 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 st.(define (runs
6df0: 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 :update-test_met
6e00: 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 a db test-name t
6e10: 65 73 74 2d 63 6f 6e 66 29 0a 20 20 28 6c 65 74 est-conf). (let
6e20: 20 28 28 63 75 72 72 72 65 63 6f 72 64 20 28 72 ((currrecord (r
6e30: 64 62 3a 74 65 73 74 6d 65 74 61 2d 67 65 74 2d db:testmeta-get-
6e40: 72 65 63 6f 72 64 20 64 62 20 74 65 73 74 2d 6e record db test-n
6e50: 61 6d 65 29 29 29 0a 20 20 20 20 28 69 66 20 28 ame))). (if (
6e60: 6e 6f 74 20 63 75 72 72 72 65 63 6f 72 64 29 0a not currrecord).
6e70: 09 28 62 65 67 69 6e 0a 09 20 20 28 73 65 74 21 .(begin.. (set!
6e80: 20 63 75 72 72 72 65 63 6f 72 64 20 28 6d 61 6b currrecord (mak
6e90: 65 2d 76 65 63 74 6f 72 20 31 30 20 23 66 29 29 e-vector 10 #f))
6ea0: 0a 09 20 20 28 72 64 62 3a 74 65 73 74 6d 65 74 .. (rdb:testmet
6eb0: 61 2d 61 64 64 2d 72 65 63 6f 72 64 20 64 62 20 a-add-record db
6ec0: 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 test-name))).
6ed0: 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 (for-each .
6ee0: 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 29 0a 20 (lambda (key).
6ef0: 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 69 64 (let* ((id
6f00: 78 20 28 63 61 64 72 20 6b 65 79 29 29 0a 09 20 x (cadr key))..
6f10: 20 20 20 20 20 28 66 6c 64 20 28 63 61 72 20 20 (fld (car
6f20: 6b 65 79 29 29 0a 09 20 20 20 20 20 20 28 76 61 key)).. (va
6f30: 6c 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 l (config-lookup
6f40: 20 74 65 73 74 2d 63 6f 6e 66 20 22 74 65 73 74 test-conf "test
6f50: 5f 6d 65 74 61 22 20 66 6c 64 29 29 29 0a 09 20 _meta" fld)))..
6f60: 3b 3b 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 ;; (debug:print
6f70: 35 20 22 69 64 78 3a 20 22 20 69 64 78 20 22 20 5 "idx: " idx "
6f80: 66 6c 64 3a 20 22 20 66 6c 64 20 22 20 76 61 6c fld: " fld " val
6f90: 3a 20 22 20 76 61 6c 29 0a 09 20 28 69 66 20 28 : " val).. (if (
6fa0: 61 6e 64 20 76 61 6c 20 28 6e 6f 74 20 28 65 71 and val (not (eq
6fb0: 75 61 6c 3f 20 28 76 65 63 74 6f 72 2d 72 65 66 ual? (vector-ref
6fc0: 20 63 75 72 72 72 65 63 6f 72 64 20 69 64 78 29 currrecord idx)
6fd0: 20 76 61 6c 29 29 29 0a 09 20 20 20 20 20 28 62 val))).. (b
6fe0: 65 67 69 6e 0a 09 20 20 20 20 20 20 20 28 70 72 egin.. (pr
6ff0: 69 6e 74 20 22 55 70 64 61 74 69 6e 67 20 22 20 int "Updating "
7000: 74 65 73 74 2d 6e 61 6d 65 20 22 20 22 20 66 6c test-name " " fl
7010: 64 20 22 20 74 6f 20 22 20 76 61 6c 29 0a 09 20 d " to " val)..
7020: 20 20 20 20 20 20 28 64 62 3a 74 65 73 74 6d 65 (db:testme
7030: 74 61 2d 75 70 64 61 74 65 2d 66 69 65 6c 64 20 ta-update-field
7040: 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 66 6c 64 db test-name fld
7050: 20 76 61 6c 29 29 29 29 29 0a 20 20 20 20 20 27 val))))). '
7060: 28 28 22 61 75 74 68 6f 72 22 20 32 29 28 22 6f (("author" 2)("o
7070: 77 6e 65 72 22 20 33 29 28 22 64 65 73 63 72 69 wner" 3)("descri
7080: 70 74 69 6f 6e 22 20 34 29 28 22 72 65 76 69 65 ption" 4)("revie
7090: 77 65 64 22 20 35 29 28 22 74 61 67 73 22 20 39 wed" 5)("tags" 9
70a0: 29 29 29 29 29 0a 0a 3b 3b 20 55 70 64 61 74 65 )))))..;; Update
70b0: 20 74 65 73 74 5f 6d 65 74 61 20 66 6f 72 20 61 test_meta for a
70c0: 6c 6c 20 74 65 73 74 73 0a 28 64 65 66 69 6e 65 ll tests.(define
70d0: 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 61 6c (runs:update-al
70e0: 6c 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 29 0a l-test_meta db).
70f0: 20 20 28 6c 65 74 20 28 28 74 65 73 74 2d 6e 61 (let ((test-na
7100: 6d 65 73 20 28 67 65 74 2d 61 6c 6c 2d 6c 65 67 mes (get-all-leg
7110: 61 6c 2d 74 65 73 74 73 29 29 29 0a 20 20 20 20 al-tests))).
7120: 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 (for-each .
7130: 28 6c 61 6d 62 64 61 20 28 74 65 73 74 2d 6e 61 (lambda (test-na
7140: 6d 65 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a me). (let*
7150: 20 28 28 74 65 73 74 2d 70 61 74 68 20 20 20 20 ((test-path
7160: 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 (conc *toppath*
7170: 22 2f 74 65 73 74 73 2f 22 20 74 65 73 74 2d 6e "/tests/" test-n
7180: 61 6d 65 29 29 0a 09 20 20 20 20 20 20 28 74 65 ame)).. (te
7190: 73 74 2d 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 st-configf (conc
71a0: 20 74 65 73 74 2d 70 61 74 68 20 22 2f 74 65 73 test-path "/tes
71b0: 74 63 6f 6e 66 69 67 22 29 29 0a 09 20 20 20 20 tconfig"))..
71c0: 20 20 28 74 65 73 74 65 78 69 73 74 73 20 20 20 (testexists
71d0: 28 61 6e 64 20 28 66 69 6c 65 2d 65 78 69 73 74 (and (file-exist
71e0: 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 s? test-configf)
71f0: 28 66 69 6c 65 2d 72 65 61 64 2d 61 63 63 65 73 (file-read-acces
7200: 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 s? test-configf)
7210: 29 29 0a 09 20 20 20 20 20 20 3b 3b 20 72 65 61 )).. ;; rea
7220: 64 20 63 6f 6e 66 69 67 73 20 77 69 74 68 20 74 d configs with t
7230: 72 69 63 6b 73 20 74 75 72 6e 65 64 20 6f 66 66 ricks turned off
7240: 20 28 69 2e 65 2e 20 6e 6f 20 73 79 73 74 65 6d (i.e. no system
7250: 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d 63 ).. (test-c
7260: 6f 6e 66 20 20 20 20 28 69 66 20 74 65 73 74 65 onf (if teste
7270: 78 69 73 74 73 20 28 72 65 61 64 2d 63 6f 6e 66 xists (read-conf
7280: 69 67 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 ig test-configf
7290: 23 66 20 23 66 29 28 6d 61 6b 65 2d 68 61 73 68 #f #f)(make-hash
72a0: 2d 74 61 62 6c 65 29 29 29 29 0a 09 20 28 72 75 -table)))).. (ru
72b0: 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d ns:update-test_m
72c0: 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 eta db test-name
72d0: 20 74 65 73 74 2d 63 6f 6e 66 29 29 29 0a 20 20 test-conf))).
72e0: 20 20 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 test-names)))
72f0: 0a 0a 3b 3b 20 54 68 69 73 20 63 6f 75 6c 64 20 ..;; This could
7300: 70 72 6f 62 61 62 6c 79 20 62 65 20 72 65 66 61 probably be refa
7310: 63 74 6f 72 65 64 20 69 6e 74 6f 20 6f 6e 65 20 ctored into one
7320: 63 6f 6d 70 6c 65 78 20 71 75 65 72 79 20 2e 2e complex query ..
7330: 2e 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a ..(define (runs:
7340: 72 6f 6c 6c 75 70 2d 72 75 6e 20 64 62 20 6b 65 rollup-run db ke
7350: 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e ys keyvallst run
7360: 6e 61 6d 65 20 75 73 65 72 29 20 3b 3b 20 77 61 name user) ;; wa
7370: 73 20 74 61 72 67 65 74 2c 20 6e 6f 77 20 6b 65 s target, now ke
7380: 79 76 61 6c 6c 73 74 0a 20 20 28 64 65 62 75 67 yvallst. (debug
7390: 3a 70 72 69 6e 74 20 34 20 22 72 75 6e 73 3a 72 :print 4 "runs:r
73a0: 6f 6c 6c 75 70 2d 72 75 6e 2c 20 6b 65 79 73 3a ollup-run, keys:
73b0: 20 22 20 6b 65 79 73 20 22 20 6b 65 79 76 61 6c " keys " keyval
73c0: 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 lst: " keyvallst
73d0: 20 22 20 3a 72 75 6e 6e 61 6d 65 20 22 20 72 75 " :runname " ru
73e0: 6e 6e 61 6d 65 20 22 20 75 73 65 72 3a 20 22 20 nname " user: "
73f0: 75 73 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 3b user). (let* (;
7400: 20 28 6b 65 79 76 61 6c 6c 6c 73 74 20 20 20 20 (keyvalllst
7410: 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 3e (keys:target->
7420: 6b 65 79 76 61 6c 20 6b 65 79 73 20 74 61 72 67 keyval keys targ
7430: 65 74 29 29 0a 09 20 28 6e 65 77 2d 72 75 6e 2d et)).. (new-run-
7440: 69 64 20 20 20 20 20 20 28 72 75 6e 73 3a 72 65 id (runs:re
7450: 67 69 73 74 65 72 2d 72 75 6e 20 64 62 20 6b 65 gister-run db ke
7460: 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e ys keyvallst run
7470: 6e 61 6d 65 20 22 6e 65 77 22 20 22 6e 2f 61 22 name "new" "n/a"
7480: 20 75 73 65 72 29 29 0a 09 20 28 70 72 65 76 2d user)).. (prev-
7490: 74 65 73 74 73 20 20 20 20 20 20 28 74 65 73 74 tests (test
74a0: 3a 67 65 74 2d 6d 61 74 63 68 69 6e 67 2d 70 72 :get-matching-pr
74b0: 65 76 69 6f 75 73 2d 74 65 73 74 2d 72 75 6e 2d evious-test-run-
74c0: 72 65 63 6f 72 64 73 20 64 62 20 6e 65 77 2d 72 records db new-r
74d0: 75 6e 2d 69 64 20 22 25 22 20 22 25 22 29 29 0a un-id "%" "%")).
74e0: 09 20 28 63 75 72 72 2d 74 65 73 74 73 20 20 20 . (curr-tests
74f0: 20 20 20 28 72 64 62 3a 67 65 74 2d 74 65 73 74 (rdb:get-test
7500: 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77 s-for-run db new
7510: 2d 72 75 6e 2d 69 64 20 22 25 22 20 22 25 22 20 -run-id "%" "%"
7520: 27 28 29 20 27 28 29 29 29 0a 09 20 28 63 75 72 '() '())).. (cur
7530: 72 2d 74 65 73 74 73 2d 68 61 73 68 20 28 6d 61 r-tests-hash (ma
7540: 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 ke-hash-table)))
7550: 0a 20 20 20 20 28 64 62 3a 75 70 64 61 74 65 2d . (db:update-
7560: 72 75 6e 2d 65 76 65 6e 74 5f 74 69 6d 65 20 64 run-event_time d
7570: 62 20 6e 65 77 2d 72 75 6e 2d 69 64 29 0a 20 20 b new-run-id).
7580: 20 20 3b 3b 20 69 6e 64 65 78 20 74 68 65 20 61 ;; index the a
7590: 6c 72 65 61 64 79 20 73 61 76 65 64 20 74 65 73 lready saved tes
75a0: 74 73 20 62 79 20 74 65 73 74 6e 61 6d 65 20 61 ts by testname a
75b0: 6e 64 20 69 74 65 6d 64 61 74 20 69 6e 20 63 75 nd itemdat in cu
75c0: 72 72 2d 74 65 73 74 73 2d 68 61 73 68 0a 20 20 rr-tests-hash.
75d0: 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 (for-each.
75e0: 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 64 61 (lambda (testda
75f0: 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 t). (let*
7600: 28 28 74 65 73 74 6e 61 6d 65 20 20 28 64 62 3a ((testname (db:
7610: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d test-get-testnam
7620: 65 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 e testdat))..
7630: 20 20 20 28 69 74 65 6d 2d 70 61 74 68 20 28 64 (item-path (d
7640: 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d b:test-get-item-
7650: 70 61 74 68 20 74 65 73 74 64 61 74 29 29 0a 09 path testdat))..
7660: 20 20 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 (full-name
7670: 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 (conc testname
7680: 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 29 "/" item-path)))
7690: 0a 09 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 .. (hash-table-s
76a0: 65 74 21 20 63 75 72 72 2d 74 65 73 74 73 2d 68 et! curr-tests-h
76b0: 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 74 65 ash full-name te
76c0: 73 74 64 61 74 29 29 29 0a 20 20 20 20 20 63 75 stdat))). cu
76d0: 72 72 2d 74 65 73 74 73 29 0a 20 20 20 20 3b 3b rr-tests). ;;
76e0: 20 4e 4f 50 45 3a 20 4e 6f 6e 2d 6f 70 74 69 6d NOPE: Non-optim
76f0: 61 6c 20 61 70 70 72 6f 61 63 68 2e 20 54 72 79 al approach. Try
7700: 20 74 68 69 73 20 69 6e 73 74 65 61 64 2e 0a 20 this instead..
7710: 20 20 20 3b 3b 20 20 20 31 2e 20 74 65 73 74 73 ;; 1. tests
7720: 20 61 72 65 20 72 65 63 65 69 76 65 64 20 69 6e are received in
7730: 20 61 20 6c 69 73 74 2c 20 6d 6f 73 74 20 72 65 a list, most re
7740: 63 65 6e 74 20 66 69 72 73 74 0a 20 20 20 20 3b cent first. ;
7750: 3b 20 20 20 32 2e 20 72 65 70 6c 61 63 65 20 74 ; 2. replace t
7760: 68 65 20 72 6f 6c 6c 75 70 20 74 65 73 74 20 77 he rollup test w
7770: 69 74 68 20 74 68 65 20 6e 65 77 20 2a 61 6c 77 ith the new *alw
7780: 61 79 73 2a 0a 20 20 20 20 28 66 6f 72 2d 65 61 ays*. (for-ea
7790: 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 ch . (lambda
77a0: 20 28 74 65 73 74 64 61 74 29 0a 20 20 20 20 20 (testdat).
77b0: 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 (let* ((testna
77c0: 6d 65 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 me (db:test-get
77d0: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 64 61 -testname testda
77e0: 74 29 29 0a 09 20 20 20 20 20 20 28 69 74 65 6d t)).. (item
77f0: 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 -path (db:test-g
7800: 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 et-item-path tes
7810: 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 66 tdat)).. (f
7820: 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 ull-name (conc t
7830: 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d estname "/" item
7840: 2d 70 61 74 68 29 29 0a 09 20 20 20 20 20 20 28 -path)).. (
7850: 70 72 65 76 2d 74 65 73 74 2d 64 61 74 20 28 68 prev-test-dat (h
7860: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 ash-table-ref/de
7870: 66 61 75 6c 74 20 63 75 72 72 2d 74 65 73 74 73 fault curr-tests
7880: 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 -hash full-name
7890: 23 66 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 #f)).. (tes
78a0: 74 2d 73 74 65 70 73 20 20 20 20 20 20 28 64 62 t-steps (db
78b0: 3a 67 65 74 2d 73 74 65 70 73 2d 66 6f 72 2d 74 :get-steps-for-t
78c0: 65 73 74 20 64 62 20 28 64 62 3a 74 65 73 74 2d est db (db:test-
78d0: 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 29 get-id testdat))
78e0: 29 0a 09 20 20 20 20 20 20 28 6e 65 77 2d 74 65 ).. (new-te
78f0: 73 74 2d 72 65 63 6f 72 64 20 23 66 29 29 0a 09 st-record #f))..
7900: 20 3b 3b 20 72 65 70 6c 61 63 65 20 74 68 65 73 ;; replace thes
7910: 65 20 77 69 74 68 20 69 6e 73 65 72 74 20 2e 2e e with insert ..
7920: 2e 20 73 65 6c 65 63 74 0a 09 20 28 61 70 70 6c . select.. (appl
7930: 79 20 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 y sqlite3:execut
7940: 65 20 0a 09 09 64 62 20 0a 09 09 28 63 6f 6e 63 e ...db ...(conc
7950: 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c "INSERT OR REPL
7960: 41 43 45 20 49 4e 54 4f 20 74 65 73 74 73 20 28 ACE INTO tests (
7970: 72 75 6e 5f 69 64 2c 74 65 73 74 6e 61 6d 65 2c run_id,testname,
7980: 73 74 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 state,status,eve
7990: 6e 74 5f 74 69 6d 65 2c 68 6f 73 74 2c 63 70 75 nt_time,host,cpu
79a0: 6c 6f 61 64 2c 64 69 73 6b 66 72 65 65 2c 75 6e load,diskfree,un
79b0: 61 6d 65 2c 72 75 6e 64 69 72 2c 69 74 65 6d 5f ame,rundir,item_
79c0: 70 61 74 68 2c 72 75 6e 5f 64 75 72 61 74 69 6f path,run_duratio
79d0: 6e 2c 66 69 6e 61 6c 5f 6c 6f 67 66 2c 63 6f 6d n,final_logf,com
79e0: 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 20 20 20 ment) "...
79f0: 22 56 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f "VALUES (?,?,?,?
7a00: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f ,?,?,?,?,?,?,?,?
7a10: 2c 3f 2c 3f 29 3b 22 29 0a 09 09 6e 65 77 2d 72 ,?,?);")...new-r
7a20: 75 6e 2d 69 64 20 28 63 64 64 72 20 28 76 65 63 un-id (cddr (vec
7a30: 74 6f 72 2d 3e 6c 69 73 74 20 74 65 73 74 64 61 tor->list testda
7a40: 74 29 29 29 0a 09 20 28 73 65 74 21 20 6e 65 77 t))).. (set! new
7a50: 2d 74 65 73 74 64 61 74 20 28 63 61 72 20 28 72 -testdat (car (r
7a60: 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 db:get-tests-for
7a70: 2d 72 75 6e 20 64 62 20 6e 65 77 2d 72 75 6e 2d -run db new-run-
7a80: 69 64 20 74 65 73 74 6e 61 6d 65 20 69 74 65 6d id testname item
7a90: 2d 70 61 74 68 20 27 28 29 20 27 28 29 29 29 29 -path '() '())))
7aa0: 0a 09 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 .. (hash-table-s
7ab0: 65 74 21 20 63 75 72 72 2d 74 65 73 74 73 2d 68 et! curr-tests-h
7ac0: 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 6e 65 ash full-name ne
7ad0: 77 2d 74 65 73 74 64 61 74 29 20 3b 3b 20 74 68 w-testdat) ;; th
7ae0: 69 73 20 63 6f 75 6c 64 20 62 65 20 63 6f 6e 66 is could be conf
7af0: 75 73 69 6e 67 2c 20 77 68 69 63 68 20 72 65 63 using, which rec
7b00: 6f 72 64 20 73 68 6f 75 6c 64 20 67 6f 20 69 6e ord should go in
7b10: 74 6f 20 74 68 65 20 6c 6f 6f 6b 75 70 20 74 61 to the lookup ta
7b20: 62 6c 65 3f 0a 09 20 3b 3b 20 4e 6f 77 20 64 75 ble?.. ;; Now du
7b30: 70 6c 69 63 61 74 65 20 74 68 65 20 74 65 73 74 plicate the test
7b40: 20 73 74 65 70 73 0a 09 20 28 64 65 62 75 67 3a steps.. (debug:
7b50: 70 72 69 6e 74 20 34 20 22 43 6f 70 79 69 6e 67 print 4 "Copying
7b60: 20 72 65 63 6f 72 64 73 20 69 6e 20 74 65 73 74 records in test
7b70: 5f 73 74 65 70 73 20 66 72 6f 6d 20 74 65 73 74 _steps from test
7b80: 5f 69 64 3d 22 20 28 64 62 3a 74 65 73 74 2d 67 _id=" (db:test-g
7b90: 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 20 22 et-id testdat) "
7ba0: 20 74 6f 20 22 20 28 64 62 3a 74 65 73 74 2d 67 to " (db:test-g
7bb0: 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 et-id new-testda
7bc0: 74 29 29 0a 09 20 28 73 71 6c 69 74 65 33 3a 65 t)).. (sqlite3:e
7bd0: 78 65 63 75 74 65 20 0a 09 20 20 64 62 20 0a 09 xecute .. db ..
7be0: 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 (conc "INSERT
7bf0: 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 OR REPLACE INTO
7c00: 74 65 73 74 5f 73 74 65 70 73 20 28 74 65 73 74 test_steps (test
7c10: 5f 69 64 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 _id,stepname,sta
7c20: 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f te,status,event_
7c30: 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a time,comment) ".
7c40: 09 09 22 53 45 4c 45 43 54 20 22 20 28 64 62 3a .."SELECT " (db:
7c50: 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d test-get-id new-
7c60: 74 65 73 74 64 61 74 29 20 22 2c 73 74 65 70 6e testdat) ",stepn
7c70: 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 ame,state,status
7c80: 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d ,event_time,comm
7c90: 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f 73 74 ent FROM test_st
7ca0: 65 70 73 20 57 48 45 52 45 20 74 65 73 74 5f 69 eps WHERE test_i
7cb0: 64 3d 3f 3b 22 29 0a 09 20 20 28 64 62 3a 74 65 d=?;").. (db:te
7cc0: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 st-get-id testda
7cd0: 74 29 29 0a 09 20 3b 3b 20 4e 6f 77 20 64 75 70 t)).. ;; Now dup
7ce0: 6c 69 63 61 74 65 20 74 68 65 20 74 65 73 74 20 licate the test
7cf0: 64 61 74 61 0a 09 20 28 64 65 62 75 67 3a 70 72 data.. (debug:pr
7d00: 69 6e 74 20 34 20 22 43 6f 70 79 69 6e 67 20 72 int 4 "Copying r
7d10: 65 63 6f 72 64 73 20 69 6e 20 74 65 73 74 5f 64 ecords in test_d
7d20: 61 74 61 20 66 72 6f 6d 20 74 65 73 74 5f 69 64 ata from test_id
7d30: 3d 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d =" (db:test-get-
7d40: 69 64 20 74 65 73 74 64 61 74 29 20 22 20 74 6f id testdat) " to
7d50: 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d " (db:test-get-
7d60: 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 29 id new-testdat))
7d70: 0a 09 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 .. (sqlite3:exec
7d80: 75 74 65 20 0a 09 20 20 64 62 20 0a 09 20 20 28 ute .. db .. (
7d90: 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 conc "INSERT OR
7da0: 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 REPLACE INTO tes
7db0: 74 5f 64 61 74 61 20 28 74 65 73 74 5f 69 64 2c t_data (test_id,
7dc0: 63 61 74 65 67 6f 72 79 2c 76 61 72 69 61 62 6c category,variabl
7dd0: 65 2c 76 61 6c 75 65 2c 65 78 70 65 63 74 65 64 e,value,expected
7de0: 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65 ,tol,units,comme
7df0: 6e 74 29 20 22 0a 09 09 22 53 45 4c 45 43 54 20 nt) "..."SELECT
7e00: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 " (db:test-get-i
7e10: 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20 22 d new-testdat) "
7e20: 2c 63 61 74 65 67 6f 72 79 2c 76 61 72 69 61 62 ,category,variab
7e30: 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65 63 74 65 le,value,expecte
7e40: 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d d,tol,units,comm
7e50: 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f 64 61 ent FROM test_da
7e60: 74 61 20 57 48 45 52 45 20 74 65 73 74 5f 69 64 ta WHERE test_id
7e70: 3d 3f 3b 22 29 0a 09 20 20 28 64 62 3a 74 65 73 =?;").. (db:tes
7e80: 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 t-get-id testdat
7e90: 29 29 0a 09 20 29 29 0a 20 20 20 20 20 70 72 65 )).. )). pre
7ea0: 76 2d 74 65 73 74 73 29 29 29 0a 09 20 0a 20 20 v-tests))).. .
7eb0: 20 20 20 0a .