Megatest

Hex Artifact Content
Login

Artifact ad0152f8143e9b4f29f9e6ebef8128c5d273c142:


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 29 0a 20  hed tal reg n). 
35d0: 20 28 69 66 20 28 3e 20 28 6c 65 6e 67 74 68 20   (if (> (length 
35e0: 72 65 67 29 20 6e 29 0a 20 20 20 20 20 20 28 63  reg) n).      (c
35f0: 61 72 20 72 65 67 29 0a 20 20 20 20 20 20 28 69  ar reg).      (i
3600: 66 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 0a 09 20  f (null? tal).. 
3610: 20 28 63 61 72 20 72 65 67 29 0a 09 20 20 28 63   (car reg)..  (c
3620: 61 72 20 74 61 6c 29 29 29 29 0a 0a 28 64 65 66  ar tal))))..(def
3630: 69 6e 65 20 28 72 75 6e 73 3a 71 75 65 75 65 2d  ine (runs:queue-
3640: 6e 65 78 74 2d 74 61 6c 20 74 61 6c 20 72 65 67  next-tal tal reg
3650: 20 6e 29 0a 20 20 28 69 66 20 28 3e 20 28 6c 65   n).  (if (> (le
3660: 6e 67 74 68 20 72 65 67 29 20 6e 29 0a 20 20 20  ngth reg) n).   
3670: 20 20 20 3b 3b 20 72 6f 74 61 74 65 0a 20 20 20     ;; rotate.   
3680: 20 20 20 28 6c 65 74 20 28 28 6e 65 78 74 74 61     (let ((nextta
3690: 6c 20 28 69 66 20 28 6e 75 6c 6c 3f 20 74 61 6c  l (if (null? tal
36a0: 29 0a 09 09 09 20 72 65 67 0a 09 09 09 20 28 63  ).... reg.... (c
36b0: 64 72 20 74 61 6c 29 29 29 29 0a 09 28 69 66 20  dr tal))))..(if 
36c0: 28 6e 75 6c 6c 3f 20 6e 65 78 74 74 61 6c 29 0a  (null? nexttal).
36d0: 09 20 20 20 20 72 65 67 0a 09 20 20 20 20 6e 65  .    reg..    ne
36e0: 78 74 74 61 6c 29 29 0a 20 20 20 20 20 20 28 69  xttal)).      (i
36f0: 66 20 28 6e 75 6c 6c 3f 20 72 65 67 29 0a 09 20  f (null? reg).. 
3700: 20 27 28 29 0a 09 20 20 28 63 64 72 20 72 65 67   '()..  (cdr reg
3710: 29 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72  ))))..(define (r
3720: 75 6e 73 3a 71 75 65 75 65 2d 6e 65 78 74 2d 72  uns:queue-next-r
3730: 65 67 20 74 61 6c 20 72 65 67 20 6e 29 0a 20 20  eg tal reg n).  
3740: 28 69 66 20 28 3e 20 28 6c 65 6e 67 74 68 20 72  (if (> (length r
3750: 65 67 29 20 6e 29 0a 20 20 20 20 20 20 28 63 64  eg) n).      (cd
3760: 72 20 72 65 67 29 0a 20 20 20 20 20 20 72 65 67  r reg).      reg
3770: 29 29 0a 20 20 20 20 20 20 0a 0a 3b 3b 20 74 65  )).      ..;; te
3780: 73 74 2d 72 65 63 6f 72 64 73 20 69 73 20 61 20  st-records is a 
3790: 68 61 73 68 20 74 61 62 6c 65 20 74 65 73 74 6e  hash table testn
37a0: 61 6d 65 3a 69 74 65 6d 5f 70 61 74 68 20 3d 3e  ame:item_path =>
37b0: 20 76 65 63 74 6f 72 20 3c 20 74 65 73 74 6e 61   vector < testna
37c0: 6d 65 20 74 65 73 74 63 6f 6e 66 69 67 20 77 61  me testconfig wa
37d0: 69 74 6f 6e 73 20 70 72 69 6f 72 69 74 79 20 69  itons priority i
37e0: 74 65 6d 73 2d 69 6e 66 6f 20 2e 2e 2e 20 3e 0a  tems-info ... >.
37f0: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 75  (define (runs:ru
3800: 6e 2d 74 65 73 74 73 2d 71 75 65 75 65 20 72 75  n-tests-queue ru
3810: 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73  n-id runname tes
3820: 74 2d 72 65 63 6f 72 64 73 20 6b 65 79 76 61 6c  t-records keyval
3830: 6c 73 74 20 66 6c 61 67 73 20 74 65 73 74 2d 70  lst flags test-p
3840: 61 74 74 73 29 0a 20 20 20 20 3b 3b 20 41 74 20  atts).    ;; At 
3850: 74 68 69 73 20 70 6f 69 6e 74 20 74 68 65 20 6c  this point the l
3860: 69 73 74 20 6f 66 20 70 61 72 65 6e 74 20 74 65  ist of parent te
3870: 73 74 73 20 69 73 20 65 78 70 61 6e 64 65 64 20  sts is expanded 
3880: 0a 20 20 20 20 3b 3b 20 4e 42 2f 2f 20 53 68 6f  .    ;; NB// Sho
3890: 75 6c 64 20 65 78 70 61 6e 64 20 69 74 65 6d 73  uld expand items
38a0: 20 68 65 72 65 20 61 6e 64 20 74 68 65 6e 20 69   here and then i
38b0: 6e 73 65 72 74 20 69 6e 74 6f 20 74 68 65 20 72  nsert into the r
38c0: 75 6e 20 71 75 65 75 65 2e 0a 20 20 28 64 65 62  un queue..  (deb
38d0: 75 67 3a 70 72 69 6e 74 20 35 20 22 74 65 73 74  ug:print 5 "test
38e0: 2d 72 65 63 6f 72 64 73 3a 20 22 20 74 65 73 74  -records: " test
38f0: 2d 72 65 63 6f 72 64 73 20 22 2c 20 6b 65 79 76  -records ", keyv
3900: 61 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c  allst: " keyvall
3910: 73 74 20 22 20 66 6c 61 67 73 3a 20 22 20 28 68  st " flags: " (h
3920: 61 73 68 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74  ash-table->alist
3930: 20 66 6c 61 67 73 29 29 0a 20 20 28 6c 65 74 20   flags)).  (let 
3940: 28 28 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61  ((sorted-test-na
3950: 6d 65 73 20 28 74 65 73 74 73 3a 73 6f 72 74 2d  mes (tests:sort-
3960: 62 79 2d 70 72 69 6f 72 69 74 79 2d 61 6e 64 2d  by-priority-and-
3970: 77 61 69 74 6f 6e 20 74 65 73 74 2d 72 65 63 6f  waiton test-reco
3980: 72 64 73 29 29 0a 09 28 74 65 73 74 2d 72 65 67  rds))..(test-reg
3990: 69 73 74 72 79 20 20 20 20 28 6d 61 6b 65 2d 68  istry    (make-h
39a0: 61 73 68 2d 74 61 62 6c 65 29 29 0a 09 28 72 65  ash-table))..(re
39b0: 67 69 73 74 72 79 2d 6d 75 74 65 78 20 20 20 28  gistry-mutex   (
39c0: 6d 61 6b 65 2d 6d 75 74 65 78 29 29 0a 09 28 6e  make-mutex))..(n
39d0: 75 6d 2d 72 65 74 72 69 65 73 20 20 20 20 20 20  um-retries      
39e0: 20 20 30 29 0a 09 28 6d 61 78 2d 72 65 74 72 69    0)..(max-retri
39f0: 65 73 20 20 20 20 20 20 20 28 63 6f 6e 66 69 67  es       (config
3a00: 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64  -lookup *configd
3a10: 61 74 2a 20 22 73 65 74 75 70 22 20 22 6d 61 78  at* "setup" "max
3a20: 72 65 74 72 69 65 73 22 29 29 0a 09 28 6d 61 78  retries"))..(max
3a30: 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73  -concurrent-jobs
3a40: 20 20 20 20 20 28 6c 65 74 20 28 28 6d 63 6a 20       (let ((mcj 
3a50: 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a  (config-lookup *
3a60: 63 6f 6e 66 69 67 64 61 74 2a 20 22 73 65 74 75  configdat* "setu
3a70: 70 22 20 20 20 20 20 22 6d 61 78 5f 63 6f 6e 63  p"     "max_conc
3a80: 75 72 72 65 6e 74 5f 6a 6f 62 73 22 29 29 29 0a  urrent_jobs"))).
3a90: 09 09 09 09 20 20 20 20 28 69 66 20 28 61 6e 64  ....    (if (and
3aa0: 20 6d 63 6a 20 28 73 74 72 69 6e 67 2d 3e 6e 75   mcj (string->nu
3ab0: 6d 62 65 72 20 6d 63 6a 29 29 0a 09 09 09 09 09  mber mcj))......
3ac0: 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 20  (string->number 
3ad0: 6d 63 6a 29 0a 09 09 09 09 09 31 29 29 29 0a 09  mcj)......1)))..
3ae0: 28 72 65 67 6c 65 6e 20 20 20 20 20 20 20 20 20  (reglen         
3af0: 20 20 20 20 31 30 29 29 20 3b 3b 20 6c 65 6e 67      10)) ;; leng
3b00: 74 68 20 6f 66 20 74 68 65 20 72 65 67 69 73 74  th of the regist
3b10: 65 72 20 71 75 65 75 65 20 61 68 65 61 64 0a 20  er queue ahead. 
3b20: 20 20 20 28 73 65 74 21 20 6d 61 78 2d 72 65 74     (set! max-ret
3b30: 72 69 65 73 20 28 69 66 20 28 61 6e 64 20 6d 61  ries (if (and ma
3b40: 78 2d 72 65 74 72 69 65 73 20 28 73 74 72 69 6e  x-retries (strin
3b50: 67 2d 3e 6e 75 6d 62 65 72 20 6d 61 78 2d 72 65  g->number max-re
3b60: 74 72 69 65 73 29 29 28 73 74 72 69 6e 67 2d 3e  tries))(string->
3b70: 6e 75 6d 62 65 72 20 6d 61 78 2d 72 65 74 72 69  number max-retri
3b80: 65 73 29 20 31 30 30 29 29 0a 20 20 20 20 28 69  es) 100)).    (i
3b90: 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 73 6f  f (not (null? so
3ba0: 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29  rted-test-names)
3bb0: 29 0a 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68  )..(let loop ((h
3bc0: 65 64 20 20 20 20 20 20 20 20 20 28 63 61 72 20  ed         (car 
3bd0: 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65  sorted-test-name
3be0: 73 29 29 0a 09 09 20 20 20 28 74 61 6c 20 20 20  s))...   (tal   
3bf0: 20 20 20 20 20 20 28 63 64 72 20 73 6f 72 74 65        (cdr sorte
3c00: 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09  d-test-names))..
3c10: 09 20 20 20 28 72 65 67 20 20 20 20 20 20 20 20  .   (reg        
3c20: 20 27 28 29 29 20 3b 3b 20 72 65 67 69 73 74 65   '()) ;; registe
3c30: 72 65 64 2c 20 70 75 74 20 74 68 65 73 65 20 61  red, put these a
3c40: 74 20 74 68 65 20 68 65 61 64 20 6f 66 20 74 61  t the head of ta
3c50: 6c 20 0a 09 09 20 20 20 28 72 65 72 75 6e 73 20  l ...   (reruns 
3c60: 20 20 20 20 20 27 28 29 29 29 0a 09 20 20 28 69       '()))..  (i
3c70: 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65  f (not (null? re
3c80: 72 75 6e 73 29 29 28 64 65 62 75 67 3a 70 72 69  runs))(debug:pri
3c90: 6e 74 2d 69 6e 66 6f 20 34 20 22 72 65 72 75 6e  nt-info 4 "rerun
3ca0: 73 3d 22 20 72 65 72 75 6e 73 29 29 0a 09 20 20  s=" reruns))..  
3cb0: 3b 3b 20 28 70 72 69 6e 74 20 22 54 6f 70 20 6f  ;; (print "Top o
3cc0: 66 20 6c 6f 6f 70 2c 20 68 65 64 3d 22 20 68 65  f loop, hed=" he
3cd0: 64 20 22 2c 20 74 61 6c 3d 22 20 74 61 6c 20 22  d ", tal=" tal "
3ce0: 20 2c 72 65 72 75 6e 73 3d 22 20 72 65 72 75 6e   ,reruns=" rerun
3cf0: 73 29 0a 09 20 20 28 6c 65 74 2a 20 28 28 74 65  s)..  (let* ((te
3d00: 73 74 2d 72 65 63 6f 72 64 20 28 68 61 73 68 2d  st-record (hash-
3d10: 74 61 62 6c 65 2d 72 65 66 20 74 65 73 74 2d 72  table-ref test-r
3d20: 65 63 6f 72 64 73 20 68 65 64 29 29 0a 09 09 20  ecords hed))... 
3d30: 28 74 65 73 74 2d 6e 61 6d 65 20 20 20 28 74 65  (test-name   (te
3d40: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65  sts:testqueue-ge
3d50: 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d  t-testname test-
3d60: 72 65 63 6f 72 64 29 29 0a 09 09 20 28 74 63 6f  record))... (tco
3d70: 6e 66 69 67 20 20 20 20 20 28 74 65 73 74 73 3a  nfig     (tests:
3d80: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65  testqueue-get-te
3d90: 73 74 63 6f 6e 66 69 67 20 74 65 73 74 2d 72 65  stconfig test-re
3da0: 63 6f 72 64 29 29 0a 09 09 20 28 74 65 73 74 6d  cord))... (testm
3db0: 6f 64 65 20 20 20 20 28 6c 65 74 20 28 28 6d 20  ode    (let ((m 
3dc0: 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74  (config-lookup t
3dd0: 63 6f 6e 66 69 67 20 22 72 65 71 75 69 72 65 6d  config "requirem
3de0: 65 6e 74 73 22 20 22 6d 6f 64 65 22 29 29 29 0a  ents" "mode"))).
3df0: 09 09 09 09 28 69 66 20 6d 20 28 73 74 72 69 6e  ....(if m (strin
3e00: 67 2d 3e 73 79 6d 62 6f 6c 20 6d 29 20 27 6e 6f  g->symbol m) 'no
3e10: 72 6d 61 6c 29 29 29 0a 09 09 20 28 77 61 69 74  rmal)))... (wait
3e20: 6f 6e 73 20 20 20 20 20 28 74 65 73 74 73 3a 74  ons     (tests:t
3e30: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 77 61 69  estqueue-get-wai
3e40: 74 6f 6e 73 20 20 20 20 74 65 73 74 2d 72 65 63  tons    test-rec
3e50: 6f 72 64 29 29 0a 09 09 20 28 70 72 69 6f 72 69  ord))... (priori
3e60: 74 79 20 20 20 20 28 74 65 73 74 73 3a 74 65 73  ty    (tests:tes
3e70: 74 71 75 65 75 65 2d 67 65 74 2d 70 72 69 6f 72  tqueue-get-prior
3e80: 69 74 79 20 20 20 74 65 73 74 2d 72 65 63 6f 72  ity   test-recor
3e90: 64 29 29 0a 09 09 20 28 69 74 65 6d 64 61 74 20  d))... (itemdat 
3ea0: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71      (tests:testq
3eb0: 75 65 75 65 2d 67 65 74 2d 69 74 65 6d 64 61 74  ueue-get-itemdat
3ec0: 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29      test-record)
3ed0: 29 20 3b 3b 20 69 74 65 6d 64 61 74 20 63 61 6e  ) ;; itemdat can
3ee0: 20 62 65 20 61 20 73 74 72 69 6e 67 2c 20 6c 69   be a string, li
3ef0: 73 74 20 6f 72 20 23 66 0a 09 09 20 28 69 74 65  st or #f... (ite
3f00: 6d 73 20 20 20 20 20 20 20 28 74 65 73 74 73 3a  ms       (tests:
3f10: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74  testqueue-get-it
3f20: 65 6d 73 20 20 20 20 20 20 74 65 73 74 2d 72 65  ems      test-re
3f30: 63 6f 72 64 29 29 0a 09 09 20 28 69 74 65 6d 2d  cord))... (item-
3f40: 70 61 74 68 20 20 20 28 69 74 65 6d 2d 6c 69 73  path   (item-lis
3f50: 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74 29  t->path itemdat)
3f60: 29 0a 09 09 20 28 6e 65 77 74 61 6c 20 20 20 20  )... (newtal    
3f70: 20 20 28 61 70 70 65 6e 64 20 74 61 6c 20 28 6c    (append tal (l
3f80: 69 73 74 20 68 65 64 29 29 29 29 0a 09 20 20 20  ist hed))))..   
3f90: 20 3b 3b 20 28 69 66 20 28 3e 20 28 6c 65 6e 67   ;; (if (> (leng
3fa0: 74 68 20 72 65 67 29 20 31 30 29 0a 09 20 20 20  th reg) 10)..   
3fb0: 20 3b 3b 20 20 20 20 20 28 62 65 67 69 6e 0a 09   ;;     (begin..
3fc0: 20 20 20 20 3b 3b 20 20 20 20 20 20 20 28 73 65      ;;       (se
3fd0: 74 21 20 74 61 6c 20 28 63 6f 6e 73 20 68 65 64  t! tal (cons hed
3fe0: 20 74 61 6c 29 29 0a 09 20 20 20 20 3b 3b 20 20   tal))..    ;;  
3ff0: 20 20 20 20 20 28 73 65 74 21 20 68 65 64 20 28       (set! hed (
4000: 63 61 72 20 72 65 67 29 29 0a 09 20 20 20 20 3b  car reg))..    ;
4010: 3b 20 20 20 20 20 20 20 28 73 65 74 21 20 72 65  ;       (set! re
4020: 67 20 28 63 64 72 20 72 65 67 29 29 0a 09 20 20  g (cdr reg))..  
4030: 20 20 3b 3b 20 20 20 20 20 20 20 28 73 65 74 21    ;;       (set!
4040: 20 6e 65 77 74 61 6c 20 74 61 6c 29 29 29 0a 09   newtal tal)))..
4050: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
4060: 20 36 0a 09 09 09 20 22 74 65 73 74 2d 6e 61 6d   6.... "test-nam
4070: 65 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 0a 09  e: " test-name..
4080: 09 09 20 22 5c 6e 20 20 68 65 64 3a 20 20 20 20  .. "\n  hed:    
4090: 20 20 20 20 20 22 20 68 65 64 0a 09 09 09 20 22       " hed.... "
40a0: 5c 6e 20 20 69 74 65 6d 64 61 74 3a 20 20 20 20  \n  itemdat:    
40b0: 20 22 20 69 74 65 6d 64 61 74 0a 09 09 09 20 22   " itemdat.... "
40c0: 5c 6e 20 20 69 74 65 6d 73 3a 20 20 20 20 20 20  \n  items:      
40d0: 20 22 20 69 74 65 6d 73 0a 09 09 09 20 22 5c 6e   " items.... "\n
40e0: 20 20 69 74 65 6d 2d 70 61 74 68 3a 20 20 20 22    item-path:   "
40f0: 20 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 20 22   item-path.... "
4100: 5c 6e 20 20 77 61 69 74 6f 6e 73 3a 20 20 20 20  \n  waitons:    
4110: 20 22 20 77 61 69 74 6f 6e 73 0a 09 09 09 20 22   " waitons.... "
4120: 5c 6e 20 20 6e 75 6d 2d 72 65 74 72 69 65 73 3a  \n  num-retries:
4130: 20 22 20 6e 75 6d 2d 72 65 74 72 69 65 73 0a 09   " num-retries..
4140: 09 09 20 22 5c 6e 20 20 74 61 6c 3a 20 20 20 20  .. "\n  tal:    
4150: 20 20 20 20 20 22 20 74 61 6c 0a 09 09 09 20 22       " tal.... "
4160: 5c 6e 20 20 72 65 72 75 6e 73 3a 20 20 20 20 20  \n  reruns:     
4170: 20 22 20 72 65 72 75 6e 73 29 0a 0a 09 20 20 20   " reruns)...   
4180: 20 3b 3b 20 63 68 65 63 6b 20 66 6f 72 20 68 65   ;; check for he
4190: 64 20 69 6e 20 77 61 69 74 6f 6e 73 20 3d 3e 20  d in waitons => 
41a0: 74 68 69 73 20 77 6f 75 6c 64 20 62 65 20 63 69  this would be ci
41b0: 72 63 75 6c 61 72 2c 20 72 65 6d 6f 76 65 20 69  rcular, remove i
41c0: 74 20 61 6e 64 20 69 73 73 75 65 20 61 6e 0a 09  t and issue an..
41d0: 20 20 20 20 3b 3b 20 65 72 72 6f 72 0a 09 20 20      ;; error..  
41e0: 20 20 28 69 66 20 28 6d 65 6d 62 65 72 20 74 65    (if (member te
41f0: 73 74 2d 6e 61 6d 65 20 77 61 69 74 6f 6e 73 29  st-name waitons)
4200: 0a 09 09 28 62 65 67 69 6e 0a 09 09 20 20 28 64  ...(begin...  (d
4210: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
4220: 52 4f 52 3a 20 74 65 73 74 20 22 20 74 65 73 74  ROR: test " test
4230: 2d 6e 61 6d 65 20 22 20 68 61 73 20 6c 69 73 74  -name " has list
4240: 65 64 20 69 74 73 65 6c 66 20 61 73 20 61 20 77  ed itself as a w
4250: 61 69 74 6f 6e 2c 20 70 6c 65 61 73 65 20 63 6f  aiton, please co
4260: 72 72 65 63 74 20 74 68 69 73 21 22 29 0a 09 09  rrect this!")...
4270: 20 20 28 73 65 74 21 20 77 61 69 74 6f 6e 20 28    (set! waiton (
4280: 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28  filter (lambda (
4290: 78 29 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 78  x)(not (equal? x
42a0: 20 68 65 64 29 29 29 20 77 61 69 74 6f 6e 73 29   hed))) waitons)
42b0: 29 29 29 0a 0a 09 20 20 20 20 28 63 6f 6e 64 20  )))...    (cond 
42c0: 3b 3b 20 4f 55 54 45 52 20 43 4f 4e 44 0a 09 20  ;; OUTER COND.. 
42d0: 20 20 20 20 28 28 6e 6f 74 20 69 74 65 6d 73 29      ((not items)
42e0: 20 3b 3b 20 77 68 65 6e 20 66 61 6c 73 65 20 74   ;; when false t
42f0: 68 65 20 74 65 73 74 20 69 73 20 6f 6b 20 74 6f  he test is ok to
4300: 20 62 65 20 68 61 6e 64 65 64 20 6f 66 66 20 74   be handed off t
4310: 6f 20 6c 61 75 6e 63 68 20 28 62 75 74 20 6e 6f  o launch (but no
4320: 74 20 62 65 66 6f 72 65 29 0a 09 20 20 20 20 20  t before)..     
4330: 20 28 6c 65 74 2a 20 28 28 72 75 6e 2d 6c 69 6d   (let* ((run-lim
4340: 69 74 73 2d 69 6e 66 6f 20 20 20 20 20 20 20 20  its-info        
4350: 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d   (runs:can-run-m
4360: 6f 72 65 2d 74 65 73 74 73 20 74 65 73 74 2d 72  ore-tests test-r
4370: 65 63 6f 72 64 20 6d 61 78 2d 63 6f 6e 63 75 72  ecord max-concur
4380: 72 65 6e 74 2d 6a 6f 62 73 29 29 20 3b 3b 20 6c  rent-jobs)) ;; l
4390: 6f 6f 6b 20 61 74 20 74 68 65 20 74 65 73 74 20  ook at the test 
43a0: 6a 6f 62 67 72 6f 75 70 20 61 6e 64 20 74 6f 74  jobgroup and tot
43b0: 20 6a 6f 62 73 20 72 75 6e 6e 69 6e 67 0a 09 09   jobs running...
43c0: 20 20 20 20 20 28 68 61 76 65 2d 72 65 73 6f 75       (have-resou
43d0: 72 63 65 73 20 20 20 20 20 20 20 20 20 20 28 63  rces          (c
43e0: 61 72 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e  ar run-limits-in
43f0: 66 6f 29 29 0a 09 09 20 20 20 20 20 28 6e 75 6d  fo))...     (num
4400: 2d 72 75 6e 6e 69 6e 67 20 20 20 20 20 20 20 20  -running        
4410: 20 20 20 20 20 28 6c 69 73 74 2d 72 65 66 20 72       (list-ref r
4420: 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 31  un-limits-info 1
4430: 29 29 0a 09 09 20 20 20 20 20 28 6e 75 6d 2d 72  ))...     (num-r
4440: 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f  unning-in-jobgro
4450: 75 70 20 28 6c 69 73 74 2d 72 65 66 20 72 75 6e  up (list-ref run
4460: 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 32 29 29  -limits-info 2))
4470: 0a 09 09 20 20 20 20 20 28 6d 61 78 2d 63 6f 6e  ...     (max-con
4480: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 20 20 20  current-jobs    
4490: 20 28 6c 69 73 74 2d 72 65 66 20 72 75 6e 2d 6c   (list-ref run-l
44a0: 69 6d 69 74 73 2d 69 6e 66 6f 20 33 29 29 0a 09  imits-info 3))..
44b0: 09 20 20 20 20 20 28 6a 6f 62 2d 67 72 6f 75 70  .     (job-group
44c0: 2d 6c 69 6d 69 74 20 20 20 20 20 20 20 20 20 28  -limit         (
44d0: 6c 69 73 74 2d 72 65 66 20 72 75 6e 2d 6c 69 6d  list-ref run-lim
44e0: 69 74 73 2d 69 6e 66 6f 20 34 29 29 0a 09 09 20  its-info 4))... 
44f0: 20 20 20 20 28 70 72 65 72 65 71 73 2d 6e 6f 74      (prereqs-not
4500: 2d 6d 65 74 20 20 20 20 20 20 20 20 20 28 64 62  -met         (db
4510: 3a 67 65 74 2d 70 72 65 72 65 71 73 2d 6e 6f 74  :get-prereqs-not
4520: 2d 6d 65 74 20 72 75 6e 2d 69 64 20 77 61 69 74  -met run-id wait
4530: 6f 6e 73 20 69 74 65 6d 2d 70 61 74 68 20 6d 6f  ons item-path mo
4540: 64 65 3a 20 74 65 73 74 6d 6f 64 65 29 29 0a 09  de: testmode))..
4550: 09 20 20 20 20 20 28 66 61 69 6c 73 20 20 20 20  .     (fails    
4560: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28                 (
4570: 72 75 6e 73 3a 63 61 6c 63 2d 66 61 69 6c 73 20  runs:calc-fails 
4580: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29  prereqs-not-met)
4590: 29 0a 09 09 20 20 20 20 20 28 6e 6f 6e 2d 63 6f  )...     (non-co
45a0: 6d 70 6c 65 74 65 64 20 20 20 20 20 20 20 20 20  mpleted         
45b0: 20 20 28 72 75 6e 73 3a 63 61 6c 63 2d 6e 6f 74    (runs:calc-not
45c0: 2d 63 6f 6d 70 6c 65 74 65 64 20 70 72 65 72 65  -completed prere
45d0: 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a 09 09  qs-not-met)))...
45e0: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
45f0: 6f 20 38 20 22 68 61 76 65 2d 72 65 73 6f 75 72  o 8 "have-resour
4600: 63 65 73 3a 20 22 20 68 61 76 65 2d 72 65 73 6f  ces: " have-reso
4610: 75 72 63 65 73 20 22 20 70 72 65 72 65 71 73 2d  urces " prereqs-
4620: 6e 6f 74 2d 6d 65 74 3a 20 22 20 0a 09 09 09 20  not-met: " .... 
4630: 20 20 20 20 28 73 74 72 69 6e 67 2d 69 6e 74 65      (string-inte
4640: 72 73 70 65 72 73 65 20 0a 09 09 09 20 20 20 20  rsperse ....    
4650: 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28    (map (lambda (
4660: 74 29 0a 09 09 09 09 20 20 20 20 20 28 69 66 20  t).....     (if 
4670: 28 76 65 63 74 6f 72 3f 20 74 29 0a 09 09 09 09  (vector? t).....
4680: 09 20 28 63 6f 6e 63 20 28 64 62 3a 74 65 73 74  . (conc (db:test
4690: 2d 67 65 74 2d 73 74 61 74 65 20 74 29 20 22 2f  -get-state t) "/
46a0: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73  " (db:test-get-s
46b0: 74 61 74 75 73 20 74 29 29 0a 09 09 09 09 09 20  tatus t))...... 
46c0: 28 63 6f 6e 63 20 22 20 57 41 52 4e 49 4e 47 3a  (conc " WARNING:
46d0: 20 74 20 69 73 20 6e 6f 74 20 61 20 76 65 63 74   t is not a vect
46e0: 6f 72 3d 22 20 74 20 29 29 29 0a 09 09 09 09 20  or=" t )))..... 
46f0: 20 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65    prereqs-not-me
4700: 74 29 20 22 2c 20 22 29 20 22 20 66 61 69 6c 73  t) ", ") " fails
4710: 3a 20 22 20 66 61 69 6c 73 29 0a 09 09 28 64 65  : " fails)...(de
4720: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34  bug:print-info 4
4730: 20 22 68 65 64 3d 22 20 68 65 64 20 22 5c 6e 20   "hed=" hed "\n 
4740: 20 74 65 73 74 2d 72 65 63 6f 72 64 3d 22 20 74   test-record=" t
4750: 65 73 74 2d 72 65 63 6f 72 64 20 22 5c 6e 20 20  est-record "\n  
4760: 74 65 73 74 2d 6e 61 6d 65 3a 20 22 20 74 65 73  test-name: " tes
4770: 74 2d 6e 61 6d 65 20 22 5c 6e 20 20 69 74 65 6d  t-name "\n  item
4780: 2d 70 61 74 68 3a 20 22 20 69 74 65 6d 2d 70 61  -path: " item-pa
4790: 74 68 20 22 5c 6e 20 20 74 65 73 74 2d 70 61 74  th "\n  test-pat
47a0: 74 73 3a 20 22 20 74 65 73 74 2d 70 61 74 74 73  ts: " test-patts
47b0: 29 0a 0a 09 09 3b 3b 20 44 6f 6e 27 74 20 6b 6e  )....;; Don't kn
47c0: 6f 77 20 61 74 20 74 68 69 73 20 74 69 6d 65 20  ow at this time 
47d0: 69 66 20 74 68 65 20 74 65 73 74 20 68 61 76 65  if the test have
47e0: 20 62 65 65 6e 20 6c 61 75 6e 63 68 65 64 20 61   been launched a
47f0: 74 20 73 6f 6d 65 20 74 69 6d 65 20 69 6e 20 74  t some time in t
4800: 68 65 20 70 61 73 74 0a 09 09 3b 3b 20 69 2e 65  he past...;; i.e
4810: 2e 20 69 73 20 74 68 69 73 20 61 20 72 65 2d 6c  . is this a re-l
4820: 61 75 6e 63 68 3f 0a 09 09 28 64 65 62 75 67 3a  aunch?...(debug:
4830: 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 72 75  print-info 4 "ru
4840: 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 3d 20  n-limits-info = 
4850: 22 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66  " run-limits-inf
4860: 6f 29 0a 09 09 28 63 6f 6e 64 20 3b 3b 20 49 4e  o)...(cond ;; IN
4870: 4e 45 52 20 43 4f 4e 44 20 23 31 20 66 6f 72 20  NER COND #1 for 
4880: 61 20 6c 61 75 6e 63 68 61 62 6c 65 20 74 65 73  a launchable tes
4890: 74 0a 09 09 20 3b 3b 20 43 68 65 63 6b 20 69 74  t... ;; Check it
48a0: 65 6d 20 70 61 74 68 20 61 67 61 69 6e 73 74 20  em path against 
48b0: 69 74 65 6d 2d 70 61 74 74 73 0a 09 09 20 28 28  item-patts... ((
48c0: 6e 6f 74 20 28 74 65 73 74 73 3a 6d 61 74 63 68  not (tests:match
48d0: 20 74 65 73 74 2d 70 61 74 74 73 20 28 74 65 73   test-patts (tes
48e0: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
48f0: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72  -testname test-r
4900: 65 63 6f 72 64 29 20 69 74 65 6d 2d 70 61 74 68  ecord) item-path
4910: 29 29 20 3b 3b 20 54 68 69 73 20 74 65 73 74 2f  )) ;; This test/
4920: 69 74 65 6d 70 61 74 68 20 69 73 20 6e 6f 74 20  itempath is not 
4930: 74 6f 20 62 65 20 72 75 6e 0a 09 09 20 20 3b 3b  to be run...  ;;
4940: 20 65 6c 73 65 20 74 68 65 20 72 75 6e 20 69 73   else the run is
4950: 20 73 74 75 63 6b 2c 20 74 65 6d 70 6f 72 61 72   stuck, temporar
4960: 69 6c 79 20 6f 72 20 70 65 72 6d 61 6e 65 6e 74  ily or permanent
4970: 6c 79 0a 09 09 20 20 3b 3b 20 62 75 74 20 73 68  ly...  ;; but sh
4980: 6f 75 6c 64 20 63 68 65 63 6b 20 69 66 20 69 74  ould check if it
4990: 20 69 73 20 64 75 65 20 74 6f 20 6c 61 63 6b 20   is due to lack 
49a0: 6f 66 20 72 65 73 6f 75 72 63 65 73 20 76 73 2e  of resources vs.
49b0: 20 70 72 65 72 65 71 75 69 73 69 74 65 73 0a 09   prerequisites..
49c0: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d  .  (debug:print-
49d0: 69 6e 66 6f 20 31 20 22 53 6b 69 70 70 69 6e 67  info 1 "Skipping
49e0: 20 22 20 28 74 65 73 74 73 3a 74 65 73 74 71 75   " (tests:testqu
49f0: 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65  eue-get-testname
4a00: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 20 22 20   test-record) " 
4a10: 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20 61 73  " item-path " as
4a20: 20 69 74 20 64 6f 65 73 6e 27 74 20 6d 61 74 63   it doesn't matc
4a30: 68 20 22 20 74 65 73 74 2d 70 61 74 74 73 29 0a  h " test-patts).
4a40: 09 09 20 20 3b 3b 20 28 74 68 72 65 61 64 2d 73  ..  ;; (thread-s
4a50: 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65  leep! *global-de
4a60: 6c 74 61 2a 29 0a 09 09 20 20 28 69 66 20 28 6e  lta*)...  (if (n
4a70: 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a  ot (null? tal)).
4a80: 09 09 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 72  ..      (loop (r
4a90: 75 6e 73 3a 71 75 65 75 65 2d 6e 65 78 74 2d 68  uns:queue-next-h
4aa0: 65 64 20 74 61 6c 20 72 65 67 20 72 65 67 6c 65  ed tal reg regle
4ab0: 6e 29 0a 09 09 09 20 20 20 20 28 72 75 6e 73 3a  n)....    (runs:
4ac0: 71 75 65 75 65 2d 6e 65 78 74 2d 74 61 6c 20 74  queue-next-tal t
4ad0: 61 6c 20 72 65 67 20 72 65 67 6c 65 6e 29 0a 09  al reg reglen)..
4ae0: 09 09 20 20 20 20 28 72 75 6e 73 3a 71 75 65 75  ..    (runs:queu
4af0: 65 2d 6e 65 78 74 2d 72 65 67 20 74 61 6c 20 72  e-next-reg tal r
4b00: 65 67 20 72 65 67 6c 65 6e 29 0a 09 09 09 20 20  eg reglen)....  
4b10: 20 20 72 65 72 75 6e 73 29 29 29 0a 09 09 20 3b    reruns)))... ;
4b20: 3b 20 52 65 67 69 73 74 72 79 20 68 61 73 20 62  ; Registry has b
4b30: 65 65 6e 20 73 74 61 72 74 65 64 20 66 6f 72 20  een started for 
4b40: 74 68 69 73 20 74 65 73 74 20 62 75 74 20 68 61  this test but ha
4b50: 73 20 6e 6f 74 20 79 65 74 20 63 6f 6d 70 6c 65  s not yet comple
4b60: 74 65 64 0a 09 09 20 3b 3b 20 74 68 69 73 20 73  ted... ;; this s
4b70: 68 6f 75 6c 64 20 62 65 20 72 61 72 65 2c 20 74  hould be rare, t
4b80: 68 65 20 63 61 73 65 20 77 68 65 72 65 20 74 68  he case where th
4b90: 65 72 65 20 61 72 65 20 6f 6e 6c 79 20 61 20 63  ere are only a c
4ba0: 6f 75 70 6c 65 20 6f 66 20 74 65 73 74 73 20 61  ouple of tests a
4bb0: 6e 64 20 74 68 65 20 64 62 20 69 73 20 73 6c 6f  nd the db is slo
4bc0: 77 0a 09 09 20 3b 3b 20 64 65 6c 61 79 20 61 20  w... ;; delay a 
4bd0: 73 68 6f 72 74 20 77 68 69 6c 65 20 61 6e 64 20  short while and 
4be0: 63 6f 6e 74 69 6e 75 65 0a 09 09 20 3b 3b 20 28  continue... ;; (
4bf0: 28 65 71 3f 20 28 68 61 73 68 2d 74 61 62 6c 65  (eq? (hash-table
4c00: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 74 65 73  -ref/default tes
4c10: 74 2d 72 65 67 69 73 74 72 79 20 28 72 75 6e 73  t-registry (runs
4c20: 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d  :make-full-test-
4c30: 6e 61 6d 65 20 74 65 73 74 2d 6e 61 6d 65 20 69  name test-name i
4c40: 74 65 6d 2d 70 61 74 68 29 20 23 66 29 20 27 73  tem-path) #f) 's
4c50: 74 61 72 74 29 0a 09 09 20 3b 3b 20 20 28 74 68  tart)... ;;  (th
4c60: 72 65 61 64 2d 73 6c 65 65 70 21 20 30 2e 30 31  read-sleep! 0.01
4c70: 29 0a 09 09 20 3b 3b 20 20 28 6c 6f 6f 70 20 28  )... ;;  (loop (
4c80: 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20  car newtal)(cdr 
4c90: 6e 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29 29  newtal) reruns))
4ca0: 0a 09 09 20 3b 3b 20 63 6f 75 6e 74 20 6e 75 6d  ... ;; count num
4cb0: 62 65 72 20 6f 66 20 27 64 6f 6e 65 2c 20 69 66  ber of 'done, if
4cc0: 20 6d 6f 72 65 20 74 68 61 6e 20 31 30 30 20 74   more than 100 t
4cd0: 68 65 6e 20 73 6b 69 70 20 6f 6e 20 74 68 72 6f  hen skip on thro
4ce0: 75 67 68 2e 0a 09 09 20 28 28 6e 6f 74 20 28 68  ugh.... ((not (h
4cf0: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65  ash-table-ref/de
4d00: 66 61 75 6c 74 20 74 65 73 74 2d 72 65 67 69 73  fault test-regis
4d10: 74 72 79 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66  try (runs:make-f
4d20: 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65  ull-test-name te
4d30: 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74  st-name item-pat
4d40: 68 29 20 23 66 29 29 20 3b 3b 20 29 20 3b 3b 20  h) #f)) ;; ) ;; 
4d50: 74 6f 6f 20 6d 61 6e 79 20 63 68 61 6e 67 65 73  too many changes
4d60: 20 72 65 71 75 69 72 65 64 2e 20 49 6d 70 6c 65   required. Imple
4d70: 6d 65 6e 74 20 6c 61 74 65 72 2e 0a 09 09 20 20  ment later....  
4d80: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
4d90: 6f 20 34 20 22 50 72 65 2d 72 65 67 69 73 74 65  o 4 "Pre-registe
4da0: 72 69 6e 67 20 74 65 73 74 20 22 20 74 65 73 74  ring test " test
4db0: 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70  -name "/" item-p
4dc0: 61 74 68 20 22 20 74 6f 20 63 72 65 61 74 65 20  ath " to create 
4dd0: 70 6c 61 63 65 68 6f 6c 64 65 72 22 20 29 0a 09  placeholder" )..
4de0: 09 20 20 28 6c 65 74 20 28 28 74 68 20 28 6d 61  .  (let ((th (ma
4df0: 6b 65 2d 74 68 72 65 61 64 20 28 6c 61 6d 62 64  ke-thread (lambd
4e00: 61 20 28 29 0a 09 09 20 20 20 20 20 20 20 20 09  a ()...        .
4e10: 09 20 20 20 28 6d 75 74 65 78 2d 6c 6f 63 6b 21  .   (mutex-lock!
4e20: 20 72 65 67 69 73 74 72 79 2d 6d 75 74 65 78 29   registry-mutex)
4e30: 0a 09 09 20 20 20 20 20 20 20 20 09 09 20 20 20  ...        ..   
4e40: 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21  (hash-table-set!
4e50: 20 74 65 73 74 2d 72 65 67 69 73 74 72 79 20 28   test-registry (
4e60: 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74  runs:make-full-t
4e70: 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 6e 61  est-name test-na
4e80: 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 20 27 73  me item-path) 's
4e90: 74 61 72 74 29 0a 09 09 20 20 20 20 20 20 20 20  tart)...        
4ea0: 09 09 20 20 20 28 6d 75 74 65 78 2d 75 6e 6c 6f  ..   (mutex-unlo
4eb0: 63 6b 21 20 72 65 67 69 73 74 72 79 2d 6d 75 74  ck! registry-mut
4ec0: 65 78 29 0a 09 09 09 09 09 20 20 20 3b 3b 20 49  ex)......   ;; I
4ed0: 66 20 68 61 76 65 6e 27 74 20 64 6f 6e 65 20 69  f haven't done i
4ee0: 74 20 62 65 66 6f 72 65 20 72 65 67 69 73 74 65  t before registe
4ef0: 72 20 61 20 74 6f 70 20 6c 65 76 65 6c 20 74 65  r a top level te
4f00: 73 74 20 69 66 20 74 68 69 73 20 69 73 20 61 6e  st if this is an
4f10: 20 69 74 65 6d 69 7a 65 64 20 74 65 73 74 0a 09   itemized test..
4f20: 09 09 09 09 20 20 20 28 69 66 20 28 6e 6f 74 20  ....   (if (not 
4f30: 28 65 71 3f 20 28 68 61 73 68 2d 74 61 62 6c 65  (eq? (hash-table
4f40: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 74 65 73  -ref/default tes
4f50: 74 2d 72 65 67 69 73 74 72 79 20 28 72 75 6e 73  t-registry (runs
4f60: 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d  :make-full-test-
4f70: 6e 61 6d 65 20 74 65 73 74 2d 6e 61 6d 65 20 22  name test-name "
4f80: 22 29 20 23 66 29 20 27 64 6f 6e 65 29 29 0a 09  ") #f) 'done))..
4f90: 09 09 09 09 20 20 20 20 20 20 20 28 63 64 62 3a  ....       (cdb:
4fa0: 74 65 73 74 73 2d 72 65 67 69 73 74 65 72 2d 74  tests-register-t
4fb0: 65 73 74 20 2a 72 75 6e 72 65 6d 6f 74 65 2a 20  est *runremote* 
4fc0: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65  run-id test-name
4fd0: 20 22 22 29 29 0a 09 09 09 09 09 20 20 20 28 63   ""))......   (c
4fe0: 64 62 3a 74 65 73 74 73 2d 72 65 67 69 73 74 65  db:tests-registe
4ff0: 72 2d 74 65 73 74 20 2a 72 75 6e 72 65 6d 6f 74  r-test *runremot
5000: 65 2a 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e  e* run-id test-n
5010: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 09  ame item-path)..
5020: 09 20 20 20 20 20 20 20 20 09 09 20 20 20 28 6d  .        ..   (m
5030: 75 74 65 78 2d 6c 6f 63 6b 21 20 72 65 67 69 73  utex-lock! regis
5040: 74 72 79 2d 6d 75 74 65 78 29 0a 09 09 09 09 09  try-mutex)......
5050: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73     (hash-table-s
5060: 65 74 21 20 74 65 73 74 2d 72 65 67 69 73 74 72  et! test-registr
5070: 79 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c  y (runs:make-ful
5080: 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74  l-test-name test
5090: 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29  -name item-path)
50a0: 20 27 64 6f 6e 65 29 0a 09 09 20 20 20 20 20 20   'done)...      
50b0: 20 20 09 09 20 20 20 28 6d 75 74 65 78 2d 75 6e    ..   (mutex-un
50c0: 6c 6f 63 6b 21 20 72 65 67 69 73 74 72 79 2d 6d  lock! registry-m
50d0: 75 74 65 78 29 29 0a 09 09 20 20 20 20 20 20 20  utex))...       
50e0: 20 09 09 20 28 63 6f 6e 63 20 74 65 73 74 2d 6e   .. (conc test-n
50f0: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74  ame "/" item-pat
5100: 68 29 29 29 29 0a 09 09 20 20 20 20 28 74 68 72  h))))...    (thr
5110: 65 61 64 2d 73 74 61 72 74 21 20 74 68 29 29 0a  ead-start! th)).
5120: 09 09 20 20 28 72 75 6e 73 3a 73 68 72 69 6e 6b  ..  (runs:shrink
5130: 2d 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65  -can-run-more-te
5140: 73 74 73 2d 63 6f 75 6e 74 29 20 20 20 3b 3b 20  sts-count)   ;; 
5150: 44 45 4c 41 59 20 54 57 45 41 4b 45 52 20 28 73  DELAY TWEAKER (s
5160: 74 69 6c 6c 20 6e 65 65 64 65 64 3f 29 0a 09 09  till needed?)...
5170: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77    (loop (car new
5180: 74 61 6c 29 0a 09 09 09 28 72 75 6e 73 3a 71 75  tal)....(runs:qu
5190: 65 75 65 2d 6e 65 78 74 2d 74 61 6c 20 74 61 6c  eue-next-tal tal
51a0: 20 72 65 67 20 72 65 67 6c 65 6e 29 0a 09 09 09   reg reglen)....
51b0: 28 61 70 70 65 6e 64 20 72 65 67 20 28 6c 69 73  (append reg (lis
51c0: 74 20 68 65 64 29 29 0a 09 09 09 72 65 72 75 6e  t hed))....rerun
51d0: 73 29 29 0a 09 09 20 3b 3b 20 41 74 20 74 68 69  s))... ;; At thi
51e0: 73 20 70 6f 69 6e 74 20 68 65 64 20 74 65 73 74  s point hed test
51f0: 20 72 65 67 69 73 74 72 61 74 69 6f 6e 20 6d 75   registration mu
5200: 73 74 20 62 65 20 63 6f 6d 70 6c 65 74 65 64 2e  st be completed.
5210: 0a 09 09 20 28 28 65 71 3f 20 28 68 61 73 68 2d  ... ((eq? (hash-
5220: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c  table-ref/defaul
5230: 74 20 74 65 73 74 2d 72 65 67 69 73 74 72 79 20  t test-registry 
5240: 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d  (runs:make-full-
5250: 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 6e  test-name test-n
5260: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 20 23  ame item-path) #
5270: 66 29 0a 09 09 20 20 20 20 20 20 20 27 73 74 61  f)...       'sta
5280: 72 74 29 0a 09 09 20 20 28 64 65 62 75 67 3a 70  rt)...  (debug:p
5290: 72 69 6e 74 2d 69 6e 66 6f 20 30 20 22 57 61 69  rint-info 0 "Wai
52a0: 74 69 6e 67 20 6f 6e 20 74 65 73 74 20 72 65 67  ting on test reg
52b0: 69 73 74 72 61 74 69 6f 6e 28 73 29 3a 20 22 20  istration(s): " 
52c0: 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65  (string-interspe
52d0: 72 73 65 20 0a 09 09 09 09 09 09 09 09 09 20 20  rse ..........  
52e0: 20 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61   (filter (lambda
52f0: 20 28 78 29 0a 09 09 09 09 09 09 09 09 09 09 20   (x)........... 
5300: 20 20 20 20 28 65 71 3f 20 28 68 61 73 68 2d 74      (eq? (hash-t
5310: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74  able-ref/default
5320: 20 74 65 73 74 2d 72 65 67 69 73 74 72 79 20 78   test-registry x
5330: 20 23 66 29 20 27 73 74 61 72 74 29 29 0a 09 09   #f) 'start))...
5340: 09 09 09 09 09 09 09 09 20 20 20 28 68 61 73 68  ........   (hash
5350: 2d 74 61 62 6c 65 2d 6b 65 79 73 20 74 65 73 74  -table-keys test
5360: 2d 72 65 67 69 73 74 72 79 29 29 0a 09 09 09 09  -registry)).....
5370: 09 09 09 09 09 20 20 20 22 2c 20 22 29 29 0a 09  .....   ", "))..
5380: 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70  .  (thread-sleep
5390: 21 20 30 2e 31 29 0a 09 09 20 20 28 6c 6f 6f 70  ! 0.1)...  (loop
53a0: 20 68 65 64 20 74 61 6c 20 72 65 67 20 72 65 72   hed tal reg rer
53b0: 75 6e 73 29 29 0a 09 09 20 28 28 6e 6f 74 20 68  uns))... ((not h
53c0: 61 76 65 2d 72 65 73 6f 75 72 63 65 73 29 20 3b  ave-resources) ;
53d0: 3b 20 73 69 6d 70 6c 79 20 74 72 79 20 61 67 61  ; simply try aga
53e0: 69 6e 20 61 66 74 65 72 20 77 61 69 74 69 6e 67  in after waiting
53f0: 20 61 20 73 65 63 6f 6e 64 0a 09 09 20 20 28 64   a second...  (d
5400: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
5410: 31 20 22 6e 6f 20 72 65 73 6f 75 72 63 65 73 20  1 "no resources 
5420: 74 6f 20 72 75 6e 20 6e 65 77 20 74 65 73 74 73  to run new tests
5430: 2c 20 77 61 69 74 69 6e 67 20 2e 2e 2e 22 29 0a  , waiting ...").
5440: 09 09 20 20 3b 3b 20 48 61 76 65 20 67 6f 6e 65  ..  ;; Have gone
5450: 20 62 61 63 6b 20 61 6e 64 20 66 6f 72 74 68 20   back and forth 
5460: 6f 6e 20 74 68 69 73 20 62 75 74 20 64 62 20 73  on this but db s
5470: 74 61 72 76 61 74 69 6f 6e 20 69 73 20 61 6e 20  tarvation is an 
5480: 69 73 73 75 65 2e 0a 09 09 20 20 3b 3b 20 77 61  issue....  ;; wa
5490: 69 74 20 6f 6e 65 20 73 65 63 6f 6e 64 20 62 65  it one second be
54a0: 66 6f 72 65 20 6c 6f 6f 6b 69 6e 67 20 61 67 61  fore looking aga
54b0: 69 6e 20 74 6f 20 72 75 6e 20 6a 6f 62 73 2e 0a  in to run jobs..
54c0: 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65  ..  (thread-slee
54d0: 70 21 20 31 29 20 3b 3b 20 28 2b 20 32 20 2a 67  p! 1) ;; (+ 2 *g
54e0: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09  lobal-delta*))..
54f0: 09 20 20 3b 3b 20 63 6f 75 6c 64 20 68 61 76 65  .  ;; could have
5500: 20 64 6f 6e 65 20 68 65 64 20 74 61 6c 20 68 65   done hed tal he
5510: 72 65 20 62 75 74 20 64 6f 69 6e 67 20 63 61 72  re but doing car
5520: 2f 63 64 72 20 6f 66 20 6e 65 77 74 61 6c 20 74  /cdr of newtal t
5530: 6f 20 72 6f 74 61 74 65 20 74 65 73 74 73 0a 09  o rotate tests..
5540: 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65  .  (loop (car ne
5550: 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c  wtal)(cdr newtal
5560: 29 20 72 65 67 20 72 65 72 75 6e 73 29 29 0a 09  ) reg reruns))..
5570: 09 20 28 28 61 6e 64 20 68 61 76 65 2d 72 65 73  . ((and have-res
5580: 6f 75 72 63 65 73 0a 09 09 20 20 20 20 20 20 20  ources...       
5590: 28 6f 72 20 28 6e 75 6c 6c 3f 20 70 72 65 72 65  (or (null? prere
55a0: 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09 09 20  qs-not-met).... 
55b0: 20 20 28 61 6e 64 20 28 65 71 3f 20 74 65 73 74    (and (eq? test
55c0: 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c 29 0a  mode 'toplevel).
55d0: 09 09 09 09 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63  ....(null? non-c
55e0: 6f 6d 70 6c 65 74 65 64 29 29 29 29 0a 09 09 20  ompleted))))... 
55f0: 20 28 72 75 6e 3a 74 65 73 74 20 72 75 6e 2d 69   (run:test run-i
5600: 64 20 72 75 6e 6e 61 6d 65 20 6b 65 79 76 61 6c  d runname keyval
5610: 6c 73 74 20 74 65 73 74 2d 72 65 63 6f 72 64 20  lst test-record 
5620: 66 6c 61 67 73 20 23 66 29 0a 09 09 20 20 28 68  flags #f)...  (h
5630: 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 74  ash-table-set! t
5640: 65 73 74 2d 72 65 67 69 73 74 72 79 20 28 72 75  est-registry (ru
5650: 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 73  ns:make-full-tes
5660: 74 2d 6e 61 6d 65 20 74 65 73 74 2d 6e 61 6d 65  t-name test-name
5670: 20 69 74 65 6d 2d 70 61 74 68 29 20 27 72 75 6e   item-path) 'run
5680: 6e 69 6e 67 29 0a 09 09 20 20 28 72 75 6e 73 3a  ning)...  (runs:
5690: 73 68 72 69 6e 6b 2d 63 61 6e 2d 72 75 6e 2d 6d  shrink-can-run-m
56a0: 6f 72 65 2d 74 65 73 74 73 2d 63 6f 75 6e 74 29  ore-tests-count)
56b0: 20 20 3b 3b 20 44 45 4c 41 59 20 54 57 45 41 4b    ;; DELAY TWEAK
56c0: 45 52 20 28 73 74 69 6c 6c 20 6e 65 65 64 65 64  ER (still needed
56d0: 3f 29 0a 09 09 20 20 3b 3b 20 28 74 68 72 65 61  ?)...  ;; (threa
56e0: 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c  d-sleep! *global
56f0: 2d 64 65 6c 74 61 2a 29 0a 09 09 20 20 28 69 66  -delta*)...  (if
5700: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c   (not (null? tal
5710: 29 29 0a 09 09 20 20 20 20 20 20 28 6c 6f 6f 70  ))...      (loop
5720: 20 28 72 75 6e 73 3a 71 75 65 75 65 2d 6e 65 78   (runs:queue-nex
5730: 74 2d 68 65 64 20 74 61 6c 20 72 65 67 20 72 65  t-hed tal reg re
5740: 67 6c 65 6e 29 0a 09 09 09 20 20 20 20 28 72 75  glen)....    (ru
5750: 6e 73 3a 71 75 65 75 65 2d 6e 65 78 74 2d 74 61  ns:queue-next-ta
5760: 6c 20 74 61 6c 20 72 65 67 20 72 65 67 6c 65 6e  l tal reg reglen
5770: 29 0a 09 09 09 20 20 20 20 28 72 75 6e 73 3a 71  )....    (runs:q
5780: 75 65 75 65 2d 6e 65 78 74 2d 72 65 67 20 74 61  ueue-next-reg ta
5790: 6c 20 72 65 67 20 72 65 67 6c 65 6e 29 0a 09 09  l reg reglen)...
57a0: 09 20 20 20 20 72 65 72 75 6e 73 29 29 29 0a 09  .    reruns)))..
57b0: 09 20 28 65 6c 73 65 20 3b 3b 20 6d 75 73 74 20  . (else ;; must 
57c0: 62 65 20 77 65 20 68 61 76 65 20 75 6e 6d 65 74  be we have unmet
57d0: 20 70 72 65 72 65 71 75 69 73 69 74 65 73 0a 09   prerequisites..
57e0: 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  .    (debug:prin
57f0: 74 20 34 20 22 46 41 49 4c 53 3a 20 22 20 66 61  t 4 "FAILS: " fa
5800: 69 6c 73 29 0a 09 09 20 20 20 20 3b 3b 20 49 66  ils)...    ;; If
5810: 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 20 6f 66 20   one or more of 
5820: 74 68 65 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d  the prereqs-not-
5830: 6d 65 74 20 61 72 65 20 46 41 49 4c 20 74 68 65  met are FAIL the
5840: 6e 20 77 65 20 63 61 6e 20 69 73 73 75 65 0a 09  n we can issue..
5850: 09 20 20 20 20 3b 3b 20 61 20 6d 65 73 73 61 67  .    ;; a messag
5860: 65 20 61 6e 64 20 64 72 6f 70 20 68 65 64 20 66  e and drop hed f
5870: 72 6f 6d 20 74 68 65 20 69 74 65 6d 73 20 74 6f  rom the items to
5880: 20 62 65 20 70 72 6f 63 65 73 73 65 64 2e 0a 09   be processed...
5890: 09 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20  .    (if (null? 
58a0: 66 61 69 6c 73 29 0a 09 09 09 28 62 65 67 69 6e  fails)....(begin
58b0: 0a 09 09 09 20 20 3b 3b 20 63 6f 75 6c 64 6e 27  ....  ;; couldn'
58c0: 74 20 72 75 6e 2c 20 74 61 6b 65 20 61 20 62 72  t run, take a br
58d0: 65 61 74 68 65 72 0a 09 09 09 20 20 28 64 65 62  eather....  (deb
58e0: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20  ug:print-info 4 
58f0: 22 53 68 6f 75 6c 64 6e 27 74 20 72 65 61 6c 6c  "Shouldn't reall
5900: 79 20 67 65 74 20 68 65 72 65 2c 20 72 61 63 65  y get here, race
5910: 20 63 6f 6e 64 69 74 69 6f 6e 3f 20 55 6e 61 62   condition? Unab
5920: 6c 65 20 74 6f 20 6c 61 75 6e 63 68 20 6d 6f 72  le to launch mor
5930: 65 20 74 65 73 74 73 20 61 74 20 74 68 69 73 20  e tests at this 
5940: 6d 6f 6d 65 6e 74 2c 20 6b 69 6c 6c 69 6e 67 20  moment, killing 
5950: 74 69 6d 65 20 2e 2e 2e 22 29 0a 09 09 09 20 20  time ...")....  
5960: 3b 3b 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70  ;; (thread-sleep
5970: 21 20 28 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61  ! (+ 0.01 *globa
5980: 6c 2d 64 65 6c 74 61 2a 29 29 20 3b 3b 20 6c 6f  l-delta*)) ;; lo
5990: 6e 67 20 73 6c 65 65 70 20 68 65 72 65 20 2d 20  ng sleep here - 
59a0: 6e 6f 20 72 65 73 6f 75 72 63 65 73 2c 20 6d 61  no resources, ma
59b0: 79 20 61 73 20 77 65 6c 6c 20 62 65 20 70 61 74  y as well be pat
59c0: 69 65 6e 74 0a 09 09 09 20 20 3b 3b 20 77 65 20  ient....  ;; we 
59d0: 6d 61 64 65 20 6e 65 77 20 74 61 6c 20 62 79 20  made new tal by 
59e0: 73 74 69 63 6b 69 6e 67 20 68 65 64 20 61 74 20  sticking hed at 
59f0: 74 68 65 20 62 61 63 6b 20 6f 66 20 74 68 65 20  the back of the 
5a00: 6c 69 73 74 0a 09 09 09 20 20 28 6c 6f 6f 70 20  list....  (loop 
5a10: 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72  (car newtal)(cdr
5a20: 20 6e 65 77 74 61 6c 29 20 72 65 67 20 72 65 72   newtal) reg rer
5a30: 75 6e 73 29 29 0a 09 09 09 3b 3b 20 74 68 65 20  uns))....;; the 
5a40: 77 61 69 74 6f 6e 20 69 73 20 46 41 49 4c 20 73  waiton is FAIL s
5a50: 6f 20 6e 6f 20 70 6f 69 6e 74 20 69 6e 20 74 72  o no point in tr
5a60: 79 69 6e 67 20 74 6f 20 72 75 6e 20 68 65 64 20  ying to run hed 
5a70: 65 76 65 72 20 61 67 61 69 6e 0a 09 09 09 28 69  ever again....(i
5a80: 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61  f (not (null? ta
5a90: 6c 29 29 0a 09 09 09 20 20 20 20 28 69 66 20 28  l))....    (if (
5aa0: 76 65 63 74 6f 72 3f 20 68 65 64 29 0a 09 09 09  vector? hed)....
5ab0: 09 28 62 65 67 69 6e 20 0a 09 09 09 09 20 20 28  .(begin .....  (
5ac0: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 57  debug:print 1 "W
5ad0: 41 52 4e 3a 20 44 72 6f 70 70 69 6e 67 20 74 65  ARN: Dropping te
5ae0: 73 74 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65  st " (db:test-ge
5af0: 74 2d 74 65 73 74 6e 61 6d 65 20 68 65 64 29 20  t-testname hed) 
5b00: 22 2f 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74  "/" (db:test-get
5b10: 2d 69 74 65 6d 2d 70 61 74 68 20 68 65 64 29 0a  -item-path hed).
5b20: 09 09 09 09 09 20 20 20 20 20 20 20 22 20 66 72  .....       " fr
5b30: 6f 6d 20 74 68 65 20 6c 61 75 6e 63 68 20 6c 69  om the launch li
5b40: 73 74 20 61 73 20 69 74 20 68 61 73 20 70 72 65  st as it has pre
5b50: 72 65 71 75 69 73 74 65 73 20 74 68 61 74 20 61  requistes that a
5b60: 72 65 20 46 41 49 4c 22 29 0a 09 09 09 09 20 20  re FAIL").....  
5b70: 28 72 75 6e 73 3a 73 68 72 69 6e 6b 2d 63 61 6e  (runs:shrink-can
5b80: 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d  -run-more-tests-
5b90: 63 6f 75 6e 74 29 20 3b 3b 20 44 45 4c 41 59 20  count) ;; DELAY 
5ba0: 54 57 45 41 4b 45 52 20 28 73 74 69 6c 6c 20 6e  TWEAKER (still n
5bb0: 65 65 64 65 64 3f 29 0a 09 09 09 09 20 20 3b 3b  eeded?).....  ;;
5bc0: 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20   (thread-sleep! 
5bd0: 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a  *global-delta*).
5be0: 09 09 09 09 20 20 28 68 61 73 68 2d 74 61 62 6c  ....  (hash-tabl
5bf0: 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 67 69  e-set! test-regi
5c00: 73 74 72 79 20 28 72 75 6e 73 3a 6d 61 6b 65 2d  stry (runs:make-
5c10: 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 74  full-test-name t
5c20: 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61  est-name item-pa
5c30: 74 68 29 20 27 72 65 6d 6f 76 65 64 29 0a 09 09  th) 'removed)...
5c40: 09 09 20 20 28 6c 6f 6f 70 20 28 72 75 6e 73 3a  ..  (loop (runs:
5c50: 71 75 65 75 65 2d 6e 65 78 74 2d 68 65 64 20 74  queue-next-hed t
5c60: 61 6c 20 72 65 67 20 72 65 67 6c 65 6e 29 0a 09  al reg reglen)..
5c70: 09 09 09 09 28 72 75 6e 73 3a 71 75 65 75 65 2d  ....(runs:queue-
5c80: 6e 65 78 74 2d 74 61 6c 20 74 61 6c 20 72 65 67  next-tal tal reg
5c90: 20 72 65 67 6c 65 6e 29 0a 09 09 09 09 09 28 72   reglen)......(r
5ca0: 75 6e 73 3a 71 75 65 75 65 2d 6e 65 78 74 2d 72  uns:queue-next-r
5cb0: 65 67 20 74 61 6c 20 72 65 67 20 72 65 67 6c 65  eg tal reg regle
5cc0: 6e 29 0a 09 09 09 09 09 28 63 6f 6e 73 20 68 65  n)......(cons he
5cd0: 64 20 72 65 72 75 6e 73 29 29 29 0a 09 09 09 09  d reruns))).....
5ce0: 28 62 65 67 69 6e 0a 09 09 09 09 20 20 28 64 65  (begin.....  (de
5cf0: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 57 41 52  bug:print 1 "WAR
5d00: 4e 3a 20 54 65 73 74 20 6e 6f 74 20 70 72 6f 63  N: Test not proc
5d10: 65 73 73 65 64 20 63 6f 72 72 65 63 74 6c 79 2e  essed correctly.
5d20: 20 43 6f 75 6c 64 20 62 65 20 61 20 72 61 63 65   Could be a race
5d30: 20 63 6f 6e 64 69 74 69 6f 6e 20 69 6e 20 79 6f   condition in yo
5d40: 75 72 20 74 65 73 74 20 69 6d 70 6c 65 6d 65 6e  ur test implemen
5d50: 74 61 74 69 6f 6e 3f 20 22 20 68 65 64 29 20 3b  tation? " hed) ;
5d60: 3b 20 20 22 20 61 73 20 69 74 20 68 61 73 20 70  ;  " as it has p
5d70: 72 65 72 65 71 75 69 73 74 65 73 20 74 68 61 74  rerequistes that
5d80: 20 61 72 65 20 46 41 49 4c 2e 20 28 4e 4f 54 45   are FAIL. (NOTE
5d90: 3a 20 68 65 64 20 69 73 20 6e 6f 74 20 61 20 76  : hed is not a v
5da0: 65 63 74 6f 72 29 22 29 0a 09 09 09 09 20 20 28  ector)").....  (
5db0: 72 75 6e 73 3a 73 68 72 69 6e 6b 2d 63 61 6e 2d  runs:shrink-can-
5dc0: 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 63  run-more-tests-c
5dd0: 6f 75 6e 74 29 20 3b 3b 20 44 45 4c 41 59 20 54  ount) ;; DELAY T
5de0: 57 45 41 4b 45 52 20 28 73 74 69 6c 6c 20 6e 65  WEAKER (still ne
5df0: 65 64 65 64 3f 29 0a 09 09 09 09 20 20 3b 3b 20  eded?).....  ;; 
5e00: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28  (thread-sleep! (
5e10: 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d 64  + 0.01 *global-d
5e20: 65 6c 74 61 2a 29 29 0a 09 09 09 09 20 20 28 6c  elta*)).....  (l
5e30: 6f 6f 70 20 68 65 64 20 74 61 6c 20 72 65 67 20  oop hed tal reg 
5e40: 72 65 72 75 6e 73 29 29 29 29 29 29 29 29 29 20  reruns))))))))) 
5e50: 3b 3b 20 45 4e 44 20 4f 46 20 49 4e 4e 45 52 20  ;; END OF INNER 
5e60: 43 4f 4e 44 0a 09 20 20 20 20 20 0a 09 20 20 20  COND..     ..   
5e70: 20 20 3b 3b 20 63 61 73 65 20 77 68 65 72 65 20    ;; case where 
5e80: 61 6e 20 69 74 65 6d 73 20 63 61 6d 65 20 69 6e  an items came in
5e90: 20 61 73 20 61 20 6c 69 73 74 20 62 65 65 6e 20   as a list been 
5ea0: 70 72 6f 63 65 73 73 65 64 0a 09 20 20 20 20 20  processed..     
5eb0: 28 28 61 6e 64 20 28 6c 69 73 74 3f 20 69 74 65  ((and (list? ite
5ec0: 6d 73 29 20 20 20 20 20 3b 3b 20 74 68 75 73 20  ms)     ;; thus 
5ed0: 77 65 20 6b 6e 6f 77 20 6f 75 72 20 69 74 65 6d  we know our item
5ee0: 73 20 61 72 65 20 61 6c 72 65 61 64 79 20 63 61  s are already ca
5ef0: 6c 63 75 6c 61 74 65 64 0a 09 09 20 20 20 28 6e  lculated...   (n
5f00: 6f 74 20 20 20 69 74 65 6d 64 61 74 29 29 20 3b  ot   itemdat)) ;
5f10: 3b 20 61 6e 64 20 6e 6f 74 20 79 65 74 20 65 78  ; and not yet ex
5f20: 70 61 6e 64 65 64 20 69 6e 74 6f 20 74 68 65 20  panded into the 
5f30: 6c 69 73 74 20 6f 66 20 74 68 69 6e 67 73 20 74  list of things t
5f40: 6f 20 62 65 20 64 6f 6e 65 0a 09 20 20 20 20 20  o be done..     
5f50: 20 28 69 66 20 28 61 6e 64 20 28 64 65 62 75 67   (if (and (debug
5f60: 3a 64 65 62 75 67 2d 6d 6f 64 65 20 31 29 20 3b  :debug-mode 1) ;
5f70: 3b 20 28 3e 3d 20 2a 76 65 72 62 6f 73 69 74 79  ; (>= *verbosity
5f80: 2a 20 31 29 0a 09 09 20 20 20 20 20 20 20 28 3e  * 1)...       (>
5f90: 20 28 6c 65 6e 67 74 68 20 69 74 65 6d 73 29 20   (length items) 
5fa0: 30 29 0a 09 09 20 20 20 20 20 20 20 28 3e 20 28  0)...       (> (
5fb0: 6c 65 6e 67 74 68 20 28 63 61 72 20 69 74 65 6d  length (car item
5fc0: 73 29 29 20 30 29 29 0a 09 09 20 20 28 70 70 20  s)) 0))...  (pp 
5fd0: 69 74 65 6d 73 29 29 0a 09 20 20 20 20 20 20 28  items))..      (
5fe0: 66 6f 72 2d 65 61 63 68 0a 09 20 20 20 20 20 20  for-each..      
5ff0: 20 28 6c 61 6d 62 64 61 20 28 6d 79 2d 69 74 65   (lambda (my-ite
6000: 6d 64 61 74 29 0a 09 09 20 28 6c 65 74 2a 20 28  mdat)... (let* (
6010: 28 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64  (new-test-record
6020: 20 28 6c 65 74 20 28 28 6e 65 77 72 65 63 20 28   (let ((newrec (
6030: 6d 61 6b 65 2d 74 65 73 74 73 3a 74 65 73 74 71  make-tests:testq
6040: 75 65 75 65 29 29 29 0a 09 09 09 09 09 20 20 20  ueue)))......   
6050: 28 76 65 63 74 6f 72 2d 63 6f 70 79 21 20 74 65  (vector-copy! te
6060: 73 74 2d 72 65 63 6f 72 64 20 6e 65 77 72 65 63  st-record newrec
6070: 29 0a 09 09 09 09 09 20 20 20 6e 65 77 72 65 63  )......   newrec
6080: 29 29 0a 09 09 09 28 6d 79 2d 69 74 65 6d 2d 70  ))....(my-item-p
6090: 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e  ath (item-list->
60a0: 70 61 74 68 20 6d 79 2d 69 74 65 6d 64 61 74 29  path my-itemdat)
60b0: 29 29 0a 09 09 20 20 20 28 69 66 20 28 74 65 73  ))...   (if (tes
60c0: 74 73 3a 6d 61 74 63 68 20 74 65 73 74 2d 70 61  ts:match test-pa
60d0: 74 74 73 20 68 65 64 20 6d 79 2d 69 74 65 6d 2d  tts hed my-item-
60e0: 70 61 74 68 29 20 3b 3b 20 28 70 61 74 74 2d 6c  path) ;; (patt-l
60f0: 69 73 74 2d 6d 61 74 63 68 20 6d 79 2d 69 74 65  ist-match my-ite
6100: 6d 2d 70 61 74 68 20 69 74 65 6d 2d 70 61 74 74  m-path item-patt
6110: 73 29 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20  s)           ;; 
6120: 79 65 73 2c 20 77 65 20 77 61 6e 74 20 74 6f 20  yes, we want to 
6130: 70 72 6f 63 65 73 73 20 74 68 69 73 20 69 74 65  process this ite
6140: 6d 2c 20 4e 4f 54 45 3a 20 53 68 6f 75 6c 64 20  m, NOTE: Should 
6150: 6e 6f 74 20 6e 65 65 64 20 74 68 69 73 20 63 68  not need this ch
6160: 65 63 6b 20 68 65 72 65 21 0a 09 09 20 20 20 20  eck here!...    
6170: 20 20 20 28 6c 65 74 20 28 28 6e 65 77 74 65 73     (let ((newtes
6180: 74 6e 61 6d 65 20 28 72 75 6e 73 3a 6d 61 6b 65  tname (runs:make
6190: 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 20  -full-test-name 
61a0: 68 65 64 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68  hed my-item-path
61b0: 29 29 29 20 20 20 20 3b 3b 20 74 65 73 74 20 6e  )))    ;; test n
61c0: 61 6d 65 73 20 61 72 65 20 75 6e 69 71 75 65 20  ames are unique 
61d0: 6f 6e 20 74 65 73 74 6e 61 6d 65 2f 69 74 65 6d  on testname/item
61e0: 2d 70 61 74 68 0a 09 09 09 20 28 74 65 73 74 73  -path.... (tests
61f0: 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69  :testqueue-set-i
6200: 74 65 6d 73 21 20 20 20 20 20 6e 65 77 2d 74 65  tems!     new-te
6210: 73 74 2d 72 65 63 6f 72 64 20 23 66 29 0a 09 09  st-record #f)...
6220: 09 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65  . (tests:testque
6230: 75 65 2d 73 65 74 2d 69 74 65 6d 64 61 74 21 20  ue-set-itemdat! 
6240: 20 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72    new-test-recor
6250: 64 20 6d 79 2d 69 74 65 6d 64 61 74 29 0a 09 09  d my-itemdat)...
6260: 09 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65  . (tests:testque
6270: 75 65 2d 73 65 74 2d 69 74 65 6d 5f 70 61 74 68  ue-set-item_path
6280: 21 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72  ! new-test-recor
6290: 64 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68 29 0a  d my-item-path).
62a0: 09 09 09 20 28 68 61 73 68 2d 74 61 62 6c 65 2d  ... (hash-table-
62b0: 73 65 74 21 20 74 65 73 74 2d 72 65 63 6f 72 64  set! test-record
62c0: 73 20 6e 65 77 74 65 73 74 6e 61 6d 65 20 6e 65  s newtestname ne
62d0: 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 29 0a 09  w-test-record)..
62e0: 09 09 20 28 73 65 74 21 20 74 61 6c 20 28 63 6f  .. (set! tal (co
62f0: 6e 73 20 6e 65 77 74 65 73 74 6e 61 6d 65 20 74  ns newtestname t
6300: 61 6c 29 29 29 29 29 29 20 3b 3b 20 73 69 6e 63  al)))))) ;; sinc
6310: 65 20 74 68 65 73 65 20 61 72 65 20 69 74 65 6d  e these are item
6320: 69 7a 65 64 20 63 72 65 61 74 65 20 6e 65 77 20  ized create new 
6330: 74 65 73 74 20 6e 61 6d 65 73 20 74 65 73 74 6e  test names testn
6340: 61 6d 65 2f 69 74 65 6d 70 61 74 68 0a 09 20 20  ame/itempath..  
6350: 20 20 20 20 20 69 74 65 6d 73 29 0a 09 20 20 20       items)..   
6360: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c     (if (not (nul
6370: 6c 3f 20 74 61 6c 29 29 0a 09 09 20 20 28 62 65  l? tal))...  (be
6380: 67 69 6e 0a 09 09 20 20 20 20 28 64 65 62 75 67  gin...    (debug
6390: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 45  :print-info 4 "E
63a0: 6e 64 20 6f 66 20 69 74 65 6d 73 20 6c 69 73 74  nd of items list
63b0: 2c 20 6c 6f 6f 70 69 6e 67 20 77 69 74 68 20 6e  , looping with n
63c0: 65 78 74 20 61 66 74 65 72 20 73 68 6f 72 74 20  ext after short 
63d0: 64 65 6c 61 79 22 29 0a 20 20 20 20 20 20 20 20  delay").        
63e0: 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 28              ;; (
63f0: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b  thread-sleep! (+
6400: 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d 64 65   0.01 *global-de
6410: 6c 74 61 2a 29 29 0a 09 09 20 20 20 20 28 6c 6f  lta*))...    (lo
6420: 6f 70 20 28 72 75 6e 73 3a 71 75 65 75 65 2d 6e  op (runs:queue-n
6430: 65 78 74 2d 68 65 64 20 74 61 6c 20 72 65 67 20  ext-hed tal reg 
6440: 72 65 67 6c 65 6e 29 0a 09 09 09 20 20 28 72 75  reglen)....  (ru
6450: 6e 73 3a 71 75 65 75 65 2d 6e 65 78 74 2d 74 61  ns:queue-next-ta
6460: 6c 20 74 61 6c 20 72 65 67 20 72 65 67 6c 65 6e  l tal reg reglen
6470: 29 0a 09 09 09 20 20 28 72 75 6e 73 3a 71 75 65  )....  (runs:que
6480: 75 65 2d 6e 65 78 74 2d 72 65 67 20 74 61 6c 20  ue-next-reg tal 
6490: 72 65 67 20 72 65 67 6c 65 6e 29 0a 09 09 09 20  reg reglen).... 
64a0: 20 72 65 72 75 6e 73 29 29 29 29 0a 0a 09 20 20   reruns))))...  
64b0: 20 20 20 3b 3b 20 69 66 20 69 74 65 6d 73 20 69     ;; if items i
64c0: 73 20 61 20 70 72 6f 63 20 74 68 65 6e 20 6e 65  s a proc then ne
64d0: 65 64 20 74 6f 20 72 75 6e 20 69 74 65 6d 73 3a  ed to run items:
64e0: 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63  get-items-from-c
64f0: 6f 6e 66 69 67 2c 20 67 65 74 20 74 68 65 20 6c  onfig, get the l
6500: 69 73 74 20 61 6e 64 20 6c 6f 6f 70 20 0a 09 20  ist and loop .. 
6510: 20 20 20 20 3b 3b 20 20 20 20 2d 20 62 75 74 20      ;;    - but 
6520: 6f 6e 6c 79 20 64 6f 20 74 68 61 74 20 69 66 20  only do that if 
6530: 72 65 73 6f 75 72 63 65 73 20 65 78 69 73 74 20  resources exist 
6540: 74 6f 20 6b 69 63 6b 20 6f 66 66 20 74 68 65 20  to kick off the 
6550: 6a 6f 62 0a 09 20 20 20 20 20 28 28 6f 72 20 28  job..     ((or (
6560: 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73  procedure? items
6570: 29 28 65 71 3f 20 69 74 65 6d 73 20 27 68 61 76  )(eq? items 'hav
6580: 65 2d 70 72 6f 63 65 64 75 72 65 29 29 0a 09 20  e-procedure)).. 
6590: 20 20 20 20 20 28 6c 65 74 20 28 28 63 61 6e 2d       (let ((can-
65a0: 72 75 6e 2d 6d 6f 72 65 20 20 20 20 28 72 75 6e  run-more    (run
65b0: 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74  s:can-run-more-t
65c0: 65 73 74 73 20 74 65 73 74 2d 72 65 63 6f 72 64  ests test-record
65d0: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d   max-concurrent-
65e0: 6a 6f 62 73 29 29 29 0a 09 09 28 69 66 20 28 61  jobs)))...(if (a
65f0: 6e 64 20 28 6c 69 73 74 3f 20 63 61 6e 2d 72 75  nd (list? can-ru
6600: 6e 2d 6d 6f 72 65 29 0a 09 09 09 20 28 63 61 72  n-more).... (car
6610: 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 29 29 0a   can-run-more)).
6620: 09 09 20 20 20 20 28 6c 65 74 2a 20 28 28 70 72  ..    (let* ((pr
6630: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 28 64  ereqs-not-met (d
6640: 62 3a 67 65 74 2d 70 72 65 72 65 71 73 2d 6e 6f  b:get-prereqs-no
6650: 74 2d 6d 65 74 20 72 75 6e 2d 69 64 20 77 61 69  t-met run-id wai
6660: 74 6f 6e 73 20 69 74 65 6d 2d 70 61 74 68 20 6d  tons item-path m
6670: 6f 64 65 3a 20 74 65 73 74 6d 6f 64 65 29 29 0a  ode: testmode)).
6680: 09 09 09 20 20 20 28 66 61 69 6c 73 20 20 20 20  ...   (fails    
6690: 20 20 20 20 20 20 20 28 72 75 6e 73 3a 63 61 6c         (runs:cal
66a0: 63 2d 66 61 69 6c 73 20 70 72 65 72 65 71 73 2d  c-fails prereqs-
66b0: 6e 6f 74 2d 6d 65 74 29 29 0a 09 09 09 20 20 20  not-met))....   
66c0: 28 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 20 20  (non-completed  
66d0: 20 28 72 75 6e 73 3a 63 61 6c 63 2d 6e 6f 74 2d   (runs:calc-not-
66e0: 63 6f 6d 70 6c 65 74 65 64 20 70 72 65 72 65 71  completed prereq
66f0: 73 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a 09 09 20  s-not-met)))... 
6700: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
6710: 74 2d 69 6e 66 6f 20 38 20 22 63 61 6e 2d 72 75  t-info 8 "can-ru
6720: 6e 2d 6d 6f 72 65 3a 20 22 20 63 61 6e 2d 72 75  n-more: " can-ru
6730: 6e 2d 6d 6f 72 65 0a 09 09 09 09 20 20 20 22 5c  n-more.....   "\
6740: 6e 20 74 65 73 74 6e 61 6d 65 3a 20 20 20 20 20  n testname:     
6750: 20 20 20 22 20 68 65 64 0a 09 09 09 09 20 20 20     " hed.....   
6760: 22 5c 6e 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d  "\n prereqs-not-
6770: 6d 65 74 3a 20 22 20 28 72 75 6e 73 3a 70 72 65  met: " (runs:pre
6780: 74 74 79 2d 73 74 72 69 6e 67 20 70 72 65 72 65  tty-string prere
6790: 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09 09 09  qs-not-met).....
67a0: 20 20 20 22 5c 6e 20 6e 6f 6e 2d 63 6f 6d 70 6c     "\n non-compl
67b0: 65 74 65 64 3a 20 20 20 22 20 28 72 75 6e 73 3a  eted:   " (runs:
67c0: 70 72 65 74 74 79 2d 73 74 72 69 6e 67 20 6e 6f  pretty-string no
67d0: 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 20 0a 09 09  n-completed) ...
67e0: 09 09 20 20 20 22 5c 6e 20 66 61 69 6c 73 3a 20  ..   "\n fails: 
67f0: 20 20 20 20 20 20 20 20 20 20 22 20 28 72 75 6e            " (run
6800: 73 3a 70 72 65 74 74 79 2d 73 74 72 69 6e 67 20  s:pretty-string 
6810: 66 61 69 6c 73 29 0a 09 09 09 09 20 20 20 22 5c  fails).....   "\
6820: 6e 20 74 65 73 74 6d 6f 64 65 3a 20 20 20 20 20  n testmode:     
6830: 20 20 20 22 20 74 65 73 74 6d 6f 64 65 0a 09 09     " testmode...
6840: 09 09 20 20 20 22 5c 6e 20 6e 75 6d 2d 72 65 74  ..   "\n num-ret
6850: 72 69 65 73 3a 20 20 20 20 20 22 20 6e 75 6d 2d  ries:     " num-
6860: 72 65 74 72 69 65 73 0a 09 09 09 09 20 20 20 22  retries.....   "
6870: 5c 6e 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 65  \n (eq? testmode
6880: 20 27 74 6f 70 6c 65 76 65 6c 29 3a 20 22 20 28   'toplevel): " (
6890: 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 74 6f  eq? testmode 'to
68a0: 70 6c 65 76 65 6c 29 0a 09 09 09 09 20 20 20 22  plevel).....   "
68b0: 5c 6e 20 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f  \n (null? non-co
68c0: 6d 70 6c 65 74 65 64 29 3a 20 20 20 20 22 20 28  mpleted):    " (
68d0: 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65  null? non-comple
68e0: 74 65 64 29 0a 09 09 09 09 20 20 20 22 5c 6e 20  ted).....   "\n 
68f0: 72 65 72 75 6e 73 3a 20 20 20 20 20 20 20 20 20  reruns:         
6900: 20 22 20 72 65 72 75 6e 73 0a 09 09 09 09 20 20   " reruns.....  
6910: 20 22 5c 6e 20 69 74 65 6d 73 3a 20 20 20 20 20   "\n items:     
6920: 20 20 20 20 20 20 22 20 69 74 65 6d 73 0a 09 09        " items...
6930: 09 09 20 20 20 22 5c 6e 20 63 61 6e 2d 72 75 6e  ..   "\n can-run
6940: 2d 6d 6f 72 65 3a 20 20 20 20 22 20 63 61 6e 2d  -more:    " can-
6950: 72 75 6e 2d 6d 6f 72 65 29 0a 09 09 20 20 20 20  run-more)...    
6960: 20 20 3b 3b 20 28 74 68 72 65 61 64 2d 73 6c 65    ;; (thread-sle
6970: 65 70 21 20 28 2b 20 30 2e 30 31 20 2a 67 6c 6f  ep! (+ 0.01 *glo
6980: 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09 20  bal-delta*))... 
6990: 20 20 20 20 20 28 63 6f 6e 64 20 3b 3b 20 49 4e       (cond ;; IN
69a0: 4e 45 52 20 43 4f 4e 44 20 23 32 0a 09 09 20 20  NER COND #2...  
69b0: 20 20 20 20 20 28 28 6f 72 20 28 6e 75 6c 6c 3f       ((or (null?
69c0: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74   prereqs-not-met
69d0: 29 20 3b 3b 20 61 6c 6c 20 70 72 65 72 65 71 73  ) ;; all prereqs
69e0: 20 6d 65 74 2c 20 66 69 72 65 20 6f 66 66 20 74   met, fire off t
69f0: 68 65 20 74 65 73 74 0a 09 09 09 20 20 20 20 3b  he test....    ;
6a00: 3b 20 6f 72 2c 20 69 66 20 69 74 20 69 73 20 61  ; or, if it is a
6a10: 20 27 74 6f 70 6c 65 76 65 6c 20 74 65 73 74 20   'toplevel test 
6a20: 61 6e 64 20 61 6c 6c 20 70 72 65 72 65 71 73 20  and all prereqs 
6a30: 6e 6f 74 20 6d 65 74 20 61 72 65 20 43 4f 4d 50  not met are COMP
6a40: 4c 45 54 45 44 20 74 68 65 6e 20 6c 61 75 6e 63  LETED then launc
6a50: 68 0a 09 09 09 20 20 20 20 28 61 6e 64 20 28 65  h....    (and (e
6a60: 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 74 6f 70  q? testmode 'top
6a70: 6c 65 76 65 6c 29 0a 09 09 09 09 20 28 6e 75 6c  level)..... (nul
6a80: 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64  l? non-completed
6a90: 29 29 29 0a 09 09 09 28 6c 65 74 20 28 28 74 65  )))....(let ((te
6aa0: 73 74 2d 6e 61 6d 65 20 28 74 65 73 74 73 3a 74  st-name (tests:t
6ab0: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73  estqueue-get-tes
6ac0: 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72  tname test-recor
6ad0: 64 29 29 29 0a 09 09 09 20 20 28 73 65 74 65 6e  d)))....  (seten
6ae0: 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d 45 22  v "MT_TEST_NAME"
6af0: 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b 20 0a   test-name) ;; .
6b00: 09 09 09 20 20 28 73 65 74 65 6e 76 20 22 4d 54  ...  (setenv "MT
6b10: 5f 52 55 4e 4e 41 4d 45 22 20 20 20 72 75 6e 6e  _RUNNAME"   runn
6b20: 61 6d 65 29 0a 09 09 09 20 20 28 73 65 74 2d 6d  ame)....  (set-m
6b30: 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73  egatest-env-vars
6b40: 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73   run-id) ;; thes
6b50: 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64 20  e may be needed 
6b60: 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e 67  by the launching
6b70: 20 70 72 6f 63 65 73 73 0a 09 09 09 20 20 28 6c   process....  (l
6b80: 65 74 20 28 28 69 74 65 6d 73 2d 6c 69 73 74 20  et ((items-list 
6b90: 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73  (items:get-items
6ba0: 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 74 63 6f  -from-config tco
6bb0: 6e 66 69 67 29 29 29 0a 09 09 09 20 20 20 20 28  nfig)))....    (
6bc0: 69 66 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 2d  if (list? items-
6bd0: 6c 69 73 74 29 0a 09 09 09 09 28 62 65 67 69 6e  list).....(begin
6be0: 0a 09 09 09 09 20 20 28 74 65 73 74 73 3a 74 65  .....  (tests:te
6bf0: 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d  stqueue-set-item
6c00: 73 21 20 74 65 73 74 2d 72 65 63 6f 72 64 20 69  s! test-record i
6c10: 74 65 6d 73 2d 6c 69 73 74 29 0a 09 09 09 09 20  tems-list)..... 
6c20: 20 3b 3b 20 28 74 68 72 65 61 64 2d 73 6c 65 65   ;; (thread-slee
6c30: 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61  p! *global-delta
6c40: 2a 29 0a 09 09 09 09 20 20 28 6c 6f 6f 70 20 68  *).....  (loop h
6c50: 65 64 20 74 61 6c 20 72 65 67 20 72 65 72 75 6e  ed tal reg rerun
6c60: 73 29 29 0a 09 09 09 09 28 62 65 67 69 6e 0a 09  s)).....(begin..
6c70: 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e  ...  (debug:prin
6c80: 74 20 30 20 22 45 52 52 4f 52 3a 20 54 68 65 20  t 0 "ERROR: The 
6c90: 70 72 6f 63 20 66 72 6f 6d 20 72 65 61 64 69 6e  proc from readin
6ca0: 67 20 74 68 65 20 73 65 74 75 70 20 64 69 64 20  g the setup did 
6cb0: 6e 6f 74 20 79 69 65 6c 64 20 61 20 6c 69 73 74  not yield a list
6cc0: 20 2d 20 70 6c 65 61 73 65 20 72 65 70 6f 72 74   - please report
6cd0: 20 74 68 69 73 22 29 0a 09 09 09 09 20 20 28 65   this").....  (e
6ce0: 78 69 74 20 31 29 29 29 29 29 29 0a 09 09 20 20  xit 1))))))...  
6cf0: 20 20 20 20 20 28 28 6e 75 6c 6c 3f 20 66 61 69       ((null? fai
6d00: 6c 73 29 0a 09 09 09 28 64 65 62 75 67 3a 70 72  ls)....(debug:pr
6d10: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 66 61 69 6c  int-info 4 "fail
6d20: 73 20 69 73 20 6e 75 6c 6c 2c 20 6d 6f 76 69 6e  s is null, movin
6d30: 67 20 6f 6e 20 69 6e 20 74 68 65 20 71 75 65 75  g on in the queu
6d40: 65 20 62 75 74 20 6b 65 65 70 69 6e 67 20 22 20  e but keeping " 
6d50: 68 65 64 20 22 20 66 6f 72 20 6e 6f 77 22 29 0a  hed " for now").
6d60: 09 09 09 3b 3b 20 6f 6e 6c 79 20 69 6e 63 72 65  ...;; only incre
6d70: 6d 65 6e 74 20 6e 75 6d 2d 72 65 74 72 69 65 73  ment num-retries
6d80: 20 77 68 65 6e 20 74 68 65 72 65 20 61 72 65 20   when there are 
6d90: 6e 6f 20 74 65 73 74 73 20 72 75 6e 69 6e 67 0a  no tests runing.
6da0: 09 09 09 28 69 66 20 28 65 71 3f 20 30 20 28 6c  ...(if (eq? 0 (l
6db0: 69 73 74 2d 72 65 66 20 63 61 6e 2d 72 75 6e 2d  ist-ref can-run-
6dc0: 6d 6f 72 65 20 31 29 29 0a 09 09 09 20 20 20 20  more 1))....    
6dd0: 28 62 65 67 69 6e 0a 09 09 09 20 20 20 20 20 20  (begin....      
6de0: 3b 3b 20 54 52 59 20 28 69 66 20 28 3e 20 6e 75  ;; TRY (if (> nu
6df0: 6d 2d 72 65 74 72 69 65 73 20 31 30 30 29 20 3b  m-retries 100) ;
6e00: 3b 20 66 69 72 73 74 20 31 30 30 20 72 65 74 72  ; first 100 retr
6e10: 69 65 73 20 61 72 65 20 6c 6f 77 20 74 69 6d 65  ies are low time
6e20: 20 63 6f 73 74 0a 09 09 09 20 20 20 20 20 20 3b   cost....      ;
6e30: 3b 20 54 52 59 20 20 20 20 20 28 74 68 72 65 61  ; TRY     (threa
6e40: 64 2d 73 6c 65 65 70 21 20 28 2b 20 32 20 2a 67  d-sleep! (+ 2 *g
6e50: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09  lobal-delta*))..
6e60: 09 09 20 20 20 20 20 20 3b 3b 20 54 52 59 20 20  ..      ;; TRY  
6e70: 20 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70     (thread-sleep
6e80: 21 20 28 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61  ! (+ 0.01 *globa
6e90: 6c 2d 64 65 6c 74 61 2a 29 29 29 0a 09 09 09 20  l-delta*))).... 
6ea0: 20 20 20 20 20 28 73 65 74 21 20 6e 75 6d 2d 72       (set! num-r
6eb0: 65 74 72 69 65 73 20 28 2b 20 6e 75 6d 2d 72 65  etries (+ num-re
6ec0: 74 72 69 65 73 20 31 29 29 29 29 0a 09 09 09 28  tries 1))))....(
6ed0: 69 66 20 28 3e 20 6e 75 6d 2d 72 65 74 72 69 65  if (> num-retrie
6ee0: 73 20 20 6d 61 78 2d 72 65 74 72 69 65 73 29 0a  s  max-retries).
6ef0: 09 09 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20  ...    (if (not 
6f00: 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 09  (null? tal))....
6f10: 09 28 6c 6f 6f 70 20 28 72 75 6e 73 3a 71 75 65  .(loop (runs:que
6f20: 75 65 2d 6e 65 78 74 2d 68 65 64 20 74 61 6c 20  ue-next-hed tal 
6f30: 72 65 67 20 72 65 67 6c 65 6e 29 0a 09 09 09 09  reg reglen).....
6f40: 20 20 20 20 20 20 28 72 75 6e 73 3a 71 75 65 75        (runs:queu
6f50: 65 2d 6e 65 78 74 2d 74 61 6c 20 74 61 6c 20 72  e-next-tal tal r
6f60: 65 67 20 72 65 67 6c 65 6e 29 0a 09 09 09 09 20  eg reglen)..... 
6f70: 20 20 20 20 20 28 72 75 6e 73 3a 71 75 65 75 65       (runs:queue
6f80: 2d 6e 65 78 74 2d 72 65 67 20 74 61 6c 20 72 65  -next-reg tal re
6f90: 67 20 72 65 67 6c 65 6e 29 0a 09 09 09 09 20 20  g reglen).....  
6fa0: 20 20 20 20 72 65 72 75 6e 73 29 29 0a 09 09 09      reruns))....
6fb0: 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e      (loop (car n
6fc0: 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61  ewtal)(cdr newta
6fd0: 6c 29 20 72 65 67 20 72 65 72 75 6e 73 29 29 29  l) reg reruns)))
6fe0: 20 3b 3b 20 61 6e 20 69 73 73 75 65 20 77 69 74   ;; an issue wit
6ff0: 68 20 70 72 65 72 65 71 73 20 6e 6f 74 20 79 65  h prereqs not ye
7000: 74 20 6d 65 74 3f 0a 09 09 20 20 20 20 20 20 20  t met?...       
7010: 28 28 61 6e 64 20 28 6e 6f 74 20 28 6e 75 6c 6c  ((and (not (null
7020: 3f 20 66 61 69 6c 73 29 29 28 65 71 3f 20 74 65  ? fails))(eq? te
7030: 73 74 6d 6f 64 65 20 27 6e 6f 72 6d 61 6c 29 29  stmode 'normal))
7040: 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74  ....(debug:print
7050: 2d 69 6e 66 6f 20 31 20 22 74 65 73 74 20 22 20  -info 1 "test " 
7060: 20 68 65 64 20 22 20 28 6d 6f 64 65 3d 22 20 74   hed " (mode=" t
7070: 65 73 74 6d 6f 64 65 20 22 29 20 68 61 73 20 66  estmode ") has f
7080: 61 69 6c 65 64 20 70 72 65 72 65 71 75 69 73 69  ailed prerequisi
7090: 74 65 28 73 29 3b 20 22 0a 09 09 09 09 20 20 20  te(s); ".....   
70a0: 20 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73    (string-inters
70b0: 70 65 72 73 65 20 28 6d 61 70 20 28 6c 61 6d 62  perse (map (lamb
70c0: 64 61 20 28 74 29 28 63 6f 6e 63 20 28 64 62 3a  da (t)(conc (db:
70d0: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d  test-get-testnam
70e0: 65 20 74 29 20 22 3a 22 20 28 64 62 3a 74 65 73  e t) ":" (db:tes
70f0: 74 2d 67 65 74 2d 73 74 61 74 65 20 74 29 22 2f  t-get-state t)"/
7100: 22 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74  "(db:test-get-st
7110: 61 74 75 73 20 74 29 29 29 20 66 61 69 6c 73 29  atus t))) fails)
7120: 20 22 2c 20 22 29 0a 09 09 09 09 20 20 20 20 20   ", ").....     
7130: 22 2c 20 72 65 6d 6f 76 69 6e 67 20 69 74 20 66  ", removing it f
7140: 72 6f 6d 20 74 6f 2d 64 6f 20 6c 69 73 74 22 29  rom to-do list")
7150: 0a 09 09 09 28 69 66 20 28 6e 6f 74 20 28 6e 75  ....(if (not (nu
7160: 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 09 20 20 20  ll? tal))....   
7170: 20 28 62 65 67 69 6e 0a 20 20 20 20 20 20 20 20   (begin.        
7180: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
7190: 20 20 20 20 20 20 3b 3b 20 28 74 68 72 65 61 64        ;; (thread
71a0: 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d  -sleep! *global-
71b0: 64 65 6c 74 61 2a 29 0a 09 09 09 20 20 20 20 20  delta*)....     
71c0: 20 28 6c 6f 6f 70 20 28 72 75 6e 73 3a 71 75 65   (loop (runs:que
71d0: 75 65 2d 6e 65 78 74 2d 68 65 64 20 74 61 6c 20  ue-next-hed tal 
71e0: 72 65 67 20 72 65 67 6c 65 6e 29 0a 09 09 09 09  reg reglen).....
71f0: 20 20 20 20 28 72 75 6e 73 3a 71 75 65 75 65 2d      (runs:queue-
7200: 6e 65 78 74 2d 74 61 6c 20 74 61 6c 20 72 65 67  next-tal tal reg
7210: 20 72 65 67 6c 65 6e 29 0a 09 09 09 09 20 20 20   reglen).....   
7220: 20 28 72 75 6e 73 3a 71 75 65 75 65 2d 6e 65 78   (runs:queue-nex
7230: 74 2d 72 65 67 20 74 61 6c 20 72 65 67 20 72 65  t-reg tal reg re
7240: 67 6c 65 6e 29 0a 09 09 09 09 20 20 20 20 28 63  glen).....    (c
7250: 6f 6e 73 20 68 65 64 20 72 65 72 75 6e 73 29 29  ons hed reruns))
7260: 29 29 29 0a 09 09 20 20 20 20 20 20 20 28 65 6c  )))...       (el
7270: 73 65 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69  se....(debug:pri
7280: 6e 74 20 38 20 22 45 52 52 4f 52 3a 20 4e 6f 20  nt 8 "ERROR: No 
7290: 68 61 6e 64 6c 65 72 20 66 6f 72 20 74 68 69 73  handler for this
72a0: 20 63 6f 6e 64 69 74 69 6f 6e 2e 22 29 0a 09 09   condition.")...
72b0: 09 3b 3b 20 54 52 59 20 28 74 68 72 65 61 64 2d  .;; TRY (thread-
72c0: 73 6c 65 65 70 21 20 28 2b 20 31 20 2a 67 6c 6f  sleep! (+ 1 *glo
72d0: 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09 09  bal-delta*))....
72e0: 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61  (loop (car newta
72f0: 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20 72  l)(cdr newtal) r
7300: 65 67 20 72 65 72 75 6e 73 29 29 29 29 20 3b 3b  eg reruns)))) ;;
7310: 20 45 4e 44 20 4f 46 20 49 46 20 43 41 4e 20 52   END OF IF CAN R
7320: 55 4e 20 4d 4f 52 45 0a 0a 09 09 20 20 20 20 3b  UN MORE....    ;
7330: 3b 20 69 66 20 63 61 6e 27 74 20 72 75 6e 20 6d  ; if can't run m
7340: 6f 72 65 20 6a 75 73 74 20 6c 6f 6f 70 20 77 69  ore just loop wi
7350: 74 68 20 6e 65 78 74 20 70 6f 73 73 69 62 6c 65  th next possible
7360: 20 74 65 73 74 0a 09 09 20 20 20 20 28 62 65 67   test...    (beg
7370: 69 6e 0a 09 09 20 20 20 20 20 20 28 64 65 62 75  in...      (debu
7380: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22  g:print-info 4 "
7390: 70 72 6f 63 65 73 73 69 6e 67 20 74 68 65 20 63  processing the c
73a0: 61 73 65 20 77 69 74 68 20 61 20 6c 61 6d 62 64  ase with a lambd
73b0: 61 20 66 6f 72 20 69 74 65 6d 73 20 6f 72 20 27  a for items or '
73c0: 68 61 76 65 2d 70 72 6f 63 65 64 75 72 65 2e 20  have-procedure. 
73d0: 4d 6f 76 69 6e 67 20 74 68 72 6f 75 67 68 20 74  Moving through t
73e0: 68 65 20 71 75 65 75 65 20 77 69 74 68 6f 75 74  he queue without
73f0: 20 64 72 6f 70 70 69 6e 67 20 22 20 68 65 64 29   dropping " hed)
7400: 0a 09 09 20 20 20 20 20 20 3b 3b 20 28 74 68 72  ...      ;; (thr
7410: 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 32 20  ead-sleep! (+ 2 
7420: 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29  *global-delta*))
7430: 0a 09 09 20 20 20 20 20 20 28 6c 6f 6f 70 20 28  ...      (loop (
7440: 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20  car newtal)(cdr 
7450: 6e 65 77 74 61 6c 29 20 72 65 67 20 72 65 72 75  newtal) reg reru
7460: 6e 73 29 29 29 29 29 20 3b 3b 20 45 4e 44 20 4f  ns))))) ;; END O
7470: 46 20 28 6f 72 20 28 70 72 6f 63 65 64 75 72 65  F (or (procedure
7480: 3f 20 69 74 65 6d 73 29 28 65 71 3f 20 69 74 65  ? items)(eq? ite
7490: 6d 73 20 27 68 61 76 65 2d 70 72 6f 63 65 64 75  ms 'have-procedu
74a0: 72 65 29 29 0a 09 20 20 20 20 20 0a 09 20 20 20  re))..     ..   
74b0: 20 20 3b 3b 20 74 68 69 73 20 63 61 73 65 20 73    ;; this case s
74c0: 68 6f 75 6c 64 20 6e 6f 74 20 68 61 70 70 65 6e  hould not happen
74d0: 2c 20 61 64 64 65 64 20 74 6f 20 68 65 6c 70 20  , added to help 
74e0: 63 61 74 63 68 20 61 6e 79 20 62 75 67 73 0a 09  catch any bugs..
74f0: 20 20 20 20 20 28 28 61 6e 64 20 28 6c 69 73 74       ((and (list
7500: 3f 20 69 74 65 6d 73 29 20 69 74 65 6d 64 61 74  ? items) itemdat
7510: 29 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 3a  )..      (debug:
7520: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
7530: 53 68 6f 75 6c 64 20 6e 6f 74 20 68 61 76 65 20  Should not have 
7540: 61 20 6c 69 73 74 20 6f 66 20 69 74 65 6d 73 20  a list of items 
7550: 69 6e 20 61 20 74 65 73 74 20 61 6e 64 20 74 68  in a test and th
7560: 65 20 69 74 65 6d 73 70 61 74 68 20 73 65 74 20  e itemspath set 
7570: 2d 20 70 6c 65 61 73 65 20 72 65 70 6f 72 74 20  - please report 
7580: 74 68 69 73 22 29 0a 09 20 20 20 20 20 20 28 65  this")..      (e
7590: 78 69 74 20 31 29 29 0a 09 20 20 20 20 20 28 28  xit 1))..     ((
75a0: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 72 75 6e  not (null? rerun
75b0: 73 29 29 0a 09 20 20 20 20 20 20 28 6c 65 74 2a  s))..      (let*
75c0: 20 28 28 6e 65 77 6c 73 74 20 28 74 65 73 74 73   ((newlst (tests
75d0: 3a 66 69 6c 74 65 72 2d 6e 6f 6e 2d 72 75 6e 6e  :filter-non-runn
75e0: 61 62 6c 65 20 72 75 6e 2d 69 64 20 74 61 6c 20  able run-id tal 
75f0: 74 65 73 74 2d 72 65 63 6f 72 64 73 29 29 20 3b  test-records)) ;
7600: 3b 20 69 2e 65 2e 20 6e 6f 74 20 46 41 49 4c 2c  ; i.e. not FAIL,
7610: 20 57 41 49 56 45 44 2c 20 49 4e 43 4f 4d 50 4c   WAIVED, INCOMPL
7620: 45 54 45 2c 20 50 41 53 53 2c 20 4b 49 4c 4c 45  ETE, PASS, KILLE
7630: 44 2c 0a 09 09 20 20 20 20 20 28 6a 75 6e 6b 65  D,...     (junke
7640: 64 20 28 6c 73 65 74 2d 64 69 66 66 65 72 65 6e  d (lset-differen
7650: 63 65 20 65 71 75 61 6c 3f 20 74 61 6c 20 6e 65  ce equal? tal ne
7660: 77 6c 73 74 29 29 29 0a 09 09 28 64 65 62 75 67  wlst)))...(debug
7670: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 66  :print-info 4 "f
7680: 75 6c 6c 20 64 72 6f 70 20 74 68 72 6f 75 67 68  ull drop through
7690: 2c 20 69 66 20 72 65 72 75 6e 73 20 69 73 20 6c  , if reruns is l
76a0: 65 73 73 20 74 68 61 6e 20 31 30 30 20 77 65 20  ess than 100 we 
76b0: 77 69 6c 6c 20 66 6f 72 63 65 20 72 65 74 72 79  will force retry
76c0: 20 74 68 65 6d 2c 20 72 65 72 75 6e 73 3d 22 20   them, reruns=" 
76d0: 72 65 72 75 6e 73 20 22 2c 20 74 61 6c 3d 22 20  reruns ", tal=" 
76e0: 74 61 6c 29 0a 09 09 28 69 66 20 28 3c 20 6e 75  tal)...(if (< nu
76f0: 6d 2d 72 65 74 72 69 65 73 20 6d 61 78 2d 72 65  m-retries max-re
7700: 74 72 69 65 73 29 0a 09 09 20 20 20 20 28 73 65  tries)...    (se
7710: 74 21 20 6e 65 77 6c 73 74 20 28 61 70 70 65 6e  t! newlst (appen
7720: 64 20 72 65 72 75 6e 73 20 6e 65 77 6c 73 74 29  d reruns newlst)
7730: 29 29 0a 09 09 28 73 65 74 21 20 6e 75 6d 2d 72  ))...(set! num-r
7740: 65 74 72 69 65 73 20 28 2b 20 6e 75 6d 2d 72 65  etries (+ num-re
7750: 74 72 69 65 73 20 31 29 29 0a 09 09 3b 3b 20 28  tries 1))...;; (
7760: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b  thread-sleep! (+
7770: 20 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61   1 *global-delta
7780: 2a 29 29 0a 09 09 28 69 66 20 28 6e 6f 74 20 28  *))...(if (not (
7790: 6e 75 6c 6c 3f 20 6e 65 77 6c 73 74 29 29 0a 09  null? newlst))..
77a0: 09 20 20 20 20 3b 3b 20 73 69 6e 63 65 20 72 65  .    ;; since re
77b0: 72 75 6e 73 20 68 61 76 65 20 62 65 65 6e 20 74  runs have been t
77c0: 61 63 6b 65 64 20 6f 6e 20 74 6f 20 6e 65 77 6c  acked on to newl
77d0: 73 74 20 63 72 65 61 74 65 20 6e 65 77 20 72 65  st create new re
77e0: 72 75 6e 73 20 66 72 6f 6d 20 6a 75 6e 6b 65 64  runs from junked
77f0: 0a 09 09 20 20 20 20 28 6c 6f 6f 70 20 28 63 61  ...    (loop (ca
7800: 72 20 6e 65 77 6c 73 74 29 28 63 64 72 20 6e 65  r newlst)(cdr ne
7810: 77 6c 73 74 29 20 72 65 67 20 28 64 65 6c 65 74  wlst) reg (delet
7820: 65 2d 64 75 70 6c 69 63 61 74 65 73 20 6a 75 6e  e-duplicates jun
7830: 6b 65 64 29 29 29 29 29 0a 09 20 20 20 20 20 28  ked)))))..     (
7840: 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29  (not (null? tal)
7850: 29 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 3a  )..      (debug:
7860: 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 49 27  print-info 4 "I'
7870: 6d 20 70 72 65 74 74 79 20 73 75 72 65 20 49 20  m pretty sure I 
7880: 73 68 6f 75 6c 64 6e 27 74 20 67 65 74 20 68 65  shouldn't get he
7890: 72 65 2e 22 29 29 0a 09 20 20 20 20 20 28 65 6c  re."))..     (el
78a0: 73 65 0a 09 20 20 20 20 20 20 28 64 65 62 75 67  se..      (debug
78b0: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 45  :print-info 4 "E
78c0: 78 69 74 69 6e 67 20 6c 6f 6f 70 20 77 69 74 68  xiting loop with
78d0: 2e 2e 2e 5c 6e 20 20 68 65 64 3d 22 20 68 65 64  ...\n  hed=" hed
78e0: 20 22 5c 6e 20 20 74 61 6c 3d 22 20 74 61 6c 20   "\n  tal=" tal 
78f0: 22 5c 6e 20 20 72 65 72 75 6e 73 3d 22 20 72 65  "\n  reruns=" re
7900: 72 75 6e 73 29 29 0a 09 20 20 20 20 20 29 29 29  runs))..     )))
7910: 29 20 3b 3b 20 4c 45 54 2a 20 28 28 74 65 73 74  ) ;; LET* ((test
7920: 2d 72 65 63 6f 72 64 0a 0a 20 20 20 20 3b 3b 20  -record..    ;; 
7930: 77 65 20 67 65 74 20 68 65 72 65 20 6f 6e 20 22  we get here on "
7940: 64 72 6f 70 20 74 68 72 6f 75 67 68 22 20 2d 20  drop through" - 
7950: 6c 6f 6f 70 20 66 6f 72 20 6e 65 78 74 20 74 65  loop for next te
7960: 73 74 20 69 6e 20 71 75 65 75 65 0a 20 20 20 20  st in queue.    
7970: 3b 3b 20 46 49 58 4d 45 21 21 21 21 20 54 48 49  ;; FIXME!!!! THI
7980: 53 20 53 48 4f 55 4c 44 20 4e 4f 54 20 52 45 51  S SHOULD NOT REQ
7990: 55 49 52 45 20 41 4e 20 45 58 49 54 21 21 21 21  UIRE AN EXIT!!!!
79a0: 21 21 21 0a 20 20 20 20 0a 20 20 20 20 28 64 65  !!!.    .    (de
79b0: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31  bug:print-info 1
79c0: 20 22 41 6c 6c 20 74 65 73 74 73 20 6c 61 75 6e   "All tests laun
79d0: 63 68 65 64 22 29 0a 20 20 20 20 28 74 68 72 65  ched").    (thre
79e0: 61 64 2d 73 6c 65 65 70 21 20 30 2e 35 29 0a 20  ad-sleep! 0.5). 
79f0: 20 20 20 3b 3b 20 46 49 58 4d 45 21 20 54 68 69     ;; FIXME! Thi
7a00: 73 20 68 61 72 73 68 20 65 78 69 74 20 73 68 6f  s harsh exit sho
7a10: 75 6c 64 20 6e 6f 74 20 62 65 20 6e 65 63 65 73  uld not be neces
7a20: 73 61 72 79 2e 2e 2e 2e 0a 20 20 20 20 3b 3b 20  sary.....    ;; 
7a30: 28 69 66 20 28 6e 6f 74 20 2a 72 75 6e 72 65 6d  (if (not *runrem
7a40: 6f 74 65 2a 29 28 65 78 69 74 29 29 20 3b 3b 20  ote*)(exit)) ;; 
7a50: 0a 20 20 20 20 23 66 29 29 20 3b 3b 20 72 65 74  .    #f)) ;; ret
7a60: 75 72 6e 20 61 20 23 66 20 61 73 20 61 20 68 69  urn a #f as a hi
7a70: 6e 74 20 74 68 61 74 20 77 65 20 61 72 65 20 64  nt that we are d
7a80: 6f 6e 65 0a 20 20 3b 3b 20 48 65 72 65 20 77 65  one.  ;; Here we
7a90: 20 6e 65 65 64 20 74 6f 20 63 68 65 63 6b 20 74   need to check t
7aa0: 68 61 74 20 61 6c 6c 20 74 68 65 20 74 65 73 74  hat all the test
7ab0: 73 20 72 65 6d 61 69 6e 69 6e 67 20 74 6f 20 62  s remaining to b
7ac0: 65 20 72 75 6e 20 61 72 65 20 65 6c 69 67 69 62  e run are eligib
7ad0: 6c 65 20 74 6f 20 72 75 6e 0a 20 20 3b 3b 20 61  le to run.  ;; a
7ae0: 6e 64 20 61 72 65 20 6e 6f 74 20 62 6c 6f 63 6b  nd are not block
7af0: 65 64 20 62 79 20 66 61 69 6c 65 64 0a 20 20 0a  ed by failed.  .
7b00: 0a 3b 3b 20 70 61 72 65 6e 74 2d 74 65 73 74 20  .;; parent-test 
7b10: 69 73 20 74 68 65 72 65 20 61 73 20 61 20 70 6c  is there as a pl
7b20: 61 63 65 68 6f 6c 64 65 72 20 66 6f 72 20 77 68  aceholder for wh
7b30: 65 6e 20 70 61 72 65 6e 74 2d 74 65 73 74 73 20  en parent-tests 
7b40: 63 61 6e 20 62 65 20 72 75 6e 20 61 73 20 61 20  can be run as a 
7b50: 73 65 74 75 70 20 73 74 65 70 0a 28 64 65 66 69  setup step.(defi
7b60: 6e 65 20 28 72 75 6e 3a 74 65 73 74 20 72 75 6e  ne (run:test run
7b70: 2d 69 64 20 72 75 6e 6e 61 6d 65 20 6b 65 79 76  -id runname keyv
7b80: 61 6c 6c 73 74 20 74 65 73 74 2d 72 65 63 6f 72  allst test-recor
7b90: 64 20 66 6c 61 67 73 20 70 61 72 65 6e 74 2d 74  d flags parent-t
7ba0: 65 73 74 29 0a 20 20 3b 3b 20 41 6c 6c 20 74 68  est).  ;; All th
7bb0: 65 73 65 20 76 61 72 73 20 6d 69 67 68 74 20 62  ese vars might b
7bc0: 65 20 72 65 66 65 72 65 6e 63 65 64 20 62 79 20  e referenced by 
7bd0: 74 68 65 20 74 65 73 74 63 6f 6e 66 69 67 20 66  the testconfig f
7be0: 69 6c 65 20 72 65 61 64 65 72 0a 20 20 28 6c 65  ile reader.  (le
7bf0: 74 2a 20 28 28 74 65 73 74 2d 6e 61 6d 65 20 20  t* ((test-name  
7c00: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65    (tests:testque
7c10: 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20  ue-get-testname 
7c20: 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a    test-record)).
7c30: 09 20 28 74 65 73 74 2d 77 61 69 74 6f 6e 73 20  . (test-waitons 
7c40: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65  (tests:testqueue
7c50: 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20 20 20 20  -get-waitons    
7c60: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20  test-record)).. 
7c70: 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 20 28 74  (test-conf    (t
7c80: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67  ests:testqueue-g
7c90: 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 74 65  et-testconfig te
7ca0: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 69  st-record)).. (i
7cb0: 74 65 6d 64 61 74 20 20 20 20 20 20 28 74 65 73  temdat      (tes
7cc0: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
7cd0: 2d 69 74 65 6d 64 61 74 20 20 20 20 74 65 73 74  -itemdat    test
7ce0: 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65 73  -record)).. (tes
7cf0: 74 2d 70 61 74 68 20 20 20 20 28 63 6f 6e 63 20  t-path    (conc 
7d00: 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74  *toppath* "/test
7d10: 73 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29 29 20  s/" test-name)) 
7d20: 3b 3b 20 63 6f 75 6c 64 20 75 73 65 20 74 65 73  ;; could use tes
7d30: 74 73 3a 67 65 74 2d 74 65 73 74 63 6f 6e 66 69  ts:get-testconfi
7d40: 67 20 68 65 72 65 20 2e 2e 2e 0a 09 20 28 66 6f  g here ..... (fo
7d50: 72 63 65 20 20 20 20 20 20 20 20 28 68 61 73 68  rce        (hash
7d60: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75  -table-ref/defau
7d70: 6c 74 20 66 6c 61 67 73 20 22 2d 66 6f 72 63 65  lt flags "-force
7d80: 22 20 23 66 29 29 0a 09 20 28 72 65 72 75 6e 20  " #f)).. (rerun 
7d90: 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 62         (hash-tab
7da0: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66  le-ref/default f
7db0: 6c 61 67 73 20 22 2d 72 65 72 75 6e 22 20 23 66  lags "-rerun" #f
7dc0: 29 29 0a 09 20 28 6b 65 65 70 67 6f 69 6e 67 20  )).. (keepgoing 
7dd0: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72     (hash-table-r
7de0: 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73  ef/default flags
7df0: 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 20 23 66   "-keepgoing" #f
7e00: 29 29 0a 09 20 28 69 74 65 6d 2d 70 61 74 68 20  )).. (item-path 
7e10: 20 20 20 20 22 22 29 0a 09 20 28 64 62 20 20 20      "").. (db   
7e20: 20 20 20 20 20 20 20 20 23 66 29 29 0a 20 20 20          #f)).   
7e30: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 0a   (debug:print 4.
7e40: 09 09 20 22 74 65 73 74 2d 63 6f 6e 66 69 67 3a  .. "test-config:
7e50: 20 22 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e   " (hash-table->
7e60: 61 6c 69 73 74 20 74 65 73 74 2d 63 6f 6e 66 29  alist test-conf)
7e70: 0a 09 09 20 22 5c 6e 20 20 20 69 74 65 6d 64 61  ... "\n   itemda
7e80: 74 3a 20 22 20 69 74 65 6d 64 61 74 0a 09 09 20  t: " itemdat... 
7e90: 29 0a 20 20 20 20 3b 3b 20 73 65 74 74 69 6e 67  ).    ;; setting
7ea0: 20 69 74 65 6d 64 61 74 20 74 6f 20 61 20 6c 69   itemdat to a li
7eb0: 73 74 20 69 66 20 69 74 20 69 73 20 23 66 0a 20  st if it is #f. 
7ec0: 20 20 20 28 69 66 20 28 6e 6f 74 20 69 74 65 6d     (if (not item
7ed0: 64 61 74 29 28 73 65 74 21 20 69 74 65 6d 64 61  dat)(set! itemda
7ee0: 74 20 27 28 29 29 29 0a 20 20 20 20 28 73 65 74  t '())).    (set
7ef0: 21 20 69 74 65 6d 2d 70 61 74 68 20 28 69 74 65  ! item-path (ite
7f00: 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 65  m-list->path ite
7f10: 6d 64 61 74 29 29 0a 20 20 20 20 28 64 65 62 75  mdat)).    (debu
7f20: 67 3a 70 72 69 6e 74 20 32 20 22 41 74 74 65 6d  g:print 2 "Attem
7f30: 70 74 69 6e 67 20 74 6f 20 6c 61 75 6e 63 68 20  pting to launch 
7f40: 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65  test " test-name
7f50: 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65   (if (equal? ite
7f60: 6d 2d 70 61 74 68 20 22 2f 22 29 20 22 2f 22 20  m-path "/") "/" 
7f70: 69 74 65 6d 2d 70 61 74 68 29 29 0a 20 20 20 20  item-path)).    
7f80: 28 73 65 74 65 6e 76 20 22 4d 54 5f 54 45 53 54  (setenv "MT_TEST
7f90: 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65  _NAME" test-name
7fa0: 29 20 3b 3b 20 0a 20 20 20 20 28 73 65 74 65 6e  ) ;; .    (seten
7fb0: 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20  v "MT_RUNNAME"  
7fc0: 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20 28 73   runname).    (s
7fd0: 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d  et-megatest-env-
7fe0: 76 61 72 73 20 72 75 6e 2d 69 64 29 20 3b 3b 20  vars run-id) ;; 
7ff0: 74 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65  these may be nee
8000: 64 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63  ded by the launc
8010: 68 69 6e 67 20 70 72 6f 63 65 73 73 0a 20 20 20  hing process.   
8020: 20 28 63 68 61 6e 67 65 2d 64 69 72 65 63 74 6f   (change-directo
8030: 72 79 20 2a 74 6f 70 70 61 74 68 2a 29 0a 0a 20  ry *toppath*).. 
8040: 20 20 20 3b 3b 20 48 65 72 65 20 69 73 20 77 68     ;; Here is wh
8050: 65 72 65 20 74 68 65 20 74 65 73 74 5f 6d 65 74  ere the test_met
8060: 61 20 74 61 62 6c 65 20 69 73 20 62 65 73 74 20  a table is best 
8070: 75 70 64 61 74 65 64 0a 20 20 20 20 3b 3b 20 59  updated.    ;; Y
8080: 65 73 2c 20 61 6e 6f 74 68 65 72 20 75 73 65 20  es, another use 
8090: 6f 66 20 61 20 67 6c 6f 62 61 6c 20 66 6f 72 20  of a global for 
80a0: 63 61 63 68 69 6e 67 2e 20 4e 65 65 64 20 61 20  caching. Need a 
80b0: 62 65 74 74 65 72 20 77 61 79 3f 0a 20 20 20 20  better way?.    
80c0: 28 69 66 20 28 6e 6f 74 20 28 68 61 73 68 2d 74  (if (not (hash-t
80d0: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74  able-ref/default
80e0: 20 2a 74 65 73 74 2d 6d 65 74 61 2d 75 70 64 61   *test-meta-upda
80f0: 74 65 64 2a 20 74 65 73 74 2d 6e 61 6d 65 20 23  ted* test-name #
8100: 66 29 29 0a 20 20 20 20 20 20 20 20 28 62 65 67  f)).        (beg
8110: 69 6e 0a 09 20 20 20 28 68 61 73 68 2d 74 61 62  in..   (hash-tab
8120: 6c 65 2d 73 65 74 21 20 2a 74 65 73 74 2d 6d 65  le-set! *test-me
8130: 74 61 2d 75 70 64 61 74 65 64 2a 20 74 65 73 74  ta-updated* test
8140: 2d 6e 61 6d 65 20 23 74 29 0a 20 20 20 20 20 20  -name #t).      
8150: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
8160: 6c 6f 73 65 20 72 75 6e 73 3a 75 70 64 61 74 65  lose runs:update
8170: 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20 74 65  -test_meta db te
8180: 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e  st-name test-con
8190: 66 29 29 29 0a 20 20 20 20 0a 20 20 20 20 3b 3b  f))).    .    ;;
81a0: 20 28 6c 61 6d 62 64 61 20 28 69 74 65 6d 64 61   (lambda (itemda
81b0: 74 29 20 3b 3b 3b 20 28 28 72 69 70 65 6e 65 73  t) ;;; ((ripenes
81c0: 73 20 22 6f 76 65 72 72 69 70 65 22 29 20 28 74  s "overripe") (t
81d0: 65 6d 70 65 72 61 74 75 72 65 20 22 63 6f 6f 6c  emperature "cool
81e0: 22 29 20 28 73 65 61 73 6f 6e 20 22 73 75 6d 6d  ") (season "summ
81f0: 65 72 22 29 29 0a 20 20 20 20 28 6c 65 74 2a 20  er")).    (let* 
8200: 28 28 6e 65 77 2d 74 65 73 74 2d 70 61 74 68 20  ((new-test-path 
8210: 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65  (string-interspe
8220: 72 73 65 20 28 63 6f 6e 73 20 74 65 73 74 2d 70  rse (cons test-p
8230: 61 74 68 20 28 6d 61 70 20 63 61 64 72 20 69 74  ath (map cadr it
8240: 65 6d 64 61 74 29 29 20 22 2f 22 29 29 0a 09 20  emdat)) "/")).. 
8250: 20 20 28 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65    (new-test-name
8260: 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65   (if (equal? ite
8270: 6d 2d 70 61 74 68 20 22 22 29 20 74 65 73 74 2d  m-path "") test-
8280: 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 2d  name (conc test-
8290: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61  name "/" item-pa
82a0: 74 68 29 29 29 20 3b 3b 20 6a 75 73 74 20 6e 65  th))) ;; just ne
82b0: 65 64 20 69 74 20 74 6f 20 62 65 20 75 6e 69 71  ed it to be uniq
82c0: 75 65 0a 09 20 20 20 28 74 65 73 74 2d 69 64 20  ue..   (test-id 
82d0: 20 20 20 20 20 20 28 63 64 62 3a 72 65 6d 6f 74        (cdb:remot
82e0: 65 2d 72 75 6e 20 64 62 3a 67 65 74 2d 74 65 73  e-run db:get-tes
82f0: 74 2d 69 64 20 23 66 20 20 72 75 6e 2d 69 64 20  t-id #f  run-id 
8300: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70  test-name item-p
8310: 61 74 68 29 29 0a 09 20 20 20 28 74 65 73 74 64  ath))..   (testd
8320: 61 74 20 20 20 20 20 20 20 28 63 64 62 3a 67 65  at       (cdb:ge
8330: 74 2d 74 65 73 74 2d 69 6e 66 6f 2d 62 79 2d 69  t-test-info-by-i
8340: 64 20 2a 72 75 6e 72 65 6d 6f 74 65 2a 20 74 65  d *runremote* te
8350: 73 74 2d 69 64 29 29 29 0a 20 20 20 20 20 20 28  st-id))).      (
8360: 69 66 20 28 6e 6f 74 20 74 65 73 74 64 61 74 29  if (not testdat)
8370: 0a 09 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20  ..  (begin..    
8380: 3b 3b 20 65 6e 73 75 72 65 20 74 68 61 74 20 74  ;; ensure that t
8390: 68 65 20 70 61 74 68 20 65 78 69 73 74 73 20 62  he path exists b
83a0: 65 66 6f 72 65 20 72 65 67 69 73 74 65 72 69 6e  efore registerin
83b0: 67 20 74 68 65 20 74 65 73 74 0a 09 20 20 20 20  g the test..    
83c0: 3b 3b 20 4e 4f 50 45 3a 20 43 61 6e 6e 6f 74 21  ;; NOPE: Cannot!
83d0: 20 44 6f 6e 27 74 20 6b 6e 6f 77 20 79 65 74 20   Don't know yet 
83e0: 77 68 69 63 68 20 64 69 73 6b 20 61 72 65 61 20  which disk area 
83f0: 77 69 6c 6c 20 62 65 20 61 73 73 69 67 6e 65 64  will be assigned
8400: 2e 2e 2e 2e 0a 09 20 20 20 20 3b 3b 20 28 73 79  ......    ;; (sy
8410: 73 74 65 6d 20 28 63 6f 6e 63 20 22 6d 6b 64 69  stem (conc "mkdi
8420: 72 20 2d 70 20 22 20 6e 65 77 2d 74 65 73 74 2d  r -p " new-test-
8430: 70 61 74 68 29 29 0a 09 20 20 20 20 3b 3b 0a 09  path))..    ;;..
8440: 20 20 20 20 3b 3b 20 28 6f 70 65 6e 2d 72 75 6e      ;; (open-run
8450: 2d 63 6c 6f 73 65 20 74 65 73 74 73 3a 72 65 67  -close tests:reg
8460: 69 73 74 65 72 2d 74 65 73 74 20 64 62 20 72 75  ister-test db ru
8470: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69  n-id test-name i
8480: 74 65 6d 2d 70 61 74 68 29 0a 09 20 20 20 20 3b  tem-path)..    ;
8490: 3b 0a 09 20 20 20 20 3b 3b 20 4e 42 2f 2f 20 66  ;..    ;; NB// f
84a0: 6f 72 20 74 68 65 20 61 62 6f 76 65 20 6c 69 6e  or the above lin
84b0: 65 2e 20 49 20 77 61 6e 74 20 74 68 65 20 74 65  e. I want the te
84c0: 73 74 20 74 6f 20 62 65 20 72 65 67 69 73 74 65  st to be registe
84d0: 72 65 64 20 6c 6f 6e 67 20 62 65 66 6f 72 65 20  red long before 
84e0: 74 68 69 73 20 72 6f 75 74 69 6e 65 20 67 65 74  this routine get
84f0: 73 20 63 61 6c 6c 65 64 21 0a 09 20 20 20 20 3b  s called!..    ;
8500: 3b 0a 09 20 20 20 20 28 73 65 74 21 20 74 65 73  ;..    (set! tes
8510: 74 2d 69 64 20 28 6f 70 65 6e 2d 72 75 6e 2d 63  t-id (open-run-c
8520: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74  lose db:get-test
8530: 2d 69 64 20 64 62 20 72 75 6e 2d 69 64 20 74 65  -id db run-id te
8540: 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74  st-name item-pat
8550: 68 29 29 0a 09 20 20 20 20 28 69 66 20 28 6e 6f  h))..    (if (no
8560: 74 20 74 65 73 74 2d 69 64 29 0a 09 09 28 62 65  t test-id)...(be
8570: 67 69 6e 0a 09 09 20 20 28 64 65 62 75 67 3a 70  gin...  (debug:p
8580: 72 69 6e 74 20 32 20 22 57 41 52 4e 3a 20 54 65  rint 2 "WARN: Te
8590: 73 74 20 6e 6f 74 20 70 72 65 2d 63 72 65 61 74  st not pre-creat
85a0: 65 64 3f 20 74 65 73 74 2d 6e 61 6d 65 3d 22 20  ed? test-name=" 
85b0: 74 65 73 74 2d 6e 61 6d 65 20 22 2c 20 69 74 65  test-name ", ite
85c0: 6d 2d 70 61 74 68 3d 22 20 69 74 65 6d 2d 70 61  m-path=" item-pa
85d0: 74 68 20 22 2c 20 72 75 6e 2d 69 64 3d 22 20 72  th ", run-id=" r
85e0: 75 6e 2d 69 64 29 0a 09 09 20 20 28 63 64 62 3a  un-id)...  (cdb:
85f0: 74 65 73 74 73 2d 72 65 67 69 73 74 65 72 2d 74  tests-register-t
8600: 65 73 74 20 2a 72 75 6e 72 65 6d 6f 74 65 2a 20  est *runremote* 
8610: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65  run-id test-name
8620: 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 09 20 20   item-path)...  
8630: 28 73 65 74 21 20 74 65 73 74 2d 69 64 20 28 6f  (set! test-id (o
8640: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62  pen-run-close db
8650: 3a 67 65 74 2d 74 65 73 74 2d 69 64 20 64 62 20  :get-test-id db 
8660: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65  run-id test-name
8670: 20 69 74 65 6d 2d 70 61 74 68 29 29 29 29 0a 09   item-path))))..
8680: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
8690: 2d 69 6e 66 6f 20 34 20 22 74 65 73 74 2d 69 64  -info 4 "test-id
86a0: 3d 22 20 74 65 73 74 2d 69 64 20 22 2c 20 72 75  =" test-id ", ru
86b0: 6e 2d 69 64 3d 22 20 72 75 6e 2d 69 64 20 22 2c  n-id=" run-id ",
86c0: 20 74 65 73 74 2d 6e 61 6d 65 3d 22 20 74 65 73   test-name=" tes
86d0: 74 2d 6e 61 6d 65 20 22 2c 20 69 74 65 6d 2d 70  t-name ", item-p
86e0: 61 74 68 3d 5c 22 22 20 69 74 65 6d 2d 70 61 74  ath=\"" item-pat
86f0: 68 20 22 5c 22 22 29 0a 09 20 20 20 20 28 73 65  h "\"")..    (se
8700: 74 21 20 74 65 73 74 64 61 74 20 28 63 64 62 3a  t! testdat (cdb:
8710: 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 2d 62 79  get-test-info-by
8720: 2d 69 64 20 2a 72 75 6e 72 65 6d 6f 74 65 2a 20  -id *runremote* 
8730: 74 65 73 74 2d 69 64 29 29 29 29 0a 20 20 20 20  test-id)))).    
8740: 20 20 28 73 65 74 21 20 74 65 73 74 2d 69 64 20    (set! test-id 
8750: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20  (db:test-get-id 
8760: 74 65 73 74 64 61 74 29 29 0a 20 20 20 20 20 20  testdat)).      
8770: 28 63 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72  (change-director
8780: 79 20 74 65 73 74 2d 70 61 74 68 29 0a 20 20 20  y test-path).   
8790: 20 20 20 28 63 61 73 65 20 28 69 66 20 66 6f 72     (case (if for
87a0: 63 65 20 3b 3b 20 28 61 72 67 73 3a 67 65 74 2d  ce ;; (args:get-
87b0: 61 72 67 20 22 2d 66 6f 72 63 65 22 29 0a 09 09  arg "-force")...
87c0: 27 4e 4f 54 5f 53 54 41 52 54 45 44 0a 09 09 28  'NOT_STARTED...(
87d0: 69 66 20 74 65 73 74 64 61 74 0a 09 09 20 20 20  if testdat...   
87e0: 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c   (string->symbol
87f0: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65   (test:get-state
8800: 20 74 65 73 74 64 61 74 29 29 0a 09 09 20 20 20   testdat))...   
8810: 20 27 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65   'failed-to-inse
8820: 72 74 29 29 0a 09 28 28 66 61 69 6c 65 64 2d 74  rt))..((failed-t
8830: 6f 2d 69 6e 73 65 72 74 29 0a 09 20 28 64 65 62  o-insert).. (deb
8840: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f  ug:print 0 "ERRO
8850: 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 69 6e 73  R: Failed to ins
8860: 65 72 74 20 74 68 65 20 72 65 63 6f 72 64 20 69  ert the record i
8870: 6e 74 6f 20 74 68 65 20 64 62 22 29 29 0a 09 28  nto the db"))..(
8880: 28 4e 4f 54 5f 53 54 41 52 54 45 44 20 43 4f 4d  (NOT_STARTED COM
8890: 50 4c 45 54 45 44 20 44 45 4c 45 54 45 44 29 0a  PLETED DELETED).
88a0: 09 20 28 6c 65 74 20 28 28 72 75 6e 66 6c 61 67  . (let ((runflag
88b0: 20 23 66 29 29 0a 09 20 20 20 28 63 6f 6e 64 0a   #f))..   (cond.
88c0: 09 20 20 20 20 3b 3b 20 2d 66 6f 72 63 65 2c 20  .    ;; -force, 
88d0: 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77 68  run no matter wh
88e0: 61 74 0a 09 20 20 20 20 28 66 6f 72 63 65 20 28  at..    (force (
88f0: 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29  set! runflag #t)
8900: 29 0a 09 20 20 20 20 3b 3b 20 4e 4f 54 5f 53 54  )..    ;; NOT_ST
8910: 41 52 54 45 44 2c 20 72 75 6e 20 6e 6f 20 6d 61  ARTED, run no ma
8920: 74 74 65 72 20 77 68 61 74 0a 09 20 20 20 20 28  tter what..    (
8930: 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65  (member (test:ge
8940: 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29  t-state testdat)
8950: 20 27 28 22 44 45 4c 45 54 45 44 22 20 22 4e 4f   '("DELETED" "NO
8960: 54 5f 53 54 41 52 54 45 44 22 29 29 28 73 65 74  T_STARTED"))(set
8970: 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09  ! runflag #t))..
8980: 20 20 20 20 3b 3b 20 6e 6f 74 20 2d 72 65 72 75      ;; not -reru
8990: 6e 20 61 6e 64 20 50 41 53 53 2c 20 57 41 52 4e  n and PASS, WARN
89a0: 20 6f 72 20 43 48 45 43 4b 2c 20 64 6f 20 6e 6f   or CHECK, do no
89b0: 20 72 75 6e 0a 09 20 20 20 20 28 28 61 6e 64 20   run..    ((and 
89c0: 28 6f 72 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a  (or (not rerun).
89d0: 09 09 20 20 20 20 20 20 6b 65 65 70 67 6f 69 6e  ..      keepgoin
89e0: 67 29 0a 09 09 20 20 3b 3b 20 52 65 71 75 69 72  g)...  ;; Requir
89f0: 65 20 74 6f 20 66 6f 72 63 65 20 72 65 2d 72 75  e to force re-ru
8a00: 6e 20 66 6f 72 20 43 4f 4d 50 4c 45 54 45 44 20  n for COMPLETED 
8a10: 6f 72 20 2a 61 6e 79 74 68 69 6e 67 2a 20 2b 20  or *anything* + 
8a20: 50 41 53 53 2c 57 41 52 4e 20 6f 72 20 43 48 45  PASS,WARN or CHE
8a30: 43 4b 0a 09 09 20 20 28 6f 72 20 28 6d 65 6d 62  CK...  (or (memb
8a40: 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61  er (test:get-sta
8a50: 74 75 73 20 74 65 73 74 64 61 74 29 20 27 28 22  tus testdat) '("
8a60: 50 41 53 53 22 20 22 57 41 52 4e 22 20 22 43 48  PASS" "WARN" "CH
8a70: 45 43 4b 22 20 22 53 4b 49 50 22 29 29 0a 09 09  ECK" "SKIP"))...
8a80: 20 20 20 20 20 20 28 6d 65 6d 62 65 72 20 28 74        (member (t
8a90: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 20 74  est:get-state  t
8aa0: 65 73 74 64 61 74 29 20 27 28 22 43 4f 4d 50 4c  estdat) '("COMPL
8ab0: 45 54 45 44 22 29 29 29 29 20 0a 09 20 20 20 20  ETED")))) ..    
8ac0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
8ad0: 66 6f 20 32 20 22 72 75 6e 6e 69 6e 67 20 74 65  fo 2 "running te
8ae0: 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22  st " test-name "
8af0: 2f 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20 73  /" item-path " s
8b00: 75 70 70 72 65 73 73 65 64 20 61 73 20 69 74 20  uppressed as it 
8b10: 69 73 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73  is " (test:get-s
8b20: 74 61 74 65 20 74 65 73 74 64 61 74 29 20 22 20  tate testdat) " 
8b30: 61 6e 64 20 22 20 28 74 65 73 74 3a 67 65 74 2d  and " (test:get-
8b40: 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 29  status testdat))
8b50: 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 75 6e  ..     (set! run
8b60: 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20 20 3b  flag #f))..    ;
8b70: 3b 20 2d 72 65 72 75 6e 20 61 6e 64 20 73 74 61  ; -rerun and sta
8b80: 74 75 73 20 69 73 20 6f 6e 65 20 6f 66 20 74 68  tus is one of th
8b90: 65 20 73 70 65 63 69 66 65 64 2c 20 72 75 6e 20  e specifed, run 
8ba0: 69 74 0a 09 20 20 20 20 28 28 61 6e 64 20 72 65  it..    ((and re
8bb0: 72 75 6e 0a 09 09 20 20 28 6c 65 74 2a 20 28 28  run...  (let* ((
8bc0: 72 65 72 75 6e 6c 73 74 20 20 20 28 73 74 72 69  rerunlst   (stri
8bd0: 6e 67 2d 73 70 6c 69 74 20 72 65 72 75 6e 20 22  ng-split rerun "
8be0: 2c 22 29 29 0a 09 09 09 20 28 6d 75 73 74 2d 72  ,")).... (must-r
8bf0: 65 72 75 6e 20 28 6d 65 6d 62 65 72 20 28 74 65  erun (member (te
8c00: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65  st:get-status te
8c10: 73 74 64 61 74 29 20 72 65 72 75 6e 6c 73 74 29  stdat) rerunlst)
8c20: 29 29 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a  ))...    (debug:
8c30: 70 72 69 6e 74 2d 69 6e 66 6f 20 33 20 22 2d 72  print-info 3 "-r
8c40: 65 72 75 6e 20 6c 69 73 74 3a 20 22 20 72 65 72  erun list: " rer
8c50: 75 6e 20 22 2c 20 74 65 73 74 2d 73 74 61 74 75  un ", test-statu
8c60: 73 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73  s: " (test:get-s
8c70: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 22 2c  tatus testdat)",
8c80: 20 6d 75 73 74 2d 72 65 72 75 6e 3a 20 22 20 6d   must-rerun: " m
8c90: 75 73 74 2d 72 65 72 75 6e 29 0a 09 09 20 20 20  ust-rerun)...   
8ca0: 20 6d 75 73 74 2d 72 65 72 75 6e 29 29 0a 09 20   must-rerun)).. 
8cb0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
8cc0: 2d 69 6e 66 6f 20 32 20 22 52 65 72 75 6e 20 66  -info 2 "Rerun f
8cd0: 6f 72 63 65 64 20 66 6f 72 20 74 65 73 74 20 22  orced for test "
8ce0: 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69   test-name "/" i
8cf0: 74 65 6d 2d 70 61 74 68 29 0a 09 20 20 20 20 20  tem-path)..     
8d00: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74  (set! runflag #t
8d10: 29 29 0a 09 20 20 20 20 3b 3b 20 2d 6b 65 65 70  ))..    ;; -keep
8d20: 67 6f 69 6e 67 2c 20 64 6f 20 6e 6f 74 20 72 65  going, do not re
8d30: 72 75 6e 20 46 41 49 4c 0a 09 20 20 20 20 28 28  run FAIL..    ((
8d40: 61 6e 64 20 6b 65 65 70 67 6f 69 6e 67 0a 09 09  and keepgoing...
8d50: 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a    (member (test:
8d60: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64  get-status testd
8d70: 61 74 29 20 27 28 22 46 41 49 4c 22 29 29 29 0a  at) '("FAIL"))).
8d80: 09 20 20 20 20 20 28 73 65 74 21 20 72 75 6e 66  .     (set! runf
8d90: 6c 61 67 20 23 66 29 29 0a 09 20 20 20 20 28 28  lag #f))..    ((
8da0: 61 6e 64 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a  and (not rerun).
8db0: 09 09 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73  ..  (member (tes
8dc0: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73  t:get-status tes
8dd0: 74 64 61 74 29 20 27 28 22 46 41 49 4c 22 20 22  tdat) '("FAIL" "
8de0: 6e 2f 61 22 29 29 29 0a 09 20 20 20 20 20 28 73  n/a")))..     (s
8df0: 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29  et! runflag #t))
8e00: 0a 09 20 20 20 20 28 65 6c 73 65 20 28 73 65 74  ..    (else (set
8e10: 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 29 0a  ! runflag #f))).
8e20: 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74  .   (debug:print
8e30: 20 36 20 22 52 55 4e 4e 49 4e 47 20 3d 3e 20 72   6 "RUNNING => r
8e40: 75 6e 66 6c 61 67 3a 20 22 20 72 75 6e 66 6c 61  unflag: " runfla
8e50: 67 20 22 20 53 54 41 54 45 3a 20 22 20 28 74 65  g " STATE: " (te
8e60: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73  st:get-state tes
8e70: 74 64 61 74 29 20 22 20 53 54 41 54 55 53 3a 20  tdat) " STATUS: 
8e80: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  " (test:get-stat
8e90: 75 73 20 74 65 73 74 64 61 74 29 29 0a 09 20 20  us testdat))..  
8ea0: 20 28 69 66 20 28 6e 6f 74 20 72 75 6e 66 6c 61   (if (not runfla
8eb0: 67 29 0a 09 20 20 20 20 20 20 20 28 69 66 20 28  g)..       (if (
8ec0: 6e 6f 74 20 70 61 72 65 6e 74 2d 74 65 73 74 29  not parent-test)
8ed0: 0a 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 69  ...   (debug:pri
8ee0: 6e 74 20 31 20 22 4e 4f 54 45 3a 20 4e 6f 74 20  nt 1 "NOTE: Not 
8ef0: 73 74 61 72 74 69 6e 67 20 74 65 73 74 20 22 20  starting test " 
8f00: 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20  new-test-name " 
8f10: 61 73 20 69 74 20 69 73 20 73 74 61 74 65 20 5c  as it is state \
8f20: 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61  "" (test:get-sta
8f30: 74 65 20 74 65 73 74 64 61 74 29 20 0a 09 09 09  te testdat) ....
8f40: 09 22 5c 22 20 61 6e 64 20 73 74 61 74 75 73 20  ."\" and status 
8f50: 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74  \"" (test:get-st
8f60: 61 74 75 73 20 74 65 73 74 64 61 74 29 20 22 5c  atus testdat) "\
8f70: 22 2c 20 75 73 65 20 2d 72 65 72 75 6e 20 5c 22  ", use -rerun \"
8f80: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  " (test:get-stat
8f90: 75 73 20 74 65 73 74 64 61 74 29 0a 20 20 20 20  us testdat).    
8fa0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
8fb0: 20 20 20 20 20 20 20 20 20 20 20 20 22 5c 22 20              "\" 
8fc0: 6f 72 20 2d 66 6f 72 63 65 20 74 6f 20 6f 76 65  or -force to ove
8fd0: 72 72 69 64 65 22 29 29 0a 09 20 20 20 20 20 20  rride"))..      
8fe0: 20 3b 3b 20 4e 4f 54 45 3a 20 4e 6f 20 6c 6f 6e   ;; NOTE: No lon
8ff0: 67 65 72 20 62 65 20 63 68 65 63 6b 69 6e 67 20  ger be checking 
9000: 70 72 65 72 65 71 75 69 73 69 74 65 73 20 68 65  prerequisites he
9010: 72 65 21 20 57 69 6c 6c 20 6e 65 76 65 72 20 67  re! Will never g
9020: 65 74 20 68 65 72 65 20 75 6e 6c 65 73 73 20 70  et here unless p
9030: 72 65 72 65 71 73 20 61 72 65 0a 09 20 20 20 20  rereqs are..    
9040: 20 20 20 3b 3b 20 20 20 20 20 20 20 61 6c 72 65     ;;       alre
9050: 61 64 79 20 6d 65 74 2e 0a 09 20 20 20 20 20 20  ady met...      
9060: 20 3b 3b 20 54 68 69 73 20 77 6f 75 6c 64 20 62   ;; This would b
9070: 65 20 61 20 67 72 65 61 74 20 70 6c 61 63 65 20  e a great place 
9080: 74 6f 20 64 6f 20 74 68 65 20 70 72 6f 63 65 73  to do the proces
9090: 73 2d 66 6f 72 6b 0a 09 20 20 20 20 20 20 20 28  s-fork..       (
90a0: 69 66 20 28 6e 6f 74 20 28 6c 61 75 6e 63 68 2d  if (not (launch-
90b0: 74 65 73 74 20 23 66 20 72 75 6e 2d 69 64 20 72  test #f run-id r
90c0: 75 6e 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66  unname test-conf
90d0: 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 73 74 2d   keyvallst test-
90e0: 6e 61 6d 65 20 74 65 73 74 2d 70 61 74 68 20 69  name test-path i
90f0: 74 65 6d 64 61 74 20 66 6c 61 67 73 29 29 0a 09  temdat flags))..
9100: 09 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20  .   (begin...   
9110: 20 20 28 70 72 69 6e 74 20 22 45 52 52 4f 52 3a    (print "ERROR:
9120: 20 46 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63   Failed to launc
9130: 68 20 74 68 65 20 74 65 73 74 2e 20 45 78 69 74  h the test. Exit
9140: 69 6e 67 20 61 73 20 73 6f 6f 6e 20 61 73 20 70  ing as soon as p
9150: 6f 73 73 69 62 6c 65 22 29 0a 09 09 20 20 20 20  ossible")...    
9160: 20 28 73 65 74 21 20 2a 67 6c 6f 62 61 6c 65 78   (set! *globalex
9170: 69 74 73 74 61 74 75 73 2a 20 31 29 20 3b 3b 20  itstatus* 1) ;; 
9180: 0a 09 09 20 20 20 20 20 28 70 72 6f 63 65 73 73  ...     (process
9190: 2d 73 69 67 6e 61 6c 20 28 63 75 72 72 65 6e 74  -signal (current
91a0: 2d 70 72 6f 63 65 73 73 2d 69 64 29 20 73 69 67  -process-id) sig
91b0: 6e 61 6c 2f 6b 69 6c 6c 29 29 29 29 29 29 0a 09  nal/kill))))))..
91c0: 28 28 4b 49 4c 4c 45 44 29 20 0a 09 20 28 64 65  ((KILLED) .. (de
91d0: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54  bug:print 1 "NOT
91e0: 45 3a 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61  E: " new-test-na
91f0: 6d 65 20 22 20 69 73 20 61 6c 72 65 61 64 79 20  me " is already 
9200: 72 75 6e 6e 69 6e 67 20 6f 72 20 77 61 73 20 65  running or was e
9210: 78 70 6c 69 63 74 6c 79 20 6b 69 6c 6c 65 64 2c  xplictly killed,
9220: 20 75 73 65 20 2d 66 6f 72 63 65 20 74 6f 20 6c   use -force to l
9230: 61 75 6e 63 68 20 69 74 2e 22 29 29 0a 09 28 28  aunch it."))..((
9240: 4c 41 55 4e 43 48 45 44 20 52 45 4d 4f 54 45 48  LAUNCHED REMOTEH
9250: 4f 53 54 53 54 41 52 54 20 52 55 4e 4e 49 4e 47  OSTSTART RUNNING
9260: 29 20 20 0a 09 20 28 69 66 20 28 3e 20 28 2d 20  )  .. (if (> (- 
9270: 28 63 75 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73  (current-seconds
9280: 29 28 2b 20 28 64 62 3a 74 65 73 74 2d 67 65 74  )(+ (db:test-get
9290: 2d 65 76 65 6e 74 5f 74 69 6d 65 20 74 65 73 74  -event_time test
92a0: 64 61 74 29 0a 09 09 09 09 20 20 20 20 20 20 20  dat).....       
92b0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e  (db:test-get-run
92c0: 5f 64 75 72 61 74 69 6f 6e 20 74 65 73 74 64 61  _duration testda
92d0: 74 29 29 29 0a 09 09 36 30 30 29 20 3b 3b 20 69  t)))...600) ;; i
92e0: 2e 65 2e 20 6e 6f 20 75 70 64 61 74 65 20 66 6f  .e. no update fo
92f0: 72 20 6d 6f 72 65 20 74 68 61 6e 20 36 30 30 20  r more than 600 
9300: 73 65 63 6f 6e 64 73 0a 09 20 20 20 20 20 28 62  seconds..     (b
9310: 65 67 69 6e 0a 09 20 20 20 20 20 20 20 28 64 65  egin..       (de
9320: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52  bug:print 0 "WAR
9330: 4e 49 4e 47 3a 20 54 65 73 74 20 22 20 74 65 73  NING: Test " tes
9340: 74 2d 6e 61 6d 65 20 22 20 61 70 70 65 61 72 73  t-name " appears
9350: 20 74 6f 20 62 65 20 64 65 61 64 2e 20 46 6f 72   to be dead. For
9360: 63 69 6e 67 20 69 74 20 74 6f 20 73 74 61 74 65  cing it to state
9370: 20 49 4e 43 4f 4d 50 4c 45 54 45 20 61 6e 64 20   INCOMPLETE and 
9380: 73 74 61 74 75 73 20 53 54 55 43 4b 2f 44 45 41  status STUCK/DEA
9390: 44 22 29 0a 09 20 20 20 20 20 20 20 28 74 65 73  D")..       (tes
93a0: 74 73 3a 74 65 73 74 2d 73 65 74 2d 73 74 61 74  ts:test-set-stat
93b0: 75 73 21 20 74 65 73 74 2d 69 64 20 22 49 4e 43  us! test-id "INC
93c0: 4f 4d 50 4c 45 54 45 22 20 22 53 54 55 43 4b 2f  OMPLETE" "STUCK/
93d0: 44 45 41 44 22 20 22 54 65 73 74 20 69 73 20 73  DEAD" "Test is s
93e0: 74 75 63 6b 20 6f 72 20 64 65 61 64 22 20 23 66  tuck or dead" #f
93f0: 29 29 0a 09 20 20 20 20 20 28 64 65 62 75 67 3a  ))..     (debug:
9400: 70 72 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 22  print 2 "NOTE: "
9410: 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 73 20   test-name " is 
9420: 61 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e 67 22  already running"
9430: 29 29 29 0a 09 28 65 6c 73 65 20 20 20 20 20 20  )))..(else      
9440: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
9450: 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74  "ERROR: Failed t
9460: 6f 20 6c 61 75 6e 63 68 20 74 65 73 74 20 22 20  o launch test " 
9470: 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 2e  new-test-name ".
9480: 20 55 6e 72 65 63 6f 67 6e 69 73 65 64 20 73 74   Unrecognised st
9490: 61 74 65 20 22 20 28 74 65 73 74 3a 67 65 74 2d  ate " (test:get-
94a0: 73 74 61 74 65 20 74 65 73 74 64 61 74 29 29 29  state testdat)))
94b0: 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d  ))))..;;========
94c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
94d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
94e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
94f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b  ==============.;
9500: 3b 20 45 4e 44 20 4f 46 20 4e 45 57 20 53 54 55  ; END OF NEW STU
9510: 46 46 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  FF.;;===========
9520: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9530: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9540: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9550: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65  ===========..(de
9560: 66 69 6e 65 20 28 67 65 74 2d 64 69 72 2d 75 70  fine (get-dir-up
9570: 2d 6e 20 64 69 72 20 2e 20 70 61 72 61 6d 73 29  -n dir . params)
9580: 20 0a 20 20 28 6c 65 74 20 28 28 64 70 61 72 74   .  (let ((dpart
9590: 73 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74  s  (string-split
95a0: 20 64 69 72 20 22 2f 22 29 29 0a 09 28 63 6f 75   dir "/"))..(cou
95b0: 6e 74 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20  nt   (if (null? 
95c0: 70 61 72 61 6d 73 29 20 31 20 28 63 61 72 20 70  params) 1 (car p
95d0: 61 72 61 6d 73 29 29 29 29 0a 20 20 20 20 28 63  arams)))).    (c
95e0: 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 6e 67 2d  onc "/" (string-
95f0: 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09 20 20  intersperse ..  
9600: 20 20 20 20 20 28 74 61 6b 65 20 64 70 61 72 74       (take dpart
9610: 73 20 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 61  s (- (length dpa
9620: 72 74 73 29 20 63 6f 75 6e 74 29 29 0a 09 20 20  rts) count))..  
9630: 20 20 20 20 20 22 2f 22 29 29 29 29 0a 3b 3b 20       "/")))).;; 
9640: 52 65 6d 6f 76 65 20 72 75 6e 73 0a 3b 3b 20 66  Remove runs.;; f
9650: 69 65 6c 64 73 20 61 72 65 20 70 61 73 73 69 6e  ields are passin
9660: 67 20 69 6e 20 74 68 72 6f 75 67 68 20 0a 3b 3b  g in through .;;
9670: 20 61 63 74 69 6f 6e 3a 0a 3b 3b 20 20 20 20 27   action:.;;    '
9680: 72 65 6d 6f 76 65 2d 72 75 6e 73 0a 3b 3b 20 20  remove-runs.;;  
9690: 20 20 27 73 65 74 2d 73 74 61 74 65 2d 73 74 61    'set-state-sta
96a0: 74 75 73 0a 3b 3b 0a 3b 3b 20 4e 42 2f 2f 20 73  tus.;;.;; NB// s
96b0: 68 6f 75 6c 64 20 70 61 73 73 20 69 6e 20 6b 65  hould pass in ke
96c0: 79 73 3f 0a 3b 3b 0a 28 64 65 66 69 6e 65 20 28  ys?.;;.(define (
96d0: 72 75 6e 73 3a 6f 70 65 72 61 74 65 2d 6f 6e 20  runs:operate-on 
96e0: 61 63 74 69 6f 6e 20 72 75 6e 6e 61 6d 65 70 61  action runnamepa
96f0: 74 74 20 74 65 73 74 70 61 74 74 20 23 21 6b 65  tt testpatt #!ke
9700: 79 20 28 73 74 61 74 65 20 23 66 29 28 73 74 61  y (state #f)(sta
9710: 74 75 73 20 23 66 29 28 6e 65 77 2d 73 74 61 74  tus #f)(new-stat
9720: 65 2d 73 74 61 74 75 73 20 23 66 29 29 0a 20 20  e-status #f)).  
9730: 28 63 6f 6d 6d 6f 6e 3a 63 6c 65 61 72 2d 63 61  (common:clear-ca
9740: 63 68 65 73 29 20 3b 3b 20 63 6c 65 61 72 20 61  ches) ;; clear a
9750: 6c 6c 20 63 61 63 68 65 73 0a 20 20 28 6c 65 74  ll caches.  (let
9760: 2a 20 28 28 64 62 20 20 20 20 20 20 20 20 20 20  * ((db          
9770: 20 23 66 29 0a 09 20 28 6b 65 79 73 20 20 20 20   #f).. (keys    
9780: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
9790: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 6b 65 79 73  lose db:get-keys
97a0: 20 64 62 29 29 0a 09 20 28 72 75 6e 64 61 74 20   db)).. (rundat 
97b0: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d        (open-run-
97c0: 63 6c 6f 73 65 20 72 75 6e 73 3a 67 65 74 2d 72  close runs:get-r
97d0: 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20 6b  uns-by-patt db k
97e0: 65 79 73 20 72 75 6e 6e 61 6d 65 70 61 74 74 29  eys runnamepatt)
97f0: 29 0a 09 20 28 68 65 61 64 65 72 20 20 20 20 20  ).. (header     
9800: 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75    (vector-ref ru
9810: 6e 64 61 74 20 30 29 29 0a 09 20 28 72 75 6e 73  ndat 0)).. (runs
9820: 20 20 20 20 20 20 20 20 20 28 76 65 63 74 6f 72           (vector
9830: 2d 72 65 66 20 72 75 6e 64 61 74 20 31 29 29 0a  -ref rundat 1)).
9840: 09 20 28 73 74 61 74 65 73 20 20 20 20 20 20 20  . (states       
9850: 28 69 66 20 73 74 61 74 65 20 20 28 73 74 72 69  (if state  (stri
9860: 6e 67 2d 73 70 6c 69 74 20 73 74 61 74 65 20 20  ng-split state  
9870: 22 2c 22 29 20 27 28 29 29 29 0a 09 20 28 73 74  ",") '())).. (st
9880: 61 74 75 73 65 73 20 20 20 20 20 28 69 66 20 73  atuses     (if s
9890: 74 61 74 75 73 20 28 73 74 72 69 6e 67 2d 73 70  tatus (string-sp
98a0: 6c 69 74 20 73 74 61 74 75 73 20 22 2c 22 29 20  lit status ",") 
98b0: 27 28 29 29 29 0a 09 20 28 73 74 61 74 65 2d 73  '())).. (state-s
98c0: 74 61 74 75 73 20 28 69 66 20 28 73 74 72 69 6e  tatus (if (strin
98d0: 67 3f 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61  g? new-state-sta
98e0: 74 75 73 29 20 28 73 74 72 69 6e 67 2d 73 70 6c  tus) (string-spl
98f0: 69 74 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61  it new-state-sta
9900: 74 75 73 20 22 2c 22 29 20 27 28 23 66 20 23 66  tus ",") '(#f #f
9910: 29 29 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a  )))).    (debug:
9920: 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 72 75  print-info 4 "ru
9930: 6e 73 3a 6f 70 65 72 61 74 65 2d 6f 6e 20 3d 3e  ns:operate-on =>
9940: 20 48 65 61 64 65 72 3a 20 22 20 68 65 61 64 65   Header: " heade
9950: 72 20 22 20 61 63 74 69 6f 6e 3a 20 22 20 61 63  r " action: " ac
9960: 74 69 6f 6e 20 22 20 6e 65 77 2d 73 74 61 74 65  tion " new-state
9970: 2d 73 74 61 74 75 73 3a 20 22 20 6e 65 77 2d 73  -status: " new-s
9980: 74 61 74 65 2d 73 74 61 74 75 73 29 0a 20 20 20  tate-status).   
9990: 20 28 69 66 20 28 3e 20 32 20 28 6c 65 6e 67 74   (if (> 2 (lengt
99a0: 68 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 29  h state-status))
99b0: 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 64 65 62  ..(begin..  (deb
99c0: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f  ug:print 0 "ERRO
99d0: 52 3a 20 74 68 65 20 70 61 72 61 6d 65 74 65 72  R: the parameter
99e0: 20 74 6f 20 2d 73 65 74 2d 73 74 61 74 65 2d 73   to -set-state-s
99f0: 74 61 74 75 73 20 69 73 20 61 20 63 6f 6d 6d 61  tatus is a comma
9a00: 20 64 65 6c 69 6d 69 74 65 64 20 73 74 72 69 6e   delimited strin
9a10: 67 2e 20 45 2e 67 2e 20 43 4f 4d 50 4c 45 54 45  g. E.g. COMPLETE
9a20: 44 2c 46 41 49 4c 22 29 0a 09 20 20 28 65 78 69  D,FAIL")..  (exi
9a30: 74 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61  t))).    (for-ea
9a40: 63 68 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20  ch.     (lambda 
9a50: 28 72 75 6e 29 0a 20 20 20 20 20 20 20 28 6c 65  (run).       (le
9a60: 74 20 28 28 72 75 6e 6b 65 79 20 28 73 74 72 69  t ((runkey (stri
9a70: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28  ng-intersperse (
9a80: 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 0a  map (lambda (k).
9a90: 09 09 09 09 09 09 28 64 62 3a 67 65 74 2d 76 61  ......(db:get-va
9aa0: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75  lue-by-header ru
9ab0: 6e 20 68 65 61 64 65 72 20 28 76 65 63 74 6f 72  n header (vector
9ac0: 2d 72 65 66 20 6b 20 30 29 29 29 20 6b 65 79 73  -ref k 0))) keys
9ad0: 29 20 22 2f 22 29 29 0a 09 20 20 20 20 20 28 64  ) "/"))..     (d
9ae0: 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 28 6d  irs-to-remove (m
9af0: 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29  ake-hash-table))
9b00: 29 0a 09 20 28 6c 65 74 2a 20 28 28 72 75 6e 2d  ).. (let* ((run-
9b10: 69 64 20 20 20 20 28 64 62 3a 67 65 74 2d 76 61  id    (db:get-va
9b20: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75  lue-by-header ru
9b30: 6e 20 68 65 61 64 65 72 20 22 69 64 22 29 29 0a  n header "id")).
9b40: 09 09 28 72 75 6e 2d 73 74 61 74 65 20 28 64 62  ..(run-state (db
9b50: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65  :get-value-by-he
9b60: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20  ader run header 
9b70: 22 73 74 61 74 65 22 29 29 0a 09 09 28 74 65 73  "state"))...(tes
9b80: 74 73 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20  ts     (if (not 
9b90: 28 65 71 75 61 6c 3f 20 72 75 6e 2d 73 74 61 74  (equal? run-stat
9ba0: 65 20 22 6c 6f 63 6b 65 64 22 29 29 0a 09 09 09  e "locked"))....
9bb0: 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e         (open-run
9bc0: 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65  -close db:get-te
9bd0: 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 72  sts-for-run db r
9be0: 75 6e 2d 69 64 0a 09 09 09 09 09 09 20 20 20 20  un-id.......    
9bf0: 20 20 74 65 73 74 70 61 74 74 20 73 74 61 74 65    testpatt state
9c00: 73 20 73 74 61 74 75 73 65 73 0a 09 09 09 09 09  s statuses......
9c10: 09 20 20 20 20 20 20 6e 6f 74 2d 69 6e 3a 20 20  .      not-in:  
9c20: 23 66 0a 09 09 09 09 09 09 20 20 20 20 20 20 73  #f.......      s
9c30: 6f 72 74 2d 62 79 3a 20 28 63 61 73 65 20 61 63  ort-by: (case ac
9c40: 74 69 6f 6e 0a 09 09 09 09 09 09 09 09 20 28 28  tion......... ((
9c50: 72 65 6d 6f 76 65 2d 72 75 6e 73 29 20 27 72 75  remove-runs) 'ru
9c60: 6e 64 69 72 29 0a 09 09 09 09 09 09 09 09 20 28  ndir)......... (
9c70: 65 6c 73 65 20 20 20 20 20 20 20 20 20 20 27 65  else          'e
9c80: 76 65 6e 74 5f 74 69 6d 65 29 29 29 0a 09 09 09  vent_time)))....
9c90: 20 20 20 20 20 20 20 27 28 29 29 29 0a 09 09 28         '()))...(
9ca0: 6c 61 73 74 74 70 61 74 68 20 22 2f 64 6f 65 73  lasttpath "/does
9cb0: 2f 6e 6f 74 2f 65 78 69 73 74 2f 49 2f 68 6f 70  /not/exist/I/hop
9cc0: 65 22 29 29 0a 09 20 20 20 28 64 65 62 75 67 3a  e"))..   (debug:
9cd0: 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 72 75  print-info 4 "ru
9ce0: 6e 73 3a 6f 70 65 72 61 74 65 2d 6f 6e 20 72 75  ns:operate-on ru
9cf0: 6e 3d 22 20 72 75 6e 20 22 2c 20 68 65 61 64 65  n=" run ", heade
9d00: 72 3d 22 20 68 65 61 64 65 72 29 0a 09 20 20 20  r=" header)..   
9d10: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20  (if (not (null? 
9d20: 74 65 73 74 73 29 29 0a 09 20 20 20 20 20 20 20  tests))..       
9d30: 28 62 65 67 69 6e 0a 09 09 20 28 63 61 73 65 20  (begin... (case 
9d40: 61 63 74 69 6f 6e 0a 09 09 20 20 20 28 28 72 65  action...   ((re
9d50: 6d 6f 76 65 2d 72 75 6e 73 29 0a 09 09 20 20 20  move-runs)...   
9d60: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20   (debug:print 1 
9d70: 22 52 65 6d 6f 76 69 6e 67 20 74 65 73 74 73 20  "Removing tests 
9d80: 66 6f 72 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65  for run: " runke
9d90: 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61  y " " (db:get-va
9da0: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75  lue-by-header ru
9db0: 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d  n header "runnam
9dc0: 65 22 29 29 29 0a 09 09 20 20 20 28 28 73 65 74  e")))...   ((set
9dd0: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 29 0a 09  -state-status)..
9de0: 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  .    (debug:prin
9df0: 74 20 31 20 22 4d 6f 64 69 66 79 69 6e 67 20 73  t 1 "Modifying s
9e00: 74 61 74 65 20 61 6e 64 20 73 74 61 75 73 20 66  tate and staus f
9e10: 6f 72 20 74 65 73 74 73 20 66 6f 72 20 72 75 6e  or tests for run
9e20: 3a 20 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28  : " runkey " " (
9e30: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d  db:get-value-by-
9e40: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65  header run heade
9e50: 72 20 22 72 75 6e 6e 61 6d 65 22 29 29 29 0a 09  r "runname")))..
9e60: 09 20 20 20 28 28 70 72 69 6e 74 2d 72 75 6e 29  .   ((print-run)
9e70: 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72  ...    (debug:pr
9e80: 69 6e 74 20 31 20 22 50 72 69 6e 74 69 6e 67 20  int 1 "Printing 
9e90: 69 6e 66 6f 20 66 6f 72 20 72 75 6e 20 22 20 72  info for run " r
9ea0: 75 6e 6b 65 79 20 22 2c 20 72 75 6e 3d 22 20 72  unkey ", run=" r
9eb0: 75 6e 20 22 2c 20 74 65 73 74 73 3d 22 20 74 65  un ", tests=" te
9ec0: 73 74 73 20 22 2c 20 68 65 61 64 65 72 3d 22 20  sts ", header=" 
9ed0: 68 65 61 64 65 72 29 0a 09 09 20 20 20 20 61 63  header)...    ac
9ee0: 74 69 6f 6e 29 0a 09 09 20 20 20 28 65 6c 73 65  tion)...   (else
9ef0: 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72  ...    (debug:pr
9f00: 69 6e 74 2d 69 6e 66 6f 20 30 20 22 61 63 74 69  int-info 0 "acti
9f10: 6f 6e 20 6e 6f 74 20 72 65 63 6f 67 6e 69 73 65  on not recognise
9f20: 64 20 22 20 61 63 74 69 6f 6e 29 29 29 0a 09 09  d " action)))...
9f30: 20 28 66 6f 72 2d 65 61 63 68 0a 09 09 20 20 28   (for-each...  (
9f40: 6c 61 6d 62 64 61 20 28 74 65 73 74 29 0a 09 09  lambda (test)...
9f50: 20 20 20 20 28 6c 65 74 2a 20 28 28 69 74 65 6d      (let* ((item
9f60: 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67  -path (db:test-g
9f70: 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73  et-item-path tes
9f80: 74 29 29 0a 09 09 09 20 20 20 28 74 65 73 74 2d  t))....   (test-
9f90: 6e 61 6d 65 20 28 64 62 3a 74 65 73 74 2d 67 65  name (db:test-ge
9fa0: 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29  t-testname test)
9fb0: 29 0a 09 09 09 20 20 20 28 72 75 6e 2d 64 69 72  )....   (run-dir
9fc0: 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d     (db:test-get-
9fd0: 72 75 6e 64 69 72 20 74 65 73 74 29 29 20 20 20  rundir test))   
9fe0: 20 3b 3b 20 72 75 6e 20 64 69 72 20 69 73 20 66   ;; run dir is f
9ff0: 72 6f 6d 20 74 68 65 20 6c 69 6e 6b 20 74 72 65  rom the link tre
a000: 65 0a 09 09 09 20 20 20 28 72 65 61 6c 2d 64 69  e....   (real-di
a010: 72 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69  r  (if (file-exi
a020: 73 74 73 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09  sts? run-dir)...
a030: 09 09 09 20 20 28 72 65 73 6f 6c 76 65 2d 70 61  ...  (resolve-pa
a040: 74 68 6e 61 6d 65 20 72 75 6e 2d 64 69 72 29 0a  thname run-dir).
a050: 09 09 09 09 09 20 20 23 66 29 29 0a 09 09 09 20  .....  #f)).... 
a060: 20 20 28 74 65 73 74 2d 69 64 20 20 20 28 64 62    (test-id   (db
a070: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73  :test-get-id tes
a080: 74 29 29 29 0a 09 09 20 20 20 20 20 20 3b 3b 20  t)))...      ;; 
a090: 20 20 28 74 64 62 20 20 20 20 20 20 20 28 64 62    (tdb       (db
a0a0: 3a 6f 70 65 6e 2d 74 65 73 74 2d 64 62 20 72 75  :open-test-db ru
a0b0: 6e 2d 64 69 72 29 29 29 0a 09 09 20 20 20 20 20  n-dir)))...     
a0c0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
a0d0: 66 6f 20 34 20 22 74 65 73 74 3d 22 20 74 65 73  fo 4 "test=" tes
a0e0: 74 29 20 3b 3b 20 20 20 22 20 28 64 62 3a 74 65  t) ;;   " (db:te
a0f0: 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20  st-get-testname 
a100: 74 65 73 74 29 20 22 20 69 64 3a 20 22 20 28 64  test) " id: " (d
a110: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65  b:test-get-id te
a120: 73 74 29 20 22 20 22 20 69 74 65 6d 2d 70 61 74  st) " " item-pat
a130: 68 20 22 20 61 63 74 69 6f 6e 3a 20 22 20 61 63  h " action: " ac
a140: 74 69 6f 6e 29 0a 09 09 20 20 20 20 20 20 28 63  tion)...      (c
a150: 61 73 65 20 61 63 74 69 6f 6e 0a 09 09 09 28 28  ase action....((
a160: 72 65 6d 6f 76 65 2d 72 75 6e 73 29 20 3b 3b 20  remove-runs) ;; 
a170: 74 68 65 20 74 64 62 20 69 73 20 66 6f 72 20 66  the tdb is for f
a180: 75 74 75 72 65 20 70 6f 73 73 69 62 6c 65 2e 20  uture possible. 
a190: 0a 09 09 09 20 28 6f 70 65 6e 2d 72 75 6e 2d 63  .... (open-run-c
a1a0: 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 2d 74  lose db:delete-t
a1b0: 65 73 74 2d 72 65 63 6f 72 64 73 20 64 62 20 23  est-records db #
a1c0: 66 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  f (db:test-get-i
a1d0: 64 20 74 65 73 74 29 29 0a 09 09 09 20 28 64 65  d test)).... (de
a1e0: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31  bug:print-info 1
a1f0: 20 22 41 74 74 65 6d 70 74 69 6e 67 20 74 6f 20   "Attempting to 
a200: 72 65 6d 6f 76 65 20 22 20 28 69 66 20 72 65 61  remove " (if rea
a210: 6c 2d 64 69 72 20 28 63 6f 6e 63 20 22 20 64 69  l-dir (conc " di
a220: 72 20 22 20 72 65 61 6c 2d 64 69 72 20 22 20 61  r " real-dir " a
a230: 6e 64 20 22 29 20 22 22 29 20 22 20 6c 69 6e 6b  nd ") "") " link
a240: 20 22 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 20   " run-dir).... 
a250: 28 69 66 20 28 61 6e 64 20 72 65 61 6c 2d 64 69  (if (and real-di
a260: 72 20 0a 09 09 09 09 20 20 28 3e 20 28 73 74 72  r .....  (> (str
a270: 69 6e 67 2d 6c 65 6e 67 74 68 20 72 65 61 6c 2d  ing-length real-
a280: 64 69 72 29 20 35 29 0a 09 09 09 09 20 20 28 66  dir) 5).....  (f
a290: 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 65 61 6c  ile-exists? real
a2a0: 2d 64 69 72 29 29 20 3b 3b 20 62 61 64 20 68 65  -dir)) ;; bad he
a2b0: 75 72 69 73 74 69 63 20 62 75 74 20 73 68 6f 75  uristic but shou
a2c0: 6c 64 20 70 72 65 76 65 6e 74 20 2f 74 6d 70 20  ld prevent /tmp 
a2d0: 2f 68 6f 6d 65 20 65 74 63 2e 0a 09 09 09 20 20  /home etc.....  
a2e0: 20 20 20 28 62 65 67 69 6e 20 3b 3b 20 6c 65 74     (begin ;; let
a2f0: 2a 20 28 28 72 65 61 6c 70 61 74 68 20 28 72 65  * ((realpath (re
a300: 73 6f 6c 76 65 2d 70 61 74 68 6e 61 6d 65 20 72  solve-pathname r
a310: 75 6e 2d 64 69 72 29 29 29 0a 09 09 09 20 20 20  un-dir)))....   
a320: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
a330: 2d 69 6e 66 6f 20 31 20 22 52 65 63 75 72 73 69  -info 1 "Recursi
a340: 76 65 6c 79 20 72 65 6d 6f 76 69 6e 67 20 22 20  vely removing " 
a350: 72 65 61 6c 2d 64 69 72 29 0a 09 09 09 20 20 20  real-dir)....   
a360: 20 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78      (if (file-ex
a370: 69 73 74 73 3f 20 72 65 61 6c 2d 64 69 72 29 0a  ists? real-dir).
a380: 09 09 09 09 20 20 20 28 69 66 20 28 3e 20 28 73  ....   (if (> (s
a390: 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 20  ystem (conc "rm 
a3a0: 2d 72 66 20 22 20 72 65 61 6c 2d 64 69 72 29 29  -rf " real-dir))
a3b0: 20 30 29 0a 09 09 09 09 20 20 20 20 20 20 20 28   0).....       (
a3c0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45  debug:print 0 "E
a3d0: 52 52 4f 52 3a 20 54 68 65 72 65 20 77 61 73 20  RROR: There was 
a3e0: 61 20 70 72 6f 62 6c 65 6d 20 72 65 6d 6f 76 69  a problem removi
a3f0: 6e 67 20 22 20 72 65 61 6c 2d 64 69 72 20 22 20  ng " real-dir " 
a400: 77 69 74 68 20 72 6d 20 2d 66 22 29 29 0a 09 09  with rm -f"))...
a410: 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  ..   (debug:prin
a420: 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 74 65  t 0 "WARNING: te
a430: 73 74 20 64 69 72 20 22 20 72 65 61 6c 2d 64 69  st dir " real-di
a440: 72 20 22 20 61 70 70 65 61 72 73 20 74 6f 20 6e  r " appears to n
a450: 6f 74 20 65 78 69 73 74 20 6f 72 20 69 73 20 6e  ot exist or is n
a460: 6f 74 20 72 65 61 64 61 62 6c 65 22 29 29 29 0a  ot readable"))).
a470: 09 09 09 20 20 20 20 20 28 69 66 20 72 65 61 6c  ...     (if real
a480: 2d 64 69 72 20 0a 09 09 09 09 20 28 64 65 62 75  -dir ..... (debu
a490: 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49  g:print 0 "WARNI
a4a0: 4e 47 3a 20 64 69 72 65 63 74 6f 72 79 20 22 20  NG: directory " 
a4b0: 72 65 61 6c 2d 64 69 72 20 22 20 64 6f 65 73 20  real-dir " does 
a4c0: 6e 6f 74 20 65 78 69 73 74 22 29 0a 09 09 09 09  not exist").....
a4d0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
a4e0: 22 57 41 52 4e 49 4e 47 3a 20 6e 6f 20 72 65 61  "WARNING: no rea
a4f0: 6c 20 64 69 72 65 63 74 6f 72 79 20 63 6f 72 72  l directory corr
a500: 6f 73 70 6f 6e 64 69 6e 67 20 74 6f 20 6c 69 6e  osponding to lin
a510: 6b 20 22 20 72 75 6e 2d 64 69 72 20 22 2c 20 6e  k " run-dir ", n
a520: 6f 74 68 69 6e 67 20 64 6f 6e 65 22 29 29 29 0a  othing done"))).
a530: 09 09 09 20 28 69 66 20 28 73 79 6d 62 6f 6c 69  ... (if (symboli
a540: 63 2d 6c 69 6e 6b 3f 20 72 75 6e 2d 64 69 72 29  c-link? run-dir)
a550: 0a 09 09 09 20 20 20 20 20 28 62 65 67 69 6e 0a  ....     (begin.
a560: 09 09 09 20 20 20 20 20 20 20 28 64 65 62 75 67  ...       (debug
a570: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 52  :print-info 1 "R
a580: 65 6d 6f 76 69 6e 67 20 73 79 6d 6c 69 6e 6b 20  emoving symlink 
a590: 22 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 20 20  " run-dir)....  
a5a0: 20 20 20 20 20 28 68 61 6e 64 6c 65 2d 65 78 63       (handle-exc
a5b0: 65 70 74 69 6f 6e 73 0a 09 09 09 09 65 78 6e 0a  eptions.....exn.
a5c0: 09 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74  ....(debug:print
a5d0: 20 30 20 22 45 52 52 4f 52 3a 20 20 46 61 69 6c   0 "ERROR:  Fail
a5e0: 65 64 20 74 6f 20 72 65 6d 6f 76 65 20 73 79 6d  ed to remove sym
a5f0: 6c 69 6e 6b 20 22 20 72 75 6e 2d 64 69 72 20 28  link " run-dir (
a600: 28 63 6f 6e 64 69 74 69 6f 6e 2d 70 72 6f 70 65  (condition-prope
a610: 72 74 79 2d 61 63 63 65 73 73 6f 72 20 27 65 78  rty-accessor 'ex
a620: 6e 20 27 6d 65 73 73 61 67 65 29 20 65 78 6e 29  n 'message) exn)
a630: 20 22 2c 20 61 74 74 65 6d 70 74 69 6e 67 20 74   ", attempting t
a640: 6f 20 63 6f 6e 74 69 6e 75 65 22 29 0a 09 09 09  o continue")....
a650: 09 28 64 65 6c 65 74 65 2d 66 69 6c 65 20 72 75  .(delete-file ru
a660: 6e 2d 64 69 72 29 29 29 0a 09 09 09 20 20 20 20  n-dir)))....    
a670: 20 28 69 66 20 28 64 69 72 65 63 74 6f 72 79 3f   (if (directory?
a680: 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 09 20 28   run-dir)..... (
a690: 69 66 20 28 3e 20 28 64 69 72 65 63 74 6f 72 79  if (> (directory
a6a0: 2d 66 6f 6c 64 20 28 6c 61 6d 62 64 61 20 28 66  -fold (lambda (f
a6b0: 20 78 29 28 2b 20 31 20 78 29 29 20 30 20 72 75   x)(+ 1 x)) 0 ru
a6c0: 6e 2d 64 69 72 29 20 30 29 0a 09 09 09 09 20 20  n-dir) 0).....  
a6d0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
a6e0: 30 20 22 57 41 52 4e 49 4e 47 3a 20 72 65 66 75  0 "WARNING: refu
a6f0: 73 69 6e 67 20 74 6f 20 72 65 6d 6f 76 65 20 22  sing to remove "
a700: 20 72 75 6e 2d 64 69 72 20 22 20 61 73 20 69 74   run-dir " as it
a710: 20 69 73 20 6e 6f 74 20 65 6d 70 74 79 22 29 0a   is not empty").
a720: 09 09 09 09 20 20 20 20 20 20 28 68 61 6e 64 6c  ....      (handl
a730: 65 2d 65 78 63 65 70 74 69 6f 6e 73 0a 09 09 09  e-exceptions....
a740: 09 20 20 20 20 20 20 20 65 78 6e 0a 09 09 09 09  .       exn.....
a750: 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72         (debug:pr
a760: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 20 46  int 0 "ERROR:  F
a770: 61 69 6c 65 64 20 74 6f 20 72 65 6d 6f 76 65 20  ailed to remove 
a780: 64 69 72 65 63 74 6f 72 79 20 22 20 72 75 6e 2d  directory " run-
a790: 64 69 72 20 28 28 63 6f 6e 64 69 74 69 6f 6e 2d  dir ((condition-
a7a0: 70 72 6f 70 65 72 74 79 2d 61 63 63 65 73 73 6f  property-accesso
a7b0: 72 20 27 65 78 6e 20 27 6d 65 73 73 61 67 65 29  r 'exn 'message)
a7c0: 20 65 78 6e 29 20 22 2c 20 61 74 74 65 6d 70 74   exn) ", attempt
a7d0: 69 6e 67 20 74 6f 20 63 6f 6e 74 69 6e 75 65 22  ing to continue"
a7e0: 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 64 65  ).....       (de
a7f0: 6c 65 74 65 2d 64 69 72 65 63 74 6f 72 79 20 72  lete-directory r
a800: 75 6e 2d 64 69 72 29 29 29 0a 09 09 09 09 20 28  un-dir)))..... (
a810: 69 66 20 72 75 6e 2d 64 69 72 0a 09 09 09 09 20  if run-dir..... 
a820: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
a830: 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 6e 6f 74   0 "WARNING: not
a840: 20 72 65 6d 6f 76 69 6e 67 20 22 20 72 75 6e 2d   removing " run-
a850: 64 69 72 20 22 20 61 73 20 69 74 20 65 69 74 68  dir " as it eith
a860: 65 72 20 64 6f 65 73 6e 27 74 20 65 78 69 73 74  er doesn't exist
a870: 20 6f 72 20 69 73 20 6e 6f 74 20 61 20 73 79 6d   or is not a sym
a880: 6c 69 6e 6b 22 29 0a 09 09 09 09 20 20 20 20 20  link").....     
a890: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
a8a0: 4e 4f 54 45 3a 20 74 68 65 20 72 75 6e 20 64 69  NOTE: the run di
a8b0: 72 20 66 6f 72 20 74 68 69 73 20 74 65 73 74 20  r for this test 
a8c0: 69 73 20 75 6e 64 65 66 69 6e 65 64 2e 20 54 65  is undefined. Te
a8d0: 73 74 20 6d 61 79 20 68 61 76 65 20 61 6c 72 65  st may have alre
a8e0: 61 64 79 20 62 65 65 6e 20 64 65 6c 65 74 65 64  ady been deleted
a8f0: 2e 22 29 29 0a 09 09 09 09 20 29 29 29 0a 09 09  ."))..... )))...
a900: 09 28 28 73 65 74 2d 73 74 61 74 65 2d 73 74 61  .((set-state-sta
a910: 74 75 73 29 0a 09 09 09 20 28 64 65 62 75 67 3a  tus).... (debug:
a920: 70 72 69 6e 74 2d 69 6e 66 6f 20 32 20 22 6e 65  print-info 2 "ne
a930: 77 20 73 74 61 74 65 20 22 20 28 63 61 72 20 73  w state " (car s
a940: 74 61 74 65 2d 73 74 61 74 75 73 29 20 22 2c 20  tate-status) ", 
a950: 6e 65 77 20 73 74 61 74 75 73 20 22 20 28 63 61  new status " (ca
a960: 64 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 29  dr state-status)
a970: 29 0a 09 09 09 20 28 6f 70 65 6e 2d 72 75 6e 2d  ).... (open-run-
a980: 63 6c 6f 73 65 20 64 62 3a 74 65 73 74 2d 73 65  close db:test-se
a990: 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73 2d 62  t-state-status-b
a9a0: 79 2d 69 64 20 64 62 20 28 64 62 3a 74 65 73 74  y-id db (db:test
a9b0: 2d 67 65 74 2d 69 64 20 74 65 73 74 29 20 28 63  -get-id test) (c
a9c0: 61 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 29  ar state-status)
a9d0: 28 63 61 64 72 20 73 74 61 74 65 2d 73 74 61 74  (cadr state-stat
a9e0: 75 73 29 20 23 66 29 29 29 29 29 0a 09 09 20 20  us) #f)))))...  
a9f0: 28 73 6f 72 74 20 74 65 73 74 73 20 28 6c 61 6d  (sort tests (lam
aa00: 62 64 61 20 28 61 20 62 29 28 6c 65 74 20 28 28  bda (a b)(let ((
aa10: 64 69 72 61 20 28 64 62 3a 74 65 73 74 2d 67 65  dira (db:test-ge
aa20: 74 2d 72 75 6e 64 69 72 20 61 29 29 0a 09 09 09  t-rundir a))....
aa30: 09 09 09 20 28 64 69 72 62 20 28 64 62 3a 74 65  ... (dirb (db:te
aa40: 73 74 2d 67 65 74 2d 72 75 6e 64 69 72 20 62 29  st-get-rundir b)
aa50: 29 29 0a 09 09 09 09 09 20 20 20 20 20 28 69 66  ))......     (if
aa60: 20 28 61 6e 64 20 28 73 74 72 69 6e 67 3f 20 64   (and (string? d
aa70: 69 72 61 29 28 73 74 72 69 6e 67 3f 20 64 69 72  ira)(string? dir
aa80: 62 29 29 0a 09 09 09 09 09 09 20 28 3e 20 28 73  b))....... (> (s
aa90: 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 64 69 72  tring-length dir
aaa0: 61 29 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68  a)(string-length
aab0: 20 64 69 72 62 29 29 0a 09 09 09 09 09 09 20 23   dirb))....... #
aac0: 66 29 29 29 29 29 29 29 0a 09 20 20 20 3b 3b 20  f)))))))..   ;; 
aad0: 72 65 6d 6f 76 65 20 74 68 65 20 72 75 6e 20 69  remove the run i
aae0: 66 20 7a 65 72 6f 20 74 65 73 74 73 20 72 65 6d  f zero tests rem
aaf0: 61 69 6e 0a 09 20 20 20 28 69 66 20 28 65 71 3f  ain..   (if (eq?
ab00: 20 61 63 74 69 6f 6e 20 27 72 65 6d 6f 76 65 2d   action 'remove-
ab10: 72 75 6e 73 29 0a 09 20 20 20 20 20 20 20 28 6c  runs)..       (l
ab20: 65 74 20 28 28 72 65 6d 74 65 73 74 73 20 28 6f  et ((remtests (o
ab30: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62  pen-run-close db
ab40: 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72  :get-tests-for-r
ab50: 75 6e 20 64 62 20 28 64 62 3a 67 65 74 2d 76 61  un db (db:get-va
ab60: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75  lue-by-header ru
ab70: 6e 20 68 65 61 64 65 72 20 22 69 64 22 29 20 23  n header "id") #
ab80: 66 20 27 28 22 44 45 4c 45 54 45 44 22 29 20 27  f '("DELETED") '
ab90: 28 22 6e 2f 61 22 29 20 6e 6f 74 2d 69 6e 3a 20  ("n/a") not-in: 
aba0: 23 74 29 29 29 0a 09 09 20 28 69 66 20 28 6e 75  #t)))... (if (nu
abb0: 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29 20 3b 3b  ll? remtests) ;;
abc0: 20 6e 6f 20 6d 6f 72 65 20 74 65 73 74 73 20 72   no more tests r
abd0: 65 6d 61 69 6e 69 6e 67 0a 09 09 20 20 20 20 20  emaining...     
abe0: 28 6c 65 74 2a 20 28 28 64 70 61 72 74 73 20 20  (let* ((dparts  
abf0: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 6c 61  (string-split la
ac00: 73 74 74 70 61 74 68 20 22 2f 22 29 29 0a 09 09  sttpath "/"))...
ac10: 09 20 20 20 20 28 72 75 6e 70 61 74 68 20 28 63  .    (runpath (c
ac20: 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 6e 67 2d  onc "/" (string-
ac30: 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09 09 09  intersperse ....
ac40: 09 09 09 28 74 61 6b 65 20 64 70 61 72 74 73 20  ...(take dparts 
ac50: 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74  (- (length dpart
ac60: 73 29 20 31 29 29 0a 09 09 09 09 09 09 22 2f 22  s) 1))......."/"
ac70: 29 29 29 29 0a 09 09 20 20 20 20 20 20 20 28 64  ))))...       (d
ac80: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65  ebug:print 1 "Re
ac90: 6d 6f 76 69 6e 67 20 72 75 6e 3a 20 22 20 72 75  moving run: " ru
aca0: 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74  nkey " " (db:get
acb0: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72  -value-by-header
acc0: 20 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e   run header "run
acd0: 6e 61 6d 65 22 29 20 22 20 61 6e 64 20 72 65 6c  name") " and rel
ace0: 61 74 65 64 20 72 65 63 6f 72 64 22 29 0a 09 09  ated record")...
acf0: 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e         (open-run
ad00: 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65  -close db:delete
ad10: 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 29 0a  -run db run-id).
ad20: 09 09 20 20 20 20 20 20 20 3b 3b 20 54 68 69 73  ..       ;; This
ad30: 20 69 73 20 61 20 70 72 65 74 74 79 20 67 6f 6f   is a pretty goo
ad40: 64 20 70 6c 61 63 65 20 74 6f 20 70 75 72 67 65  d place to purge
ad50: 20 6f 6c 64 20 44 45 4c 45 54 45 44 20 74 65 73   old DELETED tes
ad60: 74 73 0a 09 09 20 20 20 20 20 20 20 28 6f 70 65  ts...       (ope
ad70: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64  n-run-close db:d
ad80: 65 6c 65 74 65 2d 74 65 73 74 73 2d 66 6f 72 2d  elete-tests-for-
ad90: 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 29 0a 09  run db run-id)..
ada0: 09 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75  .       (open-ru
adb0: 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74  n-close db:delet
adc0: 65 2d 6f 6c 64 2d 64 65 6c 65 74 65 64 2d 74 65  e-old-deleted-te
add0: 73 74 2d 72 65 63 6f 72 64 73 20 64 62 29 0a 09  st-records db)..
ade0: 09 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75  .       (open-ru
adf0: 6e 2d 63 6c 6f 73 65 20 64 62 3a 73 65 74 2d 76  n-close db:set-v
ae00: 61 72 20 64 62 20 22 44 45 4c 45 54 45 44 5f 54  ar db "DELETED_T
ae10: 45 53 54 53 22 20 28 63 75 72 72 65 6e 74 2d 73  ESTS" (current-s
ae20: 65 63 6f 6e 64 73 29 29 0a 09 09 20 20 20 20 20  econds))...     
ae30: 20 20 3b 3b 20 6e 65 65 64 20 74 6f 20 66 69 67    ;; need to fig
ae40: 75 72 65 20 6f 75 74 20 74 68 65 20 70 61 74 68  ure out the path
ae50: 20 74 6f 20 74 68 65 20 72 75 6e 20 64 69 72 20   to the run dir 
ae60: 61 6e 64 20 72 65 6d 6f 76 65 20 69 74 20 69 66  and remove it if
ae70: 20 65 6d 70 74 79 0a 09 09 20 20 20 20 20 20 20   empty...       
ae80: 3b 3b 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f  ;;    (if (null?
ae90: 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20 72 75 6e   (glob (conc run
aea0: 70 61 74 68 20 22 2f 2a 22 29 29 29 0a 09 09 20  path "/*")))... 
aeb0: 20 20 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20        ;;        
aec0: 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20 20 20  (begin...       
aed0: 3b 3b 20 09 20 28 64 65 62 75 67 3a 70 72 69 6e  ;; . (debug:prin
aee0: 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 72 75  t 1 "Removing ru
aef0: 6e 20 64 69 72 20 22 20 72 75 6e 70 61 74 68 29  n dir " runpath)
af00: 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 09 20 28  ...       ;; . (
af10: 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d  system (conc "rm
af20: 64 69 72 20 2d 70 20 22 20 72 75 6e 70 61 74 68  dir -p " runpath
af30: 29 29 29 29 0a 09 09 20 20 20 20 20 20 20 29 29  ))))...       ))
af40: 29 29 29 0a 09 20 29 29 0a 20 20 20 20 20 72 75  ))).. )).     ru
af50: 6e 73 29 29 0a 20 20 23 74 29 0a 0a 3b 3b 3d 3d  ns)).  #t)..;;==
af60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
af70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
af80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
af90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
afa0: 3d 3d 3d 3d 0a 3b 3b 20 52 6f 75 74 69 6e 65 73  ====.;; Routines
afb0: 20 66 6f 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e   for manipulatin
afc0: 67 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d  g runs.;;=======
afd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
afe0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
aff0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b000: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a  ===============.
b010: 0a 3b 3b 20 53 69 6e 63 65 20 6d 61 6e 79 20 63  .;; Since many c
b020: 61 6c 6c 73 20 74 6f 20 61 20 72 75 6e 20 72 65  alls to a run re
b030: 71 75 69 72 65 20 70 72 65 74 74 79 20 6d 75 63  quire pretty muc
b040: 68 20 74 68 65 20 73 61 6d 65 20 73 65 74 75 70  h the same setup
b050: 20 0a 3b 3b 20 74 68 69 73 20 77 72 61 70 70 65   .;; this wrappe
b060: 72 20 69 73 20 75 73 65 64 20 74 6f 20 72 65 64  r is used to red
b070: 75 63 65 20 74 68 65 20 72 65 70 6c 69 63 61 74  uce the replicat
b080: 69 6f 6e 20 6f 66 20 63 6f 64 65 0a 28 64 65 66  ion of code.(def
b090: 69 6e 65 20 28 67 65 6e 65 72 61 6c 2d 72 75 6e  ine (general-run
b0a0: 2d 63 61 6c 6c 20 73 77 69 74 63 68 6e 61 6d 65  -call switchname
b0b0: 20 61 63 74 69 6f 6e 2d 64 65 73 63 20 70 72 6f   action-desc pro
b0c0: 63 29 0a 20 20 28 6c 65 74 20 28 28 72 75 6e 6e  c).  (let ((runn
b0d0: 61 6d 65 20 28 61 72 67 73 3a 67 65 74 2d 61 72  ame (args:get-ar
b0e0: 67 20 22 3a 72 75 6e 6e 61 6d 65 22 29 29 0a 09  g ":runname"))..
b0f0: 28 74 61 72 67 65 74 20 20 28 69 66 20 28 61 72  (target  (if (ar
b100: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72  gs:get-arg "-tar
b110: 67 65 74 22 29 0a 09 09 20 20 20 20 20 28 61 72  get")...     (ar
b120: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72  gs:get-arg "-tar
b130: 67 65 74 22 29 0a 09 09 20 20 20 20 20 28 61 72  get")...     (ar
b140: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71  gs:get-arg "-req
b150: 74 61 72 67 22 29 29 29 0a 09 28 74 68 31 20 20  targ")))..(th1  
b160: 20 20 20 23 66 29 29 0a 20 20 20 20 28 63 6f 6e     #f)).    (con
b170: 64 0a 20 20 20 20 20 28 28 6e 6f 74 20 74 61 72  d.     ((not tar
b180: 67 65 74 29 0a 20 20 20 20 20 20 28 64 65 62 75  get).      (debu
b190: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52  g:print 0 "ERROR
b1a0: 3a 20 4d 69 73 73 69 6e 67 20 72 65 71 75 69 72  : Missing requir
b1b0: 65 64 20 70 61 72 61 6d 65 74 65 72 20 66 6f 72  ed parameter for
b1c0: 20 22 20 73 77 69 74 63 68 6e 61 6d 65 20 22 2c   " switchname ",
b1d0: 20 79 6f 75 20 6d 75 73 74 20 73 70 65 63 69 66   you must specif
b1e0: 79 20 74 68 65 20 74 61 72 67 65 74 20 77 69 74  y the target wit
b1f0: 68 20 2d 74 61 72 67 65 74 22 29 0a 20 20 20 20  h -target").    
b200: 20 20 28 65 78 69 74 20 33 29 29 0a 20 20 20 20    (exit 3)).    
b210: 20 28 28 6e 6f 74 20 72 75 6e 6e 61 6d 65 29 0a   ((not runname).
b220: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
b230: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 4d 69 73  nt 0 "ERROR: Mis
b240: 73 69 6e 67 20 72 65 71 75 69 72 65 64 20 70 61  sing required pa
b250: 72 61 6d 65 74 65 72 20 66 6f 72 20 22 20 73 77  rameter for " sw
b260: 69 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20  itchname ", you 
b270: 6d 75 73 74 20 73 70 65 63 69 66 79 20 74 68 65  must specify the
b280: 20 72 75 6e 20 6e 61 6d 65 20 77 69 74 68 20 3a   run name with :
b290: 72 75 6e 6e 61 6d 65 20 72 75 6e 6e 61 6d 65 22  runname runname"
b2a0: 29 0a 20 20 20 20 20 20 28 65 78 69 74 20 33 29  ).      (exit 3)
b2b0: 29 0a 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20  ).     (else.   
b2c0: 20 20 20 28 6c 65 74 20 28 28 64 62 20 20 20 23     (let ((db   #
b2d0: 66 29 0a 09 20 20 20 20 28 6b 65 79 73 20 23 66  f)..    (keys #f
b2e0: 29 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 73 65  ))..(if (not (se
b2f0: 74 75 70 2d 66 6f 72 2d 72 75 6e 29 29 0a 09 20  tup-for-run)).. 
b300: 20 20 20 28 62 65 67 69 6e 20 0a 09 20 20 20 20     (begin ..    
b310: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
b320: 20 22 46 61 69 6c 65 64 20 74 6f 20 73 65 74 75   "Failed to setu
b330: 70 2c 20 65 78 69 74 69 6e 67 22 29 0a 09 20 20  p, exiting")..  
b340: 20 20 20 20 28 65 78 69 74 20 31 29 29 29 0a 09      (exit 1)))..
b350: 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72  (if (args:get-ar
b360: 67 20 22 2d 73 65 72 76 65 72 22 29 0a 09 20 20  g "-server")..  
b370: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73    (open-run-clos
b380: 65 20 73 65 72 76 65 72 3a 73 74 61 72 74 20 64  e server:start d
b390: 62 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20  b (args:get-arg 
b3a0: 22 2d 73 65 72 76 65 72 22 29 29 29 0a 20 09 20  "-server"))). . 
b3b0: 20 20 20 3b 3b 20 28 69 66 20 28 6e 6f 74 20 28     ;; (if (not (
b3c0: 6f 72 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  or (args:get-arg
b3d0: 20 22 2d 72 75 6e 61 6c 6c 22 29 20 20 20 20 20   "-runall")     
b3e0: 3b 3b 20 72 75 6e 61 6c 6c 20 61 6e 64 20 72 75  ;; runall and ru
b3f0: 6e 74 65 73 74 73 20 61 72 65 20 61 6c 6c 6f 77  ntests are allow
b400: 65 64 20 74 6f 20 62 65 20 73 65 72 76 65 72 73  ed to be servers
b410: 0a 20 09 20 20 20 20 3b 3b 20 20 20 20 20 09 20  . .    ;;     . 
b420: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
b430: 72 75 6e 74 65 73 74 73 22 29 29 29 0a 09 20 20  runtests")))..  
b440: 20 20 3b 3b 20 20 20 20 20 28 63 6c 69 65 6e 74    ;;     (client
b450: 3a 73 65 74 75 70 29 20 3b 3b 20 54 68 69 73 20  :setup) ;; This 
b460: 69 73 20 61 20 64 75 70 6c 69 63 61 74 65 20 73  is a duplicate s
b470: 74 61 72 74 75 70 21 21 21 3f 3f 3f 20 42 55 47  tartup!!!??? BUG
b480: 3f 0a 09 20 20 20 20 3b 3b 20 20 20 20 20 29 29  ?..    ;;     ))
b490: 0a 09 28 73 65 74 21 20 6b 65 79 73 20 28 6f 70  ..(set! keys (op
b4a0: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a  en-run-close db:
b4b0: 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 3b  get-keys db))..;
b4c0: 3b 20 68 61 76 65 20 65 6e 6f 75 67 68 20 74 6f  ; have enough to
b4d0: 20 70 72 6f 63 65 73 73 20 2d 74 61 72 67 65 74   process -target
b4e0: 20 6f 72 20 2d 72 65 71 74 61 72 67 20 68 65 72   or -reqtarg her
b4f0: 65 0a 09 28 69 66 20 28 61 72 67 73 3a 67 65 74  e..(if (args:get
b500: 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29  -arg "-reqtarg")
b510: 0a 09 20 20 20 20 28 6c 65 74 2a 20 28 28 72 75  ..    (let* ((ru
b520: 6e 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 20  nconfigf (conc  
b530: 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72 75 6e 63  *toppath* "/runc
b540: 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22 29 29  onfigs.config"))
b550: 20 3b 3b 20 44 4f 20 4e 4f 54 20 45 56 41 4c 55   ;; DO NOT EVALU
b560: 41 54 45 20 41 4c 4c 20 0a 09 09 20 20 20 28 72  ATE ALL ...   (r
b570: 75 6e 63 6f 6e 66 69 67 20 20 28 72 65 61 64 2d  unconfig  (read-
b580: 63 6f 6e 66 69 67 20 72 75 6e 63 6f 6e 66 69 67  config runconfig
b590: 66 20 23 66 20 23 74 20 65 6e 76 69 72 6f 6e 2d  f #f #t environ-
b5a0: 70 61 74 74 3a 20 23 66 29 29 29 20 0a 09 20 20  patt: #f))) ..  
b5b0: 20 20 20 20 28 69 66 20 28 68 61 73 68 2d 74 61      (if (hash-ta
b5c0: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20  ble-ref/default 
b5d0: 72 75 6e 63 6f 6e 66 69 67 20 28 61 72 67 73 3a  runconfig (args:
b5e0: 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72  get-arg "-reqtar
b5f0: 67 22 29 20 23 66 29 0a 09 09 20 20 28 6b 65 79  g") #f)...  (key
b600: 73 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 72 67  s:target-set-arg
b610: 73 20 6b 65 79 73 20 28 61 72 67 73 3a 67 65 74  s keys (args:get
b620: 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29  -arg "-reqtarg")
b630: 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 0a   args:arg-hash).
b640: 09 09 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20  ..  (begin...   
b650: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
b660: 22 45 52 52 4f 52 3a 20 5b 22 20 28 61 72 67 73  "ERROR: [" (args
b670: 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61  :get-arg "-reqta
b680: 72 67 22 29 20 22 5d 20 6e 6f 74 20 66 6f 75 6e  rg") "] not foun
b690: 64 20 69 6e 20 22 20 72 75 6e 63 6f 6e 66 69 67  d in " runconfig
b6a0: 66 29 0a 09 09 20 20 20 20 28 69 66 20 64 62 20  f)...    (if db 
b6b0: 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a  (sqlite3:finaliz
b6c0: 65 21 20 64 62 29 29 0a 09 09 20 20 20 20 28 65  e! db))...    (e
b6d0: 78 69 74 20 31 29 29 29 29 0a 09 20 20 20 20 28  xit 1))))..    (
b6e0: 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  if (args:get-arg
b6f0: 20 22 2d 74 61 72 67 65 74 22 29 0a 09 09 28 6b   "-target")...(k
b700: 65 79 73 3a 74 61 72 67 65 74 2d 73 65 74 2d 61  eys:target-set-a
b710: 72 67 73 20 6b 65 79 73 20 28 61 72 67 73 3a 67  rgs keys (args:g
b720: 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22  et-arg "-target"
b730: 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 20   args:arg-hash) 
b740: 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 29 29  args:arg-hash)))
b750: 0a 09 28 69 66 20 28 6e 6f 74 20 28 63 61 72 20  ..(if (not (car 
b760: 2a 63 6f 6e 66 69 67 69 6e 66 6f 2a 29 29 0a 09  *configinfo*))..
b770: 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20      (begin..    
b780: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
b790: 20 22 45 52 52 4f 52 3a 20 41 74 74 65 6d 70 74   "ERROR: Attempt
b7a0: 65 64 20 74 6f 20 22 20 61 63 74 69 6f 6e 2d 64  ed to " action-d
b7b0: 65 73 63 20 22 20 62 75 74 20 72 75 6e 20 61 72  esc " but run ar
b7c0: 65 61 20 63 6f 6e 66 69 67 20 66 69 6c 65 20 6e  ea config file n
b7d0: 6f 74 20 66 6f 75 6e 64 22 29 0a 09 20 20 20 20  ot found")..    
b7e0: 20 20 28 65 78 69 74 20 31 29 29 0a 09 20 20 20    (exit 1))..   
b7f0: 20 3b 3b 20 45 78 74 72 61 63 74 20 6f 75 74 20   ;; Extract out 
b800: 73 74 75 66 66 20 6e 65 65 64 65 64 20 69 6e 20  stuff needed in 
b810: 6d 6f 73 74 20 6f 72 20 6d 61 6e 79 20 63 61 6c  most or many cal
b820: 6c 73 0a 09 20 20 20 20 3b 3b 20 68 65 72 65 20  ls..    ;; here 
b830: 74 68 65 6e 20 63 61 6c 6c 20 70 72 6f 63 0a 09  then call proc..
b840: 20 20 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 6e      (let* ((keyn
b850: 61 6d 65 73 20 20 20 28 6d 61 70 20 6b 65 79 3a  ames   (map key:
b860: 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65  get-fieldname ke
b870: 79 73 29 29 0a 09 09 20 20 20 28 6b 65 79 76 61  ys))...   (keyva
b880: 6c 6c 73 74 20 20 28 6b 65 79 73 2d 3e 76 61 6c  llst  (keys->val
b890: 6c 69 73 74 20 6b 65 79 73 20 23 74 29 29 29 0a  list keys #t))).
b8a0: 09 20 20 20 20 20 20 28 70 72 6f 63 20 74 61 72  .      (proc tar
b8b0: 67 65 74 20 72 75 6e 6e 61 6d 65 20 6b 65 79 73  get runname keys
b8c0: 20 6b 65 79 6e 61 6d 65 73 20 6b 65 79 76 61 6c   keynames keyval
b8d0: 6c 73 74 29 29 29 0a 09 28 69 66 20 74 68 31 20  lst)))..(if th1 
b8e0: 28 74 68 72 65 61 64 2d 6a 6f 69 6e 21 20 74 68  (thread-join! th
b8f0: 31 29 29 0a 09 28 69 66 20 64 62 20 28 73 71 6c  1))..(if db (sql
b900: 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64  ite3:finalize! d
b910: 62 29 29 0a 09 28 73 65 74 21 20 2a 64 69 64 73  b))..(set! *dids
b920: 6f 6d 65 74 68 69 6e 67 2a 20 23 74 29 29 29 29  omething* #t))))
b930: 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ))..;;==========
b940: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b950: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b960: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b970: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20  ============.;; 
b980: 4c 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 72 75 6e 73  Lock/unlock runs
b990: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  .;;=============
b9a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b9b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b9c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b9d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69  =========..(defi
b9e0: 6e 65 20 28 72 75 6e 73 3a 68 61 6e 64 6c 65 2d  ne (runs:handle-
b9f0: 6c 6f 63 6b 69 6e 67 20 74 61 72 67 65 74 20 6b  locking target k
ba00: 65 79 73 20 72 75 6e 6e 61 6d 65 20 6c 6f 63 6b  eys runname lock
ba10: 20 75 6e 6c 6f 63 6b 20 75 73 65 72 29 0a 20 20   unlock user).  
ba20: 28 6c 65 74 2a 20 28 28 64 62 20 20 20 20 20 20  (let* ((db      
ba30: 20 23 66 29 0a 09 20 28 72 75 6e 64 61 74 20 20   #f).. (rundat  
ba40: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
ba50: 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62   runs:get-runs-b
ba60: 79 2d 70 61 74 74 20 64 62 20 6b 65 79 73 20 72  y-patt db keys r
ba70: 75 6e 6e 61 6d 65 29 29 0a 09 20 28 68 65 61 64  unname)).. (head
ba80: 65 72 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66  er   (vector-ref
ba90: 20 72 75 6e 64 61 74 20 30 29 29 0a 09 20 28 72   rundat 0)).. (r
baa0: 75 6e 73 20 20 20 20 20 28 76 65 63 74 6f 72 2d  uns     (vector-
bab0: 72 65 66 20 72 75 6e 64 61 74 20 31 29 29 29 0a  ref rundat 1))).
bac0: 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 28 6c      (for-each (l
bad0: 61 6d 62 64 61 20 28 72 75 6e 29 0a 09 09 28 6c  ambda (run)...(l
bae0: 65 74 20 28 28 72 75 6e 2d 69 64 20 28 64 62 3a  et ((run-id (db:
baf0: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61  get-value-by-hea
bb00: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22  der run header "
bb10: 69 64 22 29 29 29 0a 09 09 20 20 28 69 66 20 28  id")))...  (if (
bb20: 6f 72 20 6c 6f 63 6b 0a 09 09 09 20 20 28 61 6e  or lock....  (an
bb30: 64 20 75 6e 6c 6f 63 6b 0a 09 09 09 20 20 20 20  d unlock....    
bb40: 20 20 20 28 62 65 67 69 6e 0a 09 09 09 09 20 28     (begin..... (
bb50: 70 72 69 6e 74 20 22 44 6f 20 79 6f 75 20 72 65  print "Do you re
bb60: 61 6c 6c 79 20 77 69 73 68 20 74 6f 20 75 6e 6c  ally wish to unl
bb70: 6f 63 6b 20 72 75 6e 20 22 20 72 75 6e 2d 69 64  ock run " run-id
bb80: 20 22 3f 5c 6e 20 20 20 79 2f 6e 3a 20 22 29 0a   "?\n   y/n: ").
bb90: 09 09 09 09 20 28 65 71 75 61 6c 3f 20 22 79 22  .... (equal? "y"
bba0: 20 28 72 65 61 64 2d 6c 69 6e 65 29 29 29 29 29   (read-line)))))
bbb0: 0a 09 09 20 20 20 20 20 20 28 6f 70 65 6e 2d 72  ...      (open-r
bbc0: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 6c 6f 63 6b  un-close db:lock
bbd0: 2f 75 6e 6c 6f 63 6b 2d 72 75 6e 20 64 62 20 72  /unlock-run db r
bbe0: 75 6e 2d 69 64 20 6c 6f 63 6b 20 75 6e 6c 6f 63  un-id lock unloc
bbf0: 6b 20 75 73 65 72 29 0a 09 09 20 20 20 20 20 20  k user)...      
bc00: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
bc10: 6f 20 30 20 22 53 6b 69 70 70 69 6e 67 20 6c 6f  o 0 "Skipping lo
bc20: 63 6b 2f 75 6e 6c 6f 63 6b 20 6f 6e 20 22 20 72  ck/unlock on " r
bc30: 75 6e 2d 69 64 29 29 29 29 0a 09 20 20 20 20 20  un-id))))..     
bc40: 20 72 75 6e 73 29 29 29 0a 3b 3b 3d 3d 3d 3d 3d   runs))).;;=====
bc50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
bc60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
bc70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
bc80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
bc90: 3d 0a 3b 3b 20 52 6f 6c 6c 75 70 20 72 75 6e 73  =.;; Rollup runs
bca0: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  .;;=============
bcb0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
bcc0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
bcd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
bce0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 55 70  =========..;; Up
bcf0: 64 61 74 65 20 74 68 65 20 74 65 73 74 5f 6d 65  date the test_me
bd00: 74 61 20 74 61 62 6c 65 20 66 6f 72 20 74 68 69  ta table for thi
bd10: 73 20 74 65 73 74 0a 28 64 65 66 69 6e 65 20 28  s test.(define (
bd20: 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74  runs:update-test
bd30: 5f 6d 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61  _meta db test-na
bd40: 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 0a 20 20  me test-conf).  
bd50: 28 6c 65 74 20 28 28 63 75 72 72 72 65 63 6f 72  (let ((currrecor
bd60: 64 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75  d (cdb:remote-ru
bd70: 6e 20 64 62 3a 74 65 73 74 6d 65 74 61 2d 67 65  n db:testmeta-ge
bd80: 74 2d 72 65 63 6f 72 64 20 64 62 20 74 65 73 74  t-record db test
bd90: 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 69 66  -name))).    (if
bda0: 20 28 6e 6f 74 20 63 75 72 72 72 65 63 6f 72 64   (not currrecord
bdb0: 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 73 65  )..(begin..  (se
bdc0: 74 21 20 63 75 72 72 72 65 63 6f 72 64 20 28 6d  t! currrecord (m
bdd0: 61 6b 65 2d 76 65 63 74 6f 72 20 31 30 20 23 66  ake-vector 10 #f
bde0: 29 29 0a 09 20 20 28 63 64 62 3a 72 65 6d 6f 74  ))..  (cdb:remot
bdf0: 65 2d 72 75 6e 20 64 62 3a 74 65 73 74 6d 65 74  e-run db:testmet
be00: 61 2d 61 64 64 2d 72 65 63 6f 72 64 20 64 62 20  a-add-record db 
be10: 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20  test-name))).   
be20: 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20   (for-each .    
be30: 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 29 0a 20   (lambda (key). 
be40: 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 69 64        (let* ((id
be50: 78 20 28 63 61 64 72 20 6b 65 79 29 29 0a 09 20  x (cadr key)).. 
be60: 20 20 20 20 20 28 66 6c 64 20 28 63 61 72 20 20       (fld (car  
be70: 6b 65 79 29 29 0a 09 20 20 20 20 20 20 28 76 61  key))..      (va
be80: 6c 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70  l (config-lookup
be90: 20 74 65 73 74 2d 63 6f 6e 66 20 22 74 65 73 74   test-conf "test
bea0: 5f 6d 65 74 61 22 20 66 6c 64 29 29 29 0a 09 20  _meta" fld))).. 
beb0: 3b 3b 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  ;; (debug:print 
bec0: 35 20 22 69 64 78 3a 20 22 20 69 64 78 20 22 20  5 "idx: " idx " 
bed0: 66 6c 64 3a 20 22 20 66 6c 64 20 22 20 76 61 6c  fld: " fld " val
bee0: 3a 20 22 20 76 61 6c 29 0a 09 20 28 69 66 20 28  : " val).. (if (
bef0: 61 6e 64 20 76 61 6c 20 28 6e 6f 74 20 28 65 71  and val (not (eq
bf00: 75 61 6c 3f 20 28 76 65 63 74 6f 72 2d 72 65 66  ual? (vector-ref
bf10: 20 63 75 72 72 72 65 63 6f 72 64 20 69 64 78 29   currrecord idx)
bf20: 20 76 61 6c 29 29 29 0a 09 20 20 20 20 20 28 62   val)))..     (b
bf30: 65 67 69 6e 0a 09 20 20 20 20 20 20 20 28 70 72  egin..       (pr
bf40: 69 6e 74 20 22 55 70 64 61 74 69 6e 67 20 22 20  int "Updating " 
bf50: 74 65 73 74 2d 6e 61 6d 65 20 22 20 22 20 66 6c  test-name " " fl
bf60: 64 20 22 20 74 6f 20 22 20 76 61 6c 29 0a 09 20  d " to " val).. 
bf70: 20 20 20 20 20 20 28 63 64 62 3a 72 65 6d 6f 74        (cdb:remot
bf80: 65 2d 72 75 6e 20 64 62 3a 74 65 73 74 6d 65 74  e-run db:testmet
bf90: 61 2d 75 70 64 61 74 65 2d 66 69 65 6c 64 20 64  a-update-field d
bfa0: 62 20 74 65 73 74 2d 6e 61 6d 65 20 66 6c 64 20  b test-name fld 
bfb0: 76 61 6c 29 29 29 29 29 0a 20 20 20 20 20 27 28  val))))).     '(
bfc0: 28 22 61 75 74 68 6f 72 22 20 32 29 28 22 6f 77  ("author" 2)("ow
bfd0: 6e 65 72 22 20 33 29 28 22 64 65 73 63 72 69 70  ner" 3)("descrip
bfe0: 74 69 6f 6e 22 20 34 29 28 22 72 65 76 69 65 77  tion" 4)("review
bff0: 65 64 22 20 35 29 28 22 74 61 67 73 22 20 39 29  ed" 5)("tags" 9)
c000: 29 29 29 29 0a 0a 3b 3b 20 55 70 64 61 74 65 20  ))))..;; Update 
c010: 74 65 73 74 5f 6d 65 74 61 20 66 6f 72 20 61 6c  test_meta for al
c020: 6c 20 74 65 73 74 73 0a 28 64 65 66 69 6e 65 20  l tests.(define 
c030: 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 61 6c 6c  (runs:update-all
c040: 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 29 0a 20  -test_meta db). 
c050: 20 28 6c 65 74 20 28 28 74 65 73 74 2d 6e 61 6d   (let ((test-nam
c060: 65 73 20 28 67 65 74 2d 61 6c 6c 2d 6c 65 67 61  es (get-all-lega
c070: 6c 2d 74 65 73 74 73 29 29 29 0a 20 20 20 20 28  l-tests))).    (
c080: 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28  for-each .     (
c090: 6c 61 6d 62 64 61 20 28 74 65 73 74 2d 6e 61 6d  lambda (test-nam
c0a0: 65 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20  e).       (let* 
c0b0: 28 28 74 65 73 74 2d 70 61 74 68 20 20 20 20 28  ((test-path    (
c0c0: 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 22  conc *toppath* "
c0d0: 2f 74 65 73 74 73 2f 22 20 74 65 73 74 2d 6e 61  /tests/" test-na
c0e0: 6d 65 29 29 0a 09 20 20 20 20 20 20 28 74 65 73  me))..      (tes
c0f0: 74 2d 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20  t-configf (conc 
c100: 74 65 73 74 2d 70 61 74 68 20 22 2f 74 65 73 74  test-path "/test
c110: 63 6f 6e 66 69 67 22 29 29 0a 09 20 20 20 20 20  config"))..     
c120: 20 28 74 65 73 74 65 78 69 73 74 73 20 20 20 28   (testexists   (
c130: 61 6e 64 20 28 66 69 6c 65 2d 65 78 69 73 74 73  and (file-exists
c140: 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 28  ? test-configf)(
c150: 66 69 6c 65 2d 72 65 61 64 2d 61 63 63 65 73 73  file-read-access
c160: 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 29  ? test-configf))
c170: 29 0a 09 20 20 20 20 20 20 3b 3b 20 72 65 61 64  )..      ;; read
c180: 20 63 6f 6e 66 69 67 73 20 77 69 74 68 20 74 72   configs with tr
c190: 69 63 6b 73 20 74 75 72 6e 65 64 20 6f 66 66 20  icks turned off 
c1a0: 28 69 2e 65 2e 20 6e 6f 20 73 79 73 74 65 6d 29  (i.e. no system)
c1b0: 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d 63 6f  ..      (test-co
c1c0: 6e 66 20 20 20 20 28 69 66 20 74 65 73 74 65 78  nf    (if testex
c1d0: 69 73 74 73 20 28 72 65 61 64 2d 63 6f 6e 66 69  ists (read-confi
c1e0: 67 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 23  g test-configf #
c1f0: 66 20 23 66 29 28 6d 61 6b 65 2d 68 61 73 68 2d  f #f)(make-hash-
c200: 74 61 62 6c 65 29 29 29 29 0a 09 20 3b 3b 20 75  table)))).. ;; u
c210: 73 65 20 74 68 65 20 6f 70 65 6e 2d 72 75 6e 2d  se the open-run-
c220: 63 6c 6f 73 65 20 69 6e 73 74 65 61 64 20 6f 66  close instead of
c230: 20 70 61 73 73 69 6e 67 20 69 6e 20 64 62 0a 09   passing in db..
c240: 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65   (runs:update-te
c250: 73 74 5f 6d 65 74 61 20 23 66 20 74 65 73 74 2d  st_meta #f test-
c260: 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 29  name test-conf))
c270: 29 0a 20 20 20 20 20 74 65 73 74 2d 6e 61 6d 65  ).     test-name
c280: 73 29 29 29 0a 0a 3b 3b 20 54 68 69 73 20 63 6f  s)))..;; This co
c290: 75 6c 64 20 70 72 6f 62 61 62 6c 79 20 62 65 20  uld probably be 
c2a0: 72 65 66 61 63 74 6f 72 65 64 20 69 6e 74 6f 20  refactored into 
c2b0: 6f 6e 65 20 63 6f 6d 70 6c 65 78 20 71 75 65 72  one complex quer
c2c0: 79 20 2e 2e 2e 0a 28 64 65 66 69 6e 65 20 28 72  y ....(define (r
c2d0: 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 20 6b  uns:rollup-run k
c2e0: 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75  eys keyvallst ru
c2f0: 6e 6e 61 6d 65 20 75 73 65 72 29 20 3b 3b 20 77  nname user) ;; w
c300: 61 73 20 74 61 72 67 65 74 2c 20 6e 6f 77 20 6b  as target, now k
c310: 65 79 76 61 6c 6c 73 74 0a 20 20 28 64 65 62 75  eyvallst.  (debu
c320: 67 3a 70 72 69 6e 74 20 34 20 22 72 75 6e 73 3a  g:print 4 "runs:
c330: 72 6f 6c 6c 75 70 2d 72 75 6e 2c 20 6b 65 79 73  rollup-run, keys
c340: 3a 20 22 20 6b 65 79 73 20 22 20 6b 65 79 76 61  : " keys " keyva
c350: 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73  llst: " keyvalls
c360: 74 20 22 20 3a 72 75 6e 6e 61 6d 65 20 22 20 72  t " :runname " r
c370: 75 6e 6e 61 6d 65 20 22 20 75 73 65 72 3a 20 22  unname " user: "
c380: 20 75 73 65 72 29 0a 20 20 28 6c 65 74 2a 20 28   user).  (let* (
c390: 28 64 62 20 20 20 20 20 20 20 20 20 20 20 20 20  (db             
c3a0: 20 23 66 29 20 3b 3b 20 28 6b 65 79 76 61 6c 6c   #f) ;; (keyvall
c3b0: 6c 73 74 20 20 20 20 20 20 28 6b 65 79 73 3a 74  lst      (keys:t
c3c0: 61 72 67 65 74 2d 3e 6b 65 79 76 61 6c 20 6b 65  arget->keyval ke
c3d0: 79 73 20 74 61 72 67 65 74 29 29 0a 09 20 28 6e  ys target)).. (n
c3e0: 65 77 2d 72 75 6e 2d 69 64 20 20 20 20 20 20 28  ew-run-id      (
c3f0: 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64  cdb:remote-run d
c400: 62 3a 72 65 67 69 73 74 65 72 2d 72 75 6e 20 23  b:register-run #
c410: 66 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74  f keys keyvallst
c420: 20 72 75 6e 6e 61 6d 65 20 22 6e 65 77 22 20 22   runname "new" "
c430: 6e 2f 61 22 20 75 73 65 72 29 29 0a 09 20 28 70  n/a" user)).. (p
c440: 72 65 76 2d 74 65 73 74 73 20 20 20 20 20 20 28  rev-tests      (
c450: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 74  open-run-close t
c460: 65 73 74 3a 67 65 74 2d 6d 61 74 63 68 69 6e 67  est:get-matching
c470: 2d 70 72 65 76 69 6f 75 73 2d 74 65 73 74 2d 72  -previous-test-r
c480: 75 6e 2d 72 65 63 6f 72 64 73 20 64 62 20 6e 65  un-records db ne
c490: 77 2d 72 75 6e 2d 69 64 20 22 25 22 20 22 25 22  w-run-id "%" "%"
c4a0: 29 29 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73  )).. (curr-tests
c4b0: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d        (open-run-
c4c0: 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73  close db:get-tes
c4d0: 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65  ts-for-run db ne
c4e0: 77 2d 72 75 6e 2d 69 64 20 22 25 2f 25 22 20 27  w-run-id "%/%" '
c4f0: 28 29 20 27 28 29 29 29 0a 09 20 28 63 75 72 72  () '())).. (curr
c500: 2d 74 65 73 74 73 2d 68 61 73 68 20 28 6d 61 6b  -tests-hash (mak
c510: 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a  e-hash-table))).
c520: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c      (open-run-cl
c530: 6f 73 65 20 64 62 3a 75 70 64 61 74 65 2d 72 75  ose db:update-ru
c540: 6e 2d 65 76 65 6e 74 5f 74 69 6d 65 20 64 62 20  n-event_time db 
c550: 6e 65 77 2d 72 75 6e 2d 69 64 29 0a 20 20 20 20  new-run-id).    
c560: 3b 3b 20 69 6e 64 65 78 20 74 68 65 20 61 6c 72  ;; index the alr
c570: 65 61 64 79 20 73 61 76 65 64 20 74 65 73 74 73  eady saved tests
c580: 20 62 79 20 74 65 73 74 6e 61 6d 65 20 61 6e 64   by testname and
c590: 20 69 74 65 6d 64 61 74 20 69 6e 20 63 75 72 72   itemdat in curr
c5a0: 2d 74 65 73 74 73 2d 68 61 73 68 0a 20 20 20 20  -tests-hash.    
c5b0: 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 28  (for-each.     (
c5c0: 6c 61 6d 62 64 61 20 28 74 65 73 74 64 61 74 29  lambda (testdat)
c5d0: 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28  .       (let* ((
c5e0: 74 65 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 65  testname  (db:te
c5f0: 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20  st-get-testname 
c600: 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20  testdat))..     
c610: 20 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a   (item-path (db:
c620: 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61  test-get-item-pa
c630: 74 68 20 74 65 73 74 64 61 74 29 29 0a 09 20 20  th testdat))..  
c640: 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28      (full-name (
c650: 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f  conc testname "/
c660: 22 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 09  " item-path)))..
c670: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74   (hash-table-set
c680: 21 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73  ! curr-tests-has
c690: 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 74 65 73 74  h full-name test
c6a0: 64 61 74 29 29 29 0a 20 20 20 20 20 63 75 72 72  dat))).     curr
c6b0: 2d 74 65 73 74 73 29 0a 20 20 20 20 3b 3b 20 4e  -tests).    ;; N
c6c0: 4f 50 45 3a 20 4e 6f 6e 2d 6f 70 74 69 6d 61 6c  OPE: Non-optimal
c6d0: 20 61 70 70 72 6f 61 63 68 2e 20 54 72 79 20 74   approach. Try t
c6e0: 68 69 73 20 69 6e 73 74 65 61 64 2e 0a 20 20 20  his instead..   
c6f0: 20 3b 3b 20 20 20 31 2e 20 74 65 73 74 73 20 61   ;;   1. tests a
c700: 72 65 20 72 65 63 65 69 76 65 64 20 69 6e 20 61  re received in a
c710: 20 6c 69 73 74 2c 20 6d 6f 73 74 20 72 65 63 65   list, most rece
c720: 6e 74 20 66 69 72 73 74 0a 20 20 20 20 3b 3b 20  nt first.    ;; 
c730: 20 20 32 2e 20 72 65 70 6c 61 63 65 20 74 68 65    2. replace the
c740: 20 72 6f 6c 6c 75 70 20 74 65 73 74 20 77 69 74   rollup test wit
c750: 68 20 74 68 65 20 6e 65 77 20 2a 61 6c 77 61 79  h the new *alway
c760: 73 2a 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68  s*.    (for-each
c770: 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28   .     (lambda (
c780: 74 65 73 74 64 61 74 29 0a 20 20 20 20 20 20 20  testdat).       
c790: 28 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65  (let* ((testname
c7a0: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74    (db:test-get-t
c7b0: 65 73 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29  estname testdat)
c7c0: 29 0a 09 20 20 20 20 20 20 28 69 74 65 6d 2d 70  )..      (item-p
c7d0: 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74  ath (db:test-get
c7e0: 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 64  -item-path testd
c7f0: 61 74 29 29 0a 09 20 20 20 20 20 20 28 66 75 6c  at))..      (ful
c800: 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73  l-name (conc tes
c810: 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70  tname "/" item-p
c820: 61 74 68 29 29 0a 09 20 20 20 20 20 20 28 70 72  ath))..      (pr
c830: 65 76 2d 74 65 73 74 2d 64 61 74 20 28 68 61 73  ev-test-dat (has
c840: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61  h-table-ref/defa
c850: 75 6c 74 20 63 75 72 72 2d 74 65 73 74 73 2d 68  ult curr-tests-h
c860: 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 23 66  ash full-name #f
c870: 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d  ))..      (test-
c880: 73 74 65 70 73 20 20 20 20 20 20 28 6f 70 65 6e  steps      (open
c890: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65  -run-close db:ge
c8a0: 74 2d 73 74 65 70 73 2d 66 6f 72 2d 74 65 73 74  t-steps-for-test
c8b0: 20 64 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74   db (db:test-get
c8c0: 2d 69 64 20 74 65 73 74 64 61 74 29 29 29 0a 09  -id testdat)))..
c8d0: 20 20 20 20 20 20 28 6e 65 77 2d 74 65 73 74 2d        (new-test-
c8e0: 72 65 63 6f 72 64 20 23 66 29 29 0a 09 20 3b 3b  record #f)).. ;;
c8f0: 20 72 65 70 6c 61 63 65 20 74 68 65 73 65 20 77   replace these w
c900: 69 74 68 20 69 6e 73 65 72 74 20 2e 2e 2e 20 73  ith insert ... s
c910: 65 6c 65 63 74 0a 09 20 28 61 70 70 6c 79 20 73  elect.. (apply s
c920: 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a  qlite3:execute .
c930: 09 09 64 62 20 0a 09 09 28 63 6f 6e 63 20 22 49  ..db ...(conc "I
c940: 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45  NSERT OR REPLACE
c950: 20 49 4e 54 4f 20 74 65 73 74 73 20 28 72 75 6e   INTO tests (run
c960: 5f 69 64 2c 74 65 73 74 6e 61 6d 65 2c 73 74 61  _id,testname,sta
c970: 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f  te,status,event_
c980: 74 69 6d 65 2c 68 6f 73 74 2c 63 70 75 6c 6f 61  time,host,cpuloa
c990: 64 2c 64 69 73 6b 66 72 65 65 2c 75 6e 61 6d 65  d,diskfree,uname
c9a0: 2c 72 75 6e 64 69 72 2c 69 74 65 6d 5f 70 61 74  ,rundir,item_pat
c9b0: 68 2c 72 75 6e 5f 64 75 72 61 74 69 6f 6e 2c 66  h,run_duration,f
c9c0: 69 6e 61 6c 5f 6c 6f 67 66 2c 63 6f 6d 6d 65 6e  inal_logf,commen
c9d0: 74 29 20 22 0a 09 09 20 20 20 20 20 20 22 56 41  t) "...      "VA
c9e0: 4c 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c  LUES (?,?,?,?,?,
c9f0: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c  ?,?,?,?,?,?,?,?,
ca00: 3f 29 3b 22 29 0a 09 09 6e 65 77 2d 72 75 6e 2d  ?);")...new-run-
ca10: 69 64 20 28 63 64 64 72 20 28 76 65 63 74 6f 72  id (cddr (vector
ca20: 2d 3e 6c 69 73 74 20 74 65 73 74 64 61 74 29 29  ->list testdat))
ca30: 29 0a 09 20 28 73 65 74 21 20 6e 65 77 2d 74 65  ).. (set! new-te
ca40: 73 74 64 61 74 20 28 63 61 72 20 28 6f 70 65 6e  stdat (car (open
ca50: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65  -run-close db:ge
ca60: 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20  t-tests-for-run 
ca70: 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 28 63  db new-run-id (c
ca80: 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22  onc testname "/"
ca90: 20 69 74 65 6d 2d 70 61 74 68 29 20 27 28 29 20   item-path) '() 
caa0: 27 28 29 29 29 29 0a 09 20 28 68 61 73 68 2d 74  '()))).. (hash-t
cab0: 61 62 6c 65 2d 73 65 74 21 20 63 75 72 72 2d 74  able-set! curr-t
cac0: 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e  ests-hash full-n
cad0: 61 6d 65 20 6e 65 77 2d 74 65 73 74 64 61 74 29  ame new-testdat)
cae0: 20 3b 3b 20 74 68 69 73 20 63 6f 75 6c 64 20 62   ;; this could b
caf0: 65 20 63 6f 6e 66 75 73 69 6e 67 2c 20 77 68 69  e confusing, whi
cb00: 63 68 20 72 65 63 6f 72 64 20 73 68 6f 75 6c 64  ch record should
cb10: 20 67 6f 20 69 6e 74 6f 20 74 68 65 20 6c 6f 6f   go into the loo
cb20: 6b 75 70 20 74 61 62 6c 65 3f 0a 09 20 3b 3b 20  kup table?.. ;; 
cb30: 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74 68  Now duplicate th
cb40: 65 20 74 65 73 74 20 73 74 65 70 73 0a 09 20 28  e test steps.. (
cb50: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 43  debug:print 4 "C
cb60: 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 73 20 69  opying records i
cb70: 6e 20 74 65 73 74 5f 73 74 65 70 73 20 66 72 6f  n test_steps fro
cb80: 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62 3a  m test_id=" (db:
cb90: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74  test-get-id test
cba0: 64 61 74 29 20 22 20 74 6f 20 22 20 28 64 62 3a  dat) " to " (db:
cbb0: 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d  test-get-id new-
cbc0: 74 65 73 74 64 61 74 29 29 0a 09 20 28 6f 70 65  testdat)).. (ope
cbd0: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 0a 09 20 20  n-run-close ..  
cbe0: 28 6c 61 6d 62 64 61 20 28 29 0a 09 20 20 20 20  (lambda ()..    
cbf0: 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65  (sqlite3:execute
cc00: 20 0a 09 20 20 20 20 20 64 62 20 0a 09 20 20 20   ..     db ..   
cc10: 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20    (conc "INSERT 
cc20: 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20  OR REPLACE INTO 
cc30: 74 65 73 74 5f 73 74 65 70 73 20 28 74 65 73 74  test_steps (test
cc40: 5f 69 64 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61  _id,stepname,sta
cc50: 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f  te,status,event_
cc60: 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a  time,comment) ".
cc70: 09 09 20 20 20 22 53 45 4c 45 43 54 20 22 20 28  ..   "SELECT " (
cc80: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e  db:test-get-id n
cc90: 65 77 2d 74 65 73 74 64 61 74 29 20 22 2c 73 74  ew-testdat) ",st
cca0: 65 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61  epname,state,sta
ccb0: 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63  tus,event_time,c
ccc0: 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 74  omment FROM test
ccd0: 5f 73 74 65 70 73 20 57 48 45 52 45 20 74 65 73  _steps WHERE tes
cce0: 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 20 20 20  t_id=?;")..     
ccf0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20  (db:test-get-id 
cd00: 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 3b  testdat))..    ;
cd10: 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20  ; Now duplicate 
cd20: 74 68 65 20 74 65 73 74 20 64 61 74 61 0a 09 20  the test data.. 
cd30: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
cd40: 34 20 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 72  4 "Copying recor
cd50: 64 73 20 69 6e 20 74 65 73 74 5f 64 61 74 61 20  ds in test_data 
cd60: 66 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28  from test_id=" (
cd70: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74  db:test-get-id t
cd80: 65 73 74 64 61 74 29 20 22 20 74 6f 20 22 20 28  estdat) " to " (
cd90: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e  db:test-get-id n
cda0: 65 77 2d 74 65 73 74 64 61 74 29 29 0a 09 20 20  ew-testdat))..  
cdb0: 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75    (sqlite3:execu
cdc0: 74 65 20 0a 09 20 20 20 20 20 64 62 20 0a 09 20  te ..     db .. 
cdd0: 20 20 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 52      (conc "INSER
cde0: 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54  T OR REPLACE INT
cdf0: 4f 20 74 65 73 74 5f 64 61 74 61 20 28 74 65 73  O test_data (tes
ce00: 74 5f 69 64 2c 63 61 74 65 67 6f 72 79 2c 76 61  t_id,category,va
ce10: 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70  riable,value,exp
ce20: 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c  ected,tol,units,
ce30: 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20 20  comment) "...   
ce40: 22 53 45 4c 45 43 54 20 22 20 28 64 62 3a 74 65  "SELECT " (db:te
ce50: 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65  st-get-id new-te
ce60: 73 74 64 61 74 29 20 22 2c 63 61 74 65 67 6f 72  stdat) ",categor
ce70: 79 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65  y,variable,value
ce80: 2c 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e  ,expected,tol,un
ce90: 69 74 73 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d  its,comment FROM
cea0: 20 74 65 73 74 5f 64 61 74 61 20 57 48 45 52 45   test_data WHERE
ceb0: 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20   test_id=?;").. 
cec0: 20 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74      (db:test-get
ced0: 2d 69 64 20 74 65 73 74 64 61 74 29 29 29 29 0a  -id testdat)))).
cee0: 09 20 29 29 0a 20 20 20 20 20 70 72 65 76 2d 74  . )).     prev-t
cef0: 65 73 74 73 29 29 29 0a 09 20 0a 20 20 20 20 20  ests))).. .     
cf00: 0a                                               .