Megatest

Hex Artifact Content
Login

Artifact 172ff57d41be1697ee9549a020f5a8443c93de65:


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 3b 3b 20 41  h ")")))))..;; A
0970: 77 66 75 6c 2e 20 50 6c 65 61 73 65 20 46 49 58  wful. Please FIX
0980: 4d 45 0a 28 64 65 66 69 6e 65 20 2a 65 6e 76 2d  ME.(define *env-
0990: 76 61 72 73 2d 62 79 2d 72 75 6e 2d 69 64 2a 20  vars-by-run-id* 
09a0: 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65  (make-hash-table
09b0: 29 29 0a 28 64 65 66 69 6e 65 20 2a 63 75 72 72  )).(define *curr
09c0: 65 6e 74 2d 72 75 6e 2d 6e 61 6d 65 2a 20 20 20  ent-run-name*   
09d0: 23 66 29 0a 0a 28 64 65 66 69 6e 65 20 28 64 62  #f)..(define (db
09e0: 3a 67 65 74 2d 72 75 6e 2d 6b 65 79 2d 76 61 6c  :get-run-key-val
09f0: 20 64 62 20 72 75 6e 2d 69 64 20 6b 65 79 29 0a   db run-id key).
0a00: 20 20 28 6c 65 74 20 28 28 72 65 73 20 23 66 29    (let ((res #f)
0a10: 29 0a 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66  ).    (sqlite3:f
0a20: 6f 72 2d 65 61 63 68 2d 72 6f 77 0a 20 20 20 20  or-each-row.    
0a30: 20 28 6c 61 6d 62 64 61 20 28 76 61 6c 29 0a 20   (lambda (val). 
0a40: 20 20 20 20 20 20 28 73 65 74 21 20 72 65 73 20        (set! res 
0a50: 76 61 6c 29 29 0a 20 20 20 20 20 64 62 20 0a 20  val)).     db . 
0a60: 20 20 20 20 28 63 6f 6e 63 20 22 53 45 4c 45 43      (conc "SELEC
0a70: 54 20 22 20 28 6b 65 79 3a 67 65 74 2d 66 69 65  T " (key:get-fie
0a80: 6c 64 6e 61 6d 65 20 6b 65 79 29 20 22 20 46 52  ldname key) " FR
0a90: 4f 4d 20 72 75 6e 73 20 57 48 45 52 45 20 69 64  OM runs WHERE id
0aa0: 3d 3f 3b 22 29 0a 20 20 20 20 20 72 75 6e 2d 69  =?;").     run-i
0ab0: 64 29 0a 20 20 20 20 72 65 73 29 29 0a 0a 28 64  d).    res))..(d
0ac0: 65 66 69 6e 65 20 28 64 62 3a 67 65 74 2d 72 75  efine (db:get-ru
0ad0: 6e 2d 6e 61 6d 65 2d 66 72 6f 6d 2d 69 64 20 64  n-name-from-id d
0ae0: 62 20 72 75 6e 2d 69 64 29 0a 20 20 28 6c 65 74  b run-id).  (let
0af0: 20 28 28 72 65 73 20 23 66 29 29 0a 20 20 20 20   ((res #f)).    
0b00: 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63  (sqlite3:for-eac
0b10: 68 2d 72 6f 77 0a 20 20 20 20 20 28 6c 61 6d 62  h-row.     (lamb
0b20: 64 61 20 28 72 75 6e 6e 61 6d 65 29 0a 20 20 20  da (runname).   
0b30: 20 20 20 20 28 73 65 74 21 20 72 65 73 20 72 75      (set! res ru
0b40: 6e 6e 61 6d 65 29 29 0a 20 20 20 20 20 64 62 0a  nname)).     db.
0b50: 20 20 20 20 20 22 53 45 4c 45 43 54 20 72 75 6e       "SELECT run
0b60: 6e 61 6d 65 20 46 52 4f 4d 20 72 75 6e 73 20 57  name FROM runs W
0b70: 48 45 52 45 20 69 64 3d 3f 3b 22 0a 20 20 20 20  HERE id=?;".    
0b80: 20 72 75 6e 2d 69 64 29 0a 20 20 20 20 72 65 73   run-id).    res
0b90: 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 73 65 74  ))..(define (set
0ba0: 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61  -megatest-env-va
0bb0: 72 73 20 72 75 6e 2d 69 64 29 0a 20 20 28 6c 65  rs run-id).  (le
0bc0: 74 20 28 28 6b 65 79 73 20 28 63 64 62 3a 72 65  t ((keys (cdb:re
0bd0: 6d 6f 74 65 2d 72 75 6e 20 64 62 3a 67 65 74 2d  mote-run db:get-
0be0: 6b 65 79 73 20 23 66 29 29 0a 09 28 76 61 6c 73  keys #f))..(vals
0bf0: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66   (hash-table-ref
0c00: 2f 64 65 66 61 75 6c 74 20 2a 65 6e 76 2d 76 61  /default *env-va
0c10: 72 73 2d 62 79 2d 72 75 6e 2d 69 64 2a 20 72 75  rs-by-run-id* ru
0c20: 6e 2d 69 64 20 23 66 29 29 29 0a 20 20 20 20 3b  n-id #f))).    ;
0c30: 3b 20 67 65 74 20 74 68 65 20 69 6e 66 6f 20 66  ; get the info f
0c40: 72 6f 6d 20 74 68 65 20 64 62 20 61 6e 64 20 70  rom the db and p
0c50: 75 74 20 69 74 20 69 6e 20 74 68 65 20 63 61 63  ut it in the cac
0c60: 68 65 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20  he.    (if (not 
0c70: 76 61 6c 73 29 0a 09 28 6c 65 74 20 28 28 68 74  vals)..(let ((ht
0c80: 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c   (make-hash-tabl
0c90: 65 29 29 29 0a 09 20 20 28 68 61 73 68 2d 74 61  e)))..  (hash-ta
0ca0: 62 6c 65 2d 73 65 74 21 20 2a 65 6e 76 2d 76 61  ble-set! *env-va
0cb0: 72 73 2d 62 79 2d 72 75 6e 2d 69 64 2a 20 72 75  rs-by-run-id* ru
0cc0: 6e 2d 69 64 20 68 74 29 0a 09 20 20 28 73 65 74  n-id ht)..  (set
0cd0: 21 20 76 61 6c 73 20 68 74 29 0a 09 20 20 28 66  ! vals ht)..  (f
0ce0: 6f 72 2d 65 61 63 68 0a 09 20 20 20 28 6c 61 6d  or-each..   (lam
0cf0: 62 64 61 20 28 6b 65 79 29 0a 09 20 20 20 20 20  bda (key)..     
0d00: 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21  (hash-table-set!
0d10: 20 76 61 6c 73 20 6b 65 79 20 28 63 64 62 3a 72   vals key (cdb:r
0d20: 65 6d 6f 74 65 2d 72 75 6e 20 64 62 3a 67 65 74  emote-run db:get
0d30: 2d 72 75 6e 2d 6b 65 79 2d 76 61 6c 20 23 66 20  -run-key-val #f 
0d40: 72 75 6e 2d 69 64 20 6b 65 79 29 29 29 0a 09 20  run-id key))).. 
0d50: 20 20 6b 65 79 73 29 29 29 0a 20 20 20 20 3b 3b    keys))).    ;;
0d60: 20 66 72 6f 6d 20 74 68 65 20 63 61 63 68 65 64   from the cached
0d70: 20 64 61 74 61 20 73 65 74 20 74 68 65 20 76 61   data set the va
0d80: 72 73 0a 20 20 20 20 28 68 61 73 68 2d 74 61 62  rs.    (hash-tab
0d90: 6c 65 2d 66 6f 72 2d 65 61 63 68 0a 20 20 20 20  le-for-each.    
0da0: 20 76 61 6c 73 0a 20 20 20 20 20 28 6c 61 6d 62   vals.     (lamb
0db0: 64 61 20 28 6b 65 79 20 76 61 6c 29 0a 20 20 20  da (key val).   
0dc0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
0dd0: 20 32 20 22 73 65 74 65 6e 76 20 22 20 28 6b 65   2 "setenv " (ke
0de0: 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20  y:get-fieldname 
0df0: 6b 65 79 29 20 22 20 22 20 76 61 6c 29 0a 20 20  key) " " val).  
0e00: 20 20 20 20 20 28 73 65 74 65 6e 76 20 28 6b 65       (setenv (ke
0e10: 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20  y:get-fieldname 
0e20: 6b 65 79 29 20 76 61 6c 29 29 29 0a 20 20 20 20  key) val))).    
0e30: 28 61 6c 69 73 74 2d 3e 65 6e 76 2d 76 61 72 73  (alist->env-vars
0e40: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66   (hash-table-ref
0e50: 2f 64 65 66 61 75 6c 74 20 2a 63 6f 6e 66 69 67  /default *config
0e60: 64 61 74 2a 20 22 65 6e 76 2d 6f 76 65 72 72 69  dat* "env-overri
0e70: 64 65 22 20 27 28 29 29 29 0a 20 20 20 20 3b 3b  de" '())).    ;;
0e80: 20 4c 65 74 73 20 75 73 65 20 74 68 69 73 20 61   Lets use this a
0e90: 73 20 61 6e 20 6f 70 70 6f 72 74 75 6e 69 74 79  s an opportunity
0ea0: 20 74 6f 20 70 75 74 20 4d 54 5f 52 55 4e 4e 41   to put MT_RUNNA
0eb0: 4d 45 20 69 6e 20 74 68 65 20 65 6e 76 69 72 6f  ME in the enviro
0ec0: 6e 6d 65 6e 74 0a 20 20 20 20 28 73 65 74 65 6e  nment.    (seten
0ed0: 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 28  v "MT_RUNNAME" (
0ee0: 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64  cdb:remote-run d
0ef0: 62 3a 67 65 74 2d 72 75 6e 2d 6e 61 6d 65 2d 66  b:get-run-name-f
0f00: 72 6f 6d 2d 69 64 20 23 66 20 72 75 6e 2d 69 64  rom-id #f run-id
0f10: 29 29 0a 20 20 20 20 28 73 65 74 65 6e 76 20 22  )).    (setenv "
0f20: 4d 54 5f 52 55 4e 5f 41 52 45 41 5f 48 4f 4d 45  MT_RUN_AREA_HOME
0f30: 22 20 2a 74 6f 70 70 61 74 68 2a 29 0a 20 20 20  " *toppath*).   
0f40: 20 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 73 65   ))..(define (se
0f50: 74 2d 69 74 65 6d 2d 65 6e 76 2d 76 61 72 73 20  t-item-env-vars 
0f60: 69 74 65 6d 64 61 74 29 0a 20 20 28 66 6f 72 2d  itemdat).  (for-
0f70: 65 61 63 68 20 28 6c 61 6d 62 64 61 20 28 69 74  each (lambda (it
0f80: 65 6d 29 0a 09 20 20 20 20 20 20 28 64 65 62 75  em)..      (debu
0f90: 67 3a 70 72 69 6e 74 20 32 20 22 73 65 74 65 6e  g:print 2 "seten
0fa0: 76 20 22 20 28 63 61 72 20 69 74 65 6d 29 20 22  v " (car item) "
0fb0: 20 22 20 28 63 61 64 72 20 69 74 65 6d 29 29 0a   " (cadr item)).
0fc0: 09 20 20 20 20 20 20 28 73 65 74 65 6e 76 20 28  .      (setenv (
0fd0: 63 61 72 20 69 74 65 6d 29 20 28 63 61 64 72 20  car item) (cadr 
0fe0: 69 74 65 6d 29 29 29 0a 09 20 20 20 20 69 74 65  item)))..    ite
0ff0: 6d 64 61 74 29 29 0a 0a 28 64 65 66 69 6e 65 20  mdat))..(define 
1000: 2a 6c 61 73 74 2d 6e 75 6d 2d 72 75 6e 6e 69 6e  *last-num-runnin
1010: 67 2d 74 65 73 74 73 2a 20 30 29 0a 28 64 65 66  g-tests* 0).(def
1020: 69 6e 65 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75  ine (runs:can-ru
1030: 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 74 65 73  n-more-tests tes
1040: 74 2d 72 65 63 6f 72 64 29 0a 20 20 28 6c 65 74  t-record).  (let
1050: 2a 20 28 28 74 63 6f 6e 66 69 67 20 20 20 20 20  * ((tconfig     
1060: 20 20 20 20 20 20 20 20 20 20 20 20 28 74 65 73              (tes
1070: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
1080: 2d 74 65 73 74 63 6f 6e 66 69 67 20 74 65 73 74  -testconfig test
1090: 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 6a 6f 62  -record)).. (job
10a0: 67 72 6f 75 70 20 20 20 20 20 20 20 20 20 20 20  group           
10b0: 20 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f       (config-loo
10c0: 6b 75 70 20 74 63 6f 6e 66 69 67 20 22 72 65 71  kup tconfig "req
10d0: 75 69 72 65 6d 65 6e 74 73 22 20 22 6a 6f 62 67  uirements" "jobg
10e0: 72 6f 75 70 22 29 29 0a 09 20 28 6e 75 6d 2d 72  roup")).. (num-r
10f0: 75 6e 6e 69 6e 67 20 20 20 20 20 20 20 20 20 20  unning          
1100: 20 20 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72     (cdb:remote-r
1110: 75 6e 20 64 62 3a 67 65 74 2d 63 6f 75 6e 74 2d  un db:get-count-
1120: 74 65 73 74 73 2d 72 75 6e 6e 69 6e 67 20 23 66  tests-running #f
1130: 29 29 0a 09 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e  )).. (num-runnin
1140: 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 28 63  g-in-jobgroup (c
1150: 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64 62  db:remote-run db
1160: 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 65 73 74 73  :get-count-tests
1170: 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67  -running-in-jobg
1180: 72 6f 75 70 20 23 66 20 6a 6f 62 67 72 6f 75 70  roup #f jobgroup
1190: 29 29 0a 09 20 28 6d 61 78 2d 63 6f 6e 63 75 72  )).. (max-concur
11a0: 72 65 6e 74 2d 6a 6f 62 73 20 20 20 20 20 28 6c  rent-jobs     (l
11b0: 65 74 20 28 28 6d 63 6a 20 28 63 6f 6e 66 69 67  et ((mcj (config
11c0: 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64  -lookup *configd
11d0: 61 74 2a 20 22 73 65 74 75 70 22 20 20 20 20 20  at* "setup"     
11e0: 22 6d 61 78 5f 63 6f 6e 63 75 72 72 65 6e 74 5f  "max_concurrent_
11f0: 6a 6f 62 73 22 29 29 29 0a 09 09 09 09 20 20 20  jobs"))).....   
1200: 20 28 69 66 20 28 61 6e 64 20 6d 63 6a 20 28 73   (if (and mcj (s
1210: 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 63  tring->number mc
1220: 6a 29 29 0a 09 09 09 09 09 28 73 74 72 69 6e 67  j))......(string
1230: 2d 3e 6e 75 6d 62 65 72 20 6d 63 6a 29 0a 09 09  ->number mcj)...
1240: 09 09 09 31 29 29 29 0a 09 20 28 6a 6f 62 2d 67  ...1))).. (job-g
1250: 72 6f 75 70 2d 6c 69 6d 69 74 20 20 20 20 20 20  roup-limit      
1260: 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75     (config-looku
1270: 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 6a  p *configdat* "j
1280: 6f 62 67 72 6f 75 70 73 22 20 6a 6f 62 67 72 6f  obgroups" jobgro
1290: 75 70 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e  up))).    (if (n
12a0: 6f 74 20 28 65 71 3f 20 2a 6c 61 73 74 2d 6e 75  ot (eq? *last-nu
12b0: 6d 2d 72 75 6e 6e 69 6e 67 2d 74 65 73 74 73 2a  m-running-tests*
12c0: 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 29 0a 09   num-running))..
12d0: 28 62 65 67 69 6e 0a 09 20 20 28 64 65 62 75 67  (begin..  (debug
12e0: 3a 70 72 69 6e 74 20 32 20 22 6d 61 78 2d 63 6f  :print 2 "max-co
12f0: 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 3a 20 22  ncurrent-jobs: "
1300: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d   max-concurrent-
1310: 6a 6f 62 73 20 22 2c 20 6e 75 6d 2d 72 75 6e 6e  jobs ", num-runn
1320: 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e 69  ing: " num-runni
1330: 6e 67 29 0a 09 20 20 28 73 65 74 21 20 2a 6c 61  ng)..  (set! *la
1340: 73 74 2d 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 74  st-num-running-t
1350: 65 73 74 73 2a 20 6e 75 6d 2d 72 75 6e 6e 69 6e  ests* num-runnin
1360: 67 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e 6f  g))).    (if (no
1370: 74 20 28 65 71 3f 20 30 20 2a 67 6c 6f 62 61 6c  t (eq? 0 *global
1380: 65 78 69 74 73 74 61 74 75 73 2a 29 29 0a 09 28  exitstatus*))..(
1390: 6c 69 73 74 20 23 66 20 6e 75 6d 2d 72 75 6e 6e  list #f num-runn
13a0: 69 6e 67 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d  ing num-running-
13b0: 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 6d 61 78 2d  in-jobgroup max-
13c0: 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20  concurrent-jobs 
13d0: 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 29  job-group-limit)
13e0: 0a 09 28 6c 65 74 20 28 28 63 61 6e 2d 6e 6f 74  ..(let ((can-not
13f0: 2d 72 75 6e 2d 6d 6f 72 65 20 28 63 6f 6e 64 0a  -run-more (cond.
1400: 09 09 09 09 20 3b 3b 20 69 66 20 6d 61 78 2d 63  .... ;; if max-c
1410: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 69  oncurrent-jobs i
1420: 73 20 73 65 74 20 61 6e 64 20 74 68 65 20 6e 75  s set and the nu
1430: 6d 62 65 72 20 72 75 6e 6e 69 6e 67 20 69 73 20  mber running is 
1440: 67 72 65 61 74 65 72 20 0a 09 09 09 09 20 3b 3b  greater ..... ;;
1450: 20 74 68 61 6e 20 69 74 20 74 68 61 6e 20 63 61   than it than ca
1460: 6e 6e 6f 74 20 72 75 6e 20 6d 6f 72 65 20 6a 6f  nnot run more jo
1470: 62 73 0a 09 09 09 09 20 28 28 61 6e 64 20 6d 61  bs..... ((and ma
1480: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62  x-concurrent-job
1490: 73 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e  s (>= num-runnin
14a0: 67 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74  g max-concurrent
14b0: 2d 6a 6f 62 73 29 29 0a 09 09 09 09 20 20 28 64  -jobs)).....  (d
14c0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41  ebug:print 0 "WA
14d0: 52 4e 49 4e 47 3a 20 4d 61 78 20 72 75 6e 6e 69  RNING: Max runni
14e0: 6e 67 20 6a 6f 62 73 20 65 78 63 65 65 64 65 64  ng jobs exceeded
14f0: 2c 20 63 75 72 72 65 6e 74 20 6e 75 6d 62 65 72  , current number
1500: 20 72 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d   running: " num-
1510: 72 75 6e 6e 69 6e 67 20 0a 09 09 09 09 09 20 20  running ......  
1520: 20 20 20 20 20 22 2c 20 6d 61 78 5f 63 6f 6e 63       ", max_conc
1530: 75 72 72 65 6e 74 5f 6a 6f 62 73 3a 20 22 20 6d  urrent_jobs: " m
1540: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f  ax-concurrent-jo
1550: 62 73 29 0a 09 09 09 09 20 20 23 74 29 0a 09 09  bs).....  #t)...
1560: 09 09 20 3b 3b 20 69 66 20 6a 6f 62 2d 67 72 6f  .. ;; if job-gro
1570: 75 70 2d 6c 69 6d 69 74 20 69 73 20 73 65 74 20  up-limit is set 
1580: 61 6e 64 20 6e 75 6d 62 65 72 20 6f 66 20 6a 6f  and number of jo
1590: 62 73 20 69 6e 20 74 68 65 20 67 72 6f 75 70 20  bs in the group 
15a0: 69 73 20 67 72 65 61 74 65 72 0a 09 09 09 09 20  is greater..... 
15b0: 3b 3b 20 74 68 61 6e 20 74 68 65 20 6c 69 6d 69  ;; than the limi
15c0: 74 20 74 68 65 6e 20 63 61 6e 6e 6f 74 20 72 75  t then cannot ru
15d0: 6e 20 6d 6f 72 65 20 6a 6f 62 73 20 6f 66 20 74  n more jobs of t
15e0: 68 69 73 20 6b 69 6e 64 0a 09 09 09 09 20 28 28  his kind..... ((
15f0: 61 6e 64 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69  and job-group-li
1600: 6d 69 74 0a 09 09 09 09 20 20 20 20 20 20 20 28  mit.....       (
1610: 3e 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69  >= num-running-i
1620: 6e 2d 6a 6f 62 67 72 6f 75 70 20 6a 6f 62 2d 67  n-jobgroup job-g
1630: 72 6f 75 70 2d 6c 69 6d 69 74 29 29 0a 09 09 09  roup-limit))....
1640: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  .  (debug:print 
1650: 31 20 22 57 41 52 4e 49 4e 47 3a 20 6e 75 6d 62  1 "WARNING: numb
1660: 65 72 20 6f 66 20 6a 6f 62 73 20 22 20 6e 75 6d  er of jobs " num
1670: 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67  -running-in-jobg
1680: 72 6f 75 70 20 0a 09 09 09 09 09 20 20 20 20 20  roup ......     
1690: 20 20 22 20 69 6e 20 22 20 6a 6f 62 67 72 6f 75    " in " jobgrou
16a0: 70 20 22 20 65 78 63 65 65 64 65 64 2c 20 77 69  p " exceeded, wi
16b0: 6c 6c 20 6e 6f 74 20 72 75 6e 20 22 20 28 74 65  ll not run " (te
16c0: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65  sts:testqueue-ge
16d0: 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d  t-testname test-
16e0: 72 65 63 6f 72 64 29 29 0a 09 09 09 09 20 20 23  record)).....  #
16f0: 74 29 0a 09 09 09 09 20 28 65 6c 73 65 20 23 66  t)..... (else #f
1700: 29 29 29 29 0a 09 20 20 28 6c 69 73 74 20 28 6e  ))))..  (list (n
1710: 6f 74 20 63 61 6e 2d 6e 6f 74 2d 72 75 6e 2d 6d  ot can-not-run-m
1720: 6f 72 65 29 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67  ore) num-running
1730: 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d   num-running-in-
1740: 6a 6f 62 67 72 6f 75 70 20 6d 61 78 2d 63 6f 6e  jobgroup max-con
1750: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 6a 6f 62  current-jobs job
1760: 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 29 29 29 29  -group-limit))))
1770: 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  )..;;===========
1780: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1790: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
17a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
17b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4e  ===========.;; N
17c0: 65 77 20 6d 65 74 68 6f 64 6f 6c 6f 67 79 2e 20  ew methodology. 
17d0: 54 68 65 73 65 20 72 6f 75 74 69 6e 65 73 20 77  These routines w
17e0: 69 6c 6c 20 72 65 70 6c 61 63 65 20 74 68 65 20  ill replace the 
17f0: 61 62 6f 76 65 20 69 6e 20 74 69 6d 65 2e 20 46  above in time. F
1800: 6f 72 0a 3b 3b 20 6e 6f 77 20 74 68 65 20 63 6f  or.;; now the co
1810: 64 65 20 69 73 20 64 75 70 6c 69 63 61 74 65 64  de is duplicated
1820: 2e 20 54 68 69 73 20 73 74 75 66 66 20 69 73 20  . This stuff is 
1830: 69 6e 69 74 69 61 6c 6c 79 20 75 73 65 64 20 69  initially used i
1840: 6e 20 74 68 65 20 6d 6f 6e 69 74 6f 72 0a 3b 3b  n the monitor.;;
1850: 20 62 61 73 65 64 20 63 6f 64 65 2e 0a 3b 3b 3d   based code..;;=
1860: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1870: 3d 3d 3d 3d 3d 3d 3d 3d 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 0a 0a 3b 3b 20 72 65 67 69 73 74  =====..;; regist
18b0: 65 72 20 61 20 74 65 73 74 20 72 75 6e 20 77 69  er a test run wi
18c0: 74 68 20 74 68 65 20 64 62 0a 28 64 65 66 69 6e  th the db.(defin
18d0: 65 20 28 72 75 6e 73 3a 72 65 67 69 73 74 65 72  e (runs:register
18e0: 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79  -run db keys key
18f0: 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 73  vallst runname s
1900: 74 61 74 65 20 73 74 61 74 75 73 20 75 73 65 72  tate status user
1910: 29 0a 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ).  (debug:print
1920: 20 33 20 22 72 75 6e 73 3a 72 65 67 69 73 74 65   3 "runs:registe
1930: 72 2d 72 75 6e 2c 20 6b 65 79 73 3a 20 22 20 6b  r-run, keys: " k
1940: 65 79 73 20 22 20 6b 65 79 76 61 6c 6c 73 74 3a  eys " keyvallst:
1950: 20 22 20 6b 65 79 76 61 6c 6c 73 74 20 22 20 72   " keyvallst " r
1960: 75 6e 6e 61 6d 65 3a 20 22 20 72 75 6e 6e 61 6d  unname: " runnam
1970: 65 20 22 20 73 74 61 74 65 3a 20 22 20 73 74 61  e " state: " sta
1980: 74 65 20 22 20 73 74 61 74 75 73 3a 20 22 20 73  te " status: " s
1990: 74 61 74 75 73 20 22 20 75 73 65 72 3a 20 22 20  tatus " user: " 
19a0: 75 73 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 28  user).  (let* ((
19b0: 6b 65 79 73 74 72 20 20 20 20 28 6b 65 79 73 2d  keystr    (keys-
19c0: 3e 6b 65 79 73 74 72 20 6b 65 79 73 29 29 0a 09  >keystr keys))..
19d0: 20 28 63 6f 6d 6d 61 20 20 20 20 20 28 69 66 20   (comma     (if 
19e0: 28 3e 20 28 6c 65 6e 67 74 68 20 6b 65 79 73 29  (> (length keys)
19f0: 20 30 29 20 22 2c 22 20 22 22 29 29 0a 09 20 28   0) "," "")).. (
1a00: 61 6e 64 73 74 72 20 20 20 20 28 69 66 20 28 3e  andstr    (if (>
1a10: 20 28 6c 65 6e 67 74 68 20 6b 65 79 73 29 20 30   (length keys) 0
1a20: 29 20 22 20 41 4e 44 20 22 20 22 22 29 29 0a 09  ) " AND " ""))..
1a30: 20 28 76 61 6c 73 6c 6f 74 73 20 20 28 6b 65 79   (valslots  (key
1a40: 73 2d 3e 76 61 6c 73 6c 6f 74 73 20 6b 65 79 73  s->valslots keys
1a50: 29 29 20 3b 3b 20 3f 2c 3f 2c 3f 20 2e 2e 2e 0a  )) ;; ?,?,? ....
1a60: 09 20 28 6b 65 79 76 61 6c 73 20 20 20 28 6d 61  . (keyvals   (ma
1a70: 70 20 63 61 64 72 20 6b 65 79 76 61 6c 6c 73 74  p cadr keyvallst
1a80: 29 29 0a 09 20 28 61 6c 6c 76 61 6c 73 20 20 20  )).. (allvals   
1a90: 28 61 70 70 65 6e 64 20 28 6c 69 73 74 20 72 75  (append (list ru
1aa0: 6e 6e 61 6d 65 20 73 74 61 74 65 20 73 74 61 74  nname state stat
1ab0: 75 73 20 75 73 65 72 29 20 6b 65 79 76 61 6c 73  us user) keyvals
1ac0: 29 29 0a 09 20 28 71 72 79 76 61 6c 73 20 20 20  )).. (qryvals   
1ad0: 28 61 70 70 65 6e 64 20 28 6c 69 73 74 20 72 75  (append (list ru
1ae0: 6e 6e 61 6d 65 29 20 6b 65 79 76 61 6c 73 29 29  nname) keyvals))
1af0: 0a 09 20 28 6b 65 79 3d 3f 73 74 72 20 20 28 73  .. (key=?str  (s
1b00: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73  tring-interspers
1b10: 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28  e (map (lambda (
1b20: 6b 29 28 63 6f 6e 63 20 28 6b 65 79 3a 67 65 74  k)(conc (key:get
1b30: 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 29 20 22 3d  -fieldname k) "=
1b40: 3f 22 29 29 20 6b 65 79 73 29 20 22 20 41 4e 44  ?")) keys) " AND
1b50: 20 22 29 29 29 0a 20 20 20 20 28 64 65 62 75 67   "))).    (debug
1b60: 3a 70 72 69 6e 74 20 33 20 22 6b 65 79 73 3a 20  :print 3 "keys: 
1b70: 22 20 6b 65 79 73 20 22 20 61 6c 6c 76 61 6c 73  " keys " allvals
1b80: 3a 20 22 20 61 6c 6c 76 61 6c 73 20 22 20 6b 65  : " allvals " ke
1b90: 79 76 61 6c 73 3a 20 22 20 6b 65 79 76 61 6c 73  yvals: " keyvals
1ba0: 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ).    (debug:pri
1bb0: 6e 74 20 32 20 22 4e 4f 54 45 3a 20 75 73 69 6e  nt 2 "NOTE: usin
1bc0: 67 20 74 61 72 67 65 74 20 22 20 28 73 74 72 69  g target " (stri
1bd0: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 6b  ng-intersperse k
1be0: 65 79 76 61 6c 73 20 22 2f 22 29 20 22 20 66 6f  eyvals "/") " fo
1bf0: 72 20 74 68 69 73 20 72 75 6e 22 29 0a 20 20 20  r this run").   
1c00: 20 28 69 66 20 28 61 6e 64 20 72 75 6e 6e 61 6d   (if (and runnam
1c10: 65 20 28 6e 75 6c 6c 3f 20 28 66 69 6c 74 65 72  e (null? (filter
1c20: 20 28 6c 61 6d 62 64 61 20 28 78 29 28 6e 6f 74   (lambda (x)(not
1c30: 20 78 29 29 20 6b 65 79 76 61 6c 73 29 29 29 20   x)) keyvals))) 
1c40: 3b 3b 20 74 68 65 72 65 20 6d 75 73 74 20 62 65  ;; there must be
1c50: 20 61 20 62 65 74 74 65 72 20 77 61 79 20 74 6f   a better way to
1c60: 20 22 61 70 70 6c 79 20 61 6e 64 22 0a 09 28 6c   "apply and"..(l
1c70: 65 74 20 28 28 72 65 73 20 23 66 29 29 0a 09 20  et ((res #f)).. 
1c80: 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a   (apply sqlite3:
1c90: 65 78 65 63 75 74 65 20 64 62 20 28 63 6f 6e 63  execute db (conc
1ca0: 20 22 49 4e 53 45 52 54 20 4f 52 20 49 47 4e 4f   "INSERT OR IGNO
1cb0: 52 45 20 49 4e 54 4f 20 72 75 6e 73 20 28 72 75  RE INTO runs (ru
1cc0: 6e 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74  nname,state,stat
1cd0: 75 73 2c 6f 77 6e 65 72 2c 65 76 65 6e 74 5f 74  us,owner,event_t
1ce0: 69 6d 65 22 20 63 6f 6d 6d 61 20 6b 65 79 73 74  ime" comma keyst
1cf0: 72 20 22 29 20 56 41 4c 55 45 53 20 28 3f 2c 3f  r ") VALUES (?,?
1d00: 2c 3f 2c 3f 2c 73 74 72 66 74 69 6d 65 28 27 25  ,?,?,strftime('%
1d10: 73 27 2c 27 6e 6f 77 27 29 22 20 63 6f 6d 6d 61  s','now')" comma
1d20: 20 76 61 6c 73 6c 6f 74 73 20 22 29 3b 22 29 0a   valslots ");").
1d30: 09 09 20 61 6c 6c 76 61 6c 73 29 0a 09 20 20 28  .. allvals)..  (
1d40: 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a 66 6f  apply sqlite3:fo
1d50: 72 2d 65 61 63 68 2d 72 6f 77 20 0a 09 20 20 20  r-each-row ..   
1d60: 28 6c 61 6d 62 64 61 20 28 69 64 29 0a 09 20 20  (lambda (id)..  
1d70: 20 20 20 28 73 65 74 21 20 72 65 73 20 69 64 29     (set! res id)
1d80: 29 0a 09 20 20 20 64 62 0a 09 20 20 20 28 6c 65  )..   db..   (le
1d90: 74 20 28 28 71 72 79 20 28 63 6f 6e 63 20 22 53  t ((qry (conc "S
1da0: 45 4c 45 43 54 20 69 64 20 46 52 4f 4d 20 72 75  ELECT id FROM ru
1db0: 6e 73 20 57 48 45 52 45 20 28 72 75 6e 6e 61 6d  ns WHERE (runnam
1dc0: 65 3d 3f 20 22 20 61 6e 64 73 74 72 20 6b 65 79  e=? " andstr key
1dd0: 3d 3f 73 74 72 20 22 29 3b 22 29 29 29 0a 09 20  =?str ");"))).. 
1de0: 20 20 20 20 3b 28 64 65 62 75 67 3a 70 72 69 6e      ;(debug:prin
1df0: 74 20 34 20 22 71 72 79 3a 20 22 20 71 72 79 29  t 4 "qry: " qry)
1e00: 20 0a 09 20 20 20 20 20 71 72 79 29 0a 09 20 20   ..     qry)..  
1e10: 20 71 72 79 76 61 6c 73 29 0a 09 20 20 28 73 71   qryvals)..  (sq
1e20: 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 62  lite3:execute db
1e30: 20 22 55 50 44 41 54 45 20 72 75 6e 73 20 53 45   "UPDATE runs SE
1e40: 54 20 73 74 61 74 65 3d 3f 2c 73 74 61 74 75 73  T state=?,status
1e50: 3d 3f 20 57 48 45 52 45 20 69 64 3d 3f 3b 22 20  =? WHERE id=?;" 
1e60: 73 74 61 74 65 20 73 74 61 74 75 73 20 72 65 73  state status res
1e70: 29 0a 09 20 20 72 65 73 29 20 0a 09 28 62 65 67  )..  res) ..(beg
1e80: 69 6e 0a 09 20 20 28 64 65 62 75 67 3a 70 72 69  in..  (debug:pri
1e90: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 43 61 6c  nt 0 "ERROR: Cal
1ea0: 6c 65 64 20 77 69 74 68 6f 75 74 20 61 6c 6c 20  led without all 
1eb0: 6e 65 63 65 73 73 61 72 79 20 6b 65 79 73 22 29  necessary keys")
1ec0: 0a 09 20 20 23 66 29 29 29 29 0a 0a 3b 3b 20 54  ..  #f))))..;; T
1ed0: 68 69 73 20 69 73 20 61 20 64 75 70 6c 69 63 61  his is a duplica
1ee0: 74 65 20 6f 66 20 72 75 6e 2d 74 65 73 74 73 20  te of run-tests 
1ef0: 28 77 68 69 63 68 20 68 61 73 20 62 65 65 6e 20  (which has been 
1f00: 64 65 70 72 65 63 61 74 65 64 29 2e 20 55 73 65  deprecated). Use
1f10: 20 74 68 69 73 20 6f 6e 65 20 69 6e 73 74 65 61   this one instea
1f20: 64 20 6f 66 20 72 75 6e 20 74 65 73 74 73 2e 0a  d of run tests..
1f30: 3b 3b 20 6b 65 79 76 61 6c 73 0a 28 64 65 66 69  ;; keyvals.(defi
1f40: 6e 65 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73  ne (runs:run-tes
1f50: 74 73 20 74 61 72 67 65 74 20 72 75 6e 6e 61 6d  ts target runnam
1f60: 65 20 74 65 73 74 2d 70 61 74 74 73 20 75 73 65  e test-patts use
1f70: 72 20 66 6c 61 67 73 29 0a 20 20 28 6c 65 74 2a  r flags).  (let*
1f80: 20 28 28 64 62 20 20 20 20 20 20 20 20 20 20 23   ((db          #
1f90: 66 29 0a 09 20 28 6b 65 79 73 20 20 20 20 20 20  f).. (keys      
1fa0: 20 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75    (cdb:remote-ru
1fb0: 6e 20 64 62 3a 67 65 74 2d 6b 65 79 73 20 23 66  n db:get-keys #f
1fc0: 29 29 0a 09 20 28 6b 65 79 76 61 6c 6c 73 74 20  )).. (keyvallst 
1fd0: 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 3e    (keys:target->
1fe0: 6b 65 79 76 61 6c 20 6b 65 79 73 20 74 61 72 67  keyval keys targ
1ff0: 65 74 29 29 0a 09 20 28 72 75 6e 2d 69 64 20 20  et)).. (run-id  
2000: 20 20 20 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d      (cdb:remote-
2010: 72 75 6e 20 72 75 6e 73 3a 72 65 67 69 73 74 65  run runs:registe
2020: 72 2d 72 75 6e 20 23 66 20 6b 65 79 73 20 6b 65  r-run #f keys ke
2030: 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20  yvallst runname 
2040: 22 6e 65 77 22 20 22 6e 2f 61 22 20 75 73 65 72  "new" "n/a" user
2050: 29 29 20 20 3b 3b 20 20 74 65 73 74 2d 6e 61 6d  ))  ;;  test-nam
2060: 65 29 29 29 0a 09 20 28 64 65 66 65 72 72 65 64  e))).. (deferred
2070: 20 20 20 20 27 28 29 29 20 3b 3b 20 64 65 6c 61      '()) ;; dela
2080: 79 20 72 75 6e 6e 69 6e 67 20 74 68 65 73 65 20  y running these 
2090: 73 69 6e 63 65 20 74 68 65 79 20 68 61 76 65 20  since they have 
20a0: 61 20 77 61 69 74 6f 6e 20 63 6c 61 75 73 65 0a  a waiton clause.
20b0: 09 20 3b 3b 20 6b 65 65 70 67 6f 69 6e 67 20 69  . ;; keepgoing i
20c0: 73 20 74 68 65 20 64 65 66 61 63 74 6f 20 6d 6f  s the defacto mo
20d0: 64 61 6c 69 74 79 20 6e 6f 77 2c 20 77 69 6c 6c  dality now, will
20e0: 20 61 64 64 20 68 69 74 2d 6e 2d 72 75 6e 20 61   add hit-n-run a
20f0: 20 62 69 74 20 6c 61 74 65 72 0a 09 20 3b 3b 20   bit later.. ;; 
2100: 28 6b 65 65 70 67 6f 69 6e 67 20 20 20 28 68 61  (keepgoing   (ha
2110: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66  sh-table-ref/def
2120: 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 65  ault flags "-kee
2130: 70 67 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 28  pgoing" #f)).. (
2140: 74 65 73 74 2d 6e 61 6d 65 73 20 20 27 28 29 29  test-names  '())
2150: 0a 09 20 28 72 75 6e 63 6f 6e 66 69 67 66 20 20  .. (runconfigf  
2160: 20 28 63 6f 6e 63 20 20 2a 74 6f 70 70 61 74 68   (conc  *toppath
2170: 2a 20 22 2f 72 75 6e 63 6f 6e 66 69 67 73 2e 63  * "/runconfigs.c
2180: 6f 6e 66 69 67 22 29 29 0a 09 20 28 72 65 71 75  onfig")).. (requ
2190: 69 72 65 64 2d 74 65 73 74 73 20 27 28 29 29 0a  ired-tests '()).
21a0: 09 20 28 74 65 73 74 2d 72 65 63 6f 72 64 73 20  . (test-records 
21b0: 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65  (make-hash-table
21c0: 29 29 29 0a 0a 20 20 20 20 28 73 65 74 2d 6d 65  )))..    (set-me
21d0: 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20  gatest-env-vars 
21e0: 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73 65  run-id) ;; these
21f0: 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64 20 62   may be needed b
2200: 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e 67 20  y the launching 
2210: 70 72 6f 63 65 73 73 0a 0a 20 20 20 20 28 69 66  process..    (if
2220: 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 72   (file-exists? r
2230: 75 6e 63 6f 6e 66 69 67 66 29 0a 09 28 6f 70 65  unconfigf)..(ope
2240: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 73 65 74 75  n-run-close setu
2250: 70 2d 65 6e 76 2d 64 65 66 61 75 6c 74 73 20 64  p-env-defaults d
2260: 62 20 72 75 6e 63 6f 6e 66 69 67 66 20 72 75 6e  b runconfigf run
2270: 2d 69 64 20 2a 61 6c 72 65 61 64 79 2d 73 65 65  -id *already-see
2280: 6e 2d 72 75 6e 63 6f 6e 66 69 67 2d 69 6e 66 6f  n-runconfig-info
2290: 2a 20 22 70 72 65 2d 6c 61 75 6e 63 68 2d 65 6e  * "pre-launch-en
22a0: 76 2d 76 61 72 73 22 29 0a 09 28 64 65 62 75 67  v-vars")..(debug
22b0: 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e  :print 0 "WARNIN
22c0: 47 3a 20 59 6f 75 20 64 6f 20 6e 6f 74 20 68 61  G: You do not ha
22d0: 76 65 20 61 20 72 75 6e 20 63 6f 6e 66 69 67 20  ve a run config 
22e0: 66 69 6c 65 3a 20 22 20 72 75 6e 63 6f 6e 66 69  file: " runconfi
22f0: 67 66 29 29 0a 20 20 20 20 0a 20 20 20 20 3b 3b  gf)).    .    ;;
2300: 20 6c 6f 6f 6b 20 75 70 20 61 6c 6c 20 74 65 73   look up all tes
2310: 74 73 20 6d 61 74 63 68 69 6e 67 20 74 68 65 20  ts matching the 
2320: 63 6f 6d 6d 61 20 73 65 70 61 72 61 74 65 64 20  comma separated 
2330: 6c 69 73 74 20 6f 66 20 67 6c 6f 62 73 20 69 6e  list of globs in
2340: 0a 20 20 20 20 3b 3b 20 74 65 73 74 2d 70 61 74  .    ;; test-pat
2350: 74 73 20 28 75 73 69 6e 67 20 25 20 61 73 20 77  ts (using % as w
2360: 69 6c 64 63 61 72 64 29 0a 0a 20 20 20 20 28 73  ildcard)..    (s
2370: 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 28  et! test-names (
2380: 74 65 73 74 73 3a 67 65 74 2d 76 61 6c 69 64 2d  tests:get-valid-
2390: 74 65 73 74 73 20 2a 74 6f 70 70 61 74 68 2a 20  tests *toppath* 
23a0: 74 65 73 74 2d 70 61 74 74 73 20 74 65 73 74 2d  test-patts test-
23b0: 6e 61 6d 65 73 3a 20 74 65 73 74 2d 6e 61 6d 65  names: test-name
23c0: 73 29 29 0a 20 20 20 20 28 73 65 74 21 20 74 65  s)).    (set! te
23d0: 73 74 2d 6e 61 6d 65 73 20 28 64 65 6c 65 74 65  st-names (delete
23e0: 2d 64 75 70 6c 69 63 61 74 65 73 20 74 65 73 74  -duplicates test
23f0: 2d 6e 61 6d 65 73 29 29 0a 0a 20 20 20 20 28 64  -names))..    (d
2400: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
2410: 30 20 22 74 65 73 74 20 6e 61 6d 65 73 20 22 20  0 "test names " 
2420: 74 65 73 74 2d 6e 61 6d 65 73 29 0a 0a 20 20 20  test-names)..   
2430: 20 3b 3b 20 6f 6e 20 74 68 65 20 66 69 72 73 74   ;; on the first
2440: 20 70 61 73 73 20 6f 72 20 63 61 6c 6c 20 74 6f   pass or call to
2450: 20 72 75 6e 2d 74 65 73 74 73 20 73 65 74 20 46   run-tests set F
2460: 41 49 4c 53 20 74 6f 20 4e 4f 54 5f 53 54 41 52  AILS to NOT_STAR
2470: 54 45 44 20 69 66 0a 20 20 20 20 3b 3b 20 2d 6b  TED if.    ;; -k
2480: 65 65 70 67 6f 69 6e 67 20 69 73 20 73 70 65 63  eepgoing is spec
2490: 69 66 69 65 64 0a 20 20 20 20 28 69 66 20 28 65  ified.    (if (e
24a0: 71 3f 20 2a 70 61 73 73 6e 75 6d 2a 20 30 29 0a  q? *passnum* 0).
24b0: 09 28 62 65 67 69 6e 0a 09 20 20 3b 3b 20 68 61  .(begin..  ;; ha
24c0: 76 65 20 74 6f 20 64 65 6c 65 74 65 20 74 65 73  ve to delete tes
24d0: 74 20 72 65 63 6f 72 64 73 20 77 68 65 72 65 20  t records where 
24e0: 4e 4f 54 5f 53 54 41 52 54 45 44 20 73 69 6e 63  NOT_STARTED sinc
24f0: 65 20 74 68 65 79 20 63 61 6e 20 63 61 75 73 65  e they can cause
2500: 20 2d 6b 65 65 70 67 6f 69 6e 67 20 74 6f 20 0a   -keepgoing to .
2510: 09 20 20 3b 3b 20 67 65 74 20 73 74 75 63 6b 20  .  ;; get stuck 
2520: 64 75 65 20 74 6f 20 62 65 63 6f 6d 69 6e 67 20  due to becoming 
2530: 69 6e 61 63 63 65 73 73 69 62 6c 65 20 66 72 6f  inaccessible fro
2540: 6d 20 61 20 66 61 69 6c 65 64 20 74 65 73 74 2e  m a failed test.
2550: 20 49 2e 65 2e 20 69 66 20 74 65 73 74 20 42 20   I.e. if test B 
2560: 64 65 70 65 6e 64 73 20 0a 09 20 20 3b 3b 20 6f  depends ..  ;; o
2570: 6e 20 74 65 73 74 20 41 20 62 75 74 20 74 65 73  n test A but tes
2580: 74 20 42 20 72 65 61 63 68 65 64 20 74 68 65 20  t B reached the 
2590: 70 6f 69 6e 74 20 6f 6e 20 62 65 69 6e 67 20 72  point on being r
25a0: 65 67 69 73 74 65 72 65 64 20 61 73 20 4e 4f 54  egistered as NOT
25b0: 5f 53 54 41 52 54 45 44 20 61 6e 64 20 74 65 73  _STARTED and tes
25c0: 74 0a 09 20 20 3b 3b 20 41 20 66 61 69 6c 65 64  t..  ;; A failed
25d0: 20 66 6f 72 20 73 6f 6d 65 20 72 65 61 73 6f 6e   for some reason
25e0: 20 74 68 65 6e 20 6f 6e 20 72 65 2d 72 75 6e 20   then on re-run 
25f0: 75 73 69 6e 67 20 2d 6b 65 65 70 67 6f 69 6e 67  using -keepgoing
2600: 20 74 68 65 20 72 75 6e 20 63 61 6e 20 6e 65 76   the run can nev
2610: 65 72 20 63 6f 6d 70 6c 65 74 65 2e 0a 09 20 20  er complete...  
2620: 28 63 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74  (cdb:delete-test
2630: 73 2d 69 6e 2d 73 74 61 74 65 20 2a 72 75 6e 72  s-in-state *runr
2640: 65 6d 6f 74 65 2a 20 72 75 6e 2d 69 64 20 22 4e  emote* run-id "N
2650: 4f 54 5f 53 54 41 52 54 45 44 22 29 0a 09 20 20  OT_STARTED")..  
2660: 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20  (cdb:remote-run 
2670: 64 62 3a 73 65 74 2d 74 65 73 74 73 2d 73 74 61  db:set-tests-sta
2680: 74 65 2d 73 74 61 74 75 73 20 23 66 20 72 75 6e  te-status #f run
2690: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 73 20 23  -id test-names #
26a0: 66 20 22 46 41 49 4c 22 20 22 4e 4f 54 5f 53 54  f "FAIL" "NOT_ST
26b0: 41 52 54 45 44 22 20 22 46 41 49 4c 22 29 29 29  ARTED" "FAIL")))
26c0: 0a 0a 20 20 20 20 3b 3b 20 66 72 6f 6d 20 68 65  ..    ;; from he
26d0: 72 65 20 6f 6e 20 6f 75 74 20 74 68 65 20 64 62  re on out the db
26e0: 20 77 69 6c 6c 20 62 65 20 6f 70 65 6e 65 64 20   will be opened 
26f0: 61 6e 64 20 63 6c 6f 73 65 64 20 6f 6e 20 65 76  and closed on ev
2700: 65 72 79 20 63 61 6c 6c 20 72 75 6e 73 3a 72 75  ery call runs:ru
2710: 6e 2d 74 65 73 74 73 2d 71 75 65 75 65 0a 20 20  n-tests-queue.  
2720: 20 20 3b 3b 20 28 73 71 6c 69 74 65 33 3a 66 69    ;; (sqlite3:fi
2730: 6e 61 6c 69 7a 65 21 20 64 62 29 20 0a 20 20 20  nalize! db) .   
2740: 20 3b 3b 20 6e 6f 77 20 61 64 64 20 6e 6f 6e 2d   ;; now add non-
2750: 64 69 72 65 63 74 6c 79 20 72 65 66 65 72 65 6e  directly referen
2760: 63 65 64 20 64 65 70 65 6e 64 65 6e 63 69 65 73  ced dependencies
2770: 20 28 69 2e 65 2e 20 77 61 69 74 6f 6e 29 0a 20   (i.e. waiton). 
2780: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c     (if (not (nul
2790: 6c 3f 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a  l? test-names)).
27a0: 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68 65 64  .(let loop ((hed
27b0: 20 28 63 61 72 20 74 65 73 74 2d 6e 61 6d 65 73   (car test-names
27c0: 29 29 0a 09 09 20 20 20 28 74 61 6c 20 28 63 64  ))...   (tal (cd
27d0: 72 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 20  r test-names))) 
27e0: 20 20 20 20 20 20 20 20 3b 3b 20 27 72 65 74 75          ;; 'retu
27f0: 72 6e 2d 70 72 6f 63 73 20 74 65 6c 6c 73 20 74  rn-procs tells t
2800: 68 65 20 63 6f 6e 66 69 67 20 72 65 61 64 65 72  he config reader
2810: 20 74 6f 20 70 72 65 70 20 72 75 6e 6e 69 6e 67   to prep running
2820: 20 73 79 73 74 65 6d 20 62 75 74 20 72 65 74 75   system but retu
2830: 72 6e 20 61 20 70 72 6f 63 0a 09 20 20 28 64 65  rn a proc..  (de
2840: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34  bug:print-info 4
2850: 20 22 68 65 64 3d 22 20 68 65 64 20 22 20 61 74   "hed=" hed " at
2860: 20 74 6f 70 20 6f 66 20 6c 6f 6f 70 22 29 0a 09   top of loop")..
2870: 20 20 28 6c 65 74 2a 20 28 28 63 6f 6e 66 69 67    (let* ((config
2880: 20 20 28 74 65 73 74 73 3a 67 65 74 2d 74 65 73    (tests:get-tes
2890: 74 63 6f 6e 66 69 67 20 68 65 64 20 27 72 65 74  tconfig hed 'ret
28a0: 75 72 6e 2d 70 72 6f 63 73 29 29 0a 09 09 20 28  urn-procs))... (
28b0: 77 61 69 74 6f 6e 73 20 28 69 66 20 63 6f 6e 66  waitons (if conf
28c0: 69 67 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74  ig (string-split
28d0: 20 28 6c 65 74 20 28 28 77 20 28 63 6f 6e 66 69   (let ((w (confi
28e0: 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 20  g-lookup config 
28f0: 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22  "requirements" "
2900: 77 61 69 74 6f 6e 22 29 29 29 0a 09 09 09 09 09  waiton")))......
2910: 09 20 20 20 20 20 28 69 66 20 77 20 77 20 22 22  .     (if w w ""
2920: 29 29 29 0a 09 09 09 20 20 20 20 20 20 28 62 65  )))....      (be
2930: 67 69 6e 0a 09 09 09 09 28 64 65 62 75 67 3a 70  gin.....(debug:p
2940: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 6e  rint 0 "ERROR: n
2950: 6f 6e 2d 65 78 69 73 74 65 6e 74 20 72 65 71 75  on-existent requ
2960: 69 72 65 64 20 74 65 73 74 20 5c 22 22 20 68 65  ired test \"" he
2970: 64 20 22 5c 22 22 29 0a 20 20 20 20 20 20 20 20  d "\"").        
2980: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
2990: 20 20 20 20 20 20 20 20 28 69 66 20 64 62 20 28          (if db (
29a0: 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65  sqlite3:finalize
29b0: 21 20 64 62 29 29 0a 09 09 09 09 28 65 78 69 74  ! db)).....(exit
29c0: 20 31 29 29 29 29 29 0a 09 20 20 20 20 3b 3b 20   1)))))..    ;; 
29d0: 63 68 65 63 6b 20 66 6f 72 20 68 65 64 20 69 6e  check for hed in
29e0: 20 77 61 69 74 6f 6e 73 20 3d 3e 20 74 68 69 73   waitons => this
29f0: 20 77 6f 75 6c 64 20 62 65 20 63 69 72 63 75 6c   would be circul
2a00: 61 72 2c 20 72 65 6d 6f 76 65 20 69 74 20 61 6e  ar, remove it an
2a10: 64 20 69 73 73 75 65 20 61 6e 0a 09 20 20 20 20  d issue an..    
2a20: 3b 3b 20 65 72 72 6f 72 0a 09 20 20 20 20 28 69  ;; error..    (i
2a30: 66 20 28 6d 65 6d 62 65 72 20 68 65 64 20 77 61  f (member hed wa
2a40: 69 74 6f 6e 73 29 0a 09 09 28 62 65 67 69 6e 0a  itons)...(begin.
2a50: 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ..  (debug:print
2a60: 20 30 20 22 45 52 52 4f 52 3a 20 74 65 73 74 20   0 "ERROR: test 
2a70: 22 20 68 65 64 20 22 20 68 61 73 20 6c 69 73 74  " hed " has list
2a80: 65 64 20 69 74 73 65 6c 66 20 61 73 20 61 20 77  ed itself as a w
2a90: 61 69 74 6f 6e 2c 20 70 6c 65 61 73 65 20 63 6f  aiton, please co
2aa0: 72 72 65 63 74 20 74 68 69 73 21 22 29 0a 09 09  rrect this!")...
2ab0: 20 20 28 73 65 74 21 20 77 61 69 74 6f 6e 73 20    (set! waitons 
2ac0: 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20  (filter (lambda 
2ad0: 28 78 29 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20  (x)(not (equal? 
2ae0: 78 20 68 65 64 29 29 29 20 77 61 69 74 6f 6e 73  x hed))) waitons
2af0: 29 29 29 29 0a 09 20 20 20 20 0a 09 20 20 20 20  ))))..    ..    
2b00: 3b 3b 20 28 69 74 65 6d 73 20 20 20 28 69 74 65  ;; (items   (ite
2b10: 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f  ms:get-items-fro
2b20: 6d 2d 63 6f 6e 66 69 67 20 63 6f 6e 66 69 67 29  m-config config)
2b30: 29 29 0a 09 20 20 20 20 28 69 66 20 28 6e 6f 74  ))..    (if (not
2b40: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66   (hash-table-ref
2b50: 2f 64 65 66 61 75 6c 74 20 74 65 73 74 2d 72 65  /default test-re
2b60: 63 6f 72 64 73 20 68 65 64 20 23 66 29 29 0a 09  cords hed #f))..
2b70: 09 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74  .(hash-table-set
2b80: 21 20 74 65 73 74 2d 72 65 63 6f 72 64 73 0a 09  ! test-records..
2b90: 09 09 09 20 68 65 64 20 28 76 65 63 74 6f 72 20  ... hed (vector 
2ba0: 68 65 64 20 20 20 20 20 3b 3b 20 30 0a 09 09 09  hed     ;; 0....
2bb0: 09 09 20 20 20 20 20 63 6f 6e 66 69 67 20 20 3b  ..     config  ;
2bc0: 3b 20 31 0a 09 09 09 09 09 20 20 20 20 20 77 61  ; 1......     wa
2bd0: 69 74 6f 6e 73 20 3b 3b 20 32 0a 09 09 09 09 09  itons ;; 2......
2be0: 20 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f       (config-loo
2bf0: 6b 75 70 20 63 6f 6e 66 69 67 20 22 72 65 71 75  kup config "requ
2c00: 69 72 65 6d 65 6e 74 73 22 20 22 70 72 69 6f 72  irements" "prior
2c10: 69 74 79 22 29 20 20 20 20 20 3b 3b 20 70 72 69  ity")     ;; pri
2c20: 6f 72 69 74 79 20 33 0a 09 09 09 09 09 20 20 20  ority 3......   
2c30: 20 20 28 6c 65 74 20 28 28 69 74 65 6d 73 20 20    (let ((items  
2c40: 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d      (hash-table-
2c50: 72 65 66 2f 64 65 66 61 75 6c 74 20 63 6f 6e 66  ref/default conf
2c60: 69 67 20 22 69 74 65 6d 73 22 20 23 66 29 29 20  ig "items" #f)) 
2c70: 3b 3b 20 69 74 65 6d 73 20 34 0a 09 09 09 09 09  ;; items 4......
2c80: 09 20 20 20 28 69 74 65 6d 73 74 61 62 6c 65 20  .   (itemstable 
2c90: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f  (hash-table-ref/
2ca0: 64 65 66 61 75 6c 74 20 63 6f 6e 66 69 67 20 22  default config "
2cb0: 69 74 65 6d 73 74 61 62 6c 65 22 20 23 66 29 29  itemstable" #f))
2cc0: 29 20 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b  ) ......       ;
2cd0: 3b 20 69 66 20 65 69 74 68 65 72 20 69 74 65 6d  ; if either item
2ce0: 73 20 6f 72 20 69 74 65 6d 73 20 74 61 62 6c 65  s or items table
2cf0: 20 69 73 20 61 20 70 72 6f 63 20 72 65 74 75 72   is a proc retur
2d00: 6e 20 69 74 20 73 6f 20 74 65 73 74 20 72 75 6e  n it so test run
2d10: 6e 69 6e 67 0a 09 09 09 09 09 20 20 20 20 20 20  ning......      
2d20: 20 3b 3b 20 70 72 6f 63 65 73 73 20 63 61 6e 20   ;; process can 
2d30: 6b 6e 6f 77 20 74 6f 20 63 61 6c 6c 20 69 74 65  know to call ite
2d40: 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f  ms:get-items-fro
2d50: 6d 2d 63 6f 6e 66 69 67 0a 09 09 09 09 09 20 20  m-config......  
2d60: 20 20 20 20 20 3b 3b 20 69 66 20 65 69 74 68 65       ;; if eithe
2d70: 72 20 69 73 20 61 20 6c 69 73 74 20 61 6e 64 20  r is a list and 
2d80: 6e 6f 6e 65 20 69 73 20 61 20 70 72 6f 63 20 67  none is a proc g
2d90: 6f 20 61 68 65 61 64 20 61 6e 64 20 63 61 6c 6c  o ahead and call
2da0: 20 67 65 74 2d 69 74 65 6d 73 0a 09 09 09 09 09   get-items......
2db0: 20 20 20 20 20 20 20 3b 3b 20 6f 74 68 65 72 77         ;; otherw
2dc0: 69 73 65 20 72 65 74 75 72 6e 20 23 66 20 2d 20  ise return #f - 
2dd0: 74 68 69 73 20 69 73 20 6e 6f 74 20 61 6e 20 69  this is not an i
2de0: 74 65 72 61 74 65 64 20 74 65 73 74 0a 09 09 09  terated test....
2df0: 09 09 20 20 20 20 20 20 20 28 63 6f 6e 64 0a 09  ..       (cond..
2e00: 09 09 09 09 09 28 28 70 72 6f 63 65 64 75 72 65  .....((procedure
2e10: 3f 20 69 74 65 6d 73 29 20 20 20 20 20 20 0a 09  ? items)      ..
2e20: 09 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 69  ..... (debug:pri
2e30: 6e 74 2d 69 6e 66 6f 20 34 20 22 69 74 65 6d 73  nt-info 4 "items
2e40: 20 69 73 20 61 20 70 72 6f 63 65 64 75 72 65 2c   is a procedure,
2e50: 20 77 69 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72   will calc later
2e60: 22 29 0a 09 09 09 09 09 09 20 69 74 65 6d 73 29  ")....... items)
2e70: 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 63              ;; c
2e80: 61 6c 63 20 6c 61 74 65 72 0a 09 09 09 09 09 09  alc later.......
2e90: 28 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65  ((procedure? ite
2ea0: 6d 73 74 61 62 6c 65 29 0a 09 09 09 09 09 09 20  mstable)....... 
2eb0: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
2ec0: 6f 20 34 20 22 69 74 65 6d 73 74 61 62 6c 65 20  o 4 "itemstable 
2ed0: 69 73 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20  is a procedure, 
2ee0: 77 69 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72 22  will calc later"
2ef0: 29 0a 09 09 09 09 09 09 20 69 74 65 6d 73 74 61  )....... itemsta
2f00: 62 6c 65 29 20 20 20 20 20 20 20 3b 3b 20 63 61  ble)       ;; ca
2f10: 6c 63 20 6c 61 74 65 72 0a 09 09 09 09 09 09 28  lc later.......(
2f20: 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20  (filter (lambda 
2f30: 28 78 29 0a 09 09 09 09 09 09 09 20 20 20 28 6c  (x)........   (l
2f40: 65 74 20 28 28 76 61 6c 20 28 63 61 72 20 78 29  et ((val (car x)
2f50: 29 29 0a 09 09 09 09 09 09 09 20 20 20 20 20 28  ))........     (
2f60: 69 66 20 28 70 72 6f 63 65 64 75 72 65 3f 20 76  if (procedure? v
2f70: 61 6c 29 20 76 61 6c 20 23 66 29 29 29 0a 09 09  al) val #f)))...
2f80: 09 09 09 09 09 20 28 61 70 70 65 6e 64 20 28 69  ..... (append (i
2f90: 66 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20  f (list? items) 
2fa0: 69 74 65 6d 73 20 27 28 29 29 0a 09 09 09 09 09  items '())......
2fb0: 09 09 09 20 28 69 66 20 28 6c 69 73 74 3f 20 69  ... (if (list? i
2fc0: 74 65 6d 73 74 61 62 6c 65 29 20 69 74 65 6d 73  temstable) items
2fd0: 74 61 62 6c 65 20 27 28 29 29 29 29 0a 09 09 09  table '())))....
2fe0: 09 09 09 20 27 68 61 76 65 2d 70 72 6f 63 65 64  ... 'have-proced
2ff0: 75 72 65 29 0a 09 09 09 09 09 09 28 28 6f 72 20  ure).......((or 
3000: 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 28 6c 69  (list? items)(li
3010: 73 74 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 29  st? itemstable))
3020: 20 3b 3b 20 63 61 6c 63 20 6e 6f 77 0a 09 09 09   ;; calc now....
3030: 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ... (debug:print
3040: 2d 69 6e 66 6f 20 34 20 22 69 74 65 6d 73 20 61  -info 4 "items a
3050: 6e 64 20 69 74 65 6d 73 74 61 62 6c 65 20 61 72  nd itemstable ar
3060: 65 20 6c 69 73 74 73 2c 20 63 61 6c 63 20 6e 6f  e lists, calc no
3070: 77 5c 6e 22 0a 09 09 09 09 09 09 09 20 20 20 20  w\n"........    
3080: 20 20 22 20 20 20 20 69 74 65 6d 73 3a 20 22 20    "    items: " 
3090: 69 74 65 6d 73 20 22 20 69 74 65 6d 73 74 61 62  items " itemstab
30a0: 6c 65 3a 20 22 20 69 74 65 6d 73 74 61 62 6c 65  le: " itemstable
30b0: 29 0a 09 09 09 09 09 09 20 28 69 74 65 6d 73 3a  )....... (items:
30c0: 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63  get-items-from-c
30d0: 6f 6e 66 69 67 20 63 6f 6e 66 69 67 29 29 0a 09  onfig config))..
30e0: 09 09 09 09 09 28 65 6c 73 65 20 23 66 29 29 29  .....(else #f)))
30f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
3100: 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 6e 6f             ;; no
3110: 74 20 69 74 65 72 61 74 65 64 0a 09 09 09 09 09  t iterated......
3120: 20 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b 20       #f      ;; 
3130: 69 74 65 6d 73 64 61 74 20 35 0a 09 09 09 09 09  itemsdat 5......
3140: 20 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b 20       #f      ;; 
3150: 73 70 61 72 65 20 2d 20 75 73 65 64 20 66 6f 72  spare - used for
3160: 20 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 09 09   item-path......
3170: 20 20 20 20 20 29 29 29 0a 09 20 20 20 20 28 66       )))..    (f
3180: 6f 72 2d 65 61 63 68 20 0a 09 20 20 20 20 20 28  or-each ..     (
3190: 6c 61 6d 62 64 61 20 28 77 61 69 74 6f 6e 29 0a  lambda (waiton).
31a0: 09 20 20 20 20 20 20 20 28 69 66 20 28 61 6e 64  .       (if (and
31b0: 20 77 61 69 74 6f 6e 20 28 6e 6f 74 20 28 6d 65   waiton (not (me
31c0: 6d 62 65 72 20 77 61 69 74 6f 6e 20 74 65 73 74  mber waiton test
31d0: 2d 6e 61 6d 65 73 29 29 29 0a 09 09 20 20 20 28  -names)))...   (
31e0: 62 65 67 69 6e 0a 09 09 20 20 20 20 20 28 73 65  begin...     (se
31f0: 74 21 20 72 65 71 75 69 72 65 64 2d 74 65 73 74  t! required-test
3200: 73 20 28 63 6f 6e 73 20 77 61 69 74 6f 6e 20 72  s (cons waiton r
3210: 65 71 75 69 72 65 64 2d 74 65 73 74 73 29 29 0a  equired-tests)).
3220: 09 09 20 20 20 20 20 28 73 65 74 21 20 74 65 73  ..     (set! tes
3230: 74 2d 6e 61 6d 65 73 20 28 63 6f 6e 73 20 77 61  t-names (cons wa
3240: 69 74 6f 6e 20 74 65 73 74 2d 6e 61 6d 65 73 29  iton test-names)
3250: 29 29 29 29 20 3b 3b 20 77 61 73 20 61 6e 20 61  )))) ;; was an a
3260: 70 70 65 6e 64 2c 20 6e 6f 77 20 61 20 63 6f 6e  ppend, now a con
3270: 73 0a 09 20 20 20 20 20 77 61 69 74 6f 6e 73 29  s..     waitons)
3280: 0a 09 20 20 20 20 28 6c 65 74 20 28 28 72 65 6d  ..    (let ((rem
3290: 74 65 73 74 73 20 28 64 65 6c 65 74 65 2d 64 75  tests (delete-du
32a0: 70 6c 69 63 61 74 65 73 20 28 61 70 70 65 6e 64  plicates (append
32b0: 20 77 61 69 74 6f 6e 73 20 74 61 6c 29 29 29 29   waitons tal))))
32c0: 0a 09 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74  ..      (if (not
32d0: 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73   (null? remtests
32e0: 29 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61  ))...  (loop (ca
32f0: 72 20 72 65 6d 74 65 73 74 73 29 28 63 64 72 20  r remtests)(cdr 
3300: 72 65 6d 74 65 73 74 73 29 29 29 29 29 29 29 0a  remtests))))))).
3310: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e  .    (if (not (n
3320: 75 6c 6c 3f 20 72 65 71 75 69 72 65 64 2d 74 65  ull? required-te
3330: 73 74 73 29 29 0a 09 28 64 65 62 75 67 3a 70 72  sts))..(debug:pr
3340: 69 6e 74 2d 69 6e 66 6f 20 31 20 22 41 64 64 69  int-info 1 "Addi
3350: 6e 67 20 22 20 72 65 71 75 69 72 65 64 2d 74 65  ng " required-te
3360: 73 74 73 20 22 20 74 6f 20 74 68 65 20 72 75 6e  sts " to the run
3370: 20 71 75 65 75 65 22 29 29 0a 20 20 20 20 3b 3b   queue")).    ;;
3380: 20 4e 4f 54 45 3a 20 74 68 65 73 65 20 61 72 65   NOTE: these are
3390: 20 61 6c 6c 20 70 61 72 65 6e 74 20 74 65 73 74   all parent test
33a0: 73 2c 20 69 74 65 6d 73 20 61 72 65 20 6e 6f 74  s, items are not
33b0: 20 65 78 70 61 6e 64 65 64 20 79 65 74 2e 0a 20   expanded yet.. 
33c0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d     (debug:print-
33d0: 69 6e 66 6f 20 34 20 22 74 65 73 74 2d 72 65 63  info 4 "test-rec
33e0: 6f 72 64 73 3d 22 20 28 68 61 73 68 2d 74 61 62  ords=" (hash-tab
33f0: 6c 65 2d 3e 61 6c 69 73 74 20 74 65 73 74 2d 72  le->alist test-r
3400: 65 63 6f 72 64 73 29 29 0a 20 20 20 20 28 72 75  ecords)).    (ru
3410: 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d 71 75 65  ns:run-tests-que
3420: 75 65 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d  ue run-id runnam
3430: 65 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 6b  e test-records k
3440: 65 79 76 61 6c 6c 73 74 20 66 6c 61 67 73 20 74  eyvallst flags t
3450: 65 73 74 2d 70 61 74 74 73 29 0a 20 20 20 20 28  est-patts).    (
3460: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
3470: 20 34 20 22 41 6c 6c 20 64 6f 6e 65 20 62 79 20   4 "All done by 
3480: 68 65 72 65 22 29 29 29 0a 0a 28 64 65 66 69 6e  here")))..(defin
3490: 65 20 28 72 75 6e 73 3a 63 61 6c 63 2d 66 61 69  e (runs:calc-fai
34a0: 6c 73 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d  ls prereqs-not-m
34b0: 65 74 29 0a 20 20 28 66 69 6c 74 65 72 20 28 6c  et).  (filter (l
34c0: 61 6d 62 64 61 20 28 74 65 73 74 29 0a 09 20 20  ambda (test)..  
34d0: 20 20 28 61 6e 64 20 28 76 65 63 74 6f 72 3f 20    (and (vector? 
34e0: 74 65 73 74 29 20 3b 3b 20 6e 6f 74 20 28 73 74  test) ;; not (st
34f0: 72 69 6e 67 3f 20 74 65 73 74 29 29 0a 09 09 20  ring? test))... 
3500: 28 65 71 75 61 6c 3f 20 28 64 62 3a 74 65 73 74  (equal? (db:test
3510: 2d 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 29  -get-state test)
3520: 20 22 43 4f 4d 50 4c 45 54 45 44 22 29 0a 09 09   "COMPLETED")...
3530: 20 28 6e 6f 74 20 28 6d 65 6d 62 65 72 20 28 64   (not (member (d
3540: 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75  b:test-get-statu
3550: 73 20 74 65 73 74 29 0a 09 09 09 20 20 20 20 20  s test)....     
3560: 20 27 28 22 50 41 53 53 22 20 22 57 41 52 4e 22   '("PASS" "WARN"
3570: 20 22 43 48 45 43 4b 22 20 22 57 41 49 56 45 44   "CHECK" "WAIVED
3580: 22 29 29 29 29 29 0a 09 20 20 70 72 65 72 65 71  ")))))..  prereq
3590: 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 0a 28 64 65  s-not-met))..(de
35a0: 66 69 6e 65 20 28 72 75 6e 73 3a 63 61 6c 63 2d  fine (runs:calc-
35b0: 6e 6f 74 2d 63 6f 6d 70 6c 65 74 65 64 20 70 72  not-completed pr
35c0: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 20  ereqs-not-met). 
35d0: 20 28 66 69 6c 74 65 72 0a 20 20 20 28 6c 61 6d   (filter.   (lam
35e0: 62 64 61 20 28 74 29 0a 20 20 20 20 20 28 6f 72  bda (t).     (or
35f0: 20 28 6e 6f 74 20 28 76 65 63 74 6f 72 3f 20 74   (not (vector? t
3600: 29 29 0a 09 20 28 6e 6f 74 20 28 65 71 75 61 6c  )).. (not (equal
3610: 3f 20 22 43 4f 4d 50 4c 45 54 45 44 22 20 28 64  ? "COMPLETED" (d
3620: 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 65  b:test-get-state
3630: 20 74 29 29 29 29 29 0a 20 20 20 70 72 65 72 65   t))))).   prere
3640: 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 0a 28 64  qs-not-met))..(d
3650: 65 66 69 6e 65 20 28 72 75 6e 73 3a 70 72 65 74  efine (runs:pret
3660: 74 79 2d 73 74 72 69 6e 67 20 6c 73 74 29 0a 20  ty-string lst). 
3670: 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 74   (map (lambda (t
3680: 29 0a 09 20 28 69 66 20 28 6e 6f 74 20 28 76 65  ).. (if (not (ve
3690: 63 74 6f 72 3f 20 74 29 29 0a 09 20 20 20 20 20  ctor? t))..     
36a0: 28 63 6f 6e 63 20 74 29 0a 09 20 20 20 20 20 28  (conc t)..     (
36b0: 63 6f 6e 63 20 28 64 62 3a 74 65 73 74 2d 67 65  conc (db:test-ge
36c0: 74 2d 74 65 73 74 6e 61 6d 65 20 74 29 20 22 3a  t-testname t) ":
36d0: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73  " (db:test-get-s
36e0: 74 61 74 65 20 74 29 20 22 2f 22 20 28 64 62 3a  tate t) "/" (db:
36f0: 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73 20  test-get-status 
3700: 74 29 29 29 29 0a 20 20 20 20 20 20 20 6c 73 74  t)))).       lst
3710: 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e  ))..(define (run
3720: 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 73 74  s:make-full-test
3730: 2d 6e 61 6d 65 20 74 65 73 74 6e 61 6d 65 20 69  -name testname i
3740: 74 65 6d 70 61 74 68 29 0a 20 20 28 69 66 20 28  tempath).  (if (
3750: 65 71 75 61 6c 3f 20 69 74 65 6d 70 61 74 68 20  equal? itempath 
3760: 22 22 29 20 74 65 73 74 6e 61 6d 65 20 28 63 6f  "") testname (co
3770: 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22 20  nc testname "/" 
3780: 69 74 65 6d 70 61 74 68 29 29 29 0a 0a 3b 3b 20  itempath)))..;; 
3790: 74 65 73 74 2d 72 65 63 6f 72 64 73 20 69 73 20  test-records is 
37a0: 61 20 68 61 73 68 20 74 61 62 6c 65 20 74 65 73  a hash table tes
37b0: 74 6e 61 6d 65 3a 69 74 65 6d 5f 70 61 74 68 20  tname:item_path 
37c0: 3d 3e 20 76 65 63 74 6f 72 20 3c 20 74 65 73 74  => vector < test
37d0: 6e 61 6d 65 20 74 65 73 74 63 6f 6e 66 69 67 20  name testconfig 
37e0: 77 61 69 74 6f 6e 73 20 70 72 69 6f 72 69 74 79  waitons priority
37f0: 20 69 74 65 6d 73 2d 69 6e 66 6f 20 2e 2e 2e 20   items-info ... 
3800: 3e 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a  >.(define (runs:
3810: 72 75 6e 2d 74 65 73 74 73 2d 71 75 65 75 65 20  run-tests-queue 
3820: 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74  run-id runname t
3830: 65 73 74 2d 72 65 63 6f 72 64 73 20 6b 65 79 76  est-records keyv
3840: 61 6c 6c 73 74 20 66 6c 61 67 73 20 74 65 73 74  allst flags test
3850: 2d 70 61 74 74 73 29 0a 20 20 20 20 3b 3b 20 41  -patts).    ;; A
3860: 74 20 74 68 69 73 20 70 6f 69 6e 74 20 74 68 65  t this point the
3870: 20 6c 69 73 74 20 6f 66 20 70 61 72 65 6e 74 20   list of parent 
3880: 74 65 73 74 73 20 69 73 20 65 78 70 61 6e 64 65  tests is expande
3890: 64 20 0a 20 20 20 20 3b 3b 20 4e 42 2f 2f 20 53  d .    ;; NB// S
38a0: 68 6f 75 6c 64 20 65 78 70 61 6e 64 20 69 74 65  hould expand ite
38b0: 6d 73 20 68 65 72 65 20 61 6e 64 20 74 68 65 6e  ms here and then
38c0: 20 69 6e 73 65 72 74 20 69 6e 74 6f 20 74 68 65   insert into the
38d0: 20 72 75 6e 20 71 75 65 75 65 2e 0a 20 20 28 64   run queue..  (d
38e0: 65 62 75 67 3a 70 72 69 6e 74 20 35 20 22 74 65  ebug:print 5 "te
38f0: 73 74 2d 72 65 63 6f 72 64 73 3a 20 22 20 74 65  st-records: " te
3900: 73 74 2d 72 65 63 6f 72 64 73 20 22 2c 20 6b 65  st-records ", ke
3910: 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61  yvallst: " keyva
3920: 6c 6c 73 74 20 22 20 66 6c 61 67 73 3a 20 22 20  llst " flags: " 
3930: 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61 6c 69  (hash-table->ali
3940: 73 74 20 66 6c 61 67 73 29 29 0a 20 20 28 6c 65  st flags)).  (le
3950: 74 20 28 28 73 6f 72 74 65 64 2d 74 65 73 74 2d  t ((sorted-test-
3960: 6e 61 6d 65 73 20 28 74 65 73 74 73 3a 73 6f 72  names (tests:sor
3970: 74 2d 62 79 2d 70 72 69 6f 72 69 74 79 2d 61 6e  t-by-priority-an
3980: 64 2d 77 61 69 74 6f 6e 20 74 65 73 74 2d 72 65  d-waiton test-re
3990: 63 6f 72 64 73 29 29 0a 09 28 74 65 73 74 2d 72  cords))..(test-r
39a0: 65 67 69 73 74 65 72 79 20 20 20 20 28 6d 61 6b  egistery    (mak
39b0: 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 0a 09  e-hash-table))..
39c0: 28 6e 75 6d 2d 72 65 74 72 69 65 73 20 20 20 20  (num-retries    
39d0: 20 20 20 20 30 29 0a 09 28 6d 61 78 2d 72 65 74      0)..(max-ret
39e0: 72 69 65 73 20 20 20 20 20 20 20 28 63 6f 6e 66  ries       (conf
39f0: 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69  ig-lookup *confi
3a00: 67 64 61 74 2a 20 22 73 65 74 75 70 22 20 22 6d  gdat* "setup" "m
3a10: 61 78 72 65 74 72 69 65 73 22 29 29 29 0a 20 20  axretries"))).  
3a20: 20 20 28 73 65 74 21 20 6d 61 78 2d 72 65 74 72    (set! max-retr
3a30: 69 65 73 20 28 69 66 20 28 61 6e 64 20 6d 61 78  ies (if (and max
3a40: 2d 72 65 74 72 69 65 73 20 28 73 74 72 69 6e 67  -retries (string
3a50: 2d 3e 6e 75 6d 62 65 72 20 6d 61 78 2d 72 65 74  ->number max-ret
3a60: 72 69 65 73 29 29 28 73 74 72 69 6e 67 2d 3e 6e  ries))(string->n
3a70: 75 6d 62 65 72 20 6d 61 78 2d 72 65 74 72 69 65  umber max-retrie
3a80: 73 29 20 31 30 30 29 29 0a 20 20 20 20 28 69 66  s) 100)).    (if
3a90: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 73 6f 72   (not (null? sor
3aa0: 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29  ted-test-names))
3ab0: 0a 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68 65  ..(let loop ((he
3ac0: 64 20 20 20 20 20 20 20 20 20 28 63 61 72 20 73  d         (car s
3ad0: 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73  orted-test-names
3ae0: 29 29 0a 09 09 20 20 20 28 74 61 6c 20 20 20 20  ))...   (tal    
3af0: 20 20 20 20 20 28 63 64 72 20 73 6f 72 74 65 64       (cdr sorted
3b00: 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 09  -test-names))...
3b10: 20 20 20 28 72 65 72 75 6e 73 20 20 20 20 20 20     (reruns      
3b20: 27 28 29 29 29 0a 09 20 20 28 69 66 20 28 6e 6f  '()))..  (if (no
3b30: 74 20 28 6e 75 6c 6c 3f 20 72 65 72 75 6e 73 29  t (null? reruns)
3b40: 29 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e  )(debug:print-in
3b50: 66 6f 20 34 20 22 72 65 72 75 6e 73 3d 22 20 72  fo 4 "reruns=" r
3b60: 65 72 75 6e 73 29 29 0a 09 20 20 3b 3b 20 28 70  eruns))..  ;; (p
3b70: 72 69 6e 74 20 22 54 6f 70 20 6f 66 20 6c 6f 6f  rint "Top of loo
3b80: 70 2c 20 68 65 64 3d 22 20 68 65 64 20 22 2c 20  p, hed=" hed ", 
3b90: 74 61 6c 3d 22 20 74 61 6c 20 22 20 2c 72 65 72  tal=" tal " ,rer
3ba0: 75 6e 73 3d 22 20 72 65 72 75 6e 73 29 0a 09 20  uns=" reruns).. 
3bb0: 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 72 65   (let* ((test-re
3bc0: 63 6f 72 64 20 28 68 61 73 68 2d 74 61 62 6c 65  cord (hash-table
3bd0: 2d 72 65 66 20 74 65 73 74 2d 72 65 63 6f 72 64  -ref test-record
3be0: 73 20 68 65 64 29 29 0a 09 09 20 28 74 65 73 74  s hed))... (test
3bf0: 2d 6e 61 6d 65 20 20 20 28 74 65 73 74 73 3a 74  -name   (tests:t
3c00: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73  estqueue-get-tes
3c10: 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72  tname test-recor
3c20: 64 29 29 0a 09 09 20 28 74 63 6f 6e 66 69 67 20  d))... (tconfig 
3c30: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71      (tests:testq
3c40: 75 65 75 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e  ueue-get-testcon
3c50: 66 69 67 20 74 65 73 74 2d 72 65 63 6f 72 64 29  fig test-record)
3c60: 29 0a 09 09 20 28 74 65 73 74 6d 6f 64 65 20 20  )... (testmode  
3c70: 20 20 28 6c 65 74 20 28 28 6d 20 28 63 6f 6e 66    (let ((m (conf
3c80: 69 67 2d 6c 6f 6f 6b 75 70 20 74 63 6f 6e 66 69  ig-lookup tconfi
3c90: 67 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22  g "requirements"
3ca0: 20 22 6d 6f 64 65 22 29 29 29 0a 09 09 09 09 28   "mode"))).....(
3cb0: 69 66 20 6d 20 28 73 74 72 69 6e 67 2d 3e 73 79  if m (string->sy
3cc0: 6d 62 6f 6c 20 6d 29 20 27 6e 6f 72 6d 61 6c 29  mbol m) 'normal)
3cd0: 29 29 0a 09 09 20 28 77 61 69 74 6f 6e 73 20 20  ))... (waitons  
3ce0: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75     (tests:testqu
3cf0: 65 75 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20  eue-get-waitons 
3d00: 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29     test-record))
3d10: 0a 09 09 20 28 70 72 69 6f 72 69 74 79 20 20 20  ... (priority   
3d20: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75   (tests:testqueu
3d30: 65 2d 67 65 74 2d 70 72 69 6f 72 69 74 79 20 20  e-get-priority  
3d40: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09   test-record))..
3d50: 09 20 28 69 74 65 6d 64 61 74 20 20 20 20 20 28  . (itemdat     (
3d60: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
3d70: 67 65 74 2d 69 74 65 6d 64 61 74 20 20 20 20 74  get-itemdat    t
3d80: 65 73 74 2d 72 65 63 6f 72 64 29 29 20 3b 3b 20  est-record)) ;; 
3d90: 69 74 65 6d 64 61 74 20 63 61 6e 20 62 65 20 61  itemdat can be a
3da0: 20 73 74 72 69 6e 67 2c 20 6c 69 73 74 20 6f 72   string, list or
3db0: 20 23 66 0a 09 09 20 28 69 74 65 6d 73 20 20 20   #f... (items   
3dc0: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71      (tests:testq
3dd0: 75 65 75 65 2d 67 65 74 2d 69 74 65 6d 73 20 20  ueue-get-items  
3de0: 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29      test-record)
3df0: 29 0a 09 09 20 28 69 74 65 6d 2d 70 61 74 68 20  )... (item-path 
3e00: 20 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61    (item-list->pa
3e10: 74 68 20 69 74 65 6d 64 61 74 29 29 0a 09 09 20  th itemdat))... 
3e20: 28 6e 65 77 74 61 6c 20 20 20 20 20 20 28 61 70  (newtal      (ap
3e30: 70 65 6e 64 20 74 61 6c 20 28 6c 69 73 74 20 68  pend tal (list h
3e40: 65 64 29 29 29 29 0a 09 20 20 20 20 0a 09 20 20  ed))))..    ..  
3e50: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 36    (debug:print 6
3e60: 0a 09 09 09 20 22 74 65 73 74 2d 6e 61 6d 65 3a  .... "test-name:
3e70: 20 22 20 74 65 73 74 2d 6e 61 6d 65 0a 09 09 09   " test-name....
3e80: 20 22 5c 6e 20 20 68 65 64 3a 20 20 20 20 20 20   "\n  hed:      
3e90: 20 20 20 22 20 68 65 64 0a 09 09 09 20 22 5c 6e     " hed.... "\n
3ea0: 20 20 69 74 65 6d 64 61 74 3a 20 20 20 20 20 22    itemdat:     "
3eb0: 20 69 74 65 6d 64 61 74 0a 09 09 09 20 22 5c 6e   itemdat.... "\n
3ec0: 20 20 69 74 65 6d 73 3a 20 20 20 20 20 20 20 22    items:       "
3ed0: 20 69 74 65 6d 73 0a 09 09 09 20 22 5c 6e 20 20   items.... "\n  
3ee0: 69 74 65 6d 2d 70 61 74 68 3a 20 20 20 22 20 69  item-path:   " i
3ef0: 74 65 6d 2d 70 61 74 68 0a 09 09 09 20 22 5c 6e  tem-path.... "\n
3f00: 20 20 77 61 69 74 6f 6e 73 3a 20 20 20 20 20 22    waitons:     "
3f10: 20 77 61 69 74 6f 6e 73 0a 09 09 09 20 22 5c 6e   waitons.... "\n
3f20: 20 20 6e 75 6d 2d 72 65 74 72 69 65 73 3a 20 22    num-retries: "
3f30: 20 6e 75 6d 2d 72 65 74 72 69 65 73 0a 09 09 09   num-retries....
3f40: 20 22 5c 6e 20 20 74 61 6c 3a 20 20 20 20 20 20   "\n  tal:      
3f50: 20 20 20 22 20 74 61 6c 0a 09 09 09 20 22 5c 6e     " tal.... "\n
3f60: 20 20 72 65 72 75 6e 73 3a 20 20 20 20 20 20 22    reruns:      "
3f70: 20 72 65 72 75 6e 73 29 0a 0a 09 20 20 20 20 3b   reruns)...    ;
3f80: 3b 20 63 68 65 63 6b 20 66 6f 72 20 68 65 64 20  ; check for hed 
3f90: 69 6e 20 77 61 69 74 6f 6e 73 20 3d 3e 20 74 68  in waitons => th
3fa0: 69 73 20 77 6f 75 6c 64 20 62 65 20 63 69 72 63  is would be circ
3fb0: 75 6c 61 72 2c 20 72 65 6d 6f 76 65 20 69 74 20  ular, remove it 
3fc0: 61 6e 64 20 69 73 73 75 65 20 61 6e 0a 09 20 20  and issue an..  
3fd0: 20 20 3b 3b 20 65 72 72 6f 72 0a 09 20 20 20 20    ;; error..    
3fe0: 28 69 66 20 28 6d 65 6d 62 65 72 20 74 65 73 74  (if (member test
3ff0: 2d 6e 61 6d 65 20 77 61 69 74 6f 6e 73 29 0a 09  -name waitons)..
4000: 09 28 62 65 67 69 6e 0a 09 09 20 20 28 64 65 62  .(begin...  (deb
4010: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f  ug:print 0 "ERRO
4020: 52 3a 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e  R: test " test-n
4030: 61 6d 65 20 22 20 68 61 73 20 6c 69 73 74 65 64  ame " has listed
4040: 20 69 74 73 65 6c 66 20 61 73 20 61 20 77 61 69   itself as a wai
4050: 74 6f 6e 2c 20 70 6c 65 61 73 65 20 63 6f 72 72  ton, please corr
4060: 65 63 74 20 74 68 69 73 21 22 29 0a 09 09 20 20  ect this!")...  
4070: 28 73 65 74 21 20 77 61 69 74 6f 6e 20 28 66 69  (set! waiton (fi
4080: 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29  lter (lambda (x)
4090: 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 78 20 68  (not (equal? x h
40a0: 65 64 29 29 29 20 77 61 69 74 6f 6e 73 29 29 29  ed))) waitons)))
40b0: 29 0a 0a 09 20 20 20 20 28 63 6f 6e 64 20 3b 3b  )...    (cond ;;
40c0: 20 4f 55 54 45 52 20 43 4f 4e 44 0a 09 20 20 20   OUTER COND..   
40d0: 20 20 28 28 6e 6f 74 20 69 74 65 6d 73 29 20 3b    ((not items) ;
40e0: 3b 20 77 68 65 6e 20 66 61 6c 73 65 20 74 68 65  ; when false the
40f0: 20 74 65 73 74 20 69 73 20 6f 6b 20 74 6f 20 62   test is ok to b
4100: 65 20 68 61 6e 64 65 64 20 6f 66 66 20 74 6f 20  e handed off to 
4110: 6c 61 75 6e 63 68 20 28 62 75 74 20 6e 6f 74 20  launch (but not 
4120: 62 65 66 6f 72 65 29 0a 09 20 20 20 20 20 20 28  before)..      (
4130: 6c 65 74 2a 20 28 28 72 75 6e 2d 6c 69 6d 69 74  let* ((run-limit
4140: 73 2d 69 6e 66 6f 20 20 20 20 20 20 20 20 20 28  s-info         (
4150: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72  open-run-close r
4160: 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65  uns:can-run-more
4170: 2d 74 65 73 74 73 20 74 65 73 74 2d 72 65 63 6f  -tests test-reco
4180: 72 64 29 29 20 3b 3b 20 6c 6f 6f 6b 20 61 74 20  rd)) ;; look at 
4190: 74 68 65 20 74 65 73 74 20 6a 6f 62 67 72 6f 75  the test jobgrou
41a0: 70 20 61 6e 64 20 74 6f 74 20 6a 6f 62 73 20 72  p and tot jobs r
41b0: 75 6e 6e 69 6e 67 0a 09 09 20 20 20 20 20 28 68  unning...     (h
41c0: 61 76 65 2d 72 65 73 6f 75 72 63 65 73 20 20 20  ave-resources   
41d0: 20 20 20 20 20 20 20 28 63 61 72 20 72 75 6e 2d         (car run-
41e0: 6c 69 6d 69 74 73 2d 69 6e 66 6f 29 29 0a 09 09  limits-info))...
41f0: 20 20 20 20 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e       (num-runnin
4200: 67 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c  g             (l
4210: 69 73 74 2d 72 65 66 20 72 75 6e 2d 6c 69 6d 69  ist-ref run-limi
4220: 74 73 2d 69 6e 66 6f 20 31 29 29 0a 09 09 20 20  ts-info 1))...  
4230: 20 20 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d     (num-running-
4240: 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 28 6c 69 73  in-jobgroup (lis
4250: 74 2d 72 65 66 20 72 75 6e 2d 6c 69 6d 69 74 73  t-ref run-limits
4260: 2d 69 6e 66 6f 20 32 29 29 0a 09 09 20 20 20 20  -info 2))...    
4270: 20 28 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74   (max-concurrent
4280: 2d 6a 6f 62 73 20 20 20 20 20 28 6c 69 73 74 2d  -jobs     (list-
4290: 72 65 66 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69  ref run-limits-i
42a0: 6e 66 6f 20 33 29 29 0a 09 09 20 20 20 20 20 28  nfo 3))...     (
42b0: 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 20  job-group-limit 
42c0: 20 20 20 20 20 20 20 20 28 6c 69 73 74 2d 72 65          (list-re
42d0: 66 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66  f run-limits-inf
42e0: 6f 20 34 29 29 0a 09 09 20 20 20 20 20 28 70 72  o 4))...     (pr
42f0: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 20 20  ereqs-not-met   
4300: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d        (open-run-
4310: 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 70 72 65  close db:get-pre
4320: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 23 66 20  reqs-not-met #f 
4330: 72 75 6e 2d 69 64 20 77 61 69 74 6f 6e 73 20 69  run-id waitons i
4340: 74 65 6d 2d 70 61 74 68 20 6d 6f 64 65 3a 20 74  tem-path mode: t
4350: 65 73 74 6d 6f 64 65 29 29 0a 09 09 20 20 20 20  estmode))...    
4360: 20 28 66 61 69 6c 73 20 20 20 20 20 20 20 20 20   (fails         
4370: 20 20 20 20 20 20 20 20 20 20 28 72 75 6e 73 3a            (runs:
4380: 63 61 6c 63 2d 66 61 69 6c 73 20 70 72 65 72 65  calc-fails prere
4390: 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 09 09 20  qs-not-met))... 
43a0: 20 20 20 20 28 6e 6f 6e 2d 63 6f 6d 70 6c 65 74      (non-complet
43b0: 65 64 20 20 20 20 20 20 20 20 20 20 20 28 72 75  ed           (ru
43c0: 6e 73 3a 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70  ns:calc-not-comp
43d0: 6c 65 74 65 64 20 70 72 65 72 65 71 73 2d 6e 6f  leted prereqs-no
43e0: 74 2d 6d 65 74 29 29 29 0a 09 09 28 64 65 62 75  t-met)))...(debu
43f0: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 38 20 22  g:print-info 8 "
4400: 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 3a 20  have-resources: 
4410: 22 20 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73  " have-resources
4420: 20 22 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d   " prereqs-not-m
4430: 65 74 3a 20 22 20 0a 09 09 09 20 20 20 20 20 28  et: " ....     (
4440: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72  string-intersper
4450: 73 65 20 0a 09 09 09 20 20 20 20 20 20 28 6d 61  se ....      (ma
4460: 70 20 28 6c 61 6d 62 64 61 20 28 74 29 0a 09 09  p (lambda (t)...
4470: 09 09 20 20 20 20 20 28 69 66 20 28 76 65 63 74  ..     (if (vect
4480: 6f 72 3f 20 74 29 0a 09 09 09 09 09 20 28 63 6f  or? t)...... (co
4490: 6e 63 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  nc (db:test-get-
44a0: 73 74 61 74 65 20 74 29 20 22 2f 22 20 28 64 62  state t) "/" (db
44b0: 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73  :test-get-status
44c0: 20 74 29 29 0a 09 09 09 09 09 20 28 63 6f 6e 63   t))...... (conc
44d0: 20 22 20 57 41 52 4e 49 4e 47 3a 20 74 20 69 73   " WARNING: t is
44e0: 20 6e 6f 74 20 61 20 76 65 63 74 6f 72 3d 22 20   not a vector=" 
44f0: 74 20 29 29 29 0a 09 09 09 09 20 20 20 70 72 65  t ))).....   pre
4500: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 20 22 2c  reqs-not-met) ",
4510: 20 22 29 20 22 20 66 61 69 6c 73 3a 20 22 20 66   ") " fails: " f
4520: 61 69 6c 73 29 0a 09 09 28 64 65 62 75 67 3a 70  ails)...(debug:p
4530: 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 68 65 64  rint-info 4 "hed
4540: 3d 22 20 68 65 64 20 22 5c 6e 20 20 74 65 73 74  =" hed "\n  test
4550: 2d 72 65 63 6f 72 64 3d 22 20 74 65 73 74 2d 72  -record=" test-r
4560: 65 63 6f 72 64 20 22 5c 6e 20 20 74 65 73 74 2d  ecord "\n  test-
4570: 6e 61 6d 65 3a 20 22 20 74 65 73 74 2d 6e 61 6d  name: " test-nam
4580: 65 20 22 5c 6e 20 20 69 74 65 6d 2d 70 61 74 68  e "\n  item-path
4590: 3a 20 22 20 69 74 65 6d 2d 70 61 74 68 20 22 5c  : " item-path "\
45a0: 6e 20 20 74 65 73 74 2d 70 61 74 74 73 3a 20 22  n  test-patts: "
45b0: 20 74 65 73 74 2d 70 61 74 74 73 29 0a 0a 09 09   test-patts)....
45c0: 3b 3b 20 44 6f 6e 27 74 20 6b 6e 6f 77 20 61 74  ;; Don't know at
45d0: 20 74 68 69 73 20 74 69 6d 65 20 69 66 20 74 68   this time if th
45e0: 65 20 74 65 73 74 20 68 61 76 65 20 62 65 65 6e  e test have been
45f0: 20 6c 61 75 6e 63 68 65 64 20 61 74 20 73 6f 6d   launched at som
4600: 65 20 74 69 6d 65 20 69 6e 20 74 68 65 20 70 61  e time in the pa
4610: 73 74 0a 09 09 3b 3b 20 69 2e 65 2e 20 69 73 20  st...;; i.e. is 
4620: 74 68 69 73 20 61 20 72 65 2d 6c 61 75 6e 63 68  this a re-launch
4630: 3f 0a 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74  ?...(debug:print
4640: 2d 69 6e 66 6f 20 34 20 22 72 75 6e 2d 6c 69 6d  -info 4 "run-lim
4650: 69 74 73 2d 69 6e 66 6f 20 3d 20 22 20 72 75 6e  its-info = " run
4660: 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 29 0a 09 09  -limits-info)...
4670: 28 63 6f 6e 64 20 3b 3b 20 49 4e 4e 45 52 20 43  (cond ;; INNER C
4680: 4f 4e 44 20 23 31 20 66 6f 72 20 61 20 6c 61 75  OND #1 for a lau
4690: 6e 63 68 61 62 6c 65 20 74 65 73 74 0a 09 09 20  nchable test... 
46a0: 3b 3b 20 43 68 65 63 6b 20 69 74 65 6d 20 70 61  ;; Check item pa
46b0: 74 68 20 61 67 61 69 6e 73 74 20 69 74 65 6d 2d  th against item-
46c0: 70 61 74 74 73 0a 09 09 20 28 28 6e 6f 74 20 28  patts... ((not (
46d0: 74 65 73 74 73 3a 6d 61 74 63 68 20 74 65 73 74  tests:match test
46e0: 2d 70 61 74 74 73 20 28 74 65 73 74 73 3a 74 65  -patts (tests:te
46f0: 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74  stqueue-get-test
4700: 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64  name test-record
4710: 29 20 69 74 65 6d 2d 70 61 74 68 29 29 20 3b 3b  ) item-path)) ;;
4720: 20 54 68 69 73 20 74 65 73 74 2f 69 74 65 6d 70   This test/itemp
4730: 61 74 68 20 69 73 20 6e 6f 74 20 74 6f 20 62 65  ath is not to be
4740: 20 72 75 6e 0a 09 09 20 20 3b 3b 20 65 6c 73 65   run...  ;; else
4750: 20 74 68 65 20 72 75 6e 20 69 73 20 73 74 75 63   the run is stuc
4760: 6b 2c 20 74 65 6d 70 6f 72 61 72 69 6c 79 20 6f  k, temporarily o
4770: 72 20 70 65 72 6d 61 6e 65 6e 74 6c 79 0a 09 09  r permanently...
4780: 20 20 3b 3b 20 62 75 74 20 73 68 6f 75 6c 64 20    ;; but should 
4790: 63 68 65 63 6b 20 69 66 20 69 74 20 69 73 20 64  check if it is d
47a0: 75 65 20 74 6f 20 6c 61 63 6b 20 6f 66 20 72 65  ue to lack of re
47b0: 73 6f 75 72 63 65 73 20 76 73 2e 20 70 72 65 72  sources vs. prer
47c0: 65 71 75 69 73 69 74 65 73 0a 09 09 20 20 28 64  equisites...  (d
47d0: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
47e0: 31 20 22 53 6b 69 70 70 69 6e 67 20 22 20 28 74  1 "Skipping " (t
47f0: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67  ests:testqueue-g
4800: 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74  et-testname test
4810: 2d 72 65 63 6f 72 64 29 20 22 20 22 20 69 74 65  -record) " " ite
4820: 6d 2d 70 61 74 68 20 22 20 61 73 20 69 74 20 64  m-path " as it d
4830: 6f 65 73 6e 27 74 20 6d 61 74 63 68 20 22 20 74  oesn't match " t
4840: 65 73 74 2d 70 61 74 74 73 29 0a 09 09 20 20 28  est-patts)...  (
4850: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67  thread-sleep! *g
4860: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09  lobal-delta*)...
4870: 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c    (if (not (null
4880: 3f 20 74 61 6c 29 29 0a 09 09 20 20 20 20 20 20  ? tal))...      
4890: 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28  (loop (car tal)(
48a0: 63 64 72 20 74 61 6c 29 20 72 65 72 75 6e 73 29  cdr tal) reruns)
48b0: 29 29 0a 09 09 20 28 28 61 6e 64 20 28 6e 6f 74  ))... ((and (not
48c0: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66   (hash-table-ref
48d0: 2f 64 65 66 61 75 6c 74 20 74 65 73 74 2d 72 65  /default test-re
48e0: 67 69 73 74 65 72 79 20 28 72 75 6e 73 3a 6d 61  gistery (runs:ma
48f0: 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d  ke-full-test-nam
4900: 65 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d  e test-name item
4910: 2d 70 61 74 68 29 20 23 66 29 29 0a 09 09 20 20  -path) #f))...  
4920: 20 20 20 20 20 28 61 6e 64 20 6d 61 78 2d 63 6f       (and max-co
4930: 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 28 3e  ncurrent-jobs (>
4940: 20 28 2d 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65   (- max-concurre
4950: 6e 74 2d 6a 6f 62 73 20 6e 75 6d 2d 72 75 6e 6e  nt-jobs num-runn
4960: 69 6e 67 29 20 35 29 29 29 0a 09 09 20 20 28 64  ing) 5)))...  (d
4970: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
4980: 34 20 22 50 72 65 2d 72 65 67 69 73 74 65 72 69  4 "Pre-registeri
4990: 6e 67 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e  ng test " test-n
49a0: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74  ame "/" item-pat
49b0: 68 20 22 20 74 6f 20 63 72 65 61 74 65 20 70 6c  h " to create pl
49c0: 61 63 65 68 6f 6c 64 65 72 22 20 29 0a 09 09 20  aceholder" )... 
49d0: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
49e0: 20 64 62 3a 74 65 73 74 73 2d 72 65 67 69 73 74   db:tests-regist
49f0: 65 72 2d 74 65 73 74 20 23 66 20 72 75 6e 2d 69  er-test #f run-i
4a00: 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d  d test-name item
4a10: 2d 70 61 74 68 29 0a 09 09 20 20 28 68 61 73 68  -path)...  (hash
4a20: 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 65 73 74  -table-set! test
4a30: 2d 72 65 67 69 73 74 65 72 79 20 28 72 75 6e 73  -registery (runs
4a40: 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d  :make-full-test-
4a50: 6e 61 6d 65 20 74 65 73 74 2d 6e 61 6d 65 20 69  name test-name i
4a60: 74 65 6d 2d 70 61 74 68 29 20 23 74 29 0a 09 09  tem-path) #t)...
4a70: 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21    (thread-sleep!
4a80: 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29   *global-delta*)
4a90: 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20  ...  (loop (car 
4aa0: 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74  newtal)(cdr newt
4ab0: 61 6c 29 20 72 65 72 75 6e 73 29 29 0a 09 09 20  al) reruns))... 
4ac0: 28 28 6e 6f 74 20 68 61 76 65 2d 72 65 73 6f 75  ((not have-resou
4ad0: 72 63 65 73 29 20 3b 3b 20 73 69 6d 70 6c 79 20  rces) ;; simply 
4ae0: 74 72 79 20 61 67 61 69 6e 20 61 66 74 65 72 20  try again after 
4af0: 77 61 69 74 69 6e 67 20 61 20 73 65 63 6f 6e 64  waiting a second
4b00: 0a 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e  ...  (debug:prin
4b10: 74 2d 69 6e 66 6f 20 31 20 22 6e 6f 20 72 65 73  t-info 1 "no res
4b20: 6f 75 72 63 65 73 20 74 6f 20 72 75 6e 20 6e 65  ources to run ne
4b30: 77 20 74 65 73 74 73 2c 20 77 61 69 74 69 6e 67  w tests, waiting
4b40: 20 2e 2e 2e 22 29 0a 09 09 20 20 28 74 68 72 65   ...")...  (thre
4b50: 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 30 2e 30  ad-sleep! (+ 0.0
4b60: 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a  1 *global-delta*
4b70: 29 29 0a 09 09 20 20 3b 3b 20 63 6f 75 6c 64 20  ))...  ;; could 
4b80: 68 61 76 65 20 64 6f 6e 65 20 68 65 64 20 74 61  have done hed ta
4b90: 6c 20 68 65 72 65 20 62 75 74 20 64 6f 69 6e 67  l here but doing
4ba0: 20 63 61 72 2f 63 64 72 20 6f 66 20 6e 65 77 74   car/cdr of newt
4bb0: 61 6c 20 74 6f 20 72 6f 74 61 74 65 20 74 65 73  al to rotate tes
4bc0: 74 73 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61  ts...  (loop (ca
4bd0: 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65  r newtal)(cdr ne
4be0: 77 74 61 6c 29 20 72 65 72 75 6e 73 29 29 0a 09  wtal) reruns))..
4bf0: 09 20 28 28 61 6e 64 20 68 61 76 65 2d 72 65 73  . ((and have-res
4c00: 6f 75 72 63 65 73 0a 09 09 20 20 20 20 20 20 20  ources...       
4c10: 28 6f 72 20 28 6e 75 6c 6c 3f 20 70 72 65 72 65  (or (null? prere
4c20: 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09 09 20  qs-not-met).... 
4c30: 20 20 28 61 6e 64 20 28 65 71 3f 20 74 65 73 74    (and (eq? test
4c40: 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c 29 0a  mode 'toplevel).
4c50: 09 09 09 09 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63  ....(null? non-c
4c60: 6f 6d 70 6c 65 74 65 64 29 29 29 29 0a 09 09 20  ompleted))))... 
4c70: 20 28 72 75 6e 3a 74 65 73 74 20 72 75 6e 2d 69   (run:test run-i
4c80: 64 20 72 75 6e 6e 61 6d 65 20 6b 65 79 76 61 6c  d runname keyval
4c90: 6c 73 74 20 74 65 73 74 2d 72 65 63 6f 72 64 20  lst test-record 
4ca0: 66 6c 61 67 73 20 23 66 29 0a 09 09 20 20 28 74  flags #f)...  (t
4cb0: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c  hread-sleep! *gl
4cc0: 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 20  obal-delta*)... 
4cd0: 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f   (if (not (null?
4ce0: 20 74 61 6c 29 29 0a 09 09 20 20 20 20 20 20 28   tal))...      (
4cf0: 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63  loop (car tal)(c
4d00: 64 72 20 74 61 6c 29 20 72 65 72 75 6e 73 29 29  dr tal) reruns))
4d10: 29 0a 09 09 20 28 65 6c 73 65 20 3b 3b 20 6d 75  )... (else ;; mu
4d20: 73 74 20 62 65 20 77 65 20 68 61 76 65 20 75 6e  st be we have un
4d30: 6d 65 74 20 70 72 65 72 65 71 75 69 73 69 74 65  met prerequisite
4d40: 73 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70  s...    (debug:p
4d50: 72 69 6e 74 20 34 20 22 46 41 49 4c 53 3a 20 22  rint 4 "FAILS: "
4d60: 20 66 61 69 6c 73 29 0a 09 09 20 20 20 20 3b 3b   fails)...    ;;
4d70: 20 49 66 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 20   If one or more 
4d80: 6f 66 20 74 68 65 20 70 72 65 72 65 71 73 2d 6e  of the prereqs-n
4d90: 6f 74 2d 6d 65 74 20 61 72 65 20 46 41 49 4c 20  ot-met are FAIL 
4da0: 74 68 65 6e 20 77 65 20 63 61 6e 20 69 73 73 75  then we can issu
4db0: 65 0a 09 09 20 20 20 20 3b 3b 20 61 20 6d 65 73  e...    ;; a mes
4dc0: 73 61 67 65 20 61 6e 64 20 64 72 6f 70 20 68 65  sage and drop he
4dd0: 64 20 66 72 6f 6d 20 74 68 65 20 69 74 65 6d 73  d from the items
4de0: 20 74 6f 20 62 65 20 70 72 6f 63 65 73 73 65 64   to be processed
4df0: 2e 0a 09 09 20 20 20 20 28 69 66 20 28 6e 75 6c  ....    (if (nul
4e00: 6c 3f 20 66 61 69 6c 73 29 0a 09 09 09 28 62 65  l? fails)....(be
4e10: 67 69 6e 0a 09 09 09 20 20 3b 3b 20 63 6f 75 6c  gin....  ;; coul
4e20: 64 6e 27 74 20 72 75 6e 2c 20 74 61 6b 65 20 61  dn't run, take a
4e30: 20 62 72 65 61 74 68 65 72 0a 09 09 09 20 20 28   breather....  (
4e40: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
4e50: 20 34 20 22 53 68 6f 75 6c 64 6e 27 74 20 72 65   4 "Shouldn't re
4e60: 61 6c 6c 79 20 67 65 74 20 68 65 72 65 2c 20 72  ally get here, r
4e70: 61 63 65 20 63 6f 6e 64 69 74 69 6f 6e 3f 20 55  ace condition? U
4e80: 6e 61 62 6c 65 20 74 6f 20 6c 61 75 6e 63 68 20  nable to launch 
4e90: 6d 6f 72 65 20 74 65 73 74 73 20 61 74 20 74 68  more tests at th
4ea0: 69 73 20 6d 6f 6d 65 6e 74 2c 20 6b 69 6c 6c 69  is moment, killi
4eb0: 6e 67 20 74 69 6d 65 20 2e 2e 2e 22 29 0a 09 09  ng time ...")...
4ec0: 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70  .  (thread-sleep
4ed0: 21 20 28 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61  ! (+ 0.01 *globa
4ee0: 6c 2d 64 65 6c 74 61 2a 29 29 20 3b 3b 20 6c 6f  l-delta*)) ;; lo
4ef0: 6e 67 20 73 6c 65 65 70 20 68 65 72 65 20 2d 20  ng sleep here - 
4f00: 6e 6f 20 72 65 73 6f 75 72 63 65 73 2c 20 6d 61  no resources, ma
4f10: 79 20 61 73 20 77 65 6c 6c 20 62 65 20 70 61 74  y as well be pat
4f20: 69 65 6e 74 0a 09 09 09 20 20 3b 3b 20 77 65 20  ient....  ;; we 
4f30: 6d 61 64 65 20 6e 65 77 20 74 61 6c 20 62 79 20  made new tal by 
4f40: 73 74 69 63 6b 69 6e 67 20 68 65 64 20 61 74 20  sticking hed at 
4f50: 74 68 65 20 62 61 63 6b 20 6f 66 20 74 68 65 20  the back of the 
4f60: 6c 69 73 74 0a 09 09 09 20 20 28 6c 6f 6f 70 20  list....  (loop 
4f70: 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72  (car newtal)(cdr
4f80: 20 6e 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29   newtal) reruns)
4f90: 29 0a 09 09 09 3b 3b 20 74 68 65 20 77 61 69 74  )....;; the wait
4fa0: 6f 6e 20 69 73 20 46 41 49 4c 20 73 6f 20 6e 6f  on is FAIL so no
4fb0: 20 70 6f 69 6e 74 20 69 6e 20 74 72 79 69 6e 67   point in trying
4fc0: 20 74 6f 20 72 75 6e 20 68 65 64 20 65 76 65 72   to run hed ever
4fd0: 20 61 67 61 69 6e 0a 09 09 09 28 69 66 20 28 6e   again....(if (n
4fe0: 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a  ot (null? tal)).
4ff0: 09 09 09 20 20 20 20 28 69 66 20 28 76 65 63 74  ...    (if (vect
5000: 6f 72 3f 20 68 65 64 29 0a 09 09 09 09 28 62 65  or? hed).....(be
5010: 67 69 6e 20 28 64 65 62 75 67 3a 70 72 69 6e 74  gin (debug:print
5020: 20 31 20 22 57 41 52 4e 3a 20 44 72 6f 70 70 69   1 "WARN: Droppi
5030: 6e 67 20 74 65 73 74 20 22 20 28 64 62 3a 74 65  ng test " (db:te
5040: 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20  st-get-testname 
5050: 68 65 64 29 20 22 2f 22 20 28 64 62 3a 74 65 73  hed) "/" (db:tes
5060: 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20  t-get-item-path 
5070: 68 65 64 29 0a 09 09 09 09 09 09 20 20 20 20 22  hed).......    "
5080: 20 66 72 6f 6d 20 74 68 65 20 6c 61 75 6e 63 68   from the launch
5090: 20 6c 69 73 74 20 61 73 20 69 74 20 68 61 73 20   list as it has 
50a0: 70 72 65 72 65 71 75 69 73 74 65 73 20 74 68 61  prerequistes tha
50b0: 74 20 61 72 65 20 46 41 49 4c 22 29 0a 09 09 09  t are FAIL")....
50c0: 09 20 20 20 20 20 20 20 28 74 68 72 65 61 64 2d  .       (thread-
50d0: 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64  sleep! *global-d
50e0: 65 6c 74 61 2a 29 0a 09 09 09 09 20 20 20 20 20  elta*).....     
50f0: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c    (loop (car tal
5100: 29 28 63 64 72 20 74 61 6c 29 20 28 63 6f 6e 73  )(cdr tal) (cons
5110: 20 68 65 64 20 72 65 72 75 6e 73 29 29 29 0a 09   hed reruns)))..
5120: 09 09 09 28 62 65 67 69 6e 0a 09 09 09 09 20 20  ...(begin.....  
5130: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22  (debug:print 1 "
5140: 57 41 52 4e 3a 20 54 65 73 74 20 6e 6f 74 20 70  WARN: Test not p
5150: 72 6f 63 65 73 73 65 64 20 63 6f 72 72 65 63 74  rocessed correct
5160: 6c 79 2e 20 43 6f 75 6c 64 20 62 65 20 61 20 72  ly. Could be a r
5170: 61 63 65 20 63 6f 6e 64 69 74 69 6f 6e 20 69 6e  ace condition in
5180: 20 79 6f 75 72 20 74 65 73 74 20 69 6d 70 6c 65   your test imple
5190: 6d 65 6e 74 61 74 69 6f 6e 3f 20 22 20 68 65 64  mentation? " hed
51a0: 29 20 3b 3b 20 20 22 20 61 73 20 69 74 20 68 61  ) ;;  " as it ha
51b0: 73 20 70 72 65 72 65 71 75 69 73 74 65 73 20 74  s prerequistes t
51c0: 68 61 74 20 61 72 65 20 46 41 49 4c 2e 20 28 4e  hat are FAIL. (N
51d0: 4f 54 45 3a 20 68 65 64 20 69 73 20 6e 6f 74 20  OTE: hed is not 
51e0: 61 20 76 65 63 74 6f 72 29 22 29 0a 09 09 09 09  a vector)").....
51f0: 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21    (thread-sleep!
5200: 20 28 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c   (+ 0.01 *global
5210: 2d 64 65 6c 74 61 2a 29 29 0a 09 09 09 09 20 20  -delta*)).....  
5220: 28 6c 6f 6f 70 20 68 65 64 20 74 61 6c 20 72 65  (loop hed tal re
5230: 72 75 6e 73 29 29 29 29 29 29 29 29 29 20 3b 3b  runs))))))))) ;;
5240: 20 45 4e 44 20 4f 46 20 49 4e 4e 45 52 20 43 4f   END OF INNER CO
5250: 4e 44 0a 09 20 20 20 20 20 0a 09 20 20 20 20 20  ND..     ..     
5260: 3b 3b 20 63 61 73 65 20 77 68 65 72 65 20 61 6e  ;; case where an
5270: 20 69 74 65 6d 73 20 63 61 6d 65 20 69 6e 20 61   items came in a
5280: 73 20 61 20 6c 69 73 74 20 62 65 65 6e 20 70 72  s a list been pr
5290: 6f 63 65 73 73 65 64 0a 09 20 20 20 20 20 28 28  ocessed..     ((
52a0: 61 6e 64 20 28 6c 69 73 74 3f 20 69 74 65 6d 73  and (list? items
52b0: 29 20 20 20 20 20 3b 3b 20 74 68 75 73 20 77 65  )     ;; thus we
52c0: 20 6b 6e 6f 77 20 6f 75 72 20 69 74 65 6d 73 20   know our items 
52d0: 61 72 65 20 61 6c 72 65 61 64 79 20 63 61 6c 63  are already calc
52e0: 75 6c 61 74 65 64 0a 09 09 20 20 20 28 6e 6f 74  ulated...   (not
52f0: 20 20 20 69 74 65 6d 64 61 74 29 29 20 3b 3b 20     itemdat)) ;; 
5300: 61 6e 64 20 6e 6f 74 20 79 65 74 20 65 78 70 61  and not yet expa
5310: 6e 64 65 64 20 69 6e 74 6f 20 74 68 65 20 6c 69  nded into the li
5320: 73 74 20 6f 66 20 74 68 69 6e 67 73 20 74 6f 20  st of things to 
5330: 62 65 20 64 6f 6e 65 0a 09 20 20 20 20 20 20 28  be done..      (
5340: 69 66 20 28 61 6e 64 20 28 64 65 62 75 67 3a 64  if (and (debug:d
5350: 65 62 75 67 2d 6d 6f 64 65 20 31 29 20 3b 3b 20  ebug-mode 1) ;; 
5360: 28 3e 3d 20 2a 76 65 72 62 6f 73 69 74 79 2a 20  (>= *verbosity* 
5370: 31 29 0a 09 09 20 20 20 20 20 20 20 28 3e 20 28  1)...       (> (
5380: 6c 65 6e 67 74 68 20 69 74 65 6d 73 29 20 30 29  length items) 0)
5390: 0a 09 09 20 20 20 20 20 20 20 28 3e 20 28 6c 65  ...       (> (le
53a0: 6e 67 74 68 20 28 63 61 72 20 69 74 65 6d 73 29  ngth (car items)
53b0: 29 20 30 29 29 0a 09 09 20 20 28 70 70 20 69 74  ) 0))...  (pp it
53c0: 65 6d 73 29 29 0a 09 20 20 20 20 20 20 28 66 6f  ems))..      (fo
53d0: 72 2d 65 61 63 68 0a 09 20 20 20 20 20 20 20 28  r-each..       (
53e0: 6c 61 6d 62 64 61 20 28 6d 79 2d 69 74 65 6d 64  lambda (my-itemd
53f0: 61 74 29 0a 09 09 20 28 6c 65 74 2a 20 28 28 6e  at)... (let* ((n
5400: 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 28  ew-test-record (
5410: 6c 65 74 20 28 28 6e 65 77 72 65 63 20 28 6d 61  let ((newrec (ma
5420: 6b 65 2d 74 65 73 74 73 3a 74 65 73 74 71 75 65  ke-tests:testque
5430: 75 65 29 29 29 0a 09 09 09 09 09 20 20 20 28 76  ue)))......   (v
5440: 65 63 74 6f 72 2d 63 6f 70 79 21 20 74 65 73 74  ector-copy! test
5450: 2d 72 65 63 6f 72 64 20 6e 65 77 72 65 63 29 0a  -record newrec).
5460: 09 09 09 09 09 20 20 20 6e 65 77 72 65 63 29 29  .....   newrec))
5470: 0a 09 09 09 28 6d 79 2d 69 74 65 6d 2d 70 61 74  ....(my-item-pat
5480: 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61  h (item-list->pa
5490: 74 68 20 6d 79 2d 69 74 65 6d 64 61 74 29 29 29  th my-itemdat)))
54a0: 0a 09 09 20 20 20 28 69 66 20 28 74 65 73 74 73  ...   (if (tests
54b0: 3a 6d 61 74 63 68 20 74 65 73 74 2d 70 61 74 74  :match test-patt
54c0: 73 20 68 65 64 20 6d 79 2d 69 74 65 6d 2d 70 61  s hed my-item-pa
54d0: 74 68 29 20 3b 3b 20 28 70 61 74 74 2d 6c 69 73  th) ;; (patt-lis
54e0: 74 2d 6d 61 74 63 68 20 6d 79 2d 69 74 65 6d 2d  t-match my-item-
54f0: 70 61 74 68 20 69 74 65 6d 2d 70 61 74 74 73 29  path item-patts)
5500: 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 79 65             ;; ye
5510: 73 2c 20 77 65 20 77 61 6e 74 20 74 6f 20 70 72  s, we want to pr
5520: 6f 63 65 73 73 20 74 68 69 73 20 69 74 65 6d 2c  ocess this item,
5530: 20 4e 4f 54 45 3a 20 53 68 6f 75 6c 64 20 6e 6f   NOTE: Should no
5540: 74 20 6e 65 65 64 20 74 68 69 73 20 63 68 65 63  t need this chec
5550: 6b 20 68 65 72 65 21 0a 09 09 20 20 20 20 20 20  k here!...      
5560: 20 28 6c 65 74 20 28 28 6e 65 77 74 65 73 74 6e   (let ((newtestn
5570: 61 6d 65 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66  ame (runs:make-f
5580: 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 68 65  ull-test-name he
5590: 64 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68 29 29  d my-item-path))
55a0: 29 20 20 20 20 3b 3b 20 74 65 73 74 20 6e 61 6d  )    ;; test nam
55b0: 65 73 20 61 72 65 20 75 6e 69 71 75 65 20 6f 6e  es are unique on
55c0: 20 74 65 73 74 6e 61 6d 65 2f 69 74 65 6d 2d 70   testname/item-p
55d0: 61 74 68 0a 09 09 09 20 28 74 65 73 74 73 3a 74  ath.... (tests:t
55e0: 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65  estqueue-set-ite
55f0: 6d 73 21 20 20 20 20 20 6e 65 77 2d 74 65 73 74  ms!     new-test
5600: 2d 72 65 63 6f 72 64 20 23 66 29 0a 09 09 09 20  -record #f).... 
5610: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65  (tests:testqueue
5620: 2d 73 65 74 2d 69 74 65 6d 64 61 74 21 20 20 20  -set-itemdat!   
5630: 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20  new-test-record 
5640: 6d 79 2d 69 74 65 6d 64 61 74 29 0a 09 09 09 20  my-itemdat).... 
5650: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65  (tests:testqueue
5660: 2d 73 65 74 2d 69 74 65 6d 5f 70 61 74 68 21 20  -set-item_path! 
5670: 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20  new-test-record 
5680: 6d 79 2d 69 74 65 6d 2d 70 61 74 68 29 0a 09 09  my-item-path)...
5690: 09 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65  . (hash-table-se
56a0: 74 21 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20  t! test-records 
56b0: 6e 65 77 74 65 73 74 6e 61 6d 65 20 6e 65 77 2d  newtestname new-
56c0: 74 65 73 74 2d 72 65 63 6f 72 64 29 0a 09 09 09  test-record)....
56d0: 20 28 73 65 74 21 20 74 61 6c 20 28 63 6f 6e 73   (set! tal (cons
56e0: 20 6e 65 77 74 65 73 74 6e 61 6d 65 20 74 61 6c   newtestname tal
56f0: 29 29 29 29 29 29 20 3b 3b 20 73 69 6e 63 65 20  )))))) ;; since 
5700: 74 68 65 73 65 20 61 72 65 20 69 74 65 6d 69 7a  these are itemiz
5710: 65 64 20 63 72 65 61 74 65 20 6e 65 77 20 74 65  ed create new te
5720: 73 74 20 6e 61 6d 65 73 20 74 65 73 74 6e 61 6d  st names testnam
5730: 65 2f 69 74 65 6d 70 61 74 68 0a 09 20 20 20 20  e/itempath..    
5740: 20 20 20 69 74 65 6d 73 29 0a 09 20 20 20 20 20     items)..     
5750: 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f   (if (not (null?
5760: 20 74 61 6c 29 29 0a 09 09 20 20 28 62 65 67 69   tal))...  (begi
5770: 6e 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70  n...    (debug:p
5780: 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 45 6e 64  rint-info 4 "End
5790: 20 6f 66 20 69 74 65 6d 73 20 6c 69 73 74 2c 20   of items list, 
57a0: 6c 6f 6f 70 69 6e 67 20 77 69 74 68 20 6e 65 78  looping with nex
57b0: 74 20 61 66 74 65 72 20 73 68 6f 72 74 20 64 65  t after short de
57c0: 6c 61 79 22 29 0a 09 09 20 20 20 20 28 74 68 72  lay")...    (thr
57d0: 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 30 2e  ead-sleep! (+ 0.
57e0: 30 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61  01 *global-delta
57f0: 2a 29 29 0a 09 09 20 20 20 20 28 6c 6f 6f 70 20  *))...    (loop 
5800: 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74 61  (car tal)(cdr ta
5810: 6c 29 20 72 65 72 75 6e 73 29 29 29 29 0a 0a 09  l) reruns))))...
5820: 20 20 20 20 20 3b 3b 20 69 66 20 69 74 65 6d 73       ;; if items
5830: 20 69 73 20 61 20 70 72 6f 63 20 74 68 65 6e 20   is a proc then 
5840: 6e 65 65 64 20 74 6f 20 72 75 6e 20 69 74 65 6d  need to run item
5850: 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d  s:get-items-from
5860: 2d 63 6f 6e 66 69 67 2c 20 67 65 74 20 74 68 65  -config, get the
5870: 20 6c 69 73 74 20 61 6e 64 20 6c 6f 6f 70 20 0a   list and loop .
5880: 09 20 20 20 20 20 3b 3b 20 20 20 20 2d 20 62 75  .     ;;    - bu
5890: 74 20 6f 6e 6c 79 20 64 6f 20 74 68 61 74 20 69  t only do that i
58a0: 66 20 72 65 73 6f 75 72 63 65 73 20 65 78 69 73  f resources exis
58b0: 74 20 74 6f 20 6b 69 63 6b 20 6f 66 66 20 74 68  t to kick off th
58c0: 65 20 6a 6f 62 0a 09 20 20 20 20 20 28 28 6f 72  e job..     ((or
58d0: 20 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65   (procedure? ite
58e0: 6d 73 29 28 65 71 3f 20 69 74 65 6d 73 20 27 68  ms)(eq? items 'h
58f0: 61 76 65 2d 70 72 6f 63 65 64 75 72 65 29 29 0a  ave-procedure)).
5900: 09 20 20 20 20 20 20 28 6c 65 74 20 28 28 63 61  .      (let ((ca
5910: 6e 2d 72 75 6e 2d 6d 6f 72 65 20 20 20 20 28 72  n-run-more    (r
5920: 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65  uns:can-run-more
5930: 2d 74 65 73 74 73 20 74 65 73 74 2d 72 65 63 6f  -tests test-reco
5940: 72 64 29 29 29 0a 09 09 28 69 66 20 63 61 6e 2d  rd)))...(if can-
5950: 72 75 6e 2d 6d 6f 72 65 0a 09 09 20 20 20 20 28  run-more...    (
5960: 6c 65 74 2a 20 28 28 70 72 65 72 65 71 73 2d 6e  let* ((prereqs-n
5970: 6f 74 2d 6d 65 74 20 28 6f 70 65 6e 2d 72 75 6e  ot-met (open-run
5980: 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 70 72  -close db:get-pr
5990: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 23 66  ereqs-not-met #f
59a0: 20 72 75 6e 2d 69 64 20 77 61 69 74 6f 6e 73 20   run-id waitons 
59b0: 69 74 65 6d 2d 70 61 74 68 20 6d 6f 64 65 3a 20  item-path mode: 
59c0: 74 65 73 74 6d 6f 64 65 29 29 0a 09 09 09 20 20  testmode))....  
59d0: 20 28 66 61 69 6c 73 20 20 20 20 20 20 20 20 20   (fails         
59e0: 20 20 28 72 75 6e 73 3a 63 61 6c 63 2d 66 61 69    (runs:calc-fai
59f0: 6c 73 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d  ls prereqs-not-m
5a00: 65 74 29 29 0a 09 09 09 20 20 20 28 6e 6f 6e 2d  et))....   (non-
5a10: 63 6f 6d 70 6c 65 74 65 64 20 20 20 28 72 75 6e  completed   (run
5a20: 73 3a 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c  s:calc-not-compl
5a30: 65 74 65 64 20 70 72 65 72 65 71 73 2d 6e 6f 74  eted prereqs-not
5a40: 2d 6d 65 74 29 29 29 0a 09 09 20 20 20 20 20 20  -met)))...      
5a50: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
5a60: 6f 20 38 20 22 63 61 6e 2d 72 75 6e 2d 6d 6f 72  o 8 "can-run-mor
5a70: 65 3a 20 22 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72  e: " can-run-mor
5a80: 65 0a 09 09 09 09 20 20 20 22 5c 6e 20 74 65 73  e.....   "\n tes
5a90: 74 6e 61 6d 65 3a 20 20 20 20 20 20 20 20 22 20  tname:        " 
5aa0: 68 65 64 0a 09 09 09 09 20 20 20 22 5c 6e 20 70  hed.....   "\n p
5ab0: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 3a 20  rereqs-not-met: 
5ac0: 22 20 28 72 75 6e 73 3a 70 72 65 74 74 79 2d 73  " (runs:pretty-s
5ad0: 74 72 69 6e 67 20 70 72 65 72 65 71 73 2d 6e 6f  tring prereqs-no
5ae0: 74 2d 6d 65 74 29 0a 09 09 09 09 20 20 20 22 5c  t-met).....   "\
5af0: 6e 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 3a  n non-completed:
5b00: 20 20 20 22 20 28 72 75 6e 73 3a 70 72 65 74 74     " (runs:prett
5b10: 79 2d 73 74 72 69 6e 67 20 6e 6f 6e 2d 63 6f 6d  y-string non-com
5b20: 70 6c 65 74 65 64 29 20 0a 09 09 09 09 20 20 20  pleted) .....   
5b30: 22 5c 6e 20 66 61 69 6c 73 3a 20 20 20 20 20 20  "\n fails:      
5b40: 20 20 20 20 20 22 20 28 72 75 6e 73 3a 70 72 65       " (runs:pre
5b50: 74 74 79 2d 73 74 72 69 6e 67 20 66 61 69 6c 73  tty-string fails
5b60: 29 0a 09 09 09 09 20 20 20 22 5c 6e 20 74 65 73  ).....   "\n tes
5b70: 74 6d 6f 64 65 3a 20 20 20 20 20 20 20 20 22 20  tmode:        " 
5b80: 74 65 73 74 6d 6f 64 65 0a 09 09 09 09 20 20 20  testmode.....   
5b90: 22 5c 6e 20 6e 75 6d 2d 72 65 74 72 69 65 73 3a  "\n num-retries:
5ba0: 20 20 20 20 20 22 20 6e 75 6d 2d 72 65 74 72 69       " num-retri
5bb0: 65 73 0a 09 09 09 09 20 20 20 22 5c 6e 20 28 65  es.....   "\n (e
5bc0: 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 74 6f 70  q? testmode 'top
5bd0: 6c 65 76 65 6c 29 3a 20 22 20 28 65 71 3f 20 74  level): " (eq? t
5be0: 65 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65  estmode 'topleve
5bf0: 6c 29 0a 09 09 09 09 20 20 20 22 5c 6e 20 28 6e  l).....   "\n (n
5c00: 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74  ull? non-complet
5c10: 65 64 29 3a 20 20 20 20 22 20 28 6e 75 6c 6c 3f  ed):    " (null?
5c20: 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 0a   non-completed).
5c30: 09 09 09 09 20 20 20 22 5c 6e 20 72 65 72 75 6e  ....   "\n rerun
5c40: 73 3a 20 20 20 20 20 20 20 20 20 20 22 20 72 65  s:          " re
5c50: 72 75 6e 73 0a 09 09 09 09 20 20 20 22 5c 6e 20  runs.....   "\n 
5c60: 69 74 65 6d 73 3a 20 20 20 20 20 20 20 20 20 20  items:          
5c70: 20 22 20 69 74 65 6d 73 0a 09 09 09 09 20 20 20   " items.....   
5c80: 22 5c 6e 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65  "\n can-run-more
5c90: 3a 20 20 20 20 22 20 63 61 6e 2d 72 75 6e 2d 6d  :    " can-run-m
5ca0: 6f 72 65 29 0a 09 09 20 20 20 20 20 20 3b 3b 20  ore)...      ;; 
5cb0: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28  (thread-sleep! (
5cc0: 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d 64  + 0.01 *global-d
5cd0: 65 6c 74 61 2a 29 29 0a 09 09 20 20 20 20 20 20  elta*))...      
5ce0: 28 63 6f 6e 64 20 3b 3b 20 49 4e 4e 45 52 20 43  (cond ;; INNER C
5cf0: 4f 4e 44 20 23 32 0a 09 09 20 20 20 20 20 20 20  OND #2...       
5d00: 28 28 6f 72 20 28 6e 75 6c 6c 3f 20 70 72 65 72  ((or (null? prer
5d10: 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 20 3b 3b 20  eqs-not-met) ;; 
5d20: 61 6c 6c 20 70 72 65 72 65 71 73 20 6d 65 74 2c  all prereqs met,
5d30: 20 66 69 72 65 20 6f 66 66 20 74 68 65 20 74 65   fire off the te
5d40: 73 74 0a 09 09 09 20 20 20 20 3b 3b 20 6f 72 2c  st....    ;; or,
5d50: 20 69 66 20 69 74 20 69 73 20 61 20 27 74 6f 70   if it is a 'top
5d60: 6c 65 76 65 6c 20 74 65 73 74 20 61 6e 64 20 61  level test and a
5d70: 6c 6c 20 70 72 65 72 65 71 73 20 6e 6f 74 20 6d  ll prereqs not m
5d80: 65 74 20 61 72 65 20 43 4f 4d 50 4c 45 54 45 44  et are COMPLETED
5d90: 20 74 68 65 6e 20 6c 61 75 6e 63 68 0a 09 09 09   then launch....
5da0: 20 20 20 20 28 61 6e 64 20 28 65 71 3f 20 74 65      (and (eq? te
5db0: 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c  stmode 'toplevel
5dc0: 29 0a 09 09 09 09 20 28 6e 75 6c 6c 3f 20 6e 6f  )..... (null? no
5dd0: 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 29 29 0a 09  n-completed)))..
5de0: 09 09 28 6c 65 74 20 28 28 74 65 73 74 2d 6e 61  ..(let ((test-na
5df0: 6d 65 20 28 74 65 73 74 73 3a 74 65 73 74 71 75  me (tests:testqu
5e00: 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65  eue-get-testname
5e10: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 29 0a   test-record))).
5e20: 09 09 09 20 20 28 73 65 74 65 6e 76 20 22 4d 54  ...  (setenv "MT
5e30: 5f 54 45 53 54 5f 4e 41 4d 45 22 20 74 65 73 74  _TEST_NAME" test
5e40: 2d 6e 61 6d 65 29 20 3b 3b 20 0a 09 09 09 20 20  -name) ;; ....  
5e50: 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e 4e  (setenv "MT_RUNN
5e60: 41 4d 45 22 20 20 20 72 75 6e 6e 61 6d 65 29 0a  AME"   runname).
5e70: 09 09 09 20 20 28 73 65 74 2d 6d 65 67 61 74 65  ...  (set-megate
5e80: 73 74 2d 65 6e 76 2d 76 61 72 73 20 72 75 6e 2d  st-env-vars run-
5e90: 69 64 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79  id) ;; these may
5ea0: 20 62 65 20 6e 65 65 64 65 64 20 62 79 20 74 68   be needed by th
5eb0: 65 20 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63  e launching proc
5ec0: 65 73 73 0a 09 09 09 20 20 28 6c 65 74 20 28 28  ess....  (let ((
5ed0: 69 74 65 6d 73 2d 6c 69 73 74 20 28 69 74 65 6d  items-list (item
5ee0: 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d  s:get-items-from
5ef0: 2d 63 6f 6e 66 69 67 20 74 63 6f 6e 66 69 67 29  -config tconfig)
5f00: 29 29 0a 09 09 09 20 20 20 20 28 69 66 20 28 6c  ))....    (if (l
5f10: 69 73 74 3f 20 69 74 65 6d 73 2d 6c 69 73 74 29  ist? items-list)
5f20: 0a 09 09 09 09 28 62 65 67 69 6e 0a 09 09 09 09  .....(begin.....
5f30: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65    (tests:testque
5f40: 75 65 2d 73 65 74 2d 69 74 65 6d 73 21 20 74 65  ue-set-items! te
5f50: 73 74 2d 72 65 63 6f 72 64 20 69 74 65 6d 73 2d  st-record items-
5f60: 6c 69 73 74 29 0a 09 09 09 09 20 20 28 74 68 72  list).....  (thr
5f70: 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62  ead-sleep! *glob
5f80: 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 09 09 20  al-delta*)..... 
5f90: 20 28 6c 6f 6f 70 20 68 65 64 20 74 61 6c 20 72   (loop hed tal r
5fa0: 65 72 75 6e 73 29 29 0a 09 09 09 09 28 62 65 67  eruns)).....(beg
5fb0: 69 6e 0a 09 09 09 09 20 20 28 64 65 62 75 67 3a  in.....  (debug:
5fc0: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
5fd0: 54 68 65 20 70 72 6f 63 20 66 72 6f 6d 20 72 65  The proc from re
5fe0: 61 64 69 6e 67 20 74 68 65 20 73 65 74 75 70 20  ading the setup 
5ff0: 64 69 64 20 6e 6f 74 20 79 69 65 6c 64 20 61 20  did not yield a 
6000: 6c 69 73 74 20 2d 20 70 6c 65 61 73 65 20 72 65  list - please re
6010: 70 6f 72 74 20 74 68 69 73 22 29 0a 09 09 09 09  port this").....
6020: 20 20 28 65 78 69 74 20 31 29 29 29 29 29 29 0a    (exit 1)))))).
6030: 09 09 20 20 20 20 20 20 20 28 28 6e 75 6c 6c 3f  ..       ((null?
6040: 20 66 61 69 6c 73 29 0a 09 09 09 28 64 65 62 75   fails)....(debu
6050: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22  g:print-info 4 "
6060: 66 61 69 6c 73 20 69 73 20 6e 75 6c 6c 2c 20 6d  fails is null, m
6070: 6f 76 69 6e 67 20 6f 6e 20 69 6e 20 74 68 65 20  oving on in the 
6080: 71 75 65 75 65 20 62 75 74 20 6b 65 65 70 69 6e  queue but keepin
6090: 67 20 22 20 68 65 64 20 22 20 66 6f 72 20 6e 6f  g " hed " for no
60a0: 77 22 29 0a 09 09 09 3b 3b 20 6f 6e 6c 79 20 69  w")....;; only i
60b0: 6e 63 72 65 6d 65 6e 74 20 6e 75 6d 2d 72 65 74  ncrement num-ret
60c0: 72 69 65 73 20 77 68 65 6e 20 74 68 65 72 65 20  ries when there 
60d0: 61 72 65 20 6e 6f 20 74 65 73 74 73 20 72 75 6e  are no tests run
60e0: 69 6e 67 0a 09 09 09 28 69 66 20 28 65 71 3f 20  ing....(if (eq? 
60f0: 30 20 28 6c 69 73 74 2d 72 65 66 20 63 61 6e 2d  0 (list-ref can-
6100: 72 75 6e 2d 6d 6f 72 65 20 31 29 29 0a 09 09 09  run-more 1))....
6110: 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09 20 20      (begin....  
6120: 20 20 20 20 28 69 66 20 28 3e 20 6e 75 6d 2d 72      (if (> num-r
6130: 65 74 72 69 65 73 20 31 30 30 29 20 3b 3b 20 66  etries 100) ;; f
6140: 69 72 73 74 20 31 30 30 20 72 65 74 72 69 65 73  irst 100 retries
6150: 20 61 72 65 20 6c 6f 77 20 74 69 6d 65 20 63 6f   are low time co
6160: 73 74 0a 09 09 09 09 20 20 28 74 68 72 65 61 64  st.....  (thread
6170: 2d 73 6c 65 65 70 21 20 28 2b 20 32 20 2a 67 6c  -sleep! (+ 2 *gl
6180: 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09  obal-delta*))...
6190: 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65  ..  (thread-slee
61a0: 70 21 20 28 2b 20 30 2e 30 31 20 2a 67 6c 6f 62  p! (+ 0.01 *glob
61b0: 61 6c 2d 64 65 6c 74 61 2a 29 29 29 0a 09 09 09  al-delta*)))....
61c0: 20 20 20 20 20 20 28 73 65 74 21 20 6e 75 6d 2d        (set! num-
61d0: 72 65 74 72 69 65 73 20 28 2b 20 6e 75 6d 2d 72  retries (+ num-r
61e0: 65 74 72 69 65 73 20 31 29 29 29 29 0a 09 09 09  etries 1))))....
61f0: 28 69 66 20 28 3e 20 6e 75 6d 2d 72 65 74 72 69  (if (> num-retri
6200: 65 73 20 20 6d 61 78 2d 72 65 74 72 69 65 73 29  es  max-retries)
6210: 0a 09 09 09 20 20 20 20 28 69 66 20 28 6e 6f 74  ....    (if (not
6220: 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09   (null? tal))...
6230: 09 09 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c  ..(loop (car tal
6240: 29 28 63 64 72 20 74 61 6c 29 20 72 65 72 75 6e  )(cdr tal) rerun
6250: 73 29 29 0a 09 09 09 20 20 20 20 28 6c 6f 6f 70  s))....    (loop
6260: 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64   (car newtal)(cd
6270: 72 20 6e 65 77 74 61 6c 29 20 72 65 72 75 6e 73  r newtal) reruns
6280: 29 29 29 20 3b 3b 20 61 6e 20 69 73 73 75 65 20  ))) ;; an issue 
6290: 77 69 74 68 20 70 72 65 72 65 71 73 20 6e 6f 74  with prereqs not
62a0: 20 79 65 74 20 6d 65 74 3f 0a 09 09 20 20 20 20   yet met?...    
62b0: 20 20 20 28 28 61 6e 64 20 28 6e 6f 74 20 28 6e     ((and (not (n
62c0: 75 6c 6c 3f 20 66 61 69 6c 73 29 29 28 65 71 3f  ull? fails))(eq?
62d0: 20 74 65 73 74 6d 6f 64 65 20 27 6e 6f 72 6d 61   testmode 'norma
62e0: 6c 29 29 0a 09 09 09 28 64 65 62 75 67 3a 70 72  l))....(debug:pr
62f0: 69 6e 74 2d 69 6e 66 6f 20 31 20 22 74 65 73 74  int-info 1 "test
6300: 20 22 20 20 68 65 64 20 22 20 28 6d 6f 64 65 3d   "  hed " (mode=
6310: 22 20 74 65 73 74 6d 6f 64 65 20 22 29 20 68 61  " testmode ") ha
6320: 73 20 66 61 69 6c 65 64 20 70 72 65 72 65 71 75  s failed prerequ
6330: 69 73 69 74 65 28 73 29 3b 20 22 0a 09 09 09 09  isite(s); ".....
6340: 20 20 20 20 20 28 73 74 72 69 6e 67 2d 69 6e 74       (string-int
6350: 65 72 73 70 65 72 73 65 20 28 6d 61 70 20 28 6c  ersperse (map (l
6360: 61 6d 62 64 61 20 28 74 29 28 63 6f 6e 63 20 28  ambda (t)(conc (
6370: 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74  db:test-get-test
6380: 6e 61 6d 65 20 74 29 20 22 3a 22 20 28 64 62 3a  name t) ":" (db:
6390: 74 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74  test-get-state t
63a0: 29 22 2f 22 28 64 62 3a 74 65 73 74 2d 67 65 74  )"/"(db:test-get
63b0: 2d 73 74 61 74 75 73 20 74 29 29 29 20 66 61 69  -status t))) fai
63c0: 6c 73 29 20 22 2c 20 22 29 0a 09 09 09 09 20 20  ls) ", ").....  
63d0: 20 20 20 22 2c 20 72 65 6d 6f 76 69 6e 67 20 69     ", removing i
63e0: 74 20 66 72 6f 6d 20 74 6f 2d 64 6f 20 6c 69 73  t from to-do lis
63f0: 74 22 29 0a 09 09 09 28 69 66 20 28 6e 6f 74 20  t")....(if (not 
6400: 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 09  (null? tal))....
6410: 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09 20 20      (begin....  
6420: 20 20 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65      (thread-slee
6430: 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61  p! *global-delta
6440: 2a 29 0a 09 09 09 20 20 20 20 20 20 28 6c 6f 6f  *)....      (loo
6450: 70 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20  p (car tal)(cdr 
6460: 74 61 6c 29 28 63 6f 6e 73 20 68 65 64 20 72 65  tal)(cons hed re
6470: 72 75 6e 73 29 29 29 29 29 0a 09 09 20 20 20 20  runs)))))...    
6480: 20 20 20 28 65 6c 73 65 0a 09 09 09 28 64 65 62     (else....(deb
6490: 75 67 3a 70 72 69 6e 74 20 38 20 22 45 52 52 4f  ug:print 8 "ERRO
64a0: 52 3a 20 4e 6f 20 68 61 6e 64 6c 65 72 20 66 6f  R: No handler fo
64b0: 72 20 74 68 69 73 20 63 6f 6e 64 69 74 69 6f 6e  r this condition
64c0: 2e 22 29 0a 09 09 09 28 74 68 72 65 61 64 2d 73  .")....(thread-s
64d0: 6c 65 65 70 21 20 28 2b 20 31 20 2a 67 6c 6f 62  leep! (+ 1 *glob
64e0: 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09 09 28  al-delta*))....(
64f0: 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61 6c  loop (car newtal
6500: 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20 72 65  )(cdr newtal) re
6510: 72 75 6e 73 29 29 29 29 20 3b 3b 20 45 4e 44 20  runs)))) ;; END 
6520: 4f 46 20 49 46 20 43 41 4e 20 52 55 4e 20 4d 4f  OF IF CAN RUN MO
6530: 52 45 0a 0a 09 09 20 20 20 20 3b 3b 20 69 66 20  RE....    ;; if 
6540: 63 61 6e 27 74 20 72 75 6e 20 6d 6f 72 65 20 6a  can't run more j
6550: 75 73 74 20 6c 6f 6f 70 20 77 69 74 68 20 6e 65  ust loop with ne
6560: 78 74 20 70 6f 73 73 69 62 6c 65 20 74 65 73 74  xt possible test
6570: 0a 09 09 20 20 20 20 28 62 65 67 69 6e 0a 09 09  ...    (begin...
6580: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
6590: 6e 74 2d 69 6e 66 6f 20 34 20 22 70 72 6f 63 65  nt-info 4 "proce
65a0: 73 73 69 6e 67 20 74 68 65 20 63 61 73 65 20 77  ssing the case w
65b0: 69 74 68 20 61 20 6c 61 6d 62 64 61 20 66 6f 72  ith a lambda for
65c0: 20 69 74 65 6d 73 20 6f 72 20 27 68 61 76 65 2d   items or 'have-
65d0: 70 72 6f 63 65 64 75 72 65 2e 20 4d 6f 76 69 6e  procedure. Movin
65e0: 67 20 74 68 72 6f 75 67 68 20 74 68 65 20 71 75  g through the qu
65f0: 65 75 65 20 77 69 74 68 6f 75 74 20 64 72 6f 70  eue without drop
6600: 70 69 6e 67 20 22 20 68 65 64 29 0a 09 09 20 20  ping " hed)...  
6610: 20 20 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65      (thread-slee
6620: 70 21 20 28 2b 20 31 20 2a 67 6c 6f 62 61 6c 2d  p! (+ 1 *global-
6630: 64 65 6c 74 61 2a 29 29 0a 09 09 20 20 20 20 20  delta*))...     
6640: 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74   (loop (car newt
6650: 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20  al)(cdr newtal) 
6660: 72 65 72 75 6e 73 29 29 29 29 29 20 3b 3b 20 45  reruns))))) ;; E
6670: 4e 44 20 4f 46 20 28 6f 72 20 28 70 72 6f 63 65  ND OF (or (proce
6680: 64 75 72 65 3f 20 69 74 65 6d 73 29 28 65 71 3f  dure? items)(eq?
6690: 20 69 74 65 6d 73 20 27 68 61 76 65 2d 70 72 6f   items 'have-pro
66a0: 63 65 64 75 72 65 29 29 0a 09 20 20 20 20 20 0a  cedure))..     .
66b0: 09 20 20 20 20 20 3b 3b 20 74 68 69 73 20 63 61  .     ;; this ca
66c0: 73 65 20 73 68 6f 75 6c 64 20 6e 6f 74 20 68 61  se should not ha
66d0: 70 70 65 6e 2c 20 61 64 64 65 64 20 74 6f 20 68  ppen, added to h
66e0: 65 6c 70 20 63 61 74 63 68 20 61 6e 79 20 62 75  elp catch any bu
66f0: 67 73 0a 09 20 20 20 20 20 28 28 61 6e 64 20 28  gs..     ((and (
6700: 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 69 74 65  list? items) ite
6710: 6d 64 61 74 29 0a 09 20 20 20 20 20 20 28 64 65  mdat)..      (de
6720: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52  bug:print 0 "ERR
6730: 4f 52 3a 20 53 68 6f 75 6c 64 20 6e 6f 74 20 68  OR: Should not h
6740: 61 76 65 20 61 20 6c 69 73 74 20 6f 66 20 69 74  ave a list of it
6750: 65 6d 73 20 69 6e 20 61 20 74 65 73 74 20 61 6e  ems in a test an
6760: 64 20 74 68 65 20 69 74 65 6d 73 70 61 74 68 20  d the itemspath 
6770: 73 65 74 20 2d 20 70 6c 65 61 73 65 20 72 65 70  set - please rep
6780: 6f 72 74 20 74 68 69 73 22 29 0a 09 20 20 20 20  ort this")..    
6790: 20 20 28 65 78 69 74 20 31 29 29 0a 09 20 20 20    (exit 1))..   
67a0: 20 20 28 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72    ((not (null? r
67b0: 65 72 75 6e 73 29 29 0a 09 20 20 20 20 20 20 28  eruns))..      (
67c0: 6c 65 74 2a 20 28 28 6e 65 77 6c 73 74 20 28 74  let* ((newlst (t
67d0: 65 73 74 73 3a 66 69 6c 74 65 72 2d 6e 6f 6e 2d  ests:filter-non-
67e0: 72 75 6e 6e 61 62 6c 65 20 72 75 6e 2d 69 64 20  runnable run-id 
67f0: 74 61 6c 20 74 65 73 74 2d 72 65 63 6f 72 64 73  tal test-records
6800: 29 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f 74 20 46  )) ;; i.e. not F
6810: 41 49 4c 2c 20 57 41 49 56 45 44 2c 20 49 4e 43  AIL, WAIVED, INC
6820: 4f 4d 50 4c 45 54 45 2c 20 50 41 53 53 2c 20 4b  OMPLETE, PASS, K
6830: 49 4c 4c 45 44 2c 0a 09 09 20 20 20 20 20 28 6a  ILLED,...     (j
6840: 75 6e 6b 65 64 20 28 6c 73 65 74 2d 64 69 66 66  unked (lset-diff
6850: 65 72 65 6e 63 65 20 65 71 75 61 6c 3f 20 74 61  erence equal? ta
6860: 6c 20 6e 65 77 6c 73 74 29 29 29 0a 09 09 28 64  l newlst)))...(d
6870: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
6880: 34 20 22 66 75 6c 6c 20 64 72 6f 70 20 74 68 72  4 "full drop thr
6890: 6f 75 67 68 2c 20 69 66 20 72 65 72 75 6e 73 20  ough, if reruns 
68a0: 69 73 20 6c 65 73 73 20 74 68 61 6e 20 31 30 30  is less than 100
68b0: 20 77 65 20 77 69 6c 6c 20 66 6f 72 63 65 20 72   we will force r
68c0: 65 74 72 79 20 74 68 65 6d 2c 20 72 65 72 75 6e  etry them, rerun
68d0: 73 3d 22 20 72 65 72 75 6e 73 20 22 2c 20 74 61  s=" reruns ", ta
68e0: 6c 3d 22 20 74 61 6c 29 0a 09 09 28 69 66 20 28  l=" tal)...(if (
68f0: 3c 20 6e 75 6d 2d 72 65 74 72 69 65 73 20 6d 61  < num-retries ma
6900: 78 2d 72 65 74 72 69 65 73 29 0a 09 09 20 20 20  x-retries)...   
6910: 20 28 73 65 74 21 20 6e 65 77 6c 73 74 20 28 61   (set! newlst (a
6920: 70 70 65 6e 64 20 72 65 72 75 6e 73 20 6e 65 77  ppend reruns new
6930: 6c 73 74 29 29 29 0a 09 09 28 73 65 74 21 20 6e  lst)))...(set! n
6940: 75 6d 2d 72 65 74 72 69 65 73 20 28 2b 20 6e 75  um-retries (+ nu
6950: 6d 2d 72 65 74 72 69 65 73 20 31 29 29 0a 09 09  m-retries 1))...
6960: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28  (thread-sleep! (
6970: 2b 20 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74  + 1 *global-delt
6980: 61 2a 29 29 0a 09 09 28 69 66 20 28 6e 6f 74 20  a*))...(if (not 
6990: 28 6e 75 6c 6c 3f 20 6e 65 77 6c 73 74 29 29 0a  (null? newlst)).
69a0: 09 09 20 20 20 20 3b 3b 20 73 69 6e 63 65 20 72  ..    ;; since r
69b0: 65 72 75 6e 73 20 68 61 76 65 20 62 65 65 6e 20  eruns have been 
69c0: 74 61 63 6b 65 64 20 6f 6e 20 74 6f 20 6e 65 77  tacked on to new
69d0: 6c 73 74 20 63 72 65 61 74 65 20 6e 65 77 20 72  lst create new r
69e0: 65 72 75 6e 73 20 66 72 6f 6d 20 6a 75 6e 6b 65  eruns from junke
69f0: 64 0a 09 09 20 20 20 20 28 6c 6f 6f 70 20 28 63  d...    (loop (c
6a00: 61 72 20 6e 65 77 6c 73 74 29 28 63 64 72 20 6e  ar newlst)(cdr n
6a10: 65 77 6c 73 74 29 28 64 65 6c 65 74 65 2d 64 75  ewlst)(delete-du
6a20: 70 6c 69 63 61 74 65 73 20 6a 75 6e 6b 65 64 29  plicates junked)
6a30: 29 29 29 29 0a 09 20 20 20 20 20 28 28 6e 6f 74  ))))..     ((not
6a40: 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 20   (null? tal)).. 
6a50: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
6a60: 74 2d 69 6e 66 6f 20 34 20 22 49 27 6d 20 70 72  t-info 4 "I'm pr
6a70: 65 74 74 79 20 73 75 72 65 20 49 20 73 68 6f 75  etty sure I shou
6a80: 6c 64 6e 27 74 20 67 65 74 20 68 65 72 65 2e 22  ldn't get here."
6a90: 29 29 0a 09 20 20 20 20 20 28 65 6c 73 65 0a 09  ))..     (else..
6aa0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
6ab0: 6e 74 2d 69 6e 66 6f 20 34 20 22 45 78 69 74 69  nt-info 4 "Exiti
6ac0: 6e 67 20 6c 6f 6f 70 20 77 69 74 68 2e 2e 2e 5c  ng loop with...\
6ad0: 6e 20 20 68 65 64 3d 22 20 68 65 64 20 22 5c 6e  n  hed=" hed "\n
6ae0: 20 20 74 61 6c 3d 22 20 74 61 6c 20 22 5c 6e 20    tal=" tal "\n 
6af0: 20 72 65 72 75 6e 73 3d 22 20 72 65 72 75 6e 73   reruns=" reruns
6b00: 29 29 0a 09 20 20 20 20 20 29 29 29 29 20 3b 3b  ))..     )))) ;;
6b10: 20 4c 45 54 2a 20 28 28 74 65 73 74 2d 72 65 63   LET* ((test-rec
6b20: 6f 72 64 0a 0a 20 20 20 20 3b 3b 20 77 65 20 67  ord..    ;; we g
6b30: 65 74 20 68 65 72 65 20 6f 6e 20 22 64 72 6f 70  et here on "drop
6b40: 20 74 68 72 6f 75 67 68 22 20 2d 20 6c 6f 6f 70   through" - loop
6b50: 20 66 6f 72 20 6e 65 78 74 20 74 65 73 74 20 69   for next test i
6b60: 6e 20 71 75 65 75 65 0a 20 20 20 20 3b 3b 20 46  n queue.    ;; F
6b70: 49 58 4d 45 21 21 21 21 20 54 48 49 53 20 53 48  IXME!!!! THIS SH
6b80: 4f 55 4c 44 20 4e 4f 54 20 52 45 51 55 49 52 45  OULD NOT REQUIRE
6b90: 20 41 4e 20 45 58 49 54 21 21 21 21 21 21 21 0a   AN EXIT!!!!!!!.
6ba0: 20 20 20 20 0a 20 20 20 20 28 64 65 62 75 67 3a      .    (debug:
6bb0: 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 41 6c  print-info 1 "Al
6bc0: 6c 20 74 65 73 74 73 20 6c 61 75 6e 63 68 65 64  l tests launched
6bd0: 22 29 0a 20 20 20 20 28 74 68 72 65 61 64 2d 73  ").    (thread-s
6be0: 6c 65 65 70 21 20 30 2e 35 29 0a 20 20 20 20 3b  leep! 0.5).    ;
6bf0: 3b 20 46 49 58 4d 45 21 20 54 68 69 73 20 68 61  ; FIXME! This ha
6c00: 72 73 68 20 65 78 69 74 20 73 68 6f 75 6c 64 20  rsh exit should 
6c10: 6e 6f 74 20 62 65 20 6e 65 63 65 73 73 61 72 79  not be necessary
6c20: 2e 2e 2e 2e 0a 20 20 20 20 3b 3b 20 28 69 66 20  .....    ;; (if 
6c30: 28 6e 6f 74 20 2a 72 75 6e 72 65 6d 6f 74 65 2a  (not *runremote*
6c40: 29 28 65 78 69 74 29 29 20 3b 3b 20 0a 20 20 20  )(exit)) ;; .   
6c50: 20 23 66 29 29 20 3b 3b 20 72 65 74 75 72 6e 20   #f)) ;; return 
6c60: 61 20 23 66 20 61 73 20 61 20 68 69 6e 74 20 74  a #f as a hint t
6c70: 68 61 74 20 77 65 20 61 72 65 20 64 6f 6e 65 0a  hat we are done.
6c80: 20 20 3b 3b 20 48 65 72 65 20 77 65 20 6e 65 65    ;; Here we nee
6c90: 64 20 74 6f 20 63 68 65 63 6b 20 74 68 61 74 20  d to check that 
6ca0: 61 6c 6c 20 74 68 65 20 74 65 73 74 73 20 72 65  all the tests re
6cb0: 6d 61 69 6e 69 6e 67 20 74 6f 20 62 65 20 72 75  maining to be ru
6cc0: 6e 20 61 72 65 20 65 6c 69 67 69 62 6c 65 20 74  n are eligible t
6cd0: 6f 20 72 75 6e 0a 20 20 3b 3b 20 61 6e 64 20 61  o run.  ;; and a
6ce0: 72 65 20 6e 6f 74 20 62 6c 6f 63 6b 65 64 20 62  re not blocked b
6cf0: 79 20 66 61 69 6c 65 64 0a 20 20 0a 0a 3b 3b 20  y failed.  ..;; 
6d00: 70 61 72 65 6e 74 2d 74 65 73 74 20 69 73 20 74  parent-test is t
6d10: 68 65 72 65 20 61 73 20 61 20 70 6c 61 63 65 68  here as a placeh
6d20: 6f 6c 64 65 72 20 66 6f 72 20 77 68 65 6e 20 70  older for when p
6d30: 61 72 65 6e 74 2d 74 65 73 74 73 20 63 61 6e 20  arent-tests can 
6d40: 62 65 20 72 75 6e 20 61 73 20 61 20 73 65 74 75  be run as a setu
6d50: 70 20 73 74 65 70 0a 28 64 65 66 69 6e 65 20 28  p step.(define (
6d60: 72 75 6e 3a 74 65 73 74 20 72 75 6e 2d 69 64 20  run:test run-id 
6d70: 72 75 6e 6e 61 6d 65 20 6b 65 79 76 61 6c 6c 73  runname keyvalls
6d80: 74 20 74 65 73 74 2d 72 65 63 6f 72 64 20 66 6c  t test-record fl
6d90: 61 67 73 20 70 61 72 65 6e 74 2d 74 65 73 74 29  ags parent-test)
6da0: 0a 20 20 3b 3b 20 41 6c 6c 20 74 68 65 73 65 20  .  ;; All these 
6db0: 76 61 72 73 20 6d 69 67 68 74 20 62 65 20 72 65  vars might be re
6dc0: 66 65 72 65 6e 63 65 64 20 62 79 20 74 68 65 20  ferenced by the 
6dd0: 74 65 73 74 63 6f 6e 66 69 67 20 66 69 6c 65 20  testconfig file 
6de0: 72 65 61 64 65 72 0a 20 20 28 6c 65 74 2a 20 28  reader.  (let* (
6df0: 28 74 65 73 74 2d 6e 61 6d 65 20 20 20 20 28 74  (test-name    (t
6e00: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67  ests:testqueue-g
6e10: 65 74 2d 74 65 73 74 6e 61 6d 65 20 20 20 74 65  et-testname   te
6e20: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74  st-record)).. (t
6e30: 65 73 74 2d 77 61 69 74 6f 6e 73 20 28 74 65 73  est-waitons (tes
6e40: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
6e50: 2d 77 61 69 74 6f 6e 73 20 20 20 20 74 65 73 74  -waitons    test
6e60: 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65 73  -record)).. (tes
6e70: 74 2d 63 6f 6e 66 20 20 20 20 28 74 65 73 74 73  t-conf    (tests
6e80: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74  :testqueue-get-t
6e90: 65 73 74 63 6f 6e 66 69 67 20 74 65 73 74 2d 72  estconfig test-r
6ea0: 65 63 6f 72 64 29 29 0a 09 20 28 69 74 65 6d 64  ecord)).. (itemd
6eb0: 61 74 20 20 20 20 20 20 28 74 65 73 74 73 3a 74  at      (tests:t
6ec0: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65  estqueue-get-ite
6ed0: 6d 64 61 74 20 20 20 20 74 65 73 74 2d 72 65 63  mdat    test-rec
6ee0: 6f 72 64 29 29 0a 09 20 28 74 65 73 74 2d 70 61  ord)).. (test-pa
6ef0: 74 68 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f 70  th    (conc *top
6f00: 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 20  path* "/tests/" 
6f10: 74 65 73 74 2d 6e 61 6d 65 29 29 20 3b 3b 20 63  test-name)) ;; c
6f20: 6f 75 6c 64 20 75 73 65 20 74 65 73 74 73 3a 67  ould use tests:g
6f30: 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 68 65  et-testconfig he
6f40: 72 65 20 2e 2e 2e 0a 09 20 28 66 6f 72 63 65 20  re ..... (force 
6f50: 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 62         (hash-tab
6f60: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66  le-ref/default f
6f70: 6c 61 67 73 20 22 2d 66 6f 72 63 65 22 20 23 66  lags "-force" #f
6f80: 29 29 0a 09 20 28 72 65 72 75 6e 20 20 20 20 20  )).. (rerun     
6f90: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72     (hash-table-r
6fa0: 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73  ef/default flags
6fb0: 20 22 2d 72 65 72 75 6e 22 20 23 66 29 29 0a 09   "-rerun" #f))..
6fc0: 20 28 6b 65 65 70 67 6f 69 6e 67 20 20 20 20 28   (keepgoing    (
6fd0: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64  hash-table-ref/d
6fe0: 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 6b  efault flags "-k
6ff0: 65 65 70 67 6f 69 6e 67 22 20 23 66 29 29 0a 09  eepgoing" #f))..
7000: 20 28 69 74 65 6d 2d 70 61 74 68 20 20 20 20 20   (item-path     
7010: 22 22 29 0a 09 20 28 64 62 20 20 20 20 20 20 20  "").. (db       
7020: 20 20 20 20 23 66 29 29 0a 20 20 20 20 28 64 65      #f)).    (de
7030: 62 75 67 3a 70 72 69 6e 74 20 34 0a 09 09 20 22  bug:print 4... "
7040: 74 65 73 74 2d 63 6f 6e 66 69 67 3a 20 22 20 28  test-config: " (
7050: 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61 6c 69 73  hash-table->alis
7060: 74 20 74 65 73 74 2d 63 6f 6e 66 29 0a 09 09 20  t test-conf)... 
7070: 22 5c 6e 20 20 20 69 74 65 6d 64 61 74 3a 20 22  "\n   itemdat: "
7080: 20 69 74 65 6d 64 61 74 0a 09 09 20 29 0a 20 20   itemdat... ).  
7090: 20 20 3b 3b 20 73 65 74 74 69 6e 67 20 69 74 65    ;; setting ite
70a0: 6d 64 61 74 20 74 6f 20 61 20 6c 69 73 74 20 69  mdat to a list i
70b0: 66 20 69 74 20 69 73 20 23 66 0a 20 20 20 20 28  f it is #f.    (
70c0: 69 66 20 28 6e 6f 74 20 69 74 65 6d 64 61 74 29  if (not itemdat)
70d0: 28 73 65 74 21 20 69 74 65 6d 64 61 74 20 27 28  (set! itemdat '(
70e0: 29 29 29 0a 20 20 20 20 28 73 65 74 21 20 69 74  ))).    (set! it
70f0: 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69  em-path (item-li
7100: 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74  st->path itemdat
7110: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72  )).    (debug:pr
7120: 69 6e 74 20 32 20 22 41 74 74 65 6d 70 74 69 6e  int 2 "Attemptin
7130: 67 20 74 6f 20 6c 61 75 6e 63 68 20 74 65 73 74  g to launch test
7140: 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 28 69 66   " test-name (if
7150: 20 28 65 71 75 61 6c 3f 20 69 74 65 6d 2d 70 61   (equal? item-pa
7160: 74 68 20 22 2f 22 29 20 22 2f 22 20 69 74 65 6d  th "/") "/" item
7170: 2d 70 61 74 68 29 29 0a 20 20 20 20 28 73 65 74  -path)).    (set
7180: 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d  env "MT_TEST_NAM
7190: 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b  E" test-name) ;;
71a0: 20 0a 20 20 20 20 28 73 65 74 65 6e 76 20 22 4d   .    (setenv "M
71b0: 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20 72 75 6e  T_RUNNAME"   run
71c0: 6e 61 6d 65 29 0a 20 20 20 20 28 73 65 74 2d 6d  name).    (set-m
71d0: 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73  egatest-env-vars
71e0: 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73   run-id) ;; thes
71f0: 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64 20  e may be needed 
7200: 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e 67  by the launching
7210: 20 70 72 6f 63 65 73 73 0a 20 20 20 20 28 63 68   process.    (ch
7220: 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 79 20 2a  ange-directory *
7230: 74 6f 70 70 61 74 68 2a 29 0a 0a 20 20 20 20 3b  toppath*)..    ;
7240: 3b 20 48 65 72 65 20 69 73 20 77 68 65 72 65 20  ; Here is where 
7250: 74 68 65 20 74 65 73 74 5f 6d 65 74 61 20 74 61  the test_meta ta
7260: 62 6c 65 20 69 73 20 62 65 73 74 20 75 70 64 61  ble is best upda
7270: 74 65 64 0a 20 20 20 20 3b 3b 20 59 65 73 2c 20  ted.    ;; Yes, 
7280: 61 6e 6f 74 68 65 72 20 75 73 65 20 6f 66 20 61  another use of a
7290: 20 67 6c 6f 62 61 6c 20 66 6f 72 20 63 61 63 68   global for cach
72a0: 69 6e 67 2e 20 4e 65 65 64 20 61 20 62 65 74 74  ing. Need a bett
72b0: 65 72 20 77 61 79 3f 0a 20 20 20 20 28 69 66 20  er way?.    (if 
72c0: 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 62 6c 65  (not (hash-table
72d0: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 2a 74 65  -ref/default *te
72e0: 73 74 2d 6d 65 74 61 2d 75 70 64 61 74 65 64 2a  st-meta-updated*
72f0: 20 74 65 73 74 2d 6e 61 6d 65 20 23 66 29 29 0a   test-name #f)).
7300: 20 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09          (begin..
7310: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73     (hash-table-s
7320: 65 74 21 20 2a 74 65 73 74 2d 6d 65 74 61 2d 75  et! *test-meta-u
7330: 70 64 61 74 65 64 2a 20 74 65 73 74 2d 6e 61 6d  pdated* test-nam
7340: 65 20 23 74 29 0a 20 20 20 20 20 20 20 20 20 20  e #t).          
7350: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
7360: 20 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73   runs:update-tes
7370: 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74 2d 6e  t_meta db test-n
7380: 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 29 29  ame test-conf)))
7390: 0a 20 20 20 20 0a 20 20 20 20 3b 3b 20 28 6c 61  .    .    ;; (la
73a0: 6d 62 64 61 20 28 69 74 65 6d 64 61 74 29 20 3b  mbda (itemdat) ;
73b0: 3b 3b 20 28 28 72 69 70 65 6e 65 73 73 20 22 6f  ;; ((ripeness "o
73c0: 76 65 72 72 69 70 65 22 29 20 28 74 65 6d 70 65  verripe") (tempe
73d0: 72 61 74 75 72 65 20 22 63 6f 6f 6c 22 29 20 28  rature "cool") (
73e0: 73 65 61 73 6f 6e 20 22 73 75 6d 6d 65 72 22 29  season "summer")
73f0: 29 0a 20 20 20 20 28 6c 65 74 2a 20 28 28 6e 65  ).    (let* ((ne
7400: 77 2d 74 65 73 74 2d 70 61 74 68 20 28 73 74 72  w-test-path (str
7410: 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20  ing-intersperse 
7420: 28 63 6f 6e 73 20 74 65 73 74 2d 70 61 74 68 20  (cons test-path 
7430: 28 6d 61 70 20 63 61 64 72 20 69 74 65 6d 64 61  (map cadr itemda
7440: 74 29 29 20 22 2f 22 29 29 0a 09 20 20 20 28 6e  t)) "/"))..   (n
7450: 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 28 69 66  ew-test-name (if
7460: 20 28 65 71 75 61 6c 3f 20 69 74 65 6d 2d 70 61   (equal? item-pa
7470: 74 68 20 22 22 29 20 74 65 73 74 2d 6e 61 6d 65  th "") test-name
7480: 20 28 63 6f 6e 63 20 74 65 73 74 2d 6e 61 6d 65   (conc test-name
7490: 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29   "/" item-path))
74a0: 29 20 3b 3b 20 6a 75 73 74 20 6e 65 65 64 20 69  ) ;; just need i
74b0: 74 20 74 6f 20 62 65 20 75 6e 69 71 75 65 0a 09  t to be unique..
74c0: 20 20 20 28 74 65 73 74 2d 69 64 20 20 20 20 20     (test-id     
74d0: 20 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75    (cdb:remote-ru
74e0: 6e 20 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 64  n db:get-test-id
74f0: 20 23 66 20 20 72 75 6e 2d 69 64 20 74 65 73 74   #f  run-id test
7500: 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29  -name item-path)
7510: 29 0a 09 20 20 20 28 74 65 73 74 64 61 74 20 20  )..   (testdat  
7520: 20 20 20 20 20 28 63 64 62 3a 67 65 74 2d 74 65       (cdb:get-te
7530: 73 74 2d 69 6e 66 6f 2d 62 79 2d 69 64 20 2a 72  st-info-by-id *r
7540: 75 6e 72 65 6d 6f 74 65 2a 20 74 65 73 74 2d 69  unremote* test-i
7550: 64 29 29 29 0a 20 20 20 20 20 20 28 69 66 20 28  d))).      (if (
7560: 6e 6f 74 20 74 65 73 74 64 61 74 29 0a 09 20 20  not testdat)..  
7570: 28 62 65 67 69 6e 0a 09 20 20 20 20 3b 3b 20 65  (begin..    ;; e
7580: 6e 73 75 72 65 20 74 68 61 74 20 74 68 65 20 70  nsure that the p
7590: 61 74 68 20 65 78 69 73 74 73 20 62 65 66 6f 72  ath exists befor
75a0: 65 20 72 65 67 69 73 74 65 72 69 6e 67 20 74 68  e registering th
75b0: 65 20 74 65 73 74 0a 09 20 20 20 20 3b 3b 20 4e  e test..    ;; N
75c0: 4f 50 45 3a 20 43 61 6e 6e 6f 74 21 20 44 6f 6e  OPE: Cannot! Don
75d0: 27 74 20 6b 6e 6f 77 20 79 65 74 20 77 68 69 63  't know yet whic
75e0: 68 20 64 69 73 6b 20 61 72 65 61 20 77 69 6c 6c  h disk area will
75f0: 20 62 65 20 61 73 73 69 67 6e 65 64 2e 2e 2e 2e   be assigned....
7600: 0a 09 20 20 20 20 3b 3b 20 28 73 79 73 74 65 6d  ..    ;; (system
7610: 20 28 63 6f 6e 63 20 22 6d 6b 64 69 72 20 2d 70   (conc "mkdir -p
7620: 20 22 20 6e 65 77 2d 74 65 73 74 2d 70 61 74 68   " new-test-path
7630: 29 29 0a 09 20 20 20 20 3b 3b 0a 09 20 20 20 20  ))..    ;;..    
7640: 3b 3b 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f  ;; (open-run-clo
7650: 73 65 20 74 65 73 74 73 3a 72 65 67 69 73 74 65  se tests:registe
7660: 72 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64  r-test db run-id
7670: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d   test-name item-
7680: 70 61 74 68 29 0a 09 20 20 20 20 3b 3b 0a 09 20  path)..    ;;.. 
7690: 20 20 20 3b 3b 20 4e 42 2f 2f 20 66 6f 72 20 74     ;; NB// for t
76a0: 68 65 20 61 62 6f 76 65 20 6c 69 6e 65 2e 20 49  he above line. I
76b0: 20 77 61 6e 74 20 74 68 65 20 74 65 73 74 20 74   want the test t
76c0: 6f 20 62 65 20 72 65 67 69 73 74 65 72 65 64 20  o be registered 
76d0: 6c 6f 6e 67 20 62 65 66 6f 72 65 20 74 68 69 73  long before this
76e0: 20 72 6f 75 74 69 6e 65 20 67 65 74 73 20 63 61   routine gets ca
76f0: 6c 6c 65 64 21 0a 09 20 20 20 20 3b 3b 0a 09 20  lled!..    ;;.. 
7700: 20 20 20 28 73 65 74 21 20 74 65 73 74 2d 69 64     (set! test-id
7710: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
7720: 20 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 64 20   db:get-test-id 
7730: 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e  db run-id test-n
7740: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29 0a  ame item-path)).
7750: 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20 74 65  .    (if (not te
7760: 73 74 2d 69 64 29 0a 09 09 28 62 65 67 69 6e 0a  st-id)...(begin.
7770: 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ..  (debug:print
7780: 20 32 20 22 57 41 52 4e 3a 20 54 65 73 74 20 6e   2 "WARN: Test n
7790: 6f 74 20 70 72 65 2d 63 72 65 61 74 65 64 3f 20  ot pre-created? 
77a0: 74 65 73 74 2d 6e 61 6d 65 3d 22 20 74 65 73 74  test-name=" test
77b0: 2d 6e 61 6d 65 20 22 2c 20 69 74 65 6d 2d 70 61  -name ", item-pa
77c0: 74 68 3d 22 20 69 74 65 6d 2d 70 61 74 68 20 22  th=" item-path "
77d0: 2c 20 72 75 6e 2d 69 64 3d 22 20 72 75 6e 2d 69  , run-id=" run-i
77e0: 64 29 0a 09 09 20 20 28 6f 70 65 6e 2d 72 75 6e  d)...  (open-run
77f0: 2d 63 6c 6f 73 65 20 64 62 3a 74 65 73 74 73 2d  -close db:tests-
7800: 72 65 67 69 73 74 65 72 2d 74 65 73 74 20 23 66  register-test #f
7810: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d   run-id test-nam
7820: 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 09 20  e item-path)... 
7830: 20 28 73 65 74 21 20 74 65 73 74 2d 69 64 20 28   (set! test-id (
7840: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64  open-run-close d
7850: 62 3a 67 65 74 2d 74 65 73 74 2d 69 64 20 64 62  b:get-test-id db
7860: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d   run-id test-nam
7870: 65 20 69 74 65 6d 2d 70 61 74 68 29 29 29 29 0a  e item-path)))).
7880: 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  .    (debug:prin
7890: 74 2d 69 6e 66 6f 20 34 20 22 74 65 73 74 2d 69  t-info 4 "test-i
78a0: 64 3d 22 20 74 65 73 74 2d 69 64 20 22 2c 20 72  d=" test-id ", r
78b0: 75 6e 2d 69 64 3d 22 20 72 75 6e 2d 69 64 20 22  un-id=" run-id "
78c0: 2c 20 74 65 73 74 2d 6e 61 6d 65 3d 22 20 74 65  , test-name=" te
78d0: 73 74 2d 6e 61 6d 65 20 22 2c 20 69 74 65 6d 2d  st-name ", item-
78e0: 70 61 74 68 3d 5c 22 22 20 69 74 65 6d 2d 70 61  path=\"" item-pa
78f0: 74 68 20 22 5c 22 22 29 0a 09 20 20 20 20 28 73  th "\"")..    (s
7900: 65 74 21 20 74 65 73 74 64 61 74 20 28 63 64 62  et! testdat (cdb
7910: 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 2d 62  :get-test-info-b
7920: 79 2d 69 64 20 2a 72 75 6e 72 65 6d 6f 74 65 2a  y-id *runremote*
7930: 20 74 65 73 74 2d 69 64 29 29 29 29 0a 20 20 20   test-id)))).   
7940: 20 20 20 28 73 65 74 21 20 74 65 73 74 2d 69 64     (set! test-id
7950: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64   (db:test-get-id
7960: 20 74 65 73 74 64 61 74 29 29 0a 20 20 20 20 20   testdat)).     
7970: 20 28 63 68 61 6e 67 65 2d 64 69 72 65 63 74 6f   (change-directo
7980: 72 79 20 74 65 73 74 2d 70 61 74 68 29 0a 20 20  ry test-path).  
7990: 20 20 20 20 28 63 61 73 65 20 28 69 66 20 66 6f      (case (if fo
79a0: 72 63 65 20 3b 3b 20 28 61 72 67 73 3a 67 65 74  rce ;; (args:get
79b0: 2d 61 72 67 20 22 2d 66 6f 72 63 65 22 29 0a 09  -arg "-force")..
79c0: 09 27 4e 4f 54 5f 53 54 41 52 54 45 44 0a 09 09  .'NOT_STARTED...
79d0: 28 69 66 20 74 65 73 74 64 61 74 0a 09 09 20 20  (if testdat...  
79e0: 20 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62 6f    (string->symbo
79f0: 6c 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  l (test:get-stat
7a00: 65 20 74 65 73 74 64 61 74 29 29 0a 09 09 20 20  e testdat))...  
7a10: 20 20 27 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73    'failed-to-ins
7a20: 65 72 74 29 29 0a 09 28 28 66 61 69 6c 65 64 2d  ert))..((failed-
7a30: 74 6f 2d 69 6e 73 65 72 74 29 0a 09 20 28 64 65  to-insert).. (de
7a40: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52  bug:print 0 "ERR
7a50: 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 69 6e  OR: Failed to in
7a60: 73 65 72 74 20 74 68 65 20 72 65 63 6f 72 64 20  sert the record 
7a70: 69 6e 74 6f 20 74 68 65 20 64 62 22 29 29 0a 09  into the db"))..
7a80: 28 28 4e 4f 54 5f 53 54 41 52 54 45 44 20 43 4f  ((NOT_STARTED CO
7a90: 4d 50 4c 45 54 45 44 20 44 45 4c 45 54 45 44 29  MPLETED DELETED)
7aa0: 0a 09 20 28 6c 65 74 20 28 28 72 75 6e 66 6c 61  .. (let ((runfla
7ab0: 67 20 23 66 29 29 0a 09 20 20 20 28 63 6f 6e 64  g #f))..   (cond
7ac0: 0a 09 20 20 20 20 3b 3b 20 2d 66 6f 72 63 65 2c  ..    ;; -force,
7ad0: 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77   run no matter w
7ae0: 68 61 74 0a 09 20 20 20 20 28 66 6f 72 63 65 20  hat..    (force 
7af0: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74  (set! runflag #t
7b00: 29 29 0a 09 20 20 20 20 3b 3b 20 4e 4f 54 5f 53  ))..    ;; NOT_S
7b10: 54 41 52 54 45 44 2c 20 72 75 6e 20 6e 6f 20 6d  TARTED, run no m
7b20: 61 74 74 65 72 20 77 68 61 74 0a 09 20 20 20 20  atter what..    
7b30: 28 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67  ((member (test:g
7b40: 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74  et-state testdat
7b50: 29 20 27 28 22 44 45 4c 45 54 45 44 22 20 22 4e  ) '("DELETED" "N
7b60: 4f 54 5f 53 54 41 52 54 45 44 22 29 29 28 73 65  OT_STARTED"))(se
7b70: 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a  t! runflag #t)).
7b80: 09 20 20 20 20 3b 3b 20 6e 6f 74 20 2d 72 65 72  .    ;; not -rer
7b90: 75 6e 20 61 6e 64 20 50 41 53 53 2c 20 57 41 52  un and PASS, WAR
7ba0: 4e 20 6f 72 20 43 48 45 43 4b 2c 20 64 6f 20 6e  N or CHECK, do n
7bb0: 6f 20 72 75 6e 0a 09 20 20 20 20 28 28 61 6e 64  o run..    ((and
7bc0: 20 28 6f 72 20 28 6e 6f 74 20 72 65 72 75 6e 29   (or (not rerun)
7bd0: 0a 09 09 20 20 20 20 20 20 6b 65 65 70 67 6f 69  ...      keepgoi
7be0: 6e 67 29 0a 09 09 20 20 3b 3b 20 52 65 71 75 69  ng)...  ;; Requi
7bf0: 72 65 20 74 6f 20 66 6f 72 63 65 20 72 65 2d 72  re to force re-r
7c00: 75 6e 20 66 6f 72 20 43 4f 4d 50 4c 45 54 45 44  un for COMPLETED
7c10: 20 6f 72 20 2a 61 6e 79 74 68 69 6e 67 2a 20 2b   or *anything* +
7c20: 20 50 41 53 53 2c 57 41 52 4e 20 6f 72 20 43 48   PASS,WARN or CH
7c30: 45 43 4b 0a 09 09 20 20 28 6f 72 20 28 6d 65 6d  ECK...  (or (mem
7c40: 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74  ber (test:get-st
7c50: 61 74 75 73 20 74 65 73 74 64 61 74 29 20 27 28  atus testdat) '(
7c60: 22 50 41 53 53 22 20 22 57 41 52 4e 22 20 22 43  "PASS" "WARN" "C
7c70: 48 45 43 4b 22 29 29 0a 09 09 20 20 20 20 20 20  HECK"))...      
7c80: 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65  (member (test:ge
7c90: 74 2d 73 74 61 74 65 20 20 74 65 73 74 64 61 74  t-state  testdat
7ca0: 29 20 27 28 22 43 4f 4d 50 4c 45 54 45 44 22 29  ) '("COMPLETED")
7cb0: 29 29 29 20 0a 09 20 20 20 20 20 28 64 65 62 75  ))) ..     (debu
7cc0: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 32 20 22  g:print-info 2 "
7cd0: 72 75 6e 6e 69 6e 67 20 74 65 73 74 20 22 20 74  running test " t
7ce0: 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65  est-name "/" ite
7cf0: 6d 2d 70 61 74 68 20 22 20 73 75 70 70 72 65 73  m-path " suppres
7d00: 73 65 64 20 61 73 20 69 74 20 69 73 20 22 20 28  sed as it is " (
7d10: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74  test:get-state t
7d20: 65 73 74 64 61 74 29 20 22 20 61 6e 64 20 22 20  estdat) " and " 
7d30: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73  (test:get-status
7d40: 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20   testdat))..    
7d50: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23   (set! runflag #
7d60: 66 29 29 0a 09 20 20 20 20 3b 3b 20 2d 72 65 72  f))..    ;; -rer
7d70: 75 6e 20 61 6e 64 20 73 74 61 74 75 73 20 69 73  un and status is
7d80: 20 6f 6e 65 20 6f 66 20 74 68 65 20 73 70 65 63   one of the spec
7d90: 69 66 65 64 2c 20 72 75 6e 20 69 74 0a 09 20 20  ifed, run it..  
7da0: 20 20 28 28 61 6e 64 20 72 65 72 75 6e 0a 09 09    ((and rerun...
7db0: 20 20 28 6c 65 74 2a 20 28 28 72 65 72 75 6e 6c    (let* ((rerunl
7dc0: 73 74 20 20 20 28 73 74 72 69 6e 67 2d 73 70 6c  st   (string-spl
7dd0: 69 74 20 72 65 72 75 6e 20 22 2c 22 29 29 0a 09  it rerun ","))..
7de0: 09 09 20 28 6d 75 73 74 2d 72 65 72 75 6e 20 28  .. (must-rerun (
7df0: 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74  member (test:get
7e00: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29  -status testdat)
7e10: 20 72 65 72 75 6e 6c 73 74 29 29 29 0a 09 09 20   rerunlst)))... 
7e20: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d     (debug:print-
7e30: 69 6e 66 6f 20 33 20 22 2d 72 65 72 75 6e 20 6c  info 3 "-rerun l
7e40: 69 73 74 3a 20 22 20 72 65 72 75 6e 20 22 2c 20  ist: " rerun ", 
7e50: 74 65 73 74 2d 73 74 61 74 75 73 3a 20 22 20 28  test-status: " (
7e60: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20  test:get-status 
7e70: 74 65 73 74 64 61 74 29 22 2c 20 6d 75 73 74 2d  testdat)", must-
7e80: 72 65 72 75 6e 3a 20 22 20 6d 75 73 74 2d 72 65  rerun: " must-re
7e90: 72 75 6e 29 0a 09 09 20 20 20 20 6d 75 73 74 2d  run)...    must-
7ea0: 72 65 72 75 6e 29 29 0a 09 20 20 20 20 20 28 64  rerun))..     (d
7eb0: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
7ec0: 32 20 22 52 65 72 75 6e 20 66 6f 72 63 65 64 20  2 "Rerun forced 
7ed0: 66 6f 72 20 74 65 73 74 20 22 20 74 65 73 74 2d  for test " test-
7ee0: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61  name "/" item-pa
7ef0: 74 68 29 0a 09 20 20 20 20 20 28 73 65 74 21 20  th)..     (set! 
7f00: 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20  runflag #t))..  
7f10: 20 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 2c    ;; -keepgoing,
7f20: 20 64 6f 20 6e 6f 74 20 72 65 72 75 6e 20 46 41   do not rerun FA
7f30: 49 4c 0a 09 20 20 20 20 28 28 61 6e 64 20 6b 65  IL..    ((and ke
7f40: 65 70 67 6f 69 6e 67 0a 09 09 20 20 28 6d 65 6d  epgoing...  (mem
7f50: 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74  ber (test:get-st
7f60: 61 74 75 73 20 74 65 73 74 64 61 74 29 20 27 28  atus testdat) '(
7f70: 22 46 41 49 4c 22 29 29 29 0a 09 20 20 20 20 20  "FAIL")))..     
7f80: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66  (set! runflag #f
7f90: 29 29 0a 09 20 20 20 20 28 28 61 6e 64 20 28 6e  ))..    ((and (n
7fa0: 6f 74 20 72 65 72 75 6e 29 0a 09 09 20 20 28 6d  ot rerun)...  (m
7fb0: 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d  ember (test:get-
7fc0: 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20  status testdat) 
7fd0: 27 28 22 46 41 49 4c 22 20 22 6e 2f 61 22 29 29  '("FAIL" "n/a"))
7fe0: 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 75  )..     (set! ru
7ff0: 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20  nflag #t))..    
8000: 28 65 6c 73 65 20 28 73 65 74 21 20 72 75 6e 66  (else (set! runf
8010: 6c 61 67 20 23 66 29 29 29 0a 09 20 20 20 28 64  lag #f)))..   (d
8020: 65 62 75 67 3a 70 72 69 6e 74 20 36 20 22 52 55  ebug:print 6 "RU
8030: 4e 4e 49 4e 47 20 3d 3e 20 72 75 6e 66 6c 61 67  NNING => runflag
8040: 3a 20 22 20 72 75 6e 66 6c 61 67 20 22 20 53 54  : " runflag " ST
8050: 41 54 45 3a 20 22 20 28 74 65 73 74 3a 67 65 74  ATE: " (test:get
8060: 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 20  -state testdat) 
8070: 22 20 53 54 41 54 55 53 3a 20 22 20 28 74 65 73  " STATUS: " (tes
8080: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73  t:get-status tes
8090: 74 64 61 74 29 29 0a 09 20 20 20 28 69 66 20 28  tdat))..   (if (
80a0: 6e 6f 74 20 72 75 6e 66 6c 61 67 29 0a 09 20 20  not runflag)..  
80b0: 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 70 61       (if (not pa
80c0: 72 65 6e 74 2d 74 65 73 74 29 0a 09 09 20 20 20  rent-test)...   
80d0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22  (debug:print 1 "
80e0: 4e 4f 54 45 3a 20 4e 6f 74 20 73 74 61 72 74 69  NOTE: Not starti
80f0: 6e 67 20 74 65 73 74 20 22 20 6e 65 77 2d 74 65  ng test " new-te
8100: 73 74 2d 6e 61 6d 65 20 22 20 61 73 20 69 74 20  st-name " as it 
8110: 69 73 20 73 74 61 74 65 20 5c 22 22 20 28 74 65  is state \"" (te
8120: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73  st:get-state tes
8130: 74 64 61 74 29 20 0a 09 09 09 09 22 5c 22 20 61  tdat) ....."\" a
8140: 6e 64 20 73 74 61 74 75 73 20 5c 22 22 20 28 74  nd status \"" (t
8150: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74  est:get-status t
8160: 65 73 74 64 61 74 29 20 22 5c 22 2c 20 75 73 65  estdat) "\", use
8170: 20 2d 72 65 72 75 6e 20 5c 22 22 20 28 74 65 73   -rerun \"" (tes
8180: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73  t:get-status tes
8190: 74 64 61 74 29 0a 20 20 20 20 20 20 20 20 20 20  tdat).          
81a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
81b0: 20 20 20 20 20 20 22 5c 22 20 6f 72 20 2d 66 6f        "\" or -fo
81c0: 72 63 65 20 74 6f 20 6f 76 65 72 72 69 64 65 22  rce to override"
81d0: 29 29 0a 09 20 20 20 20 20 20 20 3b 3b 20 4e 4f  ))..       ;; NO
81e0: 54 45 3a 20 4e 6f 20 6c 6f 6e 67 65 72 20 62 65  TE: No longer be
81f0: 20 63 68 65 63 6b 69 6e 67 20 70 72 65 72 65 71   checking prereq
8200: 75 69 73 69 74 65 73 20 68 65 72 65 21 20 57 69  uisites here! Wi
8210: 6c 6c 20 6e 65 76 65 72 20 67 65 74 20 68 65 72  ll never get her
8220: 65 20 75 6e 6c 65 73 73 20 70 72 65 72 65 71 73  e unless prereqs
8230: 20 61 72 65 0a 09 20 20 20 20 20 20 20 3b 3b 20   are..       ;; 
8240: 20 20 20 20 20 20 61 6c 72 65 61 64 79 20 6d 65        already me
8250: 74 2e 0a 09 20 20 20 20 20 20 20 28 69 66 20 28  t...       (if (
8260: 6e 6f 74 20 28 6c 61 75 6e 63 68 2d 74 65 73 74  not (launch-test
8270: 20 23 66 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61   #f run-id runna
8280: 6d 65 20 74 65 73 74 2d 63 6f 6e 66 20 6b 65 79  me test-conf key
8290: 76 61 6c 6c 73 74 20 74 65 73 74 2d 6e 61 6d 65  vallst test-name
82a0: 20 74 65 73 74 2d 70 61 74 68 20 69 74 65 6d 64   test-path itemd
82b0: 61 74 20 66 6c 61 67 73 29 29 0a 09 09 20 20 20  at flags))...   
82c0: 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20 28 70  (begin...     (p
82d0: 72 69 6e 74 20 22 45 52 52 4f 52 3a 20 46 61 69  rint "ERROR: Fai
82e0: 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 68  led to launch th
82f0: 65 20 74 65 73 74 2e 20 45 78 69 74 69 6e 67 20  e test. Exiting 
8300: 61 73 20 73 6f 6f 6e 20 61 73 20 70 6f 73 73 69  as soon as possi
8310: 62 6c 65 22 29 0a 09 09 20 20 20 20 20 28 73 65  ble")...     (se
8320: 74 21 20 2a 67 6c 6f 62 61 6c 65 78 69 74 73 74  t! *globalexitst
8330: 61 74 75 73 2a 20 31 29 20 3b 3b 20 0a 09 09 20  atus* 1) ;; ... 
8340: 20 20 20 20 28 70 72 6f 63 65 73 73 2d 73 69 67      (process-sig
8350: 6e 61 6c 20 28 63 75 72 72 65 6e 74 2d 70 72 6f  nal (current-pro
8360: 63 65 73 73 2d 69 64 29 20 73 69 67 6e 61 6c 2f  cess-id) signal/
8370: 6b 69 6c 6c 29 29 29 29 29 29 0a 09 28 28 4b 49  kill))))))..((KI
8380: 4c 4c 45 44 29 20 0a 09 20 28 64 65 62 75 67 3a  LLED) .. (debug:
8390: 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 22  print 1 "NOTE: "
83a0: 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22   new-test-name "
83b0: 20 69 73 20 61 6c 72 65 61 64 79 20 72 75 6e 6e   is already runn
83c0: 69 6e 67 20 6f 72 20 77 61 73 20 65 78 70 6c 69  ing or was expli
83d0: 63 74 6c 79 20 6b 69 6c 6c 65 64 2c 20 75 73 65  ctly killed, use
83e0: 20 2d 66 6f 72 63 65 20 74 6f 20 6c 61 75 6e 63   -force to launc
83f0: 68 20 69 74 2e 22 29 29 0a 09 28 28 4c 41 55 4e  h it."))..((LAUN
8400: 43 48 45 44 20 52 45 4d 4f 54 45 48 4f 53 54 53  CHED REMOTEHOSTS
8410: 54 41 52 54 20 52 55 4e 4e 49 4e 47 29 20 20 0a  TART RUNNING)  .
8420: 09 20 28 69 66 20 28 3e 20 28 2d 20 28 63 75 72  . (if (> (- (cur
8430: 72 65 6e 74 2d 73 65 63 6f 6e 64 73 29 28 2b 20  rent-seconds)(+ 
8440: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 65 76 65  (db:test-get-eve
8450: 6e 74 5f 74 69 6d 65 20 74 65 73 74 64 61 74 29  nt_time testdat)
8460: 0a 09 09 09 09 20 20 20 20 20 20 20 28 64 62 3a  .....       (db:
8470: 74 65 73 74 2d 67 65 74 2d 72 75 6e 5f 64 75 72  test-get-run_dur
8480: 61 74 69 6f 6e 20 74 65 73 74 64 61 74 29 29 29  ation testdat)))
8490: 0a 09 09 36 30 30 29 20 3b 3b 20 69 2e 65 2e 20  ...600) ;; i.e. 
84a0: 6e 6f 20 75 70 64 61 74 65 20 66 6f 72 20 6d 6f  no update for mo
84b0: 72 65 20 74 68 61 6e 20 36 30 30 20 73 65 63 6f  re than 600 seco
84c0: 6e 64 73 0a 09 20 20 20 20 20 28 62 65 67 69 6e  nds..     (begin
84d0: 0a 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a  ..       (debug:
84e0: 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47  print 0 "WARNING
84f0: 3a 20 54 65 73 74 20 22 20 74 65 73 74 2d 6e 61  : Test " test-na
8500: 6d 65 20 22 20 61 70 70 65 61 72 73 20 74 6f 20  me " appears to 
8510: 62 65 20 64 65 61 64 2e 20 46 6f 72 63 69 6e 67  be dead. Forcing
8520: 20 69 74 20 74 6f 20 73 74 61 74 65 20 49 4e 43   it to state INC
8530: 4f 4d 50 4c 45 54 45 20 61 6e 64 20 73 74 61 74  OMPLETE and stat
8540: 75 73 20 53 54 55 43 4b 2f 44 45 41 44 22 29 0a  us STUCK/DEAD").
8550: 09 20 20 20 20 20 20 20 28 74 65 73 74 73 3a 74  .       (tests:t
8560: 65 73 74 2d 73 65 74 2d 73 74 61 74 75 73 21 20  est-set-status! 
8570: 74 65 73 74 2d 69 64 20 22 49 4e 43 4f 4d 50 4c  test-id "INCOMPL
8580: 45 54 45 22 20 22 53 54 55 43 4b 2f 44 45 41 44  ETE" "STUCK/DEAD
8590: 22 20 22 54 65 73 74 20 69 73 20 73 74 75 63 6b  " "Test is stuck
85a0: 20 6f 72 20 64 65 61 64 22 20 23 66 29 29 0a 09   or dead" #f))..
85b0: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
85c0: 74 20 32 20 22 4e 4f 54 45 3a 20 22 20 74 65 73  t 2 "NOTE: " tes
85d0: 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72 65  t-name " is alre
85e0: 61 64 79 20 72 75 6e 6e 69 6e 67 22 29 29 29 0a  ady running"))).
85f0: 09 28 65 6c 73 65 20 20 20 20 20 20 20 28 64 65  .(else       (de
8600: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52  bug:print 0 "ERR
8610: 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c 61  OR: Failed to la
8620: 75 6e 63 68 20 74 65 73 74 20 22 20 6e 65 77 2d  unch test " new-
8630: 74 65 73 74 2d 6e 61 6d 65 20 22 2e 20 55 6e 72  test-name ". Unr
8640: 65 63 6f 67 6e 69 73 65 64 20 73 74 61 74 65 20  ecognised state 
8650: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  " (test:get-stat
8660: 65 20 74 65 73 74 64 61 74 29 29 29 29 29 29 29  e testdat)))))))
8670: 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ..;;============
8680: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8690: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
86a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
86b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 45 4e  ==========.;; EN
86c0: 44 20 4f 46 20 4e 45 57 20 53 54 55 46 46 0a 3b  D OF NEW STUFF.;
86d0: 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;===============
86e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
86f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8700: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8710: 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65  =======..(define
8720: 20 28 67 65 74 2d 64 69 72 2d 75 70 2d 6e 20 64   (get-dir-up-n d
8730: 69 72 20 2e 20 70 61 72 61 6d 73 29 20 0a 20 20  ir . params) .  
8740: 28 6c 65 74 20 28 28 64 70 61 72 74 73 20 20 28  (let ((dparts  (
8750: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 64 69 72  string-split dir
8760: 20 22 2f 22 29 29 0a 09 28 63 6f 75 6e 74 20 20   "/"))..(count  
8770: 20 28 69 66 20 28 6e 75 6c 6c 3f 20 70 61 72 61   (if (null? para
8780: 6d 73 29 20 31 20 28 63 61 72 20 70 61 72 61 6d  ms) 1 (car param
8790: 73 29 29 29 29 0a 20 20 20 20 28 63 6f 6e 63 20  s)))).    (conc 
87a0: 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 65  "/" (string-inte
87b0: 72 73 70 65 72 73 65 20 0a 09 20 20 20 20 20 20  rsperse ..      
87c0: 20 28 74 61 6b 65 20 64 70 61 72 74 73 20 28 2d   (take dparts (-
87d0: 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73 29   (length dparts)
87e0: 20 63 6f 75 6e 74 29 29 0a 09 20 20 20 20 20 20   count))..      
87f0: 20 22 2f 22 29 29 29 29 0a 3b 3b 20 52 65 6d 6f   "/")))).;; Remo
8800: 76 65 20 72 75 6e 73 0a 3b 3b 20 66 69 65 6c 64  ve runs.;; field
8810: 73 20 61 72 65 20 70 61 73 73 69 6e 67 20 69 6e  s are passing in
8820: 20 74 68 72 6f 75 67 68 20 0a 3b 3b 20 61 63 74   through .;; act
8830: 69 6f 6e 3a 0a 3b 3b 20 20 20 20 27 72 65 6d 6f  ion:.;;    'remo
8840: 76 65 2d 72 75 6e 73 0a 3b 3b 20 20 20 20 27 73  ve-runs.;;    's
8850: 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73 0a  et-state-status.
8860: 3b 3b 0a 3b 3b 20 4e 42 2f 2f 20 73 68 6f 75 6c  ;;.;; NB// shoul
8870: 64 20 70 61 73 73 20 69 6e 20 6b 65 79 73 3f 0a  d pass in keys?.
8880: 3b 3b 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73  ;;.(define (runs
8890: 3a 6f 70 65 72 61 74 65 2d 6f 6e 20 61 63 74 69  :operate-on acti
88a0: 6f 6e 20 72 75 6e 6e 61 6d 65 70 61 74 74 20 74  on runnamepatt t
88b0: 65 73 74 70 61 74 74 20 23 21 6b 65 79 20 28 73  estpatt #!key (s
88c0: 74 61 74 65 20 23 66 29 28 73 74 61 74 75 73 20  tate #f)(status 
88d0: 23 66 29 28 6e 65 77 2d 73 74 61 74 65 2d 73 74  #f)(new-state-st
88e0: 61 74 75 73 20 23 66 29 29 0a 20 20 28 6c 65 74  atus #f)).  (let
88f0: 2a 20 28 28 64 62 20 20 20 20 20 20 20 20 20 20  * ((db          
8900: 20 23 66 29 0a 09 20 28 6b 65 79 73 20 20 20 20   #f).. (keys    
8910: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
8920: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 6b 65 79 73  lose db:get-keys
8930: 20 64 62 29 29 0a 09 20 28 72 75 6e 64 61 74 20   db)).. (rundat 
8940: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d        (open-run-
8950: 63 6c 6f 73 65 20 72 75 6e 73 3a 67 65 74 2d 72  close runs:get-r
8960: 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20 6b  uns-by-patt db k
8970: 65 79 73 20 72 75 6e 6e 61 6d 65 70 61 74 74 29  eys runnamepatt)
8980: 29 0a 09 20 28 68 65 61 64 65 72 20 20 20 20 20  ).. (header     
8990: 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75    (vector-ref ru
89a0: 6e 64 61 74 20 30 29 29 0a 09 20 28 72 75 6e 73  ndat 0)).. (runs
89b0: 20 20 20 20 20 20 20 20 20 28 76 65 63 74 6f 72           (vector
89c0: 2d 72 65 66 20 72 75 6e 64 61 74 20 31 29 29 0a  -ref rundat 1)).
89d0: 09 20 28 73 74 61 74 65 73 20 20 20 20 20 20 20  . (states       
89e0: 28 69 66 20 73 74 61 74 65 20 20 28 73 74 72 69  (if state  (stri
89f0: 6e 67 2d 73 70 6c 69 74 20 73 74 61 74 65 20 20  ng-split state  
8a00: 22 2c 22 29 20 27 28 29 29 29 0a 09 20 28 73 74  ",") '())).. (st
8a10: 61 74 75 73 65 73 20 20 20 20 20 28 69 66 20 73  atuses     (if s
8a20: 74 61 74 75 73 20 28 73 74 72 69 6e 67 2d 73 70  tatus (string-sp
8a30: 6c 69 74 20 73 74 61 74 75 73 20 22 2c 22 29 20  lit status ",") 
8a40: 27 28 29 29 29 0a 09 20 28 73 74 61 74 65 2d 73  '())).. (state-s
8a50: 74 61 74 75 73 20 28 69 66 20 28 73 74 72 69 6e  tatus (if (strin
8a60: 67 3f 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61  g? new-state-sta
8a70: 74 75 73 29 20 28 73 74 72 69 6e 67 2d 73 70 6c  tus) (string-spl
8a80: 69 74 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61  it new-state-sta
8a90: 74 75 73 20 22 2c 22 29 20 27 28 23 66 20 23 66  tus ",") '(#f #f
8aa0: 29 29 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a  )))).    (debug:
8ab0: 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 72 75  print-info 4 "ru
8ac0: 6e 73 3a 6f 70 65 72 61 74 65 2d 6f 6e 20 3d 3e  ns:operate-on =>
8ad0: 20 48 65 61 64 65 72 3a 20 22 20 68 65 61 64 65   Header: " heade
8ae0: 72 20 22 20 61 63 74 69 6f 6e 3a 20 22 20 61 63  r " action: " ac
8af0: 74 69 6f 6e 20 22 20 6e 65 77 2d 73 74 61 74 65  tion " new-state
8b00: 2d 73 74 61 74 75 73 3a 20 22 20 6e 65 77 2d 73  -status: " new-s
8b10: 74 61 74 65 2d 73 74 61 74 75 73 29 0a 20 20 20  tate-status).   
8b20: 20 28 69 66 20 28 3e 20 32 20 28 6c 65 6e 67 74   (if (> 2 (lengt
8b30: 68 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 29  h state-status))
8b40: 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 64 65 62  ..(begin..  (deb
8b50: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f  ug:print 0 "ERRO
8b60: 52 3a 20 74 68 65 20 70 61 72 61 6d 65 74 65 72  R: the parameter
8b70: 20 74 6f 20 2d 73 65 74 2d 73 74 61 74 65 2d 73   to -set-state-s
8b80: 74 61 74 75 73 20 69 73 20 61 20 63 6f 6d 6d 61  tatus is a comma
8b90: 20 64 65 6c 69 6d 69 74 65 64 20 73 74 72 69 6e   delimited strin
8ba0: 67 2e 20 45 2e 67 2e 20 43 4f 4d 50 4c 45 54 45  g. E.g. COMPLETE
8bb0: 44 2c 46 41 49 4c 22 29 0a 09 20 20 28 65 78 69  D,FAIL")..  (exi
8bc0: 74 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61  t))).    (for-ea
8bd0: 63 68 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20  ch.     (lambda 
8be0: 28 72 75 6e 29 0a 20 20 20 20 20 20 20 28 6c 65  (run).       (le
8bf0: 74 20 28 28 72 75 6e 6b 65 79 20 28 73 74 72 69  t ((runkey (stri
8c00: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28  ng-intersperse (
8c10: 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 0a  map (lambda (k).
8c20: 09 09 09 09 09 09 28 64 62 3a 67 65 74 2d 76 61  ......(db:get-va
8c30: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75  lue-by-header ru
8c40: 6e 20 68 65 61 64 65 72 20 28 76 65 63 74 6f 72  n header (vector
8c50: 2d 72 65 66 20 6b 20 30 29 29 29 20 6b 65 79 73  -ref k 0))) keys
8c60: 29 20 22 2f 22 29 29 0a 09 20 20 20 20 20 28 64  ) "/"))..     (d
8c70: 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 28 6d  irs-to-remove (m
8c80: 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29  ake-hash-table))
8c90: 29 0a 09 20 28 6c 65 74 2a 20 28 28 72 75 6e 2d  ).. (let* ((run-
8ca0: 69 64 20 20 20 20 28 64 62 3a 67 65 74 2d 76 61  id    (db:get-va
8cb0: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75  lue-by-header ru
8cc0: 6e 20 68 65 61 64 65 72 20 22 69 64 22 29 29 0a  n header "id")).
8cd0: 09 09 28 72 75 6e 2d 73 74 61 74 65 20 28 64 62  ..(run-state (db
8ce0: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65  :get-value-by-he
8cf0: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20  ader run header 
8d00: 22 73 74 61 74 65 22 29 29 0a 09 09 28 74 65 73  "state"))...(tes
8d10: 74 73 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20  ts     (if (not 
8d20: 28 65 71 75 61 6c 3f 20 72 75 6e 2d 73 74 61 74  (equal? run-stat
8d30: 65 20 22 6c 6f 63 6b 65 64 22 29 29 0a 09 09 09  e "locked"))....
8d40: 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e         (open-run
8d50: 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65  -close db:get-te
8d60: 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 72  sts-for-run db r
8d70: 75 6e 2d 69 64 0a 09 09 09 09 09 09 20 20 20 20  un-id.......    
8d80: 20 20 74 65 73 74 70 61 74 74 20 73 74 61 74 65    testpatt state
8d90: 73 20 73 74 61 74 75 73 65 73 0a 09 09 09 09 09  s statuses......
8da0: 09 20 20 20 20 20 20 6e 6f 74 2d 69 6e 3a 20 20  .      not-in:  
8db0: 23 66 0a 09 09 09 09 09 09 20 20 20 20 20 20 73  #f.......      s
8dc0: 6f 72 74 2d 62 79 3a 20 28 63 61 73 65 20 61 63  ort-by: (case ac
8dd0: 74 69 6f 6e 0a 09 09 09 09 09 09 09 09 20 28 28  tion......... ((
8de0: 72 65 6d 6f 76 65 2d 72 75 6e 73 29 20 27 72 75  remove-runs) 'ru
8df0: 6e 64 69 72 29 0a 09 09 09 09 09 09 09 09 20 28  ndir)......... (
8e00: 65 6c 73 65 20 20 20 20 20 20 20 20 20 20 27 65  else          'e
8e10: 76 65 6e 74 5f 74 69 6d 65 29 29 29 0a 09 09 09  vent_time)))....
8e20: 20 20 20 20 20 20 20 27 28 29 29 29 0a 09 09 28         '()))...(
8e30: 6c 61 73 74 74 70 61 74 68 20 22 2f 64 6f 65 73  lasttpath "/does
8e40: 2f 6e 6f 74 2f 65 78 69 73 74 2f 49 2f 68 6f 70  /not/exist/I/hop
8e50: 65 22 29 29 0a 09 20 20 20 28 64 65 62 75 67 3a  e"))..   (debug:
8e60: 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 72 75  print-info 4 "ru
8e70: 6e 73 3a 6f 70 65 72 61 74 65 2d 6f 6e 20 72 75  ns:operate-on ru
8e80: 6e 3d 22 20 72 75 6e 20 22 2c 20 68 65 61 64 65  n=" run ", heade
8e90: 72 3d 22 20 68 65 61 64 65 72 29 0a 09 20 20 20  r=" header)..   
8ea0: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20  (if (not (null? 
8eb0: 74 65 73 74 73 29 29 0a 09 20 20 20 20 20 20 20  tests))..       
8ec0: 28 62 65 67 69 6e 0a 09 09 20 28 63 61 73 65 20  (begin... (case 
8ed0: 61 63 74 69 6f 6e 0a 09 09 20 20 20 28 28 72 65  action...   ((re
8ee0: 6d 6f 76 65 2d 72 75 6e 73 29 0a 09 09 20 20 20  move-runs)...   
8ef0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20   (debug:print 1 
8f00: 22 52 65 6d 6f 76 69 6e 67 20 74 65 73 74 73 20  "Removing tests 
8f10: 66 6f 72 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65  for run: " runke
8f20: 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61  y " " (db:get-va
8f30: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75  lue-by-header ru
8f40: 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d  n header "runnam
8f50: 65 22 29 29 29 0a 09 09 20 20 20 28 28 73 65 74  e")))...   ((set
8f60: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 29 0a 09  -state-status)..
8f70: 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  .    (debug:prin
8f80: 74 20 31 20 22 4d 6f 64 69 66 79 69 6e 67 20 73  t 1 "Modifying s
8f90: 74 61 74 65 20 61 6e 64 20 73 74 61 75 73 20 66  tate and staus f
8fa0: 6f 72 20 74 65 73 74 73 20 66 6f 72 20 72 75 6e  or tests for run
8fb0: 3a 20 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28  : " runkey " " (
8fc0: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d  db:get-value-by-
8fd0: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65  header run heade
8fe0: 72 20 22 72 75 6e 6e 61 6d 65 22 29 29 29 0a 09  r "runname")))..
8ff0: 09 20 20 20 28 28 70 72 69 6e 74 2d 72 75 6e 29  .   ((print-run)
9000: 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72  ...    (debug:pr
9010: 69 6e 74 20 31 20 22 50 72 69 6e 74 69 6e 67 20  int 1 "Printing 
9020: 69 6e 66 6f 20 66 6f 72 20 72 75 6e 20 22 20 72  info for run " r
9030: 75 6e 6b 65 79 20 22 2c 20 72 75 6e 3d 22 20 72  unkey ", run=" r
9040: 75 6e 20 22 2c 20 74 65 73 74 73 3d 22 20 74 65  un ", tests=" te
9050: 73 74 73 20 22 2c 20 68 65 61 64 65 72 3d 22 20  sts ", header=" 
9060: 68 65 61 64 65 72 29 0a 09 09 20 20 20 20 61 63  header)...    ac
9070: 74 69 6f 6e 29 0a 09 09 20 20 20 28 65 6c 73 65  tion)...   (else
9080: 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72  ...    (debug:pr
9090: 69 6e 74 2d 69 6e 66 6f 20 30 20 22 61 63 74 69  int-info 0 "acti
90a0: 6f 6e 20 6e 6f 74 20 72 65 63 6f 67 6e 69 73 65  on not recognise
90b0: 64 20 22 20 61 63 74 69 6f 6e 29 29 29 0a 09 09  d " action)))...
90c0: 20 28 66 6f 72 2d 65 61 63 68 0a 09 09 20 20 28   (for-each...  (
90d0: 6c 61 6d 62 64 61 20 28 74 65 73 74 29 0a 09 09  lambda (test)...
90e0: 20 20 20 20 28 6c 65 74 2a 20 28 28 69 74 65 6d      (let* ((item
90f0: 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67  -path (db:test-g
9100: 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73  et-item-path tes
9110: 74 29 29 0a 09 09 09 20 20 20 28 74 65 73 74 2d  t))....   (test-
9120: 6e 61 6d 65 20 28 64 62 3a 74 65 73 74 2d 67 65  name (db:test-ge
9130: 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29  t-testname test)
9140: 29 0a 09 09 09 20 20 20 28 72 75 6e 2d 64 69 72  )....   (run-dir
9150: 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d     (db:test-get-
9160: 72 75 6e 64 69 72 20 74 65 73 74 29 29 20 20 20  rundir test))   
9170: 20 3b 3b 20 72 75 6e 20 64 69 72 20 69 73 20 66   ;; run dir is f
9180: 72 6f 6d 20 74 68 65 20 6c 69 6e 6b 20 74 72 65  rom the link tre
9190: 65 0a 09 09 09 20 20 20 28 72 65 61 6c 2d 64 69  e....   (real-di
91a0: 72 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69  r  (if (file-exi
91b0: 73 74 73 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09  sts? run-dir)...
91c0: 09 09 09 20 20 28 72 65 73 6f 6c 76 65 2d 70 61  ...  (resolve-pa
91d0: 74 68 6e 61 6d 65 20 72 75 6e 2d 64 69 72 29 0a  thname run-dir).
91e0: 09 09 09 09 09 20 20 23 66 29 29 0a 09 09 09 20  .....  #f)).... 
91f0: 20 20 28 74 65 73 74 2d 69 64 20 20 20 28 64 62    (test-id   (db
9200: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73  :test-get-id tes
9210: 74 29 29 29 0a 09 09 20 20 20 20 20 20 3b 3b 20  t)))...      ;; 
9220: 20 20 28 74 64 62 20 20 20 20 20 20 20 28 64 62    (tdb       (db
9230: 3a 6f 70 65 6e 2d 74 65 73 74 2d 64 62 20 72 75  :open-test-db ru
9240: 6e 2d 64 69 72 29 29 29 0a 09 09 20 20 20 20 20  n-dir)))...     
9250: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
9260: 66 6f 20 34 20 22 74 65 73 74 3d 22 20 74 65 73  fo 4 "test=" tes
9270: 74 29 20 3b 3b 20 20 20 22 20 28 64 62 3a 74 65  t) ;;   " (db:te
9280: 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20  st-get-testname 
9290: 74 65 73 74 29 20 22 20 69 64 3a 20 22 20 28 64  test) " id: " (d
92a0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65  b:test-get-id te
92b0: 73 74 29 20 22 20 22 20 69 74 65 6d 2d 70 61 74  st) " " item-pat
92c0: 68 20 22 20 61 63 74 69 6f 6e 3a 20 22 20 61 63  h " action: " ac
92d0: 74 69 6f 6e 29 0a 09 09 20 20 20 20 20 20 28 63  tion)...      (c
92e0: 61 73 65 20 61 63 74 69 6f 6e 0a 09 09 09 28 28  ase action....((
92f0: 72 65 6d 6f 76 65 2d 72 75 6e 73 29 20 3b 3b 20  remove-runs) ;; 
9300: 74 68 65 20 74 64 62 20 69 73 20 66 6f 72 20 66  the tdb is for f
9310: 75 74 75 72 65 20 70 6f 73 73 69 62 6c 65 2e 20  uture possible. 
9320: 0a 09 09 09 20 28 6f 70 65 6e 2d 72 75 6e 2d 63  .... (open-run-c
9330: 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 2d 74  lose db:delete-t
9340: 65 73 74 2d 72 65 63 6f 72 64 73 20 64 62 20 23  est-records db #
9350: 66 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  f (db:test-get-i
9360: 64 20 74 65 73 74 29 29 0a 09 09 09 20 28 64 65  d test)).... (de
9370: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31  bug:print-info 1
9380: 20 22 41 74 74 65 6d 70 74 69 6e 67 20 74 6f 20   "Attempting to 
9390: 72 65 6d 6f 76 65 20 22 20 28 69 66 20 72 65 61  remove " (if rea
93a0: 6c 2d 64 69 72 20 28 63 6f 6e 63 20 22 20 64 69  l-dir (conc " di
93b0: 72 20 22 20 72 65 61 6c 2d 64 69 72 20 22 20 61  r " real-dir " a
93c0: 6e 64 20 22 29 20 22 22 29 20 22 20 6c 69 6e 6b  nd ") "") " link
93d0: 20 22 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 20   " run-dir).... 
93e0: 28 69 66 20 28 61 6e 64 20 72 65 61 6c 2d 64 69  (if (and real-di
93f0: 72 20 0a 09 09 09 09 20 20 28 3e 20 28 73 74 72  r .....  (> (str
9400: 69 6e 67 2d 6c 65 6e 67 74 68 20 72 65 61 6c 2d  ing-length real-
9410: 64 69 72 29 20 35 29 0a 09 09 09 09 20 20 28 66  dir) 5).....  (f
9420: 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 65 61 6c  ile-exists? real
9430: 2d 64 69 72 29 29 20 3b 3b 20 62 61 64 20 68 65  -dir)) ;; bad he
9440: 75 72 69 73 74 69 63 20 62 75 74 20 73 68 6f 75  uristic but shou
9450: 6c 64 20 70 72 65 76 65 6e 74 20 2f 74 6d 70 20  ld prevent /tmp 
9460: 2f 68 6f 6d 65 20 65 74 63 2e 0a 09 09 09 20 20  /home etc.....  
9470: 20 20 20 28 62 65 67 69 6e 20 3b 3b 20 6c 65 74     (begin ;; let
9480: 2a 20 28 28 72 65 61 6c 70 61 74 68 20 28 72 65  * ((realpath (re
9490: 73 6f 6c 76 65 2d 70 61 74 68 6e 61 6d 65 20 72  solve-pathname r
94a0: 75 6e 2d 64 69 72 29 29 29 0a 09 09 09 20 20 20  un-dir)))....   
94b0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
94c0: 2d 69 6e 66 6f 20 31 20 22 52 65 63 75 72 73 69  -info 1 "Recursi
94d0: 76 65 6c 79 20 72 65 6d 6f 76 69 6e 67 20 22 20  vely removing " 
94e0: 72 65 61 6c 2d 64 69 72 29 0a 09 09 09 20 20 20  real-dir)....   
94f0: 20 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78      (if (file-ex
9500: 69 73 74 73 3f 20 72 65 61 6c 2d 64 69 72 29 0a  ists? real-dir).
9510: 09 09 09 09 20 20 20 28 69 66 20 28 3e 20 28 73  ....   (if (> (s
9520: 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 20  ystem (conc "rm 
9530: 2d 72 66 20 22 20 72 65 61 6c 2d 64 69 72 29 29  -rf " real-dir))
9540: 20 30 29 0a 09 09 09 09 20 20 20 20 20 20 20 28   0).....       (
9550: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45  debug:print 0 "E
9560: 52 52 4f 52 3a 20 54 68 65 72 65 20 77 61 73 20  RROR: There was 
9570: 61 20 70 72 6f 62 6c 65 6d 20 72 65 6d 6f 76 69  a problem removi
9580: 6e 67 20 22 20 72 65 61 6c 2d 64 69 72 20 22 20  ng " real-dir " 
9590: 77 69 74 68 20 72 6d 20 2d 66 22 29 29 0a 09 09  with rm -f"))...
95a0: 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  ..   (debug:prin
95b0: 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 74 65  t 0 "WARNING: te
95c0: 73 74 20 64 69 72 20 22 20 72 65 61 6c 2d 64 69  st dir " real-di
95d0: 72 20 22 20 61 70 70 65 61 72 73 20 74 6f 20 6e  r " appears to n
95e0: 6f 74 20 65 78 69 73 74 20 6f 72 20 69 73 20 6e  ot exist or is n
95f0: 6f 74 20 72 65 61 64 61 62 6c 65 22 29 29 29 0a  ot readable"))).
9600: 09 09 09 20 20 20 20 20 28 69 66 20 72 65 61 6c  ...     (if real
9610: 2d 64 69 72 20 0a 09 09 09 09 20 28 64 65 62 75  -dir ..... (debu
9620: 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49  g:print 0 "WARNI
9630: 4e 47 3a 20 64 69 72 65 63 74 6f 72 79 20 22 20  NG: directory " 
9640: 72 65 61 6c 2d 64 69 72 20 22 20 64 6f 65 73 20  real-dir " does 
9650: 6e 6f 74 20 65 78 69 73 74 22 29 0a 09 09 09 09  not exist").....
9660: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
9670: 22 57 41 52 4e 49 4e 47 3a 20 6e 6f 20 72 65 61  "WARNING: no rea
9680: 6c 20 64 69 72 65 63 74 6f 72 79 20 63 6f 72 72  l directory corr
9690: 6f 73 70 6f 6e 64 69 6e 67 20 74 6f 20 6c 69 6e  osponding to lin
96a0: 6b 20 22 20 72 75 6e 2d 64 69 72 20 22 2c 20 6e  k " run-dir ", n
96b0: 6f 74 68 69 6e 67 20 64 6f 6e 65 22 29 29 29 0a  othing done"))).
96c0: 09 09 09 20 28 69 66 20 28 73 79 6d 62 6f 6c 69  ... (if (symboli
96d0: 63 2d 6c 69 6e 6b 3f 20 72 75 6e 2d 64 69 72 29  c-link? run-dir)
96e0: 0a 09 09 09 20 20 20 20 20 28 62 65 67 69 6e 0a  ....     (begin.
96f0: 09 09 09 20 20 20 20 20 20 20 28 64 65 62 75 67  ...       (debug
9700: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 52  :print-info 1 "R
9710: 65 6d 6f 76 69 6e 67 20 73 79 6d 6c 69 6e 6b 20  emoving symlink 
9720: 22 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 20 20  " run-dir)....  
9730: 20 20 20 20 20 28 64 65 6c 65 74 65 2d 66 69 6c       (delete-fil
9740: 65 20 72 75 6e 2d 64 69 72 29 29 0a 09 09 09 20  e run-dir)).... 
9750: 20 20 20 20 28 69 66 20 28 64 69 72 65 63 74 6f      (if (directo
9760: 72 79 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09 09  ry? run-dir)....
9770: 09 20 28 69 66 20 28 3e 20 28 64 69 72 65 63 74  . (if (> (direct
9780: 6f 72 79 2d 66 6f 6c 64 20 28 6c 61 6d 62 64 61  ory-fold (lambda
9790: 20 28 66 20 78 29 28 2b 20 31 20 78 29 29 20 30   (f x)(+ 1 x)) 0
97a0: 20 72 75 6e 2d 64 69 72 29 20 30 29 0a 09 09 09   run-dir) 0)....
97b0: 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  .     (debug:pri
97c0: 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 72  nt 0 "WARNING: r
97d0: 65 66 75 73 69 6e 67 20 74 6f 20 72 65 6d 6f 76  efusing to remov
97e0: 65 20 22 20 72 75 6e 2d 64 69 72 20 22 20 61 73  e " run-dir " as
97f0: 20 69 74 20 69 73 20 6e 6f 74 20 65 6d 70 74 79   it is not empty
9800: 22 29 0a 09 09 09 09 20 20 20 20 20 28 64 65 6c  ").....     (del
9810: 65 74 65 2d 64 69 72 65 63 74 6f 72 79 20 72 75  ete-directory ru
9820: 6e 2d 64 69 72 29 29 20 3b 3b 20 69 74 20 73 68  n-dir)) ;; it sh
9830: 6f 75 6c 64 20 62 65 20 65 6d 70 74 79 20 62 79  ould be empty by
9840: 20 68 65 72 65 20 42 55 47 20 42 55 47 2c 20 61   here BUG BUG, a
9850: 64 64 20 65 72 72 6f 72 20 63 61 74 63 68 0a 09  dd error catch..
9860: 09 09 09 20 28 69 66 20 72 75 6e 2d 64 69 72 0a  ... (if run-dir.
9870: 09 09 09 09 20 20 20 20 20 28 64 65 62 75 67 3a  ....     (debug:
9880: 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47  print 0 "WARNING
9890: 3a 20 6e 6f 74 20 72 65 6d 6f 76 69 6e 67 20 22  : not removing "
98a0: 20 72 75 6e 2d 64 69 72 20 22 20 61 73 20 69 74   run-dir " as it
98b0: 20 65 69 74 68 65 72 20 64 6f 65 73 6e 27 74 20   either doesn't 
98c0: 65 78 69 73 74 20 6f 72 20 69 73 20 6e 6f 74 20  exist or is not 
98d0: 61 20 73 79 6d 6c 69 6e 6b 22 29 0a 09 09 09 09  a symlink").....
98e0: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
98f0: 74 20 30 20 22 4e 4f 54 45 3a 20 74 68 65 20 72  t 0 "NOTE: the r
9900: 75 6e 20 64 69 72 20 66 6f 72 20 74 68 69 73 20  un dir for this 
9910: 74 65 73 74 20 69 73 20 75 6e 64 65 66 69 6e 65  test is undefine
9920: 64 2e 20 54 65 73 74 20 6d 61 79 20 68 61 76 65  d. Test may have
9930: 20 61 6c 72 65 61 64 79 20 62 65 65 6e 20 64 65   already been de
9940: 6c 65 74 65 64 2e 22 29 29 0a 09 09 09 09 20 29  leted."))..... )
9950: 29 29 0a 09 09 09 28 28 73 65 74 2d 73 74 61 74  ))....((set-stat
9960: 65 2d 73 74 61 74 75 73 29 0a 09 09 09 20 28 64  e-status).... (d
9970: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
9980: 32 20 22 6e 65 77 20 73 74 61 74 65 20 22 20 28  2 "new state " (
9990: 63 61 72 20 73 74 61 74 65 2d 73 74 61 74 75 73  car state-status
99a0: 29 20 22 2c 20 6e 65 77 20 73 74 61 74 75 73 20  ) ", new status 
99b0: 22 20 28 63 61 64 72 20 73 74 61 74 65 2d 73 74  " (cadr state-st
99c0: 61 74 75 73 29 29 0a 09 09 09 20 28 6f 70 65 6e  atus)).... (open
99d0: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 74 65  -run-close db:te
99e0: 73 74 2d 73 65 74 2d 73 74 61 74 65 2d 73 74 61  st-set-state-sta
99f0: 74 75 73 2d 62 79 2d 69 64 20 64 62 20 28 64 62  tus-by-id db (db
9a00: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73  :test-get-id tes
9a10: 74 29 20 28 63 61 72 20 73 74 61 74 65 2d 73 74  t) (car state-st
9a20: 61 74 75 73 29 28 63 61 64 72 20 73 74 61 74 65  atus)(cadr state
9a30: 2d 73 74 61 74 75 73 29 20 23 66 29 29 29 29 29  -status) #f)))))
9a40: 0a 09 09 20 20 28 73 6f 72 74 20 74 65 73 74 73  ...  (sort tests
9a50: 20 28 6c 61 6d 62 64 61 20 28 61 20 62 29 28 6c   (lambda (a b)(l
9a60: 65 74 20 28 28 64 69 72 61 20 28 64 62 3a 74 65  et ((dira (db:te
9a70: 73 74 2d 67 65 74 2d 72 75 6e 64 69 72 20 61 29  st-get-rundir a)
9a80: 29 0a 09 09 09 09 09 09 20 28 64 69 72 62 20 28  )....... (dirb (
9a90: 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 64  db:test-get-rund
9aa0: 69 72 20 62 29 29 29 0a 09 09 09 09 09 20 20 20  ir b)))......   
9ab0: 20 20 28 69 66 20 28 61 6e 64 20 28 73 74 72 69    (if (and (stri
9ac0: 6e 67 3f 20 64 69 72 61 29 28 73 74 72 69 6e 67  ng? dira)(string
9ad0: 3f 20 64 69 72 62 29 29 0a 09 09 09 09 09 09 20  ? dirb))....... 
9ae0: 28 3e 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74  (> (string-lengt
9af0: 68 20 64 69 72 61 29 28 73 74 72 69 6e 67 2d 6c  h dira)(string-l
9b00: 65 6e 67 74 68 20 64 69 72 62 29 29 0a 09 09 09  ength dirb))....
9b10: 09 09 09 20 23 66 29 29 29 29 29 29 29 0a 09 20  ... #f))))))).. 
9b20: 20 20 3b 3b 20 72 65 6d 6f 76 65 20 74 68 65 20    ;; remove the 
9b30: 72 75 6e 20 69 66 20 7a 65 72 6f 20 74 65 73 74  run if zero test
9b40: 73 20 72 65 6d 61 69 6e 0a 09 20 20 20 28 69 66  s remain..   (if
9b50: 20 28 65 71 3f 20 61 63 74 69 6f 6e 20 27 72 65   (eq? action 're
9b60: 6d 6f 76 65 2d 72 75 6e 73 29 0a 09 20 20 20 20  move-runs)..    
9b70: 20 20 20 28 6c 65 74 20 28 28 72 65 6d 74 65 73     (let ((remtes
9b80: 74 73 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f  ts (open-run-clo
9b90: 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 73 2d  se db:get-tests-
9ba0: 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 62 3a 67  for-run db (db:g
9bb0: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64  et-value-by-head
9bc0: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 69  er run header "i
9bd0: 64 22 29 20 23 66 20 27 28 22 44 45 4c 45 54 45  d") #f '("DELETE
9be0: 44 22 29 20 27 28 22 6e 2f 61 22 29 20 6e 6f 74  D") '("n/a") not
9bf0: 2d 69 6e 3a 20 23 74 29 29 29 0a 09 09 20 28 69  -in: #t)))... (i
9c00: 66 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74  f (null? remtest
9c10: 73 29 20 3b 3b 20 6e 6f 20 6d 6f 72 65 20 74 65  s) ;; no more te
9c20: 73 74 73 20 72 65 6d 61 69 6e 69 6e 67 0a 09 09  sts remaining...
9c30: 20 20 20 20 20 28 6c 65 74 2a 20 28 28 64 70 61       (let* ((dpa
9c40: 72 74 73 20 20 28 73 74 72 69 6e 67 2d 73 70 6c  rts  (string-spl
9c50: 69 74 20 6c 61 73 74 74 70 61 74 68 20 22 2f 22  it lasttpath "/"
9c60: 29 29 0a 09 09 09 20 20 20 20 28 72 75 6e 70 61  ))....    (runpa
9c70: 74 68 20 28 63 6f 6e 63 20 22 2f 22 20 28 73 74  th (conc "/" (st
9c80: 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65  ring-intersperse
9c90: 20 0a 09 09 09 09 09 09 28 74 61 6b 65 20 64 70   .......(take dp
9ca0: 61 72 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 20  arts (- (length 
9cb0: 64 70 61 72 74 73 29 20 31 29 29 0a 09 09 09 09  dparts) 1)).....
9cc0: 09 09 22 2f 22 29 29 29 29 0a 09 09 20 20 20 20  .."/"))))...    
9cd0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
9ce0: 31 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 3a  1 "Removing run:
9cf0: 20 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64   " runkey " " (d
9d00: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68  b:get-value-by-h
9d10: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72  eader run header
9d20: 20 22 72 75 6e 6e 61 6d 65 22 29 20 22 20 61 6e   "runname") " an
9d30: 64 20 72 65 6c 61 74 65 64 20 72 65 63 6f 72 64  d related record
9d40: 22 29 0a 09 09 20 20 20 20 20 20 20 28 6f 70 65  ")...       (ope
9d50: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64  n-run-close db:d
9d60: 65 6c 65 74 65 2d 72 75 6e 20 64 62 20 72 75 6e  elete-run db run
9d70: 2d 69 64 29 0a 09 09 20 20 20 20 20 20 20 3b 3b  -id)...       ;;
9d80: 20 54 68 69 73 20 69 73 20 61 20 70 72 65 74 74   This is a prett
9d90: 79 20 67 6f 6f 64 20 70 6c 61 63 65 20 74 6f 20  y good place to 
9da0: 70 75 72 67 65 20 6f 6c 64 20 44 45 4c 45 54 45  purge old DELETE
9db0: 44 20 74 65 73 74 73 0a 09 09 20 20 20 20 20 20  D tests...      
9dc0: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
9dd0: 20 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 73   db:delete-tests
9de0: 2d 66 6f 72 2d 72 75 6e 20 64 62 20 72 75 6e 2d  -for-run db run-
9df0: 69 64 29 0a 09 09 20 20 20 20 20 20 20 28 6f 70  id)...       (op
9e00: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a  en-run-close db:
9e10: 64 65 6c 65 74 65 2d 6f 6c 64 2d 64 65 6c 65 74  delete-old-delet
9e20: 65 64 2d 74 65 73 74 2d 72 65 63 6f 72 64 73 20  ed-test-records 
9e30: 64 62 29 0a 09 09 20 20 20 20 20 20 20 28 6f 70  db)...       (op
9e40: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a  en-run-close db:
9e50: 73 65 74 2d 76 61 72 20 64 62 20 22 44 45 4c 45  set-var db "DELE
9e60: 54 45 44 5f 54 45 53 54 53 22 20 28 63 75 72 72  TED_TESTS" (curr
9e70: 65 6e 74 2d 73 65 63 6f 6e 64 73 29 29 0a 09 09  ent-seconds))...
9e80: 20 20 20 20 20 20 20 3b 3b 20 6e 65 65 64 20 74         ;; need t
9e90: 6f 20 66 69 67 75 72 65 20 6f 75 74 20 74 68 65  o figure out the
9ea0: 20 70 61 74 68 20 74 6f 20 74 68 65 20 72 75 6e   path to the run
9eb0: 20 64 69 72 20 61 6e 64 20 72 65 6d 6f 76 65 20   dir and remove 
9ec0: 69 74 20 69 66 20 65 6d 70 74 79 0a 09 09 20 20  it if empty...  
9ed0: 20 20 20 20 20 3b 3b 20 20 20 20 28 69 66 20 28       ;;    (if (
9ee0: 6e 75 6c 6c 3f 20 28 67 6c 6f 62 20 28 63 6f 6e  null? (glob (con
9ef0: 63 20 72 75 6e 70 61 74 68 20 22 2f 2a 22 29 29  c runpath "/*"))
9f00: 29 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 20 20  )...       ;;   
9f10: 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20       (begin...  
9f20: 20 20 20 20 20 3b 3b 20 09 20 28 64 65 62 75 67       ;; . (debug
9f30: 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69  :print 1 "Removi
9f40: 6e 67 20 72 75 6e 20 64 69 72 20 22 20 72 75 6e  ng run dir " run
9f50: 70 61 74 68 29 0a 09 09 20 20 20 20 20 20 20 3b  path)...       ;
9f60: 3b 20 09 20 28 73 79 73 74 65 6d 20 28 63 6f 6e  ; . (system (con
9f70: 63 20 22 72 6d 64 69 72 20 2d 70 20 22 20 72 75  c "rmdir -p " ru
9f80: 6e 70 61 74 68 29 29 29 29 0a 09 09 20 20 20 20  npath))))...    
9f90: 20 20 20 29 29 29 29 29 0a 09 20 29 29 0a 20 20     ))))).. )).  
9fa0: 20 20 20 72 75 6e 73 29 29 0a 20 20 23 74 29 0a     runs)).  #t).
9fb0: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  .;;=============
9fc0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9fd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9fe0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9ff0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 75  =========.;; Rou
a000: 74 69 6e 65 73 20 66 6f 72 20 6d 61 6e 69 70 75  tines for manipu
a010: 6c 61 74 69 6e 67 20 72 75 6e 73 0a 3b 3b 3d 3d  lating runs.;;==
a020: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a030: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a040: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a050: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a060: 3d 3d 3d 3d 0a 0a 3b 3b 20 53 69 6e 63 65 20 6d  ====..;; Since m
a070: 61 6e 79 20 63 61 6c 6c 73 20 74 6f 20 61 20 72  any calls to a r
a080: 75 6e 20 72 65 71 75 69 72 65 20 70 72 65 74 74  un require prett
a090: 79 20 6d 75 63 68 20 74 68 65 20 73 61 6d 65 20  y much the same 
a0a0: 73 65 74 75 70 20 0a 3b 3b 20 74 68 69 73 20 77  setup .;; this w
a0b0: 72 61 70 70 65 72 20 69 73 20 75 73 65 64 20 74  rapper is used t
a0c0: 6f 20 72 65 64 75 63 65 20 74 68 65 20 72 65 70  o reduce the rep
a0d0: 6c 69 63 61 74 69 6f 6e 20 6f 66 20 63 6f 64 65  lication of code
a0e0: 0a 28 64 65 66 69 6e 65 20 28 67 65 6e 65 72 61  .(define (genera
a0f0: 6c 2d 72 75 6e 2d 63 61 6c 6c 20 73 77 69 74 63  l-run-call switc
a100: 68 6e 61 6d 65 20 61 63 74 69 6f 6e 2d 64 65 73  hname action-des
a110: 63 20 70 72 6f 63 29 0a 20 20 28 6c 65 74 20 28  c proc).  (let (
a120: 28 72 75 6e 6e 61 6d 65 20 28 61 72 67 73 3a 67  (runname (args:g
a130: 65 74 2d 61 72 67 20 22 3a 72 75 6e 6e 61 6d 65  et-arg ":runname
a140: 22 29 29 0a 09 28 74 61 72 67 65 74 20 20 28 69  "))..(target  (i
a150: 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20  f (args:get-arg 
a160: 22 2d 74 61 72 67 65 74 22 29 0a 09 09 20 20 20  "-target")...   
a170: 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20    (args:get-arg 
a180: 22 2d 74 61 72 67 65 74 22 29 0a 09 09 20 20 20  "-target")...   
a190: 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20    (args:get-arg 
a1a0: 22 2d 72 65 71 74 61 72 67 22 29 29 29 0a 09 28  "-reqtarg")))..(
a1b0: 74 68 31 20 20 20 20 20 23 66 29 29 0a 20 20 20  th1     #f)).   
a1c0: 20 28 63 6f 6e 64 0a 20 20 20 20 20 28 28 6e 6f   (cond.     ((no
a1d0: 74 20 74 61 72 67 65 74 29 0a 20 20 20 20 20 20  t target).      
a1e0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
a1f0: 45 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67 20 72  ERROR: Missing r
a200: 65 71 75 69 72 65 64 20 70 61 72 61 6d 65 74 65  equired paramete
a210: 72 20 66 6f 72 20 22 20 73 77 69 74 63 68 6e 61  r for " switchna
a220: 6d 65 20 22 2c 20 79 6f 75 20 6d 75 73 74 20 73  me ", you must s
a230: 70 65 63 69 66 79 20 74 68 65 20 74 61 72 67 65  pecify the targe
a240: 74 20 77 69 74 68 20 2d 74 61 72 67 65 74 22 29  t with -target")
a250: 0a 20 20 20 20 20 20 28 65 78 69 74 20 33 29 29  .      (exit 3))
a260: 0a 20 20 20 20 20 28 28 6e 6f 74 20 72 75 6e 6e  .     ((not runn
a270: 61 6d 65 29 0a 20 20 20 20 20 20 28 64 65 62 75  ame).      (debu
a280: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52  g:print 0 "ERROR
a290: 3a 20 4d 69 73 73 69 6e 67 20 72 65 71 75 69 72  : Missing requir
a2a0: 65 64 20 70 61 72 61 6d 65 74 65 72 20 66 6f 72  ed parameter for
a2b0: 20 22 20 73 77 69 74 63 68 6e 61 6d 65 20 22 2c   " switchname ",
a2c0: 20 79 6f 75 20 6d 75 73 74 20 73 70 65 63 69 66   you must specif
a2d0: 79 20 74 68 65 20 72 75 6e 20 6e 61 6d 65 20 77  y the run name w
a2e0: 69 74 68 20 3a 72 75 6e 6e 61 6d 65 20 72 75 6e  ith :runname run
a2f0: 6e 61 6d 65 22 29 0a 20 20 20 20 20 20 28 65 78  name").      (ex
a300: 69 74 20 33 29 29 0a 20 20 20 20 20 28 65 6c 73  it 3)).     (els
a310: 65 0a 20 20 20 20 20 20 28 6c 65 74 20 28 28 64  e.      (let ((d
a320: 62 20 20 20 23 66 29 0a 09 20 20 20 20 28 6b 65  b   #f)..    (ke
a330: 79 73 20 23 66 29 29 0a 09 28 69 66 20 28 6e 6f  ys #f))..(if (no
a340: 74 20 28 73 65 74 75 70 2d 66 6f 72 2d 72 75 6e  t (setup-for-run
a350: 29 29 0a 09 20 20 20 20 28 62 65 67 69 6e 20 0a  ))..    (begin .
a360: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72  .      (debug:pr
a370: 69 6e 74 20 30 20 22 46 61 69 6c 65 64 20 74 6f  int 0 "Failed to
a380: 20 73 65 74 75 70 2c 20 65 78 69 74 69 6e 67 22   setup, exiting"
a390: 29 0a 09 20 20 20 20 20 20 28 65 78 69 74 20 31  )..      (exit 1
a3a0: 29 29 29 0a 09 28 69 66 20 28 61 72 67 73 3a 67  )))..(if (args:g
a3b0: 65 74 2d 61 72 67 20 22 2d 73 65 72 76 65 72 22  et-arg "-server"
a3c0: 29 0a 09 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e  )..    (open-run
a3d0: 2d 63 6c 6f 73 65 20 73 65 72 76 65 72 3a 73 74  -close server:st
a3e0: 61 72 74 20 64 62 20 28 61 72 67 73 3a 67 65 74  art db (args:get
a3f0: 2d 61 72 67 20 22 2d 73 65 72 76 65 72 22 29 29  -arg "-server"))
a400: 0a 20 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20  . .    (if (not 
a410: 28 6f 72 20 28 61 72 67 73 3a 67 65 74 2d 61 72  (or (args:get-ar
a420: 67 20 22 2d 72 75 6e 61 6c 6c 22 29 20 20 20 20  g "-runall")    
a430: 20 3b 3b 20 72 75 6e 61 6c 6c 20 61 6e 64 20 72   ;; runall and r
a440: 75 6e 74 65 73 74 73 20 61 72 65 20 61 6c 6c 6f  untests are allo
a450: 77 65 64 20 74 6f 20 62 65 20 73 65 72 76 65 72  wed to be server
a460: 73 0a 20 09 09 09 20 28 61 72 67 73 3a 67 65 74  s. ... (args:get
a470: 2d 61 72 67 20 22 2d 72 75 6e 74 65 73 74 73 22  -arg "-runtests"
a480: 29 29 29 0a 09 09 28 73 65 72 76 65 72 3a 63 6c  )))...(server:cl
a490: 69 65 6e 74 2d 73 65 74 75 70 29 29 29 0a 09 28  ient-setup)))..(
a4a0: 73 65 74 21 20 6b 65 79 73 20 28 6f 70 65 6e 2d  set! keys (open-
a4b0: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
a4c0: 2d 6b 65 79 73 20 64 62 29 29 0a 09 3b 3b 20 68  -keys db))..;; h
a4d0: 61 76 65 20 65 6e 6f 75 67 68 20 74 6f 20 70 72  ave enough to pr
a4e0: 6f 63 65 73 73 20 2d 74 61 72 67 65 74 20 6f 72  ocess -target or
a4f0: 20 2d 72 65 71 74 61 72 67 20 68 65 72 65 0a 09   -reqtarg here..
a500: 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72  (if (args:get-ar
a510: 67 20 22 2d 72 65 71 74 61 72 67 22 29 0a 09 20  g "-reqtarg").. 
a520: 20 20 20 28 6c 65 74 2a 20 28 28 72 75 6e 63 6f     (let* ((runco
a530: 6e 66 69 67 66 20 28 63 6f 6e 63 20 20 2a 74 6f  nfigf (conc  *to
a540: 70 70 61 74 68 2a 20 22 2f 72 75 6e 63 6f 6e 66  ppath* "/runconf
a550: 69 67 73 2e 63 6f 6e 66 69 67 22 29 29 20 3b 3b  igs.config")) ;;
a560: 20 44 4f 20 4e 4f 54 20 45 56 41 4c 55 41 54 45   DO NOT EVALUATE
a570: 20 41 4c 4c 20 0a 09 09 20 20 20 28 72 75 6e 63   ALL ...   (runc
a580: 6f 6e 66 69 67 20 20 28 72 65 61 64 2d 63 6f 6e  onfig  (read-con
a590: 66 69 67 20 72 75 6e 63 6f 6e 66 69 67 66 20 23  fig runconfigf #
a5a0: 66 20 23 66 20 65 6e 76 69 72 6f 6e 2d 70 61 74  f #f environ-pat
a5b0: 74 3a 20 23 66 29 29 29 20 0a 09 20 20 20 20 20  t: #f))) ..     
a5c0: 20 28 69 66 20 28 68 61 73 68 2d 74 61 62 6c 65   (if (hash-table
a5d0: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 72 75 6e  -ref/default run
a5e0: 63 6f 6e 66 69 67 20 28 61 72 67 73 3a 67 65 74  config (args:get
a5f0: 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29  -arg "-reqtarg")
a600: 20 23 66 29 0a 09 09 20 20 28 6b 65 79 73 3a 74   #f)...  (keys:t
a610: 61 72 67 65 74 2d 73 65 74 2d 61 72 67 73 20 6b  arget-set-args k
a620: 65 79 73 20 28 61 72 67 73 3a 67 65 74 2d 61 72  eys (args:get-ar
a630: 67 20 22 2d 72 65 71 74 61 72 67 22 29 20 61 72  g "-reqtarg") ar
a640: 67 73 3a 61 72 67 2d 68 61 73 68 29 0a 09 09 20  gs:arg-hash)... 
a650: 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 28 64   (begin...    (d
a660: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
a670: 52 4f 52 3a 20 5b 22 20 28 61 72 67 73 3a 67 65  ROR: [" (args:ge
a680: 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22  t-arg "-reqtarg"
a690: 29 20 22 5d 20 6e 6f 74 20 66 6f 75 6e 64 20 69  ) "] not found i
a6a0: 6e 20 22 20 72 75 6e 63 6f 6e 66 69 67 66 29 0a  n " runconfigf).
a6b0: 09 09 20 20 20 20 28 69 66 20 64 62 20 28 73 71  ..    (if db (sq
a6c0: 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20  lite3:finalize! 
a6d0: 64 62 29 29 0a 09 09 20 20 20 20 28 65 78 69 74  db))...    (exit
a6e0: 20 31 29 29 29 29 0a 09 20 20 20 20 28 69 66 20   1))))..    (if 
a6f0: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
a700: 74 61 72 67 65 74 22 29 0a 09 09 28 6b 65 79 73  target")...(keys
a710: 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 72 67 73  :target-set-args
a720: 20 6b 65 79 73 20 28 61 72 67 73 3a 67 65 74 2d   keys (args:get-
a730: 61 72 67 20 22 2d 74 61 72 67 65 74 22 20 61 72  arg "-target" ar
a740: 67 73 3a 61 72 67 2d 68 61 73 68 29 20 61 72 67  gs:arg-hash) arg
a750: 73 3a 61 72 67 2d 68 61 73 68 29 29 29 0a 09 28  s:arg-hash)))..(
a760: 69 66 20 28 6e 6f 74 20 28 63 61 72 20 2a 63 6f  if (not (car *co
a770: 6e 66 69 67 69 6e 66 6f 2a 29 29 0a 09 20 20 20  nfiginfo*))..   
a780: 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 28   (begin..      (
a790: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45  debug:print 0 "E
a7a0: 52 52 4f 52 3a 20 41 74 74 65 6d 70 74 65 64 20  RROR: Attempted 
a7b0: 74 6f 20 22 20 61 63 74 69 6f 6e 2d 64 65 73 63  to " action-desc
a7c0: 20 22 20 62 75 74 20 72 75 6e 20 61 72 65 61 20   " but run area 
a7d0: 63 6f 6e 66 69 67 20 66 69 6c 65 20 6e 6f 74 20  config file not 
a7e0: 66 6f 75 6e 64 22 29 0a 09 20 20 20 20 20 20 28  found")..      (
a7f0: 65 78 69 74 20 31 29 29 0a 09 20 20 20 20 3b 3b  exit 1))..    ;;
a800: 20 45 78 74 72 61 63 74 20 6f 75 74 20 73 74 75   Extract out stu
a810: 66 66 20 6e 65 65 64 65 64 20 69 6e 20 6d 6f 73  ff needed in mos
a820: 74 20 6f 72 20 6d 61 6e 79 20 63 61 6c 6c 73 0a  t or many calls.
a830: 09 20 20 20 20 3b 3b 20 68 65 72 65 20 74 68 65  .    ;; here the
a840: 6e 20 63 61 6c 6c 20 70 72 6f 63 0a 09 20 20 20  n call proc..   
a850: 20 28 6c 65 74 2a 20 28 28 6b 65 79 6e 61 6d 65   (let* ((keyname
a860: 73 20 20 20 28 6d 61 70 20 6b 65 79 3a 67 65 74  s   (map key:get
a870: 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79 73 29  -fieldname keys)
a880: 29 0a 09 09 20 20 20 28 6b 65 79 76 61 6c 6c 73  )...   (keyvalls
a890: 74 20 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69 73  t  (keys->vallis
a8a0: 74 20 6b 65 79 73 20 23 74 29 29 29 0a 09 20 20  t keys #t)))..  
a8b0: 20 20 20 20 28 70 72 6f 63 20 74 61 72 67 65 74      (proc target
a8c0: 20 72 75 6e 6e 61 6d 65 20 6b 65 79 73 20 6b 65   runname keys ke
a8d0: 79 6e 61 6d 65 73 20 6b 65 79 76 61 6c 6c 73 74  ynames keyvallst
a8e0: 29 29 29 0a 09 28 69 66 20 74 68 31 20 28 74 68  )))..(if th1 (th
a8f0: 72 65 61 64 2d 6a 6f 69 6e 21 20 74 68 31 29 29  read-join! th1))
a900: 0a 09 28 69 66 20 64 62 20 28 73 71 6c 69 74 65  ..(if db (sqlite
a910: 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 29 29  3:finalize! db))
a920: 0a 09 28 73 65 74 21 20 2a 64 69 64 73 6f 6d 65  ..(set! *didsome
a930: 74 68 69 6e 67 2a 20 23 74 29 29 29 29 29 29 0a  thing* #t)))))).
a940: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  .;;=============
a950: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a960: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a970: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a980: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4c 6f 63  =========.;; Loc
a990: 6b 2f 75 6e 6c 6f 63 6b 20 72 75 6e 73 0a 3b 3b  k/unlock runs.;;
a9a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a9b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a9c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a9d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a9e0: 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65 20  ======..(define 
a9f0: 28 72 75 6e 73 3a 68 61 6e 64 6c 65 2d 6c 6f 63  (runs:handle-loc
aa00: 6b 69 6e 67 20 74 61 72 67 65 74 20 6b 65 79 73  king target keys
aa10: 20 72 75 6e 6e 61 6d 65 20 6c 6f 63 6b 20 75 6e   runname lock un
aa20: 6c 6f 63 6b 20 75 73 65 72 29 0a 20 20 28 6c 65  lock user).  (le
aa30: 74 2a 20 28 28 64 62 20 20 20 20 20 20 20 23 66  t* ((db       #f
aa40: 29 0a 09 20 28 72 75 6e 64 61 74 20 20 20 28 6f  ).. (rundat   (o
aa50: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75  pen-run-close ru
aa60: 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70  ns:get-runs-by-p
aa70: 61 74 74 20 64 62 20 6b 65 79 73 20 72 75 6e 6e  att db keys runn
aa80: 61 6d 65 29 29 0a 09 20 28 68 65 61 64 65 72 20  ame)).. (header 
aa90: 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75    (vector-ref ru
aaa0: 6e 64 61 74 20 30 29 29 0a 09 20 28 72 75 6e 73  ndat 0)).. (runs
aab0: 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66       (vector-ref
aac0: 20 72 75 6e 64 61 74 20 31 29 29 29 0a 20 20 20   rundat 1))).   
aad0: 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62   (for-each (lamb
aae0: 64 61 20 28 72 75 6e 29 0a 09 09 28 6c 65 74 20  da (run)...(let 
aaf0: 28 28 72 75 6e 2d 69 64 20 28 64 62 3a 67 65 74  ((run-id (db:get
ab00: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72  -value-by-header
ab10: 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 22   run header "id"
ab20: 29 29 29 0a 09 09 20 20 28 69 66 20 28 6f 72 20  )))...  (if (or 
ab30: 6c 6f 63 6b 0a 09 09 09 20 20 28 61 6e 64 20 75  lock....  (and u
ab40: 6e 6c 6f 63 6b 0a 09 09 09 20 20 20 20 20 20 20  nlock....       
ab50: 28 62 65 67 69 6e 0a 09 09 09 09 20 28 70 72 69  (begin..... (pri
ab60: 6e 74 20 22 44 6f 20 79 6f 75 20 72 65 61 6c 6c  nt "Do you reall
ab70: 79 20 77 69 73 68 20 74 6f 20 75 6e 6c 6f 63 6b  y wish to unlock
ab80: 20 72 75 6e 20 22 20 72 75 6e 2d 69 64 20 22 3f   run " run-id "?
ab90: 5c 6e 20 20 20 79 2f 6e 3a 20 22 29 0a 09 09 09  \n   y/n: ")....
aba0: 09 20 28 65 71 75 61 6c 3f 20 22 79 22 20 28 72  . (equal? "y" (r
abb0: 65 61 64 2d 6c 69 6e 65 29 29 29 29 29 0a 09 09  ead-line)))))...
abc0: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d        (open-run-
abd0: 63 6c 6f 73 65 20 64 62 3a 6c 6f 63 6b 2f 75 6e  close db:lock/un
abe0: 6c 6f 63 6b 2d 72 75 6e 20 64 62 20 72 75 6e 2d  lock-run db run-
abf0: 69 64 20 6c 6f 63 6b 20 75 6e 6c 6f 63 6b 20 75  id lock unlock u
ac00: 73 65 72 29 0a 09 09 20 20 20 20 20 20 28 64 65  ser)...      (de
ac10: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 30  bug:print-info 0
ac20: 20 22 53 6b 69 70 70 69 6e 67 20 6c 6f 63 6b 2f   "Skipping lock/
ac30: 75 6e 6c 6f 63 6b 20 6f 6e 20 22 20 72 75 6e 2d  unlock on " run-
ac40: 69 64 29 29 29 29 0a 09 20 20 20 20 20 20 72 75  id))))..      ru
ac50: 6e 73 29 29 29 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d  ns))).;;========
ac60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
ac70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
ac80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
ac90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b  ==============.;
aca0: 3b 20 52 6f 6c 6c 75 70 20 72 75 6e 73 0a 3b 3b  ; Rollup runs.;;
acb0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
acc0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
acd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
ace0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
acf0: 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 55 70 64 61 74  ======..;; Updat
ad00: 65 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61 20  e the test_meta 
ad10: 74 61 62 6c 65 20 66 6f 72 20 74 68 69 73 20 74  table for this t
ad20: 65 73 74 0a 28 64 65 66 69 6e 65 20 28 72 75 6e  est.(define (run
ad30: 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65  s:update-test_me
ad40: 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20  ta db test-name 
ad50: 74 65 73 74 2d 63 6f 6e 66 29 0a 20 20 28 6c 65  test-conf).  (le
ad60: 74 20 28 28 63 75 72 72 72 65 63 6f 72 64 20 28  t ((currrecord (
ad70: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64  open-run-close d
ad80: 62 3a 74 65 73 74 6d 65 74 61 2d 67 65 74 2d 72  b:testmeta-get-r
ad90: 65 63 6f 72 64 20 64 62 20 74 65 73 74 2d 6e 61  ecord db test-na
ada0: 6d 65 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e  me))).    (if (n
adb0: 6f 74 20 63 75 72 72 72 65 63 6f 72 64 29 0a 09  ot currrecord)..
adc0: 28 62 65 67 69 6e 0a 09 20 20 28 73 65 74 21 20  (begin..  (set! 
add0: 63 75 72 72 72 65 63 6f 72 64 20 28 6d 61 6b 65  currrecord (make
ade0: 2d 76 65 63 74 6f 72 20 31 30 20 23 66 29 29 0a  -vector 10 #f)).
adf0: 09 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f  .  (open-run-clo
ae00: 73 65 20 64 62 3a 74 65 73 74 6d 65 74 61 2d 61  se db:testmeta-a
ae10: 64 64 2d 72 65 63 6f 72 64 20 64 62 20 74 65 73  dd-record db tes
ae20: 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 66  t-name))).    (f
ae30: 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c  or-each .     (l
ae40: 61 6d 62 64 61 20 28 6b 65 79 29 0a 20 20 20 20  ambda (key).    
ae50: 20 20 20 28 6c 65 74 2a 20 28 28 69 64 78 20 28     (let* ((idx (
ae60: 63 61 64 72 20 6b 65 79 29 29 0a 09 20 20 20 20  cadr key))..    
ae70: 20 20 28 66 6c 64 20 28 63 61 72 20 20 6b 65 79    (fld (car  key
ae80: 29 29 0a 09 20 20 20 20 20 20 28 76 61 6c 20 28  ))..      (val (
ae90: 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 65  config-lookup te
aea0: 73 74 2d 63 6f 6e 66 20 22 74 65 73 74 5f 6d 65  st-conf "test_me
aeb0: 74 61 22 20 66 6c 64 29 29 29 0a 09 20 3b 3b 20  ta" fld))).. ;; 
aec0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 35 20 22  (debug:print 5 "
aed0: 69 64 78 3a 20 22 20 69 64 78 20 22 20 66 6c 64  idx: " idx " fld
aee0: 3a 20 22 20 66 6c 64 20 22 20 76 61 6c 3a 20 22  : " fld " val: "
aef0: 20 76 61 6c 29 0a 09 20 28 69 66 20 28 61 6e 64   val).. (if (and
af00: 20 76 61 6c 20 28 6e 6f 74 20 28 65 71 75 61 6c   val (not (equal
af10: 3f 20 28 76 65 63 74 6f 72 2d 72 65 66 20 63 75  ? (vector-ref cu
af20: 72 72 72 65 63 6f 72 64 20 69 64 78 29 20 76 61  rrrecord idx) va
af30: 6c 29 29 29 0a 09 20 20 20 20 20 28 62 65 67 69  l)))..     (begi
af40: 6e 0a 09 20 20 20 20 20 20 20 28 70 72 69 6e 74  n..       (print
af50: 20 22 55 70 64 61 74 69 6e 67 20 22 20 74 65 73   "Updating " tes
af60: 74 2d 6e 61 6d 65 20 22 20 22 20 66 6c 64 20 22  t-name " " fld "
af70: 20 74 6f 20 22 20 76 61 6c 29 0a 09 20 20 20 20   to " val)..    
af80: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f     (open-run-clo
af90: 73 65 20 64 62 3a 74 65 73 74 6d 65 74 61 2d 75  se db:testmeta-u
afa0: 70 64 61 74 65 2d 66 69 65 6c 64 20 64 62 20 74  pdate-field db t
afb0: 65 73 74 2d 6e 61 6d 65 20 66 6c 64 20 76 61 6c  est-name fld val
afc0: 29 29 29 29 29 0a 20 20 20 20 20 27 28 28 22 61  ))))).     '(("a
afd0: 75 74 68 6f 72 22 20 32 29 28 22 6f 77 6e 65 72  uthor" 2)("owner
afe0: 22 20 33 29 28 22 64 65 73 63 72 69 70 74 69 6f  " 3)("descriptio
aff0: 6e 22 20 34 29 28 22 72 65 76 69 65 77 65 64 22  n" 4)("reviewed"
b000: 20 35 29 28 22 74 61 67 73 22 20 39 29 29 29 29   5)("tags" 9))))
b010: 29 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74 65 73  )..;; Update tes
b020: 74 5f 6d 65 74 61 20 66 6f 72 20 61 6c 6c 20 74  t_meta for all t
b030: 65 73 74 73 0a 28 64 65 66 69 6e 65 20 28 72 75  ests.(define (ru
b040: 6e 73 3a 75 70 64 61 74 65 2d 61 6c 6c 2d 74 65  ns:update-all-te
b050: 73 74 5f 6d 65 74 61 20 64 62 29 0a 20 20 28 6c  st_meta db).  (l
b060: 65 74 20 28 28 74 65 73 74 2d 6e 61 6d 65 73 20  et ((test-names 
b070: 28 67 65 74 2d 61 6c 6c 2d 6c 65 67 61 6c 2d 74  (get-all-legal-t
b080: 65 73 74 73 29 29 29 0a 20 20 20 20 28 66 6f 72  ests))).    (for
b090: 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d  -each .     (lam
b0a0: 62 64 61 20 28 74 65 73 74 2d 6e 61 6d 65 29 0a  bda (test-name).
b0b0: 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74         (let* ((t
b0c0: 65 73 74 2d 70 61 74 68 20 20 20 20 28 63 6f 6e  est-path    (con
b0d0: 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65  c *toppath* "/te
b0e0: 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29  sts/" test-name)
b0f0: 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d 63  )..      (test-c
b100: 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 74 65 73  onfigf (conc tes
b110: 74 2d 70 61 74 68 20 22 2f 74 65 73 74 63 6f 6e  t-path "/testcon
b120: 66 69 67 22 29 29 0a 09 20 20 20 20 20 20 28 74  fig"))..      (t
b130: 65 73 74 65 78 69 73 74 73 20 20 20 28 61 6e 64  estexists   (and
b140: 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 74   (file-exists? t
b150: 65 73 74 2d 63 6f 6e 66 69 67 66 29 28 66 69 6c  est-configf)(fil
b160: 65 2d 72 65 61 64 2d 61 63 63 65 73 73 3f 20 74  e-read-access? t
b170: 65 73 74 2d 63 6f 6e 66 69 67 66 29 29 29 0a 09  est-configf)))..
b180: 20 20 20 20 20 20 3b 3b 20 72 65 61 64 20 63 6f        ;; read co
b190: 6e 66 69 67 73 20 77 69 74 68 20 74 72 69 63 6b  nfigs with trick
b1a0: 73 20 74 75 72 6e 65 64 20 6f 66 66 20 28 69 2e  s turned off (i.
b1b0: 65 2e 20 6e 6f 20 73 79 73 74 65 6d 29 0a 09 20  e. no system).. 
b1c0: 20 20 20 20 20 28 74 65 73 74 2d 63 6f 6e 66 20       (test-conf 
b1d0: 20 20 20 28 69 66 20 74 65 73 74 65 78 69 73 74     (if testexist
b1e0: 73 20 28 72 65 61 64 2d 63 6f 6e 66 69 67 20 74  s (read-config t
b1f0: 65 73 74 2d 63 6f 6e 66 69 67 66 20 23 66 20 23  est-configf #f #
b200: 66 29 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62  f)(make-hash-tab
b210: 6c 65 29 29 29 29 0a 09 20 3b 3b 20 75 73 65 20  le)))).. ;; use 
b220: 74 68 65 20 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f  the open-run-clo
b230: 73 65 20 69 6e 73 74 65 61 64 20 6f 66 20 70 61  se instead of pa
b240: 73 73 69 6e 67 20 69 6e 20 64 62 0a 09 20 28 72  ssing in db.. (r
b250: 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f  uns:update-test_
b260: 6d 65 74 61 20 23 66 20 74 65 73 74 2d 6e 61 6d  meta #f test-nam
b270: 65 20 74 65 73 74 2d 63 6f 6e 66 29 29 29 0a 20  e test-conf))). 
b280: 20 20 20 20 74 65 73 74 2d 6e 61 6d 65 73 29 29      test-names))
b290: 29 0a 0a 3b 3b 20 54 68 69 73 20 63 6f 75 6c 64  )..;; This could
b2a0: 20 70 72 6f 62 61 62 6c 79 20 62 65 20 72 65 66   probably be ref
b2b0: 61 63 74 6f 72 65 64 20 69 6e 74 6f 20 6f 6e 65  actored into one
b2c0: 20 63 6f 6d 70 6c 65 78 20 71 75 65 72 79 20 2e   complex query .
b2d0: 2e 2e 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73  ...(define (runs
b2e0: 3a 72 6f 6c 6c 75 70 2d 72 75 6e 20 6b 65 79 73  :rollup-run keys
b2f0: 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61   keyvallst runna
b300: 6d 65 20 75 73 65 72 29 20 3b 3b 20 77 61 73 20  me user) ;; was 
b310: 74 61 72 67 65 74 2c 20 6e 6f 77 20 6b 65 79 76  target, now keyv
b320: 61 6c 6c 73 74 0a 20 20 28 64 65 62 75 67 3a 70  allst.  (debug:p
b330: 72 69 6e 74 20 34 20 22 72 75 6e 73 3a 72 6f 6c  rint 4 "runs:rol
b340: 6c 75 70 2d 72 75 6e 2c 20 6b 65 79 73 3a 20 22  lup-run, keys: "
b350: 20 6b 65 79 73 20 22 20 6b 65 79 76 61 6c 6c 73   keys " keyvalls
b360: 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 20 22  t: " keyvallst "
b370: 20 3a 72 75 6e 6e 61 6d 65 20 22 20 72 75 6e 6e   :runname " runn
b380: 61 6d 65 20 22 20 75 73 65 72 3a 20 22 20 75 73  ame " user: " us
b390: 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 28 64 62  er).  (let* ((db
b3a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 66                #f
b3b0: 29 20 3b 3b 20 28 6b 65 79 76 61 6c 6c 6c 73 74  ) ;; (keyvalllst
b3c0: 20 20 20 20 20 20 28 6b 65 79 73 3a 74 61 72 67        (keys:targ
b3d0: 65 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 79 73 20  et->keyval keys 
b3e0: 74 61 72 67 65 74 29 29 0a 09 20 28 6e 65 77 2d  target)).. (new-
b3f0: 72 75 6e 2d 69 64 20 20 20 20 20 20 28 6f 70 65  run-id      (ope
b400: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73  n-run-close runs
b410: 3a 72 65 67 69 73 74 65 72 2d 72 75 6e 20 64 62  :register-run db
b420: 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20   keys keyvallst 
b430: 72 75 6e 6e 61 6d 65 20 22 6e 65 77 22 20 22 6e  runname "new" "n
b440: 2f 61 22 20 75 73 65 72 29 29 0a 09 20 28 70 72  /a" user)).. (pr
b450: 65 76 2d 74 65 73 74 73 20 20 20 20 20 20 28 6f  ev-tests      (o
b460: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 74 65  pen-run-close te
b470: 73 74 3a 67 65 74 2d 6d 61 74 63 68 69 6e 67 2d  st:get-matching-
b480: 70 72 65 76 69 6f 75 73 2d 74 65 73 74 2d 72 75  previous-test-ru
b490: 6e 2d 72 65 63 6f 72 64 73 20 64 62 20 6e 65 77  n-records db new
b4a0: 2d 72 75 6e 2d 69 64 20 22 25 22 20 22 25 22 29  -run-id "%" "%")
b4b0: 29 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73 20  ).. (curr-tests 
b4c0: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
b4d0: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74  lose db:get-test
b4e0: 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77  s-for-run db new
b4f0: 2d 72 75 6e 2d 69 64 20 22 25 2f 25 22 20 27 28  -run-id "%/%" '(
b500: 29 20 27 28 29 29 29 0a 09 20 28 63 75 72 72 2d  ) '())).. (curr-
b510: 74 65 73 74 73 2d 68 61 73 68 20 28 6d 61 6b 65  tests-hash (make
b520: 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 20  -hash-table))). 
b530: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f     (open-run-clo
b540: 73 65 20 64 62 3a 75 70 64 61 74 65 2d 72 75 6e  se db:update-run
b550: 2d 65 76 65 6e 74 5f 74 69 6d 65 20 64 62 20 6e  -event_time db n
b560: 65 77 2d 72 75 6e 2d 69 64 29 0a 20 20 20 20 3b  ew-run-id).    ;
b570: 3b 20 69 6e 64 65 78 20 74 68 65 20 61 6c 72 65  ; index the alre
b580: 61 64 79 20 73 61 76 65 64 20 74 65 73 74 73 20  ady saved tests 
b590: 62 79 20 74 65 73 74 6e 61 6d 65 20 61 6e 64 20  by testname and 
b5a0: 69 74 65 6d 64 61 74 20 69 6e 20 63 75 72 72 2d  itemdat in curr-
b5b0: 74 65 73 74 73 2d 68 61 73 68 0a 20 20 20 20 28  tests-hash.    (
b5c0: 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 28 6c  for-each.     (l
b5d0: 61 6d 62 64 61 20 28 74 65 73 74 64 61 74 29 0a  ambda (testdat).
b5e0: 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74         (let* ((t
b5f0: 65 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 65 73  estname  (db:tes
b600: 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74  t-get-testname t
b610: 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20  estdat))..      
b620: 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74  (item-path (db:t
b630: 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74  est-get-item-pat
b640: 68 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20  h testdat))..   
b650: 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 63     (full-name (c
b660: 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22  onc testname "/"
b670: 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 09 20   item-path))).. 
b680: 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21  (hash-table-set!
b690: 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68   curr-tests-hash
b6a0: 20 66 75 6c 6c 2d 6e 61 6d 65 20 74 65 73 74 64   full-name testd
b6b0: 61 74 29 29 29 0a 20 20 20 20 20 63 75 72 72 2d  at))).     curr-
b6c0: 74 65 73 74 73 29 0a 20 20 20 20 3b 3b 20 4e 4f  tests).    ;; NO
b6d0: 50 45 3a 20 4e 6f 6e 2d 6f 70 74 69 6d 61 6c 20  PE: Non-optimal 
b6e0: 61 70 70 72 6f 61 63 68 2e 20 54 72 79 20 74 68  approach. Try th
b6f0: 69 73 20 69 6e 73 74 65 61 64 2e 0a 20 20 20 20  is instead..    
b700: 3b 3b 20 20 20 31 2e 20 74 65 73 74 73 20 61 72  ;;   1. tests ar
b710: 65 20 72 65 63 65 69 76 65 64 20 69 6e 20 61 20  e received in a 
b720: 6c 69 73 74 2c 20 6d 6f 73 74 20 72 65 63 65 6e  list, most recen
b730: 74 20 66 69 72 73 74 0a 20 20 20 20 3b 3b 20 20  t first.    ;;  
b740: 20 32 2e 20 72 65 70 6c 61 63 65 20 74 68 65 20   2. replace the 
b750: 72 6f 6c 6c 75 70 20 74 65 73 74 20 77 69 74 68  rollup test with
b760: 20 74 68 65 20 6e 65 77 20 2a 61 6c 77 61 79 73   the new *always
b770: 2a 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20  *.    (for-each 
b780: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74  .     (lambda (t
b790: 65 73 74 64 61 74 29 0a 20 20 20 20 20 20 20 28  estdat).       (
b7a0: 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 20  let* ((testname 
b7b0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65   (db:test-get-te
b7c0: 73 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29  stname testdat))
b7d0: 0a 09 20 20 20 20 20 20 28 69 74 65 6d 2d 70 61  ..      (item-pa
b7e0: 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  th (db:test-get-
b7f0: 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 64 61  item-path testda
b800: 74 29 29 0a 09 20 20 20 20 20 20 28 66 75 6c 6c  t))..      (full
b810: 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74  -name (conc test
b820: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61  name "/" item-pa
b830: 74 68 29 29 0a 09 20 20 20 20 20 20 28 70 72 65  th))..      (pre
b840: 76 2d 74 65 73 74 2d 64 61 74 20 28 68 61 73 68  v-test-dat (hash
b850: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75  -table-ref/defau
b860: 6c 74 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61  lt curr-tests-ha
b870: 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 23 66 29  sh full-name #f)
b880: 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d 73  )..      (test-s
b890: 74 65 70 73 20 20 20 20 20 20 28 6f 70 65 6e 2d  teps      (open-
b8a0: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
b8b0: 2d 73 74 65 70 73 2d 66 6f 72 2d 74 65 73 74 20  -steps-for-test 
b8c0: 64 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  db (db:test-get-
b8d0: 69 64 20 74 65 73 74 64 61 74 29 29 29 0a 09 20  id testdat))).. 
b8e0: 20 20 20 20 20 28 6e 65 77 2d 74 65 73 74 2d 72       (new-test-r
b8f0: 65 63 6f 72 64 20 23 66 29 29 0a 09 20 3b 3b 20  ecord #f)).. ;; 
b900: 72 65 70 6c 61 63 65 20 74 68 65 73 65 20 77 69  replace these wi
b910: 74 68 20 69 6e 73 65 72 74 20 2e 2e 2e 20 73 65  th insert ... se
b920: 6c 65 63 74 0a 09 20 28 61 70 70 6c 79 20 73 71  lect.. (apply sq
b930: 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09  lite3:execute ..
b940: 09 64 62 20 0a 09 09 28 63 6f 6e 63 20 22 49 4e  .db ...(conc "IN
b950: 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20  SERT OR REPLACE 
b960: 49 4e 54 4f 20 74 65 73 74 73 20 28 72 75 6e 5f  INTO tests (run_
b970: 69 64 2c 74 65 73 74 6e 61 6d 65 2c 73 74 61 74  id,testname,stat
b980: 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74  e,status,event_t
b990: 69 6d 65 2c 68 6f 73 74 2c 63 70 75 6c 6f 61 64  ime,host,cpuload
b9a0: 2c 64 69 73 6b 66 72 65 65 2c 75 6e 61 6d 65 2c  ,diskfree,uname,
b9b0: 72 75 6e 64 69 72 2c 69 74 65 6d 5f 70 61 74 68  rundir,item_path
b9c0: 2c 72 75 6e 5f 64 75 72 61 74 69 6f 6e 2c 66 69  ,run_duration,fi
b9d0: 6e 61 6c 5f 6c 6f 67 66 2c 63 6f 6d 6d 65 6e 74  nal_logf,comment
b9e0: 29 20 22 0a 09 09 20 20 20 20 20 20 22 56 41 4c  ) "...      "VAL
b9f0: 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f  UES (?,?,?,?,?,?
ba00: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f  ,?,?,?,?,?,?,?,?
ba10: 29 3b 22 29 0a 09 09 6e 65 77 2d 72 75 6e 2d 69  );")...new-run-i
ba20: 64 20 28 63 64 64 72 20 28 76 65 63 74 6f 72 2d  d (cddr (vector-
ba30: 3e 6c 69 73 74 20 74 65 73 74 64 61 74 29 29 29  >list testdat)))
ba40: 0a 09 20 28 73 65 74 21 20 6e 65 77 2d 74 65 73  .. (set! new-tes
ba50: 74 64 61 74 20 28 63 61 72 20 28 6f 70 65 6e 2d  tdat (car (open-
ba60: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
ba70: 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64  -tests-for-run d
ba80: 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 28 63 6f  b new-run-id (co
ba90: 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22 20  nc testname "/" 
baa0: 69 74 65 6d 2d 70 61 74 68 29 20 27 28 29 20 27  item-path) '() '
bab0: 28 29 29 29 29 0a 09 20 28 68 61 73 68 2d 74 61  ()))).. (hash-ta
bac0: 62 6c 65 2d 73 65 74 21 20 63 75 72 72 2d 74 65  ble-set! curr-te
bad0: 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61  sts-hash full-na
bae0: 6d 65 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20  me new-testdat) 
baf0: 3b 3b 20 74 68 69 73 20 63 6f 75 6c 64 20 62 65  ;; this could be
bb00: 20 63 6f 6e 66 75 73 69 6e 67 2c 20 77 68 69 63   confusing, whic
bb10: 68 20 72 65 63 6f 72 64 20 73 68 6f 75 6c 64 20  h record should 
bb20: 67 6f 20 69 6e 74 6f 20 74 68 65 20 6c 6f 6f 6b  go into the look
bb30: 75 70 20 74 61 62 6c 65 3f 0a 09 20 3b 3b 20 4e  up table?.. ;; N
bb40: 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74 68 65  ow duplicate the
bb50: 20 74 65 73 74 20 73 74 65 70 73 0a 09 20 28 64   test steps.. (d
bb60: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 43 6f  ebug:print 4 "Co
bb70: 70 79 69 6e 67 20 72 65 63 6f 72 64 73 20 69 6e  pying records in
bb80: 20 74 65 73 74 5f 73 74 65 70 73 20 66 72 6f 6d   test_steps from
bb90: 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62 3a 74   test_id=" (db:t
bba0: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64  est-get-id testd
bbb0: 61 74 29 20 22 20 74 6f 20 22 20 28 64 62 3a 74  at) " to " (db:t
bbc0: 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74  est-get-id new-t
bbd0: 65 73 74 64 61 74 29 29 0a 09 20 28 6f 70 65 6e  estdat)).. (open
bbe0: 2d 72 75 6e 2d 63 6c 6f 73 65 20 0a 09 20 20 28  -run-close ..  (
bbf0: 6c 61 6d 62 64 61 20 28 29 0a 09 20 20 20 20 28  lambda ()..    (
bc00: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20  sqlite3:execute 
bc10: 0a 09 20 20 20 20 20 64 62 20 0a 09 20 20 20 20  ..     db ..    
bc20: 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f   (conc "INSERT O
bc30: 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74  R REPLACE INTO t
bc40: 65 73 74 5f 73 74 65 70 73 20 28 74 65 73 74 5f  est_steps (test_
bc50: 69 64 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 74  id,stepname,stat
bc60: 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74  e,status,event_t
bc70: 69 6d 65 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09  ime,comment) "..
bc80: 09 20 20 20 22 53 45 4c 45 43 54 20 22 20 28 64  .   "SELECT " (d
bc90: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65  b:test-get-id ne
bca0: 77 2d 74 65 73 74 64 61 74 29 20 22 2c 73 74 65  w-testdat) ",ste
bcb0: 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74  pname,state,stat
bcc0: 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f  us,event_time,co
bcd0: 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f  mment FROM test_
bce0: 73 74 65 70 73 20 57 48 45 52 45 20 74 65 73 74  steps WHERE test
bcf0: 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 20 20 20 28  _id=?;")..     (
bd00: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74  db:test-get-id t
bd10: 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 3b 3b  estdat))..    ;;
bd20: 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74   Now duplicate t
bd30: 68 65 20 74 65 73 74 20 64 61 74 61 0a 09 20 20  he test data..  
bd40: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34    (debug:print 4
bd50: 20 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64   "Copying record
bd60: 73 20 69 6e 20 74 65 73 74 5f 64 61 74 61 20 66  s in test_data f
bd70: 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64  rom test_id=" (d
bd80: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65  b:test-get-id te
bd90: 73 74 64 61 74 29 20 22 20 74 6f 20 22 20 28 64  stdat) " to " (d
bda0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65  b:test-get-id ne
bdb0: 77 2d 74 65 73 74 64 61 74 29 29 0a 09 20 20 20  w-testdat))..   
bdc0: 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74   (sqlite3:execut
bdd0: 65 20 0a 09 20 20 20 20 20 64 62 20 0a 09 20 20  e ..     db ..  
bde0: 20 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54     (conc "INSERT
bdf0: 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f   OR REPLACE INTO
be00: 20 74 65 73 74 5f 64 61 74 61 20 28 74 65 73 74   test_data (test
be10: 5f 69 64 2c 63 61 74 65 67 6f 72 79 2c 76 61 72  _id,category,var
be20: 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65  iable,value,expe
be30: 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63  cted,tol,units,c
be40: 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 22  omment) "...   "
be50: 53 45 4c 45 43 54 20 22 20 28 64 62 3a 74 65 73  SELECT " (db:tes
be60: 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73  t-get-id new-tes
be70: 74 64 61 74 29 20 22 2c 63 61 74 65 67 6f 72 79  tdat) ",category
be80: 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c  ,variable,value,
be90: 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69  expected,tol,uni
bea0: 74 73 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20  ts,comment FROM 
beb0: 74 65 73 74 5f 64 61 74 61 20 57 48 45 52 45 20  test_data WHERE 
bec0: 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20  test_id=?;")..  
bed0: 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d     (db:test-get-
bee0: 69 64 20 74 65 73 74 64 61 74 29 29 29 29 0a 09  id testdat))))..
bef0: 20 29 29 0a 20 20 20 20 20 70 72 65 76 2d 74 65   )).     prev-te
bf00: 73 74 73 29 29 29 0a 09 20 0a 20 20 20 20 20 0a  sts))).. .     .