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 64 62 3a 67 65 74 2d 74 65 (db:get-te
46e0: 73 74 2d 69 6e 66 6f 20 64 62 20 72 75 6e 2d 69 st-info db run-i
46f0: 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d d test-name item
4700: 2d 70 61 74 68 29 29 29 0a 20 20 20 20 20 20 28 -path))). (
4710: 69 66 20 28 6e 6f 74 20 74 65 73 74 64 61 74 29 if (not testdat)
4720: 0a 09 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 .. (begin..
4730: 3b 3b 20 65 6e 73 75 72 65 20 74 68 61 74 20 74 ;; ensure that t
4740: 68 65 20 70 61 74 68 20 65 78 69 73 74 73 20 62 he path exists b
4750: 65 66 6f 72 65 20 72 65 67 69 73 74 65 72 69 6e efore registerin
4760: 67 20 74 68 65 20 74 65 73 74 0a 09 20 20 20 20 g the test..
4770: 3b 3b 20 4e 4f 50 45 3a 20 43 61 6e 6e 6f 74 21 ;; NOPE: Cannot!
4780: 20 44 6f 6e 27 74 20 6b 6e 6f 77 20 79 65 74 20 Don't know yet
4790: 77 68 69 63 68 20 64 69 73 6b 20 61 72 65 61 20 which disk area
47a0: 77 69 6c 6c 20 62 65 20 61 73 73 69 67 6e 65 64 will be assigned
47b0: 2e 2e 2e 2e 0a 09 20 20 20 20 3b 3b 20 28 73 79 ...... ;; (sy
47c0: 73 74 65 6d 20 28 63 6f 6e 63 20 22 6d 6b 64 69 stem (conc "mkdi
47d0: 72 20 2d 70 20 22 20 6e 65 77 2d 74 65 73 74 2d r -p " new-test-
47e0: 70 61 74 68 29 29 0a 09 20 20 20 20 28 72 74 65 path)).. (rte
47f0: 73 74 73 3a 72 65 67 69 73 74 65 72 2d 74 65 73 sts:register-tes
4800: 74 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 t db run-id test
4810: 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 -name item-path)
4820: 0a 09 20 20 20 20 28 73 65 74 21 20 74 65 73 74 .. (set! test
4830: 64 61 74 20 28 64 62 3a 67 65 74 2d 74 65 73 74 dat (db:get-test
4840: 2d 69 6e 66 6f 20 64 62 20 72 75 6e 2d 69 64 20 -info db run-id
4850: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 test-name item-p
4860: 61 74 68 29 29 29 29 0a 20 20 20 20 20 20 28 63 ath)))). (c
4870: 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 79 20 hange-directory
4880: 74 65 73 74 2d 70 61 74 68 29 0a 20 20 20 20 20 test-path).
4890: 20 28 63 61 73 65 20 28 69 66 20 66 6f 72 63 65 (case (if force
48a0: 20 3b 3b 20 28 61 72 67 73 3a 67 65 74 2d 61 72 ;; (args:get-ar
48b0: 67 20 22 2d 66 6f 72 63 65 22 29 0a 09 09 27 4e g "-force")...'N
48c0: 4f 54 5f 53 54 41 52 54 45 44 0a 09 09 28 69 66 OT_STARTED...(if
48d0: 20 74 65 73 74 64 61 74 0a 09 09 20 20 20 20 28 testdat... (
48e0: 73 74 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c 20 28 string->symbol (
48f0: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 test:get-state t
4900: 65 73 74 64 61 74 29 29 0a 09 09 20 20 20 20 27 estdat))... '
4910: 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 72 74 failed-to-insert
4920: 29 29 0a 09 28 28 66 61 69 6c 65 64 2d 74 6f 2d ))..((failed-to-
4930: 69 6e 73 65 72 74 29 0a 09 20 28 64 65 62 75 67 insert).. (debug
4940: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a :print 0 "ERROR:
4950: 20 46 61 69 6c 65 64 20 74 6f 20 69 6e 73 65 72 Failed to inser
4960: 74 20 74 68 65 20 72 65 63 6f 72 64 20 69 6e 74 t the record int
4970: 6f 20 74 68 65 20 64 62 22 29 29 0a 09 28 28 4e o the db"))..((N
4980: 4f 54 5f 53 54 41 52 54 45 44 20 43 4f 4d 50 4c OT_STARTED COMPL
4990: 45 54 45 44 29 0a 09 20 28 64 65 62 75 67 3a 70 ETED).. (debug:p
49a0: 72 69 6e 74 20 36 20 22 47 6f 74 20 68 65 72 65 rint 6 "Got here
49b0: 2c 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 , " (test:get-st
49c0: 61 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 20 ate testdat))..
49d0: 28 6c 65 74 20 28 28 72 75 6e 66 6c 61 67 20 23 (let ((runflag #
49e0: 66 29 29 0a 09 20 20 20 28 63 6f 6e 64 0a 09 20 f)).. (cond..
49f0: 20 20 20 3b 3b 20 2d 66 6f 72 63 65 2c 20 72 75 ;; -force, ru
4a00: 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77 68 61 74 n no matter what
4a10: 0a 09 20 20 20 20 28 66 6f 72 63 65 20 28 73 65 .. (force (se
4a20: 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a t! runflag #t)).
4a30: 09 20 20 20 20 3b 3b 20 4e 4f 54 5f 53 54 41 52 . ;; NOT_STAR
4a40: 54 45 44 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 TED, run no matt
4a50: 65 72 20 77 68 61 74 0a 09 20 20 20 20 28 28 65 er what.. ((e
4a60: 71 75 61 6c 3f 20 28 74 65 73 74 3a 67 65 74 2d qual? (test:get-
4a70: 73 74 61 74 65 20 74 65 73 74 64 61 74 29 20 22 state testdat) "
4a80: 4e 4f 54 5f 53 54 41 52 54 45 44 22 29 28 73 65 NOT_STARTED")(se
4a90: 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a t! runflag #t)).
4aa0: 09 20 20 20 20 3b 3b 20 6e 6f 74 20 2d 72 65 72 . ;; not -rer
4ab0: 75 6e 20 61 6e 64 20 50 41 53 53 2c 20 57 41 52 un and PASS, WAR
4ac0: 4e 20 6f 72 20 43 48 45 43 4b 2c 20 64 6f 20 6e N or CHECK, do n
4ad0: 6f 20 72 75 6e 0a 09 20 20 20 20 28 28 61 6e 64 o run.. ((and
4ae0: 20 28 6f 72 20 28 6e 6f 74 20 72 65 72 75 6e 29 (or (not rerun)
4af0: 0a 09 09 20 20 20 20 20 20 6b 65 65 70 67 6f 69 ... keepgoi
4b00: 6e 67 29 0a 09 09 20 20 3b 3b 20 52 65 71 75 69 ng)... ;; Requi
4b10: 72 65 20 74 6f 20 66 6f 72 63 65 20 72 65 2d 72 re to force re-r
4b20: 75 6e 20 66 6f 72 20 43 4f 4d 50 4c 45 54 45 44 un for COMPLETED
4b30: 20 6f 72 20 2a 61 6e 79 74 68 69 6e 67 2a 20 2b or *anything* +
4b40: 20 50 41 53 53 2c 57 41 52 4e 20 6f 72 20 43 48 PASS,WARN or CH
4b50: 45 43 4b 0a 09 09 20 20 28 6f 72 20 28 6d 65 6d ECK... (or (mem
4b60: 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 ber (test:get-st
4b70: 61 74 75 73 20 74 65 73 74 64 61 74 29 20 27 28 atus testdat) '(
4b80: 22 50 41 53 53 22 20 22 57 41 52 4e 22 20 22 43 "PASS" "WARN" "C
4b90: 48 45 43 4b 22 29 29 0a 09 09 20 20 20 20 20 20 HECK"))...
4ba0: 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 (member (test:ge
4bb0: 74 2d 73 74 61 74 65 20 20 74 65 73 74 64 61 74 t-state testdat
4bc0: 29 20 27 28 22 43 4f 4d 50 4c 45 54 45 44 22 29 ) '("COMPLETED")
4bd0: 29 29 29 20 0a 09 20 20 20 20 20 28 64 65 62 75 ))) .. (debu
4be0: 67 3a 70 72 69 6e 74 20 32 20 22 49 4e 46 4f 3a g:print 2 "INFO:
4bf0: 20 72 75 6e 6e 69 6e 67 20 74 65 73 74 20 22 20 running test "
4c00: 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 test-name "/" it
4c10: 65 6d 2d 70 61 74 68 20 22 20 73 75 70 70 72 65 em-path " suppre
4c20: 73 73 65 64 20 61 73 20 69 74 20 69 73 20 43 4f ssed as it is CO
4c30: 4d 50 4c 45 54 45 44 20 61 6e 64 20 22 20 28 74 MPLETED and " (t
4c40: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 est:get-state te
4c50: 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 28 73 stdat)).. (s
4c60: 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 et! runflag #f))
4c70: 0a 09 20 20 20 20 3b 3b 20 2d 72 65 72 75 6e 20 .. ;; -rerun
4c80: 61 6e 64 20 73 74 61 74 75 73 20 69 73 20 6f 6e and status is on
4c90: 65 20 6f 66 20 74 68 65 20 73 70 65 63 69 66 65 e of the specife
4ca0: 64 2c 20 72 75 6e 20 69 74 0a 09 20 20 20 20 28 d, run it.. (
4cb0: 28 61 6e 64 20 72 65 72 75 6e 0a 09 09 20 20 28 (and rerun... (
4cc0: 6c 65 74 2a 20 28 28 72 65 72 75 6e 6c 73 74 20 let* ((rerunlst
4cd0: 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 (string-split
4ce0: 72 65 72 75 6e 20 22 2c 22 29 29 0a 09 09 09 20 rerun ","))....
4cf0: 28 6d 75 73 74 2d 72 65 72 75 6e 20 28 6d 65 6d (must-rerun (mem
4d00: 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 ber (test:get-st
4d10: 61 74 75 73 20 74 65 73 74 64 61 74 29 20 72 65 atus testdat) re
4d20: 72 75 6e 6c 73 74 29 29 29 0a 09 09 20 20 20 20 runlst)))...
4d30: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 33 20 22 (debug:print 3 "
4d40: 49 4e 46 4f 3a 20 2d 72 65 72 75 6e 20 6c 69 73 INFO: -rerun lis
4d50: 74 3a 20 22 20 72 65 72 75 6e 20 22 2c 20 74 65 t: " rerun ", te
4d60: 73 74 2d 73 74 61 74 75 73 3a 20 22 20 28 74 65 st-status: " (te
4d70: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 st:get-status te
4d80: 73 74 64 61 74 29 22 2c 20 6d 75 73 74 2d 72 65 stdat)", must-re
4d90: 72 75 6e 3a 20 22 20 6d 75 73 74 2d 72 65 72 75 run: " must-reru
4da0: 6e 29 0a 09 09 20 20 20 20 6d 75 73 74 2d 72 65 n)... must-re
4db0: 72 75 6e 29 29 0a 09 20 20 20 20 20 28 64 65 62 run)).. (deb
4dc0: 75 67 3a 70 72 69 6e 74 20 32 20 22 49 4e 46 4f ug:print 2 "INFO
4dd0: 3a 20 52 65 72 75 6e 20 66 6f 72 63 65 64 20 66 : Rerun forced f
4de0: 6f 72 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e or test " test-n
4df0: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 ame "/" item-pat
4e00: 68 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 h).. (set! r
4e10: 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 unflag #t))..
4e20: 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 2c 20 ;; -keepgoing,
4e30: 64 6f 20 6e 6f 74 20 72 65 72 75 6e 20 46 41 49 do not rerun FAI
4e40: 4c 0a 09 20 20 20 20 28 28 61 6e 64 20 6b 65 65 L.. ((and kee
4e50: 70 67 6f 69 6e 67 0a 09 09 20 20 28 6d 65 6d 62 pgoing... (memb
4e60: 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 er (test:get-sta
4e70: 74 75 73 20 74 65 73 74 64 61 74 29 20 27 28 22 tus testdat) '("
4e80: 46 41 49 4c 22 29 29 29 0a 09 20 20 20 20 20 28 FAIL"))).. (
4e90: 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 set! runflag #f)
4ea0: 29 0a 09 20 20 20 20 28 28 61 6e 64 20 28 6e 6f ).. ((and (no
4eb0: 74 20 72 65 72 75 6e 29 0a 09 09 20 20 28 6d 65 t rerun)... (me
4ec0: 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 mber (test:get-s
4ed0: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20 27 tatus testdat) '
4ee0: 28 22 46 41 49 4c 22 20 22 6e 2f 61 22 29 29 29 ("FAIL" "n/a")))
4ef0: 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 75 6e .. (set! run
4f00: 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 28 flag #t)).. (
4f10: 65 6c 73 65 20 28 73 65 74 21 20 72 75 6e 66 6c else (set! runfl
4f20: 61 67 20 23 66 29 29 29 0a 09 20 20 20 28 64 65 ag #f))).. (de
4f30: 62 75 67 3a 70 72 69 6e 74 20 36 20 22 52 55 4e bug:print 6 "RUN
4f40: 4e 49 4e 47 20 3d 3e 20 72 75 6e 66 6c 61 67 3a NING => runflag:
4f50: 20 22 20 72 75 6e 66 6c 61 67 20 22 20 53 54 41 " runflag " STA
4f60: 54 45 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d TE: " (test:get-
4f70: 73 74 61 74 65 20 74 65 73 74 64 61 74 29 20 22 state testdat) "
4f80: 20 53 54 41 54 55 53 3a 20 22 20 28 74 65 73 74 STATUS: " (test
4f90: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 :get-status test
4fa0: 64 61 74 29 29 0a 09 20 20 20 28 69 66 20 28 6e dat)).. (if (n
4fb0: 6f 74 20 72 75 6e 66 6c 61 67 29 0a 09 20 20 20 ot runflag)..
4fc0: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 70 61 72 (if (not par
4fd0: 65 6e 74 2d 74 65 73 74 29 0a 09 09 20 20 20 28 ent-test)... (
4fe0: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4e debug:print 1 "N
4ff0: 4f 54 45 3a 20 4e 6f 74 20 73 74 61 72 74 69 6e OTE: Not startin
5000: 67 20 74 65 73 74 20 22 20 6e 65 77 2d 74 65 73 g test " new-tes
5010: 74 2d 6e 61 6d 65 20 22 20 61 73 20 69 74 20 69 t-name " as it i
5020: 73 20 73 74 61 74 65 20 5c 22 22 20 28 74 65 73 s state \"" (tes
5030: 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 t:get-state test
5040: 64 61 74 29 20 0a 09 09 09 09 22 5c 22 20 61 6e dat) ....."\" an
5050: 64 20 73 74 61 74 75 73 20 5c 22 22 20 28 74 65 d status \"" (te
5060: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 st:get-status te
5070: 73 74 64 61 74 29 20 22 5c 22 2c 20 75 73 65 20 stdat) "\", use
5080: 2d 72 65 72 75 6e 20 5c 22 22 20 28 74 65 73 74 -rerun \"" (test
5090: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 :get-status test
50a0: 64 61 74 29 20 22 5c 22 20 6f 72 20 2d 66 6f 72 dat) "\" or -for
50b0: 63 65 20 74 6f 20 6f 76 65 72 72 69 64 65 22 29 ce to override")
50c0: 29 0a 09 20 20 20 20 20 20 20 3b 3b 20 4e 4f 54 ).. ;; NOT
50d0: 45 3a 20 4e 6f 20 6c 6f 6e 67 65 72 20 62 65 20 E: No longer be
50e0: 63 68 65 63 6b 69 6e 67 20 70 72 65 72 65 71 75 checking prerequ
50f0: 69 73 69 74 65 73 20 68 65 72 65 21 20 57 69 6c isites here! Wil
5100: 6c 20 6e 65 76 65 72 20 67 65 74 20 68 65 72 65 l never get here
5110: 20 75 6e 6c 65 73 73 20 70 72 65 72 65 71 73 20 unless prereqs
5120: 61 72 65 0a 09 20 20 20 20 20 20 20 3b 3b 20 20 are.. ;;
5130: 20 20 20 20 20 61 6c 72 65 61 64 79 20 6d 65 74 already met
5140: 2e 0a 09 20 20 20 20 20 20 20 28 69 66 20 28 6e ... (if (n
5150: 6f 74 20 28 6c 61 75 6e 63 68 2d 74 65 73 74 20 ot (launch-test
5160: 64 62 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d db run-id runnam
5170: 65 20 74 65 73 74 2d 63 6f 6e 66 20 6b 65 79 76 e test-conf keyv
5180: 61 6c 6c 73 74 20 74 65 73 74 2d 6e 61 6d 65 20 allst test-name
5190: 74 65 73 74 2d 70 61 74 68 20 69 74 65 6d 64 61 test-path itemda
51a0: 74 20 66 6c 61 67 73 29 29 0a 09 09 20 20 20 28 t flags))... (
51b0: 62 65 67 69 6e 0a 09 09 20 20 20 20 20 28 70 72 begin... (pr
51c0: 69 6e 74 20 22 45 52 52 4f 52 3a 20 46 61 69 6c int "ERROR: Fail
51d0: 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 68 65 ed to launch the
51e0: 20 74 65 73 74 2e 20 45 78 69 74 69 6e 67 20 61 test. Exiting a
51f0: 73 20 73 6f 6f 6e 20 61 73 20 70 6f 73 73 69 62 s soon as possib
5200: 6c 65 22 29 0a 09 09 20 20 20 20 20 28 73 65 74 le")... (set
5210: 21 20 2a 67 6c 6f 62 61 6c 65 78 69 74 73 74 61 ! *globalexitsta
5220: 74 75 73 2a 20 31 29 20 3b 3b 20 0a 09 09 20 20 tus* 1) ;; ...
5230: 20 20 20 28 70 72 6f 63 65 73 73 2d 73 69 67 6e (process-sign
5240: 61 6c 20 28 63 75 72 72 65 6e 74 2d 70 72 6f 63 al (current-proc
5250: 65 73 73 2d 69 64 29 20 73 69 67 6e 61 6c 2f 6b ess-id) signal/k
5260: 69 6c 6c 29 29 29 29 29 29 0a 09 28 28 4b 49 4c ill))))))..((KIL
5270: 4c 45 44 29 20 0a 09 20 28 64 65 62 75 67 3a 70 LED) .. (debug:p
5280: 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 22 20 rint 1 "NOTE: "
5290: 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 new-test-name "
52a0: 69 73 20 61 6c 72 65 61 64 79 20 72 75 6e 6e 69 is already runni
52b0: 6e 67 20 6f 72 20 77 61 73 20 65 78 70 6c 69 63 ng or was explic
52c0: 74 6c 79 20 6b 69 6c 6c 65 64 2c 20 75 73 65 20 tly killed, use
52d0: 2d 66 6f 72 63 65 20 74 6f 20 6c 61 75 6e 63 68 -force to launch
52e0: 20 69 74 2e 22 29 29 0a 09 28 28 4c 41 55 4e 43 it."))..((LAUNC
52f0: 48 45 44 20 52 45 4d 4f 54 45 48 4f 53 54 53 54 HED REMOTEHOSTST
5300: 41 52 54 20 52 55 4e 4e 49 4e 47 29 20 20 0a 09 ART RUNNING) ..
5310: 20 28 69 66 20 28 3e 20 28 2d 20 28 63 75 72 72 (if (> (- (curr
5320: 65 6e 74 2d 73 65 63 6f 6e 64 73 29 28 2b 20 28 ent-seconds)(+ (
5330: 64 62 3a 74 65 73 74 2d 67 65 74 2d 65 76 65 6e db:test-get-even
5340: 74 5f 74 69 6d 65 20 74 65 73 74 64 61 74 29 0a t_time testdat).
5350: 09 09 09 09 20 20 20 20 20 20 20 28 64 62 3a 74 .... (db:t
5360: 65 73 74 2d 67 65 74 2d 72 75 6e 5f 64 75 72 61 est-get-run_dura
5370: 74 69 6f 6e 20 74 65 73 74 64 61 74 29 29 29 0a tion testdat))).
5380: 09 09 36 30 30 29 20 3b 3b 20 69 2e 65 2e 20 6e ..600) ;; i.e. n
5390: 6f 20 75 70 64 61 74 65 20 66 6f 72 20 6d 6f 72 o update for mor
53a0: 65 20 74 68 61 6e 20 36 30 30 20 73 65 63 6f 6e e than 600 secon
53b0: 64 73 0a 09 20 20 20 20 20 28 62 65 67 69 6e 0a ds.. (begin.
53c0: 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 . (debug:p
53d0: 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a rint 0 "WARNING:
53e0: 20 54 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d Test " test-nam
53f0: 65 20 22 20 61 70 70 65 61 72 73 20 74 6f 20 62 e " appears to b
5400: 65 20 64 65 61 64 2e 20 46 6f 72 63 69 6e 67 20 e dead. Forcing
5410: 69 74 20 74 6f 20 73 74 61 74 65 20 49 4e 43 4f it to state INCO
5420: 4d 50 4c 45 54 45 20 61 6e 64 20 73 74 61 74 75 MPLETE and statu
5430: 73 20 53 54 55 43 4b 2f 44 45 41 44 22 29 0a 09 s STUCK/DEAD")..
5440: 20 20 20 20 20 20 20 28 74 65 73 74 2d 73 65 74 (test-set
5450: 2d 73 74 61 74 75 73 21 20 64 62 20 72 75 6e 2d -status! db run-
5460: 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 22 49 4e id test-name "IN
5470: 43 4f 4d 50 4c 45 54 45 22 20 22 53 54 55 43 4b COMPLETE" "STUCK
5480: 2f 44 45 41 44 22 20 69 74 65 6d 64 61 74 20 22 /DEAD" itemdat "
5490: 54 65 73 74 20 69 73 20 73 74 75 63 6b 20 6f 72 Test is stuck or
54a0: 20 64 65 61 64 22 20 23 66 29 29 0a 09 20 20 20 dead" #f))..
54b0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 (debug:print 2
54c0: 20 22 4e 4f 54 45 3a 20 22 20 74 65 73 74 2d 6e "NOTE: " test-n
54d0: 61 6d 65 20 22 20 69 73 20 61 6c 72 65 61 64 79 ame " is already
54e0: 20 72 75 6e 6e 69 6e 67 22 29 29 29 0a 09 28 65 running")))..(e
54f0: 6c 73 65 20 20 20 20 20 20 20 28 64 65 62 75 67 lse (debug
5500: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a :print 0 "ERROR:
5510: 20 46 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 Failed to launc
5520: 68 20 74 65 73 74 20 22 20 6e 65 77 2d 74 65 73 h test " new-tes
5530: 74 2d 6e 61 6d 65 20 22 2e 20 55 6e 72 65 63 6f t-name ". Unreco
5540: 67 6e 69 73 65 64 20 73 74 61 74 65 20 22 20 28 gnised state " (
5550: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 test:get-state t
5560: 65 73 74 64 61 74 29 29 29 29 29 29 29 0a 0a 3b estdat)))))))..;
5570: 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;===============
5580: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5590: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
55a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
55b0: 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 45 4e 44 20 4f =======.;; END O
55c0: 46 20 4e 45 57 20 53 54 55 46 46 0a 3b 3b 3d 3d F NEW STUFF.;;==
55d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
55e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
55f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5600: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5610: 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65 20 28 67 ====..(define (g
5620: 65 74 2d 64 69 72 2d 75 70 2d 6e 20 64 69 72 20 et-dir-up-n dir
5630: 2e 20 70 61 72 61 6d 73 29 20 0a 20 20 28 6c 65 . params) . (le
5640: 74 20 28 28 64 70 61 72 74 73 20 20 28 73 74 72 t ((dparts (str
5650: 69 6e 67 2d 73 70 6c 69 74 20 64 69 72 20 22 2f ing-split dir "/
5660: 22 29 29 0a 09 28 63 6f 75 6e 74 20 20 20 28 69 "))..(count (i
5670: 66 20 28 6e 75 6c 6c 3f 20 70 61 72 61 6d 73 29 f (null? params)
5680: 20 31 20 28 63 61 72 20 70 61 72 61 6d 73 29 29 1 (car params))
5690: 29 29 0a 20 20 20 20 28 63 6f 6e 63 20 22 2f 22 )). (conc "/"
56a0: 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 (string-intersp
56b0: 65 72 73 65 20 0a 09 20 20 20 20 20 20 20 28 74 erse .. (t
56c0: 61 6b 65 20 64 70 61 72 74 73 20 28 2d 20 28 6c ake dparts (- (l
56d0: 65 6e 67 74 68 20 64 70 61 72 74 73 29 20 63 6f ength dparts) co
56e0: 75 6e 74 29 29 0a 09 20 20 20 20 20 20 20 22 2f unt)).. "/
56f0: 22 29 29 29 29 0a 3b 3b 20 52 65 6d 6f 76 65 20 ")))).;; Remove
5700: 72 75 6e 73 0a 3b 3b 20 66 69 65 6c 64 73 20 61 runs.;; fields a
5710: 72 65 20 70 61 73 73 69 6e 67 20 69 6e 20 74 68 re passing in th
5720: 72 6f 75 67 68 20 0a 28 64 65 66 69 6e 65 20 28 rough .(define (
5730: 72 75 6e 73 3a 72 65 6d 6f 76 65 2d 72 75 6e 73 runs:remove-runs
5740: 20 64 62 20 72 75 6e 6e 61 6d 65 70 61 74 74 20 db runnamepatt
5750: 74 65 73 74 70 61 74 74 20 69 74 65 6d 70 61 74 testpatt itempat
5760: 74 29 0a 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 t). (let* ((key
5770: 73 20 20 20 20 20 20 20 20 28 72 64 62 3a 67 65 s (rdb:ge
5780: 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 20 28 72 t-keys db)).. (r
5790: 75 6e 64 61 74 20 20 20 20 20 20 28 72 75 6e 73 undat (runs
57a0: 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74 :get-runs-by-pat
57b0: 74 20 64 62 20 6b 65 79 73 20 72 75 6e 6e 61 6d t db keys runnam
57c0: 65 70 61 74 74 29 29 0a 09 20 28 68 65 61 64 65 epatt)).. (heade
57d0: 72 20 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 r (vector-r
57e0: 65 66 20 72 75 6e 64 61 74 20 30 29 29 0a 09 20 ef rundat 0))..
57f0: 28 72 75 6e 73 20 20 20 20 20 20 20 20 28 76 65 (runs (ve
5800: 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 ctor-ref rundat
5810: 31 29 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 1))). (debug:
5820: 70 72 69 6e 74 20 31 20 22 48 65 61 64 65 72 3a print 1 "Header:
5830: 20 22 20 68 65 61 64 65 72 29 0a 20 20 20 20 28 " header). (
5840: 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 28 6c for-each. (l
5850: 61 6d 62 64 61 20 28 72 75 6e 29 0a 20 20 20 20 ambda (run).
5860: 20 20 20 28 6c 65 74 20 28 28 72 75 6e 6b 65 79 (let ((runkey
5870: 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 (string-intersp
5880: 65 72 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 erse (map (lambd
5890: 61 20 28 6b 29 0a 09 09 09 09 09 09 28 64 62 3a a (k).......(db:
58a0: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 get-value-by-hea
58b0: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 28 der run header (
58c0: 76 65 63 74 6f 72 2d 72 65 66 20 6b 20 30 29 29 vector-ref k 0))
58d0: 29 20 6b 65 79 73 29 20 22 2f 22 29 29 0a 09 20 ) keys) "/"))..
58e0: 20 20 20 20 28 64 69 72 73 2d 74 6f 2d 72 65 6d (dirs-to-rem
58f0: 6f 76 65 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 ove (make-hash-t
5900: 61 62 6c 65 29 29 29 0a 09 20 28 6c 65 74 2a 20 able))).. (let*
5910: 28 28 72 75 6e 2d 69 64 20 28 64 62 3a 67 65 74 ((run-id (db:get
5920: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 -value-by-header
5930: 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 22 run header "id"
5940: 29 20 29 0a 09 09 28 74 65 73 74 73 20 20 28 72 ) )...(tests (r
5950: 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 db:get-tests-for
5960: 2d 72 75 6e 20 64 62 20 28 64 62 3a 67 65 74 2d -run db (db:get-
5970: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 value-by-header
5980: 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 22 29 run header "id")
5990: 20 74 65 73 74 70 61 74 74 20 69 74 65 6d 70 61 testpatt itempa
59a0: 74 74 20 27 28 29 20 27 28 29 29 29 0a 09 09 28 tt '() '()))...(
59b0: 6c 61 73 74 74 70 61 74 68 20 22 2f 64 6f 65 73 lasttpath "/does
59c0: 2f 6e 6f 74 2f 65 78 69 73 74 2f 49 2f 68 6f 70 /not/exist/I/hop
59d0: 65 22 29 29 0a 0a 09 20 20 20 28 69 66 20 28 6e e"))... (if (n
59e0: 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 73 74 73 29 ot (null? tests)
59f0: 29 0a 09 20 20 20 20 20 20 20 28 62 65 67 69 6e ).. (begin
5a00: 0a 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 ... (debug:print
5a10: 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 74 65 73 1 "Removing tes
5a20: 74 73 20 66 6f 72 20 72 75 6e 3a 20 22 20 72 75 ts for run: " ru
5a30: 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74 nkey " " (db:get
5a40: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 -value-by-header
5a50: 20 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e run header "run
5a60: 6e 61 6d 65 22 29 29 0a 09 09 20 28 66 6f 72 2d name"))... (for-
5a70: 65 61 63 68 0a 09 09 20 20 28 6c 61 6d 62 64 61 each... (lambda
5a80: 20 28 74 65 73 74 29 0a 09 09 20 20 20 20 28 6c (test)... (l
5a90: 65 74 2a 20 28 28 69 74 65 6d 2d 70 61 74 68 20 et* ((item-path
5aa0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 (db:test-get-ite
5ab0: 6d 2d 70 61 74 68 20 74 65 73 74 29 29 0a 09 09 m-path test))...
5ac0: 09 20 20 20 28 74 65 73 74 2d 6e 61 6d 65 20 28 . (test-name (
5ad0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 db:test-get-test
5ae0: 6e 61 6d 65 20 74 65 73 74 29 29 0a 09 09 09 20 name test))....
5af0: 20 20 28 72 75 6e 2d 64 69 72 20 20 20 28 64 62 (run-dir (db
5b00: 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 64 69 72 :test-get-rundir
5b10: 20 74 65 73 74 29 29 29 0a 09 09 20 20 20 20 20 test)))...
5b20: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 (debug:print 1
5b30: 22 20 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 " " (db:test-ge
5b40: 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29 t-testname test)
5b50: 20 22 20 69 64 3a 20 22 20 28 64 62 3a 74 65 73 " id: " (db:tes
5b60: 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29 20 22 t-get-id test) "
5b70: 20 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 09 " item-path)...
5b80: 20 20 20 20 20 20 28 72 64 62 3a 64 65 6c 65 74 (rdb:delet
5b90: 65 2d 74 65 73 74 2d 72 65 63 6f 72 64 73 20 64 e-test-records d
5ba0: 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 b (db:test-get-i
5bb0: 64 20 74 65 73 74 29 29 0a 09 09 20 20 20 20 20 d test))...
5bc0: 20 28 69 66 20 28 3e 20 28 73 74 72 69 6e 67 2d (if (> (string-
5bd0: 6c 65 6e 67 74 68 20 72 75 6e 2d 64 69 72 29 20 length run-dir)
5be0: 35 29 20 3b 3b 20 62 61 64 20 68 65 75 72 69 73 5) ;; bad heuris
5bf0: 74 69 63 20 62 75 74 20 73 68 6f 75 6c 64 20 70 tic but should p
5c00: 72 65 76 65 6e 74 20 2f 74 6d 70 20 2f 68 6f 6d revent /tmp /hom
5c10: 65 20 65 74 63 2e 0a 09 09 09 20 20 28 6c 65 74 e etc..... (let
5c20: 20 28 28 66 75 6c 6c 70 61 74 68 20 72 75 6e 2d ((fullpath run-
5c30: 64 69 72 29 29 20 3b 3b 20 22 2f 22 20 28 64 62 dir)) ;; "/" (db
5c40: 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 :test-get-item-p
5c50: 61 74 68 20 74 65 73 74 29 29 29 29 0a 09 09 09 ath test))))....
5c60: 20 20 20 20 28 73 65 74 21 20 6c 61 73 74 74 70 (set! lasttp
5c70: 61 74 68 20 66 75 6c 6c 70 61 74 68 29 0a 09 09 ath fullpath)...
5c80: 09 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 . (hash-table
5c90: 2d 73 65 74 21 20 64 69 72 73 2d 74 6f 2d 72 65 -set! dirs-to-re
5ca0: 6d 6f 76 65 20 66 75 6c 6c 70 61 74 68 20 23 74 move fullpath #t
5cb0: 29 0a 09 09 09 20 20 20 20 3b 3b 20 54 68 65 20 ).... ;; The
5cc0: 66 6f 6c 6c 6f 77 69 6e 67 20 77 61 73 20 74 68 following was th
5cd0: 65 20 73 61 66 65 20 64 65 6c 65 74 65 20 63 6f e safe delete co
5ce0: 64 65 20 62 75 74 20 69 74 20 77 61 73 20 6e 6f de but it was no
5cf0: 74 20 62 65 69 6e 67 20 65 78 65 63 74 75 74 65 t being exectute
5d00: 64 2e 0a 09 09 09 20 20 20 20 3b 3b 20 28 6c 65 d..... ;; (le
5d10: 74 2a 20 28 28 64 69 72 73 2d 63 6f 75 6e 74 20 t* ((dirs-count
5d20: 28 2b 20 31 20 28 6c 65 6e 67 74 68 20 6b 65 79 (+ 1 (length key
5d30: 73 29 28 6c 65 6e 67 74 68 20 28 73 74 72 69 6e s)(length (strin
5d40: 67 2d 73 70 6c 69 74 20 69 74 65 6d 2d 70 61 74 g-split item-pat
5d50: 68 20 22 2f 22 29 29 29 29 0a 09 09 09 20 20 20 h "/"))))....
5d60: 20 3b 3b 20 20 20 20 20 20 20 20 28 64 69 72 2d ;; (dir-
5d70: 74 6f 2d 72 65 6d 20 28 67 65 74 2d 64 69 72 2d to-rem (get-dir-
5d80: 75 70 2d 6e 20 66 75 6c 6c 70 61 74 68 20 64 69 up-n fullpath di
5d90: 72 73 2d 63 6f 75 6e 74 29 29 0a 09 09 09 20 20 rs-count))....
5da0: 20 20 3b 3b 20 20 20 20 20 20 20 20 28 72 65 6d ;; (rem
5db0: 61 69 6e 69 6e 67 64 20 28 73 74 72 69 6e 67 2d ainingd (string-
5dc0: 73 75 62 73 74 69 74 75 74 65 20 28 72 65 67 65 substitute (rege
5dd0: 78 70 20 28 63 6f 6e 63 20 22 5e 22 20 64 69 72 xp (conc "^" dir
5de0: 2d 74 6f 2d 72 65 6d 20 22 2f 22 29 29 20 22 22 -to-rem "/")) ""
5df0: 20 66 75 6c 6c 70 61 74 68 29 29 0a 09 09 09 20 fullpath))....
5e00: 20 20 20 3b 3b 20 20 20 20 20 20 20 20 28 63 6d ;; (cm
5e10: 64 20 28 63 6f 6e 63 20 22 63 64 20 22 20 64 69 d (conc "cd " di
5e20: 72 2d 74 6f 2d 72 65 6d 20 22 3b 20 72 6d 64 69 r-to-rem "; rmdi
5e30: 72 20 2d 70 20 22 20 72 65 6d 61 69 6e 69 6e 67 r -p " remaining
5e40: 64 20 29 29 29 0a 09 09 09 20 20 20 20 3b 3b 20 d ))).... ;;
5e50: 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 (if (file-exis
5e60: 74 73 3f 20 66 75 6c 6c 70 61 74 68 29 0a 09 09 ts? fullpath)...
5e70: 09 20 20 20 20 3b 3b 20 20 20 20 20 20 20 28 62 . ;; (b
5e80: 65 67 69 6e 0a 09 09 09 20 20 20 20 3b 3b 20 20 egin.... ;;
5e90: 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 (debug:pr
5ea0: 69 6e 74 20 31 20 63 6d 64 29 0a 09 09 09 20 20 int 1 cmd)....
5eb0: 20 20 3b 3b 20 20 20 20 20 20 20 20 20 28 73 79 ;; (sy
5ec0: 73 74 65 6d 20 63 6d 64 29 29 29 0a 09 09 09 20 stem cmd)))....
5ed0: 20 20 20 3b 3b 20 20 20 29 29 0a 09 09 09 20 20 ;; ))....
5ee0: 20 20 29 29 29 29 0a 09 09 20 20 20 20 74 65 73 ))))... tes
5ef0: 74 73 29 29 29 0a 0a 09 20 20 20 3b 3b 20 6c 6f ts)))... ;; lo
5f00: 6f 6b 20 74 68 6f 75 67 68 20 74 68 65 20 64 69 ok though the di
5f10: 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 66 6f 72 rs-to-remove for
5f20: 20 63 61 6e 64 69 64 61 74 65 73 20 66 6f 72 20 candidates for
5f30: 72 65 6d 6f 76 61 6c 2e 20 44 6f 20 74 68 69 73 removal. Do this
5f40: 20 61 66 74 65 72 20 64 65 6c 65 74 69 6e 67 20 after deleting
5f50: 74 68 65 20 72 65 63 6f 72 64 73 0a 09 20 20 20 the records..
5f60: 3b 3b 20 66 6f 72 20 65 61 63 68 20 74 65 73 74 ;; for each test
5f70: 20 69 6e 20 63 61 73 65 20 77 65 20 67 65 74 20 in case we get
5f80: 6b 69 6c 6c 65 64 2e 20 54 68 61 74 20 73 68 6f killed. That sho
5f90: 75 6c 64 20 6d 69 6e 69 6d 69 7a 65 20 74 68 65 uld minimize the
5fa0: 20 64 65 74 72 69 74 75 73 20 6c 65 66 74 20 6f detritus left o
5fb0: 6e 20 64 69 73 6b 0a 09 20 20 20 3b 3b 20 70 72 n disk.. ;; pr
5fc0: 6f 63 65 73 73 20 74 68 65 20 64 69 72 73 20 66 ocess the dirs f
5fd0: 72 6f 6d 20 6c 6f 6e 67 65 73 74 20 73 74 72 69 rom longest stri
5fe0: 6e 67 20 6c 65 6e 67 74 68 20 74 6f 20 73 68 6f ng length to sho
5ff0: 72 74 65 73 74 0a 09 20 20 20 28 66 6f 72 2d 65 rtest.. (for-e
6000: 61 63 68 20 0a 09 20 20 20 20 28 6c 61 6d 62 64 ach .. (lambd
6010: 61 20 28 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 a (dir-to-remove
6020: 29 0a 09 20 20 20 20 20 20 28 69 66 20 28 66 69 ).. (if (fi
6030: 6c 65 2d 65 78 69 73 74 73 3f 20 64 69 72 2d 74 le-exists? dir-t
6040: 6f 2d 72 65 6d 6f 76 65 29 0a 09 09 20 20 28 6c o-remove)... (l
6050: 65 74 20 28 28 64 69 72 2d 69 6e 2d 64 62 20 27 et ((dir-in-db '
6060: 28 29 29 29 0a 09 09 20 20 20 20 28 73 71 6c 69 ()))... (sqli
6070: 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 te3:for-each-row
6080: 0a 09 09 20 20 20 20 20 28 6c 61 6d 62 64 61 20 ... (lambda
6090: 28 64 69 72 29 0a 09 09 20 20 20 20 20 20 20 28 (dir)... (
60a0: 73 65 74 21 20 64 69 72 2d 69 6e 2d 64 62 20 28 set! dir-in-db (
60b0: 63 6f 6e 73 20 64 69 72 20 64 69 72 2d 69 6e 2d cons dir dir-in-
60c0: 64 62 29 29 29 0a 09 09 20 20 20 20 20 64 62 20 db)))... db
60d0: 22 53 45 4c 45 43 54 20 72 75 6e 64 69 72 20 46 "SELECT rundir F
60e0: 52 4f 4d 20 74 65 73 74 73 20 57 48 45 52 45 20 ROM tests WHERE
60f0: 72 75 6e 64 69 72 20 4c 49 4b 45 20 3f 3b 22 20 rundir LIKE ?;"
6100: 0a 09 09 20 20 20 20 20 28 63 6f 6e 63 20 22 25 ... (conc "%
6110: 22 20 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 20 " dir-to-remove
6120: 22 25 22 29 29 20 3b 3b 20 79 65 73 2c 20 49 27 "%")) ;; yes, I'
6130: 6d 20 67 6f 69 6e 67 20 74 6f 20 62 61 69 6c 20 m going to bail
6140: 69 66 20 74 68 65 72 65 20 69 73 20 61 6e 79 74 if there is anyt
6150: 68 69 6e 67 20 6c 69 6b 65 20 74 68 69 73 20 64 hing like this d
6160: 69 72 20 69 6e 20 74 68 65 20 64 62 0a 09 09 20 ir in the db...
6170: 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 64 69 (if (null? di
6180: 72 2d 69 6e 2d 64 62 29 0a 09 09 09 28 62 65 67 r-in-db)....(beg
6190: 69 6e 0a 09 09 09 20 20 28 64 65 62 75 67 3a 70 in.... (debug:p
61a0: 72 69 6e 74 20 32 20 22 52 65 6d 6f 76 69 6e 67 rint 2 "Removing
61b0: 20 64 69 72 65 63 74 6f 72 79 20 77 69 74 68 20 directory with
61c0: 7a 65 72 6f 20 64 62 20 72 65 66 65 72 65 6e 63 zero db referenc
61d0: 65 73 3a 20 22 20 64 69 72 2d 74 6f 2d 72 65 6d es: " dir-to-rem
61e0: 6f 76 65 29 0a 09 09 09 20 20 28 73 79 73 74 65 ove).... (syste
61f0: 6d 20 28 63 6f 6e 63 20 22 72 6d 20 2d 72 66 20 m (conc "rm -rf
6200: 22 20 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 29 " dir-to-remove)
6210: 29 0a 09 09 09 20 20 28 68 61 73 68 2d 74 61 62 ).... (hash-tab
6220: 6c 65 2d 64 65 6c 65 74 65 21 20 64 69 72 73 2d le-delete! dirs-
6230: 74 6f 2d 72 65 6d 6f 76 65 20 64 69 72 2d 74 6f to-remove dir-to
6240: 2d 72 65 6d 6f 76 65 29 29 0a 09 09 09 28 64 65 -remove))....(de
6250: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 53 6b 69 bug:print 2 "Ski
6260: 70 70 69 6e 67 20 72 65 6d 6f 76 61 6c 20 6f 66 pping removal of
6270: 20 22 20 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 " dir-to-remove
6280: 20 22 20 66 6f 72 20 6e 6f 77 20 61 73 20 69 74 " for now as it
6290: 20 73 74 69 6c 6c 20 68 61 73 20 72 65 66 65 72 still has refer
62a0: 65 6e 63 65 73 20 69 6e 20 74 68 65 20 64 61 74 ences in the dat
62b0: 61 62 61 73 65 22 29 29 29 29 29 0a 09 20 20 20 abase")))))..
62c0: 20 28 73 6f 72 74 20 28 68 61 73 68 2d 74 61 62 (sort (hash-tab
62d0: 6c 65 2d 6b 65 79 73 20 64 69 72 73 2d 74 6f 2d le-keys dirs-to-
62e0: 72 65 6d 6f 76 65 29 20 28 6c 61 6d 62 64 61 20 remove) (lambda
62f0: 28 61 20 62 29 28 3e 20 28 73 74 72 69 6e 67 2d (a b)(> (string-
6300: 6c 65 6e 67 74 68 20 61 29 28 73 74 72 69 6e 67 length a)(string
6310: 2d 6c 65 6e 67 74 68 20 62 29 29 29 29 29 0a 0a -length b)))))..
6320: 09 20 20 20 3b 3b 20 72 65 6d 6f 76 65 20 74 68 . ;; remove th
6330: 65 20 72 75 6e 20 69 66 20 7a 65 72 6f 20 74 65 e run if zero te
6340: 73 74 73 20 72 65 6d 61 69 6e 0a 09 20 20 20 28 sts remain.. (
6350: 6c 65 74 20 28 28 72 65 6d 74 65 73 74 73 20 28 let ((remtests (
6360: 72 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f rdb:get-tests-fo
6370: 72 2d 72 75 6e 20 64 62 20 28 64 62 3a 67 65 74 r-run db (db:get
6380: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 -value-by-header
6390: 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 22 run header "id"
63a0: 29 20 23 66 20 23 66 20 27 28 29 20 27 28 29 29 ) #f #f '() '())
63b0: 29 29 0a 09 20 20 20 20 20 28 69 66 20 28 6e 75 )).. (if (nu
63c0: 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29 20 3b 3b ll? remtests) ;;
63d0: 20 6e 6f 20 6d 6f 72 65 20 74 65 73 74 73 20 72 no more tests r
63e0: 65 6d 61 69 6e 69 6e 67 0a 09 09 20 28 6c 65 74 emaining... (let
63f0: 2a 20 28 28 64 70 61 72 74 73 20 20 28 73 74 72 * ((dparts (str
6400: 69 6e 67 2d 73 70 6c 69 74 20 6c 61 73 74 74 70 ing-split lasttp
6410: 61 74 68 20 22 2f 22 29 29 0a 09 09 09 28 72 75 ath "/"))....(ru
6420: 6e 70 61 74 68 20 28 63 6f 6e 63 20 22 2f 22 20 npath (conc "/"
6430: 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 (string-interspe
6440: 72 73 65 20 0a 09 09 09 09 09 20 20 20 20 28 74 rse ...... (t
6450: 61 6b 65 20 64 70 61 72 74 73 20 28 2d 20 28 6c ake dparts (- (l
6460: 65 6e 67 74 68 20 64 70 61 72 74 73 29 20 31 29 ength dparts) 1)
6470: 29 0a 09 09 09 09 09 20 20 20 20 22 2f 22 29 29 )...... "/"))
6480: 29 29 0a 09 09 20 20 20 28 64 65 62 75 67 3a 70 ))... (debug:p
6490: 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 rint 1 "Removing
64a0: 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 run: " runkey "
64b0: 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 " (db:get-value
64c0: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 -by-header run h
64d0: 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 eader "runname")
64e0: 29 0a 09 09 20 20 20 28 64 62 3a 64 65 6c 65 74 )... (db:delet
64f0: 65 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 29 e-run db run-id)
6500: 0a 09 09 20 20 20 3b 3b 20 6e 65 65 64 20 74 6f ... ;; need to
6510: 20 66 69 67 75 72 65 20 6f 75 74 20 74 68 65 20 figure out the
6520: 70 61 74 68 20 74 6f 20 74 68 65 20 72 75 6e 20 path to the run
6530: 64 69 72 20 61 6e 64 20 72 65 6d 6f 76 65 20 69 dir and remove i
6540: 74 20 69 66 20 65 6d 70 74 79 0a 09 09 20 20 20 t if empty...
6550: 3b 3b 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f ;; (if (null?
6560: 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20 72 75 6e (glob (conc run
6570: 70 61 74 68 20 22 2f 2a 22 29 29 29 0a 09 09 20 path "/*")))...
6580: 20 20 3b 3b 20 20 20 20 20 20 20 20 28 62 65 67 ;; (beg
6590: 69 6e 0a 09 09 20 20 20 3b 3b 20 09 20 28 64 65 in... ;; . (de
65a0: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d bug:print 1 "Rem
65b0: 6f 76 69 6e 67 20 72 75 6e 20 64 69 72 20 22 20 oving run dir "
65c0: 72 75 6e 70 61 74 68 29 0a 09 09 20 20 20 3b 3b runpath)... ;;
65d0: 20 09 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 . (system (conc
65e0: 20 22 72 6d 64 69 72 20 2d 70 20 22 20 72 75 6e "rmdir -p " run
65f0: 70 61 74 68 29 29 29 29 0a 09 09 20 20 20 29 29 path))))... ))
6600: 29 29 0a 09 20 29 29 0a 20 20 20 20 20 72 75 6e )).. )). run
6610: 73 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d s)))..;;========
6620: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6630: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6640: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6650: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b ==============.;
6660: 3b 20 52 6f 75 74 69 6e 65 73 20 66 6f 72 20 6d ; Routines for m
6670: 61 6e 69 70 75 6c 61 74 69 6e 67 20 72 75 6e 73 anipulating runs
6680: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d .;;=============
6690: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
66a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
66b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
66c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 53 69 =========..;; Si
66d0: 6e 63 65 20 6d 61 6e 79 20 63 61 6c 6c 73 20 74 nce many calls t
66e0: 6f 20 61 20 72 75 6e 20 72 65 71 75 69 72 65 20 o a run require
66f0: 70 72 65 74 74 79 20 6d 75 63 68 20 74 68 65 20 pretty much the
6700: 73 61 6d 65 20 73 65 74 75 70 20 0a 3b 3b 20 74 same setup .;; t
6710: 68 69 73 20 77 72 61 70 70 65 72 20 69 73 20 75 his wrapper is u
6720: 73 65 64 20 74 6f 20 72 65 64 75 63 65 20 74 68 sed to reduce th
6730: 65 20 72 65 70 6c 69 63 61 74 69 6f 6e 20 6f 66 e replication of
6740: 20 63 6f 64 65 0a 28 64 65 66 69 6e 65 20 28 67 code.(define (g
6750: 65 6e 65 72 61 6c 2d 72 75 6e 2d 63 61 6c 6c 20 eneral-run-call
6760: 73 77 69 74 63 68 6e 61 6d 65 20 61 63 74 69 6f switchname actio
6770: 6e 2d 64 65 73 63 20 70 72 6f 63 29 0a 20 20 28 n-desc proc). (
6780: 6c 65 74 20 28 28 72 75 6e 6e 61 6d 65 20 28 61 let ((runname (a
6790: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 3a 72 75 rgs:get-arg ":ru
67a0: 6e 6e 61 6d 65 22 29 29 0a 09 28 74 61 72 67 65 nname"))..(targe
67b0: 74 20 20 28 69 66 20 28 61 72 67 73 3a 67 65 74 t (if (args:get
67c0: 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 29 0a -arg "-target").
67d0: 09 09 20 20 20 20 20 28 61 72 67 73 3a 67 65 74 .. (args:get
67e0: 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 29 0a -arg "-target").
67f0: 09 09 20 20 20 20 20 28 61 72 67 73 3a 67 65 74 .. (args:get
6800: 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 -arg "-reqtarg")
6810: 29 29 29 0a 20 20 20 20 28 63 6f 6e 64 0a 20 20 ))). (cond.
6820: 20 20 20 28 28 6e 6f 74 20 74 61 72 67 65 74 29 ((not target)
6830: 0a 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 . (debug:pr
6840: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 4d 69 int 0 "ERROR: Mi
6850: 73 73 69 6e 67 20 72 65 71 75 69 72 65 64 20 70 ssing required p
6860: 61 72 61 6d 65 74 65 72 20 66 6f 72 20 22 20 73 arameter for " s
6870: 77 69 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75 witchname ", you
6880: 20 6d 75 73 74 20 73 70 65 63 69 66 79 20 74 68 must specify th
6890: 65 20 74 61 72 67 65 74 20 77 69 74 68 20 2d 74 e target with -t
68a0: 61 72 67 65 74 22 29 0a 20 20 20 20 20 20 28 65 arget"). (e
68b0: 78 69 74 20 33 29 29 0a 20 20 20 20 20 28 28 6e xit 3)). ((n
68c0: 6f 74 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20 ot runname).
68d0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
68e0: 20 22 45 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67 "ERROR: Missing
68f0: 20 72 65 71 75 69 72 65 64 20 70 61 72 61 6d 65 required parame
6900: 74 65 72 20 66 6f 72 20 22 20 73 77 69 74 63 68 ter for " switch
6910: 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d 75 73 74 name ", you must
6920: 20 73 70 65 63 69 66 79 20 74 68 65 20 72 75 6e specify the run
6930: 20 6e 61 6d 65 20 77 69 74 68 20 3a 72 75 6e 6e name with :runn
6940: 61 6d 65 20 72 75 6e 6e 61 6d 65 22 29 0a 20 20 ame runname").
6950: 20 20 20 20 28 65 78 69 74 20 33 29 29 0a 20 20 (exit 3)).
6960: 20 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20 28 (else. (
6970: 6c 65 74 20 28 28 64 62 20 20 20 23 66 29 0a 09 let ((db #f)..
6980: 20 20 20 20 28 6b 65 79 73 20 23 66 29 29 0a 09 (keys #f))..
6990: 28 69 66 20 28 6e 6f 74 20 28 73 65 74 75 70 2d (if (not (setup-
69a0: 66 6f 72 2d 72 75 6e 29 29 0a 09 20 20 20 20 28 for-run)).. (
69b0: 62 65 67 69 6e 20 0a 09 20 20 20 20 20 20 28 64 begin .. (d
69c0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 46 61 ebug:print 0 "Fa
69d0: 69 6c 65 64 20 74 6f 20 73 65 74 75 70 2c 20 65 iled to setup, e
69e0: 78 69 74 69 6e 67 22 29 0a 09 20 20 20 20 20 20 xiting")..
69f0: 28 65 78 69 74 20 31 29 29 29 0a 09 28 73 65 74 (exit 1)))..(set
6a00: 21 20 64 62 20 20 20 28 6f 70 65 6e 2d 64 62 29 ! db (open-db)
6a10: 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 61 72 67 )..(if (not (arg
6a20: 73 3a 67 65 74 2d 61 72 67 20 22 2d 73 65 72 76 s:get-arg "-serv
6a30: 65 72 22 29 29 0a 09 20 20 20 20 28 73 65 72 76 er")).. (serv
6a40: 65 72 3a 63 6c 69 65 6e 74 2d 73 65 74 75 70 20 er:client-setup
6a50: 64 62 29 29 0a 09 28 73 65 74 21 20 6b 65 79 73 db))..(set! keys
6a60: 20 28 72 64 62 3a 67 65 74 2d 6b 65 79 73 20 64 (rdb:get-keys d
6a70: 62 29 29 0a 09 3b 3b 20 68 61 76 65 20 65 6e 6f b))..;; have eno
6a80: 75 67 68 20 74 6f 20 70 72 6f 63 65 73 73 20 2d ugh to process -
6a90: 74 61 72 67 65 74 20 6f 72 20 2d 72 65 71 74 61 target or -reqta
6aa0: 72 67 20 68 65 72 65 0a 09 28 69 66 20 28 61 72 rg here..(if (ar
6ab0: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 gs:get-arg "-req
6ac0: 74 61 72 67 22 29 0a 09 20 20 20 20 28 6c 65 74 targ").. (let
6ad0: 2a 20 28 28 72 75 6e 63 6f 6e 66 69 67 66 20 28 * ((runconfigf (
6ae0: 63 6f 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a 20 conc *toppath*
6af0: 22 2f 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e "/runconfigs.con
6b00: 66 69 67 22 29 29 20 3b 3b 20 44 4f 20 4e 4f 54 fig")) ;; DO NOT
6b10: 20 45 56 41 4c 55 41 54 45 20 41 4c 4c 20 0a 09 EVALUATE ALL ..
6b20: 09 20 20 20 28 72 75 6e 63 6f 6e 66 69 67 20 20 . (runconfig
6b30: 28 72 65 61 64 2d 63 6f 6e 66 69 67 20 72 75 6e (read-config run
6b40: 63 6f 6e 66 69 67 66 20 23 66 20 23 66 20 65 6e configf #f #f en
6b50: 76 69 72 6f 6e 2d 70 61 74 74 3a 20 23 66 29 29 viron-patt: #f))
6b60: 29 20 0a 09 20 20 20 20 20 20 28 69 66 20 28 68 ) .. (if (h
6b70: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 ash-table-ref/de
6b80: 66 61 75 6c 74 20 72 75 6e 63 6f 6e 66 69 67 20 fault runconfig
6b90: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d (args:get-arg "-
6ba0: 72 65 71 74 61 72 67 22 29 20 23 66 29 0a 09 09 reqtarg") #f)...
6bb0: 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 73 (keys:target-s
6bc0: 65 74 2d 61 72 67 73 20 6b 65 79 73 20 28 61 72 et-args keys (ar
6bd0: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 gs:get-arg "-req
6be0: 74 61 72 67 22 29 20 61 72 67 73 3a 61 72 67 2d targ") args:arg-
6bf0: 68 61 73 68 29 0a 09 09 20 20 28 62 65 67 69 6e hash)... (begin
6c00: 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 ... (debug:pr
6c10: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 5b 22 int 0 "ERROR: ["
6c20: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
6c30: 2d 72 65 71 74 61 72 67 22 29 20 22 5d 20 6e 6f -reqtarg") "] no
6c40: 74 20 66 6f 75 6e 64 20 69 6e 20 22 20 72 75 6e t found in " run
6c50: 63 6f 6e 66 69 67 66 29 0a 09 09 20 20 20 20 28 configf)... (
6c60: 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 sqlite3:finalize
6c70: 21 20 64 62 29 0a 09 09 20 20 20 20 28 65 78 69 ! db)... (exi
6c80: 74 20 31 29 29 29 29 0a 09 20 20 20 20 28 69 66 t 1)))).. (if
6c90: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
6ca0: 2d 74 61 72 67 65 74 22 29 0a 09 09 28 6b 65 79 -target")...(key
6cb0: 73 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 72 67 s:target-set-arg
6cc0: 73 20 6b 65 79 73 20 28 61 72 67 73 3a 67 65 74 s keys (args:get
6cd0: 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 20 61 -arg "-target" a
6ce0: 72 67 73 3a 61 72 67 2d 68 61 73 68 29 20 61 72 rgs:arg-hash) ar
6cf0: 67 73 3a 61 72 67 2d 68 61 73 68 29 29 29 0a 09 gs:arg-hash)))..
6d00: 28 69 66 20 28 6e 6f 74 20 28 63 61 72 20 2a 63 (if (not (car *c
6d10: 6f 6e 66 69 67 69 6e 66 6f 2a 29 29 0a 09 20 20 onfiginfo*))..
6d20: 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 (begin..
6d30: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
6d40: 45 52 52 4f 52 3a 20 41 74 74 65 6d 70 74 65 64 ERROR: Attempted
6d50: 20 74 6f 20 22 20 61 63 74 69 6f 6e 2d 64 65 73 to " action-des
6d60: 63 20 22 20 62 75 74 20 72 75 6e 20 61 72 65 61 c " but run area
6d70: 20 63 6f 6e 66 69 67 20 66 69 6c 65 20 6e 6f 74 config file not
6d80: 20 66 6f 75 6e 64 22 29 0a 09 20 20 20 20 20 20 found")..
6d90: 28 65 78 69 74 20 31 29 29 0a 09 20 20 20 20 3b (exit 1)).. ;
6da0: 3b 20 45 78 74 72 61 63 74 20 6f 75 74 20 73 74 ; Extract out st
6db0: 75 66 66 20 6e 65 65 64 65 64 20 69 6e 20 6d 6f uff needed in mo
6dc0: 73 74 20 6f 72 20 6d 61 6e 79 20 63 61 6c 6c 73 st or many calls
6dd0: 0a 09 20 20 20 20 3b 3b 20 68 65 72 65 20 74 68 .. ;; here th
6de0: 65 6e 20 63 61 6c 6c 20 70 72 6f 63 0a 09 20 20 en call proc..
6df0: 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 6e 61 6d (let* ((keynam
6e00: 65 73 20 20 20 28 6d 61 70 20 6b 65 79 3a 67 65 es (map key:ge
6e10: 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79 73 t-fieldname keys
6e20: 29 29 0a 09 09 20 20 20 28 6b 65 79 76 61 6c 6c ))... (keyvall
6e30: 73 74 20 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69 st (keys->valli
6e40: 73 74 20 6b 65 79 73 20 23 74 29 29 29 0a 09 20 st keys #t)))..
6e50: 20 20 20 20 20 28 70 72 6f 63 20 64 62 20 74 61 (proc db ta
6e60: 72 67 65 74 20 72 75 6e 6e 61 6d 65 20 6b 65 79 rget runname key
6e70: 73 20 6b 65 79 6e 61 6d 65 73 20 6b 65 79 76 61 s keynames keyva
6e80: 6c 6c 73 74 29 29 29 0a 09 28 73 71 6c 69 74 65 llst)))..(sqlite
6e90: 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 29 0a 3:finalize! db).
6ea0: 09 28 73 65 74 21 20 2a 64 69 64 73 6f 6d 65 74 .(set! *didsomet
6eb0: 68 69 6e 67 2a 20 23 74 29 29 29 29 29 29 0a 0a hing* #t))))))..
6ec0: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;;==============
6ed0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6ee0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6ef0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6f00: 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 6c 6c ========.;; Roll
6f10: 75 70 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d up runs.;;======
6f20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6f30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6f40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6f50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6f60: 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74 68 65 20 ..;; Update the
6f70: 74 65 73 74 5f 6d 65 74 61 20 74 61 62 6c 65 20 test_meta table
6f80: 66 6f 72 20 74 68 69 73 20 74 65 73 74 0a 28 64 for this test.(d
6f90: 65 66 69 6e 65 20 28 72 75 6e 73 3a 75 70 64 61 efine (runs:upda
6fa0: 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20 te-test_meta db
6fb0: 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 test-name test-c
6fc0: 6f 6e 66 29 0a 20 20 28 6c 65 74 20 28 28 63 75 onf). (let ((cu
6fd0: 72 72 72 65 63 6f 72 64 20 28 64 62 3a 74 65 73 rrrecord (db:tes
6fe0: 74 6d 65 74 61 2d 67 65 74 2d 72 65 63 6f 72 64 tmeta-get-record
6ff0: 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 db test-name)))
7000: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 63 75 . (if (not cu
7010: 72 72 72 65 63 6f 72 64 29 0a 09 28 62 65 67 69 rrrecord)..(begi
7020: 6e 0a 09 20 20 28 73 65 74 21 20 63 75 72 72 72 n.. (set! currr
7030: 65 63 6f 72 64 20 28 6d 61 6b 65 2d 76 65 63 74 ecord (make-vect
7040: 6f 72 20 31 30 20 23 66 29 29 0a 09 20 20 28 64 or 10 #f)).. (d
7050: 62 3a 74 65 73 74 6d 65 74 61 2d 61 64 64 2d 72 b:testmeta-add-r
7060: 65 63 6f 72 64 20 64 62 20 74 65 73 74 2d 6e 61 ecord db test-na
7070: 6d 65 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 me))). (for-e
7080: 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 ach . (lambd
7090: 61 20 28 6b 65 79 29 0a 20 20 20 20 20 20 20 28 a (key). (
70a0: 6c 65 74 2a 20 28 28 69 64 78 20 28 63 61 64 72 let* ((idx (cadr
70b0: 20 6b 65 79 29 29 0a 09 20 20 20 20 20 20 28 66 key)).. (f
70c0: 6c 64 20 28 63 61 72 20 20 6b 65 79 29 29 0a 09 ld (car key))..
70d0: 20 20 20 20 20 20 28 76 61 6c 20 28 63 6f 6e 66 (val (conf
70e0: 69 67 2d 6c 6f 6f 6b 75 70 20 74 65 73 74 2d 63 ig-lookup test-c
70f0: 6f 6e 66 20 22 74 65 73 74 5f 6d 65 74 61 22 20 onf "test_meta"
7100: 66 6c 64 29 29 29 0a 09 20 3b 3b 20 28 64 65 62 fld))).. ;; (deb
7110: 75 67 3a 70 72 69 6e 74 20 35 20 22 69 64 78 3a ug:print 5 "idx:
7120: 20 22 20 69 64 78 20 22 20 66 6c 64 3a 20 22 20 " idx " fld: "
7130: 66 6c 64 20 22 20 76 61 6c 3a 20 22 20 76 61 6c fld " val: " val
7140: 29 0a 09 20 28 69 66 20 28 61 6e 64 20 76 61 6c ).. (if (and val
7150: 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 28 76 (not (equal? (v
7160: 65 63 74 6f 72 2d 72 65 66 20 63 75 72 72 72 65 ector-ref currre
7170: 63 6f 72 64 20 69 64 78 29 20 76 61 6c 29 29 29 cord idx) val)))
7180: 0a 09 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20 .. (begin..
7190: 20 20 20 20 20 20 28 70 72 69 6e 74 20 22 55 70 (print "Up
71a0: 64 61 74 69 6e 67 20 22 20 74 65 73 74 2d 6e 61 dating " test-na
71b0: 6d 65 20 22 20 22 20 66 6c 64 20 22 20 74 6f 20 me " " fld " to
71c0: 22 20 76 61 6c 29 0a 09 20 20 20 20 20 20 20 28 " val).. (
71d0: 64 62 3a 74 65 73 74 6d 65 74 61 2d 75 70 64 61 db:testmeta-upda
71e0: 74 65 2d 66 69 65 6c 64 20 64 62 20 74 65 73 74 te-field db test
71f0: 2d 6e 61 6d 65 20 66 6c 64 20 76 61 6c 29 29 29 -name fld val)))
7200: 29 29 0a 20 20 20 20 20 27 28 28 22 61 75 74 68 )). '(("auth
7210: 6f 72 22 20 32 29 28 22 6f 77 6e 65 72 22 20 33 or" 2)("owner" 3
7220: 29 28 22 64 65 73 63 72 69 70 74 69 6f 6e 22 20 )("description"
7230: 34 29 28 22 72 65 76 69 65 77 65 64 22 20 35 29 4)("reviewed" 5)
7240: 28 22 74 61 67 73 22 20 39 29 29 29 29 29 0a 0a ("tags" 9)))))..
7250: 3b 3b 20 55 70 64 61 74 65 20 74 65 73 74 5f 6d ;; Update test_m
7260: 65 74 61 20 66 6f 72 20 61 6c 6c 20 74 65 73 74 eta for all test
7270: 73 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a s.(define (runs:
7280: 75 70 64 61 74 65 2d 61 6c 6c 2d 74 65 73 74 5f update-all-test_
7290: 6d 65 74 61 20 64 62 29 0a 20 20 28 6c 65 74 20 meta db). (let
72a0: 28 28 74 65 73 74 2d 6e 61 6d 65 73 20 28 67 65 ((test-names (ge
72b0: 74 2d 61 6c 6c 2d 6c 65 67 61 6c 2d 74 65 73 74 t-all-legal-test
72c0: 73 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 s))). (for-ea
72d0: 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 ch . (lambda
72e0: 20 28 74 65 73 74 2d 6e 61 6d 65 29 0a 20 20 20 (test-name).
72f0: 20 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 (let* ((test
7300: 2d 70 61 74 68 20 20 20 20 28 63 6f 6e 63 20 2a -path (conc *
7310: 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 toppath* "/tests
7320: 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29 29 0a 09 /" test-name))..
7330: 20 20 20 20 20 20 28 74 65 73 74 2d 63 6f 6e 66 (test-conf
7340: 69 67 66 20 28 63 6f 6e 63 20 74 65 73 74 2d 70 igf (conc test-p
7350: 61 74 68 20 22 2f 74 65 73 74 63 6f 6e 66 69 67 ath "/testconfig
7360: 22 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 ")).. (test
7370: 65 78 69 73 74 73 20 20 20 28 61 6e 64 20 28 66 exists (and (f
7380: 69 6c 65 2d 65 78 69 73 74 73 3f 20 74 65 73 74 ile-exists? test
7390: 2d 63 6f 6e 66 69 67 66 29 28 66 69 6c 65 2d 72 -configf)(file-r
73a0: 65 61 64 2d 61 63 63 65 73 73 3f 20 74 65 73 74 ead-access? test
73b0: 2d 63 6f 6e 66 69 67 66 29 29 29 0a 09 20 20 20 -configf)))..
73c0: 20 20 20 3b 3b 20 72 65 61 64 20 63 6f 6e 66 69 ;; read confi
73d0: 67 73 20 77 69 74 68 20 74 72 69 63 6b 73 20 74 gs with tricks t
73e0: 75 72 6e 65 64 20 6f 66 66 20 28 69 2e 65 2e 20 urned off (i.e.
73f0: 6e 6f 20 73 79 73 74 65 6d 29 0a 09 20 20 20 20 no system)..
7400: 20 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 20 (test-conf
7410: 28 69 66 20 74 65 73 74 65 78 69 73 74 73 20 28 (if testexists (
7420: 72 65 61 64 2d 63 6f 6e 66 69 67 20 74 65 73 74 read-config test
7430: 2d 63 6f 6e 66 69 67 66 20 23 66 20 23 66 29 28 -configf #f #f)(
7440: 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 make-hash-table)
7450: 29 29 29 0a 09 20 28 72 75 6e 73 3a 75 70 64 61 ))).. (runs:upda
7460: 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20 te-test_meta db
7470: 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 test-name test-c
7480: 6f 6e 66 29 29 29 0a 20 20 20 20 20 74 65 73 74 onf))). test
7490: 2d 6e 61 6d 65 73 29 29 29 0a 0a 3b 3b 20 54 68 -names)))..;; Th
74a0: 69 73 20 63 6f 75 6c 64 20 70 72 6f 62 61 62 6c is could probabl
74b0: 79 20 62 65 20 72 65 66 61 63 74 6f 72 65 64 20 y be refactored
74c0: 69 6e 74 6f 20 6f 6e 65 20 63 6f 6d 70 6c 65 78 into one complex
74d0: 20 71 75 65 72 79 20 2e 2e 2e 0a 28 64 65 66 69 query ....(defi
74e0: 6e 65 20 28 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d ne (runs:rollup-
74f0: 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 run db keys keyv
7500: 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 75 73 allst runname us
7510: 65 72 29 20 3b 3b 20 77 61 73 20 74 61 72 67 65 er) ;; was targe
7520: 74 2c 20 6e 6f 77 20 6b 65 79 76 61 6c 6c 73 74 t, now keyvallst
7530: 0a 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 . (debug:print
7540: 34 20 22 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 4 "runs:rollup-r
7550: 75 6e 2c 20 6b 65 79 73 3a 20 22 20 6b 65 79 73 un, keys: " keys
7560: 20 22 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 " keyvallst: "
7570: 6b 65 79 76 61 6c 6c 73 74 20 22 20 3a 72 75 6e keyvallst " :run
7580: 6e 61 6d 65 20 22 20 72 75 6e 6e 61 6d 65 20 22 name " runname "
7590: 20 75 73 65 72 3a 20 22 20 75 73 65 72 29 0a 20 user: " user).
75a0: 20 28 6c 65 74 2a 20 28 3b 20 28 6b 65 79 76 61 (let* (; (keyva
75b0: 6c 6c 6c 73 74 20 20 20 20 20 20 28 6b 65 79 73 lllst (keys
75c0: 3a 74 61 72 67 65 74 2d 3e 6b 65 79 76 61 6c 20 :target->keyval
75d0: 6b 65 79 73 20 74 61 72 67 65 74 29 29 0a 09 20 keys target))..
75e0: 28 6e 65 77 2d 72 75 6e 2d 69 64 20 20 20 20 20 (new-run-id
75f0: 20 28 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d (runs:register-
7600: 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 run db keys keyv
7610: 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e allst runname "n
7620: 65 77 22 20 22 6e 2f 61 22 20 75 73 65 72 29 29 ew" "n/a" user))
7630: 0a 09 20 28 70 72 65 76 2d 74 65 73 74 73 20 20 .. (prev-tests
7640: 20 20 20 20 28 74 65 73 74 3a 67 65 74 2d 6d 61 (test:get-ma
7650: 74 63 68 69 6e 67 2d 70 72 65 76 69 6f 75 73 2d tching-previous-
7660: 74 65 73 74 2d 72 75 6e 2d 72 65 63 6f 72 64 73 test-run-records
7670: 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 22 db new-run-id "
7680: 25 22 20 22 25 22 29 29 0a 09 20 28 63 75 72 72 %" "%")).. (curr
7690: 2d 74 65 73 74 73 20 20 20 20 20 20 28 72 64 62 -tests (rdb
76a0: 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 :get-tests-for-r
76b0: 75 6e 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 un db new-run-id
76c0: 20 22 25 22 20 22 25 22 20 27 28 29 20 27 28 29 "%" "%" '() '()
76d0: 29 29 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73 )).. (curr-tests
76e0: 2d 68 61 73 68 20 28 6d 61 6b 65 2d 68 61 73 68 -hash (make-hash
76f0: 2d 74 61 62 6c 65 29 29 29 0a 20 20 20 20 28 64 -table))). (d
7700: 62 3a 75 70 64 61 74 65 2d 72 75 6e 2d 65 76 65 b:update-run-eve
7710: 6e 74 5f 74 69 6d 65 20 64 62 20 6e 65 77 2d 72 nt_time db new-r
7720: 75 6e 2d 69 64 29 0a 20 20 20 20 3b 3b 20 69 6e un-id). ;; in
7730: 64 65 78 20 74 68 65 20 61 6c 72 65 61 64 79 20 dex the already
7740: 73 61 76 65 64 20 74 65 73 74 73 20 62 79 20 74 saved tests by t
7750: 65 73 74 6e 61 6d 65 20 61 6e 64 20 69 74 65 6d estname and item
7760: 64 61 74 20 69 6e 20 63 75 72 72 2d 74 65 73 74 dat in curr-test
7770: 73 2d 68 61 73 68 0a 20 20 20 20 28 66 6f 72 2d s-hash. (for-
7780: 65 61 63 68 0a 20 20 20 20 20 28 6c 61 6d 62 64 each. (lambd
7790: 61 20 28 74 65 73 74 64 61 74 29 0a 20 20 20 20 a (testdat).
77a0: 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 6e (let* ((testn
77b0: 61 6d 65 20 20 28 64 62 3a 74 65 73 74 2d 67 65 ame (db:test-ge
77c0: 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 64 t-testname testd
77d0: 61 74 29 29 0a 09 20 20 20 20 20 20 28 69 74 65 at)).. (ite
77e0: 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d m-path (db:test-
77f0: 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 get-item-path te
7800: 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 stdat)).. (
7810: 66 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 full-name (conc
7820: 74 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 testname "/" ite
7830: 6d 2d 70 61 74 68 29 29 29 0a 09 20 28 68 61 73 m-path))).. (has
7840: 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72 h-table-set! cur
7850: 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c r-tests-hash ful
7860: 6c 2d 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29 l-name testdat))
7870: 29 0a 20 20 20 20 20 63 75 72 72 2d 74 65 73 74 ). curr-test
7880: 73 29 0a 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 s). ;; NOPE:
7890: 4e 6f 6e 2d 6f 70 74 69 6d 61 6c 20 61 70 70 72 Non-optimal appr
78a0: 6f 61 63 68 2e 20 54 72 79 20 74 68 69 73 20 69 oach. Try this i
78b0: 6e 73 74 65 61 64 2e 0a 20 20 20 20 3b 3b 20 20 nstead.. ;;
78c0: 20 31 2e 20 74 65 73 74 73 20 61 72 65 20 72 65 1. tests are re
78d0: 63 65 69 76 65 64 20 69 6e 20 61 20 6c 69 73 74 ceived in a list
78e0: 2c 20 6d 6f 73 74 20 72 65 63 65 6e 74 20 66 69 , most recent fi
78f0: 72 73 74 0a 20 20 20 20 3b 3b 20 20 20 32 2e 20 rst. ;; 2.
7900: 72 65 70 6c 61 63 65 20 74 68 65 20 72 6f 6c 6c replace the roll
7910: 75 70 20 74 65 73 74 20 77 69 74 68 20 74 68 65 up test with the
7920: 20 6e 65 77 20 2a 61 6c 77 61 79 73 2a 0a 20 20 new *always*.
7930: 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 (for-each .
7940: 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 64 (lambda (testd
7950: 61 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a at). (let*
7960: 20 28 28 74 65 73 74 6e 61 6d 65 20 20 28 64 62 ((testname (db
7970: 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 :test-get-testna
7980: 6d 65 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 me testdat))..
7990: 20 20 20 20 28 69 74 65 6d 2d 70 61 74 68 20 28 (item-path (
79a0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d db:test-get-item
79b0: 2d 70 61 74 68 20 74 65 73 74 64 61 74 29 29 0a -path testdat)).
79c0: 09 20 20 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d . (full-nam
79d0: 65 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 e (conc testname
79e0: 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 "/" item-path))
79f0: 0a 09 20 20 20 20 20 20 28 70 72 65 76 2d 74 65 .. (prev-te
7a00: 73 74 2d 64 61 74 20 28 68 61 73 68 2d 74 61 62 st-dat (hash-tab
7a10: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63 le-ref/default c
7a20: 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 urr-tests-hash f
7a30: 75 6c 6c 2d 6e 61 6d 65 20 23 66 29 29 0a 09 20 ull-name #f))..
7a40: 20 20 20 20 20 28 74 65 73 74 2d 73 74 65 70 73 (test-steps
7a50: 20 20 20 20 20 20 28 64 62 3a 67 65 74 2d 73 74 (db:get-st
7a60: 65 70 73 2d 66 6f 72 2d 74 65 73 74 20 64 62 20 eps-for-test db
7a70: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 (db:test-get-id
7a80: 74 65 73 74 64 61 74 29 29 29 0a 09 20 20 20 20 testdat)))..
7a90: 20 20 28 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f (new-test-reco
7aa0: 72 64 20 23 66 29 29 0a 09 20 3b 3b 20 72 65 70 rd #f)).. ;; rep
7ab0: 6c 61 63 65 20 74 68 65 73 65 20 77 69 74 68 20 lace these with
7ac0: 69 6e 73 65 72 74 20 2e 2e 2e 20 73 65 6c 65 63 insert ... selec
7ad0: 74 0a 09 20 28 61 70 70 6c 79 20 73 71 6c 69 74 t.. (apply sqlit
7ae0: 65 33 3a 65 78 65 63 75 74 65 20 0a 09 09 64 62 e3:execute ...db
7af0: 20 0a 09 09 28 63 6f 6e 63 20 22 49 4e 53 45 52 ...(conc "INSER
7b00: 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 T OR REPLACE INT
7b10: 4f 20 74 65 73 74 73 20 28 72 75 6e 5f 69 64 2c O tests (run_id,
7b20: 74 65 73 74 6e 61 6d 65 2c 73 74 61 74 65 2c 73 testname,state,s
7b30: 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 tatus,event_time
7b40: 2c 68 6f 73 74 2c 63 70 75 6c 6f 61 64 2c 64 69 ,host,cpuload,di
7b50: 73 6b 66 72 65 65 2c 75 6e 61 6d 65 2c 72 75 6e skfree,uname,run
7b60: 64 69 72 2c 69 74 65 6d 5f 70 61 74 68 2c 72 75 dir,item_path,ru
7b70: 6e 5f 64 75 72 61 74 69 6f 6e 2c 66 69 6e 61 6c n_duration,final
7b80: 5f 6c 6f 67 66 2c 63 6f 6d 6d 65 6e 74 29 20 22 _logf,comment) "
7b90: 0a 09 09 20 20 20 20 20 20 22 56 41 4c 55 45 53 ... "VALUES
7ba0: 20 28 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c (?,?,?,?,?,?,?,
7bb0: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 29 3b 22 ?,?,?,?,?,?,?);"
7bc0: 29 0a 09 09 6e 65 77 2d 72 75 6e 2d 69 64 20 28 )...new-run-id (
7bd0: 63 64 64 72 20 28 76 65 63 74 6f 72 2d 3e 6c 69 cddr (vector->li
7be0: 73 74 20 74 65 73 74 64 61 74 29 29 29 0a 09 20 st testdat)))..
7bf0: 28 73 65 74 21 20 6e 65 77 2d 74 65 73 74 64 61 (set! new-testda
7c00: 74 20 28 63 61 72 20 28 72 64 62 3a 67 65 74 2d t (car (rdb:get-
7c10: 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 tests-for-run db
7c20: 20 6e 65 77 2d 72 75 6e 2d 69 64 20 74 65 73 74 new-run-id test
7c30: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 20 27 name item-path '
7c40: 28 29 20 27 28 29 29 29 29 0a 09 20 28 68 61 73 () '()))).. (has
7c50: 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72 h-table-set! cur
7c60: 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c r-tests-hash ful
7c70: 6c 2d 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74 64 l-name new-testd
7c80: 61 74 29 20 3b 3b 20 74 68 69 73 20 63 6f 75 6c at) ;; this coul
7c90: 64 20 62 65 20 63 6f 6e 66 75 73 69 6e 67 2c 20 d be confusing,
7ca0: 77 68 69 63 68 20 72 65 63 6f 72 64 20 73 68 6f which record sho
7cb0: 75 6c 64 20 67 6f 20 69 6e 74 6f 20 74 68 65 20 uld go into the
7cc0: 6c 6f 6f 6b 75 70 20 74 61 62 6c 65 3f 0a 09 20 lookup table?..
7cd0: 3b 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 ;; Now duplicate
7ce0: 20 74 68 65 20 74 65 73 74 20 73 74 65 70 73 0a the test steps.
7cf0: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 . (debug:print 4
7d00: 20 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 "Copying record
7d10: 73 20 69 6e 20 74 65 73 74 5f 73 74 65 70 73 20 s in test_steps
7d20: 66 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 from test_id=" (
7d30: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 db:test-get-id t
7d40: 65 73 74 64 61 74 29 20 22 20 74 6f 20 22 20 28 estdat) " to " (
7d50: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e db:test-get-id n
7d60: 65 77 2d 74 65 73 74 64 61 74 29 29 0a 09 20 28 ew-testdat)).. (
7d70: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 sqlite3:execute
7d80: 0a 09 20 20 64 62 20 0a 09 20 20 28 63 6f 6e 63 .. db .. (conc
7d90: 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c "INSERT OR REPL
7da0: 41 43 45 20 49 4e 54 4f 20 74 65 73 74 5f 73 74 ACE INTO test_st
7db0: 65 70 73 20 28 74 65 73 74 5f 69 64 2c 73 74 65 eps (test_id,ste
7dc0: 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 pname,state,stat
7dd0: 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f us,event_time,co
7de0: 6d 6d 65 6e 74 29 20 22 0a 09 09 22 53 45 4c 45 mment) "..."SELE
7df0: 43 54 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 CT " (db:test-ge
7e00: 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 t-id new-testdat
7e10: 29 20 22 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 ) ",stepname,sta
7e20: 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f te,status,event_
7e30: 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f time,comment FRO
7e40: 4d 20 74 65 73 74 5f 73 74 65 70 73 20 57 48 45 M test_steps WHE
7e50: 52 45 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a RE test_id=?;").
7e60: 09 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d . (db:test-get-
7e70: 69 64 20 74 65 73 74 64 61 74 29 29 0a 09 20 3b id testdat)).. ;
7e80: 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 ; Now duplicate
7e90: 74 68 65 20 74 65 73 74 20 64 61 74 61 0a 09 20 the test data..
7ea0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 (debug:print 4 "
7eb0: 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 73 20 Copying records
7ec0: 69 6e 20 74 65 73 74 5f 64 61 74 61 20 66 72 6f in test_data fro
7ed0: 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62 3a m test_id=" (db:
7ee0: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 test-get-id test
7ef0: 64 61 74 29 20 22 20 74 6f 20 22 20 28 64 62 3a dat) " to " (db:
7f00: 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d test-get-id new-
7f10: 74 65 73 74 64 61 74 29 29 0a 09 20 28 73 71 6c testdat)).. (sql
7f20: 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09 20 ite3:execute ..
7f30: 20 64 62 20 0a 09 20 20 28 63 6f 6e 63 20 22 49 db .. (conc "I
7f40: 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 NSERT OR REPLACE
7f50: 20 49 4e 54 4f 20 74 65 73 74 5f 64 61 74 61 20 INTO test_data
7f60: 28 74 65 73 74 5f 69 64 2c 63 61 74 65 67 6f 72 (test_id,categor
7f70: 79 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 y,variable,value
7f80: 2c 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e ,expected,tol,un
7f90: 69 74 73 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 its,comment) "..
7fa0: 09 22 53 45 4c 45 43 54 20 22 20 28 64 62 3a 74 ."SELECT " (db:t
7fb0: 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 est-get-id new-t
7fc0: 65 73 74 64 61 74 29 20 22 2c 63 61 74 65 67 6f estdat) ",catego
7fd0: 72 79 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 ry,variable,valu
7fe0: 65 2c 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 e,expected,tol,u
7ff0: 6e 69 74 73 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f nits,comment FRO
8000: 4d 20 74 65 73 74 5f 64 61 74 61 20 57 48 45 52 M test_data WHER
8010: 45 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 E test_id=?;")..
8020: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 (db:test-get-i
8030: 64 20 74 65 73 74 64 61 74 29 29 0a 09 20 29 29 d testdat)).. ))
8040: 0a 20 20 20 20 20 70 72 65 76 2d 74 65 73 74 73 . prev-tests
8050: 29 29 29 0a 09 20 0a 20 20 20 20 20 0a ))).. . .