Megatest

Hex Artifact Content
Login

Artifact 523e5fa4330f9ee74374b37152ab882dd895decd:


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 28 64 65 66 69 6e 65 20 2a 72 75 6e 73  0).(define *runs
0fc0: 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65  :can-run-more-te
0fd0: 73 74 73 2d 64 65 6c 61 79 2a 20 30 29 0a 28 64  sts-delay* 0).(d
0fe0: 65 66 69 6e 65 20 28 72 75 6e 73 3a 73 68 72 69  efine (runs:shri
0ff0: 6e 6b 2d 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d  nk-can-run-more-
1000: 74 65 73 74 73 2d 64 65 6c 61 79 29 0a 20 20 28  tests-delay).  (
1010: 73 65 74 21 20 2a 72 75 6e 73 3a 63 61 6e 2d 72  set! *runs:can-r
1020: 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65  un-more-tests-de
1030: 6c 61 79 2a 20 30 29 29 20 3b 3b 20 28 2f 20 2a  lay* 0)) ;; (/ *
1040: 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72  runs:can-run-mor
1050: 65 2d 74 65 73 74 73 2d 64 65 6c 61 79 2a 20 32  e-tests-delay* 2
1060: 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75  )))..(define (ru
1070: 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d  ns:can-run-more-
1080: 74 65 73 74 73 20 74 65 73 74 2d 72 65 63 6f 72  tests test-recor
1090: 64 29 0a 20 20 28 74 68 72 65 61 64 2d 73 6c 65  d).  (thread-sle
10a0: 65 70 21 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75  ep! *runs:can-ru
10b0: 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c  n-more-tests-del
10c0: 61 79 2a 29 0a 20 20 28 6c 65 74 2a 20 28 28 74  ay*).  (let* ((t
10d0: 63 6f 6e 66 69 67 20 20 20 20 20 20 20 20 20 20  config          
10e0: 20 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 65         (tests:te
10f0: 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74  stqueue-get-test
1100: 63 6f 6e 66 69 67 20 74 65 73 74 2d 72 65 63 6f  config test-reco
1110: 72 64 29 29 0a 09 20 28 6a 6f 62 67 72 6f 75 70  rd)).. (jobgroup
1120: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1130: 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74  (config-lookup t
1140: 63 6f 6e 66 69 67 20 22 72 65 71 75 69 72 65 6d  config "requirem
1150: 65 6e 74 73 22 20 22 6a 6f 62 67 72 6f 75 70 22  ents" "jobgroup"
1160: 29 29 0a 09 20 3b 3b 20 48 65 75 72 69 73 74 69  )).. ;; Heuristi
1170: 63 20 66 69 78 2e 20 54 68 65 73 65 20 61 72 65  c fix. These are
1180: 20 67 65 74 74 69 6e 67 20 63 61 6c 6c 65 64 20   getting called 
1190: 74 6f 6f 20 72 61 70 69 64 6c 79 20 77 68 65 6e  too rapidly when
11a0: 20 6a 6f 62 73 20 61 72 65 20 72 75 6e 6e 69 6e   jobs are runnin
11b0: 67 20 6f 72 20 73 74 75 63 6b 0a 09 20 3b 3b 20  g or stuck.. ;; 
11c0: 73 6f 20 77 65 20 61 72 65 20 67 6f 69 6e 67 20  so we are going 
11d0: 74 6f 20 69 6e 63 72 65 6d 65 6e 74 20 61 20 67  to increment a g
11e0: 6c 6f 62 61 6c 20 64 65 6c 61 79 20 62 79 20 30  lobal delay by 0
11f0: 2e 31 20 73 65 63 6f 6e 64 73 20 75 70 20 74 6f  .1 seconds up to
1200: 20 31 30 20 73 65 63 6f 6e 64 73 0a 09 20 3b 3b   10 seconds.. ;;
1210: 20 65 76 65 72 79 20 74 69 6d 65 20 72 75 6e 73   every time runs
1220: 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65  :can-run-more-te
1230: 73 74 73 20 69 73 20 63 61 6c 6c 65 64 2e 0a 09  sts is called...
1240: 20 3b 3b 20 77 68 65 6e 20 61 20 74 65 73 74 20   ;; when a test 
1250: 69 73 20 6c 61 75 6e 63 68 65 64 20 6f 72 20 6f  is launched or o
1260: 74 68 65 72 20 61 63 74 69 76 69 74 79 20 6f 63  ther activity oc
1270: 63 75 72 73 20 64 69 76 69 64 65 20 74 68 65 20  curs divide the 
1280: 64 65 6c 61 79 20 62 79 20 32 0a 09 20 28 6e 75  delay by 2.. (nu
1290: 6d 2d 72 75 6e 6e 69 6e 67 20 20 20 20 20 20 20  m-running       
12a0: 20 20 20 20 20 20 28 63 64 62 3a 72 65 6d 6f 74        (cdb:remot
12b0: 65 2d 72 75 6e 20 64 62 3a 67 65 74 2d 63 6f 75  e-run db:get-cou
12c0: 6e 74 2d 74 65 73 74 73 2d 72 75 6e 6e 69 6e 67  nt-tests-running
12d0: 20 23 66 29 29 0a 09 20 28 6e 75 6d 2d 72 75 6e   #f)).. (num-run
12e0: 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70  ning-in-jobgroup
12f0: 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e   (cdb:remote-run
1300: 20 64 62 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 65   db:get-count-te
1310: 73 74 73 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a  sts-running-in-j
1320: 6f 62 67 72 6f 75 70 20 23 66 20 6a 6f 62 67 72  obgroup #f jobgr
1330: 6f 75 70 29 29 0a 09 20 28 6d 61 78 2d 63 6f 6e  oup)).. (max-con
1340: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 20 20 20  current-jobs    
1350: 20 28 6c 65 74 20 28 28 6d 63 6a 20 28 63 6f 6e   (let ((mcj (con
1360: 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66  fig-lookup *conf
1370: 69 67 64 61 74 2a 20 22 73 65 74 75 70 22 20 20  igdat* "setup"  
1380: 20 20 20 22 6d 61 78 5f 63 6f 6e 63 75 72 72 65     "max_concurre
1390: 6e 74 5f 6a 6f 62 73 22 29 29 29 0a 09 09 09 09  nt_jobs"))).....
13a0: 20 20 20 20 28 69 66 20 28 61 6e 64 20 6d 63 6a      (if (and mcj
13b0: 20 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72   (string->number
13c0: 20 6d 63 6a 29 29 0a 09 09 09 09 09 28 73 74 72   mcj))......(str
13d0: 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 63 6a 29  ing->number mcj)
13e0: 0a 09 09 09 09 09 31 29 29 29 0a 09 20 28 6a 6f  ......1))).. (jo
13f0: 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 20 20 20  b-group-limit   
1400: 20 20 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f        (config-lo
1410: 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a  okup *configdat*
1420: 20 22 6a 6f 62 67 72 6f 75 70 73 22 20 6a 6f 62   "jobgroups" job
1430: 67 72 6f 75 70 29 29 29 0a 20 20 20 20 28 69 66  group))).    (if
1440: 20 28 61 6e 64 20 28 3e 20 28 2b 20 6e 75 6d 2d   (and (> (+ num-
1450: 72 75 6e 6e 69 6e 67 20 6e 75 6d 2d 72 75 6e 6e  running num-runn
1460: 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 29  ing-in-jobgroup)
1470: 20 30 29 0a 09 20 20 20 20 20 28 3c 20 2a 72 75   0)..     (< *ru
1480: 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d  ns:can-run-more-
1490: 74 65 73 74 73 2d 64 65 6c 61 79 2a 20 31 29 29  tests-delay* 1))
14a0: 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 73 65 74  ..(begin..  (set
14b0: 21 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d  ! *runs:can-run-
14c0: 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c 61 79  more-tests-delay
14d0: 2a 20 28 2b 20 2a 72 75 6e 73 3a 63 61 6e 2d 72  * (+ *runs:can-r
14e0: 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65  un-more-tests-de
14f0: 6c 61 79 2a 20 30 2e 30 30 39 29 29 0a 09 20 20  lay* 0.009))..  
1500: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
1510: 6f 20 31 34 20 22 63 61 6e 2d 72 75 6e 2d 6d 6f  o 14 "can-run-mo
1520: 72 65 2d 74 65 73 74 73 2d 64 65 6c 61 79 3a 20  re-tests-delay: 
1530: 22 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d  " *runs:can-run-
1540: 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c 61 79  more-tests-delay
1550: 2a 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e 6f  *))).    (if (no
1560: 74 20 28 65 71 3f 20 2a 6c 61 73 74 2d 6e 75 6d  t (eq? *last-num
1570: 2d 72 75 6e 6e 69 6e 67 2d 74 65 73 74 73 2a 20  -running-tests* 
1580: 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 29 0a 09 28  num-running))..(
1590: 62 65 67 69 6e 0a 09 20 20 28 64 65 62 75 67 3a  begin..  (debug:
15a0: 70 72 69 6e 74 20 32 20 22 6d 61 78 2d 63 6f 6e  print 2 "max-con
15b0: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 3a 20 22 20  current-jobs: " 
15c0: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a  max-concurrent-j
15d0: 6f 62 73 20 22 2c 20 6e 75 6d 2d 72 75 6e 6e 69  obs ", num-runni
15e0: 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e  ng: " num-runnin
15f0: 67 29 0a 09 20 20 28 73 65 74 21 20 2a 6c 61 73  g)..  (set! *las
1600: 74 2d 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 74 65  t-num-running-te
1610: 73 74 73 2a 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67  sts* num-running
1620: 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74  ))).    (if (not
1630: 20 28 65 71 3f 20 30 20 2a 67 6c 6f 62 61 6c 65   (eq? 0 *globale
1640: 78 69 74 73 74 61 74 75 73 2a 29 29 0a 09 28 6c  xitstatus*))..(l
1650: 69 73 74 20 23 66 20 6e 75 6d 2d 72 75 6e 6e 69  ist #f num-runni
1660: 6e 67 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69  ng num-running-i
1670: 6e 2d 6a 6f 62 67 72 6f 75 70 20 6d 61 78 2d 63  n-jobgroup max-c
1680: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 6a  oncurrent-jobs j
1690: 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 29 0a  ob-group-limit).
16a0: 09 28 6c 65 74 20 28 28 63 61 6e 2d 6e 6f 74 2d  .(let ((can-not-
16b0: 72 75 6e 2d 6d 6f 72 65 20 28 63 6f 6e 64 0a 09  run-more (cond..
16c0: 09 09 09 20 3b 3b 20 69 66 20 6d 61 78 2d 63 6f  ... ;; if max-co
16d0: 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 69 73  ncurrent-jobs is
16e0: 20 73 65 74 20 61 6e 64 20 74 68 65 20 6e 75 6d   set and the num
16f0: 62 65 72 20 72 75 6e 6e 69 6e 67 20 69 73 20 67  ber running is g
1700: 72 65 61 74 65 72 20 0a 09 09 09 09 20 3b 3b 20  reater ..... ;; 
1710: 74 68 61 6e 20 69 74 20 74 68 61 6e 20 63 61 6e  than it than can
1720: 6e 6f 74 20 72 75 6e 20 6d 6f 72 65 20 6a 6f 62  not run more job
1730: 73 0a 09 09 09 09 20 28 28 61 6e 64 20 6d 61 78  s..... ((and max
1740: 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73  -concurrent-jobs
1750: 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67   (>= num-running
1760: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d   max-concurrent-
1770: 6a 6f 62 73 29 29 0a 09 09 09 09 20 20 28 64 65  jobs)).....  (de
1780: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52  bug:print 0 "WAR
1790: 4e 49 4e 47 3a 20 4d 61 78 20 72 75 6e 6e 69 6e  NING: Max runnin
17a0: 67 20 6a 6f 62 73 20 65 78 63 65 65 64 65 64 2c  g jobs exceeded,
17b0: 20 63 75 72 72 65 6e 74 20 6e 75 6d 62 65 72 20   current number 
17c0: 72 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d 72  running: " num-r
17d0: 75 6e 6e 69 6e 67 20 0a 09 09 09 09 09 20 20 20  unning ......   
17e0: 20 20 20 20 22 2c 20 6d 61 78 5f 63 6f 6e 63 75      ", max_concu
17f0: 72 72 65 6e 74 5f 6a 6f 62 73 3a 20 22 20 6d 61  rrent_jobs: " ma
1800: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62  x-concurrent-job
1810: 73 29 0a 09 09 09 09 20 20 23 74 29 0a 09 09 09  s).....  #t)....
1820: 09 20 3b 3b 20 69 66 20 6a 6f 62 2d 67 72 6f 75  . ;; if job-grou
1830: 70 2d 6c 69 6d 69 74 20 69 73 20 73 65 74 20 61  p-limit is set a
1840: 6e 64 20 6e 75 6d 62 65 72 20 6f 66 20 6a 6f 62  nd number of job
1850: 73 20 69 6e 20 74 68 65 20 67 72 6f 75 70 20 69  s in the group i
1860: 73 20 67 72 65 61 74 65 72 0a 09 09 09 09 20 3b  s greater..... ;
1870: 3b 20 74 68 61 6e 20 74 68 65 20 6c 69 6d 69 74  ; than the limit
1880: 20 74 68 65 6e 20 63 61 6e 6e 6f 74 20 72 75 6e   then cannot run
1890: 20 6d 6f 72 65 20 6a 6f 62 73 20 6f 66 20 74 68   more jobs of th
18a0: 69 73 20 6b 69 6e 64 0a 09 09 09 09 20 28 28 61  is kind..... ((a
18b0: 6e 64 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d  nd job-group-lim
18c0: 69 74 0a 09 09 09 09 20 20 20 20 20 20 20 28 3e  it.....       (>
18d0: 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e  = num-running-in
18e0: 2d 6a 6f 62 67 72 6f 75 70 20 6a 6f 62 2d 67 72  -jobgroup job-gr
18f0: 6f 75 70 2d 6c 69 6d 69 74 29 29 0a 09 09 09 09  oup-limit)).....
1900: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31    (debug:print 1
1910: 20 22 57 41 52 4e 49 4e 47 3a 20 6e 75 6d 62 65   "WARNING: numbe
1920: 72 20 6f 66 20 6a 6f 62 73 20 22 20 6e 75 6d 2d  r of jobs " num-
1930: 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72  running-in-jobgr
1940: 6f 75 70 20 0a 09 09 09 09 09 20 20 20 20 20 20  oup ......      
1950: 20 22 20 69 6e 20 22 20 6a 6f 62 67 72 6f 75 70   " in " jobgroup
1960: 20 22 20 65 78 63 65 65 64 65 64 2c 20 77 69 6c   " exceeded, wil
1970: 6c 20 6e 6f 74 20 72 75 6e 20 22 20 28 74 65 73  l not run " (tes
1980: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
1990: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72  -testname test-r
19a0: 65 63 6f 72 64 29 29 0a 09 09 09 09 20 20 23 74  ecord)).....  #t
19b0: 29 0a 09 09 09 09 20 28 65 6c 73 65 20 23 66 29  )..... (else #f)
19c0: 29 29 29 0a 09 20 20 28 6c 69 73 74 20 28 6e 6f  )))..  (list (no
19d0: 74 20 63 61 6e 2d 6e 6f 74 2d 72 75 6e 2d 6d 6f  t can-not-run-mo
19e0: 72 65 29 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20  re) num-running 
19f0: 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a  num-running-in-j
1a00: 6f 62 67 72 6f 75 70 20 6d 61 78 2d 63 6f 6e 63  obgroup max-conc
1a10: 75 72 72 65 6e 74 2d 6a 6f 62 73 20 6a 6f 62 2d  urrent-jobs job-
1a20: 67 72 6f 75 70 2d 6c 69 6d 69 74 29 29 29 29 29  group-limit)))))
1a30: 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ..;;============
1a40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1a50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1a60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1a70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4e 65  ==========.;; Ne
1a80: 77 20 6d 65 74 68 6f 64 6f 6c 6f 67 79 2e 20 54  w methodology. T
1a90: 68 65 73 65 20 72 6f 75 74 69 6e 65 73 20 77 69  hese routines wi
1aa0: 6c 6c 20 72 65 70 6c 61 63 65 20 74 68 65 20 61  ll replace the a
1ab0: 62 6f 76 65 20 69 6e 20 74 69 6d 65 2e 20 46 6f  bove in time. Fo
1ac0: 72 0a 3b 3b 20 6e 6f 77 20 74 68 65 20 63 6f 64  r.;; now the cod
1ad0: 65 20 69 73 20 64 75 70 6c 69 63 61 74 65 64 2e  e is duplicated.
1ae0: 20 54 68 69 73 20 73 74 75 66 66 20 69 73 20 69   This stuff is i
1af0: 6e 69 74 69 61 6c 6c 79 20 75 73 65 64 20 69 6e  nitially used in
1b00: 20 74 68 65 20 6d 6f 6e 69 74 6f 72 0a 3b 3b 20   the monitor.;; 
1b10: 62 61 73 65 64 20 63 6f 64 65 2e 0a 3b 3b 3d 3d  based code..;;==
1b20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1b30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1b40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1b50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1b60: 3d 3d 3d 3d 0a 0a 0a 3b 3b 20 54 68 69 73 20 69  ====...;; This i
1b70: 73 20 61 20 64 75 70 6c 69 63 61 74 65 20 6f 66  s a duplicate of
1b80: 20 72 75 6e 2d 74 65 73 74 73 20 28 77 68 69 63   run-tests (whic
1b90: 68 20 68 61 73 20 62 65 65 6e 20 64 65 70 72 65  h has been depre
1ba0: 63 61 74 65 64 29 2e 20 55 73 65 20 74 68 69 73  cated). Use this
1bb0: 20 6f 6e 65 20 69 6e 73 74 65 61 64 20 6f 66 20   one instead of 
1bc0: 72 75 6e 20 74 65 73 74 73 2e 0a 3b 3b 20 6b 65  run tests..;; ke
1bd0: 79 76 61 6c 73 2e 0a 3b 3b 0a 3b 3b 20 20 74 65  yvals..;;.;;  te
1be0: 73 74 2d 6e 61 6d 65 73 3a 20 43 6f 6d 6d 61 20  st-names: Comma 
1bf0: 73 65 70 61 72 61 74 65 64 20 70 61 74 74 65 72  separated patter
1c00: 6e 73 20 73 61 6d 65 20 61 73 20 74 65 73 74 2d  ns same as test-
1c10: 70 61 74 74 73 20 62 75 74 20 75 73 65 64 20 69  patts but used i
1c20: 6e 20 73 65 6c 65 63 74 69 6f 6e 20 0a 3b 3b 20  n selection .;; 
1c30: 20 20 20 20 20 20 20 20 20 20 20 20 20 6f 66 20               of 
1c40: 74 65 73 74 73 20 74 6f 20 72 75 6e 2e 20 54 68  tests to run. Th
1c50: 65 20 69 74 65 6d 20 70 6f 72 74 69 6f 6e 73 20  e item portions 
1c60: 61 72 65 20 6e 6f 74 20 72 65 73 70 65 63 74 65  are not respecte
1c70: 64 2e 0a 3b 3b 20 20 20 20 20 20 20 20 20 20 20  d..;;           
1c80: 20 20 20 46 49 58 4d 45 3a 20 65 72 72 6f 72 20     FIXME: error 
1c90: 6f 75 74 20 69 66 20 2f 70 61 74 74 20 73 70 65  out if /patt spe
1ca0: 63 69 66 69 65 64 0a 3b 3b 20 20 20 20 20 20 20  cified.;;       
1cb0: 20 20 20 20 20 0a 28 64 65 66 69 6e 65 20 28 72       .(define (r
1cc0: 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 20 74 61  uns:run-tests ta
1cd0: 72 67 65 74 20 72 75 6e 6e 61 6d 65 20 74 65 73  rget runname tes
1ce0: 74 2d 6e 61 6d 65 73 20 74 65 73 74 2d 70 61 74  t-names test-pat
1cf0: 74 73 20 75 73 65 72 20 66 6c 61 67 73 29 0a 20  ts user flags). 
1d00: 20 28 63 6f 6d 6d 6f 6e 3a 63 6c 65 61 72 2d 63   (common:clear-c
1d10: 61 63 68 65 73 29 20 3b 3b 20 63 6c 65 61 72 20  aches) ;; clear 
1d20: 61 6c 6c 20 63 61 63 68 65 73 0a 20 20 28 6c 65  all caches.  (le
1d30: 74 2a 20 28 28 64 62 20 20 20 20 20 20 20 20 20  t* ((db         
1d40: 20 23 66 29 0a 09 20 28 6b 65 79 73 20 20 20 20   #f).. (keys    
1d50: 20 20 20 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d      (cdb:remote-
1d60: 72 75 6e 20 64 62 3a 67 65 74 2d 6b 65 79 73 20  run db:get-keys 
1d70: 23 66 29 29 0a 09 20 28 6b 65 79 76 61 6c 6c 73  #f)).. (keyvalls
1d80: 74 20 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74  t   (keys:target
1d90: 2d 3e 6b 65 79 76 61 6c 20 6b 65 79 73 20 74 61  ->keyval keys ta
1da0: 72 67 65 74 29 29 0a 09 20 28 72 75 6e 2d 69 64  rget)).. (run-id
1db0: 20 20 20 20 20 20 28 63 64 62 3a 72 65 6d 6f 74        (cdb:remot
1dc0: 65 2d 72 75 6e 20 64 62 3a 72 65 67 69 73 74 65  e-run db:registe
1dd0: 72 2d 72 75 6e 20 23 66 20 6b 65 79 73 20 6b 65  r-run #f keys ke
1de0: 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20  yvallst runname 
1df0: 22 6e 65 77 22 20 22 6e 2f 61 22 20 75 73 65 72  "new" "n/a" user
1e00: 29 29 20 20 3b 3b 20 20 74 65 73 74 2d 6e 61 6d  ))  ;;  test-nam
1e10: 65 29 29 29 0a 09 20 28 6b 65 79 76 61 6c 73 20  e))).. (keyvals 
1e20: 20 20 20 20 28 69 66 20 72 75 6e 2d 69 64 20 28      (if run-id (
1e30: 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64  cdb:remote-run d
1e40: 62 3a 67 65 74 2d 6b 65 79 2d 76 61 6c 73 20 23  b:get-key-vals #
1e50: 66 20 72 75 6e 2d 69 64 29 20 23 66 29 29 0a 09  f run-id) #f))..
1e60: 20 28 64 65 66 65 72 72 65 64 20 20 20 20 27 28   (deferred    '(
1e70: 29 29 20 3b 3b 20 64 65 6c 61 79 20 72 75 6e 6e  )) ;; delay runn
1e80: 69 6e 67 20 74 68 65 73 65 20 73 69 6e 63 65 20  ing these since 
1e90: 74 68 65 79 20 68 61 76 65 20 61 20 77 61 69 74  they have a wait
1ea0: 6f 6e 20 63 6c 61 75 73 65 0a 09 20 3b 3b 20 6b  on clause.. ;; k
1eb0: 65 65 70 67 6f 69 6e 67 20 69 73 20 74 68 65 20  eepgoing is the 
1ec0: 64 65 66 61 63 74 6f 20 6d 6f 64 61 6c 69 74 79  defacto modality
1ed0: 20 6e 6f 77 2c 20 77 69 6c 6c 20 61 64 64 20 68   now, will add h
1ee0: 69 74 2d 6e 2d 72 75 6e 20 61 20 62 69 74 20 6c  it-n-run a bit l
1ef0: 61 74 65 72 0a 09 20 3b 3b 20 28 6b 65 65 70 67  ater.. ;; (keepg
1f00: 6f 69 6e 67 20 20 20 28 68 61 73 68 2d 74 61 62  oing   (hash-tab
1f10: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66  le-ref/default f
1f20: 6c 61 67 73 20 22 2d 6b 65 65 70 67 6f 69 6e 67  lags "-keepgoing
1f30: 22 20 23 66 29 29 0a 09 20 28 72 75 6e 63 6f 6e  " #f)).. (runcon
1f40: 66 69 67 66 20 20 20 28 63 6f 6e 63 20 20 2a 74  figf   (conc  *t
1f50: 6f 70 70 61 74 68 2a 20 22 2f 72 75 6e 63 6f 6e  oppath* "/runcon
1f60: 66 69 67 73 2e 63 6f 6e 66 69 67 22 29 29 0a 09  figs.config"))..
1f70: 20 28 72 65 71 75 69 72 65 64 2d 74 65 73 74 73   (required-tests
1f80: 20 27 28 29 29 0a 09 20 28 74 65 73 74 2d 72 65   '()).. (test-re
1f90: 63 6f 72 64 73 20 28 6d 61 6b 65 2d 68 61 73 68  cords (make-hash
1fa0: 2d 74 61 62 6c 65 29 29 29 0a 0a 20 20 20 20 28  -table)))..    (
1fb0: 73 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76  set-megatest-env
1fc0: 2d 76 61 72 73 20 72 75 6e 2d 69 64 29 20 3b 3b  -vars run-id) ;;
1fd0: 20 74 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65   these may be ne
1fe0: 65 64 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e  eded by the laun
1ff0: 63 68 69 6e 67 20 70 72 6f 63 65 73 73 0a 0a 20  ching process.. 
2000: 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69     (if (file-exi
2010: 73 74 73 3f 20 72 75 6e 63 6f 6e 66 69 67 66 29  sts? runconfigf)
2020: 0a 09 28 73 65 74 75 70 2d 65 6e 76 2d 64 65 66  ..(setup-env-def
2030: 61 75 6c 74 73 20 72 75 6e 63 6f 6e 66 69 67 66  aults runconfigf
2040: 20 72 75 6e 2d 69 64 20 2a 61 6c 72 65 61 64 79   run-id *already
2050: 2d 73 65 65 6e 2d 72 75 6e 63 6f 6e 66 69 67 2d  -seen-runconfig-
2060: 69 6e 66 6f 2a 20 6b 65 79 73 20 6b 65 79 76 61  info* keys keyva
2070: 6c 73 20 22 70 72 65 2d 6c 61 75 6e 63 68 2d 65  ls "pre-launch-e
2080: 6e 76 2d 76 61 72 73 22 29 0a 09 28 64 65 62 75  nv-vars")..(debu
2090: 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49  g:print 0 "WARNI
20a0: 4e 47 3a 20 59 6f 75 20 64 6f 20 6e 6f 74 20 68  NG: You do not h
20b0: 61 76 65 20 61 20 72 75 6e 20 63 6f 6e 66 69 67  ave a run config
20c0: 20 66 69 6c 65 3a 20 22 20 72 75 6e 63 6f 6e 66   file: " runconf
20d0: 69 67 66 29 29 0a 20 20 20 20 0a 20 20 20 20 3b  igf)).    .    ;
20e0: 3b 20 6c 6f 6f 6b 20 75 70 20 61 6c 6c 20 74 65  ; look up all te
20f0: 73 74 73 20 6d 61 74 63 68 69 6e 67 20 74 68 65  sts matching the
2100: 20 63 6f 6d 6d 61 20 73 65 70 61 72 61 74 65 64   comma separated
2110: 20 6c 69 73 74 20 6f 66 20 67 6c 6f 62 73 20 69   list of globs i
2120: 6e 0a 20 20 20 20 3b 3b 20 74 65 73 74 2d 70 61  n.    ;; test-pa
2130: 74 74 73 20 28 75 73 69 6e 67 20 25 20 61 73 20  tts (using % as 
2140: 77 69 6c 64 63 61 72 64 29 0a 0a 20 20 20 20 28  wildcard)..    (
2150: 73 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20  set! test-names 
2160: 28 74 65 73 74 73 3a 67 65 74 2d 76 61 6c 69 64  (tests:get-valid
2170: 2d 74 65 73 74 73 20 2a 74 6f 70 70 61 74 68 2a  -tests *toppath*
2180: 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 20 20   test-names)).  
2190: 20 20 28 73 65 74 21 20 74 65 73 74 2d 6e 61 6d    (set! test-nam
21a0: 65 73 20 28 64 65 6c 65 74 65 2d 64 75 70 6c 69  es (delete-dupli
21b0: 63 61 74 65 73 20 74 65 73 74 2d 6e 61 6d 65 73  cates test-names
21c0: 29 29 0a 0a 20 20 20 20 28 64 65 62 75 67 3a 70  ))..    (debug:p
21d0: 72 69 6e 74 2d 69 6e 66 6f 20 30 20 22 74 65 73  rint-info 0 "tes
21e0: 74 20 6e 61 6d 65 73 20 22 20 74 65 73 74 2d 6e  t names " test-n
21f0: 61 6d 65 73 29 0a 0a 20 20 20 20 3b 3b 20 6f 6e  ames)..    ;; on
2200: 20 74 68 65 20 66 69 72 73 74 20 70 61 73 73 20   the first pass 
2210: 6f 72 20 63 61 6c 6c 20 74 6f 20 72 75 6e 2d 74  or call to run-t
2220: 65 73 74 73 20 73 65 74 20 46 41 49 4c 53 20 74  ests set FAILS t
2230: 6f 20 4e 4f 54 5f 53 54 41 52 54 45 44 20 69 66  o NOT_STARTED if
2240: 0a 20 20 20 20 3b 3b 20 2d 6b 65 65 70 67 6f 69  .    ;; -keepgoi
2250: 6e 67 20 69 73 20 73 70 65 63 69 66 69 65 64 0a  ng is specified.
2260: 20 20 20 20 28 69 66 20 28 65 71 3f 20 2a 70 61      (if (eq? *pa
2270: 73 73 6e 75 6d 2a 20 30 29 0a 09 28 62 65 67 69  ssnum* 0)..(begi
2280: 6e 0a 09 20 20 3b 3b 20 68 61 76 65 20 74 6f 20  n..  ;; have to 
2290: 64 65 6c 65 74 65 20 74 65 73 74 20 72 65 63 6f  delete test reco
22a0: 72 64 73 20 77 68 65 72 65 20 4e 4f 54 5f 53 54  rds where NOT_ST
22b0: 41 52 54 45 44 20 73 69 6e 63 65 20 74 68 65 79  ARTED since they
22c0: 20 63 61 6e 20 63 61 75 73 65 20 2d 6b 65 65 70   can cause -keep
22d0: 67 6f 69 6e 67 20 74 6f 20 0a 09 20 20 3b 3b 20  going to ..  ;; 
22e0: 67 65 74 20 73 74 75 63 6b 20 64 75 65 20 74 6f  get stuck due to
22f0: 20 62 65 63 6f 6d 69 6e 67 20 69 6e 61 63 63 65   becoming inacce
2300: 73 73 69 62 6c 65 20 66 72 6f 6d 20 61 20 66 61  ssible from a fa
2310: 69 6c 65 64 20 74 65 73 74 2e 20 49 2e 65 2e 20  iled test. I.e. 
2320: 69 66 20 74 65 73 74 20 42 20 64 65 70 65 6e 64  if test B depend
2330: 73 20 0a 09 20 20 3b 3b 20 6f 6e 20 74 65 73 74  s ..  ;; on test
2340: 20 41 20 62 75 74 20 74 65 73 74 20 42 20 72 65   A but test B re
2350: 61 63 68 65 64 20 74 68 65 20 70 6f 69 6e 74 20  ached the point 
2360: 6f 6e 20 62 65 69 6e 67 20 72 65 67 69 73 74 65  on being registe
2370: 72 65 64 20 61 73 20 4e 4f 54 5f 53 54 41 52 54  red as NOT_START
2380: 45 44 20 61 6e 64 20 74 65 73 74 0a 09 20 20 3b  ED and test..  ;
2390: 3b 20 41 20 66 61 69 6c 65 64 20 66 6f 72 20 73  ; A failed for s
23a0: 6f 6d 65 20 72 65 61 73 6f 6e 20 74 68 65 6e 20  ome reason then 
23b0: 6f 6e 20 72 65 2d 72 75 6e 20 75 73 69 6e 67 20  on re-run using 
23c0: 2d 6b 65 65 70 67 6f 69 6e 67 20 74 68 65 20 72  -keepgoing the r
23d0: 75 6e 20 63 61 6e 20 6e 65 76 65 72 20 63 6f 6d  un can never com
23e0: 70 6c 65 74 65 2e 0a 09 20 20 28 63 64 62 3a 64  plete...  (cdb:d
23f0: 65 6c 65 74 65 2d 74 65 73 74 73 2d 69 6e 2d 73  elete-tests-in-s
2400: 74 61 74 65 20 2a 72 75 6e 72 65 6d 6f 74 65 2a  tate *runremote*
2410: 20 72 75 6e 2d 69 64 20 22 4e 4f 54 5f 53 54 41   run-id "NOT_STA
2420: 52 54 45 44 22 29 0a 09 20 20 28 63 64 62 3a 72  RTED")..  (cdb:r
2430: 65 6d 6f 74 65 2d 72 75 6e 20 64 62 3a 73 65 74  emote-run db:set
2440: 2d 74 65 73 74 73 2d 73 74 61 74 65 2d 73 74 61  -tests-state-sta
2450: 74 75 73 20 23 66 20 72 75 6e 2d 69 64 20 74 65  tus #f run-id te
2460: 73 74 2d 6e 61 6d 65 73 20 23 66 20 22 46 41 49  st-names #f "FAI
2470: 4c 22 20 22 4e 4f 54 5f 53 54 41 52 54 45 44 22  L" "NOT_STARTED"
2480: 20 22 46 41 49 4c 22 29 29 29 0a 0a 20 20 20 20   "FAIL")))..    
2490: 3b 3b 20 66 72 6f 6d 20 68 65 72 65 20 6f 6e 20  ;; from here on 
24a0: 6f 75 74 20 74 68 65 20 64 62 20 77 69 6c 6c 20  out the db will 
24b0: 62 65 20 6f 70 65 6e 65 64 20 61 6e 64 20 63 6c  be opened and cl
24c0: 6f 73 65 64 20 6f 6e 20 65 76 65 72 79 20 63 61  osed on every ca
24d0: 6c 6c 20 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74  ll runs:run-test
24e0: 73 2d 71 75 65 75 65 0a 20 20 20 20 3b 3b 20 28  s-queue.    ;; (
24f0: 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65  sqlite3:finalize
2500: 21 20 64 62 29 20 0a 20 20 20 20 3b 3b 20 6e 6f  ! db) .    ;; no
2510: 77 20 61 64 64 20 6e 6f 6e 2d 64 69 72 65 63 74  w add non-direct
2520: 6c 79 20 72 65 66 65 72 65 6e 63 65 64 20 64 65  ly referenced de
2530: 70 65 6e 64 65 6e 63 69 65 73 20 28 69 2e 65 2e  pendencies (i.e.
2540: 20 77 61 69 74 6f 6e 29 0a 20 20 20 20 3b 3b 3d   waiton).    ;;=
2550: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
2560: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
2570: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
2580: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
2590: 3d 3d 3d 3d 3d 0a 20 20 20 20 3b 3b 20 72 65 66  =====.    ;; ref
25a0: 61 63 74 6f 72 69 6e 67 20 74 68 69 73 20 62 6c  actoring this bl
25b0: 6f 63 6b 20 69 6e 74 6f 20 74 65 73 74 73 3a 67  ock into tests:g
25c0: 65 74 2d 66 75 6c 6c 2d 64 61 74 61 0a 20 20 20  et-full-data.   
25d0: 20 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d   ;;=============
25e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
25f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
2600: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
2610: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 20 20 20 20 28 74  =========.    (t
2620: 65 73 74 73 3a 67 65 74 2d 66 75 6c 6c 2d 64 61  ests:get-full-da
2630: 74 61 20 74 65 73 74 2d 6e 61 6d 65 73 20 74 65  ta test-names te
2640: 73 74 2d 72 65 63 6f 72 64 73 20 72 65 71 75 69  st-records requi
2650: 72 65 64 2d 74 65 73 74 73 29 0a 0a 20 20 20 20  red-tests)..    
2660: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20  (if (not (null? 
2670: 72 65 71 75 69 72 65 64 2d 74 65 73 74 73 29 29  required-tests))
2680: 0a 09 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69  ..(debug:print-i
2690: 6e 66 6f 20 31 20 22 41 64 64 69 6e 67 20 22 20  nfo 1 "Adding " 
26a0: 72 65 71 75 69 72 65 64 2d 74 65 73 74 73 20 22  required-tests "
26b0: 20 74 6f 20 74 68 65 20 72 75 6e 20 71 75 65 75   to the run queu
26c0: 65 22 29 29 0a 20 20 20 20 3b 3b 20 4e 4f 54 45  e")).    ;; NOTE
26d0: 3a 20 74 68 65 73 65 20 61 72 65 20 61 6c 6c 20  : these are all 
26e0: 70 61 72 65 6e 74 20 74 65 73 74 73 2c 20 69 74  parent tests, it
26f0: 65 6d 73 20 61 72 65 20 6e 6f 74 20 65 78 70 61  ems are not expa
2700: 6e 64 65 64 20 79 65 74 2e 0a 20 20 20 20 28 64  nded yet..    (d
2710: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
2720: 34 20 22 74 65 73 74 2d 72 65 63 6f 72 64 73 3d  4 "test-records=
2730: 22 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61  " (hash-table->a
2740: 6c 69 73 74 20 74 65 73 74 2d 72 65 63 6f 72 64  list test-record
2750: 73 29 29 0a 20 20 20 20 28 72 75 6e 73 3a 72 75  s)).    (runs:ru
2760: 6e 2d 74 65 73 74 73 2d 71 75 65 75 65 20 72 75  n-tests-queue ru
2770: 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73  n-id runname tes
2780: 74 2d 72 65 63 6f 72 64 73 20 6b 65 79 76 61 6c  t-records keyval
2790: 6c 73 74 20 66 6c 61 67 73 20 74 65 73 74 2d 70  lst flags test-p
27a0: 61 74 74 73 29 0a 20 20 20 20 28 64 65 62 75 67  atts).    (debug
27b0: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 41  :print-info 4 "A
27c0: 6c 6c 20 64 6f 6e 65 20 62 79 20 68 65 72 65 22  ll done by here"
27d0: 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75  )))..(define (ru
27e0: 6e 73 3a 63 61 6c 63 2d 66 61 69 6c 73 20 70 72  ns:calc-fails pr
27f0: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 20  ereqs-not-met). 
2800: 20 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61   (filter (lambda
2810: 20 28 74 65 73 74 29 0a 09 20 20 20 20 28 61 6e   (test)..    (an
2820: 64 20 28 76 65 63 74 6f 72 3f 20 74 65 73 74 29  d (vector? test)
2830: 20 3b 3b 20 6e 6f 74 20 28 73 74 72 69 6e 67 3f   ;; not (string?
2840: 20 74 65 73 74 29 29 0a 09 09 20 28 65 71 75 61   test))... (equa
2850: 6c 3f 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  l? (db:test-get-
2860: 73 74 61 74 65 20 74 65 73 74 29 20 22 43 4f 4d  state test) "COM
2870: 50 4c 45 54 45 44 22 29 0a 09 09 20 28 6e 6f 74  PLETED")... (not
2880: 20 28 6d 65 6d 62 65 72 20 28 64 62 3a 74 65 73   (member (db:tes
2890: 74 2d 67 65 74 2d 73 74 61 74 75 73 20 74 65 73  t-get-status tes
28a0: 74 29 0a 09 09 09 20 20 20 20 20 20 27 28 22 50  t)....      '("P
28b0: 41 53 53 22 20 22 57 41 52 4e 22 20 22 43 48 45  ASS" "WARN" "CHE
28c0: 43 4b 22 20 22 57 41 49 56 45 44 22 20 22 53 4b  CK" "WAIVED" "SK
28d0: 49 50 22 29 29 29 29 29 0a 09 20 20 70 72 65 72  IP")))))..  prer
28e0: 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 0a 28  eqs-not-met))..(
28f0: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 63 61 6c  define (runs:cal
2900: 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 74 65 64 20  c-not-completed 
2910: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29  prereqs-not-met)
2920: 0a 20 20 28 66 69 6c 74 65 72 0a 20 20 20 28 6c  .  (filter.   (l
2930: 61 6d 62 64 61 20 28 74 29 0a 20 20 20 20 20 28  ambda (t).     (
2940: 6f 72 20 28 6e 6f 74 20 28 76 65 63 74 6f 72 3f  or (not (vector?
2950: 20 74 29 29 0a 09 20 28 6e 6f 74 20 28 65 71 75   t)).. (not (equ
2960: 61 6c 3f 20 22 43 4f 4d 50 4c 45 54 45 44 22 20  al? "COMPLETED" 
2970: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61  (db:test-get-sta
2980: 74 65 20 74 29 29 29 29 29 0a 20 20 20 70 72 65  te t))))).   pre
2990: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 0a  reqs-not-met))..
29a0: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 70 72  (define (runs:pr
29b0: 65 74 74 79 2d 73 74 72 69 6e 67 20 6c 73 74 29  etty-string lst)
29c0: 0a 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20  .  (map (lambda 
29d0: 28 74 29 0a 09 20 28 69 66 20 28 6e 6f 74 20 28  (t).. (if (not (
29e0: 76 65 63 74 6f 72 3f 20 74 29 29 0a 09 20 20 20  vector? t))..   
29f0: 20 20 28 63 6f 6e 63 20 74 29 0a 09 20 20 20 20    (conc t)..    
2a00: 20 28 63 6f 6e 63 20 28 64 62 3a 74 65 73 74 2d   (conc (db:test-
2a10: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 29 20  get-testname t) 
2a20: 22 3a 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74  ":" (db:test-get
2a30: 2d 73 74 61 74 65 20 74 29 20 22 2f 22 20 28 64  -state t) "/" (d
2a40: 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75  b:test-get-statu
2a50: 73 20 74 29 29 29 29 0a 20 20 20 20 20 20 20 6c  s t)))).       l
2a60: 73 74 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72  st))..(define (r
2a70: 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65  uns:make-full-te
2a80: 73 74 2d 6e 61 6d 65 20 74 65 73 74 6e 61 6d 65  st-name testname
2a90: 20 69 74 65 6d 70 61 74 68 29 0a 20 20 28 69 66   itempath).  (if
2aa0: 20 28 65 71 75 61 6c 3f 20 69 74 65 6d 70 61 74   (equal? itempat
2ab0: 68 20 22 22 29 20 74 65 73 74 6e 61 6d 65 20 28  h "") testname (
2ac0: 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f  conc testname "/
2ad0: 22 20 69 74 65 6d 70 61 74 68 29 29 29 0a 0a 3b  " itempath)))..;
2ae0: 3b 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 69  ; test-records i
2af0: 73 20 61 20 68 61 73 68 20 74 61 62 6c 65 20 74  s a hash table t
2b00: 65 73 74 6e 61 6d 65 3a 69 74 65 6d 5f 70 61 74  estname:item_pat
2b10: 68 20 3d 3e 20 76 65 63 74 6f 72 20 3c 20 74 65  h => vector < te
2b20: 73 74 6e 61 6d 65 20 74 65 73 74 63 6f 6e 66 69  stname testconfi
2b30: 67 20 77 61 69 74 6f 6e 73 20 70 72 69 6f 72 69  g waitons priori
2b40: 74 79 20 69 74 65 6d 73 2d 69 6e 66 6f 20 2e 2e  ty items-info ..
2b50: 2e 20 3e 0a 28 64 65 66 69 6e 65 20 28 72 75 6e  . >.(define (run
2b60: 73 3a 72 75 6e 2d 74 65 73 74 73 2d 71 75 65 75  s:run-tests-queu
2b70: 65 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65  e run-id runname
2b80: 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 6b 65   test-records ke
2b90: 79 76 61 6c 6c 73 74 20 66 6c 61 67 73 20 74 65  yvallst flags te
2ba0: 73 74 2d 70 61 74 74 73 29 0a 20 20 20 20 3b 3b  st-patts).    ;;
2bb0: 20 41 74 20 74 68 69 73 20 70 6f 69 6e 74 20 74   At this point t
2bc0: 68 65 20 6c 69 73 74 20 6f 66 20 70 61 72 65 6e  he list of paren
2bd0: 74 20 74 65 73 74 73 20 69 73 20 65 78 70 61 6e  t tests is expan
2be0: 64 65 64 20 0a 20 20 20 20 3b 3b 20 4e 42 2f 2f  ded .    ;; NB//
2bf0: 20 53 68 6f 75 6c 64 20 65 78 70 61 6e 64 20 69   Should expand i
2c00: 74 65 6d 73 20 68 65 72 65 20 61 6e 64 20 74 68  tems here and th
2c10: 65 6e 20 69 6e 73 65 72 74 20 69 6e 74 6f 20 74  en insert into t
2c20: 68 65 20 72 75 6e 20 71 75 65 75 65 2e 0a 20 20  he run queue..  
2c30: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 35 20 22  (debug:print 5 "
2c40: 74 65 73 74 2d 72 65 63 6f 72 64 73 3a 20 22 20  test-records: " 
2c50: 74 65 73 74 2d 72 65 63 6f 72 64 73 20 22 2c 20  test-records ", 
2c60: 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65 79  keyvallst: " key
2c70: 76 61 6c 6c 73 74 20 22 20 66 6c 61 67 73 3a 20  vallst " flags: 
2c80: 22 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61  " (hash-table->a
2c90: 6c 69 73 74 20 66 6c 61 67 73 29 29 0a 20 20 28  list flags)).  (
2ca0: 6c 65 74 20 28 28 73 6f 72 74 65 64 2d 74 65 73  let ((sorted-tes
2cb0: 74 2d 6e 61 6d 65 73 20 28 74 65 73 74 73 3a 73  t-names (tests:s
2cc0: 6f 72 74 2d 62 79 2d 70 72 69 6f 72 69 74 79 2d  ort-by-priority-
2cd0: 61 6e 64 2d 77 61 69 74 6f 6e 20 74 65 73 74 2d  and-waiton test-
2ce0: 72 65 63 6f 72 64 73 29 29 0a 09 28 74 65 73 74  records))..(test
2cf0: 2d 72 65 67 69 73 74 65 72 79 20 20 20 20 28 6d  -registery    (m
2d00: 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29  ake-hash-table))
2d10: 0a 09 28 72 65 67 69 73 74 65 72 79 2d 6d 75 74  ..(registery-mut
2d20: 65 78 20 20 20 28 6d 61 6b 65 2d 6d 75 74 65 78  ex   (make-mutex
2d30: 29 29 0a 09 28 6e 75 6d 2d 72 65 74 72 69 65 73  ))..(num-retries
2d40: 20 20 20 20 20 20 20 20 30 29 0a 09 28 6d 61 78          0)..(max
2d50: 2d 72 65 74 72 69 65 73 20 20 20 20 20 20 20 28  -retries       (
2d60: 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63  config-lookup *c
2d70: 6f 6e 66 69 67 64 61 74 2a 20 22 73 65 74 75 70  onfigdat* "setup
2d80: 22 20 22 6d 61 78 72 65 74 72 69 65 73 22 29 29  " "maxretries"))
2d90: 29 0a 20 20 20 20 28 73 65 74 21 20 6d 61 78 2d  ).    (set! max-
2da0: 72 65 74 72 69 65 73 20 28 69 66 20 28 61 6e 64  retries (if (and
2db0: 20 6d 61 78 2d 72 65 74 72 69 65 73 20 28 73 74   max-retries (st
2dc0: 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 61 78  ring->number max
2dd0: 2d 72 65 74 72 69 65 73 29 29 28 73 74 72 69 6e  -retries))(strin
2de0: 67 2d 3e 6e 75 6d 62 65 72 20 6d 61 78 2d 72 65  g->number max-re
2df0: 74 72 69 65 73 29 20 31 30 30 29 29 0a 20 20 20  tries) 100)).   
2e00: 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f   (if (not (null?
2e10: 20 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d   sorted-test-nam
2e20: 65 73 29 29 0a 09 28 6c 65 74 20 6c 6f 6f 70 20  es))..(let loop 
2e30: 28 28 68 65 64 20 20 20 20 20 20 20 20 20 28 63  ((hed         (c
2e40: 61 72 20 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e  ar sorted-test-n
2e50: 61 6d 65 73 29 29 0a 09 09 20 20 20 28 74 61 6c  ames))...   (tal
2e60: 20 20 20 20 20 20 20 20 20 28 63 64 72 20 73 6f           (cdr so
2e70: 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29  rted-test-names)
2e80: 29 0a 09 09 20 20 20 28 72 65 72 75 6e 73 20 20  )...   (reruns  
2e90: 20 20 20 20 27 28 29 29 29 0a 09 20 20 28 69 66      '()))..  (if
2ea0: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 72   (not (null? rer
2eb0: 75 6e 73 29 29 28 64 65 62 75 67 3a 70 72 69 6e  uns))(debug:prin
2ec0: 74 2d 69 6e 66 6f 20 34 20 22 72 65 72 75 6e 73  t-info 4 "reruns
2ed0: 3d 22 20 72 65 72 75 6e 73 29 29 0a 09 20 20 3b  =" reruns))..  ;
2ee0: 3b 20 28 70 72 69 6e 74 20 22 54 6f 70 20 6f 66  ; (print "Top of
2ef0: 20 6c 6f 6f 70 2c 20 68 65 64 3d 22 20 68 65 64   loop, hed=" hed
2f00: 20 22 2c 20 74 61 6c 3d 22 20 74 61 6c 20 22 20   ", tal=" tal " 
2f10: 2c 72 65 72 75 6e 73 3d 22 20 72 65 72 75 6e 73  ,reruns=" reruns
2f20: 29 0a 09 20 20 28 6c 65 74 2a 20 28 28 74 65 73  )..  (let* ((tes
2f30: 74 2d 72 65 63 6f 72 64 20 28 68 61 73 68 2d 74  t-record (hash-t
2f40: 61 62 6c 65 2d 72 65 66 20 74 65 73 74 2d 72 65  able-ref test-re
2f50: 63 6f 72 64 73 20 68 65 64 29 29 0a 09 09 20 28  cords hed))... (
2f60: 74 65 73 74 2d 6e 61 6d 65 20 20 20 28 74 65 73  test-name   (tes
2f70: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
2f80: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72  -testname test-r
2f90: 65 63 6f 72 64 29 29 0a 09 09 20 28 74 63 6f 6e  ecord))... (tcon
2fa0: 66 69 67 20 20 20 20 20 28 74 65 73 74 73 3a 74  fig     (tests:t
2fb0: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73  estqueue-get-tes
2fc0: 74 63 6f 6e 66 69 67 20 74 65 73 74 2d 72 65 63  tconfig test-rec
2fd0: 6f 72 64 29 29 0a 09 09 20 28 74 65 73 74 6d 6f  ord))... (testmo
2fe0: 64 65 20 20 20 20 28 6c 65 74 20 28 28 6d 20 28  de    (let ((m (
2ff0: 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 63  config-lookup tc
3000: 6f 6e 66 69 67 20 22 72 65 71 75 69 72 65 6d 65  onfig "requireme
3010: 6e 74 73 22 20 22 6d 6f 64 65 22 29 29 29 0a 09  nts" "mode")))..
3020: 09 09 09 28 69 66 20 6d 20 28 73 74 72 69 6e 67  ...(if m (string
3030: 2d 3e 73 79 6d 62 6f 6c 20 6d 29 20 27 6e 6f 72  ->symbol m) 'nor
3040: 6d 61 6c 29 29 29 0a 09 09 20 28 77 61 69 74 6f  mal)))... (waito
3050: 6e 73 20 20 20 20 20 28 74 65 73 74 73 3a 74 65  ns     (tests:te
3060: 73 74 71 75 65 75 65 2d 67 65 74 2d 77 61 69 74  stqueue-get-wait
3070: 6f 6e 73 20 20 20 20 74 65 73 74 2d 72 65 63 6f  ons    test-reco
3080: 72 64 29 29 0a 09 09 20 28 70 72 69 6f 72 69 74  rd))... (priorit
3090: 79 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74  y    (tests:test
30a0: 71 75 65 75 65 2d 67 65 74 2d 70 72 69 6f 72 69  queue-get-priori
30b0: 74 79 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64  ty   test-record
30c0: 29 29 0a 09 09 20 28 69 74 65 6d 64 61 74 20 20  ))... (itemdat  
30d0: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75     (tests:testqu
30e0: 65 75 65 2d 67 65 74 2d 69 74 65 6d 64 61 74 20  eue-get-itemdat 
30f0: 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29     test-record))
3100: 20 3b 3b 20 69 74 65 6d 64 61 74 20 63 61 6e 20   ;; itemdat can 
3110: 62 65 20 61 20 73 74 72 69 6e 67 2c 20 6c 69 73  be a string, lis
3120: 74 20 6f 72 20 23 66 0a 09 09 20 28 69 74 65 6d  t or #f... (item
3130: 73 20 20 20 20 20 20 20 28 74 65 73 74 73 3a 74  s       (tests:t
3140: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65  estqueue-get-ite
3150: 6d 73 20 20 20 20 20 20 74 65 73 74 2d 72 65 63  ms      test-rec
3160: 6f 72 64 29 29 0a 09 09 20 28 69 74 65 6d 2d 70  ord))... (item-p
3170: 61 74 68 20 20 20 28 69 74 65 6d 2d 6c 69 73 74  ath   (item-list
3180: 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74 29 29  ->path itemdat))
3190: 0a 09 09 20 28 6e 65 77 74 61 6c 20 20 20 20 20  ... (newtal     
31a0: 20 28 61 70 70 65 6e 64 20 74 61 6c 20 28 6c 69   (append tal (li
31b0: 73 74 20 68 65 64 29 29 29 29 0a 09 20 20 20 20  st hed))))..    
31c0: 0a 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ..    (debug:pri
31d0: 6e 74 20 36 0a 09 09 09 20 22 74 65 73 74 2d 6e  nt 6.... "test-n
31e0: 61 6d 65 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65  ame: " test-name
31f0: 0a 09 09 09 20 22 5c 6e 20 20 68 65 64 3a 20 20  .... "\n  hed:  
3200: 20 20 20 20 20 20 20 22 20 68 65 64 0a 09 09 09         " hed....
3210: 20 22 5c 6e 20 20 69 74 65 6d 64 61 74 3a 20 20   "\n  itemdat:  
3220: 20 20 20 22 20 69 74 65 6d 64 61 74 0a 09 09 09     " itemdat....
3230: 20 22 5c 6e 20 20 69 74 65 6d 73 3a 20 20 20 20   "\n  items:    
3240: 20 20 20 22 20 69 74 65 6d 73 0a 09 09 09 20 22     " items.... "
3250: 5c 6e 20 20 69 74 65 6d 2d 70 61 74 68 3a 20 20  \n  item-path:  
3260: 20 22 20 69 74 65 6d 2d 70 61 74 68 0a 09 09 09   " item-path....
3270: 20 22 5c 6e 20 20 77 61 69 74 6f 6e 73 3a 20 20   "\n  waitons:  
3280: 20 20 20 22 20 77 61 69 74 6f 6e 73 0a 09 09 09     " waitons....
3290: 20 22 5c 6e 20 20 6e 75 6d 2d 72 65 74 72 69 65   "\n  num-retrie
32a0: 73 3a 20 22 20 6e 75 6d 2d 72 65 74 72 69 65 73  s: " num-retries
32b0: 0a 09 09 09 20 22 5c 6e 20 20 74 61 6c 3a 20 20  .... "\n  tal:  
32c0: 20 20 20 20 20 20 20 22 20 74 61 6c 0a 09 09 09         " tal....
32d0: 20 22 5c 6e 20 20 72 65 72 75 6e 73 3a 20 20 20   "\n  reruns:   
32e0: 20 20 20 22 20 72 65 72 75 6e 73 29 0a 0a 09 20     " reruns)... 
32f0: 20 20 20 3b 3b 20 63 68 65 63 6b 20 66 6f 72 20     ;; check for 
3300: 68 65 64 20 69 6e 20 77 61 69 74 6f 6e 73 20 3d  hed in waitons =
3310: 3e 20 74 68 69 73 20 77 6f 75 6c 64 20 62 65 20  > this would be 
3320: 63 69 72 63 75 6c 61 72 2c 20 72 65 6d 6f 76 65  circular, remove
3330: 20 69 74 20 61 6e 64 20 69 73 73 75 65 20 61 6e   it and issue an
3340: 0a 09 20 20 20 20 3b 3b 20 65 72 72 6f 72 0a 09  ..    ;; error..
3350: 20 20 20 20 28 69 66 20 28 6d 65 6d 62 65 72 20      (if (member 
3360: 74 65 73 74 2d 6e 61 6d 65 20 77 61 69 74 6f 6e  test-name waiton
3370: 73 29 0a 09 09 28 62 65 67 69 6e 0a 09 09 20 20  s)...(begin...  
3380: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
3390: 45 52 52 4f 52 3a 20 74 65 73 74 20 22 20 74 65  ERROR: test " te
33a0: 73 74 2d 6e 61 6d 65 20 22 20 68 61 73 20 6c 69  st-name " has li
33b0: 73 74 65 64 20 69 74 73 65 6c 66 20 61 73 20 61  sted itself as a
33c0: 20 77 61 69 74 6f 6e 2c 20 70 6c 65 61 73 65 20   waiton, please 
33d0: 63 6f 72 72 65 63 74 20 74 68 69 73 21 22 29 0a  correct this!").
33e0: 09 09 20 20 28 73 65 74 21 20 77 61 69 74 6f 6e  ..  (set! waiton
33f0: 20 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61   (filter (lambda
3400: 20 28 78 29 28 6e 6f 74 20 28 65 71 75 61 6c 3f   (x)(not (equal?
3410: 20 78 20 68 65 64 29 29 29 20 77 61 69 74 6f 6e   x hed))) waiton
3420: 73 29 29 29 29 0a 0a 09 20 20 20 20 28 63 6f 6e  s))))...    (con
3430: 64 20 3b 3b 20 4f 55 54 45 52 20 43 4f 4e 44 0a  d ;; OUTER COND.
3440: 09 20 20 20 20 20 28 28 6e 6f 74 20 69 74 65 6d  .     ((not item
3450: 73 29 20 3b 3b 20 77 68 65 6e 20 66 61 6c 73 65  s) ;; when false
3460: 20 74 68 65 20 74 65 73 74 20 69 73 20 6f 6b 20   the test is ok 
3470: 74 6f 20 62 65 20 68 61 6e 64 65 64 20 6f 66 66  to be handed off
3480: 20 74 6f 20 6c 61 75 6e 63 68 20 28 62 75 74 20   to launch (but 
3490: 6e 6f 74 20 62 65 66 6f 72 65 29 0a 09 20 20 20  not before)..   
34a0: 20 20 20 28 6c 65 74 2a 20 28 28 72 75 6e 2d 6c     (let* ((run-l
34b0: 69 6d 69 74 73 2d 69 6e 66 6f 20 20 20 20 20 20  imits-info      
34c0: 20 20 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e     (runs:can-run
34d0: 2d 6d 6f 72 65 2d 74 65 73 74 73 20 74 65 73 74  -more-tests test
34e0: 2d 72 65 63 6f 72 64 29 29 20 3b 3b 20 6c 6f 6f  -record)) ;; loo
34f0: 6b 20 61 74 20 74 68 65 20 74 65 73 74 20 6a 6f  k at the test jo
3500: 62 67 72 6f 75 70 20 61 6e 64 20 74 6f 74 20 6a  bgroup and tot j
3510: 6f 62 73 20 72 75 6e 6e 69 6e 67 0a 09 09 20 20  obs running...  
3520: 20 20 20 28 68 61 76 65 2d 72 65 73 6f 75 72 63     (have-resourc
3530: 65 73 20 20 20 20 20 20 20 20 20 20 28 63 61 72  es          (car
3540: 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f   run-limits-info
3550: 29 29 0a 09 09 20 20 20 20 20 28 6e 75 6d 2d 72  ))...     (num-r
3560: 75 6e 6e 69 6e 67 20 20 20 20 20 20 20 20 20 20  unning          
3570: 20 20 20 28 6c 69 73 74 2d 72 65 66 20 72 75 6e     (list-ref run
3580: 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 31 29 29  -limits-info 1))
3590: 0a 09 09 20 20 20 20 20 28 6e 75 6d 2d 72 75 6e  ...     (num-run
35a0: 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70  ning-in-jobgroup
35b0: 20 28 6c 69 73 74 2d 72 65 66 20 72 75 6e 2d 6c   (list-ref run-l
35c0: 69 6d 69 74 73 2d 69 6e 66 6f 20 32 29 29 0a 09  imits-info 2))..
35d0: 09 20 20 20 20 20 28 6d 61 78 2d 63 6f 6e 63 75  .     (max-concu
35e0: 72 72 65 6e 74 2d 6a 6f 62 73 20 20 20 20 20 28  rrent-jobs     (
35f0: 6c 69 73 74 2d 72 65 66 20 72 75 6e 2d 6c 69 6d  list-ref run-lim
3600: 69 74 73 2d 69 6e 66 6f 20 33 29 29 0a 09 09 20  its-info 3))... 
3610: 20 20 20 20 28 6a 6f 62 2d 67 72 6f 75 70 2d 6c      (job-group-l
3620: 69 6d 69 74 20 20 20 20 20 20 20 20 20 28 6c 69  imit         (li
3630: 73 74 2d 72 65 66 20 72 75 6e 2d 6c 69 6d 69 74  st-ref run-limit
3640: 73 2d 69 6e 66 6f 20 34 29 29 0a 09 09 20 20 20  s-info 4))...   
3650: 20 20 28 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d    (prereqs-not-m
3660: 65 74 20 20 20 20 20 20 20 20 20 28 63 64 62 3a  et         (cdb:
3670: 72 65 6d 6f 74 65 2d 72 75 6e 20 64 62 3a 67 65  remote-run db:ge
3680: 74 2d 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65  t-prereqs-not-me
3690: 74 20 23 66 20 72 75 6e 2d 69 64 20 77 61 69 74  t #f run-id wait
36a0: 6f 6e 73 20 69 74 65 6d 2d 70 61 74 68 20 6d 6f  ons item-path mo
36b0: 64 65 3a 20 74 65 73 74 6d 6f 64 65 29 29 0a 09  de: testmode))..
36c0: 09 20 20 20 20 20 28 66 61 69 6c 73 20 20 20 20  .     (fails    
36d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28                 (
36e0: 72 75 6e 73 3a 63 61 6c 63 2d 66 61 69 6c 73 20  runs:calc-fails 
36f0: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29  prereqs-not-met)
3700: 29 0a 09 09 20 20 20 20 20 28 6e 6f 6e 2d 63 6f  )...     (non-co
3710: 6d 70 6c 65 74 65 64 20 20 20 20 20 20 20 20 20  mpleted         
3720: 20 20 28 72 75 6e 73 3a 63 61 6c 63 2d 6e 6f 74    (runs:calc-not
3730: 2d 63 6f 6d 70 6c 65 74 65 64 20 70 72 65 72 65  -completed prere
3740: 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a 09 09  qs-not-met)))...
3750: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
3760: 6f 20 38 20 22 68 61 76 65 2d 72 65 73 6f 75 72  o 8 "have-resour
3770: 63 65 73 3a 20 22 20 68 61 76 65 2d 72 65 73 6f  ces: " have-reso
3780: 75 72 63 65 73 20 22 20 70 72 65 72 65 71 73 2d  urces " prereqs-
3790: 6e 6f 74 2d 6d 65 74 3a 20 22 20 0a 09 09 09 20  not-met: " .... 
37a0: 20 20 20 20 28 73 74 72 69 6e 67 2d 69 6e 74 65      (string-inte
37b0: 72 73 70 65 72 73 65 20 0a 09 09 09 20 20 20 20  rsperse ....    
37c0: 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28    (map (lambda (
37d0: 74 29 0a 09 09 09 09 20 20 20 20 20 28 69 66 20  t).....     (if 
37e0: 28 76 65 63 74 6f 72 3f 20 74 29 0a 09 09 09 09  (vector? t).....
37f0: 09 20 28 63 6f 6e 63 20 28 64 62 3a 74 65 73 74  . (conc (db:test
3800: 2d 67 65 74 2d 73 74 61 74 65 20 74 29 20 22 2f  -get-state t) "/
3810: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73  " (db:test-get-s
3820: 74 61 74 75 73 20 74 29 29 0a 09 09 09 09 09 20  tatus t))...... 
3830: 28 63 6f 6e 63 20 22 20 57 41 52 4e 49 4e 47 3a  (conc " WARNING:
3840: 20 74 20 69 73 20 6e 6f 74 20 61 20 76 65 63 74   t is not a vect
3850: 6f 72 3d 22 20 74 20 29 29 29 0a 09 09 09 09 20  or=" t )))..... 
3860: 20 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65    prereqs-not-me
3870: 74 29 20 22 2c 20 22 29 20 22 20 66 61 69 6c 73  t) ", ") " fails
3880: 3a 20 22 20 66 61 69 6c 73 29 0a 09 09 28 64 65  : " fails)...(de
3890: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34  bug:print-info 4
38a0: 20 22 68 65 64 3d 22 20 68 65 64 20 22 5c 6e 20   "hed=" hed "\n 
38b0: 20 74 65 73 74 2d 72 65 63 6f 72 64 3d 22 20 74   test-record=" t
38c0: 65 73 74 2d 72 65 63 6f 72 64 20 22 5c 6e 20 20  est-record "\n  
38d0: 74 65 73 74 2d 6e 61 6d 65 3a 20 22 20 74 65 73  test-name: " tes
38e0: 74 2d 6e 61 6d 65 20 22 5c 6e 20 20 69 74 65 6d  t-name "\n  item
38f0: 2d 70 61 74 68 3a 20 22 20 69 74 65 6d 2d 70 61  -path: " item-pa
3900: 74 68 20 22 5c 6e 20 20 74 65 73 74 2d 70 61 74  th "\n  test-pat
3910: 74 73 3a 20 22 20 74 65 73 74 2d 70 61 74 74 73  ts: " test-patts
3920: 29 0a 0a 09 09 3b 3b 20 44 6f 6e 27 74 20 6b 6e  )....;; Don't kn
3930: 6f 77 20 61 74 20 74 68 69 73 20 74 69 6d 65 20  ow at this time 
3940: 69 66 20 74 68 65 20 74 65 73 74 20 68 61 76 65  if the test have
3950: 20 62 65 65 6e 20 6c 61 75 6e 63 68 65 64 20 61   been launched a
3960: 74 20 73 6f 6d 65 20 74 69 6d 65 20 69 6e 20 74  t some time in t
3970: 68 65 20 70 61 73 74 0a 09 09 3b 3b 20 69 2e 65  he past...;; i.e
3980: 2e 20 69 73 20 74 68 69 73 20 61 20 72 65 2d 6c  . is this a re-l
3990: 61 75 6e 63 68 3f 0a 09 09 28 64 65 62 75 67 3a  aunch?...(debug:
39a0: 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 72 75  print-info 4 "ru
39b0: 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 3d 20  n-limits-info = 
39c0: 22 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66  " run-limits-inf
39d0: 6f 29 0a 09 09 28 63 6f 6e 64 20 3b 3b 20 49 4e  o)...(cond ;; IN
39e0: 4e 45 52 20 43 4f 4e 44 20 23 31 20 66 6f 72 20  NER COND #1 for 
39f0: 61 20 6c 61 75 6e 63 68 61 62 6c 65 20 74 65 73  a launchable tes
3a00: 74 0a 09 09 20 3b 3b 20 43 68 65 63 6b 20 69 74  t... ;; Check it
3a10: 65 6d 20 70 61 74 68 20 61 67 61 69 6e 73 74 20  em path against 
3a20: 69 74 65 6d 2d 70 61 74 74 73 0a 09 09 20 28 28  item-patts... ((
3a30: 6e 6f 74 20 28 74 65 73 74 73 3a 6d 61 74 63 68  not (tests:match
3a40: 20 74 65 73 74 2d 70 61 74 74 73 20 28 74 65 73   test-patts (tes
3a50: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
3a60: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72  -testname test-r
3a70: 65 63 6f 72 64 29 20 69 74 65 6d 2d 70 61 74 68  ecord) item-path
3a80: 29 29 20 3b 3b 20 54 68 69 73 20 74 65 73 74 2f  )) ;; This test/
3a90: 69 74 65 6d 70 61 74 68 20 69 73 20 6e 6f 74 20  itempath is not 
3aa0: 74 6f 20 62 65 20 72 75 6e 0a 09 09 20 20 3b 3b  to be run...  ;;
3ab0: 20 65 6c 73 65 20 74 68 65 20 72 75 6e 20 69 73   else the run is
3ac0: 20 73 74 75 63 6b 2c 20 74 65 6d 70 6f 72 61 72   stuck, temporar
3ad0: 69 6c 79 20 6f 72 20 70 65 72 6d 61 6e 65 6e 74  ily or permanent
3ae0: 6c 79 0a 09 09 20 20 3b 3b 20 62 75 74 20 73 68  ly...  ;; but sh
3af0: 6f 75 6c 64 20 63 68 65 63 6b 20 69 66 20 69 74  ould check if it
3b00: 20 69 73 20 64 75 65 20 74 6f 20 6c 61 63 6b 20   is due to lack 
3b10: 6f 66 20 72 65 73 6f 75 72 63 65 73 20 76 73 2e  of resources vs.
3b20: 20 70 72 65 72 65 71 75 69 73 69 74 65 73 0a 09   prerequisites..
3b30: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d  .  (debug:print-
3b40: 69 6e 66 6f 20 31 20 22 53 6b 69 70 70 69 6e 67  info 1 "Skipping
3b50: 20 22 20 28 74 65 73 74 73 3a 74 65 73 74 71 75   " (tests:testqu
3b60: 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65  eue-get-testname
3b70: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 20 22 20   test-record) " 
3b80: 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20 61 73  " item-path " as
3b90: 20 69 74 20 64 6f 65 73 6e 27 74 20 6d 61 74 63   it doesn't matc
3ba0: 68 20 22 20 74 65 73 74 2d 70 61 74 74 73 29 0a  h " test-patts).
3bb0: 09 09 20 20 3b 3b 20 28 74 68 72 65 61 64 2d 73  ..  ;; (thread-s
3bc0: 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65  leep! *global-de
3bd0: 6c 74 61 2a 29 0a 09 09 20 20 28 69 66 20 28 6e  lta*)...  (if (n
3be0: 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a  ot (null? tal)).
3bf0: 09 09 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63  ..      (loop (c
3c00: 61 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29  ar tal)(cdr tal)
3c10: 20 72 65 72 75 6e 73 29 29 29 0a 09 09 20 3b 3b   reruns)))... ;;
3c20: 20 52 65 67 69 73 74 65 72 79 20 68 61 73 20 62   Registery has b
3c30: 65 65 6e 20 73 74 61 72 74 65 64 20 66 6f 72 20  een started for 
3c40: 74 68 69 73 20 74 65 73 74 20 62 75 74 20 68 61  this test but ha
3c50: 73 20 6e 6f 74 20 79 65 74 20 63 6f 6d 70 6c 65  s not yet comple
3c60: 74 65 64 0a 09 09 20 3b 3b 20 74 68 69 73 20 73  ted... ;; this s
3c70: 68 6f 75 6c 64 20 62 65 20 72 61 72 65 2c 20 74  hould be rare, t
3c80: 68 65 20 63 61 73 65 20 77 68 65 72 65 20 74 68  he case where th
3c90: 65 72 65 20 61 72 65 20 6f 6e 6c 79 20 61 20 63  ere are only a c
3ca0: 6f 75 70 6c 65 20 6f 66 20 74 65 73 74 73 20 61  ouple of tests a
3cb0: 6e 64 20 74 68 65 20 64 62 20 69 73 20 73 6c 6f  nd the db is slo
3cc0: 77 0a 09 09 20 3b 3b 20 64 65 6c 61 79 20 61 20  w... ;; delay a 
3cd0: 73 68 6f 72 74 20 77 68 69 6c 65 20 61 6e 64 20  short while and 
3ce0: 63 6f 6e 74 69 6e 75 65 0a 09 09 20 3b 3b 20 28  continue... ;; (
3cf0: 28 65 71 3f 20 28 68 61 73 68 2d 74 61 62 6c 65  (eq? (hash-table
3d00: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 74 65 73  -ref/default tes
3d10: 74 2d 72 65 67 69 73 74 65 72 79 20 28 72 75 6e  t-registery (run
3d20: 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 73 74  s:make-full-test
3d30: 2d 6e 61 6d 65 20 74 65 73 74 2d 6e 61 6d 65 20  -name test-name 
3d40: 69 74 65 6d 2d 70 61 74 68 29 20 23 66 29 20 27  item-path) #f) '
3d50: 73 74 61 72 74 29 0a 09 09 20 3b 3b 20 20 28 74  start)... ;;  (t
3d60: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 30 2e 30  hread-sleep! 0.0
3d70: 31 29 0a 09 09 20 3b 3b 20 20 28 6c 6f 6f 70 20  1)... ;;  (loop 
3d80: 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72  (car newtal)(cdr
3d90: 20 6e 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29   newtal) reruns)
3da0: 29 0a 09 09 20 3b 3b 20 63 6f 75 6e 74 20 6e 75  )... ;; count nu
3db0: 6d 62 65 72 20 6f 66 20 27 64 6f 6e 65 2c 20 69  mber of 'done, i
3dc0: 66 20 6d 6f 72 65 20 74 68 61 6e 20 31 30 30 20  f more than 100 
3dd0: 74 68 65 6e 20 73 6b 69 70 20 6f 6e 20 74 68 72  then skip on thr
3de0: 6f 75 67 68 2e 0a 09 09 20 28 3b 3b 20 28 61 6e  ough.... (;; (an
3df0: 64 20 28 3c 20 28 6c 65 6e 67 74 68 20 28 66 69  d (< (length (fi
3e00: 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29  lter (lambda (x)
3e10: 28 65 71 3f 20 78 20 27 64 6f 6e 65 29 29 28 68  (eq? x 'done))(h
3e20: 61 73 68 2d 74 61 62 6c 65 2d 76 61 6c 75 65 73  ash-table-values
3e30: 20 74 65 73 74 2d 72 65 67 69 73 74 65 72 79 29   test-registery)
3e40: 29 29 20 31 30 30 29 20 3b 3b 20 77 68 79 20 67  )) 100) ;; why g
3e50: 65 74 20 6d 6f 72 65 20 74 68 61 6e 20 32 30 30  et more than 200
3e60: 20 61 68 65 61 64 3f 0a 09 09 20 20 28 6e 6f 74   ahead?...  (not
3e70: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66   (hash-table-ref
3e80: 2f 64 65 66 61 75 6c 74 20 74 65 73 74 2d 72 65  /default test-re
3e90: 67 69 73 74 65 72 79 20 28 72 75 6e 73 3a 6d 61  gistery (runs:ma
3ea0: 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d  ke-full-test-nam
3eb0: 65 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d  e test-name item
3ec0: 2d 70 61 74 68 29 20 23 66 29 29 20 3b 3b 20 29  -path) #f)) ;; )
3ed0: 20 3b 3b 20 74 6f 6f 20 6d 61 6e 79 20 63 68 61   ;; too many cha
3ee0: 6e 67 65 73 20 72 65 71 75 69 72 65 64 2e 20 49  nges required. I
3ef0: 6d 70 6c 65 6d 65 6e 74 20 6c 61 74 65 72 2e 0a  mplement later..
3f00: 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ..  (debug:print
3f10: 2d 69 6e 66 6f 20 34 20 22 50 72 65 2d 72 65 67  -info 4 "Pre-reg
3f20: 69 73 74 65 72 69 6e 67 20 74 65 73 74 20 22 20  istering test " 
3f30: 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74  test-name "/" it
3f40: 65 6d 2d 70 61 74 68 20 22 20 74 6f 20 63 72 65  em-path " to cre
3f50: 61 74 65 20 70 6c 61 63 65 68 6f 6c 64 65 72 22  ate placeholder"
3f60: 20 29 0a 09 09 20 20 3b 3b 20 4e 45 45 44 20 54   )...  ;; NEED T
3f70: 4f 20 54 48 52 45 41 44 49 46 59 20 54 48 49 53  O THREADIFY THIS
3f80: 0a 09 09 20 20 28 6c 65 74 20 28 28 74 68 20 28  ...  (let ((th (
3f90: 6d 61 6b 65 2d 74 68 72 65 61 64 20 28 6c 61 6d  make-thread (lam
3fa0: 62 64 61 20 28 29 0a 09 09 20 20 20 20 20 20 20  bda ()...       
3fb0: 20 09 09 20 20 20 28 6d 75 74 65 78 2d 6c 6f 63   ..   (mutex-loc
3fc0: 6b 21 20 72 65 67 69 73 74 65 72 79 2d 6d 75 74  k! registery-mut
3fd0: 65 78 29 0a 09 09 20 20 20 20 20 20 20 20 09 09  ex)...        ..
3fe0: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73     (hash-table-s
3ff0: 65 74 21 20 74 65 73 74 2d 72 65 67 69 73 74 65  et! test-registe
4000: 72 79 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75  ry (runs:make-fu
4010: 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 73  ll-test-name tes
4020: 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68  t-name item-path
4030: 29 20 27 73 74 61 72 74 29 0a 09 09 20 20 20 20  ) 'start)...    
4040: 20 20 20 20 09 09 20 20 20 28 6d 75 74 65 78 2d      ..   (mutex-
4050: 75 6e 6c 6f 63 6b 21 20 72 65 67 69 73 74 65 72  unlock! register
4060: 79 2d 6d 75 74 65 78 29 0a 09 09 09 09 09 20 20  y-mutex)......  
4070: 20 3b 3b 20 49 66 20 68 61 76 65 6e 27 74 20 64   ;; If haven't d
4080: 6f 6e 65 20 69 74 20 62 65 66 6f 72 65 20 72 65  one it before re
4090: 67 69 73 74 65 72 20 61 20 74 6f 70 20 6c 65 76  gister a top lev
40a0: 65 6c 20 74 65 73 74 20 69 66 20 74 68 69 73 20  el test if this 
40b0: 69 73 20 61 6e 20 69 74 65 6d 69 7a 65 64 20 74  is an itemized t
40c0: 65 73 74 0a 09 09 09 09 09 20 20 20 28 69 66 20  est......   (if 
40d0: 28 6e 6f 74 20 28 65 71 3f 20 28 68 61 73 68 2d  (not (eq? (hash-
40e0: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c  table-ref/defaul
40f0: 74 20 74 65 73 74 2d 72 65 67 69 73 74 65 72 79  t test-registery
4100: 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c   (runs:make-full
4110: 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d  -test-name test-
4120: 6e 61 6d 65 20 22 22 29 20 23 66 29 20 27 64 6f  name "") #f) 'do
4130: 6e 65 29 29 0a 09 09 09 09 09 20 20 20 20 20 20  ne))......      
4140: 20 28 63 64 62 3a 74 65 73 74 73 2d 72 65 67 69   (cdb:tests-regi
4150: 73 74 65 72 2d 74 65 73 74 20 2a 72 75 6e 72 65  ster-test *runre
4160: 6d 6f 74 65 2a 20 72 75 6e 2d 69 64 20 74 65 73  mote* run-id tes
4170: 74 2d 6e 61 6d 65 20 22 22 29 29 0a 09 09 09 09  t-name "")).....
4180: 09 20 20 20 28 63 64 62 3a 74 65 73 74 73 2d 72  .   (cdb:tests-r
4190: 65 67 69 73 74 65 72 2d 74 65 73 74 20 2a 72 75  egister-test *ru
41a0: 6e 72 65 6d 6f 74 65 2a 20 72 75 6e 2d 69 64 20  nremote* run-id 
41b0: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70  test-name item-p
41c0: 61 74 68 29 0a 09 09 20 20 20 20 20 20 20 20 09  ath)...        .
41d0: 09 20 20 20 28 6d 75 74 65 78 2d 6c 6f 63 6b 21  .   (mutex-lock!
41e0: 20 72 65 67 69 73 74 65 72 79 2d 6d 75 74 65 78   registery-mutex
41f0: 29 0a 09 09 09 09 09 20 20 20 28 68 61 73 68 2d  )......   (hash-
4200: 74 61 62 6c 65 2d 73 65 74 21 20 74 65 73 74 2d  table-set! test-
4210: 72 65 67 69 73 74 65 72 79 20 28 72 75 6e 73 3a  registery (runs:
4220: 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e  make-full-test-n
4230: 61 6d 65 20 74 65 73 74 2d 6e 61 6d 65 20 69 74  ame test-name it
4240: 65 6d 2d 70 61 74 68 29 20 27 64 6f 6e 65 29 0a  em-path) 'done).
4250: 09 09 20 20 20 20 20 20 20 20 09 09 20 20 20 28  ..        ..   (
4260: 6d 75 74 65 78 2d 75 6e 6c 6f 63 6b 21 20 72 65  mutex-unlock! re
4270: 67 69 73 74 65 72 79 2d 6d 75 74 65 78 29 29 0a  gistery-mutex)).
4280: 09 09 20 20 20 20 20 20 20 20 09 09 20 28 63 6f  ..        .. (co
4290: 6e 63 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22  nc test-name "/"
42a0: 20 69 74 65 6d 2d 70 61 74 68 29 29 29 29 0a 09   item-path))))..
42b0: 09 20 20 20 20 28 74 68 72 65 61 64 2d 73 74 61  .    (thread-sta
42c0: 72 74 21 20 74 68 29 29 0a 09 09 20 20 28 74 68  rt! th))...  (th
42d0: 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f  read-sleep! *glo
42e0: 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 20 20  bal-delta*)...  
42f0: 28 72 75 6e 73 3a 73 68 72 69 6e 6b 2d 63 61 6e  (runs:shrink-can
4300: 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d  -run-more-tests-
4310: 64 65 6c 61 79 29 20 20 20 3b 3b 20 44 45 4c 41  delay)   ;; DELA
4320: 59 20 54 57 45 41 4b 45 52 20 28 73 74 69 6c 6c  Y TWEAKER (still
4330: 20 6e 65 65 64 65 64 3f 29 0a 09 09 20 20 28 6c   needed?)...  (l
4340: 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61 6c 29  oop (car newtal)
4350: 28 63 64 72 20 6e 65 77 74 61 6c 29 20 72 65 72  (cdr newtal) rer
4360: 75 6e 73 29 29 0a 09 09 20 3b 3b 20 41 74 20 74  uns))... ;; At t
4370: 68 69 73 20 70 6f 69 6e 74 20 2a 61 6c 6c 2a 20  his point *all* 
4380: 74 65 73 74 20 72 65 67 69 73 74 72 61 74 69 6f  test registratio
4390: 6e 73 20 6d 75 73 74 20 62 65 20 63 6f 6d 70 6c  ns must be compl
43a0: 65 74 65 64 2e 0a 09 09 20 28 28 6e 6f 74 20 28  eted.... ((not (
43b0: 6e 75 6c 6c 3f 20 28 66 69 6c 74 65 72 20 28 6c  null? (filter (l
43c0: 61 6d 62 64 61 20 28 78 29 28 65 71 3f 20 27 73  ambda (x)(eq? 's
43d0: 74 61 72 74 20 78 29 29 28 68 61 73 68 2d 74 61  tart x))(hash-ta
43e0: 62 6c 65 2d 76 61 6c 75 65 73 20 74 65 73 74 2d  ble-values test-
43f0: 72 65 67 69 73 74 65 72 79 29 29 29 29 0a 09 09  registery))))...
4400: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69    (debug:print-i
4410: 6e 66 6f 20 30 20 22 57 61 69 74 69 6e 67 20 6f  nfo 0 "Waiting o
4420: 6e 20 74 65 73 74 20 72 65 67 69 73 74 72 61 74  n test registrat
4430: 69 6f 6e 73 3a 20 22 20 28 73 74 72 69 6e 67 2d  ions: " (string-
4440: 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09 09 09  intersperse ....
4450: 09 09 09 09 09 09 20 28 66 69 6c 74 65 72 20 28  ...... (filter (
4460: 6c 61 6d 62 64 61 20 28 78 29 0a 09 09 09 09 09  lambda (x)......
4470: 09 09 09 09 09 20 20 20 28 65 71 3f 20 28 68 61  .....   (eq? (ha
4480: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66  sh-table-ref/def
4490: 61 75 6c 74 20 74 65 73 74 2d 72 65 67 69 73 74  ault test-regist
44a0: 65 72 79 20 78 20 23 66 29 20 27 73 74 61 72 74  ery x #f) 'start
44b0: 29 29 0a 09 09 09 09 09 09 09 09 09 09 20 28 68  ))........... (h
44c0: 61 73 68 2d 74 61 62 6c 65 2d 6b 65 79 73 20 74  ash-table-keys t
44d0: 65 73 74 2d 72 65 67 69 73 74 65 72 79 29 29 0a  est-registery)).
44e0: 09 09 09 09 09 09 09 09 09 20 22 2c 20 22 29 29  ......... ", "))
44f0: 0a 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65  ...  (thread-sle
4500: 65 70 21 20 30 2e 31 29 0a 09 09 20 20 28 6c 6f  ep! 0.1)...  (lo
4510: 6f 70 20 68 65 64 20 74 61 6c 20 72 65 72 75 6e  op hed tal rerun
4520: 73 29 29 0a 09 09 20 28 28 6e 6f 74 20 68 61 76  s))... ((not hav
4530: 65 2d 72 65 73 6f 75 72 63 65 73 29 20 3b 3b 20  e-resources) ;; 
4540: 73 69 6d 70 6c 79 20 74 72 79 20 61 67 61 69 6e  simply try again
4550: 20 61 66 74 65 72 20 77 61 69 74 69 6e 67 20 61   after waiting a
4560: 20 73 65 63 6f 6e 64 0a 09 09 20 20 28 64 65 62   second...  (deb
4570: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20  ug:print-info 1 
4580: 22 6e 6f 20 72 65 73 6f 75 72 63 65 73 20 74 6f  "no resources to
4590: 20 72 75 6e 20 6e 65 77 20 74 65 73 74 73 2c 20   run new tests, 
45a0: 77 61 69 74 69 6e 67 20 2e 2e 2e 22 29 0a 09 09  waiting ...")...
45b0: 20 20 3b 3b 20 48 61 76 65 20 67 6f 6e 65 20 62    ;; Have gone b
45c0: 61 63 6b 20 61 6e 64 20 66 6f 72 74 68 20 6f 6e  ack and forth on
45d0: 20 74 68 69 73 20 62 75 74 20 64 62 20 73 74 61   this but db sta
45e0: 72 76 61 74 69 6f 6e 20 69 73 20 61 6e 20 69 73  rvation is an is
45f0: 73 75 65 2e 0a 09 09 20 20 3b 3b 20 77 61 69 74  sue....  ;; wait
4600: 20 6f 6e 65 20 73 65 63 6f 6e 64 20 62 65 66 6f   one second befo
4610: 72 65 20 6c 6f 6f 6b 69 6e 67 20 61 67 61 69 6e  re looking again
4620: 20 74 6f 20 72 75 6e 20 6a 6f 62 73 2e 0a 09 09   to run jobs....
4630: 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21    (thread-sleep!
4640: 20 31 29 20 3b 3b 20 28 2b 20 32 20 2a 67 6c 6f   1) ;; (+ 2 *glo
4650: 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09 20  bal-delta*))... 
4660: 20 3b 3b 20 63 6f 75 6c 64 20 68 61 76 65 20 64   ;; could have d
4670: 6f 6e 65 20 68 65 64 20 74 61 6c 20 68 65 72 65  one hed tal here
4680: 20 62 75 74 20 64 6f 69 6e 67 20 63 61 72 2f 63   but doing car/c
4690: 64 72 20 6f 66 20 6e 65 77 74 61 6c 20 74 6f 20  dr of newtal to 
46a0: 72 6f 74 61 74 65 20 74 65 73 74 73 0a 09 09 20  rotate tests... 
46b0: 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74   (loop (car newt
46c0: 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20  al)(cdr newtal) 
46d0: 72 65 72 75 6e 73 29 29 0a 09 09 20 28 28 61 6e  reruns))... ((an
46e0: 64 20 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73  d have-resources
46f0: 0a 09 09 20 20 20 20 20 20 20 28 6f 72 20 28 6e  ...       (or (n
4700: 75 6c 6c 3f 20 70 72 65 72 65 71 73 2d 6e 6f 74  ull? prereqs-not
4710: 2d 6d 65 74 29 0a 09 09 09 20 20 20 28 61 6e 64  -met)....   (and
4720: 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27   (eq? testmode '
4730: 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09 28 6e  toplevel).....(n
4740: 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74  ull? non-complet
4750: 65 64 29 29 29 29 0a 09 09 20 20 28 72 75 6e 3a  ed))))...  (run:
4760: 74 65 73 74 20 72 75 6e 2d 69 64 20 72 75 6e 6e  test run-id runn
4770: 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20 74 65  ame keyvallst te
4780: 73 74 2d 72 65 63 6f 72 64 20 66 6c 61 67 73 20  st-record flags 
4790: 23 66 29 0a 09 09 20 20 28 68 61 73 68 2d 74 61  #f)...  (hash-ta
47a0: 62 6c 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65  ble-set! test-re
47b0: 67 69 73 74 65 72 79 20 28 72 75 6e 73 3a 6d 61  gistery (runs:ma
47c0: 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d  ke-full-test-nam
47d0: 65 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d  e test-name item
47e0: 2d 70 61 74 68 29 20 27 72 75 6e 6e 69 6e 67 29  -path) 'running)
47f0: 0a 09 09 20 20 28 72 75 6e 73 3a 73 68 72 69 6e  ...  (runs:shrin
4800: 6b 2d 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74  k-can-run-more-t
4810: 65 73 74 73 2d 64 65 6c 61 79 29 20 20 3b 3b 20  ests-delay)  ;; 
4820: 44 45 4c 41 59 20 54 57 45 41 4b 45 52 20 28 73  DELAY TWEAKER (s
4830: 74 69 6c 6c 20 6e 65 65 64 65 64 3f 29 0a 09 09  till needed?)...
4840: 20 20 3b 3b 20 28 74 68 72 65 61 64 2d 73 6c 65    ;; (thread-sle
4850: 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74  ep! *global-delt
4860: 61 2a 29 0a 09 09 20 20 28 69 66 20 28 6e 6f 74  a*)...  (if (not
4870: 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09   (null? tal))...
4880: 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72        (loop (car
4890: 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 20 72   tal)(cdr tal) r
48a0: 65 72 75 6e 73 29 29 29 0a 09 09 20 28 65 6c 73  eruns)))... (els
48b0: 65 20 3b 3b 20 6d 75 73 74 20 62 65 20 77 65 20  e ;; must be we 
48c0: 68 61 76 65 20 75 6e 6d 65 74 20 70 72 65 72 65  have unmet prere
48d0: 71 75 69 73 69 74 65 73 0a 09 09 20 20 20 20 28  quisites...    (
48e0: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 46  debug:print 4 "F
48f0: 41 49 4c 53 3a 20 22 20 66 61 69 6c 73 29 0a 09  AILS: " fails)..
4900: 09 20 20 20 20 3b 3b 20 49 66 20 6f 6e 65 20 6f  .    ;; If one o
4910: 72 20 6d 6f 72 65 20 6f 66 20 74 68 65 20 70 72  r more of the pr
4920: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 61 72  ereqs-not-met ar
4930: 65 20 46 41 49 4c 20 74 68 65 6e 20 77 65 20 63  e FAIL then we c
4940: 61 6e 20 69 73 73 75 65 0a 09 09 20 20 20 20 3b  an issue...    ;
4950: 3b 20 61 20 6d 65 73 73 61 67 65 20 61 6e 64 20  ; a message and 
4960: 64 72 6f 70 20 68 65 64 20 66 72 6f 6d 20 74 68  drop hed from th
4970: 65 20 69 74 65 6d 73 20 74 6f 20 62 65 20 70 72  e items to be pr
4980: 6f 63 65 73 73 65 64 2e 0a 09 09 20 20 20 20 28  ocessed....    (
4990: 69 66 20 28 6e 75 6c 6c 3f 20 66 61 69 6c 73 29  if (null? fails)
49a0: 0a 09 09 09 28 62 65 67 69 6e 0a 09 09 09 20 20  ....(begin....  
49b0: 3b 3b 20 63 6f 75 6c 64 6e 27 74 20 72 75 6e 2c  ;; couldn't run,
49c0: 20 74 61 6b 65 20 61 20 62 72 65 61 74 68 65 72   take a breather
49d0: 0a 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 69  ....  (debug:pri
49e0: 6e 74 2d 69 6e 66 6f 20 34 20 22 53 68 6f 75 6c  nt-info 4 "Shoul
49f0: 64 6e 27 74 20 72 65 61 6c 6c 79 20 67 65 74 20  dn't really get 
4a00: 68 65 72 65 2c 20 72 61 63 65 20 63 6f 6e 64 69  here, race condi
4a10: 74 69 6f 6e 3f 20 55 6e 61 62 6c 65 20 74 6f 20  tion? Unable to 
4a20: 6c 61 75 6e 63 68 20 6d 6f 72 65 20 74 65 73 74  launch more test
4a30: 73 20 61 74 20 74 68 69 73 20 6d 6f 6d 65 6e 74  s at this moment
4a40: 2c 20 6b 69 6c 6c 69 6e 67 20 74 69 6d 65 20 2e  , killing time .
4a50: 2e 2e 22 29 0a 09 09 09 20 20 3b 3b 20 28 74 68  ..")....  ;; (th
4a60: 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 30  read-sleep! (+ 0
4a70: 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74  .01 *global-delt
4a80: 61 2a 29 29 20 3b 3b 20 6c 6f 6e 67 20 73 6c 65  a*)) ;; long sle
4a90: 65 70 20 68 65 72 65 20 2d 20 6e 6f 20 72 65 73  ep here - no res
4aa0: 6f 75 72 63 65 73 2c 20 6d 61 79 20 61 73 20 77  ources, may as w
4ab0: 65 6c 6c 20 62 65 20 70 61 74 69 65 6e 74 0a 09  ell be patient..
4ac0: 09 09 20 20 3b 3b 20 77 65 20 6d 61 64 65 20 6e  ..  ;; we made n
4ad0: 65 77 20 74 61 6c 20 62 79 20 73 74 69 63 6b 69  ew tal by sticki
4ae0: 6e 67 20 68 65 64 20 61 74 20 74 68 65 20 62 61  ng hed at the ba
4af0: 63 6b 20 6f 66 20 74 68 65 20 6c 69 73 74 0a 09  ck of the list..
4b00: 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e  ..  (loop (car n
4b10: 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61  ewtal)(cdr newta
4b20: 6c 29 20 72 65 72 75 6e 73 29 29 0a 09 09 09 3b  l) reruns))....;
4b30: 3b 20 74 68 65 20 77 61 69 74 6f 6e 20 69 73 20  ; the waiton is 
4b40: 46 41 49 4c 20 73 6f 20 6e 6f 20 70 6f 69 6e 74  FAIL so no point
4b50: 20 69 6e 20 74 72 79 69 6e 67 20 74 6f 20 72 75   in trying to ru
4b60: 6e 20 68 65 64 20 65 76 65 72 20 61 67 61 69 6e  n hed ever again
4b70: 0a 09 09 09 28 69 66 20 28 6e 6f 74 20 28 6e 75  ....(if (not (nu
4b80: 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 09 20 20 20  ll? tal))....   
4b90: 20 28 69 66 20 28 76 65 63 74 6f 72 3f 20 68 65   (if (vector? he
4ba0: 64 29 0a 09 09 09 09 28 62 65 67 69 6e 20 0a 09  d).....(begin ..
4bb0: 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e  ...  (debug:prin
4bc0: 74 20 31 20 22 57 41 52 4e 3a 20 44 72 6f 70 70  t 1 "WARN: Dropp
4bd0: 69 6e 67 20 74 65 73 74 20 22 20 28 64 62 3a 74  ing test " (db:t
4be0: 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65  est-get-testname
4bf0: 20 68 65 64 29 20 22 2f 22 20 28 64 62 3a 74 65   hed) "/" (db:te
4c00: 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68  st-get-item-path
4c10: 20 68 65 64 29 0a 09 09 09 09 09 20 20 20 20 20   hed)......     
4c20: 20 20 22 20 66 72 6f 6d 20 74 68 65 20 6c 61 75    " from the lau
4c30: 6e 63 68 20 6c 69 73 74 20 61 73 20 69 74 20 68  nch list as it h
4c40: 61 73 20 70 72 65 72 65 71 75 69 73 74 65 73 20  as prerequistes 
4c50: 74 68 61 74 20 61 72 65 20 46 41 49 4c 22 29 0a  that are FAIL").
4c60: 09 09 09 09 20 20 28 72 75 6e 73 3a 73 68 72 69  ....  (runs:shri
4c70: 6e 6b 2d 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d  nk-can-run-more-
4c80: 74 65 73 74 73 2d 64 65 6c 61 79 29 20 3b 3b 20  tests-delay) ;; 
4c90: 44 45 4c 41 59 20 54 57 45 41 4b 45 52 20 28 73  DELAY TWEAKER (s
4ca0: 74 69 6c 6c 20 6e 65 65 64 65 64 3f 29 0a 09 09  till needed?)...
4cb0: 09 09 20 20 3b 3b 20 28 74 68 72 65 61 64 2d 73  ..  ;; (thread-s
4cc0: 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65  leep! *global-de
4cd0: 6c 74 61 2a 29 0a 09 09 09 09 20 20 28 68 61 73  lta*).....  (has
4ce0: 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 65 73  h-table-set! tes
4cf0: 74 2d 72 65 67 69 73 74 65 72 79 20 28 72 75 6e  t-registery (run
4d00: 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 73 74  s:make-full-test
4d10: 2d 6e 61 6d 65 20 74 65 73 74 2d 6e 61 6d 65 20  -name test-name 
4d20: 69 74 65 6d 2d 70 61 74 68 29 20 27 72 65 6d 6f  item-path) 'remo
4d30: 76 65 64 29 0a 09 09 09 09 20 20 28 6c 6f 6f 70  ved).....  (loop
4d40: 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74   (car tal)(cdr t
4d50: 61 6c 29 20 28 63 6f 6e 73 20 68 65 64 20 72 65  al) (cons hed re
4d60: 72 75 6e 73 29 29 29 0a 09 09 09 09 28 62 65 67  runs))).....(beg
4d70: 69 6e 0a 09 09 09 09 20 20 28 64 65 62 75 67 3a  in.....  (debug:
4d80: 70 72 69 6e 74 20 31 20 22 57 41 52 4e 3a 20 54  print 1 "WARN: T
4d90: 65 73 74 20 6e 6f 74 20 70 72 6f 63 65 73 73 65  est not processe
4da0: 64 20 63 6f 72 72 65 63 74 6c 79 2e 20 43 6f 75  d correctly. Cou
4db0: 6c 64 20 62 65 20 61 20 72 61 63 65 20 63 6f 6e  ld be a race con
4dc0: 64 69 74 69 6f 6e 20 69 6e 20 79 6f 75 72 20 74  dition in your t
4dd0: 65 73 74 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69  est implementati
4de0: 6f 6e 3f 20 22 20 68 65 64 29 20 3b 3b 20 20 22  on? " hed) ;;  "
4df0: 20 61 73 20 69 74 20 68 61 73 20 70 72 65 72 65   as it has prere
4e00: 71 75 69 73 74 65 73 20 74 68 61 74 20 61 72 65  quistes that are
4e10: 20 46 41 49 4c 2e 20 28 4e 4f 54 45 3a 20 68 65   FAIL. (NOTE: he
4e20: 64 20 69 73 20 6e 6f 74 20 61 20 76 65 63 74 6f  d is not a vecto
4e30: 72 29 22 29 0a 09 09 09 09 20 20 28 72 75 6e 73  r)").....  (runs
4e40: 3a 73 68 72 69 6e 6b 2d 63 61 6e 2d 72 75 6e 2d  :shrink-can-run-
4e50: 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c 61 79  more-tests-delay
4e60: 29 20 3b 3b 20 44 45 4c 41 59 20 54 57 45 41 4b  ) ;; DELAY TWEAK
4e70: 45 52 20 28 73 74 69 6c 6c 20 6e 65 65 64 65 64  ER (still needed
4e80: 3f 29 0a 09 09 09 09 20 20 3b 3b 20 28 74 68 72  ?).....  ;; (thr
4e90: 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 30 2e  ead-sleep! (+ 0.
4ea0: 30 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61  01 *global-delta
4eb0: 2a 29 29 0a 09 09 09 09 20 20 28 6c 6f 6f 70 20  *)).....  (loop 
4ec0: 68 65 64 20 74 61 6c 20 72 65 72 75 6e 73 29 29  hed tal reruns))
4ed0: 29 29 29 29 29 29 29 20 3b 3b 20 45 4e 44 20 4f  ))))))) ;; END O
4ee0: 46 20 49 4e 4e 45 52 20 43 4f 4e 44 0a 09 20 20  F INNER COND..  
4ef0: 20 20 20 0a 09 20 20 20 20 20 3b 3b 20 63 61 73     ..     ;; cas
4f00: 65 20 77 68 65 72 65 20 61 6e 20 69 74 65 6d 73  e where an items
4f10: 20 63 61 6d 65 20 69 6e 20 61 73 20 61 20 6c 69   came in as a li
4f20: 73 74 20 62 65 65 6e 20 70 72 6f 63 65 73 73 65  st been processe
4f30: 64 0a 09 20 20 20 20 20 28 28 61 6e 64 20 28 6c  d..     ((and (l
4f40: 69 73 74 3f 20 69 74 65 6d 73 29 20 20 20 20 20  ist? items)     
4f50: 3b 3b 20 74 68 75 73 20 77 65 20 6b 6e 6f 77 20  ;; thus we know 
4f60: 6f 75 72 20 69 74 65 6d 73 20 61 72 65 20 61 6c  our items are al
4f70: 72 65 61 64 79 20 63 61 6c 63 75 6c 61 74 65 64  ready calculated
4f80: 0a 09 09 20 20 20 28 6e 6f 74 20 20 20 69 74 65  ...   (not   ite
4f90: 6d 64 61 74 29 29 20 3b 3b 20 61 6e 64 20 6e 6f  mdat)) ;; and no
4fa0: 74 20 79 65 74 20 65 78 70 61 6e 64 65 64 20 69  t yet expanded i
4fb0: 6e 74 6f 20 74 68 65 20 6c 69 73 74 20 6f 66 20  nto the list of 
4fc0: 74 68 69 6e 67 73 20 74 6f 20 62 65 20 64 6f 6e  things to be don
4fd0: 65 0a 09 20 20 20 20 20 20 28 69 66 20 28 61 6e  e..      (if (an
4fe0: 64 20 28 64 65 62 75 67 3a 64 65 62 75 67 2d 6d  d (debug:debug-m
4ff0: 6f 64 65 20 31 29 20 3b 3b 20 28 3e 3d 20 2a 76  ode 1) ;; (>= *v
5000: 65 72 62 6f 73 69 74 79 2a 20 31 29 0a 09 09 20  erbosity* 1)... 
5010: 20 20 20 20 20 20 28 3e 20 28 6c 65 6e 67 74 68        (> (length
5020: 20 69 74 65 6d 73 29 20 30 29 0a 09 09 20 20 20   items) 0)...   
5030: 20 20 20 20 28 3e 20 28 6c 65 6e 67 74 68 20 28      (> (length (
5040: 63 61 72 20 69 74 65 6d 73 29 29 20 30 29 29 0a  car items)) 0)).
5050: 09 09 20 20 28 70 70 20 69 74 65 6d 73 29 29 0a  ..  (pp items)).
5060: 09 20 20 20 20 20 20 28 66 6f 72 2d 65 61 63 68  .      (for-each
5070: 0a 09 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61  ..       (lambda
5080: 20 28 6d 79 2d 69 74 65 6d 64 61 74 29 0a 09 09   (my-itemdat)...
5090: 20 28 6c 65 74 2a 20 28 28 6e 65 77 2d 74 65 73   (let* ((new-tes
50a0: 74 2d 72 65 63 6f 72 64 20 28 6c 65 74 20 28 28  t-record (let ((
50b0: 6e 65 77 72 65 63 20 28 6d 61 6b 65 2d 74 65 73  newrec (make-tes
50c0: 74 73 3a 74 65 73 74 71 75 65 75 65 29 29 29 0a  ts:testqueue))).
50d0: 09 09 09 09 09 20 20 20 28 76 65 63 74 6f 72 2d  .....   (vector-
50e0: 63 6f 70 79 21 20 74 65 73 74 2d 72 65 63 6f 72  copy! test-recor
50f0: 64 20 6e 65 77 72 65 63 29 0a 09 09 09 09 09 20  d newrec)...... 
5100: 20 20 6e 65 77 72 65 63 29 29 0a 09 09 09 28 6d    newrec))....(m
5110: 79 2d 69 74 65 6d 2d 70 61 74 68 20 28 69 74 65  y-item-path (ite
5120: 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 6d 79 2d  m-list->path my-
5130: 69 74 65 6d 64 61 74 29 29 29 0a 09 09 20 20 20  itemdat)))...   
5140: 28 69 66 20 28 74 65 73 74 73 3a 6d 61 74 63 68  (if (tests:match
5150: 20 74 65 73 74 2d 70 61 74 74 73 20 68 65 64 20   test-patts hed 
5160: 6d 79 2d 69 74 65 6d 2d 70 61 74 68 29 20 3b 3b  my-item-path) ;;
5170: 20 28 70 61 74 74 2d 6c 69 73 74 2d 6d 61 74 63   (patt-list-matc
5180: 68 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68 20 69  h my-item-path i
5190: 74 65 6d 2d 70 61 74 74 73 29 20 20 20 20 20 20  tem-patts)      
51a0: 20 20 20 20 20 3b 3b 20 79 65 73 2c 20 77 65 20       ;; yes, we 
51b0: 77 61 6e 74 20 74 6f 20 70 72 6f 63 65 73 73 20  want to process 
51c0: 74 68 69 73 20 69 74 65 6d 2c 20 4e 4f 54 45 3a  this item, NOTE:
51d0: 20 53 68 6f 75 6c 64 20 6e 6f 74 20 6e 65 65 64   Should not need
51e0: 20 74 68 69 73 20 63 68 65 63 6b 20 68 65 72 65   this check here
51f0: 21 0a 09 09 20 20 20 20 20 20 20 28 6c 65 74 20  !...       (let 
5200: 28 28 6e 65 77 74 65 73 74 6e 61 6d 65 20 28 72  ((newtestname (r
5210: 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65  uns:make-full-te
5220: 73 74 2d 6e 61 6d 65 20 68 65 64 20 6d 79 2d 69  st-name hed my-i
5230: 74 65 6d 2d 70 61 74 68 29 29 29 20 20 20 20 3b  tem-path)))    ;
5240: 3b 20 74 65 73 74 20 6e 61 6d 65 73 20 61 72 65  ; test names are
5250: 20 75 6e 69 71 75 65 20 6f 6e 20 74 65 73 74 6e   unique on testn
5260: 61 6d 65 2f 69 74 65 6d 2d 70 61 74 68 0a 09 09  ame/item-path...
5270: 09 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65  . (tests:testque
5280: 75 65 2d 73 65 74 2d 69 74 65 6d 73 21 20 20 20  ue-set-items!   
5290: 20 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72    new-test-recor
52a0: 64 20 23 66 29 0a 09 09 09 20 28 74 65 73 74 73  d #f).... (tests
52b0: 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69  :testqueue-set-i
52c0: 74 65 6d 64 61 74 21 20 20 20 6e 65 77 2d 74 65  temdat!   new-te
52d0: 73 74 2d 72 65 63 6f 72 64 20 6d 79 2d 69 74 65  st-record my-ite
52e0: 6d 64 61 74 29 0a 09 09 09 20 28 74 65 73 74 73  mdat).... (tests
52f0: 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69  :testqueue-set-i
5300: 74 65 6d 5f 70 61 74 68 21 20 6e 65 77 2d 74 65  tem_path! new-te
5310: 73 74 2d 72 65 63 6f 72 64 20 6d 79 2d 69 74 65  st-record my-ite
5320: 6d 2d 70 61 74 68 29 0a 09 09 09 20 28 68 61 73  m-path).... (has
5330: 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 65 73  h-table-set! tes
5340: 74 2d 72 65 63 6f 72 64 73 20 6e 65 77 74 65 73  t-records newtes
5350: 74 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74 2d 72  tname new-test-r
5360: 65 63 6f 72 64 29 0a 09 09 09 20 28 73 65 74 21  ecord).... (set!
5370: 20 74 61 6c 20 28 63 6f 6e 73 20 6e 65 77 74 65   tal (cons newte
5380: 73 74 6e 61 6d 65 20 74 61 6c 29 29 29 29 29 29  stname tal))))))
5390: 20 3b 3b 20 73 69 6e 63 65 20 74 68 65 73 65 20   ;; since these 
53a0: 61 72 65 20 69 74 65 6d 69 7a 65 64 20 63 72 65  are itemized cre
53b0: 61 74 65 20 6e 65 77 20 74 65 73 74 20 6e 61 6d  ate new test nam
53c0: 65 73 20 74 65 73 74 6e 61 6d 65 2f 69 74 65 6d  es testname/item
53d0: 70 61 74 68 0a 09 20 20 20 20 20 20 20 69 74 65  path..       ite
53e0: 6d 73 29 0a 09 20 20 20 20 20 20 28 69 66 20 28  ms)..      (if (
53f0: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29  not (null? tal))
5400: 0a 09 09 20 20 28 62 65 67 69 6e 0a 09 09 20 20  ...  (begin...  
5410: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69    (debug:print-i
5420: 6e 66 6f 20 34 20 22 45 6e 64 20 6f 66 20 69 74  nfo 4 "End of it
5430: 65 6d 73 20 6c 69 73 74 2c 20 6c 6f 6f 70 69 6e  ems list, loopin
5440: 67 20 77 69 74 68 20 6e 65 78 74 20 61 66 74 65  g with next afte
5450: 72 20 73 68 6f 72 74 20 64 65 6c 61 79 22 29 0a  r short delay").
5460: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
5470: 20 20 20 20 3b 3b 20 28 74 68 72 65 61 64 2d 73      ;; (thread-s
5480: 6c 65 65 70 21 20 28 2b 20 30 2e 30 31 20 2a 67  leep! (+ 0.01 *g
5490: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09  lobal-delta*))..
54a0: 09 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20  .    (loop (car 
54b0: 74 61 6c 29 28 63 64 72 20 74 61 6c 29 20 72 65  tal)(cdr tal) re
54c0: 72 75 6e 73 29 29 29 29 0a 0a 09 20 20 20 20 20  runs))))...     
54d0: 3b 3b 20 69 66 20 69 74 65 6d 73 20 69 73 20 61  ;; if items is a
54e0: 20 70 72 6f 63 20 74 68 65 6e 20 6e 65 65 64 20   proc then need 
54f0: 74 6f 20 72 75 6e 20 69 74 65 6d 73 3a 67 65 74  to run items:get
5500: 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66  -items-from-conf
5510: 69 67 2c 20 67 65 74 20 74 68 65 20 6c 69 73 74  ig, get the list
5520: 20 61 6e 64 20 6c 6f 6f 70 20 0a 09 20 20 20 20   and loop ..    
5530: 20 3b 3b 20 20 20 20 2d 20 62 75 74 20 6f 6e 6c   ;;    - but onl
5540: 79 20 64 6f 20 74 68 61 74 20 69 66 20 72 65 73  y do that if res
5550: 6f 75 72 63 65 73 20 65 78 69 73 74 20 74 6f 20  ources exist to 
5560: 6b 69 63 6b 20 6f 66 66 20 74 68 65 20 6a 6f 62  kick off the job
5570: 0a 09 20 20 20 20 20 28 28 6f 72 20 28 70 72 6f  ..     ((or (pro
5580: 63 65 64 75 72 65 3f 20 69 74 65 6d 73 29 28 65  cedure? items)(e
5590: 71 3f 20 69 74 65 6d 73 20 27 68 61 76 65 2d 70  q? items 'have-p
55a0: 72 6f 63 65 64 75 72 65 29 29 0a 09 20 20 20 20  rocedure))..    
55b0: 20 20 28 6c 65 74 20 28 28 63 61 6e 2d 72 75 6e    (let ((can-run
55c0: 2d 6d 6f 72 65 20 20 20 20 28 72 75 6e 73 3a 63  -more    (runs:c
55d0: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74  an-run-more-test
55e0: 73 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 29  s test-record)))
55f0: 0a 09 09 28 69 66 20 28 61 6e 64 20 28 6c 69 73  ...(if (and (lis
5600: 74 3f 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 29  t? can-run-more)
5610: 0a 09 09 09 20 28 63 61 72 20 63 61 6e 2d 72 75  .... (car can-ru
5620: 6e 2d 6d 6f 72 65 29 29 0a 09 09 20 20 20 20 28  n-more))...    (
5630: 6c 65 74 2a 20 28 28 70 72 65 72 65 71 73 2d 6e  let* ((prereqs-n
5640: 6f 74 2d 6d 65 74 20 28 6f 70 65 6e 2d 72 75 6e  ot-met (open-run
5650: 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 70 72  -close db:get-pr
5660: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 23 66  ereqs-not-met #f
5670: 20 72 75 6e 2d 69 64 20 77 61 69 74 6f 6e 73 20   run-id waitons 
5680: 69 74 65 6d 2d 70 61 74 68 20 6d 6f 64 65 3a 20  item-path mode: 
5690: 74 65 73 74 6d 6f 64 65 29 29 0a 09 09 09 20 20  testmode))....  
56a0: 20 28 66 61 69 6c 73 20 20 20 20 20 20 20 20 20   (fails         
56b0: 20 20 28 72 75 6e 73 3a 63 61 6c 63 2d 66 61 69    (runs:calc-fai
56c0: 6c 73 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d  ls prereqs-not-m
56d0: 65 74 29 29 0a 09 09 09 20 20 20 28 6e 6f 6e 2d  et))....   (non-
56e0: 63 6f 6d 70 6c 65 74 65 64 20 20 20 28 72 75 6e  completed   (run
56f0: 73 3a 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c  s:calc-not-compl
5700: 65 74 65 64 20 70 72 65 72 65 71 73 2d 6e 6f 74  eted prereqs-not
5710: 2d 6d 65 74 29 29 29 0a 09 09 20 20 20 20 20 20  -met)))...      
5720: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
5730: 6f 20 38 20 22 63 61 6e 2d 72 75 6e 2d 6d 6f 72  o 8 "can-run-mor
5740: 65 3a 20 22 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72  e: " can-run-mor
5750: 65 0a 09 09 09 09 20 20 20 22 5c 6e 20 74 65 73  e.....   "\n tes
5760: 74 6e 61 6d 65 3a 20 20 20 20 20 20 20 20 22 20  tname:        " 
5770: 68 65 64 0a 09 09 09 09 20 20 20 22 5c 6e 20 70  hed.....   "\n p
5780: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 3a 20  rereqs-not-met: 
5790: 22 20 28 72 75 6e 73 3a 70 72 65 74 74 79 2d 73  " (runs:pretty-s
57a0: 74 72 69 6e 67 20 70 72 65 72 65 71 73 2d 6e 6f  tring prereqs-no
57b0: 74 2d 6d 65 74 29 0a 09 09 09 09 20 20 20 22 5c  t-met).....   "\
57c0: 6e 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 3a  n non-completed:
57d0: 20 20 20 22 20 28 72 75 6e 73 3a 70 72 65 74 74     " (runs:prett
57e0: 79 2d 73 74 72 69 6e 67 20 6e 6f 6e 2d 63 6f 6d  y-string non-com
57f0: 70 6c 65 74 65 64 29 20 0a 09 09 09 09 20 20 20  pleted) .....   
5800: 22 5c 6e 20 66 61 69 6c 73 3a 20 20 20 20 20 20  "\n fails:      
5810: 20 20 20 20 20 22 20 28 72 75 6e 73 3a 70 72 65       " (runs:pre
5820: 74 74 79 2d 73 74 72 69 6e 67 20 66 61 69 6c 73  tty-string fails
5830: 29 0a 09 09 09 09 20 20 20 22 5c 6e 20 74 65 73  ).....   "\n tes
5840: 74 6d 6f 64 65 3a 20 20 20 20 20 20 20 20 22 20  tmode:        " 
5850: 74 65 73 74 6d 6f 64 65 0a 09 09 09 09 20 20 20  testmode.....   
5860: 22 5c 6e 20 6e 75 6d 2d 72 65 74 72 69 65 73 3a  "\n num-retries:
5870: 20 20 20 20 20 22 20 6e 75 6d 2d 72 65 74 72 69       " num-retri
5880: 65 73 0a 09 09 09 09 20 20 20 22 5c 6e 20 28 65  es.....   "\n (e
5890: 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 74 6f 70  q? testmode 'top
58a0: 6c 65 76 65 6c 29 3a 20 22 20 28 65 71 3f 20 74  level): " (eq? t
58b0: 65 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65  estmode 'topleve
58c0: 6c 29 0a 09 09 09 09 20 20 20 22 5c 6e 20 28 6e  l).....   "\n (n
58d0: 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74  ull? non-complet
58e0: 65 64 29 3a 20 20 20 20 22 20 28 6e 75 6c 6c 3f  ed):    " (null?
58f0: 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 0a   non-completed).
5900: 09 09 09 09 20 20 20 22 5c 6e 20 72 65 72 75 6e  ....   "\n rerun
5910: 73 3a 20 20 20 20 20 20 20 20 20 20 22 20 72 65  s:          " re
5920: 72 75 6e 73 0a 09 09 09 09 20 20 20 22 5c 6e 20  runs.....   "\n 
5930: 69 74 65 6d 73 3a 20 20 20 20 20 20 20 20 20 20  items:          
5940: 20 22 20 69 74 65 6d 73 0a 09 09 09 09 20 20 20   " items.....   
5950: 22 5c 6e 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65  "\n can-run-more
5960: 3a 20 20 20 20 22 20 63 61 6e 2d 72 75 6e 2d 6d  :    " can-run-m
5970: 6f 72 65 29 0a 09 09 20 20 20 20 20 20 3b 3b 20  ore)...      ;; 
5980: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28  (thread-sleep! (
5990: 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d 64  + 0.01 *global-d
59a0: 65 6c 74 61 2a 29 29 0a 09 09 20 20 20 20 20 20  elta*))...      
59b0: 28 63 6f 6e 64 20 3b 3b 20 49 4e 4e 45 52 20 43  (cond ;; INNER C
59c0: 4f 4e 44 20 23 32 0a 09 09 20 20 20 20 20 20 20  OND #2...       
59d0: 28 28 6f 72 20 28 6e 75 6c 6c 3f 20 70 72 65 72  ((or (null? prer
59e0: 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 20 3b 3b 20  eqs-not-met) ;; 
59f0: 61 6c 6c 20 70 72 65 72 65 71 73 20 6d 65 74 2c  all prereqs met,
5a00: 20 66 69 72 65 20 6f 66 66 20 74 68 65 20 74 65   fire off the te
5a10: 73 74 0a 09 09 09 20 20 20 20 3b 3b 20 6f 72 2c  st....    ;; or,
5a20: 20 69 66 20 69 74 20 69 73 20 61 20 27 74 6f 70   if it is a 'top
5a30: 6c 65 76 65 6c 20 74 65 73 74 20 61 6e 64 20 61  level test and a
5a40: 6c 6c 20 70 72 65 72 65 71 73 20 6e 6f 74 20 6d  ll prereqs not m
5a50: 65 74 20 61 72 65 20 43 4f 4d 50 4c 45 54 45 44  et are COMPLETED
5a60: 20 74 68 65 6e 20 6c 61 75 6e 63 68 0a 09 09 09   then launch....
5a70: 20 20 20 20 28 61 6e 64 20 28 65 71 3f 20 74 65      (and (eq? te
5a80: 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c  stmode 'toplevel
5a90: 29 0a 09 09 09 09 20 28 6e 75 6c 6c 3f 20 6e 6f  )..... (null? no
5aa0: 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 29 29 0a 09  n-completed)))..
5ab0: 09 09 28 6c 65 74 20 28 28 74 65 73 74 2d 6e 61  ..(let ((test-na
5ac0: 6d 65 20 28 74 65 73 74 73 3a 74 65 73 74 71 75  me (tests:testqu
5ad0: 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65  eue-get-testname
5ae0: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 29 0a   test-record))).
5af0: 09 09 09 20 20 28 73 65 74 65 6e 76 20 22 4d 54  ...  (setenv "MT
5b00: 5f 54 45 53 54 5f 4e 41 4d 45 22 20 74 65 73 74  _TEST_NAME" test
5b10: 2d 6e 61 6d 65 29 20 3b 3b 20 0a 09 09 09 20 20  -name) ;; ....  
5b20: 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e 4e  (setenv "MT_RUNN
5b30: 41 4d 45 22 20 20 20 72 75 6e 6e 61 6d 65 29 0a  AME"   runname).
5b40: 09 09 09 20 20 28 73 65 74 2d 6d 65 67 61 74 65  ...  (set-megate
5b50: 73 74 2d 65 6e 76 2d 76 61 72 73 20 72 75 6e 2d  st-env-vars run-
5b60: 69 64 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79  id) ;; these may
5b70: 20 62 65 20 6e 65 65 64 65 64 20 62 79 20 74 68   be needed by th
5b80: 65 20 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63  e launching proc
5b90: 65 73 73 0a 09 09 09 20 20 28 6c 65 74 20 28 28  ess....  (let ((
5ba0: 69 74 65 6d 73 2d 6c 69 73 74 20 28 69 74 65 6d  items-list (item
5bb0: 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d  s:get-items-from
5bc0: 2d 63 6f 6e 66 69 67 20 74 63 6f 6e 66 69 67 29  -config tconfig)
5bd0: 29 29 0a 09 09 09 20 20 20 20 28 69 66 20 28 6c  ))....    (if (l
5be0: 69 73 74 3f 20 69 74 65 6d 73 2d 6c 69 73 74 29  ist? items-list)
5bf0: 0a 09 09 09 09 28 62 65 67 69 6e 0a 09 09 09 09  .....(begin.....
5c00: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65    (tests:testque
5c10: 75 65 2d 73 65 74 2d 69 74 65 6d 73 21 20 74 65  ue-set-items! te
5c20: 73 74 2d 72 65 63 6f 72 64 20 69 74 65 6d 73 2d  st-record items-
5c30: 6c 69 73 74 29 0a 09 09 09 09 20 20 3b 3b 20 28  list).....  ;; (
5c40: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67  thread-sleep! *g
5c50: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09  lobal-delta*)...
5c60: 09 09 20 20 28 6c 6f 6f 70 20 68 65 64 20 74 61  ..  (loop hed ta
5c70: 6c 20 72 65 72 75 6e 73 29 29 0a 09 09 09 09 28  l reruns)).....(
5c80: 62 65 67 69 6e 0a 09 09 09 09 20 20 28 64 65 62  begin.....  (deb
5c90: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f  ug:print 0 "ERRO
5ca0: 52 3a 20 54 68 65 20 70 72 6f 63 20 66 72 6f 6d  R: The proc from
5cb0: 20 72 65 61 64 69 6e 67 20 74 68 65 20 73 65 74   reading the set
5cc0: 75 70 20 64 69 64 20 6e 6f 74 20 79 69 65 6c 64  up did not yield
5cd0: 20 61 20 6c 69 73 74 20 2d 20 70 6c 65 61 73 65   a list - please
5ce0: 20 72 65 70 6f 72 74 20 74 68 69 73 22 29 0a 09   report this")..
5cf0: 09 09 09 20 20 28 65 78 69 74 20 31 29 29 29 29  ...  (exit 1))))
5d00: 29 29 0a 09 09 20 20 20 20 20 20 20 28 28 6e 75  ))...       ((nu
5d10: 6c 6c 3f 20 66 61 69 6c 73 29 0a 09 09 09 28 64  ll? fails)....(d
5d20: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
5d30: 34 20 22 66 61 69 6c 73 20 69 73 20 6e 75 6c 6c  4 "fails is null
5d40: 2c 20 6d 6f 76 69 6e 67 20 6f 6e 20 69 6e 20 74  , moving on in t
5d50: 68 65 20 71 75 65 75 65 20 62 75 74 20 6b 65 65  he queue but kee
5d60: 70 69 6e 67 20 22 20 68 65 64 20 22 20 66 6f 72  ping " hed " for
5d70: 20 6e 6f 77 22 29 0a 09 09 09 3b 3b 20 6f 6e 6c   now")....;; onl
5d80: 79 20 69 6e 63 72 65 6d 65 6e 74 20 6e 75 6d 2d  y increment num-
5d90: 72 65 74 72 69 65 73 20 77 68 65 6e 20 74 68 65  retries when the
5da0: 72 65 20 61 72 65 20 6e 6f 20 74 65 73 74 73 20  re are no tests 
5db0: 72 75 6e 69 6e 67 0a 09 09 09 28 69 66 20 28 65  runing....(if (e
5dc0: 71 3f 20 30 20 28 6c 69 73 74 2d 72 65 66 20 63  q? 0 (list-ref c
5dd0: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 20 31 29 29 0a  an-run-more 1)).
5de0: 09 09 09 20 20 20 20 28 62 65 67 69 6e 0a 09 09  ...    (begin...
5df0: 09 20 20 20 20 20 20 28 69 66 20 28 3e 20 6e 75  .      (if (> nu
5e00: 6d 2d 72 65 74 72 69 65 73 20 31 30 30 29 20 3b  m-retries 100) ;
5e10: 3b 20 66 69 72 73 74 20 31 30 30 20 72 65 74 72  ; first 100 retr
5e20: 69 65 73 20 61 72 65 20 6c 6f 77 20 74 69 6d 65  ies are low time
5e30: 20 63 6f 73 74 0a 09 09 09 09 20 20 28 74 68 72   cost.....  (thr
5e40: 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 32 20  ead-sleep! (+ 2 
5e50: 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29  *global-delta*))
5e60: 0a 09 09 09 09 20 20 28 74 68 72 65 61 64 2d 73  .....  (thread-s
5e70: 6c 65 65 70 21 20 28 2b 20 30 2e 30 31 20 2a 67  leep! (+ 0.01 *g
5e80: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 29 0a  lobal-delta*))).
5e90: 09 09 09 20 20 20 20 20 20 28 73 65 74 21 20 6e  ...      (set! n
5ea0: 75 6d 2d 72 65 74 72 69 65 73 20 28 2b 20 6e 75  um-retries (+ nu
5eb0: 6d 2d 72 65 74 72 69 65 73 20 31 29 29 29 29 0a  m-retries 1)))).
5ec0: 09 09 09 28 69 66 20 28 3e 20 6e 75 6d 2d 72 65  ...(if (> num-re
5ed0: 74 72 69 65 73 20 20 6d 61 78 2d 72 65 74 72 69  tries  max-retri
5ee0: 65 73 29 0a 09 09 09 20 20 20 20 28 69 66 20 28  es)....    (if (
5ef0: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29  not (null? tal))
5f00: 0a 09 09 09 09 28 6c 6f 6f 70 20 28 63 61 72 20  .....(loop (car 
5f10: 74 61 6c 29 28 63 64 72 20 74 61 6c 29 20 72 65  tal)(cdr tal) re
5f20: 72 75 6e 73 29 29 0a 09 09 09 20 20 20 20 28 6c  runs))....    (l
5f30: 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61 6c 29  oop (car newtal)
5f40: 28 63 64 72 20 6e 65 77 74 61 6c 29 20 72 65 72  (cdr newtal) rer
5f50: 75 6e 73 29 29 29 20 3b 3b 20 61 6e 20 69 73 73  uns))) ;; an iss
5f60: 75 65 20 77 69 74 68 20 70 72 65 72 65 71 73 20  ue with prereqs 
5f70: 6e 6f 74 20 79 65 74 20 6d 65 74 3f 0a 09 09 20  not yet met?... 
5f80: 20 20 20 20 20 20 28 28 61 6e 64 20 28 6e 6f 74        ((and (not
5f90: 20 28 6e 75 6c 6c 3f 20 66 61 69 6c 73 29 29 28   (null? fails))(
5fa0: 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 6e 6f  eq? testmode 'no
5fb0: 72 6d 61 6c 29 29 0a 09 09 09 28 64 65 62 75 67  rmal))....(debug
5fc0: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 74  :print-info 1 "t
5fd0: 65 73 74 20 22 20 20 68 65 64 20 22 20 28 6d 6f  est "  hed " (mo
5fe0: 64 65 3d 22 20 74 65 73 74 6d 6f 64 65 20 22 29  de=" testmode ")
5ff0: 20 68 61 73 20 66 61 69 6c 65 64 20 70 72 65 72   has failed prer
6000: 65 71 75 69 73 69 74 65 28 73 29 3b 20 22 0a 09  equisite(s); "..
6010: 09 09 09 20 20 20 20 20 28 73 74 72 69 6e 67 2d  ...     (string-
6020: 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61 70  intersperse (map
6030: 20 28 6c 61 6d 62 64 61 20 28 74 29 28 63 6f 6e   (lambda (t)(con
6040: 63 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74  c (db:test-get-t
6050: 65 73 74 6e 61 6d 65 20 74 29 20 22 3a 22 20 28  estname t) ":" (
6060: 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74  db:test-get-stat
6070: 65 20 74 29 22 2f 22 28 64 62 3a 74 65 73 74 2d  e t)"/"(db:test-
6080: 67 65 74 2d 73 74 61 74 75 73 20 74 29 29 29 20  get-status t))) 
6090: 66 61 69 6c 73 29 20 22 2c 20 22 29 0a 09 09 09  fails) ", ")....
60a0: 09 20 20 20 20 20 22 2c 20 72 65 6d 6f 76 69 6e  .     ", removin
60b0: 67 20 69 74 20 66 72 6f 6d 20 74 6f 2d 64 6f 20  g it from to-do 
60c0: 6c 69 73 74 22 29 0a 09 09 09 28 69 66 20 28 6e  list")....(if (n
60d0: 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a  ot (null? tal)).
60e0: 09 09 09 20 20 20 20 28 62 65 67 69 6e 0a 20 20  ...    (begin.  
60f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
6100: 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 28              ;; (
6110: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67  thread-sleep! *g
6120: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09  lobal-delta*)...
6130: 09 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61  .      (loop (ca
6140: 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 28  r tal)(cdr tal)(
6150: 63 6f 6e 73 20 68 65 64 20 72 65 72 75 6e 73 29  cons hed reruns)
6160: 29 29 29 29 0a 09 09 20 20 20 20 20 20 20 28 65  ))))...       (e
6170: 6c 73 65 0a 09 09 09 28 64 65 62 75 67 3a 70 72  lse....(debug:pr
6180: 69 6e 74 20 38 20 22 45 52 52 4f 52 3a 20 4e 6f  int 8 "ERROR: No
6190: 20 68 61 6e 64 6c 65 72 20 66 6f 72 20 74 68 69   handler for thi
61a0: 73 20 63 6f 6e 64 69 74 69 6f 6e 2e 22 29 0a 09  s condition.")..
61b0: 09 09 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21  ..(thread-sleep!
61c0: 20 28 2b 20 31 20 2a 67 6c 6f 62 61 6c 2d 64 65   (+ 1 *global-de
61d0: 6c 74 61 2a 29 29 0a 09 09 09 28 6c 6f 6f 70 20  lta*))....(loop 
61e0: 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72  (car newtal)(cdr
61f0: 20 6e 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29   newtal) reruns)
6200: 29 29 29 20 3b 3b 20 45 4e 44 20 4f 46 20 49 46  ))) ;; END OF IF
6210: 20 43 41 4e 20 52 55 4e 20 4d 4f 52 45 0a 0a 09   CAN RUN MORE...
6220: 09 20 20 20 20 3b 3b 20 69 66 20 63 61 6e 27 74  .    ;; if can't
6230: 20 72 75 6e 20 6d 6f 72 65 20 6a 75 73 74 20 6c   run more just l
6240: 6f 6f 70 20 77 69 74 68 20 6e 65 78 74 20 70 6f  oop with next po
6250: 73 73 69 62 6c 65 20 74 65 73 74 0a 09 09 20 20  ssible test...  
6260: 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20    (begin...     
6270: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
6280: 66 6f 20 34 20 22 70 72 6f 63 65 73 73 69 6e 67  fo 4 "processing
6290: 20 74 68 65 20 63 61 73 65 20 77 69 74 68 20 61   the case with a
62a0: 20 6c 61 6d 62 64 61 20 66 6f 72 20 69 74 65 6d   lambda for item
62b0: 73 20 6f 72 20 27 68 61 76 65 2d 70 72 6f 63 65  s or 'have-proce
62c0: 64 75 72 65 2e 20 4d 6f 76 69 6e 67 20 74 68 72  dure. Moving thr
62d0: 6f 75 67 68 20 74 68 65 20 71 75 65 75 65 20 77  ough the queue w
62e0: 69 74 68 6f 75 74 20 64 72 6f 70 70 69 6e 67 20  ithout dropping 
62f0: 22 20 68 65 64 29 0a 09 09 20 20 20 20 20 20 3b  " hed)...      ;
6300: 3b 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21  ; (thread-sleep!
6310: 20 28 2b 20 32 20 2a 67 6c 6f 62 61 6c 2d 64 65   (+ 2 *global-de
6320: 6c 74 61 2a 29 29 0a 09 09 20 20 20 20 20 20 28  lta*))...      (
6330: 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61 6c  loop (car newtal
6340: 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20 72 65  )(cdr newtal) re
6350: 72 75 6e 73 29 29 29 29 29 20 3b 3b 20 45 4e 44  runs))))) ;; END
6360: 20 4f 46 20 28 6f 72 20 28 70 72 6f 63 65 64 75   OF (or (procedu
6370: 72 65 3f 20 69 74 65 6d 73 29 28 65 71 3f 20 69  re? items)(eq? i
6380: 74 65 6d 73 20 27 68 61 76 65 2d 70 72 6f 63 65  tems 'have-proce
6390: 64 75 72 65 29 29 0a 09 20 20 20 20 20 0a 09 20  dure))..     .. 
63a0: 20 20 20 20 3b 3b 20 74 68 69 73 20 63 61 73 65      ;; this case
63b0: 20 73 68 6f 75 6c 64 20 6e 6f 74 20 68 61 70 70   should not happ
63c0: 65 6e 2c 20 61 64 64 65 64 20 74 6f 20 68 65 6c  en, added to hel
63d0: 70 20 63 61 74 63 68 20 61 6e 79 20 62 75 67 73  p catch any bugs
63e0: 0a 09 20 20 20 20 20 28 28 61 6e 64 20 28 6c 69  ..     ((and (li
63f0: 73 74 3f 20 69 74 65 6d 73 29 20 69 74 65 6d 64  st? items) itemd
6400: 61 74 29 0a 09 20 20 20 20 20 20 28 64 65 62 75  at)..      (debu
6410: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52  g:print 0 "ERROR
6420: 3a 20 53 68 6f 75 6c 64 20 6e 6f 74 20 68 61 76  : Should not hav
6430: 65 20 61 20 6c 69 73 74 20 6f 66 20 69 74 65 6d  e a list of item
6440: 73 20 69 6e 20 61 20 74 65 73 74 20 61 6e 64 20  s in a test and 
6450: 74 68 65 20 69 74 65 6d 73 70 61 74 68 20 73 65  the itemspath se
6460: 74 20 2d 20 70 6c 65 61 73 65 20 72 65 70 6f 72  t - please repor
6470: 74 20 74 68 69 73 22 29 0a 09 20 20 20 20 20 20  t this")..      
6480: 28 65 78 69 74 20 31 29 29 0a 09 20 20 20 20 20  (exit 1))..     
6490: 28 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 72  ((not (null? rer
64a0: 75 6e 73 29 29 0a 09 20 20 20 20 20 20 28 6c 65  uns))..      (le
64b0: 74 2a 20 28 28 6e 65 77 6c 73 74 20 28 74 65 73  t* ((newlst (tes
64c0: 74 73 3a 66 69 6c 74 65 72 2d 6e 6f 6e 2d 72 75  ts:filter-non-ru
64d0: 6e 6e 61 62 6c 65 20 72 75 6e 2d 69 64 20 74 61  nnable run-id ta
64e0: 6c 20 74 65 73 74 2d 72 65 63 6f 72 64 73 29 29  l test-records))
64f0: 20 3b 3b 20 69 2e 65 2e 20 6e 6f 74 20 46 41 49   ;; i.e. not FAI
6500: 4c 2c 20 57 41 49 56 45 44 2c 20 49 4e 43 4f 4d  L, WAIVED, INCOM
6510: 50 4c 45 54 45 2c 20 50 41 53 53 2c 20 4b 49 4c  PLETE, PASS, KIL
6520: 4c 45 44 2c 0a 09 09 20 20 20 20 20 28 6a 75 6e  LED,...     (jun
6530: 6b 65 64 20 28 6c 73 65 74 2d 64 69 66 66 65 72  ked (lset-differ
6540: 65 6e 63 65 20 65 71 75 61 6c 3f 20 74 61 6c 20  ence equal? tal 
6550: 6e 65 77 6c 73 74 29 29 29 0a 09 09 28 64 65 62  newlst)))...(deb
6560: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20  ug:print-info 4 
6570: 22 66 75 6c 6c 20 64 72 6f 70 20 74 68 72 6f 75  "full drop throu
6580: 67 68 2c 20 69 66 20 72 65 72 75 6e 73 20 69 73  gh, if reruns is
6590: 20 6c 65 73 73 20 74 68 61 6e 20 31 30 30 20 77   less than 100 w
65a0: 65 20 77 69 6c 6c 20 66 6f 72 63 65 20 72 65 74  e will force ret
65b0: 72 79 20 74 68 65 6d 2c 20 72 65 72 75 6e 73 3d  ry them, reruns=
65c0: 22 20 72 65 72 75 6e 73 20 22 2c 20 74 61 6c 3d  " reruns ", tal=
65d0: 22 20 74 61 6c 29 0a 09 09 28 69 66 20 28 3c 20  " tal)...(if (< 
65e0: 6e 75 6d 2d 72 65 74 72 69 65 73 20 6d 61 78 2d  num-retries max-
65f0: 72 65 74 72 69 65 73 29 0a 09 09 20 20 20 20 28  retries)...    (
6600: 73 65 74 21 20 6e 65 77 6c 73 74 20 28 61 70 70  set! newlst (app
6610: 65 6e 64 20 72 65 72 75 6e 73 20 6e 65 77 6c 73  end reruns newls
6620: 74 29 29 29 0a 09 09 28 73 65 74 21 20 6e 75 6d  t)))...(set! num
6630: 2d 72 65 74 72 69 65 73 20 28 2b 20 6e 75 6d 2d  -retries (+ num-
6640: 72 65 74 72 69 65 73 20 31 29 29 0a 09 09 3b 3b  retries 1))...;;
6650: 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20   (thread-sleep! 
6660: 28 2b 20 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c  (+ 1 *global-del
6670: 74 61 2a 29 29 0a 09 09 28 69 66 20 28 6e 6f 74  ta*))...(if (not
6680: 20 28 6e 75 6c 6c 3f 20 6e 65 77 6c 73 74 29 29   (null? newlst))
6690: 0a 09 09 20 20 20 20 3b 3b 20 73 69 6e 63 65 20  ...    ;; since 
66a0: 72 65 72 75 6e 73 20 68 61 76 65 20 62 65 65 6e  reruns have been
66b0: 20 74 61 63 6b 65 64 20 6f 6e 20 74 6f 20 6e 65   tacked on to ne
66c0: 77 6c 73 74 20 63 72 65 61 74 65 20 6e 65 77 20  wlst create new 
66d0: 72 65 72 75 6e 73 20 66 72 6f 6d 20 6a 75 6e 6b  reruns from junk
66e0: 65 64 0a 09 09 20 20 20 20 28 6c 6f 6f 70 20 28  ed...    (loop (
66f0: 63 61 72 20 6e 65 77 6c 73 74 29 28 63 64 72 20  car newlst)(cdr 
6700: 6e 65 77 6c 73 74 29 28 64 65 6c 65 74 65 2d 64  newlst)(delete-d
6710: 75 70 6c 69 63 61 74 65 73 20 6a 75 6e 6b 65 64  uplicates junked
6720: 29 29 29 29 29 0a 09 20 20 20 20 20 28 28 6e 6f  )))))..     ((no
6730: 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09  t (null? tal))..
6740: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
6750: 6e 74 2d 69 6e 66 6f 20 34 20 22 49 27 6d 20 70  nt-info 4 "I'm p
6760: 72 65 74 74 79 20 73 75 72 65 20 49 20 73 68 6f  retty sure I sho
6770: 75 6c 64 6e 27 74 20 67 65 74 20 68 65 72 65 2e  uldn't get here.
6780: 22 29 29 0a 09 20 20 20 20 20 28 65 6c 73 65 0a  "))..     (else.
6790: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72  .      (debug:pr
67a0: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 45 78 69 74  int-info 4 "Exit
67b0: 69 6e 67 20 6c 6f 6f 70 20 77 69 74 68 2e 2e 2e  ing loop with...
67c0: 5c 6e 20 20 68 65 64 3d 22 20 68 65 64 20 22 5c  \n  hed=" hed "\
67d0: 6e 20 20 74 61 6c 3d 22 20 74 61 6c 20 22 5c 6e  n  tal=" tal "\n
67e0: 20 20 72 65 72 75 6e 73 3d 22 20 72 65 72 75 6e    reruns=" rerun
67f0: 73 29 29 0a 09 20 20 20 20 20 29 29 29 29 20 3b  s))..     )))) ;
6800: 3b 20 4c 45 54 2a 20 28 28 74 65 73 74 2d 72 65  ; LET* ((test-re
6810: 63 6f 72 64 0a 0a 20 20 20 20 3b 3b 20 77 65 20  cord..    ;; we 
6820: 67 65 74 20 68 65 72 65 20 6f 6e 20 22 64 72 6f  get here on "dro
6830: 70 20 74 68 72 6f 75 67 68 22 20 2d 20 6c 6f 6f  p through" - loo
6840: 70 20 66 6f 72 20 6e 65 78 74 20 74 65 73 74 20  p for next test 
6850: 69 6e 20 71 75 65 75 65 0a 20 20 20 20 3b 3b 20  in queue.    ;; 
6860: 46 49 58 4d 45 21 21 21 21 20 54 48 49 53 20 53  FIXME!!!! THIS S
6870: 48 4f 55 4c 44 20 4e 4f 54 20 52 45 51 55 49 52  HOULD NOT REQUIR
6880: 45 20 41 4e 20 45 58 49 54 21 21 21 21 21 21 21  E AN EXIT!!!!!!!
6890: 0a 20 20 20 20 0a 20 20 20 20 28 64 65 62 75 67  .    .    (debug
68a0: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 41  :print-info 1 "A
68b0: 6c 6c 20 74 65 73 74 73 20 6c 61 75 6e 63 68 65  ll tests launche
68c0: 64 22 29 0a 20 20 20 20 28 74 68 72 65 61 64 2d  d").    (thread-
68d0: 73 6c 65 65 70 21 20 30 2e 35 29 0a 20 20 20 20  sleep! 0.5).    
68e0: 3b 3b 20 46 49 58 4d 45 21 20 54 68 69 73 20 68  ;; FIXME! This h
68f0: 61 72 73 68 20 65 78 69 74 20 73 68 6f 75 6c 64  arsh exit should
6900: 20 6e 6f 74 20 62 65 20 6e 65 63 65 73 73 61 72   not be necessar
6910: 79 2e 2e 2e 2e 0a 20 20 20 20 3b 3b 20 28 69 66  y.....    ;; (if
6920: 20 28 6e 6f 74 20 2a 72 75 6e 72 65 6d 6f 74 65   (not *runremote
6930: 2a 29 28 65 78 69 74 29 29 20 3b 3b 20 0a 20 20  *)(exit)) ;; .  
6940: 20 20 23 66 29 29 20 3b 3b 20 72 65 74 75 72 6e    #f)) ;; return
6950: 20 61 20 23 66 20 61 73 20 61 20 68 69 6e 74 20   a #f as a hint 
6960: 74 68 61 74 20 77 65 20 61 72 65 20 64 6f 6e 65  that we are done
6970: 0a 20 20 3b 3b 20 48 65 72 65 20 77 65 20 6e 65  .  ;; Here we ne
6980: 65 64 20 74 6f 20 63 68 65 63 6b 20 74 68 61 74  ed to check that
6990: 20 61 6c 6c 20 74 68 65 20 74 65 73 74 73 20 72   all the tests r
69a0: 65 6d 61 69 6e 69 6e 67 20 74 6f 20 62 65 20 72  emaining to be r
69b0: 75 6e 20 61 72 65 20 65 6c 69 67 69 62 6c 65 20  un are eligible 
69c0: 74 6f 20 72 75 6e 0a 20 20 3b 3b 20 61 6e 64 20  to run.  ;; and 
69d0: 61 72 65 20 6e 6f 74 20 62 6c 6f 63 6b 65 64 20  are not blocked 
69e0: 62 79 20 66 61 69 6c 65 64 0a 20 20 0a 0a 3b 3b  by failed.  ..;;
69f0: 20 70 61 72 65 6e 74 2d 74 65 73 74 20 69 73 20   parent-test is 
6a00: 74 68 65 72 65 20 61 73 20 61 20 70 6c 61 63 65  there as a place
6a10: 68 6f 6c 64 65 72 20 66 6f 72 20 77 68 65 6e 20  holder for when 
6a20: 70 61 72 65 6e 74 2d 74 65 73 74 73 20 63 61 6e  parent-tests can
6a30: 20 62 65 20 72 75 6e 20 61 73 20 61 20 73 65 74   be run as a set
6a40: 75 70 20 73 74 65 70 0a 28 64 65 66 69 6e 65 20  up step.(define 
6a50: 28 72 75 6e 3a 74 65 73 74 20 72 75 6e 2d 69 64  (run:test run-id
6a60: 20 72 75 6e 6e 61 6d 65 20 6b 65 79 76 61 6c 6c   runname keyvall
6a70: 73 74 20 74 65 73 74 2d 72 65 63 6f 72 64 20 66  st test-record f
6a80: 6c 61 67 73 20 70 61 72 65 6e 74 2d 74 65 73 74  lags parent-test
6a90: 29 0a 20 20 3b 3b 20 41 6c 6c 20 74 68 65 73 65  ).  ;; All these
6aa0: 20 76 61 72 73 20 6d 69 67 68 74 20 62 65 20 72   vars might be r
6ab0: 65 66 65 72 65 6e 63 65 64 20 62 79 20 74 68 65  eferenced by the
6ac0: 20 74 65 73 74 63 6f 6e 66 69 67 20 66 69 6c 65   testconfig file
6ad0: 20 72 65 61 64 65 72 0a 20 20 28 6c 65 74 2a 20   reader.  (let* 
6ae0: 28 28 74 65 73 74 2d 6e 61 6d 65 20 20 20 20 28  ((test-name    (
6af0: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
6b00: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 20 20 74  get-testname   t
6b10: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28  est-record)).. (
6b20: 74 65 73 74 2d 77 61 69 74 6f 6e 73 20 28 74 65  test-waitons (te
6b30: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65  sts:testqueue-ge
6b40: 74 2d 77 61 69 74 6f 6e 73 20 20 20 20 74 65 73  t-waitons    tes
6b50: 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65  t-record)).. (te
6b60: 73 74 2d 63 6f 6e 66 20 20 20 20 28 74 65 73 74  st-conf    (test
6b70: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d  s:testqueue-get-
6b80: 74 65 73 74 63 6f 6e 66 69 67 20 74 65 73 74 2d  testconfig test-
6b90: 72 65 63 6f 72 64 29 29 0a 09 20 28 69 74 65 6d  record)).. (item
6ba0: 64 61 74 20 20 20 20 20 20 28 74 65 73 74 73 3a  dat      (tests:
6bb0: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74  testqueue-get-it
6bc0: 65 6d 64 61 74 20 20 20 20 74 65 73 74 2d 72 65  emdat    test-re
6bd0: 63 6f 72 64 29 29 0a 09 20 28 74 65 73 74 2d 70  cord)).. (test-p
6be0: 61 74 68 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f  ath    (conc *to
6bf0: 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 22  ppath* "/tests/"
6c00: 20 74 65 73 74 2d 6e 61 6d 65 29 29 20 3b 3b 20   test-name)) ;; 
6c10: 63 6f 75 6c 64 20 75 73 65 20 74 65 73 74 73 3a  could use tests:
6c20: 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 68  get-testconfig h
6c30: 65 72 65 20 2e 2e 2e 0a 09 20 28 66 6f 72 63 65  ere ..... (force
6c40: 20 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 61          (hash-ta
6c50: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20  ble-ref/default 
6c60: 66 6c 61 67 73 20 22 2d 66 6f 72 63 65 22 20 23  flags "-force" #
6c70: 66 29 29 0a 09 20 28 72 65 72 75 6e 20 20 20 20  f)).. (rerun    
6c80: 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d      (hash-table-
6c90: 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67  ref/default flag
6ca0: 73 20 22 2d 72 65 72 75 6e 22 20 23 66 29 29 0a  s "-rerun" #f)).
6cb0: 09 20 28 6b 65 65 70 67 6f 69 6e 67 20 20 20 20  . (keepgoing    
6cc0: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f  (hash-table-ref/
6cd0: 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d  default flags "-
6ce0: 6b 65 65 70 67 6f 69 6e 67 22 20 23 66 29 29 0a  keepgoing" #f)).
6cf0: 09 20 28 69 74 65 6d 2d 70 61 74 68 20 20 20 20  . (item-path    
6d00: 20 22 22 29 0a 09 20 28 64 62 20 20 20 20 20 20   "").. (db      
6d10: 20 20 20 20 20 23 66 29 29 0a 20 20 20 20 28 64       #f)).    (d
6d20: 65 62 75 67 3a 70 72 69 6e 74 20 34 0a 09 09 20  ebug:print 4... 
6d30: 22 74 65 73 74 2d 63 6f 6e 66 69 67 3a 20 22 20  "test-config: " 
6d40: 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61 6c 69  (hash-table->ali
6d50: 73 74 20 74 65 73 74 2d 63 6f 6e 66 29 0a 09 09  st test-conf)...
6d60: 20 22 5c 6e 20 20 20 69 74 65 6d 64 61 74 3a 20   "\n   itemdat: 
6d70: 22 20 69 74 65 6d 64 61 74 0a 09 09 20 29 0a 20  " itemdat... ). 
6d80: 20 20 20 3b 3b 20 73 65 74 74 69 6e 67 20 69 74     ;; setting it
6d90: 65 6d 64 61 74 20 74 6f 20 61 20 6c 69 73 74 20  emdat to a list 
6da0: 69 66 20 69 74 20 69 73 20 23 66 0a 20 20 20 20  if it is #f.    
6db0: 28 69 66 20 28 6e 6f 74 20 69 74 65 6d 64 61 74  (if (not itemdat
6dc0: 29 28 73 65 74 21 20 69 74 65 6d 64 61 74 20 27  )(set! itemdat '
6dd0: 28 29 29 29 0a 20 20 20 20 28 73 65 74 21 20 69  ())).    (set! i
6de0: 74 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c  tem-path (item-l
6df0: 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61  ist->path itemda
6e00: 74 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70  t)).    (debug:p
6e10: 72 69 6e 74 20 32 20 22 41 74 74 65 6d 70 74 69  rint 2 "Attempti
6e20: 6e 67 20 74 6f 20 6c 61 75 6e 63 68 20 74 65 73  ng to launch tes
6e30: 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 28 69  t " test-name (i
6e40: 66 20 28 65 71 75 61 6c 3f 20 69 74 65 6d 2d 70  f (equal? item-p
6e50: 61 74 68 20 22 2f 22 29 20 22 2f 22 20 69 74 65  ath "/") "/" ite
6e60: 6d 2d 70 61 74 68 29 29 0a 20 20 20 20 28 73 65  m-path)).    (se
6e70: 74 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41  tenv "MT_TEST_NA
6e80: 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b  ME" test-name) ;
6e90: 3b 20 0a 20 20 20 20 28 73 65 74 65 6e 76 20 22  ; .    (setenv "
6ea0: 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20 72 75  MT_RUNNAME"   ru
6eb0: 6e 6e 61 6d 65 29 0a 20 20 20 20 28 73 65 74 2d  nname).    (set-
6ec0: 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72  megatest-env-var
6ed0: 73 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65  s run-id) ;; the
6ee0: 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64  se may be needed
6ef0: 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e   by the launchin
6f00: 67 20 70 72 6f 63 65 73 73 0a 20 20 20 20 28 63  g process.    (c
6f10: 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 79 20  hange-directory 
6f20: 2a 74 6f 70 70 61 74 68 2a 29 0a 0a 20 20 20 20  *toppath*)..    
6f30: 3b 3b 20 48 65 72 65 20 69 73 20 77 68 65 72 65  ;; Here is where
6f40: 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61 20 74   the test_meta t
6f50: 61 62 6c 65 20 69 73 20 62 65 73 74 20 75 70 64  able is best upd
6f60: 61 74 65 64 0a 20 20 20 20 3b 3b 20 59 65 73 2c  ated.    ;; Yes,
6f70: 20 61 6e 6f 74 68 65 72 20 75 73 65 20 6f 66 20   another use of 
6f80: 61 20 67 6c 6f 62 61 6c 20 66 6f 72 20 63 61 63  a global for cac
6f90: 68 69 6e 67 2e 20 4e 65 65 64 20 61 20 62 65 74  hing. Need a bet
6fa0: 74 65 72 20 77 61 79 3f 0a 20 20 20 20 28 69 66  ter way?.    (if
6fb0: 20 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 62 6c   (not (hash-tabl
6fc0: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 2a 74  e-ref/default *t
6fd0: 65 73 74 2d 6d 65 74 61 2d 75 70 64 61 74 65 64  est-meta-updated
6fe0: 2a 20 74 65 73 74 2d 6e 61 6d 65 20 23 66 29 29  * test-name #f))
6ff0: 0a 20 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a  .        (begin.
7000: 09 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d  .   (hash-table-
7010: 73 65 74 21 20 2a 74 65 73 74 2d 6d 65 74 61 2d  set! *test-meta-
7020: 75 70 64 61 74 65 64 2a 20 74 65 73 74 2d 6e 61  updated* test-na
7030: 6d 65 20 23 74 29 0a 20 20 20 20 20 20 20 20 20  me #t).         
7040: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73    (open-run-clos
7050: 65 20 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65  e runs:update-te
7060: 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74 2d  st_meta db test-
7070: 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 29  name test-conf))
7080: 29 0a 20 20 20 20 0a 20 20 20 20 3b 3b 20 28 6c  ).    .    ;; (l
7090: 61 6d 62 64 61 20 28 69 74 65 6d 64 61 74 29 20  ambda (itemdat) 
70a0: 3b 3b 3b 20 28 28 72 69 70 65 6e 65 73 73 20 22  ;;; ((ripeness "
70b0: 6f 76 65 72 72 69 70 65 22 29 20 28 74 65 6d 70  overripe") (temp
70c0: 65 72 61 74 75 72 65 20 22 63 6f 6f 6c 22 29 20  erature "cool") 
70d0: 28 73 65 61 73 6f 6e 20 22 73 75 6d 6d 65 72 22  (season "summer"
70e0: 29 29 0a 20 20 20 20 28 6c 65 74 2a 20 28 28 6e  )).    (let* ((n
70f0: 65 77 2d 74 65 73 74 2d 70 61 74 68 20 28 73 74  ew-test-path (st
7100: 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65  ring-intersperse
7110: 20 28 63 6f 6e 73 20 74 65 73 74 2d 70 61 74 68   (cons test-path
7120: 20 28 6d 61 70 20 63 61 64 72 20 69 74 65 6d 64   (map cadr itemd
7130: 61 74 29 29 20 22 2f 22 29 29 0a 09 20 20 20 28  at)) "/"))..   (
7140: 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 28 69  new-test-name (i
7150: 66 20 28 65 71 75 61 6c 3f 20 69 74 65 6d 2d 70  f (equal? item-p
7160: 61 74 68 20 22 22 29 20 74 65 73 74 2d 6e 61 6d  ath "") test-nam
7170: 65 20 28 63 6f 6e 63 20 74 65 73 74 2d 6e 61 6d  e (conc test-nam
7180: 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29  e "/" item-path)
7190: 29 29 20 3b 3b 20 6a 75 73 74 20 6e 65 65 64 20  )) ;; just need 
71a0: 69 74 20 74 6f 20 62 65 20 75 6e 69 71 75 65 0a  it to be unique.
71b0: 09 20 20 20 28 74 65 73 74 2d 69 64 20 20 20 20  .   (test-id    
71c0: 20 20 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72     (cdb:remote-r
71d0: 75 6e 20 64 62 3a 67 65 74 2d 74 65 73 74 2d 69  un db:get-test-i
71e0: 64 20 23 66 20 20 72 75 6e 2d 69 64 20 74 65 73  d #f  run-id tes
71f0: 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68  t-name item-path
7200: 29 29 0a 09 20 20 20 28 74 65 73 74 64 61 74 20  ))..   (testdat 
7210: 20 20 20 20 20 20 28 63 64 62 3a 67 65 74 2d 74        (cdb:get-t
7220: 65 73 74 2d 69 6e 66 6f 2d 62 79 2d 69 64 20 2a  est-info-by-id *
7230: 72 75 6e 72 65 6d 6f 74 65 2a 20 74 65 73 74 2d  runremote* test-
7240: 69 64 29 29 29 0a 20 20 20 20 20 20 28 69 66 20  id))).      (if 
7250: 28 6e 6f 74 20 74 65 73 74 64 61 74 29 0a 09 20  (not testdat).. 
7260: 20 28 62 65 67 69 6e 0a 09 20 20 20 20 3b 3b 20   (begin..    ;; 
7270: 65 6e 73 75 72 65 20 74 68 61 74 20 74 68 65 20  ensure that the 
7280: 70 61 74 68 20 65 78 69 73 74 73 20 62 65 66 6f  path exists befo
7290: 72 65 20 72 65 67 69 73 74 65 72 69 6e 67 20 74  re registering t
72a0: 68 65 20 74 65 73 74 0a 09 20 20 20 20 3b 3b 20  he test..    ;; 
72b0: 4e 4f 50 45 3a 20 43 61 6e 6e 6f 74 21 20 44 6f  NOPE: Cannot! Do
72c0: 6e 27 74 20 6b 6e 6f 77 20 79 65 74 20 77 68 69  n't know yet whi
72d0: 63 68 20 64 69 73 6b 20 61 72 65 61 20 77 69 6c  ch disk area wil
72e0: 6c 20 62 65 20 61 73 73 69 67 6e 65 64 2e 2e 2e  l be assigned...
72f0: 2e 0a 09 20 20 20 20 3b 3b 20 28 73 79 73 74 65  ...    ;; (syste
7300: 6d 20 28 63 6f 6e 63 20 22 6d 6b 64 69 72 20 2d  m (conc "mkdir -
7310: 70 20 22 20 6e 65 77 2d 74 65 73 74 2d 70 61 74  p " new-test-pat
7320: 68 29 29 0a 09 20 20 20 20 3b 3b 0a 09 20 20 20  h))..    ;;..   
7330: 20 3b 3b 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c   ;; (open-run-cl
7340: 6f 73 65 20 74 65 73 74 73 3a 72 65 67 69 73 74  ose tests:regist
7350: 65 72 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69  er-test db run-i
7360: 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d  d test-name item
7370: 2d 70 61 74 68 29 0a 09 20 20 20 20 3b 3b 0a 09  -path)..    ;;..
7380: 20 20 20 20 3b 3b 20 4e 42 2f 2f 20 66 6f 72 20      ;; NB// for 
7390: 74 68 65 20 61 62 6f 76 65 20 6c 69 6e 65 2e 20  the above line. 
73a0: 49 20 77 61 6e 74 20 74 68 65 20 74 65 73 74 20  I want the test 
73b0: 74 6f 20 62 65 20 72 65 67 69 73 74 65 72 65 64  to be registered
73c0: 20 6c 6f 6e 67 20 62 65 66 6f 72 65 20 74 68 69   long before thi
73d0: 73 20 72 6f 75 74 69 6e 65 20 67 65 74 73 20 63  s routine gets c
73e0: 61 6c 6c 65 64 21 0a 09 20 20 20 20 3b 3b 0a 09  alled!..    ;;..
73f0: 20 20 20 20 28 73 65 74 21 20 74 65 73 74 2d 69      (set! test-i
7400: 64 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73  d (open-run-clos
7410: 65 20 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 64  e db:get-test-id
7420: 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d   db run-id test-
7430: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29  name item-path))
7440: 0a 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20 74  ..    (if (not t
7450: 65 73 74 2d 69 64 29 0a 09 09 28 62 65 67 69 6e  est-id)...(begin
7460: 0a 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e  ...  (debug:prin
7470: 74 20 32 20 22 57 41 52 4e 3a 20 54 65 73 74 20  t 2 "WARN: Test 
7480: 6e 6f 74 20 70 72 65 2d 63 72 65 61 74 65 64 3f  not pre-created?
7490: 20 74 65 73 74 2d 6e 61 6d 65 3d 22 20 74 65 73   test-name=" tes
74a0: 74 2d 6e 61 6d 65 20 22 2c 20 69 74 65 6d 2d 70  t-name ", item-p
74b0: 61 74 68 3d 22 20 69 74 65 6d 2d 70 61 74 68 20  ath=" item-path 
74c0: 22 2c 20 72 75 6e 2d 69 64 3d 22 20 72 75 6e 2d  ", run-id=" run-
74d0: 69 64 29 0a 09 09 20 20 28 63 64 62 3a 74 65 73  id)...  (cdb:tes
74e0: 74 73 2d 72 65 67 69 73 74 65 72 2d 74 65 73 74  ts-register-test
74f0: 20 2a 72 75 6e 72 65 6d 6f 74 65 2a 20 72 75 6e   *runremote* run
7500: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74  -id test-name it
7510: 65 6d 2d 70 61 74 68 29 0a 09 09 20 20 28 73 65  em-path)...  (se
7520: 74 21 20 74 65 73 74 2d 69 64 20 28 6f 70 65 6e  t! test-id (open
7530: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65  -run-close db:ge
7540: 74 2d 74 65 73 74 2d 69 64 20 64 62 20 72 75 6e  t-test-id db run
7550: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74  -id test-name it
7560: 65 6d 2d 70 61 74 68 29 29 29 29 0a 09 20 20 20  em-path))))..   
7570: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
7580: 66 6f 20 34 20 22 74 65 73 74 2d 69 64 3d 22 20  fo 4 "test-id=" 
7590: 74 65 73 74 2d 69 64 20 22 2c 20 72 75 6e 2d 69  test-id ", run-i
75a0: 64 3d 22 20 72 75 6e 2d 69 64 20 22 2c 20 74 65  d=" run-id ", te
75b0: 73 74 2d 6e 61 6d 65 3d 22 20 74 65 73 74 2d 6e  st-name=" test-n
75c0: 61 6d 65 20 22 2c 20 69 74 65 6d 2d 70 61 74 68  ame ", item-path
75d0: 3d 5c 22 22 20 69 74 65 6d 2d 70 61 74 68 20 22  =\"" item-path "
75e0: 5c 22 22 29 0a 09 20 20 20 20 28 73 65 74 21 20  \"")..    (set! 
75f0: 74 65 73 74 64 61 74 20 28 63 64 62 3a 67 65 74  testdat (cdb:get
7600: 2d 74 65 73 74 2d 69 6e 66 6f 2d 62 79 2d 69 64  -test-info-by-id
7610: 20 2a 72 75 6e 72 65 6d 6f 74 65 2a 20 74 65 73   *runremote* tes
7620: 74 2d 69 64 29 29 29 29 0a 20 20 20 20 20 20 28  t-id)))).      (
7630: 73 65 74 21 20 74 65 73 74 2d 69 64 20 28 64 62  set! test-id (db
7640: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73  :test-get-id tes
7650: 74 64 61 74 29 29 0a 20 20 20 20 20 20 28 63 68  tdat)).      (ch
7660: 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 79 20 74  ange-directory t
7670: 65 73 74 2d 70 61 74 68 29 0a 20 20 20 20 20 20  est-path).      
7680: 28 63 61 73 65 20 28 69 66 20 66 6f 72 63 65 20  (case (if force 
7690: 3b 3b 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  ;; (args:get-arg
76a0: 20 22 2d 66 6f 72 63 65 22 29 0a 09 09 27 4e 4f   "-force")...'NO
76b0: 54 5f 53 54 41 52 54 45 44 0a 09 09 28 69 66 20  T_STARTED...(if 
76c0: 74 65 73 74 64 61 74 0a 09 09 20 20 20 20 28 73  testdat...    (s
76d0: 74 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c 20 28 74  tring->symbol (t
76e0: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65  est:get-state te
76f0: 73 74 64 61 74 29 29 0a 09 09 20 20 20 20 27 66  stdat))...    'f
7700: 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 72 74 29  ailed-to-insert)
7710: 29 0a 09 28 28 66 61 69 6c 65 64 2d 74 6f 2d 69  )..((failed-to-i
7720: 6e 73 65 72 74 29 0a 09 20 28 64 65 62 75 67 3a  nsert).. (debug:
7730: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
7740: 46 61 69 6c 65 64 20 74 6f 20 69 6e 73 65 72 74  Failed to insert
7750: 20 74 68 65 20 72 65 63 6f 72 64 20 69 6e 74 6f   the record into
7760: 20 74 68 65 20 64 62 22 29 29 0a 09 28 28 4e 4f   the db"))..((NO
7770: 54 5f 53 54 41 52 54 45 44 20 43 4f 4d 50 4c 45  T_STARTED COMPLE
7780: 54 45 44 20 44 45 4c 45 54 45 44 29 0a 09 20 28  TED DELETED).. (
7790: 6c 65 74 20 28 28 72 75 6e 66 6c 61 67 20 23 66  let ((runflag #f
77a0: 29 29 0a 09 20 20 20 28 63 6f 6e 64 0a 09 20 20  ))..   (cond..  
77b0: 20 20 3b 3b 20 2d 66 6f 72 63 65 2c 20 72 75 6e    ;; -force, run
77c0: 20 6e 6f 20 6d 61 74 74 65 72 20 77 68 61 74 0a   no matter what.
77d0: 09 20 20 20 20 28 66 6f 72 63 65 20 28 73 65 74  .    (force (set
77e0: 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09  ! runflag #t))..
77f0: 20 20 20 20 3b 3b 20 4e 4f 54 5f 53 54 41 52 54      ;; NOT_START
7800: 45 44 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65  ED, run no matte
7810: 72 20 77 68 61 74 0a 09 20 20 20 20 28 28 6d 65  r what..    ((me
7820: 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73  mber (test:get-s
7830: 74 61 74 65 20 74 65 73 74 64 61 74 29 20 27 28  tate testdat) '(
7840: 22 44 45 4c 45 54 45 44 22 20 22 4e 4f 54 5f 53  "DELETED" "NOT_S
7850: 54 41 52 54 45 44 22 29 29 28 73 65 74 21 20 72  TARTED"))(set! r
7860: 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20  unflag #t))..   
7870: 20 3b 3b 20 6e 6f 74 20 2d 72 65 72 75 6e 20 61   ;; not -rerun a
7880: 6e 64 20 50 41 53 53 2c 20 57 41 52 4e 20 6f 72  nd PASS, WARN or
7890: 20 43 48 45 43 4b 2c 20 64 6f 20 6e 6f 20 72 75   CHECK, do no ru
78a0: 6e 0a 09 20 20 20 20 28 28 61 6e 64 20 28 6f 72  n..    ((and (or
78b0: 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09 20   (not rerun)... 
78c0: 20 20 20 20 20 6b 65 65 70 67 6f 69 6e 67 29 0a       keepgoing).
78d0: 09 09 20 20 3b 3b 20 52 65 71 75 69 72 65 20 74  ..  ;; Require t
78e0: 6f 20 66 6f 72 63 65 20 72 65 2d 72 75 6e 20 66  o force re-run f
78f0: 6f 72 20 43 4f 4d 50 4c 45 54 45 44 20 6f 72 20  or COMPLETED or 
7900: 2a 61 6e 79 74 68 69 6e 67 2a 20 2b 20 50 41 53  *anything* + PAS
7910: 53 2c 57 41 52 4e 20 6f 72 20 43 48 45 43 4b 0a  S,WARN or CHECK.
7920: 09 09 20 20 28 6f 72 20 28 6d 65 6d 62 65 72 20  ..  (or (member 
7930: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73  (test:get-status
7940: 20 74 65 73 74 64 61 74 29 20 27 28 22 50 41 53   testdat) '("PAS
7950: 53 22 20 22 57 41 52 4e 22 20 22 43 48 45 43 4b  S" "WARN" "CHECK
7960: 22 20 22 53 4b 49 50 22 29 29 0a 09 09 20 20 20  " "SKIP"))...   
7970: 20 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74     (member (test
7980: 3a 67 65 74 2d 73 74 61 74 65 20 20 74 65 73 74  :get-state  test
7990: 64 61 74 29 20 27 28 22 43 4f 4d 50 4c 45 54 45  dat) '("COMPLETE
79a0: 44 22 29 29 29 29 20 0a 09 20 20 20 20 20 28 64  D")))) ..     (d
79b0: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
79c0: 32 20 22 72 75 6e 6e 69 6e 67 20 74 65 73 74 20  2 "running test 
79d0: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20  " test-name "/" 
79e0: 69 74 65 6d 2d 70 61 74 68 20 22 20 73 75 70 70  item-path " supp
79f0: 72 65 73 73 65 64 20 61 73 20 69 74 20 69 73 20  ressed as it is 
7a00: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  " (test:get-stat
7a10: 65 20 74 65 73 74 64 61 74 29 20 22 20 61 6e 64  e testdat) " and
7a20: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61   " (test:get-sta
7a30: 74 75 73 20 74 65 73 74 64 61 74 29 29 0a 09 20  tus testdat)).. 
7a40: 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61      (set! runfla
7a50: 67 20 23 66 29 29 0a 09 20 20 20 20 3b 3b 20 2d  g #f))..    ;; -
7a60: 72 65 72 75 6e 20 61 6e 64 20 73 74 61 74 75 73  rerun and status
7a70: 20 69 73 20 6f 6e 65 20 6f 66 20 74 68 65 20 73   is one of the s
7a80: 70 65 63 69 66 65 64 2c 20 72 75 6e 20 69 74 0a  pecifed, run it.
7a90: 09 20 20 20 20 28 28 61 6e 64 20 72 65 72 75 6e  .    ((and rerun
7aa0: 0a 09 09 20 20 28 6c 65 74 2a 20 28 28 72 65 72  ...  (let* ((rer
7ab0: 75 6e 6c 73 74 20 20 20 28 73 74 72 69 6e 67 2d  unlst   (string-
7ac0: 73 70 6c 69 74 20 72 65 72 75 6e 20 22 2c 22 29  split rerun ",")
7ad0: 29 0a 09 09 09 20 28 6d 75 73 74 2d 72 65 72 75  ).... (must-reru
7ae0: 6e 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a  n (member (test:
7af0: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64  get-status testd
7b00: 61 74 29 20 72 65 72 75 6e 6c 73 74 29 29 29 0a  at) rerunlst))).
7b10: 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ..    (debug:pri
7b20: 6e 74 2d 69 6e 66 6f 20 33 20 22 2d 72 65 72 75  nt-info 3 "-reru
7b30: 6e 20 6c 69 73 74 3a 20 22 20 72 65 72 75 6e 20  n list: " rerun 
7b40: 22 2c 20 74 65 73 74 2d 73 74 61 74 75 73 3a 20  ", test-status: 
7b50: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  " (test:get-stat
7b60: 75 73 20 74 65 73 74 64 61 74 29 22 2c 20 6d 75  us testdat)", mu
7b70: 73 74 2d 72 65 72 75 6e 3a 20 22 20 6d 75 73 74  st-rerun: " must
7b80: 2d 72 65 72 75 6e 29 0a 09 09 20 20 20 20 6d 75  -rerun)...    mu
7b90: 73 74 2d 72 65 72 75 6e 29 29 0a 09 20 20 20 20  st-rerun))..    
7ba0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
7bb0: 66 6f 20 32 20 22 52 65 72 75 6e 20 66 6f 72 63  fo 2 "Rerun forc
7bc0: 65 64 20 66 6f 72 20 74 65 73 74 20 22 20 74 65  ed for test " te
7bd0: 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d  st-name "/" item
7be0: 2d 70 61 74 68 29 0a 09 20 20 20 20 20 28 73 65  -path)..     (se
7bf0: 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a  t! runflag #t)).
7c00: 09 20 20 20 20 3b 3b 20 2d 6b 65 65 70 67 6f 69  .    ;; -keepgoi
7c10: 6e 67 2c 20 64 6f 20 6e 6f 74 20 72 65 72 75 6e  ng, do not rerun
7c20: 20 46 41 49 4c 0a 09 20 20 20 20 28 28 61 6e 64   FAIL..    ((and
7c30: 20 6b 65 65 70 67 6f 69 6e 67 0a 09 09 20 20 28   keepgoing...  (
7c40: 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74  member (test:get
7c50: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29  -status testdat)
7c60: 20 27 28 22 46 41 49 4c 22 29 29 29 0a 09 20 20   '("FAIL")))..  
7c70: 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67     (set! runflag
7c80: 20 23 66 29 29 0a 09 20 20 20 20 28 28 61 6e 64   #f))..    ((and
7c90: 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09 20   (not rerun)... 
7ca0: 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67   (member (test:g
7cb0: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61  et-status testda
7cc0: 74 29 20 27 28 22 46 41 49 4c 22 20 22 6e 2f 61  t) '("FAIL" "n/a
7cd0: 22 29 29 29 0a 09 20 20 20 20 20 28 73 65 74 21  ")))..     (set!
7ce0: 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20   runflag #t)).. 
7cf0: 20 20 20 28 65 6c 73 65 20 28 73 65 74 21 20 72     (else (set! r
7d00: 75 6e 66 6c 61 67 20 23 66 29 29 29 0a 09 20 20  unflag #f)))..  
7d10: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 36 20   (debug:print 6 
7d20: 22 52 55 4e 4e 49 4e 47 20 3d 3e 20 72 75 6e 66  "RUNNING => runf
7d30: 6c 61 67 3a 20 22 20 72 75 6e 66 6c 61 67 20 22  lag: " runflag "
7d40: 20 53 54 41 54 45 3a 20 22 20 28 74 65 73 74 3a   STATE: " (test:
7d50: 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61  get-state testda
7d60: 74 29 20 22 20 53 54 41 54 55 53 3a 20 22 20 28  t) " STATUS: " (
7d70: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20  test:get-status 
7d80: 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 28 69  testdat))..   (i
7d90: 66 20 28 6e 6f 74 20 72 75 6e 66 6c 61 67 29 0a  f (not runflag).
7da0: 09 20 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74  .       (if (not
7db0: 20 70 61 72 65 6e 74 2d 74 65 73 74 29 0a 09 09   parent-test)...
7dc0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
7dd0: 31 20 22 4e 4f 54 45 3a 20 4e 6f 74 20 73 74 61  1 "NOTE: Not sta
7de0: 72 74 69 6e 67 20 74 65 73 74 20 22 20 6e 65 77  rting test " new
7df0: 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 73 20  -test-name " as 
7e00: 69 74 20 69 73 20 73 74 61 74 65 20 5c 22 22 20  it is state \"" 
7e10: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20  (test:get-state 
7e20: 74 65 73 74 64 61 74 29 20 0a 09 09 09 09 22 5c  testdat) ....."\
7e30: 22 20 61 6e 64 20 73 74 61 74 75 73 20 5c 22 22  " and status \""
7e40: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75   (test:get-statu
7e50: 73 20 74 65 73 74 64 61 74 29 20 22 5c 22 2c 20  s testdat) "\", 
7e60: 75 73 65 20 2d 72 65 72 75 6e 20 5c 22 22 20 28  use -rerun \"" (
7e70: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20  test:get-status 
7e80: 74 65 73 74 64 61 74 29 0a 20 20 20 20 20 20 20  testdat).       
7e90: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
7ea0: 20 20 20 20 20 20 20 20 20 22 5c 22 20 6f 72 20           "\" or 
7eb0: 2d 66 6f 72 63 65 20 74 6f 20 6f 76 65 72 72 69  -force to overri
7ec0: 64 65 22 29 29 0a 09 20 20 20 20 20 20 20 3b 3b  de"))..       ;;
7ed0: 20 4e 4f 54 45 3a 20 4e 6f 20 6c 6f 6e 67 65 72   NOTE: No longer
7ee0: 20 62 65 20 63 68 65 63 6b 69 6e 67 20 70 72 65   be checking pre
7ef0: 72 65 71 75 69 73 69 74 65 73 20 68 65 72 65 21  requisites here!
7f00: 20 57 69 6c 6c 20 6e 65 76 65 72 20 67 65 74 20   Will never get 
7f10: 68 65 72 65 20 75 6e 6c 65 73 73 20 70 72 65 72  here unless prer
7f20: 65 71 73 20 61 72 65 0a 09 20 20 20 20 20 20 20  eqs are..       
7f30: 3b 3b 20 20 20 20 20 20 20 61 6c 72 65 61 64 79  ;;       already
7f40: 20 6d 65 74 2e 0a 09 20 20 20 20 20 20 20 3b 3b   met...       ;;
7f50: 20 54 68 69 73 20 77 6f 75 6c 64 20 62 65 20 61   This would be a
7f60: 20 67 72 65 61 74 20 70 6c 61 63 65 20 74 6f 20   great place to 
7f70: 64 6f 20 74 68 65 20 70 72 6f 63 65 73 73 2d 66  do the process-f
7f80: 6f 72 6b 0a 09 20 20 20 20 20 20 20 28 69 66 20  ork..       (if 
7f90: 28 6e 6f 74 20 28 6c 61 75 6e 63 68 2d 74 65 73  (not (launch-tes
7fa0: 74 20 23 66 20 72 75 6e 2d 69 64 20 72 75 6e 6e  t #f run-id runn
7fb0: 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 20 6b 65  ame test-conf ke
7fc0: 79 76 61 6c 6c 73 74 20 74 65 73 74 2d 6e 61 6d  yvallst test-nam
7fd0: 65 20 74 65 73 74 2d 70 61 74 68 20 69 74 65 6d  e test-path item
7fe0: 64 61 74 20 66 6c 61 67 73 29 29 0a 09 09 20 20  dat flags))...  
7ff0: 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20 28   (begin...     (
8000: 70 72 69 6e 74 20 22 45 52 52 4f 52 3a 20 46 61  print "ERROR: Fa
8010: 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 74  iled to launch t
8020: 68 65 20 74 65 73 74 2e 20 45 78 69 74 69 6e 67  he test. Exiting
8030: 20 61 73 20 73 6f 6f 6e 20 61 73 20 70 6f 73 73   as soon as poss
8040: 69 62 6c 65 22 29 0a 09 09 20 20 20 20 20 28 73  ible")...     (s
8050: 65 74 21 20 2a 67 6c 6f 62 61 6c 65 78 69 74 73  et! *globalexits
8060: 74 61 74 75 73 2a 20 31 29 20 3b 3b 20 0a 09 09  tatus* 1) ;; ...
8070: 20 20 20 20 20 28 70 72 6f 63 65 73 73 2d 73 69       (process-si
8080: 67 6e 61 6c 20 28 63 75 72 72 65 6e 74 2d 70 72  gnal (current-pr
8090: 6f 63 65 73 73 2d 69 64 29 20 73 69 67 6e 61 6c  ocess-id) signal
80a0: 2f 6b 69 6c 6c 29 29 29 29 29 29 0a 09 28 28 4b  /kill))))))..((K
80b0: 49 4c 4c 45 44 29 20 0a 09 20 28 64 65 62 75 67  ILLED) .. (debug
80c0: 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20  :print 1 "NOTE: 
80d0: 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20  " new-test-name 
80e0: 22 20 69 73 20 61 6c 72 65 61 64 79 20 72 75 6e  " is already run
80f0: 6e 69 6e 67 20 6f 72 20 77 61 73 20 65 78 70 6c  ning or was expl
8100: 69 63 74 6c 79 20 6b 69 6c 6c 65 64 2c 20 75 73  ictly killed, us
8110: 65 20 2d 66 6f 72 63 65 20 74 6f 20 6c 61 75 6e  e -force to laun
8120: 63 68 20 69 74 2e 22 29 29 0a 09 28 28 4c 41 55  ch it."))..((LAU
8130: 4e 43 48 45 44 20 52 45 4d 4f 54 45 48 4f 53 54  NCHED REMOTEHOST
8140: 53 54 41 52 54 20 52 55 4e 4e 49 4e 47 29 20 20  START RUNNING)  
8150: 0a 09 20 28 69 66 20 28 3e 20 28 2d 20 28 63 75  .. (if (> (- (cu
8160: 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73 29 28 2b  rrent-seconds)(+
8170: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 65 76   (db:test-get-ev
8180: 65 6e 74 5f 74 69 6d 65 20 74 65 73 74 64 61 74  ent_time testdat
8190: 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 64 62  ).....       (db
81a0: 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 5f 64 75  :test-get-run_du
81b0: 72 61 74 69 6f 6e 20 74 65 73 74 64 61 74 29 29  ration testdat))
81c0: 29 0a 09 09 36 30 30 29 20 3b 3b 20 69 2e 65 2e  )...600) ;; i.e.
81d0: 20 6e 6f 20 75 70 64 61 74 65 20 66 6f 72 20 6d   no update for m
81e0: 6f 72 65 20 74 68 61 6e 20 36 30 30 20 73 65 63  ore than 600 sec
81f0: 6f 6e 64 73 0a 09 20 20 20 20 20 28 62 65 67 69  onds..     (begi
8200: 6e 0a 09 20 20 20 20 20 20 20 28 64 65 62 75 67  n..       (debug
8210: 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e  :print 0 "WARNIN
8220: 47 3a 20 54 65 73 74 20 22 20 74 65 73 74 2d 6e  G: Test " test-n
8230: 61 6d 65 20 22 20 61 70 70 65 61 72 73 20 74 6f  ame " appears to
8240: 20 62 65 20 64 65 61 64 2e 20 46 6f 72 63 69 6e   be dead. Forcin
8250: 67 20 69 74 20 74 6f 20 73 74 61 74 65 20 49 4e  g it to state IN
8260: 43 4f 4d 50 4c 45 54 45 20 61 6e 64 20 73 74 61  COMPLETE and sta
8270: 74 75 73 20 53 54 55 43 4b 2f 44 45 41 44 22 29  tus STUCK/DEAD")
8280: 0a 09 20 20 20 20 20 20 20 28 74 65 73 74 73 3a  ..       (tests:
8290: 74 65 73 74 2d 73 65 74 2d 73 74 61 74 75 73 21  test-set-status!
82a0: 20 74 65 73 74 2d 69 64 20 22 49 4e 43 4f 4d 50   test-id "INCOMP
82b0: 4c 45 54 45 22 20 22 53 54 55 43 4b 2f 44 45 41  LETE" "STUCK/DEA
82c0: 44 22 20 22 54 65 73 74 20 69 73 20 73 74 75 63  D" "Test is stuc
82d0: 6b 20 6f 72 20 64 65 61 64 22 20 23 66 29 29 0a  k or dead" #f)).
82e0: 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  .     (debug:pri
82f0: 6e 74 20 32 20 22 4e 4f 54 45 3a 20 22 20 74 65  nt 2 "NOTE: " te
8300: 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72  st-name " is alr
8310: 65 61 64 79 20 72 75 6e 6e 69 6e 67 22 29 29 29  eady running")))
8320: 0a 09 28 65 6c 73 65 20 20 20 20 20 20 20 28 64  ..(else       (d
8330: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
8340: 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c  ROR: Failed to l
8350: 61 75 6e 63 68 20 74 65 73 74 20 22 20 6e 65 77  aunch test " new
8360: 2d 74 65 73 74 2d 6e 61 6d 65 20 22 2e 20 55 6e  -test-name ". Un
8370: 72 65 63 6f 67 6e 69 73 65 64 20 73 74 61 74 65  recognised state
8380: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61   " (test:get-sta
8390: 74 65 20 74 65 73 74 64 61 74 29 29 29 29 29 29  te testdat))))))
83a0: 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  )..;;===========
83b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
83c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
83d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
83e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 45  ===========.;; E
83f0: 4e 44 20 4f 46 20 4e 45 57 20 53 54 55 46 46 0a  ND OF NEW STUFF.
8400: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;;==============
8410: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8420: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8430: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8440: 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e  ========..(defin
8450: 65 20 28 67 65 74 2d 64 69 72 2d 75 70 2d 6e 20  e (get-dir-up-n 
8460: 64 69 72 20 2e 20 70 61 72 61 6d 73 29 20 0a 20  dir . params) . 
8470: 20 28 6c 65 74 20 28 28 64 70 61 72 74 73 20 20   (let ((dparts  
8480: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 64 69  (string-split di
8490: 72 20 22 2f 22 29 29 0a 09 28 63 6f 75 6e 74 20  r "/"))..(count 
84a0: 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 70 61 72    (if (null? par
84b0: 61 6d 73 29 20 31 20 28 63 61 72 20 70 61 72 61  ams) 1 (car para
84c0: 6d 73 29 29 29 29 0a 20 20 20 20 28 63 6f 6e 63  ms)))).    (conc
84d0: 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74   "/" (string-int
84e0: 65 72 73 70 65 72 73 65 20 0a 09 20 20 20 20 20  ersperse ..     
84f0: 20 20 28 74 61 6b 65 20 64 70 61 72 74 73 20 28    (take dparts (
8500: 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73  - (length dparts
8510: 29 20 63 6f 75 6e 74 29 29 0a 09 20 20 20 20 20  ) count))..     
8520: 20 20 22 2f 22 29 29 29 29 0a 3b 3b 20 52 65 6d    "/")))).;; Rem
8530: 6f 76 65 20 72 75 6e 73 0a 3b 3b 20 66 69 65 6c  ove runs.;; fiel
8540: 64 73 20 61 72 65 20 70 61 73 73 69 6e 67 20 69  ds are passing i
8550: 6e 20 74 68 72 6f 75 67 68 20 0a 3b 3b 20 61 63  n through .;; ac
8560: 74 69 6f 6e 3a 0a 3b 3b 20 20 20 20 27 72 65 6d  tion:.;;    'rem
8570: 6f 76 65 2d 72 75 6e 73 0a 3b 3b 20 20 20 20 27  ove-runs.;;    '
8580: 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73  set-state-status
8590: 0a 3b 3b 0a 3b 3b 20 4e 42 2f 2f 20 73 68 6f 75  .;;.;; NB// shou
85a0: 6c 64 20 70 61 73 73 20 69 6e 20 6b 65 79 73 3f  ld pass in keys?
85b0: 0a 3b 3b 0a 28 64 65 66 69 6e 65 20 28 72 75 6e  .;;.(define (run
85c0: 73 3a 6f 70 65 72 61 74 65 2d 6f 6e 20 61 63 74  s:operate-on act
85d0: 69 6f 6e 20 72 75 6e 6e 61 6d 65 70 61 74 74 20  ion runnamepatt 
85e0: 74 65 73 74 70 61 74 74 20 23 21 6b 65 79 20 28  testpatt #!key (
85f0: 73 74 61 74 65 20 23 66 29 28 73 74 61 74 75 73  state #f)(status
8600: 20 23 66 29 28 6e 65 77 2d 73 74 61 74 65 2d 73   #f)(new-state-s
8610: 74 61 74 75 73 20 23 66 29 29 0a 20 20 28 63 6f  tatus #f)).  (co
8620: 6d 6d 6f 6e 3a 63 6c 65 61 72 2d 63 61 63 68 65  mmon:clear-cache
8630: 73 29 20 3b 3b 20 63 6c 65 61 72 20 61 6c 6c 20  s) ;; clear all 
8640: 63 61 63 68 65 73 0a 20 20 28 6c 65 74 2a 20 28  caches.  (let* (
8650: 28 64 62 20 20 20 20 20 20 20 20 20 20 20 23 66  (db           #f
8660: 29 0a 09 20 28 6b 65 79 73 20 20 20 20 20 20 20  ).. (keys       
8670: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73    (open-run-clos
8680: 65 20 64 62 3a 67 65 74 2d 6b 65 79 73 20 64 62  e db:get-keys db
8690: 29 29 0a 09 20 28 72 75 6e 64 61 74 20 20 20 20  )).. (rundat    
86a0: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f     (open-run-clo
86b0: 73 65 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73  se runs:get-runs
86c0: 2d 62 79 2d 70 61 74 74 20 64 62 20 6b 65 79 73  -by-patt db keys
86d0: 20 72 75 6e 6e 61 6d 65 70 61 74 74 29 29 0a 09   runnamepatt))..
86e0: 20 28 68 65 61 64 65 72 20 20 20 20 20 20 20 28   (header       (
86f0: 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61  vector-ref runda
8700: 74 20 30 29 29 0a 09 20 28 72 75 6e 73 20 20 20  t 0)).. (runs   
8710: 20 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65        (vector-re
8720: 66 20 72 75 6e 64 61 74 20 31 29 29 0a 09 20 28  f rundat 1)).. (
8730: 73 74 61 74 65 73 20 20 20 20 20 20 20 28 69 66  states       (if
8740: 20 73 74 61 74 65 20 20 28 73 74 72 69 6e 67 2d   state  (string-
8750: 73 70 6c 69 74 20 73 74 61 74 65 20 20 22 2c 22  split state  ","
8760: 29 20 27 28 29 29 29 0a 09 20 28 73 74 61 74 75  ) '())).. (statu
8770: 73 65 73 20 20 20 20 20 28 69 66 20 73 74 61 74  ses     (if stat
8780: 75 73 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74  us (string-split
8790: 20 73 74 61 74 75 73 20 22 2c 22 29 20 27 28 29   status ",") '()
87a0: 29 29 0a 09 20 28 73 74 61 74 65 2d 73 74 61 74  )).. (state-stat
87b0: 75 73 20 28 69 66 20 28 73 74 72 69 6e 67 3f 20  us (if (string? 
87c0: 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73  new-state-status
87d0: 29 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20  ) (string-split 
87e0: 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73  new-state-status
87f0: 20 22 2c 22 29 20 27 28 23 66 20 23 66 29 29 29   ",") '(#f #f)))
8800: 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ).    (debug:pri
8810: 6e 74 2d 69 6e 66 6f 20 34 20 22 72 75 6e 73 3a  nt-info 4 "runs:
8820: 6f 70 65 72 61 74 65 2d 6f 6e 20 3d 3e 20 48 65  operate-on => He
8830: 61 64 65 72 3a 20 22 20 68 65 61 64 65 72 20 22  ader: " header "
8840: 20 61 63 74 69 6f 6e 3a 20 22 20 61 63 74 69 6f   action: " actio
8850: 6e 20 22 20 6e 65 77 2d 73 74 61 74 65 2d 73 74  n " new-state-st
8860: 61 74 75 73 3a 20 22 20 6e 65 77 2d 73 74 61 74  atus: " new-stat
8870: 65 2d 73 74 61 74 75 73 29 0a 20 20 20 20 28 69  e-status).    (i
8880: 66 20 28 3e 20 32 20 28 6c 65 6e 67 74 68 20 73  f (> 2 (length s
8890: 74 61 74 65 2d 73 74 61 74 75 73 29 29 0a 09 28  tate-status))..(
88a0: 62 65 67 69 6e 0a 09 20 20 28 64 65 62 75 67 3a  begin..  (debug:
88b0: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
88c0: 74 68 65 20 70 61 72 61 6d 65 74 65 72 20 74 6f  the parameter to
88d0: 20 2d 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74   -set-state-stat
88e0: 75 73 20 69 73 20 61 20 63 6f 6d 6d 61 20 64 65  us is a comma de
88f0: 6c 69 6d 69 74 65 64 20 73 74 72 69 6e 67 2e 20  limited string. 
8900: 45 2e 67 2e 20 43 4f 4d 50 4c 45 54 45 44 2c 46  E.g. COMPLETED,F
8910: 41 49 4c 22 29 0a 09 20 20 28 65 78 69 74 29 29  AIL")..  (exit))
8920: 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 0a  ).    (for-each.
8930: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 72 75       (lambda (ru
8940: 6e 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28  n).       (let (
8950: 28 72 75 6e 6b 65 79 20 28 73 74 72 69 6e 67 2d  (runkey (string-
8960: 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61 70  intersperse (map
8970: 20 28 6c 61 6d 62 64 61 20 28 6b 29 0a 09 09 09   (lambda (k)....
8980: 09 09 09 28 64 62 3a 67 65 74 2d 76 61 6c 75 65  ...(db:get-value
8990: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68  -by-header run h
89a0: 65 61 64 65 72 20 28 76 65 63 74 6f 72 2d 72 65  eader (vector-re
89b0: 66 20 6b 20 30 29 29 29 20 6b 65 79 73 29 20 22  f k 0))) keys) "
89c0: 2f 22 29 29 0a 09 20 20 20 20 20 28 64 69 72 73  /"))..     (dirs
89d0: 2d 74 6f 2d 72 65 6d 6f 76 65 20 28 6d 61 6b 65  -to-remove (make
89e0: 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 09  -hash-table)))..
89f0: 20 28 6c 65 74 2a 20 28 28 72 75 6e 2d 69 64 20   (let* ((run-id 
8a00: 20 20 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65     (db:get-value
8a10: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68  -by-header run h
8a20: 65 61 64 65 72 20 22 69 64 22 29 29 0a 09 09 28  eader "id"))...(
8a30: 72 75 6e 2d 73 74 61 74 65 20 28 64 62 3a 67 65  run-state (db:ge
8a40: 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65  t-value-by-heade
8a50: 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 73 74  r run header "st
8a60: 61 74 65 22 29 29 0a 09 09 28 74 65 73 74 73 20  ate"))...(tests 
8a70: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 65 71      (if (not (eq
8a80: 75 61 6c 3f 20 72 75 6e 2d 73 74 61 74 65 20 22  ual? run-state "
8a90: 6c 6f 63 6b 65 64 22 29 29 0a 09 09 09 20 20 20  locked"))....   
8aa0: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c      (open-run-cl
8ab0: 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 73  ose db:get-tests
8ac0: 2d 66 6f 72 2d 72 75 6e 20 64 62 20 72 75 6e 2d  -for-run db run-
8ad0: 69 64 0a 09 09 09 09 09 09 20 20 20 20 20 20 74  id.......      t
8ae0: 65 73 74 70 61 74 74 20 73 74 61 74 65 73 20 73  estpatt states s
8af0: 74 61 74 75 73 65 73 0a 09 09 09 09 09 09 20 20  tatuses.......  
8b00: 20 20 20 20 6e 6f 74 2d 69 6e 3a 20 20 23 66 0a      not-in:  #f.
8b10: 09 09 09 09 09 09 20 20 20 20 20 20 73 6f 72 74  ......      sort
8b20: 2d 62 79 3a 20 28 63 61 73 65 20 61 63 74 69 6f  -by: (case actio
8b30: 6e 0a 09 09 09 09 09 09 09 09 20 28 28 72 65 6d  n......... ((rem
8b40: 6f 76 65 2d 72 75 6e 73 29 20 27 72 75 6e 64 69  ove-runs) 'rundi
8b50: 72 29 0a 09 09 09 09 09 09 09 09 20 28 65 6c 73  r)......... (els
8b60: 65 20 20 20 20 20 20 20 20 20 20 27 65 76 65 6e  e          'even
8b70: 74 5f 74 69 6d 65 29 29 29 0a 09 09 09 20 20 20  t_time)))....   
8b80: 20 20 20 20 27 28 29 29 29 0a 09 09 28 6c 61 73      '()))...(las
8b90: 74 74 70 61 74 68 20 22 2f 64 6f 65 73 2f 6e 6f  ttpath "/does/no
8ba0: 74 2f 65 78 69 73 74 2f 49 2f 68 6f 70 65 22 29  t/exist/I/hope")
8bb0: 29 0a 09 20 20 20 28 64 65 62 75 67 3a 70 72 69  )..   (debug:pri
8bc0: 6e 74 2d 69 6e 66 6f 20 34 20 22 72 75 6e 73 3a  nt-info 4 "runs:
8bd0: 6f 70 65 72 61 74 65 2d 6f 6e 20 72 75 6e 3d 22  operate-on run="
8be0: 20 72 75 6e 20 22 2c 20 68 65 61 64 65 72 3d 22   run ", header="
8bf0: 20 68 65 61 64 65 72 29 0a 09 20 20 20 28 69 66   header)..   (if
8c00: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 73   (not (null? tes
8c10: 74 73 29 29 0a 09 20 20 20 20 20 20 20 28 62 65  ts))..       (be
8c20: 67 69 6e 0a 09 09 20 28 63 61 73 65 20 61 63 74  gin... (case act
8c30: 69 6f 6e 0a 09 09 20 20 20 28 28 72 65 6d 6f 76  ion...   ((remov
8c40: 65 2d 72 75 6e 73 29 0a 09 09 20 20 20 20 28 64  e-runs)...    (d
8c50: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65  ebug:print 1 "Re
8c60: 6d 6f 76 69 6e 67 20 74 65 73 74 73 20 66 6f 72  moving tests for
8c70: 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22   run: " runkey "
8c80: 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65   " (db:get-value
8c90: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68  -by-header run h
8ca0: 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29  eader "runname")
8cb0: 29 29 0a 09 09 20 20 20 28 28 73 65 74 2d 73 74  ))...   ((set-st
8cc0: 61 74 65 2d 73 74 61 74 75 73 29 0a 09 09 20 20  ate-status)...  
8cd0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31    (debug:print 1
8ce0: 20 22 4d 6f 64 69 66 79 69 6e 67 20 73 74 61 74   "Modifying stat
8cf0: 65 20 61 6e 64 20 73 74 61 75 73 20 66 6f 72 20  e and staus for 
8d00: 74 65 73 74 73 20 66 6f 72 20 72 75 6e 3a 20 22  tests for run: "
8d10: 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a   runkey " " (db:
8d20: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61  get-value-by-hea
8d30: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22  der run header "
8d40: 72 75 6e 6e 61 6d 65 22 29 29 29 0a 09 09 20 20  runname")))...  
8d50: 20 28 28 70 72 69 6e 74 2d 72 75 6e 29 0a 09 09   ((print-run)...
8d60: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
8d70: 20 31 20 22 50 72 69 6e 74 69 6e 67 20 69 6e 66   1 "Printing inf
8d80: 6f 20 66 6f 72 20 72 75 6e 20 22 20 72 75 6e 6b  o for run " runk
8d90: 65 79 20 22 2c 20 72 75 6e 3d 22 20 72 75 6e 20  ey ", run=" run 
8da0: 22 2c 20 74 65 73 74 73 3d 22 20 74 65 73 74 73  ", tests=" tests
8db0: 20 22 2c 20 68 65 61 64 65 72 3d 22 20 68 65 61   ", header=" hea
8dc0: 64 65 72 29 0a 09 09 20 20 20 20 61 63 74 69 6f  der)...    actio
8dd0: 6e 29 0a 09 09 20 20 20 28 65 6c 73 65 0a 09 09  n)...   (else...
8de0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
8df0: 2d 69 6e 66 6f 20 30 20 22 61 63 74 69 6f 6e 20  -info 0 "action 
8e00: 6e 6f 74 20 72 65 63 6f 67 6e 69 73 65 64 20 22  not recognised "
8e10: 20 61 63 74 69 6f 6e 29 29 29 0a 09 09 20 28 66   action)))... (f
8e20: 6f 72 2d 65 61 63 68 0a 09 09 20 20 28 6c 61 6d  or-each...  (lam
8e30: 62 64 61 20 28 74 65 73 74 29 0a 09 09 20 20 20  bda (test)...   
8e40: 20 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d 70 61   (let* ((item-pa
8e50: 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  th (db:test-get-
8e60: 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29  item-path test))
8e70: 0a 09 09 09 20 20 20 28 74 65 73 74 2d 6e 61 6d  ....   (test-nam
8e80: 65 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74  e (db:test-get-t
8e90: 65 73 74 6e 61 6d 65 20 74 65 73 74 29 29 0a 09  estname test))..
8ea0: 09 09 20 20 20 28 72 75 6e 2d 64 69 72 20 20 20  ..   (run-dir   
8eb0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e  (db:test-get-run
8ec0: 64 69 72 20 74 65 73 74 29 29 20 20 20 20 3b 3b  dir test))    ;;
8ed0: 20 72 75 6e 20 64 69 72 20 69 73 20 66 72 6f 6d   run dir is from
8ee0: 20 74 68 65 20 6c 69 6e 6b 20 74 72 65 65 0a 09   the link tree..
8ef0: 09 09 20 20 20 28 72 65 61 6c 2d 64 69 72 20 20  ..   (real-dir  
8f00: 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73  (if (file-exists
8f10: 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 09 09  ? run-dir)......
8f20: 20 20 28 72 65 73 6f 6c 76 65 2d 70 61 74 68 6e    (resolve-pathn
8f30: 61 6d 65 20 72 75 6e 2d 64 69 72 29 0a 09 09 09  ame run-dir)....
8f40: 09 09 20 20 23 66 29 29 0a 09 09 09 20 20 20 28  ..  #f))....   (
8f50: 74 65 73 74 2d 69 64 20 20 20 28 64 62 3a 74 65  test-id   (db:te
8f60: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29 29  st-get-id test))
8f70: 29 0a 09 09 20 20 20 20 20 20 3b 3b 20 20 20 28  )...      ;;   (
8f80: 74 64 62 20 20 20 20 20 20 20 28 64 62 3a 6f 70  tdb       (db:op
8f90: 65 6e 2d 74 65 73 74 2d 64 62 20 72 75 6e 2d 64  en-test-db run-d
8fa0: 69 72 29 29 29 0a 09 09 20 20 20 20 20 20 28 64  ir)))...      (d
8fb0: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
8fc0: 34 20 22 74 65 73 74 3d 22 20 74 65 73 74 29 20  4 "test=" test) 
8fd0: 3b 3b 20 20 20 22 20 28 64 62 3a 74 65 73 74 2d  ;;   " (db:test-
8fe0: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73  get-testname tes
8ff0: 74 29 20 22 20 69 64 3a 20 22 20 28 64 62 3a 74  t) " id: " (db:t
9000: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29  est-get-id test)
9010: 20 22 20 22 20 69 74 65 6d 2d 70 61 74 68 20 22   " " item-path "
9020: 20 61 63 74 69 6f 6e 3a 20 22 20 61 63 74 69 6f   action: " actio
9030: 6e 29 0a 09 09 20 20 20 20 20 20 28 63 61 73 65  n)...      (case
9040: 20 61 63 74 69 6f 6e 0a 09 09 09 28 28 72 65 6d   action....((rem
9050: 6f 76 65 2d 72 75 6e 73 29 20 3b 3b 20 74 68 65  ove-runs) ;; the
9060: 20 74 64 62 20 69 73 20 66 6f 72 20 66 75 74 75   tdb is for futu
9070: 72 65 20 70 6f 73 73 69 62 6c 65 2e 20 0a 09 09  re possible. ...
9080: 09 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73  . (open-run-clos
9090: 65 20 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74  e db:delete-test
90a0: 2d 72 65 63 6f 72 64 73 20 64 62 20 23 66 20 28  -records db #f (
90b0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74  db:test-get-id t
90c0: 65 73 74 29 29 0a 09 09 09 20 28 64 65 62 75 67  est)).... (debug
90d0: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 41  :print-info 1 "A
90e0: 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 72 65 6d  ttempting to rem
90f0: 6f 76 65 20 22 20 28 69 66 20 72 65 61 6c 2d 64  ove " (if real-d
9100: 69 72 20 28 63 6f 6e 63 20 22 20 64 69 72 20 22  ir (conc " dir "
9110: 20 72 65 61 6c 2d 64 69 72 20 22 20 61 6e 64 20   real-dir " and 
9120: 22 29 20 22 22 29 20 22 20 6c 69 6e 6b 20 22 20  ") "") " link " 
9130: 72 75 6e 2d 64 69 72 29 0a 09 09 09 20 28 69 66  run-dir).... (if
9140: 20 28 61 6e 64 20 72 65 61 6c 2d 64 69 72 20 0a   (and real-dir .
9150: 09 09 09 09 20 20 28 3e 20 28 73 74 72 69 6e 67  ....  (> (string
9160: 2d 6c 65 6e 67 74 68 20 72 65 61 6c 2d 64 69 72  -length real-dir
9170: 29 20 35 29 0a 09 09 09 09 20 20 28 66 69 6c 65  ) 5).....  (file
9180: 2d 65 78 69 73 74 73 3f 20 72 65 61 6c 2d 64 69  -exists? real-di
9190: 72 29 29 20 3b 3b 20 62 61 64 20 68 65 75 72 69  r)) ;; bad heuri
91a0: 73 74 69 63 20 62 75 74 20 73 68 6f 75 6c 64 20  stic but should 
91b0: 70 72 65 76 65 6e 74 20 2f 74 6d 70 20 2f 68 6f  prevent /tmp /ho
91c0: 6d 65 20 65 74 63 2e 0a 09 09 09 20 20 20 20 20  me etc.....     
91d0: 28 62 65 67 69 6e 20 3b 3b 20 6c 65 74 2a 20 28  (begin ;; let* (
91e0: 28 72 65 61 6c 70 61 74 68 20 28 72 65 73 6f 6c  (realpath (resol
91f0: 76 65 2d 70 61 74 68 6e 61 6d 65 20 72 75 6e 2d  ve-pathname run-
9200: 64 69 72 29 29 29 0a 09 09 09 20 20 20 20 20 20  dir)))....      
9210: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
9220: 66 6f 20 31 20 22 52 65 63 75 72 73 69 76 65 6c  fo 1 "Recursivel
9230: 79 20 72 65 6d 6f 76 69 6e 67 20 22 20 72 65 61  y removing " rea
9240: 6c 2d 64 69 72 29 0a 09 09 09 20 20 20 20 20 20  l-dir)....      
9250: 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74   (if (file-exist
9260: 73 3f 20 72 65 61 6c 2d 64 69 72 29 0a 09 09 09  s? real-dir)....
9270: 09 20 20 20 28 69 66 20 28 3e 20 28 73 79 73 74  .   (if (> (syst
9280: 65 6d 20 28 63 6f 6e 63 20 22 72 6d 20 2d 72 66  em (conc "rm -rf
9290: 20 22 20 72 65 61 6c 2d 64 69 72 29 29 20 30 29   " real-dir)) 0)
92a0: 0a 09 09 09 09 20 20 20 20 20 20 20 28 64 65 62  .....       (deb
92b0: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f  ug:print 0 "ERRO
92c0: 52 3a 20 54 68 65 72 65 20 77 61 73 20 61 20 70  R: There was a p
92d0: 72 6f 62 6c 65 6d 20 72 65 6d 6f 76 69 6e 67 20  roblem removing 
92e0: 22 20 72 65 61 6c 2d 64 69 72 20 22 20 77 69 74  " real-dir " wit
92f0: 68 20 72 6d 20 2d 66 22 29 29 0a 09 09 09 09 20  h rm -f"))..... 
9300: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
9310: 20 22 57 41 52 4e 49 4e 47 3a 20 74 65 73 74 20   "WARNING: test 
9320: 64 69 72 20 22 20 72 65 61 6c 2d 64 69 72 20 22  dir " real-dir "
9330: 20 61 70 70 65 61 72 73 20 74 6f 20 6e 6f 74 20   appears to not 
9340: 65 78 69 73 74 20 6f 72 20 69 73 20 6e 6f 74 20  exist or is not 
9350: 72 65 61 64 61 62 6c 65 22 29 29 29 0a 09 09 09  readable")))....
9360: 20 20 20 20 20 28 69 66 20 72 65 61 6c 2d 64 69       (if real-di
9370: 72 20 0a 09 09 09 09 20 28 64 65 62 75 67 3a 70  r ..... (debug:p
9380: 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a  rint 0 "WARNING:
9390: 20 64 69 72 65 63 74 6f 72 79 20 22 20 72 65 61   directory " rea
93a0: 6c 2d 64 69 72 20 22 20 64 6f 65 73 20 6e 6f 74  l-dir " does not
93b0: 20 65 78 69 73 74 22 29 0a 09 09 09 09 20 28 64   exist")..... (d
93c0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41  ebug:print 0 "WA
93d0: 52 4e 49 4e 47 3a 20 6e 6f 20 72 65 61 6c 20 64  RNING: no real d
93e0: 69 72 65 63 74 6f 72 79 20 63 6f 72 72 6f 73 70  irectory corrosp
93f0: 6f 6e 64 69 6e 67 20 74 6f 20 6c 69 6e 6b 20 22  onding to link "
9400: 20 72 75 6e 2d 64 69 72 20 22 2c 20 6e 6f 74 68   run-dir ", noth
9410: 69 6e 67 20 64 6f 6e 65 22 29 29 29 0a 09 09 09  ing done")))....
9420: 20 28 69 66 20 28 73 79 6d 62 6f 6c 69 63 2d 6c   (if (symbolic-l
9430: 69 6e 6b 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09  ink? run-dir)...
9440: 09 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09  .     (begin....
9450: 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72         (debug:pr
9460: 69 6e 74 2d 69 6e 66 6f 20 31 20 22 52 65 6d 6f  int-info 1 "Remo
9470: 76 69 6e 67 20 73 79 6d 6c 69 6e 6b 20 22 20 72  ving symlink " r
9480: 75 6e 2d 64 69 72 29 0a 09 09 09 20 20 20 20 20  un-dir)....     
9490: 20 20 28 68 61 6e 64 6c 65 2d 65 78 63 65 70 74    (handle-except
94a0: 69 6f 6e 73 0a 09 09 09 09 65 78 6e 0a 09 09 09  ions.....exn....
94b0: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20  .(debug:print 0 
94c0: 22 45 52 52 4f 52 3a 20 20 46 61 69 6c 65 64 20  "ERROR:  Failed 
94d0: 74 6f 20 72 65 6d 6f 76 65 20 73 79 6d 6c 69 6e  to remove symlin
94e0: 6b 20 22 20 72 75 6e 2d 64 69 72 20 28 28 63 6f  k " run-dir ((co
94f0: 6e 64 69 74 69 6f 6e 2d 70 72 6f 70 65 72 74 79  ndition-property
9500: 2d 61 63 63 65 73 73 6f 72 20 27 65 78 6e 20 27  -accessor 'exn '
9510: 6d 65 73 73 61 67 65 29 20 65 78 6e 29 20 22 2c  message) exn) ",
9520: 20 61 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 63   attempting to c
9530: 6f 6e 74 69 6e 75 65 22 29 0a 09 09 09 09 28 64  ontinue").....(d
9540: 65 6c 65 74 65 2d 66 69 6c 65 20 72 75 6e 2d 64  elete-file run-d
9550: 69 72 29 29 29 0a 09 09 09 20 20 20 20 20 28 69  ir)))....     (i
9560: 66 20 28 64 69 72 65 63 74 6f 72 79 3f 20 72 75  f (directory? ru
9570: 6e 2d 64 69 72 29 0a 09 09 09 09 20 28 69 66 20  n-dir)..... (if 
9580: 28 3e 20 28 64 69 72 65 63 74 6f 72 79 2d 66 6f  (> (directory-fo
9590: 6c 64 20 28 6c 61 6d 62 64 61 20 28 66 20 78 29  ld (lambda (f x)
95a0: 28 2b 20 31 20 78 29 29 20 30 20 72 75 6e 2d 64  (+ 1 x)) 0 run-d
95b0: 69 72 29 20 30 29 0a 09 09 09 09 20 20 20 20 20  ir) 0).....     
95c0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
95d0: 57 41 52 4e 49 4e 47 3a 20 72 65 66 75 73 69 6e  WARNING: refusin
95e0: 67 20 74 6f 20 72 65 6d 6f 76 65 20 22 20 72 75  g to remove " ru
95f0: 6e 2d 64 69 72 20 22 20 61 73 20 69 74 20 69 73  n-dir " as it is
9600: 20 6e 6f 74 20 65 6d 70 74 79 22 29 0a 09 09 09   not empty")....
9610: 09 20 20 20 20 20 20 28 68 61 6e 64 6c 65 2d 65  .      (handle-e
9620: 78 63 65 70 74 69 6f 6e 73 0a 09 09 09 09 20 20  xceptions.....  
9630: 20 20 20 20 20 65 78 6e 0a 09 09 09 09 20 20 20       exn.....   
9640: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
9650: 20 30 20 22 45 52 52 4f 52 3a 20 20 46 61 69 6c   0 "ERROR:  Fail
9660: 65 64 20 74 6f 20 72 65 6d 6f 76 65 20 64 69 72  ed to remove dir
9670: 65 63 74 6f 72 79 20 22 20 72 75 6e 2d 64 69 72  ectory " run-dir
9680: 20 28 28 63 6f 6e 64 69 74 69 6f 6e 2d 70 72 6f   ((condition-pro
9690: 70 65 72 74 79 2d 61 63 63 65 73 73 6f 72 20 27  perty-accessor '
96a0: 65 78 6e 20 27 6d 65 73 73 61 67 65 29 20 65 78  exn 'message) ex
96b0: 6e 29 20 22 2c 20 61 74 74 65 6d 70 74 69 6e 67  n) ", attempting
96c0: 20 74 6f 20 63 6f 6e 74 69 6e 75 65 22 29 0a 09   to continue")..
96d0: 09 09 09 20 20 20 20 20 20 20 28 64 65 6c 65 74  ...       (delet
96e0: 65 2d 64 69 72 65 63 74 6f 72 79 20 72 75 6e 2d  e-directory run-
96f0: 64 69 72 29 29 29 0a 09 09 09 09 20 28 69 66 20  dir)))..... (if 
9700: 72 75 6e 2d 64 69 72 0a 09 09 09 09 20 20 20 20  run-dir.....    
9710: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
9720: 22 57 41 52 4e 49 4e 47 3a 20 6e 6f 74 20 72 65  "WARNING: not re
9730: 6d 6f 76 69 6e 67 20 22 20 72 75 6e 2d 64 69 72  moving " run-dir
9740: 20 22 20 61 73 20 69 74 20 65 69 74 68 65 72 20   " as it either 
9750: 64 6f 65 73 6e 27 74 20 65 78 69 73 74 20 6f 72  doesn't exist or
9760: 20 69 73 20 6e 6f 74 20 61 20 73 79 6d 6c 69 6e   is not a symlin
9770: 6b 22 29 0a 09 09 09 09 20 20 20 20 20 28 64 65  k").....     (de
9780: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 4e 4f 54  bug:print 0 "NOT
9790: 45 3a 20 74 68 65 20 72 75 6e 20 64 69 72 20 66  E: the run dir f
97a0: 6f 72 20 74 68 69 73 20 74 65 73 74 20 69 73 20  or this test is 
97b0: 75 6e 64 65 66 69 6e 65 64 2e 20 54 65 73 74 20  undefined. Test 
97c0: 6d 61 79 20 68 61 76 65 20 61 6c 72 65 61 64 79  may have already
97d0: 20 62 65 65 6e 20 64 65 6c 65 74 65 64 2e 22 29   been deleted.")
97e0: 29 0a 09 09 09 09 20 29 29 29 0a 09 09 09 28 28  )..... )))....((
97f0: 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73  set-state-status
9800: 29 0a 09 09 09 20 28 64 65 62 75 67 3a 70 72 69  ).... (debug:pri
9810: 6e 74 2d 69 6e 66 6f 20 32 20 22 6e 65 77 20 73  nt-info 2 "new s
9820: 74 61 74 65 20 22 20 28 63 61 72 20 73 74 61 74  tate " (car stat
9830: 65 2d 73 74 61 74 75 73 29 20 22 2c 20 6e 65 77  e-status) ", new
9840: 20 73 74 61 74 75 73 20 22 20 28 63 61 64 72 20   status " (cadr 
9850: 73 74 61 74 65 2d 73 74 61 74 75 73 29 29 0a 09  state-status))..
9860: 09 09 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f  .. (open-run-clo
9870: 73 65 20 64 62 3a 74 65 73 74 2d 73 65 74 2d 73  se db:test-set-s
9880: 74 61 74 65 2d 73 74 61 74 75 73 2d 62 79 2d 69  tate-status-by-i
9890: 64 20 64 62 20 28 64 62 3a 74 65 73 74 2d 67 65  d db (db:test-ge
98a0: 74 2d 69 64 20 74 65 73 74 29 20 28 63 61 72 20  t-id test) (car 
98b0: 73 74 61 74 65 2d 73 74 61 74 75 73 29 28 63 61  state-status)(ca
98c0: 64 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 29  dr state-status)
98d0: 20 23 66 29 29 29 29 29 0a 09 09 20 20 28 73 6f   #f)))))...  (so
98e0: 72 74 20 74 65 73 74 73 20 28 6c 61 6d 62 64 61  rt tests (lambda
98f0: 20 28 61 20 62 29 28 6c 65 74 20 28 28 64 69 72   (a b)(let ((dir
9900: 61 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72  a (db:test-get-r
9910: 75 6e 64 69 72 20 61 29 29 0a 09 09 09 09 09 09  undir a)).......
9920: 20 28 64 69 72 62 20 28 64 62 3a 74 65 73 74 2d   (dirb (db:test-
9930: 67 65 74 2d 72 75 6e 64 69 72 20 62 29 29 29 0a  get-rundir b))).
9940: 09 09 09 09 09 20 20 20 20 20 28 69 66 20 28 61  .....     (if (a
9950: 6e 64 20 28 73 74 72 69 6e 67 3f 20 64 69 72 61  nd (string? dira
9960: 29 28 73 74 72 69 6e 67 3f 20 64 69 72 62 29 29  )(string? dirb))
9970: 0a 09 09 09 09 09 09 20 28 3e 20 28 73 74 72 69  ....... (> (stri
9980: 6e 67 2d 6c 65 6e 67 74 68 20 64 69 72 61 29 28  ng-length dira)(
9990: 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 64 69  string-length di
99a0: 72 62 29 29 0a 09 09 09 09 09 09 20 23 66 29 29  rb))....... #f))
99b0: 29 29 29 29 29 0a 09 20 20 20 3b 3b 20 72 65 6d  )))))..   ;; rem
99c0: 6f 76 65 20 74 68 65 20 72 75 6e 20 69 66 20 7a  ove the run if z
99d0: 65 72 6f 20 74 65 73 74 73 20 72 65 6d 61 69 6e  ero tests remain
99e0: 0a 09 20 20 20 28 69 66 20 28 65 71 3f 20 61 63  ..   (if (eq? ac
99f0: 74 69 6f 6e 20 27 72 65 6d 6f 76 65 2d 72 75 6e  tion 'remove-run
9a00: 73 29 0a 09 20 20 20 20 20 20 20 28 6c 65 74 20  s)..       (let 
9a10: 28 28 72 65 6d 74 65 73 74 73 20 28 6f 70 65 6e  ((remtests (open
9a20: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65  -run-close db:ge
9a30: 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20  t-tests-for-run 
9a40: 64 62 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65  db (db:get-value
9a50: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68  -by-header run h
9a60: 65 61 64 65 72 20 22 69 64 22 29 20 23 66 20 27  eader "id") #f '
9a70: 28 22 44 45 4c 45 54 45 44 22 29 20 27 28 22 6e  ("DELETED") '("n
9a80: 2f 61 22 29 20 6e 6f 74 2d 69 6e 3a 20 23 74 29  /a") not-in: #t)
9a90: 29 29 0a 09 09 20 28 69 66 20 28 6e 75 6c 6c 3f  ))... (if (null?
9aa0: 20 72 65 6d 74 65 73 74 73 29 20 3b 3b 20 6e 6f   remtests) ;; no
9ab0: 20 6d 6f 72 65 20 74 65 73 74 73 20 72 65 6d 61   more tests rema
9ac0: 69 6e 69 6e 67 0a 09 09 20 20 20 20 20 28 6c 65  ining...     (le
9ad0: 74 2a 20 28 28 64 70 61 72 74 73 20 20 28 73 74  t* ((dparts  (st
9ae0: 72 69 6e 67 2d 73 70 6c 69 74 20 6c 61 73 74 74  ring-split lastt
9af0: 70 61 74 68 20 22 2f 22 29 29 0a 09 09 09 20 20  path "/"))....  
9b00: 20 20 28 72 75 6e 70 61 74 68 20 28 63 6f 6e 63    (runpath (conc
9b10: 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74   "/" (string-int
9b20: 65 72 73 70 65 72 73 65 20 0a 09 09 09 09 09 09  ersperse .......
9b30: 28 74 61 6b 65 20 64 70 61 72 74 73 20 28 2d 20  (take dparts (- 
9b40: 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73 29 20  (length dparts) 
9b50: 31 29 29 0a 09 09 09 09 09 09 22 2f 22 29 29 29  1))......."/")))
9b60: 29 0a 09 09 20 20 20 20 20 20 20 28 64 65 62 75  )...       (debu
9b70: 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76  g:print 1 "Remov
9b80: 69 6e 67 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65  ing run: " runke
9b90: 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61  y " " (db:get-va
9ba0: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75  lue-by-header ru
9bb0: 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d  n header "runnam
9bc0: 65 22 29 20 22 20 61 6e 64 20 72 65 6c 61 74 65  e") " and relate
9bd0: 64 20 72 65 63 6f 72 64 22 29 0a 09 09 20 20 20  d record")...   
9be0: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c      (open-run-cl
9bf0: 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 2d 72 75  ose db:delete-ru
9c00: 6e 20 64 62 20 72 75 6e 2d 69 64 29 0a 09 09 20  n db run-id)... 
9c10: 20 20 20 20 20 20 3b 3b 20 54 68 69 73 20 69 73        ;; This is
9c20: 20 61 20 70 72 65 74 74 79 20 67 6f 6f 64 20 70   a pretty good p
9c30: 6c 61 63 65 20 74 6f 20 70 75 72 67 65 20 6f 6c  lace to purge ol
9c40: 64 20 44 45 4c 45 54 45 44 20 74 65 73 74 73 0a  d DELETED tests.
9c50: 09 09 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72  ..       (open-r
9c60: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65  un-close db:dele
9c70: 74 65 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e  te-tests-for-run
9c80: 20 64 62 20 72 75 6e 2d 69 64 29 0a 09 09 20 20   db run-id)...  
9c90: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
9ca0: 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 2d 6f  lose db:delete-o
9cb0: 6c 64 2d 64 65 6c 65 74 65 64 2d 74 65 73 74 2d  ld-deleted-test-
9cc0: 72 65 63 6f 72 64 73 20 64 62 29 0a 09 09 20 20  records db)...  
9cd0: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
9ce0: 6c 6f 73 65 20 64 62 3a 73 65 74 2d 76 61 72 20  lose db:set-var 
9cf0: 64 62 20 22 44 45 4c 45 54 45 44 5f 54 45 53 54  db "DELETED_TEST
9d00: 53 22 20 28 63 75 72 72 65 6e 74 2d 73 65 63 6f  S" (current-seco
9d10: 6e 64 73 29 29 0a 09 09 20 20 20 20 20 20 20 3b  nds))...       ;
9d20: 3b 20 6e 65 65 64 20 74 6f 20 66 69 67 75 72 65  ; need to figure
9d30: 20 6f 75 74 20 74 68 65 20 70 61 74 68 20 74 6f   out the path to
9d40: 20 74 68 65 20 72 75 6e 20 64 69 72 20 61 6e 64   the run dir and
9d50: 20 72 65 6d 6f 76 65 20 69 74 20 69 66 20 65 6d   remove it if em
9d60: 70 74 79 0a 09 09 20 20 20 20 20 20 20 3b 3b 20  pty...       ;; 
9d70: 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 28 67     (if (null? (g
9d80: 6c 6f 62 20 28 63 6f 6e 63 20 72 75 6e 70 61 74  lob (conc runpat
9d90: 68 20 22 2f 2a 22 29 29 29 0a 09 09 20 20 20 20  h "/*")))...    
9da0: 20 20 20 3b 3b 20 20 20 20 20 20 20 20 28 62 65     ;;        (be
9db0: 67 69 6e 0a 09 09 20 20 20 20 20 20 20 3b 3b 20  gin...       ;; 
9dc0: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31  . (debug:print 1
9dd0: 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 20 64   "Removing run d
9de0: 69 72 20 22 20 72 75 6e 70 61 74 68 29 0a 09 09  ir " runpath)...
9df0: 20 20 20 20 20 20 20 3b 3b 20 09 20 28 73 79 73         ;; . (sys
9e00: 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 64 69 72  tem (conc "rmdir
9e10: 20 2d 70 20 22 20 72 75 6e 70 61 74 68 29 29 29   -p " runpath)))
9e20: 29 0a 09 09 20 20 20 20 20 20 20 29 29 29 29 29  )...       )))))
9e30: 0a 09 20 29 29 0a 20 20 20 20 20 72 75 6e 73 29  .. )).     runs)
9e40: 29 0a 20 20 23 74 29 0a 0a 3b 3b 3d 3d 3d 3d 3d  ).  #t)..;;=====
9e50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9e60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9e70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9e80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9e90: 3d 0a 3b 3b 20 52 6f 75 74 69 6e 65 73 20 66 6f  =.;; Routines fo
9ea0: 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 72  r manipulating r
9eb0: 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  uns.;;==========
9ec0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9ed0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9ee0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9ef0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b  ============..;;
9f00: 20 53 69 6e 63 65 20 6d 61 6e 79 20 63 61 6c 6c   Since many call
9f10: 73 20 74 6f 20 61 20 72 75 6e 20 72 65 71 75 69  s to a run requi
9f20: 72 65 20 70 72 65 74 74 79 20 6d 75 63 68 20 74  re pretty much t
9f30: 68 65 20 73 61 6d 65 20 73 65 74 75 70 20 0a 3b  he same setup .;
9f40: 3b 20 74 68 69 73 20 77 72 61 70 70 65 72 20 69  ; this wrapper i
9f50: 73 20 75 73 65 64 20 74 6f 20 72 65 64 75 63 65  s used to reduce
9f60: 20 74 68 65 20 72 65 70 6c 69 63 61 74 69 6f 6e   the replication
9f70: 20 6f 66 20 63 6f 64 65 0a 28 64 65 66 69 6e 65   of code.(define
9f80: 20 28 67 65 6e 65 72 61 6c 2d 72 75 6e 2d 63 61   (general-run-ca
9f90: 6c 6c 20 73 77 69 74 63 68 6e 61 6d 65 20 61 63  ll switchname ac
9fa0: 74 69 6f 6e 2d 64 65 73 63 20 70 72 6f 63 29 0a  tion-desc proc).
9fb0: 20 20 28 6c 65 74 20 28 28 72 75 6e 6e 61 6d 65    (let ((runname
9fc0: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
9fd0: 3a 72 75 6e 6e 61 6d 65 22 29 29 0a 09 28 74 61  :runname"))..(ta
9fe0: 72 67 65 74 20 20 28 69 66 20 28 61 72 67 73 3a  rget  (if (args:
9ff0: 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74  get-arg "-target
a000: 22 29 0a 09 09 20 20 20 20 20 28 61 72 67 73 3a  ")...     (args:
a010: 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74  get-arg "-target
a020: 22 29 0a 09 09 20 20 20 20 20 28 61 72 67 73 3a  ")...     (args:
a030: 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72  get-arg "-reqtar
a040: 67 22 29 29 29 0a 09 28 74 68 31 20 20 20 20 20  g")))..(th1     
a050: 23 66 29 29 0a 20 20 20 20 28 63 6f 6e 64 0a 20  #f)).    (cond. 
a060: 20 20 20 20 28 28 6e 6f 74 20 74 61 72 67 65 74      ((not target
a070: 29 0a 20 20 20 20 20 20 28 64 65 62 75 67 3a 70  ).      (debug:p
a080: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 4d  rint 0 "ERROR: M
a090: 69 73 73 69 6e 67 20 72 65 71 75 69 72 65 64 20  issing required 
a0a0: 70 61 72 61 6d 65 74 65 72 20 66 6f 72 20 22 20  parameter for " 
a0b0: 73 77 69 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f  switchname ", yo
a0c0: 75 20 6d 75 73 74 20 73 70 65 63 69 66 79 20 74  u must specify t
a0d0: 68 65 20 74 61 72 67 65 74 20 77 69 74 68 20 2d  he target with -
a0e0: 74 61 72 67 65 74 22 29 0a 20 20 20 20 20 20 28  target").      (
a0f0: 65 78 69 74 20 33 29 29 0a 20 20 20 20 20 28 28  exit 3)).     ((
a100: 6e 6f 74 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20  not runname).   
a110: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
a120: 30 20 22 45 52 52 4f 52 3a 20 4d 69 73 73 69 6e  0 "ERROR: Missin
a130: 67 20 72 65 71 75 69 72 65 64 20 70 61 72 61 6d  g required param
a140: 65 74 65 72 20 66 6f 72 20 22 20 73 77 69 74 63  eter for " switc
a150: 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d 75 73  hname ", you mus
a160: 74 20 73 70 65 63 69 66 79 20 74 68 65 20 72 75  t specify the ru
a170: 6e 20 6e 61 6d 65 20 77 69 74 68 20 3a 72 75 6e  n name with :run
a180: 6e 61 6d 65 20 72 75 6e 6e 61 6d 65 22 29 0a 20  name runname"). 
a190: 20 20 20 20 20 28 65 78 69 74 20 33 29 29 0a 20       (exit 3)). 
a1a0: 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20      (else.      
a1b0: 28 6c 65 74 20 28 28 64 62 20 20 20 23 66 29 0a  (let ((db   #f).
a1c0: 09 20 20 20 20 28 6b 65 79 73 20 23 66 29 29 0a  .    (keys #f)).
a1d0: 09 28 69 66 20 28 6e 6f 74 20 28 73 65 74 75 70  .(if (not (setup
a1e0: 2d 66 6f 72 2d 72 75 6e 29 29 0a 09 20 20 20 20  -for-run))..    
a1f0: 28 62 65 67 69 6e 20 0a 09 20 20 20 20 20 20 28  (begin ..      (
a200: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 46  debug:print 0 "F
a210: 61 69 6c 65 64 20 74 6f 20 73 65 74 75 70 2c 20  ailed to setup, 
a220: 65 78 69 74 69 6e 67 22 29 0a 09 20 20 20 20 20  exiting")..     
a230: 20 28 65 78 69 74 20 31 29 29 29 0a 09 28 69 66   (exit 1)))..(if
a240: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
a250: 2d 73 65 72 76 65 72 22 29 0a 09 20 20 20 20 28  -server")..    (
a260: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 73  open-run-close s
a270: 65 72 76 65 72 3a 73 74 61 72 74 20 64 62 20 28  erver:start db (
a280: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 73  args:get-arg "-s
a290: 65 72 76 65 72 22 29 29 29 0a 20 09 20 20 20 20  erver"))). .    
a2a0: 3b 3b 20 28 69 66 20 28 6e 6f 74 20 28 6f 72 20  ;; (if (not (or 
a2b0: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
a2c0: 72 75 6e 61 6c 6c 22 29 20 20 20 20 20 3b 3b 20  runall")     ;; 
a2d0: 72 75 6e 61 6c 6c 20 61 6e 64 20 72 75 6e 74 65  runall and runte
a2e0: 73 74 73 20 61 72 65 20 61 6c 6c 6f 77 65 64 20  sts are allowed 
a2f0: 74 6f 20 62 65 20 73 65 72 76 65 72 73 0a 20 09  to be servers. .
a300: 20 20 20 20 3b 3b 20 20 20 20 20 09 20 28 61 72      ;;     . (ar
a310: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 75 6e  gs:get-arg "-run
a320: 74 65 73 74 73 22 29 29 29 0a 09 20 20 20 20 3b  tests")))..    ;
a330: 3b 20 20 20 20 20 28 63 6c 69 65 6e 74 3a 73 65  ;     (client:se
a340: 74 75 70 29 20 3b 3b 20 54 68 69 73 20 69 73 20  tup) ;; This is 
a350: 61 20 64 75 70 6c 69 63 61 74 65 20 73 74 61 72  a duplicate star
a360: 74 75 70 21 21 21 3f 3f 3f 20 42 55 47 3f 0a 09  tup!!!??? BUG?..
a370: 20 20 20 20 3b 3b 20 20 20 20 20 29 29 0a 09 28      ;;     ))..(
a380: 73 65 74 21 20 6b 65 79 73 20 28 6f 70 65 6e 2d  set! keys (open-
a390: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
a3a0: 2d 6b 65 79 73 20 64 62 29 29 0a 09 3b 3b 20 68  -keys db))..;; h
a3b0: 61 76 65 20 65 6e 6f 75 67 68 20 74 6f 20 70 72  ave enough to pr
a3c0: 6f 63 65 73 73 20 2d 74 61 72 67 65 74 20 6f 72  ocess -target or
a3d0: 20 2d 72 65 71 74 61 72 67 20 68 65 72 65 0a 09   -reqtarg here..
a3e0: 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72  (if (args:get-ar
a3f0: 67 20 22 2d 72 65 71 74 61 72 67 22 29 0a 09 20  g "-reqtarg").. 
a400: 20 20 20 28 6c 65 74 2a 20 28 28 72 75 6e 63 6f     (let* ((runco
a410: 6e 66 69 67 66 20 28 63 6f 6e 63 20 20 2a 74 6f  nfigf (conc  *to
a420: 70 70 61 74 68 2a 20 22 2f 72 75 6e 63 6f 6e 66  ppath* "/runconf
a430: 69 67 73 2e 63 6f 6e 66 69 67 22 29 29 20 3b 3b  igs.config")) ;;
a440: 20 44 4f 20 4e 4f 54 20 45 56 41 4c 55 41 54 45   DO NOT EVALUATE
a450: 20 41 4c 4c 20 0a 09 09 20 20 20 28 72 75 6e 63   ALL ...   (runc
a460: 6f 6e 66 69 67 20 20 28 72 65 61 64 2d 63 6f 6e  onfig  (read-con
a470: 66 69 67 20 72 75 6e 63 6f 6e 66 69 67 66 20 23  fig runconfigf #
a480: 66 20 23 74 20 65 6e 76 69 72 6f 6e 2d 70 61 74  f #t environ-pat
a490: 74 3a 20 23 66 29 29 29 20 0a 09 20 20 20 20 20  t: #f))) ..     
a4a0: 20 28 69 66 20 28 68 61 73 68 2d 74 61 62 6c 65   (if (hash-table
a4b0: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 72 75 6e  -ref/default run
a4c0: 63 6f 6e 66 69 67 20 28 61 72 67 73 3a 67 65 74  config (args:get
a4d0: 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29  -arg "-reqtarg")
a4e0: 20 23 66 29 0a 09 09 20 20 28 6b 65 79 73 3a 74   #f)...  (keys:t
a4f0: 61 72 67 65 74 2d 73 65 74 2d 61 72 67 73 20 6b  arget-set-args k
a500: 65 79 73 20 28 61 72 67 73 3a 67 65 74 2d 61 72  eys (args:get-ar
a510: 67 20 22 2d 72 65 71 74 61 72 67 22 29 20 61 72  g "-reqtarg") ar
a520: 67 73 3a 61 72 67 2d 68 61 73 68 29 0a 09 09 20  gs:arg-hash)... 
a530: 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 28 64   (begin...    (d
a540: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
a550: 52 4f 52 3a 20 5b 22 20 28 61 72 67 73 3a 67 65  ROR: [" (args:ge
a560: 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22  t-arg "-reqtarg"
a570: 29 20 22 5d 20 6e 6f 74 20 66 6f 75 6e 64 20 69  ) "] not found i
a580: 6e 20 22 20 72 75 6e 63 6f 6e 66 69 67 66 29 0a  n " runconfigf).
a590: 09 09 20 20 20 20 28 69 66 20 64 62 20 28 73 71  ..    (if db (sq
a5a0: 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20  lite3:finalize! 
a5b0: 64 62 29 29 0a 09 09 20 20 20 20 28 65 78 69 74  db))...    (exit
a5c0: 20 31 29 29 29 29 0a 09 20 20 20 20 28 69 66 20   1))))..    (if 
a5d0: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
a5e0: 74 61 72 67 65 74 22 29 0a 09 09 28 6b 65 79 73  target")...(keys
a5f0: 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 72 67 73  :target-set-args
a600: 20 6b 65 79 73 20 28 61 72 67 73 3a 67 65 74 2d   keys (args:get-
a610: 61 72 67 20 22 2d 74 61 72 67 65 74 22 20 61 72  arg "-target" ar
a620: 67 73 3a 61 72 67 2d 68 61 73 68 29 20 61 72 67  gs:arg-hash) arg
a630: 73 3a 61 72 67 2d 68 61 73 68 29 29 29 0a 09 28  s:arg-hash)))..(
a640: 69 66 20 28 6e 6f 74 20 28 63 61 72 20 2a 63 6f  if (not (car *co
a650: 6e 66 69 67 69 6e 66 6f 2a 29 29 0a 09 20 20 20  nfiginfo*))..   
a660: 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 28   (begin..      (
a670: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45  debug:print 0 "E
a680: 52 52 4f 52 3a 20 41 74 74 65 6d 70 74 65 64 20  RROR: Attempted 
a690: 74 6f 20 22 20 61 63 74 69 6f 6e 2d 64 65 73 63  to " action-desc
a6a0: 20 22 20 62 75 74 20 72 75 6e 20 61 72 65 61 20   " but run area 
a6b0: 63 6f 6e 66 69 67 20 66 69 6c 65 20 6e 6f 74 20  config file not 
a6c0: 66 6f 75 6e 64 22 29 0a 09 20 20 20 20 20 20 28  found")..      (
a6d0: 65 78 69 74 20 31 29 29 0a 09 20 20 20 20 3b 3b  exit 1))..    ;;
a6e0: 20 45 78 74 72 61 63 74 20 6f 75 74 20 73 74 75   Extract out stu
a6f0: 66 66 20 6e 65 65 64 65 64 20 69 6e 20 6d 6f 73  ff needed in mos
a700: 74 20 6f 72 20 6d 61 6e 79 20 63 61 6c 6c 73 0a  t or many calls.
a710: 09 20 20 20 20 3b 3b 20 68 65 72 65 20 74 68 65  .    ;; here the
a720: 6e 20 63 61 6c 6c 20 70 72 6f 63 0a 09 20 20 20  n call proc..   
a730: 20 28 6c 65 74 2a 20 28 28 6b 65 79 6e 61 6d 65   (let* ((keyname
a740: 73 20 20 20 28 6d 61 70 20 6b 65 79 3a 67 65 74  s   (map key:get
a750: 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79 73 29  -fieldname keys)
a760: 29 0a 09 09 20 20 20 28 6b 65 79 76 61 6c 6c 73  )...   (keyvalls
a770: 74 20 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69 73  t  (keys->vallis
a780: 74 20 6b 65 79 73 20 23 74 29 29 29 0a 09 20 20  t keys #t)))..  
a790: 20 20 20 20 28 70 72 6f 63 20 74 61 72 67 65 74      (proc target
a7a0: 20 72 75 6e 6e 61 6d 65 20 6b 65 79 73 20 6b 65   runname keys ke
a7b0: 79 6e 61 6d 65 73 20 6b 65 79 76 61 6c 6c 73 74  ynames keyvallst
a7c0: 29 29 29 0a 09 28 69 66 20 74 68 31 20 28 74 68  )))..(if th1 (th
a7d0: 72 65 61 64 2d 6a 6f 69 6e 21 20 74 68 31 29 29  read-join! th1))
a7e0: 0a 09 28 69 66 20 64 62 20 28 73 71 6c 69 74 65  ..(if db (sqlite
a7f0: 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 29 29  3:finalize! db))
a800: 0a 09 28 73 65 74 21 20 2a 64 69 64 73 6f 6d 65  ..(set! *didsome
a810: 74 68 69 6e 67 2a 20 23 74 29 29 29 29 29 29 0a  thing* #t)))))).
a820: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  .;;=============
a830: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a840: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a850: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a860: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4c 6f 63  =========.;; Loc
a870: 6b 2f 75 6e 6c 6f 63 6b 20 72 75 6e 73 0a 3b 3b  k/unlock runs.;;
a880: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a890: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a8a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a8b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a8c0: 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65 20  ======..(define 
a8d0: 28 72 75 6e 73 3a 68 61 6e 64 6c 65 2d 6c 6f 63  (runs:handle-loc
a8e0: 6b 69 6e 67 20 74 61 72 67 65 74 20 6b 65 79 73  king target keys
a8f0: 20 72 75 6e 6e 61 6d 65 20 6c 6f 63 6b 20 75 6e   runname lock un
a900: 6c 6f 63 6b 20 75 73 65 72 29 0a 20 20 28 6c 65  lock user).  (le
a910: 74 2a 20 28 28 64 62 20 20 20 20 20 20 20 23 66  t* ((db       #f
a920: 29 0a 09 20 28 72 75 6e 64 61 74 20 20 20 28 6f  ).. (rundat   (o
a930: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75  pen-run-close ru
a940: 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70  ns:get-runs-by-p
a950: 61 74 74 20 64 62 20 6b 65 79 73 20 72 75 6e 6e  att db keys runn
a960: 61 6d 65 29 29 0a 09 20 28 68 65 61 64 65 72 20  ame)).. (header 
a970: 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75    (vector-ref ru
a980: 6e 64 61 74 20 30 29 29 0a 09 20 28 72 75 6e 73  ndat 0)).. (runs
a990: 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66       (vector-ref
a9a0: 20 72 75 6e 64 61 74 20 31 29 29 29 0a 20 20 20   rundat 1))).   
a9b0: 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62   (for-each (lamb
a9c0: 64 61 20 28 72 75 6e 29 0a 09 09 28 6c 65 74 20  da (run)...(let 
a9d0: 28 28 72 75 6e 2d 69 64 20 28 64 62 3a 67 65 74  ((run-id (db:get
a9e0: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72  -value-by-header
a9f0: 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 22   run header "id"
aa00: 29 29 29 0a 09 09 20 20 28 69 66 20 28 6f 72 20  )))...  (if (or 
aa10: 6c 6f 63 6b 0a 09 09 09 20 20 28 61 6e 64 20 75  lock....  (and u
aa20: 6e 6c 6f 63 6b 0a 09 09 09 20 20 20 20 20 20 20  nlock....       
aa30: 28 62 65 67 69 6e 0a 09 09 09 09 20 28 70 72 69  (begin..... (pri
aa40: 6e 74 20 22 44 6f 20 79 6f 75 20 72 65 61 6c 6c  nt "Do you reall
aa50: 79 20 77 69 73 68 20 74 6f 20 75 6e 6c 6f 63 6b  y wish to unlock
aa60: 20 72 75 6e 20 22 20 72 75 6e 2d 69 64 20 22 3f   run " run-id "?
aa70: 5c 6e 20 20 20 79 2f 6e 3a 20 22 29 0a 09 09 09  \n   y/n: ")....
aa80: 09 20 28 65 71 75 61 6c 3f 20 22 79 22 20 28 72  . (equal? "y" (r
aa90: 65 61 64 2d 6c 69 6e 65 29 29 29 29 29 0a 09 09  ead-line)))))...
aaa0: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d        (open-run-
aab0: 63 6c 6f 73 65 20 64 62 3a 6c 6f 63 6b 2f 75 6e  close db:lock/un
aac0: 6c 6f 63 6b 2d 72 75 6e 20 64 62 20 72 75 6e 2d  lock-run db run-
aad0: 69 64 20 6c 6f 63 6b 20 75 6e 6c 6f 63 6b 20 75  id lock unlock u
aae0: 73 65 72 29 0a 09 09 20 20 20 20 20 20 28 64 65  ser)...      (de
aaf0: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 30  bug:print-info 0
ab00: 20 22 53 6b 69 70 70 69 6e 67 20 6c 6f 63 6b 2f   "Skipping lock/
ab10: 75 6e 6c 6f 63 6b 20 6f 6e 20 22 20 72 75 6e 2d  unlock on " run-
ab20: 69 64 29 29 29 29 0a 09 20 20 20 20 20 20 72 75  id))))..      ru
ab30: 6e 73 29 29 29 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d  ns))).;;========
ab40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
ab50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
ab60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
ab70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b  ==============.;
ab80: 3b 20 52 6f 6c 6c 75 70 20 72 75 6e 73 0a 3b 3b  ; Rollup runs.;;
ab90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
aba0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
abb0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
abc0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
abd0: 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 55 70 64 61 74  ======..;; Updat
abe0: 65 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61 20  e the test_meta 
abf0: 74 61 62 6c 65 20 66 6f 72 20 74 68 69 73 20 74  table for this t
ac00: 65 73 74 0a 28 64 65 66 69 6e 65 20 28 72 75 6e  est.(define (run
ac10: 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65  s:update-test_me
ac20: 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20  ta db test-name 
ac30: 74 65 73 74 2d 63 6f 6e 66 29 0a 20 20 28 6c 65  test-conf).  (le
ac40: 74 20 28 28 63 75 72 72 72 65 63 6f 72 64 20 28  t ((currrecord (
ac50: 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64  cdb:remote-run d
ac60: 62 3a 74 65 73 74 6d 65 74 61 2d 67 65 74 2d 72  b:testmeta-get-r
ac70: 65 63 6f 72 64 20 64 62 20 74 65 73 74 2d 6e 61  ecord db test-na
ac80: 6d 65 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e  me))).    (if (n
ac90: 6f 74 20 63 75 72 72 72 65 63 6f 72 64 29 0a 09  ot currrecord)..
aca0: 28 62 65 67 69 6e 0a 09 20 20 28 73 65 74 21 20  (begin..  (set! 
acb0: 63 75 72 72 72 65 63 6f 72 64 20 28 6d 61 6b 65  currrecord (make
acc0: 2d 76 65 63 74 6f 72 20 31 30 20 23 66 29 29 0a  -vector 10 #f)).
acd0: 09 20 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72  .  (cdb:remote-r
ace0: 75 6e 20 64 62 3a 74 65 73 74 6d 65 74 61 2d 61  un db:testmeta-a
acf0: 64 64 2d 72 65 63 6f 72 64 20 64 62 20 74 65 73  dd-record db tes
ad00: 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 66  t-name))).    (f
ad10: 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c  or-each .     (l
ad20: 61 6d 62 64 61 20 28 6b 65 79 29 0a 20 20 20 20  ambda (key).    
ad30: 20 20 20 28 6c 65 74 2a 20 28 28 69 64 78 20 28     (let* ((idx (
ad40: 63 61 64 72 20 6b 65 79 29 29 0a 09 20 20 20 20  cadr key))..    
ad50: 20 20 28 66 6c 64 20 28 63 61 72 20 20 6b 65 79    (fld (car  key
ad60: 29 29 0a 09 20 20 20 20 20 20 28 76 61 6c 20 28  ))..      (val (
ad70: 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 65  config-lookup te
ad80: 73 74 2d 63 6f 6e 66 20 22 74 65 73 74 5f 6d 65  st-conf "test_me
ad90: 74 61 22 20 66 6c 64 29 29 29 0a 09 20 3b 3b 20  ta" fld))).. ;; 
ada0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 35 20 22  (debug:print 5 "
adb0: 69 64 78 3a 20 22 20 69 64 78 20 22 20 66 6c 64  idx: " idx " fld
adc0: 3a 20 22 20 66 6c 64 20 22 20 76 61 6c 3a 20 22  : " fld " val: "
add0: 20 76 61 6c 29 0a 09 20 28 69 66 20 28 61 6e 64   val).. (if (and
ade0: 20 76 61 6c 20 28 6e 6f 74 20 28 65 71 75 61 6c   val (not (equal
adf0: 3f 20 28 76 65 63 74 6f 72 2d 72 65 66 20 63 75  ? (vector-ref cu
ae00: 72 72 72 65 63 6f 72 64 20 69 64 78 29 20 76 61  rrrecord idx) va
ae10: 6c 29 29 29 0a 09 20 20 20 20 20 28 62 65 67 69  l)))..     (begi
ae20: 6e 0a 09 20 20 20 20 20 20 20 28 70 72 69 6e 74  n..       (print
ae30: 20 22 55 70 64 61 74 69 6e 67 20 22 20 74 65 73   "Updating " tes
ae40: 74 2d 6e 61 6d 65 20 22 20 22 20 66 6c 64 20 22  t-name " " fld "
ae50: 20 74 6f 20 22 20 76 61 6c 29 0a 09 20 20 20 20   to " val)..    
ae60: 20 20 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72     (cdb:remote-r
ae70: 75 6e 20 64 62 3a 74 65 73 74 6d 65 74 61 2d 75  un db:testmeta-u
ae80: 70 64 61 74 65 2d 66 69 65 6c 64 20 64 62 20 74  pdate-field db t
ae90: 65 73 74 2d 6e 61 6d 65 20 66 6c 64 20 76 61 6c  est-name fld val
aea0: 29 29 29 29 29 0a 20 20 20 20 20 27 28 28 22 61  ))))).     '(("a
aeb0: 75 74 68 6f 72 22 20 32 29 28 22 6f 77 6e 65 72  uthor" 2)("owner
aec0: 22 20 33 29 28 22 64 65 73 63 72 69 70 74 69 6f  " 3)("descriptio
aed0: 6e 22 20 34 29 28 22 72 65 76 69 65 77 65 64 22  n" 4)("reviewed"
aee0: 20 35 29 28 22 74 61 67 73 22 20 39 29 29 29 29   5)("tags" 9))))
aef0: 29 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74 65 73  )..;; Update tes
af00: 74 5f 6d 65 74 61 20 66 6f 72 20 61 6c 6c 20 74  t_meta for all t
af10: 65 73 74 73 0a 28 64 65 66 69 6e 65 20 28 72 75  ests.(define (ru
af20: 6e 73 3a 75 70 64 61 74 65 2d 61 6c 6c 2d 74 65  ns:update-all-te
af30: 73 74 5f 6d 65 74 61 20 64 62 29 0a 20 20 28 6c  st_meta db).  (l
af40: 65 74 20 28 28 74 65 73 74 2d 6e 61 6d 65 73 20  et ((test-names 
af50: 28 74 65 73 74 73 3a 67 65 74 2d 76 61 6c 69 64  (tests:get-valid
af60: 2d 74 65 73 74 73 29 29 29 0a 20 20 20 20 28 66  -tests))).    (f
af70: 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c  or-each .     (l
af80: 61 6d 62 64 61 20 28 74 65 73 74 2d 6e 61 6d 65  ambda (test-name
af90: 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28  ).       (let* (
afa0: 28 74 65 73 74 2d 70 61 74 68 20 20 20 20 28 63  (test-path    (c
afb0: 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f  onc *toppath* "/
afc0: 74 65 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d  tests/" test-nam
afd0: 65 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 74  e))..      (test
afe0: 2d 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 74  -configf (conc t
aff0: 65 73 74 2d 70 61 74 68 20 22 2f 74 65 73 74 63  est-path "/testc
b000: 6f 6e 66 69 67 22 29 29 0a 09 20 20 20 20 20 20  onfig"))..      
b010: 28 74 65 73 74 65 78 69 73 74 73 20 20 20 28 61  (testexists   (a
b020: 6e 64 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f  nd (file-exists?
b030: 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 28 66   test-configf)(f
b040: 69 6c 65 2d 72 65 61 64 2d 61 63 63 65 73 73 3f  ile-read-access?
b050: 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 29 29   test-configf)))
b060: 0a 09 20 20 20 20 20 20 3b 3b 20 72 65 61 64 20  ..      ;; read 
b070: 63 6f 6e 66 69 67 73 20 77 69 74 68 20 74 72 69  configs with tri
b080: 63 6b 73 20 74 75 72 6e 65 64 20 6f 66 66 20 28  cks turned off (
b090: 69 2e 65 2e 20 6e 6f 20 73 79 73 74 65 6d 29 0a  i.e. no system).
b0a0: 09 20 20 20 20 20 20 28 74 65 73 74 2d 63 6f 6e  .      (test-con
b0b0: 66 20 20 20 20 28 69 66 20 74 65 73 74 65 78 69  f    (if testexi
b0c0: 73 74 73 20 28 72 65 61 64 2d 63 6f 6e 66 69 67  sts (read-config
b0d0: 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 23 66   test-configf #f
b0e0: 20 23 66 29 28 6d 61 6b 65 2d 68 61 73 68 2d 74   #f)(make-hash-t
b0f0: 61 62 6c 65 29 29 29 29 0a 09 20 3b 3b 20 75 73  able)))).. ;; us
b100: 65 20 74 68 65 20 6f 70 65 6e 2d 72 75 6e 2d 63  e the open-run-c
b110: 6c 6f 73 65 20 69 6e 73 74 65 61 64 20 6f 66 20  lose instead of 
b120: 70 61 73 73 69 6e 67 20 69 6e 20 64 62 0a 09 20  passing in db.. 
b130: 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73  (runs:update-tes
b140: 74 5f 6d 65 74 61 20 23 66 20 74 65 73 74 2d 6e  t_meta #f test-n
b150: 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 29 29  ame test-conf)))
b160: 0a 20 20 20 20 20 74 65 73 74 2d 6e 61 6d 65 73  .     test-names
b170: 29 29 29 0a 0a 3b 3b 20 54 68 69 73 20 63 6f 75  )))..;; This cou
b180: 6c 64 20 70 72 6f 62 61 62 6c 79 20 62 65 20 72  ld probably be r
b190: 65 66 61 63 74 6f 72 65 64 20 69 6e 74 6f 20 6f  efactored into o
b1a0: 6e 65 20 63 6f 6d 70 6c 65 78 20 71 75 65 72 79  ne complex query
b1b0: 20 2e 2e 2e 0a 28 64 65 66 69 6e 65 20 28 72 75   ....(define (ru
b1c0: 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 20 6b 65  ns:rollup-run ke
b1d0: 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e  ys keyvallst run
b1e0: 6e 61 6d 65 20 75 73 65 72 29 20 3b 3b 20 77 61  name user) ;; wa
b1f0: 73 20 74 61 72 67 65 74 2c 20 6e 6f 77 20 6b 65  s target, now ke
b200: 79 76 61 6c 6c 73 74 0a 20 20 28 64 65 62 75 67  yvallst.  (debug
b210: 3a 70 72 69 6e 74 20 34 20 22 72 75 6e 73 3a 72  :print 4 "runs:r
b220: 6f 6c 6c 75 70 2d 72 75 6e 2c 20 6b 65 79 73 3a  ollup-run, keys:
b230: 20 22 20 6b 65 79 73 20 22 20 6b 65 79 76 61 6c   " keys " keyval
b240: 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74  lst: " keyvallst
b250: 20 22 20 3a 72 75 6e 6e 61 6d 65 20 22 20 72 75   " :runname " ru
b260: 6e 6e 61 6d 65 20 22 20 75 73 65 72 3a 20 22 20  nname " user: " 
b270: 75 73 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 28  user).  (let* ((
b280: 64 62 20 20 20 20 20 20 20 20 20 20 20 20 20 20  db              
b290: 23 66 29 20 3b 3b 20 28 6b 65 79 76 61 6c 6c 6c  #f) ;; (keyvalll
b2a0: 73 74 20 20 20 20 20 20 28 6b 65 79 73 3a 74 61  st      (keys:ta
b2b0: 72 67 65 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 79  rget->keyval key
b2c0: 73 20 74 61 72 67 65 74 29 29 0a 09 20 28 6e 65  s target)).. (ne
b2d0: 77 2d 72 75 6e 2d 69 64 20 20 20 20 20 20 28 63  w-run-id      (c
b2e0: 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64 62  db:remote-run db
b2f0: 3a 72 65 67 69 73 74 65 72 2d 72 75 6e 20 23 66  :register-run #f
b300: 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20   keys keyvallst 
b310: 72 75 6e 6e 61 6d 65 20 22 6e 65 77 22 20 22 6e  runname "new" "n
b320: 2f 61 22 20 75 73 65 72 29 29 0a 09 20 28 70 72  /a" user)).. (pr
b330: 65 76 2d 74 65 73 74 73 20 20 20 20 20 20 28 6f  ev-tests      (o
b340: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 74 65  pen-run-close te
b350: 73 74 3a 67 65 74 2d 6d 61 74 63 68 69 6e 67 2d  st:get-matching-
b360: 70 72 65 76 69 6f 75 73 2d 74 65 73 74 2d 72 75  previous-test-ru
b370: 6e 2d 72 65 63 6f 72 64 73 20 64 62 20 6e 65 77  n-records db new
b380: 2d 72 75 6e 2d 69 64 20 22 25 22 20 22 25 22 29  -run-id "%" "%")
b390: 29 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73 20  ).. (curr-tests 
b3a0: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
b3b0: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74  lose db:get-test
b3c0: 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77  s-for-run db new
b3d0: 2d 72 75 6e 2d 69 64 20 22 25 2f 25 22 20 27 28  -run-id "%/%" '(
b3e0: 29 20 27 28 29 29 29 0a 09 20 28 63 75 72 72 2d  ) '())).. (curr-
b3f0: 74 65 73 74 73 2d 68 61 73 68 20 28 6d 61 6b 65  tests-hash (make
b400: 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 20  -hash-table))). 
b410: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f     (open-run-clo
b420: 73 65 20 64 62 3a 75 70 64 61 74 65 2d 72 75 6e  se db:update-run
b430: 2d 65 76 65 6e 74 5f 74 69 6d 65 20 64 62 20 6e  -event_time db n
b440: 65 77 2d 72 75 6e 2d 69 64 29 0a 20 20 20 20 3b  ew-run-id).    ;
b450: 3b 20 69 6e 64 65 78 20 74 68 65 20 61 6c 72 65  ; index the alre
b460: 61 64 79 20 73 61 76 65 64 20 74 65 73 74 73 20  ady saved tests 
b470: 62 79 20 74 65 73 74 6e 61 6d 65 20 61 6e 64 20  by testname and 
b480: 69 74 65 6d 64 61 74 20 69 6e 20 63 75 72 72 2d  itemdat in curr-
b490: 74 65 73 74 73 2d 68 61 73 68 0a 20 20 20 20 28  tests-hash.    (
b4a0: 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 28 6c  for-each.     (l
b4b0: 61 6d 62 64 61 20 28 74 65 73 74 64 61 74 29 0a  ambda (testdat).
b4c0: 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74         (let* ((t
b4d0: 65 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 65 73  estname  (db:tes
b4e0: 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74  t-get-testname t
b4f0: 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20  estdat))..      
b500: 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74  (item-path (db:t
b510: 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74  est-get-item-pat
b520: 68 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20  h testdat))..   
b530: 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 63     (full-name (c
b540: 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22  onc testname "/"
b550: 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 09 20   item-path))).. 
b560: 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21  (hash-table-set!
b570: 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68   curr-tests-hash
b580: 20 66 75 6c 6c 2d 6e 61 6d 65 20 74 65 73 74 64   full-name testd
b590: 61 74 29 29 29 0a 20 20 20 20 20 63 75 72 72 2d  at))).     curr-
b5a0: 74 65 73 74 73 29 0a 20 20 20 20 3b 3b 20 4e 4f  tests).    ;; NO
b5b0: 50 45 3a 20 4e 6f 6e 2d 6f 70 74 69 6d 61 6c 20  PE: Non-optimal 
b5c0: 61 70 70 72 6f 61 63 68 2e 20 54 72 79 20 74 68  approach. Try th
b5d0: 69 73 20 69 6e 73 74 65 61 64 2e 0a 20 20 20 20  is instead..    
b5e0: 3b 3b 20 20 20 31 2e 20 74 65 73 74 73 20 61 72  ;;   1. tests ar
b5f0: 65 20 72 65 63 65 69 76 65 64 20 69 6e 20 61 20  e received in a 
b600: 6c 69 73 74 2c 20 6d 6f 73 74 20 72 65 63 65 6e  list, most recen
b610: 74 20 66 69 72 73 74 0a 20 20 20 20 3b 3b 20 20  t first.    ;;  
b620: 20 32 2e 20 72 65 70 6c 61 63 65 20 74 68 65 20   2. replace the 
b630: 72 6f 6c 6c 75 70 20 74 65 73 74 20 77 69 74 68  rollup test with
b640: 20 74 68 65 20 6e 65 77 20 2a 61 6c 77 61 79 73   the new *always
b650: 2a 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20  *.    (for-each 
b660: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74  .     (lambda (t
b670: 65 73 74 64 61 74 29 0a 20 20 20 20 20 20 20 28  estdat).       (
b680: 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 20  let* ((testname 
b690: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65   (db:test-get-te
b6a0: 73 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29  stname testdat))
b6b0: 0a 09 20 20 20 20 20 20 28 69 74 65 6d 2d 70 61  ..      (item-pa
b6c0: 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  th (db:test-get-
b6d0: 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 64 61  item-path testda
b6e0: 74 29 29 0a 09 20 20 20 20 20 20 28 66 75 6c 6c  t))..      (full
b6f0: 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74  -name (conc test
b700: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61  name "/" item-pa
b710: 74 68 29 29 0a 09 20 20 20 20 20 20 28 70 72 65  th))..      (pre
b720: 76 2d 74 65 73 74 2d 64 61 74 20 28 68 61 73 68  v-test-dat (hash
b730: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75  -table-ref/defau
b740: 6c 74 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61  lt curr-tests-ha
b750: 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 23 66 29  sh full-name #f)
b760: 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d 73  )..      (test-s
b770: 74 65 70 73 20 20 20 20 20 20 28 6f 70 65 6e 2d  teps      (open-
b780: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
b790: 2d 73 74 65 70 73 2d 66 6f 72 2d 74 65 73 74 20  -steps-for-test 
b7a0: 64 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  db (db:test-get-
b7b0: 69 64 20 74 65 73 74 64 61 74 29 29 29 0a 09 20  id testdat))).. 
b7c0: 20 20 20 20 20 28 6e 65 77 2d 74 65 73 74 2d 72       (new-test-r
b7d0: 65 63 6f 72 64 20 23 66 29 29 0a 09 20 3b 3b 20  ecord #f)).. ;; 
b7e0: 72 65 70 6c 61 63 65 20 74 68 65 73 65 20 77 69  replace these wi
b7f0: 74 68 20 69 6e 73 65 72 74 20 2e 2e 2e 20 73 65  th insert ... se
b800: 6c 65 63 74 0a 09 20 28 61 70 70 6c 79 20 73 71  lect.. (apply sq
b810: 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09  lite3:execute ..
b820: 09 64 62 20 0a 09 09 28 63 6f 6e 63 20 22 49 4e  .db ...(conc "IN
b830: 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20  SERT OR REPLACE 
b840: 49 4e 54 4f 20 74 65 73 74 73 20 28 72 75 6e 5f  INTO tests (run_
b850: 69 64 2c 74 65 73 74 6e 61 6d 65 2c 73 74 61 74  id,testname,stat
b860: 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74  e,status,event_t
b870: 69 6d 65 2c 68 6f 73 74 2c 63 70 75 6c 6f 61 64  ime,host,cpuload
b880: 2c 64 69 73 6b 66 72 65 65 2c 75 6e 61 6d 65 2c  ,diskfree,uname,
b890: 72 75 6e 64 69 72 2c 69 74 65 6d 5f 70 61 74 68  rundir,item_path
b8a0: 2c 72 75 6e 5f 64 75 72 61 74 69 6f 6e 2c 66 69  ,run_duration,fi
b8b0: 6e 61 6c 5f 6c 6f 67 66 2c 63 6f 6d 6d 65 6e 74  nal_logf,comment
b8c0: 29 20 22 0a 09 09 20 20 20 20 20 20 22 56 41 4c  ) "...      "VAL
b8d0: 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f  UES (?,?,?,?,?,?
b8e0: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f  ,?,?,?,?,?,?,?,?
b8f0: 29 3b 22 29 0a 09 09 6e 65 77 2d 72 75 6e 2d 69  );")...new-run-i
b900: 64 20 28 63 64 64 72 20 28 76 65 63 74 6f 72 2d  d (cddr (vector-
b910: 3e 6c 69 73 74 20 74 65 73 74 64 61 74 29 29 29  >list testdat)))
b920: 0a 09 20 28 73 65 74 21 20 6e 65 77 2d 74 65 73  .. (set! new-tes
b930: 74 64 61 74 20 28 63 61 72 20 28 6f 70 65 6e 2d  tdat (car (open-
b940: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
b950: 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64  -tests-for-run d
b960: 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 28 63 6f  b new-run-id (co
b970: 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22 20  nc testname "/" 
b980: 69 74 65 6d 2d 70 61 74 68 29 20 27 28 29 20 27  item-path) '() '
b990: 28 29 29 29 29 0a 09 20 28 68 61 73 68 2d 74 61  ()))).. (hash-ta
b9a0: 62 6c 65 2d 73 65 74 21 20 63 75 72 72 2d 74 65  ble-set! curr-te
b9b0: 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61  sts-hash full-na
b9c0: 6d 65 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20  me new-testdat) 
b9d0: 3b 3b 20 74 68 69 73 20 63 6f 75 6c 64 20 62 65  ;; this could be
b9e0: 20 63 6f 6e 66 75 73 69 6e 67 2c 20 77 68 69 63   confusing, whic
b9f0: 68 20 72 65 63 6f 72 64 20 73 68 6f 75 6c 64 20  h record should 
ba00: 67 6f 20 69 6e 74 6f 20 74 68 65 20 6c 6f 6f 6b  go into the look
ba10: 75 70 20 74 61 62 6c 65 3f 0a 09 20 3b 3b 20 4e  up table?.. ;; N
ba20: 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74 68 65  ow duplicate the
ba30: 20 74 65 73 74 20 73 74 65 70 73 0a 09 20 28 64   test steps.. (d
ba40: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 43 6f  ebug:print 4 "Co
ba50: 70 79 69 6e 67 20 72 65 63 6f 72 64 73 20 69 6e  pying records in
ba60: 20 74 65 73 74 5f 73 74 65 70 73 20 66 72 6f 6d   test_steps from
ba70: 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62 3a 74   test_id=" (db:t
ba80: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64  est-get-id testd
ba90: 61 74 29 20 22 20 74 6f 20 22 20 28 64 62 3a 74  at) " to " (db:t
baa0: 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74  est-get-id new-t
bab0: 65 73 74 64 61 74 29 29 0a 09 20 28 6f 70 65 6e  estdat)).. (open
bac0: 2d 72 75 6e 2d 63 6c 6f 73 65 20 0a 09 20 20 28  -run-close ..  (
bad0: 6c 61 6d 62 64 61 20 28 29 0a 09 20 20 20 20 28  lambda ()..    (
bae0: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20  sqlite3:execute 
baf0: 0a 09 20 20 20 20 20 64 62 20 0a 09 20 20 20 20  ..     db ..    
bb00: 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f   (conc "INSERT O
bb10: 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74  R REPLACE INTO t
bb20: 65 73 74 5f 73 74 65 70 73 20 28 74 65 73 74 5f  est_steps (test_
bb30: 69 64 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 74  id,stepname,stat
bb40: 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74  e,status,event_t
bb50: 69 6d 65 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09  ime,comment) "..
bb60: 09 20 20 20 22 53 45 4c 45 43 54 20 22 20 28 64  .   "SELECT " (d
bb70: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65  b:test-get-id ne
bb80: 77 2d 74 65 73 74 64 61 74 29 20 22 2c 73 74 65  w-testdat) ",ste
bb90: 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74  pname,state,stat
bba0: 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f  us,event_time,co
bbb0: 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f  mment FROM test_
bbc0: 73 74 65 70 73 20 57 48 45 52 45 20 74 65 73 74  steps WHERE test
bbd0: 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 20 20 20 28  _id=?;")..     (
bbe0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74  db:test-get-id t
bbf0: 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 3b 3b  estdat))..    ;;
bc00: 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74   Now duplicate t
bc10: 68 65 20 74 65 73 74 20 64 61 74 61 0a 09 20 20  he test data..  
bc20: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34    (debug:print 4
bc30: 20 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64   "Copying record
bc40: 73 20 69 6e 20 74 65 73 74 5f 64 61 74 61 20 66  s in test_data f
bc50: 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64  rom test_id=" (d
bc60: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65  b:test-get-id te
bc70: 73 74 64 61 74 29 20 22 20 74 6f 20 22 20 28 64  stdat) " to " (d
bc80: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65  b:test-get-id ne
bc90: 77 2d 74 65 73 74 64 61 74 29 29 0a 09 20 20 20  w-testdat))..   
bca0: 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74   (sqlite3:execut
bcb0: 65 20 0a 09 20 20 20 20 20 64 62 20 0a 09 20 20  e ..     db ..  
bcc0: 20 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54     (conc "INSERT
bcd0: 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f   OR REPLACE INTO
bce0: 20 74 65 73 74 5f 64 61 74 61 20 28 74 65 73 74   test_data (test
bcf0: 5f 69 64 2c 63 61 74 65 67 6f 72 79 2c 76 61 72  _id,category,var
bd00: 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65  iable,value,expe
bd10: 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63  cted,tol,units,c
bd20: 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 22  omment) "...   "
bd30: 53 45 4c 45 43 54 20 22 20 28 64 62 3a 74 65 73  SELECT " (db:tes
bd40: 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73  t-get-id new-tes
bd50: 74 64 61 74 29 20 22 2c 63 61 74 65 67 6f 72 79  tdat) ",category
bd60: 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c  ,variable,value,
bd70: 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69  expected,tol,uni
bd80: 74 73 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20  ts,comment FROM 
bd90: 74 65 73 74 5f 64 61 74 61 20 57 48 45 52 45 20  test_data WHERE 
bda0: 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20  test_id=?;")..  
bdb0: 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d     (db:test-get-
bdc0: 69 64 20 74 65 73 74 64 61 74 29 29 29 29 0a 09  id testdat))))..
bdd0: 20 29 29 0a 20 20 20 20 20 70 72 65 76 2d 74 65   )).     prev-te
bde0: 73 74 73 29 29 29 0a 09 20 0a 20 20 20 20 20 0a  sts))).. .     .