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 32 2c 20 4d 61 74 74 68 65 77 06-2012, Matthew
0020: 20 57 65 6c 6c 61 6e 64 2e 0a 3b 3b 20 0a 3b 3b Welland..;; .;;
0030: 20 20 54 68 69 73 20 70 72 6f 67 72 61 6d 20 69 This program i
0040: 73 20 6d 61 64 65 20 61 76 61 69 6c 61 62 6c 65 s made available
0050: 20 75 6e 64 65 72 20 74 68 65 20 47 4e 55 20 47 under the GNU G
0060: 50 4c 20 76 65 72 73 69 6f 6e 20 32 2e 30 20 6f PL version 2.0 o
0070: 72 0a 3b 3b 20 20 67 72 65 61 74 65 72 2e 20 53 r.;; greater. S
0080: 65 65 20 74 68 65 20 61 63 63 6f 6d 70 61 6e 79 ee the accompany
0090: 69 6e 67 20 66 69 6c 65 20 43 4f 50 59 49 4e 47 ing file COPYING
00a0: 20 66 6f 72 20 64 65 74 61 69 6c 73 2e 0a 3b 3b for details..;;
00b0: 20 0a 3b 3b 20 20 54 68 69 73 20 70 72 6f 67 72 .;; This progr
00c0: 61 6d 20 69 73 20 64 69 73 74 72 69 62 75 74 65 am is distribute
00d0: 64 20 57 49 54 48 4f 55 54 20 41 4e 59 20 57 41 d WITHOUT ANY WA
00e0: 52 52 41 4e 54 59 3b 20 77 69 74 68 6f 75 74 20 RRANTY; without
00f0: 65 76 65 6e 20 74 68 65 0a 3b 3b 20 20 69 6d 70 even the.;; imp
0100: 6c 69 65 64 20 77 61 72 72 61 6e 74 79 20 6f 66 lied warranty of
0110: 20 4d 45 52 43 48 41 4e 54 41 42 49 4c 49 54 59 MERCHANTABILITY
0120: 20 6f 72 20 46 49 54 4e 45 53 53 20 46 4f 52 20 or FITNESS FOR
0130: 41 20 50 41 52 54 49 43 55 4c 41 52 0a 3b 3b 20 A PARTICULAR.;;
0140: 20 50 55 52 50 4f 53 45 2e 0a 0a 3b 3b 20 20 73 PURPOSE...;; s
0150: 74 72 66 74 69 6d 65 28 27 25 6d 2f 25 64 2f 25 trftime('%m/%d/%
0160: 59 20 25 48 3a 25 4d 3a 25 53 27 2c 27 6e 6f 77 Y %H:%M:%S','now
0170: 27 2c 27 6c 6f 63 61 6c 74 69 6d 65 27 29 0a 0a ','localtime')..
0180: 28 75 73 65 20 73 71 6c 69 74 65 33 20 73 72 66 (use sqlite3 srf
0190: 69 2d 31 20 70 6f 73 69 78 20 72 65 67 65 78 20 i-1 posix regex
01a0: 72 65 67 65 78 2d 63 61 73 65 20 73 72 66 69 2d regex-case srfi-
01b0: 36 39 20 64 6f 74 2d 6c 6f 63 6b 69 6e 67 20 28 69 dot-locking (
01c0: 73 72 66 69 20 31 38 29 20 70 6f 73 69 78 2d 65 srfi 18) posix-e
01d0: 78 74 72 61 73 20 64 69 72 65 63 74 6f 72 79 2d xtras directory-
01e0: 75 74 69 6c 73 29 0a 28 69 6d 70 6f 72 74 20 28 utils).(import (
01f0: 70 72 65 66 69 78 20 73 71 6c 69 74 65 33 20 73 prefix sqlite3 s
0200: 71 6c 69 74 65 33 3a 29 29 0a 0a 28 64 65 63 6c qlite3:))..(decl
0210: 61 72 65 20 28 75 6e 69 74 20 72 75 6e 73 29 29 are (unit runs))
0220: 0a 28 64 65 63 6c 61 72 65 20 28 75 73 65 73 20 .(declare (uses
0230: 64 62 29 29 0a 28 64 65 63 6c 61 72 65 20 28 75 db)).(declare (u
0240: 73 65 73 20 63 6f 6d 6d 6f 6e 29 29 0a 28 64 65 ses common)).(de
0250: 63 6c 61 72 65 20 28 75 73 65 73 20 69 74 65 6d clare (uses item
0260: 73 29 29 0a 28 64 65 63 6c 61 72 65 20 28 75 73 s)).(declare (us
0270: 65 73 20 72 75 6e 63 6f 6e 66 69 67 29 29 0a 28 es runconfig)).(
0280: 64 65 63 6c 61 72 65 20 28 75 73 65 73 20 74 65 declare (uses te
0290: 73 74 73 29 29 0a 28 64 65 63 6c 61 72 65 20 28 sts)).(declare (
02a0: 75 73 65 73 20 73 65 72 76 65 72 29 29 0a 0a 28 uses server))..(
02b0: 69 6e 63 6c 75 64 65 20 22 63 6f 6d 6d 6f 6e 5f include "common_
02c0: 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 0a 28 69 records.scm").(i
02d0: 6e 63 6c 75 64 65 20 22 6b 65 79 5f 72 65 63 6f nclude "key_reco
02e0: 72 64 73 2e 73 63 6d 22 29 0a 28 69 6e 63 6c 75 rds.scm").(inclu
02f0: 64 65 20 22 64 62 5f 72 65 63 6f 72 64 73 2e 73 de "db_records.s
0300: 63 6d 22 29 0a 28 69 6e 63 6c 75 64 65 20 22 72 cm").(include "r
0310: 75 6e 5f 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 un_records.scm")
0320: 0a 28 69 6e 63 6c 75 64 65 20 22 74 65 73 74 5f .(include "test_
0330: 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 0a 0a 3b records.scm")..;
0340: 3b 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d ; runs:get-runs-
0350: 62 79 2d 70 61 74 74 0a 3b 3b 20 67 65 74 20 72 by-patt.;; get r
0360: 75 6e 73 20 62 79 20 6c 69 73 74 20 6f 66 20 63 uns by list of c
0370: 72 69 74 65 72 69 61 0a 3b 3b 20 72 65 67 69 73 riteria.;; regis
0380: 74 65 72 20 61 20 74 65 73 74 20 72 75 6e 20 77 ter a test run w
0390: 69 74 68 20 74 68 65 20 64 62 0a 3b 3b 0a 3b 3b ith the db.;;.;;
03a0: 20 55 73 65 3a 20 28 64 62 2d 67 65 74 2d 76 61 Use: (db-get-va
03b0: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 28 64 lue-by-header (d
03c0: 62 3a 67 65 74 2d 68 65 61 64 65 72 20 72 75 6e b:get-header run
03d0: 69 6e 66 6f 29 28 64 62 3a 67 65 74 2d 72 6f 77 info)(db:get-row
03e0: 20 72 75 6e 69 6e 66 6f 29 29 0a 3b 3b 20 20 74 runinfo)).;; t
03f0: 6f 20 65 78 74 72 61 63 74 20 69 6e 66 6f 20 66 o extract info f
0400: 72 6f 6d 20 74 68 65 20 73 74 72 75 63 74 75 72 rom the structur
0410: 65 20 72 65 74 75 72 6e 65 64 0a 3b 3b 0a 28 64 e returned.;;.(d
0420: 65 66 69 6e 65 20 28 72 75 6e 73 3a 67 65 74 2d efine (runs:get-
0430: 72 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20 runs-by-patt db
0440: 6b 65 79 73 20 72 75 6e 6e 61 6d 65 70 61 74 74 keys runnamepatt
0450: 29 20 3b 3b 20 74 65 73 74 2d 6e 61 6d 65 29 0a ) ;; test-name).
0460: 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 76 61 6c (let* ((keyval
0470: 6c 73 74 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69 lst (keys->valli
0480: 73 74 20 6b 65 79 73 29 29 0a 09 20 28 74 6d 70 st keys)).. (tmp
0490: 20 20 20 20 20 20 28 72 75 6e 73 3a 67 65 74 2d (runs:get-
04a0: 73 74 64 2d 72 75 6e 2d 66 69 65 6c 64 73 20 6b std-run-fields k
04b0: 65 79 73 20 27 28 22 69 64 22 20 22 72 75 6e 6e eys '("id" "runn
04c0: 61 6d 65 22 20 22 73 74 61 74 65 22 20 22 73 74 ame" "state" "st
04d0: 61 74 75 73 22 20 22 6f 77 6e 65 72 22 20 22 65 atus" "owner" "e
04e0: 76 65 6e 74 5f 74 69 6d 65 22 29 29 29 0a 09 20 vent_time")))..
04f0: 28 6b 65 79 73 74 72 20 20 20 28 63 61 72 20 74 (keystr (car t
0500: 6d 70 29 29 0a 09 20 28 68 65 61 64 65 72 20 20 mp)).. (header
0510: 20 28 63 61 64 72 20 74 6d 70 29 29 0a 09 20 28 (cadr tmp)).. (
0520: 72 65 73 20 20 20 20 20 27 28 29 29 0a 09 20 28 res '()).. (
0530: 6b 65 79 2d 70 61 74 74 20 22 22 29 0a 09 20 28 key-patt "").. (
0540: 72 75 6e 77 69 6c 64 74 79 70 65 20 28 69 66 20 runwildtype (if
0550: 28 73 75 62 73 74 72 69 6e 67 2d 69 6e 64 65 78 (substring-index
0560: 20 22 25 22 20 72 75 6e 6e 61 6d 65 70 61 74 74 "%" runnamepatt
0570: 29 20 22 6c 69 6b 65 22 20 22 67 6c 6f 62 22 29 ) "like" "glob")
0580: 29 0a 09 20 28 71 72 79 2d 73 74 72 20 20 23 66 ).. (qry-str #f
0590: 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 )). (for-each
05a0: 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 76 61 6c (lambda (keyval
05b0: 29 0a 09 09 28 6c 65 74 2a 20 28 28 6b 65 79 20 )...(let* ((key
05c0: 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 6b (vector-ref k
05d0: 65 79 76 61 6c 20 30 29 29 0a 09 09 20 20 20 20 eyval 0))...
05e0: 20 20 20 28 66 75 6c 6b 65 79 20 28 63 6f 6e 63 (fulkey (conc
05f0: 20 22 3a 22 20 6b 65 79 29 29 0a 09 09 20 20 20 ":" key))...
0600: 20 20 20 20 28 70 61 74 74 20 20 20 28 61 72 67 (patt (arg
0610: 73 3a 67 65 74 2d 61 72 67 20 66 75 6c 6b 65 79 s:get-arg fulkey
0620: 29 29 0a 09 09 20 20 20 20 20 20 20 28 77 69 6c ))... (wil
0630: 64 74 79 70 65 20 28 69 66 20 28 73 75 62 73 74 dtype (if (subst
0640: 72 69 6e 67 2d 69 6e 64 65 78 20 22 25 22 20 70 ring-index "%" p
0650: 61 74 74 29 20 22 6c 69 6b 65 22 20 22 67 6c 6f att) "like" "glo
0660: 62 22 29 29 29 0a 09 09 20 20 28 69 66 20 70 61 b")))... (if pa
0670: 74 74 0a 09 09 20 20 20 20 20 20 28 73 65 74 21 tt... (set!
0680: 20 6b 65 79 2d 70 61 74 74 20 28 63 6f 6e 63 20 key-patt (conc
0690: 6b 65 79 2d 70 61 74 74 20 22 20 41 4e 44 20 22 key-patt " AND "
06a0: 20 6b 65 79 20 22 20 22 20 77 69 6c 64 74 79 70 key " " wildtyp
06b0: 65 20 22 20 27 22 20 70 61 74 74 20 22 27 22 29 e " '" patt "'")
06c0: 29 0a 09 09 20 20 20 20 20 20 28 62 65 67 69 6e )... (begin
06d0: 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 ....(debug:print
06e0: 20 30 20 22 45 52 52 4f 52 3a 20 73 65 61 72 63 0 "ERROR: searc
06f0: 68 69 6e 67 20 66 6f 72 20 72 75 6e 73 20 77 69 hing for runs wi
0700: 74 68 20 6e 6f 20 70 61 74 74 65 72 6e 20 73 65 th no pattern se
0710: 74 20 66 6f 72 20 22 20 66 75 6c 6b 65 79 29 0a t for " fulkey).
0720: 09 09 09 28 65 78 69 74 20 36 29 29 29 29 29 0a ...(exit 6))))).
0730: 09 20 20 20 20 20 20 6b 65 79 73 29 0a 20 20 20 . keys).
0740: 20 28 73 65 74 21 20 71 72 79 2d 73 74 72 20 28 (set! qry-str (
0750: 63 6f 6e 63 20 22 53 45 4c 45 43 54 20 22 20 6b conc "SELECT " k
0760: 65 79 73 74 72 20 22 20 46 52 4f 4d 20 72 75 6e eystr " FROM run
0770: 73 20 57 48 45 52 45 20 72 75 6e 6e 61 6d 65 20 s WHERE runname
0780: 22 20 72 75 6e 77 69 6c 64 74 79 70 65 20 22 20 " runwildtype "
0790: 3f 20 22 20 6b 65 79 2d 70 61 74 74 20 22 3b 22 ? " key-patt ";"
07a0: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 )). (debug:pr
07b0: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 72 75 6e 73 int-info 4 "runs
07c0: 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74 :get-runs-by-pat
07d0: 74 20 71 72 79 3d 22 20 71 72 79 2d 73 74 72 20 t qry=" qry-str
07e0: 22 20 22 20 72 75 6e 6e 61 6d 65 70 61 74 74 29 " " runnamepatt)
07f0: 0a 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66 6f . (sqlite3:fo
0800: 72 2d 65 61 63 68 2d 72 6f 77 20 0a 20 20 20 20 r-each-row .
0810: 20 28 6c 61 6d 62 64 61 20 28 61 20 2e 20 72 29 (lambda (a . r)
0820: 0a 20 20 20 20 20 20 20 28 73 65 74 21 20 72 65 . (set! re
0830: 73 20 28 63 6f 6e 73 20 28 6c 69 73 74 2d 3e 76 s (cons (list->v
0840: 65 63 74 6f 72 20 28 63 6f 6e 73 20 61 20 72 29 ector (cons a r)
0850: 29 20 72 65 73 29 29 29 0a 20 20 20 20 20 64 62 ) res))). db
0860: 20 0a 20 20 20 20 20 71 72 79 2d 73 74 72 0a 20 . qry-str.
0870: 20 20 20 20 72 75 6e 6e 61 6d 65 70 61 74 74 29 runnamepatt)
0880: 0a 20 20 20 20 28 76 65 63 74 6f 72 20 68 65 61 . (vector hea
0890: 64 65 72 20 72 65 73 29 29 29 0a 0a 28 64 65 66 der res)))..(def
08a0: 69 6e 65 20 28 72 75 6e 73 3a 74 65 73 74 2d 67 ine (runs:test-g
08b0: 65 74 2d 66 75 6c 6c 2d 70 61 74 68 20 74 65 73 et-full-path tes
08c0: 74 29 0a 20 20 28 6c 65 74 2a 20 28 28 74 65 73 t). (let* ((tes
08d0: 74 6e 61 6d 65 20 28 64 62 3a 74 65 73 74 2d 67 tname (db:test-g
08e0: 65 74 2d 74 65 73 74 6e 61 6d 65 20 20 20 74 65 et-testname te
08f0: 73 74 29 29 0a 09 20 28 69 74 65 6d 70 61 74 68 st)).. (itempath
0900: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 (db:test-get-it
0910: 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29 29 0a em-path test))).
0920: 20 20 20 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 (conc testna
0930: 6d 65 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69 me (if (equal? i
0940: 74 65 6d 70 61 74 68 20 22 22 29 20 22 22 20 28 tempath "") "" (
0950: 63 6f 6e 63 20 22 28 22 20 69 74 65 6d 70 61 74 conc "(" itempat
0960: 68 20 22 29 22 29 29 29 29 29 0a 0a 28 64 65 66 h ")")))))..(def
0970: 69 6e 65 20 28 64 62 3a 67 65 74 2d 72 75 6e 2d ine (db:get-run-
0980: 6b 65 79 2d 76 61 6c 20 64 62 20 72 75 6e 2d 69 key-val db run-i
0990: 64 20 6b 65 79 29 0a 20 20 28 6c 65 74 20 28 28 d key). (let ((
09a0: 72 65 73 20 23 66 29 29 0a 20 20 20 20 28 73 71 res #f)). (sq
09b0: 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 lite3:for-each-r
09c0: 6f 77 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 ow. (lambda
09d0: 28 76 61 6c 29 0a 20 20 20 20 20 20 20 28 73 65 (val). (se
09e0: 74 21 20 72 65 73 20 76 61 6c 29 29 0a 20 20 20 t! res val)).
09f0: 20 20 64 62 20 0a 20 20 20 20 20 28 63 6f 6e 63 db . (conc
0a00: 20 22 53 45 4c 45 43 54 20 22 20 28 6b 65 79 3a "SELECT " (key:
0a10: 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 get-fieldname ke
0a20: 79 29 20 22 20 46 52 4f 4d 20 72 75 6e 73 20 57 y) " FROM runs W
0a30: 48 45 52 45 20 69 64 3d 3f 3b 22 29 0a 20 20 20 HERE id=?;").
0a40: 20 20 72 75 6e 2d 69 64 29 0a 20 20 20 20 72 65 run-id). re
0a50: 73 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 64 62 s))..(define (db
0a60: 3a 67 65 74 2d 72 75 6e 2d 6e 61 6d 65 2d 66 72 :get-run-name-fr
0a70: 6f 6d 2d 69 64 20 64 62 20 72 75 6e 2d 69 64 29 om-id db run-id)
0a80: 0a 20 20 28 6c 65 74 20 28 28 72 65 73 20 23 66 . (let ((res #f
0a90: 29 29 0a 20 20 20 20 28 73 71 6c 69 74 65 33 3a )). (sqlite3:
0aa0: 66 6f 72 2d 65 61 63 68 2d 72 6f 77 0a 20 20 20 for-each-row.
0ab0: 20 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 6e 61 (lambda (runna
0ac0: 6d 65 29 0a 20 20 20 20 20 20 20 28 73 65 74 21 me). (set!
0ad0: 20 72 65 73 20 72 75 6e 6e 61 6d 65 29 29 0a 20 res runname)).
0ae0: 20 20 20 20 64 62 0a 20 20 20 20 20 22 53 45 4c db. "SEL
0af0: 45 43 54 20 72 75 6e 6e 61 6d 65 20 46 52 4f 4d ECT runname FROM
0b00: 20 72 75 6e 73 20 57 48 45 52 45 20 69 64 3d 3f runs WHERE id=?
0b10: 3b 22 0a 20 20 20 20 20 72 75 6e 2d 69 64 29 0a ;". run-id).
0b20: 20 20 20 20 72 65 73 29 29 0a 0a 28 64 65 66 69 res))..(defi
0b30: 6e 65 20 28 73 65 74 2d 6d 65 67 61 74 65 73 74 ne (set-megatest
0b40: 2d 65 6e 76 2d 76 61 72 73 20 72 75 6e 2d 69 64 -env-vars run-id
0b50: 29 0a 20 20 28 6c 65 74 20 28 28 6b 65 79 73 20 ). (let ((keys
0b60: 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 (cdb:remote-run
0b70: 64 62 3a 67 65 74 2d 6b 65 79 73 20 23 66 29 29 db:get-keys #f))
0b80: 0a 09 28 76 61 6c 73 20 28 68 61 73 68 2d 74 61 ..(vals (hash-ta
0b90: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 ble-ref/default
0ba0: 2a 65 6e 76 2d 76 61 72 73 2d 62 79 2d 72 75 6e *env-vars-by-run
0bb0: 2d 69 64 2a 20 72 75 6e 2d 69 64 20 23 66 29 29 -id* run-id #f))
0bc0: 29 0a 20 20 20 20 3b 3b 20 67 65 74 20 74 68 65 ). ;; get the
0bd0: 20 69 6e 66 6f 20 66 72 6f 6d 20 74 68 65 20 64 info from the d
0be0: 62 20 61 6e 64 20 70 75 74 20 69 74 20 69 6e 20 b and put it in
0bf0: 74 68 65 20 63 61 63 68 65 0a 20 20 20 20 28 69 the cache. (i
0c00: 66 20 28 6e 6f 74 20 76 61 6c 73 29 0a 09 28 6c f (not vals)..(l
0c10: 65 74 20 28 28 68 74 20 28 6d 61 6b 65 2d 68 61 et ((ht (make-ha
0c20: 73 68 2d 74 61 62 6c 65 29 29 29 0a 09 20 20 28 sh-table))).. (
0c30: 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 hash-table-set!
0c40: 2a 65 6e 76 2d 76 61 72 73 2d 62 79 2d 72 75 6e *env-vars-by-run
0c50: 2d 69 64 2a 20 72 75 6e 2d 69 64 20 68 74 29 0a -id* run-id ht).
0c60: 09 20 20 28 73 65 74 21 20 76 61 6c 73 20 68 74 . (set! vals ht
0c70: 29 0a 09 20 20 28 66 6f 72 2d 65 61 63 68 0a 09 ).. (for-each..
0c80: 20 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 29 (lambda (key)
0c90: 0a 09 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 .. (hash-tab
0ca0: 6c 65 2d 73 65 74 21 20 76 61 6c 73 20 6b 65 79 le-set! vals key
0cb0: 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e (cdb:remote-run
0cc0: 20 64 62 3a 67 65 74 2d 72 75 6e 2d 6b 65 79 2d db:get-run-key-
0cd0: 76 61 6c 20 23 66 20 72 75 6e 2d 69 64 20 6b 65 val #f run-id ke
0ce0: 79 29 29 29 0a 09 20 20 20 6b 65 79 73 29 29 29 y))).. keys)))
0cf0: 0a 20 20 20 20 3b 3b 20 66 72 6f 6d 20 74 68 65 . ;; from the
0d00: 20 63 61 63 68 65 64 20 64 61 74 61 20 73 65 74 cached data set
0d10: 20 74 68 65 20 76 61 72 73 0a 20 20 20 20 28 68 the vars. (h
0d20: 61 73 68 2d 74 61 62 6c 65 2d 66 6f 72 2d 65 61 ash-table-for-ea
0d30: 63 68 0a 20 20 20 20 20 76 61 6c 73 0a 20 20 20 ch. vals.
0d40: 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 20 76 (lambda (key v
0d50: 61 6c 29 0a 20 20 20 20 20 20 20 28 64 65 62 75 al). (debu
0d60: 67 3a 70 72 69 6e 74 20 32 20 22 73 65 74 65 6e g:print 2 "seten
0d70: 76 20 22 20 28 6b 65 79 3a 67 65 74 2d 66 69 65 v " (key:get-fie
0d80: 6c 64 6e 61 6d 65 20 6b 65 79 29 20 22 20 22 20 ldname key) " "
0d90: 76 61 6c 29 0a 20 20 20 20 20 20 20 28 73 65 74 val). (set
0da0: 65 6e 76 20 28 6b 65 79 3a 67 65 74 2d 66 69 65 env (key:get-fie
0db0: 6c 64 6e 61 6d 65 20 6b 65 79 29 20 76 61 6c 29 ldname key) val)
0dc0: 29 29 0a 20 20 20 20 28 61 6c 69 73 74 2d 3e 65 )). (alist->e
0dd0: 6e 76 2d 76 61 72 73 20 28 68 61 73 68 2d 74 61 nv-vars (hash-ta
0de0: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 ble-ref/default
0df0: 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 65 6e 76 *configdat* "env
0e00: 2d 6f 76 65 72 72 69 64 65 22 20 27 28 29 29 29 -override" '()))
0e10: 0a 20 20 20 20 3b 3b 20 4c 65 74 73 20 75 73 65 . ;; Lets use
0e20: 20 74 68 69 73 20 61 73 20 61 6e 20 6f 70 70 6f this as an oppo
0e30: 72 74 75 6e 69 74 79 20 74 6f 20 70 75 74 20 4d rtunity to put M
0e40: 54 5f 52 55 4e 4e 41 4d 45 20 69 6e 20 74 68 65 T_RUNNAME in the
0e50: 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 20 20 20 environment.
0e60: 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e (setenv "MT_RUN
0e70: 4e 41 4d 45 22 20 28 63 64 62 3a 72 65 6d 6f 74 NAME" (cdb:remot
0e80: 65 2d 72 75 6e 20 64 62 3a 67 65 74 2d 72 75 6e e-run db:get-run
0e90: 2d 6e 61 6d 65 2d 66 72 6f 6d 2d 69 64 20 23 66 -name-from-id #f
0ea0: 20 72 75 6e 2d 69 64 29 29 0a 20 20 20 20 28 73 run-id)). (s
0eb0: 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e 5f 41 52 etenv "MT_RUN_AR
0ec0: 45 41 5f 48 4f 4d 45 22 20 2a 74 6f 70 70 61 74 EA_HOME" *toppat
0ed0: 68 2a 29 0a 20 20 20 20 29 29 0a 0a 28 64 65 66 h*). ))..(def
0ee0: 69 6e 65 20 28 73 65 74 2d 69 74 65 6d 2d 65 6e ine (set-item-en
0ef0: 76 2d 76 61 72 73 20 69 74 65 6d 64 61 74 29 0a v-vars itemdat).
0f00: 20 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d (for-each (lam
0f10: 62 64 61 20 28 69 74 65 6d 29 0a 09 20 20 20 20 bda (item)..
0f20: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 (debug:print 2
0f30: 20 22 73 65 74 65 6e 76 20 22 20 28 63 61 72 20 "setenv " (car
0f40: 69 74 65 6d 29 20 22 20 22 20 28 63 61 64 72 20 item) " " (cadr
0f50: 69 74 65 6d 29 29 0a 09 20 20 20 20 20 20 28 73 item)).. (s
0f60: 65 74 65 6e 76 20 28 63 61 72 20 69 74 65 6d 29 etenv (car item)
0f70: 20 28 63 61 64 72 20 69 74 65 6d 29 29 29 0a 09 (cadr item)))..
0f80: 20 20 20 20 69 74 65 6d 64 61 74 29 29 0a 0a 28 itemdat))..(
0f90: 64 65 66 69 6e 65 20 2a 6c 61 73 74 2d 6e 75 6d define *last-num
0fa0: 2d 72 75 6e 6e 69 6e 67 2d 74 65 73 74 73 2a 20 -running-tests*
0fb0: 30 29 0a 0a 3b 3b 20 45 76 65 72 79 20 74 69 6d 0)..;; Every tim
0fc0: 65 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 e can-run-more-t
0fd0: 65 73 74 73 20 69 73 20 63 61 6c 6c 65 64 20 69 ests is called i
0fe0: 6e 63 72 65 6d 65 6e 74 20 74 68 65 20 64 65 6c ncrement the del
0ff0: 61 79 0a 3b 3b 20 69 66 20 74 68 65 20 63 6f 75 ay.;; if the cou
1000: 0a 28 64 65 66 69 6e 65 20 2a 72 75 6e 73 3a 63 .(define *runs:c
1010: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 an-run-more-test
1020: 73 2d 63 6f 75 6e 74 2a 20 30 29 0a 28 64 65 66 s-count* 0).(def
1030: 69 6e 65 20 28 72 75 6e 73 3a 73 68 72 69 6e 6b ine (runs:shrink
1040: 2d 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 -can-run-more-te
1050: 73 74 73 2d 63 6f 75 6e 74 29 0a 20 20 28 73 65 sts-count). (se
1060: 74 21 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75 6e t! *runs:can-run
1070: 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 63 6f 75 6e -more-tests-coun
1080: 74 2a 20 30 29 29 20 3b 3b 20 28 2f 20 2a 72 75 t* 0)) ;; (/ *ru
1090: 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d ns:can-run-more-
10a0: 74 65 73 74 73 2d 63 6f 75 6e 74 2a 20 32 29 29 tests-count* 2))
10b0: 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 )..(define (runs
10c0: 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 :can-run-more-te
10d0: 73 74 73 20 74 65 73 74 2d 72 65 63 6f 72 64 20 sts test-record
10e0: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a max-concurrent-j
10f0: 6f 62 73 29 0a 20 20 28 74 68 72 65 61 64 2d 73 obs). (thread-s
1100: 6c 65 65 70 21 20 28 63 6f 6e 64 0a 09 09 20 20 leep! (cond...
1110: 28 28 3e 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75 ((> *runs:can-ru
1120: 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 63 6f 75 n-more-tests-cou
1130: 6e 74 2a 20 32 30 29 20 32 29 3b 3b 20 6f 62 76 nt* 20) 2);; obv
1140: 69 6f 75 73 6c 79 20 68 61 76 65 6e 27 74 20 68 iously haven't h
1150: 61 64 20 61 6e 79 20 77 6f 72 6b 20 74 6f 20 64 ad any work to d
1160: 6f 20 66 6f 72 20 61 20 77 68 69 6c 65 0a 09 09 o for a while...
1170: 20 20 28 65 6c 73 65 20 30 29 29 29 0a 20 20 28 (else 0))). (
1180: 6c 65 74 2a 20 28 28 74 63 6f 6e 66 69 67 20 20 let* ((tconfig
1190: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 (
11a0: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d tests:testqueue-
11b0: 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 74 get-testconfig t
11c0: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 est-record)).. (
11d0: 6a 6f 62 67 72 6f 75 70 20 20 20 20 20 20 20 20 jobgroup
11e0: 20 20 20 20 20 20 20 20 28 63 6f 6e 66 69 67 2d (config-
11f0: 6c 6f 6f 6b 75 70 20 74 63 6f 6e 66 69 67 20 22 lookup tconfig "
1200: 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 6a requirements" "j
1210: 6f 62 67 72 6f 75 70 22 29 29 0a 09 20 28 6e 75 obgroup")).. (nu
1220: 6d 2d 72 75 6e 6e 69 6e 67 20 20 20 20 20 20 20 m-running
1230: 20 20 20 20 20 20 28 63 64 62 3a 72 65 6d 6f 74 (cdb:remot
1240: 65 2d 72 75 6e 20 64 62 3a 67 65 74 2d 63 6f 75 e-run db:get-cou
1250: 6e 74 2d 74 65 73 74 73 2d 72 75 6e 6e 69 6e 67 nt-tests-running
1260: 20 23 66 29 29 0a 09 20 28 6e 75 6d 2d 72 75 6e #f)).. (num-run
1270: 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 ning-in-jobgroup
1280: 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e (cdb:remote-run
1290: 20 64 62 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 65 db:get-count-te
12a0: 73 74 73 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a sts-running-in-j
12b0: 6f 62 67 72 6f 75 70 20 23 66 20 6a 6f 62 67 72 obgroup #f jobgr
12c0: 6f 75 70 29 29 0a 09 20 28 6a 6f 62 2d 67 72 6f oup)).. (job-gro
12d0: 75 70 2d 6c 69 6d 69 74 20 20 20 20 20 20 20 20 up-limit
12e0: 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 (config-lookup
12f0: 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 6a 6f 62 *configdat* "job
1300: 67 72 6f 75 70 73 22 20 6a 6f 62 67 72 6f 75 70 groups" jobgroup
1310: 29 29 29 0a 20 20 20 20 28 69 66 20 28 3e 20 28 ))). (if (> (
1320: 2b 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 6e 75 + num-running nu
1330: 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 m-running-in-job
1340: 67 72 6f 75 70 29 20 30 29 0a 09 28 73 65 74 21 group) 0)..(set!
1350: 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d *runs:can-run-m
1360: 6f 72 65 2d 74 65 73 74 73 2d 63 6f 75 6e 74 2a ore-tests-count*
1370: 20 28 2b 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75 (+ *runs:can-ru
1380: 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 63 6f 75 n-more-tests-cou
1390: 6e 74 2a 20 31 29 29 29 0a 20 20 20 20 28 69 66 nt* 1))). (if
13a0: 20 28 6e 6f 74 20 28 65 71 3f 20 2a 6c 61 73 74 (not (eq? *last
13b0: 2d 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 74 65 73 -num-running-tes
13c0: 74 73 2a 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 ts* num-running)
13d0: 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 64 65 )..(begin.. (de
13e0: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 6d 61 78 bug:print 2 "max
13f0: 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 -concurrent-jobs
1400: 3a 20 22 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 : " max-concurre
1410: 6e 74 2d 6a 6f 62 73 20 22 2c 20 6e 75 6d 2d 72 nt-jobs ", num-r
1420: 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 unning: " num-ru
1430: 6e 6e 69 6e 67 29 0a 09 20 20 28 73 65 74 21 20 nning).. (set!
1440: 2a 6c 61 73 74 2d 6e 75 6d 2d 72 75 6e 6e 69 6e *last-num-runnin
1450: 67 2d 74 65 73 74 73 2a 20 6e 75 6d 2d 72 75 6e g-tests* num-run
1460: 6e 69 6e 67 29 29 29 0a 20 20 20 20 28 69 66 20 ning))). (if
1470: 28 6e 6f 74 20 28 65 71 3f 20 30 20 2a 67 6c 6f (not (eq? 0 *glo
1480: 62 61 6c 65 78 69 74 73 74 61 74 75 73 2a 29 29 balexitstatus*))
1490: 0a 09 28 6c 69 73 74 20 23 66 20 6e 75 6d 2d 72 ..(list #f num-r
14a0: 75 6e 6e 69 6e 67 20 6e 75 6d 2d 72 75 6e 6e 69 unning num-runni
14b0: 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 6d ng-in-jobgroup m
14c0: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f ax-concurrent-jo
14d0: 62 73 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d bs job-group-lim
14e0: 69 74 29 0a 09 28 6c 65 74 20 28 28 63 61 6e 2d it)..(let ((can-
14f0: 6e 6f 74 2d 72 75 6e 2d 6d 6f 72 65 20 28 63 6f not-run-more (co
1500: 6e 64 0a 09 09 09 09 20 3b 3b 20 69 66 20 6d 61 nd..... ;; if ma
1510: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 x-concurrent-job
1520: 73 20 69 73 20 73 65 74 20 61 6e 64 20 74 68 65 s is set and the
1530: 20 6e 75 6d 62 65 72 20 72 75 6e 6e 69 6e 67 20 number running
1540: 69 73 20 67 72 65 61 74 65 72 20 0a 09 09 09 09 is greater .....
1550: 20 3b 3b 20 74 68 61 6e 20 69 74 20 74 68 61 6e ;; than it than
1560: 20 63 61 6e 6e 6f 74 20 72 75 6e 20 6d 6f 72 65 cannot run more
1570: 20 6a 6f 62 73 0a 09 09 09 09 20 28 28 61 6e 64 jobs..... ((and
1580: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d max-concurrent-
1590: 6a 6f 62 73 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e jobs (>= num-run
15a0: 6e 69 6e 67 20 6d 61 78 2d 63 6f 6e 63 75 72 72 ning max-concurr
15b0: 65 6e 74 2d 6a 6f 62 73 29 29 0a 09 09 09 09 20 ent-jobs)).....
15c0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 (debug:print 0
15d0: 22 57 41 52 4e 49 4e 47 3a 20 4d 61 78 20 72 75 "WARNING: Max ru
15e0: 6e 6e 69 6e 67 20 6a 6f 62 73 20 65 78 63 65 65 nning jobs excee
15f0: 64 65 64 2c 20 63 75 72 72 65 6e 74 20 6e 75 6d ded, current num
1600: 62 65 72 20 72 75 6e 6e 69 6e 67 3a 20 22 20 6e ber running: " n
1610: 75 6d 2d 72 75 6e 6e 69 6e 67 20 0a 09 09 09 09 um-running .....
1620: 09 20 20 20 20 20 20 20 22 2c 20 6d 61 78 5f 63 . ", max_c
1630: 6f 6e 63 75 72 72 65 6e 74 5f 6a 6f 62 73 3a 20 oncurrent_jobs:
1640: 22 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 " max-concurrent
1650: 2d 6a 6f 62 73 29 0a 09 09 09 09 20 20 23 74 29 -jobs)..... #t)
1660: 0a 09 09 09 09 20 3b 3b 20 69 66 20 6a 6f 62 2d ..... ;; if job-
1670: 67 72 6f 75 70 2d 6c 69 6d 69 74 20 69 73 20 73 group-limit is s
1680: 65 74 20 61 6e 64 20 6e 75 6d 62 65 72 20 6f 66 et and number of
1690: 20 6a 6f 62 73 20 69 6e 20 74 68 65 20 67 72 6f jobs in the gro
16a0: 75 70 20 69 73 20 67 72 65 61 74 65 72 0a 09 09 up is greater...
16b0: 09 09 20 3b 3b 20 74 68 61 6e 20 74 68 65 20 6c .. ;; than the l
16c0: 69 6d 69 74 20 74 68 65 6e 20 63 61 6e 6e 6f 74 imit then cannot
16d0: 20 72 75 6e 20 6d 6f 72 65 20 6a 6f 62 73 20 6f run more jobs o
16e0: 66 20 74 68 69 73 20 6b 69 6e 64 0a 09 09 09 09 f this kind.....
16f0: 20 28 28 61 6e 64 20 6a 6f 62 2d 67 72 6f 75 70 ((and job-group
1700: 2d 6c 69 6d 69 74 0a 09 09 09 09 20 20 20 20 20 -limit.....
1710: 20 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e (>= num-runnin
1720: 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 6a 6f g-in-jobgroup jo
1730: 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 29 29 0a b-group-limit)).
1740: 09 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 .... (debug:pri
1750: 6e 74 20 31 20 22 57 41 52 4e 49 4e 47 3a 20 6e nt 1 "WARNING: n
1760: 75 6d 62 65 72 20 6f 66 20 6a 6f 62 73 20 22 20 umber of jobs "
1770: 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a num-running-in-j
1780: 6f 62 67 72 6f 75 70 20 0a 09 09 09 09 09 20 20 obgroup ......
1790: 20 20 20 20 20 22 20 69 6e 20 22 20 6a 6f 62 67 " in " jobg
17a0: 72 6f 75 70 20 22 20 65 78 63 65 65 64 65 64 2c roup " exceeded,
17b0: 20 77 69 6c 6c 20 6e 6f 74 20 72 75 6e 20 22 20 will not run "
17c0: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 (tests:testqueue
17d0: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 -get-testname te
17e0: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 09 09 st-record)).....
17f0: 20 20 23 74 29 0a 09 09 09 09 20 28 65 6c 73 65 #t)..... (else
1800: 20 23 66 29 29 29 29 0a 09 20 20 28 6c 69 73 74 #f)))).. (list
1810: 20 28 6e 6f 74 20 63 61 6e 2d 6e 6f 74 2d 72 75 (not can-not-ru
1820: 6e 2d 6d 6f 72 65 29 20 6e 75 6d 2d 72 75 6e 6e n-more) num-runn
1830: 69 6e 67 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d ing num-running-
1840: 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 6d 61 78 2d in-jobgroup max-
1850: 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 concurrent-jobs
1860: 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 29 job-group-limit)
1870: 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d ))))..;;========
1880: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1890: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
18a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
18b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b ==============.;
18c0: 3b 20 4e 65 77 20 6d 65 74 68 6f 64 6f 6c 6f 67 ; New methodolog
18d0: 79 2e 20 54 68 65 73 65 20 72 6f 75 74 69 6e 65 y. These routine
18e0: 73 20 77 69 6c 6c 20 72 65 70 6c 61 63 65 20 74 s will replace t
18f0: 68 65 20 61 62 6f 76 65 20 69 6e 20 74 69 6d 65 he above in time
1900: 2e 20 46 6f 72 0a 3b 3b 20 6e 6f 77 20 74 68 65 . For.;; now the
1910: 20 63 6f 64 65 20 69 73 20 64 75 70 6c 69 63 61 code is duplica
1920: 74 65 64 2e 20 54 68 69 73 20 73 74 75 66 66 20 ted. This stuff
1930: 69 73 20 69 6e 69 74 69 61 6c 6c 79 20 75 73 65 is initially use
1940: 64 20 69 6e 20 74 68 65 20 6d 6f 6e 69 74 6f 72 d in the monitor
1950: 0a 3b 3b 20 62 61 73 65 64 20 63 6f 64 65 2e 0a .;; based code..
1960: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;;==============
1970: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1980: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1990: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
19a0: 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 0a 3b 3b 20 54 68 ========...;; Th
19b0: 69 73 20 69 73 20 61 20 64 75 70 6c 69 63 61 74 is is a duplicat
19c0: 65 20 6f 66 20 72 75 6e 2d 74 65 73 74 73 20 28 e of run-tests (
19d0: 77 68 69 63 68 20 68 61 73 20 62 65 65 6e 20 64 which has been d
19e0: 65 70 72 65 63 61 74 65 64 29 2e 20 55 73 65 20 eprecated). Use
19f0: 74 68 69 73 20 6f 6e 65 20 69 6e 73 74 65 61 64 this one instead
1a00: 20 6f 66 20 72 75 6e 20 74 65 73 74 73 2e 0a 3b of run tests..;
1a10: 3b 20 6b 65 79 76 61 6c 73 2e 0a 3b 3b 0a 3b 3b ; keyvals..;;.;;
1a20: 20 20 74 65 73 74 2d 6e 61 6d 65 73 3a 20 43 6f test-names: Co
1a30: 6d 6d 61 20 73 65 70 61 72 61 74 65 64 20 70 61 mma separated pa
1a40: 74 74 65 72 6e 73 20 73 61 6d 65 20 61 73 20 74 tterns same as t
1a50: 65 73 74 2d 70 61 74 74 73 20 62 75 74 20 75 73 est-patts but us
1a60: 65 64 20 69 6e 20 73 65 6c 65 63 74 69 6f 6e 20 ed in selection
1a70: 0a 3b 3b 20 20 20 20 20 20 20 20 20 20 20 20 20 .;;
1a80: 20 6f 66 20 74 65 73 74 73 20 74 6f 20 72 75 6e of tests to run
1a90: 2e 20 54 68 65 20 69 74 65 6d 20 70 6f 72 74 69 . The item porti
1aa0: 6f 6e 73 20 61 72 65 20 6e 6f 74 20 72 65 73 70 ons are not resp
1ab0: 65 63 74 65 64 2e 0a 3b 3b 20 20 20 20 20 20 20 ected..;;
1ac0: 20 20 20 20 20 20 20 46 49 58 4d 45 3a 20 65 72 FIXME: er
1ad0: 72 6f 72 20 6f 75 74 20 69 66 20 2f 70 61 74 74 ror out if /patt
1ae0: 20 73 70 65 63 69 66 69 65 64 0a 3b 3b 20 20 20 specified.;;
1af0: 20 20 20 20 20 20 20 20 20 0a 28 64 65 66 69 6e .(defin
1b00: 65 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 e (runs:run-test
1b10: 73 20 74 61 72 67 65 74 20 72 75 6e 6e 61 6d 65 s target runname
1b20: 20 74 65 73 74 2d 6e 61 6d 65 73 20 74 65 73 74 test-names test
1b30: 2d 70 61 74 74 73 20 75 73 65 72 20 66 6c 61 67 -patts user flag
1b40: 73 29 0a 20 20 28 63 6f 6d 6d 6f 6e 3a 63 6c 65 s). (common:cle
1b50: 61 72 2d 63 61 63 68 65 73 29 20 3b 3b 20 63 6c ar-caches) ;; cl
1b60: 65 61 72 20 61 6c 6c 20 63 61 63 68 65 73 0a 20 ear all caches.
1b70: 20 28 6c 65 74 2a 20 28 28 64 62 20 20 20 20 20 (let* ((db
1b80: 20 20 20 20 20 23 66 29 0a 09 20 28 6b 65 79 73 #f).. (keys
1b90: 20 20 20 20 20 20 20 20 28 63 64 62 3a 72 65 6d (cdb:rem
1ba0: 6f 74 65 2d 72 75 6e 20 64 62 3a 67 65 74 2d 6b ote-run db:get-k
1bb0: 65 79 73 20 23 66 29 29 0a 09 20 28 6b 65 79 76 eys #f)).. (keyv
1bc0: 61 6c 6c 73 74 20 20 20 28 6b 65 79 73 3a 74 61 allst (keys:ta
1bd0: 72 67 65 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 79 rget->keyval key
1be0: 73 20 74 61 72 67 65 74 29 29 0a 09 20 28 72 75 s target)).. (ru
1bf0: 6e 2d 69 64 20 20 20 20 20 20 28 63 64 62 3a 72 n-id (cdb:r
1c00: 65 6d 6f 74 65 2d 72 75 6e 20 64 62 3a 72 65 67 emote-run db:reg
1c10: 69 73 74 65 72 2d 72 75 6e 20 23 66 20 6b 65 79 ister-run #f key
1c20: 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e s keyvallst runn
1c30: 61 6d 65 20 22 6e 65 77 22 20 22 6e 2f 61 22 20 ame "new" "n/a"
1c40: 75 73 65 72 29 29 20 20 3b 3b 20 20 74 65 73 74 user)) ;; test
1c50: 2d 6e 61 6d 65 29 29 29 0a 09 20 28 6b 65 79 76 -name))).. (keyv
1c60: 61 6c 73 20 20 20 20 20 28 69 66 20 72 75 6e 2d als (if run-
1c70: 69 64 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 id (cdb:remote-r
1c80: 75 6e 20 64 62 3a 67 65 74 2d 6b 65 79 2d 76 61 un db:get-key-va
1c90: 6c 73 20 23 66 20 72 75 6e 2d 69 64 29 20 23 66 ls #f run-id) #f
1ca0: 29 29 0a 09 20 28 64 65 66 65 72 72 65 64 20 20 )).. (deferred
1cb0: 20 20 27 28 29 29 20 3b 3b 20 64 65 6c 61 79 20 '()) ;; delay
1cc0: 72 75 6e 6e 69 6e 67 20 74 68 65 73 65 20 73 69 running these si
1cd0: 6e 63 65 20 74 68 65 79 20 68 61 76 65 20 61 20 nce they have a
1ce0: 77 61 69 74 6f 6e 20 63 6c 61 75 73 65 0a 09 20 waiton clause..
1cf0: 3b 3b 20 6b 65 65 70 67 6f 69 6e 67 20 69 73 20 ;; keepgoing is
1d00: 74 68 65 20 64 65 66 61 63 74 6f 20 6d 6f 64 61 the defacto moda
1d10: 6c 69 74 79 20 6e 6f 77 2c 20 77 69 6c 6c 20 61 lity now, will a
1d20: 64 64 20 68 69 74 2d 6e 2d 72 75 6e 20 61 20 62 dd hit-n-run a b
1d30: 69 74 20 6c 61 74 65 72 0a 09 20 3b 3b 20 28 6b it later.. ;; (k
1d40: 65 65 70 67 6f 69 6e 67 20 20 20 28 68 61 73 68 eepgoing (hash
1d50: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 -table-ref/defau
1d60: 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 65 70 67 lt flags "-keepg
1d70: 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 28 72 75 oing" #f)).. (ru
1d80: 6e 63 6f 6e 66 69 67 66 20 20 20 28 63 6f 6e 63 nconfigf (conc
1d90: 20 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72 75 *toppath* "/ru
1da0: 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22 nconfigs.config"
1db0: 29 29 0a 09 20 28 72 65 71 75 69 72 65 64 2d 74 )).. (required-t
1dc0: 65 73 74 73 20 27 28 29 29 0a 09 20 28 74 65 73 ests '()).. (tes
1dd0: 74 2d 72 65 63 6f 72 64 73 20 28 6d 61 6b 65 2d t-records (make-
1de0: 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 0a 20 hash-table)))..
1df0: 20 20 20 28 73 65 74 2d 6d 65 67 61 74 65 73 74 (set-megatest
1e00: 2d 65 6e 76 2d 76 61 72 73 20 72 75 6e 2d 69 64 -env-vars run-id
1e10: 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62 ) ;; these may b
1e20: 65 20 6e 65 65 64 65 64 20 62 79 20 74 68 65 20 e needed by the
1e30: 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 launching proces
1e40: 73 0a 0a 20 20 20 20 28 69 66 20 28 66 69 6c 65 s.. (if (file
1e50: 2d 65 78 69 73 74 73 3f 20 72 75 6e 63 6f 6e 66 -exists? runconf
1e60: 69 67 66 29 0a 09 28 73 65 74 75 70 2d 65 6e 76 igf)..(setup-env
1e70: 2d 64 65 66 61 75 6c 74 73 20 72 75 6e 63 6f 6e -defaults runcon
1e80: 66 69 67 66 20 72 75 6e 2d 69 64 20 2a 61 6c 72 figf run-id *alr
1e90: 65 61 64 79 2d 73 65 65 6e 2d 72 75 6e 63 6f 6e eady-seen-runcon
1ea0: 66 69 67 2d 69 6e 66 6f 2a 20 6b 65 79 73 20 6b fig-info* keys k
1eb0: 65 79 76 61 6c 73 20 22 70 72 65 2d 6c 61 75 6e eyvals "pre-laun
1ec0: 63 68 2d 65 6e 76 2d 76 61 72 73 22 29 0a 09 28 ch-env-vars")..(
1ed0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 debug:print 0 "W
1ee0: 41 52 4e 49 4e 47 3a 20 59 6f 75 20 64 6f 20 6e ARNING: You do n
1ef0: 6f 74 20 68 61 76 65 20 61 20 72 75 6e 20 63 6f ot have a run co
1f00: 6e 66 69 67 20 66 69 6c 65 3a 20 22 20 72 75 6e nfig file: " run
1f10: 63 6f 6e 66 69 67 66 29 29 0a 20 20 20 20 0a 20 configf)). .
1f20: 20 20 20 3b 3b 20 6c 6f 6f 6b 20 75 70 20 61 6c ;; look up al
1f30: 6c 20 74 65 73 74 73 20 6d 61 74 63 68 69 6e 67 l tests matching
1f40: 20 74 68 65 20 63 6f 6d 6d 61 20 73 65 70 61 72 the comma separ
1f50: 61 74 65 64 20 6c 69 73 74 20 6f 66 20 67 6c 6f ated list of glo
1f60: 62 73 20 69 6e 0a 20 20 20 20 3b 3b 20 74 65 73 bs in. ;; tes
1f70: 74 2d 70 61 74 74 73 20 28 75 73 69 6e 67 20 25 t-patts (using %
1f80: 20 61 73 20 77 69 6c 64 63 61 72 64 29 0a 0a 20 as wildcard)..
1f90: 20 20 20 28 73 65 74 21 20 74 65 73 74 2d 6e 61 (set! test-na
1fa0: 6d 65 73 20 28 74 65 73 74 73 3a 67 65 74 2d 76 mes (tests:get-v
1fb0: 61 6c 69 64 2d 74 65 73 74 73 20 2a 74 6f 70 70 alid-tests *topp
1fc0: 61 74 68 2a 20 74 65 73 74 2d 6e 61 6d 65 73 29 ath* test-names)
1fd0: 29 0a 20 20 20 20 28 73 65 74 21 20 74 65 73 74 ). (set! test
1fe0: 2d 6e 61 6d 65 73 20 28 64 65 6c 65 74 65 2d 64 -names (delete-d
1ff0: 75 70 6c 69 63 61 74 65 73 20 74 65 73 74 2d 6e uplicates test-n
2000: 61 6d 65 73 29 29 0a 0a 20 20 20 20 28 64 65 62 ames)).. (deb
2010: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 30 20 ug:print-info 0
2020: 22 74 65 73 74 20 6e 61 6d 65 73 20 22 20 74 65 "test names " te
2030: 73 74 2d 6e 61 6d 65 73 29 0a 0a 20 20 20 20 3b st-names).. ;
2040: 3b 20 6f 6e 20 74 68 65 20 66 69 72 73 74 20 70 ; on the first p
2050: 61 73 73 20 6f 72 20 63 61 6c 6c 20 74 6f 20 72 ass or call to r
2060: 75 6e 2d 74 65 73 74 73 20 73 65 74 20 46 41 49 un-tests set FAI
2070: 4c 53 20 74 6f 20 4e 4f 54 5f 53 54 41 52 54 45 LS to NOT_STARTE
2080: 44 20 69 66 0a 20 20 20 20 3b 3b 20 2d 6b 65 65 D if. ;; -kee
2090: 70 67 6f 69 6e 67 20 69 73 20 73 70 65 63 69 66 pgoing is specif
20a0: 69 65 64 0a 20 20 20 20 28 69 66 20 28 65 71 3f ied. (if (eq?
20b0: 20 2a 70 61 73 73 6e 75 6d 2a 20 30 29 0a 09 28 *passnum* 0)..(
20c0: 62 65 67 69 6e 0a 09 20 20 3b 3b 20 68 61 76 65 begin.. ;; have
20d0: 20 74 6f 20 64 65 6c 65 74 65 20 74 65 73 74 20 to delete test
20e0: 72 65 63 6f 72 64 73 20 77 68 65 72 65 20 4e 4f records where NO
20f0: 54 5f 53 54 41 52 54 45 44 20 73 69 6e 63 65 20 T_STARTED since
2100: 74 68 65 79 20 63 61 6e 20 63 61 75 73 65 20 2d they can cause -
2110: 6b 65 65 70 67 6f 69 6e 67 20 74 6f 20 0a 09 20 keepgoing to ..
2120: 20 3b 3b 20 67 65 74 20 73 74 75 63 6b 20 64 75 ;; get stuck du
2130: 65 20 74 6f 20 62 65 63 6f 6d 69 6e 67 20 69 6e e to becoming in
2140: 61 63 63 65 73 73 69 62 6c 65 20 66 72 6f 6d 20 accessible from
2150: 61 20 66 61 69 6c 65 64 20 74 65 73 74 2e 20 49 a failed test. I
2160: 2e 65 2e 20 69 66 20 74 65 73 74 20 42 20 64 65 .e. if test B de
2170: 70 65 6e 64 73 20 0a 09 20 20 3b 3b 20 6f 6e 20 pends .. ;; on
2180: 74 65 73 74 20 41 20 62 75 74 20 74 65 73 74 20 test A but test
2190: 42 20 72 65 61 63 68 65 64 20 74 68 65 20 70 6f B reached the po
21a0: 69 6e 74 20 6f 6e 20 62 65 69 6e 67 20 72 65 67 int on being reg
21b0: 69 73 74 65 72 65 64 20 61 73 20 4e 4f 54 5f 53 istered as NOT_S
21c0: 54 41 52 54 45 44 20 61 6e 64 20 74 65 73 74 0a TARTED and test.
21d0: 09 20 20 3b 3b 20 41 20 66 61 69 6c 65 64 20 66 . ;; A failed f
21e0: 6f 72 20 73 6f 6d 65 20 72 65 61 73 6f 6e 20 74 or some reason t
21f0: 68 65 6e 20 6f 6e 20 72 65 2d 72 75 6e 20 75 73 hen on re-run us
2200: 69 6e 67 20 2d 6b 65 65 70 67 6f 69 6e 67 20 74 ing -keepgoing t
2210: 68 65 20 72 75 6e 20 63 61 6e 20 6e 65 76 65 72 he run can never
2220: 20 63 6f 6d 70 6c 65 74 65 2e 0a 09 20 20 28 63 complete... (c
2230: 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 73 2d db:delete-tests-
2240: 69 6e 2d 73 74 61 74 65 20 2a 72 75 6e 72 65 6d in-state *runrem
2250: 6f 74 65 2a 20 72 75 6e 2d 69 64 20 22 4e 4f 54 ote* run-id "NOT
2260: 5f 53 54 41 52 54 45 44 22 29 0a 09 20 20 28 63 _STARTED").. (c
2270: 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64 62 db:remote-run db
2280: 3a 73 65 74 2d 74 65 73 74 73 2d 73 74 61 74 65 :set-tests-state
2290: 2d 73 74 61 74 75 73 20 23 66 20 72 75 6e 2d 69 -status #f run-i
22a0: 64 20 74 65 73 74 2d 6e 61 6d 65 73 20 23 66 20 d test-names #f
22b0: 22 46 41 49 4c 22 20 22 4e 4f 54 5f 53 54 41 52 "FAIL" "NOT_STAR
22c0: 54 45 44 22 20 22 46 41 49 4c 22 29 29 29 0a 0a TED" "FAIL")))..
22d0: 20 20 20 20 3b 3b 20 66 72 6f 6d 20 68 65 72 65 ;; from here
22e0: 20 6f 6e 20 6f 75 74 20 74 68 65 20 64 62 20 77 on out the db w
22f0: 69 6c 6c 20 62 65 20 6f 70 65 6e 65 64 20 61 6e ill be opened an
2300: 64 20 63 6c 6f 73 65 64 20 6f 6e 20 65 76 65 72 d closed on ever
2310: 79 20 63 61 6c 6c 20 72 75 6e 73 3a 72 75 6e 2d y call runs:run-
2320: 74 65 73 74 73 2d 71 75 65 75 65 0a 20 20 20 20 tests-queue.
2330: 3b 3b 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 ;; (sqlite3:fina
2340: 6c 69 7a 65 21 20 64 62 29 20 0a 20 20 20 20 3b lize! db) . ;
2350: 3b 20 6e 6f 77 20 61 64 64 20 6e 6f 6e 2d 64 69 ; now add non-di
2360: 72 65 63 74 6c 79 20 72 65 66 65 72 65 6e 63 65 rectly reference
2370: 64 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 28 d dependencies (
2380: 69 2e 65 2e 20 77 61 69 74 6f 6e 29 0a 20 20 20 i.e. waiton).
2390: 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f (if (not (null?
23a0: 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 28 test-names))..(
23b0: 6c 65 74 20 6c 6f 6f 70 20 28 28 68 65 64 20 28 let loop ((hed (
23c0: 63 61 72 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 car test-names))
23d0: 0a 09 09 20 20 20 28 74 61 6c 20 28 63 64 72 20 ... (tal (cdr
23e0: 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 20 20 20 test-names)))
23f0: 20 20 20 20 20 20 3b 3b 20 27 72 65 74 75 72 6e ;; 'return
2400: 2d 70 72 6f 63 73 20 74 65 6c 6c 73 20 74 68 65 -procs tells the
2410: 20 63 6f 6e 66 69 67 20 72 65 61 64 65 72 20 74 config reader t
2420: 6f 20 70 72 65 70 20 72 75 6e 6e 69 6e 67 20 73 o prep running s
2430: 79 73 74 65 6d 20 62 75 74 20 72 65 74 75 72 6e ystem but return
2440: 20 61 20 70 72 6f 63 0a 09 20 20 28 64 65 62 75 a proc.. (debu
2450: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 g:print-info 4 "
2460: 68 65 64 3d 22 20 68 65 64 20 22 20 61 74 20 74 hed=" hed " at t
2470: 6f 70 20 6f 66 20 6c 6f 6f 70 22 29 0a 09 20 20 op of loop")..
2480: 28 6c 65 74 2a 20 28 28 63 6f 6e 66 69 67 20 20 (let* ((config
2490: 28 74 65 73 74 73 3a 67 65 74 2d 74 65 73 74 63 (tests:get-testc
24a0: 6f 6e 66 69 67 20 68 65 64 20 27 72 65 74 75 72 onfig hed 'retur
24b0: 6e 2d 70 72 6f 63 73 29 29 0a 09 09 20 28 77 61 n-procs))... (wa
24c0: 69 74 6f 6e 73 20 28 6c 65 74 20 28 28 69 6e 73 itons (let ((ins
24d0: 74 72 20 28 69 66 20 63 6f 6e 66 69 67 20 0a 09 tr (if config ..
24e0: 09 09 09 09 20 20 20 28 63 6f 6e 66 69 67 2d 6c .... (config-l
24f0: 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 20 22 72 65 ookup config "re
2500: 71 75 69 72 65 6d 65 6e 74 73 22 20 22 77 61 69 quirements" "wai
2510: 74 6f 6e 22 29 0a 09 09 09 09 09 20 20 20 28 62 ton")...... (b
2520: 65 67 69 6e 20 3b 3b 20 4e 6f 20 63 6f 6e 66 69 egin ;; No confi
2530: 67 20 6d 65 61 6e 73 20 74 68 69 73 20 69 73 20 g means this is
2540: 61 20 6e 6f 6e 2d 65 78 69 73 74 61 6e 74 20 74 a non-existant t
2550: 65 73 74 0a 09 09 09 09 09 20 20 20 20 20 28 64 est...... (d
2560: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 ebug:print 0 "ER
2570: 52 4f 52 3a 20 6e 6f 6e 2d 65 78 69 73 74 65 6e ROR: non-existen
2580: 74 20 72 65 71 75 69 72 65 64 20 74 65 73 74 20 t required test
2590: 5c 22 22 20 68 65 64 20 22 5c 22 22 29 0a 09 09 \"" hed "\"")...
25a0: 09 09 09 20 20 20 20 20 28 69 66 20 64 62 20 28 ... (if db (
25b0: 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 sqlite3:finalize
25c0: 21 20 64 62 29 29 0a 09 09 09 09 09 20 20 20 20 ! db))......
25d0: 20 28 65 78 69 74 20 31 29 29 29 29 29 0a 09 09 (exit 1)))))...
25e0: 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e . (debug:prin
25f0: 74 2d 69 6e 66 6f 20 38 20 22 77 61 69 74 6f 6e t-info 8 "waiton
2600: 73 20 73 74 72 69 6e 67 20 69 73 20 22 20 69 6e s string is " in
2610: 73 74 72 29 0a 09 09 09 20 20 20 20 28 73 74 72 str).... (str
2620: 69 6e 67 2d 73 70 6c 69 74 20 28 63 6f 6e 64 0a ing-split (cond.
2630: 09 09 09 09 09 20 20 20 28 28 70 72 6f 63 65 64 ..... ((proced
2640: 75 72 65 3f 20 69 6e 73 74 72 29 0a 09 09 09 09 ure? instr).....
2650: 09 20 20 20 20 28 6c 65 74 20 28 28 72 65 73 20 . (let ((res
2660: 28 69 6e 73 74 72 29 29 29 0a 09 09 09 09 09 20 (instr)))......
2670: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e (debug:prin
2680: 74 2d 69 6e 66 6f 20 38 20 22 77 61 69 74 6f 6e t-info 8 "waiton
2690: 20 70 72 6f 63 65 64 75 72 65 20 72 65 73 75 6c procedure resul
26a0: 74 73 20 69 6e 20 73 74 72 69 6e 67 20 22 20 72 ts in string " r
26b0: 65 73 20 22 20 66 6f 72 20 74 65 73 74 20 22 20 es " for test "
26c0: 68 65 64 29 0a 09 09 09 09 09 20 20 20 20 20 20 hed)......
26d0: 72 65 73 29 29 0a 09 09 09 09 09 20 20 20 28 28 res))...... ((
26e0: 73 74 72 69 6e 67 3f 20 69 6e 73 74 72 29 20 20 string? instr)
26f0: 20 20 20 69 6e 73 74 72 29 0a 09 09 09 09 09 20 instr)......
2700: 20 20 28 65 6c 73 65 20 0a 09 09 09 09 09 20 20 (else ......
2710: 20 20 3b 3b 20 4e 4f 54 45 3a 20 54 68 69 73 20 ;; NOTE: This
2720: 69 73 20 61 63 74 75 61 6c 6c 79 20 74 68 65 20 is actually the
2730: 63 61 73 65 20 6f 66 20 2a 6e 6f 2a 20 77 61 69 case of *no* wai
2740: 74 6f 6e 73 21 20 3b 3b 20 28 64 65 62 75 67 3a tons! ;; (debug:
2750: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 print 0 "ERROR:
2760: 73 6f 6d 65 74 68 69 6e 67 20 77 65 6e 74 20 77 something went w
2770: 72 6f 6e 67 20 69 6e 20 70 72 6f 63 65 73 73 69 rong in processi
2780: 6e 67 20 77 61 69 74 6f 6e 73 20 66 6f 72 20 74 ng waitons for t
2790: 65 73 74 20 22 20 68 65 64 29 0a 09 09 09 09 09 est " hed)......
27a0: 20 20 20 20 22 22 29 29 29 29 29 29 0a 09 20 20 ""))))))..
27b0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 (debug:print-i
27c0: 6e 66 6f 20 38 20 22 77 61 69 74 6f 6e 73 3a 20 nfo 8 "waitons:
27d0: 22 20 77 61 69 74 6f 6e 73 29 0a 09 20 20 20 20 " waitons)..
27e0: 3b 3b 20 63 68 65 63 6b 20 66 6f 72 20 68 65 64 ;; check for hed
27f0: 20 69 6e 20 77 61 69 74 6f 6e 73 20 3d 3e 20 74 in waitons => t
2800: 68 69 73 20 77 6f 75 6c 64 20 62 65 20 63 69 72 his would be cir
2810: 63 75 6c 61 72 2c 20 72 65 6d 6f 76 65 20 69 74 cular, remove it
2820: 20 61 6e 64 20 69 73 73 75 65 20 61 6e 0a 09 20 and issue an..
2830: 20 20 20 3b 3b 20 65 72 72 6f 72 0a 09 20 20 20 ;; error..
2840: 20 28 69 66 20 28 6d 65 6d 62 65 72 20 68 65 64 (if (member hed
2850: 20 77 61 69 74 6f 6e 73 29 0a 09 09 28 62 65 67 waitons)...(beg
2860: 69 6e 0a 09 09 20 20 28 64 65 62 75 67 3a 70 72 in... (debug:pr
2870: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 74 65 int 0 "ERROR: te
2880: 73 74 20 22 20 68 65 64 20 22 20 68 61 73 20 6c st " hed " has l
2890: 69 73 74 65 64 20 69 74 73 65 6c 66 20 61 73 20 isted itself as
28a0: 61 20 77 61 69 74 6f 6e 2c 20 70 6c 65 61 73 65 a waiton, please
28b0: 20 63 6f 72 72 65 63 74 20 74 68 69 73 21 22 29 correct this!")
28c0: 0a 09 09 20 20 28 73 65 74 21 20 77 61 69 74 6f ... (set! waito
28d0: 6e 73 20 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 ns (filter (lamb
28e0: 64 61 20 28 78 29 28 6e 6f 74 20 28 65 71 75 61 da (x)(not (equa
28f0: 6c 3f 20 78 20 68 65 64 29 29 29 20 77 61 69 74 l? x hed))) wait
2900: 6f 6e 73 29 29 29 29 0a 09 20 20 20 20 0a 09 20 ons)))).. ..
2910: 20 20 20 3b 3b 20 28 69 74 65 6d 73 20 20 20 28 ;; (items (
2920: 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d items:get-items-
2930: 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 63 6f 6e 66 from-config conf
2940: 69 67 29 29 29 0a 09 20 20 20 20 28 69 66 20 28 ig))).. (if (
2950: 6e 6f 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d not (hash-table-
2960: 72 65 66 2f 64 65 66 61 75 6c 74 20 74 65 73 74 ref/default test
2970: 2d 72 65 63 6f 72 64 73 20 68 65 64 20 23 66 29 -records hed #f)
2980: 29 0a 09 09 28 68 61 73 68 2d 74 61 62 6c 65 2d )...(hash-table-
2990: 73 65 74 21 20 74 65 73 74 2d 72 65 63 6f 72 64 set! test-record
29a0: 73 0a 09 09 09 09 20 68 65 64 20 28 76 65 63 74 s..... hed (vect
29b0: 6f 72 20 68 65 64 20 20 20 20 20 3b 3b 20 30 0a or hed ;; 0.
29c0: 09 09 09 09 09 20 20 20 20 20 63 6f 6e 66 69 67 ..... config
29d0: 20 20 3b 3b 20 31 0a 09 09 09 09 09 20 20 20 20 ;; 1......
29e0: 20 77 61 69 74 6f 6e 73 20 3b 3b 20 32 0a 09 09 waitons ;; 2...
29f0: 09 09 09 20 20 20 20 20 28 63 6f 6e 66 69 67 2d ... (config-
2a00: 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 20 22 72 lookup config "r
2a10: 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 70 72 equirements" "pr
2a20: 69 6f 72 69 74 79 22 29 20 20 20 20 20 3b 3b 20 iority") ;;
2a30: 70 72 69 6f 72 69 74 79 20 33 0a 09 09 09 09 09 priority 3......
2a40: 20 20 20 20 20 28 6c 65 74 20 28 28 69 74 65 6d (let ((item
2a50: 73 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 s (hash-tab
2a60: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63 le-ref/default c
2a70: 6f 6e 66 69 67 20 22 69 74 65 6d 73 22 20 23 66 onfig "items" #f
2a80: 29 29 20 3b 3b 20 69 74 65 6d 73 20 34 0a 09 09 )) ;; items 4...
2a90: 09 09 09 09 20 20 20 28 69 74 65 6d 73 74 61 62 .... (itemstab
2aa0: 6c 65 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 le (hash-table-r
2ab0: 65 66 2f 64 65 66 61 75 6c 74 20 63 6f 6e 66 69 ef/default confi
2ac0: 67 20 22 69 74 65 6d 73 74 61 62 6c 65 22 20 23 g "itemstable" #
2ad0: 66 29 29 29 20 0a 09 09 09 09 09 20 20 20 20 20 f))) ......
2ae0: 20 20 3b 3b 20 69 66 20 65 69 74 68 65 72 20 69 ;; if either i
2af0: 74 65 6d 73 20 6f 72 20 69 74 65 6d 73 20 74 61 tems or items ta
2b00: 62 6c 65 20 69 73 20 61 20 70 72 6f 63 20 72 65 ble is a proc re
2b10: 74 75 72 6e 20 69 74 20 73 6f 20 74 65 73 74 20 turn it so test
2b20: 72 75 6e 6e 69 6e 67 0a 09 09 09 09 09 20 20 20 running......
2b30: 20 20 20 20 3b 3b 20 70 72 6f 63 65 73 73 20 63 ;; process c
2b40: 61 6e 20 6b 6e 6f 77 20 74 6f 20 63 61 6c 6c 20 an know to call
2b50: 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d items:get-items-
2b60: 66 72 6f 6d 2d 63 6f 6e 66 69 67 0a 09 09 09 09 from-config.....
2b70: 09 20 20 20 20 20 20 20 3b 3b 20 69 66 20 65 69 . ;; if ei
2b80: 74 68 65 72 20 69 73 20 61 20 6c 69 73 74 20 61 ther is a list a
2b90: 6e 64 20 6e 6f 6e 65 20 69 73 20 61 20 70 72 6f nd none is a pro
2ba0: 63 20 67 6f 20 61 68 65 61 64 20 61 6e 64 20 63 c go ahead and c
2bb0: 61 6c 6c 20 67 65 74 2d 69 74 65 6d 73 0a 09 09 all get-items...
2bc0: 09 09 09 20 20 20 20 20 20 20 3b 3b 20 6f 74 68 ... ;; oth
2bd0: 65 72 77 69 73 65 20 72 65 74 75 72 6e 20 23 66 erwise return #f
2be0: 20 2d 20 74 68 69 73 20 69 73 20 6e 6f 74 20 61 - this is not a
2bf0: 6e 20 69 74 65 72 61 74 65 64 20 74 65 73 74 0a n iterated test.
2c00: 09 09 09 09 09 20 20 20 20 20 20 20 28 63 6f 6e ..... (con
2c10: 64 0a 09 09 09 09 09 09 28 28 70 72 6f 63 65 64 d.......((proced
2c20: 75 72 65 3f 20 69 74 65 6d 73 29 20 20 20 20 20 ure? items)
2c30: 20 0a 09 09 09 09 09 09 20 28 64 65 62 75 67 3a ....... (debug:
2c40: 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 69 74 print-info 4 "it
2c50: 65 6d 73 20 69 73 20 61 20 70 72 6f 63 65 64 75 ems is a procedu
2c60: 72 65 2c 20 77 69 6c 6c 20 63 61 6c 63 20 6c 61 re, will calc la
2c70: 74 65 72 22 29 0a 09 09 09 09 09 09 20 69 74 65 ter")....... ite
2c80: 6d 73 29 20 20 20 20 20 20 20 20 20 20 20 20 3b ms) ;
2c90: 3b 20 63 61 6c 63 20 6c 61 74 65 72 0a 09 09 09 ; calc later....
2ca0: 09 09 09 28 28 70 72 6f 63 65 64 75 72 65 3f 20 ...((procedure?
2cb0: 69 74 65 6d 73 74 61 62 6c 65 29 0a 09 09 09 09 itemstable).....
2cc0: 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d .. (debug:print-
2cd0: 69 6e 66 6f 20 34 20 22 69 74 65 6d 73 74 61 62 info 4 "itemstab
2ce0: 6c 65 20 69 73 20 61 20 70 72 6f 63 65 64 75 72 le is a procedur
2cf0: 65 2c 20 77 69 6c 6c 20 63 61 6c 63 20 6c 61 74 e, will calc lat
2d00: 65 72 22 29 0a 09 09 09 09 09 09 20 69 74 65 6d er")....... item
2d10: 73 74 61 62 6c 65 29 20 20 20 20 20 20 20 3b 3b stable) ;;
2d20: 20 63 61 6c 63 20 6c 61 74 65 72 0a 09 09 09 09 calc later.....
2d30: 09 09 28 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 ..((filter (lamb
2d40: 64 61 20 28 78 29 0a 09 09 09 09 09 09 09 20 20 da (x)........
2d50: 20 28 6c 65 74 20 28 28 76 61 6c 20 28 63 61 72 (let ((val (car
2d60: 20 78 29 29 29 0a 09 09 09 09 09 09 09 20 20 20 x)))........
2d70: 20 20 28 69 66 20 28 70 72 6f 63 65 64 75 72 65 (if (procedure
2d80: 3f 20 76 61 6c 29 20 76 61 6c 20 23 66 29 29 29 ? val) val #f)))
2d90: 0a 09 09 09 09 09 09 09 20 28 61 70 70 65 6e 64 ........ (append
2da0: 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74 65 6d (if (list? item
2db0: 73 29 20 69 74 65 6d 73 20 27 28 29 29 0a 09 09 s) items '())...
2dc0: 09 09 09 09 09 09 20 28 69 66 20 28 6c 69 73 74 ...... (if (list
2dd0: 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 20 69 74 ? itemstable) it
2de0: 65 6d 73 74 61 62 6c 65 20 27 28 29 29 29 29 0a emstable '()))).
2df0: 09 09 09 09 09 09 20 27 68 61 76 65 2d 70 72 6f ...... 'have-pro
2e00: 63 65 64 75 72 65 29 0a 09 09 09 09 09 09 28 28 cedure).......((
2e10: 6f 72 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 or (list? items)
2e20: 28 6c 69 73 74 3f 20 69 74 65 6d 73 74 61 62 6c (list? itemstabl
2e30: 65 29 29 20 3b 3b 20 63 61 6c 63 20 6e 6f 77 0a e)) ;; calc now.
2e40: 09 09 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 ...... (debug:pr
2e50: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 69 74 65 6d int-info 4 "item
2e60: 73 20 61 6e 64 20 69 74 65 6d 73 74 61 62 6c 65 s and itemstable
2e70: 20 61 72 65 20 6c 69 73 74 73 2c 20 63 61 6c 63 are lists, calc
2e80: 20 6e 6f 77 5c 6e 22 0a 09 09 09 09 09 09 09 20 now\n"........
2e90: 20 20 20 20 20 22 20 20 20 20 69 74 65 6d 73 3a " items:
2ea0: 20 22 20 69 74 65 6d 73 20 22 20 69 74 65 6d 73 " items " items
2eb0: 74 61 62 6c 65 3a 20 22 20 69 74 65 6d 73 74 61 table: " itemsta
2ec0: 62 6c 65 29 0a 09 09 09 09 09 09 20 28 69 74 65 ble)....... (ite
2ed0: 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f ms:get-items-fro
2ee0: 6d 2d 63 6f 6e 66 69 67 20 63 6f 6e 66 69 67 29 m-config config)
2ef0: 29 0a 09 09 09 09 09 09 28 65 6c 73 65 20 23 66 ).......(else #f
2f00: 29 29 29 20 20 20 20 20 20 20 20 20 20 20 20 20 )))
2f10: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b ;;
2f20: 20 6e 6f 74 20 69 74 65 72 61 74 65 64 0a 09 09 not iterated...
2f30: 09 09 09 20 20 20 20 20 23 66 20 20 20 20 20 20 ... #f
2f40: 3b 3b 20 69 74 65 6d 73 64 61 74 20 35 0a 09 09 ;; itemsdat 5...
2f50: 09 09 09 20 20 20 20 20 23 66 20 20 20 20 20 20 ... #f
2f60: 3b 3b 20 73 70 61 72 65 20 2d 20 75 73 65 64 20 ;; spare - used
2f70: 66 6f 72 20 69 74 65 6d 2d 70 61 74 68 0a 09 09 for item-path...
2f80: 09 09 09 20 20 20 20 20 29 29 29 0a 09 20 20 20 ... )))..
2f90: 20 28 66 6f 72 2d 65 61 63 68 20 0a 09 20 20 20 (for-each ..
2fa0: 20 20 28 6c 61 6d 62 64 61 20 28 77 61 69 74 6f (lambda (waito
2fb0: 6e 29 0a 09 20 20 20 20 20 20 20 28 69 66 20 28 n).. (if (
2fc0: 61 6e 64 20 77 61 69 74 6f 6e 20 28 6e 6f 74 20 and waiton (not
2fd0: 28 6d 65 6d 62 65 72 20 77 61 69 74 6f 6e 20 74 (member waiton t
2fe0: 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a 09 09 20 est-names)))...
2ff0: 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20 (begin...
3000: 28 73 65 74 21 20 72 65 71 75 69 72 65 64 2d 74 (set! required-t
3010: 65 73 74 73 20 28 63 6f 6e 73 20 77 61 69 74 6f ests (cons waito
3020: 6e 20 72 65 71 75 69 72 65 64 2d 74 65 73 74 73 n required-tests
3030: 29 29 0a 09 09 20 20 20 20 20 28 73 65 74 21 20 ))... (set!
3040: 74 65 73 74 2d 6e 61 6d 65 73 20 28 63 6f 6e 73 test-names (cons
3050: 20 77 61 69 74 6f 6e 20 74 65 73 74 2d 6e 61 6d waiton test-nam
3060: 65 73 29 29 29 29 29 20 3b 3b 20 77 61 73 20 61 es))))) ;; was a
3070: 6e 20 61 70 70 65 6e 64 2c 20 6e 6f 77 20 61 20 n append, now a
3080: 63 6f 6e 73 0a 09 20 20 20 20 20 77 61 69 74 6f cons.. waito
3090: 6e 73 29 0a 09 20 20 20 20 28 6c 65 74 20 28 28 ns).. (let ((
30a0: 72 65 6d 74 65 73 74 73 20 28 64 65 6c 65 74 65 remtests (delete
30b0: 2d 64 75 70 6c 69 63 61 74 65 73 20 28 61 70 70 -duplicates (app
30c0: 65 6e 64 20 77 61 69 74 6f 6e 73 20 74 61 6c 29 end waitons tal)
30d0: 29 29 29 0a 09 20 20 20 20 20 20 28 69 66 20 28 ))).. (if (
30e0: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 not (null? remte
30f0: 73 74 73 29 29 0a 09 09 20 20 28 6c 6f 6f 70 20 sts))... (loop
3100: 28 63 61 72 20 72 65 6d 74 65 73 74 73 29 28 63 (car remtests)(c
3110: 64 72 20 72 65 6d 74 65 73 74 73 29 29 29 29 29 dr remtests)))))
3120: 29 29 0a 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 )).. (if (not
3130: 20 28 6e 75 6c 6c 3f 20 72 65 71 75 69 72 65 64 (null? required
3140: 2d 74 65 73 74 73 29 29 0a 09 28 64 65 62 75 67 -tests))..(debug
3150: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 41 :print-info 1 "A
3160: 64 64 69 6e 67 20 22 20 72 65 71 75 69 72 65 64 dding " required
3170: 2d 74 65 73 74 73 20 22 20 74 6f 20 74 68 65 20 -tests " to the
3180: 72 75 6e 20 71 75 65 75 65 22 29 29 0a 20 20 20 run queue")).
3190: 20 3b 3b 20 4e 4f 54 45 3a 20 74 68 65 73 65 20 ;; NOTE: these
31a0: 61 72 65 20 61 6c 6c 20 70 61 72 65 6e 74 20 74 are all parent t
31b0: 65 73 74 73 2c 20 69 74 65 6d 73 20 61 72 65 20 ests, items are
31c0: 6e 6f 74 20 65 78 70 61 6e 64 65 64 20 79 65 74 not expanded yet
31d0: 2e 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 .. (debug:pri
31e0: 6e 74 2d 69 6e 66 6f 20 34 20 22 74 65 73 74 2d nt-info 4 "test-
31f0: 72 65 63 6f 72 64 73 3d 22 20 28 68 61 73 68 2d records=" (hash-
3200: 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65 73 table->alist tes
3210: 74 2d 72 65 63 6f 72 64 73 29 29 0a 20 20 20 20 t-records)).
3220: 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d (runs:run-tests-
3230: 71 75 65 75 65 20 72 75 6e 2d 69 64 20 72 75 6e queue run-id run
3240: 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 name test-record
3250: 73 20 6b 65 79 76 61 6c 6c 73 74 20 66 6c 61 67 s keyvallst flag
3260: 73 20 74 65 73 74 2d 70 61 74 74 73 29 0a 20 20 s test-patts).
3270: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 (debug:print-i
3280: 6e 66 6f 20 34 20 22 41 6c 6c 20 64 6f 6e 65 20 nfo 4 "All done
3290: 62 79 20 68 65 72 65 22 29 29 29 0a 0a 28 64 65 by here")))..(de
32a0: 66 69 6e 65 20 28 72 75 6e 73 3a 63 61 6c 63 2d fine (runs:calc-
32b0: 66 61 69 6c 73 20 70 72 65 72 65 71 73 2d 6e 6f fails prereqs-no
32c0: 74 2d 6d 65 74 29 0a 20 20 28 66 69 6c 74 65 72 t-met). (filter
32d0: 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 29 0a (lambda (test).
32e0: 09 20 20 20 20 28 61 6e 64 20 28 76 65 63 74 6f . (and (vecto
32f0: 72 3f 20 74 65 73 74 29 20 3b 3b 20 6e 6f 74 20 r? test) ;; not
3300: 28 73 74 72 69 6e 67 3f 20 74 65 73 74 29 29 0a (string? test)).
3310: 09 09 20 28 65 71 75 61 6c 3f 20 28 64 62 3a 74 .. (equal? (db:t
3320: 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74 65 est-get-state te
3330: 73 74 29 20 22 43 4f 4d 50 4c 45 54 45 44 22 29 st) "COMPLETED")
3340: 0a 09 09 20 28 6e 6f 74 20 28 6d 65 6d 62 65 72 ... (not (member
3350: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 (db:test-get-st
3360: 61 74 75 73 20 74 65 73 74 29 0a 09 09 09 20 20 atus test)....
3370: 20 20 20 20 27 28 22 50 41 53 53 22 20 22 57 41 '("PASS" "WA
3380: 52 4e 22 20 22 43 48 45 43 4b 22 20 22 57 41 49 RN" "CHECK" "WAI
3390: 56 45 44 22 20 22 53 4b 49 50 22 29 29 29 29 29 VED" "SKIP")))))
33a0: 0a 09 20 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d .. prereqs-not-
33b0: 6d 65 74 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 met))..(define (
33c0: 72 75 6e 73 3a 63 61 6c 63 2d 6e 6f 74 2d 63 6f runs:calc-not-co
33d0: 6d 70 6c 65 74 65 64 20 70 72 65 72 65 71 73 2d mpleted prereqs-
33e0: 6e 6f 74 2d 6d 65 74 29 0a 20 20 28 66 69 6c 74 not-met). (filt
33f0: 65 72 0a 20 20 20 28 6c 61 6d 62 64 61 20 28 74 er. (lambda (t
3400: 29 0a 20 20 20 20 20 28 6f 72 20 28 6e 6f 74 20 ). (or (not
3410: 28 76 65 63 74 6f 72 3f 20 74 29 29 0a 09 20 28 (vector? t)).. (
3420: 6e 6f 74 20 28 65 71 75 61 6c 3f 20 22 43 4f 4d not (equal? "COM
3430: 50 4c 45 54 45 44 22 20 28 64 62 3a 74 65 73 74 PLETED" (db:test
3440: 2d 67 65 74 2d 73 74 61 74 65 20 74 29 29 29 29 -get-state t))))
3450: 29 0a 20 20 20 70 72 65 72 65 71 73 2d 6e 6f 74 ). prereqs-not
3460: 2d 6d 65 74 29 29 0a 0a 28 64 65 66 69 6e 65 20 -met))..(define
3470: 28 72 75 6e 73 3a 70 72 65 74 74 79 2d 73 74 72 (runs:pretty-str
3480: 69 6e 67 20 6c 73 74 29 0a 20 20 28 6d 61 70 20 ing lst). (map
3490: 28 6c 61 6d 62 64 61 20 28 74 29 0a 09 20 28 69 (lambda (t).. (i
34a0: 66 20 28 6e 6f 74 20 28 76 65 63 74 6f 72 3f 20 f (not (vector?
34b0: 74 29 29 0a 09 20 20 20 20 20 28 63 6f 6e 63 20 t)).. (conc
34c0: 74 29 0a 09 20 20 20 20 20 28 63 6f 6e 63 20 28 t).. (conc (
34d0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 db:test-get-test
34e0: 6e 61 6d 65 20 74 29 20 22 3a 22 20 28 64 62 3a name t) ":" (db:
34f0: 74 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74 test-get-state t
3500: 29 20 22 2f 22 20 28 64 62 3a 74 65 73 74 2d 67 ) "/" (db:test-g
3510: 65 74 2d 73 74 61 74 75 73 20 74 29 29 29 29 0a et-status t)))).
3520: 20 20 20 20 20 20 20 6c 73 74 29 29 0a 0a 28 64 lst))..(d
3530: 65 66 69 6e 65 20 28 72 75 6e 73 3a 6d 61 6b 65 efine (runs:make
3540: 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 -full-test-name
3550: 74 65 73 74 6e 61 6d 65 20 69 74 65 6d 70 61 74 testname itempat
3560: 68 29 0a 20 20 28 69 66 20 28 65 71 75 61 6c 3f h). (if (equal?
3570: 20 69 74 65 6d 70 61 74 68 20 22 22 29 20 74 65 itempath "") te
3580: 73 74 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 stname (conc tes
3590: 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 70 61 tname "/" itempa
35a0: 74 68 29 29 29 0a 0a 28 69 6e 63 6c 75 64 65 20 th)))..(include
35b0: 22 72 75 6e 2d 74 65 73 74 73 2d 71 75 65 75 65 "run-tests-queue
35c0: 2d 63 6c 61 73 73 69 63 2e 73 63 6d 22 29 0a 0a -classic.scm")..
35d0: 0a 3b 3b 20 70 61 72 65 6e 74 2d 74 65 73 74 20 .;; parent-test
35e0: 69 73 20 74 68 65 72 65 20 61 73 20 61 20 70 6c is there as a pl
35f0: 61 63 65 68 6f 6c 64 65 72 20 66 6f 72 20 77 68 aceholder for wh
3600: 65 6e 20 70 61 72 65 6e 74 2d 74 65 73 74 73 20 en parent-tests
3610: 63 61 6e 20 62 65 20 72 75 6e 20 61 73 20 61 20 can be run as a
3620: 73 65 74 75 70 20 73 74 65 70 0a 28 64 65 66 69 setup step.(defi
3630: 6e 65 20 28 72 75 6e 3a 74 65 73 74 20 72 75 6e ne (run:test run
3640: 2d 69 64 20 72 75 6e 6e 61 6d 65 20 6b 65 79 76 -id runname keyv
3650: 61 6c 6c 73 74 20 74 65 73 74 2d 72 65 63 6f 72 allst test-recor
3660: 64 20 66 6c 61 67 73 20 70 61 72 65 6e 74 2d 74 d flags parent-t
3670: 65 73 74 29 0a 20 20 3b 3b 20 41 6c 6c 20 74 68 est). ;; All th
3680: 65 73 65 20 76 61 72 73 20 6d 69 67 68 74 20 62 ese vars might b
3690: 65 20 72 65 66 65 72 65 6e 63 65 64 20 62 79 20 e referenced by
36a0: 74 68 65 20 74 65 73 74 63 6f 6e 66 69 67 20 66 the testconfig f
36b0: 69 6c 65 20 72 65 61 64 65 72 0a 20 20 28 6c 65 ile reader. (le
36c0: 74 2a 20 28 28 74 65 73 74 2d 6e 61 6d 65 20 20 t* ((test-name
36d0: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 (tests:testque
36e0: 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 ue-get-testname
36f0: 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a test-record)).
3700: 09 20 28 74 65 73 74 2d 77 61 69 74 6f 6e 73 20 . (test-waitons
3710: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 (tests:testqueue
3720: 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20 20 20 20 -get-waitons
3730: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 test-record))..
3740: 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 20 28 74 (test-conf (t
3750: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 ests:testqueue-g
3760: 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 74 65 et-testconfig te
3770: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 69 st-record)).. (i
3780: 74 65 6d 64 61 74 20 20 20 20 20 20 28 74 65 73 temdat (tes
3790: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 ts:testqueue-get
37a0: 2d 69 74 65 6d 64 61 74 20 20 20 20 74 65 73 74 -itemdat test
37b0: 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65 73 -record)).. (tes
37c0: 74 2d 70 61 74 68 20 20 20 20 28 63 6f 6e 63 20 t-path (conc
37d0: 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74 *toppath* "/test
37e0: 73 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29 29 20 s/" test-name))
37f0: 3b 3b 20 63 6f 75 6c 64 20 75 73 65 20 74 65 73 ;; could use tes
3800: 74 73 3a 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 ts:get-testconfi
3810: 67 20 68 65 72 65 20 2e 2e 2e 0a 09 20 28 66 6f g here ..... (fo
3820: 72 63 65 20 20 20 20 20 20 20 20 28 68 61 73 68 rce (hash
3830: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 -table-ref/defau
3840: 6c 74 20 66 6c 61 67 73 20 22 2d 66 6f 72 63 65 lt flags "-force
3850: 22 20 23 66 29 29 0a 09 20 28 72 65 72 75 6e 20 " #f)).. (rerun
3860: 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 (hash-tab
3870: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 le-ref/default f
3880: 6c 61 67 73 20 22 2d 72 65 72 75 6e 22 20 23 66 lags "-rerun" #f
3890: 29 29 0a 09 20 28 6b 65 65 70 67 6f 69 6e 67 20 )).. (keepgoing
38a0: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 (hash-table-r
38b0: 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 ef/default flags
38c0: 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 20 23 66 "-keepgoing" #f
38d0: 29 29 0a 09 20 28 69 74 65 6d 2d 70 61 74 68 20 )).. (item-path
38e0: 20 20 20 20 22 22 29 0a 09 20 28 64 62 20 20 20 "").. (db
38f0: 20 20 20 20 20 20 20 20 23 66 29 29 0a 20 20 20 #f)).
3900: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 0a (debug:print 4.
3910: 09 09 20 22 74 65 73 74 2d 63 6f 6e 66 69 67 3a .. "test-config:
3920: 20 22 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e " (hash-table->
3930: 61 6c 69 73 74 20 74 65 73 74 2d 63 6f 6e 66 29 alist test-conf)
3940: 0a 09 09 20 22 5c 6e 20 20 20 69 74 65 6d 64 61 ... "\n itemda
3950: 74 3a 20 22 20 69 74 65 6d 64 61 74 0a 09 09 20 t: " itemdat...
3960: 29 0a 20 20 20 20 3b 3b 20 73 65 74 74 69 6e 67 ). ;; setting
3970: 20 69 74 65 6d 64 61 74 20 74 6f 20 61 20 6c 69 itemdat to a li
3980: 73 74 20 69 66 20 69 74 20 69 73 20 23 66 0a 20 st if it is #f.
3990: 20 20 20 28 69 66 20 28 6e 6f 74 20 69 74 65 6d (if (not item
39a0: 64 61 74 29 28 73 65 74 21 20 69 74 65 6d 64 61 dat)(set! itemda
39b0: 74 20 27 28 29 29 29 0a 20 20 20 20 28 73 65 74 t '())). (set
39c0: 21 20 69 74 65 6d 2d 70 61 74 68 20 28 69 74 65 ! item-path (ite
39d0: 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 65 m-list->path ite
39e0: 6d 64 61 74 29 29 0a 20 20 20 20 28 64 65 62 75 mdat)). (debu
39f0: 67 3a 70 72 69 6e 74 20 32 20 22 41 74 74 65 6d g:print 2 "Attem
3a00: 70 74 69 6e 67 20 74 6f 20 6c 61 75 6e 63 68 20 pting to launch
3a10: 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 test " test-name
3a20: 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65 (if (equal? ite
3a30: 6d 2d 70 61 74 68 20 22 2f 22 29 20 22 2f 22 20 m-path "/") "/"
3a40: 69 74 65 6d 2d 70 61 74 68 29 29 0a 20 20 20 20 item-path)).
3a50: 28 73 65 74 65 6e 76 20 22 4d 54 5f 54 45 53 54 (setenv "MT_TEST
3a60: 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65 _NAME" test-name
3a70: 29 20 3b 3b 20 0a 20 20 20 20 28 73 65 74 65 6e ) ;; . (seten
3a80: 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20 v "MT_RUNNAME"
3a90: 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20 28 73 runname). (s
3aa0: 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d et-megatest-env-
3ab0: 76 61 72 73 20 72 75 6e 2d 69 64 29 20 3b 3b 20 vars run-id) ;;
3ac0: 74 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65 these may be nee
3ad0: 64 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63 ded by the launc
3ae0: 68 69 6e 67 20 70 72 6f 63 65 73 73 0a 20 20 20 hing process.
3af0: 20 28 63 68 61 6e 67 65 2d 64 69 72 65 63 74 6f (change-directo
3b00: 72 79 20 2a 74 6f 70 70 61 74 68 2a 29 0a 0a 20 ry *toppath*)..
3b10: 20 20 20 3b 3b 20 48 65 72 65 20 69 73 20 77 68 ;; Here is wh
3b20: 65 72 65 20 74 68 65 20 74 65 73 74 5f 6d 65 74 ere the test_met
3b30: 61 20 74 61 62 6c 65 20 69 73 20 62 65 73 74 20 a table is best
3b40: 75 70 64 61 74 65 64 0a 20 20 20 20 3b 3b 20 59 updated. ;; Y
3b50: 65 73 2c 20 61 6e 6f 74 68 65 72 20 75 73 65 20 es, another use
3b60: 6f 66 20 61 20 67 6c 6f 62 61 6c 20 66 6f 72 20 of a global for
3b70: 63 61 63 68 69 6e 67 2e 20 4e 65 65 64 20 61 20 caching. Need a
3b80: 62 65 74 74 65 72 20 77 61 79 3f 0a 20 20 20 20 better way?.
3b90: 28 69 66 20 28 6e 6f 74 20 28 68 61 73 68 2d 74 (if (not (hash-t
3ba0: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 able-ref/default
3bb0: 20 2a 74 65 73 74 2d 6d 65 74 61 2d 75 70 64 61 *test-meta-upda
3bc0: 74 65 64 2a 20 74 65 73 74 2d 6e 61 6d 65 20 23 ted* test-name #
3bd0: 66 29 29 0a 20 20 20 20 20 20 20 20 28 62 65 67 f)). (beg
3be0: 69 6e 0a 09 20 20 20 28 68 61 73 68 2d 74 61 62 in.. (hash-tab
3bf0: 6c 65 2d 73 65 74 21 20 2a 74 65 73 74 2d 6d 65 le-set! *test-me
3c00: 74 61 2d 75 70 64 61 74 65 64 2a 20 74 65 73 74 ta-updated* test
3c10: 2d 6e 61 6d 65 20 23 74 29 0a 20 20 20 20 20 20 -name #t).
3c20: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 (open-run-c
3c30: 6c 6f 73 65 20 72 75 6e 73 3a 75 70 64 61 74 65 lose runs:update
3c40: 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20 74 65 -test_meta db te
3c50: 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e st-name test-con
3c60: 66 29 29 29 0a 20 20 20 20 0a 20 20 20 20 3b 3b f))). . ;;
3c70: 20 28 6c 61 6d 62 64 61 20 28 69 74 65 6d 64 61 (lambda (itemda
3c80: 74 29 20 3b 3b 3b 20 28 28 72 69 70 65 6e 65 73 t) ;;; ((ripenes
3c90: 73 20 22 6f 76 65 72 72 69 70 65 22 29 20 28 74 s "overripe") (t
3ca0: 65 6d 70 65 72 61 74 75 72 65 20 22 63 6f 6f 6c emperature "cool
3cb0: 22 29 20 28 73 65 61 73 6f 6e 20 22 73 75 6d 6d ") (season "summ
3cc0: 65 72 22 29 29 0a 20 20 20 20 28 6c 65 74 2a 20 er")). (let*
3cd0: 28 28 6e 65 77 2d 74 65 73 74 2d 70 61 74 68 20 ((new-test-path
3ce0: 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 (string-interspe
3cf0: 72 73 65 20 28 63 6f 6e 73 20 74 65 73 74 2d 70 rse (cons test-p
3d00: 61 74 68 20 28 6d 61 70 20 63 61 64 72 20 69 74 ath (map cadr it
3d10: 65 6d 64 61 74 29 29 20 22 2f 22 29 29 0a 09 20 emdat)) "/"))..
3d20: 20 20 28 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 (new-test-name
3d30: 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65 (if (equal? ite
3d40: 6d 2d 70 61 74 68 20 22 22 29 20 74 65 73 74 2d m-path "") test-
3d50: 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 2d name (conc test-
3d60: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 name "/" item-pa
3d70: 74 68 29 29 29 20 3b 3b 20 6a 75 73 74 20 6e 65 th))) ;; just ne
3d80: 65 64 20 69 74 20 74 6f 20 62 65 20 75 6e 69 71 ed it to be uniq
3d90: 75 65 0a 09 20 20 20 28 74 65 73 74 2d 69 64 20 ue.. (test-id
3da0: 20 20 20 20 20 20 28 63 64 62 3a 72 65 6d 6f 74 (cdb:remot
3db0: 65 2d 72 75 6e 20 64 62 3a 67 65 74 2d 74 65 73 e-run db:get-tes
3dc0: 74 2d 69 64 20 23 66 20 20 72 75 6e 2d 69 64 20 t-id #f run-id
3dd0: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 test-name item-p
3de0: 61 74 68 29 29 0a 09 20 20 20 28 74 65 73 74 64 ath)).. (testd
3df0: 61 74 20 20 20 20 20 20 20 28 63 64 62 3a 67 65 at (cdb:ge
3e00: 74 2d 74 65 73 74 2d 69 6e 66 6f 2d 62 79 2d 69 t-test-info-by-i
3e10: 64 20 2a 72 75 6e 72 65 6d 6f 74 65 2a 20 74 65 d *runremote* te
3e20: 73 74 2d 69 64 29 29 29 0a 20 20 20 20 20 20 28 st-id))). (
3e30: 69 66 20 28 6e 6f 74 20 74 65 73 74 64 61 74 29 if (not testdat)
3e40: 0a 09 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 .. (begin..
3e50: 3b 3b 20 65 6e 73 75 72 65 20 74 68 61 74 20 74 ;; ensure that t
3e60: 68 65 20 70 61 74 68 20 65 78 69 73 74 73 20 62 he path exists b
3e70: 65 66 6f 72 65 20 72 65 67 69 73 74 65 72 69 6e efore registerin
3e80: 67 20 74 68 65 20 74 65 73 74 0a 09 20 20 20 20 g the test..
3e90: 3b 3b 20 4e 4f 50 45 3a 20 43 61 6e 6e 6f 74 21 ;; NOPE: Cannot!
3ea0: 20 44 6f 6e 27 74 20 6b 6e 6f 77 20 79 65 74 20 Don't know yet
3eb0: 77 68 69 63 68 20 64 69 73 6b 20 61 72 65 61 20 which disk area
3ec0: 77 69 6c 6c 20 62 65 20 61 73 73 69 67 6e 65 64 will be assigned
3ed0: 2e 2e 2e 2e 0a 09 20 20 20 20 3b 3b 20 28 73 79 ...... ;; (sy
3ee0: 73 74 65 6d 20 28 63 6f 6e 63 20 22 6d 6b 64 69 stem (conc "mkdi
3ef0: 72 20 2d 70 20 22 20 6e 65 77 2d 74 65 73 74 2d r -p " new-test-
3f00: 70 61 74 68 29 29 0a 09 20 20 20 20 3b 3b 0a 09 path)).. ;;..
3f10: 20 20 20 20 3b 3b 20 28 6f 70 65 6e 2d 72 75 6e ;; (open-run
3f20: 2d 63 6c 6f 73 65 20 74 65 73 74 73 3a 72 65 67 -close tests:reg
3f30: 69 73 74 65 72 2d 74 65 73 74 20 64 62 20 72 75 ister-test db ru
3f40: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 n-id test-name i
3f50: 74 65 6d 2d 70 61 74 68 29 0a 09 20 20 20 20 3b tem-path).. ;
3f60: 3b 0a 09 20 20 20 20 3b 3b 20 4e 42 2f 2f 20 66 ;.. ;; NB// f
3f70: 6f 72 20 74 68 65 20 61 62 6f 76 65 20 6c 69 6e or the above lin
3f80: 65 2e 20 49 20 77 61 6e 74 20 74 68 65 20 74 65 e. I want the te
3f90: 73 74 20 74 6f 20 62 65 20 72 65 67 69 73 74 65 st to be registe
3fa0: 72 65 64 20 6c 6f 6e 67 20 62 65 66 6f 72 65 20 red long before
3fb0: 74 68 69 73 20 72 6f 75 74 69 6e 65 20 67 65 74 this routine get
3fc0: 73 20 63 61 6c 6c 65 64 21 0a 09 20 20 20 20 3b s called!.. ;
3fd0: 3b 0a 09 20 20 20 20 28 73 65 74 21 20 74 65 73 ;.. (set! tes
3fe0: 74 2d 69 64 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 t-id (open-run-c
3ff0: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 lose db:get-test
4000: 2d 69 64 20 64 62 20 72 75 6e 2d 69 64 20 74 65 -id db run-id te
4010: 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 st-name item-pat
4020: 68 29 29 0a 09 20 20 20 20 28 69 66 20 28 6e 6f h)).. (if (no
4030: 74 20 74 65 73 74 2d 69 64 29 0a 09 09 28 62 65 t test-id)...(be
4040: 67 69 6e 0a 09 09 20 20 28 64 65 62 75 67 3a 70 gin... (debug:p
4050: 72 69 6e 74 20 32 20 22 57 41 52 4e 3a 20 54 65 rint 2 "WARN: Te
4060: 73 74 20 6e 6f 74 20 70 72 65 2d 63 72 65 61 74 st not pre-creat
4070: 65 64 3f 20 74 65 73 74 2d 6e 61 6d 65 3d 22 20 ed? test-name="
4080: 74 65 73 74 2d 6e 61 6d 65 20 22 2c 20 69 74 65 test-name ", ite
4090: 6d 2d 70 61 74 68 3d 22 20 69 74 65 6d 2d 70 61 m-path=" item-pa
40a0: 74 68 20 22 2c 20 72 75 6e 2d 69 64 3d 22 20 72 th ", run-id=" r
40b0: 75 6e 2d 69 64 29 0a 09 09 20 20 28 63 64 62 3a un-id)... (cdb:
40c0: 74 65 73 74 73 2d 72 65 67 69 73 74 65 72 2d 74 tests-register-t
40d0: 65 73 74 20 2a 72 75 6e 72 65 6d 6f 74 65 2a 20 est *runremote*
40e0: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
40f0: 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 09 20 20 item-path)...
4100: 28 73 65 74 21 20 74 65 73 74 2d 69 64 20 28 6f (set! test-id (o
4110: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 pen-run-close db
4120: 3a 67 65 74 2d 74 65 73 74 2d 69 64 20 64 62 20 :get-test-id db
4130: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
4140: 20 69 74 65 6d 2d 70 61 74 68 29 29 29 29 0a 09 item-path))))..
4150: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
4160: 2d 69 6e 66 6f 20 34 20 22 74 65 73 74 2d 69 64 -info 4 "test-id
4170: 3d 22 20 74 65 73 74 2d 69 64 20 22 2c 20 72 75 =" test-id ", ru
4180: 6e 2d 69 64 3d 22 20 72 75 6e 2d 69 64 20 22 2c n-id=" run-id ",
4190: 20 74 65 73 74 2d 6e 61 6d 65 3d 22 20 74 65 73 test-name=" tes
41a0: 74 2d 6e 61 6d 65 20 22 2c 20 69 74 65 6d 2d 70 t-name ", item-p
41b0: 61 74 68 3d 5c 22 22 20 69 74 65 6d 2d 70 61 74 ath=\"" item-pat
41c0: 68 20 22 5c 22 22 29 0a 09 20 20 20 20 28 73 65 h "\"").. (se
41d0: 74 21 20 74 65 73 74 64 61 74 20 28 63 64 62 3a t! testdat (cdb:
41e0: 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 2d 62 79 get-test-info-by
41f0: 2d 69 64 20 2a 72 75 6e 72 65 6d 6f 74 65 2a 20 -id *runremote*
4200: 74 65 73 74 2d 69 64 29 29 29 29 0a 20 20 20 20 test-id)))).
4210: 20 20 28 73 65 74 21 20 74 65 73 74 2d 69 64 20 (set! test-id
4220: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 (db:test-get-id
4230: 74 65 73 74 64 61 74 29 29 0a 20 20 20 20 20 20 testdat)).
4240: 28 63 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 (change-director
4250: 79 20 74 65 73 74 2d 70 61 74 68 29 0a 20 20 20 y test-path).
4260: 20 20 20 28 63 61 73 65 20 28 69 66 20 66 6f 72 (case (if for
4270: 63 65 20 3b 3b 20 28 61 72 67 73 3a 67 65 74 2d ce ;; (args:get-
4280: 61 72 67 20 22 2d 66 6f 72 63 65 22 29 0a 09 09 arg "-force")...
4290: 27 4e 4f 54 5f 53 54 41 52 54 45 44 0a 09 09 28 'NOT_STARTED...(
42a0: 69 66 20 74 65 73 74 64 61 74 0a 09 09 20 20 20 if testdat...
42b0: 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c (string->symbol
42c0: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 (test:get-state
42d0: 20 74 65 73 74 64 61 74 29 29 0a 09 09 20 20 20 testdat))...
42e0: 20 27 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 'failed-to-inse
42f0: 72 74 29 29 0a 09 28 28 66 61 69 6c 65 64 2d 74 rt))..((failed-t
4300: 6f 2d 69 6e 73 65 72 74 29 0a 09 20 28 64 65 62 o-insert).. (deb
4310: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f ug:print 0 "ERRO
4320: 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 69 6e 73 R: Failed to ins
4330: 65 72 74 20 74 68 65 20 72 65 63 6f 72 64 20 69 ert the record i
4340: 6e 74 6f 20 74 68 65 20 64 62 22 29 29 0a 09 28 nto the db"))..(
4350: 28 4e 4f 54 5f 53 54 41 52 54 45 44 20 43 4f 4d (NOT_STARTED COM
4360: 50 4c 45 54 45 44 20 44 45 4c 45 54 45 44 29 0a PLETED DELETED).
4370: 09 20 28 6c 65 74 20 28 28 72 75 6e 66 6c 61 67 . (let ((runflag
4380: 20 23 66 29 29 0a 09 20 20 20 28 63 6f 6e 64 0a #f)).. (cond.
4390: 09 20 20 20 20 3b 3b 20 2d 66 6f 72 63 65 2c 20 . ;; -force,
43a0: 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77 68 run no matter wh
43b0: 61 74 0a 09 20 20 20 20 28 66 6f 72 63 65 20 28 at.. (force (
43c0: 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 set! runflag #t)
43d0: 29 0a 09 20 20 20 20 3b 3b 20 4e 4f 54 5f 53 54 ).. ;; NOT_ST
43e0: 41 52 54 45 44 2c 20 72 75 6e 20 6e 6f 20 6d 61 ARTED, run no ma
43f0: 74 74 65 72 20 77 68 61 74 0a 09 20 20 20 20 28 tter what.. (
4400: 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 (member (test:ge
4410: 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 t-state testdat)
4420: 20 27 28 22 44 45 4c 45 54 45 44 22 20 22 4e 4f '("DELETED" "NO
4430: 54 5f 53 54 41 52 54 45 44 22 29 29 28 73 65 74 T_STARTED"))(set
4440: 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 ! runflag #t))..
4450: 20 20 20 20 3b 3b 20 6e 6f 74 20 2d 72 65 72 75 ;; not -reru
4460: 6e 20 61 6e 64 20 50 41 53 53 2c 20 57 41 52 4e n and PASS, WARN
4470: 20 6f 72 20 43 48 45 43 4b 2c 20 64 6f 20 6e 6f or CHECK, do no
4480: 20 72 75 6e 0a 09 20 20 20 20 28 28 61 6e 64 20 run.. ((and
4490: 28 6f 72 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a (or (not rerun).
44a0: 09 09 20 20 20 20 20 20 6b 65 65 70 67 6f 69 6e .. keepgoin
44b0: 67 29 0a 09 09 20 20 3b 3b 20 52 65 71 75 69 72 g)... ;; Requir
44c0: 65 20 74 6f 20 66 6f 72 63 65 20 72 65 2d 72 75 e to force re-ru
44d0: 6e 20 66 6f 72 20 43 4f 4d 50 4c 45 54 45 44 20 n for COMPLETED
44e0: 6f 72 20 2a 61 6e 79 74 68 69 6e 67 2a 20 2b 20 or *anything* +
44f0: 50 41 53 53 2c 57 41 52 4e 20 6f 72 20 43 48 45 PASS,WARN or CHE
4500: 43 4b 0a 09 09 20 20 28 6f 72 20 28 6d 65 6d 62 CK... (or (memb
4510: 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 er (test:get-sta
4520: 74 75 73 20 74 65 73 74 64 61 74 29 20 27 28 22 tus testdat) '("
4530: 50 41 53 53 22 20 22 57 41 52 4e 22 20 22 43 48 PASS" "WARN" "CH
4540: 45 43 4b 22 20 22 53 4b 49 50 22 29 29 0a 09 09 ECK" "SKIP"))...
4550: 20 20 20 20 20 20 28 6d 65 6d 62 65 72 20 28 74 (member (t
4560: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 20 74 est:get-state t
4570: 65 73 74 64 61 74 29 20 27 28 22 43 4f 4d 50 4c estdat) '("COMPL
4580: 45 54 45 44 22 29 29 29 29 20 0a 09 20 20 20 20 ETED")))) ..
4590: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e (debug:print-in
45a0: 66 6f 20 32 20 22 72 75 6e 6e 69 6e 67 20 74 65 fo 2 "running te
45b0: 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 st " test-name "
45c0: 2f 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20 73 /" item-path " s
45d0: 75 70 70 72 65 73 73 65 64 20 61 73 20 69 74 20 uppressed as it
45e0: 69 73 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 is " (test:get-s
45f0: 74 61 74 65 20 74 65 73 74 64 61 74 29 20 22 20 tate testdat) "
4600: 61 6e 64 20 22 20 28 74 65 73 74 3a 67 65 74 2d and " (test:get-
4610: 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 29 status testdat))
4620: 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 75 6e .. (set! run
4630: 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20 20 3b flag #f)).. ;
4640: 3b 20 2d 72 65 72 75 6e 20 61 6e 64 20 73 74 61 ; -rerun and sta
4650: 74 75 73 20 69 73 20 6f 6e 65 20 6f 66 20 74 68 tus is one of th
4660: 65 20 73 70 65 63 69 66 65 64 2c 20 72 75 6e 20 e specifed, run
4670: 69 74 0a 09 20 20 20 20 28 28 61 6e 64 20 72 65 it.. ((and re
4680: 72 75 6e 0a 09 09 20 20 28 6c 65 74 2a 20 28 28 run... (let* ((
4690: 72 65 72 75 6e 6c 73 74 20 20 20 28 73 74 72 69 rerunlst (stri
46a0: 6e 67 2d 73 70 6c 69 74 20 72 65 72 75 6e 20 22 ng-split rerun "
46b0: 2c 22 29 29 0a 09 09 09 20 28 6d 75 73 74 2d 72 ,")).... (must-r
46c0: 65 72 75 6e 20 28 6d 65 6d 62 65 72 20 28 74 65 erun (member (te
46d0: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 st:get-status te
46e0: 73 74 64 61 74 29 20 72 65 72 75 6e 6c 73 74 29 stdat) rerunlst)
46f0: 29 29 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a ))... (debug:
4700: 70 72 69 6e 74 2d 69 6e 66 6f 20 33 20 22 2d 72 print-info 3 "-r
4710: 65 72 75 6e 20 6c 69 73 74 3a 20 22 20 72 65 72 erun list: " rer
4720: 75 6e 20 22 2c 20 74 65 73 74 2d 73 74 61 74 75 un ", test-statu
4730: 73 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 s: " (test:get-s
4740: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 22 2c tatus testdat)",
4750: 20 6d 75 73 74 2d 72 65 72 75 6e 3a 20 22 20 6d must-rerun: " m
4760: 75 73 74 2d 72 65 72 75 6e 29 0a 09 09 20 20 20 ust-rerun)...
4770: 20 6d 75 73 74 2d 72 65 72 75 6e 29 29 0a 09 20 must-rerun))..
4780: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
4790: 2d 69 6e 66 6f 20 32 20 22 52 65 72 75 6e 20 66 -info 2 "Rerun f
47a0: 6f 72 63 65 64 20 66 6f 72 20 74 65 73 74 20 22 orced for test "
47b0: 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 test-name "/" i
47c0: 74 65 6d 2d 70 61 74 68 29 0a 09 20 20 20 20 20 tem-path)..
47d0: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 (set! runflag #t
47e0: 29 29 0a 09 20 20 20 20 3b 3b 20 2d 6b 65 65 70 )).. ;; -keep
47f0: 67 6f 69 6e 67 2c 20 64 6f 20 6e 6f 74 20 72 65 going, do not re
4800: 72 75 6e 20 46 41 49 4c 0a 09 20 20 20 20 28 28 run FAIL.. ((
4810: 61 6e 64 20 6b 65 65 70 67 6f 69 6e 67 0a 09 09 and keepgoing...
4820: 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a (member (test:
4830: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 get-status testd
4840: 61 74 29 20 27 28 22 46 41 49 4c 22 29 29 29 0a at) '("FAIL"))).
4850: 09 20 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 . (set! runf
4860: 6c 61 67 20 23 66 29 29 0a 09 20 20 20 20 28 28 lag #f)).. ((
4870: 61 6e 64 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a and (not rerun).
4880: 09 09 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 .. (member (tes
4890: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 t:get-status tes
48a0: 74 64 61 74 29 20 27 28 22 46 41 49 4c 22 20 22 tdat) '("FAIL" "
48b0: 6e 2f 61 22 29 29 29 0a 09 20 20 20 20 20 28 73 n/a"))).. (s
48c0: 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 et! runflag #t))
48d0: 0a 09 20 20 20 20 28 65 6c 73 65 20 28 73 65 74 .. (else (set
48e0: 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 29 0a ! runflag #f))).
48f0: 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 . (debug:print
4900: 20 36 20 22 52 55 4e 4e 49 4e 47 20 3d 3e 20 72 6 "RUNNING => r
4910: 75 6e 66 6c 61 67 3a 20 22 20 72 75 6e 66 6c 61 unflag: " runfla
4920: 67 20 22 20 53 54 41 54 45 3a 20 22 20 28 74 65 g " STATE: " (te
4930: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 st:get-state tes
4940: 74 64 61 74 29 20 22 20 53 54 41 54 55 53 3a 20 tdat) " STATUS:
4950: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 " (test:get-stat
4960: 75 73 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 us testdat))..
4970: 20 28 69 66 20 28 6e 6f 74 20 72 75 6e 66 6c 61 (if (not runfla
4980: 67 29 0a 09 20 20 20 20 20 20 20 28 69 66 20 28 g).. (if (
4990: 6e 6f 74 20 70 61 72 65 6e 74 2d 74 65 73 74 29 not parent-test)
49a0: 0a 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 ... (debug:pri
49b0: 6e 74 20 31 20 22 4e 4f 54 45 3a 20 4e 6f 74 20 nt 1 "NOTE: Not
49c0: 73 74 61 72 74 69 6e 67 20 74 65 73 74 20 22 20 starting test "
49d0: 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 new-test-name "
49e0: 61 73 20 69 74 20 69 73 20 73 74 61 74 65 20 5c as it is state \
49f0: 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 "" (test:get-sta
4a00: 74 65 20 74 65 73 74 64 61 74 29 20 0a 09 09 09 te testdat) ....
4a10: 09 22 5c 22 20 61 6e 64 20 73 74 61 74 75 73 20 ."\" and status
4a20: 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 \"" (test:get-st
4a30: 61 74 75 73 20 74 65 73 74 64 61 74 29 20 22 5c atus testdat) "\
4a40: 22 2c 20 75 73 65 20 2d 72 65 72 75 6e 20 5c 22 ", use -rerun \"
4a50: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 " (test:get-stat
4a60: 75 73 20 74 65 73 74 64 61 74 29 0a 20 20 20 20 us testdat).
4a70: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
4a80: 20 20 20 20 20 20 20 20 20 20 20 20 22 5c 22 20 "\"
4a90: 6f 72 20 2d 66 6f 72 63 65 20 74 6f 20 6f 76 65 or -force to ove
4aa0: 72 72 69 64 65 22 29 29 0a 09 20 20 20 20 20 20 rride"))..
4ab0: 20 3b 3b 20 4e 4f 54 45 3a 20 4e 6f 20 6c 6f 6e ;; NOTE: No lon
4ac0: 67 65 72 20 62 65 20 63 68 65 63 6b 69 6e 67 20 ger be checking
4ad0: 70 72 65 72 65 71 75 69 73 69 74 65 73 20 68 65 prerequisites he
4ae0: 72 65 21 20 57 69 6c 6c 20 6e 65 76 65 72 20 67 re! Will never g
4af0: 65 74 20 68 65 72 65 20 75 6e 6c 65 73 73 20 70 et here unless p
4b00: 72 65 72 65 71 73 20 61 72 65 0a 09 20 20 20 20 rereqs are..
4b10: 20 20 20 3b 3b 20 20 20 20 20 20 20 61 6c 72 65 ;; alre
4b20: 61 64 79 20 6d 65 74 2e 0a 09 20 20 20 20 20 20 ady met...
4b30: 20 3b 3b 20 54 68 69 73 20 77 6f 75 6c 64 20 62 ;; This would b
4b40: 65 20 61 20 67 72 65 61 74 20 70 6c 61 63 65 20 e a great place
4b50: 74 6f 20 64 6f 20 74 68 65 20 70 72 6f 63 65 73 to do the proces
4b60: 73 2d 66 6f 72 6b 0a 09 20 20 20 20 20 20 20 28 s-fork.. (
4b70: 69 66 20 28 6e 6f 74 20 28 6c 61 75 6e 63 68 2d if (not (launch-
4b80: 74 65 73 74 20 23 66 20 72 75 6e 2d 69 64 20 72 test #f run-id r
4b90: 75 6e 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 unname test-conf
4ba0: 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 73 74 2d keyvallst test-
4bb0: 6e 61 6d 65 20 74 65 73 74 2d 70 61 74 68 20 69 name test-path i
4bc0: 74 65 6d 64 61 74 20 66 6c 61 67 73 29 29 0a 09 temdat flags))..
4bd0: 09 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 . (begin...
4be0: 20 20 28 70 72 69 6e 74 20 22 45 52 52 4f 52 3a (print "ERROR:
4bf0: 20 46 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 Failed to launc
4c00: 68 20 74 68 65 20 74 65 73 74 2e 20 45 78 69 74 h the test. Exit
4c10: 69 6e 67 20 61 73 20 73 6f 6f 6e 20 61 73 20 70 ing as soon as p
4c20: 6f 73 73 69 62 6c 65 22 29 0a 09 09 20 20 20 20 ossible")...
4c30: 20 28 73 65 74 21 20 2a 67 6c 6f 62 61 6c 65 78 (set! *globalex
4c40: 69 74 73 74 61 74 75 73 2a 20 31 29 20 3b 3b 20 itstatus* 1) ;;
4c50: 0a 09 09 20 20 20 20 20 28 70 72 6f 63 65 73 73 ... (process
4c60: 2d 73 69 67 6e 61 6c 20 28 63 75 72 72 65 6e 74 -signal (current
4c70: 2d 70 72 6f 63 65 73 73 2d 69 64 29 20 73 69 67 -process-id) sig
4c80: 6e 61 6c 2f 6b 69 6c 6c 29 29 29 29 29 29 0a 09 nal/kill))))))..
4c90: 28 28 4b 49 4c 4c 45 44 29 20 0a 09 20 28 64 65 ((KILLED) .. (de
4ca0: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 bug:print 1 "NOT
4cb0: 45 3a 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 E: " new-test-na
4cc0: 6d 65 20 22 20 69 73 20 61 6c 72 65 61 64 79 20 me " is already
4cd0: 72 75 6e 6e 69 6e 67 20 6f 72 20 77 61 73 20 65 running or was e
4ce0: 78 70 6c 69 63 74 6c 79 20 6b 69 6c 6c 65 64 2c xplictly killed,
4cf0: 20 75 73 65 20 2d 66 6f 72 63 65 20 74 6f 20 6c use -force to l
4d00: 61 75 6e 63 68 20 69 74 2e 22 29 29 0a 09 28 28 aunch it."))..((
4d10: 4c 41 55 4e 43 48 45 44 20 52 45 4d 4f 54 45 48 LAUNCHED REMOTEH
4d20: 4f 53 54 53 54 41 52 54 20 52 55 4e 4e 49 4e 47 OSTSTART RUNNING
4d30: 29 20 20 0a 09 20 28 69 66 20 28 3e 20 28 2d 20 ) .. (if (> (-
4d40: 28 63 75 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73 (current-seconds
4d50: 29 28 2b 20 28 64 62 3a 74 65 73 74 2d 67 65 74 )(+ (db:test-get
4d60: 2d 65 76 65 6e 74 5f 74 69 6d 65 20 74 65 73 74 -event_time test
4d70: 64 61 74 29 0a 09 09 09 09 20 20 20 20 20 20 20 dat).....
4d80: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e (db:test-get-run
4d90: 5f 64 75 72 61 74 69 6f 6e 20 74 65 73 74 64 61 _duration testda
4da0: 74 29 29 29 0a 09 09 36 30 30 29 20 3b 3b 20 69 t)))...600) ;; i
4db0: 2e 65 2e 20 6e 6f 20 75 70 64 61 74 65 20 66 6f .e. no update fo
4dc0: 72 20 6d 6f 72 65 20 74 68 61 6e 20 36 30 30 20 r more than 600
4dd0: 73 65 63 6f 6e 64 73 0a 09 20 20 20 20 20 28 62 seconds.. (b
4de0: 65 67 69 6e 0a 09 20 20 20 20 20 20 20 28 64 65 egin.. (de
4df0: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 bug:print 0 "WAR
4e00: 4e 49 4e 47 3a 20 54 65 73 74 20 22 20 74 65 73 NING: Test " tes
4e10: 74 2d 6e 61 6d 65 20 22 20 61 70 70 65 61 72 73 t-name " appears
4e20: 20 74 6f 20 62 65 20 64 65 61 64 2e 20 46 6f 72 to be dead. For
4e30: 63 69 6e 67 20 69 74 20 74 6f 20 73 74 61 74 65 cing it to state
4e40: 20 49 4e 43 4f 4d 50 4c 45 54 45 20 61 6e 64 20 INCOMPLETE and
4e50: 73 74 61 74 75 73 20 53 54 55 43 4b 2f 44 45 41 status STUCK/DEA
4e60: 44 22 29 0a 09 20 20 20 20 20 20 20 28 74 65 73 D").. (tes
4e70: 74 73 3a 74 65 73 74 2d 73 65 74 2d 73 74 61 74 ts:test-set-stat
4e80: 75 73 21 20 74 65 73 74 2d 69 64 20 22 49 4e 43 us! test-id "INC
4e90: 4f 4d 50 4c 45 54 45 22 20 22 53 54 55 43 4b 2f OMPLETE" "STUCK/
4ea0: 44 45 41 44 22 20 22 54 65 73 74 20 69 73 20 73 DEAD" "Test is s
4eb0: 74 75 63 6b 20 6f 72 20 64 65 61 64 22 20 23 66 tuck or dead" #f
4ec0: 29 29 0a 09 20 20 20 20 20 28 64 65 62 75 67 3a )).. (debug:
4ed0: 70 72 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 22 print 2 "NOTE: "
4ee0: 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 test-name " is
4ef0: 61 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e 67 22 already running"
4f00: 29 29 29 0a 09 28 65 6c 73 65 20 20 20 20 20 20 )))..(else
4f10: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 (debug:print 0
4f20: 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 "ERROR: Failed t
4f30: 6f 20 6c 61 75 6e 63 68 20 74 65 73 74 20 22 20 o launch test "
4f40: 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 2e new-test-name ".
4f50: 20 55 6e 72 65 63 6f 67 6e 69 73 65 64 20 73 74 Unrecognised st
4f60: 61 74 65 20 22 20 28 74 65 73 74 3a 67 65 74 2d ate " (test:get-
4f70: 73 74 61 74 65 20 74 65 73 74 64 61 74 29 29 29 state testdat)))
4f80: 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d ))))..;;========
4f90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
4fa0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
4fb0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
4fc0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b ==============.;
4fd0: 3b 20 45 4e 44 20 4f 46 20 4e 45 57 20 53 54 55 ; END OF NEW STU
4fe0: 46 46 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d FF.;;===========
4ff0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5000: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5010: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5020: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 ===========..(de
5030: 66 69 6e 65 20 28 67 65 74 2d 64 69 72 2d 75 70 fine (get-dir-up
5040: 2d 6e 20 64 69 72 20 2e 20 70 61 72 61 6d 73 29 -n dir . params)
5050: 20 0a 20 20 28 6c 65 74 20 28 28 64 70 61 72 74 . (let ((dpart
5060: 73 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 s (string-split
5070: 20 64 69 72 20 22 2f 22 29 29 0a 09 28 63 6f 75 dir "/"))..(cou
5080: 6e 74 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 nt (if (null?
5090: 70 61 72 61 6d 73 29 20 31 20 28 63 61 72 20 70 params) 1 (car p
50a0: 61 72 61 6d 73 29 29 29 29 0a 20 20 20 20 28 63 arams)))). (c
50b0: 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 6e 67 2d onc "/" (string-
50c0: 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09 20 20 intersperse ..
50d0: 20 20 20 20 20 28 74 61 6b 65 20 64 70 61 72 74 (take dpart
50e0: 73 20 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 s (- (length dpa
50f0: 72 74 73 29 20 63 6f 75 6e 74 29 29 0a 09 20 20 rts) count))..
5100: 20 20 20 20 20 22 2f 22 29 29 29 29 0a 3b 3b 20 "/")))).;;
5110: 52 65 6d 6f 76 65 20 72 75 6e 73 0a 3b 3b 20 66 Remove runs.;; f
5120: 69 65 6c 64 73 20 61 72 65 20 70 61 73 73 69 6e ields are passin
5130: 67 20 69 6e 20 74 68 72 6f 75 67 68 20 0a 3b 3b g in through .;;
5140: 20 61 63 74 69 6f 6e 3a 0a 3b 3b 20 20 20 20 27 action:.;; '
5150: 72 65 6d 6f 76 65 2d 72 75 6e 73 0a 3b 3b 20 20 remove-runs.;;
5160: 20 20 27 73 65 74 2d 73 74 61 74 65 2d 73 74 61 'set-state-sta
5170: 74 75 73 0a 3b 3b 0a 3b 3b 20 4e 42 2f 2f 20 73 tus.;;.;; NB// s
5180: 68 6f 75 6c 64 20 70 61 73 73 20 69 6e 20 6b 65 hould pass in ke
5190: 79 73 3f 0a 3b 3b 0a 28 64 65 66 69 6e 65 20 28 ys?.;;.(define (
51a0: 72 75 6e 73 3a 6f 70 65 72 61 74 65 2d 6f 6e 20 runs:operate-on
51b0: 61 63 74 69 6f 6e 20 72 75 6e 6e 61 6d 65 70 61 action runnamepa
51c0: 74 74 20 74 65 73 74 70 61 74 74 20 23 21 6b 65 tt testpatt #!ke
51d0: 79 20 28 73 74 61 74 65 20 23 66 29 28 73 74 61 y (state #f)(sta
51e0: 74 75 73 20 23 66 29 28 6e 65 77 2d 73 74 61 74 tus #f)(new-stat
51f0: 65 2d 73 74 61 74 75 73 20 23 66 29 29 0a 20 20 e-status #f)).
5200: 28 63 6f 6d 6d 6f 6e 3a 63 6c 65 61 72 2d 63 61 (common:clear-ca
5210: 63 68 65 73 29 20 3b 3b 20 63 6c 65 61 72 20 61 ches) ;; clear a
5220: 6c 6c 20 63 61 63 68 65 73 0a 20 20 28 6c 65 74 ll caches. (let
5230: 2a 20 28 28 64 62 20 20 20 20 20 20 20 20 20 20 * ((db
5240: 20 23 66 29 0a 09 20 28 6b 65 79 73 20 20 20 20 #f).. (keys
5250: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 (open-run-c
5260: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 6b 65 79 73 lose db:get-keys
5270: 20 64 62 29 29 0a 09 20 28 72 75 6e 64 61 74 20 db)).. (rundat
5280: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d (open-run-
5290: 63 6c 6f 73 65 20 72 75 6e 73 3a 67 65 74 2d 72 close runs:get-r
52a0: 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20 6b uns-by-patt db k
52b0: 65 79 73 20 72 75 6e 6e 61 6d 65 70 61 74 74 29 eys runnamepatt)
52c0: 29 0a 09 20 28 68 65 61 64 65 72 20 20 20 20 20 ).. (header
52d0: 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 (vector-ref ru
52e0: 6e 64 61 74 20 30 29 29 0a 09 20 28 72 75 6e 73 ndat 0)).. (runs
52f0: 20 20 20 20 20 20 20 20 20 28 76 65 63 74 6f 72 (vector
5300: 2d 72 65 66 20 72 75 6e 64 61 74 20 31 29 29 0a -ref rundat 1)).
5310: 09 20 28 73 74 61 74 65 73 20 20 20 20 20 20 20 . (states
5320: 28 69 66 20 73 74 61 74 65 20 20 28 73 74 72 69 (if state (stri
5330: 6e 67 2d 73 70 6c 69 74 20 73 74 61 74 65 20 20 ng-split state
5340: 22 2c 22 29 20 27 28 29 29 29 0a 09 20 28 73 74 ",") '())).. (st
5350: 61 74 75 73 65 73 20 20 20 20 20 28 69 66 20 73 atuses (if s
5360: 74 61 74 75 73 20 28 73 74 72 69 6e 67 2d 73 70 tatus (string-sp
5370: 6c 69 74 20 73 74 61 74 75 73 20 22 2c 22 29 20 lit status ",")
5380: 27 28 29 29 29 0a 09 20 28 73 74 61 74 65 2d 73 '())).. (state-s
5390: 74 61 74 75 73 20 28 69 66 20 28 73 74 72 69 6e tatus (if (strin
53a0: 67 3f 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 g? new-state-sta
53b0: 74 75 73 29 20 28 73 74 72 69 6e 67 2d 73 70 6c tus) (string-spl
53c0: 69 74 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 it new-state-sta
53d0: 74 75 73 20 22 2c 22 29 20 27 28 23 66 20 23 66 tus ",") '(#f #f
53e0: 29 29 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a )))). (debug:
53f0: 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 72 75 print-info 4 "ru
5400: 6e 73 3a 6f 70 65 72 61 74 65 2d 6f 6e 20 3d 3e ns:operate-on =>
5410: 20 48 65 61 64 65 72 3a 20 22 20 68 65 61 64 65 Header: " heade
5420: 72 20 22 20 61 63 74 69 6f 6e 3a 20 22 20 61 63 r " action: " ac
5430: 74 69 6f 6e 20 22 20 6e 65 77 2d 73 74 61 74 65 tion " new-state
5440: 2d 73 74 61 74 75 73 3a 20 22 20 6e 65 77 2d 73 -status: " new-s
5450: 74 61 74 65 2d 73 74 61 74 75 73 29 0a 20 20 20 tate-status).
5460: 20 28 69 66 20 28 3e 20 32 20 28 6c 65 6e 67 74 (if (> 2 (lengt
5470: 68 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 29 h state-status))
5480: 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 64 65 62 ..(begin.. (deb
5490: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f ug:print 0 "ERRO
54a0: 52 3a 20 74 68 65 20 70 61 72 61 6d 65 74 65 72 R: the parameter
54b0: 20 74 6f 20 2d 73 65 74 2d 73 74 61 74 65 2d 73 to -set-state-s
54c0: 74 61 74 75 73 20 69 73 20 61 20 63 6f 6d 6d 61 tatus is a comma
54d0: 20 64 65 6c 69 6d 69 74 65 64 20 73 74 72 69 6e delimited strin
54e0: 67 2e 20 45 2e 67 2e 20 43 4f 4d 50 4c 45 54 45 g. E.g. COMPLETE
54f0: 44 2c 46 41 49 4c 22 29 0a 09 20 20 28 65 78 69 D,FAIL").. (exi
5500: 74 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 t))). (for-ea
5510: 63 68 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 ch. (lambda
5520: 28 72 75 6e 29 0a 20 20 20 20 20 20 20 28 6c 65 (run). (le
5530: 74 20 28 28 72 75 6e 6b 65 79 20 28 73 74 72 69 t ((runkey (stri
5540: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 ng-intersperse (
5550: 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 0a map (lambda (k).
5560: 09 09 09 09 09 09 28 64 62 3a 67 65 74 2d 76 61 ......(db:get-va
5570: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 lue-by-header ru
5580: 6e 20 68 65 61 64 65 72 20 28 76 65 63 74 6f 72 n header (vector
5590: 2d 72 65 66 20 6b 20 30 29 29 29 20 6b 65 79 73 -ref k 0))) keys
55a0: 29 20 22 2f 22 29 29 0a 09 20 20 20 20 20 28 64 ) "/")).. (d
55b0: 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 28 6d irs-to-remove (m
55c0: 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 ake-hash-table))
55d0: 29 0a 09 20 28 6c 65 74 2a 20 28 28 72 75 6e 2d ).. (let* ((run-
55e0: 69 64 20 20 20 20 28 64 62 3a 67 65 74 2d 76 61 id (db:get-va
55f0: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 lue-by-header ru
5600: 6e 20 68 65 61 64 65 72 20 22 69 64 22 29 29 0a n header "id")).
5610: 09 09 28 72 75 6e 2d 73 74 61 74 65 20 28 64 62 ..(run-state (db
5620: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 :get-value-by-he
5630: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 ader run header
5640: 22 73 74 61 74 65 22 29 29 0a 09 09 28 74 65 73 "state"))...(tes
5650: 74 73 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 ts (if (not
5660: 28 65 71 75 61 6c 3f 20 72 75 6e 2d 73 74 61 74 (equal? run-stat
5670: 65 20 22 6c 6f 63 6b 65 64 22 29 29 0a 09 09 09 e "locked"))....
5680: 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e (open-run
5690: 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 -close db:get-te
56a0: 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 72 sts-for-run db r
56b0: 75 6e 2d 69 64 0a 09 09 09 09 09 09 20 20 20 20 un-id.......
56c0: 20 20 74 65 73 74 70 61 74 74 20 73 74 61 74 65 testpatt state
56d0: 73 20 73 74 61 74 75 73 65 73 0a 09 09 09 09 09 s statuses......
56e0: 09 20 20 20 20 20 20 6e 6f 74 2d 69 6e 3a 20 20 . not-in:
56f0: 23 66 0a 09 09 09 09 09 09 20 20 20 20 20 20 73 #f....... s
5700: 6f 72 74 2d 62 79 3a 20 28 63 61 73 65 20 61 63 ort-by: (case ac
5710: 74 69 6f 6e 0a 09 09 09 09 09 09 09 09 20 28 28 tion......... ((
5720: 72 65 6d 6f 76 65 2d 72 75 6e 73 29 20 27 72 75 remove-runs) 'ru
5730: 6e 64 69 72 29 0a 09 09 09 09 09 09 09 09 20 28 ndir)......... (
5740: 65 6c 73 65 20 20 20 20 20 20 20 20 20 20 27 65 else 'e
5750: 76 65 6e 74 5f 74 69 6d 65 29 29 29 0a 09 09 09 vent_time)))....
5760: 20 20 20 20 20 20 20 27 28 29 29 29 0a 09 09 28 '()))...(
5770: 6c 61 73 74 74 70 61 74 68 20 22 2f 64 6f 65 73 lasttpath "/does
5780: 2f 6e 6f 74 2f 65 78 69 73 74 2f 49 2f 68 6f 70 /not/exist/I/hop
5790: 65 22 29 29 0a 09 20 20 20 28 64 65 62 75 67 3a e")).. (debug:
57a0: 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 72 75 print-info 4 "ru
57b0: 6e 73 3a 6f 70 65 72 61 74 65 2d 6f 6e 20 72 75 ns:operate-on ru
57c0: 6e 3d 22 20 72 75 6e 20 22 2c 20 68 65 61 64 65 n=" run ", heade
57d0: 72 3d 22 20 68 65 61 64 65 72 29 0a 09 20 20 20 r=" header)..
57e0: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 (if (not (null?
57f0: 74 65 73 74 73 29 29 0a 09 20 20 20 20 20 20 20 tests))..
5800: 28 62 65 67 69 6e 0a 09 09 20 28 63 61 73 65 20 (begin... (case
5810: 61 63 74 69 6f 6e 0a 09 09 20 20 20 28 28 72 65 action... ((re
5820: 6d 6f 76 65 2d 72 75 6e 73 29 0a 09 09 20 20 20 move-runs)...
5830: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 (debug:print 1
5840: 22 52 65 6d 6f 76 69 6e 67 20 74 65 73 74 73 20 "Removing tests
5850: 66 6f 72 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 for run: " runke
5860: 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61 y " " (db:get-va
5870: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 lue-by-header ru
5880: 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d n header "runnam
5890: 65 22 29 29 29 0a 09 09 20 20 20 28 28 73 65 74 e")))... ((set
58a0: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 29 0a 09 -state-status)..
58b0: 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e . (debug:prin
58c0: 74 20 31 20 22 4d 6f 64 69 66 79 69 6e 67 20 73 t 1 "Modifying s
58d0: 74 61 74 65 20 61 6e 64 20 73 74 61 75 73 20 66 tate and staus f
58e0: 6f 72 20 74 65 73 74 73 20 66 6f 72 20 72 75 6e or tests for run
58f0: 3a 20 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28 : " runkey " " (
5900: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d db:get-value-by-
5910: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 header run heade
5920: 72 20 22 72 75 6e 6e 61 6d 65 22 29 29 29 0a 09 r "runname")))..
5930: 09 20 20 20 28 28 70 72 69 6e 74 2d 72 75 6e 29 . ((print-run)
5940: 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 ... (debug:pr
5950: 69 6e 74 20 31 20 22 50 72 69 6e 74 69 6e 67 20 int 1 "Printing
5960: 69 6e 66 6f 20 66 6f 72 20 72 75 6e 20 22 20 72 info for run " r
5970: 75 6e 6b 65 79 20 22 2c 20 72 75 6e 3d 22 20 72 unkey ", run=" r
5980: 75 6e 20 22 2c 20 74 65 73 74 73 3d 22 20 74 65 un ", tests=" te
5990: 73 74 73 20 22 2c 20 68 65 61 64 65 72 3d 22 20 sts ", header="
59a0: 68 65 61 64 65 72 29 0a 09 09 20 20 20 20 61 63 header)... ac
59b0: 74 69 6f 6e 29 0a 09 09 20 20 20 28 65 6c 73 65 tion)... (else
59c0: 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 ... (debug:pr
59d0: 69 6e 74 2d 69 6e 66 6f 20 30 20 22 61 63 74 69 int-info 0 "acti
59e0: 6f 6e 20 6e 6f 74 20 72 65 63 6f 67 6e 69 73 65 on not recognise
59f0: 64 20 22 20 61 63 74 69 6f 6e 29 29 29 0a 09 09 d " action)))...
5a00: 20 28 66 6f 72 2d 65 61 63 68 0a 09 09 20 20 28 (for-each... (
5a10: 6c 61 6d 62 64 61 20 28 74 65 73 74 29 0a 09 09 lambda (test)...
5a20: 20 20 20 20 28 6c 65 74 2a 20 28 28 69 74 65 6d (let* ((item
5a30: 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 -path (db:test-g
5a40: 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 et-item-path tes
5a50: 74 29 29 0a 09 09 09 20 20 20 28 74 65 73 74 2d t)).... (test-
5a60: 6e 61 6d 65 20 28 64 62 3a 74 65 73 74 2d 67 65 name (db:test-ge
5a70: 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29 t-testname test)
5a80: 29 0a 09 09 09 20 20 20 28 72 75 6e 2d 64 69 72 ).... (run-dir
5a90: 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d (db:test-get-
5aa0: 72 75 6e 64 69 72 20 74 65 73 74 29 29 20 20 20 rundir test))
5ab0: 20 3b 3b 20 72 75 6e 20 64 69 72 20 69 73 20 66 ;; run dir is f
5ac0: 72 6f 6d 20 74 68 65 20 6c 69 6e 6b 20 74 72 65 rom the link tre
5ad0: 65 0a 09 09 09 20 20 20 28 72 65 61 6c 2d 64 69 e.... (real-di
5ae0: 72 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 r (if (file-exi
5af0: 73 74 73 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09 sts? run-dir)...
5b00: 09 09 09 20 20 28 72 65 73 6f 6c 76 65 2d 70 61 ... (resolve-pa
5b10: 74 68 6e 61 6d 65 20 72 75 6e 2d 64 69 72 29 0a thname run-dir).
5b20: 09 09 09 09 09 20 20 23 66 29 29 0a 09 09 09 20 ..... #f))....
5b30: 20 20 28 74 65 73 74 2d 69 64 20 20 20 28 64 62 (test-id (db
5b40: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 :test-get-id tes
5b50: 74 29 29 29 0a 09 09 20 20 20 20 20 20 3b 3b 20 t)))... ;;
5b60: 20 20 28 74 64 62 20 20 20 20 20 20 20 28 64 62 (tdb (db
5b70: 3a 6f 70 65 6e 2d 74 65 73 74 2d 64 62 20 72 75 :open-test-db ru
5b80: 6e 2d 64 69 72 29 29 29 0a 09 09 20 20 20 20 20 n-dir)))...
5b90: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e (debug:print-in
5ba0: 66 6f 20 34 20 22 74 65 73 74 3d 22 20 74 65 73 fo 4 "test=" tes
5bb0: 74 29 20 3b 3b 20 20 20 22 20 28 64 62 3a 74 65 t) ;; " (db:te
5bc0: 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 st-get-testname
5bd0: 74 65 73 74 29 20 22 20 69 64 3a 20 22 20 28 64 test) " id: " (d
5be0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 b:test-get-id te
5bf0: 73 74 29 20 22 20 22 20 69 74 65 6d 2d 70 61 74 st) " " item-pat
5c00: 68 20 22 20 61 63 74 69 6f 6e 3a 20 22 20 61 63 h " action: " ac
5c10: 74 69 6f 6e 29 0a 09 09 20 20 20 20 20 20 28 63 tion)... (c
5c20: 61 73 65 20 61 63 74 69 6f 6e 0a 09 09 09 28 28 ase action....((
5c30: 72 65 6d 6f 76 65 2d 72 75 6e 73 29 20 3b 3b 20 remove-runs) ;;
5c40: 74 68 65 20 74 64 62 20 69 73 20 66 6f 72 20 66 the tdb is for f
5c50: 75 74 75 72 65 20 70 6f 73 73 69 62 6c 65 2e 20 uture possible.
5c60: 0a 09 09 09 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 .... (open-run-c
5c70: 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 2d 74 lose db:delete-t
5c80: 65 73 74 2d 72 65 63 6f 72 64 73 20 64 62 20 23 est-records db #
5c90: 66 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 f (db:test-get-i
5ca0: 64 20 74 65 73 74 29 29 0a 09 09 09 20 28 64 65 d test)).... (de
5cb0: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 bug:print-info 1
5cc0: 20 22 41 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 "Attempting to
5cd0: 72 65 6d 6f 76 65 20 22 20 28 69 66 20 72 65 61 remove " (if rea
5ce0: 6c 2d 64 69 72 20 28 63 6f 6e 63 20 22 20 64 69 l-dir (conc " di
5cf0: 72 20 22 20 72 65 61 6c 2d 64 69 72 20 22 20 61 r " real-dir " a
5d00: 6e 64 20 22 29 20 22 22 29 20 22 20 6c 69 6e 6b nd ") "") " link
5d10: 20 22 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 20 " run-dir)....
5d20: 28 69 66 20 28 61 6e 64 20 72 65 61 6c 2d 64 69 (if (and real-di
5d30: 72 20 0a 09 09 09 09 20 20 28 3e 20 28 73 74 72 r ..... (> (str
5d40: 69 6e 67 2d 6c 65 6e 67 74 68 20 72 65 61 6c 2d ing-length real-
5d50: 64 69 72 29 20 35 29 0a 09 09 09 09 20 20 28 66 dir) 5)..... (f
5d60: 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 65 61 6c ile-exists? real
5d70: 2d 64 69 72 29 29 20 3b 3b 20 62 61 64 20 68 65 -dir)) ;; bad he
5d80: 75 72 69 73 74 69 63 20 62 75 74 20 73 68 6f 75 uristic but shou
5d90: 6c 64 20 70 72 65 76 65 6e 74 20 2f 74 6d 70 20 ld prevent /tmp
5da0: 2f 68 6f 6d 65 20 65 74 63 2e 0a 09 09 09 20 20 /home etc.....
5db0: 20 20 20 28 62 65 67 69 6e 20 3b 3b 20 6c 65 74 (begin ;; let
5dc0: 2a 20 28 28 72 65 61 6c 70 61 74 68 20 28 72 65 * ((realpath (re
5dd0: 73 6f 6c 76 65 2d 70 61 74 68 6e 61 6d 65 20 72 solve-pathname r
5de0: 75 6e 2d 64 69 72 29 29 29 0a 09 09 09 20 20 20 un-dir)))....
5df0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
5e00: 2d 69 6e 66 6f 20 31 20 22 52 65 63 75 72 73 69 -info 1 "Recursi
5e10: 76 65 6c 79 20 72 65 6d 6f 76 69 6e 67 20 22 20 vely removing "
5e20: 72 65 61 6c 2d 64 69 72 29 0a 09 09 09 20 20 20 real-dir)....
5e30: 20 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 (if (file-ex
5e40: 69 73 74 73 3f 20 72 65 61 6c 2d 64 69 72 29 0a ists? real-dir).
5e50: 09 09 09 09 20 20 20 28 69 66 20 28 3e 20 28 73 .... (if (> (s
5e60: 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 20 ystem (conc "rm
5e70: 2d 72 66 20 22 20 72 65 61 6c 2d 64 69 72 29 29 -rf " real-dir))
5e80: 20 30 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 0)..... (
5e90: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 debug:print 0 "E
5ea0: 52 52 4f 52 3a 20 54 68 65 72 65 20 77 61 73 20 RROR: There was
5eb0: 61 20 70 72 6f 62 6c 65 6d 20 72 65 6d 6f 76 69 a problem removi
5ec0: 6e 67 20 22 20 72 65 61 6c 2d 64 69 72 20 22 20 ng " real-dir "
5ed0: 77 69 74 68 20 72 6d 20 2d 66 22 29 29 0a 09 09 with rm -f"))...
5ee0: 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e .. (debug:prin
5ef0: 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 74 65 t 0 "WARNING: te
5f00: 73 74 20 64 69 72 20 22 20 72 65 61 6c 2d 64 69 st dir " real-di
5f10: 72 20 22 20 61 70 70 65 61 72 73 20 74 6f 20 6e r " appears to n
5f20: 6f 74 20 65 78 69 73 74 20 6f 72 20 69 73 20 6e ot exist or is n
5f30: 6f 74 20 72 65 61 64 61 62 6c 65 22 29 29 29 0a ot readable"))).
5f40: 09 09 09 20 20 20 20 20 28 69 66 20 72 65 61 6c ... (if real
5f50: 2d 64 69 72 20 0a 09 09 09 09 20 28 64 65 62 75 -dir ..... (debu
5f60: 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 g:print 0 "WARNI
5f70: 4e 47 3a 20 64 69 72 65 63 74 6f 72 79 20 22 20 NG: directory "
5f80: 72 65 61 6c 2d 64 69 72 20 22 20 64 6f 65 73 20 real-dir " does
5f90: 6e 6f 74 20 65 78 69 73 74 22 29 0a 09 09 09 09 not exist").....
5fa0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 (debug:print 0
5fb0: 22 57 41 52 4e 49 4e 47 3a 20 6e 6f 20 72 65 61 "WARNING: no rea
5fc0: 6c 20 64 69 72 65 63 74 6f 72 79 20 63 6f 72 72 l directory corr
5fd0: 6f 73 70 6f 6e 64 69 6e 67 20 74 6f 20 6c 69 6e osponding to lin
5fe0: 6b 20 22 20 72 75 6e 2d 64 69 72 20 22 2c 20 6e k " run-dir ", n
5ff0: 6f 74 68 69 6e 67 20 64 6f 6e 65 22 29 29 29 0a othing done"))).
6000: 09 09 09 20 28 69 66 20 28 73 79 6d 62 6f 6c 69 ... (if (symboli
6010: 63 2d 6c 69 6e 6b 3f 20 72 75 6e 2d 64 69 72 29 c-link? run-dir)
6020: 0a 09 09 09 20 20 20 20 20 28 62 65 67 69 6e 0a .... (begin.
6030: 09 09 09 20 20 20 20 20 20 20 28 64 65 62 75 67 ... (debug
6040: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 52 :print-info 1 "R
6050: 65 6d 6f 76 69 6e 67 20 73 79 6d 6c 69 6e 6b 20 emoving symlink
6060: 22 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 20 20 " run-dir)....
6070: 20 20 20 20 20 28 68 61 6e 64 6c 65 2d 65 78 63 (handle-exc
6080: 65 70 74 69 6f 6e 73 0a 09 09 09 09 65 78 6e 0a eptions.....exn.
6090: 09 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 ....(debug:print
60a0: 20 30 20 22 45 52 52 4f 52 3a 20 20 46 61 69 6c 0 "ERROR: Fail
60b0: 65 64 20 74 6f 20 72 65 6d 6f 76 65 20 73 79 6d ed to remove sym
60c0: 6c 69 6e 6b 20 22 20 72 75 6e 2d 64 69 72 20 28 link " run-dir (
60d0: 28 63 6f 6e 64 69 74 69 6f 6e 2d 70 72 6f 70 65 (condition-prope
60e0: 72 74 79 2d 61 63 63 65 73 73 6f 72 20 27 65 78 rty-accessor 'ex
60f0: 6e 20 27 6d 65 73 73 61 67 65 29 20 65 78 6e 29 n 'message) exn)
6100: 20 22 2c 20 61 74 74 65 6d 70 74 69 6e 67 20 74 ", attempting t
6110: 6f 20 63 6f 6e 74 69 6e 75 65 22 29 0a 09 09 09 o continue")....
6120: 09 28 64 65 6c 65 74 65 2d 66 69 6c 65 20 72 75 .(delete-file ru
6130: 6e 2d 64 69 72 29 29 29 0a 09 09 09 20 20 20 20 n-dir)))....
6140: 20 28 69 66 20 28 64 69 72 65 63 74 6f 72 79 3f (if (directory?
6150: 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 09 20 28 run-dir)..... (
6160: 69 66 20 28 3e 20 28 64 69 72 65 63 74 6f 72 79 if (> (directory
6170: 2d 66 6f 6c 64 20 28 6c 61 6d 62 64 61 20 28 66 -fold (lambda (f
6180: 20 78 29 28 2b 20 31 20 78 29 29 20 30 20 72 75 x)(+ 1 x)) 0 ru
6190: 6e 2d 64 69 72 29 20 30 29 0a 09 09 09 09 20 20 n-dir) 0).....
61a0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
61b0: 30 20 22 57 41 52 4e 49 4e 47 3a 20 72 65 66 75 0 "WARNING: refu
61c0: 73 69 6e 67 20 74 6f 20 72 65 6d 6f 76 65 20 22 sing to remove "
61d0: 20 72 75 6e 2d 64 69 72 20 22 20 61 73 20 69 74 run-dir " as it
61e0: 20 69 73 20 6e 6f 74 20 65 6d 70 74 79 22 29 0a is not empty").
61f0: 09 09 09 09 20 20 20 20 20 20 28 68 61 6e 64 6c .... (handl
6200: 65 2d 65 78 63 65 70 74 69 6f 6e 73 0a 09 09 09 e-exceptions....
6210: 09 20 20 20 20 20 20 20 65 78 6e 0a 09 09 09 09 . exn.....
6220: 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 (debug:pr
6230: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 20 46 int 0 "ERROR: F
6240: 61 69 6c 65 64 20 74 6f 20 72 65 6d 6f 76 65 20 ailed to remove
6250: 64 69 72 65 63 74 6f 72 79 20 22 20 72 75 6e 2d directory " run-
6260: 64 69 72 20 28 28 63 6f 6e 64 69 74 69 6f 6e 2d dir ((condition-
6270: 70 72 6f 70 65 72 74 79 2d 61 63 63 65 73 73 6f property-accesso
6280: 72 20 27 65 78 6e 20 27 6d 65 73 73 61 67 65 29 r 'exn 'message)
6290: 20 65 78 6e 29 20 22 2c 20 61 74 74 65 6d 70 74 exn) ", attempt
62a0: 69 6e 67 20 74 6f 20 63 6f 6e 74 69 6e 75 65 22 ing to continue"
62b0: 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 64 65 )..... (de
62c0: 6c 65 74 65 2d 64 69 72 65 63 74 6f 72 79 20 72 lete-directory r
62d0: 75 6e 2d 64 69 72 29 29 29 0a 09 09 09 09 20 28 un-dir)))..... (
62e0: 69 66 20 72 75 6e 2d 64 69 72 0a 09 09 09 09 20 if run-dir.....
62f0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
6300: 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 6e 6f 74 0 "WARNING: not
6310: 20 72 65 6d 6f 76 69 6e 67 20 22 20 72 75 6e 2d removing " run-
6320: 64 69 72 20 22 20 61 73 20 69 74 20 65 69 74 68 dir " as it eith
6330: 65 72 20 64 6f 65 73 6e 27 74 20 65 78 69 73 74 er doesn't exist
6340: 20 6f 72 20 69 73 20 6e 6f 74 20 61 20 73 79 6d or is not a sym
6350: 6c 69 6e 6b 22 29 0a 09 09 09 09 20 20 20 20 20 link").....
6360: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
6370: 4e 4f 54 45 3a 20 74 68 65 20 72 75 6e 20 64 69 NOTE: the run di
6380: 72 20 66 6f 72 20 74 68 69 73 20 74 65 73 74 20 r for this test
6390: 69 73 20 75 6e 64 65 66 69 6e 65 64 2e 20 54 65 is undefined. Te
63a0: 73 74 20 6d 61 79 20 68 61 76 65 20 61 6c 72 65 st may have alre
63b0: 61 64 79 20 62 65 65 6e 20 64 65 6c 65 74 65 64 ady been deleted
63c0: 2e 22 29 29 0a 09 09 09 09 20 29 29 29 0a 09 09 ."))..... )))...
63d0: 09 28 28 73 65 74 2d 73 74 61 74 65 2d 73 74 61 .((set-state-sta
63e0: 74 75 73 29 0a 09 09 09 20 28 64 65 62 75 67 3a tus).... (debug:
63f0: 70 72 69 6e 74 2d 69 6e 66 6f 20 32 20 22 6e 65 print-info 2 "ne
6400: 77 20 73 74 61 74 65 20 22 20 28 63 61 72 20 73 w state " (car s
6410: 74 61 74 65 2d 73 74 61 74 75 73 29 20 22 2c 20 tate-status) ",
6420: 6e 65 77 20 73 74 61 74 75 73 20 22 20 28 63 61 new status " (ca
6430: 64 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 dr state-status)
6440: 29 0a 09 09 09 20 28 6f 70 65 6e 2d 72 75 6e 2d ).... (open-run-
6450: 63 6c 6f 73 65 20 64 62 3a 74 65 73 74 2d 73 65 close db:test-se
6460: 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73 2d 62 t-state-status-b
6470: 79 2d 69 64 20 64 62 20 28 64 62 3a 74 65 73 74 y-id db (db:test
6480: 2d 67 65 74 2d 69 64 20 74 65 73 74 29 20 28 63 -get-id test) (c
6490: 61 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 ar state-status)
64a0: 28 63 61 64 72 20 73 74 61 74 65 2d 73 74 61 74 (cadr state-stat
64b0: 75 73 29 20 23 66 29 29 29 29 29 0a 09 09 20 20 us) #f)))))...
64c0: 28 73 6f 72 74 20 74 65 73 74 73 20 28 6c 61 6d (sort tests (lam
64d0: 62 64 61 20 28 61 20 62 29 28 6c 65 74 20 28 28 bda (a b)(let ((
64e0: 64 69 72 61 20 28 64 62 3a 74 65 73 74 2d 67 65 dira (db:test-ge
64f0: 74 2d 72 75 6e 64 69 72 20 61 29 29 0a 09 09 09 t-rundir a))....
6500: 09 09 09 20 28 64 69 72 62 20 28 64 62 3a 74 65 ... (dirb (db:te
6510: 73 74 2d 67 65 74 2d 72 75 6e 64 69 72 20 62 29 st-get-rundir b)
6520: 29 29 0a 09 09 09 09 09 20 20 20 20 20 28 69 66 ))...... (if
6530: 20 28 61 6e 64 20 28 73 74 72 69 6e 67 3f 20 64 (and (string? d
6540: 69 72 61 29 28 73 74 72 69 6e 67 3f 20 64 69 72 ira)(string? dir
6550: 62 29 29 0a 09 09 09 09 09 09 20 28 3e 20 28 73 b))....... (> (s
6560: 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 64 69 72 tring-length dir
6570: 61 29 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 a)(string-length
6580: 20 64 69 72 62 29 29 0a 09 09 09 09 09 09 20 23 dirb))....... #
6590: 66 29 29 29 29 29 29 29 0a 09 20 20 20 3b 3b 20 f))))))).. ;;
65a0: 72 65 6d 6f 76 65 20 74 68 65 20 72 75 6e 20 69 remove the run i
65b0: 66 20 7a 65 72 6f 20 74 65 73 74 73 20 72 65 6d f zero tests rem
65c0: 61 69 6e 0a 09 20 20 20 28 69 66 20 28 65 71 3f ain.. (if (eq?
65d0: 20 61 63 74 69 6f 6e 20 27 72 65 6d 6f 76 65 2d action 'remove-
65e0: 72 75 6e 73 29 0a 09 20 20 20 20 20 20 20 28 6c runs).. (l
65f0: 65 74 20 28 28 72 65 6d 74 65 73 74 73 20 28 6f et ((remtests (o
6600: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 pen-run-close db
6610: 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 :get-tests-for-r
6620: 75 6e 20 64 62 20 28 64 62 3a 67 65 74 2d 76 61 un db (db:get-va
6630: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 lue-by-header ru
6640: 6e 20 68 65 61 64 65 72 20 22 69 64 22 29 20 23 n header "id") #
6650: 66 20 27 28 22 44 45 4c 45 54 45 44 22 29 20 27 f '("DELETED") '
6660: 28 22 6e 2f 61 22 29 20 6e 6f 74 2d 69 6e 3a 20 ("n/a") not-in:
6670: 23 74 29 29 29 0a 09 09 20 28 69 66 20 28 6e 75 #t)))... (if (nu
6680: 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29 20 3b 3b ll? remtests) ;;
6690: 20 6e 6f 20 6d 6f 72 65 20 74 65 73 74 73 20 72 no more tests r
66a0: 65 6d 61 69 6e 69 6e 67 0a 09 09 20 20 20 20 20 emaining...
66b0: 28 6c 65 74 2a 20 28 28 64 70 61 72 74 73 20 20 (let* ((dparts
66c0: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 6c 61 (string-split la
66d0: 73 74 74 70 61 74 68 20 22 2f 22 29 29 0a 09 09 sttpath "/"))...
66e0: 09 20 20 20 20 28 72 75 6e 70 61 74 68 20 28 63 . (runpath (c
66f0: 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 6e 67 2d onc "/" (string-
6700: 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09 09 09 intersperse ....
6710: 09 09 09 28 74 61 6b 65 20 64 70 61 72 74 73 20 ...(take dparts
6720: 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 (- (length dpart
6730: 73 29 20 31 29 29 0a 09 09 09 09 09 09 22 2f 22 s) 1))......."/"
6740: 29 29 29 29 0a 09 09 20 20 20 20 20 20 20 28 64 ))))... (d
6750: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 ebug:print 1 "Re
6760: 6d 6f 76 69 6e 67 20 72 75 6e 3a 20 22 20 72 75 moving run: " ru
6770: 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74 nkey " " (db:get
6780: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 -value-by-header
6790: 20 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e run header "run
67a0: 6e 61 6d 65 22 29 20 22 20 61 6e 64 20 72 65 6c name") " and rel
67b0: 61 74 65 64 20 72 65 63 6f 72 64 22 29 0a 09 09 ated record")...
67c0: 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e (open-run
67d0: 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 -close db:delete
67e0: 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 29 0a -run db run-id).
67f0: 09 09 20 20 20 20 20 20 20 3b 3b 20 54 68 69 73 .. ;; This
6800: 20 69 73 20 61 20 70 72 65 74 74 79 20 67 6f 6f is a pretty goo
6810: 64 20 70 6c 61 63 65 20 74 6f 20 70 75 72 67 65 d place to purge
6820: 20 6f 6c 64 20 44 45 4c 45 54 45 44 20 74 65 73 old DELETED tes
6830: 74 73 0a 09 09 20 20 20 20 20 20 20 28 6f 70 65 ts... (ope
6840: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 n-run-close db:d
6850: 65 6c 65 74 65 2d 74 65 73 74 73 2d 66 6f 72 2d elete-tests-for-
6860: 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 29 0a 09 run db run-id)..
6870: 09 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 . (open-ru
6880: 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 n-close db:delet
6890: 65 2d 6f 6c 64 2d 64 65 6c 65 74 65 64 2d 74 65 e-old-deleted-te
68a0: 73 74 2d 72 65 63 6f 72 64 73 20 64 62 29 0a 09 st-records db)..
68b0: 09 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 . (open-ru
68c0: 6e 2d 63 6c 6f 73 65 20 64 62 3a 73 65 74 2d 76 n-close db:set-v
68d0: 61 72 20 64 62 20 22 44 45 4c 45 54 45 44 5f 54 ar db "DELETED_T
68e0: 45 53 54 53 22 20 28 63 75 72 72 65 6e 74 2d 73 ESTS" (current-s
68f0: 65 63 6f 6e 64 73 29 29 0a 09 09 20 20 20 20 20 econds))...
6900: 20 20 3b 3b 20 6e 65 65 64 20 74 6f 20 66 69 67 ;; need to fig
6910: 75 72 65 20 6f 75 74 20 74 68 65 20 70 61 74 68 ure out the path
6920: 20 74 6f 20 74 68 65 20 72 75 6e 20 64 69 72 20 to the run dir
6930: 61 6e 64 20 72 65 6d 6f 76 65 20 69 74 20 69 66 and remove it if
6940: 20 65 6d 70 74 79 0a 09 09 20 20 20 20 20 20 20 empty...
6950: 3b 3b 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f ;; (if (null?
6960: 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20 72 75 6e (glob (conc run
6970: 70 61 74 68 20 22 2f 2a 22 29 29 29 0a 09 09 20 path "/*")))...
6980: 20 20 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20 ;;
6990: 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20 20 20 (begin...
69a0: 3b 3b 20 09 20 28 64 65 62 75 67 3a 70 72 69 6e ;; . (debug:prin
69b0: 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 t 1 "Removing ru
69c0: 6e 20 64 69 72 20 22 20 72 75 6e 70 61 74 68 29 n dir " runpath)
69d0: 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 09 20 28 ... ;; . (
69e0: 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d system (conc "rm
69f0: 64 69 72 20 2d 70 20 22 20 72 75 6e 70 61 74 68 dir -p " runpath
6a00: 29 29 29 29 0a 09 09 20 20 20 20 20 20 20 29 29 ))))... ))
6a10: 29 29 29 0a 09 20 29 29 0a 20 20 20 20 20 72 75 ))).. )). ru
6a20: 6e 73 29 29 0a 20 20 23 74 29 0a 0a 3b 3b 3d 3d ns)). #t)..;;==
6a30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6a40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6a50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6a60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6a70: 3d 3d 3d 3d 0a 3b 3b 20 52 6f 75 74 69 6e 65 73 ====.;; Routines
6a80: 20 66 6f 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e for manipulatin
6a90: 67 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d g runs.;;=======
6aa0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6ab0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6ac0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6ad0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a ===============.
6ae0: 0a 3b 3b 20 53 69 6e 63 65 20 6d 61 6e 79 20 63 .;; Since many c
6af0: 61 6c 6c 73 20 74 6f 20 61 20 72 75 6e 20 72 65 alls to a run re
6b00: 71 75 69 72 65 20 70 72 65 74 74 79 20 6d 75 63 quire pretty muc
6b10: 68 20 74 68 65 20 73 61 6d 65 20 73 65 74 75 70 h the same setup
6b20: 20 0a 3b 3b 20 74 68 69 73 20 77 72 61 70 70 65 .;; this wrappe
6b30: 72 20 69 73 20 75 73 65 64 20 74 6f 20 72 65 64 r is used to red
6b40: 75 63 65 20 74 68 65 20 72 65 70 6c 69 63 61 74 uce the replicat
6b50: 69 6f 6e 20 6f 66 20 63 6f 64 65 0a 28 64 65 66 ion of code.(def
6b60: 69 6e 65 20 28 67 65 6e 65 72 61 6c 2d 72 75 6e ine (general-run
6b70: 2d 63 61 6c 6c 20 73 77 69 74 63 68 6e 61 6d 65 -call switchname
6b80: 20 61 63 74 69 6f 6e 2d 64 65 73 63 20 70 72 6f action-desc pro
6b90: 63 29 0a 20 20 28 6c 65 74 20 28 28 72 75 6e 6e c). (let ((runn
6ba0: 61 6d 65 20 28 61 72 67 73 3a 67 65 74 2d 61 72 ame (args:get-ar
6bb0: 67 20 22 3a 72 75 6e 6e 61 6d 65 22 29 29 0a 09 g ":runname"))..
6bc0: 28 74 61 72 67 65 74 20 20 28 69 66 20 28 61 72 (target (if (ar
6bd0: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 gs:get-arg "-tar
6be0: 67 65 74 22 29 0a 09 09 20 20 20 20 20 28 61 72 get")... (ar
6bf0: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 gs:get-arg "-tar
6c00: 67 65 74 22 29 0a 09 09 20 20 20 20 20 28 61 72 get")... (ar
6c10: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 gs:get-arg "-req
6c20: 74 61 72 67 22 29 29 29 0a 09 28 74 68 31 20 20 targ")))..(th1
6c30: 20 20 20 23 66 29 29 0a 20 20 20 20 28 63 6f 6e #f)). (con
6c40: 64 0a 20 20 20 20 20 28 28 6e 6f 74 20 74 61 72 d. ((not tar
6c50: 67 65 74 29 0a 20 20 20 20 20 20 28 64 65 62 75 get). (debu
6c60: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 g:print 0 "ERROR
6c70: 3a 20 4d 69 73 73 69 6e 67 20 72 65 71 75 69 72 : Missing requir
6c80: 65 64 20 70 61 72 61 6d 65 74 65 72 20 66 6f 72 ed parameter for
6c90: 20 22 20 73 77 69 74 63 68 6e 61 6d 65 20 22 2c " switchname ",
6ca0: 20 79 6f 75 20 6d 75 73 74 20 73 70 65 63 69 66 you must specif
6cb0: 79 20 74 68 65 20 74 61 72 67 65 74 20 77 69 74 y the target wit
6cc0: 68 20 2d 74 61 72 67 65 74 22 29 0a 20 20 20 20 h -target").
6cd0: 20 20 28 65 78 69 74 20 33 29 29 0a 20 20 20 20 (exit 3)).
6ce0: 20 28 28 6e 6f 74 20 72 75 6e 6e 61 6d 65 29 0a ((not runname).
6cf0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 (debug:pri
6d00: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 4d 69 73 nt 0 "ERROR: Mis
6d10: 73 69 6e 67 20 72 65 71 75 69 72 65 64 20 70 61 sing required pa
6d20: 72 61 6d 65 74 65 72 20 66 6f 72 20 22 20 73 77 rameter for " sw
6d30: 69 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20 itchname ", you
6d40: 6d 75 73 74 20 73 70 65 63 69 66 79 20 74 68 65 must specify the
6d50: 20 72 75 6e 20 6e 61 6d 65 20 77 69 74 68 20 3a run name with :
6d60: 72 75 6e 6e 61 6d 65 20 72 75 6e 6e 61 6d 65 22 runname runname"
6d70: 29 0a 20 20 20 20 20 20 28 65 78 69 74 20 33 29 ). (exit 3)
6d80: 29 0a 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20 ). (else.
6d90: 20 20 20 28 6c 65 74 20 28 28 64 62 20 20 20 23 (let ((db #
6da0: 66 29 0a 09 20 20 20 20 28 6b 65 79 73 20 23 66 f).. (keys #f
6db0: 29 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 73 65 ))..(if (not (se
6dc0: 74 75 70 2d 66 6f 72 2d 72 75 6e 29 29 0a 09 20 tup-for-run))..
6dd0: 20 20 20 28 62 65 67 69 6e 20 0a 09 20 20 20 20 (begin ..
6de0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
6df0: 20 22 46 61 69 6c 65 64 20 74 6f 20 73 65 74 75 "Failed to setu
6e00: 70 2c 20 65 78 69 74 69 6e 67 22 29 0a 09 20 20 p, exiting")..
6e10: 20 20 20 20 28 65 78 69 74 20 31 29 29 29 0a 09 (exit 1)))..
6e20: 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 (if (args:get-ar
6e30: 67 20 22 2d 73 65 72 76 65 72 22 29 0a 09 20 20 g "-server")..
6e40: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 (open-run-clos
6e50: 65 20 73 65 72 76 65 72 3a 73 74 61 72 74 20 64 e server:start d
6e60: 62 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 b (args:get-arg
6e70: 22 2d 73 65 72 76 65 72 22 29 29 29 0a 20 09 20 "-server"))). .
6e80: 20 20 20 3b 3b 20 28 69 66 20 28 6e 6f 74 20 28 ;; (if (not (
6e90: 6f 72 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 or (args:get-arg
6ea0: 20 22 2d 72 75 6e 61 6c 6c 22 29 20 20 20 20 20 "-runall")
6eb0: 3b 3b 20 72 75 6e 61 6c 6c 20 61 6e 64 20 72 75 ;; runall and ru
6ec0: 6e 74 65 73 74 73 20 61 72 65 20 61 6c 6c 6f 77 ntests are allow
6ed0: 65 64 20 74 6f 20 62 65 20 73 65 72 76 65 72 73 ed to be servers
6ee0: 0a 20 09 20 20 20 20 3b 3b 20 20 20 20 20 09 20 . . ;; .
6ef0: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d (args:get-arg "-
6f00: 72 75 6e 74 65 73 74 73 22 29 29 29 0a 09 20 20 runtests")))..
6f10: 20 20 3b 3b 20 20 20 20 20 28 63 6c 69 65 6e 74 ;; (client
6f20: 3a 73 65 74 75 70 29 20 3b 3b 20 54 68 69 73 20 :setup) ;; This
6f30: 69 73 20 61 20 64 75 70 6c 69 63 61 74 65 20 73 is a duplicate s
6f40: 74 61 72 74 75 70 21 21 21 3f 3f 3f 20 42 55 47 tartup!!!??? BUG
6f50: 3f 0a 09 20 20 20 20 3b 3b 20 20 20 20 20 29 29 ?.. ;; ))
6f60: 0a 09 28 73 65 74 21 20 6b 65 79 73 20 28 6f 70 ..(set! keys (op
6f70: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a en-run-close db:
6f80: 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 3b get-keys db))..;
6f90: 3b 20 68 61 76 65 20 65 6e 6f 75 67 68 20 74 6f ; have enough to
6fa0: 20 70 72 6f 63 65 73 73 20 2d 74 61 72 67 65 74 process -target
6fb0: 20 6f 72 20 2d 72 65 71 74 61 72 67 20 68 65 72 or -reqtarg her
6fc0: 65 0a 09 28 69 66 20 28 61 72 67 73 3a 67 65 74 e..(if (args:get
6fd0: 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 -arg "-reqtarg")
6fe0: 0a 09 20 20 20 20 28 6c 65 74 2a 20 28 28 72 75 .. (let* ((ru
6ff0: 6e 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 20 nconfigf (conc
7000: 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72 75 6e 63 *toppath* "/runc
7010: 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22 29 29 onfigs.config"))
7020: 20 3b 3b 20 44 4f 20 4e 4f 54 20 45 56 41 4c 55 ;; DO NOT EVALU
7030: 41 54 45 20 41 4c 4c 20 0a 09 09 20 20 20 28 72 ATE ALL ... (r
7040: 75 6e 63 6f 6e 66 69 67 20 20 28 72 65 61 64 2d unconfig (read-
7050: 63 6f 6e 66 69 67 20 72 75 6e 63 6f 6e 66 69 67 config runconfig
7060: 66 20 23 66 20 23 74 20 65 6e 76 69 72 6f 6e 2d f #f #t environ-
7070: 70 61 74 74 3a 20 23 66 29 29 29 20 0a 09 20 20 patt: #f))) ..
7080: 20 20 20 20 28 69 66 20 28 68 61 73 68 2d 74 61 (if (hash-ta
7090: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 ble-ref/default
70a0: 72 75 6e 63 6f 6e 66 69 67 20 28 61 72 67 73 3a runconfig (args:
70b0: 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 get-arg "-reqtar
70c0: 67 22 29 20 23 66 29 0a 09 09 20 20 28 6b 65 79 g") #f)... (key
70d0: 73 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 72 67 s:target-set-arg
70e0: 73 20 6b 65 79 73 20 28 61 72 67 73 3a 67 65 74 s keys (args:get
70f0: 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 -arg "-reqtarg")
7100: 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 0a args:arg-hash).
7110: 09 09 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 .. (begin...
7120: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 (debug:print 0
7130: 22 45 52 52 4f 52 3a 20 5b 22 20 28 61 72 67 73 "ERROR: [" (args
7140: 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 :get-arg "-reqta
7150: 72 67 22 29 20 22 5d 20 6e 6f 74 20 66 6f 75 6e rg") "] not foun
7160: 64 20 69 6e 20 22 20 72 75 6e 63 6f 6e 66 69 67 d in " runconfig
7170: 66 29 0a 09 09 20 20 20 20 28 69 66 20 64 62 20 f)... (if db
7180: 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a (sqlite3:finaliz
7190: 65 21 20 64 62 29 29 0a 09 09 20 20 20 20 28 65 e! db))... (e
71a0: 78 69 74 20 31 29 29 29 29 0a 09 20 20 20 20 28 xit 1)))).. (
71b0: 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 if (args:get-arg
71c0: 20 22 2d 74 61 72 67 65 74 22 29 0a 09 09 28 6b "-target")...(k
71d0: 65 79 73 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 eys:target-set-a
71e0: 72 67 73 20 6b 65 79 73 20 28 61 72 67 73 3a 67 rgs keys (args:g
71f0: 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 et-arg "-target"
7200: 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 20 args:arg-hash)
7210: 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 29 29 args:arg-hash)))
7220: 0a 09 28 69 66 20 28 6e 6f 74 20 28 63 61 72 20 ..(if (not (car
7230: 2a 63 6f 6e 66 69 67 69 6e 66 6f 2a 29 29 0a 09 *configinfo*))..
7240: 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 (begin..
7250: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
7260: 20 22 45 52 52 4f 52 3a 20 41 74 74 65 6d 70 74 "ERROR: Attempt
7270: 65 64 20 74 6f 20 22 20 61 63 74 69 6f 6e 2d 64 ed to " action-d
7280: 65 73 63 20 22 20 62 75 74 20 72 75 6e 20 61 72 esc " but run ar
7290: 65 61 20 63 6f 6e 66 69 67 20 66 69 6c 65 20 6e ea config file n
72a0: 6f 74 20 66 6f 75 6e 64 22 29 0a 09 20 20 20 20 ot found")..
72b0: 20 20 28 65 78 69 74 20 31 29 29 0a 09 20 20 20 (exit 1))..
72c0: 20 3b 3b 20 45 78 74 72 61 63 74 20 6f 75 74 20 ;; Extract out
72d0: 73 74 75 66 66 20 6e 65 65 64 65 64 20 69 6e 20 stuff needed in
72e0: 6d 6f 73 74 20 6f 72 20 6d 61 6e 79 20 63 61 6c most or many cal
72f0: 6c 73 0a 09 20 20 20 20 3b 3b 20 68 65 72 65 20 ls.. ;; here
7300: 74 68 65 6e 20 63 61 6c 6c 20 70 72 6f 63 0a 09 then call proc..
7310: 20 20 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 6e (let* ((keyn
7320: 61 6d 65 73 20 20 20 28 6d 61 70 20 6b 65 79 3a ames (map key:
7330: 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 get-fieldname ke
7340: 79 73 29 29 0a 09 09 20 20 20 28 6b 65 79 76 61 ys))... (keyva
7350: 6c 6c 73 74 20 20 28 6b 65 79 73 2d 3e 76 61 6c llst (keys->val
7360: 6c 69 73 74 20 6b 65 79 73 20 23 74 29 29 29 0a list keys #t))).
7370: 09 20 20 20 20 20 20 28 70 72 6f 63 20 74 61 72 . (proc tar
7380: 67 65 74 20 72 75 6e 6e 61 6d 65 20 6b 65 79 73 get runname keys
7390: 20 6b 65 79 6e 61 6d 65 73 20 6b 65 79 76 61 6c keynames keyval
73a0: 6c 73 74 29 29 29 0a 09 28 69 66 20 74 68 31 20 lst)))..(if th1
73b0: 28 74 68 72 65 61 64 2d 6a 6f 69 6e 21 20 74 68 (thread-join! th
73c0: 31 29 29 0a 09 28 69 66 20 64 62 20 28 73 71 6c 1))..(if db (sql
73d0: 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 ite3:finalize! d
73e0: 62 29 29 0a 09 28 73 65 74 21 20 2a 64 69 64 73 b))..(set! *dids
73f0: 6f 6d 65 74 68 69 6e 67 2a 20 23 74 29 29 29 29 omething* #t))))
7400: 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ))..;;==========
7410: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7420: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7430: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7440: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 ============.;;
7450: 4c 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 72 75 6e 73 Lock/unlock runs
7460: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d .;;=============
7470: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7480: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7490: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
74a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 =========..(defi
74b0: 6e 65 20 28 72 75 6e 73 3a 68 61 6e 64 6c 65 2d ne (runs:handle-
74c0: 6c 6f 63 6b 69 6e 67 20 74 61 72 67 65 74 20 6b locking target k
74d0: 65 79 73 20 72 75 6e 6e 61 6d 65 20 6c 6f 63 6b eys runname lock
74e0: 20 75 6e 6c 6f 63 6b 20 75 73 65 72 29 0a 20 20 unlock user).
74f0: 28 6c 65 74 2a 20 28 28 64 62 20 20 20 20 20 20 (let* ((db
7500: 20 23 66 29 0a 09 20 28 72 75 6e 64 61 74 20 20 #f).. (rundat
7510: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 (open-run-close
7520: 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 runs:get-runs-b
7530: 79 2d 70 61 74 74 20 64 62 20 6b 65 79 73 20 72 y-patt db keys r
7540: 75 6e 6e 61 6d 65 29 29 0a 09 20 28 68 65 61 64 unname)).. (head
7550: 65 72 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 er (vector-ref
7560: 20 72 75 6e 64 61 74 20 30 29 29 0a 09 20 28 72 rundat 0)).. (r
7570: 75 6e 73 20 20 20 20 20 28 76 65 63 74 6f 72 2d uns (vector-
7580: 72 65 66 20 72 75 6e 64 61 74 20 31 29 29 29 0a ref rundat 1))).
7590: 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 28 6c (for-each (l
75a0: 61 6d 62 64 61 20 28 72 75 6e 29 0a 09 09 28 6c ambda (run)...(l
75b0: 65 74 20 28 28 72 75 6e 2d 69 64 20 28 64 62 3a et ((run-id (db:
75c0: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 get-value-by-hea
75d0: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 der run header "
75e0: 69 64 22 29 29 29 0a 09 09 20 20 28 69 66 20 28 id")))... (if (
75f0: 6f 72 20 6c 6f 63 6b 0a 09 09 09 20 20 28 61 6e or lock.... (an
7600: 64 20 75 6e 6c 6f 63 6b 0a 09 09 09 20 20 20 20 d unlock....
7610: 20 20 20 28 62 65 67 69 6e 0a 09 09 09 09 20 28 (begin..... (
7620: 70 72 69 6e 74 20 22 44 6f 20 79 6f 75 20 72 65 print "Do you re
7630: 61 6c 6c 79 20 77 69 73 68 20 74 6f 20 75 6e 6c ally wish to unl
7640: 6f 63 6b 20 72 75 6e 20 22 20 72 75 6e 2d 69 64 ock run " run-id
7650: 20 22 3f 5c 6e 20 20 20 79 2f 6e 3a 20 22 29 0a "?\n y/n: ").
7660: 09 09 09 09 20 28 65 71 75 61 6c 3f 20 22 79 22 .... (equal? "y"
7670: 20 28 72 65 61 64 2d 6c 69 6e 65 29 29 29 29 29 (read-line)))))
7680: 0a 09 09 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 ... (open-r
7690: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 6c 6f 63 6b un-close db:lock
76a0: 2f 75 6e 6c 6f 63 6b 2d 72 75 6e 20 64 62 20 72 /unlock-run db r
76b0: 75 6e 2d 69 64 20 6c 6f 63 6b 20 75 6e 6c 6f 63 un-id lock unloc
76c0: 6b 20 75 73 65 72 29 0a 09 09 20 20 20 20 20 20 k user)...
76d0: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 (debug:print-inf
76e0: 6f 20 30 20 22 53 6b 69 70 70 69 6e 67 20 6c 6f o 0 "Skipping lo
76f0: 63 6b 2f 75 6e 6c 6f 63 6b 20 6f 6e 20 22 20 72 ck/unlock on " r
7700: 75 6e 2d 69 64 29 29 29 29 0a 09 20 20 20 20 20 un-id))))..
7710: 20 72 75 6e 73 29 29 29 0a 3b 3b 3d 3d 3d 3d 3d runs))).;;=====
7720: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7730: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7740: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7750: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7760: 3d 0a 3b 3b 20 52 6f 6c 6c 75 70 20 72 75 6e 73 =.;; Rollup runs
7770: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d .;;=============
7780: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7790: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
77a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
77b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 55 70 =========..;; Up
77c0: 64 61 74 65 20 74 68 65 20 74 65 73 74 5f 6d 65 date the test_me
77d0: 74 61 20 74 61 62 6c 65 20 66 6f 72 20 74 68 69 ta table for thi
77e0: 73 20 74 65 73 74 0a 28 64 65 66 69 6e 65 20 28 s test.(define (
77f0: 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 runs:update-test
7800: 5f 6d 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61 _meta db test-na
7810: 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 0a 20 20 me test-conf).
7820: 28 6c 65 74 20 28 28 63 75 72 72 72 65 63 6f 72 (let ((currrecor
7830: 64 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 d (cdb:remote-ru
7840: 6e 20 64 62 3a 74 65 73 74 6d 65 74 61 2d 67 65 n db:testmeta-ge
7850: 74 2d 72 65 63 6f 72 64 20 64 62 20 74 65 73 74 t-record db test
7860: 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 69 66 -name))). (if
7870: 20 28 6e 6f 74 20 63 75 72 72 72 65 63 6f 72 64 (not currrecord
7880: 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 73 65 )..(begin.. (se
7890: 74 21 20 63 75 72 72 72 65 63 6f 72 64 20 28 6d t! currrecord (m
78a0: 61 6b 65 2d 76 65 63 74 6f 72 20 31 30 20 23 66 ake-vector 10 #f
78b0: 29 29 0a 09 20 20 28 63 64 62 3a 72 65 6d 6f 74 )).. (cdb:remot
78c0: 65 2d 72 75 6e 20 64 62 3a 74 65 73 74 6d 65 74 e-run db:testmet
78d0: 61 2d 61 64 64 2d 72 65 63 6f 72 64 20 64 62 20 a-add-record db
78e0: 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 test-name))).
78f0: 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 (for-each .
7900: 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 29 0a 20 (lambda (key).
7910: 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 69 64 (let* ((id
7920: 78 20 28 63 61 64 72 20 6b 65 79 29 29 0a 09 20 x (cadr key))..
7930: 20 20 20 20 20 28 66 6c 64 20 28 63 61 72 20 20 (fld (car
7940: 6b 65 79 29 29 0a 09 20 20 20 20 20 20 28 76 61 key)).. (va
7950: 6c 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 l (config-lookup
7960: 20 74 65 73 74 2d 63 6f 6e 66 20 22 74 65 73 74 test-conf "test
7970: 5f 6d 65 74 61 22 20 66 6c 64 29 29 29 0a 09 20 _meta" fld)))..
7980: 3b 3b 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 ;; (debug:print
7990: 35 20 22 69 64 78 3a 20 22 20 69 64 78 20 22 20 5 "idx: " idx "
79a0: 66 6c 64 3a 20 22 20 66 6c 64 20 22 20 76 61 6c fld: " fld " val
79b0: 3a 20 22 20 76 61 6c 29 0a 09 20 28 69 66 20 28 : " val).. (if (
79c0: 61 6e 64 20 76 61 6c 20 28 6e 6f 74 20 28 65 71 and val (not (eq
79d0: 75 61 6c 3f 20 28 76 65 63 74 6f 72 2d 72 65 66 ual? (vector-ref
79e0: 20 63 75 72 72 72 65 63 6f 72 64 20 69 64 78 29 currrecord idx)
79f0: 20 76 61 6c 29 29 29 0a 09 20 20 20 20 20 28 62 val))).. (b
7a00: 65 67 69 6e 0a 09 20 20 20 20 20 20 20 28 70 72 egin.. (pr
7a10: 69 6e 74 20 22 55 70 64 61 74 69 6e 67 20 22 20 int "Updating "
7a20: 74 65 73 74 2d 6e 61 6d 65 20 22 20 22 20 66 6c test-name " " fl
7a30: 64 20 22 20 74 6f 20 22 20 76 61 6c 29 0a 09 20 d " to " val)..
7a40: 20 20 20 20 20 20 28 63 64 62 3a 72 65 6d 6f 74 (cdb:remot
7a50: 65 2d 72 75 6e 20 64 62 3a 74 65 73 74 6d 65 74 e-run db:testmet
7a60: 61 2d 75 70 64 61 74 65 2d 66 69 65 6c 64 20 64 a-update-field d
7a70: 62 20 74 65 73 74 2d 6e 61 6d 65 20 66 6c 64 20 b test-name fld
7a80: 76 61 6c 29 29 29 29 29 0a 20 20 20 20 20 27 28 val))))). '(
7a90: 28 22 61 75 74 68 6f 72 22 20 32 29 28 22 6f 77 ("author" 2)("ow
7aa0: 6e 65 72 22 20 33 29 28 22 64 65 73 63 72 69 70 ner" 3)("descrip
7ab0: 74 69 6f 6e 22 20 34 29 28 22 72 65 76 69 65 77 tion" 4)("review
7ac0: 65 64 22 20 35 29 28 22 74 61 67 73 22 20 39 29 ed" 5)("tags" 9)
7ad0: 29 29 29 29 0a 0a 3b 3b 20 55 70 64 61 74 65 20 ))))..;; Update
7ae0: 74 65 73 74 5f 6d 65 74 61 20 66 6f 72 20 61 6c test_meta for al
7af0: 6c 20 74 65 73 74 73 0a 28 64 65 66 69 6e 65 20 l tests.(define
7b00: 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 61 6c 6c (runs:update-all
7b10: 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 29 0a 20 -test_meta db).
7b20: 20 28 6c 65 74 20 28 28 74 65 73 74 2d 6e 61 6d (let ((test-nam
7b30: 65 73 20 28 67 65 74 2d 61 6c 6c 2d 6c 65 67 61 es (get-all-lega
7b40: 6c 2d 74 65 73 74 73 29 29 29 0a 20 20 20 20 28 l-tests))). (
7b50: 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 for-each . (
7b60: 6c 61 6d 62 64 61 20 28 74 65 73 74 2d 6e 61 6d lambda (test-nam
7b70: 65 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 e). (let*
7b80: 28 28 74 65 73 74 2d 70 61 74 68 20 20 20 20 28 ((test-path (
7b90: 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 conc *toppath* "
7ba0: 2f 74 65 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 /tests/" test-na
7bb0: 6d 65 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 me)).. (tes
7bc0: 74 2d 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 t-configf (conc
7bd0: 74 65 73 74 2d 70 61 74 68 20 22 2f 74 65 73 74 test-path "/test
7be0: 63 6f 6e 66 69 67 22 29 29 0a 09 20 20 20 20 20 config"))..
7bf0: 20 28 74 65 73 74 65 78 69 73 74 73 20 20 20 28 (testexists (
7c00: 61 6e 64 20 28 66 69 6c 65 2d 65 78 69 73 74 73 and (file-exists
7c10: 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 28 ? test-configf)(
7c20: 66 69 6c 65 2d 72 65 61 64 2d 61 63 63 65 73 73 file-read-access
7c30: 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 29 ? test-configf))
7c40: 29 0a 09 20 20 20 20 20 20 3b 3b 20 72 65 61 64 ).. ;; read
7c50: 20 63 6f 6e 66 69 67 73 20 77 69 74 68 20 74 72 configs with tr
7c60: 69 63 6b 73 20 74 75 72 6e 65 64 20 6f 66 66 20 icks turned off
7c70: 28 69 2e 65 2e 20 6e 6f 20 73 79 73 74 65 6d 29 (i.e. no system)
7c80: 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d 63 6f .. (test-co
7c90: 6e 66 20 20 20 20 28 69 66 20 74 65 73 74 65 78 nf (if testex
7ca0: 69 73 74 73 20 28 72 65 61 64 2d 63 6f 6e 66 69 ists (read-confi
7cb0: 67 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 23 g test-configf #
7cc0: 66 20 23 66 29 28 6d 61 6b 65 2d 68 61 73 68 2d f #f)(make-hash-
7cd0: 74 61 62 6c 65 29 29 29 29 0a 09 20 3b 3b 20 75 table)))).. ;; u
7ce0: 73 65 20 74 68 65 20 6f 70 65 6e 2d 72 75 6e 2d se the open-run-
7cf0: 63 6c 6f 73 65 20 69 6e 73 74 65 61 64 20 6f 66 close instead of
7d00: 20 70 61 73 73 69 6e 67 20 69 6e 20 64 62 0a 09 passing in db..
7d10: 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 (runs:update-te
7d20: 73 74 5f 6d 65 74 61 20 23 66 20 74 65 73 74 2d st_meta #f test-
7d30: 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 29 name test-conf))
7d40: 29 0a 20 20 20 20 20 74 65 73 74 2d 6e 61 6d 65 ). test-name
7d50: 73 29 29 29 0a 0a 3b 3b 20 54 68 69 73 20 63 6f s)))..;; This co
7d60: 75 6c 64 20 70 72 6f 62 61 62 6c 79 20 62 65 20 uld probably be
7d70: 72 65 66 61 63 74 6f 72 65 64 20 69 6e 74 6f 20 refactored into
7d80: 6f 6e 65 20 63 6f 6d 70 6c 65 78 20 71 75 65 72 one complex quer
7d90: 79 20 2e 2e 2e 0a 28 64 65 66 69 6e 65 20 28 72 y ....(define (r
7da0: 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 20 6b uns:rollup-run k
7db0: 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 eys keyvallst ru
7dc0: 6e 6e 61 6d 65 20 75 73 65 72 29 20 3b 3b 20 77 nname user) ;; w
7dd0: 61 73 20 74 61 72 67 65 74 2c 20 6e 6f 77 20 6b as target, now k
7de0: 65 79 76 61 6c 6c 73 74 0a 20 20 28 64 65 62 75 eyvallst. (debu
7df0: 67 3a 70 72 69 6e 74 20 34 20 22 72 75 6e 73 3a g:print 4 "runs:
7e00: 72 6f 6c 6c 75 70 2d 72 75 6e 2c 20 6b 65 79 73 rollup-run, keys
7e10: 3a 20 22 20 6b 65 79 73 20 22 20 6b 65 79 76 61 : " keys " keyva
7e20: 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 llst: " keyvalls
7e30: 74 20 22 20 3a 72 75 6e 6e 61 6d 65 20 22 20 72 t " :runname " r
7e40: 75 6e 6e 61 6d 65 20 22 20 75 73 65 72 3a 20 22 unname " user: "
7e50: 20 75 73 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 user). (let* (
7e60: 28 64 62 20 20 20 20 20 20 20 20 20 20 20 20 20 (db
7e70: 20 23 66 29 20 3b 3b 20 28 6b 65 79 76 61 6c 6c #f) ;; (keyvall
7e80: 6c 73 74 20 20 20 20 20 20 28 6b 65 79 73 3a 74 lst (keys:t
7e90: 61 72 67 65 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 arget->keyval ke
7ea0: 79 73 20 74 61 72 67 65 74 29 29 0a 09 20 28 6e ys target)).. (n
7eb0: 65 77 2d 72 75 6e 2d 69 64 20 20 20 20 20 20 28 ew-run-id (
7ec0: 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64 cdb:remote-run d
7ed0: 62 3a 72 65 67 69 73 74 65 72 2d 72 75 6e 20 23 b:register-run #
7ee0: 66 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 f keys keyvallst
7ef0: 20 72 75 6e 6e 61 6d 65 20 22 6e 65 77 22 20 22 runname "new" "
7f00: 6e 2f 61 22 20 75 73 65 72 29 29 0a 09 20 28 70 n/a" user)).. (p
7f10: 72 65 76 2d 74 65 73 74 73 20 20 20 20 20 20 28 rev-tests (
7f20: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 74 open-run-close t
7f30: 65 73 74 3a 67 65 74 2d 6d 61 74 63 68 69 6e 67 est:get-matching
7f40: 2d 70 72 65 76 69 6f 75 73 2d 74 65 73 74 2d 72 -previous-test-r
7f50: 75 6e 2d 72 65 63 6f 72 64 73 20 64 62 20 6e 65 un-records db ne
7f60: 77 2d 72 75 6e 2d 69 64 20 22 25 22 20 22 25 22 w-run-id "%" "%"
7f70: 29 29 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73 )).. (curr-tests
7f80: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d (open-run-
7f90: 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 close db:get-tes
7fa0: 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 ts-for-run db ne
7fb0: 77 2d 72 75 6e 2d 69 64 20 22 25 2f 25 22 20 27 w-run-id "%/%" '
7fc0: 28 29 20 27 28 29 29 29 0a 09 20 28 63 75 72 72 () '())).. (curr
7fd0: 2d 74 65 73 74 73 2d 68 61 73 68 20 28 6d 61 6b -tests-hash (mak
7fe0: 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a e-hash-table))).
7ff0: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c (open-run-cl
8000: 6f 73 65 20 64 62 3a 75 70 64 61 74 65 2d 72 75 ose db:update-ru
8010: 6e 2d 65 76 65 6e 74 5f 74 69 6d 65 20 64 62 20 n-event_time db
8020: 6e 65 77 2d 72 75 6e 2d 69 64 29 0a 20 20 20 20 new-run-id).
8030: 3b 3b 20 69 6e 64 65 78 20 74 68 65 20 61 6c 72 ;; index the alr
8040: 65 61 64 79 20 73 61 76 65 64 20 74 65 73 74 73 eady saved tests
8050: 20 62 79 20 74 65 73 74 6e 61 6d 65 20 61 6e 64 by testname and
8060: 20 69 74 65 6d 64 61 74 20 69 6e 20 63 75 72 72 itemdat in curr
8070: 2d 74 65 73 74 73 2d 68 61 73 68 0a 20 20 20 20 -tests-hash.
8080: 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 28 (for-each. (
8090: 6c 61 6d 62 64 61 20 28 74 65 73 74 64 61 74 29 lambda (testdat)
80a0: 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 . (let* ((
80b0: 74 65 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 65 testname (db:te
80c0: 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 st-get-testname
80d0: 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 testdat))..
80e0: 20 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a (item-path (db:
80f0: 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 test-get-item-pa
8100: 74 68 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 th testdat))..
8110: 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 (full-name (
8120: 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f conc testname "/
8130: 22 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 09 " item-path)))..
8140: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 (hash-table-set
8150: 21 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 ! curr-tests-has
8160: 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 74 65 73 74 h full-name test
8170: 64 61 74 29 29 29 0a 20 20 20 20 20 63 75 72 72 dat))). curr
8180: 2d 74 65 73 74 73 29 0a 20 20 20 20 3b 3b 20 4e -tests). ;; N
8190: 4f 50 45 3a 20 4e 6f 6e 2d 6f 70 74 69 6d 61 6c OPE: Non-optimal
81a0: 20 61 70 70 72 6f 61 63 68 2e 20 54 72 79 20 74 approach. Try t
81b0: 68 69 73 20 69 6e 73 74 65 61 64 2e 0a 20 20 20 his instead..
81c0: 20 3b 3b 20 20 20 31 2e 20 74 65 73 74 73 20 61 ;; 1. tests a
81d0: 72 65 20 72 65 63 65 69 76 65 64 20 69 6e 20 61 re received in a
81e0: 20 6c 69 73 74 2c 20 6d 6f 73 74 20 72 65 63 65 list, most rece
81f0: 6e 74 20 66 69 72 73 74 0a 20 20 20 20 3b 3b 20 nt first. ;;
8200: 20 20 32 2e 20 72 65 70 6c 61 63 65 20 74 68 65 2. replace the
8210: 20 72 6f 6c 6c 75 70 20 74 65 73 74 20 77 69 74 rollup test wit
8220: 68 20 74 68 65 20 6e 65 77 20 2a 61 6c 77 61 79 h the new *alway
8230: 73 2a 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 s*. (for-each
8240: 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 . (lambda (
8250: 74 65 73 74 64 61 74 29 0a 20 20 20 20 20 20 20 testdat).
8260: 28 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 (let* ((testname
8270: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 (db:test-get-t
8280: 65 73 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29 estname testdat)
8290: 29 0a 09 20 20 20 20 20 20 28 69 74 65 6d 2d 70 ).. (item-p
82a0: 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 ath (db:test-get
82b0: 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 64 -item-path testd
82c0: 61 74 29 29 0a 09 20 20 20 20 20 20 28 66 75 6c at)).. (ful
82d0: 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 l-name (conc tes
82e0: 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 tname "/" item-p
82f0: 61 74 68 29 29 0a 09 20 20 20 20 20 20 28 70 72 ath)).. (pr
8300: 65 76 2d 74 65 73 74 2d 64 61 74 20 28 68 61 73 ev-test-dat (has
8310: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 h-table-ref/defa
8320: 75 6c 74 20 63 75 72 72 2d 74 65 73 74 73 2d 68 ult curr-tests-h
8330: 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 23 66 ash full-name #f
8340: 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d )).. (test-
8350: 73 74 65 70 73 20 20 20 20 20 20 28 6f 70 65 6e steps (open
8360: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 -run-close db:ge
8370: 74 2d 73 74 65 70 73 2d 66 6f 72 2d 74 65 73 74 t-steps-for-test
8380: 20 64 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74 db (db:test-get
8390: 2d 69 64 20 74 65 73 74 64 61 74 29 29 29 0a 09 -id testdat)))..
83a0: 20 20 20 20 20 20 28 6e 65 77 2d 74 65 73 74 2d (new-test-
83b0: 72 65 63 6f 72 64 20 23 66 29 29 0a 09 20 3b 3b record #f)).. ;;
83c0: 20 72 65 70 6c 61 63 65 20 74 68 65 73 65 20 77 replace these w
83d0: 69 74 68 20 69 6e 73 65 72 74 20 2e 2e 2e 20 73 ith insert ... s
83e0: 65 6c 65 63 74 0a 09 20 28 61 70 70 6c 79 20 73 elect.. (apply s
83f0: 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a qlite3:execute .
8400: 09 09 64 62 20 0a 09 09 28 63 6f 6e 63 20 22 49 ..db ...(conc "I
8410: 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 NSERT OR REPLACE
8420: 20 49 4e 54 4f 20 74 65 73 74 73 20 28 72 75 6e INTO tests (run
8430: 5f 69 64 2c 74 65 73 74 6e 61 6d 65 2c 73 74 61 _id,testname,sta
8440: 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f te,status,event_
8450: 74 69 6d 65 2c 68 6f 73 74 2c 63 70 75 6c 6f 61 time,host,cpuloa
8460: 64 2c 64 69 73 6b 66 72 65 65 2c 75 6e 61 6d 65 d,diskfree,uname
8470: 2c 72 75 6e 64 69 72 2c 69 74 65 6d 5f 70 61 74 ,rundir,item_pat
8480: 68 2c 72 75 6e 5f 64 75 72 61 74 69 6f 6e 2c 66 h,run_duration,f
8490: 69 6e 61 6c 5f 6c 6f 67 66 2c 63 6f 6d 6d 65 6e inal_logf,commen
84a0: 74 29 20 22 0a 09 09 20 20 20 20 20 20 22 56 41 t) "... "VA
84b0: 4c 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c LUES (?,?,?,?,?,
84c0: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c ?,?,?,?,?,?,?,?,
84d0: 3f 29 3b 22 29 0a 09 09 6e 65 77 2d 72 75 6e 2d ?);")...new-run-
84e0: 69 64 20 28 63 64 64 72 20 28 76 65 63 74 6f 72 id (cddr (vector
84f0: 2d 3e 6c 69 73 74 20 74 65 73 74 64 61 74 29 29 ->list testdat))
8500: 29 0a 09 20 28 73 65 74 21 20 6e 65 77 2d 74 65 ).. (set! new-te
8510: 73 74 64 61 74 20 28 63 61 72 20 28 6f 70 65 6e stdat (car (open
8520: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 -run-close db:ge
8530: 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 t-tests-for-run
8540: 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 28 63 db new-run-id (c
8550: 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22 onc testname "/"
8560: 20 69 74 65 6d 2d 70 61 74 68 29 20 27 28 29 20 item-path) '()
8570: 27 28 29 29 29 29 0a 09 20 28 68 61 73 68 2d 74 '()))).. (hash-t
8580: 61 62 6c 65 2d 73 65 74 21 20 63 75 72 72 2d 74 able-set! curr-t
8590: 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e ests-hash full-n
85a0: 61 6d 65 20 6e 65 77 2d 74 65 73 74 64 61 74 29 ame new-testdat)
85b0: 20 3b 3b 20 74 68 69 73 20 63 6f 75 6c 64 20 62 ;; this could b
85c0: 65 20 63 6f 6e 66 75 73 69 6e 67 2c 20 77 68 69 e confusing, whi
85d0: 63 68 20 72 65 63 6f 72 64 20 73 68 6f 75 6c 64 ch record should
85e0: 20 67 6f 20 69 6e 74 6f 20 74 68 65 20 6c 6f 6f go into the loo
85f0: 6b 75 70 20 74 61 62 6c 65 3f 0a 09 20 3b 3b 20 kup table?.. ;;
8600: 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74 68 Now duplicate th
8610: 65 20 74 65 73 74 20 73 74 65 70 73 0a 09 20 28 e test steps.. (
8620: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 43 debug:print 4 "C
8630: 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 73 20 69 opying records i
8640: 6e 20 74 65 73 74 5f 73 74 65 70 73 20 66 72 6f n test_steps fro
8650: 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62 3a m test_id=" (db:
8660: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 test-get-id test
8670: 64 61 74 29 20 22 20 74 6f 20 22 20 28 64 62 3a dat) " to " (db:
8680: 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d test-get-id new-
8690: 74 65 73 74 64 61 74 29 29 0a 09 20 28 6f 70 65 testdat)).. (ope
86a0: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 0a 09 20 20 n-run-close ..
86b0: 28 6c 61 6d 62 64 61 20 28 29 0a 09 20 20 20 20 (lambda ()..
86c0: 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 (sqlite3:execute
86d0: 20 0a 09 20 20 20 20 20 64 62 20 0a 09 20 20 20 .. db ..
86e0: 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 (conc "INSERT
86f0: 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 OR REPLACE INTO
8700: 74 65 73 74 5f 73 74 65 70 73 20 28 74 65 73 74 test_steps (test
8710: 5f 69 64 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 _id,stepname,sta
8720: 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f te,status,event_
8730: 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a time,comment) ".
8740: 09 09 20 20 20 22 53 45 4c 45 43 54 20 22 20 28 .. "SELECT " (
8750: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e db:test-get-id n
8760: 65 77 2d 74 65 73 74 64 61 74 29 20 22 2c 73 74 ew-testdat) ",st
8770: 65 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 epname,state,sta
8780: 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 tus,event_time,c
8790: 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 omment FROM test
87a0: 5f 73 74 65 70 73 20 57 48 45 52 45 20 74 65 73 _steps WHERE tes
87b0: 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 20 20 20 t_id=?;")..
87c0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 (db:test-get-id
87d0: 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 3b testdat)).. ;
87e0: 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 ; Now duplicate
87f0: 74 68 65 20 74 65 73 74 20 64 61 74 61 0a 09 20 the test data..
8800: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
8810: 34 20 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 4 "Copying recor
8820: 64 73 20 69 6e 20 74 65 73 74 5f 64 61 74 61 20 ds in test_data
8830: 66 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 from test_id=" (
8840: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 db:test-get-id t
8850: 65 73 74 64 61 74 29 20 22 20 74 6f 20 22 20 28 estdat) " to " (
8860: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e db:test-get-id n
8870: 65 77 2d 74 65 73 74 64 61 74 29 29 0a 09 20 20 ew-testdat))..
8880: 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 (sqlite3:execu
8890: 74 65 20 0a 09 20 20 20 20 20 64 62 20 0a 09 20 te .. db ..
88a0: 20 20 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 (conc "INSER
88b0: 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 T OR REPLACE INT
88c0: 4f 20 74 65 73 74 5f 64 61 74 61 20 28 74 65 73 O test_data (tes
88d0: 74 5f 69 64 2c 63 61 74 65 67 6f 72 79 2c 76 61 t_id,category,va
88e0: 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70 riable,value,exp
88f0: 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c ected,tol,units,
8900: 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 comment) "...
8910: 22 53 45 4c 45 43 54 20 22 20 28 64 62 3a 74 65 "SELECT " (db:te
8920: 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 st-get-id new-te
8930: 73 74 64 61 74 29 20 22 2c 63 61 74 65 67 6f 72 stdat) ",categor
8940: 79 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 y,variable,value
8950: 2c 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e ,expected,tol,un
8960: 69 74 73 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d its,comment FROM
8970: 20 74 65 73 74 5f 64 61 74 61 20 57 48 45 52 45 test_data WHERE
8980: 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 test_id=?;")..
8990: 20 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 (db:test-get
89a0: 2d 69 64 20 74 65 73 74 64 61 74 29 29 29 29 0a -id testdat)))).
89b0: 09 20 29 29 0a 20 20 20 20 20 70 72 65 76 2d 74 . )). prev-t
89c0: 65 73 74 73 29 29 29 0a 09 20 0a 20 20 20 20 20 ests))).. .
89d0: 0a .