Megatest

Hex Artifact Content
Login

Artifact 2a43a8e327f6e9756c29613e90cb5cef99b7cfed:


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 3b 3b 20 74 65 73 74 2d 72  th)))..;; test-r
35b0: 65 63 6f 72 64 73 20 69 73 20 61 20 68 61 73 68  ecords is a hash
35c0: 20 74 61 62 6c 65 20 74 65 73 74 6e 61 6d 65 3a   table testname:
35d0: 69 74 65 6d 5f 70 61 74 68 20 3d 3e 20 76 65 63  item_path => vec
35e0: 74 6f 72 20 3c 20 74 65 73 74 6e 61 6d 65 20 74  tor < testname t
35f0: 65 73 74 63 6f 6e 66 69 67 20 77 61 69 74 6f 6e  estconfig waiton
3600: 73 20 70 72 69 6f 72 69 74 79 20 69 74 65 6d 73  s priority items
3610: 2d 69 6e 66 6f 20 2e 2e 2e 20 3e 0a 28 64 65 66  -info ... >.(def
3620: 69 6e 65 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65  ine (runs:run-te
3630: 73 74 73 2d 71 75 65 75 65 20 72 75 6e 2d 69 64  sts-queue run-id
3640: 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d 72 65   runname test-re
3650: 63 6f 72 64 73 20 6b 65 79 76 61 6c 6c 73 74 20  cords keyvallst 
3660: 66 6c 61 67 73 20 74 65 73 74 2d 70 61 74 74 73  flags test-patts
3670: 29 0a 20 20 20 20 3b 3b 20 41 74 20 74 68 69 73  ).    ;; At this
3680: 20 70 6f 69 6e 74 20 74 68 65 20 6c 69 73 74 20   point the list 
3690: 6f 66 20 70 61 72 65 6e 74 20 74 65 73 74 73 20  of parent tests 
36a0: 69 73 20 65 78 70 61 6e 64 65 64 20 0a 20 20 20  is expanded .   
36b0: 20 3b 3b 20 4e 42 2f 2f 20 53 68 6f 75 6c 64 20   ;; NB// Should 
36c0: 65 78 70 61 6e 64 20 69 74 65 6d 73 20 68 65 72  expand items her
36d0: 65 20 61 6e 64 20 74 68 65 6e 20 69 6e 73 65 72  e and then inser
36e0: 74 20 69 6e 74 6f 20 74 68 65 20 72 75 6e 20 71  t into the run q
36f0: 75 65 75 65 2e 0a 20 20 28 64 65 62 75 67 3a 70  ueue..  (debug:p
3700: 72 69 6e 74 20 35 20 22 74 65 73 74 2d 72 65 63  rint 5 "test-rec
3710: 6f 72 64 73 3a 20 22 20 74 65 73 74 2d 72 65 63  ords: " test-rec
3720: 6f 72 64 73 20 22 2c 20 6b 65 79 76 61 6c 6c 73  ords ", keyvalls
3730: 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 20 22  t: " keyvallst "
3740: 20 66 6c 61 67 73 3a 20 22 20 28 68 61 73 68 2d   flags: " (hash-
3750: 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 66 6c 61  table->alist fla
3760: 67 73 29 29 0a 20 20 28 6c 65 74 20 28 28 73 6f  gs)).  (let ((so
3770: 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 20  rted-test-names 
3780: 28 74 65 73 74 73 3a 73 6f 72 74 2d 62 79 2d 70  (tests:sort-by-p
3790: 72 69 6f 72 69 74 79 2d 61 6e 64 2d 77 61 69 74  riority-and-wait
37a0: 6f 6e 20 74 65 73 74 2d 72 65 63 6f 72 64 73 29  on test-records)
37b0: 29 0a 09 28 74 65 73 74 2d 72 65 67 69 73 74 65  )..(test-registe
37c0: 72 79 20 20 20 20 28 6d 61 6b 65 2d 68 61 73 68  ry    (make-hash
37d0: 2d 74 61 62 6c 65 29 29 0a 09 28 72 65 67 69 73  -table))..(regis
37e0: 74 65 72 79 2d 6d 75 74 65 78 20 20 20 28 6d 61  tery-mutex   (ma
37f0: 6b 65 2d 6d 75 74 65 78 29 29 0a 09 28 6e 75 6d  ke-mutex))..(num
3800: 2d 72 65 74 72 69 65 73 20 20 20 20 20 20 20 20  -retries        
3810: 30 29 0a 09 28 6d 61 78 2d 72 65 74 72 69 65 73  0)..(max-retries
3820: 20 20 20 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c         (config-l
3830: 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 74  ookup *configdat
3840: 2a 20 22 73 65 74 75 70 22 20 22 6d 61 78 72 65  * "setup" "maxre
3850: 74 72 69 65 73 22 29 29 0a 09 28 6d 61 78 2d 63  tries"))..(max-c
3860: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 20  oncurrent-jobs  
3870: 20 20 20 28 6c 65 74 20 28 28 6d 63 6a 20 28 63     (let ((mcj (c
3880: 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f  onfig-lookup *co
3890: 6e 66 69 67 64 61 74 2a 20 22 73 65 74 75 70 22  nfigdat* "setup"
38a0: 20 20 20 20 20 22 6d 61 78 5f 63 6f 6e 63 75 72       "max_concur
38b0: 72 65 6e 74 5f 6a 6f 62 73 22 29 29 29 0a 09 09  rent_jobs")))...
38c0: 09 09 20 20 20 20 28 69 66 20 28 61 6e 64 20 6d  ..    (if (and m
38d0: 63 6a 20 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62  cj (string->numb
38e0: 65 72 20 6d 63 6a 29 29 0a 09 09 09 09 09 28 73  er mcj))......(s
38f0: 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 63  tring->number mc
3900: 6a 29 0a 09 09 09 09 09 31 29 29 29 29 0a 20 20  j)......1)))).  
3910: 20 20 28 73 65 74 21 20 6d 61 78 2d 72 65 74 72    (set! max-retr
3920: 69 65 73 20 28 69 66 20 28 61 6e 64 20 6d 61 78  ies (if (and max
3930: 2d 72 65 74 72 69 65 73 20 28 73 74 72 69 6e 67  -retries (string
3940: 2d 3e 6e 75 6d 62 65 72 20 6d 61 78 2d 72 65 74  ->number max-ret
3950: 72 69 65 73 29 29 28 73 74 72 69 6e 67 2d 3e 6e  ries))(string->n
3960: 75 6d 62 65 72 20 6d 61 78 2d 72 65 74 72 69 65  umber max-retrie
3970: 73 29 20 31 30 30 29 29 0a 20 20 20 20 28 69 66  s) 100)).    (if
3980: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 73 6f 72   (not (null? sor
3990: 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29  ted-test-names))
39a0: 0a 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68 65  ..(let loop ((he
39b0: 64 20 20 20 20 20 20 20 20 20 28 63 61 72 20 73  d         (car s
39c0: 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73  orted-test-names
39d0: 29 29 0a 09 09 20 20 20 28 74 61 6c 20 20 20 20  ))...   (tal    
39e0: 20 20 20 20 20 28 63 64 72 20 73 6f 72 74 65 64       (cdr sorted
39f0: 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 09  -test-names))...
3a00: 20 20 20 28 72 65 72 75 6e 73 20 20 20 20 20 20     (reruns      
3a10: 27 28 29 29 29 0a 09 20 20 28 69 66 20 28 6e 6f  '()))..  (if (no
3a20: 74 20 28 6e 75 6c 6c 3f 20 72 65 72 75 6e 73 29  t (null? reruns)
3a30: 29 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e  )(debug:print-in
3a40: 66 6f 20 34 20 22 72 65 72 75 6e 73 3d 22 20 72  fo 4 "reruns=" r
3a50: 65 72 75 6e 73 29 29 0a 09 20 20 3b 3b 20 28 70  eruns))..  ;; (p
3a60: 72 69 6e 74 20 22 54 6f 70 20 6f 66 20 6c 6f 6f  rint "Top of loo
3a70: 70 2c 20 68 65 64 3d 22 20 68 65 64 20 22 2c 20  p, hed=" hed ", 
3a80: 74 61 6c 3d 22 20 74 61 6c 20 22 20 2c 72 65 72  tal=" tal " ,rer
3a90: 75 6e 73 3d 22 20 72 65 72 75 6e 73 29 0a 09 20  uns=" reruns).. 
3aa0: 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 72 65   (let* ((test-re
3ab0: 63 6f 72 64 20 28 68 61 73 68 2d 74 61 62 6c 65  cord (hash-table
3ac0: 2d 72 65 66 20 74 65 73 74 2d 72 65 63 6f 72 64  -ref test-record
3ad0: 73 20 68 65 64 29 29 0a 09 09 20 28 74 65 73 74  s hed))... (test
3ae0: 2d 6e 61 6d 65 20 20 20 28 74 65 73 74 73 3a 74  -name   (tests:t
3af0: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73  estqueue-get-tes
3b00: 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72  tname test-recor
3b10: 64 29 29 0a 09 09 20 28 74 63 6f 6e 66 69 67 20  d))... (tconfig 
3b20: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71      (tests:testq
3b30: 75 65 75 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e  ueue-get-testcon
3b40: 66 69 67 20 74 65 73 74 2d 72 65 63 6f 72 64 29  fig test-record)
3b50: 29 0a 09 09 20 28 74 65 73 74 6d 6f 64 65 20 20  )... (testmode  
3b60: 20 20 28 6c 65 74 20 28 28 6d 20 28 63 6f 6e 66    (let ((m (conf
3b70: 69 67 2d 6c 6f 6f 6b 75 70 20 74 63 6f 6e 66 69  ig-lookup tconfi
3b80: 67 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22  g "requirements"
3b90: 20 22 6d 6f 64 65 22 29 29 29 0a 09 09 09 09 28   "mode"))).....(
3ba0: 69 66 20 6d 20 28 73 74 72 69 6e 67 2d 3e 73 79  if m (string->sy
3bb0: 6d 62 6f 6c 20 6d 29 20 27 6e 6f 72 6d 61 6c 29  mbol m) 'normal)
3bc0: 29 29 0a 09 09 20 28 77 61 69 74 6f 6e 73 20 20  ))... (waitons  
3bd0: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75     (tests:testqu
3be0: 65 75 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20  eue-get-waitons 
3bf0: 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29     test-record))
3c00: 0a 09 09 20 28 70 72 69 6f 72 69 74 79 20 20 20  ... (priority   
3c10: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75   (tests:testqueu
3c20: 65 2d 67 65 74 2d 70 72 69 6f 72 69 74 79 20 20  e-get-priority  
3c30: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09   test-record))..
3c40: 09 20 28 69 74 65 6d 64 61 74 20 20 20 20 20 28  . (itemdat     (
3c50: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
3c60: 67 65 74 2d 69 74 65 6d 64 61 74 20 20 20 20 74  get-itemdat    t
3c70: 65 73 74 2d 72 65 63 6f 72 64 29 29 20 3b 3b 20  est-record)) ;; 
3c80: 69 74 65 6d 64 61 74 20 63 61 6e 20 62 65 20 61  itemdat can be a
3c90: 20 73 74 72 69 6e 67 2c 20 6c 69 73 74 20 6f 72   string, list or
3ca0: 20 23 66 0a 09 09 20 28 69 74 65 6d 73 20 20 20   #f... (items   
3cb0: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71      (tests:testq
3cc0: 75 65 75 65 2d 67 65 74 2d 69 74 65 6d 73 20 20  ueue-get-items  
3cd0: 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29      test-record)
3ce0: 29 0a 09 09 20 28 69 74 65 6d 2d 70 61 74 68 20  )... (item-path 
3cf0: 20 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61    (item-list->pa
3d00: 74 68 20 69 74 65 6d 64 61 74 29 29 0a 09 09 20  th itemdat))... 
3d10: 28 6e 65 77 74 61 6c 20 20 20 20 20 20 28 61 70  (newtal      (ap
3d20: 70 65 6e 64 20 74 61 6c 20 28 6c 69 73 74 20 68  pend tal (list h
3d30: 65 64 29 29 29 29 0a 09 20 20 20 20 0a 09 20 20  ed))))..    ..  
3d40: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 36    (debug:print 6
3d50: 0a 09 09 09 20 22 74 65 73 74 2d 6e 61 6d 65 3a  .... "test-name:
3d60: 20 22 20 74 65 73 74 2d 6e 61 6d 65 0a 09 09 09   " test-name....
3d70: 20 22 5c 6e 20 20 68 65 64 3a 20 20 20 20 20 20   "\n  hed:      
3d80: 20 20 20 22 20 68 65 64 0a 09 09 09 20 22 5c 6e     " hed.... "\n
3d90: 20 20 69 74 65 6d 64 61 74 3a 20 20 20 20 20 22    itemdat:     "
3da0: 20 69 74 65 6d 64 61 74 0a 09 09 09 20 22 5c 6e   itemdat.... "\n
3db0: 20 20 69 74 65 6d 73 3a 20 20 20 20 20 20 20 22    items:       "
3dc0: 20 69 74 65 6d 73 0a 09 09 09 20 22 5c 6e 20 20   items.... "\n  
3dd0: 69 74 65 6d 2d 70 61 74 68 3a 20 20 20 22 20 69  item-path:   " i
3de0: 74 65 6d 2d 70 61 74 68 0a 09 09 09 20 22 5c 6e  tem-path.... "\n
3df0: 20 20 77 61 69 74 6f 6e 73 3a 20 20 20 20 20 22    waitons:     "
3e00: 20 77 61 69 74 6f 6e 73 0a 09 09 09 20 22 5c 6e   waitons.... "\n
3e10: 20 20 6e 75 6d 2d 72 65 74 72 69 65 73 3a 20 22    num-retries: "
3e20: 20 6e 75 6d 2d 72 65 74 72 69 65 73 0a 09 09 09   num-retries....
3e30: 20 22 5c 6e 20 20 74 61 6c 3a 20 20 20 20 20 20   "\n  tal:      
3e40: 20 20 20 22 20 74 61 6c 0a 09 09 09 20 22 5c 6e     " tal.... "\n
3e50: 20 20 72 65 72 75 6e 73 3a 20 20 20 20 20 20 22    reruns:      "
3e60: 20 72 65 72 75 6e 73 29 0a 0a 09 20 20 20 20 3b   reruns)...    ;
3e70: 3b 20 63 68 65 63 6b 20 66 6f 72 20 68 65 64 20  ; check for hed 
3e80: 69 6e 20 77 61 69 74 6f 6e 73 20 3d 3e 20 74 68  in waitons => th
3e90: 69 73 20 77 6f 75 6c 64 20 62 65 20 63 69 72 63  is would be circ
3ea0: 75 6c 61 72 2c 20 72 65 6d 6f 76 65 20 69 74 20  ular, remove it 
3eb0: 61 6e 64 20 69 73 73 75 65 20 61 6e 0a 09 20 20  and issue an..  
3ec0: 20 20 3b 3b 20 65 72 72 6f 72 0a 09 20 20 20 20    ;; error..    
3ed0: 28 69 66 20 28 6d 65 6d 62 65 72 20 74 65 73 74  (if (member test
3ee0: 2d 6e 61 6d 65 20 77 61 69 74 6f 6e 73 29 0a 09  -name waitons)..
3ef0: 09 28 62 65 67 69 6e 0a 09 09 20 20 28 64 65 62  .(begin...  (deb
3f00: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f  ug:print 0 "ERRO
3f10: 52 3a 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e  R: test " test-n
3f20: 61 6d 65 20 22 20 68 61 73 20 6c 69 73 74 65 64  ame " has listed
3f30: 20 69 74 73 65 6c 66 20 61 73 20 61 20 77 61 69   itself as a wai
3f40: 74 6f 6e 2c 20 70 6c 65 61 73 65 20 63 6f 72 72  ton, please corr
3f50: 65 63 74 20 74 68 69 73 21 22 29 0a 09 09 20 20  ect this!")...  
3f60: 28 73 65 74 21 20 77 61 69 74 6f 6e 20 28 66 69  (set! waiton (fi
3f70: 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29  lter (lambda (x)
3f80: 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 78 20 68  (not (equal? x h
3f90: 65 64 29 29 29 20 77 61 69 74 6f 6e 73 29 29 29  ed))) waitons)))
3fa0: 29 0a 0a 09 20 20 20 20 28 63 6f 6e 64 20 3b 3b  )...    (cond ;;
3fb0: 20 4f 55 54 45 52 20 43 4f 4e 44 0a 09 20 20 20   OUTER COND..   
3fc0: 20 20 28 28 6e 6f 74 20 69 74 65 6d 73 29 20 3b    ((not items) ;
3fd0: 3b 20 77 68 65 6e 20 66 61 6c 73 65 20 74 68 65  ; when false the
3fe0: 20 74 65 73 74 20 69 73 20 6f 6b 20 74 6f 20 62   test is ok to b
3ff0: 65 20 68 61 6e 64 65 64 20 6f 66 66 20 74 6f 20  e handed off to 
4000: 6c 61 75 6e 63 68 20 28 62 75 74 20 6e 6f 74 20  launch (but not 
4010: 62 65 66 6f 72 65 29 0a 09 20 20 20 20 20 20 28  before)..      (
4020: 6c 65 74 2a 20 28 28 72 75 6e 2d 6c 69 6d 69 74  let* ((run-limit
4030: 73 2d 69 6e 66 6f 20 20 20 20 20 20 20 20 20 28  s-info         (
4040: 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72  runs:can-run-mor
4050: 65 2d 74 65 73 74 73 20 74 65 73 74 2d 72 65 63  e-tests test-rec
4060: 6f 72 64 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65  ord max-concurre
4070: 6e 74 2d 6a 6f 62 73 29 29 20 3b 3b 20 6c 6f 6f  nt-jobs)) ;; loo
4080: 6b 20 61 74 20 74 68 65 20 74 65 73 74 20 6a 6f  k at the test jo
4090: 62 67 72 6f 75 70 20 61 6e 64 20 74 6f 74 20 6a  bgroup and tot j
40a0: 6f 62 73 20 72 75 6e 6e 69 6e 67 0a 09 09 20 20  obs running...  
40b0: 20 20 20 28 68 61 76 65 2d 72 65 73 6f 75 72 63     (have-resourc
40c0: 65 73 20 20 20 20 20 20 20 20 20 20 28 63 61 72  es          (car
40d0: 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f   run-limits-info
40e0: 29 29 0a 09 09 20 20 20 20 20 28 6e 75 6d 2d 72  ))...     (num-r
40f0: 75 6e 6e 69 6e 67 20 20 20 20 20 20 20 20 20 20  unning          
4100: 20 20 20 28 6c 69 73 74 2d 72 65 66 20 72 75 6e     (list-ref run
4110: 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 31 29 29  -limits-info 1))
4120: 0a 09 09 20 20 20 20 20 28 6e 75 6d 2d 72 75 6e  ...     (num-run
4130: 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70  ning-in-jobgroup
4140: 20 28 6c 69 73 74 2d 72 65 66 20 72 75 6e 2d 6c   (list-ref run-l
4150: 69 6d 69 74 73 2d 69 6e 66 6f 20 32 29 29 0a 09  imits-info 2))..
4160: 09 20 20 20 20 20 28 6d 61 78 2d 63 6f 6e 63 75  .     (max-concu
4170: 72 72 65 6e 74 2d 6a 6f 62 73 20 20 20 20 20 28  rrent-jobs     (
4180: 6c 69 73 74 2d 72 65 66 20 72 75 6e 2d 6c 69 6d  list-ref run-lim
4190: 69 74 73 2d 69 6e 66 6f 20 33 29 29 0a 09 09 20  its-info 3))... 
41a0: 20 20 20 20 28 6a 6f 62 2d 67 72 6f 75 70 2d 6c      (job-group-l
41b0: 69 6d 69 74 20 20 20 20 20 20 20 20 20 28 6c 69  imit         (li
41c0: 73 74 2d 72 65 66 20 72 75 6e 2d 6c 69 6d 69 74  st-ref run-limit
41d0: 73 2d 69 6e 66 6f 20 34 29 29 0a 09 09 20 20 20  s-info 4))...   
41e0: 20 20 28 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d    (prereqs-not-m
41f0: 65 74 20 20 20 20 20 20 20 20 20 28 64 62 3a 67  et         (db:g
4200: 65 74 2d 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d  et-prereqs-not-m
4210: 65 74 20 72 75 6e 2d 69 64 20 77 61 69 74 6f 6e  et run-id waiton
4220: 73 20 69 74 65 6d 2d 70 61 74 68 20 6d 6f 64 65  s item-path mode
4230: 3a 20 74 65 73 74 6d 6f 64 65 29 29 0a 09 09 20  : testmode))... 
4240: 20 20 20 20 28 66 61 69 6c 73 20 20 20 20 20 20      (fails      
4250: 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 75               (ru
4260: 6e 73 3a 63 61 6c 63 2d 66 61 69 6c 73 20 70 72  ns:calc-fails pr
4270: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a  ereqs-not-met)).
4280: 09 09 20 20 20 20 20 28 6e 6f 6e 2d 63 6f 6d 70  ..     (non-comp
4290: 6c 65 74 65 64 20 20 20 20 20 20 20 20 20 20 20  leted           
42a0: 28 72 75 6e 73 3a 63 61 6c 63 2d 6e 6f 74 2d 63  (runs:calc-not-c
42b0: 6f 6d 70 6c 65 74 65 64 20 70 72 65 72 65 71 73  ompleted prereqs
42c0: 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a 09 09 28 64  -not-met)))...(d
42d0: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
42e0: 38 20 22 68 61 76 65 2d 72 65 73 6f 75 72 63 65  8 "have-resource
42f0: 73 3a 20 22 20 68 61 76 65 2d 72 65 73 6f 75 72  s: " have-resour
4300: 63 65 73 20 22 20 70 72 65 72 65 71 73 2d 6e 6f  ces " prereqs-no
4310: 74 2d 6d 65 74 3a 20 22 20 0a 09 09 09 20 20 20  t-met: " ....   
4320: 20 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73    (string-inters
4330: 70 65 72 73 65 20 0a 09 09 09 20 20 20 20 20 20  perse ....      
4340: 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 74 29  (map (lambda (t)
4350: 0a 09 09 09 09 20 20 20 20 20 28 69 66 20 28 76  .....     (if (v
4360: 65 63 74 6f 72 3f 20 74 29 0a 09 09 09 09 09 20  ector? t)...... 
4370: 28 63 6f 6e 63 20 28 64 62 3a 74 65 73 74 2d 67  (conc (db:test-g
4380: 65 74 2d 73 74 61 74 65 20 74 29 20 22 2f 22 20  et-state t) "/" 
4390: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61  (db:test-get-sta
43a0: 74 75 73 20 74 29 29 0a 09 09 09 09 09 20 28 63  tus t))...... (c
43b0: 6f 6e 63 20 22 20 57 41 52 4e 49 4e 47 3a 20 74  onc " WARNING: t
43c0: 20 69 73 20 6e 6f 74 20 61 20 76 65 63 74 6f 72   is not a vector
43d0: 3d 22 20 74 20 29 29 29 0a 09 09 09 09 20 20 20  =" t ))).....   
43e0: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29  prereqs-not-met)
43f0: 20 22 2c 20 22 29 20 22 20 66 61 69 6c 73 3a 20   ", ") " fails: 
4400: 22 20 66 61 69 6c 73 29 0a 09 09 28 64 65 62 75  " fails)...(debu
4410: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22  g:print-info 4 "
4420: 68 65 64 3d 22 20 68 65 64 20 22 5c 6e 20 20 74  hed=" hed "\n  t
4430: 65 73 74 2d 72 65 63 6f 72 64 3d 22 20 74 65 73  est-record=" tes
4440: 74 2d 72 65 63 6f 72 64 20 22 5c 6e 20 20 74 65  t-record "\n  te
4450: 73 74 2d 6e 61 6d 65 3a 20 22 20 74 65 73 74 2d  st-name: " test-
4460: 6e 61 6d 65 20 22 5c 6e 20 20 69 74 65 6d 2d 70  name "\n  item-p
4470: 61 74 68 3a 20 22 20 69 74 65 6d 2d 70 61 74 68  ath: " item-path
4480: 20 22 5c 6e 20 20 74 65 73 74 2d 70 61 74 74 73   "\n  test-patts
4490: 3a 20 22 20 74 65 73 74 2d 70 61 74 74 73 29 0a  : " test-patts).
44a0: 0a 09 09 3b 3b 20 44 6f 6e 27 74 20 6b 6e 6f 77  ...;; Don't know
44b0: 20 61 74 20 74 68 69 73 20 74 69 6d 65 20 69 66   at this time if
44c0: 20 74 68 65 20 74 65 73 74 20 68 61 76 65 20 62   the test have b
44d0: 65 65 6e 20 6c 61 75 6e 63 68 65 64 20 61 74 20  een launched at 
44e0: 73 6f 6d 65 20 74 69 6d 65 20 69 6e 20 74 68 65  some time in the
44f0: 20 70 61 73 74 0a 09 09 3b 3b 20 69 2e 65 2e 20   past...;; i.e. 
4500: 69 73 20 74 68 69 73 20 61 20 72 65 2d 6c 61 75  is this a re-lau
4510: 6e 63 68 3f 0a 09 09 28 64 65 62 75 67 3a 70 72  nch?...(debug:pr
4520: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 72 75 6e 2d  int-info 4 "run-
4530: 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 3d 20 22 20  limits-info = " 
4540: 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 29  run-limits-info)
4550: 0a 09 09 28 63 6f 6e 64 20 3b 3b 20 49 4e 4e 45  ...(cond ;; INNE
4560: 52 20 43 4f 4e 44 20 23 31 20 66 6f 72 20 61 20  R COND #1 for a 
4570: 6c 61 75 6e 63 68 61 62 6c 65 20 74 65 73 74 0a  launchable test.
4580: 09 09 20 3b 3b 20 43 68 65 63 6b 20 69 74 65 6d  .. ;; Check item
4590: 20 70 61 74 68 20 61 67 61 69 6e 73 74 20 69 74   path against it
45a0: 65 6d 2d 70 61 74 74 73 0a 09 09 20 28 28 6e 6f  em-patts... ((no
45b0: 74 20 28 74 65 73 74 73 3a 6d 61 74 63 68 20 74  t (tests:match t
45c0: 65 73 74 2d 70 61 74 74 73 20 28 74 65 73 74 73  est-patts (tests
45d0: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74  :testqueue-get-t
45e0: 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63  estname test-rec
45f0: 6f 72 64 29 20 69 74 65 6d 2d 70 61 74 68 29 29  ord) item-path))
4600: 20 3b 3b 20 54 68 69 73 20 74 65 73 74 2f 69 74   ;; This test/it
4610: 65 6d 70 61 74 68 20 69 73 20 6e 6f 74 20 74 6f  empath is not to
4620: 20 62 65 20 72 75 6e 0a 09 09 20 20 3b 3b 20 65   be run...  ;; e
4630: 6c 73 65 20 74 68 65 20 72 75 6e 20 69 73 20 73  lse the run is s
4640: 74 75 63 6b 2c 20 74 65 6d 70 6f 72 61 72 69 6c  tuck, temporaril
4650: 79 20 6f 72 20 70 65 72 6d 61 6e 65 6e 74 6c 79  y or permanently
4660: 0a 09 09 20 20 3b 3b 20 62 75 74 20 73 68 6f 75  ...  ;; but shou
4670: 6c 64 20 63 68 65 63 6b 20 69 66 20 69 74 20 69  ld check if it i
4680: 73 20 64 75 65 20 74 6f 20 6c 61 63 6b 20 6f 66  s due to lack of
4690: 20 72 65 73 6f 75 72 63 65 73 20 76 73 2e 20 70   resources vs. p
46a0: 72 65 72 65 71 75 69 73 69 74 65 73 0a 09 09 20  rerequisites... 
46b0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
46c0: 66 6f 20 31 20 22 53 6b 69 70 70 69 6e 67 20 22  fo 1 "Skipping "
46d0: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75   (tests:testqueu
46e0: 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74  e-get-testname t
46f0: 65 73 74 2d 72 65 63 6f 72 64 29 20 22 20 22 20  est-record) " " 
4700: 69 74 65 6d 2d 70 61 74 68 20 22 20 61 73 20 69  item-path " as i
4710: 74 20 64 6f 65 73 6e 27 74 20 6d 61 74 63 68 20  t doesn't match 
4720: 22 20 74 65 73 74 2d 70 61 74 74 73 29 0a 09 09  " test-patts)...
4730: 20 20 3b 3b 20 28 74 68 72 65 61 64 2d 73 6c 65    ;; (thread-sle
4740: 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74  ep! *global-delt
4750: 61 2a 29 0a 09 09 20 20 28 69 66 20 28 6e 6f 74  a*)...  (if (not
4760: 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09   (null? tal))...
4770: 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72        (loop (car
4780: 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 20 72   tal)(cdr tal) r
4790: 65 72 75 6e 73 29 29 29 0a 09 09 20 3b 3b 20 52  eruns)))... ;; R
47a0: 65 67 69 73 74 65 72 79 20 68 61 73 20 62 65 65  egistery has bee
47b0: 6e 20 73 74 61 72 74 65 64 20 66 6f 72 20 74 68  n started for th
47c0: 69 73 20 74 65 73 74 20 62 75 74 20 68 61 73 20  is test but has 
47d0: 6e 6f 74 20 79 65 74 20 63 6f 6d 70 6c 65 74 65  not yet complete
47e0: 64 0a 09 09 20 3b 3b 20 74 68 69 73 20 73 68 6f  d... ;; this sho
47f0: 75 6c 64 20 62 65 20 72 61 72 65 2c 20 74 68 65  uld be rare, the
4800: 20 63 61 73 65 20 77 68 65 72 65 20 74 68 65 72   case where ther
4810: 65 20 61 72 65 20 6f 6e 6c 79 20 61 20 63 6f 75  e are only a cou
4820: 70 6c 65 20 6f 66 20 74 65 73 74 73 20 61 6e 64  ple of tests and
4830: 20 74 68 65 20 64 62 20 69 73 20 73 6c 6f 77 0a   the db is slow.
4840: 09 09 20 3b 3b 20 64 65 6c 61 79 20 61 20 73 68  .. ;; delay a sh
4850: 6f 72 74 20 77 68 69 6c 65 20 61 6e 64 20 63 6f  ort while and co
4860: 6e 74 69 6e 75 65 0a 09 09 20 3b 3b 20 28 28 65  ntinue... ;; ((e
4870: 71 3f 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72  q? (hash-table-r
4880: 65 66 2f 64 65 66 61 75 6c 74 20 74 65 73 74 2d  ef/default test-
4890: 72 65 67 69 73 74 65 72 79 20 28 72 75 6e 73 3a  registery (runs:
48a0: 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e  make-full-test-n
48b0: 61 6d 65 20 74 65 73 74 2d 6e 61 6d 65 20 69 74  ame test-name it
48c0: 65 6d 2d 70 61 74 68 29 20 23 66 29 20 27 73 74  em-path) #f) 'st
48d0: 61 72 74 29 0a 09 09 20 3b 3b 20 20 28 74 68 72  art)... ;;  (thr
48e0: 65 61 64 2d 73 6c 65 65 70 21 20 30 2e 30 31 29  ead-sleep! 0.01)
48f0: 0a 09 09 20 3b 3b 20 20 28 6c 6f 6f 70 20 28 63  ... ;;  (loop (c
4900: 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e  ar newtal)(cdr n
4910: 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29 29 0a  ewtal) reruns)).
4920: 09 09 20 3b 3b 20 63 6f 75 6e 74 20 6e 75 6d 62  .. ;; count numb
4930: 65 72 20 6f 66 20 27 64 6f 6e 65 2c 20 69 66 20  er of 'done, if 
4940: 6d 6f 72 65 20 74 68 61 6e 20 31 30 30 20 74 68  more than 100 th
4950: 65 6e 20 73 6b 69 70 20 6f 6e 20 74 68 72 6f 75  en skip on throu
4960: 67 68 2e 0a 09 09 20 28 3b 3b 20 28 61 6e 64 20  gh.... (;; (and 
4970: 28 3c 20 28 6c 65 6e 67 74 68 20 28 66 69 6c 74  (< (length (filt
4980: 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29 28 65  er (lambda (x)(e
4990: 71 3f 20 78 20 27 64 6f 6e 65 29 29 28 68 61 73  q? x 'done))(has
49a0: 68 2d 74 61 62 6c 65 2d 76 61 6c 75 65 73 20 74  h-table-values t
49b0: 65 73 74 2d 72 65 67 69 73 74 65 72 79 29 29 29  est-registery)))
49c0: 20 31 30 30 29 20 3b 3b 20 77 68 79 20 67 65 74   100) ;; why get
49d0: 20 6d 6f 72 65 20 74 68 61 6e 20 32 30 30 20 61   more than 200 a
49e0: 68 65 61 64 3f 0a 09 09 20 20 28 6e 6f 74 20 28  head?...  (not (
49f0: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64  hash-table-ref/d
4a00: 65 66 61 75 6c 74 20 74 65 73 74 2d 72 65 67 69  efault test-regi
4a10: 73 74 65 72 79 20 28 72 75 6e 73 3a 6d 61 6b 65  stery (runs:make
4a20: 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 20  -full-test-name 
4a30: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70  test-name item-p
4a40: 61 74 68 29 20 23 66 29 29 20 3b 3b 20 29 20 3b  ath) #f)) ;; ) ;
4a50: 3b 20 74 6f 6f 20 6d 61 6e 79 20 63 68 61 6e 67  ; too many chang
4a60: 65 73 20 72 65 71 75 69 72 65 64 2e 20 49 6d 70  es required. Imp
4a70: 6c 65 6d 65 6e 74 20 6c 61 74 65 72 2e 0a 09 09  lement later....
4a80: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69    (debug:print-i
4a90: 6e 66 6f 20 34 20 22 50 72 65 2d 72 65 67 69 73  nfo 4 "Pre-regis
4aa0: 74 65 72 69 6e 67 20 74 65 73 74 20 22 20 74 65  tering test " te
4ab0: 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d  st-name "/" item
4ac0: 2d 70 61 74 68 20 22 20 74 6f 20 63 72 65 61 74  -path " to creat
4ad0: 65 20 70 6c 61 63 65 68 6f 6c 64 65 72 22 20 29  e placeholder" )
4ae0: 0a 09 09 20 20 3b 3b 20 4e 45 45 44 20 54 4f 20  ...  ;; NEED TO 
4af0: 54 48 52 45 41 44 49 46 59 20 54 48 49 53 0a 09  THREADIFY THIS..
4b00: 09 20 20 28 6c 65 74 20 28 28 74 68 20 28 6d 61  .  (let ((th (ma
4b10: 6b 65 2d 74 68 72 65 61 64 20 28 6c 61 6d 62 64  ke-thread (lambd
4b20: 61 20 28 29 0a 09 09 20 20 20 20 20 20 20 20 09  a ()...        .
4b30: 09 20 20 20 28 6d 75 74 65 78 2d 6c 6f 63 6b 21  .   (mutex-lock!
4b40: 20 72 65 67 69 73 74 65 72 79 2d 6d 75 74 65 78   registery-mutex
4b50: 29 0a 09 09 20 20 20 20 20 20 20 20 09 09 20 20  )...        ..  
4b60: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74   (hash-table-set
4b70: 21 20 74 65 73 74 2d 72 65 67 69 73 74 65 72 79  ! test-registery
4b80: 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c   (runs:make-full
4b90: 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d  -test-name test-
4ba0: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 20  name item-path) 
4bb0: 27 73 74 61 72 74 29 0a 09 09 20 20 20 20 20 20  'start)...      
4bc0: 20 20 09 09 20 20 20 28 6d 75 74 65 78 2d 75 6e    ..   (mutex-un
4bd0: 6c 6f 63 6b 21 20 72 65 67 69 73 74 65 72 79 2d  lock! registery-
4be0: 6d 75 74 65 78 29 0a 09 09 09 09 09 20 20 20 3b  mutex)......   ;
4bf0: 3b 20 49 66 20 68 61 76 65 6e 27 74 20 64 6f 6e  ; If haven't don
4c00: 65 20 69 74 20 62 65 66 6f 72 65 20 72 65 67 69  e it before regi
4c10: 73 74 65 72 20 61 20 74 6f 70 20 6c 65 76 65 6c  ster a top level
4c20: 20 74 65 73 74 20 69 66 20 74 68 69 73 20 69 73   test if this is
4c30: 20 61 6e 20 69 74 65 6d 69 7a 65 64 20 74 65 73   an itemized tes
4c40: 74 0a 09 09 09 09 09 20 20 20 28 69 66 20 28 6e  t......   (if (n
4c50: 6f 74 20 28 65 71 3f 20 28 68 61 73 68 2d 74 61  ot (eq? (hash-ta
4c60: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20  ble-ref/default 
4c70: 74 65 73 74 2d 72 65 67 69 73 74 65 72 79 20 28  test-registery (
4c80: 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74  runs:make-full-t
4c90: 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 6e 61  est-name test-na
4ca0: 6d 65 20 22 22 29 20 23 66 29 20 27 64 6f 6e 65  me "") #f) 'done
4cb0: 29 29 0a 09 09 09 09 09 20 20 20 20 20 20 20 28  ))......       (
4cc0: 63 64 62 3a 74 65 73 74 73 2d 72 65 67 69 73 74  cdb:tests-regist
4cd0: 65 72 2d 74 65 73 74 20 2a 72 75 6e 72 65 6d 6f  er-test *runremo
4ce0: 74 65 2a 20 72 75 6e 2d 69 64 20 74 65 73 74 2d  te* run-id test-
4cf0: 6e 61 6d 65 20 22 22 29 29 0a 09 09 09 09 09 20  name ""))...... 
4d00: 20 20 28 63 64 62 3a 74 65 73 74 73 2d 72 65 67    (cdb:tests-reg
4d10: 69 73 74 65 72 2d 74 65 73 74 20 2a 72 75 6e 72  ister-test *runr
4d20: 65 6d 6f 74 65 2a 20 72 75 6e 2d 69 64 20 74 65  emote* run-id 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 0a 09 09 20 20 20 20 20 20 20 20 09 09 20  h)...        .. 
4d50: 20 20 28 6d 75 74 65 78 2d 6c 6f 63 6b 21 20 72    (mutex-lock! r
4d60: 65 67 69 73 74 65 72 79 2d 6d 75 74 65 78 29 0a  egistery-mutex).
4d70: 09 09 09 09 09 20 20 20 28 68 61 73 68 2d 74 61  .....   (hash-ta
4d80: 62 6c 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65  ble-set! test-re
4d90: 67 69 73 74 65 72 79 20 28 72 75 6e 73 3a 6d 61  gistery (runs:ma
4da0: 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d  ke-full-test-nam
4db0: 65 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d  e test-name item
4dc0: 2d 70 61 74 68 29 20 27 64 6f 6e 65 29 0a 09 09  -path) 'done)...
4dd0: 20 20 20 20 20 20 20 20 09 09 20 20 20 28 6d 75          ..   (mu
4de0: 74 65 78 2d 75 6e 6c 6f 63 6b 21 20 72 65 67 69  tex-unlock! regi
4df0: 73 74 65 72 79 2d 6d 75 74 65 78 29 29 0a 09 09  stery-mutex))...
4e00: 20 20 20 20 20 20 20 20 09 09 20 28 63 6f 6e 63          .. (conc
4e10: 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69   test-name "/" i
4e20: 74 65 6d 2d 70 61 74 68 29 29 29 29 0a 09 09 20  tem-path))))... 
4e30: 20 20 20 28 74 68 72 65 61 64 2d 73 74 61 72 74     (thread-start
4e40: 21 20 74 68 29 29 0a 09 09 20 20 3b 3b 20 54 52  ! th))...  ;; TR
4e50: 59 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21  Y (thread-sleep!
4e60: 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29   *global-delta*)
4e70: 0a 09 09 20 20 28 72 75 6e 73 3a 73 68 72 69 6e  ...  (runs:shrin
4e80: 6b 2d 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74  k-can-run-more-t
4e90: 65 73 74 73 2d 63 6f 75 6e 74 29 20 20 20 3b 3b  ests-count)   ;;
4ea0: 20 44 45 4c 41 59 20 54 57 45 41 4b 45 52 20 28   DELAY TWEAKER (
4eb0: 73 74 69 6c 6c 20 6e 65 65 64 65 64 3f 29 0a 09  still needed?)..
4ec0: 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65  .  (loop (car ne
4ed0: 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c  wtal)(cdr newtal
4ee0: 29 20 72 65 72 75 6e 73 29 29 0a 09 09 20 3b 3b  ) reruns))... ;;
4ef0: 20 41 74 20 74 68 69 73 20 70 6f 69 6e 74 20 2a   At this point *
4f00: 61 6c 6c 2a 20 74 65 73 74 20 72 65 67 69 73 74  all* test regist
4f10: 72 61 74 69 6f 6e 73 20 6d 75 73 74 20 62 65 20  rations must be 
4f20: 63 6f 6d 70 6c 65 74 65 64 2e 0a 09 09 20 28 28  completed.... ((
4f30: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 28 66 69 6c 74  not (null? (filt
4f40: 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29 28 65  er (lambda (x)(e
4f50: 71 3f 20 27 73 74 61 72 74 20 78 29 29 28 68 61  q? 'start x))(ha
4f60: 73 68 2d 74 61 62 6c 65 2d 76 61 6c 75 65 73 20  sh-table-values 
4f70: 74 65 73 74 2d 72 65 67 69 73 74 65 72 79 29 29  test-registery))
4f80: 29 29 0a 09 09 20 20 28 64 65 62 75 67 3a 70 72  ))...  (debug:pr
4f90: 69 6e 74 2d 69 6e 66 6f 20 30 20 22 57 61 69 74  int-info 0 "Wait
4fa0: 69 6e 67 20 6f 6e 20 74 65 73 74 20 72 65 67 69  ing on test regi
4fb0: 73 74 72 61 74 69 6f 6e 73 3a 20 22 20 28 73 74  strations: " (st
4fc0: 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65  ring-intersperse
4fd0: 20 0a 09 09 09 09 09 09 09 09 09 20 28 66 69 6c   .......... (fil
4fe0: 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29 0a  ter (lambda (x).
4ff0: 09 09 09 09 09 09 09 09 09 09 20 20 20 28 65 71  ..........   (eq
5000: 3f 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65  ? (hash-table-re
5010: 66 2f 64 65 66 61 75 6c 74 20 74 65 73 74 2d 72  f/default test-r
5020: 65 67 69 73 74 65 72 79 20 78 20 23 66 29 20 27  egistery x #f) '
5030: 73 74 61 72 74 29 29 0a 09 09 09 09 09 09 09 09  start)).........
5040: 09 09 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 6b  .. (hash-table-k
5050: 65 79 73 20 74 65 73 74 2d 72 65 67 69 73 74 65  eys test-registe
5060: 72 79 29 29 0a 09 09 09 09 09 09 09 09 09 20 22  ry)).......... "
5070: 2c 20 22 29 29 0a 09 09 20 20 28 74 68 72 65 61  , "))...  (threa
5080: 64 2d 73 6c 65 65 70 21 20 30 2e 31 29 0a 09 09  d-sleep! 0.1)...
5090: 20 20 28 6c 6f 6f 70 20 68 65 64 20 74 61 6c 20    (loop hed tal 
50a0: 72 65 72 75 6e 73 29 29 0a 09 09 20 28 28 6e 6f  reruns))... ((no
50b0: 74 20 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73  t have-resources
50c0: 29 20 3b 3b 20 73 69 6d 70 6c 79 20 74 72 79 20  ) ;; simply try 
50d0: 61 67 61 69 6e 20 61 66 74 65 72 20 77 61 69 74  again after wait
50e0: 69 6e 67 20 61 20 73 65 63 6f 6e 64 0a 09 09 20  ing a second... 
50f0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
5100: 66 6f 20 31 20 22 6e 6f 20 72 65 73 6f 75 72 63  fo 1 "no resourc
5110: 65 73 20 74 6f 20 72 75 6e 20 6e 65 77 20 74 65  es to run new te
5120: 73 74 73 2c 20 77 61 69 74 69 6e 67 20 2e 2e 2e  sts, waiting ...
5130: 22 29 0a 09 09 20 20 3b 3b 20 48 61 76 65 20 67  ")...  ;; Have g
5140: 6f 6e 65 20 62 61 63 6b 20 61 6e 64 20 66 6f 72  one back and for
5150: 74 68 20 6f 6e 20 74 68 69 73 20 62 75 74 20 64  th on this but d
5160: 62 20 73 74 61 72 76 61 74 69 6f 6e 20 69 73 20  b starvation is 
5170: 61 6e 20 69 73 73 75 65 2e 0a 09 09 20 20 3b 3b  an issue....  ;;
5180: 20 77 61 69 74 20 6f 6e 65 20 73 65 63 6f 6e 64   wait one second
5190: 20 62 65 66 6f 72 65 20 6c 6f 6f 6b 69 6e 67 20   before looking 
51a0: 61 67 61 69 6e 20 74 6f 20 72 75 6e 20 6a 6f 62  again to run job
51b0: 73 2e 0a 09 09 20 20 28 74 68 72 65 61 64 2d 73  s....  (thread-s
51c0: 6c 65 65 70 21 20 31 29 20 3b 3b 20 28 2b 20 32  leep! 1) ;; (+ 2
51d0: 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29   *global-delta*)
51e0: 29 0a 09 09 20 20 3b 3b 20 63 6f 75 6c 64 20 68  )...  ;; could h
51f0: 61 76 65 20 64 6f 6e 65 20 68 65 64 20 74 61 6c  ave done hed tal
5200: 20 68 65 72 65 20 62 75 74 20 64 6f 69 6e 67 20   here but doing 
5210: 63 61 72 2f 63 64 72 20 6f 66 20 6e 65 77 74 61  car/cdr of newta
5220: 6c 20 74 6f 20 72 6f 74 61 74 65 20 74 65 73 74  l to rotate test
5230: 73 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72  s...  (loop (car
5240: 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77   newtal)(cdr new
5250: 74 61 6c 29 20 72 65 72 75 6e 73 29 29 0a 09 09  tal) reruns))...
5260: 20 28 28 61 6e 64 20 68 61 76 65 2d 72 65 73 6f   ((and have-reso
5270: 75 72 63 65 73 0a 09 09 20 20 20 20 20 20 20 28  urces...       (
5280: 6f 72 20 28 6e 75 6c 6c 3f 20 70 72 65 72 65 71  or (null? prereq
5290: 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09 09 20 20  s-not-met)....  
52a0: 20 28 61 6e 64 20 28 65 71 3f 20 74 65 73 74 6d   (and (eq? testm
52b0: 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c 29 0a 09  ode 'toplevel)..
52c0: 09 09 09 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f  ...(null? non-co
52d0: 6d 70 6c 65 74 65 64 29 29 29 29 0a 09 09 20 20  mpleted))))...  
52e0: 28 72 75 6e 3a 74 65 73 74 20 72 75 6e 2d 69 64  (run:test run-id
52f0: 20 72 75 6e 6e 61 6d 65 20 6b 65 79 76 61 6c 6c   runname keyvall
5300: 73 74 20 74 65 73 74 2d 72 65 63 6f 72 64 20 66  st test-record f
5310: 6c 61 67 73 20 23 66 29 0a 09 09 20 20 28 68 61  lags #f)...  (ha
5320: 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 65  sh-table-set! te
5330: 73 74 2d 72 65 67 69 73 74 65 72 79 20 28 72 75  st-registery (ru
5340: 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 73  ns:make-full-tes
5350: 74 2d 6e 61 6d 65 20 74 65 73 74 2d 6e 61 6d 65  t-name test-name
5360: 20 69 74 65 6d 2d 70 61 74 68 29 20 27 72 75 6e   item-path) 'run
5370: 6e 69 6e 67 29 0a 09 09 20 20 28 72 75 6e 73 3a  ning)...  (runs:
5380: 73 68 72 69 6e 6b 2d 63 61 6e 2d 72 75 6e 2d 6d  shrink-can-run-m
5390: 6f 72 65 2d 74 65 73 74 73 2d 63 6f 75 6e 74 29  ore-tests-count)
53a0: 20 20 3b 3b 20 44 45 4c 41 59 20 54 57 45 41 4b    ;; DELAY TWEAK
53b0: 45 52 20 28 73 74 69 6c 6c 20 6e 65 65 64 65 64  ER (still needed
53c0: 3f 29 0a 09 09 20 20 3b 3b 20 28 74 68 72 65 61  ?)...  ;; (threa
53d0: 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c  d-sleep! *global
53e0: 2d 64 65 6c 74 61 2a 29 0a 09 09 20 20 28 69 66  -delta*)...  (if
53f0: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c   (not (null? tal
5400: 29 29 0a 09 09 20 20 20 20 20 20 28 6c 6f 6f 70  ))...      (loop
5410: 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74   (car tal)(cdr t
5420: 61 6c 29 20 72 65 72 75 6e 73 29 29 29 0a 09 09  al) reruns)))...
5430: 20 28 65 6c 73 65 20 3b 3b 20 6d 75 73 74 20 62   (else ;; must b
5440: 65 20 77 65 20 68 61 76 65 20 75 6e 6d 65 74 20  e we have unmet 
5450: 70 72 65 72 65 71 75 69 73 69 74 65 73 0a 09 09  prerequisites...
5460: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
5470: 20 34 20 22 46 41 49 4c 53 3a 20 22 20 66 61 69   4 "FAILS: " fai
5480: 6c 73 29 0a 09 09 20 20 20 20 3b 3b 20 49 66 20  ls)...    ;; If 
5490: 6f 6e 65 20 6f 72 20 6d 6f 72 65 20 6f 66 20 74  one or more of t
54a0: 68 65 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d  he prereqs-not-m
54b0: 65 74 20 61 72 65 20 46 41 49 4c 20 74 68 65 6e  et are FAIL then
54c0: 20 77 65 20 63 61 6e 20 69 73 73 75 65 0a 09 09   we can issue...
54d0: 20 20 20 20 3b 3b 20 61 20 6d 65 73 73 61 67 65      ;; a message
54e0: 20 61 6e 64 20 64 72 6f 70 20 68 65 64 20 66 72   and drop hed fr
54f0: 6f 6d 20 74 68 65 20 69 74 65 6d 73 20 74 6f 20  om the items to 
5500: 62 65 20 70 72 6f 63 65 73 73 65 64 2e 0a 09 09  be processed....
5510: 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 66      (if (null? f
5520: 61 69 6c 73 29 0a 09 09 09 28 62 65 67 69 6e 0a  ails)....(begin.
5530: 09 09 09 20 20 3b 3b 20 63 6f 75 6c 64 6e 27 74  ...  ;; couldn't
5540: 20 72 75 6e 2c 20 74 61 6b 65 20 61 20 62 72 65   run, take a bre
5550: 61 74 68 65 72 0a 09 09 09 20 20 28 64 65 62 75  ather....  (debu
5560: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22  g:print-info 4 "
5570: 53 68 6f 75 6c 64 6e 27 74 20 72 65 61 6c 6c 79  Shouldn't really
5580: 20 67 65 74 20 68 65 72 65 2c 20 72 61 63 65 20   get here, race 
5590: 63 6f 6e 64 69 74 69 6f 6e 3f 20 55 6e 61 62 6c  condition? Unabl
55a0: 65 20 74 6f 20 6c 61 75 6e 63 68 20 6d 6f 72 65  e to launch more
55b0: 20 74 65 73 74 73 20 61 74 20 74 68 69 73 20 6d   tests at this m
55c0: 6f 6d 65 6e 74 2c 20 6b 69 6c 6c 69 6e 67 20 74  oment, killing t
55d0: 69 6d 65 20 2e 2e 2e 22 29 0a 09 09 09 20 20 3b  ime ...")....  ;
55e0: 3b 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21  ; (thread-sleep!
55f0: 20 28 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c   (+ 0.01 *global
5600: 2d 64 65 6c 74 61 2a 29 29 20 3b 3b 20 6c 6f 6e  -delta*)) ;; lon
5610: 67 20 73 6c 65 65 70 20 68 65 72 65 20 2d 20 6e  g sleep here - n
5620: 6f 20 72 65 73 6f 75 72 63 65 73 2c 20 6d 61 79  o resources, may
5630: 20 61 73 20 77 65 6c 6c 20 62 65 20 70 61 74 69   as well be pati
5640: 65 6e 74 0a 09 09 09 20 20 3b 3b 20 77 65 20 6d  ent....  ;; we m
5650: 61 64 65 20 6e 65 77 20 74 61 6c 20 62 79 20 73  ade new tal by s
5660: 74 69 63 6b 69 6e 67 20 68 65 64 20 61 74 20 74  ticking hed at t
5670: 68 65 20 62 61 63 6b 20 6f 66 20 74 68 65 20 6c  he back of the l
5680: 69 73 74 0a 09 09 09 20 20 28 6c 6f 6f 70 20 28  ist....  (loop (
5690: 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20  car newtal)(cdr 
56a0: 6e 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29 29  newtal) reruns))
56b0: 0a 09 09 09 3b 3b 20 74 68 65 20 77 61 69 74 6f  ....;; the waito
56c0: 6e 20 69 73 20 46 41 49 4c 20 73 6f 20 6e 6f 20  n is FAIL so no 
56d0: 70 6f 69 6e 74 20 69 6e 20 74 72 79 69 6e 67 20  point in trying 
56e0: 74 6f 20 72 75 6e 20 68 65 64 20 65 76 65 72 20  to run hed ever 
56f0: 61 67 61 69 6e 0a 09 09 09 28 69 66 20 28 6e 6f  again....(if (no
5700: 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09  t (null? tal))..
5710: 09 09 20 20 20 20 28 69 66 20 28 76 65 63 74 6f  ..    (if (vecto
5720: 72 3f 20 68 65 64 29 0a 09 09 09 09 28 62 65 67  r? hed).....(beg
5730: 69 6e 20 0a 09 09 09 09 20 20 28 64 65 62 75 67  in .....  (debug
5740: 3a 70 72 69 6e 74 20 31 20 22 57 41 52 4e 3a 20  :print 1 "WARN: 
5750: 44 72 6f 70 70 69 6e 67 20 74 65 73 74 20 22 20  Dropping test " 
5760: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73  (db:test-get-tes
5770: 74 6e 61 6d 65 20 68 65 64 29 20 22 2f 22 20 28  tname hed) "/" (
5780: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d  db:test-get-item
5790: 2d 70 61 74 68 20 68 65 64 29 0a 09 09 09 09 09  -path hed)......
57a0: 20 20 20 20 20 20 20 22 20 66 72 6f 6d 20 74 68         " from th
57b0: 65 20 6c 61 75 6e 63 68 20 6c 69 73 74 20 61 73  e launch list as
57c0: 20 69 74 20 68 61 73 20 70 72 65 72 65 71 75 69   it has prerequi
57d0: 73 74 65 73 20 74 68 61 74 20 61 72 65 20 46 41  stes that are FA
57e0: 49 4c 22 29 0a 09 09 09 09 20 20 28 72 75 6e 73  IL").....  (runs
57f0: 3a 73 68 72 69 6e 6b 2d 63 61 6e 2d 72 75 6e 2d  :shrink-can-run-
5800: 6d 6f 72 65 2d 74 65 73 74 73 2d 63 6f 75 6e 74  more-tests-count
5810: 29 20 3b 3b 20 44 45 4c 41 59 20 54 57 45 41 4b  ) ;; DELAY TWEAK
5820: 45 52 20 28 73 74 69 6c 6c 20 6e 65 65 64 65 64  ER (still needed
5830: 3f 29 0a 09 09 09 09 20 20 3b 3b 20 28 74 68 72  ?).....  ;; (thr
5840: 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62  ead-sleep! *glob
5850: 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 09 09 20  al-delta*)..... 
5860: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74   (hash-table-set
5870: 21 20 74 65 73 74 2d 72 65 67 69 73 74 65 72 79  ! test-registery
5880: 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c   (runs:make-full
5890: 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d  -test-name test-
58a0: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 20  name item-path) 
58b0: 27 72 65 6d 6f 76 65 64 29 0a 09 09 09 09 20 20  'removed).....  
58c0: 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28  (loop (car tal)(
58d0: 63 64 72 20 74 61 6c 29 20 28 63 6f 6e 73 20 68  cdr tal) (cons h
58e0: 65 64 20 72 65 72 75 6e 73 29 29 29 0a 09 09 09  ed reruns)))....
58f0: 09 28 62 65 67 69 6e 0a 09 09 09 09 20 20 28 64  .(begin.....  (d
5900: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 57 41  ebug:print 1 "WA
5910: 52 4e 3a 20 54 65 73 74 20 6e 6f 74 20 70 72 6f  RN: Test not pro
5920: 63 65 73 73 65 64 20 63 6f 72 72 65 63 74 6c 79  cessed correctly
5930: 2e 20 43 6f 75 6c 64 20 62 65 20 61 20 72 61 63  . Could be a rac
5940: 65 20 63 6f 6e 64 69 74 69 6f 6e 20 69 6e 20 79  e condition in y
5950: 6f 75 72 20 74 65 73 74 20 69 6d 70 6c 65 6d 65  our test impleme
5960: 6e 74 61 74 69 6f 6e 3f 20 22 20 68 65 64 29 20  ntation? " hed) 
5970: 3b 3b 20 20 22 20 61 73 20 69 74 20 68 61 73 20  ;;  " as it has 
5980: 70 72 65 72 65 71 75 69 73 74 65 73 20 74 68 61  prerequistes tha
5990: 74 20 61 72 65 20 46 41 49 4c 2e 20 28 4e 4f 54  t are FAIL. (NOT
59a0: 45 3a 20 68 65 64 20 69 73 20 6e 6f 74 20 61 20  E: hed is not a 
59b0: 76 65 63 74 6f 72 29 22 29 0a 09 09 09 09 20 20  vector)").....  
59c0: 28 72 75 6e 73 3a 73 68 72 69 6e 6b 2d 63 61 6e  (runs:shrink-can
59d0: 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d  -run-more-tests-
59e0: 63 6f 75 6e 74 29 20 3b 3b 20 44 45 4c 41 59 20  count) ;; DELAY 
59f0: 54 57 45 41 4b 45 52 20 28 73 74 69 6c 6c 20 6e  TWEAKER (still n
5a00: 65 65 64 65 64 3f 29 0a 09 09 09 09 20 20 3b 3b  eeded?).....  ;;
5a10: 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20   (thread-sleep! 
5a20: 28 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d  (+ 0.01 *global-
5a30: 64 65 6c 74 61 2a 29 29 0a 09 09 09 09 20 20 28  delta*)).....  (
5a40: 6c 6f 6f 70 20 68 65 64 20 74 61 6c 20 72 65 72  loop hed tal rer
5a50: 75 6e 73 29 29 29 29 29 29 29 29 29 20 3b 3b 20  uns))))))))) ;; 
5a60: 45 4e 44 20 4f 46 20 49 4e 4e 45 52 20 43 4f 4e  END OF INNER CON
5a70: 44 0a 09 20 20 20 20 20 0a 09 20 20 20 20 20 3b  D..     ..     ;
5a80: 3b 20 63 61 73 65 20 77 68 65 72 65 20 61 6e 20  ; case where an 
5a90: 69 74 65 6d 73 20 63 61 6d 65 20 69 6e 20 61 73  items came in as
5aa0: 20 61 20 6c 69 73 74 20 62 65 65 6e 20 70 72 6f   a list been pro
5ab0: 63 65 73 73 65 64 0a 09 20 20 20 20 20 28 28 61  cessed..     ((a
5ac0: 6e 64 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29  nd (list? items)
5ad0: 20 20 20 20 20 3b 3b 20 74 68 75 73 20 77 65 20       ;; thus we 
5ae0: 6b 6e 6f 77 20 6f 75 72 20 69 74 65 6d 73 20 61  know our items a
5af0: 72 65 20 61 6c 72 65 61 64 79 20 63 61 6c 63 75  re already calcu
5b00: 6c 61 74 65 64 0a 09 09 20 20 20 28 6e 6f 74 20  lated...   (not 
5b10: 20 20 69 74 65 6d 64 61 74 29 29 20 3b 3b 20 61    itemdat)) ;; a
5b20: 6e 64 20 6e 6f 74 20 79 65 74 20 65 78 70 61 6e  nd not yet expan
5b30: 64 65 64 20 69 6e 74 6f 20 74 68 65 20 6c 69 73  ded into the lis
5b40: 74 20 6f 66 20 74 68 69 6e 67 73 20 74 6f 20 62  t of things to b
5b50: 65 20 64 6f 6e 65 0a 09 20 20 20 20 20 20 28 69  e done..      (i
5b60: 66 20 28 61 6e 64 20 28 64 65 62 75 67 3a 64 65  f (and (debug:de
5b70: 62 75 67 2d 6d 6f 64 65 20 31 29 20 3b 3b 20 28  bug-mode 1) ;; (
5b80: 3e 3d 20 2a 76 65 72 62 6f 73 69 74 79 2a 20 31  >= *verbosity* 1
5b90: 29 0a 09 09 20 20 20 20 20 20 20 28 3e 20 28 6c  )...       (> (l
5ba0: 65 6e 67 74 68 20 69 74 65 6d 73 29 20 30 29 0a  ength items) 0).
5bb0: 09 09 20 20 20 20 20 20 20 28 3e 20 28 6c 65 6e  ..       (> (len
5bc0: 67 74 68 20 28 63 61 72 20 69 74 65 6d 73 29 29  gth (car items))
5bd0: 20 30 29 29 0a 09 09 20 20 28 70 70 20 69 74 65   0))...  (pp ite
5be0: 6d 73 29 29 0a 09 20 20 20 20 20 20 28 66 6f 72  ms))..      (for
5bf0: 2d 65 61 63 68 0a 09 20 20 20 20 20 20 20 28 6c  -each..       (l
5c00: 61 6d 62 64 61 20 28 6d 79 2d 69 74 65 6d 64 61  ambda (my-itemda
5c10: 74 29 0a 09 09 20 28 6c 65 74 2a 20 28 28 6e 65  t)... (let* ((ne
5c20: 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 28 6c  w-test-record (l
5c30: 65 74 20 28 28 6e 65 77 72 65 63 20 28 6d 61 6b  et ((newrec (mak
5c40: 65 2d 74 65 73 74 73 3a 74 65 73 74 71 75 65 75  e-tests:testqueu
5c50: 65 29 29 29 0a 09 09 09 09 09 20 20 20 28 76 65  e)))......   (ve
5c60: 63 74 6f 72 2d 63 6f 70 79 21 20 74 65 73 74 2d  ctor-copy! test-
5c70: 72 65 63 6f 72 64 20 6e 65 77 72 65 63 29 0a 09  record newrec)..
5c80: 09 09 09 09 20 20 20 6e 65 77 72 65 63 29 29 0a  ....   newrec)).
5c90: 09 09 09 28 6d 79 2d 69 74 65 6d 2d 70 61 74 68  ...(my-item-path
5ca0: 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74   (item-list->pat
5cb0: 68 20 6d 79 2d 69 74 65 6d 64 61 74 29 29 29 0a  h my-itemdat))).
5cc0: 09 09 20 20 20 28 69 66 20 28 74 65 73 74 73 3a  ..   (if (tests:
5cd0: 6d 61 74 63 68 20 74 65 73 74 2d 70 61 74 74 73  match test-patts
5ce0: 20 68 65 64 20 6d 79 2d 69 74 65 6d 2d 70 61 74   hed my-item-pat
5cf0: 68 29 20 3b 3b 20 28 70 61 74 74 2d 6c 69 73 74  h) ;; (patt-list
5d00: 2d 6d 61 74 63 68 20 6d 79 2d 69 74 65 6d 2d 70  -match my-item-p
5d10: 61 74 68 20 69 74 65 6d 2d 70 61 74 74 73 29 20  ath item-patts) 
5d20: 20 20 20 20 20 20 20 20 20 20 3b 3b 20 79 65 73            ;; yes
5d30: 2c 20 77 65 20 77 61 6e 74 20 74 6f 20 70 72 6f  , we want to pro
5d40: 63 65 73 73 20 74 68 69 73 20 69 74 65 6d 2c 20  cess this item, 
5d50: 4e 4f 54 45 3a 20 53 68 6f 75 6c 64 20 6e 6f 74  NOTE: Should not
5d60: 20 6e 65 65 64 20 74 68 69 73 20 63 68 65 63 6b   need this check
5d70: 20 68 65 72 65 21 0a 09 09 20 20 20 20 20 20 20   here!...       
5d80: 28 6c 65 74 20 28 28 6e 65 77 74 65 73 74 6e 61  (let ((newtestna
5d90: 6d 65 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75  me (runs:make-fu
5da0: 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 68 65 64  ll-test-name hed
5db0: 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68 29 29 29   my-item-path)))
5dc0: 20 20 20 20 3b 3b 20 74 65 73 74 20 6e 61 6d 65      ;; test name
5dd0: 73 20 61 72 65 20 75 6e 69 71 75 65 20 6f 6e 20  s are unique on 
5de0: 74 65 73 74 6e 61 6d 65 2f 69 74 65 6d 2d 70 61  testname/item-pa
5df0: 74 68 0a 09 09 09 20 28 74 65 73 74 73 3a 74 65  th.... (tests:te
5e00: 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d  stqueue-set-item
5e10: 73 21 20 20 20 20 20 6e 65 77 2d 74 65 73 74 2d  s!     new-test-
5e20: 72 65 63 6f 72 64 20 23 66 29 0a 09 09 09 20 28  record #f).... (
5e30: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
5e40: 73 65 74 2d 69 74 65 6d 64 61 74 21 20 20 20 6e  set-itemdat!   n
5e50: 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 6d  ew-test-record m
5e60: 79 2d 69 74 65 6d 64 61 74 29 0a 09 09 09 20 28  y-itemdat).... (
5e70: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
5e80: 73 65 74 2d 69 74 65 6d 5f 70 61 74 68 21 20 6e  set-item_path! n
5e90: 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 6d  ew-test-record m
5ea0: 79 2d 69 74 65 6d 2d 70 61 74 68 29 0a 09 09 09  y-item-path)....
5eb0: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74   (hash-table-set
5ec0: 21 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 6e  ! test-records n
5ed0: 65 77 74 65 73 74 6e 61 6d 65 20 6e 65 77 2d 74  ewtestname new-t
5ee0: 65 73 74 2d 72 65 63 6f 72 64 29 0a 09 09 09 20  est-record).... 
5ef0: 28 73 65 74 21 20 74 61 6c 20 28 63 6f 6e 73 20  (set! tal (cons 
5f00: 6e 65 77 74 65 73 74 6e 61 6d 65 20 74 61 6c 29  newtestname tal)
5f10: 29 29 29 29 29 20 3b 3b 20 73 69 6e 63 65 20 74  ))))) ;; since t
5f20: 68 65 73 65 20 61 72 65 20 69 74 65 6d 69 7a 65  hese are itemize
5f30: 64 20 63 72 65 61 74 65 20 6e 65 77 20 74 65 73  d create new tes
5f40: 74 20 6e 61 6d 65 73 20 74 65 73 74 6e 61 6d 65  t names testname
5f50: 2f 69 74 65 6d 70 61 74 68 0a 09 20 20 20 20 20  /itempath..     
5f60: 20 20 69 74 65 6d 73 29 0a 09 20 20 20 20 20 20    items)..      
5f70: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20  (if (not (null? 
5f80: 74 61 6c 29 29 0a 09 09 20 20 28 62 65 67 69 6e  tal))...  (begin
5f90: 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72  ...    (debug:pr
5fa0: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 45 6e 64 20  int-info 4 "End 
5fb0: 6f 66 20 69 74 65 6d 73 20 6c 69 73 74 2c 20 6c  of items list, l
5fc0: 6f 6f 70 69 6e 67 20 77 69 74 68 20 6e 65 78 74  ooping with next
5fd0: 20 61 66 74 65 72 20 73 68 6f 72 74 20 64 65 6c   after short del
5fe0: 61 79 22 29 0a 20 20 20 20 20 20 20 20 20 20 20  ay").           
5ff0: 20 20 20 20 20 20 20 20 20 3b 3b 20 28 74 68 72           ;; (thr
6000: 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 30 2e  ead-sleep! (+ 0.
6010: 30 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61  01 *global-delta
6020: 2a 29 29 0a 09 09 20 20 20 20 28 6c 6f 6f 70 20  *))...    (loop 
6030: 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74 61  (car tal)(cdr ta
6040: 6c 29 20 72 65 72 75 6e 73 29 29 29 29 0a 0a 09  l) reruns))))...
6050: 20 20 20 20 20 3b 3b 20 69 66 20 69 74 65 6d 73       ;; if items
6060: 20 69 73 20 61 20 70 72 6f 63 20 74 68 65 6e 20   is a proc then 
6070: 6e 65 65 64 20 74 6f 20 72 75 6e 20 69 74 65 6d  need to run item
6080: 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d  s:get-items-from
6090: 2d 63 6f 6e 66 69 67 2c 20 67 65 74 20 74 68 65  -config, get the
60a0: 20 6c 69 73 74 20 61 6e 64 20 6c 6f 6f 70 20 0a   list and loop .
60b0: 09 20 20 20 20 20 3b 3b 20 20 20 20 2d 20 62 75  .     ;;    - bu
60c0: 74 20 6f 6e 6c 79 20 64 6f 20 74 68 61 74 20 69  t only do that i
60d0: 66 20 72 65 73 6f 75 72 63 65 73 20 65 78 69 73  f resources exis
60e0: 74 20 74 6f 20 6b 69 63 6b 20 6f 66 66 20 74 68  t to kick off th
60f0: 65 20 6a 6f 62 0a 09 20 20 20 20 20 28 28 6f 72  e job..     ((or
6100: 20 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65   (procedure? ite
6110: 6d 73 29 28 65 71 3f 20 69 74 65 6d 73 20 27 68  ms)(eq? items 'h
6120: 61 76 65 2d 70 72 6f 63 65 64 75 72 65 29 29 0a  ave-procedure)).
6130: 09 20 20 20 20 20 20 28 6c 65 74 20 28 28 63 61  .      (let ((ca
6140: 6e 2d 72 75 6e 2d 6d 6f 72 65 20 20 20 20 28 72  n-run-more    (r
6150: 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65  uns:can-run-more
6160: 2d 74 65 73 74 73 20 74 65 73 74 2d 72 65 63 6f  -tests test-reco
6170: 72 64 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e  rd max-concurren
6180: 74 2d 6a 6f 62 73 29 29 29 0a 09 09 28 69 66 20  t-jobs)))...(if 
6190: 28 61 6e 64 20 28 6c 69 73 74 3f 20 63 61 6e 2d  (and (list? can-
61a0: 72 75 6e 2d 6d 6f 72 65 29 0a 09 09 09 20 28 63  run-more).... (c
61b0: 61 72 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 29  ar can-run-more)
61c0: 29 0a 09 09 20 20 20 20 28 6c 65 74 2a 20 28 28  )...    (let* ((
61d0: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20  prereqs-not-met 
61e0: 28 64 62 3a 67 65 74 2d 70 72 65 72 65 71 73 2d  (db:get-prereqs-
61f0: 6e 6f 74 2d 6d 65 74 20 72 75 6e 2d 69 64 20 77  not-met run-id w
6200: 61 69 74 6f 6e 73 20 69 74 65 6d 2d 70 61 74 68  aitons item-path
6210: 20 6d 6f 64 65 3a 20 74 65 73 74 6d 6f 64 65 29   mode: testmode)
6220: 29 0a 09 09 09 20 20 20 28 66 61 69 6c 73 20 20  )....   (fails  
6230: 20 20 20 20 20 20 20 20 20 28 72 75 6e 73 3a 63           (runs:c
6240: 61 6c 63 2d 66 61 69 6c 73 20 70 72 65 72 65 71  alc-fails prereq
6250: 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 09 09 09 20  s-not-met)).... 
6260: 20 20 28 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64    (non-completed
6270: 20 20 20 28 72 75 6e 73 3a 63 61 6c 63 2d 6e 6f     (runs:calc-no
6280: 74 2d 63 6f 6d 70 6c 65 74 65 64 20 70 72 65 72  t-completed prer
6290: 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a 09  eqs-not-met)))..
62a0: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72  .      (debug:pr
62b0: 69 6e 74 2d 69 6e 66 6f 20 38 20 22 63 61 6e 2d  int-info 8 "can-
62c0: 72 75 6e 2d 6d 6f 72 65 3a 20 22 20 63 61 6e 2d  run-more: " can-
62d0: 72 75 6e 2d 6d 6f 72 65 0a 09 09 09 09 20 20 20  run-more.....   
62e0: 22 5c 6e 20 74 65 73 74 6e 61 6d 65 3a 20 20 20  "\n testname:   
62f0: 20 20 20 20 20 22 20 68 65 64 0a 09 09 09 09 20       " hed..... 
6300: 20 20 22 5c 6e 20 70 72 65 72 65 71 73 2d 6e 6f    "\n prereqs-no
6310: 74 2d 6d 65 74 3a 20 22 20 28 72 75 6e 73 3a 70  t-met: " (runs:p
6320: 72 65 74 74 79 2d 73 74 72 69 6e 67 20 70 72 65  retty-string pre
6330: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09  reqs-not-met)...
6340: 09 09 20 20 20 22 5c 6e 20 6e 6f 6e 2d 63 6f 6d  ..   "\n non-com
6350: 70 6c 65 74 65 64 3a 20 20 20 22 20 28 72 75 6e  pleted:   " (run
6360: 73 3a 70 72 65 74 74 79 2d 73 74 72 69 6e 67 20  s:pretty-string 
6370: 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 20 0a  non-completed) .
6380: 09 09 09 09 20 20 20 22 5c 6e 20 66 61 69 6c 73  ....   "\n fails
6390: 3a 20 20 20 20 20 20 20 20 20 20 20 22 20 28 72  :           " (r
63a0: 75 6e 73 3a 70 72 65 74 74 79 2d 73 74 72 69 6e  uns:pretty-strin
63b0: 67 20 66 61 69 6c 73 29 0a 09 09 09 09 20 20 20  g fails).....   
63c0: 22 5c 6e 20 74 65 73 74 6d 6f 64 65 3a 20 20 20  "\n testmode:   
63d0: 20 20 20 20 20 22 20 74 65 73 74 6d 6f 64 65 0a       " testmode.
63e0: 09 09 09 09 20 20 20 22 5c 6e 20 6e 75 6d 2d 72  ....   "\n num-r
63f0: 65 74 72 69 65 73 3a 20 20 20 20 20 22 20 6e 75  etries:     " nu
6400: 6d 2d 72 65 74 72 69 65 73 0a 09 09 09 09 20 20  m-retries.....  
6410: 20 22 5c 6e 20 28 65 71 3f 20 74 65 73 74 6d 6f   "\n (eq? testmo
6420: 64 65 20 27 74 6f 70 6c 65 76 65 6c 29 3a 20 22  de 'toplevel): "
6430: 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27   (eq? testmode '
6440: 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09 20 20  toplevel).....  
6450: 20 22 5c 6e 20 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d   "\n (null? non-
6460: 63 6f 6d 70 6c 65 74 65 64 29 3a 20 20 20 20 22  completed):    "
6470: 20 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70   (null? non-comp
6480: 6c 65 74 65 64 29 0a 09 09 09 09 20 20 20 22 5c  leted).....   "\
6490: 6e 20 72 65 72 75 6e 73 3a 20 20 20 20 20 20 20  n reruns:       
64a0: 20 20 20 22 20 72 65 72 75 6e 73 0a 09 09 09 09     " reruns.....
64b0: 20 20 20 22 5c 6e 20 69 74 65 6d 73 3a 20 20 20     "\n items:   
64c0: 20 20 20 20 20 20 20 20 22 20 69 74 65 6d 73 0a          " items.
64d0: 09 09 09 09 20 20 20 22 5c 6e 20 63 61 6e 2d 72  ....   "\n can-r
64e0: 75 6e 2d 6d 6f 72 65 3a 20 20 20 20 22 20 63 61  un-more:    " ca
64f0: 6e 2d 72 75 6e 2d 6d 6f 72 65 29 0a 09 09 20 20  n-run-more)...  
6500: 20 20 20 20 3b 3b 20 28 74 68 72 65 61 64 2d 73      ;; (thread-s
6510: 6c 65 65 70 21 20 28 2b 20 30 2e 30 31 20 2a 67  leep! (+ 0.01 *g
6520: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09  lobal-delta*))..
6530: 09 20 20 20 20 20 20 28 63 6f 6e 64 20 3b 3b 20  .      (cond ;; 
6540: 49 4e 4e 45 52 20 43 4f 4e 44 20 23 32 0a 09 09  INNER COND #2...
6550: 20 20 20 20 20 20 20 28 28 6f 72 20 28 6e 75 6c         ((or (nul
6560: 6c 3f 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d  l? prereqs-not-m
6570: 65 74 29 20 3b 3b 20 61 6c 6c 20 70 72 65 72 65  et) ;; all prere
6580: 71 73 20 6d 65 74 2c 20 66 69 72 65 20 6f 66 66  qs met, fire off
6590: 20 74 68 65 20 74 65 73 74 0a 09 09 09 20 20 20   the test....   
65a0: 20 3b 3b 20 6f 72 2c 20 69 66 20 69 74 20 69 73   ;; or, if it is
65b0: 20 61 20 27 74 6f 70 6c 65 76 65 6c 20 74 65 73   a 'toplevel tes
65c0: 74 20 61 6e 64 20 61 6c 6c 20 70 72 65 72 65 71  t and all prereq
65d0: 73 20 6e 6f 74 20 6d 65 74 20 61 72 65 20 43 4f  s not met are CO
65e0: 4d 50 4c 45 54 45 44 20 74 68 65 6e 20 6c 61 75  MPLETED then lau
65f0: 6e 63 68 0a 09 09 09 20 20 20 20 28 61 6e 64 20  nch....    (and 
6600: 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 74  (eq? testmode 't
6610: 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09 20 28 6e  oplevel)..... (n
6620: 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74  ull? non-complet
6630: 65 64 29 29 29 0a 09 09 09 28 6c 65 74 20 28 28  ed)))....(let ((
6640: 74 65 73 74 2d 6e 61 6d 65 20 28 74 65 73 74 73  test-name (tests
6650: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74  :testqueue-get-t
6660: 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63  estname test-rec
6670: 6f 72 64 29 29 29 0a 09 09 09 20 20 28 73 65 74  ord)))....  (set
6680: 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d  env "MT_TEST_NAM
6690: 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b  E" test-name) ;;
66a0: 20 0a 09 09 09 20 20 28 73 65 74 65 6e 76 20 22   ....  (setenv "
66b0: 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20 72 75  MT_RUNNAME"   ru
66c0: 6e 6e 61 6d 65 29 0a 09 09 09 20 20 28 73 65 74  nname)....  (set
66d0: 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61  -megatest-env-va
66e0: 72 73 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68  rs run-id) ;; th
66f0: 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65  ese may be neede
6700: 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69  d by the launchi
6710: 6e 67 20 70 72 6f 63 65 73 73 0a 09 09 09 20 20  ng process....  
6720: 28 6c 65 74 20 28 28 69 74 65 6d 73 2d 6c 69 73  (let ((items-lis
6730: 74 20 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 65  t (items:get-ite
6740: 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 74  ms-from-config t
6750: 63 6f 6e 66 69 67 29 29 29 0a 09 09 09 20 20 20  config)))....   
6760: 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74 65 6d   (if (list? item
6770: 73 2d 6c 69 73 74 29 0a 09 09 09 09 28 62 65 67  s-list).....(beg
6780: 69 6e 0a 09 09 09 09 20 20 28 74 65 73 74 73 3a  in.....  (tests:
6790: 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74  testqueue-set-it
67a0: 65 6d 73 21 20 74 65 73 74 2d 72 65 63 6f 72 64  ems! test-record
67b0: 20 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09 09 09   items-list)....
67c0: 09 20 20 3b 3b 20 28 74 68 72 65 61 64 2d 73 6c  .  ;; (thread-sl
67d0: 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c  eep! *global-del
67e0: 74 61 2a 29 0a 09 09 09 09 20 20 28 6c 6f 6f 70  ta*).....  (loop
67f0: 20 68 65 64 20 74 61 6c 20 72 65 72 75 6e 73 29   hed tal reruns)
6800: 29 0a 09 09 09 09 28 62 65 67 69 6e 0a 09 09 09  ).....(begin....
6810: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  .  (debug:print 
6820: 30 20 22 45 52 52 4f 52 3a 20 54 68 65 20 70 72  0 "ERROR: The pr
6830: 6f 63 20 66 72 6f 6d 20 72 65 61 64 69 6e 67 20  oc from reading 
6840: 74 68 65 20 73 65 74 75 70 20 64 69 64 20 6e 6f  the setup did no
6850: 74 20 79 69 65 6c 64 20 61 20 6c 69 73 74 20 2d  t yield a list -
6860: 20 70 6c 65 61 73 65 20 72 65 70 6f 72 74 20 74   please report t
6870: 68 69 73 22 29 0a 09 09 09 09 20 20 28 65 78 69  his").....  (exi
6880: 74 20 31 29 29 29 29 29 29 0a 09 09 20 20 20 20  t 1))))))...    
6890: 20 20 20 28 28 6e 75 6c 6c 3f 20 66 61 69 6c 73     ((null? fails
68a0: 29 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e  )....(debug:prin
68b0: 74 2d 69 6e 66 6f 20 34 20 22 66 61 69 6c 73 20  t-info 4 "fails 
68c0: 69 73 20 6e 75 6c 6c 2c 20 6d 6f 76 69 6e 67 20  is null, moving 
68d0: 6f 6e 20 69 6e 20 74 68 65 20 71 75 65 75 65 20  on in the queue 
68e0: 62 75 74 20 6b 65 65 70 69 6e 67 20 22 20 68 65  but keeping " he
68f0: 64 20 22 20 66 6f 72 20 6e 6f 77 22 29 0a 09 09  d " for now")...
6900: 09 3b 3b 20 6f 6e 6c 79 20 69 6e 63 72 65 6d 65  .;; only increme
6910: 6e 74 20 6e 75 6d 2d 72 65 74 72 69 65 73 20 77  nt num-retries w
6920: 68 65 6e 20 74 68 65 72 65 20 61 72 65 20 6e 6f  hen there are no
6930: 20 74 65 73 74 73 20 72 75 6e 69 6e 67 0a 09 09   tests runing...
6940: 09 28 69 66 20 28 65 71 3f 20 30 20 28 6c 69 73  .(if (eq? 0 (lis
6950: 74 2d 72 65 66 20 63 61 6e 2d 72 75 6e 2d 6d 6f  t-ref can-run-mo
6960: 72 65 20 31 29 29 0a 09 09 09 20 20 20 20 28 62  re 1))....    (b
6970: 65 67 69 6e 0a 09 09 09 20 20 20 20 20 20 3b 3b  egin....      ;;
6980: 20 54 52 59 20 28 69 66 20 28 3e 20 6e 75 6d 2d   TRY (if (> num-
6990: 72 65 74 72 69 65 73 20 31 30 30 29 20 3b 3b 20  retries 100) ;; 
69a0: 66 69 72 73 74 20 31 30 30 20 72 65 74 72 69 65  first 100 retrie
69b0: 73 20 61 72 65 20 6c 6f 77 20 74 69 6d 65 20 63  s are low time c
69c0: 6f 73 74 0a 09 09 09 20 20 20 20 20 20 3b 3b 20  ost....      ;; 
69d0: 54 52 59 20 20 20 20 20 28 74 68 72 65 61 64 2d  TRY     (thread-
69e0: 73 6c 65 65 70 21 20 28 2b 20 32 20 2a 67 6c 6f  sleep! (+ 2 *glo
69f0: 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09 09  bal-delta*))....
6a00: 20 20 20 20 20 20 3b 3b 20 54 52 59 20 20 20 20        ;; TRY    
6a10: 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20   (thread-sleep! 
6a20: 28 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d  (+ 0.01 *global-
6a30: 64 65 6c 74 61 2a 29 29 29 0a 09 09 09 20 20 20  delta*)))....   
6a40: 20 20 20 28 73 65 74 21 20 6e 75 6d 2d 72 65 74     (set! num-ret
6a50: 72 69 65 73 20 28 2b 20 6e 75 6d 2d 72 65 74 72  ries (+ num-retr
6a60: 69 65 73 20 31 29 29 29 29 0a 09 09 09 28 69 66  ies 1))))....(if
6a70: 20 28 3e 20 6e 75 6d 2d 72 65 74 72 69 65 73 20   (> num-retries 
6a80: 20 6d 61 78 2d 72 65 74 72 69 65 73 29 0a 09 09   max-retries)...
6a90: 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e  .    (if (not (n
6aa0: 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 09 09 28  ull? tal)).....(
6ab0: 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63  loop (car tal)(c
6ac0: 64 72 20 74 61 6c 29 20 72 65 72 75 6e 73 29 29  dr tal) reruns))
6ad0: 0a 09 09 09 20 20 20 20 28 6c 6f 6f 70 20 28 63  ....    (loop (c
6ae0: 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e  ar newtal)(cdr n
6af0: 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29 29 29  ewtal) reruns)))
6b00: 20 3b 3b 20 61 6e 20 69 73 73 75 65 20 77 69 74   ;; an issue wit
6b10: 68 20 70 72 65 72 65 71 73 20 6e 6f 74 20 79 65  h prereqs not ye
6b20: 74 20 6d 65 74 3f 0a 09 09 20 20 20 20 20 20 20  t met?...       
6b30: 28 28 61 6e 64 20 28 6e 6f 74 20 28 6e 75 6c 6c  ((and (not (null
6b40: 3f 20 66 61 69 6c 73 29 29 28 65 71 3f 20 74 65  ? fails))(eq? te
6b50: 73 74 6d 6f 64 65 20 27 6e 6f 72 6d 61 6c 29 29  stmode 'normal))
6b60: 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74  ....(debug:print
6b70: 2d 69 6e 66 6f 20 31 20 22 74 65 73 74 20 22 20  -info 1 "test " 
6b80: 20 68 65 64 20 22 20 28 6d 6f 64 65 3d 22 20 74   hed " (mode=" t
6b90: 65 73 74 6d 6f 64 65 20 22 29 20 68 61 73 20 66  estmode ") has f
6ba0: 61 69 6c 65 64 20 70 72 65 72 65 71 75 69 73 69  ailed prerequisi
6bb0: 74 65 28 73 29 3b 20 22 0a 09 09 09 09 20 20 20  te(s); ".....   
6bc0: 20 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73    (string-inters
6bd0: 70 65 72 73 65 20 28 6d 61 70 20 28 6c 61 6d 62  perse (map (lamb
6be0: 64 61 20 28 74 29 28 63 6f 6e 63 20 28 64 62 3a  da (t)(conc (db:
6bf0: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d  test-get-testnam
6c00: 65 20 74 29 20 22 3a 22 20 28 64 62 3a 74 65 73  e t) ":" (db:tes
6c10: 74 2d 67 65 74 2d 73 74 61 74 65 20 74 29 22 2f  t-get-state t)"/
6c20: 22 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74  "(db:test-get-st
6c30: 61 74 75 73 20 74 29 29 29 20 66 61 69 6c 73 29  atus t))) fails)
6c40: 20 22 2c 20 22 29 0a 09 09 09 09 20 20 20 20 20   ", ").....     
6c50: 22 2c 20 72 65 6d 6f 76 69 6e 67 20 69 74 20 66  ", removing it f
6c60: 72 6f 6d 20 74 6f 2d 64 6f 20 6c 69 73 74 22 29  rom to-do list")
6c70: 0a 09 09 09 28 69 66 20 28 6e 6f 74 20 28 6e 75  ....(if (not (nu
6c80: 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 09 20 20 20  ll? tal))....   
6c90: 20 28 62 65 67 69 6e 0a 20 20 20 20 20 20 20 20   (begin.        
6ca0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
6cb0: 20 20 20 20 20 20 3b 3b 20 28 74 68 72 65 61 64        ;; (thread
6cc0: 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d  -sleep! *global-
6cd0: 64 65 6c 74 61 2a 29 0a 09 09 09 20 20 20 20 20  delta*)....     
6ce0: 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29   (loop (car tal)
6cf0: 28 63 64 72 20 74 61 6c 29 28 63 6f 6e 73 20 68  (cdr tal)(cons h
6d00: 65 64 20 72 65 72 75 6e 73 29 29 29 29 29 0a 09  ed reruns)))))..
6d10: 09 20 20 20 20 20 20 20 28 65 6c 73 65 0a 09 09  .       (else...
6d20: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 38 20  .(debug:print 8 
6d30: 22 45 52 52 4f 52 3a 20 4e 6f 20 68 61 6e 64 6c  "ERROR: No handl
6d40: 65 72 20 66 6f 72 20 74 68 69 73 20 63 6f 6e 64  er for this cond
6d50: 69 74 69 6f 6e 2e 22 29 0a 09 09 09 3b 3b 20 54  ition.")....;; T
6d60: 52 59 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70  RY (thread-sleep
6d70: 21 20 28 2b 20 31 20 2a 67 6c 6f 62 61 6c 2d 64  ! (+ 1 *global-d
6d80: 65 6c 74 61 2a 29 29 0a 09 09 09 28 6c 6f 6f 70  elta*))....(loop
6d90: 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64   (car newtal)(cd
6da0: 72 20 6e 65 77 74 61 6c 29 20 72 65 72 75 6e 73  r newtal) reruns
6db0: 29 29 29 29 20 3b 3b 20 45 4e 44 20 4f 46 20 49  )))) ;; END OF I
6dc0: 46 20 43 41 4e 20 52 55 4e 20 4d 4f 52 45 0a 0a  F CAN RUN MORE..
6dd0: 09 09 20 20 20 20 3b 3b 20 69 66 20 63 61 6e 27  ..    ;; if can'
6de0: 74 20 72 75 6e 20 6d 6f 72 65 20 6a 75 73 74 20  t run more just 
6df0: 6c 6f 6f 70 20 77 69 74 68 20 6e 65 78 74 20 70  loop with next p
6e00: 6f 73 73 69 62 6c 65 20 74 65 73 74 0a 09 09 20  ossible test... 
6e10: 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20     (begin...    
6e20: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69    (debug:print-i
6e30: 6e 66 6f 20 34 20 22 70 72 6f 63 65 73 73 69 6e  nfo 4 "processin
6e40: 67 20 74 68 65 20 63 61 73 65 20 77 69 74 68 20  g the case with 
6e50: 61 20 6c 61 6d 62 64 61 20 66 6f 72 20 69 74 65  a lambda for ite
6e60: 6d 73 20 6f 72 20 27 68 61 76 65 2d 70 72 6f 63  ms or 'have-proc
6e70: 65 64 75 72 65 2e 20 4d 6f 76 69 6e 67 20 74 68  edure. Moving th
6e80: 72 6f 75 67 68 20 74 68 65 20 71 75 65 75 65 20  rough the queue 
6e90: 77 69 74 68 6f 75 74 20 64 72 6f 70 70 69 6e 67  without dropping
6ea0: 20 22 20 68 65 64 29 0a 09 09 20 20 20 20 20 20   " hed)...      
6eb0: 3b 3b 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70  ;; (thread-sleep
6ec0: 21 20 28 2b 20 32 20 2a 67 6c 6f 62 61 6c 2d 64  ! (+ 2 *global-d
6ed0: 65 6c 74 61 2a 29 29 0a 09 09 20 20 20 20 20 20  elta*))...      
6ee0: 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61  (loop (car newta
6ef0: 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20 72  l)(cdr newtal) r
6f00: 65 72 75 6e 73 29 29 29 29 29 20 3b 3b 20 45 4e  eruns))))) ;; EN
6f10: 44 20 4f 46 20 28 6f 72 20 28 70 72 6f 63 65 64  D OF (or (proced
6f20: 75 72 65 3f 20 69 74 65 6d 73 29 28 65 71 3f 20  ure? items)(eq? 
6f30: 69 74 65 6d 73 20 27 68 61 76 65 2d 70 72 6f 63  items 'have-proc
6f40: 65 64 75 72 65 29 29 0a 09 20 20 20 20 20 0a 09  edure))..     ..
6f50: 20 20 20 20 20 3b 3b 20 74 68 69 73 20 63 61 73       ;; this cas
6f60: 65 20 73 68 6f 75 6c 64 20 6e 6f 74 20 68 61 70  e should not hap
6f70: 70 65 6e 2c 20 61 64 64 65 64 20 74 6f 20 68 65  pen, added to he
6f80: 6c 70 20 63 61 74 63 68 20 61 6e 79 20 62 75 67  lp catch any bug
6f90: 73 0a 09 20 20 20 20 20 28 28 61 6e 64 20 28 6c  s..     ((and (l
6fa0: 69 73 74 3f 20 69 74 65 6d 73 29 20 69 74 65 6d  ist? items) item
6fb0: 64 61 74 29 0a 09 20 20 20 20 20 20 28 64 65 62  dat)..      (deb
6fc0: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f  ug:print 0 "ERRO
6fd0: 52 3a 20 53 68 6f 75 6c 64 20 6e 6f 74 20 68 61  R: Should not ha
6fe0: 76 65 20 61 20 6c 69 73 74 20 6f 66 20 69 74 65  ve a list of ite
6ff0: 6d 73 20 69 6e 20 61 20 74 65 73 74 20 61 6e 64  ms in a test and
7000: 20 74 68 65 20 69 74 65 6d 73 70 61 74 68 20 73   the itemspath s
7010: 65 74 20 2d 20 70 6c 65 61 73 65 20 72 65 70 6f  et - please repo
7020: 72 74 20 74 68 69 73 22 29 0a 09 20 20 20 20 20  rt this")..     
7030: 20 28 65 78 69 74 20 31 29 29 0a 09 20 20 20 20   (exit 1))..    
7040: 20 28 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65   ((not (null? re
7050: 72 75 6e 73 29 29 0a 09 20 20 20 20 20 20 28 6c  runs))..      (l
7060: 65 74 2a 20 28 28 6e 65 77 6c 73 74 20 28 74 65  et* ((newlst (te
7070: 73 74 73 3a 66 69 6c 74 65 72 2d 6e 6f 6e 2d 72  sts:filter-non-r
7080: 75 6e 6e 61 62 6c 65 20 72 75 6e 2d 69 64 20 74  unnable run-id t
7090: 61 6c 20 74 65 73 74 2d 72 65 63 6f 72 64 73 29  al test-records)
70a0: 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f 74 20 46 41  ) ;; i.e. not FA
70b0: 49 4c 2c 20 57 41 49 56 45 44 2c 20 49 4e 43 4f  IL, WAIVED, INCO
70c0: 4d 50 4c 45 54 45 2c 20 50 41 53 53 2c 20 4b 49  MPLETE, PASS, KI
70d0: 4c 4c 45 44 2c 0a 09 09 20 20 20 20 20 28 6a 75  LLED,...     (ju
70e0: 6e 6b 65 64 20 28 6c 73 65 74 2d 64 69 66 66 65  nked (lset-diffe
70f0: 72 65 6e 63 65 20 65 71 75 61 6c 3f 20 74 61 6c  rence equal? tal
7100: 20 6e 65 77 6c 73 74 29 29 29 0a 09 09 28 64 65   newlst)))...(de
7110: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34  bug:print-info 4
7120: 20 22 66 75 6c 6c 20 64 72 6f 70 20 74 68 72 6f   "full drop thro
7130: 75 67 68 2c 20 69 66 20 72 65 72 75 6e 73 20 69  ugh, if reruns i
7140: 73 20 6c 65 73 73 20 74 68 61 6e 20 31 30 30 20  s less than 100 
7150: 77 65 20 77 69 6c 6c 20 66 6f 72 63 65 20 72 65  we will force re
7160: 74 72 79 20 74 68 65 6d 2c 20 72 65 72 75 6e 73  try them, reruns
7170: 3d 22 20 72 65 72 75 6e 73 20 22 2c 20 74 61 6c  =" reruns ", tal
7180: 3d 22 20 74 61 6c 29 0a 09 09 28 69 66 20 28 3c  =" tal)...(if (<
7190: 20 6e 75 6d 2d 72 65 74 72 69 65 73 20 6d 61 78   num-retries max
71a0: 2d 72 65 74 72 69 65 73 29 0a 09 09 20 20 20 20  -retries)...    
71b0: 28 73 65 74 21 20 6e 65 77 6c 73 74 20 28 61 70  (set! newlst (ap
71c0: 70 65 6e 64 20 72 65 72 75 6e 73 20 6e 65 77 6c  pend reruns newl
71d0: 73 74 29 29 29 0a 09 09 28 73 65 74 21 20 6e 75  st)))...(set! nu
71e0: 6d 2d 72 65 74 72 69 65 73 20 28 2b 20 6e 75 6d  m-retries (+ num
71f0: 2d 72 65 74 72 69 65 73 20 31 29 29 0a 09 09 3b  -retries 1))...;
7200: 3b 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21  ; (thread-sleep!
7210: 20 28 2b 20 31 20 2a 67 6c 6f 62 61 6c 2d 64 65   (+ 1 *global-de
7220: 6c 74 61 2a 29 29 0a 09 09 28 69 66 20 28 6e 6f  lta*))...(if (no
7230: 74 20 28 6e 75 6c 6c 3f 20 6e 65 77 6c 73 74 29  t (null? newlst)
7240: 29 0a 09 09 20 20 20 20 3b 3b 20 73 69 6e 63 65  )...    ;; since
7250: 20 72 65 72 75 6e 73 20 68 61 76 65 20 62 65 65   reruns have bee
7260: 6e 20 74 61 63 6b 65 64 20 6f 6e 20 74 6f 20 6e  n tacked on to n
7270: 65 77 6c 73 74 20 63 72 65 61 74 65 20 6e 65 77  ewlst create new
7280: 20 72 65 72 75 6e 73 20 66 72 6f 6d 20 6a 75 6e   reruns from jun
7290: 6b 65 64 0a 09 09 20 20 20 20 28 6c 6f 6f 70 20  ked...    (loop 
72a0: 28 63 61 72 20 6e 65 77 6c 73 74 29 28 63 64 72  (car newlst)(cdr
72b0: 20 6e 65 77 6c 73 74 29 28 64 65 6c 65 74 65 2d   newlst)(delete-
72c0: 64 75 70 6c 69 63 61 74 65 73 20 6a 75 6e 6b 65  duplicates junke
72d0: 64 29 29 29 29 29 0a 09 20 20 20 20 20 28 28 6e  d)))))..     ((n
72e0: 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a  ot (null? tal)).
72f0: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72  .      (debug:pr
7300: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 49 27 6d 20  int-info 4 "I'm 
7310: 70 72 65 74 74 79 20 73 75 72 65 20 49 20 73 68  pretty sure I sh
7320: 6f 75 6c 64 6e 27 74 20 67 65 74 20 68 65 72 65  ouldn't get here
7330: 2e 22 29 29 0a 09 20 20 20 20 20 28 65 6c 73 65  ."))..     (else
7340: 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70  ..      (debug:p
7350: 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 45 78 69  rint-info 4 "Exi
7360: 74 69 6e 67 20 6c 6f 6f 70 20 77 69 74 68 2e 2e  ting loop with..
7370: 2e 5c 6e 20 20 68 65 64 3d 22 20 68 65 64 20 22  .\n  hed=" hed "
7380: 5c 6e 20 20 74 61 6c 3d 22 20 74 61 6c 20 22 5c  \n  tal=" tal "\
7390: 6e 20 20 72 65 72 75 6e 73 3d 22 20 72 65 72 75  n  reruns=" reru
73a0: 6e 73 29 29 0a 09 20 20 20 20 20 29 29 29 29 20  ns))..     )))) 
73b0: 3b 3b 20 4c 45 54 2a 20 28 28 74 65 73 74 2d 72  ;; LET* ((test-r
73c0: 65 63 6f 72 64 0a 0a 20 20 20 20 3b 3b 20 77 65  ecord..    ;; we
73d0: 20 67 65 74 20 68 65 72 65 20 6f 6e 20 22 64 72   get here on "dr
73e0: 6f 70 20 74 68 72 6f 75 67 68 22 20 2d 20 6c 6f  op through" - lo
73f0: 6f 70 20 66 6f 72 20 6e 65 78 74 20 74 65 73 74  op for next test
7400: 20 69 6e 20 71 75 65 75 65 0a 20 20 20 20 3b 3b   in queue.    ;;
7410: 20 46 49 58 4d 45 21 21 21 21 20 54 48 49 53 20   FIXME!!!! THIS 
7420: 53 48 4f 55 4c 44 20 4e 4f 54 20 52 45 51 55 49  SHOULD NOT REQUI
7430: 52 45 20 41 4e 20 45 58 49 54 21 21 21 21 21 21  RE AN EXIT!!!!!!
7440: 21 0a 20 20 20 20 0a 20 20 20 20 28 64 65 62 75  !.    .    (debu
7450: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22  g:print-info 1 "
7460: 41 6c 6c 20 74 65 73 74 73 20 6c 61 75 6e 63 68  All tests launch
7470: 65 64 22 29 0a 20 20 20 20 28 74 68 72 65 61 64  ed").    (thread
7480: 2d 73 6c 65 65 70 21 20 30 2e 35 29 0a 20 20 20  -sleep! 0.5).   
7490: 20 3b 3b 20 46 49 58 4d 45 21 20 54 68 69 73 20   ;; FIXME! This 
74a0: 68 61 72 73 68 20 65 78 69 74 20 73 68 6f 75 6c  harsh exit shoul
74b0: 64 20 6e 6f 74 20 62 65 20 6e 65 63 65 73 73 61  d not be necessa
74c0: 72 79 2e 2e 2e 2e 0a 20 20 20 20 3b 3b 20 28 69  ry.....    ;; (i
74d0: 66 20 28 6e 6f 74 20 2a 72 75 6e 72 65 6d 6f 74  f (not *runremot
74e0: 65 2a 29 28 65 78 69 74 29 29 20 3b 3b 20 0a 20  e*)(exit)) ;; . 
74f0: 20 20 20 23 66 29 29 20 3b 3b 20 72 65 74 75 72     #f)) ;; retur
7500: 6e 20 61 20 23 66 20 61 73 20 61 20 68 69 6e 74  n a #f as a hint
7510: 20 74 68 61 74 20 77 65 20 61 72 65 20 64 6f 6e   that we are don
7520: 65 0a 20 20 3b 3b 20 48 65 72 65 20 77 65 20 6e  e.  ;; Here we n
7530: 65 65 64 20 74 6f 20 63 68 65 63 6b 20 74 68 61  eed to check tha
7540: 74 20 61 6c 6c 20 74 68 65 20 74 65 73 74 73 20  t all the tests 
7550: 72 65 6d 61 69 6e 69 6e 67 20 74 6f 20 62 65 20  remaining to be 
7560: 72 75 6e 20 61 72 65 20 65 6c 69 67 69 62 6c 65  run are eligible
7570: 20 74 6f 20 72 75 6e 0a 20 20 3b 3b 20 61 6e 64   to run.  ;; and
7580: 20 61 72 65 20 6e 6f 74 20 62 6c 6f 63 6b 65 64   are not blocked
7590: 20 62 79 20 66 61 69 6c 65 64 0a 20 20 0a 0a 3b   by failed.  ..;
75a0: 3b 20 70 61 72 65 6e 74 2d 74 65 73 74 20 69 73  ; parent-test is
75b0: 20 74 68 65 72 65 20 61 73 20 61 20 70 6c 61 63   there as a plac
75c0: 65 68 6f 6c 64 65 72 20 66 6f 72 20 77 68 65 6e  eholder for when
75d0: 20 70 61 72 65 6e 74 2d 74 65 73 74 73 20 63 61   parent-tests ca
75e0: 6e 20 62 65 20 72 75 6e 20 61 73 20 61 20 73 65  n be run as a se
75f0: 74 75 70 20 73 74 65 70 0a 28 64 65 66 69 6e 65  tup step.(define
7600: 20 28 72 75 6e 3a 74 65 73 74 20 72 75 6e 2d 69   (run:test run-i
7610: 64 20 72 75 6e 6e 61 6d 65 20 6b 65 79 76 61 6c  d runname keyval
7620: 6c 73 74 20 74 65 73 74 2d 72 65 63 6f 72 64 20  lst test-record 
7630: 66 6c 61 67 73 20 70 61 72 65 6e 74 2d 74 65 73  flags parent-tes
7640: 74 29 0a 20 20 3b 3b 20 41 6c 6c 20 74 68 65 73  t).  ;; All thes
7650: 65 20 76 61 72 73 20 6d 69 67 68 74 20 62 65 20  e vars might be 
7660: 72 65 66 65 72 65 6e 63 65 64 20 62 79 20 74 68  referenced by th
7670: 65 20 74 65 73 74 63 6f 6e 66 69 67 20 66 69 6c  e testconfig fil
7680: 65 20 72 65 61 64 65 72 0a 20 20 28 6c 65 74 2a  e reader.  (let*
7690: 20 28 28 74 65 73 74 2d 6e 61 6d 65 20 20 20 20   ((test-name    
76a0: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65  (tests:testqueue
76b0: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 20 20  -get-testname   
76c0: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20  test-record)).. 
76d0: 28 74 65 73 74 2d 77 61 69 74 6f 6e 73 20 28 74  (test-waitons (t
76e0: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67  ests:testqueue-g
76f0: 65 74 2d 77 61 69 74 6f 6e 73 20 20 20 20 74 65  et-waitons    te
7700: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74  st-record)).. (t
7710: 65 73 74 2d 63 6f 6e 66 20 20 20 20 28 74 65 73  est-conf    (tes
7720: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
7730: 2d 74 65 73 74 63 6f 6e 66 69 67 20 74 65 73 74  -testconfig test
7740: 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 69 74 65  -record)).. (ite
7750: 6d 64 61 74 20 20 20 20 20 20 28 74 65 73 74 73  mdat      (tests
7760: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 69  :testqueue-get-i
7770: 74 65 6d 64 61 74 20 20 20 20 74 65 73 74 2d 72  temdat    test-r
7780: 65 63 6f 72 64 29 29 0a 09 20 28 74 65 73 74 2d  ecord)).. (test-
7790: 70 61 74 68 20 20 20 20 28 63 6f 6e 63 20 2a 74  path    (conc *t
77a0: 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f  oppath* "/tests/
77b0: 22 20 74 65 73 74 2d 6e 61 6d 65 29 29 20 3b 3b  " test-name)) ;;
77c0: 20 63 6f 75 6c 64 20 75 73 65 20 74 65 73 74 73   could use tests
77d0: 3a 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20  :get-testconfig 
77e0: 68 65 72 65 20 2e 2e 2e 0a 09 20 28 66 6f 72 63  here ..... (forc
77f0: 65 20 20 20 20 20 20 20 20 28 68 61 73 68 2d 74  e        (hash-t
7800: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74  able-ref/default
7810: 20 66 6c 61 67 73 20 22 2d 66 6f 72 63 65 22 20   flags "-force" 
7820: 23 66 29 29 0a 09 20 28 72 65 72 75 6e 20 20 20  #f)).. (rerun   
7830: 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65       (hash-table
7840: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61  -ref/default fla
7850: 67 73 20 22 2d 72 65 72 75 6e 22 20 23 66 29 29  gs "-rerun" #f))
7860: 0a 09 20 28 6b 65 65 70 67 6f 69 6e 67 20 20 20  .. (keepgoing   
7870: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66   (hash-table-ref
7880: 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22  /default flags "
7890: 2d 6b 65 65 70 67 6f 69 6e 67 22 20 23 66 29 29  -keepgoing" #f))
78a0: 0a 09 20 28 69 74 65 6d 2d 70 61 74 68 20 20 20  .. (item-path   
78b0: 20 20 22 22 29 0a 09 20 28 64 62 20 20 20 20 20    "").. (db     
78c0: 20 20 20 20 20 20 23 66 29 29 0a 20 20 20 20 28        #f)).    (
78d0: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 0a 09 09  debug:print 4...
78e0: 20 22 74 65 73 74 2d 63 6f 6e 66 69 67 3a 20 22   "test-config: "
78f0: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61 6c   (hash-table->al
7900: 69 73 74 20 74 65 73 74 2d 63 6f 6e 66 29 0a 09  ist test-conf)..
7910: 09 20 22 5c 6e 20 20 20 69 74 65 6d 64 61 74 3a  . "\n   itemdat:
7920: 20 22 20 69 74 65 6d 64 61 74 0a 09 09 20 29 0a   " itemdat... ).
7930: 20 20 20 20 3b 3b 20 73 65 74 74 69 6e 67 20 69      ;; setting i
7940: 74 65 6d 64 61 74 20 74 6f 20 61 20 6c 69 73 74  temdat to a list
7950: 20 69 66 20 69 74 20 69 73 20 23 66 0a 20 20 20   if it is #f.   
7960: 20 28 69 66 20 28 6e 6f 74 20 69 74 65 6d 64 61   (if (not itemda
7970: 74 29 28 73 65 74 21 20 69 74 65 6d 64 61 74 20  t)(set! itemdat 
7980: 27 28 29 29 29 0a 20 20 20 20 28 73 65 74 21 20  '())).    (set! 
7990: 69 74 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d  item-path (item-
79a0: 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64  list->path itemd
79b0: 61 74 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a  at)).    (debug:
79c0: 70 72 69 6e 74 20 32 20 22 41 74 74 65 6d 70 74  print 2 "Attempt
79d0: 69 6e 67 20 74 6f 20 6c 61 75 6e 63 68 20 74 65  ing to launch te
79e0: 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 28  st " test-name (
79f0: 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65 6d 2d  if (equal? item-
7a00: 70 61 74 68 20 22 2f 22 29 20 22 2f 22 20 69 74  path "/") "/" it
7a10: 65 6d 2d 70 61 74 68 29 29 0a 20 20 20 20 28 73  em-path)).    (s
7a20: 65 74 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e  etenv "MT_TEST_N
7a30: 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 20  AME" test-name) 
7a40: 3b 3b 20 0a 20 20 20 20 28 73 65 74 65 6e 76 20  ;; .    (setenv 
7a50: 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20 72  "MT_RUNNAME"   r
7a60: 75 6e 6e 61 6d 65 29 0a 20 20 20 20 28 73 65 74  unname).    (set
7a70: 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61  -megatest-env-va
7a80: 72 73 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68  rs run-id) ;; th
7a90: 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65  ese may be neede
7aa0: 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69  d by the launchi
7ab0: 6e 67 20 70 72 6f 63 65 73 73 0a 20 20 20 20 28  ng process.    (
7ac0: 63 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 79  change-directory
7ad0: 20 2a 74 6f 70 70 61 74 68 2a 29 0a 0a 20 20 20   *toppath*)..   
7ae0: 20 3b 3b 20 48 65 72 65 20 69 73 20 77 68 65 72   ;; Here is wher
7af0: 65 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61 20  e the test_meta 
7b00: 74 61 62 6c 65 20 69 73 20 62 65 73 74 20 75 70  table is best up
7b10: 64 61 74 65 64 0a 20 20 20 20 3b 3b 20 59 65 73  dated.    ;; Yes
7b20: 2c 20 61 6e 6f 74 68 65 72 20 75 73 65 20 6f 66  , another use of
7b30: 20 61 20 67 6c 6f 62 61 6c 20 66 6f 72 20 63 61   a global for ca
7b40: 63 68 69 6e 67 2e 20 4e 65 65 64 20 61 20 62 65  ching. Need a be
7b50: 74 74 65 72 20 77 61 79 3f 0a 20 20 20 20 28 69  tter way?.    (i
7b60: 66 20 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 62  f (not (hash-tab
7b70: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 2a  le-ref/default *
7b80: 74 65 73 74 2d 6d 65 74 61 2d 75 70 64 61 74 65  test-meta-update
7b90: 64 2a 20 74 65 73 74 2d 6e 61 6d 65 20 23 66 29  d* test-name #f)
7ba0: 29 0a 20 20 20 20 20 20 20 20 28 62 65 67 69 6e  ).        (begin
7bb0: 0a 09 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65  ..   (hash-table
7bc0: 2d 73 65 74 21 20 2a 74 65 73 74 2d 6d 65 74 61  -set! *test-meta
7bd0: 2d 75 70 64 61 74 65 64 2a 20 74 65 73 74 2d 6e  -updated* test-n
7be0: 61 6d 65 20 23 74 29 0a 20 20 20 20 20 20 20 20  ame #t).        
7bf0: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f     (open-run-clo
7c00: 73 65 20 72 75 6e 73 3a 75 70 64 61 74 65 2d 74  se runs:update-t
7c10: 65 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74  est_meta db test
7c20: 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29  -name test-conf)
7c30: 29 29 0a 20 20 20 20 0a 20 20 20 20 3b 3b 20 28  )).    .    ;; (
7c40: 6c 61 6d 62 64 61 20 28 69 74 65 6d 64 61 74 29  lambda (itemdat)
7c50: 20 3b 3b 3b 20 28 28 72 69 70 65 6e 65 73 73 20   ;;; ((ripeness 
7c60: 22 6f 76 65 72 72 69 70 65 22 29 20 28 74 65 6d  "overripe") (tem
7c70: 70 65 72 61 74 75 72 65 20 22 63 6f 6f 6c 22 29  perature "cool")
7c80: 20 28 73 65 61 73 6f 6e 20 22 73 75 6d 6d 65 72   (season "summer
7c90: 22 29 29 0a 20 20 20 20 28 6c 65 74 2a 20 28 28  ")).    (let* ((
7ca0: 6e 65 77 2d 74 65 73 74 2d 70 61 74 68 20 28 73  new-test-path (s
7cb0: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73  tring-interspers
7cc0: 65 20 28 63 6f 6e 73 20 74 65 73 74 2d 70 61 74  e (cons test-pat
7cd0: 68 20 28 6d 61 70 20 63 61 64 72 20 69 74 65 6d  h (map cadr item
7ce0: 64 61 74 29 29 20 22 2f 22 29 29 0a 09 20 20 20  dat)) "/"))..   
7cf0: 28 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 28  (new-test-name (
7d00: 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65 6d 2d  if (equal? item-
7d10: 70 61 74 68 20 22 22 29 20 74 65 73 74 2d 6e 61  path "") test-na
7d20: 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 2d 6e 61  me (conc test-na
7d30: 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68  me "/" item-path
7d40: 29 29 29 20 3b 3b 20 6a 75 73 74 20 6e 65 65 64  ))) ;; just need
7d50: 20 69 74 20 74 6f 20 62 65 20 75 6e 69 71 75 65   it to be unique
7d60: 0a 09 20 20 20 28 74 65 73 74 2d 69 64 20 20 20  ..   (test-id   
7d70: 20 20 20 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d      (cdb:remote-
7d80: 72 75 6e 20 64 62 3a 67 65 74 2d 74 65 73 74 2d  run db:get-test-
7d90: 69 64 20 23 66 20 20 72 75 6e 2d 69 64 20 74 65  id #f  run-id te
7da0: 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74  st-name item-pat
7db0: 68 29 29 0a 09 20 20 20 28 74 65 73 74 64 61 74  h))..   (testdat
7dc0: 20 20 20 20 20 20 20 28 63 64 62 3a 67 65 74 2d         (cdb:get-
7dd0: 74 65 73 74 2d 69 6e 66 6f 2d 62 79 2d 69 64 20  test-info-by-id 
7de0: 2a 72 75 6e 72 65 6d 6f 74 65 2a 20 74 65 73 74  *runremote* test
7df0: 2d 69 64 29 29 29 0a 20 20 20 20 20 20 28 69 66  -id))).      (if
7e00: 20 28 6e 6f 74 20 74 65 73 74 64 61 74 29 0a 09   (not testdat)..
7e10: 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 3b 3b    (begin..    ;;
7e20: 20 65 6e 73 75 72 65 20 74 68 61 74 20 74 68 65   ensure that the
7e30: 20 70 61 74 68 20 65 78 69 73 74 73 20 62 65 66   path exists bef
7e40: 6f 72 65 20 72 65 67 69 73 74 65 72 69 6e 67 20  ore registering 
7e50: 74 68 65 20 74 65 73 74 0a 09 20 20 20 20 3b 3b  the test..    ;;
7e60: 20 4e 4f 50 45 3a 20 43 61 6e 6e 6f 74 21 20 44   NOPE: Cannot! D
7e70: 6f 6e 27 74 20 6b 6e 6f 77 20 79 65 74 20 77 68  on't know yet wh
7e80: 69 63 68 20 64 69 73 6b 20 61 72 65 61 20 77 69  ich disk area wi
7e90: 6c 6c 20 62 65 20 61 73 73 69 67 6e 65 64 2e 2e  ll be assigned..
7ea0: 2e 2e 0a 09 20 20 20 20 3b 3b 20 28 73 79 73 74  ....    ;; (syst
7eb0: 65 6d 20 28 63 6f 6e 63 20 22 6d 6b 64 69 72 20  em (conc "mkdir 
7ec0: 2d 70 20 22 20 6e 65 77 2d 74 65 73 74 2d 70 61  -p " new-test-pa
7ed0: 74 68 29 29 0a 09 20 20 20 20 3b 3b 0a 09 20 20  th))..    ;;..  
7ee0: 20 20 3b 3b 20 28 6f 70 65 6e 2d 72 75 6e 2d 63    ;; (open-run-c
7ef0: 6c 6f 73 65 20 74 65 73 74 73 3a 72 65 67 69 73  lose tests:regis
7f00: 74 65 72 2d 74 65 73 74 20 64 62 20 72 75 6e 2d  ter-test db run-
7f10: 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65  id test-name ite
7f20: 6d 2d 70 61 74 68 29 0a 09 20 20 20 20 3b 3b 0a  m-path)..    ;;.
7f30: 09 20 20 20 20 3b 3b 20 4e 42 2f 2f 20 66 6f 72  .    ;; NB// for
7f40: 20 74 68 65 20 61 62 6f 76 65 20 6c 69 6e 65 2e   the above line.
7f50: 20 49 20 77 61 6e 74 20 74 68 65 20 74 65 73 74   I want the test
7f60: 20 74 6f 20 62 65 20 72 65 67 69 73 74 65 72 65   to be registere
7f70: 64 20 6c 6f 6e 67 20 62 65 66 6f 72 65 20 74 68  d long before th
7f80: 69 73 20 72 6f 75 74 69 6e 65 20 67 65 74 73 20  is routine gets 
7f90: 63 61 6c 6c 65 64 21 0a 09 20 20 20 20 3b 3b 0a  called!..    ;;.
7fa0: 09 20 20 20 20 28 73 65 74 21 20 74 65 73 74 2d  .    (set! test-
7fb0: 69 64 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f  id (open-run-clo
7fc0: 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 2d 69  se db:get-test-i
7fd0: 64 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74  d db run-id test
7fe0: 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29  -name item-path)
7ff0: 29 0a 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20  )..    (if (not 
8000: 74 65 73 74 2d 69 64 29 0a 09 09 28 62 65 67 69  test-id)...(begi
8010: 6e 0a 09 09 20 20 28 64 65 62 75 67 3a 70 72 69  n...  (debug:pri
8020: 6e 74 20 32 20 22 57 41 52 4e 3a 20 54 65 73 74  nt 2 "WARN: Test
8030: 20 6e 6f 74 20 70 72 65 2d 63 72 65 61 74 65 64   not pre-created
8040: 3f 20 74 65 73 74 2d 6e 61 6d 65 3d 22 20 74 65  ? test-name=" te
8050: 73 74 2d 6e 61 6d 65 20 22 2c 20 69 74 65 6d 2d  st-name ", item-
8060: 70 61 74 68 3d 22 20 69 74 65 6d 2d 70 61 74 68  path=" item-path
8070: 20 22 2c 20 72 75 6e 2d 69 64 3d 22 20 72 75 6e   ", run-id=" run
8080: 2d 69 64 29 0a 09 09 20 20 28 63 64 62 3a 74 65  -id)...  (cdb:te
8090: 73 74 73 2d 72 65 67 69 73 74 65 72 2d 74 65 73  sts-register-tes
80a0: 74 20 2a 72 75 6e 72 65 6d 6f 74 65 2a 20 72 75  t *runremote* ru
80b0: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69  n-id test-name i
80c0: 74 65 6d 2d 70 61 74 68 29 0a 09 09 20 20 28 73  tem-path)...  (s
80d0: 65 74 21 20 74 65 73 74 2d 69 64 20 28 6f 70 65  et! test-id (ope
80e0: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67  n-run-close db:g
80f0: 65 74 2d 74 65 73 74 2d 69 64 20 64 62 20 72 75  et-test-id db ru
8100: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69  n-id test-name i
8110: 74 65 6d 2d 70 61 74 68 29 29 29 29 0a 09 20 20  tem-path))))..  
8120: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69    (debug:print-i
8130: 6e 66 6f 20 34 20 22 74 65 73 74 2d 69 64 3d 22  nfo 4 "test-id="
8140: 20 74 65 73 74 2d 69 64 20 22 2c 20 72 75 6e 2d   test-id ", run-
8150: 69 64 3d 22 20 72 75 6e 2d 69 64 20 22 2c 20 74  id=" run-id ", t
8160: 65 73 74 2d 6e 61 6d 65 3d 22 20 74 65 73 74 2d  est-name=" test-
8170: 6e 61 6d 65 20 22 2c 20 69 74 65 6d 2d 70 61 74  name ", item-pat
8180: 68 3d 5c 22 22 20 69 74 65 6d 2d 70 61 74 68 20  h=\"" item-path 
8190: 22 5c 22 22 29 0a 09 20 20 20 20 28 73 65 74 21  "\"")..    (set!
81a0: 20 74 65 73 74 64 61 74 20 28 63 64 62 3a 67 65   testdat (cdb:ge
81b0: 74 2d 74 65 73 74 2d 69 6e 66 6f 2d 62 79 2d 69  t-test-info-by-i
81c0: 64 20 2a 72 75 6e 72 65 6d 6f 74 65 2a 20 74 65  d *runremote* te
81d0: 73 74 2d 69 64 29 29 29 29 0a 20 20 20 20 20 20  st-id)))).      
81e0: 28 73 65 74 21 20 74 65 73 74 2d 69 64 20 28 64  (set! test-id (d
81f0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65  b:test-get-id te
8200: 73 74 64 61 74 29 29 0a 20 20 20 20 20 20 28 63  stdat)).      (c
8210: 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 79 20  hange-directory 
8220: 74 65 73 74 2d 70 61 74 68 29 0a 20 20 20 20 20  test-path).     
8230: 20 28 63 61 73 65 20 28 69 66 20 66 6f 72 63 65   (case (if force
8240: 20 3b 3b 20 28 61 72 67 73 3a 67 65 74 2d 61 72   ;; (args:get-ar
8250: 67 20 22 2d 66 6f 72 63 65 22 29 0a 09 09 27 4e  g "-force")...'N
8260: 4f 54 5f 53 54 41 52 54 45 44 0a 09 09 28 69 66  OT_STARTED...(if
8270: 20 74 65 73 74 64 61 74 0a 09 09 20 20 20 20 28   testdat...    (
8280: 73 74 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c 20 28  string->symbol (
8290: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74  test:get-state t
82a0: 65 73 74 64 61 74 29 29 0a 09 09 20 20 20 20 27  estdat))...    '
82b0: 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 72 74  failed-to-insert
82c0: 29 29 0a 09 28 28 66 61 69 6c 65 64 2d 74 6f 2d  ))..((failed-to-
82d0: 69 6e 73 65 72 74 29 0a 09 20 28 64 65 62 75 67  insert).. (debug
82e0: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a  :print 0 "ERROR:
82f0: 20 46 61 69 6c 65 64 20 74 6f 20 69 6e 73 65 72   Failed to inser
8300: 74 20 74 68 65 20 72 65 63 6f 72 64 20 69 6e 74  t the record int
8310: 6f 20 74 68 65 20 64 62 22 29 29 0a 09 28 28 4e  o the db"))..((N
8320: 4f 54 5f 53 54 41 52 54 45 44 20 43 4f 4d 50 4c  OT_STARTED COMPL
8330: 45 54 45 44 20 44 45 4c 45 54 45 44 29 0a 09 20  ETED DELETED).. 
8340: 28 6c 65 74 20 28 28 72 75 6e 66 6c 61 67 20 23  (let ((runflag #
8350: 66 29 29 0a 09 20 20 20 28 63 6f 6e 64 0a 09 20  f))..   (cond.. 
8360: 20 20 20 3b 3b 20 2d 66 6f 72 63 65 2c 20 72 75     ;; -force, ru
8370: 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77 68 61 74  n no matter what
8380: 0a 09 20 20 20 20 28 66 6f 72 63 65 20 28 73 65  ..    (force (se
8390: 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a  t! runflag #t)).
83a0: 09 20 20 20 20 3b 3b 20 4e 4f 54 5f 53 54 41 52  .    ;; NOT_STAR
83b0: 54 45 44 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74  TED, run no matt
83c0: 65 72 20 77 68 61 74 0a 09 20 20 20 20 28 28 6d  er what..    ((m
83d0: 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d  ember (test:get-
83e0: 73 74 61 74 65 20 74 65 73 74 64 61 74 29 20 27  state testdat) '
83f0: 28 22 44 45 4c 45 54 45 44 22 20 22 4e 4f 54 5f  ("DELETED" "NOT_
8400: 53 54 41 52 54 45 44 22 29 29 28 73 65 74 21 20  STARTED"))(set! 
8410: 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20  runflag #t))..  
8420: 20 20 3b 3b 20 6e 6f 74 20 2d 72 65 72 75 6e 20    ;; not -rerun 
8430: 61 6e 64 20 50 41 53 53 2c 20 57 41 52 4e 20 6f  and PASS, WARN o
8440: 72 20 43 48 45 43 4b 2c 20 64 6f 20 6e 6f 20 72  r CHECK, do no r
8450: 75 6e 0a 09 20 20 20 20 28 28 61 6e 64 20 28 6f  un..    ((and (o
8460: 72 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09  r (not rerun)...
8470: 20 20 20 20 20 20 6b 65 65 70 67 6f 69 6e 67 29        keepgoing)
8480: 0a 09 09 20 20 3b 3b 20 52 65 71 75 69 72 65 20  ...  ;; Require 
8490: 74 6f 20 66 6f 72 63 65 20 72 65 2d 72 75 6e 20  to force re-run 
84a0: 66 6f 72 20 43 4f 4d 50 4c 45 54 45 44 20 6f 72  for COMPLETED or
84b0: 20 2a 61 6e 79 74 68 69 6e 67 2a 20 2b 20 50 41   *anything* + PA
84c0: 53 53 2c 57 41 52 4e 20 6f 72 20 43 48 45 43 4b  SS,WARN or CHECK
84d0: 0a 09 09 20 20 28 6f 72 20 28 6d 65 6d 62 65 72  ...  (or (member
84e0: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75   (test:get-statu
84f0: 73 20 74 65 73 74 64 61 74 29 20 27 28 22 50 41  s testdat) '("PA
8500: 53 53 22 20 22 57 41 52 4e 22 20 22 43 48 45 43  SS" "WARN" "CHEC
8510: 4b 22 20 22 53 4b 49 50 22 29 29 0a 09 09 20 20  K" "SKIP"))...  
8520: 20 20 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73      (member (tes
8530: 74 3a 67 65 74 2d 73 74 61 74 65 20 20 74 65 73  t:get-state  tes
8540: 74 64 61 74 29 20 27 28 22 43 4f 4d 50 4c 45 54  tdat) '("COMPLET
8550: 45 44 22 29 29 29 29 20 0a 09 20 20 20 20 20 28  ED")))) ..     (
8560: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
8570: 20 32 20 22 72 75 6e 6e 69 6e 67 20 74 65 73 74   2 "running test
8580: 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22   " test-name "/"
8590: 20 69 74 65 6d 2d 70 61 74 68 20 22 20 73 75 70   item-path " sup
85a0: 70 72 65 73 73 65 64 20 61 73 20 69 74 20 69 73  pressed as it is
85b0: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61   " (test:get-sta
85c0: 74 65 20 74 65 73 74 64 61 74 29 20 22 20 61 6e  te testdat) " an
85d0: 64 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74  d " (test:get-st
85e0: 61 74 75 73 20 74 65 73 74 64 61 74 29 29 0a 09  atus testdat))..
85f0: 20 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c       (set! runfl
8600: 61 67 20 23 66 29 29 0a 09 20 20 20 20 3b 3b 20  ag #f))..    ;; 
8610: 2d 72 65 72 75 6e 20 61 6e 64 20 73 74 61 74 75  -rerun and statu
8620: 73 20 69 73 20 6f 6e 65 20 6f 66 20 74 68 65 20  s is one of the 
8630: 73 70 65 63 69 66 65 64 2c 20 72 75 6e 20 69 74  specifed, run it
8640: 0a 09 20 20 20 20 28 28 61 6e 64 20 72 65 72 75  ..    ((and reru
8650: 6e 0a 09 09 20 20 28 6c 65 74 2a 20 28 28 72 65  n...  (let* ((re
8660: 72 75 6e 6c 73 74 20 20 20 28 73 74 72 69 6e 67  runlst   (string
8670: 2d 73 70 6c 69 74 20 72 65 72 75 6e 20 22 2c 22  -split rerun ","
8680: 29 29 0a 09 09 09 20 28 6d 75 73 74 2d 72 65 72  )).... (must-rer
8690: 75 6e 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74  un (member (test
86a0: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74  :get-status test
86b0: 64 61 74 29 20 72 65 72 75 6e 6c 73 74 29 29 29  dat) rerunlst)))
86c0: 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72  ...    (debug:pr
86d0: 69 6e 74 2d 69 6e 66 6f 20 33 20 22 2d 72 65 72  int-info 3 "-rer
86e0: 75 6e 20 6c 69 73 74 3a 20 22 20 72 65 72 75 6e  un list: " rerun
86f0: 20 22 2c 20 74 65 73 74 2d 73 74 61 74 75 73 3a   ", test-status:
8700: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61   " (test:get-sta
8710: 74 75 73 20 74 65 73 74 64 61 74 29 22 2c 20 6d  tus testdat)", m
8720: 75 73 74 2d 72 65 72 75 6e 3a 20 22 20 6d 75 73  ust-rerun: " mus
8730: 74 2d 72 65 72 75 6e 29 0a 09 09 20 20 20 20 6d  t-rerun)...    m
8740: 75 73 74 2d 72 65 72 75 6e 29 29 0a 09 20 20 20  ust-rerun))..   
8750: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69    (debug:print-i
8760: 6e 66 6f 20 32 20 22 52 65 72 75 6e 20 66 6f 72  nfo 2 "Rerun for
8770: 63 65 64 20 66 6f 72 20 74 65 73 74 20 22 20 74  ced for test " t
8780: 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65  est-name "/" ite
8790: 6d 2d 70 61 74 68 29 0a 09 20 20 20 20 20 28 73  m-path)..     (s
87a0: 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29  et! runflag #t))
87b0: 0a 09 20 20 20 20 3b 3b 20 2d 6b 65 65 70 67 6f  ..    ;; -keepgo
87c0: 69 6e 67 2c 20 64 6f 20 6e 6f 74 20 72 65 72 75  ing, do not reru
87d0: 6e 20 46 41 49 4c 0a 09 20 20 20 20 28 28 61 6e  n FAIL..    ((an
87e0: 64 20 6b 65 65 70 67 6f 69 6e 67 0a 09 09 20 20  d keepgoing...  
87f0: 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65  (member (test:ge
8800: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74  t-status testdat
8810: 29 20 27 28 22 46 41 49 4c 22 29 29 29 0a 09 20  ) '("FAIL"))).. 
8820: 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61      (set! runfla
8830: 67 20 23 66 29 29 0a 09 20 20 20 20 28 28 61 6e  g #f))..    ((an
8840: 64 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09  d (not rerun)...
8850: 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a    (member (test:
8860: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64  get-status testd
8870: 61 74 29 20 27 28 22 46 41 49 4c 22 20 22 6e 2f  at) '("FAIL" "n/
8880: 61 22 29 29 29 0a 09 20 20 20 20 20 28 73 65 74  a")))..     (set
8890: 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09  ! runflag #t))..
88a0: 20 20 20 20 28 65 6c 73 65 20 28 73 65 74 21 20      (else (set! 
88b0: 72 75 6e 66 6c 61 67 20 23 66 29 29 29 0a 09 20  runflag #f))).. 
88c0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 36    (debug:print 6
88d0: 20 22 52 55 4e 4e 49 4e 47 20 3d 3e 20 72 75 6e   "RUNNING => run
88e0: 66 6c 61 67 3a 20 22 20 72 75 6e 66 6c 61 67 20  flag: " runflag 
88f0: 22 20 53 54 41 54 45 3a 20 22 20 28 74 65 73 74  " STATE: " (test
8900: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64  :get-state testd
8910: 61 74 29 20 22 20 53 54 41 54 55 53 3a 20 22 20  at) " STATUS: " 
8920: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73  (test:get-status
8930: 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 28   testdat))..   (
8940: 69 66 20 28 6e 6f 74 20 72 75 6e 66 6c 61 67 29  if (not runflag)
8950: 0a 09 20 20 20 20 20 20 20 28 69 66 20 28 6e 6f  ..       (if (no
8960: 74 20 70 61 72 65 6e 74 2d 74 65 73 74 29 0a 09  t parent-test)..
8970: 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74  .   (debug:print
8980: 20 31 20 22 4e 4f 54 45 3a 20 4e 6f 74 20 73 74   1 "NOTE: Not st
8990: 61 72 74 69 6e 67 20 74 65 73 74 20 22 20 6e 65  arting test " ne
89a0: 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 73  w-test-name " as
89b0: 20 69 74 20 69 73 20 73 74 61 74 65 20 5c 22 22   it is state \""
89c0: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65   (test:get-state
89d0: 20 74 65 73 74 64 61 74 29 20 0a 09 09 09 09 22   testdat) ....."
89e0: 5c 22 20 61 6e 64 20 73 74 61 74 75 73 20 5c 22  \" and status \"
89f0: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  " (test:get-stat
8a00: 75 73 20 74 65 73 74 64 61 74 29 20 22 5c 22 2c  us testdat) "\",
8a10: 20 75 73 65 20 2d 72 65 72 75 6e 20 5c 22 22 20   use -rerun \"" 
8a20: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73  (test:get-status
8a30: 20 74 65 73 74 64 61 74 29 0a 20 20 20 20 20 20   testdat).      
8a40: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
8a50: 20 20 20 20 20 20 20 20 20 20 22 5c 22 20 6f 72            "\" or
8a60: 20 2d 66 6f 72 63 65 20 74 6f 20 6f 76 65 72 72   -force to overr
8a70: 69 64 65 22 29 29 0a 09 20 20 20 20 20 20 20 3b  ide"))..       ;
8a80: 3b 20 4e 4f 54 45 3a 20 4e 6f 20 6c 6f 6e 67 65  ; NOTE: No longe
8a90: 72 20 62 65 20 63 68 65 63 6b 69 6e 67 20 70 72  r be checking pr
8aa0: 65 72 65 71 75 69 73 69 74 65 73 20 68 65 72 65  erequisites here
8ab0: 21 20 57 69 6c 6c 20 6e 65 76 65 72 20 67 65 74  ! Will never get
8ac0: 20 68 65 72 65 20 75 6e 6c 65 73 73 20 70 72 65   here unless pre
8ad0: 72 65 71 73 20 61 72 65 0a 09 20 20 20 20 20 20  reqs are..      
8ae0: 20 3b 3b 20 20 20 20 20 20 20 61 6c 72 65 61 64   ;;       alread
8af0: 79 20 6d 65 74 2e 0a 09 20 20 20 20 20 20 20 3b  y met...       ;
8b00: 3b 20 54 68 69 73 20 77 6f 75 6c 64 20 62 65 20  ; This would be 
8b10: 61 20 67 72 65 61 74 20 70 6c 61 63 65 20 74 6f  a great place to
8b20: 20 64 6f 20 74 68 65 20 70 72 6f 63 65 73 73 2d   do the process-
8b30: 66 6f 72 6b 0a 09 20 20 20 20 20 20 20 28 69 66  fork..       (if
8b40: 20 28 6e 6f 74 20 28 6c 61 75 6e 63 68 2d 74 65   (not (launch-te
8b50: 73 74 20 23 66 20 72 75 6e 2d 69 64 20 72 75 6e  st #f run-id run
8b60: 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 20 6b  name test-conf k
8b70: 65 79 76 61 6c 6c 73 74 20 74 65 73 74 2d 6e 61  eyvallst test-na
8b80: 6d 65 20 74 65 73 74 2d 70 61 74 68 20 69 74 65  me test-path ite
8b90: 6d 64 61 74 20 66 6c 61 67 73 29 29 0a 09 09 20  mdat flags))... 
8ba0: 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20    (begin...     
8bb0: 28 70 72 69 6e 74 20 22 45 52 52 4f 52 3a 20 46  (print "ERROR: F
8bc0: 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 20  ailed to launch 
8bd0: 74 68 65 20 74 65 73 74 2e 20 45 78 69 74 69 6e  the test. Exitin
8be0: 67 20 61 73 20 73 6f 6f 6e 20 61 73 20 70 6f 73  g as soon as pos
8bf0: 73 69 62 6c 65 22 29 0a 09 09 20 20 20 20 20 28  sible")...     (
8c00: 73 65 74 21 20 2a 67 6c 6f 62 61 6c 65 78 69 74  set! *globalexit
8c10: 73 74 61 74 75 73 2a 20 31 29 20 3b 3b 20 0a 09  status* 1) ;; ..
8c20: 09 20 20 20 20 20 28 70 72 6f 63 65 73 73 2d 73  .     (process-s
8c30: 69 67 6e 61 6c 20 28 63 75 72 72 65 6e 74 2d 70  ignal (current-p
8c40: 72 6f 63 65 73 73 2d 69 64 29 20 73 69 67 6e 61  rocess-id) signa
8c50: 6c 2f 6b 69 6c 6c 29 29 29 29 29 29 0a 09 28 28  l/kill))))))..((
8c60: 4b 49 4c 4c 45 44 29 20 0a 09 20 28 64 65 62 75  KILLED) .. (debu
8c70: 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a  g:print 1 "NOTE:
8c80: 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65   " new-test-name
8c90: 20 22 20 69 73 20 61 6c 72 65 61 64 79 20 72 75   " is already ru
8ca0: 6e 6e 69 6e 67 20 6f 72 20 77 61 73 20 65 78 70  nning or was exp
8cb0: 6c 69 63 74 6c 79 20 6b 69 6c 6c 65 64 2c 20 75  lictly killed, u
8cc0: 73 65 20 2d 66 6f 72 63 65 20 74 6f 20 6c 61 75  se -force to lau
8cd0: 6e 63 68 20 69 74 2e 22 29 29 0a 09 28 28 4c 41  nch it."))..((LA
8ce0: 55 4e 43 48 45 44 20 52 45 4d 4f 54 45 48 4f 53  UNCHED REMOTEHOS
8cf0: 54 53 54 41 52 54 20 52 55 4e 4e 49 4e 47 29 20  TSTART RUNNING) 
8d00: 20 0a 09 20 28 69 66 20 28 3e 20 28 2d 20 28 63   .. (if (> (- (c
8d10: 75 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73 29 28  urrent-seconds)(
8d20: 2b 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 65  + (db:test-get-e
8d30: 76 65 6e 74 5f 74 69 6d 65 20 74 65 73 74 64 61  vent_time testda
8d40: 74 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 64  t).....       (d
8d50: 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 5f 64  b:test-get-run_d
8d60: 75 72 61 74 69 6f 6e 20 74 65 73 74 64 61 74 29  uration testdat)
8d70: 29 29 0a 09 09 36 30 30 29 20 3b 3b 20 69 2e 65  ))...600) ;; i.e
8d80: 2e 20 6e 6f 20 75 70 64 61 74 65 20 66 6f 72 20  . no update for 
8d90: 6d 6f 72 65 20 74 68 61 6e 20 36 30 30 20 73 65  more than 600 se
8da0: 63 6f 6e 64 73 0a 09 20 20 20 20 20 28 62 65 67  conds..     (beg
8db0: 69 6e 0a 09 20 20 20 20 20 20 20 28 64 65 62 75  in..       (debu
8dc0: 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49  g:print 0 "WARNI
8dd0: 4e 47 3a 20 54 65 73 74 20 22 20 74 65 73 74 2d  NG: Test " test-
8de0: 6e 61 6d 65 20 22 20 61 70 70 65 61 72 73 20 74  name " appears t
8df0: 6f 20 62 65 20 64 65 61 64 2e 20 46 6f 72 63 69  o be dead. Forci
8e00: 6e 67 20 69 74 20 74 6f 20 73 74 61 74 65 20 49  ng it to state I
8e10: 4e 43 4f 4d 50 4c 45 54 45 20 61 6e 64 20 73 74  NCOMPLETE and st
8e20: 61 74 75 73 20 53 54 55 43 4b 2f 44 45 41 44 22  atus STUCK/DEAD"
8e30: 29 0a 09 20 20 20 20 20 20 20 28 74 65 73 74 73  )..       (tests
8e40: 3a 74 65 73 74 2d 73 65 74 2d 73 74 61 74 75 73  :test-set-status
8e50: 21 20 74 65 73 74 2d 69 64 20 22 49 4e 43 4f 4d  ! test-id "INCOM
8e60: 50 4c 45 54 45 22 20 22 53 54 55 43 4b 2f 44 45  PLETE" "STUCK/DE
8e70: 41 44 22 20 22 54 65 73 74 20 69 73 20 73 74 75  AD" "Test is stu
8e80: 63 6b 20 6f 72 20 64 65 61 64 22 20 23 66 29 29  ck or dead" #f))
8e90: 0a 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72  ..     (debug:pr
8ea0: 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 22 20 74  int 2 "NOTE: " t
8eb0: 65 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c  est-name " is al
8ec0: 72 65 61 64 79 20 72 75 6e 6e 69 6e 67 22 29 29  ready running"))
8ed0: 29 0a 09 28 65 6c 73 65 20 20 20 20 20 20 20 28  )..(else       (
8ee0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45  debug:print 0 "E
8ef0: 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20  RROR: Failed to 
8f00: 6c 61 75 6e 63 68 20 74 65 73 74 20 22 20 6e 65  launch test " ne
8f10: 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 2e 20 55  w-test-name ". U
8f20: 6e 72 65 63 6f 67 6e 69 73 65 64 20 73 74 61 74  nrecognised stat
8f30: 65 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74  e " (test:get-st
8f40: 61 74 65 20 74 65 73 74 64 61 74 29 29 29 29 29  ate testdat)))))
8f50: 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ))..;;==========
8f60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8f70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8f80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8f90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20  ============.;; 
8fa0: 45 4e 44 20 4f 46 20 4e 45 57 20 53 54 55 46 46  END OF NEW STUFF
8fb0: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  .;;=============
8fc0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8fd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8fe0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8ff0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69  =========..(defi
9000: 6e 65 20 28 67 65 74 2d 64 69 72 2d 75 70 2d 6e  ne (get-dir-up-n
9010: 20 64 69 72 20 2e 20 70 61 72 61 6d 73 29 20 0a   dir . params) .
9020: 20 20 28 6c 65 74 20 28 28 64 70 61 72 74 73 20    (let ((dparts 
9030: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 64   (string-split d
9040: 69 72 20 22 2f 22 29 29 0a 09 28 63 6f 75 6e 74  ir "/"))..(count
9050: 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 70 61     (if (null? pa
9060: 72 61 6d 73 29 20 31 20 28 63 61 72 20 70 61 72  rams) 1 (car par
9070: 61 6d 73 29 29 29 29 0a 20 20 20 20 28 63 6f 6e  ams)))).    (con
9080: 63 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e  c "/" (string-in
9090: 74 65 72 73 70 65 72 73 65 20 0a 09 20 20 20 20  tersperse ..    
90a0: 20 20 20 28 74 61 6b 65 20 64 70 61 72 74 73 20     (take dparts 
90b0: 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74  (- (length dpart
90c0: 73 29 20 63 6f 75 6e 74 29 29 0a 09 20 20 20 20  s) count))..    
90d0: 20 20 20 22 2f 22 29 29 29 29 0a 3b 3b 20 52 65     "/")))).;; Re
90e0: 6d 6f 76 65 20 72 75 6e 73 0a 3b 3b 20 66 69 65  move runs.;; fie
90f0: 6c 64 73 20 61 72 65 20 70 61 73 73 69 6e 67 20  lds are passing 
9100: 69 6e 20 74 68 72 6f 75 67 68 20 0a 3b 3b 20 61  in through .;; a
9110: 63 74 69 6f 6e 3a 0a 3b 3b 20 20 20 20 27 72 65  ction:.;;    're
9120: 6d 6f 76 65 2d 72 75 6e 73 0a 3b 3b 20 20 20 20  move-runs.;;    
9130: 27 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75  'set-state-statu
9140: 73 0a 3b 3b 0a 3b 3b 20 4e 42 2f 2f 20 73 68 6f  s.;;.;; NB// sho
9150: 75 6c 64 20 70 61 73 73 20 69 6e 20 6b 65 79 73  uld pass in keys
9160: 3f 0a 3b 3b 0a 28 64 65 66 69 6e 65 20 28 72 75  ?.;;.(define (ru
9170: 6e 73 3a 6f 70 65 72 61 74 65 2d 6f 6e 20 61 63  ns:operate-on ac
9180: 74 69 6f 6e 20 72 75 6e 6e 61 6d 65 70 61 74 74  tion runnamepatt
9190: 20 74 65 73 74 70 61 74 74 20 23 21 6b 65 79 20   testpatt #!key 
91a0: 28 73 74 61 74 65 20 23 66 29 28 73 74 61 74 75  (state #f)(statu
91b0: 73 20 23 66 29 28 6e 65 77 2d 73 74 61 74 65 2d  s #f)(new-state-
91c0: 73 74 61 74 75 73 20 23 66 29 29 0a 20 20 28 63  status #f)).  (c
91d0: 6f 6d 6d 6f 6e 3a 63 6c 65 61 72 2d 63 61 63 68  ommon:clear-cach
91e0: 65 73 29 20 3b 3b 20 63 6c 65 61 72 20 61 6c 6c  es) ;; clear all
91f0: 20 63 61 63 68 65 73 0a 20 20 28 6c 65 74 2a 20   caches.  (let* 
9200: 28 28 64 62 20 20 20 20 20 20 20 20 20 20 20 23  ((db           #
9210: 66 29 0a 09 20 28 6b 65 79 73 20 20 20 20 20 20  f).. (keys      
9220: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f     (open-run-clo
9230: 73 65 20 64 62 3a 67 65 74 2d 6b 65 79 73 20 64  se db:get-keys d
9240: 62 29 29 0a 09 20 28 72 75 6e 64 61 74 20 20 20  b)).. (rundat   
9250: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c      (open-run-cl
9260: 6f 73 65 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e  ose runs:get-run
9270: 73 2d 62 79 2d 70 61 74 74 20 64 62 20 6b 65 79  s-by-patt db key
9280: 73 20 72 75 6e 6e 61 6d 65 70 61 74 74 29 29 0a  s runnamepatt)).
9290: 09 20 28 68 65 61 64 65 72 20 20 20 20 20 20 20  . (header       
92a0: 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64  (vector-ref rund
92b0: 61 74 20 30 29 29 0a 09 20 28 72 75 6e 73 20 20  at 0)).. (runs  
92c0: 20 20 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72         (vector-r
92d0: 65 66 20 72 75 6e 64 61 74 20 31 29 29 0a 09 20  ef rundat 1)).. 
92e0: 28 73 74 61 74 65 73 20 20 20 20 20 20 20 28 69  (states       (i
92f0: 66 20 73 74 61 74 65 20 20 28 73 74 72 69 6e 67  f state  (string
9300: 2d 73 70 6c 69 74 20 73 74 61 74 65 20 20 22 2c  -split state  ",
9310: 22 29 20 27 28 29 29 29 0a 09 20 28 73 74 61 74  ") '())).. (stat
9320: 75 73 65 73 20 20 20 20 20 28 69 66 20 73 74 61  uses     (if sta
9330: 74 75 73 20 28 73 74 72 69 6e 67 2d 73 70 6c 69  tus (string-spli
9340: 74 20 73 74 61 74 75 73 20 22 2c 22 29 20 27 28  t status ",") '(
9350: 29 29 29 0a 09 20 28 73 74 61 74 65 2d 73 74 61  ))).. (state-sta
9360: 74 75 73 20 28 69 66 20 28 73 74 72 69 6e 67 3f  tus (if (string?
9370: 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75   new-state-statu
9380: 73 29 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74  s) (string-split
9390: 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75   new-state-statu
93a0: 73 20 22 2c 22 29 20 27 28 23 66 20 23 66 29 29  s ",") '(#f #f))
93b0: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72  )).    (debug:pr
93c0: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 72 75 6e 73  int-info 4 "runs
93d0: 3a 6f 70 65 72 61 74 65 2d 6f 6e 20 3d 3e 20 48  :operate-on => H
93e0: 65 61 64 65 72 3a 20 22 20 68 65 61 64 65 72 20  eader: " header 
93f0: 22 20 61 63 74 69 6f 6e 3a 20 22 20 61 63 74 69  " action: " acti
9400: 6f 6e 20 22 20 6e 65 77 2d 73 74 61 74 65 2d 73  on " new-state-s
9410: 74 61 74 75 73 3a 20 22 20 6e 65 77 2d 73 74 61  tatus: " new-sta
9420: 74 65 2d 73 74 61 74 75 73 29 0a 20 20 20 20 28  te-status).    (
9430: 69 66 20 28 3e 20 32 20 28 6c 65 6e 67 74 68 20  if (> 2 (length 
9440: 73 74 61 74 65 2d 73 74 61 74 75 73 29 29 0a 09  state-status))..
9450: 28 62 65 67 69 6e 0a 09 20 20 28 64 65 62 75 67  (begin..  (debug
9460: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a  :print 0 "ERROR:
9470: 20 74 68 65 20 70 61 72 61 6d 65 74 65 72 20 74   the parameter t
9480: 6f 20 2d 73 65 74 2d 73 74 61 74 65 2d 73 74 61  o -set-state-sta
9490: 74 75 73 20 69 73 20 61 20 63 6f 6d 6d 61 20 64  tus is a comma d
94a0: 65 6c 69 6d 69 74 65 64 20 73 74 72 69 6e 67 2e  elimited string.
94b0: 20 45 2e 67 2e 20 43 4f 4d 50 4c 45 54 45 44 2c   E.g. COMPLETED,
94c0: 46 41 49 4c 22 29 0a 09 20 20 28 65 78 69 74 29  FAIL")..  (exit)
94d0: 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68  )).    (for-each
94e0: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 72  .     (lambda (r
94f0: 75 6e 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20  un).       (let 
9500: 28 28 72 75 6e 6b 65 79 20 28 73 74 72 69 6e 67  ((runkey (string
9510: 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61  -intersperse (ma
9520: 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 0a 09 09  p (lambda (k)...
9530: 09 09 09 09 28 64 62 3a 67 65 74 2d 76 61 6c 75  ....(db:get-valu
9540: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20  e-by-header run 
9550: 68 65 61 64 65 72 20 28 76 65 63 74 6f 72 2d 72  header (vector-r
9560: 65 66 20 6b 20 30 29 29 29 20 6b 65 79 73 29 20  ef k 0))) keys) 
9570: 22 2f 22 29 29 0a 09 20 20 20 20 20 28 64 69 72  "/"))..     (dir
9580: 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 28 6d 61 6b  s-to-remove (mak
9590: 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a  e-hash-table))).
95a0: 09 20 28 6c 65 74 2a 20 28 28 72 75 6e 2d 69 64  . (let* ((run-id
95b0: 20 20 20 20 28 64 62 3a 67 65 74 2d 76 61 6c 75      (db:get-valu
95c0: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20  e-by-header run 
95d0: 68 65 61 64 65 72 20 22 69 64 22 29 29 0a 09 09  header "id"))...
95e0: 28 72 75 6e 2d 73 74 61 74 65 20 28 64 62 3a 67  (run-state (db:g
95f0: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64  et-value-by-head
9600: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 73  er run header "s
9610: 74 61 74 65 22 29 29 0a 09 09 28 74 65 73 74 73  tate"))...(tests
9620: 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 65       (if (not (e
9630: 71 75 61 6c 3f 20 72 75 6e 2d 73 74 61 74 65 20  qual? run-state 
9640: 22 6c 6f 63 6b 65 64 22 29 29 0a 09 09 09 20 20  "locked"))....  
9650: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
9660: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74  lose db:get-test
9670: 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 72 75 6e  s-for-run db run
9680: 2d 69 64 0a 09 09 09 09 09 09 20 20 20 20 20 20  -id.......      
9690: 74 65 73 74 70 61 74 74 20 73 74 61 74 65 73 20  testpatt states 
96a0: 73 74 61 74 75 73 65 73 0a 09 09 09 09 09 09 20  statuses....... 
96b0: 20 20 20 20 20 6e 6f 74 2d 69 6e 3a 20 20 23 66       not-in:  #f
96c0: 0a 09 09 09 09 09 09 20 20 20 20 20 20 73 6f 72  .......      sor
96d0: 74 2d 62 79 3a 20 28 63 61 73 65 20 61 63 74 69  t-by: (case acti
96e0: 6f 6e 0a 09 09 09 09 09 09 09 09 20 28 28 72 65  on......... ((re
96f0: 6d 6f 76 65 2d 72 75 6e 73 29 20 27 72 75 6e 64  move-runs) 'rund
9700: 69 72 29 0a 09 09 09 09 09 09 09 09 20 28 65 6c  ir)......... (el
9710: 73 65 20 20 20 20 20 20 20 20 20 20 27 65 76 65  se          'eve
9720: 6e 74 5f 74 69 6d 65 29 29 29 0a 09 09 09 20 20  nt_time)))....  
9730: 20 20 20 20 20 27 28 29 29 29 0a 09 09 28 6c 61       '()))...(la
9740: 73 74 74 70 61 74 68 20 22 2f 64 6f 65 73 2f 6e  sttpath "/does/n
9750: 6f 74 2f 65 78 69 73 74 2f 49 2f 68 6f 70 65 22  ot/exist/I/hope"
9760: 29 29 0a 09 20 20 20 28 64 65 62 75 67 3a 70 72  ))..   (debug:pr
9770: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 72 75 6e 73  int-info 4 "runs
9780: 3a 6f 70 65 72 61 74 65 2d 6f 6e 20 72 75 6e 3d  :operate-on run=
9790: 22 20 72 75 6e 20 22 2c 20 68 65 61 64 65 72 3d  " run ", header=
97a0: 22 20 68 65 61 64 65 72 29 0a 09 20 20 20 28 69  " header)..   (i
97b0: 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 65  f (not (null? te
97c0: 73 74 73 29 29 0a 09 20 20 20 20 20 20 20 28 62  sts))..       (b
97d0: 65 67 69 6e 0a 09 09 20 28 63 61 73 65 20 61 63  egin... (case ac
97e0: 74 69 6f 6e 0a 09 09 20 20 20 28 28 72 65 6d 6f  tion...   ((remo
97f0: 76 65 2d 72 75 6e 73 29 0a 09 09 20 20 20 20 28  ve-runs)...    (
9800: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52  debug:print 1 "R
9810: 65 6d 6f 76 69 6e 67 20 74 65 73 74 73 20 66 6f  emoving tests fo
9820: 72 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20  r run: " runkey 
9830: 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75  " " (db:get-valu
9840: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20  e-by-header run 
9850: 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22  header "runname"
9860: 29 29 29 0a 09 09 20 20 20 28 28 73 65 74 2d 73  )))...   ((set-s
9870: 74 61 74 65 2d 73 74 61 74 75 73 29 0a 09 09 20  tate-status)... 
9880: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
9890: 31 20 22 4d 6f 64 69 66 79 69 6e 67 20 73 74 61  1 "Modifying sta
98a0: 74 65 20 61 6e 64 20 73 74 61 75 73 20 66 6f 72  te and staus for
98b0: 20 74 65 73 74 73 20 66 6f 72 20 72 75 6e 3a 20   tests for run: 
98c0: 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62  " runkey " " (db
98d0: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65  :get-value-by-he
98e0: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20  ader run header 
98f0: 22 72 75 6e 6e 61 6d 65 22 29 29 29 0a 09 09 20  "runname")))... 
9900: 20 20 28 28 70 72 69 6e 74 2d 72 75 6e 29 0a 09    ((print-run)..
9910: 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  .    (debug:prin
9920: 74 20 31 20 22 50 72 69 6e 74 69 6e 67 20 69 6e  t 1 "Printing in
9930: 66 6f 20 66 6f 72 20 72 75 6e 20 22 20 72 75 6e  fo for run " run
9940: 6b 65 79 20 22 2c 20 72 75 6e 3d 22 20 72 75 6e  key ", run=" run
9950: 20 22 2c 20 74 65 73 74 73 3d 22 20 74 65 73 74   ", tests=" test
9960: 73 20 22 2c 20 68 65 61 64 65 72 3d 22 20 68 65  s ", header=" he
9970: 61 64 65 72 29 0a 09 09 20 20 20 20 61 63 74 69  ader)...    acti
9980: 6f 6e 29 0a 09 09 20 20 20 28 65 6c 73 65 0a 09  on)...   (else..
9990: 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  .    (debug:prin
99a0: 74 2d 69 6e 66 6f 20 30 20 22 61 63 74 69 6f 6e  t-info 0 "action
99b0: 20 6e 6f 74 20 72 65 63 6f 67 6e 69 73 65 64 20   not recognised 
99c0: 22 20 61 63 74 69 6f 6e 29 29 29 0a 09 09 20 28  " action)))... (
99d0: 66 6f 72 2d 65 61 63 68 0a 09 09 20 20 28 6c 61  for-each...  (la
99e0: 6d 62 64 61 20 28 74 65 73 74 29 0a 09 09 20 20  mbda (test)...  
99f0: 20 20 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d 70    (let* ((item-p
9a00: 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74  ath (db:test-get
9a10: 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 29  -item-path test)
9a20: 29 0a 09 09 09 20 20 20 28 74 65 73 74 2d 6e 61  )....   (test-na
9a30: 6d 65 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  me (db:test-get-
9a40: 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29 29 0a  testname test)).
9a50: 09 09 09 20 20 20 28 72 75 6e 2d 64 69 72 20 20  ...   (run-dir  
9a60: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75   (db:test-get-ru
9a70: 6e 64 69 72 20 74 65 73 74 29 29 20 20 20 20 3b  ndir test))    ;
9a80: 3b 20 72 75 6e 20 64 69 72 20 69 73 20 66 72 6f  ; run dir is fro
9a90: 6d 20 74 68 65 20 6c 69 6e 6b 20 74 72 65 65 0a  m the link tree.
9aa0: 09 09 09 20 20 20 28 72 65 61 6c 2d 64 69 72 20  ...   (real-dir 
9ab0: 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74   (if (file-exist
9ac0: 73 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 09  s? run-dir).....
9ad0: 09 20 20 28 72 65 73 6f 6c 76 65 2d 70 61 74 68  .  (resolve-path
9ae0: 6e 61 6d 65 20 72 75 6e 2d 64 69 72 29 0a 09 09  name run-dir)...
9af0: 09 09 09 20 20 23 66 29 29 0a 09 09 09 20 20 20  ...  #f))....   
9b00: 28 74 65 73 74 2d 69 64 20 20 20 28 64 62 3a 74  (test-id   (db:t
9b10: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29  est-get-id test)
9b20: 29 29 0a 09 09 20 20 20 20 20 20 3b 3b 20 20 20  ))...      ;;   
9b30: 28 74 64 62 20 20 20 20 20 20 20 28 64 62 3a 6f  (tdb       (db:o
9b40: 70 65 6e 2d 74 65 73 74 2d 64 62 20 72 75 6e 2d  pen-test-db run-
9b50: 64 69 72 29 29 29 0a 09 09 20 20 20 20 20 20 28  dir)))...      (
9b60: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
9b70: 20 34 20 22 74 65 73 74 3d 22 20 74 65 73 74 29   4 "test=" test)
9b80: 20 3b 3b 20 20 20 22 20 28 64 62 3a 74 65 73 74   ;;   " (db:test
9b90: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65  -get-testname te
9ba0: 73 74 29 20 22 20 69 64 3a 20 22 20 28 64 62 3a  st) " id: " (db:
9bb0: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74  test-get-id test
9bc0: 29 20 22 20 22 20 69 74 65 6d 2d 70 61 74 68 20  ) " " item-path 
9bd0: 22 20 61 63 74 69 6f 6e 3a 20 22 20 61 63 74 69  " action: " acti
9be0: 6f 6e 29 0a 09 09 20 20 20 20 20 20 28 63 61 73  on)...      (cas
9bf0: 65 20 61 63 74 69 6f 6e 0a 09 09 09 28 28 72 65  e action....((re
9c00: 6d 6f 76 65 2d 72 75 6e 73 29 20 3b 3b 20 74 68  move-runs) ;; th
9c10: 65 20 74 64 62 20 69 73 20 66 6f 72 20 66 75 74  e tdb is for fut
9c20: 75 72 65 20 70 6f 73 73 69 62 6c 65 2e 20 0a 09  ure possible. ..
9c30: 09 09 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f  .. (open-run-clo
9c40: 73 65 20 64 62 3a 64 65 6c 65 74 65 2d 74 65 73  se db:delete-tes
9c50: 74 2d 72 65 63 6f 72 64 73 20 64 62 20 23 66 20  t-records db #f 
9c60: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20  (db:test-get-id 
9c70: 74 65 73 74 29 29 0a 09 09 09 20 28 64 65 62 75  test)).... (debu
9c80: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22  g:print-info 1 "
9c90: 41 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 72 65  Attempting to re
9ca0: 6d 6f 76 65 20 22 20 28 69 66 20 72 65 61 6c 2d  move " (if real-
9cb0: 64 69 72 20 28 63 6f 6e 63 20 22 20 64 69 72 20  dir (conc " dir 
9cc0: 22 20 72 65 61 6c 2d 64 69 72 20 22 20 61 6e 64  " real-dir " and
9cd0: 20 22 29 20 22 22 29 20 22 20 6c 69 6e 6b 20 22   ") "") " link "
9ce0: 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 20 28 69   run-dir).... (i
9cf0: 66 20 28 61 6e 64 20 72 65 61 6c 2d 64 69 72 20  f (and real-dir 
9d00: 0a 09 09 09 09 20 20 28 3e 20 28 73 74 72 69 6e  .....  (> (strin
9d10: 67 2d 6c 65 6e 67 74 68 20 72 65 61 6c 2d 64 69  g-length real-di
9d20: 72 29 20 35 29 0a 09 09 09 09 20 20 28 66 69 6c  r) 5).....  (fil
9d30: 65 2d 65 78 69 73 74 73 3f 20 72 65 61 6c 2d 64  e-exists? real-d
9d40: 69 72 29 29 20 3b 3b 20 62 61 64 20 68 65 75 72  ir)) ;; bad heur
9d50: 69 73 74 69 63 20 62 75 74 20 73 68 6f 75 6c 64  istic but should
9d60: 20 70 72 65 76 65 6e 74 20 2f 74 6d 70 20 2f 68   prevent /tmp /h
9d70: 6f 6d 65 20 65 74 63 2e 0a 09 09 09 20 20 20 20  ome etc.....    
9d80: 20 28 62 65 67 69 6e 20 3b 3b 20 6c 65 74 2a 20   (begin ;; let* 
9d90: 28 28 72 65 61 6c 70 61 74 68 20 28 72 65 73 6f  ((realpath (reso
9da0: 6c 76 65 2d 70 61 74 68 6e 61 6d 65 20 72 75 6e  lve-pathname run
9db0: 2d 64 69 72 29 29 29 0a 09 09 09 20 20 20 20 20  -dir)))....     
9dc0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69    (debug:print-i
9dd0: 6e 66 6f 20 31 20 22 52 65 63 75 72 73 69 76 65  nfo 1 "Recursive
9de0: 6c 79 20 72 65 6d 6f 76 69 6e 67 20 22 20 72 65  ly removing " re
9df0: 61 6c 2d 64 69 72 29 0a 09 09 09 20 20 20 20 20  al-dir)....     
9e00: 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73    (if (file-exis
9e10: 74 73 3f 20 72 65 61 6c 2d 64 69 72 29 0a 09 09  ts? real-dir)...
9e20: 09 09 20 20 20 28 69 66 20 28 3e 20 28 73 79 73  ..   (if (> (sys
9e30: 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 20 2d 72  tem (conc "rm -r
9e40: 66 20 22 20 72 65 61 6c 2d 64 69 72 29 29 20 30  f " real-dir)) 0
9e50: 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 64 65  ).....       (de
9e60: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52  bug:print 0 "ERR
9e70: 4f 52 3a 20 54 68 65 72 65 20 77 61 73 20 61 20  OR: There was a 
9e80: 70 72 6f 62 6c 65 6d 20 72 65 6d 6f 76 69 6e 67  problem removing
9e90: 20 22 20 72 65 61 6c 2d 64 69 72 20 22 20 77 69   " real-dir " wi
9ea0: 74 68 20 72 6d 20 2d 66 22 29 29 0a 09 09 09 09  th rm -f")).....
9eb0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
9ec0: 30 20 22 57 41 52 4e 49 4e 47 3a 20 74 65 73 74  0 "WARNING: test
9ed0: 20 64 69 72 20 22 20 72 65 61 6c 2d 64 69 72 20   dir " real-dir 
9ee0: 22 20 61 70 70 65 61 72 73 20 74 6f 20 6e 6f 74  " appears to not
9ef0: 20 65 78 69 73 74 20 6f 72 20 69 73 20 6e 6f 74   exist or is not
9f00: 20 72 65 61 64 61 62 6c 65 22 29 29 29 0a 09 09   readable")))...
9f10: 09 20 20 20 20 20 28 69 66 20 72 65 61 6c 2d 64  .     (if real-d
9f20: 69 72 20 0a 09 09 09 09 20 28 64 65 62 75 67 3a  ir ..... (debug:
9f30: 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47  print 0 "WARNING
9f40: 3a 20 64 69 72 65 63 74 6f 72 79 20 22 20 72 65  : directory " re
9f50: 61 6c 2d 64 69 72 20 22 20 64 6f 65 73 20 6e 6f  al-dir " does no
9f60: 74 20 65 78 69 73 74 22 29 0a 09 09 09 09 20 28  t exist")..... (
9f70: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57  debug:print 0 "W
9f80: 41 52 4e 49 4e 47 3a 20 6e 6f 20 72 65 61 6c 20  ARNING: no real 
9f90: 64 69 72 65 63 74 6f 72 79 20 63 6f 72 72 6f 73  directory corros
9fa0: 70 6f 6e 64 69 6e 67 20 74 6f 20 6c 69 6e 6b 20  ponding to link 
9fb0: 22 20 72 75 6e 2d 64 69 72 20 22 2c 20 6e 6f 74  " run-dir ", not
9fc0: 68 69 6e 67 20 64 6f 6e 65 22 29 29 29 0a 09 09  hing done")))...
9fd0: 09 20 28 69 66 20 28 73 79 6d 62 6f 6c 69 63 2d  . (if (symbolic-
9fe0: 6c 69 6e 6b 3f 20 72 75 6e 2d 64 69 72 29 0a 09  link? run-dir)..
9ff0: 09 09 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09  ..     (begin...
a000: 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70  .       (debug:p
a010: 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 52 65 6d  rint-info 1 "Rem
a020: 6f 76 69 6e 67 20 73 79 6d 6c 69 6e 6b 20 22 20  oving symlink " 
a030: 72 75 6e 2d 64 69 72 29 0a 09 09 09 20 20 20 20  run-dir)....    
a040: 20 20 20 28 68 61 6e 64 6c 65 2d 65 78 63 65 70     (handle-excep
a050: 74 69 6f 6e 73 0a 09 09 09 09 65 78 6e 0a 09 09  tions.....exn...
a060: 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30  ..(debug:print 0
a070: 20 22 45 52 52 4f 52 3a 20 20 46 61 69 6c 65 64   "ERROR:  Failed
a080: 20 74 6f 20 72 65 6d 6f 76 65 20 73 79 6d 6c 69   to remove symli
a090: 6e 6b 20 22 20 72 75 6e 2d 64 69 72 20 28 28 63  nk " run-dir ((c
a0a0: 6f 6e 64 69 74 69 6f 6e 2d 70 72 6f 70 65 72 74  ondition-propert
a0b0: 79 2d 61 63 63 65 73 73 6f 72 20 27 65 78 6e 20  y-accessor 'exn 
a0c0: 27 6d 65 73 73 61 67 65 29 20 65 78 6e 29 20 22  'message) exn) "
a0d0: 2c 20 61 74 74 65 6d 70 74 69 6e 67 20 74 6f 20  , attempting to 
a0e0: 63 6f 6e 74 69 6e 75 65 22 29 0a 09 09 09 09 28  continue").....(
a0f0: 64 65 6c 65 74 65 2d 66 69 6c 65 20 72 75 6e 2d  delete-file run-
a100: 64 69 72 29 29 29 0a 09 09 09 20 20 20 20 20 28  dir)))....     (
a110: 69 66 20 28 64 69 72 65 63 74 6f 72 79 3f 20 72  if (directory? r
a120: 75 6e 2d 64 69 72 29 0a 09 09 09 09 20 28 69 66  un-dir)..... (if
a130: 20 28 3e 20 28 64 69 72 65 63 74 6f 72 79 2d 66   (> (directory-f
a140: 6f 6c 64 20 28 6c 61 6d 62 64 61 20 28 66 20 78  old (lambda (f x
a150: 29 28 2b 20 31 20 78 29 29 20 30 20 72 75 6e 2d  )(+ 1 x)) 0 run-
a160: 64 69 72 29 20 30 29 0a 09 09 09 09 20 20 20 20  dir) 0).....    
a170: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
a180: 22 57 41 52 4e 49 4e 47 3a 20 72 65 66 75 73 69  "WARNING: refusi
a190: 6e 67 20 74 6f 20 72 65 6d 6f 76 65 20 22 20 72  ng to remove " r
a1a0: 75 6e 2d 64 69 72 20 22 20 61 73 20 69 74 20 69  un-dir " as it i
a1b0: 73 20 6e 6f 74 20 65 6d 70 74 79 22 29 0a 09 09  s not empty")...
a1c0: 09 09 20 20 20 20 20 20 28 68 61 6e 64 6c 65 2d  ..      (handle-
a1d0: 65 78 63 65 70 74 69 6f 6e 73 0a 09 09 09 09 20  exceptions..... 
a1e0: 20 20 20 20 20 20 65 78 6e 0a 09 09 09 09 20 20        exn.....  
a1f0: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
a200: 74 20 30 20 22 45 52 52 4f 52 3a 20 20 46 61 69  t 0 "ERROR:  Fai
a210: 6c 65 64 20 74 6f 20 72 65 6d 6f 76 65 20 64 69  led to remove di
a220: 72 65 63 74 6f 72 79 20 22 20 72 75 6e 2d 64 69  rectory " run-di
a230: 72 20 28 28 63 6f 6e 64 69 74 69 6f 6e 2d 70 72  r ((condition-pr
a240: 6f 70 65 72 74 79 2d 61 63 63 65 73 73 6f 72 20  operty-accessor 
a250: 27 65 78 6e 20 27 6d 65 73 73 61 67 65 29 20 65  'exn 'message) e
a260: 78 6e 29 20 22 2c 20 61 74 74 65 6d 70 74 69 6e  xn) ", attemptin
a270: 67 20 74 6f 20 63 6f 6e 74 69 6e 75 65 22 29 0a  g to continue").
a280: 09 09 09 09 20 20 20 20 20 20 20 28 64 65 6c 65  ....       (dele
a290: 74 65 2d 64 69 72 65 63 74 6f 72 79 20 72 75 6e  te-directory run
a2a0: 2d 64 69 72 29 29 29 0a 09 09 09 09 20 28 69 66  -dir)))..... (if
a2b0: 20 72 75 6e 2d 64 69 72 0a 09 09 09 09 20 20 20   run-dir.....   
a2c0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
a2d0: 20 22 57 41 52 4e 49 4e 47 3a 20 6e 6f 74 20 72   "WARNING: not r
a2e0: 65 6d 6f 76 69 6e 67 20 22 20 72 75 6e 2d 64 69  emoving " run-di
a2f0: 72 20 22 20 61 73 20 69 74 20 65 69 74 68 65 72  r " as it either
a300: 20 64 6f 65 73 6e 27 74 20 65 78 69 73 74 20 6f   doesn't exist o
a310: 72 20 69 73 20 6e 6f 74 20 61 20 73 79 6d 6c 69  r is not a symli
a320: 6e 6b 22 29 0a 09 09 09 09 20 20 20 20 20 28 64  nk").....     (d
a330: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 4e 4f  ebug:print 0 "NO
a340: 54 45 3a 20 74 68 65 20 72 75 6e 20 64 69 72 20  TE: the run dir 
a350: 66 6f 72 20 74 68 69 73 20 74 65 73 74 20 69 73  for this test is
a360: 20 75 6e 64 65 66 69 6e 65 64 2e 20 54 65 73 74   undefined. Test
a370: 20 6d 61 79 20 68 61 76 65 20 61 6c 72 65 61 64   may have alread
a380: 79 20 62 65 65 6e 20 64 65 6c 65 74 65 64 2e 22  y been deleted."
a390: 29 29 0a 09 09 09 09 20 29 29 29 0a 09 09 09 28  ))..... )))....(
a3a0: 28 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75  (set-state-statu
a3b0: 73 29 0a 09 09 09 20 28 64 65 62 75 67 3a 70 72  s).... (debug:pr
a3c0: 69 6e 74 2d 69 6e 66 6f 20 32 20 22 6e 65 77 20  int-info 2 "new 
a3d0: 73 74 61 74 65 20 22 20 28 63 61 72 20 73 74 61  state " (car sta
a3e0: 74 65 2d 73 74 61 74 75 73 29 20 22 2c 20 6e 65  te-status) ", ne
a3f0: 77 20 73 74 61 74 75 73 20 22 20 28 63 61 64 72  w status " (cadr
a400: 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 29 0a   state-status)).
a410: 09 09 09 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c  ... (open-run-cl
a420: 6f 73 65 20 64 62 3a 74 65 73 74 2d 73 65 74 2d  ose db:test-set-
a430: 73 74 61 74 65 2d 73 74 61 74 75 73 2d 62 79 2d  state-status-by-
a440: 69 64 20 64 62 20 28 64 62 3a 74 65 73 74 2d 67  id db (db:test-g
a450: 65 74 2d 69 64 20 74 65 73 74 29 20 28 63 61 72  et-id test) (car
a460: 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 28 63   state-status)(c
a470: 61 64 72 20 73 74 61 74 65 2d 73 74 61 74 75 73  adr state-status
a480: 29 20 23 66 29 29 29 29 29 0a 09 09 20 20 28 73  ) #f)))))...  (s
a490: 6f 72 74 20 74 65 73 74 73 20 28 6c 61 6d 62 64  ort tests (lambd
a4a0: 61 20 28 61 20 62 29 28 6c 65 74 20 28 28 64 69  a (a b)(let ((di
a4b0: 72 61 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  ra (db:test-get-
a4c0: 72 75 6e 64 69 72 20 61 29 29 0a 09 09 09 09 09  rundir a))......
a4d0: 09 20 28 64 69 72 62 20 28 64 62 3a 74 65 73 74  . (dirb (db:test
a4e0: 2d 67 65 74 2d 72 75 6e 64 69 72 20 62 29 29 29  -get-rundir b)))
a4f0: 0a 09 09 09 09 09 20 20 20 20 20 28 69 66 20 28  ......     (if (
a500: 61 6e 64 20 28 73 74 72 69 6e 67 3f 20 64 69 72  and (string? dir
a510: 61 29 28 73 74 72 69 6e 67 3f 20 64 69 72 62 29  a)(string? dirb)
a520: 29 0a 09 09 09 09 09 09 20 28 3e 20 28 73 74 72  )....... (> (str
a530: 69 6e 67 2d 6c 65 6e 67 74 68 20 64 69 72 61 29  ing-length dira)
a540: 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 64  (string-length d
a550: 69 72 62 29 29 0a 09 09 09 09 09 09 20 23 66 29  irb))....... #f)
a560: 29 29 29 29 29 29 0a 09 20 20 20 3b 3b 20 72 65  ))))))..   ;; re
a570: 6d 6f 76 65 20 74 68 65 20 72 75 6e 20 69 66 20  move the run if 
a580: 7a 65 72 6f 20 74 65 73 74 73 20 72 65 6d 61 69  zero tests remai
a590: 6e 0a 09 20 20 20 28 69 66 20 28 65 71 3f 20 61  n..   (if (eq? a
a5a0: 63 74 69 6f 6e 20 27 72 65 6d 6f 76 65 2d 72 75  ction 'remove-ru
a5b0: 6e 73 29 0a 09 20 20 20 20 20 20 20 28 6c 65 74  ns)..       (let
a5c0: 20 28 28 72 65 6d 74 65 73 74 73 20 28 6f 70 65   ((remtests (ope
a5d0: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67  n-run-close db:g
a5e0: 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e  et-tests-for-run
a5f0: 20 64 62 20 28 64 62 3a 67 65 74 2d 76 61 6c 75   db (db:get-valu
a600: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20  e-by-header run 
a610: 68 65 61 64 65 72 20 22 69 64 22 29 20 23 66 20  header "id") #f 
a620: 27 28 22 44 45 4c 45 54 45 44 22 29 20 27 28 22  '("DELETED") '("
a630: 6e 2f 61 22 29 20 6e 6f 74 2d 69 6e 3a 20 23 74  n/a") not-in: #t
a640: 29 29 29 0a 09 09 20 28 69 66 20 28 6e 75 6c 6c  )))... (if (null
a650: 3f 20 72 65 6d 74 65 73 74 73 29 20 3b 3b 20 6e  ? remtests) ;; n
a660: 6f 20 6d 6f 72 65 20 74 65 73 74 73 20 72 65 6d  o more tests rem
a670: 61 69 6e 69 6e 67 0a 09 09 20 20 20 20 20 28 6c  aining...     (l
a680: 65 74 2a 20 28 28 64 70 61 72 74 73 20 20 28 73  et* ((dparts  (s
a690: 74 72 69 6e 67 2d 73 70 6c 69 74 20 6c 61 73 74  tring-split last
a6a0: 74 70 61 74 68 20 22 2f 22 29 29 0a 09 09 09 20  tpath "/")).... 
a6b0: 20 20 20 28 72 75 6e 70 61 74 68 20 28 63 6f 6e     (runpath (con
a6c0: 63 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e  c "/" (string-in
a6d0: 74 65 72 73 70 65 72 73 65 20 0a 09 09 09 09 09  tersperse ......
a6e0: 09 28 74 61 6b 65 20 64 70 61 72 74 73 20 28 2d  .(take dparts (-
a6f0: 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73 29   (length dparts)
a700: 20 31 29 29 0a 09 09 09 09 09 09 22 2f 22 29 29   1))......."/"))
a710: 29 29 0a 09 09 20 20 20 20 20 20 20 28 64 65 62  ))...       (deb
a720: 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f  ug:print 1 "Remo
a730: 76 69 6e 67 20 72 75 6e 3a 20 22 20 72 75 6e 6b  ving run: " runk
a740: 65 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76  ey " " (db:get-v
a750: 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72  alue-by-header r
a760: 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61  un header "runna
a770: 6d 65 22 29 20 22 20 61 6e 64 20 72 65 6c 61 74  me") " and relat
a780: 65 64 20 72 65 63 6f 72 64 22 29 0a 09 09 20 20  ed record")...  
a790: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
a7a0: 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 2d 72  lose db:delete-r
a7b0: 75 6e 20 64 62 20 72 75 6e 2d 69 64 29 0a 09 09  un db run-id)...
a7c0: 20 20 20 20 20 20 20 3b 3b 20 54 68 69 73 20 69         ;; This i
a7d0: 73 20 61 20 70 72 65 74 74 79 20 67 6f 6f 64 20  s a pretty good 
a7e0: 70 6c 61 63 65 20 74 6f 20 70 75 72 67 65 20 6f  place to purge o
a7f0: 6c 64 20 44 45 4c 45 54 45 44 20 74 65 73 74 73  ld DELETED tests
a800: 0a 09 09 20 20 20 20 20 20 20 28 6f 70 65 6e 2d  ...       (open-
a810: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c  run-close db:del
a820: 65 74 65 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75  ete-tests-for-ru
a830: 6e 20 64 62 20 72 75 6e 2d 69 64 29 0a 09 09 20  n db run-id)... 
a840: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d        (open-run-
a850: 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 2d  close db:delete-
a860: 6f 6c 64 2d 64 65 6c 65 74 65 64 2d 74 65 73 74  old-deleted-test
a870: 2d 72 65 63 6f 72 64 73 20 64 62 29 0a 09 09 20  -records db)... 
a880: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d        (open-run-
a890: 63 6c 6f 73 65 20 64 62 3a 73 65 74 2d 76 61 72  close db:set-var
a8a0: 20 64 62 20 22 44 45 4c 45 54 45 44 5f 54 45 53   db "DELETED_TES
a8b0: 54 53 22 20 28 63 75 72 72 65 6e 74 2d 73 65 63  TS" (current-sec
a8c0: 6f 6e 64 73 29 29 0a 09 09 20 20 20 20 20 20 20  onds))...       
a8d0: 3b 3b 20 6e 65 65 64 20 74 6f 20 66 69 67 75 72  ;; need to figur
a8e0: 65 20 6f 75 74 20 74 68 65 20 70 61 74 68 20 74  e out the path t
a8f0: 6f 20 74 68 65 20 72 75 6e 20 64 69 72 20 61 6e  o the run dir an
a900: 64 20 72 65 6d 6f 76 65 20 69 74 20 69 66 20 65  d remove it if e
a910: 6d 70 74 79 0a 09 09 20 20 20 20 20 20 20 3b 3b  mpty...       ;;
a920: 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 28      (if (null? (
a930: 67 6c 6f 62 20 28 63 6f 6e 63 20 72 75 6e 70 61  glob (conc runpa
a940: 74 68 20 22 2f 2a 22 29 29 29 0a 09 09 20 20 20  th "/*")))...   
a950: 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20 28 62      ;;        (b
a960: 65 67 69 6e 0a 09 09 20 20 20 20 20 20 20 3b 3b  egin...       ;;
a970: 20 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20   . (debug:print 
a980: 31 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 20  1 "Removing run 
a990: 64 69 72 20 22 20 72 75 6e 70 61 74 68 29 0a 09  dir " runpath)..
a9a0: 09 20 20 20 20 20 20 20 3b 3b 20 09 20 28 73 79  .       ;; . (sy
a9b0: 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 64 69  stem (conc "rmdi
a9c0: 72 20 2d 70 20 22 20 72 75 6e 70 61 74 68 29 29  r -p " runpath))
a9d0: 29 29 0a 09 09 20 20 20 20 20 20 20 29 29 29 29  ))...       ))))
a9e0: 29 0a 09 20 29 29 0a 20 20 20 20 20 72 75 6e 73  ).. )).     runs
a9f0: 29 29 0a 20 20 23 74 29 0a 0a 3b 3b 3d 3d 3d 3d  )).  #t)..;;====
aa00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
aa10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
aa20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
aa30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
aa40: 3d 3d 0a 3b 3b 20 52 6f 75 74 69 6e 65 73 20 66  ==.;; Routines f
aa50: 6f 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20  or manipulating 
aa60: 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d  runs.;;=========
aa70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
aa80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
aa90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
aaa0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b  =============..;
aab0: 3b 20 53 69 6e 63 65 20 6d 61 6e 79 20 63 61 6c  ; Since many cal
aac0: 6c 73 20 74 6f 20 61 20 72 75 6e 20 72 65 71 75  ls to a run requ
aad0: 69 72 65 20 70 72 65 74 74 79 20 6d 75 63 68 20  ire pretty much 
aae0: 74 68 65 20 73 61 6d 65 20 73 65 74 75 70 20 0a  the same setup .
aaf0: 3b 3b 20 74 68 69 73 20 77 72 61 70 70 65 72 20  ;; this wrapper 
ab00: 69 73 20 75 73 65 64 20 74 6f 20 72 65 64 75 63  is used to reduc
ab10: 65 20 74 68 65 20 72 65 70 6c 69 63 61 74 69 6f  e the replicatio
ab20: 6e 20 6f 66 20 63 6f 64 65 0a 28 64 65 66 69 6e  n of code.(defin
ab30: 65 20 28 67 65 6e 65 72 61 6c 2d 72 75 6e 2d 63  e (general-run-c
ab40: 61 6c 6c 20 73 77 69 74 63 68 6e 61 6d 65 20 61  all switchname a
ab50: 63 74 69 6f 6e 2d 64 65 73 63 20 70 72 6f 63 29  ction-desc proc)
ab60: 0a 20 20 28 6c 65 74 20 28 28 72 75 6e 6e 61 6d  .  (let ((runnam
ab70: 65 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20  e (args:get-arg 
ab80: 22 3a 72 75 6e 6e 61 6d 65 22 29 29 0a 09 28 74  ":runname"))..(t
ab90: 61 72 67 65 74 20 20 28 69 66 20 28 61 72 67 73  arget  (if (args
aba0: 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65  :get-arg "-targe
abb0: 74 22 29 0a 09 09 20 20 20 20 20 28 61 72 67 73  t")...     (args
abc0: 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65  :get-arg "-targe
abd0: 74 22 29 0a 09 09 20 20 20 20 20 28 61 72 67 73  t")...     (args
abe0: 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61  :get-arg "-reqta
abf0: 72 67 22 29 29 29 0a 09 28 74 68 31 20 20 20 20  rg")))..(th1    
ac00: 20 23 66 29 29 0a 20 20 20 20 28 63 6f 6e 64 0a   #f)).    (cond.
ac10: 20 20 20 20 20 28 28 6e 6f 74 20 74 61 72 67 65       ((not targe
ac20: 74 29 0a 20 20 20 20 20 20 28 64 65 62 75 67 3a  t).      (debug:
ac30: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
ac40: 4d 69 73 73 69 6e 67 20 72 65 71 75 69 72 65 64  Missing required
ac50: 20 70 61 72 61 6d 65 74 65 72 20 66 6f 72 20 22   parameter for "
ac60: 20 73 77 69 74 63 68 6e 61 6d 65 20 22 2c 20 79   switchname ", y
ac70: 6f 75 20 6d 75 73 74 20 73 70 65 63 69 66 79 20  ou must specify 
ac80: 74 68 65 20 74 61 72 67 65 74 20 77 69 74 68 20  the target with 
ac90: 2d 74 61 72 67 65 74 22 29 0a 20 20 20 20 20 20  -target").      
aca0: 28 65 78 69 74 20 33 29 29 0a 20 20 20 20 20 28  (exit 3)).     (
acb0: 28 6e 6f 74 20 72 75 6e 6e 61 6d 65 29 0a 20 20  (not runname).  
acc0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
acd0: 20 30 20 22 45 52 52 4f 52 3a 20 4d 69 73 73 69   0 "ERROR: Missi
ace0: 6e 67 20 72 65 71 75 69 72 65 64 20 70 61 72 61  ng required para
acf0: 6d 65 74 65 72 20 66 6f 72 20 22 20 73 77 69 74  meter for " swit
ad00: 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d 75  chname ", you mu
ad10: 73 74 20 73 70 65 63 69 66 79 20 74 68 65 20 72  st specify the r
ad20: 75 6e 20 6e 61 6d 65 20 77 69 74 68 20 3a 72 75  un name with :ru
ad30: 6e 6e 61 6d 65 20 72 75 6e 6e 61 6d 65 22 29 0a  nname runname").
ad40: 20 20 20 20 20 20 28 65 78 69 74 20 33 29 29 0a        (exit 3)).
ad50: 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20 20       (else.     
ad60: 20 28 6c 65 74 20 28 28 64 62 20 20 20 23 66 29   (let ((db   #f)
ad70: 0a 09 20 20 20 20 28 6b 65 79 73 20 23 66 29 29  ..    (keys #f))
ad80: 0a 09 28 69 66 20 28 6e 6f 74 20 28 73 65 74 75  ..(if (not (setu
ad90: 70 2d 66 6f 72 2d 72 75 6e 29 29 0a 09 20 20 20  p-for-run))..   
ada0: 20 28 62 65 67 69 6e 20 0a 09 20 20 20 20 20 20   (begin ..      
adb0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
adc0: 46 61 69 6c 65 64 20 74 6f 20 73 65 74 75 70 2c  Failed to setup,
add0: 20 65 78 69 74 69 6e 67 22 29 0a 09 20 20 20 20   exiting")..    
ade0: 20 20 28 65 78 69 74 20 31 29 29 29 0a 09 28 69    (exit 1)))..(i
adf0: 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20  f (args:get-arg 
ae00: 22 2d 73 65 72 76 65 72 22 29 0a 09 20 20 20 20  "-server")..    
ae10: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
ae20: 73 65 72 76 65 72 3a 73 74 61 72 74 20 64 62 20  server:start db 
ae30: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
ae40: 73 65 72 76 65 72 22 29 29 29 0a 20 09 20 20 20  server"))). .   
ae50: 20 3b 3b 20 28 69 66 20 28 6e 6f 74 20 28 6f 72   ;; (if (not (or
ae60: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
ae70: 2d 72 75 6e 61 6c 6c 22 29 20 20 20 20 20 3b 3b  -runall")     ;;
ae80: 20 72 75 6e 61 6c 6c 20 61 6e 64 20 72 75 6e 74   runall and runt
ae90: 65 73 74 73 20 61 72 65 20 61 6c 6c 6f 77 65 64  ests are allowed
aea0: 20 74 6f 20 62 65 20 73 65 72 76 65 72 73 0a 20   to be servers. 
aeb0: 09 20 20 20 20 3b 3b 20 20 20 20 20 09 20 28 61  .    ;;     . (a
aec0: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 75  rgs:get-arg "-ru
aed0: 6e 74 65 73 74 73 22 29 29 29 0a 09 20 20 20 20  ntests")))..    
aee0: 3b 3b 20 20 20 20 20 28 63 6c 69 65 6e 74 3a 73  ;;     (client:s
aef0: 65 74 75 70 29 20 3b 3b 20 54 68 69 73 20 69 73  etup) ;; This is
af00: 20 61 20 64 75 70 6c 69 63 61 74 65 20 73 74 61   a duplicate sta
af10: 72 74 75 70 21 21 21 3f 3f 3f 20 42 55 47 3f 0a  rtup!!!??? BUG?.
af20: 09 20 20 20 20 3b 3b 20 20 20 20 20 29 29 0a 09  .    ;;     ))..
af30: 28 73 65 74 21 20 6b 65 79 73 20 28 6f 70 65 6e  (set! keys (open
af40: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65  -run-close db:ge
af50: 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 3b 3b 20  t-keys db))..;; 
af60: 68 61 76 65 20 65 6e 6f 75 67 68 20 74 6f 20 70  have enough to p
af70: 72 6f 63 65 73 73 20 2d 74 61 72 67 65 74 20 6f  rocess -target o
af80: 72 20 2d 72 65 71 74 61 72 67 20 68 65 72 65 0a  r -reqtarg here.
af90: 09 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61  .(if (args:get-a
afa0: 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 0a 09  rg "-reqtarg")..
afb0: 20 20 20 20 28 6c 65 74 2a 20 28 28 72 75 6e 63      (let* ((runc
afc0: 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 20 2a 74  onfigf (conc  *t
afd0: 6f 70 70 61 74 68 2a 20 22 2f 72 75 6e 63 6f 6e  oppath* "/runcon
afe0: 66 69 67 73 2e 63 6f 6e 66 69 67 22 29 29 20 3b  figs.config")) ;
aff0: 3b 20 44 4f 20 4e 4f 54 20 45 56 41 4c 55 41 54  ; DO NOT EVALUAT
b000: 45 20 41 4c 4c 20 0a 09 09 20 20 20 28 72 75 6e  E ALL ...   (run
b010: 63 6f 6e 66 69 67 20 20 28 72 65 61 64 2d 63 6f  config  (read-co
b020: 6e 66 69 67 20 72 75 6e 63 6f 6e 66 69 67 66 20  nfig runconfigf 
b030: 23 66 20 23 74 20 65 6e 76 69 72 6f 6e 2d 70 61  #f #t environ-pa
b040: 74 74 3a 20 23 66 29 29 29 20 0a 09 20 20 20 20  tt: #f))) ..    
b050: 20 20 28 69 66 20 28 68 61 73 68 2d 74 61 62 6c    (if (hash-tabl
b060: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 72 75  e-ref/default ru
b070: 6e 63 6f 6e 66 69 67 20 28 61 72 67 73 3a 67 65  nconfig (args:ge
b080: 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22  t-arg "-reqtarg"
b090: 29 20 23 66 29 0a 09 09 20 20 28 6b 65 79 73 3a  ) #f)...  (keys:
b0a0: 74 61 72 67 65 74 2d 73 65 74 2d 61 72 67 73 20  target-set-args 
b0b0: 6b 65 79 73 20 28 61 72 67 73 3a 67 65 74 2d 61  keys (args:get-a
b0c0: 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 20 61  rg "-reqtarg") a
b0d0: 72 67 73 3a 61 72 67 2d 68 61 73 68 29 0a 09 09  rgs:arg-hash)...
b0e0: 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 28    (begin...    (
b0f0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45  debug:print 0 "E
b100: 52 52 4f 52 3a 20 5b 22 20 28 61 72 67 73 3a 67  RROR: [" (args:g
b110: 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67  et-arg "-reqtarg
b120: 22 29 20 22 5d 20 6e 6f 74 20 66 6f 75 6e 64 20  ") "] not found 
b130: 69 6e 20 22 20 72 75 6e 63 6f 6e 66 69 67 66 29  in " runconfigf)
b140: 0a 09 09 20 20 20 20 28 69 66 20 64 62 20 28 73  ...    (if db (s
b150: 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21  qlite3:finalize!
b160: 20 64 62 29 29 0a 09 09 20 20 20 20 28 65 78 69   db))...    (exi
b170: 74 20 31 29 29 29 29 0a 09 20 20 20 20 28 69 66  t 1))))..    (if
b180: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
b190: 2d 74 61 72 67 65 74 22 29 0a 09 09 28 6b 65 79  -target")...(key
b1a0: 73 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 72 67  s:target-set-arg
b1b0: 73 20 6b 65 79 73 20 28 61 72 67 73 3a 67 65 74  s keys (args:get
b1c0: 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 20 61  -arg "-target" a
b1d0: 72 67 73 3a 61 72 67 2d 68 61 73 68 29 20 61 72  rgs:arg-hash) ar
b1e0: 67 73 3a 61 72 67 2d 68 61 73 68 29 29 29 0a 09  gs:arg-hash)))..
b1f0: 28 69 66 20 28 6e 6f 74 20 28 63 61 72 20 2a 63  (if (not (car *c
b200: 6f 6e 66 69 67 69 6e 66 6f 2a 29 29 0a 09 20 20  onfiginfo*))..  
b210: 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20    (begin..      
b220: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
b230: 45 52 52 4f 52 3a 20 41 74 74 65 6d 70 74 65 64  ERROR: Attempted
b240: 20 74 6f 20 22 20 61 63 74 69 6f 6e 2d 64 65 73   to " action-des
b250: 63 20 22 20 62 75 74 20 72 75 6e 20 61 72 65 61  c " but run area
b260: 20 63 6f 6e 66 69 67 20 66 69 6c 65 20 6e 6f 74   config file not
b270: 20 66 6f 75 6e 64 22 29 0a 09 20 20 20 20 20 20   found")..      
b280: 28 65 78 69 74 20 31 29 29 0a 09 20 20 20 20 3b  (exit 1))..    ;
b290: 3b 20 45 78 74 72 61 63 74 20 6f 75 74 20 73 74  ; Extract out st
b2a0: 75 66 66 20 6e 65 65 64 65 64 20 69 6e 20 6d 6f  uff needed in mo
b2b0: 73 74 20 6f 72 20 6d 61 6e 79 20 63 61 6c 6c 73  st or many calls
b2c0: 0a 09 20 20 20 20 3b 3b 20 68 65 72 65 20 74 68  ..    ;; here th
b2d0: 65 6e 20 63 61 6c 6c 20 70 72 6f 63 0a 09 20 20  en call proc..  
b2e0: 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 6e 61 6d    (let* ((keynam
b2f0: 65 73 20 20 20 28 6d 61 70 20 6b 65 79 3a 67 65  es   (map key:ge
b300: 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79 73  t-fieldname keys
b310: 29 29 0a 09 09 20 20 20 28 6b 65 79 76 61 6c 6c  ))...   (keyvall
b320: 73 74 20 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69  st  (keys->valli
b330: 73 74 20 6b 65 79 73 20 23 74 29 29 29 0a 09 20  st keys #t))).. 
b340: 20 20 20 20 20 28 70 72 6f 63 20 74 61 72 67 65       (proc targe
b350: 74 20 72 75 6e 6e 61 6d 65 20 6b 65 79 73 20 6b  t runname keys k
b360: 65 79 6e 61 6d 65 73 20 6b 65 79 76 61 6c 6c 73  eynames keyvalls
b370: 74 29 29 29 0a 09 28 69 66 20 74 68 31 20 28 74  t)))..(if th1 (t
b380: 68 72 65 61 64 2d 6a 6f 69 6e 21 20 74 68 31 29  hread-join! th1)
b390: 29 0a 09 28 69 66 20 64 62 20 28 73 71 6c 69 74  )..(if db (sqlit
b3a0: 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 29  e3:finalize! db)
b3b0: 29 0a 09 28 73 65 74 21 20 2a 64 69 64 73 6f 6d  )..(set! *didsom
b3c0: 65 74 68 69 6e 67 2a 20 23 74 29 29 29 29 29 29  ething* #t))))))
b3d0: 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ..;;============
b3e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b3f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b400: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b410: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4c 6f  ==========.;; Lo
b420: 63 6b 2f 75 6e 6c 6f 63 6b 20 72 75 6e 73 0a 3b  ck/unlock runs.;
b430: 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;===============
b440: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b450: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b460: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b470: 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65  =======..(define
b480: 20 28 72 75 6e 73 3a 68 61 6e 64 6c 65 2d 6c 6f   (runs:handle-lo
b490: 63 6b 69 6e 67 20 74 61 72 67 65 74 20 6b 65 79  cking target key
b4a0: 73 20 72 75 6e 6e 61 6d 65 20 6c 6f 63 6b 20 75  s runname lock u
b4b0: 6e 6c 6f 63 6b 20 75 73 65 72 29 0a 20 20 28 6c  nlock user).  (l
b4c0: 65 74 2a 20 28 28 64 62 20 20 20 20 20 20 20 23  et* ((db       #
b4d0: 66 29 0a 09 20 28 72 75 6e 64 61 74 20 20 20 28  f).. (rundat   (
b4e0: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72  open-run-close r
b4f0: 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d  uns:get-runs-by-
b500: 70 61 74 74 20 64 62 20 6b 65 79 73 20 72 75 6e  patt db keys run
b510: 6e 61 6d 65 29 29 0a 09 20 28 68 65 61 64 65 72  name)).. (header
b520: 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72     (vector-ref r
b530: 75 6e 64 61 74 20 30 29 29 0a 09 20 28 72 75 6e  undat 0)).. (run
b540: 73 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65  s     (vector-re
b550: 66 20 72 75 6e 64 61 74 20 31 29 29 29 0a 20 20  f rundat 1))).  
b560: 20 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d    (for-each (lam
b570: 62 64 61 20 28 72 75 6e 29 0a 09 09 28 6c 65 74  bda (run)...(let
b580: 20 28 28 72 75 6e 2d 69 64 20 28 64 62 3a 67 65   ((run-id (db:ge
b590: 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65  t-value-by-heade
b5a0: 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 64  r run header "id
b5b0: 22 29 29 29 0a 09 09 20 20 28 69 66 20 28 6f 72  ")))...  (if (or
b5c0: 20 6c 6f 63 6b 0a 09 09 09 20 20 28 61 6e 64 20   lock....  (and 
b5d0: 75 6e 6c 6f 63 6b 0a 09 09 09 20 20 20 20 20 20  unlock....      
b5e0: 20 28 62 65 67 69 6e 0a 09 09 09 09 20 28 70 72   (begin..... (pr
b5f0: 69 6e 74 20 22 44 6f 20 79 6f 75 20 72 65 61 6c  int "Do you real
b600: 6c 79 20 77 69 73 68 20 74 6f 20 75 6e 6c 6f 63  ly wish to unloc
b610: 6b 20 72 75 6e 20 22 20 72 75 6e 2d 69 64 20 22  k run " run-id "
b620: 3f 5c 6e 20 20 20 79 2f 6e 3a 20 22 29 0a 09 09  ?\n   y/n: ")...
b630: 09 09 20 28 65 71 75 61 6c 3f 20 22 79 22 20 28  .. (equal? "y" (
b640: 72 65 61 64 2d 6c 69 6e 65 29 29 29 29 29 0a 09  read-line)))))..
b650: 09 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e  .      (open-run
b660: 2d 63 6c 6f 73 65 20 64 62 3a 6c 6f 63 6b 2f 75  -close db:lock/u
b670: 6e 6c 6f 63 6b 2d 72 75 6e 20 64 62 20 72 75 6e  nlock-run db run
b680: 2d 69 64 20 6c 6f 63 6b 20 75 6e 6c 6f 63 6b 20  -id lock unlock 
b690: 75 73 65 72 29 0a 09 09 20 20 20 20 20 20 28 64  user)...      (d
b6a0: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
b6b0: 30 20 22 53 6b 69 70 70 69 6e 67 20 6c 6f 63 6b  0 "Skipping lock
b6c0: 2f 75 6e 6c 6f 63 6b 20 6f 6e 20 22 20 72 75 6e  /unlock on " run
b6d0: 2d 69 64 29 29 29 29 0a 09 20 20 20 20 20 20 72  -id))))..      r
b6e0: 75 6e 73 29 29 29 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d  uns))).;;=======
b6f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b700: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b710: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b720: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a  ===============.
b730: 3b 3b 20 52 6f 6c 6c 75 70 20 72 75 6e 73 0a 3b  ;; Rollup runs.;
b740: 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;===============
b750: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b760: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b770: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b780: 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 55 70 64 61  =======..;; Upda
b790: 74 65 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61  te the test_meta
b7a0: 20 74 61 62 6c 65 20 66 6f 72 20 74 68 69 73 20   table for this 
b7b0: 74 65 73 74 0a 28 64 65 66 69 6e 65 20 28 72 75  test.(define (ru
b7c0: 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d  ns:update-test_m
b7d0: 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65  eta db test-name
b7e0: 20 74 65 73 74 2d 63 6f 6e 66 29 0a 20 20 28 6c   test-conf).  (l
b7f0: 65 74 20 28 28 63 75 72 72 72 65 63 6f 72 64 20  et ((currrecord 
b800: 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20  (cdb:remote-run 
b810: 64 62 3a 74 65 73 74 6d 65 74 61 2d 67 65 74 2d  db:testmeta-get-
b820: 72 65 63 6f 72 64 20 64 62 20 74 65 73 74 2d 6e  record db test-n
b830: 61 6d 65 29 29 29 0a 20 20 20 20 28 69 66 20 28  ame))).    (if (
b840: 6e 6f 74 20 63 75 72 72 72 65 63 6f 72 64 29 0a  not currrecord).
b850: 09 28 62 65 67 69 6e 0a 09 20 20 28 73 65 74 21  .(begin..  (set!
b860: 20 63 75 72 72 72 65 63 6f 72 64 20 28 6d 61 6b   currrecord (mak
b870: 65 2d 76 65 63 74 6f 72 20 31 30 20 23 66 29 29  e-vector 10 #f))
b880: 0a 09 20 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d  ..  (cdb:remote-
b890: 72 75 6e 20 64 62 3a 74 65 73 74 6d 65 74 61 2d  run db:testmeta-
b8a0: 61 64 64 2d 72 65 63 6f 72 64 20 64 62 20 74 65  add-record db te
b8b0: 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 28  st-name))).    (
b8c0: 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28  for-each .     (
b8d0: 6c 61 6d 62 64 61 20 28 6b 65 79 29 0a 20 20 20  lambda (key).   
b8e0: 20 20 20 20 28 6c 65 74 2a 20 28 28 69 64 78 20      (let* ((idx 
b8f0: 28 63 61 64 72 20 6b 65 79 29 29 0a 09 20 20 20  (cadr key))..   
b900: 20 20 20 28 66 6c 64 20 28 63 61 72 20 20 6b 65     (fld (car  ke
b910: 79 29 29 0a 09 20 20 20 20 20 20 28 76 61 6c 20  y))..      (val 
b920: 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74  (config-lookup t
b930: 65 73 74 2d 63 6f 6e 66 20 22 74 65 73 74 5f 6d  est-conf "test_m
b940: 65 74 61 22 20 66 6c 64 29 29 29 0a 09 20 3b 3b  eta" fld))).. ;;
b950: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 35 20   (debug:print 5 
b960: 22 69 64 78 3a 20 22 20 69 64 78 20 22 20 66 6c  "idx: " idx " fl
b970: 64 3a 20 22 20 66 6c 64 20 22 20 76 61 6c 3a 20  d: " fld " val: 
b980: 22 20 76 61 6c 29 0a 09 20 28 69 66 20 28 61 6e  " val).. (if (an
b990: 64 20 76 61 6c 20 28 6e 6f 74 20 28 65 71 75 61  d val (not (equa
b9a0: 6c 3f 20 28 76 65 63 74 6f 72 2d 72 65 66 20 63  l? (vector-ref c
b9b0: 75 72 72 72 65 63 6f 72 64 20 69 64 78 29 20 76  urrrecord idx) v
b9c0: 61 6c 29 29 29 0a 09 20 20 20 20 20 28 62 65 67  al)))..     (beg
b9d0: 69 6e 0a 09 20 20 20 20 20 20 20 28 70 72 69 6e  in..       (prin
b9e0: 74 20 22 55 70 64 61 74 69 6e 67 20 22 20 74 65  t "Updating " te
b9f0: 73 74 2d 6e 61 6d 65 20 22 20 22 20 66 6c 64 20  st-name " " fld 
ba00: 22 20 74 6f 20 22 20 76 61 6c 29 0a 09 20 20 20  " to " val)..   
ba10: 20 20 20 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d      (cdb:remote-
ba20: 72 75 6e 20 64 62 3a 74 65 73 74 6d 65 74 61 2d  run db:testmeta-
ba30: 75 70 64 61 74 65 2d 66 69 65 6c 64 20 64 62 20  update-field db 
ba40: 74 65 73 74 2d 6e 61 6d 65 20 66 6c 64 20 76 61  test-name fld va
ba50: 6c 29 29 29 29 29 0a 20 20 20 20 20 27 28 28 22  l))))).     '(("
ba60: 61 75 74 68 6f 72 22 20 32 29 28 22 6f 77 6e 65  author" 2)("owne
ba70: 72 22 20 33 29 28 22 64 65 73 63 72 69 70 74 69  r" 3)("descripti
ba80: 6f 6e 22 20 34 29 28 22 72 65 76 69 65 77 65 64  on" 4)("reviewed
ba90: 22 20 35 29 28 22 74 61 67 73 22 20 39 29 29 29  " 5)("tags" 9)))
baa0: 29 29 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74 65  ))..;; Update te
bab0: 73 74 5f 6d 65 74 61 20 66 6f 72 20 61 6c 6c 20  st_meta for all 
bac0: 74 65 73 74 73 0a 28 64 65 66 69 6e 65 20 28 72  tests.(define (r
bad0: 75 6e 73 3a 75 70 64 61 74 65 2d 61 6c 6c 2d 74  uns:update-all-t
bae0: 65 73 74 5f 6d 65 74 61 20 64 62 29 0a 20 20 28  est_meta db).  (
baf0: 6c 65 74 20 28 28 74 65 73 74 2d 6e 61 6d 65 73  let ((test-names
bb00: 20 28 67 65 74 2d 61 6c 6c 2d 6c 65 67 61 6c 2d   (get-all-legal-
bb10: 74 65 73 74 73 29 29 29 0a 20 20 20 20 28 66 6f  tests))).    (fo
bb20: 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c 61  r-each .     (la
bb30: 6d 62 64 61 20 28 74 65 73 74 2d 6e 61 6d 65 29  mbda (test-name)
bb40: 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28  .       (let* ((
bb50: 74 65 73 74 2d 70 61 74 68 20 20 20 20 28 63 6f  test-path    (co
bb60: 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74  nc *toppath* "/t
bb70: 65 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d 65  ests/" test-name
bb80: 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d  ))..      (test-
bb90: 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 74 65  configf (conc te
bba0: 73 74 2d 70 61 74 68 20 22 2f 74 65 73 74 63 6f  st-path "/testco
bbb0: 6e 66 69 67 22 29 29 0a 09 20 20 20 20 20 20 28  nfig"))..      (
bbc0: 74 65 73 74 65 78 69 73 74 73 20 20 20 28 61 6e  testexists   (an
bbd0: 64 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20  d (file-exists? 
bbe0: 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 28 66 69  test-configf)(fi
bbf0: 6c 65 2d 72 65 61 64 2d 61 63 63 65 73 73 3f 20  le-read-access? 
bc00: 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 29 29 0a  test-configf))).
bc10: 09 20 20 20 20 20 20 3b 3b 20 72 65 61 64 20 63  .      ;; read c
bc20: 6f 6e 66 69 67 73 20 77 69 74 68 20 74 72 69 63  onfigs with tric
bc30: 6b 73 20 74 75 72 6e 65 64 20 6f 66 66 20 28 69  ks turned off (i
bc40: 2e 65 2e 20 6e 6f 20 73 79 73 74 65 6d 29 0a 09  .e. no system)..
bc50: 20 20 20 20 20 20 28 74 65 73 74 2d 63 6f 6e 66        (test-conf
bc60: 20 20 20 20 28 69 66 20 74 65 73 74 65 78 69 73      (if testexis
bc70: 74 73 20 28 72 65 61 64 2d 63 6f 6e 66 69 67 20  ts (read-config 
bc80: 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 23 66 20  test-configf #f 
bc90: 23 66 29 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61  #f)(make-hash-ta
bca0: 62 6c 65 29 29 29 29 0a 09 20 3b 3b 20 75 73 65  ble)))).. ;; use
bcb0: 20 74 68 65 20 6f 70 65 6e 2d 72 75 6e 2d 63 6c   the open-run-cl
bcc0: 6f 73 65 20 69 6e 73 74 65 61 64 20 6f 66 20 70  ose instead of p
bcd0: 61 73 73 69 6e 67 20 69 6e 20 64 62 0a 09 20 28  assing in db.. (
bce0: 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74  runs:update-test
bcf0: 5f 6d 65 74 61 20 23 66 20 74 65 73 74 2d 6e 61  _meta #f test-na
bd00: 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 29 29 0a  me test-conf))).
bd10: 20 20 20 20 20 74 65 73 74 2d 6e 61 6d 65 73 29       test-names)
bd20: 29 29 0a 0a 3b 3b 20 54 68 69 73 20 63 6f 75 6c  ))..;; This coul
bd30: 64 20 70 72 6f 62 61 62 6c 79 20 62 65 20 72 65  d probably be re
bd40: 66 61 63 74 6f 72 65 64 20 69 6e 74 6f 20 6f 6e  factored into on
bd50: 65 20 63 6f 6d 70 6c 65 78 20 71 75 65 72 79 20  e complex query 
bd60: 2e 2e 2e 0a 28 64 65 66 69 6e 65 20 28 72 75 6e  ....(define (run
bd70: 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 20 6b 65 79  s:rollup-run key
bd80: 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e  s keyvallst runn
bd90: 61 6d 65 20 75 73 65 72 29 20 3b 3b 20 77 61 73  ame user) ;; was
bda0: 20 74 61 72 67 65 74 2c 20 6e 6f 77 20 6b 65 79   target, now key
bdb0: 76 61 6c 6c 73 74 0a 20 20 28 64 65 62 75 67 3a  vallst.  (debug:
bdc0: 70 72 69 6e 74 20 34 20 22 72 75 6e 73 3a 72 6f  print 4 "runs:ro
bdd0: 6c 6c 75 70 2d 72 75 6e 2c 20 6b 65 79 73 3a 20  llup-run, keys: 
bde0: 22 20 6b 65 79 73 20 22 20 6b 65 79 76 61 6c 6c  " keys " keyvall
bdf0: 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 20  st: " keyvallst 
be00: 22 20 3a 72 75 6e 6e 61 6d 65 20 22 20 72 75 6e  " :runname " run
be10: 6e 61 6d 65 20 22 20 75 73 65 72 3a 20 22 20 75  name " user: " u
be20: 73 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 28 64  ser).  (let* ((d
be30: 62 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23  b              #
be40: 66 29 20 3b 3b 20 28 6b 65 79 76 61 6c 6c 6c 73  f) ;; (keyvallls
be50: 74 20 20 20 20 20 20 28 6b 65 79 73 3a 74 61 72  t      (keys:tar
be60: 67 65 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 79 73  get->keyval keys
be70: 20 74 61 72 67 65 74 29 29 0a 09 20 28 6e 65 77   target)).. (new
be80: 2d 72 75 6e 2d 69 64 20 20 20 20 20 20 28 63 64  -run-id      (cd
be90: 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64 62 3a  b:remote-run db:
bea0: 72 65 67 69 73 74 65 72 2d 72 75 6e 20 23 66 20  register-run #f 
beb0: 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72  keys keyvallst r
bec0: 75 6e 6e 61 6d 65 20 22 6e 65 77 22 20 22 6e 2f  unname "new" "n/
bed0: 61 22 20 75 73 65 72 29 29 0a 09 20 28 70 72 65  a" user)).. (pre
bee0: 76 2d 74 65 73 74 73 20 20 20 20 20 20 28 6f 70  v-tests      (op
bef0: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 74 65 73  en-run-close tes
bf00: 74 3a 67 65 74 2d 6d 61 74 63 68 69 6e 67 2d 70  t:get-matching-p
bf10: 72 65 76 69 6f 75 73 2d 74 65 73 74 2d 72 75 6e  revious-test-run
bf20: 2d 72 65 63 6f 72 64 73 20 64 62 20 6e 65 77 2d  -records db new-
bf30: 72 75 6e 2d 69 64 20 22 25 22 20 22 25 22 29 29  run-id "%" "%"))
bf40: 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73 20 20  .. (curr-tests  
bf50: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c      (open-run-cl
bf60: 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 73  ose db:get-tests
bf70: 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77 2d  -for-run db new-
bf80: 72 75 6e 2d 69 64 20 22 25 2f 25 22 20 27 28 29  run-id "%/%" '()
bf90: 20 27 28 29 29 29 0a 09 20 28 63 75 72 72 2d 74   '())).. (curr-t
bfa0: 65 73 74 73 2d 68 61 73 68 20 28 6d 61 6b 65 2d  ests-hash (make-
bfb0: 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 20 20  hash-table))).  
bfc0: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73    (open-run-clos
bfd0: 65 20 64 62 3a 75 70 64 61 74 65 2d 72 75 6e 2d  e db:update-run-
bfe0: 65 76 65 6e 74 5f 74 69 6d 65 20 64 62 20 6e 65  event_time db ne
bff0: 77 2d 72 75 6e 2d 69 64 29 0a 20 20 20 20 3b 3b  w-run-id).    ;;
c000: 20 69 6e 64 65 78 20 74 68 65 20 61 6c 72 65 61   index the alrea
c010: 64 79 20 73 61 76 65 64 20 74 65 73 74 73 20 62  dy saved tests b
c020: 79 20 74 65 73 74 6e 61 6d 65 20 61 6e 64 20 69  y testname and i
c030: 74 65 6d 64 61 74 20 69 6e 20 63 75 72 72 2d 74  temdat in curr-t
c040: 65 73 74 73 2d 68 61 73 68 0a 20 20 20 20 28 66  ests-hash.    (f
c050: 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 28 6c 61  or-each.     (la
c060: 6d 62 64 61 20 28 74 65 73 74 64 61 74 29 0a 20  mbda (testdat). 
c070: 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74 65        (let* ((te
c080: 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 65 73 74  stname  (db:test
c090: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65  -get-testname te
c0a0: 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28  stdat))..      (
c0b0: 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74 65  item-path (db:te
c0c0: 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68  st-get-item-path
c0d0: 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20   testdat))..    
c0e0: 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f    (full-name (co
c0f0: 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22 20  nc testname "/" 
c100: 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 09 20 28  item-path))).. (
c110: 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20  hash-table-set! 
c120: 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20  curr-tests-hash 
c130: 66 75 6c 6c 2d 6e 61 6d 65 20 74 65 73 74 64 61  full-name testda
c140: 74 29 29 29 0a 20 20 20 20 20 63 75 72 72 2d 74  t))).     curr-t
c150: 65 73 74 73 29 0a 20 20 20 20 3b 3b 20 4e 4f 50  ests).    ;; NOP
c160: 45 3a 20 4e 6f 6e 2d 6f 70 74 69 6d 61 6c 20 61  E: Non-optimal a
c170: 70 70 72 6f 61 63 68 2e 20 54 72 79 20 74 68 69  pproach. Try thi
c180: 73 20 69 6e 73 74 65 61 64 2e 0a 20 20 20 20 3b  s instead..    ;
c190: 3b 20 20 20 31 2e 20 74 65 73 74 73 20 61 72 65  ;   1. tests are
c1a0: 20 72 65 63 65 69 76 65 64 20 69 6e 20 61 20 6c   received in a l
c1b0: 69 73 74 2c 20 6d 6f 73 74 20 72 65 63 65 6e 74  ist, most recent
c1c0: 20 66 69 72 73 74 0a 20 20 20 20 3b 3b 20 20 20   first.    ;;   
c1d0: 32 2e 20 72 65 70 6c 61 63 65 20 74 68 65 20 72  2. replace the r
c1e0: 6f 6c 6c 75 70 20 74 65 73 74 20 77 69 74 68 20  ollup test with 
c1f0: 74 68 65 20 6e 65 77 20 2a 61 6c 77 61 79 73 2a  the new *always*
c200: 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a  .    (for-each .
c210: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74 65       (lambda (te
c220: 73 74 64 61 74 29 0a 20 20 20 20 20 20 20 28 6c  stdat).       (l
c230: 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 20 20  et* ((testname  
c240: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73  (db:test-get-tes
c250: 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29 0a  tname testdat)).
c260: 09 20 20 20 20 20 20 28 69 74 65 6d 2d 70 61 74  .      (item-pat
c270: 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  h (db:test-get-i
c280: 74 65 6d 2d 70 61 74 68 20 74 65 73 74 64 61 74  tem-path testdat
c290: 29 29 0a 09 20 20 20 20 20 20 28 66 75 6c 6c 2d  ))..      (full-
c2a0: 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 6e  name (conc testn
c2b0: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74  ame "/" item-pat
c2c0: 68 29 29 0a 09 20 20 20 20 20 20 28 70 72 65 76  h))..      (prev
c2d0: 2d 74 65 73 74 2d 64 61 74 20 28 68 61 73 68 2d  -test-dat (hash-
c2e0: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c  table-ref/defaul
c2f0: 74 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73  t curr-tests-has
c300: 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 23 66 29 29  h full-name #f))
c310: 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d 73 74  ..      (test-st
c320: 65 70 73 20 20 20 20 20 20 28 6f 70 65 6e 2d 72  eps      (open-r
c330: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d  un-close db:get-
c340: 73 74 65 70 73 2d 66 6f 72 2d 74 65 73 74 20 64  steps-for-test d
c350: 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  b (db:test-get-i
c360: 64 20 74 65 73 74 64 61 74 29 29 29 0a 09 20 20  d testdat)))..  
c370: 20 20 20 20 28 6e 65 77 2d 74 65 73 74 2d 72 65      (new-test-re
c380: 63 6f 72 64 20 23 66 29 29 0a 09 20 3b 3b 20 72  cord #f)).. ;; r
c390: 65 70 6c 61 63 65 20 74 68 65 73 65 20 77 69 74  eplace these wit
c3a0: 68 20 69 6e 73 65 72 74 20 2e 2e 2e 20 73 65 6c  h insert ... sel
c3b0: 65 63 74 0a 09 20 28 61 70 70 6c 79 20 73 71 6c  ect.. (apply sql
c3c0: 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09 09  ite3:execute ...
c3d0: 64 62 20 0a 09 09 28 63 6f 6e 63 20 22 49 4e 53  db ...(conc "INS
c3e0: 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49  ERT OR REPLACE I
c3f0: 4e 54 4f 20 74 65 73 74 73 20 28 72 75 6e 5f 69  NTO tests (run_i
c400: 64 2c 74 65 73 74 6e 61 6d 65 2c 73 74 61 74 65  d,testname,state
c410: 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69  ,status,event_ti
c420: 6d 65 2c 68 6f 73 74 2c 63 70 75 6c 6f 61 64 2c  me,host,cpuload,
c430: 64 69 73 6b 66 72 65 65 2c 75 6e 61 6d 65 2c 72  diskfree,uname,r
c440: 75 6e 64 69 72 2c 69 74 65 6d 5f 70 61 74 68 2c  undir,item_path,
c450: 72 75 6e 5f 64 75 72 61 74 69 6f 6e 2c 66 69 6e  run_duration,fin
c460: 61 6c 5f 6c 6f 67 66 2c 63 6f 6d 6d 65 6e 74 29  al_logf,comment)
c470: 20 22 0a 09 09 20 20 20 20 20 20 22 56 41 4c 55   "...      "VALU
c480: 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c  ES (?,?,?,?,?,?,
c490: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 29  ?,?,?,?,?,?,?,?)
c4a0: 3b 22 29 0a 09 09 6e 65 77 2d 72 75 6e 2d 69 64  ;")...new-run-id
c4b0: 20 28 63 64 64 72 20 28 76 65 63 74 6f 72 2d 3e   (cddr (vector->
c4c0: 6c 69 73 74 20 74 65 73 74 64 61 74 29 29 29 0a  list testdat))).
c4d0: 09 20 28 73 65 74 21 20 6e 65 77 2d 74 65 73 74  . (set! new-test
c4e0: 64 61 74 20 28 63 61 72 20 28 6f 70 65 6e 2d 72  dat (car (open-r
c4f0: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d  un-close db:get-
c500: 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62  tests-for-run db
c510: 20 6e 65 77 2d 72 75 6e 2d 69 64 20 28 63 6f 6e   new-run-id (con
c520: 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22 20 69  c testname "/" i
c530: 74 65 6d 2d 70 61 74 68 29 20 27 28 29 20 27 28  tem-path) '() '(
c540: 29 29 29 29 0a 09 20 28 68 61 73 68 2d 74 61 62  )))).. (hash-tab
c550: 6c 65 2d 73 65 74 21 20 63 75 72 72 2d 74 65 73  le-set! curr-tes
c560: 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d  ts-hash full-nam
c570: 65 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20 3b  e new-testdat) ;
c580: 3b 20 74 68 69 73 20 63 6f 75 6c 64 20 62 65 20  ; this could be 
c590: 63 6f 6e 66 75 73 69 6e 67 2c 20 77 68 69 63 68  confusing, which
c5a0: 20 72 65 63 6f 72 64 20 73 68 6f 75 6c 64 20 67   record should g
c5b0: 6f 20 69 6e 74 6f 20 74 68 65 20 6c 6f 6f 6b 75  o into the looku
c5c0: 70 20 74 61 62 6c 65 3f 0a 09 20 3b 3b 20 4e 6f  p table?.. ;; No
c5d0: 77 20 64 75 70 6c 69 63 61 74 65 20 74 68 65 20  w duplicate the 
c5e0: 74 65 73 74 20 73 74 65 70 73 0a 09 20 28 64 65  test steps.. (de
c5f0: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 43 6f 70  bug:print 4 "Cop
c600: 79 69 6e 67 20 72 65 63 6f 72 64 73 20 69 6e 20  ying records in 
c610: 74 65 73 74 5f 73 74 65 70 73 20 66 72 6f 6d 20  test_steps from 
c620: 74 65 73 74 5f 69 64 3d 22 20 28 64 62 3a 74 65  test_id=" (db:te
c630: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61  st-get-id testda
c640: 74 29 20 22 20 74 6f 20 22 20 28 64 62 3a 74 65  t) " to " (db:te
c650: 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65  st-get-id new-te
c660: 73 74 64 61 74 29 29 0a 09 20 28 6f 70 65 6e 2d  stdat)).. (open-
c670: 72 75 6e 2d 63 6c 6f 73 65 20 0a 09 20 20 28 6c  run-close ..  (l
c680: 61 6d 62 64 61 20 28 29 0a 09 20 20 20 20 28 73  ambda ()..    (s
c690: 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a  qlite3:execute .
c6a0: 09 20 20 20 20 20 64 62 20 0a 09 20 20 20 20 20  .     db ..     
c6b0: 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52  (conc "INSERT OR
c6c0: 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65   REPLACE INTO te
c6d0: 73 74 5f 73 74 65 70 73 20 28 74 65 73 74 5f 69  st_steps (test_i
c6e0: 64 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 74 65  d,stepname,state
c6f0: 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69  ,status,event_ti
c700: 6d 65 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09  me,comment) "...
c710: 20 20 20 22 53 45 4c 45 43 54 20 22 20 28 64 62     "SELECT " (db
c720: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77  :test-get-id new
c730: 2d 74 65 73 74 64 61 74 29 20 22 2c 73 74 65 70  -testdat) ",step
c740: 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75  name,state,statu
c750: 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d  s,event_time,com
c760: 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f 73  ment FROM test_s
c770: 74 65 70 73 20 57 48 45 52 45 20 74 65 73 74 5f  teps WHERE test_
c780: 69 64 3d 3f 3b 22 29 0a 09 20 20 20 20 20 28 64  id=?;")..     (d
c790: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65  b:test-get-id te
c7a0: 73 74 64 61 74 29 29 0a 09 20 20 20 20 3b 3b 20  stdat))..    ;; 
c7b0: 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74 68  Now duplicate th
c7c0: 65 20 74 65 73 74 20 64 61 74 61 0a 09 20 20 20  e test data..   
c7d0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20   (debug:print 4 
c7e0: 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 73  "Copying records
c7f0: 20 69 6e 20 74 65 73 74 5f 64 61 74 61 20 66 72   in test_data fr
c800: 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62  om test_id=" (db
c810: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73  :test-get-id tes
c820: 74 64 61 74 29 20 22 20 74 6f 20 22 20 28 64 62  tdat) " to " (db
c830: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77  :test-get-id new
c840: 2d 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20  -testdat))..    
c850: 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65  (sqlite3:execute
c860: 20 0a 09 20 20 20 20 20 64 62 20 0a 09 20 20 20   ..     db ..   
c870: 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20    (conc "INSERT 
c880: 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20  OR REPLACE INTO 
c890: 74 65 73 74 5f 64 61 74 61 20 28 74 65 73 74 5f  test_data (test_
c8a0: 69 64 2c 63 61 74 65 67 6f 72 79 2c 76 61 72 69  id,category,vari
c8b0: 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65 63  able,value,expec
c8c0: 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f  ted,tol,units,co
c8d0: 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 22 53  mment) "...   "S
c8e0: 45 4c 45 43 54 20 22 20 28 64 62 3a 74 65 73 74  ELECT " (db:test
c8f0: 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74  -get-id new-test
c900: 64 61 74 29 20 22 2c 63 61 74 65 67 6f 72 79 2c  dat) ",category,
c910: 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65  variable,value,e
c920: 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74  xpected,tol,unit
c930: 73 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 74  s,comment FROM t
c940: 65 73 74 5f 64 61 74 61 20 57 48 45 52 45 20 74  est_data WHERE t
c950: 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 20  est_id=?;")..   
c960: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69    (db:test-get-i
c970: 64 20 74 65 73 74 64 61 74 29 29 29 29 0a 09 20  d testdat)))).. 
c980: 29 29 0a 20 20 20 20 20 70 72 65 76 2d 74 65 73  )).     prev-tes
c990: 74 73 29 29 29 0a 09 20 0a 20 20 20 20 20 0a     ts))).. .     .