Megatest

Hex Artifact Content
Login

Artifact d5c694d73c0ed03eb2fc930188d6e408860ab903:


0000: 0a 3b 3b 20 43 6f 70 79 72 69 67 68 74 20 32 30  .;; Copyright 20
0010: 30 36 2d 32 30 31 32 2c 20 4d 61 74 74 68 65 77  06-2012, Matthew
0020: 20 57 65 6c 6c 61 6e 64 2e 0a 3b 3b 20 0a 3b 3b   Welland..;; .;;
0030: 20 20 54 68 69 73 20 70 72 6f 67 72 61 6d 20 69    This program i
0040: 73 20 6d 61 64 65 20 61 76 61 69 6c 61 62 6c 65  s made available
0050: 20 75 6e 64 65 72 20 74 68 65 20 47 4e 55 20 47   under the GNU G
0060: 50 4c 20 76 65 72 73 69 6f 6e 20 32 2e 30 20 6f  PL version 2.0 o
0070: 72 0a 3b 3b 20 20 67 72 65 61 74 65 72 2e 20 53  r.;;  greater. S
0080: 65 65 20 74 68 65 20 61 63 63 6f 6d 70 61 6e 79  ee the accompany
0090: 69 6e 67 20 66 69 6c 65 20 43 4f 50 59 49 4e 47  ing file COPYING
00a0: 20 66 6f 72 20 64 65 74 61 69 6c 73 2e 0a 3b 3b   for details..;;
00b0: 20 0a 3b 3b 20 20 54 68 69 73 20 70 72 6f 67 72   .;;  This progr
00c0: 61 6d 20 69 73 20 64 69 73 74 72 69 62 75 74 65  am is distribute
00d0: 64 20 57 49 54 48 4f 55 54 20 41 4e 59 20 57 41  d WITHOUT ANY WA
00e0: 52 52 41 4e 54 59 3b 20 77 69 74 68 6f 75 74 20  RRANTY; without 
00f0: 65 76 65 6e 20 74 68 65 0a 3b 3b 20 20 69 6d 70  even the.;;  imp
0100: 6c 69 65 64 20 77 61 72 72 61 6e 74 79 20 6f 66  lied warranty of
0110: 20 4d 45 52 43 48 41 4e 54 41 42 49 4c 49 54 59   MERCHANTABILITY
0120: 20 6f 72 20 46 49 54 4e 45 53 53 20 46 4f 52 20   or FITNESS FOR 
0130: 41 20 50 41 52 54 49 43 55 4c 41 52 0a 3b 3b 20  A PARTICULAR.;; 
0140: 20 50 55 52 50 4f 53 45 2e 0a 0a 3b 3b 20 20 73   PURPOSE...;;  s
0150: 74 72 66 74 69 6d 65 28 27 25 6d 2f 25 64 2f 25  trftime('%m/%d/%
0160: 59 20 25 48 3a 25 4d 3a 25 53 27 2c 27 6e 6f 77  Y %H:%M:%S','now
0170: 27 2c 27 6c 6f 63 61 6c 74 69 6d 65 27 29 0a 0a  ','localtime')..
0180: 28 75 73 65 20 73 71 6c 69 74 65 33 20 73 72 66  (use sqlite3 srf
0190: 69 2d 31 20 70 6f 73 69 78 20 72 65 67 65 78 20  i-1 posix regex 
01a0: 72 65 67 65 78 2d 63 61 73 65 20 73 72 66 69 2d  regex-case srfi-
01b0: 36 39 20 64 6f 74 2d 6c 6f 63 6b 69 6e 67 20 28  69 dot-locking (
01c0: 73 72 66 69 20 31 38 29 20 70 6f 73 69 78 2d 65  srfi 18) posix-e
01d0: 78 74 72 61 73 20 64 69 72 65 63 74 6f 72 79 2d  xtras directory-
01e0: 75 74 69 6c 73 29 0a 28 69 6d 70 6f 72 74 20 28  utils).(import (
01f0: 70 72 65 66 69 78 20 73 71 6c 69 74 65 33 20 73  prefix sqlite3 s
0200: 71 6c 69 74 65 33 3a 29 29 0a 0a 28 64 65 63 6c  qlite3:))..(decl
0210: 61 72 65 20 28 75 6e 69 74 20 72 75 6e 73 29 29  are (unit runs))
0220: 0a 28 64 65 63 6c 61 72 65 20 28 75 73 65 73 20  .(declare (uses 
0230: 64 62 29 29 0a 28 64 65 63 6c 61 72 65 20 28 75  db)).(declare (u
0240: 73 65 73 20 63 6f 6d 6d 6f 6e 29 29 0a 28 64 65  ses common)).(de
0250: 63 6c 61 72 65 20 28 75 73 65 73 20 69 74 65 6d  clare (uses item
0260: 73 29 29 0a 28 64 65 63 6c 61 72 65 20 28 75 73  s)).(declare (us
0270: 65 73 20 72 75 6e 63 6f 6e 66 69 67 29 29 0a 28  es runconfig)).(
0280: 64 65 63 6c 61 72 65 20 28 75 73 65 73 20 74 65  declare (uses te
0290: 73 74 73 29 29 0a 28 64 65 63 6c 61 72 65 20 28  sts)).(declare (
02a0: 75 73 65 73 20 73 65 72 76 65 72 29 29 0a 0a 28  uses server))..(
02b0: 69 6e 63 6c 75 64 65 20 22 63 6f 6d 6d 6f 6e 5f  include "common_
02c0: 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 0a 28 69  records.scm").(i
02d0: 6e 63 6c 75 64 65 20 22 6b 65 79 5f 72 65 63 6f  nclude "key_reco
02e0: 72 64 73 2e 73 63 6d 22 29 0a 28 69 6e 63 6c 75  rds.scm").(inclu
02f0: 64 65 20 22 64 62 5f 72 65 63 6f 72 64 73 2e 73  de "db_records.s
0300: 63 6d 22 29 0a 28 69 6e 63 6c 75 64 65 20 22 72  cm").(include "r
0310: 75 6e 5f 72 65 63 6f 72 64 73 2e 73 63 6d 22 29  un_records.scm")
0320: 0a 28 69 6e 63 6c 75 64 65 20 22 74 65 73 74 5f  .(include "test_
0330: 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 0a 0a 3b  records.scm")..;
0340: 3b 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d  ; runs:get-runs-
0350: 62 79 2d 70 61 74 74 0a 3b 3b 20 67 65 74 20 72  by-patt.;; get r
0360: 75 6e 73 20 62 79 20 6c 69 73 74 20 6f 66 20 63  uns by list of c
0370: 72 69 74 65 72 69 61 0a 3b 3b 20 72 65 67 69 73  riteria.;; regis
0380: 74 65 72 20 61 20 74 65 73 74 20 72 75 6e 20 77  ter a test run w
0390: 69 74 68 20 74 68 65 20 64 62 0a 3b 3b 0a 3b 3b  ith the db.;;.;;
03a0: 20 55 73 65 3a 20 28 64 62 2d 67 65 74 2d 76 61   Use: (db-get-va
03b0: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 28 64  lue-by-header (d
03c0: 62 3a 67 65 74 2d 68 65 61 64 65 72 20 72 75 6e  b:get-header run
03d0: 69 6e 66 6f 29 28 64 62 3a 67 65 74 2d 72 6f 77  info)(db:get-row
03e0: 20 72 75 6e 69 6e 66 6f 29 29 0a 3b 3b 20 20 74   runinfo)).;;  t
03f0: 6f 20 65 78 74 72 61 63 74 20 69 6e 66 6f 20 66  o extract info f
0400: 72 6f 6d 20 74 68 65 20 73 74 72 75 63 74 75 72  rom the structur
0410: 65 20 72 65 74 75 72 6e 65 64 0a 3b 3b 0a 28 64  e returned.;;.(d
0420: 65 66 69 6e 65 20 28 72 75 6e 73 3a 67 65 74 2d  efine (runs:get-
0430: 72 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20  runs-by-patt db 
0440: 6b 65 79 73 20 72 75 6e 6e 61 6d 65 70 61 74 74  keys runnamepatt
0450: 29 20 3b 3b 20 74 65 73 74 2d 6e 61 6d 65 29 0a  ) ;; test-name).
0460: 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 76 61 6c    (let* ((keyval
0470: 6c 73 74 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69  lst (keys->valli
0480: 73 74 20 6b 65 79 73 29 29 0a 09 20 28 74 6d 70  st keys)).. (tmp
0490: 20 20 20 20 20 20 28 72 75 6e 73 3a 67 65 74 2d        (runs:get-
04a0: 73 74 64 2d 72 75 6e 2d 66 69 65 6c 64 73 20 6b  std-run-fields k
04b0: 65 79 73 20 27 28 22 69 64 22 20 22 72 75 6e 6e  eys '("id" "runn
04c0: 61 6d 65 22 20 22 73 74 61 74 65 22 20 22 73 74  ame" "state" "st
04d0: 61 74 75 73 22 20 22 6f 77 6e 65 72 22 20 22 65  atus" "owner" "e
04e0: 76 65 6e 74 5f 74 69 6d 65 22 29 29 29 0a 09 20  vent_time"))).. 
04f0: 28 6b 65 79 73 74 72 20 20 20 28 63 61 72 20 74  (keystr   (car t
0500: 6d 70 29 29 0a 09 20 28 68 65 61 64 65 72 20 20  mp)).. (header  
0510: 20 28 63 61 64 72 20 74 6d 70 29 29 0a 09 20 28   (cadr tmp)).. (
0520: 72 65 73 20 20 20 20 20 27 28 29 29 0a 09 20 28  res     '()).. (
0530: 6b 65 79 2d 70 61 74 74 20 22 22 29 0a 09 20 28  key-patt "").. (
0540: 72 75 6e 77 69 6c 64 74 79 70 65 20 28 69 66 20  runwildtype (if 
0550: 28 73 75 62 73 74 72 69 6e 67 2d 69 6e 64 65 78  (substring-index
0560: 20 22 25 22 20 72 75 6e 6e 61 6d 65 70 61 74 74   "%" runnamepatt
0570: 29 20 22 6c 69 6b 65 22 20 22 67 6c 6f 62 22 29  ) "like" "glob")
0580: 29 0a 09 20 28 71 72 79 2d 73 74 72 20 20 23 66  ).. (qry-str  #f
0590: 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68  )).    (for-each
05a0: 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 76 61 6c   (lambda (keyval
05b0: 29 0a 09 09 28 6c 65 74 2a 20 28 28 6b 65 79 20  )...(let* ((key 
05c0: 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 6b     (vector-ref k
05d0: 65 79 76 61 6c 20 30 29 29 0a 09 09 20 20 20 20  eyval 0))...    
05e0: 20 20 20 28 66 75 6c 6b 65 79 20 28 63 6f 6e 63     (fulkey (conc
05f0: 20 22 3a 22 20 6b 65 79 29 29 0a 09 09 20 20 20   ":" key))...   
0600: 20 20 20 20 28 70 61 74 74 20 20 20 28 61 72 67      (patt   (arg
0610: 73 3a 67 65 74 2d 61 72 67 20 66 75 6c 6b 65 79  s:get-arg fulkey
0620: 29 29 0a 09 09 20 20 20 20 20 20 20 28 77 69 6c  ))...       (wil
0630: 64 74 79 70 65 20 28 69 66 20 28 73 75 62 73 74  dtype (if (subst
0640: 72 69 6e 67 2d 69 6e 64 65 78 20 22 25 22 20 70  ring-index "%" p
0650: 61 74 74 29 20 22 6c 69 6b 65 22 20 22 67 6c 6f  att) "like" "glo
0660: 62 22 29 29 29 0a 09 09 20 20 28 69 66 20 70 61  b")))...  (if pa
0670: 74 74 0a 09 09 20 20 20 20 20 20 28 73 65 74 21  tt...      (set!
0680: 20 6b 65 79 2d 70 61 74 74 20 28 63 6f 6e 63 20   key-patt (conc 
0690: 6b 65 79 2d 70 61 74 74 20 22 20 41 4e 44 20 22  key-patt " AND "
06a0: 20 6b 65 79 20 22 20 22 20 77 69 6c 64 74 79 70   key " " wildtyp
06b0: 65 20 22 20 27 22 20 70 61 74 74 20 22 27 22 29  e " '" patt "'")
06c0: 29 0a 09 09 20 20 20 20 20 20 28 62 65 67 69 6e  )...      (begin
06d0: 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74  ....(debug:print
06e0: 20 30 20 22 45 52 52 4f 52 3a 20 73 65 61 72 63   0 "ERROR: searc
06f0: 68 69 6e 67 20 66 6f 72 20 72 75 6e 73 20 77 69  hing for runs wi
0700: 74 68 20 6e 6f 20 70 61 74 74 65 72 6e 20 73 65  th no pattern se
0710: 74 20 66 6f 72 20 22 20 66 75 6c 6b 65 79 29 0a  t for " fulkey).
0720: 09 09 09 28 65 78 69 74 20 36 29 29 29 29 29 0a  ...(exit 6))))).
0730: 09 20 20 20 20 20 20 6b 65 79 73 29 0a 20 20 20  .      keys).   
0740: 20 28 73 65 74 21 20 71 72 79 2d 73 74 72 20 28   (set! qry-str (
0750: 63 6f 6e 63 20 22 53 45 4c 45 43 54 20 22 20 6b  conc "SELECT " k
0760: 65 79 73 74 72 20 22 20 46 52 4f 4d 20 72 75 6e  eystr " FROM run
0770: 73 20 57 48 45 52 45 20 72 75 6e 6e 61 6d 65 20  s WHERE runname 
0780: 22 20 72 75 6e 77 69 6c 64 74 79 70 65 20 22 20  " runwildtype " 
0790: 3f 20 22 20 6b 65 79 2d 70 61 74 74 20 22 3b 22  ? " key-patt ";"
07a0: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72  )).    (debug:pr
07b0: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 72 75 6e 73  int-info 4 "runs
07c0: 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74  :get-runs-by-pat
07d0: 74 20 71 72 79 3d 22 20 71 72 79 2d 73 74 72 20  t qry=" qry-str 
07e0: 22 20 22 20 72 75 6e 6e 61 6d 65 70 61 74 74 29  " " runnamepatt)
07f0: 0a 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66 6f  .    (sqlite3:fo
0800: 72 2d 65 61 63 68 2d 72 6f 77 20 0a 20 20 20 20  r-each-row .    
0810: 20 28 6c 61 6d 62 64 61 20 28 61 20 2e 20 72 29   (lambda (a . r)
0820: 0a 20 20 20 20 20 20 20 28 73 65 74 21 20 72 65  .       (set! re
0830: 73 20 28 63 6f 6e 73 20 28 6c 69 73 74 2d 3e 76  s (cons (list->v
0840: 65 63 74 6f 72 20 28 63 6f 6e 73 20 61 20 72 29  ector (cons a r)
0850: 29 20 72 65 73 29 29 29 0a 20 20 20 20 20 64 62  ) res))).     db
0860: 20 0a 20 20 20 20 20 71 72 79 2d 73 74 72 0a 20   .     qry-str. 
0870: 20 20 20 20 72 75 6e 6e 61 6d 65 70 61 74 74 29      runnamepatt)
0880: 0a 20 20 20 20 28 76 65 63 74 6f 72 20 68 65 61  .    (vector hea
0890: 64 65 72 20 72 65 73 29 29 29 0a 0a 28 64 65 66  der res)))..(def
08a0: 69 6e 65 20 28 72 75 6e 73 3a 74 65 73 74 2d 67  ine (runs:test-g
08b0: 65 74 2d 66 75 6c 6c 2d 70 61 74 68 20 74 65 73  et-full-path tes
08c0: 74 29 0a 20 20 28 6c 65 74 2a 20 28 28 74 65 73  t).  (let* ((tes
08d0: 74 6e 61 6d 65 20 28 64 62 3a 74 65 73 74 2d 67  tname (db:test-g
08e0: 65 74 2d 74 65 73 74 6e 61 6d 65 20 20 20 74 65  et-testname   te
08f0: 73 74 29 29 0a 09 20 28 69 74 65 6d 70 61 74 68  st)).. (itempath
0900: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74   (db:test-get-it
0910: 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29 29 0a  em-path test))).
0920: 20 20 20 20 28 63 6f 6e 63 20 74 65 73 74 6e 61      (conc testna
0930: 6d 65 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69  me (if (equal? i
0940: 74 65 6d 70 61 74 68 20 22 22 29 20 22 22 20 28  tempath "") "" (
0950: 63 6f 6e 63 20 22 28 22 20 69 74 65 6d 70 61 74  conc "(" itempat
0960: 68 20 22 29 22 29 29 29 29 29 0a 0a 28 64 65 66  h ")")))))..(def
0970: 69 6e 65 20 28 64 62 3a 67 65 74 2d 72 75 6e 2d  ine (db:get-run-
0980: 6b 65 79 2d 76 61 6c 20 64 62 20 72 75 6e 2d 69  key-val db run-i
0990: 64 20 6b 65 79 29 0a 20 20 28 6c 65 74 20 28 28  d key).  (let ((
09a0: 72 65 73 20 23 66 29 29 0a 20 20 20 20 28 73 71  res #f)).    (sq
09b0: 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72  lite3:for-each-r
09c0: 6f 77 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20  ow.     (lambda 
09d0: 28 76 61 6c 29 0a 20 20 20 20 20 20 20 28 73 65  (val).       (se
09e0: 74 21 20 72 65 73 20 76 61 6c 29 29 0a 20 20 20  t! res val)).   
09f0: 20 20 64 62 20 0a 20 20 20 20 20 28 63 6f 6e 63    db .     (conc
0a00: 20 22 53 45 4c 45 43 54 20 22 20 28 6b 65 79 3a   "SELECT " (key:
0a10: 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65  get-fieldname ke
0a20: 79 29 20 22 20 46 52 4f 4d 20 72 75 6e 73 20 57  y) " FROM runs W
0a30: 48 45 52 45 20 69 64 3d 3f 3b 22 29 0a 20 20 20  HERE id=?;").   
0a40: 20 20 72 75 6e 2d 69 64 29 0a 20 20 20 20 72 65    run-id).    re
0a50: 73 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 64 62  s))..(define (db
0a60: 3a 67 65 74 2d 72 75 6e 2d 6e 61 6d 65 2d 66 72  :get-run-name-fr
0a70: 6f 6d 2d 69 64 20 64 62 20 72 75 6e 2d 69 64 29  om-id db run-id)
0a80: 0a 20 20 28 6c 65 74 20 28 28 72 65 73 20 23 66  .  (let ((res #f
0a90: 29 29 0a 20 20 20 20 28 73 71 6c 69 74 65 33 3a  )).    (sqlite3:
0aa0: 66 6f 72 2d 65 61 63 68 2d 72 6f 77 0a 20 20 20  for-each-row.   
0ab0: 20 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 6e 61    (lambda (runna
0ac0: 6d 65 29 0a 20 20 20 20 20 20 20 28 73 65 74 21  me).       (set!
0ad0: 20 72 65 73 20 72 75 6e 6e 61 6d 65 29 29 0a 20   res runname)). 
0ae0: 20 20 20 20 64 62 0a 20 20 20 20 20 22 53 45 4c      db.     "SEL
0af0: 45 43 54 20 72 75 6e 6e 61 6d 65 20 46 52 4f 4d  ECT runname FROM
0b00: 20 72 75 6e 73 20 57 48 45 52 45 20 69 64 3d 3f   runs WHERE id=?
0b10: 3b 22 0a 20 20 20 20 20 72 75 6e 2d 69 64 29 0a  ;".     run-id).
0b20: 20 20 20 20 72 65 73 29 29 0a 0a 28 64 65 66 69      res))..(defi
0b30: 6e 65 20 28 73 65 74 2d 6d 65 67 61 74 65 73 74  ne (set-megatest
0b40: 2d 65 6e 76 2d 76 61 72 73 20 72 75 6e 2d 69 64  -env-vars run-id
0b50: 29 0a 20 20 28 6c 65 74 20 28 28 6b 65 79 73 20  ).  (let ((keys 
0b60: 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20  (cdb:remote-run 
0b70: 64 62 3a 67 65 74 2d 6b 65 79 73 20 23 66 29 29  db:get-keys #f))
0b80: 0a 09 28 76 61 6c 73 20 28 68 61 73 68 2d 74 61  ..(vals (hash-ta
0b90: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20  ble-ref/default 
0ba0: 2a 65 6e 76 2d 76 61 72 73 2d 62 79 2d 72 75 6e  *env-vars-by-run
0bb0: 2d 69 64 2a 20 72 75 6e 2d 69 64 20 23 66 29 29  -id* run-id #f))
0bc0: 29 0a 20 20 20 20 3b 3b 20 67 65 74 20 74 68 65  ).    ;; get the
0bd0: 20 69 6e 66 6f 20 66 72 6f 6d 20 74 68 65 20 64   info from the d
0be0: 62 20 61 6e 64 20 70 75 74 20 69 74 20 69 6e 20  b and put it in 
0bf0: 74 68 65 20 63 61 63 68 65 0a 20 20 20 20 28 69  the cache.    (i
0c00: 66 20 28 6e 6f 74 20 76 61 6c 73 29 0a 09 28 6c  f (not vals)..(l
0c10: 65 74 20 28 28 68 74 20 28 6d 61 6b 65 2d 68 61  et ((ht (make-ha
0c20: 73 68 2d 74 61 62 6c 65 29 29 29 0a 09 20 20 28  sh-table)))..  (
0c30: 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20  hash-table-set! 
0c40: 2a 65 6e 76 2d 76 61 72 73 2d 62 79 2d 72 75 6e  *env-vars-by-run
0c50: 2d 69 64 2a 20 72 75 6e 2d 69 64 20 68 74 29 0a  -id* run-id ht).
0c60: 09 20 20 28 73 65 74 21 20 76 61 6c 73 20 68 74  .  (set! vals ht
0c70: 29 0a 09 20 20 28 66 6f 72 2d 65 61 63 68 0a 09  )..  (for-each..
0c80: 20 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 29     (lambda (key)
0c90: 0a 09 20 20 20 20 20 28 68 61 73 68 2d 74 61 62  ..     (hash-tab
0ca0: 6c 65 2d 73 65 74 21 20 76 61 6c 73 20 6b 65 79  le-set! vals key
0cb0: 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e   (cdb:remote-run
0cc0: 20 64 62 3a 67 65 74 2d 72 75 6e 2d 6b 65 79 2d   db:get-run-key-
0cd0: 76 61 6c 20 23 66 20 72 75 6e 2d 69 64 20 6b 65  val #f run-id ke
0ce0: 79 29 29 29 0a 09 20 20 20 6b 65 79 73 29 29 29  y)))..   keys)))
0cf0: 0a 20 20 20 20 3b 3b 20 66 72 6f 6d 20 74 68 65  .    ;; from the
0d00: 20 63 61 63 68 65 64 20 64 61 74 61 20 73 65 74   cached data set
0d10: 20 74 68 65 20 76 61 72 73 0a 20 20 20 20 28 68   the vars.    (h
0d20: 61 73 68 2d 74 61 62 6c 65 2d 66 6f 72 2d 65 61  ash-table-for-ea
0d30: 63 68 0a 20 20 20 20 20 76 61 6c 73 0a 20 20 20  ch.     vals.   
0d40: 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 20 76    (lambda (key v
0d50: 61 6c 29 0a 20 20 20 20 20 20 20 28 64 65 62 75  al).       (debu
0d60: 67 3a 70 72 69 6e 74 20 32 20 22 73 65 74 65 6e  g:print 2 "seten
0d70: 76 20 22 20 28 6b 65 79 3a 67 65 74 2d 66 69 65  v " (key:get-fie
0d80: 6c 64 6e 61 6d 65 20 6b 65 79 29 20 22 20 22 20  ldname key) " " 
0d90: 76 61 6c 29 0a 20 20 20 20 20 20 20 28 73 65 74  val).       (set
0da0: 65 6e 76 20 28 6b 65 79 3a 67 65 74 2d 66 69 65  env (key:get-fie
0db0: 6c 64 6e 61 6d 65 20 6b 65 79 29 20 76 61 6c 29  ldname key) val)
0dc0: 29 29 0a 20 20 20 20 28 61 6c 69 73 74 2d 3e 65  )).    (alist->e
0dd0: 6e 76 2d 76 61 72 73 20 28 68 61 73 68 2d 74 61  nv-vars (hash-ta
0de0: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20  ble-ref/default 
0df0: 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 65 6e 76  *configdat* "env
0e00: 2d 6f 76 65 72 72 69 64 65 22 20 27 28 29 29 29  -override" '()))
0e10: 0a 20 20 20 20 3b 3b 20 4c 65 74 73 20 75 73 65  .    ;; Lets use
0e20: 20 74 68 69 73 20 61 73 20 61 6e 20 6f 70 70 6f   this as an oppo
0e30: 72 74 75 6e 69 74 79 20 74 6f 20 70 75 74 20 4d  rtunity to put M
0e40: 54 5f 52 55 4e 4e 41 4d 45 20 69 6e 20 74 68 65  T_RUNNAME in the
0e50: 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 20 20 20   environment.   
0e60: 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e   (setenv "MT_RUN
0e70: 4e 41 4d 45 22 20 28 63 64 62 3a 72 65 6d 6f 74  NAME" (cdb:remot
0e80: 65 2d 72 75 6e 20 64 62 3a 67 65 74 2d 72 75 6e  e-run db:get-run
0e90: 2d 6e 61 6d 65 2d 66 72 6f 6d 2d 69 64 20 23 66  -name-from-id #f
0ea0: 20 72 75 6e 2d 69 64 29 29 0a 20 20 20 20 28 73   run-id)).    (s
0eb0: 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e 5f 41 52  etenv "MT_RUN_AR
0ec0: 45 41 5f 48 4f 4d 45 22 20 2a 74 6f 70 70 61 74  EA_HOME" *toppat
0ed0: 68 2a 29 0a 20 20 20 20 29 29 0a 0a 28 64 65 66  h*).    ))..(def
0ee0: 69 6e 65 20 28 73 65 74 2d 69 74 65 6d 2d 65 6e  ine (set-item-en
0ef0: 76 2d 76 61 72 73 20 69 74 65 6d 64 61 74 29 0a  v-vars itemdat).
0f00: 20 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d    (for-each (lam
0f10: 62 64 61 20 28 69 74 65 6d 29 0a 09 20 20 20 20  bda (item)..    
0f20: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32    (debug:print 2
0f30: 20 22 73 65 74 65 6e 76 20 22 20 28 63 61 72 20   "setenv " (car 
0f40: 69 74 65 6d 29 20 22 20 22 20 28 63 61 64 72 20  item) " " (cadr 
0f50: 69 74 65 6d 29 29 0a 09 20 20 20 20 20 20 28 73  item))..      (s
0f60: 65 74 65 6e 76 20 28 63 61 72 20 69 74 65 6d 29  etenv (car item)
0f70: 20 28 63 61 64 72 20 69 74 65 6d 29 29 29 0a 09   (cadr item)))..
0f80: 20 20 20 20 69 74 65 6d 64 61 74 29 29 0a 0a 28      itemdat))..(
0f90: 64 65 66 69 6e 65 20 2a 6c 61 73 74 2d 6e 75 6d  define *last-num
0fa0: 2d 72 75 6e 6e 69 6e 67 2d 74 65 73 74 73 2a 20  -running-tests* 
0fb0: 30 29 0a 0a 3b 3b 20 45 76 65 72 79 20 74 69 6d  0)..;; Every tim
0fc0: 65 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74  e can-run-more-t
0fd0: 65 73 74 73 20 69 73 20 63 61 6c 6c 65 64 20 69  ests is called i
0fe0: 6e 63 72 65 6d 65 6e 74 20 74 68 65 20 64 65 6c  ncrement the del
0ff0: 61 79 0a 3b 3b 20 69 66 20 74 68 65 20 63 6f 75  ay.;; if the cou
1000: 0a 28 64 65 66 69 6e 65 20 2a 72 75 6e 73 3a 63  .(define *runs:c
1010: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74  an-run-more-test
1020: 73 2d 63 6f 75 6e 74 2a 20 30 29 0a 28 64 65 66  s-count* 0).(def
1030: 69 6e 65 20 28 72 75 6e 73 3a 73 68 72 69 6e 6b  ine (runs:shrink
1040: 2d 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65  -can-run-more-te
1050: 73 74 73 2d 63 6f 75 6e 74 29 0a 20 20 28 73 65  sts-count).  (se
1060: 74 21 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75 6e  t! *runs:can-run
1070: 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 63 6f 75 6e  -more-tests-coun
1080: 74 2a 20 30 29 29 20 3b 3b 20 28 2f 20 2a 72 75  t* 0)) ;; (/ *ru
1090: 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d  ns:can-run-more-
10a0: 74 65 73 74 73 2d 63 6f 75 6e 74 2a 20 32 29 29  tests-count* 2))
10b0: 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73  )..(define (runs
10c0: 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65  :can-run-more-te
10d0: 73 74 73 20 74 65 73 74 2d 72 65 63 6f 72 64 20  sts test-record 
10e0: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a  max-concurrent-j
10f0: 6f 62 73 29 0a 20 20 28 74 68 72 65 61 64 2d 73  obs).  (thread-s
1100: 6c 65 65 70 21 20 28 63 6f 6e 64 0a 09 09 20 20  leep! (cond...  
1110: 28 28 3e 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75  ((> *runs:can-ru
1120: 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 63 6f 75  n-more-tests-cou
1130: 6e 74 2a 20 32 30 29 20 32 29 3b 3b 20 6f 62 76  nt* 20) 2);; obv
1140: 69 6f 75 73 6c 79 20 68 61 76 65 6e 27 74 20 68  iously haven't h
1150: 61 64 20 61 6e 79 20 77 6f 72 6b 20 74 6f 20 64  ad any work to d
1160: 6f 20 66 6f 72 20 61 20 77 68 69 6c 65 0a 09 09  o for a while...
1170: 20 20 28 65 6c 73 65 20 30 29 29 29 0a 20 20 28    (else 0))).  (
1180: 6c 65 74 2a 20 28 28 74 63 6f 6e 66 69 67 20 20  let* ((tconfig  
1190: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28                 (
11a0: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
11b0: 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 74  get-testconfig t
11c0: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28  est-record)).. (
11d0: 6a 6f 62 67 72 6f 75 70 20 20 20 20 20 20 20 20  jobgroup        
11e0: 20 20 20 20 20 20 20 20 28 63 6f 6e 66 69 67 2d          (config-
11f0: 6c 6f 6f 6b 75 70 20 74 63 6f 6e 66 69 67 20 22  lookup tconfig "
1200: 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 6a  requirements" "j
1210: 6f 62 67 72 6f 75 70 22 29 29 0a 09 20 28 6e 75  obgroup")).. (nu
1220: 6d 2d 72 75 6e 6e 69 6e 67 20 20 20 20 20 20 20  m-running       
1230: 20 20 20 20 20 20 28 63 64 62 3a 72 65 6d 6f 74        (cdb:remot
1240: 65 2d 72 75 6e 20 64 62 3a 67 65 74 2d 63 6f 75  e-run db:get-cou
1250: 6e 74 2d 74 65 73 74 73 2d 72 75 6e 6e 69 6e 67  nt-tests-running
1260: 20 23 66 29 29 0a 09 20 28 6e 75 6d 2d 72 75 6e   #f)).. (num-run
1270: 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70  ning-in-jobgroup
1280: 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e   (cdb:remote-run
1290: 20 64 62 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 65   db:get-count-te
12a0: 73 74 73 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a  sts-running-in-j
12b0: 6f 62 67 72 6f 75 70 20 23 66 20 6a 6f 62 67 72  obgroup #f jobgr
12c0: 6f 75 70 29 29 0a 09 20 28 6a 6f 62 2d 67 72 6f  oup)).. (job-gro
12d0: 75 70 2d 6c 69 6d 69 74 20 20 20 20 20 20 20 20  up-limit        
12e0: 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20   (config-lookup 
12f0: 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 6a 6f 62  *configdat* "job
1300: 67 72 6f 75 70 73 22 20 6a 6f 62 67 72 6f 75 70  groups" jobgroup
1310: 29 29 29 0a 20 20 20 20 28 69 66 20 28 3e 20 28  ))).    (if (> (
1320: 2b 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 6e 75  + num-running nu
1330: 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62  m-running-in-job
1340: 67 72 6f 75 70 29 20 30 29 0a 09 28 73 65 74 21  group) 0)..(set!
1350: 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d   *runs:can-run-m
1360: 6f 72 65 2d 74 65 73 74 73 2d 63 6f 75 6e 74 2a  ore-tests-count*
1370: 20 28 2b 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75   (+ *runs:can-ru
1380: 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 63 6f 75  n-more-tests-cou
1390: 6e 74 2a 20 31 29 29 29 0a 20 20 20 20 28 69 66  nt* 1))).    (if
13a0: 20 28 6e 6f 74 20 28 65 71 3f 20 2a 6c 61 73 74   (not (eq? *last
13b0: 2d 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 74 65 73  -num-running-tes
13c0: 74 73 2a 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29  ts* num-running)
13d0: 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 64 65  )..(begin..  (de
13e0: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 6d 61 78  bug:print 2 "max
13f0: 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73  -concurrent-jobs
1400: 3a 20 22 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65  : " max-concurre
1410: 6e 74 2d 6a 6f 62 73 20 22 2c 20 6e 75 6d 2d 72  nt-jobs ", num-r
1420: 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75  unning: " num-ru
1430: 6e 6e 69 6e 67 29 0a 09 20 20 28 73 65 74 21 20  nning)..  (set! 
1440: 2a 6c 61 73 74 2d 6e 75 6d 2d 72 75 6e 6e 69 6e  *last-num-runnin
1450: 67 2d 74 65 73 74 73 2a 20 6e 75 6d 2d 72 75 6e  g-tests* num-run
1460: 6e 69 6e 67 29 29 29 0a 20 20 20 20 28 69 66 20  ning))).    (if 
1470: 28 6e 6f 74 20 28 65 71 3f 20 30 20 2a 67 6c 6f  (not (eq? 0 *glo
1480: 62 61 6c 65 78 69 74 73 74 61 74 75 73 2a 29 29  balexitstatus*))
1490: 0a 09 28 6c 69 73 74 20 23 66 20 6e 75 6d 2d 72  ..(list #f num-r
14a0: 75 6e 6e 69 6e 67 20 6e 75 6d 2d 72 75 6e 6e 69  unning num-runni
14b0: 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 6d  ng-in-jobgroup m
14c0: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f  ax-concurrent-jo
14d0: 62 73 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d  bs job-group-lim
14e0: 69 74 29 0a 09 28 6c 65 74 20 28 28 63 61 6e 2d  it)..(let ((can-
14f0: 6e 6f 74 2d 72 75 6e 2d 6d 6f 72 65 20 28 63 6f  not-run-more (co
1500: 6e 64 0a 09 09 09 09 20 3b 3b 20 69 66 20 6d 61  nd..... ;; if ma
1510: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62  x-concurrent-job
1520: 73 20 69 73 20 73 65 74 20 61 6e 64 20 74 68 65  s is set and the
1530: 20 6e 75 6d 62 65 72 20 72 75 6e 6e 69 6e 67 20   number running 
1540: 69 73 20 67 72 65 61 74 65 72 20 0a 09 09 09 09  is greater .....
1550: 20 3b 3b 20 74 68 61 6e 20 69 74 20 74 68 61 6e   ;; than it than
1560: 20 63 61 6e 6e 6f 74 20 72 75 6e 20 6d 6f 72 65   cannot run more
1570: 20 6a 6f 62 73 0a 09 09 09 09 20 28 28 61 6e 64   jobs..... ((and
1580: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d   max-concurrent-
1590: 6a 6f 62 73 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e  jobs (>= num-run
15a0: 6e 69 6e 67 20 6d 61 78 2d 63 6f 6e 63 75 72 72  ning max-concurr
15b0: 65 6e 74 2d 6a 6f 62 73 29 29 0a 09 09 09 09 20  ent-jobs))..... 
15c0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
15d0: 22 57 41 52 4e 49 4e 47 3a 20 4d 61 78 20 72 75  "WARNING: Max ru
15e0: 6e 6e 69 6e 67 20 6a 6f 62 73 20 65 78 63 65 65  nning jobs excee
15f0: 64 65 64 2c 20 63 75 72 72 65 6e 74 20 6e 75 6d  ded, current num
1600: 62 65 72 20 72 75 6e 6e 69 6e 67 3a 20 22 20 6e  ber running: " n
1610: 75 6d 2d 72 75 6e 6e 69 6e 67 20 0a 09 09 09 09  um-running .....
1620: 09 20 20 20 20 20 20 20 22 2c 20 6d 61 78 5f 63  .       ", max_c
1630: 6f 6e 63 75 72 72 65 6e 74 5f 6a 6f 62 73 3a 20  oncurrent_jobs: 
1640: 22 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74  " max-concurrent
1650: 2d 6a 6f 62 73 29 0a 09 09 09 09 20 20 23 74 29  -jobs).....  #t)
1660: 0a 09 09 09 09 20 3b 3b 20 69 66 20 6a 6f 62 2d  ..... ;; if job-
1670: 67 72 6f 75 70 2d 6c 69 6d 69 74 20 69 73 20 73  group-limit is s
1680: 65 74 20 61 6e 64 20 6e 75 6d 62 65 72 20 6f 66  et and number of
1690: 20 6a 6f 62 73 20 69 6e 20 74 68 65 20 67 72 6f   jobs in the gro
16a0: 75 70 20 69 73 20 67 72 65 61 74 65 72 0a 09 09  up is greater...
16b0: 09 09 20 3b 3b 20 74 68 61 6e 20 74 68 65 20 6c  .. ;; than the l
16c0: 69 6d 69 74 20 74 68 65 6e 20 63 61 6e 6e 6f 74  imit then cannot
16d0: 20 72 75 6e 20 6d 6f 72 65 20 6a 6f 62 73 20 6f   run more jobs o
16e0: 66 20 74 68 69 73 20 6b 69 6e 64 0a 09 09 09 09  f this kind.....
16f0: 20 28 28 61 6e 64 20 6a 6f 62 2d 67 72 6f 75 70   ((and job-group
1700: 2d 6c 69 6d 69 74 0a 09 09 09 09 20 20 20 20 20  -limit.....     
1710: 20 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e    (>= num-runnin
1720: 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 6a 6f  g-in-jobgroup jo
1730: 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 29 29 0a  b-group-limit)).
1740: 09 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 69  ....  (debug:pri
1750: 6e 74 20 31 20 22 57 41 52 4e 49 4e 47 3a 20 6e  nt 1 "WARNING: n
1760: 75 6d 62 65 72 20 6f 66 20 6a 6f 62 73 20 22 20  umber of jobs " 
1770: 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a  num-running-in-j
1780: 6f 62 67 72 6f 75 70 20 0a 09 09 09 09 09 20 20  obgroup ......  
1790: 20 20 20 20 20 22 20 69 6e 20 22 20 6a 6f 62 67       " in " jobg
17a0: 72 6f 75 70 20 22 20 65 78 63 65 65 64 65 64 2c  roup " exceeded,
17b0: 20 77 69 6c 6c 20 6e 6f 74 20 72 75 6e 20 22 20   will not run " 
17c0: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65  (tests:testqueue
17d0: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65  -get-testname te
17e0: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 09 09  st-record)).....
17f0: 20 20 23 74 29 0a 09 09 09 09 20 28 65 6c 73 65    #t)..... (else
1800: 20 23 66 29 29 29 29 0a 09 20 20 28 6c 69 73 74   #f))))..  (list
1810: 20 28 6e 6f 74 20 63 61 6e 2d 6e 6f 74 2d 72 75   (not can-not-ru
1820: 6e 2d 6d 6f 72 65 29 20 6e 75 6d 2d 72 75 6e 6e  n-more) num-runn
1830: 69 6e 67 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d  ing num-running-
1840: 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 6d 61 78 2d  in-jobgroup max-
1850: 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20  concurrent-jobs 
1860: 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 29  job-group-limit)
1870: 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d  ))))..;;========
1880: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1890: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
18a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
18b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b  ==============.;
18c0: 3b 20 4e 65 77 20 6d 65 74 68 6f 64 6f 6c 6f 67  ; New methodolog
18d0: 79 2e 20 54 68 65 73 65 20 72 6f 75 74 69 6e 65  y. These routine
18e0: 73 20 77 69 6c 6c 20 72 65 70 6c 61 63 65 20 74  s will replace t
18f0: 68 65 20 61 62 6f 76 65 20 69 6e 20 74 69 6d 65  he above in time
1900: 2e 20 46 6f 72 0a 3b 3b 20 6e 6f 77 20 74 68 65  . For.;; now the
1910: 20 63 6f 64 65 20 69 73 20 64 75 70 6c 69 63 61   code is duplica
1920: 74 65 64 2e 20 54 68 69 73 20 73 74 75 66 66 20  ted. This stuff 
1930: 69 73 20 69 6e 69 74 69 61 6c 6c 79 20 75 73 65  is initially use
1940: 64 20 69 6e 20 74 68 65 20 6d 6f 6e 69 74 6f 72  d in the monitor
1950: 0a 3b 3b 20 62 61 73 65 64 20 63 6f 64 65 2e 0a  .;; based code..
1960: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;;==============
1970: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1980: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1990: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
19a0: 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 0a 3b 3b 20 54 68  ========...;; Th
19b0: 69 73 20 69 73 20 61 20 64 75 70 6c 69 63 61 74  is is a duplicat
19c0: 65 20 6f 66 20 72 75 6e 2d 74 65 73 74 73 20 28  e of run-tests (
19d0: 77 68 69 63 68 20 68 61 73 20 62 65 65 6e 20 64  which has been d
19e0: 65 70 72 65 63 61 74 65 64 29 2e 20 55 73 65 20  eprecated). Use 
19f0: 74 68 69 73 20 6f 6e 65 20 69 6e 73 74 65 61 64  this one instead
1a00: 20 6f 66 20 72 75 6e 20 74 65 73 74 73 2e 0a 3b   of run tests..;
1a10: 3b 20 6b 65 79 76 61 6c 73 2e 0a 3b 3b 0a 3b 3b  ; keyvals..;;.;;
1a20: 20 20 74 65 73 74 2d 6e 61 6d 65 73 3a 20 43 6f    test-names: Co
1a30: 6d 6d 61 20 73 65 70 61 72 61 74 65 64 20 70 61  mma separated pa
1a40: 74 74 65 72 6e 73 20 73 61 6d 65 20 61 73 20 74  tterns same as t
1a50: 65 73 74 2d 70 61 74 74 73 20 62 75 74 20 75 73  est-patts but us
1a60: 65 64 20 69 6e 20 73 65 6c 65 63 74 69 6f 6e 20  ed in selection 
1a70: 0a 3b 3b 20 20 20 20 20 20 20 20 20 20 20 20 20  .;;             
1a80: 20 6f 66 20 74 65 73 74 73 20 74 6f 20 72 75 6e   of tests to run
1a90: 2e 20 54 68 65 20 69 74 65 6d 20 70 6f 72 74 69  . The item porti
1aa0: 6f 6e 73 20 61 72 65 20 6e 6f 74 20 72 65 73 70  ons are not resp
1ab0: 65 63 74 65 64 2e 0a 3b 3b 20 20 20 20 20 20 20  ected..;;       
1ac0: 20 20 20 20 20 20 20 46 49 58 4d 45 3a 20 65 72         FIXME: er
1ad0: 72 6f 72 20 6f 75 74 20 69 66 20 2f 70 61 74 74  ror out if /patt
1ae0: 20 73 70 65 63 69 66 69 65 64 0a 3b 3b 20 20 20   specified.;;   
1af0: 20 20 20 20 20 20 20 20 20 0a 28 64 65 66 69 6e           .(defin
1b00: 65 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74  e (runs:run-test
1b10: 73 20 74 61 72 67 65 74 20 72 75 6e 6e 61 6d 65  s target runname
1b20: 20 74 65 73 74 2d 6e 61 6d 65 73 20 74 65 73 74   test-names test
1b30: 2d 70 61 74 74 73 20 75 73 65 72 20 66 6c 61 67  -patts user flag
1b40: 73 29 0a 20 20 28 63 6f 6d 6d 6f 6e 3a 63 6c 65  s).  (common:cle
1b50: 61 72 2d 63 61 63 68 65 73 29 20 3b 3b 20 63 6c  ar-caches) ;; cl
1b60: 65 61 72 20 61 6c 6c 20 63 61 63 68 65 73 0a 20  ear all caches. 
1b70: 20 28 6c 65 74 2a 20 28 28 64 62 20 20 20 20 20   (let* ((db     
1b80: 20 20 20 20 20 23 66 29 0a 09 20 28 6b 65 79 73       #f).. (keys
1b90: 20 20 20 20 20 20 20 20 28 63 64 62 3a 72 65 6d          (cdb:rem
1ba0: 6f 74 65 2d 72 75 6e 20 64 62 3a 67 65 74 2d 6b  ote-run db:get-k
1bb0: 65 79 73 20 23 66 29 29 0a 09 20 28 6b 65 79 76  eys #f)).. (keyv
1bc0: 61 6c 6c 73 74 20 20 20 28 6b 65 79 73 3a 74 61  allst   (keys:ta
1bd0: 72 67 65 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 79  rget->keyval key
1be0: 73 20 74 61 72 67 65 74 29 29 0a 09 20 28 72 75  s target)).. (ru
1bf0: 6e 2d 69 64 20 20 20 20 20 20 28 63 64 62 3a 72  n-id      (cdb:r
1c00: 65 6d 6f 74 65 2d 72 75 6e 20 64 62 3a 72 65 67  emote-run db:reg
1c10: 69 73 74 65 72 2d 72 75 6e 20 23 66 20 6b 65 79  ister-run #f key
1c20: 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e  s keyvallst runn
1c30: 61 6d 65 20 22 6e 65 77 22 20 22 6e 2f 61 22 20  ame "new" "n/a" 
1c40: 75 73 65 72 29 29 20 20 3b 3b 20 20 74 65 73 74  user))  ;;  test
1c50: 2d 6e 61 6d 65 29 29 29 0a 09 20 28 6b 65 79 76  -name))).. (keyv
1c60: 61 6c 73 20 20 20 20 20 28 69 66 20 72 75 6e 2d  als     (if run-
1c70: 69 64 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72  id (cdb:remote-r
1c80: 75 6e 20 64 62 3a 67 65 74 2d 6b 65 79 2d 76 61  un db:get-key-va
1c90: 6c 73 20 23 66 20 72 75 6e 2d 69 64 29 20 23 66  ls #f run-id) #f
1ca0: 29 29 0a 09 20 28 64 65 66 65 72 72 65 64 20 20  )).. (deferred  
1cb0: 20 20 27 28 29 29 20 3b 3b 20 64 65 6c 61 79 20    '()) ;; delay 
1cc0: 72 75 6e 6e 69 6e 67 20 74 68 65 73 65 20 73 69  running these si
1cd0: 6e 63 65 20 74 68 65 79 20 68 61 76 65 20 61 20  nce they have a 
1ce0: 77 61 69 74 6f 6e 20 63 6c 61 75 73 65 0a 09 20  waiton clause.. 
1cf0: 3b 3b 20 6b 65 65 70 67 6f 69 6e 67 20 69 73 20  ;; keepgoing is 
1d00: 74 68 65 20 64 65 66 61 63 74 6f 20 6d 6f 64 61  the defacto moda
1d10: 6c 69 74 79 20 6e 6f 77 2c 20 77 69 6c 6c 20 61  lity now, will a
1d20: 64 64 20 68 69 74 2d 6e 2d 72 75 6e 20 61 20 62  dd hit-n-run a b
1d30: 69 74 20 6c 61 74 65 72 0a 09 20 3b 3b 20 28 6b  it later.. ;; (k
1d40: 65 65 70 67 6f 69 6e 67 20 20 20 28 68 61 73 68  eepgoing   (hash
1d50: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75  -table-ref/defau
1d60: 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 65 70 67  lt flags "-keepg
1d70: 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 28 72 75  oing" #f)).. (ru
1d80: 6e 63 6f 6e 66 69 67 66 20 20 20 28 63 6f 6e 63  nconfigf   (conc
1d90: 20 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72 75    *toppath* "/ru
1da0: 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22  nconfigs.config"
1db0: 29 29 0a 09 20 28 72 65 71 75 69 72 65 64 2d 74  )).. (required-t
1dc0: 65 73 74 73 20 27 28 29 29 0a 09 20 28 74 65 73  ests '()).. (tes
1dd0: 74 2d 72 65 63 6f 72 64 73 20 28 6d 61 6b 65 2d  t-records (make-
1de0: 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 0a 20  hash-table))).. 
1df0: 20 20 20 28 73 65 74 2d 6d 65 67 61 74 65 73 74     (set-megatest
1e00: 2d 65 6e 76 2d 76 61 72 73 20 72 75 6e 2d 69 64  -env-vars run-id
1e10: 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62  ) ;; these may b
1e20: 65 20 6e 65 65 64 65 64 20 62 79 20 74 68 65 20  e needed by the 
1e30: 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73  launching proces
1e40: 73 0a 0a 20 20 20 20 28 69 66 20 28 66 69 6c 65  s..    (if (file
1e50: 2d 65 78 69 73 74 73 3f 20 72 75 6e 63 6f 6e 66  -exists? runconf
1e60: 69 67 66 29 0a 09 28 73 65 74 75 70 2d 65 6e 76  igf)..(setup-env
1e70: 2d 64 65 66 61 75 6c 74 73 20 72 75 6e 63 6f 6e  -defaults runcon
1e80: 66 69 67 66 20 72 75 6e 2d 69 64 20 2a 61 6c 72  figf run-id *alr
1e90: 65 61 64 79 2d 73 65 65 6e 2d 72 75 6e 63 6f 6e  eady-seen-runcon
1ea0: 66 69 67 2d 69 6e 66 6f 2a 20 6b 65 79 73 20 6b  fig-info* keys k
1eb0: 65 79 76 61 6c 73 20 22 70 72 65 2d 6c 61 75 6e  eyvals "pre-laun
1ec0: 63 68 2d 65 6e 76 2d 76 61 72 73 22 29 0a 09 28  ch-env-vars")..(
1ed0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57  debug:print 0 "W
1ee0: 41 52 4e 49 4e 47 3a 20 59 6f 75 20 64 6f 20 6e  ARNING: You do n
1ef0: 6f 74 20 68 61 76 65 20 61 20 72 75 6e 20 63 6f  ot have a run co
1f00: 6e 66 69 67 20 66 69 6c 65 3a 20 22 20 72 75 6e  nfig file: " run
1f10: 63 6f 6e 66 69 67 66 29 29 0a 20 20 20 20 0a 20  configf)).    . 
1f20: 20 20 20 3b 3b 20 6c 6f 6f 6b 20 75 70 20 61 6c     ;; look up al
1f30: 6c 20 74 65 73 74 73 20 6d 61 74 63 68 69 6e 67  l tests matching
1f40: 20 74 68 65 20 63 6f 6d 6d 61 20 73 65 70 61 72   the comma separ
1f50: 61 74 65 64 20 6c 69 73 74 20 6f 66 20 67 6c 6f  ated list of glo
1f60: 62 73 20 69 6e 0a 20 20 20 20 3b 3b 20 74 65 73  bs in.    ;; tes
1f70: 74 2d 70 61 74 74 73 20 28 75 73 69 6e 67 20 25  t-patts (using %
1f80: 20 61 73 20 77 69 6c 64 63 61 72 64 29 0a 0a 20   as wildcard).. 
1f90: 20 20 20 28 73 65 74 21 20 74 65 73 74 2d 6e 61     (set! test-na
1fa0: 6d 65 73 20 28 74 65 73 74 73 3a 67 65 74 2d 76  mes (tests:get-v
1fb0: 61 6c 69 64 2d 74 65 73 74 73 20 2a 74 6f 70 70  alid-tests *topp
1fc0: 61 74 68 2a 20 74 65 73 74 2d 6e 61 6d 65 73 29  ath* test-names)
1fd0: 29 0a 20 20 20 20 28 73 65 74 21 20 74 65 73 74  ).    (set! test
1fe0: 2d 6e 61 6d 65 73 20 28 64 65 6c 65 74 65 2d 64  -names (delete-d
1ff0: 75 70 6c 69 63 61 74 65 73 20 74 65 73 74 2d 6e  uplicates test-n
2000: 61 6d 65 73 29 29 0a 0a 20 20 20 20 28 64 65 62  ames))..    (deb
2010: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 30 20  ug:print-info 0 
2020: 22 74 65 73 74 20 6e 61 6d 65 73 20 22 20 74 65  "test names " te
2030: 73 74 2d 6e 61 6d 65 73 29 0a 0a 20 20 20 20 3b  st-names)..    ;
2040: 3b 20 6f 6e 20 74 68 65 20 66 69 72 73 74 20 70  ; on the first p
2050: 61 73 73 20 6f 72 20 63 61 6c 6c 20 74 6f 20 72  ass or call to r
2060: 75 6e 2d 74 65 73 74 73 20 73 65 74 20 46 41 49  un-tests set FAI
2070: 4c 53 20 74 6f 20 4e 4f 54 5f 53 54 41 52 54 45  LS to NOT_STARTE
2080: 44 20 69 66 0a 20 20 20 20 3b 3b 20 2d 6b 65 65  D if.    ;; -kee
2090: 70 67 6f 69 6e 67 20 69 73 20 73 70 65 63 69 66  pgoing is specif
20a0: 69 65 64 0a 20 20 20 20 28 69 66 20 28 65 71 3f  ied.    (if (eq?
20b0: 20 2a 70 61 73 73 6e 75 6d 2a 20 30 29 0a 09 28   *passnum* 0)..(
20c0: 62 65 67 69 6e 0a 09 20 20 3b 3b 20 68 61 76 65  begin..  ;; have
20d0: 20 74 6f 20 64 65 6c 65 74 65 20 74 65 73 74 20   to delete test 
20e0: 72 65 63 6f 72 64 73 20 77 68 65 72 65 20 4e 4f  records where NO
20f0: 54 5f 53 54 41 52 54 45 44 20 73 69 6e 63 65 20  T_STARTED since 
2100: 74 68 65 79 20 63 61 6e 20 63 61 75 73 65 20 2d  they can cause -
2110: 6b 65 65 70 67 6f 69 6e 67 20 74 6f 20 0a 09 20  keepgoing to .. 
2120: 20 3b 3b 20 67 65 74 20 73 74 75 63 6b 20 64 75   ;; get stuck du
2130: 65 20 74 6f 20 62 65 63 6f 6d 69 6e 67 20 69 6e  e to becoming in
2140: 61 63 63 65 73 73 69 62 6c 65 20 66 72 6f 6d 20  accessible from 
2150: 61 20 66 61 69 6c 65 64 20 74 65 73 74 2e 20 49  a failed test. I
2160: 2e 65 2e 20 69 66 20 74 65 73 74 20 42 20 64 65  .e. if test B de
2170: 70 65 6e 64 73 20 0a 09 20 20 3b 3b 20 6f 6e 20  pends ..  ;; on 
2180: 74 65 73 74 20 41 20 62 75 74 20 74 65 73 74 20  test A but test 
2190: 42 20 72 65 61 63 68 65 64 20 74 68 65 20 70 6f  B reached the po
21a0: 69 6e 74 20 6f 6e 20 62 65 69 6e 67 20 72 65 67  int on being reg
21b0: 69 73 74 65 72 65 64 20 61 73 20 4e 4f 54 5f 53  istered as NOT_S
21c0: 54 41 52 54 45 44 20 61 6e 64 20 74 65 73 74 0a  TARTED and test.
21d0: 09 20 20 3b 3b 20 41 20 66 61 69 6c 65 64 20 66  .  ;; A failed f
21e0: 6f 72 20 73 6f 6d 65 20 72 65 61 73 6f 6e 20 74  or some reason t
21f0: 68 65 6e 20 6f 6e 20 72 65 2d 72 75 6e 20 75 73  hen on re-run us
2200: 69 6e 67 20 2d 6b 65 65 70 67 6f 69 6e 67 20 74  ing -keepgoing t
2210: 68 65 20 72 75 6e 20 63 61 6e 20 6e 65 76 65 72  he run can never
2220: 20 63 6f 6d 70 6c 65 74 65 2e 0a 09 20 20 28 63   complete...  (c
2230: 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 73 2d  db:delete-tests-
2240: 69 6e 2d 73 74 61 74 65 20 2a 72 75 6e 72 65 6d  in-state *runrem
2250: 6f 74 65 2a 20 72 75 6e 2d 69 64 20 22 4e 4f 54  ote* run-id "NOT
2260: 5f 53 54 41 52 54 45 44 22 29 0a 09 20 20 28 63  _STARTED")..  (c
2270: 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64 62  db:remote-run db
2280: 3a 73 65 74 2d 74 65 73 74 73 2d 73 74 61 74 65  :set-tests-state
2290: 2d 73 74 61 74 75 73 20 23 66 20 72 75 6e 2d 69  -status #f run-i
22a0: 64 20 74 65 73 74 2d 6e 61 6d 65 73 20 23 66 20  d test-names #f 
22b0: 22 46 41 49 4c 22 20 22 4e 4f 54 5f 53 54 41 52  "FAIL" "NOT_STAR
22c0: 54 45 44 22 20 22 46 41 49 4c 22 29 29 29 0a 0a  TED" "FAIL")))..
22d0: 20 20 20 20 3b 3b 20 66 72 6f 6d 20 68 65 72 65      ;; from here
22e0: 20 6f 6e 20 6f 75 74 20 74 68 65 20 64 62 20 77   on out the db w
22f0: 69 6c 6c 20 62 65 20 6f 70 65 6e 65 64 20 61 6e  ill be opened an
2300: 64 20 63 6c 6f 73 65 64 20 6f 6e 20 65 76 65 72  d closed on ever
2310: 79 20 63 61 6c 6c 20 72 75 6e 73 3a 72 75 6e 2d  y call runs:run-
2320: 74 65 73 74 73 2d 71 75 65 75 65 0a 20 20 20 20  tests-queue.    
2330: 3b 3b 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61  ;; (sqlite3:fina
2340: 6c 69 7a 65 21 20 64 62 29 20 0a 20 20 20 20 3b  lize! db) .    ;
2350: 3b 20 6e 6f 77 20 61 64 64 20 6e 6f 6e 2d 64 69  ; now add non-di
2360: 72 65 63 74 6c 79 20 72 65 66 65 72 65 6e 63 65  rectly reference
2370: 64 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 28  d dependencies (
2380: 69 2e 65 2e 20 77 61 69 74 6f 6e 29 0a 20 20 20  i.e. waiton).   
2390: 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f   (if (not (null?
23a0: 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 28   test-names))..(
23b0: 6c 65 74 20 6c 6f 6f 70 20 28 28 68 65 64 20 28  let loop ((hed (
23c0: 63 61 72 20 74 65 73 74 2d 6e 61 6d 65 73 29 29  car test-names))
23d0: 0a 09 09 20 20 20 28 74 61 6c 20 28 63 64 72 20  ...   (tal (cdr 
23e0: 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 20 20 20  test-names)))   
23f0: 20 20 20 20 20 20 3b 3b 20 27 72 65 74 75 72 6e        ;; 'return
2400: 2d 70 72 6f 63 73 20 74 65 6c 6c 73 20 74 68 65  -procs tells the
2410: 20 63 6f 6e 66 69 67 20 72 65 61 64 65 72 20 74   config reader t
2420: 6f 20 70 72 65 70 20 72 75 6e 6e 69 6e 67 20 73  o prep running s
2430: 79 73 74 65 6d 20 62 75 74 20 72 65 74 75 72 6e  ystem but return
2440: 20 61 20 70 72 6f 63 0a 09 20 20 28 64 65 62 75   a proc..  (debu
2450: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22  g:print-info 4 "
2460: 68 65 64 3d 22 20 68 65 64 20 22 20 61 74 20 74  hed=" hed " at t
2470: 6f 70 20 6f 66 20 6c 6f 6f 70 22 29 0a 09 20 20  op of loop")..  
2480: 28 6c 65 74 2a 20 28 28 63 6f 6e 66 69 67 20 20  (let* ((config  
2490: 28 74 65 73 74 73 3a 67 65 74 2d 74 65 73 74 63  (tests:get-testc
24a0: 6f 6e 66 69 67 20 68 65 64 20 27 72 65 74 75 72  onfig hed 'retur
24b0: 6e 2d 70 72 6f 63 73 29 29 0a 09 09 20 28 77 61  n-procs))... (wa
24c0: 69 74 6f 6e 73 20 28 6c 65 74 20 28 28 69 6e 73  itons (let ((ins
24d0: 74 72 20 28 69 66 20 63 6f 6e 66 69 67 20 0a 09  tr (if config ..
24e0: 09 09 09 09 20 20 20 28 63 6f 6e 66 69 67 2d 6c  ....   (config-l
24f0: 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 20 22 72 65  ookup config "re
2500: 71 75 69 72 65 6d 65 6e 74 73 22 20 22 77 61 69  quirements" "wai
2510: 74 6f 6e 22 29 0a 09 09 09 09 09 20 20 20 28 62  ton")......   (b
2520: 65 67 69 6e 20 3b 3b 20 4e 6f 20 63 6f 6e 66 69  egin ;; No confi
2530: 67 20 6d 65 61 6e 73 20 74 68 69 73 20 69 73 20  g means this is 
2540: 61 20 6e 6f 6e 2d 65 78 69 73 74 61 6e 74 20 74  a non-existant t
2550: 65 73 74 0a 09 09 09 09 09 20 20 20 20 20 28 64  est......     (d
2560: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
2570: 52 4f 52 3a 20 6e 6f 6e 2d 65 78 69 73 74 65 6e  ROR: non-existen
2580: 74 20 72 65 71 75 69 72 65 64 20 74 65 73 74 20  t required test 
2590: 5c 22 22 20 68 65 64 20 22 5c 22 22 29 0a 09 09  \"" hed "\"")...
25a0: 09 09 09 20 20 20 20 20 28 69 66 20 64 62 20 28  ...     (if db (
25b0: 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65  sqlite3:finalize
25c0: 21 20 64 62 29 29 0a 09 09 09 09 09 20 20 20 20  ! db))......    
25d0: 20 28 65 78 69 74 20 31 29 29 29 29 29 0a 09 09   (exit 1)))))...
25e0: 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  .    (debug:prin
25f0: 74 2d 69 6e 66 6f 20 38 20 22 77 61 69 74 6f 6e  t-info 8 "waiton
2600: 73 20 73 74 72 69 6e 67 20 69 73 20 22 20 69 6e  s string is " in
2610: 73 74 72 29 0a 09 09 09 20 20 20 20 28 73 74 72  str)....    (str
2620: 69 6e 67 2d 73 70 6c 69 74 20 28 63 6f 6e 64 0a  ing-split (cond.
2630: 09 09 09 09 09 20 20 20 28 28 70 72 6f 63 65 64  .....   ((proced
2640: 75 72 65 3f 20 69 6e 73 74 72 29 0a 09 09 09 09  ure? instr).....
2650: 09 20 20 20 20 28 6c 65 74 20 28 28 72 65 73 20  .    (let ((res 
2660: 28 69 6e 73 74 72 29 29 29 0a 09 09 09 09 09 20  (instr)))...... 
2670: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
2680: 74 2d 69 6e 66 6f 20 38 20 22 77 61 69 74 6f 6e  t-info 8 "waiton
2690: 20 70 72 6f 63 65 64 75 72 65 20 72 65 73 75 6c   procedure resul
26a0: 74 73 20 69 6e 20 73 74 72 69 6e 67 20 22 20 72  ts in string " r
26b0: 65 73 20 22 20 66 6f 72 20 74 65 73 74 20 22 20  es " for test " 
26c0: 68 65 64 29 0a 09 09 09 09 09 20 20 20 20 20 20  hed)......      
26d0: 72 65 73 29 29 0a 09 09 09 09 09 20 20 20 28 28  res))......   ((
26e0: 73 74 72 69 6e 67 3f 20 69 6e 73 74 72 29 20 20  string? instr)  
26f0: 20 20 20 69 6e 73 74 72 29 0a 09 09 09 09 09 20     instr)...... 
2700: 20 20 28 65 6c 73 65 20 0a 09 09 09 09 09 20 20    (else ......  
2710: 20 20 3b 3b 20 4e 4f 54 45 3a 20 54 68 69 73 20    ;; NOTE: This 
2720: 69 73 20 61 63 74 75 61 6c 6c 79 20 74 68 65 20  is actually the 
2730: 63 61 73 65 20 6f 66 20 2a 6e 6f 2a 20 77 61 69  case of *no* wai
2740: 74 6f 6e 73 21 20 3b 3b 20 28 64 65 62 75 67 3a  tons! ;; (debug:
2750: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
2760: 73 6f 6d 65 74 68 69 6e 67 20 77 65 6e 74 20 77  something went w
2770: 72 6f 6e 67 20 69 6e 20 70 72 6f 63 65 73 73 69  rong in processi
2780: 6e 67 20 77 61 69 74 6f 6e 73 20 66 6f 72 20 74  ng waitons for t
2790: 65 73 74 20 22 20 68 65 64 29 0a 09 09 09 09 09  est " hed)......
27a0: 20 20 20 20 22 22 29 29 29 29 29 29 0a 09 20 20      ""))))))..  
27b0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69    (debug:print-i
27c0: 6e 66 6f 20 38 20 22 77 61 69 74 6f 6e 73 3a 20  nfo 8 "waitons: 
27d0: 22 20 77 61 69 74 6f 6e 73 29 0a 09 20 20 20 20  " waitons)..    
27e0: 3b 3b 20 63 68 65 63 6b 20 66 6f 72 20 68 65 64  ;; check for hed
27f0: 20 69 6e 20 77 61 69 74 6f 6e 73 20 3d 3e 20 74   in waitons => t
2800: 68 69 73 20 77 6f 75 6c 64 20 62 65 20 63 69 72  his would be cir
2810: 63 75 6c 61 72 2c 20 72 65 6d 6f 76 65 20 69 74  cular, remove it
2820: 20 61 6e 64 20 69 73 73 75 65 20 61 6e 0a 09 20   and issue an.. 
2830: 20 20 20 3b 3b 20 65 72 72 6f 72 0a 09 20 20 20     ;; error..   
2840: 20 28 69 66 20 28 6d 65 6d 62 65 72 20 68 65 64   (if (member hed
2850: 20 77 61 69 74 6f 6e 73 29 0a 09 09 28 62 65 67   waitons)...(beg
2860: 69 6e 0a 09 09 20 20 28 64 65 62 75 67 3a 70 72  in...  (debug:pr
2870: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 74 65  int 0 "ERROR: te
2880: 73 74 20 22 20 68 65 64 20 22 20 68 61 73 20 6c  st " hed " has l
2890: 69 73 74 65 64 20 69 74 73 65 6c 66 20 61 73 20  isted itself as 
28a0: 61 20 77 61 69 74 6f 6e 2c 20 70 6c 65 61 73 65  a waiton, please
28b0: 20 63 6f 72 72 65 63 74 20 74 68 69 73 21 22 29   correct this!")
28c0: 0a 09 09 20 20 28 73 65 74 21 20 77 61 69 74 6f  ...  (set! waito
28d0: 6e 73 20 28 66 69 6c 74 65 72 20 28 6c 61 6d 62  ns (filter (lamb
28e0: 64 61 20 28 78 29 28 6e 6f 74 20 28 65 71 75 61  da (x)(not (equa
28f0: 6c 3f 20 78 20 68 65 64 29 29 29 20 77 61 69 74  l? x hed))) wait
2900: 6f 6e 73 29 29 29 29 0a 09 20 20 20 20 0a 09 20  ons))))..    .. 
2910: 20 20 20 3b 3b 20 28 69 74 65 6d 73 20 20 20 28     ;; (items   (
2920: 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d  items:get-items-
2930: 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 63 6f 6e 66  from-config conf
2940: 69 67 29 29 29 0a 09 20 20 20 20 28 69 66 20 28  ig)))..    (if (
2950: 6e 6f 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d  not (hash-table-
2960: 72 65 66 2f 64 65 66 61 75 6c 74 20 74 65 73 74  ref/default test
2970: 2d 72 65 63 6f 72 64 73 20 68 65 64 20 23 66 29  -records hed #f)
2980: 29 0a 09 09 28 68 61 73 68 2d 74 61 62 6c 65 2d  )...(hash-table-
2990: 73 65 74 21 20 74 65 73 74 2d 72 65 63 6f 72 64  set! test-record
29a0: 73 0a 09 09 09 09 20 68 65 64 20 28 76 65 63 74  s..... hed (vect
29b0: 6f 72 20 68 65 64 20 20 20 20 20 3b 3b 20 30 0a  or hed     ;; 0.
29c0: 09 09 09 09 09 20 20 20 20 20 63 6f 6e 66 69 67  .....     config
29d0: 20 20 3b 3b 20 31 0a 09 09 09 09 09 20 20 20 20    ;; 1......    
29e0: 20 77 61 69 74 6f 6e 73 20 3b 3b 20 32 0a 09 09   waitons ;; 2...
29f0: 09 09 09 20 20 20 20 20 28 63 6f 6e 66 69 67 2d  ...     (config-
2a00: 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 20 22 72  lookup config "r
2a10: 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 70 72  equirements" "pr
2a20: 69 6f 72 69 74 79 22 29 20 20 20 20 20 3b 3b 20  iority")     ;; 
2a30: 70 72 69 6f 72 69 74 79 20 33 0a 09 09 09 09 09  priority 3......
2a40: 20 20 20 20 20 28 6c 65 74 20 28 28 69 74 65 6d       (let ((item
2a50: 73 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 62  s      (hash-tab
2a60: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63  le-ref/default c
2a70: 6f 6e 66 69 67 20 22 69 74 65 6d 73 22 20 23 66  onfig "items" #f
2a80: 29 29 20 3b 3b 20 69 74 65 6d 73 20 34 0a 09 09  )) ;; items 4...
2a90: 09 09 09 09 20 20 20 28 69 74 65 6d 73 74 61 62  ....   (itemstab
2aa0: 6c 65 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72  le (hash-table-r
2ab0: 65 66 2f 64 65 66 61 75 6c 74 20 63 6f 6e 66 69  ef/default confi
2ac0: 67 20 22 69 74 65 6d 73 74 61 62 6c 65 22 20 23  g "itemstable" #
2ad0: 66 29 29 29 20 0a 09 09 09 09 09 20 20 20 20 20  f))) ......     
2ae0: 20 20 3b 3b 20 69 66 20 65 69 74 68 65 72 20 69    ;; if either i
2af0: 74 65 6d 73 20 6f 72 20 69 74 65 6d 73 20 74 61  tems or items ta
2b00: 62 6c 65 20 69 73 20 61 20 70 72 6f 63 20 72 65  ble is a proc re
2b10: 74 75 72 6e 20 69 74 20 73 6f 20 74 65 73 74 20  turn it so test 
2b20: 72 75 6e 6e 69 6e 67 0a 09 09 09 09 09 20 20 20  running......   
2b30: 20 20 20 20 3b 3b 20 70 72 6f 63 65 73 73 20 63      ;; process c
2b40: 61 6e 20 6b 6e 6f 77 20 74 6f 20 63 61 6c 6c 20  an know to call 
2b50: 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d  items:get-items-
2b60: 66 72 6f 6d 2d 63 6f 6e 66 69 67 0a 09 09 09 09  from-config.....
2b70: 09 20 20 20 20 20 20 20 3b 3b 20 69 66 20 65 69  .       ;; if ei
2b80: 74 68 65 72 20 69 73 20 61 20 6c 69 73 74 20 61  ther is a list a
2b90: 6e 64 20 6e 6f 6e 65 20 69 73 20 61 20 70 72 6f  nd none is a pro
2ba0: 63 20 67 6f 20 61 68 65 61 64 20 61 6e 64 20 63  c go ahead and c
2bb0: 61 6c 6c 20 67 65 74 2d 69 74 65 6d 73 0a 09 09  all get-items...
2bc0: 09 09 09 20 20 20 20 20 20 20 3b 3b 20 6f 74 68  ...       ;; oth
2bd0: 65 72 77 69 73 65 20 72 65 74 75 72 6e 20 23 66  erwise return #f
2be0: 20 2d 20 74 68 69 73 20 69 73 20 6e 6f 74 20 61   - this is not a
2bf0: 6e 20 69 74 65 72 61 74 65 64 20 74 65 73 74 0a  n iterated test.
2c00: 09 09 09 09 09 20 20 20 20 20 20 20 28 63 6f 6e  .....       (con
2c10: 64 0a 09 09 09 09 09 09 28 28 70 72 6f 63 65 64  d.......((proced
2c20: 75 72 65 3f 20 69 74 65 6d 73 29 20 20 20 20 20  ure? items)     
2c30: 20 0a 09 09 09 09 09 09 20 28 64 65 62 75 67 3a   ....... (debug:
2c40: 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 69 74  print-info 4 "it
2c50: 65 6d 73 20 69 73 20 61 20 70 72 6f 63 65 64 75  ems is a procedu
2c60: 72 65 2c 20 77 69 6c 6c 20 63 61 6c 63 20 6c 61  re, will calc la
2c70: 74 65 72 22 29 0a 09 09 09 09 09 09 20 69 74 65  ter")....... ite
2c80: 6d 73 29 20 20 20 20 20 20 20 20 20 20 20 20 3b  ms)            ;
2c90: 3b 20 63 61 6c 63 20 6c 61 74 65 72 0a 09 09 09  ; calc later....
2ca0: 09 09 09 28 28 70 72 6f 63 65 64 75 72 65 3f 20  ...((procedure? 
2cb0: 69 74 65 6d 73 74 61 62 6c 65 29 0a 09 09 09 09  itemstable).....
2cc0: 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d  .. (debug:print-
2cd0: 69 6e 66 6f 20 34 20 22 69 74 65 6d 73 74 61 62  info 4 "itemstab
2ce0: 6c 65 20 69 73 20 61 20 70 72 6f 63 65 64 75 72  le is a procedur
2cf0: 65 2c 20 77 69 6c 6c 20 63 61 6c 63 20 6c 61 74  e, will calc lat
2d00: 65 72 22 29 0a 09 09 09 09 09 09 20 69 74 65 6d  er")....... item
2d10: 73 74 61 62 6c 65 29 20 20 20 20 20 20 20 3b 3b  stable)       ;;
2d20: 20 63 61 6c 63 20 6c 61 74 65 72 0a 09 09 09 09   calc later.....
2d30: 09 09 28 28 66 69 6c 74 65 72 20 28 6c 61 6d 62  ..((filter (lamb
2d40: 64 61 20 28 78 29 0a 09 09 09 09 09 09 09 20 20  da (x)........  
2d50: 20 28 6c 65 74 20 28 28 76 61 6c 20 28 63 61 72   (let ((val (car
2d60: 20 78 29 29 29 0a 09 09 09 09 09 09 09 20 20 20   x)))........   
2d70: 20 20 28 69 66 20 28 70 72 6f 63 65 64 75 72 65    (if (procedure
2d80: 3f 20 76 61 6c 29 20 76 61 6c 20 23 66 29 29 29  ? val) val #f)))
2d90: 0a 09 09 09 09 09 09 09 20 28 61 70 70 65 6e 64  ........ (append
2da0: 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74 65 6d   (if (list? item
2db0: 73 29 20 69 74 65 6d 73 20 27 28 29 29 0a 09 09  s) items '())...
2dc0: 09 09 09 09 09 09 20 28 69 66 20 28 6c 69 73 74  ...... (if (list
2dd0: 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 20 69 74  ? itemstable) it
2de0: 65 6d 73 74 61 62 6c 65 20 27 28 29 29 29 29 0a  emstable '()))).
2df0: 09 09 09 09 09 09 20 27 68 61 76 65 2d 70 72 6f  ...... 'have-pro
2e00: 63 65 64 75 72 65 29 0a 09 09 09 09 09 09 28 28  cedure).......((
2e10: 6f 72 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29  or (list? items)
2e20: 28 6c 69 73 74 3f 20 69 74 65 6d 73 74 61 62 6c  (list? itemstabl
2e30: 65 29 29 20 3b 3b 20 63 61 6c 63 20 6e 6f 77 0a  e)) ;; calc now.
2e40: 09 09 09 09 09 09 20 28 64 65 62 75 67 3a 70 72  ...... (debug:pr
2e50: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 69 74 65 6d  int-info 4 "item
2e60: 73 20 61 6e 64 20 69 74 65 6d 73 74 61 62 6c 65  s and itemstable
2e70: 20 61 72 65 20 6c 69 73 74 73 2c 20 63 61 6c 63   are lists, calc
2e80: 20 6e 6f 77 5c 6e 22 0a 09 09 09 09 09 09 09 20   now\n"........ 
2e90: 20 20 20 20 20 22 20 20 20 20 69 74 65 6d 73 3a       "    items:
2ea0: 20 22 20 69 74 65 6d 73 20 22 20 69 74 65 6d 73   " items " items
2eb0: 74 61 62 6c 65 3a 20 22 20 69 74 65 6d 73 74 61  table: " itemsta
2ec0: 62 6c 65 29 0a 09 09 09 09 09 09 20 28 69 74 65  ble)....... (ite
2ed0: 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f  ms:get-items-fro
2ee0: 6d 2d 63 6f 6e 66 69 67 20 63 6f 6e 66 69 67 29  m-config config)
2ef0: 29 0a 09 09 09 09 09 09 28 65 6c 73 65 20 23 66  ).......(else #f
2f00: 29 29 29 20 20 20 20 20 20 20 20 20 20 20 20 20  )))             
2f10: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b                ;;
2f20: 20 6e 6f 74 20 69 74 65 72 61 74 65 64 0a 09 09   not iterated...
2f30: 09 09 09 20 20 20 20 20 23 66 20 20 20 20 20 20  ...     #f      
2f40: 3b 3b 20 69 74 65 6d 73 64 61 74 20 35 0a 09 09  ;; itemsdat 5...
2f50: 09 09 09 20 20 20 20 20 23 66 20 20 20 20 20 20  ...     #f      
2f60: 3b 3b 20 73 70 61 72 65 20 2d 20 75 73 65 64 20  ;; spare - used 
2f70: 66 6f 72 20 69 74 65 6d 2d 70 61 74 68 0a 09 09  for item-path...
2f80: 09 09 09 20 20 20 20 20 29 29 29 0a 09 20 20 20  ...     )))..   
2f90: 20 28 66 6f 72 2d 65 61 63 68 20 0a 09 20 20 20   (for-each ..   
2fa0: 20 20 28 6c 61 6d 62 64 61 20 28 77 61 69 74 6f    (lambda (waito
2fb0: 6e 29 0a 09 20 20 20 20 20 20 20 28 69 66 20 28  n)..       (if (
2fc0: 61 6e 64 20 77 61 69 74 6f 6e 20 28 6e 6f 74 20  and waiton (not 
2fd0: 28 6d 65 6d 62 65 72 20 77 61 69 74 6f 6e 20 74  (member waiton t
2fe0: 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a 09 09 20  est-names)))... 
2ff0: 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20    (begin...     
3000: 28 73 65 74 21 20 72 65 71 75 69 72 65 64 2d 74  (set! required-t
3010: 65 73 74 73 20 28 63 6f 6e 73 20 77 61 69 74 6f  ests (cons waito
3020: 6e 20 72 65 71 75 69 72 65 64 2d 74 65 73 74 73  n required-tests
3030: 29 29 0a 09 09 20 20 20 20 20 28 73 65 74 21 20  ))...     (set! 
3040: 74 65 73 74 2d 6e 61 6d 65 73 20 28 63 6f 6e 73  test-names (cons
3050: 20 77 61 69 74 6f 6e 20 74 65 73 74 2d 6e 61 6d   waiton test-nam
3060: 65 73 29 29 29 29 29 20 3b 3b 20 77 61 73 20 61  es))))) ;; was a
3070: 6e 20 61 70 70 65 6e 64 2c 20 6e 6f 77 20 61 20  n append, now a 
3080: 63 6f 6e 73 0a 09 20 20 20 20 20 77 61 69 74 6f  cons..     waito
3090: 6e 73 29 0a 09 20 20 20 20 28 6c 65 74 20 28 28  ns)..    (let ((
30a0: 72 65 6d 74 65 73 74 73 20 28 64 65 6c 65 74 65  remtests (delete
30b0: 2d 64 75 70 6c 69 63 61 74 65 73 20 28 61 70 70  -duplicates (app
30c0: 65 6e 64 20 77 61 69 74 6f 6e 73 20 74 61 6c 29  end waitons tal)
30d0: 29 29 29 0a 09 20 20 20 20 20 20 28 69 66 20 28  )))..      (if (
30e0: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65  not (null? remte
30f0: 73 74 73 29 29 0a 09 09 20 20 28 6c 6f 6f 70 20  sts))...  (loop 
3100: 28 63 61 72 20 72 65 6d 74 65 73 74 73 29 28 63  (car remtests)(c
3110: 64 72 20 72 65 6d 74 65 73 74 73 29 29 29 29 29  dr remtests)))))
3120: 29 29 0a 0a 20 20 20 20 28 69 66 20 28 6e 6f 74  ))..    (if (not
3130: 20 28 6e 75 6c 6c 3f 20 72 65 71 75 69 72 65 64   (null? required
3140: 2d 74 65 73 74 73 29 29 0a 09 28 64 65 62 75 67  -tests))..(debug
3150: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 41  :print-info 1 "A
3160: 64 64 69 6e 67 20 22 20 72 65 71 75 69 72 65 64  dding " required
3170: 2d 74 65 73 74 73 20 22 20 74 6f 20 74 68 65 20  -tests " to the 
3180: 72 75 6e 20 71 75 65 75 65 22 29 29 0a 20 20 20  run queue")).   
3190: 20 3b 3b 20 4e 4f 54 45 3a 20 74 68 65 73 65 20   ;; NOTE: these 
31a0: 61 72 65 20 61 6c 6c 20 70 61 72 65 6e 74 20 74  are all parent t
31b0: 65 73 74 73 2c 20 69 74 65 6d 73 20 61 72 65 20  ests, items are 
31c0: 6e 6f 74 20 65 78 70 61 6e 64 65 64 20 79 65 74  not expanded yet
31d0: 2e 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ..    (debug:pri
31e0: 6e 74 2d 69 6e 66 6f 20 34 20 22 74 65 73 74 2d  nt-info 4 "test-
31f0: 72 65 63 6f 72 64 73 3d 22 20 28 68 61 73 68 2d  records=" (hash-
3200: 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65 73  table->alist tes
3210: 74 2d 72 65 63 6f 72 64 73 29 29 0a 20 20 20 20  t-records)).    
3220: 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d  (runs:run-tests-
3230: 71 75 65 75 65 20 72 75 6e 2d 69 64 20 72 75 6e  queue run-id run
3240: 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64  name test-record
3250: 73 20 6b 65 79 76 61 6c 6c 73 74 20 66 6c 61 67  s keyvallst flag
3260: 73 20 74 65 73 74 2d 70 61 74 74 73 29 0a 20 20  s test-patts).  
3270: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69    (debug:print-i
3280: 6e 66 6f 20 34 20 22 41 6c 6c 20 64 6f 6e 65 20  nfo 4 "All done 
3290: 62 79 20 68 65 72 65 22 29 29 29 0a 0a 28 64 65  by here")))..(de
32a0: 66 69 6e 65 20 28 72 75 6e 73 3a 63 61 6c 63 2d  fine (runs:calc-
32b0: 66 61 69 6c 73 20 70 72 65 72 65 71 73 2d 6e 6f  fails prereqs-no
32c0: 74 2d 6d 65 74 29 0a 20 20 28 66 69 6c 74 65 72  t-met).  (filter
32d0: 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 29 0a   (lambda (test).
32e0: 09 20 20 20 20 28 61 6e 64 20 28 76 65 63 74 6f  .    (and (vecto
32f0: 72 3f 20 74 65 73 74 29 20 3b 3b 20 6e 6f 74 20  r? test) ;; not 
3300: 28 73 74 72 69 6e 67 3f 20 74 65 73 74 29 29 0a  (string? test)).
3310: 09 09 20 28 65 71 75 61 6c 3f 20 28 64 62 3a 74  .. (equal? (db:t
3320: 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74 65  est-get-state te
3330: 73 74 29 20 22 43 4f 4d 50 4c 45 54 45 44 22 29  st) "COMPLETED")
3340: 0a 09 09 20 28 6e 6f 74 20 28 6d 65 6d 62 65 72  ... (not (member
3350: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74   (db:test-get-st
3360: 61 74 75 73 20 74 65 73 74 29 0a 09 09 09 20 20  atus test)....  
3370: 20 20 20 20 27 28 22 50 41 53 53 22 20 22 57 41      '("PASS" "WA
3380: 52 4e 22 20 22 43 48 45 43 4b 22 20 22 57 41 49  RN" "CHECK" "WAI
3390: 56 45 44 22 20 22 53 4b 49 50 22 29 29 29 29 29  VED" "SKIP")))))
33a0: 0a 09 20 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d  ..  prereqs-not-
33b0: 6d 65 74 29 29 0a 0a 28 64 65 66 69 6e 65 20 28  met))..(define (
33c0: 72 75 6e 73 3a 63 61 6c 63 2d 6e 6f 74 2d 63 6f  runs:calc-not-co
33d0: 6d 70 6c 65 74 65 64 20 70 72 65 72 65 71 73 2d  mpleted prereqs-
33e0: 6e 6f 74 2d 6d 65 74 29 0a 20 20 28 66 69 6c 74  not-met).  (filt
33f0: 65 72 0a 20 20 20 28 6c 61 6d 62 64 61 20 28 74  er.   (lambda (t
3400: 29 0a 20 20 20 20 20 28 6f 72 20 28 6e 6f 74 20  ).     (or (not 
3410: 28 76 65 63 74 6f 72 3f 20 74 29 29 0a 09 20 28  (vector? t)).. (
3420: 6e 6f 74 20 28 65 71 75 61 6c 3f 20 22 43 4f 4d  not (equal? "COM
3430: 50 4c 45 54 45 44 22 20 28 64 62 3a 74 65 73 74  PLETED" (db:test
3440: 2d 67 65 74 2d 73 74 61 74 65 20 74 29 29 29 29  -get-state t))))
3450: 29 0a 20 20 20 70 72 65 72 65 71 73 2d 6e 6f 74  ).   prereqs-not
3460: 2d 6d 65 74 29 29 0a 0a 28 64 65 66 69 6e 65 20  -met))..(define 
3470: 28 72 75 6e 73 3a 70 72 65 74 74 79 2d 73 74 72  (runs:pretty-str
3480: 69 6e 67 20 6c 73 74 29 0a 20 20 28 6d 61 70 20  ing lst).  (map 
3490: 28 6c 61 6d 62 64 61 20 28 74 29 0a 09 20 28 69  (lambda (t).. (i
34a0: 66 20 28 6e 6f 74 20 28 76 65 63 74 6f 72 3f 20  f (not (vector? 
34b0: 74 29 29 0a 09 20 20 20 20 20 28 63 6f 6e 63 20  t))..     (conc 
34c0: 74 29 0a 09 20 20 20 20 20 28 63 6f 6e 63 20 28  t)..     (conc (
34d0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74  db:test-get-test
34e0: 6e 61 6d 65 20 74 29 20 22 3a 22 20 28 64 62 3a  name t) ":" (db:
34f0: 74 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74  test-get-state t
3500: 29 20 22 2f 22 20 28 64 62 3a 74 65 73 74 2d 67  ) "/" (db:test-g
3510: 65 74 2d 73 74 61 74 75 73 20 74 29 29 29 29 0a  et-status t)))).
3520: 20 20 20 20 20 20 20 6c 73 74 29 29 0a 0a 28 64         lst))..(d
3530: 65 66 69 6e 65 20 28 72 75 6e 73 3a 6d 61 6b 65  efine (runs:make
3540: 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 20  -full-test-name 
3550: 74 65 73 74 6e 61 6d 65 20 69 74 65 6d 70 61 74  testname itempat
3560: 68 29 0a 20 20 28 69 66 20 28 65 71 75 61 6c 3f  h).  (if (equal?
3570: 20 69 74 65 6d 70 61 74 68 20 22 22 29 20 74 65   itempath "") te
3580: 73 74 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73  stname (conc tes
3590: 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 70 61  tname "/" itempa
35a0: 74 68 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28  th)))..(define (
35b0: 72 75 6e 73 3a 71 75 65 75 65 2d 6e 65 78 74 2d  runs:queue-next-
35c0: 68 65 64 20 74 61 6c 20 72 65 67 20 6e 20 72 65  hed tal reg n re
35d0: 67 66 75 6c 29 0a 20 20 28 69 66 20 72 65 67 66  gful).  (if regf
35e0: 75 6c 0a 20 20 20 20 20 20 28 69 66 20 28 6e 75  ul.      (if (nu
35f0: 6c 6c 3f 20 72 65 67 29 20 3b 3b 20 64 6f 65 73  ll? reg) ;; does
3600: 6e 27 74 20 6d 61 6b 65 20 73 65 6e 73 65 2c 20  n't make sense, 
3610: 74 68 69 73 20 69 73 20 70 72 6f 62 61 62 6c 79  this is probably
3620: 20 4e 4f 54 20 74 68 65 20 70 72 6f 62 6c 65 6d   NOT the problem
3630: 20 6f 66 20 74 68 65 20 63 61 72 0a 09 20 20 28   of the car..  (
3640: 63 61 72 20 74 61 6c 29 0a 09 20 20 28 63 61 72  car tal)..  (car
3650: 20 72 65 67 29 29 0a 20 20 20 20 20 20 28 63 61   reg)).      (ca
3660: 72 20 74 61 6c 29 29 29 0a 0a 28 64 65 66 69 6e  r tal)))..(defin
3670: 65 20 28 72 75 6e 73 3a 71 75 65 75 65 2d 6e 65  e (runs:queue-ne
3680: 78 74 2d 74 61 6c 20 74 61 6c 20 72 65 67 20 6e  xt-tal tal reg n
3690: 20 72 65 67 66 75 6c 29 0a 20 20 28 69 66 20 72   regful).  (if r
36a0: 65 67 66 75 6c 0a 20 20 20 20 20 20 74 61 6c 0a  egful.      tal.
36b0: 20 20 20 20 20 20 28 6c 65 74 20 28 28 6e 65 77        (let ((new
36c0: 74 61 6c 20 28 63 64 72 20 74 61 6c 29 29 29 0a  tal (cdr tal))).
36d0: 09 28 69 66 20 28 6e 75 6c 6c 3f 20 6e 65 77 74  .(if (null? newt
36e0: 61 6c 29 0a 09 20 20 20 20 72 65 67 0a 09 20 20  al)..    reg..  
36f0: 20 20 6e 65 77 74 61 6c 0a 09 20 20 20 20 29 29    newtal..    ))
3700: 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e  ))..(define (run
3710: 73 3a 71 75 65 75 65 2d 6e 65 78 74 2d 72 65 67  s:queue-next-reg
3720: 20 74 61 6c 20 72 65 67 20 6e 20 72 65 67 66 75   tal reg n regfu
3730: 6c 29 0a 20 20 28 69 66 20 72 65 67 66 75 6c 0a  l).  (if regful.
3740: 20 20 20 20 20 20 28 63 64 72 20 72 65 67 29 0a        (cdr reg).
3750: 20 20 20 20 20 20 28 69 66 20 28 65 71 3f 20 28        (if (eq? (
3760: 6c 65 6e 67 74 68 20 74 61 6c 29 20 31 29 0a 09  length tal) 1)..
3770: 20 20 27 28 29 0a 09 20 20 72 65 67 29 29 29 0a    '()..  reg))).
3780: 0a 3b 3b 20 74 65 73 74 2d 72 65 63 6f 72 64 73  .;; test-records
3790: 20 69 73 20 61 20 68 61 73 68 20 74 61 62 6c 65   is a hash table
37a0: 20 74 65 73 74 6e 61 6d 65 3a 69 74 65 6d 5f 70   testname:item_p
37b0: 61 74 68 20 3d 3e 20 76 65 63 74 6f 72 20 3c 20  ath => vector < 
37c0: 74 65 73 74 6e 61 6d 65 20 74 65 73 74 63 6f 6e  testname testcon
37d0: 66 69 67 20 77 61 69 74 6f 6e 73 20 70 72 69 6f  fig waitons prio
37e0: 72 69 74 79 20 69 74 65 6d 73 2d 69 6e 66 6f 20  rity items-info 
37f0: 2e 2e 2e 20 3e 0a 28 64 65 66 69 6e 65 20 28 72  ... >.(define (r
3800: 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d 71 75  uns:run-tests-qu
3810: 65 75 65 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61  eue run-id runna
3820: 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20  me test-records 
3830: 6b 65 79 76 61 6c 6c 73 74 20 66 6c 61 67 73 20  keyvallst flags 
3840: 74 65 73 74 2d 70 61 74 74 73 29 0a 20 20 20 20  test-patts).    
3850: 3b 3b 20 41 74 20 74 68 69 73 20 70 6f 69 6e 74  ;; At this point
3860: 20 74 68 65 20 6c 69 73 74 20 6f 66 20 70 61 72   the list of par
3870: 65 6e 74 20 74 65 73 74 73 20 69 73 20 65 78 70  ent tests is exp
3880: 61 6e 64 65 64 20 0a 20 20 20 20 3b 3b 20 4e 42  anded .    ;; NB
3890: 2f 2f 20 53 68 6f 75 6c 64 20 65 78 70 61 6e 64  // Should expand
38a0: 20 69 74 65 6d 73 20 68 65 72 65 20 61 6e 64 20   items here and 
38b0: 74 68 65 6e 20 69 6e 73 65 72 74 20 69 6e 74 6f  then insert into
38c0: 20 74 68 65 20 72 75 6e 20 71 75 65 75 65 2e 0a   the run queue..
38d0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 35    (debug:print 5
38e0: 20 22 74 65 73 74 2d 72 65 63 6f 72 64 73 3a 20   "test-records: 
38f0: 22 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 22  " test-records "
3900: 2c 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b  , keyvallst: " k
3910: 65 79 76 61 6c 6c 73 74 20 22 20 66 6c 61 67 73  eyvallst " flags
3920: 3a 20 22 20 28 68 61 73 68 2d 74 61 62 6c 65 2d  : " (hash-table-
3930: 3e 61 6c 69 73 74 20 66 6c 61 67 73 29 29 0a 20  >alist flags)). 
3940: 20 28 6c 65 74 20 28 28 73 6f 72 74 65 64 2d 74   (let ((sorted-t
3950: 65 73 74 2d 6e 61 6d 65 73 20 28 74 65 73 74 73  est-names (tests
3960: 3a 73 6f 72 74 2d 62 79 2d 70 72 69 6f 72 69 74  :sort-by-priorit
3970: 79 2d 61 6e 64 2d 77 61 69 74 6f 6e 20 74 65 73  y-and-waiton tes
3980: 74 2d 72 65 63 6f 72 64 73 29 29 0a 09 28 74 65  t-records))..(te
3990: 73 74 2d 72 65 67 69 73 74 72 79 20 20 20 20 28  st-registry    (
39a0: 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29  make-hash-table)
39b0: 29 0a 09 28 72 65 67 69 73 74 72 79 2d 6d 75 74  )..(registry-mut
39c0: 65 78 20 20 20 28 6d 61 6b 65 2d 6d 75 74 65 78  ex   (make-mutex
39d0: 29 29 0a 09 28 6e 75 6d 2d 72 65 74 72 69 65 73  ))..(num-retries
39e0: 20 20 20 20 20 20 20 20 30 29 0a 09 28 6d 61 78          0)..(max
39f0: 2d 72 65 74 72 69 65 73 20 20 20 20 20 20 20 28  -retries       (
3a00: 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63  config-lookup *c
3a10: 6f 6e 66 69 67 64 61 74 2a 20 22 73 65 74 75 70  onfigdat* "setup
3a20: 22 20 22 6d 61 78 72 65 74 72 69 65 73 22 29 29  " "maxretries"))
3a30: 0a 09 28 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e  ..(max-concurren
3a40: 74 2d 6a 6f 62 73 20 20 20 20 20 28 6c 65 74 20  t-jobs     (let 
3a50: 28 28 6d 63 6a 20 28 63 6f 6e 66 69 67 2d 6c 6f  ((mcj (config-lo
3a60: 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a  okup *configdat*
3a70: 20 22 73 65 74 75 70 22 20 20 20 20 20 22 6d 61   "setup"     "ma
3a80: 78 5f 63 6f 6e 63 75 72 72 65 6e 74 5f 6a 6f 62  x_concurrent_job
3a90: 73 22 29 29 29 0a 09 09 09 09 20 20 20 20 28 69  s"))).....    (i
3aa0: 66 20 28 61 6e 64 20 6d 63 6a 20 28 73 74 72 69  f (and mcj (stri
3ab0: 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 63 6a 29 29  ng->number mcj))
3ac0: 0a 09 09 09 09 09 28 73 74 72 69 6e 67 2d 3e 6e  ......(string->n
3ad0: 75 6d 62 65 72 20 6d 63 6a 29 0a 09 09 09 09 09  umber mcj)......
3ae0: 31 29 29 29 0a 09 28 72 65 67 6c 65 6e 20 20 20  1)))..(reglen   
3af0: 20 20 20 20 20 20 20 20 20 20 32 29 29 20 3b 3b            2)) ;;
3b00: 20 6c 65 6e 67 74 68 20 6f 66 20 74 68 65 20 72   length of the r
3b10: 65 67 69 73 74 65 72 20 71 75 65 75 65 20 61 68  egister queue ah
3b20: 65 61 64 0a 20 20 20 20 28 73 65 74 21 20 6d 61  ead.    (set! ma
3b30: 78 2d 72 65 74 72 69 65 73 20 28 69 66 20 28 61  x-retries (if (a
3b40: 6e 64 20 6d 61 78 2d 72 65 74 72 69 65 73 20 28  nd max-retries (
3b50: 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d  string->number m
3b60: 61 78 2d 72 65 74 72 69 65 73 29 29 28 73 74 72  ax-retries))(str
3b70: 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 61 78 2d  ing->number max-
3b80: 72 65 74 72 69 65 73 29 20 31 30 30 29 29 0a 20  retries) 100)). 
3b90: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c     (if (not (nul
3ba0: 6c 3f 20 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e  l? sorted-test-n
3bb0: 61 6d 65 73 29 29 0a 09 28 6c 65 74 20 6c 6f 6f  ames))..(let loo
3bc0: 70 20 28 28 68 65 64 20 20 20 20 20 20 20 20 20  p ((hed         
3bd0: 28 63 61 72 20 73 6f 72 74 65 64 2d 74 65 73 74  (car sorted-test
3be0: 2d 6e 61 6d 65 73 29 29 0a 09 09 20 20 20 28 74  -names))...   (t
3bf0: 61 6c 20 20 20 20 20 20 20 20 20 28 63 64 72 20  al         (cdr 
3c00: 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65  sorted-test-name
3c10: 73 29 29 0a 09 09 20 20 20 28 72 65 67 20 20 20  s))...   (reg   
3c20: 20 20 20 20 20 20 27 28 29 29 20 3b 3b 20 72 65        '()) ;; re
3c30: 67 69 73 74 65 72 65 64 2c 20 70 75 74 20 74 68  gistered, put th
3c40: 65 73 65 20 61 74 20 74 68 65 20 68 65 61 64 20  ese at the head 
3c50: 6f 66 20 74 61 6c 20 0a 09 09 20 20 20 28 72 65  of tal ...   (re
3c60: 72 75 6e 73 20 20 20 20 20 20 27 28 29 29 29 0a  runs      '())).
3c70: 09 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c  .  (if (not (nul
3c80: 6c 3f 20 72 65 72 75 6e 73 29 29 28 64 65 62 75  l? reruns))(debu
3c90: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22  g:print-info 4 "
3ca0: 72 65 72 75 6e 73 3d 22 20 72 65 72 75 6e 73 29  reruns=" reruns)
3cb0: 29 0a 09 20 20 3b 3b 20 28 70 72 69 6e 74 20 22  )..  ;; (print "
3cc0: 54 6f 70 20 6f 66 20 6c 6f 6f 70 2c 20 68 65 64  Top of loop, hed
3cd0: 3d 22 20 68 65 64 20 22 2c 20 74 61 6c 3d 22 20  =" hed ", tal=" 
3ce0: 74 61 6c 20 22 20 2c 72 65 72 75 6e 73 3d 22 20  tal " ,reruns=" 
3cf0: 72 65 72 75 6e 73 29 0a 09 20 20 28 6c 65 74 2a  reruns)..  (let*
3d00: 20 28 28 74 65 73 74 2d 72 65 63 6f 72 64 20 28   ((test-record (
3d10: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 20 74  hash-table-ref t
3d20: 65 73 74 2d 72 65 63 6f 72 64 73 20 68 65 64 29  est-records hed)
3d30: 29 0a 09 09 20 28 74 65 73 74 2d 6e 61 6d 65 20  )... (test-name 
3d40: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65    (tests:testque
3d50: 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20  ue-get-testname 
3d60: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09  test-record))...
3d70: 20 28 74 63 6f 6e 66 69 67 20 20 20 20 20 28 74   (tconfig     (t
3d80: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67  ests:testqueue-g
3d90: 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 74 65  et-testconfig te
3da0: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 28  st-record))... (
3db0: 74 65 73 74 6d 6f 64 65 20 20 20 20 28 6c 65 74  testmode    (let
3dc0: 20 28 28 6d 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f   ((m (config-loo
3dd0: 6b 75 70 20 74 63 6f 6e 66 69 67 20 22 72 65 71  kup tconfig "req
3de0: 75 69 72 65 6d 65 6e 74 73 22 20 22 6d 6f 64 65  uirements" "mode
3df0: 22 29 29 29 0a 09 09 09 09 28 69 66 20 6d 20 28  "))).....(if m (
3e00: 73 74 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c 20 6d  string->symbol m
3e10: 29 20 27 6e 6f 72 6d 61 6c 29 29 29 0a 09 09 20  ) 'normal)))... 
3e20: 28 77 61 69 74 6f 6e 73 20 20 20 20 20 28 74 65  (waitons     (te
3e30: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65  sts:testqueue-ge
3e40: 74 2d 77 61 69 74 6f 6e 73 20 20 20 20 74 65 73  t-waitons    tes
3e50: 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 28 70  t-record))... (p
3e60: 72 69 6f 72 69 74 79 20 20 20 20 28 74 65 73 74  riority    (test
3e70: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d  s:testqueue-get-
3e80: 70 72 69 6f 72 69 74 79 20 20 20 74 65 73 74 2d  priority   test-
3e90: 72 65 63 6f 72 64 29 29 0a 09 09 20 28 69 74 65  record))... (ite
3ea0: 6d 64 61 74 20 20 20 20 20 28 74 65 73 74 73 3a  mdat     (tests:
3eb0: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74  testqueue-get-it
3ec0: 65 6d 64 61 74 20 20 20 20 74 65 73 74 2d 72 65  emdat    test-re
3ed0: 63 6f 72 64 29 29 20 3b 3b 20 69 74 65 6d 64 61  cord)) ;; itemda
3ee0: 74 20 63 61 6e 20 62 65 20 61 20 73 74 72 69 6e  t can be a strin
3ef0: 67 2c 20 6c 69 73 74 20 6f 72 20 23 66 0a 09 09  g, list or #f...
3f00: 20 28 69 74 65 6d 73 20 20 20 20 20 20 20 28 74   (items       (t
3f10: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67  ests:testqueue-g
3f20: 65 74 2d 69 74 65 6d 73 20 20 20 20 20 20 74 65  et-items      te
3f30: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 28  st-record))... (
3f40: 69 74 65 6d 2d 70 61 74 68 20 20 20 28 69 74 65  item-path   (ite
3f50: 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 65  m-list->path ite
3f60: 6d 64 61 74 29 29 0a 09 09 20 28 6e 65 77 74 61  mdat))... (newta
3f70: 6c 20 20 20 20 20 20 28 61 70 70 65 6e 64 20 74  l      (append t
3f80: 61 6c 20 28 6c 69 73 74 20 68 65 64 29 29 29 0a  al (list hed))).
3f90: 09 09 20 28 72 65 67 66 75 6c 6c 20 20 20 20 20  .. (regfull     
3fa0: 28 3e 20 28 6c 65 6e 67 74 68 20 72 65 67 29 20  (> (length reg) 
3fb0: 72 65 67 6c 65 6e 29 29 29 0a 09 20 20 20 20 3b  reglen)))..    ;
3fc0: 3b 20 28 69 66 20 28 3e 20 28 6c 65 6e 67 74 68  ; (if (> (length
3fd0: 20 72 65 67 29 20 31 30 29 0a 09 20 20 20 20 3b   reg) 10)..    ;
3fe0: 3b 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20  ;     (begin..  
3ff0: 20 20 3b 3b 20 20 20 20 20 20 20 28 73 65 74 21    ;;       (set!
4000: 20 74 61 6c 20 28 63 6f 6e 73 20 68 65 64 20 74   tal (cons hed t
4010: 61 6c 29 29 0a 09 20 20 20 20 3b 3b 20 20 20 20  al))..    ;;    
4020: 20 20 20 28 73 65 74 21 20 68 65 64 20 28 63 61     (set! hed (ca
4030: 72 20 72 65 67 29 29 0a 09 20 20 20 20 3b 3b 20  r reg))..    ;; 
4040: 20 20 20 20 20 20 28 73 65 74 21 20 72 65 67 20        (set! reg 
4050: 28 63 64 72 20 72 65 67 29 29 0a 09 20 20 20 20  (cdr reg))..    
4060: 3b 3b 20 20 20 20 20 20 20 28 73 65 74 21 20 6e  ;;       (set! n
4070: 65 77 74 61 6c 20 74 61 6c 29 29 29 0a 09 20 20  ewtal tal)))..  
4080: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 36    (debug:print 6
4090: 0a 09 09 09 20 22 74 65 73 74 2d 6e 61 6d 65 3a  .... "test-name:
40a0: 20 22 20 74 65 73 74 2d 6e 61 6d 65 0a 09 09 09   " test-name....
40b0: 20 22 5c 6e 20 20 68 65 64 3a 20 20 20 20 20 20   "\n  hed:      
40c0: 20 20 20 22 20 68 65 64 0a 09 09 09 20 22 5c 6e     " hed.... "\n
40d0: 20 20 69 74 65 6d 64 61 74 3a 20 20 20 20 20 22    itemdat:     "
40e0: 20 69 74 65 6d 64 61 74 0a 09 09 09 20 22 5c 6e   itemdat.... "\n
40f0: 20 20 69 74 65 6d 73 3a 20 20 20 20 20 20 20 22    items:       "
4100: 20 69 74 65 6d 73 0a 09 09 09 20 22 5c 6e 20 20   items.... "\n  
4110: 69 74 65 6d 2d 70 61 74 68 3a 20 20 20 22 20 69  item-path:   " i
4120: 74 65 6d 2d 70 61 74 68 0a 09 09 09 20 22 5c 6e  tem-path.... "\n
4130: 20 20 77 61 69 74 6f 6e 73 3a 20 20 20 20 20 22    waitons:     "
4140: 20 77 61 69 74 6f 6e 73 0a 09 09 09 20 22 5c 6e   waitons.... "\n
4150: 20 20 6e 75 6d 2d 72 65 74 72 69 65 73 3a 20 22    num-retries: "
4160: 20 6e 75 6d 2d 72 65 74 72 69 65 73 0a 09 09 09   num-retries....
4170: 20 22 5c 6e 20 20 74 61 6c 3a 20 20 20 20 20 20   "\n  tal:      
4180: 20 20 20 22 20 74 61 6c 0a 09 09 09 20 22 5c 6e     " tal.... "\n
4190: 20 20 72 65 72 75 6e 73 3a 20 20 20 20 20 20 22    reruns:      "
41a0: 20 72 65 72 75 6e 73 29 0a 0a 09 20 20 20 20 3b   reruns)...    ;
41b0: 3b 20 63 68 65 63 6b 20 66 6f 72 20 68 65 64 20  ; check for hed 
41c0: 69 6e 20 77 61 69 74 6f 6e 73 20 3d 3e 20 74 68  in waitons => th
41d0: 69 73 20 77 6f 75 6c 64 20 62 65 20 63 69 72 63  is would be circ
41e0: 75 6c 61 72 2c 20 72 65 6d 6f 76 65 20 69 74 20  ular, remove it 
41f0: 61 6e 64 20 69 73 73 75 65 20 61 6e 0a 09 20 20  and issue an..  
4200: 20 20 3b 3b 20 65 72 72 6f 72 0a 09 20 20 20 20    ;; error..    
4210: 28 69 66 20 28 6d 65 6d 62 65 72 20 74 65 73 74  (if (member test
4220: 2d 6e 61 6d 65 20 77 61 69 74 6f 6e 73 29 0a 09  -name waitons)..
4230: 09 28 62 65 67 69 6e 0a 09 09 20 20 28 64 65 62  .(begin...  (deb
4240: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f  ug:print 0 "ERRO
4250: 52 3a 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e  R: test " test-n
4260: 61 6d 65 20 22 20 68 61 73 20 6c 69 73 74 65 64  ame " has listed
4270: 20 69 74 73 65 6c 66 20 61 73 20 61 20 77 61 69   itself as a wai
4280: 74 6f 6e 2c 20 70 6c 65 61 73 65 20 63 6f 72 72  ton, please corr
4290: 65 63 74 20 74 68 69 73 21 22 29 0a 09 09 20 20  ect this!")...  
42a0: 28 73 65 74 21 20 77 61 69 74 6f 6e 20 28 66 69  (set! waiton (fi
42b0: 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29  lter (lambda (x)
42c0: 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 78 20 68  (not (equal? x h
42d0: 65 64 29 29 29 20 77 61 69 74 6f 6e 73 29 29 29  ed))) waitons)))
42e0: 29 0a 0a 09 20 20 20 20 28 63 6f 6e 64 20 3b 3b  )...    (cond ;;
42f0: 20 4f 55 54 45 52 20 43 4f 4e 44 0a 09 20 20 20   OUTER COND..   
4300: 20 20 28 28 6e 6f 74 20 69 74 65 6d 73 29 20 3b    ((not items) ;
4310: 3b 20 77 68 65 6e 20 66 61 6c 73 65 20 74 68 65  ; when false the
4320: 20 74 65 73 74 20 69 73 20 6f 6b 20 74 6f 20 62   test is ok to b
4330: 65 20 68 61 6e 64 65 64 20 6f 66 66 20 74 6f 20  e handed off to 
4340: 6c 61 75 6e 63 68 20 28 62 75 74 20 6e 6f 74 20  launch (but not 
4350: 62 65 66 6f 72 65 29 0a 09 20 20 20 20 20 20 28  before)..      (
4360: 6c 65 74 2a 20 28 28 72 75 6e 2d 6c 69 6d 69 74  let* ((run-limit
4370: 73 2d 69 6e 66 6f 20 20 20 20 20 20 20 20 20 28  s-info         (
4380: 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72  runs:can-run-mor
4390: 65 2d 74 65 73 74 73 20 74 65 73 74 2d 72 65 63  e-tests test-rec
43a0: 6f 72 64 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65  ord max-concurre
43b0: 6e 74 2d 6a 6f 62 73 29 29 20 3b 3b 20 6c 6f 6f  nt-jobs)) ;; loo
43c0: 6b 20 61 74 20 74 68 65 20 74 65 73 74 20 6a 6f  k at the test jo
43d0: 62 67 72 6f 75 70 20 61 6e 64 20 74 6f 74 20 6a  bgroup and tot j
43e0: 6f 62 73 20 72 75 6e 6e 69 6e 67 0a 09 09 20 20  obs running...  
43f0: 20 20 20 28 68 61 76 65 2d 72 65 73 6f 75 72 63     (have-resourc
4400: 65 73 20 20 20 20 20 20 20 20 20 20 28 63 61 72  es          (car
4410: 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f   run-limits-info
4420: 29 29 0a 09 09 20 20 20 20 20 28 6e 75 6d 2d 72  ))...     (num-r
4430: 75 6e 6e 69 6e 67 20 20 20 20 20 20 20 20 20 20  unning          
4440: 20 20 20 28 6c 69 73 74 2d 72 65 66 20 72 75 6e     (list-ref run
4450: 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 31 29 29  -limits-info 1))
4460: 0a 09 09 20 20 20 20 20 28 6e 75 6d 2d 72 75 6e  ...     (num-run
4470: 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70  ning-in-jobgroup
4480: 20 28 6c 69 73 74 2d 72 65 66 20 72 75 6e 2d 6c   (list-ref run-l
4490: 69 6d 69 74 73 2d 69 6e 66 6f 20 32 29 29 0a 09  imits-info 2))..
44a0: 09 20 20 20 20 20 28 6d 61 78 2d 63 6f 6e 63 75  .     (max-concu
44b0: 72 72 65 6e 74 2d 6a 6f 62 73 20 20 20 20 20 28  rrent-jobs     (
44c0: 6c 69 73 74 2d 72 65 66 20 72 75 6e 2d 6c 69 6d  list-ref run-lim
44d0: 69 74 73 2d 69 6e 66 6f 20 33 29 29 0a 09 09 20  its-info 3))... 
44e0: 20 20 20 20 28 6a 6f 62 2d 67 72 6f 75 70 2d 6c      (job-group-l
44f0: 69 6d 69 74 20 20 20 20 20 20 20 20 20 28 6c 69  imit         (li
4500: 73 74 2d 72 65 66 20 72 75 6e 2d 6c 69 6d 69 74  st-ref run-limit
4510: 73 2d 69 6e 66 6f 20 34 29 29 0a 09 09 20 20 20  s-info 4))...   
4520: 20 20 28 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d    (prereqs-not-m
4530: 65 74 20 20 20 20 20 20 20 20 20 28 64 62 3a 67  et         (db:g
4540: 65 74 2d 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d  et-prereqs-not-m
4550: 65 74 20 72 75 6e 2d 69 64 20 77 61 69 74 6f 6e  et run-id waiton
4560: 73 20 69 74 65 6d 2d 70 61 74 68 20 6d 6f 64 65  s item-path mode
4570: 3a 20 74 65 73 74 6d 6f 64 65 29 29 0a 09 09 20  : testmode))... 
4580: 20 20 20 20 28 66 61 69 6c 73 20 20 20 20 20 20      (fails      
4590: 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 75               (ru
45a0: 6e 73 3a 63 61 6c 63 2d 66 61 69 6c 73 20 70 72  ns:calc-fails pr
45b0: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a  ereqs-not-met)).
45c0: 09 09 20 20 20 20 20 28 6e 6f 6e 2d 63 6f 6d 70  ..     (non-comp
45d0: 6c 65 74 65 64 20 20 20 20 20 20 20 20 20 20 20  leted           
45e0: 28 72 75 6e 73 3a 63 61 6c 63 2d 6e 6f 74 2d 63  (runs:calc-not-c
45f0: 6f 6d 70 6c 65 74 65 64 20 70 72 65 72 65 71 73  ompleted prereqs
4600: 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a 09 09 28 64  -not-met)))...(d
4610: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
4620: 38 20 22 68 61 76 65 2d 72 65 73 6f 75 72 63 65  8 "have-resource
4630: 73 3a 20 22 20 68 61 76 65 2d 72 65 73 6f 75 72  s: " have-resour
4640: 63 65 73 20 22 20 70 72 65 72 65 71 73 2d 6e 6f  ces " prereqs-no
4650: 74 2d 6d 65 74 3a 20 22 20 0a 09 09 09 20 20 20  t-met: " ....   
4660: 20 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73    (string-inters
4670: 70 65 72 73 65 20 0a 09 09 09 20 20 20 20 20 20  perse ....      
4680: 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 74 29  (map (lambda (t)
4690: 0a 09 09 09 09 20 20 20 20 20 28 69 66 20 28 76  .....     (if (v
46a0: 65 63 74 6f 72 3f 20 74 29 0a 09 09 09 09 09 20  ector? t)...... 
46b0: 28 63 6f 6e 63 20 28 64 62 3a 74 65 73 74 2d 67  (conc (db:test-g
46c0: 65 74 2d 73 74 61 74 65 20 74 29 20 22 2f 22 20  et-state t) "/" 
46d0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61  (db:test-get-sta
46e0: 74 75 73 20 74 29 29 0a 09 09 09 09 09 20 28 63  tus t))...... (c
46f0: 6f 6e 63 20 22 20 57 41 52 4e 49 4e 47 3a 20 74  onc " WARNING: t
4700: 20 69 73 20 6e 6f 74 20 61 20 76 65 63 74 6f 72   is not a vector
4710: 3d 22 20 74 20 29 29 29 0a 09 09 09 09 20 20 20  =" t ))).....   
4720: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29  prereqs-not-met)
4730: 20 22 2c 20 22 29 20 22 20 66 61 69 6c 73 3a 20   ", ") " fails: 
4740: 22 20 66 61 69 6c 73 29 0a 09 09 28 64 65 62 75  " fails)...(debu
4750: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22  g:print-info 4 "
4760: 68 65 64 3d 22 20 68 65 64 20 22 5c 6e 20 20 74  hed=" hed "\n  t
4770: 65 73 74 2d 72 65 63 6f 72 64 3d 22 20 74 65 73  est-record=" tes
4780: 74 2d 72 65 63 6f 72 64 20 22 5c 6e 20 20 74 65  t-record "\n  te
4790: 73 74 2d 6e 61 6d 65 3a 20 22 20 74 65 73 74 2d  st-name: " test-
47a0: 6e 61 6d 65 20 22 5c 6e 20 20 69 74 65 6d 2d 70  name "\n  item-p
47b0: 61 74 68 3a 20 22 20 69 74 65 6d 2d 70 61 74 68  ath: " item-path
47c0: 20 22 5c 6e 20 20 74 65 73 74 2d 70 61 74 74 73   "\n  test-patts
47d0: 3a 20 22 20 74 65 73 74 2d 70 61 74 74 73 29 0a  : " test-patts).
47e0: 0a 09 09 3b 3b 20 44 6f 6e 27 74 20 6b 6e 6f 77  ...;; Don't know
47f0: 20 61 74 20 74 68 69 73 20 74 69 6d 65 20 69 66   at this time if
4800: 20 74 68 65 20 74 65 73 74 20 68 61 76 65 20 62   the test have b
4810: 65 65 6e 20 6c 61 75 6e 63 68 65 64 20 61 74 20  een launched at 
4820: 73 6f 6d 65 20 74 69 6d 65 20 69 6e 20 74 68 65  some time in the
4830: 20 70 61 73 74 0a 09 09 3b 3b 20 69 2e 65 2e 20   past...;; i.e. 
4840: 69 73 20 74 68 69 73 20 61 20 72 65 2d 6c 61 75  is this a re-lau
4850: 6e 63 68 3f 0a 09 09 28 64 65 62 75 67 3a 70 72  nch?...(debug:pr
4860: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 72 75 6e 2d  int-info 4 "run-
4870: 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 3d 20 22 20  limits-info = " 
4880: 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 29  run-limits-info)
4890: 0a 09 09 28 63 6f 6e 64 20 3b 3b 20 49 4e 4e 45  ...(cond ;; INNE
48a0: 52 20 43 4f 4e 44 20 23 31 20 66 6f 72 20 61 20  R COND #1 for a 
48b0: 6c 61 75 6e 63 68 61 62 6c 65 20 74 65 73 74 0a  launchable test.
48c0: 09 09 20 3b 3b 20 43 68 65 63 6b 20 69 74 65 6d  .. ;; Check item
48d0: 20 70 61 74 68 20 61 67 61 69 6e 73 74 20 69 74   path against it
48e0: 65 6d 2d 70 61 74 74 73 0a 09 09 20 28 28 6e 6f  em-patts... ((no
48f0: 74 20 28 74 65 73 74 73 3a 6d 61 74 63 68 20 74  t (tests:match t
4900: 65 73 74 2d 70 61 74 74 73 20 28 74 65 73 74 73  est-patts (tests
4910: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74  :testqueue-get-t
4920: 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63  estname test-rec
4930: 6f 72 64 29 20 69 74 65 6d 2d 70 61 74 68 29 29  ord) item-path))
4940: 20 3b 3b 20 54 68 69 73 20 74 65 73 74 2f 69 74   ;; This test/it
4950: 65 6d 70 61 74 68 20 69 73 20 6e 6f 74 20 74 6f  empath is not to
4960: 20 62 65 20 72 75 6e 0a 09 09 20 20 3b 3b 20 65   be run...  ;; e
4970: 6c 73 65 20 74 68 65 20 72 75 6e 20 69 73 20 73  lse the run is s
4980: 74 75 63 6b 2c 20 74 65 6d 70 6f 72 61 72 69 6c  tuck, temporaril
4990: 79 20 6f 72 20 70 65 72 6d 61 6e 65 6e 74 6c 79  y or permanently
49a0: 0a 09 09 20 20 3b 3b 20 62 75 74 20 73 68 6f 75  ...  ;; but shou
49b0: 6c 64 20 63 68 65 63 6b 20 69 66 20 69 74 20 69  ld check if it i
49c0: 73 20 64 75 65 20 74 6f 20 6c 61 63 6b 20 6f 66  s due to lack of
49d0: 20 72 65 73 6f 75 72 63 65 73 20 76 73 2e 20 70   resources vs. p
49e0: 72 65 72 65 71 75 69 73 69 74 65 73 0a 09 09 20  rerequisites... 
49f0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
4a00: 66 6f 20 31 20 22 53 6b 69 70 70 69 6e 67 20 22  fo 1 "Skipping "
4a10: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75   (tests:testqueu
4a20: 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74  e-get-testname t
4a30: 65 73 74 2d 72 65 63 6f 72 64 29 20 22 20 22 20  est-record) " " 
4a40: 69 74 65 6d 2d 70 61 74 68 20 22 20 61 73 20 69  item-path " as i
4a50: 74 20 64 6f 65 73 6e 27 74 20 6d 61 74 63 68 20  t doesn't match 
4a60: 22 20 74 65 73 74 2d 70 61 74 74 73 29 0a 09 09  " test-patts)...
4a70: 20 20 3b 3b 20 28 74 68 72 65 61 64 2d 73 6c 65    ;; (thread-sle
4a80: 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74  ep! *global-delt
4a90: 61 2a 29 0a 09 09 20 20 28 69 66 20 28 6e 6f 74  a*)...  (if (not
4aa0: 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09   (null? tal))...
4ab0: 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 72 75 6e        (loop (run
4ac0: 73 3a 71 75 65 75 65 2d 6e 65 78 74 2d 68 65 64  s:queue-next-hed
4ad0: 20 74 61 6c 20 72 65 67 20 72 65 67 6c 65 6e 20   tal reg reglen 
4ae0: 72 65 67 66 75 6c 6c 29 0a 09 09 09 20 20 20 20  regfull)....    
4af0: 28 72 75 6e 73 3a 71 75 65 75 65 2d 6e 65 78 74  (runs:queue-next
4b00: 2d 74 61 6c 20 74 61 6c 20 72 65 67 20 72 65 67  -tal tal reg reg
4b10: 6c 65 6e 20 72 65 67 66 75 6c 6c 29 0a 09 09 09  len regfull)....
4b20: 20 20 20 20 28 72 75 6e 73 3a 71 75 65 75 65 2d      (runs:queue-
4b30: 6e 65 78 74 2d 72 65 67 20 74 61 6c 20 72 65 67  next-reg tal reg
4b40: 20 72 65 67 6c 65 6e 20 72 65 67 66 75 6c 6c 29   reglen regfull)
4b50: 0a 09 09 09 20 20 20 20 72 65 72 75 6e 73 29 29  ....    reruns))
4b60: 29 0a 09 09 20 3b 3b 20 52 65 67 69 73 74 72 79  )... ;; Registry
4b70: 20 68 61 73 20 62 65 65 6e 20 73 74 61 72 74 65   has been starte
4b80: 64 20 66 6f 72 20 74 68 69 73 20 74 65 73 74 20  d for this test 
4b90: 62 75 74 20 68 61 73 20 6e 6f 74 20 79 65 74 20  but has not yet 
4ba0: 63 6f 6d 70 6c 65 74 65 64 0a 09 09 20 3b 3b 20  completed... ;; 
4bb0: 74 68 69 73 20 73 68 6f 75 6c 64 20 62 65 20 72  this should be r
4bc0: 61 72 65 2c 20 74 68 65 20 63 61 73 65 20 77 68  are, the case wh
4bd0: 65 72 65 20 74 68 65 72 65 20 61 72 65 20 6f 6e  ere there are on
4be0: 6c 79 20 61 20 63 6f 75 70 6c 65 20 6f 66 20 74  ly a couple of t
4bf0: 65 73 74 73 20 61 6e 64 20 74 68 65 20 64 62 20  ests and the db 
4c00: 69 73 20 73 6c 6f 77 0a 09 09 20 3b 3b 20 64 65  is slow... ;; de
4c10: 6c 61 79 20 61 20 73 68 6f 72 74 20 77 68 69 6c  lay a short whil
4c20: 65 20 61 6e 64 20 63 6f 6e 74 69 6e 75 65 0a 09  e and continue..
4c30: 09 20 3b 3b 20 28 28 65 71 3f 20 28 68 61 73 68  . ;; ((eq? (hash
4c40: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75  -table-ref/defau
4c50: 6c 74 20 74 65 73 74 2d 72 65 67 69 73 74 72 79  lt test-registry
4c60: 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c   (runs:make-full
4c70: 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d  -test-name test-
4c80: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 20  name item-path) 
4c90: 23 66 29 20 27 73 74 61 72 74 29 0a 09 09 20 3b  #f) 'start)... ;
4ca0: 3b 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70  ;  (thread-sleep
4cb0: 21 20 30 2e 30 31 29 0a 09 09 20 3b 3b 20 20 28  ! 0.01)... ;;  (
4cc0: 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61 6c  loop (car newtal
4cd0: 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20 72 65  )(cdr newtal) re
4ce0: 72 75 6e 73 29 29 0a 09 09 20 3b 3b 20 63 6f 75  runs))... ;; cou
4cf0: 6e 74 20 6e 75 6d 62 65 72 20 6f 66 20 27 64 6f  nt number of 'do
4d00: 6e 65 2c 20 69 66 20 6d 6f 72 65 20 74 68 61 6e  ne, if more than
4d10: 20 31 30 30 20 74 68 65 6e 20 73 6b 69 70 20 6f   100 then skip o
4d20: 6e 20 74 68 72 6f 75 67 68 2e 0a 09 09 20 28 28  n through.... ((
4d30: 6e 6f 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d  not (hash-table-
4d40: 72 65 66 2f 64 65 66 61 75 6c 74 20 74 65 73 74  ref/default test
4d50: 2d 72 65 67 69 73 74 72 79 20 28 72 75 6e 73 3a  -registry (runs:
4d60: 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e  make-full-test-n
4d70: 61 6d 65 20 74 65 73 74 2d 6e 61 6d 65 20 69 74  ame test-name it
4d80: 65 6d 2d 70 61 74 68 29 20 23 66 29 29 20 3b 3b  em-path) #f)) ;;
4d90: 20 29 20 3b 3b 20 74 6f 6f 20 6d 61 6e 79 20 63   ) ;; too many c
4da0: 68 61 6e 67 65 73 20 72 65 71 75 69 72 65 64 2e  hanges required.
4db0: 20 49 6d 70 6c 65 6d 65 6e 74 20 6c 61 74 65 72   Implement later
4dc0: 2e 0a 09 09 20 20 28 64 65 62 75 67 3a 70 72 69  ....  (debug:pri
4dd0: 6e 74 2d 69 6e 66 6f 20 34 20 22 50 72 65 2d 72  nt-info 4 "Pre-r
4de0: 65 67 69 73 74 65 72 69 6e 67 20 74 65 73 74 20  egistering test 
4df0: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20  " test-name "/" 
4e00: 69 74 65 6d 2d 70 61 74 68 20 22 20 74 6f 20 63  item-path " to c
4e10: 72 65 61 74 65 20 70 6c 61 63 65 68 6f 6c 64 65  reate placeholde
4e20: 72 22 20 29 0a 09 09 20 20 28 6c 65 74 20 28 28  r" )...  (let ((
4e30: 74 68 20 28 6d 61 6b 65 2d 74 68 72 65 61 64 20  th (make-thread 
4e40: 28 6c 61 6d 62 64 61 20 28 29 0a 09 09 20 20 20  (lambda ()...   
4e50: 20 20 20 20 20 09 09 20 20 20 28 6d 75 74 65 78       ..   (mutex
4e60: 2d 6c 6f 63 6b 21 20 72 65 67 69 73 74 72 79 2d  -lock! registry-
4e70: 6d 75 74 65 78 29 0a 09 09 20 20 20 20 20 20 20  mutex)...       
4e80: 20 09 09 20 20 20 28 68 61 73 68 2d 74 61 62 6c   ..   (hash-tabl
4e90: 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 67 69  e-set! test-regi
4ea0: 73 74 72 79 20 28 72 75 6e 73 3a 6d 61 6b 65 2d  stry (runs:make-
4eb0: 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 74  full-test-name t
4ec0: 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61  est-name item-pa
4ed0: 74 68 29 20 27 73 74 61 72 74 29 0a 09 09 20 20  th) 'start)...  
4ee0: 20 20 20 20 20 20 09 09 20 20 20 28 6d 75 74 65        ..   (mute
4ef0: 78 2d 75 6e 6c 6f 63 6b 21 20 72 65 67 69 73 74  x-unlock! regist
4f00: 72 79 2d 6d 75 74 65 78 29 0a 09 09 09 09 09 20  ry-mutex)...... 
4f10: 20 20 3b 3b 20 49 66 20 68 61 76 65 6e 27 74 20    ;; If haven't 
4f20: 64 6f 6e 65 20 69 74 20 62 65 66 6f 72 65 20 72  done it before r
4f30: 65 67 69 73 74 65 72 20 61 20 74 6f 70 20 6c 65  egister a top le
4f40: 76 65 6c 20 74 65 73 74 20 69 66 20 74 68 69 73  vel test if this
4f50: 20 69 73 20 61 6e 20 69 74 65 6d 69 7a 65 64 20   is an itemized 
4f60: 74 65 73 74 0a 09 09 09 09 09 20 20 20 28 69 66  test......   (if
4f70: 20 28 6e 6f 74 20 28 65 71 3f 20 28 68 61 73 68   (not (eq? (hash
4f80: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75  -table-ref/defau
4f90: 6c 74 20 74 65 73 74 2d 72 65 67 69 73 74 72 79  lt test-registry
4fa0: 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c   (runs:make-full
4fb0: 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d  -test-name test-
4fc0: 6e 61 6d 65 20 22 22 29 20 23 66 29 20 27 64 6f  name "") #f) 'do
4fd0: 6e 65 29 29 0a 09 09 09 09 09 20 20 20 20 20 20  ne))......      
4fe0: 20 28 63 64 62 3a 74 65 73 74 73 2d 72 65 67 69   (cdb:tests-regi
4ff0: 73 74 65 72 2d 74 65 73 74 20 2a 72 75 6e 72 65  ster-test *runre
5000: 6d 6f 74 65 2a 20 72 75 6e 2d 69 64 20 74 65 73  mote* run-id tes
5010: 74 2d 6e 61 6d 65 20 22 22 29 29 0a 09 09 09 09  t-name "")).....
5020: 09 20 20 20 28 63 64 62 3a 74 65 73 74 73 2d 72  .   (cdb:tests-r
5030: 65 67 69 73 74 65 72 2d 74 65 73 74 20 2a 72 75  egister-test *ru
5040: 6e 72 65 6d 6f 74 65 2a 20 72 75 6e 2d 69 64 20  nremote* run-id 
5050: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70  test-name item-p
5060: 61 74 68 29 0a 09 09 20 20 20 20 20 20 20 20 09  ath)...        .
5070: 09 20 20 20 28 6d 75 74 65 78 2d 6c 6f 63 6b 21  .   (mutex-lock!
5080: 20 72 65 67 69 73 74 72 79 2d 6d 75 74 65 78 29   registry-mutex)
5090: 0a 09 09 09 09 09 20 20 20 28 68 61 73 68 2d 74  ......   (hash-t
50a0: 61 62 6c 65 2d 73 65 74 21 20 74 65 73 74 2d 72  able-set! test-r
50b0: 65 67 69 73 74 72 79 20 28 72 75 6e 73 3a 6d 61  egistry (runs:ma
50c0: 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d  ke-full-test-nam
50d0: 65 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d  e test-name item
50e0: 2d 70 61 74 68 29 20 27 64 6f 6e 65 29 0a 09 09  -path) 'done)...
50f0: 20 20 20 20 20 20 20 20 09 09 20 20 20 28 6d 75          ..   (mu
5100: 74 65 78 2d 75 6e 6c 6f 63 6b 21 20 72 65 67 69  tex-unlock! regi
5110: 73 74 72 79 2d 6d 75 74 65 78 29 29 0a 09 09 20  stry-mutex))... 
5120: 20 20 20 20 20 20 20 09 09 20 28 63 6f 6e 63 20         .. (conc 
5130: 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74  test-name "/" it
5140: 65 6d 2d 70 61 74 68 29 29 29 29 0a 09 09 20 20  em-path))))...  
5150: 20 20 28 74 68 72 65 61 64 2d 73 74 61 72 74 21    (thread-start!
5160: 20 74 68 29 29 0a 09 09 20 20 28 72 75 6e 73 3a   th))...  (runs:
5170: 73 68 72 69 6e 6b 2d 63 61 6e 2d 72 75 6e 2d 6d  shrink-can-run-m
5180: 6f 72 65 2d 74 65 73 74 73 2d 63 6f 75 6e 74 29  ore-tests-count)
5190: 20 20 20 3b 3b 20 44 45 4c 41 59 20 54 57 45 41     ;; DELAY TWEA
51a0: 4b 45 52 20 28 73 74 69 6c 6c 20 6e 65 65 64 65  KER (still neede
51b0: 64 3f 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 72  d?)...  (loop (r
51c0: 75 6e 73 3a 71 75 65 75 65 2d 6e 65 78 74 2d 68  uns:queue-next-h
51d0: 65 64 20 74 61 6c 20 72 65 67 20 72 65 67 6c 65  ed tal reg regle
51e0: 6e 20 72 65 67 66 75 6c 6c 29 0a 09 09 09 28 72  n regfull)....(r
51f0: 75 6e 73 3a 71 75 65 75 65 2d 6e 65 78 74 2d 74  uns:queue-next-t
5200: 61 6c 20 74 61 6c 20 72 65 67 20 72 65 67 6c 65  al tal reg regle
5210: 6e 20 72 65 67 66 75 6c 6c 29 0a 09 09 09 28 6c  n regfull)....(l
5220: 65 74 20 28 28 6e 65 77 6c 20 28 61 70 70 65 6e  et ((newl (appen
5230: 64 20 72 65 67 20 28 6c 69 73 74 20 68 65 64 29  d reg (list hed)
5240: 29 29 29 0a 09 09 09 20 20 28 69 66 20 72 65 67  )))....  (if reg
5250: 66 75 6c 6c 20 0a 09 09 09 20 20 20 20 20 20 28  full ....      (
5260: 63 64 72 20 6e 65 77 6c 29 0a 09 09 09 20 20 20  cdr newl)....   
5270: 20 20 20 6e 65 77 6c 29 29 0a 09 09 09 72 65 72     newl))....rer
5280: 75 6e 73 29 29 0a 09 09 20 3b 3b 20 41 74 20 74  uns))... ;; At t
5290: 68 69 73 20 70 6f 69 6e 74 20 68 65 64 20 74 65  his point hed te
52a0: 73 74 20 72 65 67 69 73 74 72 61 74 69 6f 6e 20  st registration 
52b0: 6d 75 73 74 20 62 65 20 63 6f 6d 70 6c 65 74 65  must be complete
52c0: 64 2e 0a 09 09 20 28 28 65 71 3f 20 28 68 61 73  d.... ((eq? (has
52d0: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61  h-table-ref/defa
52e0: 75 6c 74 20 74 65 73 74 2d 72 65 67 69 73 74 72  ult test-registr
52f0: 79 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c  y (runs:make-ful
5300: 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74  l-test-name test
5310: 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29  -name item-path)
5320: 20 23 66 29 0a 09 09 20 20 20 20 20 20 20 27 73   #f)...       's
5330: 74 61 72 74 29 0a 09 09 20 20 28 64 65 62 75 67  tart)...  (debug
5340: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 30 20 22 57  :print-info 0 "W
5350: 61 69 74 69 6e 67 20 6f 6e 20 74 65 73 74 20 72  aiting on test r
5360: 65 67 69 73 74 72 61 74 69 6f 6e 28 73 29 3a 20  egistration(s): 
5370: 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73  " (string-inters
5380: 70 65 72 73 65 20 0a 09 09 09 09 09 09 09 09 09  perse ..........
5390: 20 20 20 28 66 69 6c 74 65 72 20 28 6c 61 6d 62     (filter (lamb
53a0: 64 61 20 28 78 29 0a 09 09 09 09 09 09 09 09 09  da (x)..........
53b0: 09 20 20 20 20 20 28 65 71 3f 20 28 68 61 73 68  .     (eq? (hash
53c0: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75  -table-ref/defau
53d0: 6c 74 20 74 65 73 74 2d 72 65 67 69 73 74 72 79  lt test-registry
53e0: 20 78 20 23 66 29 20 27 73 74 61 72 74 29 29 0a   x #f) 'start)).
53f0: 09 09 09 09 09 09 09 09 09 09 20 20 20 28 68 61  ..........   (ha
5400: 73 68 2d 74 61 62 6c 65 2d 6b 65 79 73 20 74 65  sh-table-keys te
5410: 73 74 2d 72 65 67 69 73 74 72 79 29 29 0a 09 09  st-registry))...
5420: 09 09 09 09 09 09 09 20 20 20 22 2c 20 22 29 29  .......   ", "))
5430: 0a 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65  ...  (thread-sle
5440: 65 70 21 20 30 2e 31 29 0a 09 09 20 20 28 6c 6f  ep! 0.1)...  (lo
5450: 6f 70 20 68 65 64 20 74 61 6c 20 72 65 67 20 72  op hed tal reg r
5460: 65 72 75 6e 73 29 29 0a 09 09 20 28 28 6e 6f 74  eruns))... ((not
5470: 20 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 29   have-resources)
5480: 20 3b 3b 20 73 69 6d 70 6c 79 20 74 72 79 20 61   ;; simply try a
5490: 67 61 69 6e 20 61 66 74 65 72 20 77 61 69 74 69  gain after waiti
54a0: 6e 67 20 61 20 73 65 63 6f 6e 64 0a 09 09 20 20  ng a second...  
54b0: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
54c0: 6f 20 31 20 22 6e 6f 20 72 65 73 6f 75 72 63 65  o 1 "no resource
54d0: 73 20 74 6f 20 72 75 6e 20 6e 65 77 20 74 65 73  s to run new tes
54e0: 74 73 2c 20 77 61 69 74 69 6e 67 20 2e 2e 2e 22  ts, waiting ..."
54f0: 29 0a 09 09 20 20 3b 3b 20 48 61 76 65 20 67 6f  )...  ;; Have go
5500: 6e 65 20 62 61 63 6b 20 61 6e 64 20 66 6f 72 74  ne back and fort
5510: 68 20 6f 6e 20 74 68 69 73 20 62 75 74 20 64 62  h on this but db
5520: 20 73 74 61 72 76 61 74 69 6f 6e 20 69 73 20 61   starvation is a
5530: 6e 20 69 73 73 75 65 2e 0a 09 09 20 20 3b 3b 20  n issue....  ;; 
5540: 77 61 69 74 20 6f 6e 65 20 73 65 63 6f 6e 64 20  wait one second 
5550: 62 65 66 6f 72 65 20 6c 6f 6f 6b 69 6e 67 20 61  before looking a
5560: 67 61 69 6e 20 74 6f 20 72 75 6e 20 6a 6f 62 73  gain to run jobs
5570: 2e 0a 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c  ....  (thread-sl
5580: 65 65 70 21 20 31 29 20 3b 3b 20 28 2b 20 32 20  eep! 1) ;; (+ 2 
5590: 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29  *global-delta*))
55a0: 0a 09 09 20 20 3b 3b 20 63 6f 75 6c 64 20 68 61  ...  ;; could ha
55b0: 76 65 20 64 6f 6e 65 20 68 65 64 20 74 61 6c 20  ve done hed tal 
55c0: 68 65 72 65 20 62 75 74 20 64 6f 69 6e 67 20 63  here but doing c
55d0: 61 72 2f 63 64 72 20 6f 66 20 6e 65 77 74 61 6c  ar/cdr of newtal
55e0: 20 74 6f 20 72 6f 74 61 74 65 20 74 65 73 74 73   to rotate tests
55f0: 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20  ...  (loop (car 
5600: 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74  newtal)(cdr newt
5610: 61 6c 29 20 72 65 67 20 72 65 72 75 6e 73 29 29  al) reg reruns))
5620: 0a 09 09 20 28 28 61 6e 64 20 68 61 76 65 2d 72  ... ((and have-r
5630: 65 73 6f 75 72 63 65 73 0a 09 09 20 20 20 20 20  esources...     
5640: 20 20 28 6f 72 20 28 6e 75 6c 6c 3f 20 70 72 65    (or (null? pre
5650: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09  reqs-not-met)...
5660: 09 20 20 20 28 61 6e 64 20 28 65 71 3f 20 74 65  .   (and (eq? te
5670: 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c  stmode 'toplevel
5680: 29 0a 09 09 09 09 28 6e 75 6c 6c 3f 20 6e 6f 6e  ).....(null? non
5690: 2d 63 6f 6d 70 6c 65 74 65 64 29 29 29 29 0a 09  -completed))))..
56a0: 09 20 20 28 72 75 6e 3a 74 65 73 74 20 72 75 6e  .  (run:test run
56b0: 2d 69 64 20 72 75 6e 6e 61 6d 65 20 6b 65 79 76  -id runname keyv
56c0: 61 6c 6c 73 74 20 74 65 73 74 2d 72 65 63 6f 72  allst test-recor
56d0: 64 20 66 6c 61 67 73 20 23 66 29 0a 09 09 20 20  d flags #f)...  
56e0: 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21  (hash-table-set!
56f0: 20 74 65 73 74 2d 72 65 67 69 73 74 72 79 20 28   test-registry (
5700: 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74  runs:make-full-t
5710: 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 6e 61  est-name test-na
5720: 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 20 27 72  me item-path) 'r
5730: 75 6e 6e 69 6e 67 29 0a 09 09 20 20 28 72 75 6e  unning)...  (run
5740: 73 3a 73 68 72 69 6e 6b 2d 63 61 6e 2d 72 75 6e  s:shrink-can-run
5750: 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 63 6f 75 6e  -more-tests-coun
5760: 74 29 20 20 3b 3b 20 44 45 4c 41 59 20 54 57 45  t)  ;; DELAY TWE
5770: 41 4b 45 52 20 28 73 74 69 6c 6c 20 6e 65 65 64  AKER (still need
5780: 65 64 3f 29 0a 09 09 20 20 3b 3b 20 28 74 68 72  ed?)...  ;; (thr
5790: 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62  ead-sleep! *glob
57a0: 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 20 20 28  al-delta*)...  (
57b0: 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74  if (not (null? t
57c0: 61 6c 29 29 0a 09 09 20 20 20 20 20 20 28 6c 6f  al))...      (lo
57d0: 6f 70 20 28 72 75 6e 73 3a 71 75 65 75 65 2d 6e  op (runs:queue-n
57e0: 65 78 74 2d 68 65 64 20 74 61 6c 20 72 65 67 20  ext-hed tal reg 
57f0: 72 65 67 6c 65 6e 20 72 65 67 66 75 6c 6c 29 0a  reglen regfull).
5800: 09 09 09 20 20 20 20 28 72 75 6e 73 3a 71 75 65  ...    (runs:que
5810: 75 65 2d 6e 65 78 74 2d 74 61 6c 20 74 61 6c 20  ue-next-tal tal 
5820: 72 65 67 20 72 65 67 6c 65 6e 20 72 65 67 66 75  reg reglen regfu
5830: 6c 6c 29 0a 09 09 09 20 20 20 20 28 72 75 6e 73  ll)....    (runs
5840: 3a 71 75 65 75 65 2d 6e 65 78 74 2d 72 65 67 20  :queue-next-reg 
5850: 74 61 6c 20 72 65 67 20 72 65 67 6c 65 6e 20 72  tal reg reglen r
5860: 65 67 66 75 6c 6c 29 0a 09 09 09 20 20 20 20 72  egfull)....    r
5870: 65 72 75 6e 73 29 29 29 0a 09 09 20 28 65 6c 73  eruns)))... (els
5880: 65 20 3b 3b 20 6d 75 73 74 20 62 65 20 77 65 20  e ;; must be we 
5890: 68 61 76 65 20 75 6e 6d 65 74 20 70 72 65 72 65  have unmet prere
58a0: 71 75 69 73 69 74 65 73 0a 09 09 20 20 20 20 28  quisites...    (
58b0: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 46  debug:print 4 "F
58c0: 41 49 4c 53 3a 20 22 20 66 61 69 6c 73 29 0a 09  AILS: " fails)..
58d0: 09 20 20 20 20 3b 3b 20 49 66 20 6f 6e 65 20 6f  .    ;; If one o
58e0: 72 20 6d 6f 72 65 20 6f 66 20 74 68 65 20 70 72  r more of the pr
58f0: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 61 72  ereqs-not-met ar
5900: 65 20 46 41 49 4c 20 74 68 65 6e 20 77 65 20 63  e FAIL then we c
5910: 61 6e 20 69 73 73 75 65 0a 09 09 20 20 20 20 3b  an issue...    ;
5920: 3b 20 61 20 6d 65 73 73 61 67 65 20 61 6e 64 20  ; a message and 
5930: 64 72 6f 70 20 68 65 64 20 66 72 6f 6d 20 74 68  drop hed from th
5940: 65 20 69 74 65 6d 73 20 74 6f 20 62 65 20 70 72  e items to be pr
5950: 6f 63 65 73 73 65 64 2e 0a 09 09 20 20 20 20 28  ocessed....    (
5960: 69 66 20 28 6e 75 6c 6c 3f 20 66 61 69 6c 73 29  if (null? fails)
5970: 0a 09 09 09 28 62 65 67 69 6e 0a 09 09 09 20 20  ....(begin....  
5980: 3b 3b 20 63 6f 75 6c 64 6e 27 74 20 72 75 6e 2c  ;; couldn't run,
5990: 20 74 61 6b 65 20 61 20 62 72 65 61 74 68 65 72   take a breather
59a0: 0a 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 69  ....  (debug:pri
59b0: 6e 74 2d 69 6e 66 6f 20 34 20 22 53 68 6f 75 6c  nt-info 4 "Shoul
59c0: 64 6e 27 74 20 72 65 61 6c 6c 79 20 67 65 74 20  dn't really get 
59d0: 68 65 72 65 2c 20 72 61 63 65 20 63 6f 6e 64 69  here, race condi
59e0: 74 69 6f 6e 3f 20 55 6e 61 62 6c 65 20 74 6f 20  tion? Unable to 
59f0: 6c 61 75 6e 63 68 20 6d 6f 72 65 20 74 65 73 74  launch more test
5a00: 73 20 61 74 20 74 68 69 73 20 6d 6f 6d 65 6e 74  s at this moment
5a10: 2c 20 6b 69 6c 6c 69 6e 67 20 74 69 6d 65 20 2e  , killing time .
5a20: 2e 2e 22 29 0a 09 09 09 20 20 3b 3b 20 28 74 68  ..")....  ;; (th
5a30: 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 30  read-sleep! (+ 0
5a40: 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74  .01 *global-delt
5a50: 61 2a 29 29 20 3b 3b 20 6c 6f 6e 67 20 73 6c 65  a*)) ;; long sle
5a60: 65 70 20 68 65 72 65 20 2d 20 6e 6f 20 72 65 73  ep here - no res
5a70: 6f 75 72 63 65 73 2c 20 6d 61 79 20 61 73 20 77  ources, may as w
5a80: 65 6c 6c 20 62 65 20 70 61 74 69 65 6e 74 0a 09  ell be patient..
5a90: 09 09 20 20 3b 3b 20 77 65 20 6d 61 64 65 20 6e  ..  ;; we made n
5aa0: 65 77 20 74 61 6c 20 62 79 20 73 74 69 63 6b 69  ew tal by sticki
5ab0: 6e 67 20 68 65 64 20 61 74 20 74 68 65 20 62 61  ng hed at the ba
5ac0: 63 6b 20 6f 66 20 74 68 65 20 6c 69 73 74 0a 09  ck of the list..
5ad0: 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e  ..  (loop (car n
5ae0: 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61  ewtal)(cdr newta
5af0: 6c 29 20 72 65 67 20 72 65 72 75 6e 73 29 29 0a  l) reg reruns)).
5b00: 09 09 09 3b 3b 20 74 68 65 20 77 61 69 74 6f 6e  ...;; the waiton
5b10: 20 69 73 20 46 41 49 4c 20 73 6f 20 6e 6f 20 70   is FAIL so no p
5b20: 6f 69 6e 74 20 69 6e 20 74 72 79 69 6e 67 20 74  oint in trying t
5b30: 6f 20 72 75 6e 20 68 65 64 20 65 76 65 72 20 61  o run hed ever a
5b40: 67 61 69 6e 0a 09 09 09 28 69 66 20 28 6e 6f 74  gain....(if (not
5b50: 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09   (null? tal))...
5b60: 09 20 20 20 20 28 69 66 20 28 76 65 63 74 6f 72  .    (if (vector
5b70: 3f 20 68 65 64 29 0a 09 09 09 09 28 62 65 67 69  ? hed).....(begi
5b80: 6e 20 0a 09 09 09 09 20 20 28 64 65 62 75 67 3a  n .....  (debug:
5b90: 70 72 69 6e 74 20 31 20 22 57 41 52 4e 3a 20 44  print 1 "WARN: D
5ba0: 72 6f 70 70 69 6e 67 20 74 65 73 74 20 22 20 28  ropping test " (
5bb0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74  db:test-get-test
5bc0: 6e 61 6d 65 20 68 65 64 29 20 22 2f 22 20 28 64  name hed) "/" (d
5bd0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d  b:test-get-item-
5be0: 70 61 74 68 20 68 65 64 29 0a 09 09 09 09 09 20  path hed)...... 
5bf0: 20 20 20 20 20 20 22 20 66 72 6f 6d 20 74 68 65        " from the
5c00: 20 6c 61 75 6e 63 68 20 6c 69 73 74 20 61 73 20   launch list as 
5c10: 69 74 20 68 61 73 20 70 72 65 72 65 71 75 69 73  it has prerequis
5c20: 74 65 73 20 74 68 61 74 20 61 72 65 20 46 41 49  tes that are FAI
5c30: 4c 22 29 0a 09 09 09 09 20 20 28 72 75 6e 73 3a  L").....  (runs:
5c40: 73 68 72 69 6e 6b 2d 63 61 6e 2d 72 75 6e 2d 6d  shrink-can-run-m
5c50: 6f 72 65 2d 74 65 73 74 73 2d 63 6f 75 6e 74 29  ore-tests-count)
5c60: 20 3b 3b 20 44 45 4c 41 59 20 54 57 45 41 4b 45   ;; DELAY TWEAKE
5c70: 52 20 28 73 74 69 6c 6c 20 6e 65 65 64 65 64 3f  R (still needed?
5c80: 29 0a 09 09 09 09 20 20 3b 3b 20 28 74 68 72 65  ).....  ;; (thre
5c90: 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61  ad-sleep! *globa
5ca0: 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 09 09 20 20  l-delta*).....  
5cb0: 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21  (hash-table-set!
5cc0: 20 74 65 73 74 2d 72 65 67 69 73 74 72 79 20 28   test-registry (
5cd0: 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74  runs:make-full-t
5ce0: 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 6e 61  est-name test-na
5cf0: 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 20 27 72  me item-path) 'r
5d00: 65 6d 6f 76 65 64 29 0a 09 09 09 09 20 20 28 6c  emoved).....  (l
5d10: 6f 6f 70 20 28 72 75 6e 73 3a 71 75 65 75 65 2d  oop (runs:queue-
5d20: 6e 65 78 74 2d 68 65 64 20 74 61 6c 20 72 65 67  next-hed tal reg
5d30: 20 72 65 67 6c 65 6e 20 72 65 67 66 75 6c 6c 29   reglen regfull)
5d40: 0a 09 09 09 09 09 28 72 75 6e 73 3a 71 75 65 75  ......(runs:queu
5d50: 65 2d 6e 65 78 74 2d 74 61 6c 20 74 61 6c 20 72  e-next-tal tal r
5d60: 65 67 20 72 65 67 6c 65 6e 20 72 65 67 66 75 6c  eg reglen regful
5d70: 6c 29 0a 09 09 09 09 09 28 72 75 6e 73 3a 71 75  l)......(runs:qu
5d80: 65 75 65 2d 6e 65 78 74 2d 72 65 67 20 74 61 6c  eue-next-reg tal
5d90: 20 72 65 67 20 72 65 67 6c 65 6e 20 72 65 67 66   reg reglen regf
5da0: 75 6c 6c 29 0a 09 09 09 09 09 28 63 6f 6e 73 20  ull)......(cons 
5db0: 68 65 64 20 72 65 72 75 6e 73 29 29 29 0a 09 09  hed reruns)))...
5dc0: 09 09 28 62 65 67 69 6e 0a 09 09 09 09 20 20 28  ..(begin.....  (
5dd0: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 57  debug:print 1 "W
5de0: 41 52 4e 3a 20 54 65 73 74 20 6e 6f 74 20 70 72  ARN: Test not pr
5df0: 6f 63 65 73 73 65 64 20 63 6f 72 72 65 63 74 6c  ocessed correctl
5e00: 79 2e 20 43 6f 75 6c 64 20 62 65 20 61 20 72 61  y. Could be a ra
5e10: 63 65 20 63 6f 6e 64 69 74 69 6f 6e 20 69 6e 20  ce condition in 
5e20: 79 6f 75 72 20 74 65 73 74 20 69 6d 70 6c 65 6d  your test implem
5e30: 65 6e 74 61 74 69 6f 6e 3f 20 22 20 68 65 64 29  entation? " hed)
5e40: 20 3b 3b 20 20 22 20 61 73 20 69 74 20 68 61 73   ;;  " as it has
5e50: 20 70 72 65 72 65 71 75 69 73 74 65 73 20 74 68   prerequistes th
5e60: 61 74 20 61 72 65 20 46 41 49 4c 2e 20 28 4e 4f  at are FAIL. (NO
5e70: 54 45 3a 20 68 65 64 20 69 73 20 6e 6f 74 20 61  TE: hed is not a
5e80: 20 76 65 63 74 6f 72 29 22 29 0a 09 09 09 09 20   vector)")..... 
5e90: 20 28 72 75 6e 73 3a 73 68 72 69 6e 6b 2d 63 61   (runs:shrink-ca
5ea0: 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73  n-run-more-tests
5eb0: 2d 63 6f 75 6e 74 29 20 3b 3b 20 44 45 4c 41 59  -count) ;; DELAY
5ec0: 20 54 57 45 41 4b 45 52 20 28 73 74 69 6c 6c 20   TWEAKER (still 
5ed0: 6e 65 65 64 65 64 3f 29 0a 09 09 09 09 20 20 3b  needed?).....  ;
5ee0: 3b 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21  ; (thread-sleep!
5ef0: 20 28 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c   (+ 0.01 *global
5f00: 2d 64 65 6c 74 61 2a 29 29 0a 09 09 09 09 20 20  -delta*)).....  
5f10: 28 6c 6f 6f 70 20 68 65 64 20 74 61 6c 20 72 65  (loop hed tal re
5f20: 67 20 72 65 72 75 6e 73 29 29 29 29 29 29 29 29  g reruns))))))))
5f30: 29 20 3b 3b 20 45 4e 44 20 4f 46 20 49 4e 4e 45  ) ;; END OF INNE
5f40: 52 20 43 4f 4e 44 0a 09 20 20 20 20 20 0a 09 20  R COND..     .. 
5f50: 20 20 20 20 3b 3b 20 63 61 73 65 20 77 68 65 72      ;; case wher
5f60: 65 20 61 6e 20 69 74 65 6d 73 20 63 61 6d 65 20  e an items came 
5f70: 69 6e 20 61 73 20 61 20 6c 69 73 74 20 62 65 65  in as a list bee
5f80: 6e 20 70 72 6f 63 65 73 73 65 64 0a 09 20 20 20  n processed..   
5f90: 20 20 28 28 61 6e 64 20 28 6c 69 73 74 3f 20 69    ((and (list? i
5fa0: 74 65 6d 73 29 20 20 20 20 20 3b 3b 20 74 68 75  tems)     ;; thu
5fb0: 73 20 77 65 20 6b 6e 6f 77 20 6f 75 72 20 69 74  s we know our it
5fc0: 65 6d 73 20 61 72 65 20 61 6c 72 65 61 64 79 20  ems are already 
5fd0: 63 61 6c 63 75 6c 61 74 65 64 0a 09 09 20 20 20  calculated...   
5fe0: 28 6e 6f 74 20 20 20 69 74 65 6d 64 61 74 29 29  (not   itemdat))
5ff0: 20 3b 3b 20 61 6e 64 20 6e 6f 74 20 79 65 74 20   ;; and not yet 
6000: 65 78 70 61 6e 64 65 64 20 69 6e 74 6f 20 74 68  expanded into th
6010: 65 20 6c 69 73 74 20 6f 66 20 74 68 69 6e 67 73  e list of things
6020: 20 74 6f 20 62 65 20 64 6f 6e 65 0a 09 20 20 20   to be done..   
6030: 20 20 20 28 69 66 20 28 61 6e 64 20 28 64 65 62     (if (and (deb
6040: 75 67 3a 64 65 62 75 67 2d 6d 6f 64 65 20 31 29  ug:debug-mode 1)
6050: 20 3b 3b 20 28 3e 3d 20 2a 76 65 72 62 6f 73 69   ;; (>= *verbosi
6060: 74 79 2a 20 31 29 0a 09 09 20 20 20 20 20 20 20  ty* 1)...       
6070: 28 3e 20 28 6c 65 6e 67 74 68 20 69 74 65 6d 73  (> (length items
6080: 29 20 30 29 0a 09 09 20 20 20 20 20 20 20 28 3e  ) 0)...       (>
6090: 20 28 6c 65 6e 67 74 68 20 28 63 61 72 20 69 74   (length (car it
60a0: 65 6d 73 29 29 20 30 29 29 0a 09 09 20 20 28 70  ems)) 0))...  (p
60b0: 70 20 69 74 65 6d 73 29 29 0a 09 20 20 20 20 20  p items))..     
60c0: 20 28 66 6f 72 2d 65 61 63 68 0a 09 20 20 20 20   (for-each..    
60d0: 20 20 20 28 6c 61 6d 62 64 61 20 28 6d 79 2d 69     (lambda (my-i
60e0: 74 65 6d 64 61 74 29 0a 09 09 20 28 6c 65 74 2a  temdat)... (let*
60f0: 20 28 28 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f   ((new-test-reco
6100: 72 64 20 28 6c 65 74 20 28 28 6e 65 77 72 65 63  rd (let ((newrec
6110: 20 28 6d 61 6b 65 2d 74 65 73 74 73 3a 74 65 73   (make-tests:tes
6120: 74 71 75 65 75 65 29 29 29 0a 09 09 09 09 09 20  tqueue)))...... 
6130: 20 20 28 76 65 63 74 6f 72 2d 63 6f 70 79 21 20    (vector-copy! 
6140: 74 65 73 74 2d 72 65 63 6f 72 64 20 6e 65 77 72  test-record newr
6150: 65 63 29 0a 09 09 09 09 09 20 20 20 6e 65 77 72  ec)......   newr
6160: 65 63 29 29 0a 09 09 09 28 6d 79 2d 69 74 65 6d  ec))....(my-item
6170: 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74  -path (item-list
6180: 2d 3e 70 61 74 68 20 6d 79 2d 69 74 65 6d 64 61  ->path my-itemda
6190: 74 29 29 29 0a 09 09 20 20 20 28 69 66 20 28 74  t)))...   (if (t
61a0: 65 73 74 73 3a 6d 61 74 63 68 20 74 65 73 74 2d  ests:match test-
61b0: 70 61 74 74 73 20 68 65 64 20 6d 79 2d 69 74 65  patts hed my-ite
61c0: 6d 2d 70 61 74 68 29 20 3b 3b 20 28 70 61 74 74  m-path) ;; (patt
61d0: 2d 6c 69 73 74 2d 6d 61 74 63 68 20 6d 79 2d 69  -list-match my-i
61e0: 74 65 6d 2d 70 61 74 68 20 69 74 65 6d 2d 70 61  tem-path item-pa
61f0: 74 74 73 29 20 20 20 20 20 20 20 20 20 20 20 3b  tts)           ;
6200: 3b 20 79 65 73 2c 20 77 65 20 77 61 6e 74 20 74  ; yes, we want t
6210: 6f 20 70 72 6f 63 65 73 73 20 74 68 69 73 20 69  o process this i
6220: 74 65 6d 2c 20 4e 4f 54 45 3a 20 53 68 6f 75 6c  tem, NOTE: Shoul
6230: 64 20 6e 6f 74 20 6e 65 65 64 20 74 68 69 73 20  d not need this 
6240: 63 68 65 63 6b 20 68 65 72 65 21 0a 09 09 20 20  check here!...  
6250: 20 20 20 20 20 28 6c 65 74 20 28 28 6e 65 77 74       (let ((newt
6260: 65 73 74 6e 61 6d 65 20 28 72 75 6e 73 3a 6d 61  estname (runs:ma
6270: 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d  ke-full-test-nam
6280: 65 20 68 65 64 20 6d 79 2d 69 74 65 6d 2d 70 61  e hed my-item-pa
6290: 74 68 29 29 29 20 20 20 20 3b 3b 20 74 65 73 74  th)))    ;; test
62a0: 20 6e 61 6d 65 73 20 61 72 65 20 75 6e 69 71 75   names are uniqu
62b0: 65 20 6f 6e 20 74 65 73 74 6e 61 6d 65 2f 69 74  e on testname/it
62c0: 65 6d 2d 70 61 74 68 0a 09 09 09 20 28 74 65 73  em-path.... (tes
62d0: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74  ts:testqueue-set
62e0: 2d 69 74 65 6d 73 21 20 20 20 20 20 6e 65 77 2d  -items!     new-
62f0: 74 65 73 74 2d 72 65 63 6f 72 64 20 23 66 29 0a  test-record #f).
6300: 09 09 09 20 28 74 65 73 74 73 3a 74 65 73 74 71  ... (tests:testq
6310: 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 64 61 74  ueue-set-itemdat
6320: 21 20 20 20 6e 65 77 2d 74 65 73 74 2d 72 65 63  !   new-test-rec
6330: 6f 72 64 20 6d 79 2d 69 74 65 6d 64 61 74 29 0a  ord my-itemdat).
6340: 09 09 09 20 28 74 65 73 74 73 3a 74 65 73 74 71  ... (tests:testq
6350: 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 5f 70 61  ueue-set-item_pa
6360: 74 68 21 20 6e 65 77 2d 74 65 73 74 2d 72 65 63  th! new-test-rec
6370: 6f 72 64 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68  ord my-item-path
6380: 29 0a 09 09 09 20 28 68 61 73 68 2d 74 61 62 6c  ).... (hash-tabl
6390: 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 63 6f  e-set! test-reco
63a0: 72 64 73 20 6e 65 77 74 65 73 74 6e 61 6d 65 20  rds newtestname 
63b0: 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 29  new-test-record)
63c0: 0a 09 09 09 20 28 73 65 74 21 20 74 61 6c 20 28  .... (set! tal (
63d0: 63 6f 6e 73 20 6e 65 77 74 65 73 74 6e 61 6d 65  cons newtestname
63e0: 20 74 61 6c 29 29 29 29 29 29 20 3b 3b 20 73 69   tal)))))) ;; si
63f0: 6e 63 65 20 74 68 65 73 65 20 61 72 65 20 69 74  nce these are it
6400: 65 6d 69 7a 65 64 20 63 72 65 61 74 65 20 6e 65  emized create ne
6410: 77 20 74 65 73 74 20 6e 61 6d 65 73 20 74 65 73  w test names tes
6420: 74 6e 61 6d 65 2f 69 74 65 6d 70 61 74 68 0a 09  tname/itempath..
6430: 20 20 20 20 20 20 20 69 74 65 6d 73 29 0a 09 20         items).. 
6440: 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e       (if (not (n
6450: 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 20 20 28  ull? tal))...  (
6460: 62 65 67 69 6e 0a 09 09 20 20 20 20 28 64 65 62  begin...    (deb
6470: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20  ug:print-info 4 
6480: 22 45 6e 64 20 6f 66 20 69 74 65 6d 73 20 6c 69  "End of items li
6490: 73 74 2c 20 6c 6f 6f 70 69 6e 67 20 77 69 74 68  st, looping with
64a0: 20 6e 65 78 74 20 61 66 74 65 72 20 73 68 6f 72   next after shor
64b0: 74 20 64 65 6c 61 79 22 29 0a 20 20 20 20 20 20  t delay").      
64c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b                ;;
64d0: 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20   (thread-sleep! 
64e0: 28 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d  (+ 0.01 *global-
64f0: 64 65 6c 74 61 2a 29 29 0a 09 09 20 20 20 20 28  delta*))...    (
6500: 6c 6f 6f 70 20 28 72 75 6e 73 3a 71 75 65 75 65  loop (runs:queue
6510: 2d 6e 65 78 74 2d 68 65 64 20 74 61 6c 20 72 65  -next-hed tal re
6520: 67 20 72 65 67 6c 65 6e 20 72 65 67 66 75 6c 6c  g reglen regfull
6530: 29 0a 09 09 09 20 20 28 72 75 6e 73 3a 71 75 65  )....  (runs:que
6540: 75 65 2d 6e 65 78 74 2d 74 61 6c 20 74 61 6c 20  ue-next-tal tal 
6550: 72 65 67 20 72 65 67 6c 65 6e 20 72 65 67 66 75  reg reglen regfu
6560: 6c 6c 29 0a 09 09 09 20 20 28 72 75 6e 73 3a 71  ll)....  (runs:q
6570: 75 65 75 65 2d 6e 65 78 74 2d 72 65 67 20 74 61  ueue-next-reg ta
6580: 6c 20 72 65 67 20 72 65 67 6c 65 6e 20 72 65 67  l reg reglen reg
6590: 66 75 6c 6c 29 0a 09 09 09 20 20 72 65 72 75 6e  full)....  rerun
65a0: 73 29 29 29 29 0a 0a 09 20 20 20 20 20 3b 3b 20  s))))...     ;; 
65b0: 69 66 20 69 74 65 6d 73 20 69 73 20 61 20 70 72  if items is a pr
65c0: 6f 63 20 74 68 65 6e 20 6e 65 65 64 20 74 6f 20  oc then need to 
65d0: 72 75 6e 20 69 74 65 6d 73 3a 67 65 74 2d 69 74  run items:get-it
65e0: 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 2c  ems-from-config,
65f0: 20 67 65 74 20 74 68 65 20 6c 69 73 74 20 61 6e   get the list an
6600: 64 20 6c 6f 6f 70 20 0a 09 20 20 20 20 20 3b 3b  d loop ..     ;;
6610: 20 20 20 20 2d 20 62 75 74 20 6f 6e 6c 79 20 64      - but only d
6620: 6f 20 74 68 61 74 20 69 66 20 72 65 73 6f 75 72  o that if resour
6630: 63 65 73 20 65 78 69 73 74 20 74 6f 20 6b 69 63  ces exist to kic
6640: 6b 20 6f 66 66 20 74 68 65 20 6a 6f 62 0a 09 20  k off the job.. 
6650: 20 20 20 20 28 28 6f 72 20 28 70 72 6f 63 65 64      ((or (proced
6660: 75 72 65 3f 20 69 74 65 6d 73 29 28 65 71 3f 20  ure? items)(eq? 
6670: 69 74 65 6d 73 20 27 68 61 76 65 2d 70 72 6f 63  items 'have-proc
6680: 65 64 75 72 65 29 29 0a 09 20 20 20 20 20 20 28  edure))..      (
6690: 6c 65 74 20 28 28 63 61 6e 2d 72 75 6e 2d 6d 6f  let ((can-run-mo
66a0: 72 65 20 20 20 20 28 72 75 6e 73 3a 63 61 6e 2d  re    (runs:can-
66b0: 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 74  run-more-tests t
66c0: 65 73 74 2d 72 65 63 6f 72 64 20 6d 61 78 2d 63  est-record max-c
66d0: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 29 29  oncurrent-jobs))
66e0: 29 0a 09 09 28 69 66 20 28 61 6e 64 20 28 6c 69  )...(if (and (li
66f0: 73 74 3f 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65  st? can-run-more
6700: 29 0a 09 09 09 20 28 63 61 72 20 63 61 6e 2d 72  ).... (car can-r
6710: 75 6e 2d 6d 6f 72 65 29 29 0a 09 09 20 20 20 20  un-more))...    
6720: 28 6c 65 74 2a 20 28 28 70 72 65 72 65 71 73 2d  (let* ((prereqs-
6730: 6e 6f 74 2d 6d 65 74 20 28 64 62 3a 67 65 74 2d  not-met (db:get-
6740: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20  prereqs-not-met 
6750: 72 75 6e 2d 69 64 20 77 61 69 74 6f 6e 73 20 69  run-id waitons i
6760: 74 65 6d 2d 70 61 74 68 20 6d 6f 64 65 3a 20 74  tem-path mode: t
6770: 65 73 74 6d 6f 64 65 29 29 0a 09 09 09 20 20 20  estmode))....   
6780: 28 66 61 69 6c 73 20 20 20 20 20 20 20 20 20 20  (fails          
6790: 20 28 72 75 6e 73 3a 63 61 6c 63 2d 66 61 69 6c   (runs:calc-fail
67a0: 73 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65  s prereqs-not-me
67b0: 74 29 29 0a 09 09 09 20 20 20 28 6e 6f 6e 2d 63  t))....   (non-c
67c0: 6f 6d 70 6c 65 74 65 64 20 20 20 28 72 75 6e 73  ompleted   (runs
67d0: 3a 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65  :calc-not-comple
67e0: 74 65 64 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d  ted prereqs-not-
67f0: 6d 65 74 29 29 29 0a 09 09 20 20 20 20 20 20 28  met)))...      (
6800: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
6810: 20 38 20 22 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65   8 "can-run-more
6820: 3a 20 22 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65  : " can-run-more
6830: 0a 09 09 09 09 20 20 20 22 5c 6e 20 74 65 73 74  .....   "\n test
6840: 6e 61 6d 65 3a 20 20 20 20 20 20 20 20 22 20 68  name:        " h
6850: 65 64 0a 09 09 09 09 20 20 20 22 5c 6e 20 70 72  ed.....   "\n pr
6860: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 3a 20 22  ereqs-not-met: "
6870: 20 28 72 75 6e 73 3a 70 72 65 74 74 79 2d 73 74   (runs:pretty-st
6880: 72 69 6e 67 20 70 72 65 72 65 71 73 2d 6e 6f 74  ring prereqs-not
6890: 2d 6d 65 74 29 0a 09 09 09 09 20 20 20 22 5c 6e  -met).....   "\n
68a0: 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 3a 20   non-completed: 
68b0: 20 20 22 20 28 72 75 6e 73 3a 70 72 65 74 74 79    " (runs:pretty
68c0: 2d 73 74 72 69 6e 67 20 6e 6f 6e 2d 63 6f 6d 70  -string non-comp
68d0: 6c 65 74 65 64 29 20 0a 09 09 09 09 20 20 20 22  leted) .....   "
68e0: 5c 6e 20 66 61 69 6c 73 3a 20 20 20 20 20 20 20  \n fails:       
68f0: 20 20 20 20 22 20 28 72 75 6e 73 3a 70 72 65 74      " (runs:pret
6900: 74 79 2d 73 74 72 69 6e 67 20 66 61 69 6c 73 29  ty-string fails)
6910: 0a 09 09 09 09 20 20 20 22 5c 6e 20 74 65 73 74  .....   "\n test
6920: 6d 6f 64 65 3a 20 20 20 20 20 20 20 20 22 20 74  mode:        " t
6930: 65 73 74 6d 6f 64 65 0a 09 09 09 09 20 20 20 22  estmode.....   "
6940: 5c 6e 20 6e 75 6d 2d 72 65 74 72 69 65 73 3a 20  \n num-retries: 
6950: 20 20 20 20 22 20 6e 75 6d 2d 72 65 74 72 69 65      " num-retrie
6960: 73 0a 09 09 09 09 20 20 20 22 5c 6e 20 28 65 71  s.....   "\n (eq
6970: 3f 20 74 65 73 74 6d 6f 64 65 20 27 74 6f 70 6c  ? testmode 'topl
6980: 65 76 65 6c 29 3a 20 22 20 28 65 71 3f 20 74 65  evel): " (eq? te
6990: 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c  stmode 'toplevel
69a0: 29 0a 09 09 09 09 20 20 20 22 5c 6e 20 28 6e 75  ).....   "\n (nu
69b0: 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65  ll? non-complete
69c0: 64 29 3a 20 20 20 20 22 20 28 6e 75 6c 6c 3f 20  d):    " (null? 
69d0: 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 0a 09  non-completed)..
69e0: 09 09 09 20 20 20 22 5c 6e 20 72 65 72 75 6e 73  ...   "\n reruns
69f0: 3a 20 20 20 20 20 20 20 20 20 20 22 20 72 65 72  :          " rer
6a00: 75 6e 73 0a 09 09 09 09 20 20 20 22 5c 6e 20 69  uns.....   "\n i
6a10: 74 65 6d 73 3a 20 20 20 20 20 20 20 20 20 20 20  tems:           
6a20: 22 20 69 74 65 6d 73 0a 09 09 09 09 20 20 20 22  " items.....   "
6a30: 5c 6e 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 3a  \n can-run-more:
6a40: 20 20 20 20 22 20 63 61 6e 2d 72 75 6e 2d 6d 6f      " can-run-mo
6a50: 72 65 29 0a 09 09 20 20 20 20 20 20 3b 3b 20 28  re)...      ;; (
6a60: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b  thread-sleep! (+
6a70: 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d 64 65   0.01 *global-de
6a80: 6c 74 61 2a 29 29 0a 09 09 20 20 20 20 20 20 28  lta*))...      (
6a90: 63 6f 6e 64 20 3b 3b 20 49 4e 4e 45 52 20 43 4f  cond ;; INNER CO
6aa0: 4e 44 20 23 32 0a 09 09 20 20 20 20 20 20 20 28  ND #2...       (
6ab0: 28 6f 72 20 28 6e 75 6c 6c 3f 20 70 72 65 72 65  (or (null? prere
6ac0: 71 73 2d 6e 6f 74 2d 6d 65 74 29 20 3b 3b 20 61  qs-not-met) ;; a
6ad0: 6c 6c 20 70 72 65 72 65 71 73 20 6d 65 74 2c 20  ll prereqs met, 
6ae0: 66 69 72 65 20 6f 66 66 20 74 68 65 20 74 65 73  fire off the tes
6af0: 74 0a 09 09 09 20 20 20 20 3b 3b 20 6f 72 2c 20  t....    ;; or, 
6b00: 69 66 20 69 74 20 69 73 20 61 20 27 74 6f 70 6c  if it is a 'topl
6b10: 65 76 65 6c 20 74 65 73 74 20 61 6e 64 20 61 6c  evel test and al
6b20: 6c 20 70 72 65 72 65 71 73 20 6e 6f 74 20 6d 65  l prereqs not me
6b30: 74 20 61 72 65 20 43 4f 4d 50 4c 45 54 45 44 20  t are COMPLETED 
6b40: 74 68 65 6e 20 6c 61 75 6e 63 68 0a 09 09 09 20  then launch.... 
6b50: 20 20 20 28 61 6e 64 20 28 65 71 3f 20 74 65 73     (and (eq? tes
6b60: 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c 29  tmode 'toplevel)
6b70: 0a 09 09 09 09 20 28 6e 75 6c 6c 3f 20 6e 6f 6e  ..... (null? non
6b80: 2d 63 6f 6d 70 6c 65 74 65 64 29 29 29 0a 09 09  -completed)))...
6b90: 09 28 6c 65 74 20 28 28 74 65 73 74 2d 6e 61 6d  .(let ((test-nam
6ba0: 65 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65  e (tests:testque
6bb0: 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20  ue-get-testname 
6bc0: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 29 0a 09  test-record)))..
6bd0: 09 09 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f  ..  (setenv "MT_
6be0: 54 45 53 54 5f 4e 41 4d 45 22 20 74 65 73 74 2d  TEST_NAME" test-
6bf0: 6e 61 6d 65 29 20 3b 3b 20 0a 09 09 09 20 20 28  name) ;; ....  (
6c00: 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e 4e 41  setenv "MT_RUNNA
6c10: 4d 45 22 20 20 20 72 75 6e 6e 61 6d 65 29 0a 09  ME"   runname)..
6c20: 09 09 20 20 28 73 65 74 2d 6d 65 67 61 74 65 73  ..  (set-megates
6c30: 74 2d 65 6e 76 2d 76 61 72 73 20 72 75 6e 2d 69  t-env-vars run-i
6c40: 64 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20  d) ;; these may 
6c50: 62 65 20 6e 65 65 64 65 64 20 62 79 20 74 68 65  be needed by the
6c60: 20 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65   launching proce
6c70: 73 73 0a 09 09 09 20 20 28 6c 65 74 20 28 28 69  ss....  (let ((i
6c80: 74 65 6d 73 2d 6c 69 73 74 20 28 69 74 65 6d 73  tems-list (items
6c90: 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d  :get-items-from-
6ca0: 63 6f 6e 66 69 67 20 74 63 6f 6e 66 69 67 29 29  config tconfig))
6cb0: 29 0a 09 09 09 20 20 20 20 28 69 66 20 28 6c 69  )....    (if (li
6cc0: 73 74 3f 20 69 74 65 6d 73 2d 6c 69 73 74 29 0a  st? items-list).
6cd0: 09 09 09 09 28 62 65 67 69 6e 0a 09 09 09 09 20  ....(begin..... 
6ce0: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75   (tests:testqueu
6cf0: 65 2d 73 65 74 2d 69 74 65 6d 73 21 20 74 65 73  e-set-items! tes
6d00: 74 2d 72 65 63 6f 72 64 20 69 74 65 6d 73 2d 6c  t-record items-l
6d10: 69 73 74 29 0a 09 09 09 09 20 20 3b 3b 20 28 74  ist).....  ;; (t
6d20: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c  hread-sleep! *gl
6d30: 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 09  obal-delta*)....
6d40: 09 20 20 28 6c 6f 6f 70 20 68 65 64 20 74 61 6c  .  (loop hed tal
6d50: 20 72 65 67 20 72 65 72 75 6e 73 29 29 0a 09 09   reg reruns))...
6d60: 09 09 28 62 65 67 69 6e 0a 09 09 09 09 20 20 28  ..(begin.....  (
6d70: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45  debug:print 0 "E
6d80: 52 52 4f 52 3a 20 54 68 65 20 70 72 6f 63 20 66  RROR: The proc f
6d90: 72 6f 6d 20 72 65 61 64 69 6e 67 20 74 68 65 20  rom reading the 
6da0: 73 65 74 75 70 20 64 69 64 20 6e 6f 74 20 79 69  setup did not yi
6db0: 65 6c 64 20 61 20 6c 69 73 74 20 2d 20 70 6c 65  eld a list - ple
6dc0: 61 73 65 20 72 65 70 6f 72 74 20 74 68 69 73 22  ase report this"
6dd0: 29 0a 09 09 09 09 20 20 28 65 78 69 74 20 31 29  ).....  (exit 1)
6de0: 29 29 29 29 29 0a 09 09 20 20 20 20 20 20 20 28  )))))...       (
6df0: 28 6e 75 6c 6c 3f 20 66 61 69 6c 73 29 0a 09 09  (null? fails)...
6e00: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e  .(debug:print-in
6e10: 66 6f 20 34 20 22 66 61 69 6c 73 20 69 73 20 6e  fo 4 "fails is n
6e20: 75 6c 6c 2c 20 6d 6f 76 69 6e 67 20 6f 6e 20 69  ull, moving on i
6e30: 6e 20 74 68 65 20 71 75 65 75 65 20 62 75 74 20  n the queue but 
6e40: 6b 65 65 70 69 6e 67 20 22 20 68 65 64 20 22 20  keeping " hed " 
6e50: 66 6f 72 20 6e 6f 77 22 29 0a 09 09 09 3b 3b 20  for now")....;; 
6e60: 6f 6e 6c 79 20 69 6e 63 72 65 6d 65 6e 74 20 6e  only increment n
6e70: 75 6d 2d 72 65 74 72 69 65 73 20 77 68 65 6e 20  um-retries when 
6e80: 74 68 65 72 65 20 61 72 65 20 6e 6f 20 74 65 73  there are no tes
6e90: 74 73 20 72 75 6e 69 6e 67 0a 09 09 09 28 69 66  ts runing....(if
6ea0: 20 28 65 71 3f 20 30 20 28 6c 69 73 74 2d 72 65   (eq? 0 (list-re
6eb0: 66 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 20 31  f can-run-more 1
6ec0: 29 29 0a 09 09 09 20 20 20 20 28 62 65 67 69 6e  ))....    (begin
6ed0: 0a 09 09 09 20 20 20 20 20 20 3b 3b 20 54 52 59  ....      ;; TRY
6ee0: 20 28 69 66 20 28 3e 20 6e 75 6d 2d 72 65 74 72   (if (> num-retr
6ef0: 69 65 73 20 31 30 30 29 20 3b 3b 20 66 69 72 73  ies 100) ;; firs
6f00: 74 20 31 30 30 20 72 65 74 72 69 65 73 20 61 72  t 100 retries ar
6f10: 65 20 6c 6f 77 20 74 69 6d 65 20 63 6f 73 74 0a  e low time cost.
6f20: 09 09 09 20 20 20 20 20 20 3b 3b 20 54 52 59 20  ...      ;; TRY 
6f30: 20 20 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65      (thread-slee
6f40: 70 21 20 28 2b 20 32 20 2a 67 6c 6f 62 61 6c 2d  p! (+ 2 *global-
6f50: 64 65 6c 74 61 2a 29 29 0a 09 09 09 20 20 20 20  delta*))....    
6f60: 20 20 3b 3b 20 54 52 59 20 20 20 20 20 28 74 68    ;; TRY     (th
6f70: 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 30  read-sleep! (+ 0
6f80: 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74  .01 *global-delt
6f90: 61 2a 29 29 29 0a 09 09 09 20 20 20 20 20 20 28  a*)))....      (
6fa0: 73 65 74 21 20 6e 75 6d 2d 72 65 74 72 69 65 73  set! num-retries
6fb0: 20 28 2b 20 6e 75 6d 2d 72 65 74 72 69 65 73 20   (+ num-retries 
6fc0: 31 29 29 29 29 0a 09 09 09 28 69 66 20 28 3e 20  1))))....(if (> 
6fd0: 6e 75 6d 2d 72 65 74 72 69 65 73 20 20 6d 61 78  num-retries  max
6fe0: 2d 72 65 74 72 69 65 73 29 0a 09 09 09 20 20 20  -retries)....   
6ff0: 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f   (if (not (null?
7000: 20 74 61 6c 29 29 0a 09 09 09 09 28 6c 6f 6f 70   tal)).....(loop
7010: 20 28 72 75 6e 73 3a 71 75 65 75 65 2d 6e 65 78   (runs:queue-nex
7020: 74 2d 68 65 64 20 74 61 6c 20 72 65 67 20 72 65  t-hed tal reg re
7030: 67 6c 65 6e 20 72 65 67 66 75 6c 6c 29 0a 09 09  glen regfull)...
7040: 09 09 20 20 20 20 20 20 28 72 75 6e 73 3a 71 75  ..      (runs:qu
7050: 65 75 65 2d 6e 65 78 74 2d 74 61 6c 20 74 61 6c  eue-next-tal tal
7060: 20 72 65 67 20 72 65 67 6c 65 6e 20 72 65 67 66   reg reglen regf
7070: 75 6c 6c 29 0a 09 09 09 09 20 20 20 20 20 20 28  ull).....      (
7080: 72 75 6e 73 3a 71 75 65 75 65 2d 6e 65 78 74 2d  runs:queue-next-
7090: 72 65 67 20 74 61 6c 20 72 65 67 20 72 65 67 6c  reg tal reg regl
70a0: 65 6e 20 72 65 67 66 75 6c 6c 29 0a 09 09 09 09  en regfull).....
70b0: 20 20 20 20 20 20 72 65 72 75 6e 73 29 29 0a 09        reruns))..
70c0: 09 09 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72  ..    (loop (car
70d0: 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77   newtal)(cdr new
70e0: 74 61 6c 29 20 72 65 67 20 72 65 72 75 6e 73 29  tal) reg reruns)
70f0: 29 29 20 3b 3b 20 61 6e 20 69 73 73 75 65 20 77  )) ;; an issue w
7100: 69 74 68 20 70 72 65 72 65 71 73 20 6e 6f 74 20  ith prereqs not 
7110: 79 65 74 20 6d 65 74 3f 0a 09 09 20 20 20 20 20  yet met?...     
7120: 20 20 28 28 61 6e 64 20 28 6e 6f 74 20 28 6e 75    ((and (not (nu
7130: 6c 6c 3f 20 66 61 69 6c 73 29 29 28 65 71 3f 20  ll? fails))(eq? 
7140: 74 65 73 74 6d 6f 64 65 20 27 6e 6f 72 6d 61 6c  testmode 'normal
7150: 29 29 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69  ))....(debug:pri
7160: 6e 74 2d 69 6e 66 6f 20 31 20 22 74 65 73 74 20  nt-info 1 "test 
7170: 22 20 20 68 65 64 20 22 20 28 6d 6f 64 65 3d 22  "  hed " (mode="
7180: 20 74 65 73 74 6d 6f 64 65 20 22 29 20 68 61 73   testmode ") has
7190: 20 66 61 69 6c 65 64 20 70 72 65 72 65 71 75 69   failed prerequi
71a0: 73 69 74 65 28 73 29 3b 20 22 0a 09 09 09 09 20  site(s); "..... 
71b0: 20 20 20 20 28 73 74 72 69 6e 67 2d 69 6e 74 65      (string-inte
71c0: 72 73 70 65 72 73 65 20 28 6d 61 70 20 28 6c 61  rsperse (map (la
71d0: 6d 62 64 61 20 28 74 29 28 63 6f 6e 63 20 28 64  mbda (t)(conc (d
71e0: 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e  b:test-get-testn
71f0: 61 6d 65 20 74 29 20 22 3a 22 20 28 64 62 3a 74  ame t) ":" (db:t
7200: 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74 29  est-get-state t)
7210: 22 2f 22 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  "/"(db:test-get-
7220: 73 74 61 74 75 73 20 74 29 29 29 20 66 61 69 6c  status t))) fail
7230: 73 29 20 22 2c 20 22 29 0a 09 09 09 09 20 20 20  s) ", ").....   
7240: 20 20 22 2c 20 72 65 6d 6f 76 69 6e 67 20 69 74    ", removing it
7250: 20 66 72 6f 6d 20 74 6f 2d 64 6f 20 6c 69 73 74   from to-do list
7260: 22 29 0a 09 09 09 28 69 66 20 28 6e 6f 74 20 28  ")....(if (not (
7270: 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 09 20  null? tal)).... 
7280: 20 20 20 28 62 65 67 69 6e 0a 20 20 20 20 20 20     (begin.      
7290: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
72a0: 20 20 20 20 20 20 20 20 3b 3b 20 28 74 68 72 65          ;; (thre
72b0: 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61  ad-sleep! *globa
72c0: 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 09 20 20 20  l-delta*)....   
72d0: 20 20 20 28 6c 6f 6f 70 20 28 72 75 6e 73 3a 71     (loop (runs:q
72e0: 75 65 75 65 2d 6e 65 78 74 2d 68 65 64 20 74 61  ueue-next-hed ta
72f0: 6c 20 72 65 67 20 72 65 67 6c 65 6e 20 72 65 67  l reg reglen reg
7300: 66 75 6c 6c 29 0a 09 09 09 09 20 20 20 20 28 72  full).....    (r
7310: 75 6e 73 3a 71 75 65 75 65 2d 6e 65 78 74 2d 74  uns:queue-next-t
7320: 61 6c 20 74 61 6c 20 72 65 67 20 72 65 67 6c 65  al tal reg regle
7330: 6e 20 72 65 67 66 75 6c 6c 29 0a 09 09 09 09 20  n regfull)..... 
7340: 20 20 20 28 72 75 6e 73 3a 71 75 65 75 65 2d 6e     (runs:queue-n
7350: 65 78 74 2d 72 65 67 20 74 61 6c 20 72 65 67 20  ext-reg tal reg 
7360: 72 65 67 6c 65 6e 20 72 65 67 66 75 6c 6c 29 0a  reglen regfull).
7370: 09 09 09 09 20 20 20 20 28 63 6f 6e 73 20 68 65  ....    (cons he
7380: 64 20 72 65 72 75 6e 73 29 29 29 29 29 0a 09 09  d reruns)))))...
7390: 20 20 20 20 20 20 20 28 65 6c 73 65 0a 09 09 09         (else....
73a0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 38 20 22  (debug:print 8 "
73b0: 45 52 52 4f 52 3a 20 4e 6f 20 68 61 6e 64 6c 65  ERROR: No handle
73c0: 72 20 66 6f 72 20 74 68 69 73 20 63 6f 6e 64 69  r for this condi
73d0: 74 69 6f 6e 2e 22 29 0a 09 09 09 3b 3b 20 54 52  tion.")....;; TR
73e0: 59 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21  Y (thread-sleep!
73f0: 20 28 2b 20 31 20 2a 67 6c 6f 62 61 6c 2d 64 65   (+ 1 *global-de
7400: 6c 74 61 2a 29 29 0a 09 09 09 28 6c 6f 6f 70 20  lta*))....(loop 
7410: 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72  (car newtal)(cdr
7420: 20 6e 65 77 74 61 6c 29 20 72 65 67 20 72 65 72   newtal) reg rer
7430: 75 6e 73 29 29 29 29 20 3b 3b 20 45 4e 44 20 4f  uns)))) ;; END O
7440: 46 20 49 46 20 43 41 4e 20 52 55 4e 20 4d 4f 52  F IF CAN RUN MOR
7450: 45 0a 0a 09 09 20 20 20 20 3b 3b 20 69 66 20 63  E....    ;; if c
7460: 61 6e 27 74 20 72 75 6e 20 6d 6f 72 65 20 6a 75  an't run more ju
7470: 73 74 20 6c 6f 6f 70 20 77 69 74 68 20 6e 65 78  st loop with nex
7480: 74 20 70 6f 73 73 69 62 6c 65 20 74 65 73 74 0a  t possible test.
7490: 09 09 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20  ..    (begin... 
74a0: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
74b0: 74 2d 69 6e 66 6f 20 34 20 22 70 72 6f 63 65 73  t-info 4 "proces
74c0: 73 69 6e 67 20 74 68 65 20 63 61 73 65 20 77 69  sing the case wi
74d0: 74 68 20 61 20 6c 61 6d 62 64 61 20 66 6f 72 20  th a lambda for 
74e0: 69 74 65 6d 73 20 6f 72 20 27 68 61 76 65 2d 70  items or 'have-p
74f0: 72 6f 63 65 64 75 72 65 2e 20 4d 6f 76 69 6e 67  rocedure. Moving
7500: 20 74 68 72 6f 75 67 68 20 74 68 65 20 71 75 65   through the que
7510: 75 65 20 77 69 74 68 6f 75 74 20 64 72 6f 70 70  ue without dropp
7520: 69 6e 67 20 22 20 68 65 64 29 0a 09 09 20 20 20  ing " hed)...   
7530: 20 20 20 3b 3b 20 28 74 68 72 65 61 64 2d 73 6c     ;; (thread-sl
7540: 65 65 70 21 20 28 2b 20 32 20 2a 67 6c 6f 62 61  eep! (+ 2 *globa
7550: 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09 20 20 20  l-delta*))...   
7560: 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65     (loop (car ne
7570: 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c  wtal)(cdr newtal
7580: 29 20 72 65 67 20 72 65 72 75 6e 73 29 29 29 29  ) reg reruns))))
7590: 29 20 3b 3b 20 45 4e 44 20 4f 46 20 28 6f 72 20  ) ;; END OF (or 
75a0: 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d  (procedure? item
75b0: 73 29 28 65 71 3f 20 69 74 65 6d 73 20 27 68 61  s)(eq? items 'ha
75c0: 76 65 2d 70 72 6f 63 65 64 75 72 65 29 29 0a 09  ve-procedure))..
75d0: 20 20 20 20 20 0a 09 20 20 20 20 20 3b 3b 20 74       ..     ;; t
75e0: 68 69 73 20 63 61 73 65 20 73 68 6f 75 6c 64 20  his case should 
75f0: 6e 6f 74 20 68 61 70 70 65 6e 2c 20 61 64 64 65  not happen, adde
7600: 64 20 74 6f 20 68 65 6c 70 20 63 61 74 63 68 20  d to help catch 
7610: 61 6e 79 20 62 75 67 73 0a 09 20 20 20 20 20 28  any bugs..     (
7620: 28 61 6e 64 20 28 6c 69 73 74 3f 20 69 74 65 6d  (and (list? item
7630: 73 29 20 69 74 65 6d 64 61 74 29 0a 09 20 20 20  s) itemdat)..   
7640: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
7650: 30 20 22 45 52 52 4f 52 3a 20 53 68 6f 75 6c 64  0 "ERROR: Should
7660: 20 6e 6f 74 20 68 61 76 65 20 61 20 6c 69 73 74   not have a list
7670: 20 6f 66 20 69 74 65 6d 73 20 69 6e 20 61 20 74   of items in a t
7680: 65 73 74 20 61 6e 64 20 74 68 65 20 69 74 65 6d  est and the item
7690: 73 70 61 74 68 20 73 65 74 20 2d 20 70 6c 65 61  spath set - plea
76a0: 73 65 20 72 65 70 6f 72 74 20 74 68 69 73 22 29  se report this")
76b0: 0a 09 20 20 20 20 20 20 28 65 78 69 74 20 31 29  ..      (exit 1)
76c0: 29 0a 09 20 20 20 20 20 28 28 6e 6f 74 20 28 6e  )..     ((not (n
76d0: 75 6c 6c 3f 20 72 65 72 75 6e 73 29 29 0a 09 20  ull? reruns)).. 
76e0: 20 20 20 20 20 28 6c 65 74 2a 20 28 28 6e 65 77       (let* ((new
76f0: 6c 73 74 20 28 74 65 73 74 73 3a 66 69 6c 74 65  lst (tests:filte
7700: 72 2d 6e 6f 6e 2d 72 75 6e 6e 61 62 6c 65 20 72  r-non-runnable r
7710: 75 6e 2d 69 64 20 74 61 6c 20 74 65 73 74 2d 72  un-id tal test-r
7720: 65 63 6f 72 64 73 29 29 20 3b 3b 20 69 2e 65 2e  ecords)) ;; i.e.
7730: 20 6e 6f 74 20 46 41 49 4c 2c 20 57 41 49 56 45   not FAIL, WAIVE
7740: 44 2c 20 49 4e 43 4f 4d 50 4c 45 54 45 2c 20 50  D, INCOMPLETE, P
7750: 41 53 53 2c 20 4b 49 4c 4c 45 44 2c 0a 09 09 20  ASS, KILLED,... 
7760: 20 20 20 20 28 6a 75 6e 6b 65 64 20 28 6c 73 65      (junked (lse
7770: 74 2d 64 69 66 66 65 72 65 6e 63 65 20 65 71 75  t-difference equ
7780: 61 6c 3f 20 74 61 6c 20 6e 65 77 6c 73 74 29 29  al? tal newlst))
7790: 29 0a 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74  )...(debug:print
77a0: 2d 69 6e 66 6f 20 34 20 22 66 75 6c 6c 20 64 72  -info 4 "full dr
77b0: 6f 70 20 74 68 72 6f 75 67 68 2c 20 69 66 20 72  op through, if r
77c0: 65 72 75 6e 73 20 69 73 20 6c 65 73 73 20 74 68  eruns is less th
77d0: 61 6e 20 31 30 30 20 77 65 20 77 69 6c 6c 20 66  an 100 we will f
77e0: 6f 72 63 65 20 72 65 74 72 79 20 74 68 65 6d 2c  orce retry them,
77f0: 20 72 65 72 75 6e 73 3d 22 20 72 65 72 75 6e 73   reruns=" reruns
7800: 20 22 2c 20 74 61 6c 3d 22 20 74 61 6c 29 0a 09   ", tal=" tal)..
7810: 09 28 69 66 20 28 3c 20 6e 75 6d 2d 72 65 74 72  .(if (< num-retr
7820: 69 65 73 20 6d 61 78 2d 72 65 74 72 69 65 73 29  ies max-retries)
7830: 0a 09 09 20 20 20 20 28 73 65 74 21 20 6e 65 77  ...    (set! new
7840: 6c 73 74 20 28 61 70 70 65 6e 64 20 72 65 72 75  lst (append reru
7850: 6e 73 20 6e 65 77 6c 73 74 29 29 29 0a 09 09 28  ns newlst)))...(
7860: 73 65 74 21 20 6e 75 6d 2d 72 65 74 72 69 65 73  set! num-retries
7870: 20 28 2b 20 6e 75 6d 2d 72 65 74 72 69 65 73 20   (+ num-retries 
7880: 31 29 29 0a 09 09 3b 3b 20 28 74 68 72 65 61 64  1))...;; (thread
7890: 2d 73 6c 65 65 70 21 20 28 2b 20 31 20 2a 67 6c  -sleep! (+ 1 *gl
78a0: 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09  obal-delta*))...
78b0: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20  (if (not (null? 
78c0: 6e 65 77 6c 73 74 29 29 0a 09 09 20 20 20 20 3b  newlst))...    ;
78d0: 3b 20 73 69 6e 63 65 20 72 65 72 75 6e 73 20 68  ; since reruns h
78e0: 61 76 65 20 62 65 65 6e 20 74 61 63 6b 65 64 20  ave been tacked 
78f0: 6f 6e 20 74 6f 20 6e 65 77 6c 73 74 20 63 72 65  on to newlst cre
7900: 61 74 65 20 6e 65 77 20 72 65 72 75 6e 73 20 66  ate new reruns f
7910: 72 6f 6d 20 6a 75 6e 6b 65 64 0a 09 09 20 20 20  rom junked...   
7920: 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 6c   (loop (car newl
7930: 73 74 29 28 63 64 72 20 6e 65 77 6c 73 74 29 20  st)(cdr newlst) 
7940: 72 65 67 20 28 64 65 6c 65 74 65 2d 64 75 70 6c  reg (delete-dupl
7950: 69 63 61 74 65 73 20 6a 75 6e 6b 65 64 29 29 29  icates junked)))
7960: 29 29 0a 09 20 20 20 20 20 28 28 6e 6f 74 20 28  ))..     ((not (
7970: 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 20 20 20  null? tal))..   
7980: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d     (debug:print-
7990: 69 6e 66 6f 20 34 20 22 49 27 6d 20 70 72 65 74  info 4 "I'm pret
79a0: 74 79 20 73 75 72 65 20 49 20 73 68 6f 75 6c 64  ty sure I should
79b0: 6e 27 74 20 67 65 74 20 68 65 72 65 2e 22 29 29  n't get here."))
79c0: 0a 09 20 20 20 20 20 28 65 6c 73 65 0a 09 20 20  ..     (else..  
79d0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
79e0: 2d 69 6e 66 6f 20 34 20 22 45 78 69 74 69 6e 67  -info 4 "Exiting
79f0: 20 6c 6f 6f 70 20 77 69 74 68 2e 2e 2e 5c 6e 20   loop with...\n 
7a00: 20 68 65 64 3d 22 20 68 65 64 20 22 5c 6e 20 20   hed=" hed "\n  
7a10: 74 61 6c 3d 22 20 74 61 6c 20 22 5c 6e 20 20 72  tal=" tal "\n  r
7a20: 65 72 75 6e 73 3d 22 20 72 65 72 75 6e 73 29 29  eruns=" reruns))
7a30: 0a 09 20 20 20 20 20 29 29 29 29 20 3b 3b 20 4c  ..     )))) ;; L
7a40: 45 54 2a 20 28 28 74 65 73 74 2d 72 65 63 6f 72  ET* ((test-recor
7a50: 64 0a 0a 20 20 20 20 3b 3b 20 77 65 20 67 65 74  d..    ;; we get
7a60: 20 68 65 72 65 20 6f 6e 20 22 64 72 6f 70 20 74   here on "drop t
7a70: 68 72 6f 75 67 68 22 20 2d 20 6c 6f 6f 70 20 66  hrough" - loop f
7a80: 6f 72 20 6e 65 78 74 20 74 65 73 74 20 69 6e 20  or next test in 
7a90: 71 75 65 75 65 0a 20 20 20 20 3b 3b 20 46 49 58  queue.    ;; FIX
7aa0: 4d 45 21 21 21 21 20 54 48 49 53 20 53 48 4f 55  ME!!!! THIS SHOU
7ab0: 4c 44 20 4e 4f 54 20 52 45 51 55 49 52 45 20 41  LD NOT REQUIRE A
7ac0: 4e 20 45 58 49 54 21 21 21 21 21 21 21 0a 20 20  N EXIT!!!!!!!.  
7ad0: 20 20 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72    .    (debug:pr
7ae0: 69 6e 74 2d 69 6e 66 6f 20 31 20 22 41 6c 6c 20  int-info 1 "All 
7af0: 74 65 73 74 73 20 6c 61 75 6e 63 68 65 64 22 29  tests launched")
7b00: 0a 20 20 20 20 28 74 68 72 65 61 64 2d 73 6c 65  .    (thread-sle
7b10: 65 70 21 20 30 2e 35 29 0a 20 20 20 20 3b 3b 20  ep! 0.5).    ;; 
7b20: 46 49 58 4d 45 21 20 54 68 69 73 20 68 61 72 73  FIXME! This hars
7b30: 68 20 65 78 69 74 20 73 68 6f 75 6c 64 20 6e 6f  h exit should no
7b40: 74 20 62 65 20 6e 65 63 65 73 73 61 72 79 2e 2e  t be necessary..
7b50: 2e 2e 0a 20 20 20 20 3b 3b 20 28 69 66 20 28 6e  ...    ;; (if (n
7b60: 6f 74 20 2a 72 75 6e 72 65 6d 6f 74 65 2a 29 28  ot *runremote*)(
7b70: 65 78 69 74 29 29 20 3b 3b 20 0a 20 20 20 20 23  exit)) ;; .    #
7b80: 66 29 29 20 3b 3b 20 72 65 74 75 72 6e 20 61 20  f)) ;; return a 
7b90: 23 66 20 61 73 20 61 20 68 69 6e 74 20 74 68 61  #f as a hint tha
7ba0: 74 20 77 65 20 61 72 65 20 64 6f 6e 65 0a 20 20  t we are done.  
7bb0: 3b 3b 20 48 65 72 65 20 77 65 20 6e 65 65 64 20  ;; Here we need 
7bc0: 74 6f 20 63 68 65 63 6b 20 74 68 61 74 20 61 6c  to check that al
7bd0: 6c 20 74 68 65 20 74 65 73 74 73 20 72 65 6d 61  l the tests rema
7be0: 69 6e 69 6e 67 20 74 6f 20 62 65 20 72 75 6e 20  ining to be run 
7bf0: 61 72 65 20 65 6c 69 67 69 62 6c 65 20 74 6f 20  are eligible to 
7c00: 72 75 6e 0a 20 20 3b 3b 20 61 6e 64 20 61 72 65  run.  ;; and are
7c10: 20 6e 6f 74 20 62 6c 6f 63 6b 65 64 20 62 79 20   not blocked by 
7c20: 66 61 69 6c 65 64 0a 20 20 0a 0a 3b 3b 20 70 61  failed.  ..;; pa
7c30: 72 65 6e 74 2d 74 65 73 74 20 69 73 20 74 68 65  rent-test is the
7c40: 72 65 20 61 73 20 61 20 70 6c 61 63 65 68 6f 6c  re as a placehol
7c50: 64 65 72 20 66 6f 72 20 77 68 65 6e 20 70 61 72  der for when par
7c60: 65 6e 74 2d 74 65 73 74 73 20 63 61 6e 20 62 65  ent-tests can be
7c70: 20 72 75 6e 20 61 73 20 61 20 73 65 74 75 70 20   run as a setup 
7c80: 73 74 65 70 0a 28 64 65 66 69 6e 65 20 28 72 75  step.(define (ru
7c90: 6e 3a 74 65 73 74 20 72 75 6e 2d 69 64 20 72 75  n:test run-id ru
7ca0: 6e 6e 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20  nname keyvallst 
7cb0: 74 65 73 74 2d 72 65 63 6f 72 64 20 66 6c 61 67  test-record flag
7cc0: 73 20 70 61 72 65 6e 74 2d 74 65 73 74 29 0a 20  s parent-test). 
7cd0: 20 3b 3b 20 41 6c 6c 20 74 68 65 73 65 20 76 61   ;; All these va
7ce0: 72 73 20 6d 69 67 68 74 20 62 65 20 72 65 66 65  rs might be refe
7cf0: 72 65 6e 63 65 64 20 62 79 20 74 68 65 20 74 65  renced by the te
7d00: 73 74 63 6f 6e 66 69 67 20 66 69 6c 65 20 72 65  stconfig file re
7d10: 61 64 65 72 0a 20 20 28 6c 65 74 2a 20 28 28 74  ader.  (let* ((t
7d20: 65 73 74 2d 6e 61 6d 65 20 20 20 20 28 74 65 73  est-name    (tes
7d30: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
7d40: 2d 74 65 73 74 6e 61 6d 65 20 20 20 74 65 73 74  -testname   test
7d50: 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65 73  -record)).. (tes
7d60: 74 2d 77 61 69 74 6f 6e 73 20 28 74 65 73 74 73  t-waitons (tests
7d70: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 77  :testqueue-get-w
7d80: 61 69 74 6f 6e 73 20 20 20 20 74 65 73 74 2d 72  aitons    test-r
7d90: 65 63 6f 72 64 29 29 0a 09 20 28 74 65 73 74 2d  ecord)).. (test-
7da0: 63 6f 6e 66 20 20 20 20 28 74 65 73 74 73 3a 74  conf    (tests:t
7db0: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73  estqueue-get-tes
7dc0: 74 63 6f 6e 66 69 67 20 74 65 73 74 2d 72 65 63  tconfig test-rec
7dd0: 6f 72 64 29 29 0a 09 20 28 69 74 65 6d 64 61 74  ord)).. (itemdat
7de0: 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73        (tests:tes
7df0: 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d 64  tqueue-get-itemd
7e00: 61 74 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72  at    test-recor
7e10: 64 29 29 0a 09 20 28 74 65 73 74 2d 70 61 74 68  d)).. (test-path
7e20: 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61      (conc *toppa
7e30: 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 20 74 65  th* "/tests/" te
7e40: 73 74 2d 6e 61 6d 65 29 29 20 3b 3b 20 63 6f 75  st-name)) ;; cou
7e50: 6c 64 20 75 73 65 20 74 65 73 74 73 3a 67 65 74  ld use tests:get
7e60: 2d 74 65 73 74 63 6f 6e 66 69 67 20 68 65 72 65  -testconfig here
7e70: 20 2e 2e 2e 0a 09 20 28 66 6f 72 63 65 20 20 20   ..... (force   
7e80: 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65       (hash-table
7e90: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61  -ref/default fla
7ea0: 67 73 20 22 2d 66 6f 72 63 65 22 20 23 66 29 29  gs "-force" #f))
7eb0: 0a 09 20 28 72 65 72 75 6e 20 20 20 20 20 20 20  .. (rerun       
7ec0: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66   (hash-table-ref
7ed0: 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22  /default flags "
7ee0: 2d 72 65 72 75 6e 22 20 23 66 29 29 0a 09 20 28  -rerun" #f)).. (
7ef0: 6b 65 65 70 67 6f 69 6e 67 20 20 20 20 28 68 61  keepgoing    (ha
7f00: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66  sh-table-ref/def
7f10: 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 65  ault flags "-kee
7f20: 70 67 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 28  pgoing" #f)).. (
7f30: 69 74 65 6d 2d 70 61 74 68 20 20 20 20 20 22 22  item-path     ""
7f40: 29 0a 09 20 28 64 62 20 20 20 20 20 20 20 20 20  ).. (db         
7f50: 20 20 23 66 29 29 0a 20 20 20 20 28 64 65 62 75    #f)).    (debu
7f60: 67 3a 70 72 69 6e 74 20 34 0a 09 09 20 22 74 65  g:print 4... "te
7f70: 73 74 2d 63 6f 6e 66 69 67 3a 20 22 20 28 68 61  st-config: " (ha
7f80: 73 68 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20  sh-table->alist 
7f90: 74 65 73 74 2d 63 6f 6e 66 29 0a 09 09 20 22 5c  test-conf)... "\
7fa0: 6e 20 20 20 69 74 65 6d 64 61 74 3a 20 22 20 69  n   itemdat: " i
7fb0: 74 65 6d 64 61 74 0a 09 09 20 29 0a 20 20 20 20  temdat... ).    
7fc0: 3b 3b 20 73 65 74 74 69 6e 67 20 69 74 65 6d 64  ;; setting itemd
7fd0: 61 74 20 74 6f 20 61 20 6c 69 73 74 20 69 66 20  at to a list if 
7fe0: 69 74 20 69 73 20 23 66 0a 20 20 20 20 28 69 66  it is #f.    (if
7ff0: 20 28 6e 6f 74 20 69 74 65 6d 64 61 74 29 28 73   (not itemdat)(s
8000: 65 74 21 20 69 74 65 6d 64 61 74 20 27 28 29 29  et! itemdat '())
8010: 29 0a 20 20 20 20 28 73 65 74 21 20 69 74 65 6d  ).    (set! item
8020: 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74  -path (item-list
8030: 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74 29 29  ->path itemdat))
8040: 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  .    (debug:prin
8050: 74 20 32 20 22 41 74 74 65 6d 70 74 69 6e 67 20  t 2 "Attempting 
8060: 74 6f 20 6c 61 75 6e 63 68 20 74 65 73 74 20 22  to launch test "
8070: 20 74 65 73 74 2d 6e 61 6d 65 20 28 69 66 20 28   test-name (if (
8080: 65 71 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68  equal? item-path
8090: 20 22 2f 22 29 20 22 2f 22 20 69 74 65 6d 2d 70   "/") "/" item-p
80a0: 61 74 68 29 29 0a 20 20 20 20 28 73 65 74 65 6e  ath)).    (seten
80b0: 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d 45 22  v "MT_TEST_NAME"
80c0: 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b 20 0a   test-name) ;; .
80d0: 20 20 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f      (setenv "MT_
80e0: 52 55 4e 4e 41 4d 45 22 20 20 20 72 75 6e 6e 61  RUNNAME"   runna
80f0: 6d 65 29 0a 20 20 20 20 28 73 65 74 2d 6d 65 67  me).    (set-meg
8100: 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 72  atest-env-vars r
8110: 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73 65 20  un-id) ;; these 
8120: 6d 61 79 20 62 65 20 6e 65 65 64 65 64 20 62 79  may be needed by
8130: 20 74 68 65 20 6c 61 75 6e 63 68 69 6e 67 20 70   the launching p
8140: 72 6f 63 65 73 73 0a 20 20 20 20 28 63 68 61 6e  rocess.    (chan
8150: 67 65 2d 64 69 72 65 63 74 6f 72 79 20 2a 74 6f  ge-directory *to
8160: 70 70 61 74 68 2a 29 0a 0a 20 20 20 20 3b 3b 20  ppath*)..    ;; 
8170: 48 65 72 65 20 69 73 20 77 68 65 72 65 20 74 68  Here is where th
8180: 65 20 74 65 73 74 5f 6d 65 74 61 20 74 61 62 6c  e test_meta tabl
8190: 65 20 69 73 20 62 65 73 74 20 75 70 64 61 74 65  e is best update
81a0: 64 0a 20 20 20 20 3b 3b 20 59 65 73 2c 20 61 6e  d.    ;; Yes, an
81b0: 6f 74 68 65 72 20 75 73 65 20 6f 66 20 61 20 67  other use of a g
81c0: 6c 6f 62 61 6c 20 66 6f 72 20 63 61 63 68 69 6e  lobal for cachin
81d0: 67 2e 20 4e 65 65 64 20 61 20 62 65 74 74 65 72  g. Need a better
81e0: 20 77 61 79 3f 0a 20 20 20 20 28 69 66 20 28 6e   way?.    (if (n
81f0: 6f 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72  ot (hash-table-r
8200: 65 66 2f 64 65 66 61 75 6c 74 20 2a 74 65 73 74  ef/default *test
8210: 2d 6d 65 74 61 2d 75 70 64 61 74 65 64 2a 20 74  -meta-updated* t
8220: 65 73 74 2d 6e 61 6d 65 20 23 66 29 29 0a 20 20  est-name #f)).  
8230: 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20        (begin..  
8240: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74   (hash-table-set
8250: 21 20 2a 74 65 73 74 2d 6d 65 74 61 2d 75 70 64  ! *test-meta-upd
8260: 61 74 65 64 2a 20 74 65 73 74 2d 6e 61 6d 65 20  ated* test-name 
8270: 23 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 28  #t).           (
8280: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72  open-run-close r
8290: 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f  uns:update-test_
82a0: 6d 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d  meta db test-nam
82b0: 65 20 74 65 73 74 2d 63 6f 6e 66 29 29 29 0a 20  e test-conf))). 
82c0: 20 20 20 0a 20 20 20 20 3b 3b 20 28 6c 61 6d 62     .    ;; (lamb
82d0: 64 61 20 28 69 74 65 6d 64 61 74 29 20 3b 3b 3b  da (itemdat) ;;;
82e0: 20 28 28 72 69 70 65 6e 65 73 73 20 22 6f 76 65   ((ripeness "ove
82f0: 72 72 69 70 65 22 29 20 28 74 65 6d 70 65 72 61  rripe") (tempera
8300: 74 75 72 65 20 22 63 6f 6f 6c 22 29 20 28 73 65  ture "cool") (se
8310: 61 73 6f 6e 20 22 73 75 6d 6d 65 72 22 29 29 0a  ason "summer")).
8320: 20 20 20 20 28 6c 65 74 2a 20 28 28 6e 65 77 2d      (let* ((new-
8330: 74 65 73 74 2d 70 61 74 68 20 28 73 74 72 69 6e  test-path (strin
8340: 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 63  g-intersperse (c
8350: 6f 6e 73 20 74 65 73 74 2d 70 61 74 68 20 28 6d  ons test-path (m
8360: 61 70 20 63 61 64 72 20 69 74 65 6d 64 61 74 29  ap cadr itemdat)
8370: 29 20 22 2f 22 29 29 0a 09 20 20 20 28 6e 65 77  ) "/"))..   (new
8380: 2d 74 65 73 74 2d 6e 61 6d 65 20 28 69 66 20 28  -test-name (if (
8390: 65 71 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68  equal? item-path
83a0: 20 22 22 29 20 74 65 73 74 2d 6e 61 6d 65 20 28   "") test-name (
83b0: 63 6f 6e 63 20 74 65 73 74 2d 6e 61 6d 65 20 22  conc test-name "
83c0: 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 29 20  /" item-path))) 
83d0: 3b 3b 20 6a 75 73 74 20 6e 65 65 64 20 69 74 20  ;; just need it 
83e0: 74 6f 20 62 65 20 75 6e 69 71 75 65 0a 09 20 20  to be unique..  
83f0: 20 28 74 65 73 74 2d 69 64 20 20 20 20 20 20 20   (test-id       
8400: 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20  (cdb:remote-run 
8410: 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 64 20 23  db:get-test-id #
8420: 66 20 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e  f  run-id test-n
8430: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29 0a  ame item-path)).
8440: 09 20 20 20 28 74 65 73 74 64 61 74 20 20 20 20  .   (testdat    
8450: 20 20 20 28 63 64 62 3a 67 65 74 2d 74 65 73 74     (cdb:get-test
8460: 2d 69 6e 66 6f 2d 62 79 2d 69 64 20 2a 72 75 6e  -info-by-id *run
8470: 72 65 6d 6f 74 65 2a 20 74 65 73 74 2d 69 64 29  remote* test-id)
8480: 29 29 0a 20 20 20 20 20 20 28 69 66 20 28 6e 6f  )).      (if (no
8490: 74 20 74 65 73 74 64 61 74 29 0a 09 20 20 28 62  t testdat)..  (b
84a0: 65 67 69 6e 0a 09 20 20 20 20 3b 3b 20 65 6e 73  egin..    ;; ens
84b0: 75 72 65 20 74 68 61 74 20 74 68 65 20 70 61 74  ure that the pat
84c0: 68 20 65 78 69 73 74 73 20 62 65 66 6f 72 65 20  h exists before 
84d0: 72 65 67 69 73 74 65 72 69 6e 67 20 74 68 65 20  registering the 
84e0: 74 65 73 74 0a 09 20 20 20 20 3b 3b 20 4e 4f 50  test..    ;; NOP
84f0: 45 3a 20 43 61 6e 6e 6f 74 21 20 44 6f 6e 27 74  E: Cannot! Don't
8500: 20 6b 6e 6f 77 20 79 65 74 20 77 68 69 63 68 20   know yet which 
8510: 64 69 73 6b 20 61 72 65 61 20 77 69 6c 6c 20 62  disk area will b
8520: 65 20 61 73 73 69 67 6e 65 64 2e 2e 2e 2e 0a 09  e assigned......
8530: 20 20 20 20 3b 3b 20 28 73 79 73 74 65 6d 20 28      ;; (system (
8540: 63 6f 6e 63 20 22 6d 6b 64 69 72 20 2d 70 20 22  conc "mkdir -p "
8550: 20 6e 65 77 2d 74 65 73 74 2d 70 61 74 68 29 29   new-test-path))
8560: 0a 09 20 20 20 20 3b 3b 0a 09 20 20 20 20 3b 3b  ..    ;;..    ;;
8570: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
8580: 20 74 65 73 74 73 3a 72 65 67 69 73 74 65 72 2d   tests:register-
8590: 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 74  test db run-id t
85a0: 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61  est-name item-pa
85b0: 74 68 29 0a 09 20 20 20 20 3b 3b 0a 09 20 20 20  th)..    ;;..   
85c0: 20 3b 3b 20 4e 42 2f 2f 20 66 6f 72 20 74 68 65   ;; NB// for the
85d0: 20 61 62 6f 76 65 20 6c 69 6e 65 2e 20 49 20 77   above line. I w
85e0: 61 6e 74 20 74 68 65 20 74 65 73 74 20 74 6f 20  ant the test to 
85f0: 62 65 20 72 65 67 69 73 74 65 72 65 64 20 6c 6f  be registered lo
8600: 6e 67 20 62 65 66 6f 72 65 20 74 68 69 73 20 72  ng before this r
8610: 6f 75 74 69 6e 65 20 67 65 74 73 20 63 61 6c 6c  outine gets call
8620: 65 64 21 0a 09 20 20 20 20 3b 3b 0a 09 20 20 20  ed!..    ;;..   
8630: 20 28 73 65 74 21 20 74 65 73 74 2d 69 64 20 28   (set! test-id (
8640: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64  open-run-close d
8650: 62 3a 67 65 74 2d 74 65 73 74 2d 69 64 20 64 62  b:get-test-id db
8660: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d   run-id test-nam
8670: 65 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 20  e item-path)).. 
8680: 20 20 20 28 69 66 20 28 6e 6f 74 20 74 65 73 74     (if (not test
8690: 2d 69 64 29 0a 09 09 28 62 65 67 69 6e 0a 09 09  -id)...(begin...
86a0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32    (debug:print 2
86b0: 20 22 57 41 52 4e 3a 20 54 65 73 74 20 6e 6f 74   "WARN: Test not
86c0: 20 70 72 65 2d 63 72 65 61 74 65 64 3f 20 74 65   pre-created? te
86d0: 73 74 2d 6e 61 6d 65 3d 22 20 74 65 73 74 2d 6e  st-name=" test-n
86e0: 61 6d 65 20 22 2c 20 69 74 65 6d 2d 70 61 74 68  ame ", item-path
86f0: 3d 22 20 69 74 65 6d 2d 70 61 74 68 20 22 2c 20  =" item-path ", 
8700: 72 75 6e 2d 69 64 3d 22 20 72 75 6e 2d 69 64 29  run-id=" run-id)
8710: 0a 09 09 20 20 28 63 64 62 3a 74 65 73 74 73 2d  ...  (cdb:tests-
8720: 72 65 67 69 73 74 65 72 2d 74 65 73 74 20 2a 72  register-test *r
8730: 75 6e 72 65 6d 6f 74 65 2a 20 72 75 6e 2d 69 64  unremote* run-id
8740: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d   test-name item-
8750: 70 61 74 68 29 0a 09 09 20 20 28 73 65 74 21 20  path)...  (set! 
8760: 74 65 73 74 2d 69 64 20 28 6f 70 65 6e 2d 72 75  test-id (open-ru
8770: 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74  n-close db:get-t
8780: 65 73 74 2d 69 64 20 64 62 20 72 75 6e 2d 69 64  est-id db run-id
8790: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d   test-name item-
87a0: 70 61 74 68 29 29 29 29 0a 09 20 20 20 20 28 64  path))))..    (d
87b0: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
87c0: 34 20 22 74 65 73 74 2d 69 64 3d 22 20 74 65 73  4 "test-id=" tes
87d0: 74 2d 69 64 20 22 2c 20 72 75 6e 2d 69 64 3d 22  t-id ", run-id="
87e0: 20 72 75 6e 2d 69 64 20 22 2c 20 74 65 73 74 2d   run-id ", test-
87f0: 6e 61 6d 65 3d 22 20 74 65 73 74 2d 6e 61 6d 65  name=" test-name
8800: 20 22 2c 20 69 74 65 6d 2d 70 61 74 68 3d 5c 22   ", item-path=\"
8810: 22 20 69 74 65 6d 2d 70 61 74 68 20 22 5c 22 22  " item-path "\""
8820: 29 0a 09 20 20 20 20 28 73 65 74 21 20 74 65 73  )..    (set! tes
8830: 74 64 61 74 20 28 63 64 62 3a 67 65 74 2d 74 65  tdat (cdb:get-te
8840: 73 74 2d 69 6e 66 6f 2d 62 79 2d 69 64 20 2a 72  st-info-by-id *r
8850: 75 6e 72 65 6d 6f 74 65 2a 20 74 65 73 74 2d 69  unremote* test-i
8860: 64 29 29 29 29 0a 20 20 20 20 20 20 28 73 65 74  d)))).      (set
8870: 21 20 74 65 73 74 2d 69 64 20 28 64 62 3a 74 65  ! test-id (db:te
8880: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61  st-get-id testda
8890: 74 29 29 0a 20 20 20 20 20 20 28 63 68 61 6e 67  t)).      (chang
88a0: 65 2d 64 69 72 65 63 74 6f 72 79 20 74 65 73 74  e-directory test
88b0: 2d 70 61 74 68 29 0a 20 20 20 20 20 20 28 63 61  -path).      (ca
88c0: 73 65 20 28 69 66 20 66 6f 72 63 65 20 3b 3b 20  se (if force ;; 
88d0: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
88e0: 66 6f 72 63 65 22 29 0a 09 09 27 4e 4f 54 5f 53  force")...'NOT_S
88f0: 54 41 52 54 45 44 0a 09 09 28 69 66 20 74 65 73  TARTED...(if tes
8900: 74 64 61 74 0a 09 09 20 20 20 20 28 73 74 72 69  tdat...    (stri
8910: 6e 67 2d 3e 73 79 6d 62 6f 6c 20 28 74 65 73 74  ng->symbol (test
8920: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64  :get-state testd
8930: 61 74 29 29 0a 09 09 20 20 20 20 27 66 61 69 6c  at))...    'fail
8940: 65 64 2d 74 6f 2d 69 6e 73 65 72 74 29 29 0a 09  ed-to-insert))..
8950: 28 28 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65  ((failed-to-inse
8960: 72 74 29 0a 09 20 28 64 65 62 75 67 3a 70 72 69  rt).. (debug:pri
8970: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 46 61 69  nt 0 "ERROR: Fai
8980: 6c 65 64 20 74 6f 20 69 6e 73 65 72 74 20 74 68  led to insert th
8990: 65 20 72 65 63 6f 72 64 20 69 6e 74 6f 20 74 68  e record into th
89a0: 65 20 64 62 22 29 29 0a 09 28 28 4e 4f 54 5f 53  e db"))..((NOT_S
89b0: 54 41 52 54 45 44 20 43 4f 4d 50 4c 45 54 45 44  TARTED COMPLETED
89c0: 20 44 45 4c 45 54 45 44 29 0a 09 20 28 6c 65 74   DELETED).. (let
89d0: 20 28 28 72 75 6e 66 6c 61 67 20 23 66 29 29 0a   ((runflag #f)).
89e0: 09 20 20 20 28 63 6f 6e 64 0a 09 20 20 20 20 3b  .   (cond..    ;
89f0: 3b 20 2d 66 6f 72 63 65 2c 20 72 75 6e 20 6e 6f  ; -force, run no
8a00: 20 6d 61 74 74 65 72 20 77 68 61 74 0a 09 20 20   matter what..  
8a10: 20 20 28 66 6f 72 63 65 20 28 73 65 74 21 20 72    (force (set! r
8a20: 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20  unflag #t))..   
8a30: 20 3b 3b 20 4e 4f 54 5f 53 54 41 52 54 45 44 2c   ;; NOT_STARTED,
8a40: 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77   run no matter w
8a50: 68 61 74 0a 09 20 20 20 20 28 28 6d 65 6d 62 65  hat..    ((membe
8a60: 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  r (test:get-stat
8a70: 65 20 74 65 73 74 64 61 74 29 20 27 28 22 44 45  e testdat) '("DE
8a80: 4c 45 54 45 44 22 20 22 4e 4f 54 5f 53 54 41 52  LETED" "NOT_STAR
8a90: 54 45 44 22 29 29 28 73 65 74 21 20 72 75 6e 66  TED"))(set! runf
8aa0: 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b 3b  lag #t))..    ;;
8ab0: 20 6e 6f 74 20 2d 72 65 72 75 6e 20 61 6e 64 20   not -rerun and 
8ac0: 50 41 53 53 2c 20 57 41 52 4e 20 6f 72 20 43 48  PASS, WARN or CH
8ad0: 45 43 4b 2c 20 64 6f 20 6e 6f 20 72 75 6e 0a 09  ECK, do no run..
8ae0: 20 20 20 20 28 28 61 6e 64 20 28 6f 72 20 28 6e      ((and (or (n
8af0: 6f 74 20 72 65 72 75 6e 29 0a 09 09 20 20 20 20  ot rerun)...    
8b00: 20 20 6b 65 65 70 67 6f 69 6e 67 29 0a 09 09 20    keepgoing)... 
8b10: 20 3b 3b 20 52 65 71 75 69 72 65 20 74 6f 20 66   ;; Require to f
8b20: 6f 72 63 65 20 72 65 2d 72 75 6e 20 66 6f 72 20  orce re-run for 
8b30: 43 4f 4d 50 4c 45 54 45 44 20 6f 72 20 2a 61 6e  COMPLETED or *an
8b40: 79 74 68 69 6e 67 2a 20 2b 20 50 41 53 53 2c 57  ything* + PASS,W
8b50: 41 52 4e 20 6f 72 20 43 48 45 43 4b 0a 09 09 20  ARN or CHECK... 
8b60: 20 28 6f 72 20 28 6d 65 6d 62 65 72 20 28 74 65   (or (member (te
8b70: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65  st:get-status te
8b80: 73 74 64 61 74 29 20 27 28 22 50 41 53 53 22 20  stdat) '("PASS" 
8b90: 22 57 41 52 4e 22 20 22 43 48 45 43 4b 22 20 22  "WARN" "CHECK" "
8ba0: 53 4b 49 50 22 29 29 0a 09 09 20 20 20 20 20 20  SKIP"))...      
8bb0: 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65  (member (test:ge
8bc0: 74 2d 73 74 61 74 65 20 20 74 65 73 74 64 61 74  t-state  testdat
8bd0: 29 20 27 28 22 43 4f 4d 50 4c 45 54 45 44 22 29  ) '("COMPLETED")
8be0: 29 29 29 20 0a 09 20 20 20 20 20 28 64 65 62 75  ))) ..     (debu
8bf0: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 32 20 22  g:print-info 2 "
8c00: 72 75 6e 6e 69 6e 67 20 74 65 73 74 20 22 20 74  running test " t
8c10: 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65  est-name "/" ite
8c20: 6d 2d 70 61 74 68 20 22 20 73 75 70 70 72 65 73  m-path " suppres
8c30: 73 65 64 20 61 73 20 69 74 20 69 73 20 22 20 28  sed as it is " (
8c40: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74  test:get-state t
8c50: 65 73 74 64 61 74 29 20 22 20 61 6e 64 20 22 20  estdat) " and " 
8c60: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73  (test:get-status
8c70: 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20   testdat))..    
8c80: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23   (set! runflag #
8c90: 66 29 29 0a 09 20 20 20 20 3b 3b 20 2d 72 65 72  f))..    ;; -rer
8ca0: 75 6e 20 61 6e 64 20 73 74 61 74 75 73 20 69 73  un and status is
8cb0: 20 6f 6e 65 20 6f 66 20 74 68 65 20 73 70 65 63   one of the spec
8cc0: 69 66 65 64 2c 20 72 75 6e 20 69 74 0a 09 20 20  ifed, run it..  
8cd0: 20 20 28 28 61 6e 64 20 72 65 72 75 6e 0a 09 09    ((and rerun...
8ce0: 20 20 28 6c 65 74 2a 20 28 28 72 65 72 75 6e 6c    (let* ((rerunl
8cf0: 73 74 20 20 20 28 73 74 72 69 6e 67 2d 73 70 6c  st   (string-spl
8d00: 69 74 20 72 65 72 75 6e 20 22 2c 22 29 29 0a 09  it rerun ","))..
8d10: 09 09 20 28 6d 75 73 74 2d 72 65 72 75 6e 20 28  .. (must-rerun (
8d20: 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74  member (test:get
8d30: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29  -status testdat)
8d40: 20 72 65 72 75 6e 6c 73 74 29 29 29 0a 09 09 20   rerunlst)))... 
8d50: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d     (debug:print-
8d60: 69 6e 66 6f 20 33 20 22 2d 72 65 72 75 6e 20 6c  info 3 "-rerun l
8d70: 69 73 74 3a 20 22 20 72 65 72 75 6e 20 22 2c 20  ist: " rerun ", 
8d80: 74 65 73 74 2d 73 74 61 74 75 73 3a 20 22 20 28  test-status: " (
8d90: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20  test:get-status 
8da0: 74 65 73 74 64 61 74 29 22 2c 20 6d 75 73 74 2d  testdat)", must-
8db0: 72 65 72 75 6e 3a 20 22 20 6d 75 73 74 2d 72 65  rerun: " must-re
8dc0: 72 75 6e 29 0a 09 09 20 20 20 20 6d 75 73 74 2d  run)...    must-
8dd0: 72 65 72 75 6e 29 29 0a 09 20 20 20 20 20 28 64  rerun))..     (d
8de0: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
8df0: 32 20 22 52 65 72 75 6e 20 66 6f 72 63 65 64 20  2 "Rerun forced 
8e00: 66 6f 72 20 74 65 73 74 20 22 20 74 65 73 74 2d  for test " test-
8e10: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61  name "/" item-pa
8e20: 74 68 29 0a 09 20 20 20 20 20 28 73 65 74 21 20  th)..     (set! 
8e30: 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20  runflag #t))..  
8e40: 20 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 2c    ;; -keepgoing,
8e50: 20 64 6f 20 6e 6f 74 20 72 65 72 75 6e 20 46 41   do not rerun FA
8e60: 49 4c 0a 09 20 20 20 20 28 28 61 6e 64 20 6b 65  IL..    ((and ke
8e70: 65 70 67 6f 69 6e 67 0a 09 09 20 20 28 6d 65 6d  epgoing...  (mem
8e80: 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74  ber (test:get-st
8e90: 61 74 75 73 20 74 65 73 74 64 61 74 29 20 27 28  atus testdat) '(
8ea0: 22 46 41 49 4c 22 29 29 29 0a 09 20 20 20 20 20  "FAIL")))..     
8eb0: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66  (set! runflag #f
8ec0: 29 29 0a 09 20 20 20 20 28 28 61 6e 64 20 28 6e  ))..    ((and (n
8ed0: 6f 74 20 72 65 72 75 6e 29 0a 09 09 20 20 28 6d  ot rerun)...  (m
8ee0: 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d  ember (test:get-
8ef0: 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20  status testdat) 
8f00: 27 28 22 46 41 49 4c 22 20 22 6e 2f 61 22 29 29  '("FAIL" "n/a"))
8f10: 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 75  )..     (set! ru
8f20: 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20  nflag #t))..    
8f30: 28 65 6c 73 65 20 28 73 65 74 21 20 72 75 6e 66  (else (set! runf
8f40: 6c 61 67 20 23 66 29 29 29 0a 09 20 20 20 28 64  lag #f)))..   (d
8f50: 65 62 75 67 3a 70 72 69 6e 74 20 36 20 22 52 55  ebug:print 6 "RU
8f60: 4e 4e 49 4e 47 20 3d 3e 20 72 75 6e 66 6c 61 67  NNING => runflag
8f70: 3a 20 22 20 72 75 6e 66 6c 61 67 20 22 20 53 54  : " runflag " ST
8f80: 41 54 45 3a 20 22 20 28 74 65 73 74 3a 67 65 74  ATE: " (test:get
8f90: 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 20  -state testdat) 
8fa0: 22 20 53 54 41 54 55 53 3a 20 22 20 28 74 65 73  " STATUS: " (tes
8fb0: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73  t:get-status tes
8fc0: 74 64 61 74 29 29 0a 09 20 20 20 28 69 66 20 28  tdat))..   (if (
8fd0: 6e 6f 74 20 72 75 6e 66 6c 61 67 29 0a 09 20 20  not runflag)..  
8fe0: 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 70 61       (if (not pa
8ff0: 72 65 6e 74 2d 74 65 73 74 29 0a 09 09 20 20 20  rent-test)...   
9000: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22  (debug:print 1 "
9010: 4e 4f 54 45 3a 20 4e 6f 74 20 73 74 61 72 74 69  NOTE: Not starti
9020: 6e 67 20 74 65 73 74 20 22 20 6e 65 77 2d 74 65  ng test " new-te
9030: 73 74 2d 6e 61 6d 65 20 22 20 61 73 20 69 74 20  st-name " as it 
9040: 69 73 20 73 74 61 74 65 20 5c 22 22 20 28 74 65  is state \"" (te
9050: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73  st:get-state tes
9060: 74 64 61 74 29 20 0a 09 09 09 09 22 5c 22 20 61  tdat) ....."\" a
9070: 6e 64 20 73 74 61 74 75 73 20 5c 22 22 20 28 74  nd status \"" (t
9080: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74  est:get-status t
9090: 65 73 74 64 61 74 29 20 22 5c 22 2c 20 75 73 65  estdat) "\", use
90a0: 20 2d 72 65 72 75 6e 20 5c 22 22 20 28 74 65 73   -rerun \"" (tes
90b0: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73  t:get-status tes
90c0: 74 64 61 74 29 0a 20 20 20 20 20 20 20 20 20 20  tdat).          
90d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
90e0: 20 20 20 20 20 20 22 5c 22 20 6f 72 20 2d 66 6f        "\" or -fo
90f0: 72 63 65 20 74 6f 20 6f 76 65 72 72 69 64 65 22  rce to override"
9100: 29 29 0a 09 20 20 20 20 20 20 20 3b 3b 20 4e 4f  ))..       ;; NO
9110: 54 45 3a 20 4e 6f 20 6c 6f 6e 67 65 72 20 62 65  TE: No longer be
9120: 20 63 68 65 63 6b 69 6e 67 20 70 72 65 72 65 71   checking prereq
9130: 75 69 73 69 74 65 73 20 68 65 72 65 21 20 57 69  uisites here! Wi
9140: 6c 6c 20 6e 65 76 65 72 20 67 65 74 20 68 65 72  ll never get her
9150: 65 20 75 6e 6c 65 73 73 20 70 72 65 72 65 71 73  e unless prereqs
9160: 20 61 72 65 0a 09 20 20 20 20 20 20 20 3b 3b 20   are..       ;; 
9170: 20 20 20 20 20 20 61 6c 72 65 61 64 79 20 6d 65        already me
9180: 74 2e 0a 09 20 20 20 20 20 20 20 3b 3b 20 54 68  t...       ;; Th
9190: 69 73 20 77 6f 75 6c 64 20 62 65 20 61 20 67 72  is would be a gr
91a0: 65 61 74 20 70 6c 61 63 65 20 74 6f 20 64 6f 20  eat place to do 
91b0: 74 68 65 20 70 72 6f 63 65 73 73 2d 66 6f 72 6b  the process-fork
91c0: 0a 09 20 20 20 20 20 20 20 28 69 66 20 28 6e 6f  ..       (if (no
91d0: 74 20 28 6c 61 75 6e 63 68 2d 74 65 73 74 20 23  t (launch-test #
91e0: 66 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65  f run-id runname
91f0: 20 74 65 73 74 2d 63 6f 6e 66 20 6b 65 79 76 61   test-conf keyva
9200: 6c 6c 73 74 20 74 65 73 74 2d 6e 61 6d 65 20 74  llst test-name t
9210: 65 73 74 2d 70 61 74 68 20 69 74 65 6d 64 61 74  est-path itemdat
9220: 20 66 6c 61 67 73 29 29 0a 09 09 20 20 20 28 62   flags))...   (b
9230: 65 67 69 6e 0a 09 09 20 20 20 20 20 28 70 72 69  egin...     (pri
9240: 6e 74 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65  nt "ERROR: Faile
9250: 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 68 65 20  d to launch the 
9260: 74 65 73 74 2e 20 45 78 69 74 69 6e 67 20 61 73  test. Exiting as
9270: 20 73 6f 6f 6e 20 61 73 20 70 6f 73 73 69 62 6c   soon as possibl
9280: 65 22 29 0a 09 09 20 20 20 20 20 28 73 65 74 21  e")...     (set!
9290: 20 2a 67 6c 6f 62 61 6c 65 78 69 74 73 74 61 74   *globalexitstat
92a0: 75 73 2a 20 31 29 20 3b 3b 20 0a 09 09 20 20 20  us* 1) ;; ...   
92b0: 20 20 28 70 72 6f 63 65 73 73 2d 73 69 67 6e 61    (process-signa
92c0: 6c 20 28 63 75 72 72 65 6e 74 2d 70 72 6f 63 65  l (current-proce
92d0: 73 73 2d 69 64 29 20 73 69 67 6e 61 6c 2f 6b 69  ss-id) signal/ki
92e0: 6c 6c 29 29 29 29 29 29 0a 09 28 28 4b 49 4c 4c  ll))))))..((KILL
92f0: 45 44 29 20 0a 09 20 28 64 65 62 75 67 3a 70 72  ED) .. (debug:pr
9300: 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 22 20 6e  int 1 "NOTE: " n
9310: 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 69  ew-test-name " i
9320: 73 20 61 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e  s already runnin
9330: 67 20 6f 72 20 77 61 73 20 65 78 70 6c 69 63 74  g or was explict
9340: 6c 79 20 6b 69 6c 6c 65 64 2c 20 75 73 65 20 2d  ly killed, use -
9350: 66 6f 72 63 65 20 74 6f 20 6c 61 75 6e 63 68 20  force to launch 
9360: 69 74 2e 22 29 29 0a 09 28 28 4c 41 55 4e 43 48  it."))..((LAUNCH
9370: 45 44 20 52 45 4d 4f 54 45 48 4f 53 54 53 54 41  ED REMOTEHOSTSTA
9380: 52 54 20 52 55 4e 4e 49 4e 47 29 20 20 0a 09 20  RT RUNNING)  .. 
9390: 28 69 66 20 28 3e 20 28 2d 20 28 63 75 72 72 65  (if (> (- (curre
93a0: 6e 74 2d 73 65 63 6f 6e 64 73 29 28 2b 20 28 64  nt-seconds)(+ (d
93b0: 62 3a 74 65 73 74 2d 67 65 74 2d 65 76 65 6e 74  b:test-get-event
93c0: 5f 74 69 6d 65 20 74 65 73 74 64 61 74 29 0a 09  _time testdat)..
93d0: 09 09 09 20 20 20 20 20 20 20 28 64 62 3a 74 65  ...       (db:te
93e0: 73 74 2d 67 65 74 2d 72 75 6e 5f 64 75 72 61 74  st-get-run_durat
93f0: 69 6f 6e 20 74 65 73 74 64 61 74 29 29 29 0a 09  ion testdat)))..
9400: 09 36 30 30 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f  .600) ;; i.e. no
9410: 20 75 70 64 61 74 65 20 66 6f 72 20 6d 6f 72 65   update for more
9420: 20 74 68 61 6e 20 36 30 30 20 73 65 63 6f 6e 64   than 600 second
9430: 73 0a 09 20 20 20 20 20 28 62 65 67 69 6e 0a 09  s..     (begin..
9440: 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72         (debug:pr
9450: 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20  int 0 "WARNING: 
9460: 54 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65  Test " test-name
9470: 20 22 20 61 70 70 65 61 72 73 20 74 6f 20 62 65   " appears to be
9480: 20 64 65 61 64 2e 20 46 6f 72 63 69 6e 67 20 69   dead. Forcing i
9490: 74 20 74 6f 20 73 74 61 74 65 20 49 4e 43 4f 4d  t to state INCOM
94a0: 50 4c 45 54 45 20 61 6e 64 20 73 74 61 74 75 73  PLETE and status
94b0: 20 53 54 55 43 4b 2f 44 45 41 44 22 29 0a 09 20   STUCK/DEAD").. 
94c0: 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73        (tests:tes
94d0: 74 2d 73 65 74 2d 73 74 61 74 75 73 21 20 74 65  t-set-status! te
94e0: 73 74 2d 69 64 20 22 49 4e 43 4f 4d 50 4c 45 54  st-id "INCOMPLET
94f0: 45 22 20 22 53 54 55 43 4b 2f 44 45 41 44 22 20  E" "STUCK/DEAD" 
9500: 22 54 65 73 74 20 69 73 20 73 74 75 63 6b 20 6f  "Test is stuck o
9510: 72 20 64 65 61 64 22 20 23 66 29 29 0a 09 20 20  r dead" #f))..  
9520: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
9530: 32 20 22 4e 4f 54 45 3a 20 22 20 74 65 73 74 2d  2 "NOTE: " test-
9540: 6e 61 6d 65 20 22 20 69 73 20 61 6c 72 65 61 64  name " is alread
9550: 79 20 72 75 6e 6e 69 6e 67 22 29 29 29 0a 09 28  y running")))..(
9560: 65 6c 73 65 20 20 20 20 20 20 20 28 64 65 62 75  else       (debu
9570: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52  g:print 0 "ERROR
9580: 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e  : Failed to laun
9590: 63 68 20 74 65 73 74 20 22 20 6e 65 77 2d 74 65  ch test " new-te
95a0: 73 74 2d 6e 61 6d 65 20 22 2e 20 55 6e 72 65 63  st-name ". Unrec
95b0: 6f 67 6e 69 73 65 64 20 73 74 61 74 65 20 22 20  ognised state " 
95c0: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20  (test:get-state 
95d0: 74 65 73 74 64 61 74 29 29 29 29 29 29 29 0a 0a  testdat)))))))..
95e0: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;;==============
95f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9600: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9610: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9620: 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 45 4e 44 20  ========.;; END 
9630: 4f 46 20 4e 45 57 20 53 54 55 46 46 0a 3b 3b 3d  OF NEW STUFF.;;=
9640: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9650: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9660: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9670: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9680: 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65 20 28  =====..(define (
9690: 67 65 74 2d 64 69 72 2d 75 70 2d 6e 20 64 69 72  get-dir-up-n dir
96a0: 20 2e 20 70 61 72 61 6d 73 29 20 0a 20 20 28 6c   . params) .  (l
96b0: 65 74 20 28 28 64 70 61 72 74 73 20 20 28 73 74  et ((dparts  (st
96c0: 72 69 6e 67 2d 73 70 6c 69 74 20 64 69 72 20 22  ring-split dir "
96d0: 2f 22 29 29 0a 09 28 63 6f 75 6e 74 20 20 20 28  /"))..(count   (
96e0: 69 66 20 28 6e 75 6c 6c 3f 20 70 61 72 61 6d 73  if (null? params
96f0: 29 20 31 20 28 63 61 72 20 70 61 72 61 6d 73 29  ) 1 (car params)
9700: 29 29 29 0a 20 20 20 20 28 63 6f 6e 63 20 22 2f  ))).    (conc "/
9710: 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73  " (string-inters
9720: 70 65 72 73 65 20 0a 09 20 20 20 20 20 20 20 28  perse ..       (
9730: 74 61 6b 65 20 64 70 61 72 74 73 20 28 2d 20 28  take dparts (- (
9740: 6c 65 6e 67 74 68 20 64 70 61 72 74 73 29 20 63  length dparts) c
9750: 6f 75 6e 74 29 29 0a 09 20 20 20 20 20 20 20 22  ount))..       "
9760: 2f 22 29 29 29 29 0a 3b 3b 20 52 65 6d 6f 76 65  /")))).;; Remove
9770: 20 72 75 6e 73 0a 3b 3b 20 66 69 65 6c 64 73 20   runs.;; fields 
9780: 61 72 65 20 70 61 73 73 69 6e 67 20 69 6e 20 74  are passing in t
9790: 68 72 6f 75 67 68 20 0a 3b 3b 20 61 63 74 69 6f  hrough .;; actio
97a0: 6e 3a 0a 3b 3b 20 20 20 20 27 72 65 6d 6f 76 65  n:.;;    'remove
97b0: 2d 72 75 6e 73 0a 3b 3b 20 20 20 20 27 73 65 74  -runs.;;    'set
97c0: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 0a 3b 3b  -state-status.;;
97d0: 0a 3b 3b 20 4e 42 2f 2f 20 73 68 6f 75 6c 64 20  .;; NB// should 
97e0: 70 61 73 73 20 69 6e 20 6b 65 79 73 3f 0a 3b 3b  pass in keys?.;;
97f0: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 6f  .(define (runs:o
9800: 70 65 72 61 74 65 2d 6f 6e 20 61 63 74 69 6f 6e  perate-on action
9810: 20 72 75 6e 6e 61 6d 65 70 61 74 74 20 74 65 73   runnamepatt tes
9820: 74 70 61 74 74 20 23 21 6b 65 79 20 28 73 74 61  tpatt #!key (sta
9830: 74 65 20 23 66 29 28 73 74 61 74 75 73 20 23 66  te #f)(status #f
9840: 29 28 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74  )(new-state-stat
9850: 75 73 20 23 66 29 29 0a 20 20 28 63 6f 6d 6d 6f  us #f)).  (commo
9860: 6e 3a 63 6c 65 61 72 2d 63 61 63 68 65 73 29 20  n:clear-caches) 
9870: 3b 3b 20 63 6c 65 61 72 20 61 6c 6c 20 63 61 63  ;; clear all cac
9880: 68 65 73 0a 20 20 28 6c 65 74 2a 20 28 28 64 62  hes.  (let* ((db
9890: 20 20 20 20 20 20 20 20 20 20 20 23 66 29 0a 09             #f)..
98a0: 20 28 6b 65 79 73 20 20 20 20 20 20 20 20 20 28   (keys         (
98b0: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64  open-run-close d
98c0: 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a  b:get-keys db)).
98d0: 09 20 28 72 75 6e 64 61 74 20 20 20 20 20 20 20  . (rundat       
98e0: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
98f0: 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79  runs:get-runs-by
9900: 2d 70 61 74 74 20 64 62 20 6b 65 79 73 20 72 75  -patt db keys ru
9910: 6e 6e 61 6d 65 70 61 74 74 29 29 0a 09 20 28 68  nnamepatt)).. (h
9920: 65 61 64 65 72 20 20 20 20 20 20 20 28 76 65 63  eader       (vec
9930: 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 30  tor-ref rundat 0
9940: 29 29 0a 09 20 28 72 75 6e 73 20 20 20 20 20 20  )).. (runs      
9950: 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72     (vector-ref r
9960: 75 6e 64 61 74 20 31 29 29 0a 09 20 28 73 74 61  undat 1)).. (sta
9970: 74 65 73 20 20 20 20 20 20 20 28 69 66 20 73 74  tes       (if st
9980: 61 74 65 20 20 28 73 74 72 69 6e 67 2d 73 70 6c  ate  (string-spl
9990: 69 74 20 73 74 61 74 65 20 20 22 2c 22 29 20 27  it state  ",") '
99a0: 28 29 29 29 0a 09 20 28 73 74 61 74 75 73 65 73  ())).. (statuses
99b0: 20 20 20 20 20 28 69 66 20 73 74 61 74 75 73 20       (if status 
99c0: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 73 74  (string-split st
99d0: 61 74 75 73 20 22 2c 22 29 20 27 28 29 29 29 0a  atus ",") '())).
99e0: 09 20 28 73 74 61 74 65 2d 73 74 61 74 75 73 20  . (state-status 
99f0: 28 69 66 20 28 73 74 72 69 6e 67 3f 20 6e 65 77  (if (string? new
9a00: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 29 20 28  -state-status) (
9a10: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 6e 65 77  string-split new
9a20: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 20 22 2c  -state-status ",
9a30: 22 29 20 27 28 23 66 20 23 66 29 29 29 29 0a 20  ") '(#f #f)))). 
9a40: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d     (debug:print-
9a50: 69 6e 66 6f 20 34 20 22 72 75 6e 73 3a 6f 70 65  info 4 "runs:ope
9a60: 72 61 74 65 2d 6f 6e 20 3d 3e 20 48 65 61 64 65  rate-on => Heade
9a70: 72 3a 20 22 20 68 65 61 64 65 72 20 22 20 61 63  r: " header " ac
9a80: 74 69 6f 6e 3a 20 22 20 61 63 74 69 6f 6e 20 22  tion: " action "
9a90: 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75   new-state-statu
9aa0: 73 3a 20 22 20 6e 65 77 2d 73 74 61 74 65 2d 73  s: " new-state-s
9ab0: 74 61 74 75 73 29 0a 20 20 20 20 28 69 66 20 28  tatus).    (if (
9ac0: 3e 20 32 20 28 6c 65 6e 67 74 68 20 73 74 61 74  > 2 (length stat
9ad0: 65 2d 73 74 61 74 75 73 29 29 0a 09 28 62 65 67  e-status))..(beg
9ae0: 69 6e 0a 09 20 20 28 64 65 62 75 67 3a 70 72 69  in..  (debug:pri
9af0: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 74 68 65  nt 0 "ERROR: the
9b00: 20 70 61 72 61 6d 65 74 65 72 20 74 6f 20 2d 73   parameter to -s
9b10: 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73 20  et-state-status 
9b20: 69 73 20 61 20 63 6f 6d 6d 61 20 64 65 6c 69 6d  is a comma delim
9b30: 69 74 65 64 20 73 74 72 69 6e 67 2e 20 45 2e 67  ited string. E.g
9b40: 2e 20 43 4f 4d 50 4c 45 54 45 44 2c 46 41 49 4c  . COMPLETED,FAIL
9b50: 22 29 0a 09 20 20 28 65 78 69 74 29 29 29 0a 20  ")..  (exit))). 
9b60: 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 20     (for-each.   
9b70: 20 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a    (lambda (run).
9b80: 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 75         (let ((ru
9b90: 6e 6b 65 79 20 28 73 74 72 69 6e 67 2d 69 6e 74  nkey (string-int
9ba0: 65 72 73 70 65 72 73 65 20 28 6d 61 70 20 28 6c  ersperse (map (l
9bb0: 61 6d 62 64 61 20 28 6b 29 0a 09 09 09 09 09 09  ambda (k).......
9bc0: 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79  (db:get-value-by
9bd0: 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64  -header run head
9be0: 65 72 20 28 76 65 63 74 6f 72 2d 72 65 66 20 6b  er (vector-ref k
9bf0: 20 30 29 29 29 20 6b 65 79 73 29 20 22 2f 22 29   0))) keys) "/")
9c00: 29 0a 09 20 20 20 20 20 28 64 69 72 73 2d 74 6f  )..     (dirs-to
9c10: 2d 72 65 6d 6f 76 65 20 28 6d 61 6b 65 2d 68 61  -remove (make-ha
9c20: 73 68 2d 74 61 62 6c 65 29 29 29 0a 09 20 28 6c  sh-table))).. (l
9c30: 65 74 2a 20 28 28 72 75 6e 2d 69 64 20 20 20 20  et* ((run-id    
9c40: 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79  (db:get-value-by
9c50: 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64  -header run head
9c60: 65 72 20 22 69 64 22 29 29 0a 09 09 28 72 75 6e  er "id"))...(run
9c70: 2d 73 74 61 74 65 20 28 64 62 3a 67 65 74 2d 76  -state (db:get-v
9c80: 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72  alue-by-header r
9c90: 75 6e 20 68 65 61 64 65 72 20 22 73 74 61 74 65  un header "state
9ca0: 22 29 29 0a 09 09 28 74 65 73 74 73 20 20 20 20  "))...(tests    
9cb0: 20 28 69 66 20 28 6e 6f 74 20 28 65 71 75 61 6c   (if (not (equal
9cc0: 3f 20 72 75 6e 2d 73 74 61 74 65 20 22 6c 6f 63  ? run-state "loc
9cd0: 6b 65 64 22 29 29 0a 09 09 09 20 20 20 20 20 20  ked"))....      
9ce0: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
9cf0: 20 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f   db:get-tests-fo
9d00: 72 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 0a  r-run db run-id.
9d10: 09 09 09 09 09 09 20 20 20 20 20 20 74 65 73 74  ......      test
9d20: 70 61 74 74 20 73 74 61 74 65 73 20 73 74 61 74  patt states stat
9d30: 75 73 65 73 0a 09 09 09 09 09 09 20 20 20 20 20  uses.......     
9d40: 20 6e 6f 74 2d 69 6e 3a 20 20 23 66 0a 09 09 09   not-in:  #f....
9d50: 09 09 09 20 20 20 20 20 20 73 6f 72 74 2d 62 79  ...      sort-by
9d60: 3a 20 28 63 61 73 65 20 61 63 74 69 6f 6e 0a 09  : (case action..
9d70: 09 09 09 09 09 09 09 20 28 28 72 65 6d 6f 76 65  ....... ((remove
9d80: 2d 72 75 6e 73 29 20 27 72 75 6e 64 69 72 29 0a  -runs) 'rundir).
9d90: 09 09 09 09 09 09 09 09 20 28 65 6c 73 65 20 20  ........ (else  
9da0: 20 20 20 20 20 20 20 20 27 65 76 65 6e 74 5f 74          'event_t
9db0: 69 6d 65 29 29 29 0a 09 09 09 20 20 20 20 20 20  ime)))....      
9dc0: 20 27 28 29 29 29 0a 09 09 28 6c 61 73 74 74 70   '()))...(lasttp
9dd0: 61 74 68 20 22 2f 64 6f 65 73 2f 6e 6f 74 2f 65  ath "/does/not/e
9de0: 78 69 73 74 2f 49 2f 68 6f 70 65 22 29 29 0a 09  xist/I/hope"))..
9df0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d     (debug:print-
9e00: 69 6e 66 6f 20 34 20 22 72 75 6e 73 3a 6f 70 65  info 4 "runs:ope
9e10: 72 61 74 65 2d 6f 6e 20 72 75 6e 3d 22 20 72 75  rate-on run=" ru
9e20: 6e 20 22 2c 20 68 65 61 64 65 72 3d 22 20 68 65  n ", header=" he
9e30: 61 64 65 72 29 0a 09 20 20 20 28 69 66 20 28 6e  ader)..   (if (n
9e40: 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 73 74 73 29  ot (null? tests)
9e50: 29 0a 09 20 20 20 20 20 20 20 28 62 65 67 69 6e  )..       (begin
9e60: 0a 09 09 20 28 63 61 73 65 20 61 63 74 69 6f 6e  ... (case action
9e70: 0a 09 09 20 20 20 28 28 72 65 6d 6f 76 65 2d 72  ...   ((remove-r
9e80: 75 6e 73 29 0a 09 09 20 20 20 20 28 64 65 62 75  uns)...    (debu
9e90: 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76  g:print 1 "Remov
9ea0: 69 6e 67 20 74 65 73 74 73 20 66 6f 72 20 72 75  ing tests for ru
9eb0: 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20 22 20  n: " runkey " " 
9ec0: 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79  (db:get-value-by
9ed0: 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64  -header run head
9ee0: 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 29 29 0a  er "runname"))).
9ef0: 09 09 20 20 20 28 28 73 65 74 2d 73 74 61 74 65  ..   ((set-state
9f00: 2d 73 74 61 74 75 73 29 0a 09 09 20 20 20 20 28  -status)...    (
9f10: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4d  debug:print 1 "M
9f20: 6f 64 69 66 79 69 6e 67 20 73 74 61 74 65 20 61  odifying state a
9f30: 6e 64 20 73 74 61 75 73 20 66 6f 72 20 74 65 73  nd staus for tes
9f40: 74 73 20 66 6f 72 20 72 75 6e 3a 20 22 20 72 75  ts for run: " ru
9f50: 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74  nkey " " (db:get
9f60: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72  -value-by-header
9f70: 20 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e   run header "run
9f80: 6e 61 6d 65 22 29 29 29 0a 09 09 20 20 20 28 28  name")))...   ((
9f90: 70 72 69 6e 74 2d 72 75 6e 29 0a 09 09 20 20 20  print-run)...   
9fa0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20   (debug:print 1 
9fb0: 22 50 72 69 6e 74 69 6e 67 20 69 6e 66 6f 20 66  "Printing info f
9fc0: 6f 72 20 72 75 6e 20 22 20 72 75 6e 6b 65 79 20  or run " runkey 
9fd0: 22 2c 20 72 75 6e 3d 22 20 72 75 6e 20 22 2c 20  ", run=" run ", 
9fe0: 74 65 73 74 73 3d 22 20 74 65 73 74 73 20 22 2c  tests=" tests ",
9ff0: 20 68 65 61 64 65 72 3d 22 20 68 65 61 64 65 72   header=" header
a000: 29 0a 09 09 20 20 20 20 61 63 74 69 6f 6e 29 0a  )...    action).
a010: 09 09 20 20 20 28 65 6c 73 65 0a 09 09 20 20 20  ..   (else...   
a020: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
a030: 66 6f 20 30 20 22 61 63 74 69 6f 6e 20 6e 6f 74  fo 0 "action not
a040: 20 72 65 63 6f 67 6e 69 73 65 64 20 22 20 61 63   recognised " ac
a050: 74 69 6f 6e 29 29 29 0a 09 09 20 28 66 6f 72 2d  tion)))... (for-
a060: 65 61 63 68 0a 09 09 20 20 28 6c 61 6d 62 64 61  each...  (lambda
a070: 20 28 74 65 73 74 29 0a 09 09 20 20 20 20 28 6c   (test)...    (l
a080: 65 74 2a 20 28 28 69 74 65 6d 2d 70 61 74 68 20  et* ((item-path 
a090: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65  (db:test-get-ite
a0a0: 6d 2d 70 61 74 68 20 74 65 73 74 29 29 0a 09 09  m-path test))...
a0b0: 09 20 20 20 28 74 65 73 74 2d 6e 61 6d 65 20 28  .   (test-name (
a0c0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74  db:test-get-test
a0d0: 6e 61 6d 65 20 74 65 73 74 29 29 0a 09 09 09 20  name test)).... 
a0e0: 20 20 28 72 75 6e 2d 64 69 72 20 20 20 28 64 62    (run-dir   (db
a0f0: 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 64 69 72  :test-get-rundir
a100: 20 74 65 73 74 29 29 20 20 20 20 3b 3b 20 72 75   test))    ;; ru
a110: 6e 20 64 69 72 20 69 73 20 66 72 6f 6d 20 74 68  n dir is from th
a120: 65 20 6c 69 6e 6b 20 74 72 65 65 0a 09 09 09 20  e link tree.... 
a130: 20 20 28 72 65 61 6c 2d 64 69 72 20 20 28 69 66    (real-dir  (if
a140: 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 72   (file-exists? r
a150: 75 6e 2d 64 69 72 29 0a 09 09 09 09 09 20 20 28  un-dir)......  (
a160: 72 65 73 6f 6c 76 65 2d 70 61 74 68 6e 61 6d 65  resolve-pathname
a170: 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 09 09 20   run-dir)...... 
a180: 20 23 66 29 29 0a 09 09 09 20 20 20 28 74 65 73   #f))....   (tes
a190: 74 2d 69 64 20 20 20 28 64 62 3a 74 65 73 74 2d  t-id   (db:test-
a1a0: 67 65 74 2d 69 64 20 74 65 73 74 29 29 29 0a 09  get-id test)))..
a1b0: 09 20 20 20 20 20 20 3b 3b 20 20 20 28 74 64 62  .      ;;   (tdb
a1c0: 20 20 20 20 20 20 20 28 64 62 3a 6f 70 65 6e 2d         (db:open-
a1d0: 74 65 73 74 2d 64 62 20 72 75 6e 2d 64 69 72 29  test-db run-dir)
a1e0: 29 29 0a 09 09 20 20 20 20 20 20 28 64 65 62 75  ))...      (debu
a1f0: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22  g:print-info 4 "
a200: 74 65 73 74 3d 22 20 74 65 73 74 29 20 3b 3b 20  test=" test) ;; 
a210: 20 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74    " (db:test-get
a220: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29 20  -testname test) 
a230: 22 20 69 64 3a 20 22 20 28 64 62 3a 74 65 73 74  " id: " (db:test
a240: 2d 67 65 74 2d 69 64 20 74 65 73 74 29 20 22 20  -get-id test) " 
a250: 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20 61 63  " item-path " ac
a260: 74 69 6f 6e 3a 20 22 20 61 63 74 69 6f 6e 29 0a  tion: " action).
a270: 09 09 20 20 20 20 20 20 28 63 61 73 65 20 61 63  ..      (case ac
a280: 74 69 6f 6e 0a 09 09 09 28 28 72 65 6d 6f 76 65  tion....((remove
a290: 2d 72 75 6e 73 29 20 3b 3b 20 74 68 65 20 74 64  -runs) ;; the td
a2a0: 62 20 69 73 20 66 6f 72 20 66 75 74 75 72 65 20  b is for future 
a2b0: 70 6f 73 73 69 62 6c 65 2e 20 0a 09 09 09 20 28  possible. .... (
a2c0: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64  open-run-close d
a2d0: 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 2d 72 65  b:delete-test-re
a2e0: 63 6f 72 64 73 20 64 62 20 23 66 20 28 64 62 3a  cords db #f (db:
a2f0: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74  test-get-id test
a300: 29 29 0a 09 09 09 20 28 64 65 62 75 67 3a 70 72  )).... (debug:pr
a310: 69 6e 74 2d 69 6e 66 6f 20 31 20 22 41 74 74 65  int-info 1 "Atte
a320: 6d 70 74 69 6e 67 20 74 6f 20 72 65 6d 6f 76 65  mpting to remove
a330: 20 22 20 28 69 66 20 72 65 61 6c 2d 64 69 72 20   " (if real-dir 
a340: 28 63 6f 6e 63 20 22 20 64 69 72 20 22 20 72 65  (conc " dir " re
a350: 61 6c 2d 64 69 72 20 22 20 61 6e 64 20 22 29 20  al-dir " and ") 
a360: 22 22 29 20 22 20 6c 69 6e 6b 20 22 20 72 75 6e  "") " link " run
a370: 2d 64 69 72 29 0a 09 09 09 20 28 69 66 20 28 61  -dir).... (if (a
a380: 6e 64 20 72 65 61 6c 2d 64 69 72 20 0a 09 09 09  nd real-dir ....
a390: 09 20 20 28 3e 20 28 73 74 72 69 6e 67 2d 6c 65  .  (> (string-le
a3a0: 6e 67 74 68 20 72 65 61 6c 2d 64 69 72 29 20 35  ngth real-dir) 5
a3b0: 29 0a 09 09 09 09 20 20 28 66 69 6c 65 2d 65 78  ).....  (file-ex
a3c0: 69 73 74 73 3f 20 72 65 61 6c 2d 64 69 72 29 29  ists? real-dir))
a3d0: 20 3b 3b 20 62 61 64 20 68 65 75 72 69 73 74 69   ;; bad heuristi
a3e0: 63 20 62 75 74 20 73 68 6f 75 6c 64 20 70 72 65  c but should pre
a3f0: 76 65 6e 74 20 2f 74 6d 70 20 2f 68 6f 6d 65 20  vent /tmp /home 
a400: 65 74 63 2e 0a 09 09 09 20 20 20 20 20 28 62 65  etc.....     (be
a410: 67 69 6e 20 3b 3b 20 6c 65 74 2a 20 28 28 72 65  gin ;; let* ((re
a420: 61 6c 70 61 74 68 20 28 72 65 73 6f 6c 76 65 2d  alpath (resolve-
a430: 70 61 74 68 6e 61 6d 65 20 72 75 6e 2d 64 69 72  pathname run-dir
a440: 29 29 29 0a 09 09 09 20 20 20 20 20 20 20 28 64  )))....       (d
a450: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
a460: 31 20 22 52 65 63 75 72 73 69 76 65 6c 79 20 72  1 "Recursively r
a470: 65 6d 6f 76 69 6e 67 20 22 20 72 65 61 6c 2d 64  emoving " real-d
a480: 69 72 29 0a 09 09 09 20 20 20 20 20 20 20 28 69  ir)....       (i
a490: 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20  f (file-exists? 
a4a0: 72 65 61 6c 2d 64 69 72 29 0a 09 09 09 09 20 20  real-dir).....  
a4b0: 20 28 69 66 20 28 3e 20 28 73 79 73 74 65 6d 20   (if (> (system 
a4c0: 28 63 6f 6e 63 20 22 72 6d 20 2d 72 66 20 22 20  (conc "rm -rf " 
a4d0: 72 65 61 6c 2d 64 69 72 29 29 20 30 29 0a 09 09  real-dir)) 0)...
a4e0: 09 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a  ..       (debug:
a4f0: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
a500: 54 68 65 72 65 20 77 61 73 20 61 20 70 72 6f 62  There was a prob
a510: 6c 65 6d 20 72 65 6d 6f 76 69 6e 67 20 22 20 72  lem removing " r
a520: 65 61 6c 2d 64 69 72 20 22 20 77 69 74 68 20 72  eal-dir " with r
a530: 6d 20 2d 66 22 29 29 0a 09 09 09 09 20 20 20 28  m -f")).....   (
a540: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57  debug:print 0 "W
a550: 41 52 4e 49 4e 47 3a 20 74 65 73 74 20 64 69 72  ARNING: test dir
a560: 20 22 20 72 65 61 6c 2d 64 69 72 20 22 20 61 70   " real-dir " ap
a570: 70 65 61 72 73 20 74 6f 20 6e 6f 74 20 65 78 69  pears to not exi
a580: 73 74 20 6f 72 20 69 73 20 6e 6f 74 20 72 65 61  st or is not rea
a590: 64 61 62 6c 65 22 29 29 29 0a 09 09 09 20 20 20  dable")))....   
a5a0: 20 20 28 69 66 20 72 65 61 6c 2d 64 69 72 20 0a    (if real-dir .
a5b0: 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e  .... (debug:prin
a5c0: 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 64 69  t 0 "WARNING: di
a5d0: 72 65 63 74 6f 72 79 20 22 20 72 65 61 6c 2d 64  rectory " real-d
a5e0: 69 72 20 22 20 64 6f 65 73 20 6e 6f 74 20 65 78  ir " does not ex
a5f0: 69 73 74 22 29 0a 09 09 09 09 20 28 64 65 62 75  ist")..... (debu
a600: 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49  g:print 0 "WARNI
a610: 4e 47 3a 20 6e 6f 20 72 65 61 6c 20 64 69 72 65  NG: no real dire
a620: 63 74 6f 72 79 20 63 6f 72 72 6f 73 70 6f 6e 64  ctory corrospond
a630: 69 6e 67 20 74 6f 20 6c 69 6e 6b 20 22 20 72 75  ing to link " ru
a640: 6e 2d 64 69 72 20 22 2c 20 6e 6f 74 68 69 6e 67  n-dir ", nothing
a650: 20 64 6f 6e 65 22 29 29 29 0a 09 09 09 20 28 69   done"))).... (i
a660: 66 20 28 73 79 6d 62 6f 6c 69 63 2d 6c 69 6e 6b  f (symbolic-link
a670: 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 20 20  ? run-dir)....  
a680: 20 20 20 28 62 65 67 69 6e 0a 09 09 09 20 20 20     (begin....   
a690: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
a6a0: 2d 69 6e 66 6f 20 31 20 22 52 65 6d 6f 76 69 6e  -info 1 "Removin
a6b0: 67 20 73 79 6d 6c 69 6e 6b 20 22 20 72 75 6e 2d  g symlink " run-
a6c0: 64 69 72 29 0a 09 09 09 20 20 20 20 20 20 20 28  dir)....       (
a6d0: 68 61 6e 64 6c 65 2d 65 78 63 65 70 74 69 6f 6e  handle-exception
a6e0: 73 0a 09 09 09 09 65 78 6e 0a 09 09 09 09 28 64  s.....exn.....(d
a6f0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
a700: 52 4f 52 3a 20 20 46 61 69 6c 65 64 20 74 6f 20  ROR:  Failed to 
a710: 72 65 6d 6f 76 65 20 73 79 6d 6c 69 6e 6b 20 22  remove symlink "
a720: 20 72 75 6e 2d 64 69 72 20 28 28 63 6f 6e 64 69   run-dir ((condi
a730: 74 69 6f 6e 2d 70 72 6f 70 65 72 74 79 2d 61 63  tion-property-ac
a740: 63 65 73 73 6f 72 20 27 65 78 6e 20 27 6d 65 73  cessor 'exn 'mes
a750: 73 61 67 65 29 20 65 78 6e 29 20 22 2c 20 61 74  sage) exn) ", at
a760: 74 65 6d 70 74 69 6e 67 20 74 6f 20 63 6f 6e 74  tempting to cont
a770: 69 6e 75 65 22 29 0a 09 09 09 09 28 64 65 6c 65  inue").....(dele
a780: 74 65 2d 66 69 6c 65 20 72 75 6e 2d 64 69 72 29  te-file run-dir)
a790: 29 29 0a 09 09 09 20 20 20 20 20 28 69 66 20 28  ))....     (if (
a7a0: 64 69 72 65 63 74 6f 72 79 3f 20 72 75 6e 2d 64  directory? run-d
a7b0: 69 72 29 0a 09 09 09 09 20 28 69 66 20 28 3e 20  ir)..... (if (> 
a7c0: 28 64 69 72 65 63 74 6f 72 79 2d 66 6f 6c 64 20  (directory-fold 
a7d0: 28 6c 61 6d 62 64 61 20 28 66 20 78 29 28 2b 20  (lambda (f x)(+ 
a7e0: 31 20 78 29 29 20 30 20 72 75 6e 2d 64 69 72 29  1 x)) 0 run-dir)
a7f0: 20 30 29 0a 09 09 09 09 20 20 20 20 20 28 64 65   0).....     (de
a800: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52  bug:print 0 "WAR
a810: 4e 49 4e 47 3a 20 72 65 66 75 73 69 6e 67 20 74  NING: refusing t
a820: 6f 20 72 65 6d 6f 76 65 20 22 20 72 75 6e 2d 64  o remove " run-d
a830: 69 72 20 22 20 61 73 20 69 74 20 69 73 20 6e 6f  ir " as it is no
a840: 74 20 65 6d 70 74 79 22 29 0a 09 09 09 09 20 20  t empty").....  
a850: 20 20 20 20 28 68 61 6e 64 6c 65 2d 65 78 63 65      (handle-exce
a860: 70 74 69 6f 6e 73 0a 09 09 09 09 20 20 20 20 20  ptions.....     
a870: 20 20 65 78 6e 0a 09 09 09 09 20 20 20 20 20 20    exn.....      
a880: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
a890: 22 45 52 52 4f 52 3a 20 20 46 61 69 6c 65 64 20  "ERROR:  Failed 
a8a0: 74 6f 20 72 65 6d 6f 76 65 20 64 69 72 65 63 74  to remove direct
a8b0: 6f 72 79 20 22 20 72 75 6e 2d 64 69 72 20 28 28  ory " run-dir ((
a8c0: 63 6f 6e 64 69 74 69 6f 6e 2d 70 72 6f 70 65 72  condition-proper
a8d0: 74 79 2d 61 63 63 65 73 73 6f 72 20 27 65 78 6e  ty-accessor 'exn
a8e0: 20 27 6d 65 73 73 61 67 65 29 20 65 78 6e 29 20   'message) exn) 
a8f0: 22 2c 20 61 74 74 65 6d 70 74 69 6e 67 20 74 6f  ", attempting to
a900: 20 63 6f 6e 74 69 6e 75 65 22 29 0a 09 09 09 09   continue").....
a910: 20 20 20 20 20 20 20 28 64 65 6c 65 74 65 2d 64         (delete-d
a920: 69 72 65 63 74 6f 72 79 20 72 75 6e 2d 64 69 72  irectory run-dir
a930: 29 29 29 0a 09 09 09 09 20 28 69 66 20 72 75 6e  )))..... (if run
a940: 2d 64 69 72 0a 09 09 09 09 20 20 20 20 20 28 64  -dir.....     (d
a950: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41  ebug:print 0 "WA
a960: 52 4e 49 4e 47 3a 20 6e 6f 74 20 72 65 6d 6f 76  RNING: not remov
a970: 69 6e 67 20 22 20 72 75 6e 2d 64 69 72 20 22 20  ing " run-dir " 
a980: 61 73 20 69 74 20 65 69 74 68 65 72 20 64 6f 65  as it either doe
a990: 73 6e 27 74 20 65 78 69 73 74 20 6f 72 20 69 73  sn't exist or is
a9a0: 20 6e 6f 74 20 61 20 73 79 6d 6c 69 6e 6b 22 29   not a symlink")
a9b0: 0a 09 09 09 09 20 20 20 20 20 28 64 65 62 75 67  .....     (debug
a9c0: 3a 70 72 69 6e 74 20 30 20 22 4e 4f 54 45 3a 20  :print 0 "NOTE: 
a9d0: 74 68 65 20 72 75 6e 20 64 69 72 20 66 6f 72 20  the run dir for 
a9e0: 74 68 69 73 20 74 65 73 74 20 69 73 20 75 6e 64  this test is und
a9f0: 65 66 69 6e 65 64 2e 20 54 65 73 74 20 6d 61 79  efined. Test may
aa00: 20 68 61 76 65 20 61 6c 72 65 61 64 79 20 62 65   have already be
aa10: 65 6e 20 64 65 6c 65 74 65 64 2e 22 29 29 0a 09  en deleted."))..
aa20: 09 09 09 20 29 29 29 0a 09 09 09 28 28 73 65 74  ... )))....((set
aa30: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 29 0a 09  -state-status)..
aa40: 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d  .. (debug:print-
aa50: 69 6e 66 6f 20 32 20 22 6e 65 77 20 73 74 61 74  info 2 "new stat
aa60: 65 20 22 20 28 63 61 72 20 73 74 61 74 65 2d 73  e " (car state-s
aa70: 74 61 74 75 73 29 20 22 2c 20 6e 65 77 20 73 74  tatus) ", new st
aa80: 61 74 75 73 20 22 20 28 63 61 64 72 20 73 74 61  atus " (cadr sta
aa90: 74 65 2d 73 74 61 74 75 73 29 29 0a 09 09 09 20  te-status)).... 
aaa0: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
aab0: 64 62 3a 74 65 73 74 2d 73 65 74 2d 73 74 61 74  db:test-set-stat
aac0: 65 2d 73 74 61 74 75 73 2d 62 79 2d 69 64 20 64  e-status-by-id d
aad0: 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  b (db:test-get-i
aae0: 64 20 74 65 73 74 29 20 28 63 61 72 20 73 74 61  d test) (car sta
aaf0: 74 65 2d 73 74 61 74 75 73 29 28 63 61 64 72 20  te-status)(cadr 
ab00: 73 74 61 74 65 2d 73 74 61 74 75 73 29 20 23 66  state-status) #f
ab10: 29 29 29 29 29 0a 09 09 20 20 28 73 6f 72 74 20  )))))...  (sort 
ab20: 74 65 73 74 73 20 28 6c 61 6d 62 64 61 20 28 61  tests (lambda (a
ab30: 20 62 29 28 6c 65 74 20 28 28 64 69 72 61 20 28   b)(let ((dira (
ab40: 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 64  db:test-get-rund
ab50: 69 72 20 61 29 29 0a 09 09 09 09 09 09 20 28 64  ir a))....... (d
ab60: 69 72 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74  irb (db:test-get
ab70: 2d 72 75 6e 64 69 72 20 62 29 29 29 0a 09 09 09  -rundir b)))....
ab80: 09 09 20 20 20 20 20 28 69 66 20 28 61 6e 64 20  ..     (if (and 
ab90: 28 73 74 72 69 6e 67 3f 20 64 69 72 61 29 28 73  (string? dira)(s
aba0: 74 72 69 6e 67 3f 20 64 69 72 62 29 29 0a 09 09  tring? dirb))...
abb0: 09 09 09 09 20 28 3e 20 28 73 74 72 69 6e 67 2d  .... (> (string-
abc0: 6c 65 6e 67 74 68 20 64 69 72 61 29 28 73 74 72  length dira)(str
abd0: 69 6e 67 2d 6c 65 6e 67 74 68 20 64 69 72 62 29  ing-length dirb)
abe0: 29 0a 09 09 09 09 09 09 20 23 66 29 29 29 29 29  )....... #f)))))
abf0: 29 29 0a 09 20 20 20 3b 3b 20 72 65 6d 6f 76 65  ))..   ;; remove
ac00: 20 74 68 65 20 72 75 6e 20 69 66 20 7a 65 72 6f   the run if zero
ac10: 20 74 65 73 74 73 20 72 65 6d 61 69 6e 0a 09 20   tests remain.. 
ac20: 20 20 28 69 66 20 28 65 71 3f 20 61 63 74 69 6f    (if (eq? actio
ac30: 6e 20 27 72 65 6d 6f 76 65 2d 72 75 6e 73 29 0a  n 'remove-runs).
ac40: 09 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 72  .       (let ((r
ac50: 65 6d 74 65 73 74 73 20 28 6f 70 65 6e 2d 72 75  emtests (open-ru
ac60: 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74  n-close db:get-t
ac70: 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20  ests-for-run db 
ac80: 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79  (db:get-value-by
ac90: 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64  -header run head
aca0: 65 72 20 22 69 64 22 29 20 23 66 20 27 28 22 44  er "id") #f '("D
acb0: 45 4c 45 54 45 44 22 29 20 27 28 22 6e 2f 61 22  ELETED") '("n/a"
acc0: 29 20 6e 6f 74 2d 69 6e 3a 20 23 74 29 29 29 0a  ) not-in: #t))).
acd0: 09 09 20 28 69 66 20 28 6e 75 6c 6c 3f 20 72 65  .. (if (null? re
ace0: 6d 74 65 73 74 73 29 20 3b 3b 20 6e 6f 20 6d 6f  mtests) ;; no mo
acf0: 72 65 20 74 65 73 74 73 20 72 65 6d 61 69 6e 69  re tests remaini
ad00: 6e 67 0a 09 09 20 20 20 20 20 28 6c 65 74 2a 20  ng...     (let* 
ad10: 28 28 64 70 61 72 74 73 20 20 28 73 74 72 69 6e  ((dparts  (strin
ad20: 67 2d 73 70 6c 69 74 20 6c 61 73 74 74 70 61 74  g-split lasttpat
ad30: 68 20 22 2f 22 29 29 0a 09 09 09 20 20 20 20 28  h "/"))....    (
ad40: 72 75 6e 70 61 74 68 20 28 63 6f 6e 63 20 22 2f  runpath (conc "/
ad50: 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73  " (string-inters
ad60: 70 65 72 73 65 20 0a 09 09 09 09 09 09 28 74 61  perse .......(ta
ad70: 6b 65 20 64 70 61 72 74 73 20 28 2d 20 28 6c 65  ke dparts (- (le
ad80: 6e 67 74 68 20 64 70 61 72 74 73 29 20 31 29 29  ngth dparts) 1))
ad90: 0a 09 09 09 09 09 09 22 2f 22 29 29 29 29 0a 09  ......."/"))))..
ada0: 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70  .       (debug:p
adb0: 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67  rint 1 "Removing
adc0: 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22   run: " runkey "
add0: 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65   " (db:get-value
ade0: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68  -by-header run h
adf0: 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29  eader "runname")
ae00: 20 22 20 61 6e 64 20 72 65 6c 61 74 65 64 20 72   " and related r
ae10: 65 63 6f 72 64 22 29 0a 09 09 20 20 20 20 20 20  ecord")...      
ae20: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
ae30: 20 64 62 3a 64 65 6c 65 74 65 2d 72 75 6e 20 64   db:delete-run d
ae40: 62 20 72 75 6e 2d 69 64 29 0a 09 09 20 20 20 20  b run-id)...    
ae50: 20 20 20 3b 3b 20 54 68 69 73 20 69 73 20 61 20     ;; This is a 
ae60: 70 72 65 74 74 79 20 67 6f 6f 64 20 70 6c 61 63  pretty good plac
ae70: 65 20 74 6f 20 70 75 72 67 65 20 6f 6c 64 20 44  e to purge old D
ae80: 45 4c 45 54 45 44 20 74 65 73 74 73 0a 09 09 20  ELETED tests... 
ae90: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d        (open-run-
aea0: 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 2d  close db:delete-
aeb0: 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62  tests-for-run db
aec0: 20 72 75 6e 2d 69 64 29 0a 09 09 20 20 20 20 20   run-id)...     
aed0: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73    (open-run-clos
aee0: 65 20 64 62 3a 64 65 6c 65 74 65 2d 6f 6c 64 2d  e db:delete-old-
aef0: 64 65 6c 65 74 65 64 2d 74 65 73 74 2d 72 65 63  deleted-test-rec
af00: 6f 72 64 73 20 64 62 29 0a 09 09 20 20 20 20 20  ords db)...     
af10: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73    (open-run-clos
af20: 65 20 64 62 3a 73 65 74 2d 76 61 72 20 64 62 20  e db:set-var db 
af30: 22 44 45 4c 45 54 45 44 5f 54 45 53 54 53 22 20  "DELETED_TESTS" 
af40: 28 63 75 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73  (current-seconds
af50: 29 29 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 6e  ))...       ;; n
af60: 65 65 64 20 74 6f 20 66 69 67 75 72 65 20 6f 75  eed to figure ou
af70: 74 20 74 68 65 20 70 61 74 68 20 74 6f 20 74 68  t the path to th
af80: 65 20 72 75 6e 20 64 69 72 20 61 6e 64 20 72 65  e run dir and re
af90: 6d 6f 76 65 20 69 74 20 69 66 20 65 6d 70 74 79  move it if empty
afa0: 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 20 20 20  ...       ;;    
afb0: 28 69 66 20 28 6e 75 6c 6c 3f 20 28 67 6c 6f 62  (if (null? (glob
afc0: 20 28 63 6f 6e 63 20 72 75 6e 70 61 74 68 20 22   (conc runpath "
afd0: 2f 2a 22 29 29 29 0a 09 09 20 20 20 20 20 20 20  /*")))...       
afe0: 3b 3b 20 20 20 20 20 20 20 20 28 62 65 67 69 6e  ;;        (begin
aff0: 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 09 20 28  ...       ;; . (
b000: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52  debug:print 1 "R
b010: 65 6d 6f 76 69 6e 67 20 72 75 6e 20 64 69 72 20  emoving run dir 
b020: 22 20 72 75 6e 70 61 74 68 29 0a 09 09 20 20 20  " runpath)...   
b030: 20 20 20 20 3b 3b 20 09 20 28 73 79 73 74 65 6d      ;; . (system
b040: 20 28 63 6f 6e 63 20 22 72 6d 64 69 72 20 2d 70   (conc "rmdir -p
b050: 20 22 20 72 75 6e 70 61 74 68 29 29 29 29 0a 09   " runpath))))..
b060: 09 20 20 20 20 20 20 20 29 29 29 29 29 0a 09 20  .       ))))).. 
b070: 29 29 0a 20 20 20 20 20 72 75 6e 73 29 29 0a 20  )).     runs)). 
b080: 20 23 74 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d   #t)..;;========
b090: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b0a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b0b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b0c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b  ==============.;
b0d0: 3b 20 52 6f 75 74 69 6e 65 73 20 66 6f 72 20 6d  ; Routines for m
b0e0: 61 6e 69 70 75 6c 61 74 69 6e 67 20 72 75 6e 73  anipulating runs
b0f0: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  .;;=============
b100: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b110: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b120: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b130: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 53 69  =========..;; Si
b140: 6e 63 65 20 6d 61 6e 79 20 63 61 6c 6c 73 20 74  nce many calls t
b150: 6f 20 61 20 72 75 6e 20 72 65 71 75 69 72 65 20  o a run require 
b160: 70 72 65 74 74 79 20 6d 75 63 68 20 74 68 65 20  pretty much the 
b170: 73 61 6d 65 20 73 65 74 75 70 20 0a 3b 3b 20 74  same setup .;; t
b180: 68 69 73 20 77 72 61 70 70 65 72 20 69 73 20 75  his wrapper is u
b190: 73 65 64 20 74 6f 20 72 65 64 75 63 65 20 74 68  sed to reduce th
b1a0: 65 20 72 65 70 6c 69 63 61 74 69 6f 6e 20 6f 66  e replication of
b1b0: 20 63 6f 64 65 0a 28 64 65 66 69 6e 65 20 28 67   code.(define (g
b1c0: 65 6e 65 72 61 6c 2d 72 75 6e 2d 63 61 6c 6c 20  eneral-run-call 
b1d0: 73 77 69 74 63 68 6e 61 6d 65 20 61 63 74 69 6f  switchname actio
b1e0: 6e 2d 64 65 73 63 20 70 72 6f 63 29 0a 20 20 28  n-desc proc).  (
b1f0: 6c 65 74 20 28 28 72 75 6e 6e 61 6d 65 20 28 61  let ((runname (a
b200: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 3a 72 75  rgs:get-arg ":ru
b210: 6e 6e 61 6d 65 22 29 29 0a 09 28 74 61 72 67 65  nname"))..(targe
b220: 74 20 20 28 69 66 20 28 61 72 67 73 3a 67 65 74  t  (if (args:get
b230: 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 29 0a  -arg "-target").
b240: 09 09 20 20 20 20 20 28 61 72 67 73 3a 67 65 74  ..     (args:get
b250: 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 29 0a  -arg "-target").
b260: 09 09 20 20 20 20 20 28 61 72 67 73 3a 67 65 74  ..     (args:get
b270: 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29  -arg "-reqtarg")
b280: 29 29 0a 09 28 74 68 31 20 20 20 20 20 23 66 29  ))..(th1     #f)
b290: 29 0a 20 20 20 20 28 63 6f 6e 64 0a 20 20 20 20  ).    (cond.    
b2a0: 20 28 28 6e 6f 74 20 74 61 72 67 65 74 29 0a 20   ((not target). 
b2b0: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
b2c0: 74 20 30 20 22 45 52 52 4f 52 3a 20 4d 69 73 73  t 0 "ERROR: Miss
b2d0: 69 6e 67 20 72 65 71 75 69 72 65 64 20 70 61 72  ing required par
b2e0: 61 6d 65 74 65 72 20 66 6f 72 20 22 20 73 77 69  ameter for " swi
b2f0: 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d  tchname ", you m
b300: 75 73 74 20 73 70 65 63 69 66 79 20 74 68 65 20  ust specify the 
b310: 74 61 72 67 65 74 20 77 69 74 68 20 2d 74 61 72  target with -tar
b320: 67 65 74 22 29 0a 20 20 20 20 20 20 28 65 78 69  get").      (exi
b330: 74 20 33 29 29 0a 20 20 20 20 20 28 28 6e 6f 74  t 3)).     ((not
b340: 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20 20 20   runname).      
b350: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
b360: 45 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67 20 72  ERROR: Missing r
b370: 65 71 75 69 72 65 64 20 70 61 72 61 6d 65 74 65  equired paramete
b380: 72 20 66 6f 72 20 22 20 73 77 69 74 63 68 6e 61  r for " switchna
b390: 6d 65 20 22 2c 20 79 6f 75 20 6d 75 73 74 20 73  me ", you must s
b3a0: 70 65 63 69 66 79 20 74 68 65 20 72 75 6e 20 6e  pecify the run n
b3b0: 61 6d 65 20 77 69 74 68 20 3a 72 75 6e 6e 61 6d  ame with :runnam
b3c0: 65 20 72 75 6e 6e 61 6d 65 22 29 0a 20 20 20 20  e runname").    
b3d0: 20 20 28 65 78 69 74 20 33 29 29 0a 20 20 20 20    (exit 3)).    
b3e0: 20 28 65 6c 73 65 0a 20 20 20 20 20 20 28 6c 65   (else.      (le
b3f0: 74 20 28 28 64 62 20 20 20 23 66 29 0a 09 20 20  t ((db   #f)..  
b400: 20 20 28 6b 65 79 73 20 23 66 29 29 0a 09 28 69    (keys #f))..(i
b410: 66 20 28 6e 6f 74 20 28 73 65 74 75 70 2d 66 6f  f (not (setup-fo
b420: 72 2d 72 75 6e 29 29 0a 09 20 20 20 20 28 62 65  r-run))..    (be
b430: 67 69 6e 20 0a 09 20 20 20 20 20 20 28 64 65 62  gin ..      (deb
b440: 75 67 3a 70 72 69 6e 74 20 30 20 22 46 61 69 6c  ug:print 0 "Fail
b450: 65 64 20 74 6f 20 73 65 74 75 70 2c 20 65 78 69  ed to setup, exi
b460: 74 69 6e 67 22 29 0a 09 20 20 20 20 20 20 28 65  ting")..      (e
b470: 78 69 74 20 31 29 29 29 0a 09 28 69 66 20 28 61  xit 1)))..(if (a
b480: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 73 65  rgs:get-arg "-se
b490: 72 76 65 72 22 29 0a 09 20 20 20 20 28 6f 70 65  rver")..    (ope
b4a0: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 73 65 72 76  n-run-close serv
b4b0: 65 72 3a 73 74 61 72 74 20 64 62 20 28 61 72 67  er:start db (arg
b4c0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 73 65 72 76  s:get-arg "-serv
b4d0: 65 72 22 29 29 29 0a 20 09 20 20 20 20 3b 3b 20  er"))). .    ;; 
b4e0: 28 69 66 20 28 6e 6f 74 20 28 6f 72 20 28 61 72  (if (not (or (ar
b4f0: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 75 6e  gs:get-arg "-run
b500: 61 6c 6c 22 29 20 20 20 20 20 3b 3b 20 72 75 6e  all")     ;; run
b510: 61 6c 6c 20 61 6e 64 20 72 75 6e 74 65 73 74 73  all and runtests
b520: 20 61 72 65 20 61 6c 6c 6f 77 65 64 20 74 6f 20   are allowed to 
b530: 62 65 20 73 65 72 76 65 72 73 0a 20 09 20 20 20  be servers. .   
b540: 20 3b 3b 20 20 20 20 20 09 20 28 61 72 67 73 3a   ;;     . (args:
b550: 67 65 74 2d 61 72 67 20 22 2d 72 75 6e 74 65 73  get-arg "-runtes
b560: 74 73 22 29 29 29 0a 09 20 20 20 20 3b 3b 20 20  ts")))..    ;;  
b570: 20 20 20 28 63 6c 69 65 6e 74 3a 73 65 74 75 70     (client:setup
b580: 29 20 3b 3b 20 54 68 69 73 20 69 73 20 61 20 64  ) ;; This is a d
b590: 75 70 6c 69 63 61 74 65 20 73 74 61 72 74 75 70  uplicate startup
b5a0: 21 21 21 3f 3f 3f 20 42 55 47 3f 0a 09 20 20 20  !!!??? BUG?..   
b5b0: 20 3b 3b 20 20 20 20 20 29 29 0a 09 28 73 65 74   ;;     ))..(set
b5c0: 21 20 6b 65 79 73 20 28 6f 70 65 6e 2d 72 75 6e  ! keys (open-run
b5d0: 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 6b 65  -close db:get-ke
b5e0: 79 73 20 64 62 29 29 0a 09 3b 3b 20 68 61 76 65  ys db))..;; have
b5f0: 20 65 6e 6f 75 67 68 20 74 6f 20 70 72 6f 63 65   enough to proce
b600: 73 73 20 2d 74 61 72 67 65 74 20 6f 72 20 2d 72  ss -target or -r
b610: 65 71 74 61 72 67 20 68 65 72 65 0a 09 28 69 66  eqtarg here..(if
b620: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
b630: 2d 72 65 71 74 61 72 67 22 29 0a 09 20 20 20 20  -reqtarg")..    
b640: 28 6c 65 74 2a 20 28 28 72 75 6e 63 6f 6e 66 69  (let* ((runconfi
b650: 67 66 20 28 63 6f 6e 63 20 20 2a 74 6f 70 70 61  gf (conc  *toppa
b660: 74 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 69 67 73  th* "/runconfigs
b670: 2e 63 6f 6e 66 69 67 22 29 29 20 3b 3b 20 44 4f  .config")) ;; DO
b680: 20 4e 4f 54 20 45 56 41 4c 55 41 54 45 20 41 4c   NOT EVALUATE AL
b690: 4c 20 0a 09 09 20 20 20 28 72 75 6e 63 6f 6e 66  L ...   (runconf
b6a0: 69 67 20 20 28 72 65 61 64 2d 63 6f 6e 66 69 67  ig  (read-config
b6b0: 20 72 75 6e 63 6f 6e 66 69 67 66 20 23 66 20 23   runconfigf #f #
b6c0: 74 20 65 6e 76 69 72 6f 6e 2d 70 61 74 74 3a 20  t environ-patt: 
b6d0: 23 66 29 29 29 20 0a 09 20 20 20 20 20 20 28 69  #f))) ..      (i
b6e0: 66 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65  f (hash-table-re
b6f0: 66 2f 64 65 66 61 75 6c 74 20 72 75 6e 63 6f 6e  f/default runcon
b700: 66 69 67 20 28 61 72 67 73 3a 67 65 74 2d 61 72  fig (args:get-ar
b710: 67 20 22 2d 72 65 71 74 61 72 67 22 29 20 23 66  g "-reqtarg") #f
b720: 29 0a 09 09 20 20 28 6b 65 79 73 3a 74 61 72 67  )...  (keys:targ
b730: 65 74 2d 73 65 74 2d 61 72 67 73 20 6b 65 79 73  et-set-args keys
b740: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
b750: 2d 72 65 71 74 61 72 67 22 29 20 61 72 67 73 3a  -reqtarg") args:
b760: 61 72 67 2d 68 61 73 68 29 0a 09 09 20 20 28 62  arg-hash)...  (b
b770: 65 67 69 6e 0a 09 09 20 20 20 20 28 64 65 62 75  egin...    (debu
b780: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52  g:print 0 "ERROR
b790: 3a 20 5b 22 20 28 61 72 67 73 3a 67 65 74 2d 61  : [" (args:get-a
b7a0: 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 20 22  rg "-reqtarg") "
b7b0: 5d 20 6e 6f 74 20 66 6f 75 6e 64 20 69 6e 20 22  ] not found in "
b7c0: 20 72 75 6e 63 6f 6e 66 69 67 66 29 0a 09 09 20   runconfigf)... 
b7d0: 20 20 20 28 69 66 20 64 62 20 28 73 71 6c 69 74     (if db (sqlit
b7e0: 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 29  e3:finalize! db)
b7f0: 29 0a 09 09 20 20 20 20 28 65 78 69 74 20 31 29  )...    (exit 1)
b800: 29 29 29 0a 09 20 20 20 20 28 69 66 20 28 61 72  )))..    (if (ar
b810: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72  gs:get-arg "-tar
b820: 67 65 74 22 29 0a 09 09 28 6b 65 79 73 3a 74 61  get")...(keys:ta
b830: 72 67 65 74 2d 73 65 74 2d 61 72 67 73 20 6b 65  rget-set-args ke
b840: 79 73 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  ys (args:get-arg
b850: 20 22 2d 74 61 72 67 65 74 22 20 61 72 67 73 3a   "-target" args:
b860: 61 72 67 2d 68 61 73 68 29 20 61 72 67 73 3a 61  arg-hash) args:a
b870: 72 67 2d 68 61 73 68 29 29 29 0a 09 28 69 66 20  rg-hash)))..(if 
b880: 28 6e 6f 74 20 28 63 61 72 20 2a 63 6f 6e 66 69  (not (car *confi
b890: 67 69 6e 66 6f 2a 29 29 0a 09 20 20 20 20 28 62  ginfo*))..    (b
b8a0: 65 67 69 6e 0a 09 20 20 20 20 20 20 28 64 65 62  egin..      (deb
b8b0: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f  ug:print 0 "ERRO
b8c0: 52 3a 20 41 74 74 65 6d 70 74 65 64 20 74 6f 20  R: Attempted to 
b8d0: 22 20 61 63 74 69 6f 6e 2d 64 65 73 63 20 22 20  " action-desc " 
b8e0: 62 75 74 20 72 75 6e 20 61 72 65 61 20 63 6f 6e  but run area con
b8f0: 66 69 67 20 66 69 6c 65 20 6e 6f 74 20 66 6f 75  fig file not fou
b900: 6e 64 22 29 0a 09 20 20 20 20 20 20 28 65 78 69  nd")..      (exi
b910: 74 20 31 29 29 0a 09 20 20 20 20 3b 3b 20 45 78  t 1))..    ;; Ex
b920: 74 72 61 63 74 20 6f 75 74 20 73 74 75 66 66 20  tract out stuff 
b930: 6e 65 65 64 65 64 20 69 6e 20 6d 6f 73 74 20 6f  needed in most o
b940: 72 20 6d 61 6e 79 20 63 61 6c 6c 73 0a 09 20 20  r many calls..  
b950: 20 20 3b 3b 20 68 65 72 65 20 74 68 65 6e 20 63    ;; here then c
b960: 61 6c 6c 20 70 72 6f 63 0a 09 20 20 20 20 28 6c  all proc..    (l
b970: 65 74 2a 20 28 28 6b 65 79 6e 61 6d 65 73 20 20  et* ((keynames  
b980: 20 28 6d 61 70 20 6b 65 79 3a 67 65 74 2d 66 69   (map key:get-fi
b990: 65 6c 64 6e 61 6d 65 20 6b 65 79 73 29 29 0a 09  eldname keys))..
b9a0: 09 20 20 20 28 6b 65 79 76 61 6c 6c 73 74 20 20  .   (keyvallst  
b9b0: 28 6b 65 79 73 2d 3e 76 61 6c 6c 69 73 74 20 6b  (keys->vallist k
b9c0: 65 79 73 20 23 74 29 29 29 0a 09 20 20 20 20 20  eys #t)))..     
b9d0: 20 28 70 72 6f 63 20 74 61 72 67 65 74 20 72 75   (proc target ru
b9e0: 6e 6e 61 6d 65 20 6b 65 79 73 20 6b 65 79 6e 61  nname keys keyna
b9f0: 6d 65 73 20 6b 65 79 76 61 6c 6c 73 74 29 29 29  mes keyvallst)))
ba00: 0a 09 28 69 66 20 74 68 31 20 28 74 68 72 65 61  ..(if th1 (threa
ba10: 64 2d 6a 6f 69 6e 21 20 74 68 31 29 29 0a 09 28  d-join! th1))..(
ba20: 69 66 20 64 62 20 28 73 71 6c 69 74 65 33 3a 66  if db (sqlite3:f
ba30: 69 6e 61 6c 69 7a 65 21 20 64 62 29 29 0a 09 28  inalize! db))..(
ba40: 73 65 74 21 20 2a 64 69 64 73 6f 6d 65 74 68 69  set! *didsomethi
ba50: 6e 67 2a 20 23 74 29 29 29 29 29 29 0a 0a 3b 3b  ng* #t))))))..;;
ba60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
ba70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
ba80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
ba90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
baa0: 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4c 6f 63 6b 2f 75  ======.;; Lock/u
bab0: 6e 6c 6f 63 6b 20 72 75 6e 73 0a 3b 3b 3d 3d 3d  nlock runs.;;===
bac0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
bad0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
bae0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
baf0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
bb00: 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65 20 28 72 75  ===..(define (ru
bb10: 6e 73 3a 68 61 6e 64 6c 65 2d 6c 6f 63 6b 69 6e  ns:handle-lockin
bb20: 67 20 74 61 72 67 65 74 20 6b 65 79 73 20 72 75  g target keys ru
bb30: 6e 6e 61 6d 65 20 6c 6f 63 6b 20 75 6e 6c 6f 63  nname lock unloc
bb40: 6b 20 75 73 65 72 29 0a 20 20 28 6c 65 74 2a 20  k user).  (let* 
bb50: 28 28 64 62 20 20 20 20 20 20 20 23 66 29 0a 09  ((db       #f)..
bb60: 20 28 72 75 6e 64 61 74 20 20 20 28 6f 70 65 6e   (rundat   (open
bb70: 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 3a  -run-close runs:
bb80: 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74 74  get-runs-by-patt
bb90: 20 64 62 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65   db keys runname
bba0: 29 29 0a 09 20 28 68 65 61 64 65 72 20 20 20 28  )).. (header   (
bbb0: 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61  vector-ref runda
bbc0: 74 20 30 29 29 0a 09 20 28 72 75 6e 73 20 20 20  t 0)).. (runs   
bbd0: 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75    (vector-ref ru
bbe0: 6e 64 61 74 20 31 29 29 29 0a 20 20 20 20 28 66  ndat 1))).    (f
bbf0: 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 61 20  or-each (lambda 
bc00: 28 72 75 6e 29 0a 09 09 28 6c 65 74 20 28 28 72  (run)...(let ((r
bc10: 75 6e 2d 69 64 20 28 64 62 3a 67 65 74 2d 76 61  un-id (db:get-va
bc20: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75  lue-by-header ru
bc30: 6e 20 68 65 61 64 65 72 20 22 69 64 22 29 29 29  n header "id")))
bc40: 0a 09 09 20 20 28 69 66 20 28 6f 72 20 6c 6f 63  ...  (if (or loc
bc50: 6b 0a 09 09 09 20 20 28 61 6e 64 20 75 6e 6c 6f  k....  (and unlo
bc60: 63 6b 0a 09 09 09 20 20 20 20 20 20 20 28 62 65  ck....       (be
bc70: 67 69 6e 0a 09 09 09 09 20 28 70 72 69 6e 74 20  gin..... (print 
bc80: 22 44 6f 20 79 6f 75 20 72 65 61 6c 6c 79 20 77  "Do you really w
bc90: 69 73 68 20 74 6f 20 75 6e 6c 6f 63 6b 20 72 75  ish to unlock ru
bca0: 6e 20 22 20 72 75 6e 2d 69 64 20 22 3f 5c 6e 20  n " run-id "?\n 
bcb0: 20 20 79 2f 6e 3a 20 22 29 0a 09 09 09 09 20 28    y/n: ")..... (
bcc0: 65 71 75 61 6c 3f 20 22 79 22 20 28 72 65 61 64  equal? "y" (read
bcd0: 2d 6c 69 6e 65 29 29 29 29 29 0a 09 09 20 20 20  -line)))))...   
bce0: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f     (open-run-clo
bcf0: 73 65 20 64 62 3a 6c 6f 63 6b 2f 75 6e 6c 6f 63  se db:lock/unloc
bd00: 6b 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 20  k-run db run-id 
bd10: 6c 6f 63 6b 20 75 6e 6c 6f 63 6b 20 75 73 65 72  lock unlock user
bd20: 29 0a 09 09 20 20 20 20 20 20 28 64 65 62 75 67  )...      (debug
bd30: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 30 20 22 53  :print-info 0 "S
bd40: 6b 69 70 70 69 6e 67 20 6c 6f 63 6b 2f 75 6e 6c  kipping lock/unl
bd50: 6f 63 6b 20 6f 6e 20 22 20 72 75 6e 2d 69 64 29  ock on " run-id)
bd60: 29 29 29 0a 09 20 20 20 20 20 20 72 75 6e 73 29  )))..      runs)
bd70: 29 29 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  )).;;===========
bd80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
bd90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
bda0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
bdb0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52  ===========.;; R
bdc0: 6f 6c 6c 75 70 20 72 75 6e 73 0a 3b 3b 3d 3d 3d  ollup runs.;;===
bdd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
bde0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
bdf0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
be00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
be10: 3d 3d 3d 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74  ===..;; Update t
be20: 68 65 20 74 65 73 74 5f 6d 65 74 61 20 74 61 62  he test_meta tab
be30: 6c 65 20 66 6f 72 20 74 68 69 73 20 74 65 73 74  le for this test
be40: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 75  .(define (runs:u
be50: 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 20  pdate-test_meta 
be60: 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73  db test-name tes
be70: 74 2d 63 6f 6e 66 29 0a 20 20 28 6c 65 74 20 28  t-conf).  (let (
be80: 28 63 75 72 72 72 65 63 6f 72 64 20 28 63 64 62  (currrecord (cdb
be90: 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64 62 3a 74  :remote-run db:t
bea0: 65 73 74 6d 65 74 61 2d 67 65 74 2d 72 65 63 6f  estmeta-get-reco
beb0: 72 64 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 29  rd db test-name)
bec0: 29 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20  )).    (if (not 
bed0: 63 75 72 72 72 65 63 6f 72 64 29 0a 09 28 62 65  currrecord)..(be
bee0: 67 69 6e 0a 09 20 20 28 73 65 74 21 20 63 75 72  gin..  (set! cur
bef0: 72 72 65 63 6f 72 64 20 28 6d 61 6b 65 2d 76 65  rrecord (make-ve
bf00: 63 74 6f 72 20 31 30 20 23 66 29 29 0a 09 20 20  ctor 10 #f))..  
bf10: 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20  (cdb:remote-run 
bf20: 64 62 3a 74 65 73 74 6d 65 74 61 2d 61 64 64 2d  db:testmeta-add-
bf30: 72 65 63 6f 72 64 20 64 62 20 74 65 73 74 2d 6e  record db test-n
bf40: 61 6d 65 29 29 29 0a 20 20 20 20 28 66 6f 72 2d  ame))).    (for-
bf50: 65 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62  each .     (lamb
bf60: 64 61 20 28 6b 65 79 29 0a 20 20 20 20 20 20 20  da (key).       
bf70: 28 6c 65 74 2a 20 28 28 69 64 78 20 28 63 61 64  (let* ((idx (cad
bf80: 72 20 6b 65 79 29 29 0a 09 20 20 20 20 20 20 28  r key))..      (
bf90: 66 6c 64 20 28 63 61 72 20 20 6b 65 79 29 29 0a  fld (car  key)).
bfa0: 09 20 20 20 20 20 20 28 76 61 6c 20 28 63 6f 6e  .      (val (con
bfb0: 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 65 73 74 2d  fig-lookup test-
bfc0: 63 6f 6e 66 20 22 74 65 73 74 5f 6d 65 74 61 22  conf "test_meta"
bfd0: 20 66 6c 64 29 29 29 0a 09 20 3b 3b 20 28 64 65   fld))).. ;; (de
bfe0: 62 75 67 3a 70 72 69 6e 74 20 35 20 22 69 64 78  bug:print 5 "idx
bff0: 3a 20 22 20 69 64 78 20 22 20 66 6c 64 3a 20 22  : " idx " fld: "
c000: 20 66 6c 64 20 22 20 76 61 6c 3a 20 22 20 76 61   fld " val: " va
c010: 6c 29 0a 09 20 28 69 66 20 28 61 6e 64 20 76 61  l).. (if (and va
c020: 6c 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 28  l (not (equal? (
c030: 76 65 63 74 6f 72 2d 72 65 66 20 63 75 72 72 72  vector-ref currr
c040: 65 63 6f 72 64 20 69 64 78 29 20 76 61 6c 29 29  ecord idx) val))
c050: 29 0a 09 20 20 20 20 20 28 62 65 67 69 6e 0a 09  )..     (begin..
c060: 20 20 20 20 20 20 20 28 70 72 69 6e 74 20 22 55         (print "U
c070: 70 64 61 74 69 6e 67 20 22 20 74 65 73 74 2d 6e  pdating " test-n
c080: 61 6d 65 20 22 20 22 20 66 6c 64 20 22 20 74 6f  ame " " fld " to
c090: 20 22 20 76 61 6c 29 0a 09 20 20 20 20 20 20 20   " val)..       
c0a0: 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20  (cdb:remote-run 
c0b0: 64 62 3a 74 65 73 74 6d 65 74 61 2d 75 70 64 61  db:testmeta-upda
c0c0: 74 65 2d 66 69 65 6c 64 20 64 62 20 74 65 73 74  te-field db test
c0d0: 2d 6e 61 6d 65 20 66 6c 64 20 76 61 6c 29 29 29  -name fld val)))
c0e0: 29 29 0a 20 20 20 20 20 27 28 28 22 61 75 74 68  )).     '(("auth
c0f0: 6f 72 22 20 32 29 28 22 6f 77 6e 65 72 22 20 33  or" 2)("owner" 3
c100: 29 28 22 64 65 73 63 72 69 70 74 69 6f 6e 22 20  )("description" 
c110: 34 29 28 22 72 65 76 69 65 77 65 64 22 20 35 29  4)("reviewed" 5)
c120: 28 22 74 61 67 73 22 20 39 29 29 29 29 29 0a 0a  ("tags" 9)))))..
c130: 3b 3b 20 55 70 64 61 74 65 20 74 65 73 74 5f 6d  ;; Update test_m
c140: 65 74 61 20 66 6f 72 20 61 6c 6c 20 74 65 73 74  eta for all test
c150: 73 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a  s.(define (runs:
c160: 75 70 64 61 74 65 2d 61 6c 6c 2d 74 65 73 74 5f  update-all-test_
c170: 6d 65 74 61 20 64 62 29 0a 20 20 28 6c 65 74 20  meta db).  (let 
c180: 28 28 74 65 73 74 2d 6e 61 6d 65 73 20 28 67 65  ((test-names (ge
c190: 74 2d 61 6c 6c 2d 6c 65 67 61 6c 2d 74 65 73 74  t-all-legal-test
c1a0: 73 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61  s))).    (for-ea
c1b0: 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61  ch .     (lambda
c1c0: 20 28 74 65 73 74 2d 6e 61 6d 65 29 0a 20 20 20   (test-name).   
c1d0: 20 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74      (let* ((test
c1e0: 2d 70 61 74 68 20 20 20 20 28 63 6f 6e 63 20 2a  -path    (conc *
c1f0: 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73  toppath* "/tests
c200: 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29 29 0a 09  /" test-name))..
c210: 20 20 20 20 20 20 28 74 65 73 74 2d 63 6f 6e 66        (test-conf
c220: 69 67 66 20 28 63 6f 6e 63 20 74 65 73 74 2d 70  igf (conc test-p
c230: 61 74 68 20 22 2f 74 65 73 74 63 6f 6e 66 69 67  ath "/testconfig
c240: 22 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 74  "))..      (test
c250: 65 78 69 73 74 73 20 20 20 28 61 6e 64 20 28 66  exists   (and (f
c260: 69 6c 65 2d 65 78 69 73 74 73 3f 20 74 65 73 74  ile-exists? test
c270: 2d 63 6f 6e 66 69 67 66 29 28 66 69 6c 65 2d 72  -configf)(file-r
c280: 65 61 64 2d 61 63 63 65 73 73 3f 20 74 65 73 74  ead-access? test
c290: 2d 63 6f 6e 66 69 67 66 29 29 29 0a 09 20 20 20  -configf)))..   
c2a0: 20 20 20 3b 3b 20 72 65 61 64 20 63 6f 6e 66 69     ;; read confi
c2b0: 67 73 20 77 69 74 68 20 74 72 69 63 6b 73 20 74  gs with tricks t
c2c0: 75 72 6e 65 64 20 6f 66 66 20 28 69 2e 65 2e 20  urned off (i.e. 
c2d0: 6e 6f 20 73 79 73 74 65 6d 29 0a 09 20 20 20 20  no system)..    
c2e0: 20 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 20    (test-conf    
c2f0: 28 69 66 20 74 65 73 74 65 78 69 73 74 73 20 28  (if testexists (
c300: 72 65 61 64 2d 63 6f 6e 66 69 67 20 74 65 73 74  read-config test
c310: 2d 63 6f 6e 66 69 67 66 20 23 66 20 23 66 29 28  -configf #f #f)(
c320: 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29  make-hash-table)
c330: 29 29 29 0a 09 20 3b 3b 20 75 73 65 20 74 68 65  ))).. ;; use the
c340: 20 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20   open-run-close 
c350: 69 6e 73 74 65 61 64 20 6f 66 20 70 61 73 73 69  instead of passi
c360: 6e 67 20 69 6e 20 64 62 0a 09 20 28 72 75 6e 73  ng in db.. (runs
c370: 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74  :update-test_met
c380: 61 20 23 66 20 74 65 73 74 2d 6e 61 6d 65 20 74  a #f test-name t
c390: 65 73 74 2d 63 6f 6e 66 29 29 29 0a 20 20 20 20  est-conf))).    
c3a0: 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a 0a   test-names)))..
c3b0: 3b 3b 20 54 68 69 73 20 63 6f 75 6c 64 20 70 72  ;; This could pr
c3c0: 6f 62 61 62 6c 79 20 62 65 20 72 65 66 61 63 74  obably be refact
c3d0: 6f 72 65 64 20 69 6e 74 6f 20 6f 6e 65 20 63 6f  ored into one co
c3e0: 6d 70 6c 65 78 20 71 75 65 72 79 20 2e 2e 2e 0a  mplex query ....
c3f0: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 6f  (define (runs:ro
c400: 6c 6c 75 70 2d 72 75 6e 20 6b 65 79 73 20 6b 65  llup-run keys ke
c410: 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20  yvallst runname 
c420: 75 73 65 72 29 20 3b 3b 20 77 61 73 20 74 61 72  user) ;; was tar
c430: 67 65 74 2c 20 6e 6f 77 20 6b 65 79 76 61 6c 6c  get, now keyvall
c440: 73 74 0a 20 20 28 64 65 62 75 67 3a 70 72 69 6e  st.  (debug:prin
c450: 74 20 34 20 22 72 75 6e 73 3a 72 6f 6c 6c 75 70  t 4 "runs:rollup
c460: 2d 72 75 6e 2c 20 6b 65 79 73 3a 20 22 20 6b 65  -run, keys: " ke
c470: 79 73 20 22 20 6b 65 79 76 61 6c 6c 73 74 3a 20  ys " keyvallst: 
c480: 22 20 6b 65 79 76 61 6c 6c 73 74 20 22 20 3a 72  " keyvallst " :r
c490: 75 6e 6e 61 6d 65 20 22 20 72 75 6e 6e 61 6d 65  unname " runname
c4a0: 20 22 20 75 73 65 72 3a 20 22 20 75 73 65 72 29   " user: " user)
c4b0: 0a 20 20 28 6c 65 74 2a 20 28 28 64 62 20 20 20  .  (let* ((db   
c4c0: 20 20 20 20 20 20 20 20 20 20 20 23 66 29 20 3b             #f) ;
c4d0: 3b 20 28 6b 65 79 76 61 6c 6c 6c 73 74 20 20 20  ; (keyvalllst   
c4e0: 20 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74 2d     (keys:target-
c4f0: 3e 6b 65 79 76 61 6c 20 6b 65 79 73 20 74 61 72  >keyval keys tar
c500: 67 65 74 29 29 0a 09 20 28 6e 65 77 2d 72 75 6e  get)).. (new-run
c510: 2d 69 64 20 20 20 20 20 20 28 63 64 62 3a 72 65  -id      (cdb:re
c520: 6d 6f 74 65 2d 72 75 6e 20 64 62 3a 72 65 67 69  mote-run db:regi
c530: 73 74 65 72 2d 72 75 6e 20 23 66 20 6b 65 79 73  ster-run #f keys
c540: 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61   keyvallst runna
c550: 6d 65 20 22 6e 65 77 22 20 22 6e 2f 61 22 20 75  me "new" "n/a" u
c560: 73 65 72 29 29 0a 09 20 28 70 72 65 76 2d 74 65  ser)).. (prev-te
c570: 73 74 73 20 20 20 20 20 20 28 6f 70 65 6e 2d 72  sts      (open-r
c580: 75 6e 2d 63 6c 6f 73 65 20 74 65 73 74 3a 67 65  un-close test:ge
c590: 74 2d 6d 61 74 63 68 69 6e 67 2d 70 72 65 76 69  t-matching-previ
c5a0: 6f 75 73 2d 74 65 73 74 2d 72 75 6e 2d 72 65 63  ous-test-run-rec
c5b0: 6f 72 64 73 20 64 62 20 6e 65 77 2d 72 75 6e 2d  ords db new-run-
c5c0: 69 64 20 22 25 22 20 22 25 22 29 29 0a 09 20 28  id "%" "%")).. (
c5d0: 63 75 72 72 2d 74 65 73 74 73 20 20 20 20 20 20  curr-tests      
c5e0: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
c5f0: 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72  db:get-tests-for
c600: 2d 72 75 6e 20 64 62 20 6e 65 77 2d 72 75 6e 2d  -run db new-run-
c610: 69 64 20 22 25 2f 25 22 20 27 28 29 20 27 28 29  id "%/%" '() '()
c620: 29 29 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73  )).. (curr-tests
c630: 2d 68 61 73 68 20 28 6d 61 6b 65 2d 68 61 73 68  -hash (make-hash
c640: 2d 74 61 62 6c 65 29 29 29 0a 20 20 20 20 28 6f  -table))).    (o
c650: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62  pen-run-close db
c660: 3a 75 70 64 61 74 65 2d 72 75 6e 2d 65 76 65 6e  :update-run-even
c670: 74 5f 74 69 6d 65 20 64 62 20 6e 65 77 2d 72 75  t_time db new-ru
c680: 6e 2d 69 64 29 0a 20 20 20 20 3b 3b 20 69 6e 64  n-id).    ;; ind
c690: 65 78 20 74 68 65 20 61 6c 72 65 61 64 79 20 73  ex the already s
c6a0: 61 76 65 64 20 74 65 73 74 73 20 62 79 20 74 65  aved tests by te
c6b0: 73 74 6e 61 6d 65 20 61 6e 64 20 69 74 65 6d 64  stname and itemd
c6c0: 61 74 20 69 6e 20 63 75 72 72 2d 74 65 73 74 73  at in curr-tests
c6d0: 2d 68 61 73 68 0a 20 20 20 20 28 66 6f 72 2d 65  -hash.    (for-e
c6e0: 61 63 68 0a 20 20 20 20 20 28 6c 61 6d 62 64 61  ach.     (lambda
c6f0: 20 28 74 65 73 74 64 61 74 29 0a 20 20 20 20 20   (testdat).     
c700: 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 6e 61    (let* ((testna
c710: 6d 65 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74  me  (db:test-get
c720: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 64 61  -testname testda
c730: 74 29 29 0a 09 20 20 20 20 20 20 28 69 74 65 6d  t))..      (item
c740: 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67  -path (db:test-g
c750: 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73  et-item-path tes
c760: 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 66  tdat))..      (f
c770: 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74  ull-name (conc t
c780: 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d  estname "/" item
c790: 2d 70 61 74 68 29 29 29 0a 09 20 28 68 61 73 68  -path))).. (hash
c7a0: 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72 72  -table-set! curr
c7b0: 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c  -tests-hash full
c7c0: 2d 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29 29  -name testdat)))
c7d0: 0a 20 20 20 20 20 63 75 72 72 2d 74 65 73 74 73  .     curr-tests
c7e0: 29 0a 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 4e  ).    ;; NOPE: N
c7f0: 6f 6e 2d 6f 70 74 69 6d 61 6c 20 61 70 70 72 6f  on-optimal appro
c800: 61 63 68 2e 20 54 72 79 20 74 68 69 73 20 69 6e  ach. Try this in
c810: 73 74 65 61 64 2e 0a 20 20 20 20 3b 3b 20 20 20  stead..    ;;   
c820: 31 2e 20 74 65 73 74 73 20 61 72 65 20 72 65 63  1. tests are rec
c830: 65 69 76 65 64 20 69 6e 20 61 20 6c 69 73 74 2c  eived in a list,
c840: 20 6d 6f 73 74 20 72 65 63 65 6e 74 20 66 69 72   most recent fir
c850: 73 74 0a 20 20 20 20 3b 3b 20 20 20 32 2e 20 72  st.    ;;   2. r
c860: 65 70 6c 61 63 65 20 74 68 65 20 72 6f 6c 6c 75  eplace the rollu
c870: 70 20 74 65 73 74 20 77 69 74 68 20 74 68 65 20  p test with the 
c880: 6e 65 77 20 2a 61 6c 77 61 79 73 2a 0a 20 20 20  new *always*.   
c890: 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20   (for-each .    
c8a0: 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 64 61   (lambda (testda
c8b0: 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20  t).       (let* 
c8c0: 28 28 74 65 73 74 6e 61 6d 65 20 20 28 64 62 3a  ((testname  (db:
c8d0: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d  test-get-testnam
c8e0: 65 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20  e testdat))..   
c8f0: 20 20 20 28 69 74 65 6d 2d 70 61 74 68 20 28 64     (item-path (d
c900: 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d  b:test-get-item-
c910: 70 61 74 68 20 74 65 73 74 64 61 74 29 29 0a 09  path testdat))..
c920: 20 20 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65        (full-name
c930: 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20   (conc testname 
c940: 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 0a  "/" item-path)).
c950: 09 20 20 20 20 20 20 28 70 72 65 76 2d 74 65 73  .      (prev-tes
c960: 74 2d 64 61 74 20 28 68 61 73 68 2d 74 61 62 6c  t-dat (hash-tabl
c970: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63 75  e-ref/default cu
c980: 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75  rr-tests-hash fu
c990: 6c 6c 2d 6e 61 6d 65 20 23 66 29 29 0a 09 20 20  ll-name #f))..  
c9a0: 20 20 20 20 28 74 65 73 74 2d 73 74 65 70 73 20      (test-steps 
c9b0: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
c9c0: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 73 74 65 70  lose db:get-step
c9d0: 73 2d 66 6f 72 2d 74 65 73 74 20 64 62 20 28 64  s-for-test db (d
c9e0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65  b:test-get-id te
c9f0: 73 74 64 61 74 29 29 29 0a 09 20 20 20 20 20 20  stdat)))..      
ca00: 28 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64  (new-test-record
ca10: 20 23 66 29 29 0a 09 20 3b 3b 20 72 65 70 6c 61   #f)).. ;; repla
ca20: 63 65 20 74 68 65 73 65 20 77 69 74 68 20 69 6e  ce these with in
ca30: 73 65 72 74 20 2e 2e 2e 20 73 65 6c 65 63 74 0a  sert ... select.
ca40: 09 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 33  . (apply sqlite3
ca50: 3a 65 78 65 63 75 74 65 20 0a 09 09 64 62 20 0a  :execute ...db .
ca60: 09 09 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20  ..(conc "INSERT 
ca70: 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20  OR REPLACE INTO 
ca80: 74 65 73 74 73 20 28 72 75 6e 5f 69 64 2c 74 65  tests (run_id,te
ca90: 73 74 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61  stname,state,sta
caa0: 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 68  tus,event_time,h
cab0: 6f 73 74 2c 63 70 75 6c 6f 61 64 2c 64 69 73 6b  ost,cpuload,disk
cac0: 66 72 65 65 2c 75 6e 61 6d 65 2c 72 75 6e 64 69  free,uname,rundi
cad0: 72 2c 69 74 65 6d 5f 70 61 74 68 2c 72 75 6e 5f  r,item_path,run_
cae0: 64 75 72 61 74 69 6f 6e 2c 66 69 6e 61 6c 5f 6c  duration,final_l
caf0: 6f 67 66 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09  ogf,comment) "..
cb00: 09 20 20 20 20 20 20 22 56 41 4c 55 45 53 20 28  .      "VALUES (
cb10: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c  ?,?,?,?,?,?,?,?,
cb20: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 29 3b 22 29 0a  ?,?,?,?,?,?);").
cb30: 09 09 6e 65 77 2d 72 75 6e 2d 69 64 20 28 63 64  ..new-run-id (cd
cb40: 64 72 20 28 76 65 63 74 6f 72 2d 3e 6c 69 73 74  dr (vector->list
cb50: 20 74 65 73 74 64 61 74 29 29 29 0a 09 20 28 73   testdat))).. (s
cb60: 65 74 21 20 6e 65 77 2d 74 65 73 74 64 61 74 20  et! new-testdat 
cb70: 28 63 61 72 20 28 6f 70 65 6e 2d 72 75 6e 2d 63  (car (open-run-c
cb80: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74  lose db:get-test
cb90: 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77  s-for-run db new
cba0: 2d 72 75 6e 2d 69 64 20 28 63 6f 6e 63 20 74 65  -run-id (conc te
cbb0: 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d  stname "/" item-
cbc0: 70 61 74 68 29 20 27 28 29 20 27 28 29 29 29 29  path) '() '())))
cbd0: 0a 09 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73  .. (hash-table-s
cbe0: 65 74 21 20 63 75 72 72 2d 74 65 73 74 73 2d 68  et! curr-tests-h
cbf0: 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 6e 65  ash full-name ne
cc00: 77 2d 74 65 73 74 64 61 74 29 20 3b 3b 20 74 68  w-testdat) ;; th
cc10: 69 73 20 63 6f 75 6c 64 20 62 65 20 63 6f 6e 66  is could be conf
cc20: 75 73 69 6e 67 2c 20 77 68 69 63 68 20 72 65 63  using, which rec
cc30: 6f 72 64 20 73 68 6f 75 6c 64 20 67 6f 20 69 6e  ord should go in
cc40: 74 6f 20 74 68 65 20 6c 6f 6f 6b 75 70 20 74 61  to the lookup ta
cc50: 62 6c 65 3f 0a 09 20 3b 3b 20 4e 6f 77 20 64 75  ble?.. ;; Now du
cc60: 70 6c 69 63 61 74 65 20 74 68 65 20 74 65 73 74  plicate the test
cc70: 20 73 74 65 70 73 0a 09 20 28 64 65 62 75 67 3a   steps.. (debug:
cc80: 70 72 69 6e 74 20 34 20 22 43 6f 70 79 69 6e 67  print 4 "Copying
cc90: 20 72 65 63 6f 72 64 73 20 69 6e 20 74 65 73 74   records in test
cca0: 5f 73 74 65 70 73 20 66 72 6f 6d 20 74 65 73 74  _steps from test
ccb0: 5f 69 64 3d 22 20 28 64 62 3a 74 65 73 74 2d 67  _id=" (db:test-g
ccc0: 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 20 22  et-id testdat) "
ccd0: 20 74 6f 20 22 20 28 64 62 3a 74 65 73 74 2d 67   to " (db:test-g
cce0: 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61  et-id new-testda
ccf0: 74 29 29 0a 09 20 28 6f 70 65 6e 2d 72 75 6e 2d  t)).. (open-run-
cd00: 63 6c 6f 73 65 20 0a 09 20 20 28 6c 61 6d 62 64  close ..  (lambd
cd10: 61 20 28 29 0a 09 20 20 20 20 28 73 71 6c 69 74  a ()..    (sqlit
cd20: 65 33 3a 65 78 65 63 75 74 65 20 0a 09 20 20 20  e3:execute ..   
cd30: 20 20 64 62 20 0a 09 20 20 20 20 20 28 63 6f 6e    db ..     (con
cd40: 63 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50  c "INSERT OR REP
cd50: 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 74 5f 73  LACE INTO test_s
cd60: 74 65 70 73 20 28 74 65 73 74 5f 69 64 2c 73 74  teps (test_id,st
cd70: 65 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61  epname,state,sta
cd80: 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63  tus,event_time,c
cd90: 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 22  omment) "...   "
cda0: 53 45 4c 45 43 54 20 22 20 28 64 62 3a 74 65 73  SELECT " (db:tes
cdb0: 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73  t-get-id new-tes
cdc0: 74 64 61 74 29 20 22 2c 73 74 65 70 6e 61 6d 65  tdat) ",stepname
cdd0: 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c 65 76  ,state,status,ev
cde0: 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74  ent_time,comment
cdf0: 20 46 52 4f 4d 20 74 65 73 74 5f 73 74 65 70 73   FROM test_steps
ce00: 20 57 48 45 52 45 20 74 65 73 74 5f 69 64 3d 3f   WHERE test_id=?
ce10: 3b 22 29 0a 09 20 20 20 20 20 28 64 62 3a 74 65  ;")..     (db:te
ce20: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61  st-get-id testda
ce30: 74 29 29 0a 09 20 20 20 20 3b 3b 20 4e 6f 77 20  t))..    ;; Now 
ce40: 64 75 70 6c 69 63 61 74 65 20 74 68 65 20 74 65  duplicate the te
ce50: 73 74 20 64 61 74 61 0a 09 20 20 20 20 28 64 65  st data..    (de
ce60: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 43 6f 70  bug:print 4 "Cop
ce70: 79 69 6e 67 20 72 65 63 6f 72 64 73 20 69 6e 20  ying records in 
ce80: 74 65 73 74 5f 64 61 74 61 20 66 72 6f 6d 20 74  test_data from t
ce90: 65 73 74 5f 69 64 3d 22 20 28 64 62 3a 74 65 73  est_id=" (db:tes
cea0: 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 74  t-get-id testdat
ceb0: 29 20 22 20 74 6f 20 22 20 28 64 62 3a 74 65 73  ) " to " (db:tes
cec0: 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73  t-get-id new-tes
ced0: 74 64 61 74 29 29 0a 09 20 20 20 20 28 73 71 6c  tdat))..    (sql
cee0: 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09 20  ite3:execute .. 
cef0: 20 20 20 20 64 62 20 0a 09 20 20 20 20 20 28 63      db ..     (c
cf00: 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 52  onc "INSERT OR R
cf10: 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 74  EPLACE INTO test
cf20: 5f 64 61 74 61 20 28 74 65 73 74 5f 69 64 2c 63  _data (test_id,c
cf30: 61 74 65 67 6f 72 79 2c 76 61 72 69 61 62 6c 65  ategory,variable
cf40: 2c 76 61 6c 75 65 2c 65 78 70 65 63 74 65 64 2c  ,value,expected,
cf50: 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65 6e  tol,units,commen
cf60: 74 29 20 22 0a 09 09 20 20 20 22 53 45 4c 45 43  t) "...   "SELEC
cf70: 54 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74  T " (db:test-get
cf80: 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29  -id new-testdat)
cf90: 20 22 2c 63 61 74 65 67 6f 72 79 2c 76 61 72 69   ",category,vari
cfa0: 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65 63  able,value,expec
cfb0: 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f  ted,tol,units,co
cfc0: 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f  mment FROM test_
cfd0: 64 61 74 61 20 57 48 45 52 45 20 74 65 73 74 5f  data WHERE test_
cfe0: 69 64 3d 3f 3b 22 29 0a 09 20 20 20 20 20 28 64  id=?;")..     (d
cff0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65  b:test-get-id te
d000: 73 74 64 61 74 29 29 29 29 0a 09 20 29 29 0a 20  stdat)))).. )). 
d010: 20 20 20 20 70 72 65 76 2d 74 65 73 74 73 29 29      prev-tests))
d020: 29 0a 09 20 0a 20 20 20 20 20 0a                 ).. .     .