Megatest

Hex Artifact Content
Login

Artifact c68e27a10b9d0d895f861946a0835b4e3c8d1eee:


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 28 75 73 65 20 74 72 61 63 65 29 0a  .;; (use trace).
3790: 3b 3b 20 28 74 72 61 63 65 0a 3b 3b 20 20 72 75  ;; (trace.;;  ru
37a0: 6e 73 3a 71 75 65 75 65 2d 6e 65 78 74 2d 68 65  ns:queue-next-he
37b0: 64 0a 3b 3b 20 20 72 75 6e 73 3a 71 75 65 75 65  d.;;  runs:queue
37c0: 2d 6e 65 78 74 2d 74 61 6c 0a 3b 3b 20 20 72 75  -next-tal.;;  ru
37d0: 6e 73 3a 71 75 65 75 65 2d 6e 65 78 74 2d 72 65  ns:queue-next-re
37e0: 67 0a 3b 3b 20 20 29 0a 0a 3b 3b 20 74 65 73 74  g.;;  )..;; test
37f0: 2d 72 65 63 6f 72 64 73 20 69 73 20 61 20 68 61  -records is a ha
3800: 73 68 20 74 61 62 6c 65 20 74 65 73 74 6e 61 6d  sh table testnam
3810: 65 3a 69 74 65 6d 5f 70 61 74 68 20 3d 3e 20 76  e:item_path => v
3820: 65 63 74 6f 72 20 3c 20 74 65 73 74 6e 61 6d 65  ector < testname
3830: 20 74 65 73 74 63 6f 6e 66 69 67 20 77 61 69 74   testconfig wait
3840: 6f 6e 73 20 70 72 69 6f 72 69 74 79 20 69 74 65  ons priority ite
3850: 6d 73 2d 69 6e 66 6f 20 2e 2e 2e 20 3e 0a 28 64  ms-info ... >.(d
3860: 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 75 6e 2d  efine (runs:run-
3870: 74 65 73 74 73 2d 71 75 65 75 65 20 72 75 6e 2d  tests-queue run-
3880: 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d  id runname test-
3890: 72 65 63 6f 72 64 73 20 6b 65 79 76 61 6c 6c 73  records keyvalls
38a0: 74 20 66 6c 61 67 73 20 74 65 73 74 2d 70 61 74  t flags test-pat
38b0: 74 73 29 0a 20 20 20 20 3b 3b 20 41 74 20 74 68  ts).    ;; At th
38c0: 69 73 20 70 6f 69 6e 74 20 74 68 65 20 6c 69 73  is point the lis
38d0: 74 20 6f 66 20 70 61 72 65 6e 74 20 74 65 73 74  t of parent test
38e0: 73 20 69 73 20 65 78 70 61 6e 64 65 64 20 0a 20  s is expanded . 
38f0: 20 20 20 3b 3b 20 4e 42 2f 2f 20 53 68 6f 75 6c     ;; NB// Shoul
3900: 64 20 65 78 70 61 6e 64 20 69 74 65 6d 73 20 68  d expand items h
3910: 65 72 65 20 61 6e 64 20 74 68 65 6e 20 69 6e 73  ere and then ins
3920: 65 72 74 20 69 6e 74 6f 20 74 68 65 20 72 75 6e  ert into the run
3930: 20 71 75 65 75 65 2e 0a 20 20 28 64 65 62 75 67   queue..  (debug
3940: 3a 70 72 69 6e 74 20 35 20 22 74 65 73 74 2d 72  :print 5 "test-r
3950: 65 63 6f 72 64 73 3a 20 22 20 74 65 73 74 2d 72  ecords: " test-r
3960: 65 63 6f 72 64 73 20 22 2c 20 6b 65 79 76 61 6c  ecords ", keyval
3970: 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74  lst: " keyvallst
3980: 20 22 20 66 6c 61 67 73 3a 20 22 20 28 68 61 73   " flags: " (has
3990: 68 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 66  h-table->alist f
39a0: 6c 61 67 73 29 29 0a 20 20 28 6c 65 74 20 28 28  lags)).  (let ((
39b0: 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65  sorted-test-name
39c0: 73 20 28 74 65 73 74 73 3a 73 6f 72 74 2d 62 79  s (tests:sort-by
39d0: 2d 70 72 69 6f 72 69 74 79 2d 61 6e 64 2d 77 61  -priority-and-wa
39e0: 69 74 6f 6e 20 74 65 73 74 2d 72 65 63 6f 72 64  iton test-record
39f0: 73 29 29 0a 09 28 74 65 73 74 2d 72 65 67 69 73  s))..(test-regis
3a00: 74 72 79 20 20 20 20 28 6d 61 6b 65 2d 68 61 73  try    (make-has
3a10: 68 2d 74 61 62 6c 65 29 29 0a 09 28 72 65 67 69  h-table))..(regi
3a20: 73 74 72 79 2d 6d 75 74 65 78 20 20 20 28 6d 61  stry-mutex   (ma
3a30: 6b 65 2d 6d 75 74 65 78 29 29 0a 09 28 6e 75 6d  ke-mutex))..(num
3a40: 2d 72 65 74 72 69 65 73 20 20 20 20 20 20 20 20  -retries        
3a50: 30 29 0a 09 28 6d 61 78 2d 72 65 74 72 69 65 73  0)..(max-retries
3a60: 20 20 20 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c         (config-l
3a70: 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 74  ookup *configdat
3a80: 2a 20 22 73 65 74 75 70 22 20 22 6d 61 78 72 65  * "setup" "maxre
3a90: 74 72 69 65 73 22 29 29 0a 09 28 6d 61 78 2d 63  tries"))..(max-c
3aa0: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 20  oncurrent-jobs  
3ab0: 20 20 20 28 6c 65 74 20 28 28 6d 63 6a 20 28 63     (let ((mcj (c
3ac0: 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f  onfig-lookup *co
3ad0: 6e 66 69 67 64 61 74 2a 20 22 73 65 74 75 70 22  nfigdat* "setup"
3ae0: 20 20 20 20 20 22 6d 61 78 5f 63 6f 6e 63 75 72       "max_concur
3af0: 72 65 6e 74 5f 6a 6f 62 73 22 29 29 29 0a 09 09  rent_jobs")))...
3b00: 09 09 20 20 20 20 28 69 66 20 28 61 6e 64 20 6d  ..    (if (and m
3b10: 63 6a 20 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62  cj (string->numb
3b20: 65 72 20 6d 63 6a 29 29 0a 09 09 09 09 09 28 73  er mcj))......(s
3b30: 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 63  tring->number mc
3b40: 6a 29 0a 09 09 09 09 09 31 29 29 29 0a 09 28 72  j)......1)))..(r
3b50: 65 67 6c 65 6e 20 20 20 20 20 20 20 20 20 20 20  eglen           
3b60: 20 20 31 30 29 29 20 3b 3b 20 6c 65 6e 67 74 68    10)) ;; length
3b70: 20 6f 66 20 74 68 65 20 72 65 67 69 73 74 65 72   of the register
3b80: 20 71 75 65 75 65 20 61 68 65 61 64 0a 20 20 20   queue ahead.   
3b90: 20 28 73 65 74 21 20 6d 61 78 2d 72 65 74 72 69   (set! max-retri
3ba0: 65 73 20 28 69 66 20 28 61 6e 64 20 6d 61 78 2d  es (if (and max-
3bb0: 72 65 74 72 69 65 73 20 28 73 74 72 69 6e 67 2d  retries (string-
3bc0: 3e 6e 75 6d 62 65 72 20 6d 61 78 2d 72 65 74 72  >number max-retr
3bd0: 69 65 73 29 29 28 73 74 72 69 6e 67 2d 3e 6e 75  ies))(string->nu
3be0: 6d 62 65 72 20 6d 61 78 2d 72 65 74 72 69 65 73  mber max-retries
3bf0: 29 20 31 30 30 29 29 0a 20 20 20 20 28 69 66 20  ) 100)).    (if 
3c00: 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 73 6f 72 74  (not (null? sort
3c10: 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a  ed-test-names)).
3c20: 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68 65 64  .(let loop ((hed
3c30: 20 20 20 20 20 20 20 20 20 28 63 61 72 20 73 6f           (car so
3c40: 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29  rted-test-names)
3c50: 29 0a 09 09 20 20 20 28 74 61 6c 20 20 20 20 20  )...   (tal     
3c60: 20 20 20 20 28 63 64 72 20 73 6f 72 74 65 64 2d      (cdr sorted-
3c70: 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 09 20  test-names))... 
3c80: 20 20 28 72 65 67 20 20 20 20 20 20 20 20 20 27    (reg         '
3c90: 28 29 29 20 3b 3b 20 72 65 67 69 73 74 65 72 65  ()) ;; registere
3ca0: 64 2c 20 70 75 74 20 74 68 65 73 65 20 61 74 20  d, put these at 
3cb0: 74 68 65 20 68 65 61 64 20 6f 66 20 74 61 6c 20  the head of tal 
3cc0: 0a 09 09 20 20 20 28 72 65 72 75 6e 73 20 20 20  ...   (reruns   
3cd0: 20 20 20 27 28 29 29 29 0a 09 20 20 28 69 66 20     '()))..  (if 
3ce0: 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 72 75  (not (null? reru
3cf0: 6e 73 29 29 28 64 65 62 75 67 3a 70 72 69 6e 74  ns))(debug:print
3d00: 2d 69 6e 66 6f 20 34 20 22 72 65 72 75 6e 73 3d  -info 4 "reruns=
3d10: 22 20 72 65 72 75 6e 73 29 29 0a 09 20 20 3b 3b  " reruns))..  ;;
3d20: 20 28 70 72 69 6e 74 20 22 54 6f 70 20 6f 66 20   (print "Top of 
3d30: 6c 6f 6f 70 2c 20 68 65 64 3d 22 20 68 65 64 20  loop, hed=" hed 
3d40: 22 2c 20 74 61 6c 3d 22 20 74 61 6c 20 22 20 2c  ", tal=" tal " ,
3d50: 72 65 72 75 6e 73 3d 22 20 72 65 72 75 6e 73 29  reruns=" reruns)
3d60: 0a 09 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74  ..  (let* ((test
3d70: 2d 72 65 63 6f 72 64 20 28 68 61 73 68 2d 74 61  -record (hash-ta
3d80: 62 6c 65 2d 72 65 66 20 74 65 73 74 2d 72 65 63  ble-ref test-rec
3d90: 6f 72 64 73 20 68 65 64 29 29 0a 09 09 20 28 74  ords hed))... (t
3da0: 65 73 74 2d 6e 61 6d 65 20 20 20 28 74 65 73 74  est-name   (test
3db0: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d  s:testqueue-get-
3dc0: 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65  testname test-re
3dd0: 63 6f 72 64 29 29 0a 09 09 20 28 74 63 6f 6e 66  cord))... (tconf
3de0: 69 67 20 20 20 20 20 28 74 65 73 74 73 3a 74 65  ig     (tests:te
3df0: 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74  stqueue-get-test
3e00: 63 6f 6e 66 69 67 20 74 65 73 74 2d 72 65 63 6f  config test-reco
3e10: 72 64 29 29 0a 09 09 20 28 74 65 73 74 6d 6f 64  rd))... (testmod
3e20: 65 20 20 20 20 28 6c 65 74 20 28 28 6d 20 28 63  e    (let ((m (c
3e30: 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 63 6f  onfig-lookup tco
3e40: 6e 66 69 67 20 22 72 65 71 75 69 72 65 6d 65 6e  nfig "requiremen
3e50: 74 73 22 20 22 6d 6f 64 65 22 29 29 29 0a 09 09  ts" "mode")))...
3e60: 09 09 28 69 66 20 6d 20 28 73 74 72 69 6e 67 2d  ..(if m (string-
3e70: 3e 73 79 6d 62 6f 6c 20 6d 29 20 27 6e 6f 72 6d  >symbol m) 'norm
3e80: 61 6c 29 29 29 0a 09 09 20 28 77 61 69 74 6f 6e  al)))... (waiton
3e90: 73 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73  s     (tests:tes
3ea0: 74 71 75 65 75 65 2d 67 65 74 2d 77 61 69 74 6f  tqueue-get-waito
3eb0: 6e 73 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72  ns    test-recor
3ec0: 64 29 29 0a 09 09 20 28 70 72 69 6f 72 69 74 79  d))... (priority
3ed0: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71      (tests:testq
3ee0: 75 65 75 65 2d 67 65 74 2d 70 72 69 6f 72 69 74  ueue-get-priorit
3ef0: 79 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29  y   test-record)
3f00: 29 0a 09 09 20 28 69 74 65 6d 64 61 74 20 20 20  )... (itemdat   
3f10: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65    (tests:testque
3f20: 75 65 2d 67 65 74 2d 69 74 65 6d 64 61 74 20 20  ue-get-itemdat  
3f30: 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 20    test-record)) 
3f40: 3b 3b 20 69 74 65 6d 64 61 74 20 63 61 6e 20 62  ;; itemdat can b
3f50: 65 20 61 20 73 74 72 69 6e 67 2c 20 6c 69 73 74  e a string, list
3f60: 20 6f 72 20 23 66 0a 09 09 20 28 69 74 65 6d 73   or #f... (items
3f70: 20 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 65         (tests:te
3f80: 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d  stqueue-get-item
3f90: 73 20 20 20 20 20 20 74 65 73 74 2d 72 65 63 6f  s      test-reco
3fa0: 72 64 29 29 0a 09 09 20 28 69 74 65 6d 2d 70 61  rd))... (item-pa
3fb0: 74 68 20 20 20 28 69 74 65 6d 2d 6c 69 73 74 2d  th   (item-list-
3fc0: 3e 70 61 74 68 20 69 74 65 6d 64 61 74 29 29 0a  >path itemdat)).
3fd0: 09 09 20 28 6e 65 77 74 61 6c 20 20 20 20 20 20  .. (newtal      
3fe0: 28 61 70 70 65 6e 64 20 74 61 6c 20 28 6c 69 73  (append tal (lis
3ff0: 74 20 68 65 64 29 29 29 0a 09 09 20 28 72 65 67  t hed)))... (reg
4000: 66 75 6c 6c 20 20 20 20 20 28 3e 20 28 6c 65 6e  full     (> (len
4010: 67 74 68 20 72 65 67 29 20 72 65 67 6c 65 6e 29  gth reg) reglen)
4020: 29 29 0a 09 20 20 20 20 3b 3b 20 28 69 66 20 28  ))..    ;; (if (
4030: 3e 20 28 6c 65 6e 67 74 68 20 72 65 67 29 20 31  > (length reg) 1
4040: 30 29 0a 09 20 20 20 20 3b 3b 20 20 20 20 20 28  0)..    ;;     (
4050: 62 65 67 69 6e 0a 09 20 20 20 20 3b 3b 20 20 20  begin..    ;;   
4060: 20 20 20 20 28 73 65 74 21 20 74 61 6c 20 28 63      (set! tal (c
4070: 6f 6e 73 20 68 65 64 20 74 61 6c 29 29 0a 09 20  ons hed tal)).. 
4080: 20 20 20 3b 3b 20 20 20 20 20 20 20 28 73 65 74     ;;       (set
4090: 21 20 68 65 64 20 28 63 61 72 20 72 65 67 29 29  ! hed (car reg))
40a0: 0a 09 20 20 20 20 3b 3b 20 20 20 20 20 20 20 28  ..    ;;       (
40b0: 73 65 74 21 20 72 65 67 20 28 63 64 72 20 72 65  set! reg (cdr re
40c0: 67 29 29 0a 09 20 20 20 20 3b 3b 20 20 20 20 20  g))..    ;;     
40d0: 20 20 28 73 65 74 21 20 6e 65 77 74 61 6c 20 74    (set! newtal t
40e0: 61 6c 29 29 29 0a 09 20 20 20 20 28 64 65 62 75  al)))..    (debu
40f0: 67 3a 70 72 69 6e 74 20 36 0a 09 09 09 20 22 74  g:print 6.... "t
4100: 65 73 74 2d 6e 61 6d 65 3a 20 22 20 74 65 73 74  est-name: " test
4110: 2d 6e 61 6d 65 0a 09 09 09 20 22 5c 6e 20 20 68  -name.... "\n  h
4120: 65 64 3a 20 20 20 20 20 20 20 20 20 22 20 68 65  ed:         " he
4130: 64 0a 09 09 09 20 22 5c 6e 20 20 69 74 65 6d 64  d.... "\n  itemd
4140: 61 74 3a 20 20 20 20 20 22 20 69 74 65 6d 64 61  at:     " itemda
4150: 74 0a 09 09 09 20 22 5c 6e 20 20 69 74 65 6d 73  t.... "\n  items
4160: 3a 20 20 20 20 20 20 20 22 20 69 74 65 6d 73 0a  :       " items.
4170: 09 09 09 20 22 5c 6e 20 20 69 74 65 6d 2d 70 61  ... "\n  item-pa
4180: 74 68 3a 20 20 20 22 20 69 74 65 6d 2d 70 61 74  th:   " item-pat
4190: 68 0a 09 09 09 20 22 5c 6e 20 20 77 61 69 74 6f  h.... "\n  waito
41a0: 6e 73 3a 20 20 20 20 20 22 20 77 61 69 74 6f 6e  ns:     " waiton
41b0: 73 0a 09 09 09 20 22 5c 6e 20 20 6e 75 6d 2d 72  s.... "\n  num-r
41c0: 65 74 72 69 65 73 3a 20 22 20 6e 75 6d 2d 72 65  etries: " num-re
41d0: 74 72 69 65 73 0a 09 09 09 20 22 5c 6e 20 20 74  tries.... "\n  t
41e0: 61 6c 3a 20 20 20 20 20 20 20 20 20 22 20 74 61  al:         " ta
41f0: 6c 0a 09 09 09 20 22 5c 6e 20 20 72 65 72 75 6e  l.... "\n  rerun
4200: 73 3a 20 20 20 20 20 20 22 20 72 65 72 75 6e 73  s:      " reruns
4210: 29 0a 0a 09 20 20 20 20 3b 3b 20 63 68 65 63 6b  )...    ;; check
4220: 20 66 6f 72 20 68 65 64 20 69 6e 20 77 61 69 74   for hed in wait
4230: 6f 6e 73 20 3d 3e 20 74 68 69 73 20 77 6f 75 6c  ons => this woul
4240: 64 20 62 65 20 63 69 72 63 75 6c 61 72 2c 20 72  d be circular, r
4250: 65 6d 6f 76 65 20 69 74 20 61 6e 64 20 69 73 73  emove it and iss
4260: 75 65 20 61 6e 0a 09 20 20 20 20 3b 3b 20 65 72  ue an..    ;; er
4270: 72 6f 72 0a 09 20 20 20 20 28 69 66 20 28 6d 65  ror..    (if (me
4280: 6d 62 65 72 20 74 65 73 74 2d 6e 61 6d 65 20 77  mber test-name w
4290: 61 69 74 6f 6e 73 29 0a 09 09 28 62 65 67 69 6e  aitons)...(begin
42a0: 0a 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e  ...  (debug:prin
42b0: 74 20 30 20 22 45 52 52 4f 52 3a 20 74 65 73 74  t 0 "ERROR: test
42c0: 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 68   " test-name " h
42d0: 61 73 20 6c 69 73 74 65 64 20 69 74 73 65 6c 66  as listed itself
42e0: 20 61 73 20 61 20 77 61 69 74 6f 6e 2c 20 70 6c   as a waiton, pl
42f0: 65 61 73 65 20 63 6f 72 72 65 63 74 20 74 68 69  ease correct thi
4300: 73 21 22 29 0a 09 09 20 20 28 73 65 74 21 20 77  s!")...  (set! w
4310: 61 69 74 6f 6e 20 28 66 69 6c 74 65 72 20 28 6c  aiton (filter (l
4320: 61 6d 62 64 61 20 28 78 29 28 6e 6f 74 20 28 65  ambda (x)(not (e
4330: 71 75 61 6c 3f 20 78 20 68 65 64 29 29 29 20 77  qual? x hed))) w
4340: 61 69 74 6f 6e 73 29 29 29 29 0a 0a 09 20 20 20  aitons))))...   
4350: 20 28 63 6f 6e 64 20 3b 3b 20 4f 55 54 45 52 20   (cond ;; OUTER 
4360: 43 4f 4e 44 0a 09 20 20 20 20 20 28 28 6e 6f 74  COND..     ((not
4370: 20 69 74 65 6d 73 29 20 3b 3b 20 77 68 65 6e 20   items) ;; when 
4380: 66 61 6c 73 65 20 74 68 65 20 74 65 73 74 20 69  false the test i
4390: 73 20 6f 6b 20 74 6f 20 62 65 20 68 61 6e 64 65  s ok to be hande
43a0: 64 20 6f 66 66 20 74 6f 20 6c 61 75 6e 63 68 20  d off to launch 
43b0: 28 62 75 74 20 6e 6f 74 20 62 65 66 6f 72 65 29  (but not before)
43c0: 0a 09 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28  ..      (let* ((
43d0: 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 20  run-limits-info 
43e0: 20 20 20 20 20 20 20 20 28 72 75 6e 73 3a 63 61          (runs:ca
43f0: 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73  n-run-more-tests
4400: 20 74 65 73 74 2d 72 65 63 6f 72 64 20 6d 61 78   test-record max
4410: 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73  -concurrent-jobs
4420: 29 29 20 3b 3b 20 6c 6f 6f 6b 20 61 74 20 74 68  )) ;; look at th
4430: 65 20 74 65 73 74 20 6a 6f 62 67 72 6f 75 70 20  e test jobgroup 
4440: 61 6e 64 20 74 6f 74 20 6a 6f 62 73 20 72 75 6e  and tot jobs run
4450: 6e 69 6e 67 0a 09 09 20 20 20 20 20 28 68 61 76  ning...     (hav
4460: 65 2d 72 65 73 6f 75 72 63 65 73 20 20 20 20 20  e-resources     
4470: 20 20 20 20 20 28 63 61 72 20 72 75 6e 2d 6c 69       (car run-li
4480: 6d 69 74 73 2d 69 6e 66 6f 29 29 0a 09 09 20 20  mits-info))...  
4490: 20 20 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20     (num-running 
44a0: 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73              (lis
44b0: 74 2d 72 65 66 20 72 75 6e 2d 6c 69 6d 69 74 73  t-ref run-limits
44c0: 2d 69 6e 66 6f 20 31 29 29 0a 09 09 20 20 20 20  -info 1))...    
44d0: 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e   (num-running-in
44e0: 2d 6a 6f 62 67 72 6f 75 70 20 28 6c 69 73 74 2d  -jobgroup (list-
44f0: 72 65 66 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69  ref run-limits-i
4500: 6e 66 6f 20 32 29 29 0a 09 09 20 20 20 20 20 28  nfo 2))...     (
4510: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a  max-concurrent-j
4520: 6f 62 73 20 20 20 20 20 28 6c 69 73 74 2d 72 65  obs     (list-re
4530: 66 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66  f run-limits-inf
4540: 6f 20 33 29 29 0a 09 09 20 20 20 20 20 28 6a 6f  o 3))...     (jo
4550: 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 20 20 20  b-group-limit   
4560: 20 20 20 20 20 20 28 6c 69 73 74 2d 72 65 66 20        (list-ref 
4570: 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 20  run-limits-info 
4580: 34 29 29 0a 09 09 20 20 20 20 20 28 70 72 65 72  4))...     (prer
4590: 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 20 20 20 20  eqs-not-met     
45a0: 20 20 20 20 28 64 62 3a 67 65 74 2d 70 72 65 72      (db:get-prer
45b0: 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 72 75 6e 2d  eqs-not-met run-
45c0: 69 64 20 77 61 69 74 6f 6e 73 20 69 74 65 6d 2d  id waitons item-
45d0: 70 61 74 68 20 6d 6f 64 65 3a 20 74 65 73 74 6d  path mode: testm
45e0: 6f 64 65 29 29 0a 09 09 20 20 20 20 20 28 66 61  ode))...     (fa
45f0: 69 6c 73 20 20 20 20 20 20 20 20 20 20 20 20 20  ils             
4600: 20 20 20 20 20 20 28 72 75 6e 73 3a 63 61 6c 63        (runs:calc
4610: 2d 66 61 69 6c 73 20 70 72 65 72 65 71 73 2d 6e  -fails prereqs-n
4620: 6f 74 2d 6d 65 74 29 29 0a 09 09 20 20 20 20 20  ot-met))...     
4630: 28 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 20 20  (non-completed  
4640: 20 20 20 20 20 20 20 20 20 28 72 75 6e 73 3a 63           (runs:c
4650: 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 74 65  alc-not-complete
4660: 64 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65  d prereqs-not-me
4670: 74 29 29 29 0a 09 09 28 64 65 62 75 67 3a 70 72  t)))...(debug:pr
4680: 69 6e 74 2d 69 6e 66 6f 20 38 20 22 68 61 76 65  int-info 8 "have
4690: 2d 72 65 73 6f 75 72 63 65 73 3a 20 22 20 68 61  -resources: " ha
46a0: 76 65 2d 72 65 73 6f 75 72 63 65 73 20 22 20 70  ve-resources " p
46b0: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 3a 20  rereqs-not-met: 
46c0: 22 20 0a 09 09 09 20 20 20 20 20 28 73 74 72 69  " ....     (stri
46d0: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 0a  ng-intersperse .
46e0: 09 09 09 20 20 20 20 20 20 28 6d 61 70 20 28 6c  ...      (map (l
46f0: 61 6d 62 64 61 20 28 74 29 0a 09 09 09 09 20 20  ambda (t).....  
4700: 20 20 20 28 69 66 20 28 76 65 63 74 6f 72 3f 20     (if (vector? 
4710: 74 29 0a 09 09 09 09 09 20 28 63 6f 6e 63 20 28  t)...... (conc (
4720: 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74  db:test-get-stat
4730: 65 20 74 29 20 22 2f 22 20 28 64 62 3a 74 65 73  e t) "/" (db:tes
4740: 74 2d 67 65 74 2d 73 74 61 74 75 73 20 74 29 29  t-get-status t))
4750: 0a 09 09 09 09 09 20 28 63 6f 6e 63 20 22 20 57  ...... (conc " W
4760: 41 52 4e 49 4e 47 3a 20 74 20 69 73 20 6e 6f 74  ARNING: t is not
4770: 20 61 20 76 65 63 74 6f 72 3d 22 20 74 20 29 29   a vector=" t ))
4780: 29 0a 09 09 09 09 20 20 20 70 72 65 72 65 71 73  ).....   prereqs
4790: 2d 6e 6f 74 2d 6d 65 74 29 20 22 2c 20 22 29 20  -not-met) ", ") 
47a0: 22 20 66 61 69 6c 73 3a 20 22 20 66 61 69 6c 73  " fails: " fails
47b0: 29 0a 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74  )...(debug:print
47c0: 2d 69 6e 66 6f 20 34 20 22 68 65 64 3d 22 20 68  -info 4 "hed=" h
47d0: 65 64 20 22 5c 6e 20 20 74 65 73 74 2d 72 65 63  ed "\n  test-rec
47e0: 6f 72 64 3d 22 20 74 65 73 74 2d 72 65 63 6f 72  ord=" test-recor
47f0: 64 20 22 5c 6e 20 20 74 65 73 74 2d 6e 61 6d 65  d "\n  test-name
4800: 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 5c  : " test-name "\
4810: 6e 20 20 69 74 65 6d 2d 70 61 74 68 3a 20 22 20  n  item-path: " 
4820: 69 74 65 6d 2d 70 61 74 68 20 22 5c 6e 20 20 74  item-path "\n  t
4830: 65 73 74 2d 70 61 74 74 73 3a 20 22 20 74 65 73  est-patts: " tes
4840: 74 2d 70 61 74 74 73 29 0a 0a 09 09 3b 3b 20 44  t-patts)....;; D
4850: 6f 6e 27 74 20 6b 6e 6f 77 20 61 74 20 74 68 69  on't know at thi
4860: 73 20 74 69 6d 65 20 69 66 20 74 68 65 20 74 65  s time if the te
4870: 73 74 20 68 61 76 65 20 62 65 65 6e 20 6c 61 75  st have been lau
4880: 6e 63 68 65 64 20 61 74 20 73 6f 6d 65 20 74 69  nched at some ti
4890: 6d 65 20 69 6e 20 74 68 65 20 70 61 73 74 0a 09  me in the past..
48a0: 09 3b 3b 20 69 2e 65 2e 20 69 73 20 74 68 69 73  .;; i.e. is this
48b0: 20 61 20 72 65 2d 6c 61 75 6e 63 68 3f 0a 09 09   a re-launch?...
48c0: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
48d0: 6f 20 34 20 22 72 75 6e 2d 6c 69 6d 69 74 73 2d  o 4 "run-limits-
48e0: 69 6e 66 6f 20 3d 20 22 20 72 75 6e 2d 6c 69 6d  info = " run-lim
48f0: 69 74 73 2d 69 6e 66 6f 29 0a 09 09 28 63 6f 6e  its-info)...(con
4900: 64 20 3b 3b 20 49 4e 4e 45 52 20 43 4f 4e 44 20  d ;; INNER COND 
4910: 23 31 20 66 6f 72 20 61 20 6c 61 75 6e 63 68 61  #1 for a launcha
4920: 62 6c 65 20 74 65 73 74 0a 09 09 20 3b 3b 20 43  ble test... ;; C
4930: 68 65 63 6b 20 69 74 65 6d 20 70 61 74 68 20 61  heck item path a
4940: 67 61 69 6e 73 74 20 69 74 65 6d 2d 70 61 74 74  gainst item-patt
4950: 73 0a 09 09 20 28 28 6e 6f 74 20 28 74 65 73 74  s... ((not (test
4960: 73 3a 6d 61 74 63 68 20 74 65 73 74 2d 70 61 74  s:match test-pat
4970: 74 73 20 28 74 65 73 74 73 3a 74 65 73 74 71 75  ts (tests:testqu
4980: 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65  eue-get-testname
4990: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 20 69 74   test-record) it
49a0: 65 6d 2d 70 61 74 68 29 29 20 3b 3b 20 54 68 69  em-path)) ;; Thi
49b0: 73 20 74 65 73 74 2f 69 74 65 6d 70 61 74 68 20  s test/itempath 
49c0: 69 73 20 6e 6f 74 20 74 6f 20 62 65 20 72 75 6e  is not to be run
49d0: 0a 09 09 20 20 3b 3b 20 65 6c 73 65 20 74 68 65  ...  ;; else the
49e0: 20 72 75 6e 20 69 73 20 73 74 75 63 6b 2c 20 74   run is stuck, t
49f0: 65 6d 70 6f 72 61 72 69 6c 79 20 6f 72 20 70 65  emporarily or pe
4a00: 72 6d 61 6e 65 6e 74 6c 79 0a 09 09 20 20 3b 3b  rmanently...  ;;
4a10: 20 62 75 74 20 73 68 6f 75 6c 64 20 63 68 65 63   but should chec
4a20: 6b 20 69 66 20 69 74 20 69 73 20 64 75 65 20 74  k if it is due t
4a30: 6f 20 6c 61 63 6b 20 6f 66 20 72 65 73 6f 75 72  o lack of resour
4a40: 63 65 73 20 76 73 2e 20 70 72 65 72 65 71 75 69  ces vs. prerequi
4a50: 73 69 74 65 73 0a 09 09 20 20 28 64 65 62 75 67  sites...  (debug
4a60: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 53  :print-info 1 "S
4a70: 6b 69 70 70 69 6e 67 20 22 20 28 74 65 73 74 73  kipping " (tests
4a80: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74  :testqueue-get-t
4a90: 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63  estname test-rec
4aa0: 6f 72 64 29 20 22 20 22 20 69 74 65 6d 2d 70 61  ord) " " item-pa
4ab0: 74 68 20 22 20 61 73 20 69 74 20 64 6f 65 73 6e  th " as it doesn
4ac0: 27 74 20 6d 61 74 63 68 20 22 20 74 65 73 74 2d  't match " test-
4ad0: 70 61 74 74 73 29 0a 09 09 20 20 3b 3b 20 28 74  patts)...  ;; (t
4ae0: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c  hread-sleep! *gl
4af0: 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 20  obal-delta*)... 
4b00: 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f   (if (not (null?
4b10: 20 74 61 6c 29 29 0a 09 09 20 20 20 20 20 20 28   tal))...      (
4b20: 6c 6f 6f 70 20 28 72 75 6e 73 3a 71 75 65 75 65  loop (runs:queue
4b30: 2d 6e 65 78 74 2d 68 65 64 20 74 61 6c 20 72 65  -next-hed tal re
4b40: 67 20 72 65 67 6c 65 6e 20 72 65 67 66 75 6c 6c  g reglen regfull
4b50: 29 0a 09 09 09 20 20 20 20 28 72 75 6e 73 3a 71  )....    (runs:q
4b60: 75 65 75 65 2d 6e 65 78 74 2d 74 61 6c 20 74 61  ueue-next-tal ta
4b70: 6c 20 72 65 67 20 72 65 67 6c 65 6e 20 72 65 67  l reg reglen reg
4b80: 66 75 6c 6c 29 0a 09 09 09 20 20 20 20 28 72 75  full)....    (ru
4b90: 6e 73 3a 71 75 65 75 65 2d 6e 65 78 74 2d 72 65  ns:queue-next-re
4ba0: 67 20 74 61 6c 20 72 65 67 20 72 65 67 6c 65 6e  g tal reg reglen
4bb0: 20 72 65 67 66 75 6c 6c 29 0a 09 09 09 20 20 20   regfull)....   
4bc0: 20 72 65 72 75 6e 73 29 29 29 0a 09 09 20 3b 3b   reruns)))... ;;
4bd0: 20 52 65 67 69 73 74 72 79 20 68 61 73 20 62 65   Registry has be
4be0: 65 6e 20 73 74 61 72 74 65 64 20 66 6f 72 20 74  en started for t
4bf0: 68 69 73 20 74 65 73 74 20 62 75 74 20 68 61 73  his test but has
4c00: 20 6e 6f 74 20 79 65 74 20 63 6f 6d 70 6c 65 74   not yet complet
4c10: 65 64 0a 09 09 20 3b 3b 20 74 68 69 73 20 73 68  ed... ;; this sh
4c20: 6f 75 6c 64 20 62 65 20 72 61 72 65 2c 20 74 68  ould be rare, th
4c30: 65 20 63 61 73 65 20 77 68 65 72 65 20 74 68 65  e case where the
4c40: 72 65 20 61 72 65 20 6f 6e 6c 79 20 61 20 63 6f  re are only a co
4c50: 75 70 6c 65 20 6f 66 20 74 65 73 74 73 20 61 6e  uple of tests an
4c60: 64 20 74 68 65 20 64 62 20 69 73 20 73 6c 6f 77  d the db is slow
4c70: 0a 09 09 20 3b 3b 20 64 65 6c 61 79 20 61 20 73  ... ;; delay a s
4c80: 68 6f 72 74 20 77 68 69 6c 65 20 61 6e 64 20 63  hort while and c
4c90: 6f 6e 74 69 6e 75 65 0a 09 09 20 3b 3b 20 28 28  ontinue... ;; ((
4ca0: 65 71 3f 20 28 68 61 73 68 2d 74 61 62 6c 65 2d  eq? (hash-table-
4cb0: 72 65 66 2f 64 65 66 61 75 6c 74 20 74 65 73 74  ref/default test
4cc0: 2d 72 65 67 69 73 74 72 79 20 28 72 75 6e 73 3a  -registry (runs:
4cd0: 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e  make-full-test-n
4ce0: 61 6d 65 20 74 65 73 74 2d 6e 61 6d 65 20 69 74  ame test-name it
4cf0: 65 6d 2d 70 61 74 68 29 20 23 66 29 20 27 73 74  em-path) #f) 'st
4d00: 61 72 74 29 0a 09 09 20 3b 3b 20 20 28 74 68 72  art)... ;;  (thr
4d10: 65 61 64 2d 73 6c 65 65 70 21 20 30 2e 30 31 29  ead-sleep! 0.01)
4d20: 0a 09 09 20 3b 3b 20 20 28 6c 6f 6f 70 20 28 63  ... ;;  (loop (c
4d30: 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e  ar newtal)(cdr n
4d40: 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29 29 0a  ewtal) reruns)).
4d50: 09 09 20 3b 3b 20 63 6f 75 6e 74 20 6e 75 6d 62  .. ;; count numb
4d60: 65 72 20 6f 66 20 27 64 6f 6e 65 2c 20 69 66 20  er of 'done, if 
4d70: 6d 6f 72 65 20 74 68 61 6e 20 31 30 30 20 74 68  more than 100 th
4d80: 65 6e 20 73 6b 69 70 20 6f 6e 20 74 68 72 6f 75  en skip on throu
4d90: 67 68 2e 0a 09 09 20 28 28 6e 6f 74 20 28 68 61  gh.... ((not (ha
4da0: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66  sh-table-ref/def
4db0: 61 75 6c 74 20 74 65 73 74 2d 72 65 67 69 73 74  ault test-regist
4dc0: 72 79 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75  ry (runs:make-fu
4dd0: 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 73  ll-test-name tes
4de0: 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68  t-name item-path
4df0: 29 20 23 66 29 29 20 3b 3b 20 29 20 3b 3b 20 74  ) #f)) ;; ) ;; t
4e00: 6f 6f 20 6d 61 6e 79 20 63 68 61 6e 67 65 73 20  oo many changes 
4e10: 72 65 71 75 69 72 65 64 2e 20 49 6d 70 6c 65 6d  required. Implem
4e20: 65 6e 74 20 6c 61 74 65 72 2e 0a 09 09 20 20 28  ent later....  (
4e30: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
4e40: 20 34 20 22 50 72 65 2d 72 65 67 69 73 74 65 72   4 "Pre-register
4e50: 69 6e 67 20 74 65 73 74 20 22 20 74 65 73 74 2d  ing test " test-
4e60: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61  name "/" item-pa
4e70: 74 68 20 22 20 74 6f 20 63 72 65 61 74 65 20 70  th " to create p
4e80: 6c 61 63 65 68 6f 6c 64 65 72 22 20 29 0a 09 09  laceholder" )...
4e90: 20 20 28 6c 65 74 20 28 28 74 68 20 28 6d 61 6b    (let ((th (mak
4ea0: 65 2d 74 68 72 65 61 64 20 28 6c 61 6d 62 64 61  e-thread (lambda
4eb0: 20 28 29 0a 09 09 20 20 20 20 20 20 20 20 09 09   ()...        ..
4ec0: 20 20 20 28 6d 75 74 65 78 2d 6c 6f 63 6b 21 20     (mutex-lock! 
4ed0: 72 65 67 69 73 74 72 79 2d 6d 75 74 65 78 29 0a  registry-mutex).
4ee0: 09 09 20 20 20 20 20 20 20 20 09 09 20 20 20 28  ..        ..   (
4ef0: 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20  hash-table-set! 
4f00: 74 65 73 74 2d 72 65 67 69 73 74 72 79 20 28 72  test-registry (r
4f10: 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65  uns:make-full-te
4f20: 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 6e 61 6d  st-name test-nam
4f30: 65 20 69 74 65 6d 2d 70 61 74 68 29 20 27 73 74  e item-path) 'st
4f40: 61 72 74 29 0a 09 09 20 20 20 20 20 20 20 20 09  art)...        .
4f50: 09 20 20 20 28 6d 75 74 65 78 2d 75 6e 6c 6f 63  .   (mutex-unloc
4f60: 6b 21 20 72 65 67 69 73 74 72 79 2d 6d 75 74 65  k! registry-mute
4f70: 78 29 0a 09 09 09 09 09 20 20 20 3b 3b 20 49 66  x)......   ;; If
4f80: 20 68 61 76 65 6e 27 74 20 64 6f 6e 65 20 69 74   haven't done it
4f90: 20 62 65 66 6f 72 65 20 72 65 67 69 73 74 65 72   before register
4fa0: 20 61 20 74 6f 70 20 6c 65 76 65 6c 20 74 65 73   a top level tes
4fb0: 74 20 69 66 20 74 68 69 73 20 69 73 20 61 6e 20  t if this is an 
4fc0: 69 74 65 6d 69 7a 65 64 20 74 65 73 74 0a 09 09  itemized test...
4fd0: 09 09 09 20 20 20 28 69 66 20 28 6e 6f 74 20 28  ...   (if (not (
4fe0: 65 71 3f 20 28 68 61 73 68 2d 74 61 62 6c 65 2d  eq? (hash-table-
4ff0: 72 65 66 2f 64 65 66 61 75 6c 74 20 74 65 73 74  ref/default test
5000: 2d 72 65 67 69 73 74 72 79 20 28 72 75 6e 73 3a  -registry (runs:
5010: 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e  make-full-test-n
5020: 61 6d 65 20 74 65 73 74 2d 6e 61 6d 65 20 22 22  ame test-name ""
5030: 29 20 23 66 29 20 27 64 6f 6e 65 29 29 0a 09 09  ) #f) 'done))...
5040: 09 09 09 20 20 20 20 20 20 20 28 63 64 62 3a 74  ...       (cdb:t
5050: 65 73 74 73 2d 72 65 67 69 73 74 65 72 2d 74 65  ests-register-te
5060: 73 74 20 2a 72 75 6e 72 65 6d 6f 74 65 2a 20 72  st *runremote* r
5070: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20  un-id test-name 
5080: 22 22 29 29 0a 09 09 09 09 09 20 20 20 28 63 64  ""))......   (cd
5090: 62 3a 74 65 73 74 73 2d 72 65 67 69 73 74 65 72  b:tests-register
50a0: 2d 74 65 73 74 20 2a 72 75 6e 72 65 6d 6f 74 65  -test *runremote
50b0: 2a 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61  * run-id test-na
50c0: 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 09  me item-path)...
50d0: 20 20 20 20 20 20 20 20 09 09 20 20 20 28 6d 75          ..   (mu
50e0: 74 65 78 2d 6c 6f 63 6b 21 20 72 65 67 69 73 74  tex-lock! regist
50f0: 72 79 2d 6d 75 74 65 78 29 0a 09 09 09 09 09 20  ry-mutex)...... 
5100: 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65    (hash-table-se
5110: 74 21 20 74 65 73 74 2d 72 65 67 69 73 74 72 79  t! test-registry
5120: 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c   (runs:make-full
5130: 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d  -test-name test-
5140: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 20  name item-path) 
5150: 27 64 6f 6e 65 29 0a 09 09 20 20 20 20 20 20 20  'done)...       
5160: 20 09 09 20 20 20 28 6d 75 74 65 78 2d 75 6e 6c   ..   (mutex-unl
5170: 6f 63 6b 21 20 72 65 67 69 73 74 72 79 2d 6d 75  ock! registry-mu
5180: 74 65 78 29 29 0a 09 09 20 20 20 20 20 20 20 20  tex))...        
5190: 09 09 20 28 63 6f 6e 63 20 74 65 73 74 2d 6e 61  .. (conc test-na
51a0: 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68  me "/" item-path
51b0: 29 29 29 29 0a 09 09 20 20 20 20 28 74 68 72 65  ))))...    (thre
51c0: 61 64 2d 73 74 61 72 74 21 20 74 68 29 29 0a 09  ad-start! th))..
51d0: 09 20 20 28 72 75 6e 73 3a 73 68 72 69 6e 6b 2d  .  (runs:shrink-
51e0: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73  can-run-more-tes
51f0: 74 73 2d 63 6f 75 6e 74 29 20 20 20 3b 3b 20 44  ts-count)   ;; D
5200: 45 4c 41 59 20 54 57 45 41 4b 45 52 20 28 73 74  ELAY TWEAKER (st
5210: 69 6c 6c 20 6e 65 65 64 65 64 3f 29 0a 09 09 20  ill needed?)... 
5220: 20 28 69 66 20 28 61 6e 64 20 28 6e 75 6c 6c 3f   (if (and (null?
5230: 20 74 61 6c 29 28 6e 75 6c 6c 3f 20 72 65 67 29   tal)(null? reg)
5240: 29 0a 09 09 20 20 20 20 20 20 28 6c 6f 6f 70 20  )...      (loop 
5250: 68 65 64 20 74 61 6c 20 72 65 67 20 72 65 72 75  hed tal reg reru
5260: 6e 73 29 0a 09 09 20 20 20 20 20 20 28 6c 6f 6f  ns)...      (loo
5270: 70 20 28 72 75 6e 73 3a 71 75 65 75 65 2d 6e 65  p (runs:queue-ne
5280: 78 74 2d 68 65 64 20 74 61 6c 20 72 65 67 20 72  xt-hed tal reg r
5290: 65 67 6c 65 6e 20 72 65 67 66 75 6c 6c 29 0a 09  eglen regfull)..
52a0: 09 09 20 20 20 20 28 72 75 6e 73 3a 71 75 65 75  ..    (runs:queu
52b0: 65 2d 6e 65 78 74 2d 74 61 6c 20 74 61 6c 20 72  e-next-tal tal r
52c0: 65 67 20 72 65 67 6c 65 6e 20 72 65 67 66 75 6c  eg reglen regful
52d0: 6c 29 0a 09 09 09 20 20 20 20 28 6c 65 74 20 28  l)....    (let (
52e0: 28 6e 65 77 6c 20 28 61 70 70 65 6e 64 20 72 65  (newl (append re
52f0: 67 20 28 6c 69 73 74 20 68 65 64 29 29 29 29 0a  g (list hed)))).
5300: 09 09 09 20 20 20 20 20 20 28 69 66 20 72 65 67  ...      (if reg
5310: 66 75 6c 6c 20 0a 09 09 09 09 20 20 28 63 64 72  full .....  (cdr
5320: 20 6e 65 77 6c 29 0a 09 09 09 09 20 20 6e 65 77   newl).....  new
5330: 6c 29 29 0a 09 09 09 20 20 20 20 72 65 72 75 6e  l))....    rerun
5340: 73 29 29 29 0a 09 09 20 3b 3b 20 41 74 20 74 68  s)))... ;; At th
5350: 69 73 20 70 6f 69 6e 74 20 68 65 64 20 74 65 73  is point hed tes
5360: 74 20 72 65 67 69 73 74 72 61 74 69 6f 6e 20 6d  t registration m
5370: 75 73 74 20 62 65 20 63 6f 6d 70 6c 65 74 65 64  ust be completed
5380: 2e 0a 09 09 20 28 28 65 71 3f 20 28 68 61 73 68  .... ((eq? (hash
5390: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75  -table-ref/defau
53a0: 6c 74 20 74 65 73 74 2d 72 65 67 69 73 74 72 79  lt test-registry
53b0: 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c   (runs:make-full
53c0: 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d  -test-name test-
53d0: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 20  name item-path) 
53e0: 23 66 29 0a 09 09 20 20 20 20 20 20 20 27 73 74  #f)...       'st
53f0: 61 72 74 29 0a 09 09 20 20 28 64 65 62 75 67 3a  art)...  (debug:
5400: 70 72 69 6e 74 2d 69 6e 66 6f 20 30 20 22 57 61  print-info 0 "Wa
5410: 69 74 69 6e 67 20 6f 6e 20 74 65 73 74 20 72 65  iting on test re
5420: 67 69 73 74 72 61 74 69 6f 6e 28 73 29 3a 20 22  gistration(s): "
5430: 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70   (string-intersp
5440: 65 72 73 65 20 0a 09 09 09 09 09 09 09 09 09 20  erse .......... 
5450: 20 20 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64    (filter (lambd
5460: 61 20 28 78 29 0a 09 09 09 09 09 09 09 09 09 09  a (x)...........
5470: 20 20 20 20 20 28 65 71 3f 20 28 68 61 73 68 2d       (eq? (hash-
5480: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c  table-ref/defaul
5490: 74 20 74 65 73 74 2d 72 65 67 69 73 74 72 79 20  t test-registry 
54a0: 78 20 23 66 29 20 27 73 74 61 72 74 29 29 0a 09  x #f) 'start))..
54b0: 09 09 09 09 09 09 09 09 09 20 20 20 28 68 61 73  .........   (has
54c0: 68 2d 74 61 62 6c 65 2d 6b 65 79 73 20 74 65 73  h-table-keys tes
54d0: 74 2d 72 65 67 69 73 74 72 79 29 29 0a 09 09 09  t-registry))....
54e0: 09 09 09 09 09 09 20 20 20 22 2c 20 22 29 29 0a  ......   ", ")).
54f0: 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65  ..  (thread-slee
5500: 70 21 20 30 2e 31 29 0a 09 09 20 20 28 6c 6f 6f  p! 0.1)...  (loo
5510: 70 20 68 65 64 20 74 61 6c 20 72 65 67 20 72 65  p hed tal reg re
5520: 72 75 6e 73 29 29 0a 09 09 20 28 28 6e 6f 74 20  runs))... ((not 
5530: 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 29 20  have-resources) 
5540: 3b 3b 20 73 69 6d 70 6c 79 20 74 72 79 20 61 67  ;; simply try ag
5550: 61 69 6e 20 61 66 74 65 72 20 77 61 69 74 69 6e  ain after waitin
5560: 67 20 61 20 73 65 63 6f 6e 64 0a 09 09 20 20 28  g a second...  (
5570: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
5580: 20 31 20 22 6e 6f 20 72 65 73 6f 75 72 63 65 73   1 "no resources
5590: 20 74 6f 20 72 75 6e 20 6e 65 77 20 74 65 73 74   to run new test
55a0: 73 2c 20 77 61 69 74 69 6e 67 20 2e 2e 2e 22 29  s, waiting ...")
55b0: 0a 09 09 20 20 3b 3b 20 48 61 76 65 20 67 6f 6e  ...  ;; Have gon
55c0: 65 20 62 61 63 6b 20 61 6e 64 20 66 6f 72 74 68  e back and forth
55d0: 20 6f 6e 20 74 68 69 73 20 62 75 74 20 64 62 20   on this but db 
55e0: 73 74 61 72 76 61 74 69 6f 6e 20 69 73 20 61 6e  starvation is an
55f0: 20 69 73 73 75 65 2e 0a 09 09 20 20 3b 3b 20 77   issue....  ;; w
5600: 61 69 74 20 6f 6e 65 20 73 65 63 6f 6e 64 20 62  ait one second b
5610: 65 66 6f 72 65 20 6c 6f 6f 6b 69 6e 67 20 61 67  efore looking ag
5620: 61 69 6e 20 74 6f 20 72 75 6e 20 6a 6f 62 73 2e  ain to run jobs.
5630: 0a 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65  ...  (thread-sle
5640: 65 70 21 20 31 29 20 3b 3b 20 28 2b 20 32 20 2a  ep! 1) ;; (+ 2 *
5650: 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a  global-delta*)).
5660: 09 09 20 20 3b 3b 20 63 6f 75 6c 64 20 68 61 76  ..  ;; could hav
5670: 65 20 64 6f 6e 65 20 68 65 64 20 74 61 6c 20 68  e done hed tal h
5680: 65 72 65 20 62 75 74 20 64 6f 69 6e 67 20 63 61  ere but doing ca
5690: 72 2f 63 64 72 20 6f 66 20 6e 65 77 74 61 6c 20  r/cdr of newtal 
56a0: 74 6f 20 72 6f 74 61 74 65 20 74 65 73 74 73 0a  to rotate tests.
56b0: 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e  ..  (loop (car n
56c0: 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61  ewtal)(cdr newta
56d0: 6c 29 20 72 65 67 20 72 65 72 75 6e 73 29 29 0a  l) reg reruns)).
56e0: 09 09 20 28 28 61 6e 64 20 68 61 76 65 2d 72 65  .. ((and have-re
56f0: 73 6f 75 72 63 65 73 0a 09 09 20 20 20 20 20 20  sources...      
5700: 20 28 6f 72 20 28 6e 75 6c 6c 3f 20 70 72 65 72   (or (null? prer
5710: 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09 09  eqs-not-met)....
5720: 20 20 20 28 61 6e 64 20 28 65 71 3f 20 74 65 73     (and (eq? tes
5730: 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c 29  tmode 'toplevel)
5740: 0a 09 09 09 09 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d  .....(null? non-
5750: 63 6f 6d 70 6c 65 74 65 64 29 29 29 29 0a 09 09  completed))))...
5760: 20 20 28 72 75 6e 3a 74 65 73 74 20 72 75 6e 2d    (run:test run-
5770: 69 64 20 72 75 6e 6e 61 6d 65 20 6b 65 79 76 61  id runname keyva
5780: 6c 6c 73 74 20 74 65 73 74 2d 72 65 63 6f 72 64  llst test-record
5790: 20 66 6c 61 67 73 20 23 66 29 0a 09 09 20 20 28   flags #f)...  (
57a0: 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20  hash-table-set! 
57b0: 74 65 73 74 2d 72 65 67 69 73 74 72 79 20 28 72  test-registry (r
57c0: 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65  uns:make-full-te
57d0: 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 6e 61 6d  st-name test-nam
57e0: 65 20 69 74 65 6d 2d 70 61 74 68 29 20 27 72 75  e item-path) 'ru
57f0: 6e 6e 69 6e 67 29 0a 09 09 20 20 28 72 75 6e 73  nning)...  (runs
5800: 3a 73 68 72 69 6e 6b 2d 63 61 6e 2d 72 75 6e 2d  :shrink-can-run-
5810: 6d 6f 72 65 2d 74 65 73 74 73 2d 63 6f 75 6e 74  more-tests-count
5820: 29 20 20 3b 3b 20 44 45 4c 41 59 20 54 57 45 41  )  ;; DELAY TWEA
5830: 4b 45 52 20 28 73 74 69 6c 6c 20 6e 65 65 64 65  KER (still neede
5840: 64 3f 29 0a 09 09 20 20 3b 3b 20 28 74 68 72 65  d?)...  ;; (thre
5850: 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61  ad-sleep! *globa
5860: 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 20 20 28 69  l-delta*)...  (i
5870: 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61  f (not (null? ta
5880: 6c 29 29 0a 09 09 20 20 20 20 20 20 28 6c 6f 6f  l))...      (loo
5890: 70 20 28 72 75 6e 73 3a 71 75 65 75 65 2d 6e 65  p (runs:queue-ne
58a0: 78 74 2d 68 65 64 20 74 61 6c 20 72 65 67 20 72  xt-hed tal reg r
58b0: 65 67 6c 65 6e 20 72 65 67 66 75 6c 6c 29 0a 09  eglen regfull)..
58c0: 09 09 20 20 20 20 28 72 75 6e 73 3a 71 75 65 75  ..    (runs:queu
58d0: 65 2d 6e 65 78 74 2d 74 61 6c 20 74 61 6c 20 72  e-next-tal tal r
58e0: 65 67 20 72 65 67 6c 65 6e 20 72 65 67 66 75 6c  eg reglen regful
58f0: 6c 29 0a 09 09 09 20 20 20 20 28 72 75 6e 73 3a  l)....    (runs:
5900: 71 75 65 75 65 2d 6e 65 78 74 2d 72 65 67 20 74  queue-next-reg t
5910: 61 6c 20 72 65 67 20 72 65 67 6c 65 6e 20 72 65  al reg reglen re
5920: 67 66 75 6c 6c 29 0a 09 09 09 20 20 20 20 72 65  gfull)....    re
5930: 72 75 6e 73 29 29 29 0a 09 09 20 28 65 6c 73 65  runs)))... (else
5940: 20 3b 3b 20 6d 75 73 74 20 62 65 20 77 65 20 68   ;; must be we h
5950: 61 76 65 20 75 6e 6d 65 74 20 70 72 65 72 65 71  ave unmet prereq
5960: 75 69 73 69 74 65 73 0a 09 09 20 20 20 20 28 64  uisites...    (d
5970: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 46 41  ebug:print 4 "FA
5980: 49 4c 53 3a 20 22 20 66 61 69 6c 73 29 0a 09 09  ILS: " fails)...
5990: 20 20 20 20 3b 3b 20 49 66 20 6f 6e 65 20 6f 72      ;; If one or
59a0: 20 6d 6f 72 65 20 6f 66 20 74 68 65 20 70 72 65   more of the pre
59b0: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 61 72 65  reqs-not-met are
59c0: 20 46 41 49 4c 20 74 68 65 6e 20 77 65 20 63 61   FAIL then we ca
59d0: 6e 20 69 73 73 75 65 0a 09 09 20 20 20 20 3b 3b  n issue...    ;;
59e0: 20 61 20 6d 65 73 73 61 67 65 20 61 6e 64 20 64   a message and d
59f0: 72 6f 70 20 68 65 64 20 66 72 6f 6d 20 74 68 65  rop hed from the
5a00: 20 69 74 65 6d 73 20 74 6f 20 62 65 20 70 72 6f   items to be pro
5a10: 63 65 73 73 65 64 2e 0a 09 09 20 20 20 20 28 69  cessed....    (i
5a20: 66 20 28 6e 75 6c 6c 3f 20 66 61 69 6c 73 29 0a  f (null? fails).
5a30: 09 09 09 28 62 65 67 69 6e 0a 09 09 09 20 20 3b  ...(begin....  ;
5a40: 3b 20 63 6f 75 6c 64 6e 27 74 20 72 75 6e 2c 20  ; couldn't run, 
5a50: 74 61 6b 65 20 61 20 62 72 65 61 74 68 65 72 0a  take a breather.
5a60: 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e  ...  (debug:prin
5a70: 74 2d 69 6e 66 6f 20 34 20 22 53 68 6f 75 6c 64  t-info 4 "Should
5a80: 6e 27 74 20 72 65 61 6c 6c 79 20 67 65 74 20 68  n't really get h
5a90: 65 72 65 2c 20 72 61 63 65 20 63 6f 6e 64 69 74  ere, race condit
5aa0: 69 6f 6e 3f 20 55 6e 61 62 6c 65 20 74 6f 20 6c  ion? Unable to l
5ab0: 61 75 6e 63 68 20 6d 6f 72 65 20 74 65 73 74 73  aunch more tests
5ac0: 20 61 74 20 74 68 69 73 20 6d 6f 6d 65 6e 74 2c   at this moment,
5ad0: 20 6b 69 6c 6c 69 6e 67 20 74 69 6d 65 20 2e 2e   killing time ..
5ae0: 2e 22 29 0a 09 09 09 20 20 3b 3b 20 28 74 68 72  .")....  ;; (thr
5af0: 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 30 2e  ead-sleep! (+ 0.
5b00: 30 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61  01 *global-delta
5b10: 2a 29 29 20 3b 3b 20 6c 6f 6e 67 20 73 6c 65 65  *)) ;; long slee
5b20: 70 20 68 65 72 65 20 2d 20 6e 6f 20 72 65 73 6f  p here - no reso
5b30: 75 72 63 65 73 2c 20 6d 61 79 20 61 73 20 77 65  urces, may as we
5b40: 6c 6c 20 62 65 20 70 61 74 69 65 6e 74 0a 09 09  ll be patient...
5b50: 09 20 20 3b 3b 20 77 65 20 6d 61 64 65 20 6e 65  .  ;; we made ne
5b60: 77 20 74 61 6c 20 62 79 20 73 74 69 63 6b 69 6e  w tal by stickin
5b70: 67 20 68 65 64 20 61 74 20 74 68 65 20 62 61 63  g hed at the bac
5b80: 6b 20 6f 66 20 74 68 65 20 6c 69 73 74 0a 09 09  k of the list...
5b90: 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65  .  (loop (car ne
5ba0: 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c  wtal)(cdr newtal
5bb0: 29 20 72 65 67 20 72 65 72 75 6e 73 29 29 0a 09  ) reg reruns))..
5bc0: 09 09 3b 3b 20 74 68 65 20 77 61 69 74 6f 6e 20  ..;; the waiton 
5bd0: 69 73 20 46 41 49 4c 20 73 6f 20 6e 6f 20 70 6f  is FAIL so no po
5be0: 69 6e 74 20 69 6e 20 74 72 79 69 6e 67 20 74 6f  int in trying to
5bf0: 20 72 75 6e 20 68 65 64 20 65 76 65 72 20 61 67   run hed ever ag
5c00: 61 69 6e 0a 09 09 09 28 69 66 20 28 6e 6f 74 20  ain....(if (not 
5c10: 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 09  (null? tal))....
5c20: 20 20 20 20 28 69 66 20 28 76 65 63 74 6f 72 3f      (if (vector?
5c30: 20 68 65 64 29 0a 09 09 09 09 28 62 65 67 69 6e   hed).....(begin
5c40: 20 0a 09 09 09 09 20 20 28 64 65 62 75 67 3a 70   .....  (debug:p
5c50: 72 69 6e 74 20 31 20 22 57 41 52 4e 3a 20 44 72  rint 1 "WARN: Dr
5c60: 6f 70 70 69 6e 67 20 74 65 73 74 20 22 20 28 64  opping test " (d
5c70: 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e  b:test-get-testn
5c80: 61 6d 65 20 68 65 64 29 20 22 2f 22 20 28 64 62  ame hed) "/" (db
5c90: 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70  :test-get-item-p
5ca0: 61 74 68 20 68 65 64 29 0a 09 09 09 09 09 20 20  ath hed)......  
5cb0: 20 20 20 20 20 22 20 66 72 6f 6d 20 74 68 65 20       " from the 
5cc0: 6c 61 75 6e 63 68 20 6c 69 73 74 20 61 73 20 69  launch list as i
5cd0: 74 20 68 61 73 20 70 72 65 72 65 71 75 69 73 74  t has prerequist
5ce0: 65 73 20 74 68 61 74 20 61 72 65 20 46 41 49 4c  es that are FAIL
5cf0: 22 29 0a 09 09 09 09 20 20 28 72 75 6e 73 3a 73  ").....  (runs:s
5d00: 68 72 69 6e 6b 2d 63 61 6e 2d 72 75 6e 2d 6d 6f  hrink-can-run-mo
5d10: 72 65 2d 74 65 73 74 73 2d 63 6f 75 6e 74 29 20  re-tests-count) 
5d20: 3b 3b 20 44 45 4c 41 59 20 54 57 45 41 4b 45 52  ;; DELAY TWEAKER
5d30: 20 28 73 74 69 6c 6c 20 6e 65 65 64 65 64 3f 29   (still needed?)
5d40: 0a 09 09 09 09 20 20 3b 3b 20 28 74 68 72 65 61  .....  ;; (threa
5d50: 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c  d-sleep! *global
5d60: 2d 64 65 6c 74 61 2a 29 0a 09 09 09 09 20 20 28  -delta*).....  (
5d70: 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20  hash-table-set! 
5d80: 74 65 73 74 2d 72 65 67 69 73 74 72 79 20 28 72  test-registry (r
5d90: 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65  uns:make-full-te
5da0: 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 6e 61 6d  st-name test-nam
5db0: 65 20 69 74 65 6d 2d 70 61 74 68 29 20 27 72 65  e item-path) 're
5dc0: 6d 6f 76 65 64 29 0a 09 09 09 09 20 20 28 6c 6f  moved).....  (lo
5dd0: 6f 70 20 28 72 75 6e 73 3a 71 75 65 75 65 2d 6e  op (runs:queue-n
5de0: 65 78 74 2d 68 65 64 20 74 61 6c 20 72 65 67 20  ext-hed tal reg 
5df0: 72 65 67 6c 65 6e 20 72 65 67 66 75 6c 6c 29 0a  reglen regfull).
5e00: 09 09 09 09 09 28 72 75 6e 73 3a 71 75 65 75 65  .....(runs:queue
5e10: 2d 6e 65 78 74 2d 74 61 6c 20 74 61 6c 20 72 65  -next-tal tal re
5e20: 67 20 72 65 67 6c 65 6e 20 72 65 67 66 75 6c 6c  g reglen regfull
5e30: 29 0a 09 09 09 09 09 28 72 75 6e 73 3a 71 75 65  )......(runs:que
5e40: 75 65 2d 6e 65 78 74 2d 72 65 67 20 74 61 6c 20  ue-next-reg tal 
5e50: 72 65 67 20 72 65 67 6c 65 6e 20 72 65 67 66 75  reg reglen regfu
5e60: 6c 6c 29 0a 09 09 09 09 09 28 63 6f 6e 73 20 68  ll)......(cons h
5e70: 65 64 20 72 65 72 75 6e 73 29 29 29 0a 09 09 09  ed reruns)))....
5e80: 09 28 62 65 67 69 6e 0a 09 09 09 09 20 20 28 64  .(begin.....  (d
5e90: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 57 41  ebug:print 1 "WA
5ea0: 52 4e 3a 20 54 65 73 74 20 6e 6f 74 20 70 72 6f  RN: Test not pro
5eb0: 63 65 73 73 65 64 20 63 6f 72 72 65 63 74 6c 79  cessed correctly
5ec0: 2e 20 43 6f 75 6c 64 20 62 65 20 61 20 72 61 63  . Could be a rac
5ed0: 65 20 63 6f 6e 64 69 74 69 6f 6e 20 69 6e 20 79  e condition in y
5ee0: 6f 75 72 20 74 65 73 74 20 69 6d 70 6c 65 6d 65  our test impleme
5ef0: 6e 74 61 74 69 6f 6e 3f 20 22 20 68 65 64 29 20  ntation? " hed) 
5f00: 3b 3b 20 20 22 20 61 73 20 69 74 20 68 61 73 20  ;;  " as it has 
5f10: 70 72 65 72 65 71 75 69 73 74 65 73 20 74 68 61  prerequistes tha
5f20: 74 20 61 72 65 20 46 41 49 4c 2e 20 28 4e 4f 54  t are FAIL. (NOT
5f30: 45 3a 20 68 65 64 20 69 73 20 6e 6f 74 20 61 20  E: hed is not a 
5f40: 76 65 63 74 6f 72 29 22 29 0a 09 09 09 09 20 20  vector)").....  
5f50: 28 72 75 6e 73 3a 73 68 72 69 6e 6b 2d 63 61 6e  (runs:shrink-can
5f60: 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d  -run-more-tests-
5f70: 63 6f 75 6e 74 29 20 3b 3b 20 44 45 4c 41 59 20  count) ;; DELAY 
5f80: 54 57 45 41 4b 45 52 20 28 73 74 69 6c 6c 20 6e  TWEAKER (still n
5f90: 65 65 64 65 64 3f 29 0a 09 09 09 09 20 20 3b 3b  eeded?).....  ;;
5fa0: 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20   (thread-sleep! 
5fb0: 28 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d  (+ 0.01 *global-
5fc0: 64 65 6c 74 61 2a 29 29 0a 09 09 09 09 20 20 28  delta*)).....  (
5fd0: 6c 6f 6f 70 20 68 65 64 20 74 61 6c 20 72 65 67  loop hed tal reg
5fe0: 20 72 65 72 75 6e 73 29 29 29 29 29 29 29 29 29   reruns)))))))))
5ff0: 20 3b 3b 20 45 4e 44 20 4f 46 20 49 4e 4e 45 52   ;; END OF INNER
6000: 20 43 4f 4e 44 0a 09 20 20 20 20 20 0a 09 20 20   COND..     ..  
6010: 20 20 20 3b 3b 20 63 61 73 65 20 77 68 65 72 65     ;; case where
6020: 20 61 6e 20 69 74 65 6d 73 20 63 61 6d 65 20 69   an items came i
6030: 6e 20 61 73 20 61 20 6c 69 73 74 20 62 65 65 6e  n as a list been
6040: 20 70 72 6f 63 65 73 73 65 64 0a 09 20 20 20 20   processed..    
6050: 20 28 28 61 6e 64 20 28 6c 69 73 74 3f 20 69 74   ((and (list? it
6060: 65 6d 73 29 20 20 20 20 20 3b 3b 20 74 68 75 73  ems)     ;; thus
6070: 20 77 65 20 6b 6e 6f 77 20 6f 75 72 20 69 74 65   we know our ite
6080: 6d 73 20 61 72 65 20 61 6c 72 65 61 64 79 20 63  ms are already c
6090: 61 6c 63 75 6c 61 74 65 64 0a 09 09 20 20 20 28  alculated...   (
60a0: 6e 6f 74 20 20 20 69 74 65 6d 64 61 74 29 29 20  not   itemdat)) 
60b0: 3b 3b 20 61 6e 64 20 6e 6f 74 20 79 65 74 20 65  ;; and not yet e
60c0: 78 70 61 6e 64 65 64 20 69 6e 74 6f 20 74 68 65  xpanded into the
60d0: 20 6c 69 73 74 20 6f 66 20 74 68 69 6e 67 73 20   list of things 
60e0: 74 6f 20 62 65 20 64 6f 6e 65 0a 09 20 20 20 20  to be done..    
60f0: 20 20 28 69 66 20 28 61 6e 64 20 28 64 65 62 75    (if (and (debu
6100: 67 3a 64 65 62 75 67 2d 6d 6f 64 65 20 31 29 20  g:debug-mode 1) 
6110: 3b 3b 20 28 3e 3d 20 2a 76 65 72 62 6f 73 69 74  ;; (>= *verbosit
6120: 79 2a 20 31 29 0a 09 09 20 20 20 20 20 20 20 28  y* 1)...       (
6130: 3e 20 28 6c 65 6e 67 74 68 20 69 74 65 6d 73 29  > (length items)
6140: 20 30 29 0a 09 09 20 20 20 20 20 20 20 28 3e 20   0)...       (> 
6150: 28 6c 65 6e 67 74 68 20 28 63 61 72 20 69 74 65  (length (car ite
6160: 6d 73 29 29 20 30 29 29 0a 09 09 20 20 28 70 70  ms)) 0))...  (pp
6170: 20 69 74 65 6d 73 29 29 0a 09 20 20 20 20 20 20   items))..      
6180: 28 66 6f 72 2d 65 61 63 68 0a 09 20 20 20 20 20  (for-each..     
6190: 20 20 28 6c 61 6d 62 64 61 20 28 6d 79 2d 69 74    (lambda (my-it
61a0: 65 6d 64 61 74 29 0a 09 09 20 28 6c 65 74 2a 20  emdat)... (let* 
61b0: 28 28 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72  ((new-test-recor
61c0: 64 20 28 6c 65 74 20 28 28 6e 65 77 72 65 63 20  d (let ((newrec 
61d0: 28 6d 61 6b 65 2d 74 65 73 74 73 3a 74 65 73 74  (make-tests:test
61e0: 71 75 65 75 65 29 29 29 0a 09 09 09 09 09 20 20  queue)))......  
61f0: 20 28 76 65 63 74 6f 72 2d 63 6f 70 79 21 20 74   (vector-copy! t
6200: 65 73 74 2d 72 65 63 6f 72 64 20 6e 65 77 72 65  est-record newre
6210: 63 29 0a 09 09 09 09 09 20 20 20 6e 65 77 72 65  c)......   newre
6220: 63 29 29 0a 09 09 09 28 6d 79 2d 69 74 65 6d 2d  c))....(my-item-
6230: 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d  path (item-list-
6240: 3e 70 61 74 68 20 6d 79 2d 69 74 65 6d 64 61 74  >path my-itemdat
6250: 29 29 29 0a 09 09 20 20 20 28 69 66 20 28 74 65  )))...   (if (te
6260: 73 74 73 3a 6d 61 74 63 68 20 74 65 73 74 2d 70  sts:match test-p
6270: 61 74 74 73 20 68 65 64 20 6d 79 2d 69 74 65 6d  atts hed my-item
6280: 2d 70 61 74 68 29 20 3b 3b 20 28 70 61 74 74 2d  -path) ;; (patt-
6290: 6c 69 73 74 2d 6d 61 74 63 68 20 6d 79 2d 69 74  list-match my-it
62a0: 65 6d 2d 70 61 74 68 20 69 74 65 6d 2d 70 61 74  em-path item-pat
62b0: 74 73 29 20 20 20 20 20 20 20 20 20 20 20 3b 3b  ts)           ;;
62c0: 20 79 65 73 2c 20 77 65 20 77 61 6e 74 20 74 6f   yes, we want to
62d0: 20 70 72 6f 63 65 73 73 20 74 68 69 73 20 69 74   process this it
62e0: 65 6d 2c 20 4e 4f 54 45 3a 20 53 68 6f 75 6c 64  em, NOTE: Should
62f0: 20 6e 6f 74 20 6e 65 65 64 20 74 68 69 73 20 63   not need this c
6300: 68 65 63 6b 20 68 65 72 65 21 0a 09 09 20 20 20  heck here!...   
6310: 20 20 20 20 28 6c 65 74 20 28 28 6e 65 77 74 65      (let ((newte
6320: 73 74 6e 61 6d 65 20 28 72 75 6e 73 3a 6d 61 6b  stname (runs:mak
6330: 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65  e-full-test-name
6340: 20 68 65 64 20 6d 79 2d 69 74 65 6d 2d 70 61 74   hed my-item-pat
6350: 68 29 29 29 20 20 20 20 3b 3b 20 74 65 73 74 20  h)))    ;; test 
6360: 6e 61 6d 65 73 20 61 72 65 20 75 6e 69 71 75 65  names are unique
6370: 20 6f 6e 20 74 65 73 74 6e 61 6d 65 2f 69 74 65   on testname/ite
6380: 6d 2d 70 61 74 68 0a 09 09 09 20 28 74 65 73 74  m-path.... (test
6390: 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d  s:testqueue-set-
63a0: 69 74 65 6d 73 21 20 20 20 20 20 6e 65 77 2d 74  items!     new-t
63b0: 65 73 74 2d 72 65 63 6f 72 64 20 23 66 29 0a 09  est-record #f)..
63c0: 09 09 20 28 74 65 73 74 73 3a 74 65 73 74 71 75  .. (tests:testqu
63d0: 65 75 65 2d 73 65 74 2d 69 74 65 6d 64 61 74 21  eue-set-itemdat!
63e0: 20 20 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f     new-test-reco
63f0: 72 64 20 6d 79 2d 69 74 65 6d 64 61 74 29 0a 09  rd my-itemdat)..
6400: 09 09 20 28 74 65 73 74 73 3a 74 65 73 74 71 75  .. (tests:testqu
6410: 65 75 65 2d 73 65 74 2d 69 74 65 6d 5f 70 61 74  eue-set-item_pat
6420: 68 21 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f  h! new-test-reco
6430: 72 64 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68 29  rd my-item-path)
6440: 0a 09 09 09 20 28 68 61 73 68 2d 74 61 62 6c 65  .... (hash-table
6450: 2d 73 65 74 21 20 74 65 73 74 2d 72 65 63 6f 72  -set! test-recor
6460: 64 73 20 6e 65 77 74 65 73 74 6e 61 6d 65 20 6e  ds newtestname n
6470: 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 29 0a  ew-test-record).
6480: 09 09 09 20 28 73 65 74 21 20 74 61 6c 20 28 63  ... (set! tal (c
6490: 6f 6e 73 20 6e 65 77 74 65 73 74 6e 61 6d 65 20  ons newtestname 
64a0: 74 61 6c 29 29 29 29 29 29 20 3b 3b 20 73 69 6e  tal)))))) ;; sin
64b0: 63 65 20 74 68 65 73 65 20 61 72 65 20 69 74 65  ce these are ite
64c0: 6d 69 7a 65 64 20 63 72 65 61 74 65 20 6e 65 77  mized create new
64d0: 20 74 65 73 74 20 6e 61 6d 65 73 20 74 65 73 74   test names test
64e0: 6e 61 6d 65 2f 69 74 65 6d 70 61 74 68 0a 09 20  name/itempath.. 
64f0: 20 20 20 20 20 20 69 74 65 6d 73 29 0a 09 20 20        items)..  
6500: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75      (if (not (nu
6510: 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 20 20 28 62  ll? tal))...  (b
6520: 65 67 69 6e 0a 09 09 20 20 20 20 28 64 65 62 75  egin...    (debu
6530: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22  g:print-info 4 "
6540: 45 6e 64 20 6f 66 20 69 74 65 6d 73 20 6c 69 73  End of items lis
6550: 74 2c 20 6c 6f 6f 70 69 6e 67 20 77 69 74 68 20  t, looping with 
6560: 6e 65 78 74 20 61 66 74 65 72 20 73 68 6f 72 74  next after short
6570: 20 64 65 6c 61 79 22 29 0a 20 20 20 20 20 20 20   delay").       
6580: 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20               ;; 
6590: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28  (thread-sleep! (
65a0: 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d 64  + 0.01 *global-d
65b0: 65 6c 74 61 2a 29 29 0a 09 09 20 20 20 20 28 6c  elta*))...    (l
65c0: 6f 6f 70 20 28 72 75 6e 73 3a 71 75 65 75 65 2d  oop (runs:queue-
65d0: 6e 65 78 74 2d 68 65 64 20 74 61 6c 20 72 65 67  next-hed tal reg
65e0: 20 72 65 67 6c 65 6e 20 72 65 67 66 75 6c 6c 29   reglen regfull)
65f0: 0a 09 09 09 20 20 28 72 75 6e 73 3a 71 75 65 75  ....  (runs:queu
6600: 65 2d 6e 65 78 74 2d 74 61 6c 20 74 61 6c 20 72  e-next-tal tal r
6610: 65 67 20 72 65 67 6c 65 6e 20 72 65 67 66 75 6c  eg reglen regful
6620: 6c 29 0a 09 09 09 20 20 28 72 75 6e 73 3a 71 75  l)....  (runs:qu
6630: 65 75 65 2d 6e 65 78 74 2d 72 65 67 20 74 61 6c  eue-next-reg tal
6640: 20 72 65 67 20 72 65 67 6c 65 6e 20 72 65 67 66   reg reglen regf
6650: 75 6c 6c 29 0a 09 09 09 20 20 72 65 72 75 6e 73  ull)....  reruns
6660: 29 29 29 29 0a 0a 09 20 20 20 20 20 3b 3b 20 69  ))))...     ;; i
6670: 66 20 69 74 65 6d 73 20 69 73 20 61 20 70 72 6f  f items is a pro
6680: 63 20 74 68 65 6e 20 6e 65 65 64 20 74 6f 20 72  c then need to r
6690: 75 6e 20 69 74 65 6d 73 3a 67 65 74 2d 69 74 65  un items:get-ite
66a0: 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 2c 20  ms-from-config, 
66b0: 67 65 74 20 74 68 65 20 6c 69 73 74 20 61 6e 64  get the list and
66c0: 20 6c 6f 6f 70 20 0a 09 20 20 20 20 20 3b 3b 20   loop ..     ;; 
66d0: 20 20 20 2d 20 62 75 74 20 6f 6e 6c 79 20 64 6f     - but only do
66e0: 20 74 68 61 74 20 69 66 20 72 65 73 6f 75 72 63   that if resourc
66f0: 65 73 20 65 78 69 73 74 20 74 6f 20 6b 69 63 6b  es exist to kick
6700: 20 6f 66 66 20 74 68 65 20 6a 6f 62 0a 09 20 20   off the job..  
6710: 20 20 20 28 28 6f 72 20 28 70 72 6f 63 65 64 75     ((or (procedu
6720: 72 65 3f 20 69 74 65 6d 73 29 28 65 71 3f 20 69  re? items)(eq? i
6730: 74 65 6d 73 20 27 68 61 76 65 2d 70 72 6f 63 65  tems 'have-proce
6740: 64 75 72 65 29 29 0a 09 20 20 20 20 20 20 28 6c  dure))..      (l
6750: 65 74 20 28 28 63 61 6e 2d 72 75 6e 2d 6d 6f 72  et ((can-run-mor
6760: 65 20 20 20 20 28 72 75 6e 73 3a 63 61 6e 2d 72  e    (runs:can-r
6770: 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 74 65  un-more-tests te
6780: 73 74 2d 72 65 63 6f 72 64 20 6d 61 78 2d 63 6f  st-record max-co
6790: 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 29 29 29  ncurrent-jobs)))
67a0: 0a 09 09 28 69 66 20 28 61 6e 64 20 28 6c 69 73  ...(if (and (lis
67b0: 74 3f 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 29  t? can-run-more)
67c0: 0a 09 09 09 20 28 63 61 72 20 63 61 6e 2d 72 75  .... (car can-ru
67d0: 6e 2d 6d 6f 72 65 29 29 0a 09 09 20 20 20 20 28  n-more))...    (
67e0: 6c 65 74 2a 20 28 28 70 72 65 72 65 71 73 2d 6e  let* ((prereqs-n
67f0: 6f 74 2d 6d 65 74 20 28 64 62 3a 67 65 74 2d 70  ot-met (db:get-p
6800: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 72  rereqs-not-met r
6810: 75 6e 2d 69 64 20 77 61 69 74 6f 6e 73 20 69 74  un-id waitons it
6820: 65 6d 2d 70 61 74 68 20 6d 6f 64 65 3a 20 74 65  em-path mode: te
6830: 73 74 6d 6f 64 65 29 29 0a 09 09 09 20 20 20 28  stmode))....   (
6840: 66 61 69 6c 73 20 20 20 20 20 20 20 20 20 20 20  fails           
6850: 28 72 75 6e 73 3a 63 61 6c 63 2d 66 61 69 6c 73  (runs:calc-fails
6860: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74   prereqs-not-met
6870: 29 29 0a 09 09 09 20 20 20 28 6e 6f 6e 2d 63 6f  ))....   (non-co
6880: 6d 70 6c 65 74 65 64 20 20 20 28 72 75 6e 73 3a  mpleted   (runs:
6890: 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 74  calc-not-complet
68a0: 65 64 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d  ed prereqs-not-m
68b0: 65 74 29 29 29 0a 09 09 20 20 20 20 20 20 28 64  et)))...      (d
68c0: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
68d0: 38 20 22 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 3a  8 "can-run-more:
68e0: 20 22 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 0a   " can-run-more.
68f0: 09 09 09 09 20 20 20 22 5c 6e 20 74 65 73 74 6e  ....   "\n testn
6900: 61 6d 65 3a 20 20 20 20 20 20 20 20 22 20 68 65  ame:        " he
6910: 64 0a 09 09 09 09 20 20 20 22 5c 6e 20 70 72 65  d.....   "\n pre
6920: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 3a 20 22 20  reqs-not-met: " 
6930: 28 72 75 6e 73 3a 70 72 65 74 74 79 2d 73 74 72  (runs:pretty-str
6940: 69 6e 67 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d  ing prereqs-not-
6950: 6d 65 74 29 0a 09 09 09 09 20 20 20 22 5c 6e 20  met).....   "\n 
6960: 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 3a 20 20  non-completed:  
6970: 20 22 20 28 72 75 6e 73 3a 70 72 65 74 74 79 2d   " (runs:pretty-
6980: 73 74 72 69 6e 67 20 6e 6f 6e 2d 63 6f 6d 70 6c  string non-compl
6990: 65 74 65 64 29 20 0a 09 09 09 09 20 20 20 22 5c  eted) .....   "\
69a0: 6e 20 66 61 69 6c 73 3a 20 20 20 20 20 20 20 20  n fails:        
69b0: 20 20 20 22 20 28 72 75 6e 73 3a 70 72 65 74 74     " (runs:prett
69c0: 79 2d 73 74 72 69 6e 67 20 66 61 69 6c 73 29 0a  y-string fails).
69d0: 09 09 09 09 20 20 20 22 5c 6e 20 74 65 73 74 6d  ....   "\n testm
69e0: 6f 64 65 3a 20 20 20 20 20 20 20 20 22 20 74 65  ode:        " te
69f0: 73 74 6d 6f 64 65 0a 09 09 09 09 20 20 20 22 5c  stmode.....   "\
6a00: 6e 20 6e 75 6d 2d 72 65 74 72 69 65 73 3a 20 20  n num-retries:  
6a10: 20 20 20 22 20 6e 75 6d 2d 72 65 74 72 69 65 73     " num-retries
6a20: 0a 09 09 09 09 20 20 20 22 5c 6e 20 28 65 71 3f  .....   "\n (eq?
6a30: 20 74 65 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65   testmode 'tople
6a40: 76 65 6c 29 3a 20 22 20 28 65 71 3f 20 74 65 73  vel): " (eq? tes
6a50: 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c 29  tmode 'toplevel)
6a60: 0a 09 09 09 09 20 20 20 22 5c 6e 20 28 6e 75 6c  .....   "\n (nul
6a70: 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64  l? non-completed
6a80: 29 3a 20 20 20 20 22 20 28 6e 75 6c 6c 3f 20 6e  ):    " (null? n
6a90: 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 0a 09 09  on-completed)...
6aa0: 09 09 20 20 20 22 5c 6e 20 72 65 72 75 6e 73 3a  ..   "\n reruns:
6ab0: 20 20 20 20 20 20 20 20 20 20 22 20 72 65 72 75            " reru
6ac0: 6e 73 0a 09 09 09 09 20 20 20 22 5c 6e 20 69 74  ns.....   "\n it
6ad0: 65 6d 73 3a 20 20 20 20 20 20 20 20 20 20 20 22  ems:           "
6ae0: 20 69 74 65 6d 73 0a 09 09 09 09 20 20 20 22 5c   items.....   "\
6af0: 6e 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 3a 20  n can-run-more: 
6b00: 20 20 20 22 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72     " can-run-mor
6b10: 65 29 0a 09 09 20 20 20 20 20 20 3b 3b 20 28 74  e)...      ;; (t
6b20: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20  hread-sleep! (+ 
6b30: 30 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c  0.01 *global-del
6b40: 74 61 2a 29 29 0a 09 09 20 20 20 20 20 20 28 63  ta*))...      (c
6b50: 6f 6e 64 20 3b 3b 20 49 4e 4e 45 52 20 43 4f 4e  ond ;; INNER CON
6b60: 44 20 23 32 0a 09 09 20 20 20 20 20 20 20 28 28  D #2...       ((
6b70: 6f 72 20 28 6e 75 6c 6c 3f 20 70 72 65 72 65 71  or (null? prereq
6b80: 73 2d 6e 6f 74 2d 6d 65 74 29 20 3b 3b 20 61 6c  s-not-met) ;; al
6b90: 6c 20 70 72 65 72 65 71 73 20 6d 65 74 2c 20 66  l prereqs met, f
6ba0: 69 72 65 20 6f 66 66 20 74 68 65 20 74 65 73 74  ire off the test
6bb0: 0a 09 09 09 20 20 20 20 3b 3b 20 6f 72 2c 20 69  ....    ;; or, i
6bc0: 66 20 69 74 20 69 73 20 61 20 27 74 6f 70 6c 65  f it is a 'tople
6bd0: 76 65 6c 20 74 65 73 74 20 61 6e 64 20 61 6c 6c  vel test and all
6be0: 20 70 72 65 72 65 71 73 20 6e 6f 74 20 6d 65 74   prereqs not met
6bf0: 20 61 72 65 20 43 4f 4d 50 4c 45 54 45 44 20 74   are COMPLETED t
6c00: 68 65 6e 20 6c 61 75 6e 63 68 0a 09 09 09 20 20  hen launch....  
6c10: 20 20 28 61 6e 64 20 28 65 71 3f 20 74 65 73 74    (and (eq? test
6c20: 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c 29 0a  mode 'toplevel).
6c30: 09 09 09 09 20 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d  .... (null? non-
6c40: 63 6f 6d 70 6c 65 74 65 64 29 29 29 0a 09 09 09  completed)))....
6c50: 28 6c 65 74 20 28 28 74 65 73 74 2d 6e 61 6d 65  (let ((test-name
6c60: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75   (tests:testqueu
6c70: 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74  e-get-testname t
6c80: 65 73 74 2d 72 65 63 6f 72 64 29 29 29 0a 09 09  est-record)))...
6c90: 09 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 54  .  (setenv "MT_T
6ca0: 45 53 54 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e  EST_NAME" test-n
6cb0: 61 6d 65 29 20 3b 3b 20 0a 09 09 09 20 20 28 73  ame) ;; ....  (s
6cc0: 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e 4e 41 4d  etenv "MT_RUNNAM
6cd0: 45 22 20 20 20 72 75 6e 6e 61 6d 65 29 0a 09 09  E"   runname)...
6ce0: 09 20 20 28 73 65 74 2d 6d 65 67 61 74 65 73 74  .  (set-megatest
6cf0: 2d 65 6e 76 2d 76 61 72 73 20 72 75 6e 2d 69 64  -env-vars run-id
6d00: 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62  ) ;; these may b
6d10: 65 20 6e 65 65 64 65 64 20 62 79 20 74 68 65 20  e needed by the 
6d20: 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73  launching proces
6d30: 73 0a 09 09 09 20 20 28 6c 65 74 20 28 28 69 74  s....  (let ((it
6d40: 65 6d 73 2d 6c 69 73 74 20 28 69 74 65 6d 73 3a  ems-list (items:
6d50: 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63  get-items-from-c
6d60: 6f 6e 66 69 67 20 74 63 6f 6e 66 69 67 29 29 29  onfig tconfig)))
6d70: 0a 09 09 09 20 20 20 20 28 69 66 20 28 6c 69 73  ....    (if (lis
6d80: 74 3f 20 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09  t? items-list)..
6d90: 09 09 09 28 62 65 67 69 6e 0a 09 09 09 09 20 20  ...(begin.....  
6da0: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65  (tests:testqueue
6db0: 2d 73 65 74 2d 69 74 65 6d 73 21 20 74 65 73 74  -set-items! test
6dc0: 2d 72 65 63 6f 72 64 20 69 74 65 6d 73 2d 6c 69  -record items-li
6dd0: 73 74 29 0a 09 09 09 09 20 20 3b 3b 20 28 74 68  st).....  ;; (th
6de0: 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f  read-sleep! *glo
6df0: 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 09 09  bal-delta*).....
6e00: 20 20 28 6c 6f 6f 70 20 68 65 64 20 74 61 6c 20    (loop hed tal 
6e10: 72 65 67 20 72 65 72 75 6e 73 29 29 0a 09 09 09  reg reruns))....
6e20: 09 28 62 65 67 69 6e 0a 09 09 09 09 20 20 28 64  .(begin.....  (d
6e30: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
6e40: 52 4f 52 3a 20 54 68 65 20 70 72 6f 63 20 66 72  ROR: The proc fr
6e50: 6f 6d 20 72 65 61 64 69 6e 67 20 74 68 65 20 73  om reading the s
6e60: 65 74 75 70 20 64 69 64 20 6e 6f 74 20 79 69 65  etup did not yie
6e70: 6c 64 20 61 20 6c 69 73 74 20 2d 20 70 6c 65 61  ld a list - plea
6e80: 73 65 20 72 65 70 6f 72 74 20 74 68 69 73 22 29  se report this")
6e90: 0a 09 09 09 09 20 20 28 65 78 69 74 20 31 29 29  .....  (exit 1))
6ea0: 29 29 29 29 0a 09 09 20 20 20 20 20 20 20 28 28  ))))...       ((
6eb0: 6e 75 6c 6c 3f 20 66 61 69 6c 73 29 0a 09 09 09  null? fails)....
6ec0: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
6ed0: 6f 20 34 20 22 66 61 69 6c 73 20 69 73 20 6e 75  o 4 "fails is nu
6ee0: 6c 6c 2c 20 6d 6f 76 69 6e 67 20 6f 6e 20 69 6e  ll, moving on in
6ef0: 20 74 68 65 20 71 75 65 75 65 20 62 75 74 20 6b   the queue but k
6f00: 65 65 70 69 6e 67 20 22 20 68 65 64 20 22 20 66  eeping " hed " f
6f10: 6f 72 20 6e 6f 77 22 29 0a 09 09 09 3b 3b 20 6f  or now")....;; o
6f20: 6e 6c 79 20 69 6e 63 72 65 6d 65 6e 74 20 6e 75  nly increment nu
6f30: 6d 2d 72 65 74 72 69 65 73 20 77 68 65 6e 20 74  m-retries when t
6f40: 68 65 72 65 20 61 72 65 20 6e 6f 20 74 65 73 74  here are no test
6f50: 73 20 72 75 6e 69 6e 67 0a 09 09 09 28 69 66 20  s runing....(if 
6f60: 28 65 71 3f 20 30 20 28 6c 69 73 74 2d 72 65 66  (eq? 0 (list-ref
6f70: 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 20 31 29   can-run-more 1)
6f80: 29 0a 09 09 09 20 20 20 20 28 62 65 67 69 6e 0a  )....    (begin.
6f90: 09 09 09 20 20 20 20 20 20 3b 3b 20 54 52 59 20  ...      ;; TRY 
6fa0: 28 69 66 20 28 3e 20 6e 75 6d 2d 72 65 74 72 69  (if (> num-retri
6fb0: 65 73 20 31 30 30 29 20 3b 3b 20 66 69 72 73 74  es 100) ;; first
6fc0: 20 31 30 30 20 72 65 74 72 69 65 73 20 61 72 65   100 retries are
6fd0: 20 6c 6f 77 20 74 69 6d 65 20 63 6f 73 74 0a 09   low time cost..
6fe0: 09 09 20 20 20 20 20 20 3b 3b 20 54 52 59 20 20  ..      ;; TRY  
6ff0: 20 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70     (thread-sleep
7000: 21 20 28 2b 20 32 20 2a 67 6c 6f 62 61 6c 2d 64  ! (+ 2 *global-d
7010: 65 6c 74 61 2a 29 29 0a 09 09 09 20 20 20 20 20  elta*))....     
7020: 20 3b 3b 20 54 52 59 20 20 20 20 20 28 74 68 72   ;; TRY     (thr
7030: 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 30 2e  ead-sleep! (+ 0.
7040: 30 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61  01 *global-delta
7050: 2a 29 29 29 0a 09 09 09 20 20 20 20 20 20 28 73  *)))....      (s
7060: 65 74 21 20 6e 75 6d 2d 72 65 74 72 69 65 73 20  et! num-retries 
7070: 28 2b 20 6e 75 6d 2d 72 65 74 72 69 65 73 20 31  (+ num-retries 1
7080: 29 29 29 29 0a 09 09 09 28 69 66 20 28 3e 20 6e  ))))....(if (> n
7090: 75 6d 2d 72 65 74 72 69 65 73 20 20 6d 61 78 2d  um-retries  max-
70a0: 72 65 74 72 69 65 73 29 0a 09 09 09 20 20 20 20  retries)....    
70b0: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20  (if (not (null? 
70c0: 74 61 6c 29 29 0a 09 09 09 09 28 6c 6f 6f 70 20  tal)).....(loop 
70d0: 28 72 75 6e 73 3a 71 75 65 75 65 2d 6e 65 78 74  (runs:queue-next
70e0: 2d 68 65 64 20 74 61 6c 20 72 65 67 20 72 65 67  -hed tal reg reg
70f0: 6c 65 6e 20 72 65 67 66 75 6c 6c 29 0a 09 09 09  len regfull)....
7100: 09 20 20 20 20 20 20 28 72 75 6e 73 3a 71 75 65  .      (runs:que
7110: 75 65 2d 6e 65 78 74 2d 74 61 6c 20 74 61 6c 20  ue-next-tal tal 
7120: 72 65 67 20 72 65 67 6c 65 6e 20 72 65 67 66 75  reg reglen regfu
7130: 6c 6c 29 0a 09 09 09 09 20 20 20 20 20 20 28 72  ll).....      (r
7140: 75 6e 73 3a 71 75 65 75 65 2d 6e 65 78 74 2d 72  uns:queue-next-r
7150: 65 67 20 74 61 6c 20 72 65 67 20 72 65 67 6c 65  eg tal reg regle
7160: 6e 20 72 65 67 66 75 6c 6c 29 0a 09 09 09 09 20  n regfull)..... 
7170: 20 20 20 20 20 72 65 72 75 6e 73 29 29 0a 09 09       reruns))...
7180: 09 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20  .    (loop (car 
7190: 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74  newtal)(cdr newt
71a0: 61 6c 29 20 72 65 67 20 72 65 72 75 6e 73 29 29  al) reg reruns))
71b0: 29 20 3b 3b 20 61 6e 20 69 73 73 75 65 20 77 69  ) ;; an issue wi
71c0: 74 68 20 70 72 65 72 65 71 73 20 6e 6f 74 20 79  th prereqs not y
71d0: 65 74 20 6d 65 74 3f 0a 09 09 20 20 20 20 20 20  et met?...      
71e0: 20 28 28 61 6e 64 20 28 6e 6f 74 20 28 6e 75 6c   ((and (not (nul
71f0: 6c 3f 20 66 61 69 6c 73 29 29 28 65 71 3f 20 74  l? fails))(eq? t
7200: 65 73 74 6d 6f 64 65 20 27 6e 6f 72 6d 61 6c 29  estmode 'normal)
7210: 29 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e  )....(debug:prin
7220: 74 2d 69 6e 66 6f 20 31 20 22 74 65 73 74 20 22  t-info 1 "test "
7230: 20 20 68 65 64 20 22 20 28 6d 6f 64 65 3d 22 20    hed " (mode=" 
7240: 74 65 73 74 6d 6f 64 65 20 22 29 20 68 61 73 20  testmode ") has 
7250: 66 61 69 6c 65 64 20 70 72 65 72 65 71 75 69 73  failed prerequis
7260: 69 74 65 28 73 29 3b 20 22 0a 09 09 09 09 20 20  ite(s); ".....  
7270: 20 20 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72     (string-inter
7280: 73 70 65 72 73 65 20 28 6d 61 70 20 28 6c 61 6d  sperse (map (lam
7290: 62 64 61 20 28 74 29 28 63 6f 6e 63 20 28 64 62  bda (t)(conc (db
72a0: 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61  :test-get-testna
72b0: 6d 65 20 74 29 20 22 3a 22 20 28 64 62 3a 74 65  me t) ":" (db:te
72c0: 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74 29 22  st-get-state t)"
72d0: 2f 22 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73  /"(db:test-get-s
72e0: 74 61 74 75 73 20 74 29 29 29 20 66 61 69 6c 73  tatus t))) fails
72f0: 29 20 22 2c 20 22 29 0a 09 09 09 09 20 20 20 20  ) ", ").....    
7300: 20 22 2c 20 72 65 6d 6f 76 69 6e 67 20 69 74 20   ", removing it 
7310: 66 72 6f 6d 20 74 6f 2d 64 6f 20 6c 69 73 74 22  from to-do list"
7320: 29 0a 09 09 09 28 69 66 20 28 6e 6f 74 20 28 6e  )....(if (not (n
7330: 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 09 20 20  ull? tal))....  
7340: 20 20 28 62 65 67 69 6e 0a 20 20 20 20 20 20 20    (begin.       
7350: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
7360: 20 20 20 20 20 20 20 3b 3b 20 28 74 68 72 65 61         ;; (threa
7370: 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c  d-sleep! *global
7380: 2d 64 65 6c 74 61 2a 29 0a 09 09 09 20 20 20 20  -delta*)....    
7390: 20 20 28 6c 6f 6f 70 20 28 72 75 6e 73 3a 71 75    (loop (runs:qu
73a0: 65 75 65 2d 6e 65 78 74 2d 68 65 64 20 74 61 6c  eue-next-hed tal
73b0: 20 72 65 67 20 72 65 67 6c 65 6e 20 72 65 67 66   reg reglen regf
73c0: 75 6c 6c 29 0a 09 09 09 09 20 20 20 20 28 72 75  ull).....    (ru
73d0: 6e 73 3a 71 75 65 75 65 2d 6e 65 78 74 2d 74 61  ns:queue-next-ta
73e0: 6c 20 74 61 6c 20 72 65 67 20 72 65 67 6c 65 6e  l tal reg reglen
73f0: 20 72 65 67 66 75 6c 6c 29 0a 09 09 09 09 20 20   regfull).....  
7400: 20 20 28 72 75 6e 73 3a 71 75 65 75 65 2d 6e 65    (runs:queue-ne
7410: 78 74 2d 72 65 67 20 74 61 6c 20 72 65 67 20 72  xt-reg tal reg r
7420: 65 67 6c 65 6e 20 72 65 67 66 75 6c 6c 29 0a 09  eglen regfull)..
7430: 09 09 09 20 20 20 20 28 63 6f 6e 73 20 68 65 64  ...    (cons hed
7440: 20 72 65 72 75 6e 73 29 29 29 29 29 0a 09 09 20   reruns)))))... 
7450: 20 20 20 20 20 20 28 65 6c 73 65 0a 09 09 09 28        (else....(
7460: 64 65 62 75 67 3a 70 72 69 6e 74 20 38 20 22 45  debug:print 8 "E
7470: 52 52 4f 52 3a 20 4e 6f 20 68 61 6e 64 6c 65 72  RROR: No handler
7480: 20 66 6f 72 20 74 68 69 73 20 63 6f 6e 64 69 74   for this condit
7490: 69 6f 6e 2e 22 29 0a 09 09 09 3b 3b 20 54 52 59  ion.")....;; TRY
74a0: 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20   (thread-sleep! 
74b0: 28 2b 20 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c  (+ 1 *global-del
74c0: 74 61 2a 29 29 0a 09 09 09 28 6c 6f 6f 70 20 28  ta*))....(loop (
74d0: 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20  car newtal)(cdr 
74e0: 6e 65 77 74 61 6c 29 20 72 65 67 20 72 65 72 75  newtal) reg reru
74f0: 6e 73 29 29 29 29 20 3b 3b 20 45 4e 44 20 4f 46  ns)))) ;; END OF
7500: 20 49 46 20 43 41 4e 20 52 55 4e 20 4d 4f 52 45   IF CAN RUN MORE
7510: 0a 0a 09 09 20 20 20 20 3b 3b 20 69 66 20 63 61  ....    ;; if ca
7520: 6e 27 74 20 72 75 6e 20 6d 6f 72 65 20 6a 75 73  n't run more jus
7530: 74 20 6c 6f 6f 70 20 77 69 74 68 20 6e 65 78 74  t loop with next
7540: 20 70 6f 73 73 69 62 6c 65 20 74 65 73 74 0a 09   possible test..
7550: 09 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20  .    (begin...  
7560: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
7570: 2d 69 6e 66 6f 20 34 20 22 70 72 6f 63 65 73 73  -info 4 "process
7580: 69 6e 67 20 74 68 65 20 63 61 73 65 20 77 69 74  ing the case wit
7590: 68 20 61 20 6c 61 6d 62 64 61 20 66 6f 72 20 69  h a lambda for i
75a0: 74 65 6d 73 20 6f 72 20 27 68 61 76 65 2d 70 72  tems or 'have-pr
75b0: 6f 63 65 64 75 72 65 2e 20 4d 6f 76 69 6e 67 20  ocedure. Moving 
75c0: 74 68 72 6f 75 67 68 20 74 68 65 20 71 75 65 75  through the queu
75d0: 65 20 77 69 74 68 6f 75 74 20 64 72 6f 70 70 69  e without droppi
75e0: 6e 67 20 22 20 68 65 64 29 0a 09 09 20 20 20 20  ng " hed)...    
75f0: 20 20 3b 3b 20 28 74 68 72 65 61 64 2d 73 6c 65    ;; (thread-sle
7600: 65 70 21 20 28 2b 20 32 20 2a 67 6c 6f 62 61 6c  ep! (+ 2 *global
7610: 2d 64 65 6c 74 61 2a 29 29 0a 09 09 20 20 20 20  -delta*))...    
7620: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77    (loop (car new
7630: 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29  tal)(cdr newtal)
7640: 20 72 65 67 20 72 65 72 75 6e 73 29 29 29 29 29   reg reruns)))))
7650: 20 3b 3b 20 45 4e 44 20 4f 46 20 28 6f 72 20 28   ;; END OF (or (
7660: 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73  procedure? items
7670: 29 28 65 71 3f 20 69 74 65 6d 73 20 27 68 61 76  )(eq? items 'hav
7680: 65 2d 70 72 6f 63 65 64 75 72 65 29 29 0a 09 20  e-procedure)).. 
7690: 20 20 20 20 0a 09 20 20 20 20 20 3b 3b 20 74 68      ..     ;; th
76a0: 69 73 20 63 61 73 65 20 73 68 6f 75 6c 64 20 6e  is case should n
76b0: 6f 74 20 68 61 70 70 65 6e 2c 20 61 64 64 65 64  ot happen, added
76c0: 20 74 6f 20 68 65 6c 70 20 63 61 74 63 68 20 61   to help catch a
76d0: 6e 79 20 62 75 67 73 0a 09 20 20 20 20 20 28 28  ny bugs..     ((
76e0: 61 6e 64 20 28 6c 69 73 74 3f 20 69 74 65 6d 73  and (list? items
76f0: 29 20 69 74 65 6d 64 61 74 29 0a 09 20 20 20 20  ) itemdat)..    
7700: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
7710: 20 22 45 52 52 4f 52 3a 20 53 68 6f 75 6c 64 20   "ERROR: Should 
7720: 6e 6f 74 20 68 61 76 65 20 61 20 6c 69 73 74 20  not have a list 
7730: 6f 66 20 69 74 65 6d 73 20 69 6e 20 61 20 74 65  of items in a te
7740: 73 74 20 61 6e 64 20 74 68 65 20 69 74 65 6d 73  st and the items
7750: 70 61 74 68 20 73 65 74 20 2d 20 70 6c 65 61 73  path set - pleas
7760: 65 20 72 65 70 6f 72 74 20 74 68 69 73 22 29 0a  e report this").
7770: 09 20 20 20 20 20 20 28 65 78 69 74 20 31 29 29  .      (exit 1))
7780: 0a 09 20 20 20 20 20 28 28 6e 6f 74 20 28 6e 75  ..     ((not (nu
7790: 6c 6c 3f 20 72 65 72 75 6e 73 29 29 0a 09 20 20  ll? reruns))..  
77a0: 20 20 20 20 28 6c 65 74 2a 20 28 28 6e 65 77 6c      (let* ((newl
77b0: 73 74 20 28 74 65 73 74 73 3a 66 69 6c 74 65 72  st (tests:filter
77c0: 2d 6e 6f 6e 2d 72 75 6e 6e 61 62 6c 65 20 72 75  -non-runnable ru
77d0: 6e 2d 69 64 20 74 61 6c 20 74 65 73 74 2d 72 65  n-id tal test-re
77e0: 63 6f 72 64 73 29 29 20 3b 3b 20 69 2e 65 2e 20  cords)) ;; i.e. 
77f0: 6e 6f 74 20 46 41 49 4c 2c 20 57 41 49 56 45 44  not FAIL, WAIVED
7800: 2c 20 49 4e 43 4f 4d 50 4c 45 54 45 2c 20 50 41  , INCOMPLETE, PA
7810: 53 53 2c 20 4b 49 4c 4c 45 44 2c 0a 09 09 20 20  SS, KILLED,...  
7820: 20 20 20 28 6a 75 6e 6b 65 64 20 28 6c 73 65 74     (junked (lset
7830: 2d 64 69 66 66 65 72 65 6e 63 65 20 65 71 75 61  -difference equa
7840: 6c 3f 20 74 61 6c 20 6e 65 77 6c 73 74 29 29 29  l? tal newlst)))
7850: 0a 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 2d  ...(debug:print-
7860: 69 6e 66 6f 20 34 20 22 66 75 6c 6c 20 64 72 6f  info 4 "full dro
7870: 70 20 74 68 72 6f 75 67 68 2c 20 69 66 20 72 65  p through, if re
7880: 72 75 6e 73 20 69 73 20 6c 65 73 73 20 74 68 61  runs is less tha
7890: 6e 20 31 30 30 20 77 65 20 77 69 6c 6c 20 66 6f  n 100 we will fo
78a0: 72 63 65 20 72 65 74 72 79 20 74 68 65 6d 2c 20  rce retry them, 
78b0: 72 65 72 75 6e 73 3d 22 20 72 65 72 75 6e 73 20  reruns=" reruns 
78c0: 22 2c 20 74 61 6c 3d 22 20 74 61 6c 29 0a 09 09  ", tal=" tal)...
78d0: 28 69 66 20 28 3c 20 6e 75 6d 2d 72 65 74 72 69  (if (< num-retri
78e0: 65 73 20 6d 61 78 2d 72 65 74 72 69 65 73 29 0a  es max-retries).
78f0: 09 09 20 20 20 20 28 73 65 74 21 20 6e 65 77 6c  ..    (set! newl
7900: 73 74 20 28 61 70 70 65 6e 64 20 72 65 72 75 6e  st (append rerun
7910: 73 20 6e 65 77 6c 73 74 29 29 29 0a 09 09 28 73  s newlst)))...(s
7920: 65 74 21 20 6e 75 6d 2d 72 65 74 72 69 65 73 20  et! num-retries 
7930: 28 2b 20 6e 75 6d 2d 72 65 74 72 69 65 73 20 31  (+ num-retries 1
7940: 29 29 0a 09 09 3b 3b 20 28 74 68 72 65 61 64 2d  ))...;; (thread-
7950: 73 6c 65 65 70 21 20 28 2b 20 31 20 2a 67 6c 6f  sleep! (+ 1 *glo
7960: 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09 28  bal-delta*))...(
7970: 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 6e  if (not (null? n
7980: 65 77 6c 73 74 29 29 0a 09 09 20 20 20 20 3b 3b  ewlst))...    ;;
7990: 20 73 69 6e 63 65 20 72 65 72 75 6e 73 20 68 61   since reruns ha
79a0: 76 65 20 62 65 65 6e 20 74 61 63 6b 65 64 20 6f  ve been tacked o
79b0: 6e 20 74 6f 20 6e 65 77 6c 73 74 20 63 72 65 61  n to newlst crea
79c0: 74 65 20 6e 65 77 20 72 65 72 75 6e 73 20 66 72  te new reruns fr
79d0: 6f 6d 20 6a 75 6e 6b 65 64 0a 09 09 20 20 20 20  om junked...    
79e0: 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 6c 73  (loop (car newls
79f0: 74 29 28 63 64 72 20 6e 65 77 6c 73 74 29 20 72  t)(cdr newlst) r
7a00: 65 67 20 28 64 65 6c 65 74 65 2d 64 75 70 6c 69  eg (delete-dupli
7a10: 63 61 74 65 73 20 6a 75 6e 6b 65 64 29 29 29 29  cates junked))))
7a20: 29 0a 09 20 20 20 20 20 28 28 6e 6f 74 20 28 6e  )..     ((not (n
7a30: 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 20 20 20 20  ull? tal))..    
7a40: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69    (debug:print-i
7a50: 6e 66 6f 20 34 20 22 49 27 6d 20 70 72 65 74 74  nfo 4 "I'm prett
7a60: 79 20 73 75 72 65 20 49 20 73 68 6f 75 6c 64 6e  y sure I shouldn
7a70: 27 74 20 67 65 74 20 68 65 72 65 2e 22 29 29 0a  't get here.")).
7a80: 09 20 20 20 20 20 28 28 6e 6f 74 20 28 6e 75 6c  .     ((not (nul
7a90: 6c 3f 20 72 65 67 29 29 20 3b 3b 20 63 6f 75 6c  l? reg)) ;; coul
7aa0: 64 20 77 65 20 67 65 74 20 68 65 72 65 20 77 69  d we get here wi
7ab0: 74 68 20 6c 65 66 74 6f 76 65 72 73 3f 0a 09 20  th leftovers?.. 
7ac0: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
7ad0: 74 2d 69 6e 66 6f 20 30 20 22 48 61 76 65 20 6c  t-info 0 "Have l
7ae0: 65 66 74 6f 76 65 72 73 21 22 29 0a 09 20 20 20  eftovers!")..   
7af0: 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 72 65     (loop (car re
7b00: 67 29 28 63 64 72 20 72 65 67 29 20 27 28 29 20  g)(cdr reg) '() 
7b10: 72 65 72 75 6e 73 29 29 0a 09 20 20 20 20 20 28  reruns))..     (
7b20: 65 6c 73 65 0a 09 20 20 20 20 20 20 28 64 65 62  else..      (deb
7b30: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20  ug:print-info 4 
7b40: 22 45 78 69 74 69 6e 67 20 6c 6f 6f 70 20 77 69  "Exiting loop wi
7b50: 74 68 2e 2e 2e 5c 6e 20 20 68 65 64 3d 22 20 68  th...\n  hed=" h
7b60: 65 64 20 22 5c 6e 20 20 74 61 6c 3d 22 20 74 61  ed "\n  tal=" ta
7b70: 6c 20 22 5c 6e 20 20 72 65 72 75 6e 73 3d 22 20  l "\n  reruns=" 
7b80: 72 65 72 75 6e 73 29 29 0a 09 20 20 20 20 20 29  reruns))..     )
7b90: 29 29 29 20 3b 3b 20 4c 45 54 2a 20 28 28 74 65  ))) ;; LET* ((te
7ba0: 73 74 2d 72 65 63 6f 72 64 0a 0a 20 20 20 20 3b  st-record..    ;
7bb0: 3b 20 77 65 20 67 65 74 20 68 65 72 65 20 6f 6e  ; we get here on
7bc0: 20 22 64 72 6f 70 20 74 68 72 6f 75 67 68 22 20   "drop through" 
7bd0: 2d 20 6c 6f 6f 70 20 66 6f 72 20 6e 65 78 74 20  - loop for next 
7be0: 74 65 73 74 20 69 6e 20 71 75 65 75 65 0a 20 20  test in queue.  
7bf0: 20 20 3b 3b 20 46 49 58 4d 45 21 21 21 21 20 54    ;; FIXME!!!! T
7c00: 48 49 53 20 53 48 4f 55 4c 44 20 4e 4f 54 20 52  HIS SHOULD NOT R
7c10: 45 51 55 49 52 45 20 41 4e 20 45 58 49 54 21 21  EQUIRE AN EXIT!!
7c20: 21 21 21 21 21 0a 20 20 20 20 0a 20 20 20 20 28  !!!!!.    .    (
7c30: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
7c40: 20 31 20 22 41 6c 6c 20 74 65 73 74 73 20 6c 61   1 "All tests la
7c50: 75 6e 63 68 65 64 22 29 0a 20 20 20 20 28 74 68  unched").    (th
7c60: 72 65 61 64 2d 73 6c 65 65 70 21 20 30 2e 35 29  read-sleep! 0.5)
7c70: 0a 20 20 20 20 3b 3b 20 46 49 58 4d 45 21 20 54  .    ;; FIXME! T
7c80: 68 69 73 20 68 61 72 73 68 20 65 78 69 74 20 73  his harsh exit s
7c90: 68 6f 75 6c 64 20 6e 6f 74 20 62 65 20 6e 65 63  hould not be nec
7ca0: 65 73 73 61 72 79 2e 2e 2e 2e 0a 20 20 20 20 3b  essary.....    ;
7cb0: 3b 20 28 69 66 20 28 6e 6f 74 20 2a 72 75 6e 72  ; (if (not *runr
7cc0: 65 6d 6f 74 65 2a 29 28 65 78 69 74 29 29 20 3b  emote*)(exit)) ;
7cd0: 3b 20 0a 20 20 20 20 23 66 29 29 20 3b 3b 20 72  ; .    #f)) ;; r
7ce0: 65 74 75 72 6e 20 61 20 23 66 20 61 73 20 61 20  eturn a #f as a 
7cf0: 68 69 6e 74 20 74 68 61 74 20 77 65 20 61 72 65  hint that we are
7d00: 20 64 6f 6e 65 0a 20 20 3b 3b 20 48 65 72 65 20   done.  ;; Here 
7d10: 77 65 20 6e 65 65 64 20 74 6f 20 63 68 65 63 6b  we need to check
7d20: 20 74 68 61 74 20 61 6c 6c 20 74 68 65 20 74 65   that all the te
7d30: 73 74 73 20 72 65 6d 61 69 6e 69 6e 67 20 74 6f  sts remaining to
7d40: 20 62 65 20 72 75 6e 20 61 72 65 20 65 6c 69 67   be run are elig
7d50: 69 62 6c 65 20 74 6f 20 72 75 6e 0a 20 20 3b 3b  ible to run.  ;;
7d60: 20 61 6e 64 20 61 72 65 20 6e 6f 74 20 62 6c 6f   and are not blo
7d70: 63 6b 65 64 20 62 79 20 66 61 69 6c 65 64 0a 20  cked by failed. 
7d80: 20 0a 0a 3b 3b 20 70 61 72 65 6e 74 2d 74 65 73   ..;; parent-tes
7d90: 74 20 69 73 20 74 68 65 72 65 20 61 73 20 61 20  t is there as a 
7da0: 70 6c 61 63 65 68 6f 6c 64 65 72 20 66 6f 72 20  placeholder for 
7db0: 77 68 65 6e 20 70 61 72 65 6e 74 2d 74 65 73 74  when parent-test
7dc0: 73 20 63 61 6e 20 62 65 20 72 75 6e 20 61 73 20  s can be run as 
7dd0: 61 20 73 65 74 75 70 20 73 74 65 70 0a 28 64 65  a setup step.(de
7de0: 66 69 6e 65 20 28 72 75 6e 3a 74 65 73 74 20 72  fine (run:test r
7df0: 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 6b 65  un-id runname ke
7e00: 79 76 61 6c 6c 73 74 20 74 65 73 74 2d 72 65 63  yvallst test-rec
7e10: 6f 72 64 20 66 6c 61 67 73 20 70 61 72 65 6e 74  ord flags parent
7e20: 2d 74 65 73 74 29 0a 20 20 3b 3b 20 41 6c 6c 20  -test).  ;; All 
7e30: 74 68 65 73 65 20 76 61 72 73 20 6d 69 67 68 74  these vars might
7e40: 20 62 65 20 72 65 66 65 72 65 6e 63 65 64 20 62   be referenced b
7e50: 79 20 74 68 65 20 74 65 73 74 63 6f 6e 66 69 67  y the testconfig
7e60: 20 66 69 6c 65 20 72 65 61 64 65 72 0a 20 20 28   file reader.  (
7e70: 6c 65 74 2a 20 28 28 74 65 73 74 2d 6e 61 6d 65  let* ((test-name
7e80: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71      (tests:testq
7e90: 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d  ueue-get-testnam
7ea0: 65 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29  e   test-record)
7eb0: 29 0a 09 20 28 74 65 73 74 2d 77 61 69 74 6f 6e  ).. (test-waiton
7ec0: 73 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65  s (tests:testque
7ed0: 75 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20 20  ue-get-waitons  
7ee0: 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a    test-record)).
7ef0: 09 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 20  . (test-conf    
7f00: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65  (tests:testqueue
7f10: 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20  -get-testconfig 
7f20: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20  test-record)).. 
7f30: 28 69 74 65 6d 64 61 74 20 20 20 20 20 20 28 74  (itemdat      (t
7f40: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67  ests:testqueue-g
7f50: 65 74 2d 69 74 65 6d 64 61 74 20 20 20 20 74 65  et-itemdat    te
7f60: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74  st-record)).. (t
7f70: 65 73 74 2d 70 61 74 68 20 20 20 20 28 63 6f 6e  est-path    (con
7f80: 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65  c *toppath* "/te
7f90: 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29  sts/" test-name)
7fa0: 29 20 3b 3b 20 63 6f 75 6c 64 20 75 73 65 20 74  ) ;; could use t
7fb0: 65 73 74 73 3a 67 65 74 2d 74 65 73 74 63 6f 6e  ests:get-testcon
7fc0: 66 69 67 20 68 65 72 65 20 2e 2e 2e 0a 09 20 28  fig here ..... (
7fd0: 66 6f 72 63 65 20 20 20 20 20 20 20 20 28 68 61  force        (ha
7fe0: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66  sh-table-ref/def
7ff0: 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 66 6f 72  ault flags "-for
8000: 63 65 22 20 23 66 29 29 0a 09 20 28 72 65 72 75  ce" #f)).. (reru
8010: 6e 20 20 20 20 20 20 20 20 28 68 61 73 68 2d 74  n        (hash-t
8020: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74  able-ref/default
8030: 20 66 6c 61 67 73 20 22 2d 72 65 72 75 6e 22 20   flags "-rerun" 
8040: 23 66 29 29 0a 09 20 28 6b 65 65 70 67 6f 69 6e  #f)).. (keepgoin
8050: 67 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65  g    (hash-table
8060: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61  -ref/default fla
8070: 67 73 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 20  gs "-keepgoing" 
8080: 23 66 29 29 0a 09 20 28 69 74 65 6d 2d 70 61 74  #f)).. (item-pat
8090: 68 20 20 20 20 20 22 22 29 0a 09 20 28 64 62 20  h     "").. (db 
80a0: 20 20 20 20 20 20 20 20 20 20 23 66 29 29 0a 20            #f)). 
80b0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
80c0: 34 0a 09 09 20 22 74 65 73 74 2d 63 6f 6e 66 69  4... "test-confi
80d0: 67 3a 20 22 20 28 68 61 73 68 2d 74 61 62 6c 65  g: " (hash-table
80e0: 2d 3e 61 6c 69 73 74 20 74 65 73 74 2d 63 6f 6e  ->alist test-con
80f0: 66 29 0a 09 09 20 22 5c 6e 20 20 20 69 74 65 6d  f)... "\n   item
8100: 64 61 74 3a 20 22 20 69 74 65 6d 64 61 74 0a 09  dat: " itemdat..
8110: 09 20 29 0a 20 20 20 20 3b 3b 20 73 65 74 74 69  . ).    ;; setti
8120: 6e 67 20 69 74 65 6d 64 61 74 20 74 6f 20 61 20  ng itemdat to a 
8130: 6c 69 73 74 20 69 66 20 69 74 20 69 73 20 23 66  list if it is #f
8140: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 69 74  .    (if (not it
8150: 65 6d 64 61 74 29 28 73 65 74 21 20 69 74 65 6d  emdat)(set! item
8160: 64 61 74 20 27 28 29 29 29 0a 20 20 20 20 28 73  dat '())).    (s
8170: 65 74 21 20 69 74 65 6d 2d 70 61 74 68 20 28 69  et! item-path (i
8180: 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69  tem-list->path i
8190: 74 65 6d 64 61 74 29 29 0a 20 20 20 20 28 64 65  temdat)).    (de
81a0: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 41 74 74  bug:print 2 "Att
81b0: 65 6d 70 74 69 6e 67 20 74 6f 20 6c 61 75 6e 63  empting to launc
81c0: 68 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61  h test " test-na
81d0: 6d 65 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69  me (if (equal? i
81e0: 74 65 6d 2d 70 61 74 68 20 22 2f 22 29 20 22 2f  tem-path "/") "/
81f0: 22 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 20 20  " item-path)).  
8200: 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 54 45    (setenv "MT_TE
8210: 53 54 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e 61  ST_NAME" test-na
8220: 6d 65 29 20 3b 3b 20 0a 20 20 20 20 28 73 65 74  me) ;; .    (set
8230: 65 6e 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22  env "MT_RUNNAME"
8240: 20 20 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20     runname).    
8250: 28 73 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e  (set-megatest-en
8260: 76 2d 76 61 72 73 20 72 75 6e 2d 69 64 29 20 3b  v-vars run-id) ;
8270: 3b 20 74 68 65 73 65 20 6d 61 79 20 62 65 20 6e  ; these may be n
8280: 65 65 64 65 64 20 62 79 20 74 68 65 20 6c 61 75  eeded by the lau
8290: 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 73 0a 20  nching process. 
82a0: 20 20 20 28 63 68 61 6e 67 65 2d 64 69 72 65 63     (change-direc
82b0: 74 6f 72 79 20 2a 74 6f 70 70 61 74 68 2a 29 0a  tory *toppath*).
82c0: 0a 20 20 20 20 3b 3b 20 48 65 72 65 20 69 73 20  .    ;; Here is 
82d0: 77 68 65 72 65 20 74 68 65 20 74 65 73 74 5f 6d  where the test_m
82e0: 65 74 61 20 74 61 62 6c 65 20 69 73 20 62 65 73  eta table is bes
82f0: 74 20 75 70 64 61 74 65 64 0a 20 20 20 20 3b 3b  t updated.    ;;
8300: 20 59 65 73 2c 20 61 6e 6f 74 68 65 72 20 75 73   Yes, another us
8310: 65 20 6f 66 20 61 20 67 6c 6f 62 61 6c 20 66 6f  e of a global fo
8320: 72 20 63 61 63 68 69 6e 67 2e 20 4e 65 65 64 20  r caching. Need 
8330: 61 20 62 65 74 74 65 72 20 77 61 79 3f 0a 20 20  a better way?.  
8340: 20 20 28 69 66 20 28 6e 6f 74 20 28 68 61 73 68    (if (not (hash
8350: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75  -table-ref/defau
8360: 6c 74 20 2a 74 65 73 74 2d 6d 65 74 61 2d 75 70  lt *test-meta-up
8370: 64 61 74 65 64 2a 20 74 65 73 74 2d 6e 61 6d 65  dated* test-name
8380: 20 23 66 29 29 0a 20 20 20 20 20 20 20 20 28 62   #f)).        (b
8390: 65 67 69 6e 0a 09 20 20 20 28 68 61 73 68 2d 74  egin..   (hash-t
83a0: 61 62 6c 65 2d 73 65 74 21 20 2a 74 65 73 74 2d  able-set! *test-
83b0: 6d 65 74 61 2d 75 70 64 61 74 65 64 2a 20 74 65  meta-updated* te
83c0: 73 74 2d 6e 61 6d 65 20 23 74 29 0a 20 20 20 20  st-name #t).    
83d0: 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e         (open-run
83e0: 2d 63 6c 6f 73 65 20 72 75 6e 73 3a 75 70 64 61  -close runs:upda
83f0: 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20  te-test_meta db 
8400: 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63  test-name test-c
8410: 6f 6e 66 29 29 29 0a 20 20 20 20 0a 20 20 20 20  onf))).    .    
8420: 3b 3b 20 28 6c 61 6d 62 64 61 20 28 69 74 65 6d  ;; (lambda (item
8430: 64 61 74 29 20 3b 3b 3b 20 28 28 72 69 70 65 6e  dat) ;;; ((ripen
8440: 65 73 73 20 22 6f 76 65 72 72 69 70 65 22 29 20  ess "overripe") 
8450: 28 74 65 6d 70 65 72 61 74 75 72 65 20 22 63 6f  (temperature "co
8460: 6f 6c 22 29 20 28 73 65 61 73 6f 6e 20 22 73 75  ol") (season "su
8470: 6d 6d 65 72 22 29 29 0a 20 20 20 20 28 6c 65 74  mmer")).    (let
8480: 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d 70 61 74  * ((new-test-pat
8490: 68 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73  h (string-inters
84a0: 70 65 72 73 65 20 28 63 6f 6e 73 20 74 65 73 74  perse (cons test
84b0: 2d 70 61 74 68 20 28 6d 61 70 20 63 61 64 72 20  -path (map cadr 
84c0: 69 74 65 6d 64 61 74 29 29 20 22 2f 22 29 29 0a  itemdat)) "/")).
84d0: 09 20 20 20 28 6e 65 77 2d 74 65 73 74 2d 6e 61  .   (new-test-na
84e0: 6d 65 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69  me (if (equal? i
84f0: 74 65 6d 2d 70 61 74 68 20 22 22 29 20 74 65 73  tem-path "") tes
8500: 74 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73  t-name (conc tes
8510: 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d  t-name "/" item-
8520: 70 61 74 68 29 29 29 20 3b 3b 20 6a 75 73 74 20  path))) ;; just 
8530: 6e 65 65 64 20 69 74 20 74 6f 20 62 65 20 75 6e  need it to be un
8540: 69 71 75 65 0a 09 20 20 20 28 74 65 73 74 2d 69  ique..   (test-i
8550: 64 20 20 20 20 20 20 20 28 63 64 62 3a 72 65 6d  d       (cdb:rem
8560: 6f 74 65 2d 72 75 6e 20 64 62 3a 67 65 74 2d 74  ote-run db:get-t
8570: 65 73 74 2d 69 64 20 23 66 20 20 72 75 6e 2d 69  est-id #f  run-i
8580: 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d  d test-name item
8590: 2d 70 61 74 68 29 29 0a 09 20 20 20 28 74 65 73  -path))..   (tes
85a0: 74 64 61 74 20 20 20 20 20 20 20 28 63 64 62 3a  tdat       (cdb:
85b0: 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 2d 62 79  get-test-info-by
85c0: 2d 69 64 20 2a 72 75 6e 72 65 6d 6f 74 65 2a 20  -id *runremote* 
85d0: 74 65 73 74 2d 69 64 29 29 29 0a 20 20 20 20 20  test-id))).     
85e0: 20 28 69 66 20 28 6e 6f 74 20 74 65 73 74 64 61   (if (not testda
85f0: 74 29 0a 09 20 20 28 62 65 67 69 6e 0a 09 20 20  t)..  (begin..  
8600: 20 20 3b 3b 20 65 6e 73 75 72 65 20 74 68 61 74    ;; ensure that
8610: 20 74 68 65 20 70 61 74 68 20 65 78 69 73 74 73   the path exists
8620: 20 62 65 66 6f 72 65 20 72 65 67 69 73 74 65 72   before register
8630: 69 6e 67 20 74 68 65 20 74 65 73 74 0a 09 20 20  ing the test..  
8640: 20 20 3b 3b 20 4e 4f 50 45 3a 20 43 61 6e 6e 6f    ;; NOPE: Canno
8650: 74 21 20 44 6f 6e 27 74 20 6b 6e 6f 77 20 79 65  t! Don't know ye
8660: 74 20 77 68 69 63 68 20 64 69 73 6b 20 61 72 65  t which disk are
8670: 61 20 77 69 6c 6c 20 62 65 20 61 73 73 69 67 6e  a will be assign
8680: 65 64 2e 2e 2e 2e 0a 09 20 20 20 20 3b 3b 20 28  ed......    ;; (
8690: 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 6d 6b  system (conc "mk
86a0: 64 69 72 20 2d 70 20 22 20 6e 65 77 2d 74 65 73  dir -p " new-tes
86b0: 74 2d 70 61 74 68 29 29 0a 09 20 20 20 20 3b 3b  t-path))..    ;;
86c0: 0a 09 20 20 20 20 3b 3b 20 28 6f 70 65 6e 2d 72  ..    ;; (open-r
86d0: 75 6e 2d 63 6c 6f 73 65 20 74 65 73 74 73 3a 72  un-close tests:r
86e0: 65 67 69 73 74 65 72 2d 74 65 73 74 20 64 62 20  egister-test db 
86f0: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65  run-id test-name
8700: 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 20 20 20   item-path)..   
8710: 20 3b 3b 0a 09 20 20 20 20 3b 3b 20 4e 42 2f 2f   ;;..    ;; NB//
8720: 20 66 6f 72 20 74 68 65 20 61 62 6f 76 65 20 6c   for the above l
8730: 69 6e 65 2e 20 49 20 77 61 6e 74 20 74 68 65 20  ine. I want the 
8740: 74 65 73 74 20 74 6f 20 62 65 20 72 65 67 69 73  test to be regis
8750: 74 65 72 65 64 20 6c 6f 6e 67 20 62 65 66 6f 72  tered long befor
8760: 65 20 74 68 69 73 20 72 6f 75 74 69 6e 65 20 67  e this routine g
8770: 65 74 73 20 63 61 6c 6c 65 64 21 0a 09 20 20 20  ets called!..   
8780: 20 3b 3b 0a 09 20 20 20 20 28 73 65 74 21 20 74   ;;..    (set! t
8790: 65 73 74 2d 69 64 20 28 6f 70 65 6e 2d 72 75 6e  est-id (open-run
87a0: 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65  -close db:get-te
87b0: 73 74 2d 69 64 20 64 62 20 72 75 6e 2d 69 64 20  st-id db run-id 
87c0: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70  test-name item-p
87d0: 61 74 68 29 29 0a 09 20 20 20 20 28 69 66 20 28  ath))..    (if (
87e0: 6e 6f 74 20 74 65 73 74 2d 69 64 29 0a 09 09 28  not test-id)...(
87f0: 62 65 67 69 6e 0a 09 09 20 20 28 64 65 62 75 67  begin...  (debug
8800: 3a 70 72 69 6e 74 20 32 20 22 57 41 52 4e 3a 20  :print 2 "WARN: 
8810: 54 65 73 74 20 6e 6f 74 20 70 72 65 2d 63 72 65  Test not pre-cre
8820: 61 74 65 64 3f 20 74 65 73 74 2d 6e 61 6d 65 3d  ated? test-name=
8830: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2c 20 69  " test-name ", i
8840: 74 65 6d 2d 70 61 74 68 3d 22 20 69 74 65 6d 2d  tem-path=" item-
8850: 70 61 74 68 20 22 2c 20 72 75 6e 2d 69 64 3d 22  path ", run-id="
8860: 20 72 75 6e 2d 69 64 29 0a 09 09 20 20 28 63 64   run-id)...  (cd
8870: 62 3a 74 65 73 74 73 2d 72 65 67 69 73 74 65 72  b:tests-register
8880: 2d 74 65 73 74 20 2a 72 75 6e 72 65 6d 6f 74 65  -test *runremote
8890: 2a 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61  * run-id test-na
88a0: 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 09  me item-path)...
88b0: 20 20 28 73 65 74 21 20 74 65 73 74 2d 69 64 20    (set! test-id 
88c0: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
88d0: 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 64 20 64  db:get-test-id d
88e0: 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61  b run-id test-na
88f0: 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29 29 29  me item-path))))
8900: 0a 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ..    (debug:pri
8910: 6e 74 2d 69 6e 66 6f 20 34 20 22 74 65 73 74 2d  nt-info 4 "test-
8920: 69 64 3d 22 20 74 65 73 74 2d 69 64 20 22 2c 20  id=" test-id ", 
8930: 72 75 6e 2d 69 64 3d 22 20 72 75 6e 2d 69 64 20  run-id=" run-id 
8940: 22 2c 20 74 65 73 74 2d 6e 61 6d 65 3d 22 20 74  ", test-name=" t
8950: 65 73 74 2d 6e 61 6d 65 20 22 2c 20 69 74 65 6d  est-name ", item
8960: 2d 70 61 74 68 3d 5c 22 22 20 69 74 65 6d 2d 70  -path=\"" item-p
8970: 61 74 68 20 22 5c 22 22 29 0a 09 20 20 20 20 28  ath "\"")..    (
8980: 73 65 74 21 20 74 65 73 74 64 61 74 20 28 63 64  set! testdat (cd
8990: 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 2d  b:get-test-info-
89a0: 62 79 2d 69 64 20 2a 72 75 6e 72 65 6d 6f 74 65  by-id *runremote
89b0: 2a 20 74 65 73 74 2d 69 64 29 29 29 29 0a 20 20  * test-id)))).  
89c0: 20 20 20 20 28 73 65 74 21 20 74 65 73 74 2d 69      (set! test-i
89d0: 64 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  d (db:test-get-i
89e0: 64 20 74 65 73 74 64 61 74 29 29 0a 20 20 20 20  d testdat)).    
89f0: 20 20 28 63 68 61 6e 67 65 2d 64 69 72 65 63 74    (change-direct
8a00: 6f 72 79 20 74 65 73 74 2d 70 61 74 68 29 0a 20  ory test-path). 
8a10: 20 20 20 20 20 28 63 61 73 65 20 28 69 66 20 66       (case (if f
8a20: 6f 72 63 65 20 3b 3b 20 28 61 72 67 73 3a 67 65  orce ;; (args:ge
8a30: 74 2d 61 72 67 20 22 2d 66 6f 72 63 65 22 29 0a  t-arg "-force").
8a40: 09 09 27 4e 4f 54 5f 53 54 41 52 54 45 44 0a 09  ..'NOT_STARTED..
8a50: 09 28 69 66 20 74 65 73 74 64 61 74 0a 09 09 20  .(if testdat... 
8a60: 20 20 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62     (string->symb
8a70: 6f 6c 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61  ol (test:get-sta
8a80: 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 09 20  te testdat))... 
8a90: 20 20 20 27 66 61 69 6c 65 64 2d 74 6f 2d 69 6e     'failed-to-in
8aa0: 73 65 72 74 29 29 0a 09 28 28 66 61 69 6c 65 64  sert))..((failed
8ab0: 2d 74 6f 2d 69 6e 73 65 72 74 29 0a 09 20 28 64  -to-insert).. (d
8ac0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
8ad0: 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 69  ROR: Failed to i
8ae0: 6e 73 65 72 74 20 74 68 65 20 72 65 63 6f 72 64  nsert the record
8af0: 20 69 6e 74 6f 20 74 68 65 20 64 62 22 29 29 0a   into the db")).
8b00: 09 28 28 4e 4f 54 5f 53 54 41 52 54 45 44 20 43  .((NOT_STARTED C
8b10: 4f 4d 50 4c 45 54 45 44 20 44 45 4c 45 54 45 44  OMPLETED DELETED
8b20: 29 0a 09 20 28 6c 65 74 20 28 28 72 75 6e 66 6c  ).. (let ((runfl
8b30: 61 67 20 23 66 29 29 0a 09 20 20 20 28 63 6f 6e  ag #f))..   (con
8b40: 64 0a 09 20 20 20 20 3b 3b 20 2d 66 6f 72 63 65  d..    ;; -force
8b50: 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20  , run no matter 
8b60: 77 68 61 74 0a 09 20 20 20 20 28 66 6f 72 63 65  what..    (force
8b70: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23   (set! runflag #
8b80: 74 29 29 0a 09 20 20 20 20 3b 3b 20 4e 4f 54 5f  t))..    ;; NOT_
8b90: 53 54 41 52 54 45 44 2c 20 72 75 6e 20 6e 6f 20  STARTED, run no 
8ba0: 6d 61 74 74 65 72 20 77 68 61 74 0a 09 20 20 20  matter what..   
8bb0: 20 28 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a   ((member (test:
8bc0: 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61  get-state testda
8bd0: 74 29 20 27 28 22 44 45 4c 45 54 45 44 22 20 22  t) '("DELETED" "
8be0: 4e 4f 54 5f 53 54 41 52 54 45 44 22 29 29 28 73  NOT_STARTED"))(s
8bf0: 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29  et! runflag #t))
8c00: 0a 09 20 20 20 20 3b 3b 20 6e 6f 74 20 2d 72 65  ..    ;; not -re
8c10: 72 75 6e 20 61 6e 64 20 50 41 53 53 2c 20 57 41  run and PASS, WA
8c20: 52 4e 20 6f 72 20 43 48 45 43 4b 2c 20 64 6f 20  RN or CHECK, do 
8c30: 6e 6f 20 72 75 6e 0a 09 20 20 20 20 28 28 61 6e  no run..    ((an
8c40: 64 20 28 6f 72 20 28 6e 6f 74 20 72 65 72 75 6e  d (or (not rerun
8c50: 29 0a 09 09 20 20 20 20 20 20 6b 65 65 70 67 6f  )...      keepgo
8c60: 69 6e 67 29 0a 09 09 20 20 3b 3b 20 52 65 71 75  ing)...  ;; Requ
8c70: 69 72 65 20 74 6f 20 66 6f 72 63 65 20 72 65 2d  ire to force re-
8c80: 72 75 6e 20 66 6f 72 20 43 4f 4d 50 4c 45 54 45  run for COMPLETE
8c90: 44 20 6f 72 20 2a 61 6e 79 74 68 69 6e 67 2a 20  D or *anything* 
8ca0: 2b 20 50 41 53 53 2c 57 41 52 4e 20 6f 72 20 43  + PASS,WARN or C
8cb0: 48 45 43 4b 0a 09 09 20 20 28 6f 72 20 28 6d 65  HECK...  (or (me
8cc0: 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73  mber (test:get-s
8cd0: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20 27  tatus testdat) '
8ce0: 28 22 50 41 53 53 22 20 22 57 41 52 4e 22 20 22  ("PASS" "WARN" "
8cf0: 43 48 45 43 4b 22 20 22 53 4b 49 50 22 29 29 0a  CHECK" "SKIP")).
8d00: 09 09 20 20 20 20 20 20 28 6d 65 6d 62 65 72 20  ..      (member 
8d10: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20  (test:get-state 
8d20: 20 74 65 73 74 64 61 74 29 20 27 28 22 43 4f 4d   testdat) '("COM
8d30: 50 4c 45 54 45 44 22 29 29 29 29 20 0a 09 20 20  PLETED")))) ..  
8d40: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d     (debug:print-
8d50: 69 6e 66 6f 20 32 20 22 72 75 6e 6e 69 6e 67 20  info 2 "running 
8d60: 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65  test " test-name
8d70: 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 20 22   "/" item-path "
8d80: 20 73 75 70 70 72 65 73 73 65 64 20 61 73 20 69   suppressed as i
8d90: 74 20 69 73 20 22 20 28 74 65 73 74 3a 67 65 74  t is " (test:get
8da0: 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 20  -state testdat) 
8db0: 22 20 61 6e 64 20 22 20 28 74 65 73 74 3a 67 65  " and " (test:ge
8dc0: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74  t-status testdat
8dd0: 29 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72  ))..     (set! r
8de0: 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20  unflag #f))..   
8df0: 20 3b 3b 20 2d 72 65 72 75 6e 20 61 6e 64 20 73   ;; -rerun and s
8e00: 74 61 74 75 73 20 69 73 20 6f 6e 65 20 6f 66 20  tatus is one of 
8e10: 74 68 65 20 73 70 65 63 69 66 65 64 2c 20 72 75  the specifed, ru
8e20: 6e 20 69 74 0a 09 20 20 20 20 28 28 61 6e 64 20  n it..    ((and 
8e30: 72 65 72 75 6e 0a 09 09 20 20 28 6c 65 74 2a 20  rerun...  (let* 
8e40: 28 28 72 65 72 75 6e 6c 73 74 20 20 20 28 73 74  ((rerunlst   (st
8e50: 72 69 6e 67 2d 73 70 6c 69 74 20 72 65 72 75 6e  ring-split rerun
8e60: 20 22 2c 22 29 29 0a 09 09 09 20 28 6d 75 73 74   ",")).... (must
8e70: 2d 72 65 72 75 6e 20 28 6d 65 6d 62 65 72 20 28  -rerun (member (
8e80: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20  test:get-status 
8e90: 74 65 73 74 64 61 74 29 20 72 65 72 75 6e 6c 73  testdat) rerunls
8ea0: 74 29 29 29 0a 09 09 20 20 20 20 28 64 65 62 75  t)))...    (debu
8eb0: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 33 20 22  g:print-info 3 "
8ec0: 2d 72 65 72 75 6e 20 6c 69 73 74 3a 20 22 20 72  -rerun list: " r
8ed0: 65 72 75 6e 20 22 2c 20 74 65 73 74 2d 73 74 61  erun ", test-sta
8ee0: 74 75 73 3a 20 22 20 28 74 65 73 74 3a 67 65 74  tus: " (test:get
8ef0: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29  -status testdat)
8f00: 22 2c 20 6d 75 73 74 2d 72 65 72 75 6e 3a 20 22  ", must-rerun: "
8f10: 20 6d 75 73 74 2d 72 65 72 75 6e 29 0a 09 09 20   must-rerun)... 
8f20: 20 20 20 6d 75 73 74 2d 72 65 72 75 6e 29 29 0a     must-rerun)).
8f30: 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  .     (debug:pri
8f40: 6e 74 2d 69 6e 66 6f 20 32 20 22 52 65 72 75 6e  nt-info 2 "Rerun
8f50: 20 66 6f 72 63 65 64 20 66 6f 72 20 74 65 73 74   forced for test
8f60: 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22   " test-name "/"
8f70: 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 20 20 20   item-path)..   
8f80: 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20    (set! runflag 
8f90: 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 2d 6b 65  #t))..    ;; -ke
8fa0: 65 70 67 6f 69 6e 67 2c 20 64 6f 20 6e 6f 74 20  epgoing, do not 
8fb0: 72 65 72 75 6e 20 46 41 49 4c 0a 09 20 20 20 20  rerun FAIL..    
8fc0: 28 28 61 6e 64 20 6b 65 65 70 67 6f 69 6e 67 0a  ((and keepgoing.
8fd0: 09 09 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73  ..  (member (tes
8fe0: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73  t:get-status tes
8ff0: 74 64 61 74 29 20 27 28 22 46 41 49 4c 22 29 29  tdat) '("FAIL"))
9000: 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 75  )..     (set! ru
9010: 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20 20  nflag #f))..    
9020: 28 28 61 6e 64 20 28 6e 6f 74 20 72 65 72 75 6e  ((and (not rerun
9030: 29 0a 09 09 20 20 28 6d 65 6d 62 65 72 20 28 74  )...  (member (t
9040: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74  est:get-status t
9050: 65 73 74 64 61 74 29 20 27 28 22 46 41 49 4c 22  estdat) '("FAIL"
9060: 20 22 6e 2f 61 22 29 29 29 0a 09 20 20 20 20 20   "n/a")))..     
9070: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74  (set! runflag #t
9080: 29 29 0a 09 20 20 20 20 28 65 6c 73 65 20 28 73  ))..    (else (s
9090: 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29  et! runflag #f))
90a0: 29 0a 09 20 20 20 28 64 65 62 75 67 3a 70 72 69  )..   (debug:pri
90b0: 6e 74 20 36 20 22 52 55 4e 4e 49 4e 47 20 3d 3e  nt 6 "RUNNING =>
90c0: 20 72 75 6e 66 6c 61 67 3a 20 22 20 72 75 6e 66   runflag: " runf
90d0: 6c 61 67 20 22 20 53 54 41 54 45 3a 20 22 20 28  lag " STATE: " (
90e0: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74  test:get-state t
90f0: 65 73 74 64 61 74 29 20 22 20 53 54 41 54 55 53  estdat) " STATUS
9100: 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74  : " (test:get-st
9110: 61 74 75 73 20 74 65 73 74 64 61 74 29 29 0a 09  atus testdat))..
9120: 20 20 20 28 69 66 20 28 6e 6f 74 20 72 75 6e 66     (if (not runf
9130: 6c 61 67 29 0a 09 20 20 20 20 20 20 20 28 69 66  lag)..       (if
9140: 20 28 6e 6f 74 20 70 61 72 65 6e 74 2d 74 65 73   (not parent-tes
9150: 74 29 0a 09 09 20 20 20 28 64 65 62 75 67 3a 70  t)...   (debug:p
9160: 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 4e 6f  rint 1 "NOTE: No
9170: 74 20 73 74 61 72 74 69 6e 67 20 74 65 73 74 20  t starting test 
9180: 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20  " new-test-name 
9190: 22 20 61 73 20 69 74 20 69 73 20 73 74 61 74 65  " as it is state
91a0: 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73   \"" (test:get-s
91b0: 74 61 74 65 20 74 65 73 74 64 61 74 29 20 0a 09  tate testdat) ..
91c0: 09 09 09 22 5c 22 20 61 6e 64 20 73 74 61 74 75  ..."\" and statu
91d0: 73 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d  s \"" (test:get-
91e0: 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20  status testdat) 
91f0: 22 5c 22 2c 20 75 73 65 20 2d 72 65 72 75 6e 20  "\", use -rerun 
9200: 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74  \"" (test:get-st
9210: 61 74 75 73 20 74 65 73 74 64 61 74 29 0a 20 20  atus testdat).  
9220: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
9230: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 5c                "\
9240: 22 20 6f 72 20 2d 66 6f 72 63 65 20 74 6f 20 6f  " or -force to o
9250: 76 65 72 72 69 64 65 22 29 29 0a 09 20 20 20 20  verride"))..    
9260: 20 20 20 3b 3b 20 4e 4f 54 45 3a 20 4e 6f 20 6c     ;; NOTE: No l
9270: 6f 6e 67 65 72 20 62 65 20 63 68 65 63 6b 69 6e  onger be checkin
9280: 67 20 70 72 65 72 65 71 75 69 73 69 74 65 73 20  g prerequisites 
9290: 68 65 72 65 21 20 57 69 6c 6c 20 6e 65 76 65 72  here! Will never
92a0: 20 67 65 74 20 68 65 72 65 20 75 6e 6c 65 73 73   get here unless
92b0: 20 70 72 65 72 65 71 73 20 61 72 65 0a 09 20 20   prereqs are..  
92c0: 20 20 20 20 20 3b 3b 20 20 20 20 20 20 20 61 6c       ;;       al
92d0: 72 65 61 64 79 20 6d 65 74 2e 0a 09 20 20 20 20  ready met...    
92e0: 20 20 20 3b 3b 20 54 68 69 73 20 77 6f 75 6c 64     ;; This would
92f0: 20 62 65 20 61 20 67 72 65 61 74 20 70 6c 61 63   be a great plac
9300: 65 20 74 6f 20 64 6f 20 74 68 65 20 70 72 6f 63  e to do the proc
9310: 65 73 73 2d 66 6f 72 6b 0a 09 20 20 20 20 20 20  ess-fork..      
9320: 20 28 69 66 20 28 6e 6f 74 20 28 6c 61 75 6e 63   (if (not (launc
9330: 68 2d 74 65 73 74 20 23 66 20 72 75 6e 2d 69 64  h-test #f run-id
9340: 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d 63 6f   runname test-co
9350: 6e 66 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 73  nf keyvallst tes
9360: 74 2d 6e 61 6d 65 20 74 65 73 74 2d 70 61 74 68  t-name test-path
9370: 20 69 74 65 6d 64 61 74 20 66 6c 61 67 73 29 29   itemdat flags))
9380: 0a 09 09 20 20 20 28 62 65 67 69 6e 0a 09 09 20  ...   (begin... 
9390: 20 20 20 20 28 70 72 69 6e 74 20 22 45 52 52 4f      (print "ERRO
93a0: 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c 61 75  R: Failed to lau
93b0: 6e 63 68 20 74 68 65 20 74 65 73 74 2e 20 45 78  nch the test. Ex
93c0: 69 74 69 6e 67 20 61 73 20 73 6f 6f 6e 20 61 73  iting as soon as
93d0: 20 70 6f 73 73 69 62 6c 65 22 29 0a 09 09 20 20   possible")...  
93e0: 20 20 20 28 73 65 74 21 20 2a 67 6c 6f 62 61 6c     (set! *global
93f0: 65 78 69 74 73 74 61 74 75 73 2a 20 31 29 20 3b  exitstatus* 1) ;
9400: 3b 20 0a 09 09 20 20 20 20 20 28 70 72 6f 63 65  ; ...     (proce
9410: 73 73 2d 73 69 67 6e 61 6c 20 28 63 75 72 72 65  ss-signal (curre
9420: 6e 74 2d 70 72 6f 63 65 73 73 2d 69 64 29 20 73  nt-process-id) s
9430: 69 67 6e 61 6c 2f 6b 69 6c 6c 29 29 29 29 29 29  ignal/kill))))))
9440: 0a 09 28 28 4b 49 4c 4c 45 44 29 20 0a 09 20 28  ..((KILLED) .. (
9450: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4e  debug:print 1 "N
9460: 4f 54 45 3a 20 22 20 6e 65 77 2d 74 65 73 74 2d  OTE: " new-test-
9470: 6e 61 6d 65 20 22 20 69 73 20 61 6c 72 65 61 64  name " is alread
9480: 79 20 72 75 6e 6e 69 6e 67 20 6f 72 20 77 61 73  y running or was
9490: 20 65 78 70 6c 69 63 74 6c 79 20 6b 69 6c 6c 65   explictly kille
94a0: 64 2c 20 75 73 65 20 2d 66 6f 72 63 65 20 74 6f  d, use -force to
94b0: 20 6c 61 75 6e 63 68 20 69 74 2e 22 29 29 0a 09   launch it."))..
94c0: 28 28 4c 41 55 4e 43 48 45 44 20 52 45 4d 4f 54  ((LAUNCHED REMOT
94d0: 45 48 4f 53 54 53 54 41 52 54 20 52 55 4e 4e 49  EHOSTSTART RUNNI
94e0: 4e 47 29 20 20 0a 09 20 28 69 66 20 28 3e 20 28  NG)  .. (if (> (
94f0: 2d 20 28 63 75 72 72 65 6e 74 2d 73 65 63 6f 6e  - (current-secon
9500: 64 73 29 28 2b 20 28 64 62 3a 74 65 73 74 2d 67  ds)(+ (db:test-g
9510: 65 74 2d 65 76 65 6e 74 5f 74 69 6d 65 20 74 65  et-event_time te
9520: 73 74 64 61 74 29 0a 09 09 09 09 20 20 20 20 20  stdat).....     
9530: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72    (db:test-get-r
9540: 75 6e 5f 64 75 72 61 74 69 6f 6e 20 74 65 73 74  un_duration test
9550: 64 61 74 29 29 29 0a 09 09 36 30 30 29 20 3b 3b  dat)))...600) ;;
9560: 20 69 2e 65 2e 20 6e 6f 20 75 70 64 61 74 65 20   i.e. no update 
9570: 66 6f 72 20 6d 6f 72 65 20 74 68 61 6e 20 36 30  for more than 60
9580: 30 20 73 65 63 6f 6e 64 73 0a 09 20 20 20 20 20  0 seconds..     
9590: 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 20 28  (begin..       (
95a0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57  debug:print 0 "W
95b0: 41 52 4e 49 4e 47 3a 20 54 65 73 74 20 22 20 74  ARNING: Test " t
95c0: 65 73 74 2d 6e 61 6d 65 20 22 20 61 70 70 65 61  est-name " appea
95d0: 72 73 20 74 6f 20 62 65 20 64 65 61 64 2e 20 46  rs to be dead. F
95e0: 6f 72 63 69 6e 67 20 69 74 20 74 6f 20 73 74 61  orcing it to sta
95f0: 74 65 20 49 4e 43 4f 4d 50 4c 45 54 45 20 61 6e  te INCOMPLETE an
9600: 64 20 73 74 61 74 75 73 20 53 54 55 43 4b 2f 44  d status STUCK/D
9610: 45 41 44 22 29 0a 09 20 20 20 20 20 20 20 28 74  EAD")..       (t
9620: 65 73 74 73 3a 74 65 73 74 2d 73 65 74 2d 73 74  ests:test-set-st
9630: 61 74 75 73 21 20 74 65 73 74 2d 69 64 20 22 49  atus! test-id "I
9640: 4e 43 4f 4d 50 4c 45 54 45 22 20 22 53 54 55 43  NCOMPLETE" "STUC
9650: 4b 2f 44 45 41 44 22 20 22 54 65 73 74 20 69 73  K/DEAD" "Test is
9660: 20 73 74 75 63 6b 20 6f 72 20 64 65 61 64 22 20   stuck or dead" 
9670: 23 66 29 29 0a 09 20 20 20 20 20 28 64 65 62 75  #f))..     (debu
9680: 67 3a 70 72 69 6e 74 20 32 20 22 4e 4f 54 45 3a  g:print 2 "NOTE:
9690: 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 69   " test-name " i
96a0: 73 20 61 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e  s already runnin
96b0: 67 22 29 29 29 0a 09 28 65 6c 73 65 20 20 20 20  g")))..(else    
96c0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
96d0: 30 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64  0 "ERROR: Failed
96e0: 20 74 6f 20 6c 61 75 6e 63 68 20 74 65 73 74 20   to launch test 
96f0: 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20  " new-test-name 
9700: 22 2e 20 55 6e 72 65 63 6f 67 6e 69 73 65 64 20  ". Unrecognised 
9710: 73 74 61 74 65 20 22 20 28 74 65 73 74 3a 67 65  state " (test:ge
9720: 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29  t-state testdat)
9730: 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d  ))))))..;;======
9740: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9750: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9760: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9770: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9780: 0a 3b 3b 20 45 4e 44 20 4f 46 20 4e 45 57 20 53  .;; END OF NEW S
9790: 54 55 46 46 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d  TUFF.;;=========
97a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
97b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
97c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
97d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28  =============..(
97e0: 64 65 66 69 6e 65 20 28 67 65 74 2d 64 69 72 2d  define (get-dir-
97f0: 75 70 2d 6e 20 64 69 72 20 2e 20 70 61 72 61 6d  up-n dir . param
9800: 73 29 20 0a 20 20 28 6c 65 74 20 28 28 64 70 61  s) .  (let ((dpa
9810: 72 74 73 20 20 28 73 74 72 69 6e 67 2d 73 70 6c  rts  (string-spl
9820: 69 74 20 64 69 72 20 22 2f 22 29 29 0a 09 28 63  it dir "/"))..(c
9830: 6f 75 6e 74 20 20 20 28 69 66 20 28 6e 75 6c 6c  ount   (if (null
9840: 3f 20 70 61 72 61 6d 73 29 20 31 20 28 63 61 72  ? params) 1 (car
9850: 20 70 61 72 61 6d 73 29 29 29 29 0a 20 20 20 20   params)))).    
9860: 28 63 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 6e  (conc "/" (strin
9870: 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09  g-intersperse ..
9880: 20 20 20 20 20 20 20 28 74 61 6b 65 20 64 70 61         (take dpa
9890: 72 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 20 64  rts (- (length d
98a0: 70 61 72 74 73 29 20 63 6f 75 6e 74 29 29 0a 09  parts) count))..
98b0: 20 20 20 20 20 20 20 22 2f 22 29 29 29 29 0a 3b         "/")))).;
98c0: 3b 20 52 65 6d 6f 76 65 20 72 75 6e 73 0a 3b 3b  ; Remove runs.;;
98d0: 20 66 69 65 6c 64 73 20 61 72 65 20 70 61 73 73   fields are pass
98e0: 69 6e 67 20 69 6e 20 74 68 72 6f 75 67 68 20 0a  ing in through .
98f0: 3b 3b 20 61 63 74 69 6f 6e 3a 0a 3b 3b 20 20 20  ;; action:.;;   
9900: 20 27 72 65 6d 6f 76 65 2d 72 75 6e 73 0a 3b 3b   'remove-runs.;;
9910: 20 20 20 20 27 73 65 74 2d 73 74 61 74 65 2d 73      'set-state-s
9920: 74 61 74 75 73 0a 3b 3b 0a 3b 3b 20 4e 42 2f 2f  tatus.;;.;; NB//
9930: 20 73 68 6f 75 6c 64 20 70 61 73 73 20 69 6e 20   should pass in 
9940: 6b 65 79 73 3f 0a 3b 3b 0a 28 64 65 66 69 6e 65  keys?.;;.(define
9950: 20 28 72 75 6e 73 3a 6f 70 65 72 61 74 65 2d 6f   (runs:operate-o
9960: 6e 20 61 63 74 69 6f 6e 20 72 75 6e 6e 61 6d 65  n action runname
9970: 70 61 74 74 20 74 65 73 74 70 61 74 74 20 23 21  patt testpatt #!
9980: 6b 65 79 20 28 73 74 61 74 65 20 23 66 29 28 73  key (state #f)(s
9990: 74 61 74 75 73 20 23 66 29 28 6e 65 77 2d 73 74  tatus #f)(new-st
99a0: 61 74 65 2d 73 74 61 74 75 73 20 23 66 29 29 0a  ate-status #f)).
99b0: 20 20 28 63 6f 6d 6d 6f 6e 3a 63 6c 65 61 72 2d    (common:clear-
99c0: 63 61 63 68 65 73 29 20 3b 3b 20 63 6c 65 61 72  caches) ;; clear
99d0: 20 61 6c 6c 20 63 61 63 68 65 73 0a 20 20 28 6c   all caches.  (l
99e0: 65 74 2a 20 28 28 64 62 20 20 20 20 20 20 20 20  et* ((db        
99f0: 20 20 20 23 66 29 0a 09 20 28 6b 65 79 73 20 20     #f).. (keys  
9a00: 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e         (open-run
9a10: 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 6b 65  -close db:get-ke
9a20: 79 73 20 64 62 29 29 0a 09 20 28 72 75 6e 64 61  ys db)).. (runda
9a30: 74 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75  t       (open-ru
9a40: 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 3a 67 65 74  n-close runs:get
9a50: 2d 72 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62  -runs-by-patt db
9a60: 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65 70 61 74   keys runnamepat
9a70: 74 29 29 0a 09 20 28 68 65 61 64 65 72 20 20 20  t)).. (header   
9a80: 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20      (vector-ref 
9a90: 72 75 6e 64 61 74 20 30 29 29 0a 09 20 28 72 75  rundat 0)).. (ru
9aa0: 6e 73 20 20 20 20 20 20 20 20 20 28 76 65 63 74  ns         (vect
9ab0: 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 31 29  or-ref rundat 1)
9ac0: 29 0a 09 20 28 73 74 61 74 65 73 20 20 20 20 20  ).. (states     
9ad0: 20 20 28 69 66 20 73 74 61 74 65 20 20 28 73 74    (if state  (st
9ae0: 72 69 6e 67 2d 73 70 6c 69 74 20 73 74 61 74 65  ring-split state
9af0: 20 20 22 2c 22 29 20 27 28 29 29 29 0a 09 20 28    ",") '())).. (
9b00: 73 74 61 74 75 73 65 73 20 20 20 20 20 28 69 66  statuses     (if
9b10: 20 73 74 61 74 75 73 20 28 73 74 72 69 6e 67 2d   status (string-
9b20: 73 70 6c 69 74 20 73 74 61 74 75 73 20 22 2c 22  split status ","
9b30: 29 20 27 28 29 29 29 0a 09 20 28 73 74 61 74 65  ) '())).. (state
9b40: 2d 73 74 61 74 75 73 20 28 69 66 20 28 73 74 72  -status (if (str
9b50: 69 6e 67 3f 20 6e 65 77 2d 73 74 61 74 65 2d 73  ing? new-state-s
9b60: 74 61 74 75 73 29 20 28 73 74 72 69 6e 67 2d 73  tatus) (string-s
9b70: 70 6c 69 74 20 6e 65 77 2d 73 74 61 74 65 2d 73  plit new-state-s
9b80: 74 61 74 75 73 20 22 2c 22 29 20 27 28 23 66 20  tatus ",") '(#f 
9b90: 23 66 29 29 29 29 0a 20 20 20 20 28 64 65 62 75  #f)))).    (debu
9ba0: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22  g:print-info 4 "
9bb0: 72 75 6e 73 3a 6f 70 65 72 61 74 65 2d 6f 6e 20  runs:operate-on 
9bc0: 3d 3e 20 48 65 61 64 65 72 3a 20 22 20 68 65 61  => Header: " hea
9bd0: 64 65 72 20 22 20 61 63 74 69 6f 6e 3a 20 22 20  der " action: " 
9be0: 61 63 74 69 6f 6e 20 22 20 6e 65 77 2d 73 74 61  action " new-sta
9bf0: 74 65 2d 73 74 61 74 75 73 3a 20 22 20 6e 65 77  te-status: " new
9c00: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 29 0a 20  -state-status). 
9c10: 20 20 20 28 69 66 20 28 3e 20 32 20 28 6c 65 6e     (if (> 2 (len
9c20: 67 74 68 20 73 74 61 74 65 2d 73 74 61 74 75 73  gth state-status
9c30: 29 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 64  ))..(begin..  (d
9c40: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
9c50: 52 4f 52 3a 20 74 68 65 20 70 61 72 61 6d 65 74  ROR: the paramet
9c60: 65 72 20 74 6f 20 2d 73 65 74 2d 73 74 61 74 65  er to -set-state
9c70: 2d 73 74 61 74 75 73 20 69 73 20 61 20 63 6f 6d  -status is a com
9c80: 6d 61 20 64 65 6c 69 6d 69 74 65 64 20 73 74 72  ma delimited str
9c90: 69 6e 67 2e 20 45 2e 67 2e 20 43 4f 4d 50 4c 45  ing. E.g. COMPLE
9ca0: 54 45 44 2c 46 41 49 4c 22 29 0a 09 20 20 28 65  TED,FAIL")..  (e
9cb0: 78 69 74 29 29 29 0a 20 20 20 20 28 66 6f 72 2d  xit))).    (for-
9cc0: 65 61 63 68 0a 20 20 20 20 20 28 6c 61 6d 62 64  each.     (lambd
9cd0: 61 20 28 72 75 6e 29 0a 20 20 20 20 20 20 20 28  a (run).       (
9ce0: 6c 65 74 20 28 28 72 75 6e 6b 65 79 20 28 73 74  let ((runkey (st
9cf0: 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65  ring-intersperse
9d00: 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 6b   (map (lambda (k
9d10: 29 0a 09 09 09 09 09 09 28 64 62 3a 67 65 74 2d  ).......(db:get-
9d20: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20  value-by-header 
9d30: 72 75 6e 20 68 65 61 64 65 72 20 28 76 65 63 74  run header (vect
9d40: 6f 72 2d 72 65 66 20 6b 20 30 29 29 29 20 6b 65  or-ref k 0))) ke
9d50: 79 73 29 20 22 2f 22 29 29 0a 09 20 20 20 20 20  ys) "/"))..     
9d60: 28 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20  (dirs-to-remove 
9d70: 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65  (make-hash-table
9d80: 29 29 29 0a 09 20 28 6c 65 74 2a 20 28 28 72 75  ))).. (let* ((ru
9d90: 6e 2d 69 64 20 20 20 20 28 64 62 3a 67 65 74 2d  n-id    (db:get-
9da0: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20  value-by-header 
9db0: 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 22 29  run header "id")
9dc0: 29 0a 09 09 28 72 75 6e 2d 73 74 61 74 65 20 28  )...(run-state (
9dd0: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d  db:get-value-by-
9de0: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65  header run heade
9df0: 72 20 22 73 74 61 74 65 22 29 29 0a 09 09 28 74  r "state"))...(t
9e00: 65 73 74 73 20 20 20 20 20 28 69 66 20 28 6e 6f  ests     (if (no
9e10: 74 20 28 65 71 75 61 6c 3f 20 72 75 6e 2d 73 74  t (equal? run-st
9e20: 61 74 65 20 22 6c 6f 63 6b 65 64 22 29 29 0a 09  ate "locked"))..
9e30: 09 09 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72  ..       (open-r
9e40: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d  un-close db:get-
9e50: 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62  tests-for-run db
9e60: 20 72 75 6e 2d 69 64 0a 09 09 09 09 09 09 20 20   run-id.......  
9e70: 20 20 20 20 74 65 73 74 70 61 74 74 20 73 74 61      testpatt sta
9e80: 74 65 73 20 73 74 61 74 75 73 65 73 0a 09 09 09  tes statuses....
9e90: 09 09 09 20 20 20 20 20 20 6e 6f 74 2d 69 6e 3a  ...      not-in:
9ea0: 20 20 23 66 0a 09 09 09 09 09 09 20 20 20 20 20    #f.......     
9eb0: 20 73 6f 72 74 2d 62 79 3a 20 28 63 61 73 65 20   sort-by: (case 
9ec0: 61 63 74 69 6f 6e 0a 09 09 09 09 09 09 09 09 20  action......... 
9ed0: 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29 20 27  ((remove-runs) '
9ee0: 72 75 6e 64 69 72 29 0a 09 09 09 09 09 09 09 09  rundir).........
9ef0: 20 28 65 6c 73 65 20 20 20 20 20 20 20 20 20 20   (else          
9f00: 27 65 76 65 6e 74 5f 74 69 6d 65 29 29 29 0a 09  'event_time)))..
9f10: 09 09 20 20 20 20 20 20 20 27 28 29 29 29 0a 09  ..       '()))..
9f20: 09 28 6c 61 73 74 74 70 61 74 68 20 22 2f 64 6f  .(lasttpath "/do
9f30: 65 73 2f 6e 6f 74 2f 65 78 69 73 74 2f 49 2f 68  es/not/exist/I/h
9f40: 6f 70 65 22 29 29 0a 09 20 20 20 28 64 65 62 75  ope"))..   (debu
9f50: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22  g:print-info 4 "
9f60: 72 75 6e 73 3a 6f 70 65 72 61 74 65 2d 6f 6e 20  runs:operate-on 
9f70: 72 75 6e 3d 22 20 72 75 6e 20 22 2c 20 68 65 61  run=" run ", hea
9f80: 64 65 72 3d 22 20 68 65 61 64 65 72 29 0a 09 20  der=" header).. 
9f90: 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c    (if (not (null
9fa0: 3f 20 74 65 73 74 73 29 29 0a 09 20 20 20 20 20  ? tests))..     
9fb0: 20 20 28 62 65 67 69 6e 0a 09 09 20 28 63 61 73    (begin... (cas
9fc0: 65 20 61 63 74 69 6f 6e 0a 09 09 20 20 20 28 28  e action...   ((
9fd0: 72 65 6d 6f 76 65 2d 72 75 6e 73 29 0a 09 09 20  remove-runs)... 
9fe0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
9ff0: 31 20 22 52 65 6d 6f 76 69 6e 67 20 74 65 73 74  1 "Removing test
a000: 73 20 66 6f 72 20 72 75 6e 3a 20 22 20 72 75 6e  s for run: " run
a010: 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d  key " " (db:get-
a020: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20  value-by-header 
a030: 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e  run header "runn
a040: 61 6d 65 22 29 29 29 0a 09 09 20 20 20 28 28 73  ame")))...   ((s
a050: 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73 29  et-state-status)
a060: 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72  ...    (debug:pr
a070: 69 6e 74 20 31 20 22 4d 6f 64 69 66 79 69 6e 67  int 1 "Modifying
a080: 20 73 74 61 74 65 20 61 6e 64 20 73 74 61 75 73   state and staus
a090: 20 66 6f 72 20 74 65 73 74 73 20 66 6f 72 20 72   for tests for r
a0a0: 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20 22  un: " runkey " "
a0b0: 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62   (db:get-value-b
a0c0: 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61  y-header run hea
a0d0: 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 29 29  der "runname")))
a0e0: 0a 09 09 20 20 20 28 28 70 72 69 6e 74 2d 72 75  ...   ((print-ru
a0f0: 6e 29 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a  n)...    (debug:
a100: 70 72 69 6e 74 20 31 20 22 50 72 69 6e 74 69 6e  print 1 "Printin
a110: 67 20 69 6e 66 6f 20 66 6f 72 20 72 75 6e 20 22  g info for run "
a120: 20 72 75 6e 6b 65 79 20 22 2c 20 72 75 6e 3d 22   runkey ", run="
a130: 20 72 75 6e 20 22 2c 20 74 65 73 74 73 3d 22 20   run ", tests=" 
a140: 74 65 73 74 73 20 22 2c 20 68 65 61 64 65 72 3d  tests ", header=
a150: 22 20 68 65 61 64 65 72 29 0a 09 09 20 20 20 20  " header)...    
a160: 61 63 74 69 6f 6e 29 0a 09 09 20 20 20 28 65 6c  action)...   (el
a170: 73 65 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a  se...    (debug:
a180: 70 72 69 6e 74 2d 69 6e 66 6f 20 30 20 22 61 63  print-info 0 "ac
a190: 74 69 6f 6e 20 6e 6f 74 20 72 65 63 6f 67 6e 69  tion not recogni
a1a0: 73 65 64 20 22 20 61 63 74 69 6f 6e 29 29 29 0a  sed " action))).
a1b0: 09 09 20 28 66 6f 72 2d 65 61 63 68 0a 09 09 20  .. (for-each... 
a1c0: 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 29 0a   (lambda (test).
a1d0: 09 09 20 20 20 20 28 6c 65 74 2a 20 28 28 69 74  ..    (let* ((it
a1e0: 65 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74  em-path (db:test
a1f0: 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74  -get-item-path t
a200: 65 73 74 29 29 0a 09 09 09 20 20 20 28 74 65 73  est))....   (tes
a210: 74 2d 6e 61 6d 65 20 28 64 62 3a 74 65 73 74 2d  t-name (db:test-
a220: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73  get-testname tes
a230: 74 29 29 0a 09 09 09 20 20 20 28 72 75 6e 2d 64  t))....   (run-d
a240: 69 72 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65  ir   (db:test-ge
a250: 74 2d 72 75 6e 64 69 72 20 74 65 73 74 29 29 20  t-rundir test)) 
a260: 20 20 20 3b 3b 20 72 75 6e 20 64 69 72 20 69 73     ;; run dir is
a270: 20 66 72 6f 6d 20 74 68 65 20 6c 69 6e 6b 20 74   from the link t
a280: 72 65 65 0a 09 09 09 20 20 20 28 72 65 61 6c 2d  ree....   (real-
a290: 64 69 72 20 20 28 69 66 20 28 66 69 6c 65 2d 65  dir  (if (file-e
a2a0: 78 69 73 74 73 3f 20 72 75 6e 2d 64 69 72 29 0a  xists? run-dir).
a2b0: 09 09 09 09 09 20 20 28 72 65 73 6f 6c 76 65 2d  .....  (resolve-
a2c0: 70 61 74 68 6e 61 6d 65 20 72 75 6e 2d 64 69 72  pathname run-dir
a2d0: 29 0a 09 09 09 09 09 20 20 23 66 29 29 0a 09 09  )......  #f))...
a2e0: 09 20 20 20 28 74 65 73 74 2d 69 64 20 20 20 28  .   (test-id   (
a2f0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74  db:test-get-id t
a300: 65 73 74 29 29 29 0a 09 09 20 20 20 20 20 20 3b  est)))...      ;
a310: 3b 20 20 20 28 74 64 62 20 20 20 20 20 20 20 28  ;   (tdb       (
a320: 64 62 3a 6f 70 65 6e 2d 74 65 73 74 2d 64 62 20  db:open-test-db 
a330: 72 75 6e 2d 64 69 72 29 29 29 0a 09 09 20 20 20  run-dir)))...   
a340: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d     (debug:print-
a350: 69 6e 66 6f 20 34 20 22 74 65 73 74 3d 22 20 74  info 4 "test=" t
a360: 65 73 74 29 20 3b 3b 20 20 20 22 20 28 64 62 3a  est) ;;   " (db:
a370: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d  test-get-testnam
a380: 65 20 74 65 73 74 29 20 22 20 69 64 3a 20 22 20  e test) " id: " 
a390: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20  (db:test-get-id 
a3a0: 74 65 73 74 29 20 22 20 22 20 69 74 65 6d 2d 70  test) " " item-p
a3b0: 61 74 68 20 22 20 61 63 74 69 6f 6e 3a 20 22 20  ath " action: " 
a3c0: 61 63 74 69 6f 6e 29 0a 09 09 20 20 20 20 20 20  action)...      
a3d0: 28 63 61 73 65 20 61 63 74 69 6f 6e 0a 09 09 09  (case action....
a3e0: 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29 20 3b  ((remove-runs) ;
a3f0: 3b 20 74 68 65 20 74 64 62 20 69 73 20 66 6f 72  ; the tdb is for
a400: 20 66 75 74 75 72 65 20 70 6f 73 73 69 62 6c 65   future possible
a410: 2e 20 0a 09 09 09 20 28 6f 70 65 6e 2d 72 75 6e  . .... (open-run
a420: 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65  -close db:delete
a430: 2d 74 65 73 74 2d 72 65 63 6f 72 64 73 20 64 62  -test-records db
a440: 20 23 66 20 28 64 62 3a 74 65 73 74 2d 67 65 74   #f (db:test-get
a450: 2d 69 64 20 74 65 73 74 29 29 0a 09 09 09 20 28  -id test)).... (
a460: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
a470: 20 31 20 22 41 74 74 65 6d 70 74 69 6e 67 20 74   1 "Attempting t
a480: 6f 20 72 65 6d 6f 76 65 20 22 20 28 69 66 20 72  o remove " (if r
a490: 65 61 6c 2d 64 69 72 20 28 63 6f 6e 63 20 22 20  eal-dir (conc " 
a4a0: 64 69 72 20 22 20 72 65 61 6c 2d 64 69 72 20 22  dir " real-dir "
a4b0: 20 61 6e 64 20 22 29 20 22 22 29 20 22 20 6c 69   and ") "") " li
a4c0: 6e 6b 20 22 20 72 75 6e 2d 64 69 72 29 0a 09 09  nk " run-dir)...
a4d0: 09 20 28 69 66 20 28 61 6e 64 20 72 65 61 6c 2d  . (if (and real-
a4e0: 64 69 72 20 0a 09 09 09 09 20 20 28 3e 20 28 73  dir .....  (> (s
a4f0: 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 72 65 61  tring-length rea
a500: 6c 2d 64 69 72 29 20 35 29 0a 09 09 09 09 20 20  l-dir) 5).....  
a510: 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 65  (file-exists? re
a520: 61 6c 2d 64 69 72 29 29 20 3b 3b 20 62 61 64 20  al-dir)) ;; bad 
a530: 68 65 75 72 69 73 74 69 63 20 62 75 74 20 73 68  heuristic but sh
a540: 6f 75 6c 64 20 70 72 65 76 65 6e 74 20 2f 74 6d  ould prevent /tm
a550: 70 20 2f 68 6f 6d 65 20 65 74 63 2e 0a 09 09 09  p /home etc.....
a560: 20 20 20 20 20 28 62 65 67 69 6e 20 3b 3b 20 6c       (begin ;; l
a570: 65 74 2a 20 28 28 72 65 61 6c 70 61 74 68 20 28  et* ((realpath (
a580: 72 65 73 6f 6c 76 65 2d 70 61 74 68 6e 61 6d 65  resolve-pathname
a590: 20 72 75 6e 2d 64 69 72 29 29 29 0a 09 09 09 20   run-dir))).... 
a5a0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
a5b0: 6e 74 2d 69 6e 66 6f 20 31 20 22 52 65 63 75 72  nt-info 1 "Recur
a5c0: 73 69 76 65 6c 79 20 72 65 6d 6f 76 69 6e 67 20  sively removing 
a5d0: 22 20 72 65 61 6c 2d 64 69 72 29 0a 09 09 09 20  " real-dir).... 
a5e0: 20 20 20 20 20 20 28 69 66 20 28 66 69 6c 65 2d        (if (file-
a5f0: 65 78 69 73 74 73 3f 20 72 65 61 6c 2d 64 69 72  exists? real-dir
a600: 29 0a 09 09 09 09 20 20 20 28 69 66 20 28 3e 20  ).....   (if (> 
a610: 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 72  (system (conc "r
a620: 6d 20 2d 72 66 20 22 20 72 65 61 6c 2d 64 69 72  m -rf " real-dir
a630: 29 29 20 30 29 0a 09 09 09 09 20 20 20 20 20 20  )) 0).....      
a640: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
a650: 22 45 52 52 4f 52 3a 20 54 68 65 72 65 20 77 61  "ERROR: There wa
a660: 73 20 61 20 70 72 6f 62 6c 65 6d 20 72 65 6d 6f  s a problem remo
a670: 76 69 6e 67 20 22 20 72 65 61 6c 2d 64 69 72 20  ving " real-dir 
a680: 22 20 77 69 74 68 20 72 6d 20 2d 66 22 29 29 0a  " with rm -f")).
a690: 09 09 09 09 20 20 20 28 64 65 62 75 67 3a 70 72  ....   (debug:pr
a6a0: 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20  int 0 "WARNING: 
a6b0: 74 65 73 74 20 64 69 72 20 22 20 72 65 61 6c 2d  test dir " real-
a6c0: 64 69 72 20 22 20 61 70 70 65 61 72 73 20 74 6f  dir " appears to
a6d0: 20 6e 6f 74 20 65 78 69 73 74 20 6f 72 20 69 73   not exist or is
a6e0: 20 6e 6f 74 20 72 65 61 64 61 62 6c 65 22 29 29   not readable"))
a6f0: 29 0a 09 09 09 20 20 20 20 20 28 69 66 20 72 65  )....     (if re
a700: 61 6c 2d 64 69 72 20 0a 09 09 09 09 20 28 64 65  al-dir ..... (de
a710: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52  bug:print 0 "WAR
a720: 4e 49 4e 47 3a 20 64 69 72 65 63 74 6f 72 79 20  NING: directory 
a730: 22 20 72 65 61 6c 2d 64 69 72 20 22 20 64 6f 65  " real-dir " doe
a740: 73 20 6e 6f 74 20 65 78 69 73 74 22 29 0a 09 09  s not exist")...
a750: 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  .. (debug:print 
a760: 30 20 22 57 41 52 4e 49 4e 47 3a 20 6e 6f 20 72  0 "WARNING: no r
a770: 65 61 6c 20 64 69 72 65 63 74 6f 72 79 20 63 6f  eal directory co
a780: 72 72 6f 73 70 6f 6e 64 69 6e 67 20 74 6f 20 6c  rrosponding to l
a790: 69 6e 6b 20 22 20 72 75 6e 2d 64 69 72 20 22 2c  ink " run-dir ",
a7a0: 20 6e 6f 74 68 69 6e 67 20 64 6f 6e 65 22 29 29   nothing done"))
a7b0: 29 0a 09 09 09 20 28 69 66 20 28 73 79 6d 62 6f  ).... (if (symbo
a7c0: 6c 69 63 2d 6c 69 6e 6b 3f 20 72 75 6e 2d 64 69  lic-link? run-di
a7d0: 72 29 0a 09 09 09 20 20 20 20 20 28 62 65 67 69  r)....     (begi
a7e0: 6e 0a 09 09 09 20 20 20 20 20 20 20 28 64 65 62  n....       (deb
a7f0: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20  ug:print-info 1 
a800: 22 52 65 6d 6f 76 69 6e 67 20 73 79 6d 6c 69 6e  "Removing symlin
a810: 6b 20 22 20 72 75 6e 2d 64 69 72 29 0a 09 09 09  k " run-dir)....
a820: 20 20 20 20 20 20 20 28 68 61 6e 64 6c 65 2d 65         (handle-e
a830: 78 63 65 70 74 69 6f 6e 73 0a 09 09 09 09 65 78  xceptions.....ex
a840: 6e 0a 09 09 09 09 28 64 65 62 75 67 3a 70 72 69  n.....(debug:pri
a850: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 20 46 61  nt 0 "ERROR:  Fa
a860: 69 6c 65 64 20 74 6f 20 72 65 6d 6f 76 65 20 73  iled to remove s
a870: 79 6d 6c 69 6e 6b 20 22 20 72 75 6e 2d 64 69 72  ymlink " run-dir
a880: 20 28 28 63 6f 6e 64 69 74 69 6f 6e 2d 70 72 6f   ((condition-pro
a890: 70 65 72 74 79 2d 61 63 63 65 73 73 6f 72 20 27  perty-accessor '
a8a0: 65 78 6e 20 27 6d 65 73 73 61 67 65 29 20 65 78  exn 'message) ex
a8b0: 6e 29 20 22 2c 20 61 74 74 65 6d 70 74 69 6e 67  n) ", attempting
a8c0: 20 74 6f 20 63 6f 6e 74 69 6e 75 65 22 29 0a 09   to continue")..
a8d0: 09 09 09 28 64 65 6c 65 74 65 2d 66 69 6c 65 20  ...(delete-file 
a8e0: 72 75 6e 2d 64 69 72 29 29 29 0a 09 09 09 20 20  run-dir)))....  
a8f0: 20 20 20 28 69 66 20 28 64 69 72 65 63 74 6f 72     (if (director
a900: 79 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 09  y? run-dir).....
a910: 20 28 69 66 20 28 3e 20 28 64 69 72 65 63 74 6f   (if (> (directo
a920: 72 79 2d 66 6f 6c 64 20 28 6c 61 6d 62 64 61 20  ry-fold (lambda 
a930: 28 66 20 78 29 28 2b 20 31 20 78 29 29 20 30 20  (f x)(+ 1 x)) 0 
a940: 72 75 6e 2d 64 69 72 29 20 30 29 0a 09 09 09 09  run-dir) 0).....
a950: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
a960: 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 72 65  t 0 "WARNING: re
a970: 66 75 73 69 6e 67 20 74 6f 20 72 65 6d 6f 76 65  fusing to remove
a980: 20 22 20 72 75 6e 2d 64 69 72 20 22 20 61 73 20   " run-dir " as 
a990: 69 74 20 69 73 20 6e 6f 74 20 65 6d 70 74 79 22  it is not empty"
a9a0: 29 0a 09 09 09 09 20 20 20 20 20 20 28 68 61 6e  ).....      (han
a9b0: 64 6c 65 2d 65 78 63 65 70 74 69 6f 6e 73 0a 09  dle-exceptions..
a9c0: 09 09 09 20 20 20 20 20 20 20 65 78 6e 0a 09 09  ...       exn...
a9d0: 09 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a  ..       (debug:
a9e0: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
a9f0: 20 46 61 69 6c 65 64 20 74 6f 20 72 65 6d 6f 76   Failed to remov
aa00: 65 20 64 69 72 65 63 74 6f 72 79 20 22 20 72 75  e directory " ru
aa10: 6e 2d 64 69 72 20 28 28 63 6f 6e 64 69 74 69 6f  n-dir ((conditio
aa20: 6e 2d 70 72 6f 70 65 72 74 79 2d 61 63 63 65 73  n-property-acces
aa30: 73 6f 72 20 27 65 78 6e 20 27 6d 65 73 73 61 67  sor 'exn 'messag
aa40: 65 29 20 65 78 6e 29 20 22 2c 20 61 74 74 65 6d  e) exn) ", attem
aa50: 70 74 69 6e 67 20 74 6f 20 63 6f 6e 74 69 6e 75  pting to continu
aa60: 65 22 29 0a 09 09 09 09 20 20 20 20 20 20 20 28  e").....       (
aa70: 64 65 6c 65 74 65 2d 64 69 72 65 63 74 6f 72 79  delete-directory
aa80: 20 72 75 6e 2d 64 69 72 29 29 29 0a 09 09 09 09   run-dir))).....
aa90: 20 28 69 66 20 72 75 6e 2d 64 69 72 0a 09 09 09   (if run-dir....
aaa0: 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  .     (debug:pri
aab0: 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 6e  nt 0 "WARNING: n
aac0: 6f 74 20 72 65 6d 6f 76 69 6e 67 20 22 20 72 75  ot removing " ru
aad0: 6e 2d 64 69 72 20 22 20 61 73 20 69 74 20 65 69  n-dir " as it ei
aae0: 74 68 65 72 20 64 6f 65 73 6e 27 74 20 65 78 69  ther doesn't exi
aaf0: 73 74 20 6f 72 20 69 73 20 6e 6f 74 20 61 20 73  st or is not a s
ab00: 79 6d 6c 69 6e 6b 22 29 0a 09 09 09 09 20 20 20  ymlink").....   
ab10: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
ab20: 20 22 4e 4f 54 45 3a 20 74 68 65 20 72 75 6e 20   "NOTE: the run 
ab30: 64 69 72 20 66 6f 72 20 74 68 69 73 20 74 65 73  dir for this tes
ab40: 74 20 69 73 20 75 6e 64 65 66 69 6e 65 64 2e 20  t is undefined. 
ab50: 54 65 73 74 20 6d 61 79 20 68 61 76 65 20 61 6c  Test may have al
ab60: 72 65 61 64 79 20 62 65 65 6e 20 64 65 6c 65 74  ready been delet
ab70: 65 64 2e 22 29 29 0a 09 09 09 09 20 29 29 29 0a  ed."))..... ))).
ab80: 09 09 09 28 28 73 65 74 2d 73 74 61 74 65 2d 73  ...((set-state-s
ab90: 74 61 74 75 73 29 0a 09 09 09 20 28 64 65 62 75  tatus).... (debu
aba0: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 32 20 22  g:print-info 2 "
abb0: 6e 65 77 20 73 74 61 74 65 20 22 20 28 63 61 72  new state " (car
abc0: 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 20 22   state-status) "
abd0: 2c 20 6e 65 77 20 73 74 61 74 75 73 20 22 20 28  , new status " (
abe0: 63 61 64 72 20 73 74 61 74 65 2d 73 74 61 74 75  cadr state-statu
abf0: 73 29 29 0a 09 09 09 20 28 6f 70 65 6e 2d 72 75  s)).... (open-ru
ac00: 6e 2d 63 6c 6f 73 65 20 64 62 3a 74 65 73 74 2d  n-close db:test-
ac10: 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73  set-state-status
ac20: 2d 62 79 2d 69 64 20 64 62 20 28 64 62 3a 74 65  -by-id db (db:te
ac30: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29 20  st-get-id test) 
ac40: 28 63 61 72 20 73 74 61 74 65 2d 73 74 61 74 75  (car state-statu
ac50: 73 29 28 63 61 64 72 20 73 74 61 74 65 2d 73 74  s)(cadr state-st
ac60: 61 74 75 73 29 20 23 66 29 29 29 29 29 0a 09 09  atus) #f)))))...
ac70: 20 20 28 73 6f 72 74 20 74 65 73 74 73 20 28 6c    (sort tests (l
ac80: 61 6d 62 64 61 20 28 61 20 62 29 28 6c 65 74 20  ambda (a b)(let 
ac90: 28 28 64 69 72 61 20 28 64 62 3a 74 65 73 74 2d  ((dira (db:test-
aca0: 67 65 74 2d 72 75 6e 64 69 72 20 61 29 29 0a 09  get-rundir a))..
acb0: 09 09 09 09 09 20 28 64 69 72 62 20 28 64 62 3a  ..... (dirb (db:
acc0: 74 65 73 74 2d 67 65 74 2d 72 75 6e 64 69 72 20  test-get-rundir 
acd0: 62 29 29 29 0a 09 09 09 09 09 20 20 20 20 20 28  b)))......     (
ace0: 69 66 20 28 61 6e 64 20 28 73 74 72 69 6e 67 3f  if (and (string?
acf0: 20 64 69 72 61 29 28 73 74 72 69 6e 67 3f 20 64   dira)(string? d
ad00: 69 72 62 29 29 0a 09 09 09 09 09 09 20 28 3e 20  irb))....... (> 
ad10: 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 64  (string-length d
ad20: 69 72 61 29 28 73 74 72 69 6e 67 2d 6c 65 6e 67  ira)(string-leng
ad30: 74 68 20 64 69 72 62 29 29 0a 09 09 09 09 09 09  th dirb)).......
ad40: 20 23 66 29 29 29 29 29 29 29 0a 09 20 20 20 3b   #f)))))))..   ;
ad50: 3b 20 72 65 6d 6f 76 65 20 74 68 65 20 72 75 6e  ; remove the run
ad60: 20 69 66 20 7a 65 72 6f 20 74 65 73 74 73 20 72   if zero tests r
ad70: 65 6d 61 69 6e 0a 09 20 20 20 28 69 66 20 28 65  emain..   (if (e
ad80: 71 3f 20 61 63 74 69 6f 6e 20 27 72 65 6d 6f 76  q? action 'remov
ad90: 65 2d 72 75 6e 73 29 0a 09 20 20 20 20 20 20 20  e-runs)..       
ada0: 28 6c 65 74 20 28 28 72 65 6d 74 65 73 74 73 20  (let ((remtests 
adb0: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
adc0: 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72  db:get-tests-for
add0: 2d 72 75 6e 20 64 62 20 28 64 62 3a 67 65 74 2d  -run db (db:get-
ade0: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20  value-by-header 
adf0: 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 22 29  run header "id")
ae00: 20 23 66 20 27 28 22 44 45 4c 45 54 45 44 22 29   #f '("DELETED")
ae10: 20 27 28 22 6e 2f 61 22 29 20 6e 6f 74 2d 69 6e   '("n/a") not-in
ae20: 3a 20 23 74 29 29 29 0a 09 09 20 28 69 66 20 28  : #t)))... (if (
ae30: 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29 20  null? remtests) 
ae40: 3b 3b 20 6e 6f 20 6d 6f 72 65 20 74 65 73 74 73  ;; no more tests
ae50: 20 72 65 6d 61 69 6e 69 6e 67 0a 09 09 20 20 20   remaining...   
ae60: 20 20 28 6c 65 74 2a 20 28 28 64 70 61 72 74 73    (let* ((dparts
ae70: 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20    (string-split 
ae80: 6c 61 73 74 74 70 61 74 68 20 22 2f 22 29 29 0a  lasttpath "/")).
ae90: 09 09 09 20 20 20 20 28 72 75 6e 70 61 74 68 20  ...    (runpath 
aea0: 28 63 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 6e  (conc "/" (strin
aeb0: 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09  g-intersperse ..
aec0: 09 09 09 09 09 28 74 61 6b 65 20 64 70 61 72 74  .....(take dpart
aed0: 73 20 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 61  s (- (length dpa
aee0: 72 74 73 29 20 31 29 29 0a 09 09 09 09 09 09 22  rts) 1))......."
aef0: 2f 22 29 29 29 29 0a 09 09 20 20 20 20 20 20 20  /"))))...       
af00: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22  (debug:print 1 "
af10: 52 65 6d 6f 76 69 6e 67 20 72 75 6e 3a 20 22 20  Removing run: " 
af20: 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67  runkey " " (db:g
af30: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64  et-value-by-head
af40: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 72  er run header "r
af50: 75 6e 6e 61 6d 65 22 29 20 22 20 61 6e 64 20 72  unname") " and r
af60: 65 6c 61 74 65 64 20 72 65 63 6f 72 64 22 29 0a  elated record").
af70: 09 09 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72  ..       (open-r
af80: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65  un-close db:dele
af90: 74 65 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 64  te-run db run-id
afa0: 29 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 54 68  )...       ;; Th
afb0: 69 73 20 69 73 20 61 20 70 72 65 74 74 79 20 67  is is a pretty g
afc0: 6f 6f 64 20 70 6c 61 63 65 20 74 6f 20 70 75 72  ood place to pur
afd0: 67 65 20 6f 6c 64 20 44 45 4c 45 54 45 44 20 74  ge old DELETED t
afe0: 65 73 74 73 0a 09 09 20 20 20 20 20 20 20 28 6f  ests...       (o
aff0: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62  pen-run-close db
b000: 3a 64 65 6c 65 74 65 2d 74 65 73 74 73 2d 66 6f  :delete-tests-fo
b010: 72 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 29  r-run db run-id)
b020: 0a 09 09 20 20 20 20 20 20 20 28 6f 70 65 6e 2d  ...       (open-
b030: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c  run-close db:del
b040: 65 74 65 2d 6f 6c 64 2d 64 65 6c 65 74 65 64 2d  ete-old-deleted-
b050: 74 65 73 74 2d 72 65 63 6f 72 64 73 20 64 62 29  test-records db)
b060: 0a 09 09 20 20 20 20 20 20 20 28 6f 70 65 6e 2d  ...       (open-
b070: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 73 65 74  run-close db:set
b080: 2d 76 61 72 20 64 62 20 22 44 45 4c 45 54 45 44  -var db "DELETED
b090: 5f 54 45 53 54 53 22 20 28 63 75 72 72 65 6e 74  _TESTS" (current
b0a0: 2d 73 65 63 6f 6e 64 73 29 29 0a 09 09 20 20 20  -seconds))...   
b0b0: 20 20 20 20 3b 3b 20 6e 65 65 64 20 74 6f 20 66      ;; need to f
b0c0: 69 67 75 72 65 20 6f 75 74 20 74 68 65 20 70 61  igure out the pa
b0d0: 74 68 20 74 6f 20 74 68 65 20 72 75 6e 20 64 69  th to the run di
b0e0: 72 20 61 6e 64 20 72 65 6d 6f 76 65 20 69 74 20  r and remove it 
b0f0: 69 66 20 65 6d 70 74 79 0a 09 09 20 20 20 20 20  if empty...     
b100: 20 20 3b 3b 20 20 20 20 28 69 66 20 28 6e 75 6c    ;;    (if (nul
b110: 6c 3f 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20 72  l? (glob (conc r
b120: 75 6e 70 61 74 68 20 22 2f 2a 22 29 29 29 0a 09  unpath "/*")))..
b130: 09 20 20 20 20 20 20 20 3b 3b 20 20 20 20 20 20  .       ;;      
b140: 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20    (begin...     
b150: 20 20 3b 3b 20 09 20 28 64 65 62 75 67 3a 70 72    ;; . (debug:pr
b160: 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20  int 1 "Removing 
b170: 72 75 6e 20 64 69 72 20 22 20 72 75 6e 70 61 74  run dir " runpat
b180: 68 29 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 09  h)...       ;; .
b190: 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 22   (system (conc "
b1a0: 72 6d 64 69 72 20 2d 70 20 22 20 72 75 6e 70 61  rmdir -p " runpa
b1b0: 74 68 29 29 29 29 0a 09 09 20 20 20 20 20 20 20  th))))...       
b1c0: 29 29 29 29 29 0a 09 20 29 29 0a 20 20 20 20 20  ))))).. )).     
b1d0: 72 75 6e 73 29 29 0a 20 20 23 74 29 0a 0a 3b 3b  runs)).  #t)..;;
b1e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b1f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b200: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b210: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b220: 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 75 74 69 6e  ======.;; Routin
b230: 65 73 20 66 6f 72 20 6d 61 6e 69 70 75 6c 61 74  es for manipulat
b240: 69 6e 67 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d  ing runs.;;=====
b250: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b260: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b270: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b280: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b290: 3d 0a 0a 3b 3b 20 53 69 6e 63 65 20 6d 61 6e 79  =..;; Since many
b2a0: 20 63 61 6c 6c 73 20 74 6f 20 61 20 72 75 6e 20   calls to a run 
b2b0: 72 65 71 75 69 72 65 20 70 72 65 74 74 79 20 6d  require pretty m
b2c0: 75 63 68 20 74 68 65 20 73 61 6d 65 20 73 65 74  uch the same set
b2d0: 75 70 20 0a 3b 3b 20 74 68 69 73 20 77 72 61 70  up .;; this wrap
b2e0: 70 65 72 20 69 73 20 75 73 65 64 20 74 6f 20 72  per is used to r
b2f0: 65 64 75 63 65 20 74 68 65 20 72 65 70 6c 69 63  educe the replic
b300: 61 74 69 6f 6e 20 6f 66 20 63 6f 64 65 0a 28 64  ation of code.(d
b310: 65 66 69 6e 65 20 28 67 65 6e 65 72 61 6c 2d 72  efine (general-r
b320: 75 6e 2d 63 61 6c 6c 20 73 77 69 74 63 68 6e 61  un-call switchna
b330: 6d 65 20 61 63 74 69 6f 6e 2d 64 65 73 63 20 70  me action-desc p
b340: 72 6f 63 29 0a 20 20 28 6c 65 74 20 28 28 72 75  roc).  (let ((ru
b350: 6e 6e 61 6d 65 20 28 61 72 67 73 3a 67 65 74 2d  nname (args:get-
b360: 61 72 67 20 22 3a 72 75 6e 6e 61 6d 65 22 29 29  arg ":runname"))
b370: 0a 09 28 74 61 72 67 65 74 20 20 28 69 66 20 28  ..(target  (if (
b380: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74  args:get-arg "-t
b390: 61 72 67 65 74 22 29 0a 09 09 20 20 20 20 20 28  arget")...     (
b3a0: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74  args:get-arg "-t
b3b0: 61 72 67 65 74 22 29 0a 09 09 20 20 20 20 20 28  arget")...     (
b3c0: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72  args:get-arg "-r
b3d0: 65 71 74 61 72 67 22 29 29 29 0a 09 28 74 68 31  eqtarg")))..(th1
b3e0: 20 20 20 20 20 23 66 29 29 0a 20 20 20 20 28 63       #f)).    (c
b3f0: 6f 6e 64 0a 20 20 20 20 20 28 28 6e 6f 74 20 74  ond.     ((not t
b400: 61 72 67 65 74 29 0a 20 20 20 20 20 20 28 64 65  arget).      (de
b410: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52  bug:print 0 "ERR
b420: 4f 52 3a 20 4d 69 73 73 69 6e 67 20 72 65 71 75  OR: Missing requ
b430: 69 72 65 64 20 70 61 72 61 6d 65 74 65 72 20 66  ired parameter f
b440: 6f 72 20 22 20 73 77 69 74 63 68 6e 61 6d 65 20  or " switchname 
b450: 22 2c 20 79 6f 75 20 6d 75 73 74 20 73 70 65 63  ", you must spec
b460: 69 66 79 20 74 68 65 20 74 61 72 67 65 74 20 77  ify the target w
b470: 69 74 68 20 2d 74 61 72 67 65 74 22 29 0a 20 20  ith -target").  
b480: 20 20 20 20 28 65 78 69 74 20 33 29 29 0a 20 20      (exit 3)).  
b490: 20 20 20 28 28 6e 6f 74 20 72 75 6e 6e 61 6d 65     ((not runname
b4a0: 29 0a 20 20 20 20 20 20 28 64 65 62 75 67 3a 70  ).      (debug:p
b4b0: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 4d  rint 0 "ERROR: M
b4c0: 69 73 73 69 6e 67 20 72 65 71 75 69 72 65 64 20  issing required 
b4d0: 70 61 72 61 6d 65 74 65 72 20 66 6f 72 20 22 20  parameter for " 
b4e0: 73 77 69 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f  switchname ", yo
b4f0: 75 20 6d 75 73 74 20 73 70 65 63 69 66 79 20 74  u must specify t
b500: 68 65 20 72 75 6e 20 6e 61 6d 65 20 77 69 74 68  he run name with
b510: 20 3a 72 75 6e 6e 61 6d 65 20 72 75 6e 6e 61 6d   :runname runnam
b520: 65 22 29 0a 20 20 20 20 20 20 28 65 78 69 74 20  e").      (exit 
b530: 33 29 29 0a 20 20 20 20 20 28 65 6c 73 65 0a 20  3)).     (else. 
b540: 20 20 20 20 20 28 6c 65 74 20 28 28 64 62 20 20       (let ((db  
b550: 20 23 66 29 0a 09 20 20 20 20 28 6b 65 79 73 20   #f)..    (keys 
b560: 23 66 29 29 0a 09 28 69 66 20 28 6e 6f 74 20 28  #f))..(if (not (
b570: 73 65 74 75 70 2d 66 6f 72 2d 72 75 6e 29 29 0a  setup-for-run)).
b580: 09 20 20 20 20 28 62 65 67 69 6e 20 0a 09 20 20  .    (begin ..  
b590: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
b5a0: 20 30 20 22 46 61 69 6c 65 64 20 74 6f 20 73 65   0 "Failed to se
b5b0: 74 75 70 2c 20 65 78 69 74 69 6e 67 22 29 0a 09  tup, exiting")..
b5c0: 20 20 20 20 20 20 28 65 78 69 74 20 31 29 29 29        (exit 1)))
b5d0: 0a 09 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d  ..(if (args:get-
b5e0: 61 72 67 20 22 2d 73 65 72 76 65 72 22 29 0a 09  arg "-server")..
b5f0: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c      (open-run-cl
b600: 6f 73 65 20 73 65 72 76 65 72 3a 73 74 61 72 74  ose server:start
b610: 20 64 62 20 28 61 72 67 73 3a 67 65 74 2d 61 72   db (args:get-ar
b620: 67 20 22 2d 73 65 72 76 65 72 22 29 29 29 0a 20  g "-server"))). 
b630: 09 20 20 20 20 3b 3b 20 28 69 66 20 28 6e 6f 74  .    ;; (if (not
b640: 20 28 6f 72 20 28 61 72 67 73 3a 67 65 74 2d 61   (or (args:get-a
b650: 72 67 20 22 2d 72 75 6e 61 6c 6c 22 29 20 20 20  rg "-runall")   
b660: 20 20 3b 3b 20 72 75 6e 61 6c 6c 20 61 6e 64 20    ;; runall and 
b670: 72 75 6e 74 65 73 74 73 20 61 72 65 20 61 6c 6c  runtests are all
b680: 6f 77 65 64 20 74 6f 20 62 65 20 73 65 72 76 65  owed to be serve
b690: 72 73 0a 20 09 20 20 20 20 3b 3b 20 20 20 20 20  rs. .    ;;     
b6a0: 09 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20  . (args:get-arg 
b6b0: 22 2d 72 75 6e 74 65 73 74 73 22 29 29 29 0a 09  "-runtests")))..
b6c0: 20 20 20 20 3b 3b 20 20 20 20 20 28 63 6c 69 65      ;;     (clie
b6d0: 6e 74 3a 73 65 74 75 70 29 20 3b 3b 20 54 68 69  nt:setup) ;; Thi
b6e0: 73 20 69 73 20 61 20 64 75 70 6c 69 63 61 74 65  s is a duplicate
b6f0: 20 73 74 61 72 74 75 70 21 21 21 3f 3f 3f 20 42   startup!!!??? B
b700: 55 47 3f 0a 09 20 20 20 20 3b 3b 20 20 20 20 20  UG?..    ;;     
b710: 29 29 0a 09 28 73 65 74 21 20 6b 65 79 73 20 28  ))..(set! keys (
b720: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64  open-run-close d
b730: 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a  b:get-keys db)).
b740: 09 3b 3b 20 68 61 76 65 20 65 6e 6f 75 67 68 20  .;; have enough 
b750: 74 6f 20 70 72 6f 63 65 73 73 20 2d 74 61 72 67  to process -targ
b760: 65 74 20 6f 72 20 2d 72 65 71 74 61 72 67 20 68  et or -reqtarg h
b770: 65 72 65 0a 09 28 69 66 20 28 61 72 67 73 3a 67  ere..(if (args:g
b780: 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67  et-arg "-reqtarg
b790: 22 29 0a 09 20 20 20 20 28 6c 65 74 2a 20 28 28  ")..    (let* ((
b7a0: 72 75 6e 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63  runconfigf (conc
b7b0: 20 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72 75    *toppath* "/ru
b7c0: 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22  nconfigs.config"
b7d0: 29 29 20 3b 3b 20 44 4f 20 4e 4f 54 20 45 56 41  )) ;; DO NOT EVA
b7e0: 4c 55 41 54 45 20 41 4c 4c 20 0a 09 09 20 20 20  LUATE ALL ...   
b7f0: 28 72 75 6e 63 6f 6e 66 69 67 20 20 28 72 65 61  (runconfig  (rea
b800: 64 2d 63 6f 6e 66 69 67 20 72 75 6e 63 6f 6e 66  d-config runconf
b810: 69 67 66 20 23 66 20 23 74 20 65 6e 76 69 72 6f  igf #f #t enviro
b820: 6e 2d 70 61 74 74 3a 20 23 66 29 29 29 20 0a 09  n-patt: #f))) ..
b830: 20 20 20 20 20 20 28 69 66 20 28 68 61 73 68 2d        (if (hash-
b840: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c  table-ref/defaul
b850: 74 20 72 75 6e 63 6f 6e 66 69 67 20 28 61 72 67  t runconfig (arg
b860: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74  s:get-arg "-reqt
b870: 61 72 67 22 29 20 23 66 29 0a 09 09 20 20 28 6b  arg") #f)...  (k
b880: 65 79 73 3a 74 61 72 67 65 74 2d 73 65 74 2d 61  eys:target-set-a
b890: 72 67 73 20 6b 65 79 73 20 28 61 72 67 73 3a 67  rgs keys (args:g
b8a0: 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67  et-arg "-reqtarg
b8b0: 22 29 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68  ") args:arg-hash
b8c0: 29 0a 09 09 20 20 28 62 65 67 69 6e 0a 09 09 20  )...  (begin... 
b8d0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
b8e0: 30 20 22 45 52 52 4f 52 3a 20 5b 22 20 28 61 72  0 "ERROR: [" (ar
b8f0: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71  gs:get-arg "-req
b900: 74 61 72 67 22 29 20 22 5d 20 6e 6f 74 20 66 6f  targ") "] not fo
b910: 75 6e 64 20 69 6e 20 22 20 72 75 6e 63 6f 6e 66  und in " runconf
b920: 69 67 66 29 0a 09 09 20 20 20 20 28 69 66 20 64  igf)...    (if d
b930: 62 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c  b (sqlite3:final
b940: 69 7a 65 21 20 64 62 29 29 0a 09 09 20 20 20 20  ize! db))...    
b950: 28 65 78 69 74 20 31 29 29 29 29 0a 09 20 20 20  (exit 1))))..   
b960: 20 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61   (if (args:get-a
b970: 72 67 20 22 2d 74 61 72 67 65 74 22 29 0a 09 09  rg "-target")...
b980: 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 73 65 74  (keys:target-set
b990: 2d 61 72 67 73 20 6b 65 79 73 20 28 61 72 67 73  -args keys (args
b9a0: 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65  :get-arg "-targe
b9b0: 74 22 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68  t" args:arg-hash
b9c0: 29 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29  ) args:arg-hash)
b9d0: 29 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 63 61  ))..(if (not (ca
b9e0: 72 20 2a 63 6f 6e 66 69 67 69 6e 66 6f 2a 29 29  r *configinfo*))
b9f0: 0a 09 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20  ..    (begin..  
ba00: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
ba10: 20 30 20 22 45 52 52 4f 52 3a 20 41 74 74 65 6d   0 "ERROR: Attem
ba20: 70 74 65 64 20 74 6f 20 22 20 61 63 74 69 6f 6e  pted to " action
ba30: 2d 64 65 73 63 20 22 20 62 75 74 20 72 75 6e 20  -desc " but run 
ba40: 61 72 65 61 20 63 6f 6e 66 69 67 20 66 69 6c 65  area config file
ba50: 20 6e 6f 74 20 66 6f 75 6e 64 22 29 0a 09 20 20   not found")..  
ba60: 20 20 20 20 28 65 78 69 74 20 31 29 29 0a 09 20      (exit 1)).. 
ba70: 20 20 20 3b 3b 20 45 78 74 72 61 63 74 20 6f 75     ;; Extract ou
ba80: 74 20 73 74 75 66 66 20 6e 65 65 64 65 64 20 69  t stuff needed i
ba90: 6e 20 6d 6f 73 74 20 6f 72 20 6d 61 6e 79 20 63  n most or many c
baa0: 61 6c 6c 73 0a 09 20 20 20 20 3b 3b 20 68 65 72  alls..    ;; her
bab0: 65 20 74 68 65 6e 20 63 61 6c 6c 20 70 72 6f 63  e then call proc
bac0: 0a 09 20 20 20 20 28 6c 65 74 2a 20 28 28 6b 65  ..    (let* ((ke
bad0: 79 6e 61 6d 65 73 20 20 20 28 6d 61 70 20 6b 65  ynames   (map ke
bae0: 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20  y:get-fieldname 
baf0: 6b 65 79 73 29 29 0a 09 09 20 20 20 28 6b 65 79  keys))...   (key
bb00: 76 61 6c 6c 73 74 20 20 28 6b 65 79 73 2d 3e 76  vallst  (keys->v
bb10: 61 6c 6c 69 73 74 20 6b 65 79 73 20 23 74 29 29  allist keys #t))
bb20: 29 0a 09 20 20 20 20 20 20 28 70 72 6f 63 20 74  )..      (proc t
bb30: 61 72 67 65 74 20 72 75 6e 6e 61 6d 65 20 6b 65  arget runname ke
bb40: 79 73 20 6b 65 79 6e 61 6d 65 73 20 6b 65 79 76  ys keynames keyv
bb50: 61 6c 6c 73 74 29 29 29 0a 09 28 69 66 20 74 68  allst)))..(if th
bb60: 31 20 28 74 68 72 65 61 64 2d 6a 6f 69 6e 21 20  1 (thread-join! 
bb70: 74 68 31 29 29 0a 09 28 69 66 20 64 62 20 28 73  th1))..(if db (s
bb80: 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21  qlite3:finalize!
bb90: 20 64 62 29 29 0a 09 28 73 65 74 21 20 2a 64 69   db))..(set! *di
bba0: 64 73 6f 6d 65 74 68 69 6e 67 2a 20 23 74 29 29  dsomething* #t))
bbb0: 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d  ))))..;;========
bbc0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
bbd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
bbe0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
bbf0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b  ==============.;
bc00: 3b 20 4c 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 72 75  ; Lock/unlock ru
bc10: 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ns.;;===========
bc20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
bc30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
bc40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
bc50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65  ===========..(de
bc60: 66 69 6e 65 20 28 72 75 6e 73 3a 68 61 6e 64 6c  fine (runs:handl
bc70: 65 2d 6c 6f 63 6b 69 6e 67 20 74 61 72 67 65 74  e-locking target
bc80: 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65 20 6c 6f   keys runname lo
bc90: 63 6b 20 75 6e 6c 6f 63 6b 20 75 73 65 72 29 0a  ck unlock user).
bca0: 20 20 28 6c 65 74 2a 20 28 28 64 62 20 20 20 20    (let* ((db    
bcb0: 20 20 20 23 66 29 0a 09 20 28 72 75 6e 64 61 74     #f).. (rundat
bcc0: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f     (open-run-clo
bcd0: 73 65 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73  se runs:get-runs
bce0: 2d 62 79 2d 70 61 74 74 20 64 62 20 6b 65 79 73  -by-patt db keys
bcf0: 20 72 75 6e 6e 61 6d 65 29 29 0a 09 20 28 68 65   runname)).. (he
bd00: 61 64 65 72 20 20 20 28 76 65 63 74 6f 72 2d 72  ader   (vector-r
bd10: 65 66 20 72 75 6e 64 61 74 20 30 29 29 0a 09 20  ef rundat 0)).. 
bd20: 28 72 75 6e 73 20 20 20 20 20 28 76 65 63 74 6f  (runs     (vecto
bd30: 72 2d 72 65 66 20 72 75 6e 64 61 74 20 31 29 29  r-ref rundat 1))
bd40: 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20  ).    (for-each 
bd50: 28 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a 09 09  (lambda (run)...
bd60: 28 6c 65 74 20 28 28 72 75 6e 2d 69 64 20 28 64  (let ((run-id (d
bd70: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68  b:get-value-by-h
bd80: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72  eader run header
bd90: 20 22 69 64 22 29 29 29 0a 09 09 20 20 28 69 66   "id")))...  (if
bda0: 20 28 6f 72 20 6c 6f 63 6b 0a 09 09 09 20 20 28   (or lock....  (
bdb0: 61 6e 64 20 75 6e 6c 6f 63 6b 0a 09 09 09 20 20  and unlock....  
bdc0: 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09 09       (begin.....
bdd0: 20 28 70 72 69 6e 74 20 22 44 6f 20 79 6f 75 20   (print "Do you 
bde0: 72 65 61 6c 6c 79 20 77 69 73 68 20 74 6f 20 75  really wish to u
bdf0: 6e 6c 6f 63 6b 20 72 75 6e 20 22 20 72 75 6e 2d  nlock run " run-
be00: 69 64 20 22 3f 5c 6e 20 20 20 79 2f 6e 3a 20 22  id "?\n   y/n: "
be10: 29 0a 09 09 09 09 20 28 65 71 75 61 6c 3f 20 22  )..... (equal? "
be20: 79 22 20 28 72 65 61 64 2d 6c 69 6e 65 29 29 29  y" (read-line)))
be30: 29 29 0a 09 09 20 20 20 20 20 20 28 6f 70 65 6e  ))...      (open
be40: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 6c 6f  -run-close db:lo
be50: 63 6b 2f 75 6e 6c 6f 63 6b 2d 72 75 6e 20 64 62  ck/unlock-run db
be60: 20 72 75 6e 2d 69 64 20 6c 6f 63 6b 20 75 6e 6c   run-id lock unl
be70: 6f 63 6b 20 75 73 65 72 29 0a 09 09 20 20 20 20  ock user)...    
be80: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69    (debug:print-i
be90: 6e 66 6f 20 30 20 22 53 6b 69 70 70 69 6e 67 20  nfo 0 "Skipping 
bea0: 6c 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 6f 6e 20 22  lock/unlock on "
beb0: 20 72 75 6e 2d 69 64 29 29 29 29 0a 09 20 20 20   run-id))))..   
bec0: 20 20 20 72 75 6e 73 29 29 29 0a 3b 3b 3d 3d 3d     runs))).;;===
bed0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
bee0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
bef0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
bf00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
bf10: 3d 3d 3d 0a 3b 3b 20 52 6f 6c 6c 75 70 20 72 75  ===.;; Rollup ru
bf20: 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ns.;;===========
bf30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
bf40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
bf50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
bf60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20  ===========..;; 
bf70: 55 70 64 61 74 65 20 74 68 65 20 74 65 73 74 5f  Update the test_
bf80: 6d 65 74 61 20 74 61 62 6c 65 20 66 6f 72 20 74  meta table for t
bf90: 68 69 73 20 74 65 73 74 0a 28 64 65 66 69 6e 65  his test.(define
bfa0: 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65   (runs:update-te
bfb0: 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74 2d  st_meta db test-
bfc0: 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 0a  name test-conf).
bfd0: 20 20 28 6c 65 74 20 28 28 63 75 72 72 72 65 63    (let ((currrec
bfe0: 6f 72 64 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d  ord (cdb:remote-
bff0: 72 75 6e 20 64 62 3a 74 65 73 74 6d 65 74 61 2d  run db:testmeta-
c000: 67 65 74 2d 72 65 63 6f 72 64 20 64 62 20 74 65  get-record db te
c010: 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 28  st-name))).    (
c020: 69 66 20 28 6e 6f 74 20 63 75 72 72 72 65 63 6f  if (not currreco
c030: 72 64 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 28  rd)..(begin..  (
c040: 73 65 74 21 20 63 75 72 72 72 65 63 6f 72 64 20  set! currrecord 
c050: 28 6d 61 6b 65 2d 76 65 63 74 6f 72 20 31 30 20  (make-vector 10 
c060: 23 66 29 29 0a 09 20 20 28 63 64 62 3a 72 65 6d  #f))..  (cdb:rem
c070: 6f 74 65 2d 72 75 6e 20 64 62 3a 74 65 73 74 6d  ote-run db:testm
c080: 65 74 61 2d 61 64 64 2d 72 65 63 6f 72 64 20 64  eta-add-record d
c090: 62 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20  b test-name))). 
c0a0: 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20     (for-each .  
c0b0: 20 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 29     (lambda (key)
c0c0: 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28  .       (let* ((
c0d0: 69 64 78 20 28 63 61 64 72 20 6b 65 79 29 29 0a  idx (cadr key)).
c0e0: 09 20 20 20 20 20 20 28 66 6c 64 20 28 63 61 72  .      (fld (car
c0f0: 20 20 6b 65 79 29 29 0a 09 20 20 20 20 20 20 28    key))..      (
c100: 76 61 6c 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b  val (config-look
c110: 75 70 20 74 65 73 74 2d 63 6f 6e 66 20 22 74 65  up test-conf "te
c120: 73 74 5f 6d 65 74 61 22 20 66 6c 64 29 29 29 0a  st_meta" fld))).
c130: 09 20 3b 3b 20 28 64 65 62 75 67 3a 70 72 69 6e  . ;; (debug:prin
c140: 74 20 35 20 22 69 64 78 3a 20 22 20 69 64 78 20  t 5 "idx: " idx 
c150: 22 20 66 6c 64 3a 20 22 20 66 6c 64 20 22 20 76  " fld: " fld " v
c160: 61 6c 3a 20 22 20 76 61 6c 29 0a 09 20 28 69 66  al: " val).. (if
c170: 20 28 61 6e 64 20 76 61 6c 20 28 6e 6f 74 20 28   (and val (not (
c180: 65 71 75 61 6c 3f 20 28 76 65 63 74 6f 72 2d 72  equal? (vector-r
c190: 65 66 20 63 75 72 72 72 65 63 6f 72 64 20 69 64  ef currrecord id
c1a0: 78 29 20 76 61 6c 29 29 29 0a 09 20 20 20 20 20  x) val)))..     
c1b0: 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 20 28  (begin..       (
c1c0: 70 72 69 6e 74 20 22 55 70 64 61 74 69 6e 67 20  print "Updating 
c1d0: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 22 20  " test-name " " 
c1e0: 66 6c 64 20 22 20 74 6f 20 22 20 76 61 6c 29 0a  fld " to " val).
c1f0: 09 20 20 20 20 20 20 20 28 63 64 62 3a 72 65 6d  .       (cdb:rem
c200: 6f 74 65 2d 72 75 6e 20 64 62 3a 74 65 73 74 6d  ote-run db:testm
c210: 65 74 61 2d 75 70 64 61 74 65 2d 66 69 65 6c 64  eta-update-field
c220: 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 66 6c   db test-name fl
c230: 64 20 76 61 6c 29 29 29 29 29 0a 20 20 20 20 20  d val))))).     
c240: 27 28 28 22 61 75 74 68 6f 72 22 20 32 29 28 22  '(("author" 2)("
c250: 6f 77 6e 65 72 22 20 33 29 28 22 64 65 73 63 72  owner" 3)("descr
c260: 69 70 74 69 6f 6e 22 20 34 29 28 22 72 65 76 69  iption" 4)("revi
c270: 65 77 65 64 22 20 35 29 28 22 74 61 67 73 22 20  ewed" 5)("tags" 
c280: 39 29 29 29 29 29 0a 0a 3b 3b 20 55 70 64 61 74  9)))))..;; Updat
c290: 65 20 74 65 73 74 5f 6d 65 74 61 20 66 6f 72 20  e test_meta for 
c2a0: 61 6c 6c 20 74 65 73 74 73 0a 28 64 65 66 69 6e  all tests.(defin
c2b0: 65 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 61  e (runs:update-a
c2c0: 6c 6c 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 29  ll-test_meta db)
c2d0: 0a 20 20 28 6c 65 74 20 28 28 74 65 73 74 2d 6e  .  (let ((test-n
c2e0: 61 6d 65 73 20 28 67 65 74 2d 61 6c 6c 2d 6c 65  ames (get-all-le
c2f0: 67 61 6c 2d 74 65 73 74 73 29 29 29 0a 20 20 20  gal-tests))).   
c300: 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20   (for-each .    
c310: 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 2d 6e   (lambda (test-n
c320: 61 6d 65 29 0a 20 20 20 20 20 20 20 28 6c 65 74  ame).       (let
c330: 2a 20 28 28 74 65 73 74 2d 70 61 74 68 20 20 20  * ((test-path   
c340: 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a   (conc *toppath*
c350: 20 22 2f 74 65 73 74 73 2f 22 20 74 65 73 74 2d   "/tests/" test-
c360: 6e 61 6d 65 29 29 0a 09 20 20 20 20 20 20 28 74  name))..      (t
c370: 65 73 74 2d 63 6f 6e 66 69 67 66 20 28 63 6f 6e  est-configf (con
c380: 63 20 74 65 73 74 2d 70 61 74 68 20 22 2f 74 65  c test-path "/te
c390: 73 74 63 6f 6e 66 69 67 22 29 29 0a 09 20 20 20  stconfig"))..   
c3a0: 20 20 20 28 74 65 73 74 65 78 69 73 74 73 20 20     (testexists  
c3b0: 20 28 61 6e 64 20 28 66 69 6c 65 2d 65 78 69 73   (and (file-exis
c3c0: 74 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66  ts? test-configf
c3d0: 29 28 66 69 6c 65 2d 72 65 61 64 2d 61 63 63 65  )(file-read-acce
c3e0: 73 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66  ss? test-configf
c3f0: 29 29 29 0a 09 20 20 20 20 20 20 3b 3b 20 72 65  )))..      ;; re
c400: 61 64 20 63 6f 6e 66 69 67 73 20 77 69 74 68 20  ad configs with 
c410: 74 72 69 63 6b 73 20 74 75 72 6e 65 64 20 6f 66  tricks turned of
c420: 66 20 28 69 2e 65 2e 20 6e 6f 20 73 79 73 74 65  f (i.e. no syste
c430: 6d 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d  m)..      (test-
c440: 63 6f 6e 66 20 20 20 20 28 69 66 20 74 65 73 74  conf    (if test
c450: 65 78 69 73 74 73 20 28 72 65 61 64 2d 63 6f 6e  exists (read-con
c460: 66 69 67 20 74 65 73 74 2d 63 6f 6e 66 69 67 66  fig test-configf
c470: 20 23 66 20 23 66 29 28 6d 61 6b 65 2d 68 61 73   #f #f)(make-has
c480: 68 2d 74 61 62 6c 65 29 29 29 29 0a 09 20 3b 3b  h-table)))).. ;;
c490: 20 75 73 65 20 74 68 65 20 6f 70 65 6e 2d 72 75   use the open-ru
c4a0: 6e 2d 63 6c 6f 73 65 20 69 6e 73 74 65 61 64 20  n-close instead 
c4b0: 6f 66 20 70 61 73 73 69 6e 67 20 69 6e 20 64 62  of passing in db
c4c0: 0a 09 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d  .. (runs:update-
c4d0: 74 65 73 74 5f 6d 65 74 61 20 23 66 20 74 65 73  test_meta #f tes
c4e0: 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66  t-name test-conf
c4f0: 29 29 29 0a 20 20 20 20 20 74 65 73 74 2d 6e 61  ))).     test-na
c500: 6d 65 73 29 29 29 0a 0a 3b 3b 20 54 68 69 73 20  mes)))..;; This 
c510: 63 6f 75 6c 64 20 70 72 6f 62 61 62 6c 79 20 62  could probably b
c520: 65 20 72 65 66 61 63 74 6f 72 65 64 20 69 6e 74  e refactored int
c530: 6f 20 6f 6e 65 20 63 6f 6d 70 6c 65 78 20 71 75  o one complex qu
c540: 65 72 79 20 2e 2e 2e 0a 28 64 65 66 69 6e 65 20  ery ....(define 
c550: 28 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e  (runs:rollup-run
c560: 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20   keys keyvallst 
c570: 72 75 6e 6e 61 6d 65 20 75 73 65 72 29 20 3b 3b  runname user) ;;
c580: 20 77 61 73 20 74 61 72 67 65 74 2c 20 6e 6f 77   was target, now
c590: 20 6b 65 79 76 61 6c 6c 73 74 0a 20 20 28 64 65   keyvallst.  (de
c5a0: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 72 75 6e  bug:print 4 "run
c5b0: 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 2c 20 6b 65  s:rollup-run, ke
c5c0: 79 73 3a 20 22 20 6b 65 79 73 20 22 20 6b 65 79  ys: " keys " key
c5d0: 76 61 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c  vallst: " keyval
c5e0: 6c 73 74 20 22 20 3a 72 75 6e 6e 61 6d 65 20 22  lst " :runname "
c5f0: 20 72 75 6e 6e 61 6d 65 20 22 20 75 73 65 72 3a   runname " user:
c600: 20 22 20 75 73 65 72 29 0a 20 20 28 6c 65 74 2a   " user).  (let*
c610: 20 28 28 64 62 20 20 20 20 20 20 20 20 20 20 20   ((db           
c620: 20 20 20 23 66 29 20 3b 3b 20 28 6b 65 79 76 61     #f) ;; (keyva
c630: 6c 6c 6c 73 74 20 20 20 20 20 20 28 6b 65 79 73  lllst      (keys
c640: 3a 74 61 72 67 65 74 2d 3e 6b 65 79 76 61 6c 20  :target->keyval 
c650: 6b 65 79 73 20 74 61 72 67 65 74 29 29 0a 09 20  keys target)).. 
c660: 28 6e 65 77 2d 72 75 6e 2d 69 64 20 20 20 20 20  (new-run-id     
c670: 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e   (cdb:remote-run
c680: 20 64 62 3a 72 65 67 69 73 74 65 72 2d 72 75 6e   db:register-run
c690: 20 23 66 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c   #f keys keyvall
c6a0: 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e 65 77 22  st runname "new"
c6b0: 20 22 6e 2f 61 22 20 75 73 65 72 29 29 0a 09 20   "n/a" user)).. 
c6c0: 28 70 72 65 76 2d 74 65 73 74 73 20 20 20 20 20  (prev-tests     
c6d0: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
c6e0: 20 74 65 73 74 3a 67 65 74 2d 6d 61 74 63 68 69   test:get-matchi
c6f0: 6e 67 2d 70 72 65 76 69 6f 75 73 2d 74 65 73 74  ng-previous-test
c700: 2d 72 75 6e 2d 72 65 63 6f 72 64 73 20 64 62 20  -run-records db 
c710: 6e 65 77 2d 72 75 6e 2d 69 64 20 22 25 22 20 22  new-run-id "%" "
c720: 25 22 29 29 0a 09 20 28 63 75 72 72 2d 74 65 73  %")).. (curr-tes
c730: 74 73 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75  ts      (open-ru
c740: 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74  n-close db:get-t
c750: 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20  ests-for-run db 
c760: 6e 65 77 2d 72 75 6e 2d 69 64 20 22 25 2f 25 22  new-run-id "%/%"
c770: 20 27 28 29 20 27 28 29 29 29 0a 09 20 28 63 75   '() '())).. (cu
c780: 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 28 6d  rr-tests-hash (m
c790: 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29  ake-hash-table))
c7a0: 29 0a 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d  ).    (open-run-
c7b0: 63 6c 6f 73 65 20 64 62 3a 75 70 64 61 74 65 2d  close db:update-
c7c0: 72 75 6e 2d 65 76 65 6e 74 5f 74 69 6d 65 20 64  run-event_time d
c7d0: 62 20 6e 65 77 2d 72 75 6e 2d 69 64 29 0a 20 20  b new-run-id).  
c7e0: 20 20 3b 3b 20 69 6e 64 65 78 20 74 68 65 20 61    ;; index the a
c7f0: 6c 72 65 61 64 79 20 73 61 76 65 64 20 74 65 73  lready saved tes
c800: 74 73 20 62 79 20 74 65 73 74 6e 61 6d 65 20 61  ts by testname a
c810: 6e 64 20 69 74 65 6d 64 61 74 20 69 6e 20 63 75  nd itemdat in cu
c820: 72 72 2d 74 65 73 74 73 2d 68 61 73 68 0a 20 20  rr-tests-hash.  
c830: 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 20    (for-each.    
c840: 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 64 61   (lambda (testda
c850: 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20  t).       (let* 
c860: 28 28 74 65 73 74 6e 61 6d 65 20 20 28 64 62 3a  ((testname  (db:
c870: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d  test-get-testnam
c880: 65 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20  e testdat))..   
c890: 20 20 20 28 69 74 65 6d 2d 70 61 74 68 20 28 64     (item-path (d
c8a0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d  b:test-get-item-
c8b0: 70 61 74 68 20 74 65 73 74 64 61 74 29 29 0a 09  path testdat))..
c8c0: 20 20 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65        (full-name
c8d0: 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20   (conc testname 
c8e0: 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 29  "/" item-path)))
c8f0: 0a 09 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73  .. (hash-table-s
c900: 65 74 21 20 63 75 72 72 2d 74 65 73 74 73 2d 68  et! curr-tests-h
c910: 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 74 65  ash full-name te
c920: 73 74 64 61 74 29 29 29 0a 20 20 20 20 20 63 75  stdat))).     cu
c930: 72 72 2d 74 65 73 74 73 29 0a 20 20 20 20 3b 3b  rr-tests).    ;;
c940: 20 4e 4f 50 45 3a 20 4e 6f 6e 2d 6f 70 74 69 6d   NOPE: Non-optim
c950: 61 6c 20 61 70 70 72 6f 61 63 68 2e 20 54 72 79  al approach. Try
c960: 20 74 68 69 73 20 69 6e 73 74 65 61 64 2e 0a 20   this instead.. 
c970: 20 20 20 3b 3b 20 20 20 31 2e 20 74 65 73 74 73     ;;   1. tests
c980: 20 61 72 65 20 72 65 63 65 69 76 65 64 20 69 6e   are received in
c990: 20 61 20 6c 69 73 74 2c 20 6d 6f 73 74 20 72 65   a list, most re
c9a0: 63 65 6e 74 20 66 69 72 73 74 0a 20 20 20 20 3b  cent first.    ;
c9b0: 3b 20 20 20 32 2e 20 72 65 70 6c 61 63 65 20 74  ;   2. replace t
c9c0: 68 65 20 72 6f 6c 6c 75 70 20 74 65 73 74 20 77  he rollup test w
c9d0: 69 74 68 20 74 68 65 20 6e 65 77 20 2a 61 6c 77  ith the new *alw
c9e0: 61 79 73 2a 0a 20 20 20 20 28 66 6f 72 2d 65 61  ays*.    (for-ea
c9f0: 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61  ch .     (lambda
ca00: 20 28 74 65 73 74 64 61 74 29 0a 20 20 20 20 20   (testdat).     
ca10: 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 6e 61    (let* ((testna
ca20: 6d 65 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74  me  (db:test-get
ca30: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 64 61  -testname testda
ca40: 74 29 29 0a 09 20 20 20 20 20 20 28 69 74 65 6d  t))..      (item
ca50: 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67  -path (db:test-g
ca60: 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73  et-item-path tes
ca70: 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 66  tdat))..      (f
ca80: 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74  ull-name (conc t
ca90: 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d  estname "/" item
caa0: 2d 70 61 74 68 29 29 0a 09 20 20 20 20 20 20 28  -path))..      (
cab0: 70 72 65 76 2d 74 65 73 74 2d 64 61 74 20 28 68  prev-test-dat (h
cac0: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65  ash-table-ref/de
cad0: 66 61 75 6c 74 20 63 75 72 72 2d 74 65 73 74 73  fault curr-tests
cae0: 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20  -hash full-name 
caf0: 23 66 29 29 0a 09 20 20 20 20 20 20 28 74 65 73  #f))..      (tes
cb00: 74 2d 73 74 65 70 73 20 20 20 20 20 20 28 6f 70  t-steps      (op
cb10: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a  en-run-close db:
cb20: 67 65 74 2d 73 74 65 70 73 2d 66 6f 72 2d 74 65  get-steps-for-te
cb30: 73 74 20 64 62 20 28 64 62 3a 74 65 73 74 2d 67  st db (db:test-g
cb40: 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 29 29  et-id testdat)))
cb50: 0a 09 20 20 20 20 20 20 28 6e 65 77 2d 74 65 73  ..      (new-tes
cb60: 74 2d 72 65 63 6f 72 64 20 23 66 29 29 0a 09 20  t-record #f)).. 
cb70: 3b 3b 20 72 65 70 6c 61 63 65 20 74 68 65 73 65  ;; replace these
cb80: 20 77 69 74 68 20 69 6e 73 65 72 74 20 2e 2e 2e   with insert ...
cb90: 20 73 65 6c 65 63 74 0a 09 20 28 61 70 70 6c 79   select.. (apply
cba0: 20 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65   sqlite3:execute
cbb0: 20 0a 09 09 64 62 20 0a 09 09 28 63 6f 6e 63 20   ...db ...(conc 
cbc0: 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41  "INSERT OR REPLA
cbd0: 43 45 20 49 4e 54 4f 20 74 65 73 74 73 20 28 72  CE INTO tests (r
cbe0: 75 6e 5f 69 64 2c 74 65 73 74 6e 61 6d 65 2c 73  un_id,testname,s
cbf0: 74 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e  tate,status,even
cc00: 74 5f 74 69 6d 65 2c 68 6f 73 74 2c 63 70 75 6c  t_time,host,cpul
cc10: 6f 61 64 2c 64 69 73 6b 66 72 65 65 2c 75 6e 61  oad,diskfree,una
cc20: 6d 65 2c 72 75 6e 64 69 72 2c 69 74 65 6d 5f 70  me,rundir,item_p
cc30: 61 74 68 2c 72 75 6e 5f 64 75 72 61 74 69 6f 6e  ath,run_duration
cc40: 2c 66 69 6e 61 6c 5f 6c 6f 67 66 2c 63 6f 6d 6d  ,final_logf,comm
cc50: 65 6e 74 29 20 22 0a 09 09 20 20 20 20 20 20 22  ent) "...      "
cc60: 56 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c  VALUES (?,?,?,?,
cc70: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c  ?,?,?,?,?,?,?,?,
cc80: 3f 2c 3f 29 3b 22 29 0a 09 09 6e 65 77 2d 72 75  ?,?);")...new-ru
cc90: 6e 2d 69 64 20 28 63 64 64 72 20 28 76 65 63 74  n-id (cddr (vect
cca0: 6f 72 2d 3e 6c 69 73 74 20 74 65 73 74 64 61 74  or->list testdat
ccb0: 29 29 29 0a 09 20 28 73 65 74 21 20 6e 65 77 2d  ))).. (set! new-
ccc0: 74 65 73 74 64 61 74 20 28 63 61 72 20 28 6f 70  testdat (car (op
ccd0: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a  en-run-close db:
cce0: 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75  get-tests-for-ru
ccf0: 6e 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20  n db new-run-id 
cd00: 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22  (conc testname "
cd10: 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 20 27 28  /" item-path) '(
cd20: 29 20 27 28 29 29 29 29 0a 09 20 28 68 61 73 68  ) '()))).. (hash
cd30: 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72 72  -table-set! curr
cd40: 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c  -tests-hash full
cd50: 2d 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74 64 61  -name new-testda
cd60: 74 29 20 3b 3b 20 74 68 69 73 20 63 6f 75 6c 64  t) ;; this could
cd70: 20 62 65 20 63 6f 6e 66 75 73 69 6e 67 2c 20 77   be confusing, w
cd80: 68 69 63 68 20 72 65 63 6f 72 64 20 73 68 6f 75  hich record shou
cd90: 6c 64 20 67 6f 20 69 6e 74 6f 20 74 68 65 20 6c  ld go into the l
cda0: 6f 6f 6b 75 70 20 74 61 62 6c 65 3f 0a 09 20 3b  ookup table?.. ;
cdb0: 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20  ; Now duplicate 
cdc0: 74 68 65 20 74 65 73 74 20 73 74 65 70 73 0a 09  the test steps..
cdd0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20   (debug:print 4 
cde0: 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 73  "Copying records
cdf0: 20 69 6e 20 74 65 73 74 5f 73 74 65 70 73 20 66   in test_steps f
ce00: 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64  rom test_id=" (d
ce10: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65  b:test-get-id te
ce20: 73 74 64 61 74 29 20 22 20 74 6f 20 22 20 28 64  stdat) " to " (d
ce30: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65  b:test-get-id ne
ce40: 77 2d 74 65 73 74 64 61 74 29 29 0a 09 20 28 6f  w-testdat)).. (o
ce50: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 0a 09  pen-run-close ..
ce60: 20 20 28 6c 61 6d 62 64 61 20 28 29 0a 09 20 20    (lambda ()..  
ce70: 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75    (sqlite3:execu
ce80: 74 65 20 0a 09 20 20 20 20 20 64 62 20 0a 09 20  te ..     db .. 
ce90: 20 20 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 52      (conc "INSER
cea0: 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54  T OR REPLACE INT
ceb0: 4f 20 74 65 73 74 5f 73 74 65 70 73 20 28 74 65  O test_steps (te
cec0: 73 74 5f 69 64 2c 73 74 65 70 6e 61 6d 65 2c 73  st_id,stepname,s
ced0: 74 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e  tate,status,even
cee0: 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 29 20  t_time,comment) 
cef0: 22 0a 09 09 20 20 20 22 53 45 4c 45 43 54 20 22  "...   "SELECT "
cf00: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64   (db:test-get-id
cf10: 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20 22 2c   new-testdat) ",
cf20: 73 74 65 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73  stepname,state,s
cf30: 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65  tatus,event_time
cf40: 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65  ,comment FROM te
cf50: 73 74 5f 73 74 65 70 73 20 57 48 45 52 45 20 74  st_steps WHERE t
cf60: 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 20  est_id=?;")..   
cf70: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69    (db:test-get-i
cf80: 64 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20  d testdat))..   
cf90: 20 3b 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61 74   ;; Now duplicat
cfa0: 65 20 74 68 65 20 74 65 73 74 20 64 61 74 61 0a  e the test data.
cfb0: 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  .    (debug:prin
cfc0: 74 20 34 20 22 43 6f 70 79 69 6e 67 20 72 65 63  t 4 "Copying rec
cfd0: 6f 72 64 73 20 69 6e 20 74 65 73 74 5f 64 61 74  ords in test_dat
cfe0: 61 20 66 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22  a from test_id="
cff0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64   (db:test-get-id
d000: 20 74 65 73 74 64 61 74 29 20 22 20 74 6f 20 22   testdat) " to "
d010: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64   (db:test-get-id
d020: 20 6e 65 77 2d 74 65 73 74 64 61 74 29 29 0a 09   new-testdat))..
d030: 20 20 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65      (sqlite3:exe
d040: 63 75 74 65 20 0a 09 20 20 20 20 20 64 62 20 0a  cute ..     db .
d050: 09 20 20 20 20 20 28 63 6f 6e 63 20 22 49 4e 53  .     (conc "INS
d060: 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49  ERT OR REPLACE I
d070: 4e 54 4f 20 74 65 73 74 5f 64 61 74 61 20 28 74  NTO test_data (t
d080: 65 73 74 5f 69 64 2c 63 61 74 65 67 6f 72 79 2c  est_id,category,
d090: 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65  variable,value,e
d0a0: 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74  xpected,tol,unit
d0b0: 73 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20  s,comment) "... 
d0c0: 20 20 22 53 45 4c 45 43 54 20 22 20 28 64 62 3a    "SELECT " (db:
d0d0: 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d  test-get-id new-
d0e0: 74 65 73 74 64 61 74 29 20 22 2c 63 61 74 65 67  testdat) ",categ
d0f0: 6f 72 79 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c  ory,variable,val
d100: 75 65 2c 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c  ue,expected,tol,
d110: 75 6e 69 74 73 2c 63 6f 6d 6d 65 6e 74 20 46 52  units,comment FR
d120: 4f 4d 20 74 65 73 74 5f 64 61 74 61 20 57 48 45  OM test_data WHE
d130: 52 45 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a  RE test_id=?;").
d140: 09 20 20 20 20 20 28 64 62 3a 74 65 73 74 2d 67  .     (db:test-g
d150: 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 29 29  et-id testdat)))
d160: 29 0a 09 20 29 29 0a 20 20 20 20 20 70 72 65 76  ).. )).     prev
d170: 2d 74 65 73 74 73 29 29 29 0a 09 20 0a 20 20 20  -tests))).. .   
d180: 20 20 0a                                           .