Megatest

Hex Artifact Content
Login

Artifact a8bf9623c9f30a243d7dcd442b8cfc1d15aa2b70:


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 28 69 66   waiton).    (if
2550: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 73   (not (null? tes
2560: 74 2d 6e 61 6d 65 73 29 29 0a 09 28 6c 65 74 20  t-names))..(let 
2570: 6c 6f 6f 70 20 28 28 68 65 64 20 28 63 61 72 20  loop ((hed (car 
2580: 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 09 20  test-names))... 
2590: 20 20 28 74 61 6c 20 28 63 64 72 20 74 65 73 74    (tal (cdr test
25a0: 2d 6e 61 6d 65 73 29 29 29 20 20 20 20 20 20 20  -names)))       
25b0: 20 20 3b 3b 20 27 72 65 74 75 72 6e 2d 70 72 6f    ;; 'return-pro
25c0: 63 73 20 74 65 6c 6c 73 20 74 68 65 20 63 6f 6e  cs tells the con
25d0: 66 69 67 20 72 65 61 64 65 72 20 74 6f 20 70 72  fig reader to pr
25e0: 65 70 20 72 75 6e 6e 69 6e 67 20 73 79 73 74 65  ep running syste
25f0: 6d 20 62 75 74 20 72 65 74 75 72 6e 20 61 20 70  m but return a p
2600: 72 6f 63 0a 09 20 20 28 64 65 62 75 67 3a 70 72  roc..  (debug:pr
2610: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 68 65 64 3d  int-info 4 "hed=
2620: 22 20 68 65 64 20 22 20 61 74 20 74 6f 70 20 6f  " hed " at top o
2630: 66 20 6c 6f 6f 70 22 29 0a 09 20 20 28 6c 65 74  f loop")..  (let
2640: 2a 20 28 28 63 6f 6e 66 69 67 20 20 28 74 65 73  * ((config  (tes
2650: 74 73 3a 67 65 74 2d 74 65 73 74 63 6f 6e 66 69  ts:get-testconfi
2660: 67 20 68 65 64 20 27 72 65 74 75 72 6e 2d 70 72  g hed 'return-pr
2670: 6f 63 73 29 29 0a 09 09 20 28 77 61 69 74 6f 6e  ocs))... (waiton
2680: 73 20 28 6c 65 74 20 28 28 69 6e 73 74 72 20 28  s (let ((instr (
2690: 69 66 20 63 6f 6e 66 69 67 20 0a 09 09 09 09 09  if config ......
26a0: 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75     (config-looku
26b0: 70 20 63 6f 6e 66 69 67 20 22 72 65 71 75 69 72  p config "requir
26c0: 65 6d 65 6e 74 73 22 20 22 77 61 69 74 6f 6e 22  ements" "waiton"
26d0: 29 0a 09 09 09 09 09 20 20 20 28 62 65 67 69 6e  )......   (begin
26e0: 20 3b 3b 20 4e 6f 20 63 6f 6e 66 69 67 20 6d 65   ;; No config me
26f0: 61 6e 73 20 74 68 69 73 20 69 73 20 61 20 6e 6f  ans this is a no
2700: 6e 2d 65 78 69 73 74 61 6e 74 20 74 65 73 74 0a  n-existant test.
2710: 09 09 09 09 09 20 20 20 20 20 28 64 65 62 75 67  .....     (debug
2720: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a  :print 0 "ERROR:
2730: 20 6e 6f 6e 2d 65 78 69 73 74 65 6e 74 20 72 65   non-existent re
2740: 71 75 69 72 65 64 20 74 65 73 74 20 5c 22 22 20  quired test \"" 
2750: 68 65 64 20 22 5c 22 22 29 0a 09 09 09 09 09 20  hed "\"")...... 
2760: 20 20 20 20 28 69 66 20 64 62 20 28 73 71 6c 69      (if db (sqli
2770: 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62  te3:finalize! db
2780: 29 29 0a 09 09 09 09 09 20 20 20 20 20 28 65 78  ))......     (ex
2790: 69 74 20 31 29 29 29 29 29 0a 09 09 09 20 20 20  it 1)))))....   
27a0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
27b0: 66 6f 20 38 20 22 77 61 69 74 6f 6e 73 20 73 74  fo 8 "waitons st
27c0: 72 69 6e 67 20 69 73 20 22 20 69 6e 73 74 72 29  ring is " instr)
27d0: 0a 09 09 09 20 20 20 20 28 73 74 72 69 6e 67 2d  ....    (string-
27e0: 73 70 6c 69 74 20 28 63 6f 6e 64 0a 09 09 09 09  split (cond.....
27f0: 09 20 20 20 28 28 70 72 6f 63 65 64 75 72 65 3f  .   ((procedure?
2800: 20 69 6e 73 74 72 29 0a 09 09 09 09 09 20 20 20   instr)......   
2810: 20 28 6c 65 74 20 28 28 72 65 73 20 28 69 6e 73   (let ((res (ins
2820: 74 72 29 29 29 0a 09 09 09 09 09 20 20 20 20 20  tr)))......     
2830: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
2840: 66 6f 20 38 20 22 77 61 69 74 6f 6e 20 70 72 6f  fo 8 "waiton pro
2850: 63 65 64 75 72 65 20 72 65 73 75 6c 74 73 20 69  cedure results i
2860: 6e 20 73 74 72 69 6e 67 20 22 20 72 65 73 20 22  n string " res "
2870: 20 66 6f 72 20 74 65 73 74 20 22 20 68 65 64 29   for test " hed)
2880: 0a 09 09 09 09 09 20 20 20 20 20 20 72 65 73 29  ......      res)
2890: 29 0a 09 09 09 09 09 20 20 20 28 28 73 74 72 69  )......   ((stri
28a0: 6e 67 3f 20 69 6e 73 74 72 29 20 20 20 20 20 69  ng? instr)     i
28b0: 6e 73 74 72 29 0a 09 09 09 09 09 20 20 20 28 65  nstr)......   (e
28c0: 6c 73 65 20 0a 09 09 09 09 09 20 20 20 20 3b 3b  lse ......    ;;
28d0: 20 4e 4f 54 45 3a 20 54 68 69 73 20 69 73 20 61   NOTE: This is a
28e0: 63 74 75 61 6c 6c 79 20 74 68 65 20 63 61 73 65  ctually the case
28f0: 20 6f 66 20 2a 6e 6f 2a 20 77 61 69 74 6f 6e 73   of *no* waitons
2900: 21 20 3b 3b 20 28 64 65 62 75 67 3a 70 72 69 6e  ! ;; (debug:prin
2910: 74 20 30 20 22 45 52 52 4f 52 3a 20 73 6f 6d 65  t 0 "ERROR: some
2920: 74 68 69 6e 67 20 77 65 6e 74 20 77 72 6f 6e 67  thing went wrong
2930: 20 69 6e 20 70 72 6f 63 65 73 73 69 6e 67 20 77   in processing w
2940: 61 69 74 6f 6e 73 20 66 6f 72 20 74 65 73 74 20  aitons for test 
2950: 22 20 68 65 64 29 0a 09 09 09 09 09 20 20 20 20  " hed)......    
2960: 22 22 29 29 29 29 29 29 0a 09 20 20 20 20 28 64  ""))))))..    (d
2970: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
2980: 38 20 22 77 61 69 74 6f 6e 73 3a 20 22 20 77 61  8 "waitons: " wa
2990: 69 74 6f 6e 73 29 0a 09 20 20 20 20 3b 3b 20 63  itons)..    ;; c
29a0: 68 65 63 6b 20 66 6f 72 20 68 65 64 20 69 6e 20  heck for hed in 
29b0: 77 61 69 74 6f 6e 73 20 3d 3e 20 74 68 69 73 20  waitons => this 
29c0: 77 6f 75 6c 64 20 62 65 20 63 69 72 63 75 6c 61  would be circula
29d0: 72 2c 20 72 65 6d 6f 76 65 20 69 74 20 61 6e 64  r, remove it and
29e0: 20 69 73 73 75 65 20 61 6e 0a 09 20 20 20 20 3b   issue an..    ;
29f0: 3b 20 65 72 72 6f 72 0a 09 20 20 20 20 28 69 66  ; error..    (if
2a00: 20 28 6d 65 6d 62 65 72 20 68 65 64 20 77 61 69   (member hed wai
2a10: 74 6f 6e 73 29 0a 09 09 28 62 65 67 69 6e 0a 09  tons)...(begin..
2a20: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  .  (debug:print 
2a30: 30 20 22 45 52 52 4f 52 3a 20 74 65 73 74 20 22  0 "ERROR: test "
2a40: 20 68 65 64 20 22 20 68 61 73 20 6c 69 73 74 65   hed " has liste
2a50: 64 20 69 74 73 65 6c 66 20 61 73 20 61 20 77 61  d itself as a wa
2a60: 69 74 6f 6e 2c 20 70 6c 65 61 73 65 20 63 6f 72  iton, please cor
2a70: 72 65 63 74 20 74 68 69 73 21 22 29 0a 09 09 20  rect this!")... 
2a80: 20 28 73 65 74 21 20 77 61 69 74 6f 6e 73 20 28   (set! waitons (
2a90: 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28  filter (lambda (
2aa0: 78 29 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 78  x)(not (equal? x
2ab0: 20 68 65 64 29 29 29 20 77 61 69 74 6f 6e 73 29   hed))) waitons)
2ac0: 29 29 29 0a 09 20 20 20 20 0a 09 20 20 20 20 3b  )))..    ..    ;
2ad0: 3b 20 28 69 74 65 6d 73 20 20 20 28 69 74 65 6d  ; (items   (item
2ae0: 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d  s:get-items-from
2af0: 2d 63 6f 6e 66 69 67 20 63 6f 6e 66 69 67 29 29  -config config))
2b00: 29 0a 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20  )..    (if (not 
2b10: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f  (hash-table-ref/
2b20: 64 65 66 61 75 6c 74 20 74 65 73 74 2d 72 65 63  default test-rec
2b30: 6f 72 64 73 20 68 65 64 20 23 66 29 29 0a 09 09  ords hed #f))...
2b40: 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21  (hash-table-set!
2b50: 20 74 65 73 74 2d 72 65 63 6f 72 64 73 0a 09 09   test-records...
2b60: 09 09 20 68 65 64 20 28 76 65 63 74 6f 72 20 68  .. hed (vector h
2b70: 65 64 20 20 20 20 20 3b 3b 20 30 0a 09 09 09 09  ed     ;; 0.....
2b80: 09 20 20 20 20 20 63 6f 6e 66 69 67 20 20 3b 3b  .     config  ;;
2b90: 20 31 0a 09 09 09 09 09 20 20 20 20 20 77 61 69   1......     wai
2ba0: 74 6f 6e 73 20 3b 3b 20 32 0a 09 09 09 09 09 20  tons ;; 2...... 
2bb0: 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b      (config-look
2bc0: 75 70 20 63 6f 6e 66 69 67 20 22 72 65 71 75 69  up config "requi
2bd0: 72 65 6d 65 6e 74 73 22 20 22 70 72 69 6f 72 69  rements" "priori
2be0: 74 79 22 29 20 20 20 20 20 3b 3b 20 70 72 69 6f  ty")     ;; prio
2bf0: 72 69 74 79 20 33 0a 09 09 09 09 09 20 20 20 20  rity 3......    
2c00: 20 28 6c 65 74 20 28 28 69 74 65 6d 73 20 20 20   (let ((items   
2c10: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72     (hash-table-r
2c20: 65 66 2f 64 65 66 61 75 6c 74 20 63 6f 6e 66 69  ef/default confi
2c30: 67 20 22 69 74 65 6d 73 22 20 23 66 29 29 20 3b  g "items" #f)) ;
2c40: 3b 20 69 74 65 6d 73 20 34 0a 09 09 09 09 09 09  ; items 4.......
2c50: 20 20 20 28 69 74 65 6d 73 74 61 62 6c 65 20 28     (itemstable (
2c60: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64  hash-table-ref/d
2c70: 65 66 61 75 6c 74 20 63 6f 6e 66 69 67 20 22 69  efault config "i
2c80: 74 65 6d 73 74 61 62 6c 65 22 20 23 66 29 29 29  temstable" #f)))
2c90: 20 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b   ......       ;;
2ca0: 20 69 66 20 65 69 74 68 65 72 20 69 74 65 6d 73   if either items
2cb0: 20 6f 72 20 69 74 65 6d 73 20 74 61 62 6c 65 20   or items table 
2cc0: 69 73 20 61 20 70 72 6f 63 20 72 65 74 75 72 6e  is a proc return
2cd0: 20 69 74 20 73 6f 20 74 65 73 74 20 72 75 6e 6e   it so test runn
2ce0: 69 6e 67 0a 09 09 09 09 09 20 20 20 20 20 20 20  ing......       
2cf0: 3b 3b 20 70 72 6f 63 65 73 73 20 63 61 6e 20 6b  ;; process can k
2d00: 6e 6f 77 20 74 6f 20 63 61 6c 6c 20 69 74 65 6d  now to call item
2d10: 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d  s:get-items-from
2d20: 2d 63 6f 6e 66 69 67 0a 09 09 09 09 09 20 20 20  -config......   
2d30: 20 20 20 20 3b 3b 20 69 66 20 65 69 74 68 65 72      ;; if either
2d40: 20 69 73 20 61 20 6c 69 73 74 20 61 6e 64 20 6e   is a list and n
2d50: 6f 6e 65 20 69 73 20 61 20 70 72 6f 63 20 67 6f  one is a proc go
2d60: 20 61 68 65 61 64 20 61 6e 64 20 63 61 6c 6c 20   ahead and call 
2d70: 67 65 74 2d 69 74 65 6d 73 0a 09 09 09 09 09 20  get-items...... 
2d80: 20 20 20 20 20 20 3b 3b 20 6f 74 68 65 72 77 69        ;; otherwi
2d90: 73 65 20 72 65 74 75 72 6e 20 23 66 20 2d 20 74  se return #f - t
2da0: 68 69 73 20 69 73 20 6e 6f 74 20 61 6e 20 69 74  his is not an it
2db0: 65 72 61 74 65 64 20 74 65 73 74 0a 09 09 09 09  erated test.....
2dc0: 09 20 20 20 20 20 20 20 28 63 6f 6e 64 0a 09 09  .       (cond...
2dd0: 09 09 09 09 28 28 70 72 6f 63 65 64 75 72 65 3f  ....((procedure?
2de0: 20 69 74 65 6d 73 29 20 20 20 20 20 20 0a 09 09   items)      ...
2df0: 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e  .... (debug:prin
2e00: 74 2d 69 6e 66 6f 20 34 20 22 69 74 65 6d 73 20  t-info 4 "items 
2e10: 69 73 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20  is a procedure, 
2e20: 77 69 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72 22  will calc later"
2e30: 29 0a 09 09 09 09 09 09 20 69 74 65 6d 73 29 20  )....... items) 
2e40: 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 63 61             ;; ca
2e50: 6c 63 20 6c 61 74 65 72 0a 09 09 09 09 09 09 28  lc later.......(
2e60: 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d  (procedure? item
2e70: 73 74 61 62 6c 65 29 0a 09 09 09 09 09 09 20 28  stable)....... (
2e80: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
2e90: 20 34 20 22 69 74 65 6d 73 74 61 62 6c 65 20 69   4 "itemstable i
2ea0: 73 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20 77  s a procedure, w
2eb0: 69 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72 22 29  ill calc later")
2ec0: 0a 09 09 09 09 09 09 20 69 74 65 6d 73 74 61 62  ....... itemstab
2ed0: 6c 65 29 20 20 20 20 20 20 20 3b 3b 20 63 61 6c  le)       ;; cal
2ee0: 63 20 6c 61 74 65 72 0a 09 09 09 09 09 09 28 28  c later.......((
2ef0: 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28  filter (lambda (
2f00: 78 29 0a 09 09 09 09 09 09 09 20 20 20 28 6c 65  x)........   (le
2f10: 74 20 28 28 76 61 6c 20 28 63 61 72 20 78 29 29  t ((val (car x))
2f20: 29 0a 09 09 09 09 09 09 09 20 20 20 20 20 28 69  )........     (i
2f30: 66 20 28 70 72 6f 63 65 64 75 72 65 3f 20 76 61  f (procedure? va
2f40: 6c 29 20 76 61 6c 20 23 66 29 29 29 0a 09 09 09  l) val #f)))....
2f50: 09 09 09 09 20 28 61 70 70 65 6e 64 20 28 69 66  .... (append (if
2f60: 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 69   (list? items) i
2f70: 74 65 6d 73 20 27 28 29 29 0a 09 09 09 09 09 09  tems '()).......
2f80: 09 09 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74  .. (if (list? it
2f90: 65 6d 73 74 61 62 6c 65 29 20 69 74 65 6d 73 74  emstable) itemst
2fa0: 61 62 6c 65 20 27 28 29 29 29 29 0a 09 09 09 09  able '()))).....
2fb0: 09 09 20 27 68 61 76 65 2d 70 72 6f 63 65 64 75  .. 'have-procedu
2fc0: 72 65 29 0a 09 09 09 09 09 09 28 28 6f 72 20 28  re).......((or (
2fd0: 6c 69 73 74 3f 20 69 74 65 6d 73 29 28 6c 69 73  list? items)(lis
2fe0: 74 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 29 20  t? itemstable)) 
2ff0: 3b 3b 20 63 61 6c 63 20 6e 6f 77 0a 09 09 09 09  ;; calc now.....
3000: 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d  .. (debug:print-
3010: 69 6e 66 6f 20 34 20 22 69 74 65 6d 73 20 61 6e  info 4 "items an
3020: 64 20 69 74 65 6d 73 74 61 62 6c 65 20 61 72 65  d itemstable are
3030: 20 6c 69 73 74 73 2c 20 63 61 6c 63 20 6e 6f 77   lists, calc now
3040: 5c 6e 22 0a 09 09 09 09 09 09 09 20 20 20 20 20  \n"........     
3050: 20 22 20 20 20 20 69 74 65 6d 73 3a 20 22 20 69   "    items: " i
3060: 74 65 6d 73 20 22 20 69 74 65 6d 73 74 61 62 6c  tems " itemstabl
3070: 65 3a 20 22 20 69 74 65 6d 73 74 61 62 6c 65 29  e: " itemstable)
3080: 0a 09 09 09 09 09 09 20 28 69 74 65 6d 73 3a 67  ....... (items:g
3090: 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f  et-items-from-co
30a0: 6e 66 69 67 20 63 6f 6e 66 69 67 29 29 0a 09 09  nfig config))...
30b0: 09 09 09 09 28 65 6c 73 65 20 23 66 29 29 29 20  ....(else #f))) 
30c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
30d0: 20 20 20 20 20 20 20 20 20 20 3b 3b 20 6e 6f 74            ;; not
30e0: 20 69 74 65 72 61 74 65 64 0a 09 09 09 09 09 20   iterated...... 
30f0: 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b 20 69      #f      ;; i
3100: 74 65 6d 73 64 61 74 20 35 0a 09 09 09 09 09 20  temsdat 5...... 
3110: 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b 20 73      #f      ;; s
3120: 70 61 72 65 20 2d 20 75 73 65 64 20 66 6f 72 20  pare - used for 
3130: 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 09 09 20  item-path...... 
3140: 20 20 20 20 29 29 29 0a 09 20 20 20 20 28 66 6f      )))..    (fo
3150: 72 2d 65 61 63 68 20 0a 09 20 20 20 20 20 28 6c  r-each ..     (l
3160: 61 6d 62 64 61 20 28 77 61 69 74 6f 6e 29 0a 09  ambda (waiton)..
3170: 20 20 20 20 20 20 20 28 69 66 20 28 61 6e 64 20         (if (and 
3180: 77 61 69 74 6f 6e 20 28 6e 6f 74 20 28 6d 65 6d  waiton (not (mem
3190: 62 65 72 20 77 61 69 74 6f 6e 20 74 65 73 74 2d  ber waiton test-
31a0: 6e 61 6d 65 73 29 29 29 0a 09 09 20 20 20 28 62  names)))...   (b
31b0: 65 67 69 6e 0a 09 09 20 20 20 20 20 28 73 65 74  egin...     (set
31c0: 21 20 72 65 71 75 69 72 65 64 2d 74 65 73 74 73  ! required-tests
31d0: 20 28 63 6f 6e 73 20 77 61 69 74 6f 6e 20 72 65   (cons waiton re
31e0: 71 75 69 72 65 64 2d 74 65 73 74 73 29 29 0a 09  quired-tests))..
31f0: 09 20 20 20 20 20 28 73 65 74 21 20 74 65 73 74  .     (set! test
3200: 2d 6e 61 6d 65 73 20 28 63 6f 6e 73 20 77 61 69  -names (cons wai
3210: 74 6f 6e 20 74 65 73 74 2d 6e 61 6d 65 73 29 29  ton test-names))
3220: 29 29 29 20 3b 3b 20 77 61 73 20 61 6e 20 61 70  ))) ;; was an ap
3230: 70 65 6e 64 2c 20 6e 6f 77 20 61 20 63 6f 6e 73  pend, now a cons
3240: 0a 09 20 20 20 20 20 77 61 69 74 6f 6e 73 29 0a  ..     waitons).
3250: 09 20 20 20 20 28 6c 65 74 20 28 28 72 65 6d 74  .    (let ((remt
3260: 65 73 74 73 20 28 64 65 6c 65 74 65 2d 64 75 70  ests (delete-dup
3270: 6c 69 63 61 74 65 73 20 28 61 70 70 65 6e 64 20  licates (append 
3280: 77 61 69 74 6f 6e 73 20 74 61 6c 29 29 29 29 0a  waitons tal)))).
3290: 09 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20  .      (if (not 
32a0: 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29  (null? remtests)
32b0: 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72  )...  (loop (car
32c0: 20 72 65 6d 74 65 73 74 73 29 28 63 64 72 20 72   remtests)(cdr r
32d0: 65 6d 74 65 73 74 73 29 29 29 29 29 29 29 0a 0a  emtests)))))))..
32e0: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75      (if (not (nu
32f0: 6c 6c 3f 20 72 65 71 75 69 72 65 64 2d 74 65 73  ll? required-tes
3300: 74 73 29 29 0a 09 28 64 65 62 75 67 3a 70 72 69  ts))..(debug:pri
3310: 6e 74 2d 69 6e 66 6f 20 31 20 22 41 64 64 69 6e  nt-info 1 "Addin
3320: 67 20 22 20 72 65 71 75 69 72 65 64 2d 74 65 73  g " required-tes
3330: 74 73 20 22 20 74 6f 20 74 68 65 20 72 75 6e 20  ts " to the run 
3340: 71 75 65 75 65 22 29 29 0a 20 20 20 20 3b 3b 20  queue")).    ;; 
3350: 4e 4f 54 45 3a 20 74 68 65 73 65 20 61 72 65 20  NOTE: these are 
3360: 61 6c 6c 20 70 61 72 65 6e 74 20 74 65 73 74 73  all parent tests
3370: 2c 20 69 74 65 6d 73 20 61 72 65 20 6e 6f 74 20  , items are not 
3380: 65 78 70 61 6e 64 65 64 20 79 65 74 2e 0a 20 20  expanded yet..  
3390: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69    (debug:print-i
33a0: 6e 66 6f 20 34 20 22 74 65 73 74 2d 72 65 63 6f  nfo 4 "test-reco
33b0: 72 64 73 3d 22 20 28 68 61 73 68 2d 74 61 62 6c  rds=" (hash-tabl
33c0: 65 2d 3e 61 6c 69 73 74 20 74 65 73 74 2d 72 65  e->alist test-re
33d0: 63 6f 72 64 73 29 29 0a 20 20 20 20 28 72 75 6e  cords)).    (run
33e0: 73 3a 72 75 6e 2d 74 65 73 74 73 2d 71 75 65 75  s:run-tests-queu
33f0: 65 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65  e run-id runname
3400: 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 6b 65   test-records ke
3410: 79 76 61 6c 6c 73 74 20 66 6c 61 67 73 20 74 65  yvallst flags te
3420: 73 74 2d 70 61 74 74 73 29 0a 20 20 20 20 28 64  st-patts).    (d
3430: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
3440: 34 20 22 41 6c 6c 20 64 6f 6e 65 20 62 79 20 68  4 "All done by h
3450: 65 72 65 22 29 29 29 0a 0a 28 64 65 66 69 6e 65  ere")))..(define
3460: 20 28 72 75 6e 73 3a 63 61 6c 63 2d 66 61 69 6c   (runs:calc-fail
3470: 73 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65  s prereqs-not-me
3480: 74 29 0a 20 20 28 66 69 6c 74 65 72 20 28 6c 61  t).  (filter (la
3490: 6d 62 64 61 20 28 74 65 73 74 29 0a 09 20 20 20  mbda (test)..   
34a0: 20 28 61 6e 64 20 28 76 65 63 74 6f 72 3f 20 74   (and (vector? t
34b0: 65 73 74 29 20 3b 3b 20 6e 6f 74 20 28 73 74 72  est) ;; not (str
34c0: 69 6e 67 3f 20 74 65 73 74 29 29 0a 09 09 20 28  ing? test))... (
34d0: 65 71 75 61 6c 3f 20 28 64 62 3a 74 65 73 74 2d  equal? (db:test-
34e0: 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 29 20  get-state test) 
34f0: 22 43 4f 4d 50 4c 45 54 45 44 22 29 0a 09 09 20  "COMPLETED")... 
3500: 28 6e 6f 74 20 28 6d 65 6d 62 65 72 20 28 64 62  (not (member (db
3510: 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73  :test-get-status
3520: 20 74 65 73 74 29 0a 09 09 09 20 20 20 20 20 20   test)....      
3530: 27 28 22 50 41 53 53 22 20 22 57 41 52 4e 22 20  '("PASS" "WARN" 
3540: 22 43 48 45 43 4b 22 20 22 57 41 49 56 45 44 22  "CHECK" "WAIVED"
3550: 20 22 53 4b 49 50 22 29 29 29 29 29 0a 09 20 20   "SKIP")))))..  
3560: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29  prereqs-not-met)
3570: 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73  )..(define (runs
3580: 3a 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65  :calc-not-comple
3590: 74 65 64 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d  ted prereqs-not-
35a0: 6d 65 74 29 0a 20 20 28 66 69 6c 74 65 72 0a 20  met).  (filter. 
35b0: 20 20 28 6c 61 6d 62 64 61 20 28 74 29 0a 20 20    (lambda (t).  
35c0: 20 20 20 28 6f 72 20 28 6e 6f 74 20 28 76 65 63     (or (not (vec
35d0: 74 6f 72 3f 20 74 29 29 0a 09 20 28 6e 6f 74 20  tor? t)).. (not 
35e0: 28 65 71 75 61 6c 3f 20 22 43 4f 4d 50 4c 45 54  (equal? "COMPLET
35f0: 45 44 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74  ED" (db:test-get
3600: 2d 73 74 61 74 65 20 74 29 29 29 29 29 0a 20 20  -state t))))).  
3610: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74   prereqs-not-met
3620: 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e  ))..(define (run
3630: 73 3a 70 72 65 74 74 79 2d 73 74 72 69 6e 67 20  s:pretty-string 
3640: 6c 73 74 29 0a 20 20 28 6d 61 70 20 28 6c 61 6d  lst).  (map (lam
3650: 62 64 61 20 28 74 29 0a 09 20 28 69 66 20 28 6e  bda (t).. (if (n
3660: 6f 74 20 28 76 65 63 74 6f 72 3f 20 74 29 29 0a  ot (vector? t)).
3670: 09 20 20 20 20 20 28 63 6f 6e 63 20 74 29 0a 09  .     (conc t)..
3680: 20 20 20 20 20 28 63 6f 6e 63 20 28 64 62 3a 74       (conc (db:t
3690: 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65  est-get-testname
36a0: 20 74 29 20 22 3a 22 20 28 64 62 3a 74 65 73 74   t) ":" (db:test
36b0: 2d 67 65 74 2d 73 74 61 74 65 20 74 29 20 22 2f  -get-state t) "/
36c0: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73  " (db:test-get-s
36d0: 74 61 74 75 73 20 74 29 29 29 29 0a 20 20 20 20  tatus t)))).    
36e0: 20 20 20 6c 73 74 29 29 0a 0a 28 64 65 66 69 6e     lst))..(defin
36f0: 65 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c  e (runs:make-ful
3700: 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74  l-test-name test
3710: 6e 61 6d 65 20 69 74 65 6d 70 61 74 68 29 0a 20  name itempath). 
3720: 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65   (if (equal? ite
3730: 6d 70 61 74 68 20 22 22 29 20 74 65 73 74 6e 61  mpath "") testna
3740: 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d  me (conc testnam
3750: 65 20 22 2f 22 20 69 74 65 6d 70 61 74 68 29 29  e "/" itempath))
3760: 29 0a 0a 3b 3b 20 74 65 73 74 2d 72 65 63 6f 72  )..;; test-recor
3770: 64 73 20 69 73 20 61 20 68 61 73 68 20 74 61 62  ds is a hash tab
3780: 6c 65 20 74 65 73 74 6e 61 6d 65 3a 69 74 65 6d  le testname:item
3790: 5f 70 61 74 68 20 3d 3e 20 76 65 63 74 6f 72 20  _path => vector 
37a0: 3c 20 74 65 73 74 6e 61 6d 65 20 74 65 73 74 63  < testname testc
37b0: 6f 6e 66 69 67 20 77 61 69 74 6f 6e 73 20 70 72  onfig waitons pr
37c0: 69 6f 72 69 74 79 20 69 74 65 6d 73 2d 69 6e 66  iority items-inf
37d0: 6f 20 2e 2e 2e 20 3e 0a 28 64 65 66 69 6e 65 20  o ... >.(define 
37e0: 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d  (runs:run-tests-
37f0: 71 75 65 75 65 20 72 75 6e 2d 69 64 20 72 75 6e  queue run-id run
3800: 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64  name test-record
3810: 73 20 6b 65 79 76 61 6c 6c 73 74 20 66 6c 61 67  s keyvallst flag
3820: 73 20 74 65 73 74 2d 70 61 74 74 73 29 0a 20 20  s test-patts).  
3830: 20 20 3b 3b 20 41 74 20 74 68 69 73 20 70 6f 69    ;; At this poi
3840: 6e 74 20 74 68 65 20 6c 69 73 74 20 6f 66 20 70  nt the list of p
3850: 61 72 65 6e 74 20 74 65 73 74 73 20 69 73 20 65  arent tests is e
3860: 78 70 61 6e 64 65 64 20 0a 20 20 20 20 3b 3b 20  xpanded .    ;; 
3870: 4e 42 2f 2f 20 53 68 6f 75 6c 64 20 65 78 70 61  NB// Should expa
3880: 6e 64 20 69 74 65 6d 73 20 68 65 72 65 20 61 6e  nd items here an
3890: 64 20 74 68 65 6e 20 69 6e 73 65 72 74 20 69 6e  d then insert in
38a0: 74 6f 20 74 68 65 20 72 75 6e 20 71 75 65 75 65  to the run queue
38b0: 2e 0a 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ..  (debug:print
38c0: 20 35 20 22 74 65 73 74 2d 72 65 63 6f 72 64 73   5 "test-records
38d0: 3a 20 22 20 74 65 73 74 2d 72 65 63 6f 72 64 73  : " test-records
38e0: 20 22 2c 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22   ", keyvallst: "
38f0: 20 6b 65 79 76 61 6c 6c 73 74 20 22 20 66 6c 61   keyvallst " fla
3900: 67 73 3a 20 22 20 28 68 61 73 68 2d 74 61 62 6c  gs: " (hash-tabl
3910: 65 2d 3e 61 6c 69 73 74 20 66 6c 61 67 73 29 29  e->alist flags))
3920: 0a 20 20 28 6c 65 74 20 28 28 73 6f 72 74 65 64  .  (let ((sorted
3930: 2d 74 65 73 74 2d 6e 61 6d 65 73 20 28 74 65 73  -test-names (tes
3940: 74 73 3a 73 6f 72 74 2d 62 79 2d 70 72 69 6f 72  ts:sort-by-prior
3950: 69 74 79 2d 61 6e 64 2d 77 61 69 74 6f 6e 20 74  ity-and-waiton t
3960: 65 73 74 2d 72 65 63 6f 72 64 73 29 29 0a 09 28  est-records))..(
3970: 74 65 73 74 2d 72 65 67 69 73 74 65 72 79 20 20  test-registery  
3980: 20 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62    (make-hash-tab
3990: 6c 65 29 29 0a 09 28 72 65 67 69 73 74 65 72 79  le))..(registery
39a0: 2d 6d 75 74 65 78 20 20 20 28 6d 61 6b 65 2d 6d  -mutex   (make-m
39b0: 75 74 65 78 29 29 0a 09 28 6e 75 6d 2d 72 65 74  utex))..(num-ret
39c0: 72 69 65 73 20 20 20 20 20 20 20 20 30 29 0a 09  ries        0)..
39d0: 28 6d 61 78 2d 72 65 74 72 69 65 73 20 20 20 20  (max-retries    
39e0: 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75     (config-looku
39f0: 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 73  p *configdat* "s
3a00: 65 74 75 70 22 20 22 6d 61 78 72 65 74 72 69 65  etup" "maxretrie
3a10: 73 22 29 29 29 0a 20 20 20 20 28 73 65 74 21 20  s"))).    (set! 
3a20: 6d 61 78 2d 72 65 74 72 69 65 73 20 28 69 66 20  max-retries (if 
3a30: 28 61 6e 64 20 6d 61 78 2d 72 65 74 72 69 65 73  (and max-retries
3a40: 20 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72   (string->number
3a50: 20 6d 61 78 2d 72 65 74 72 69 65 73 29 29 28 73   max-retries))(s
3a60: 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 61  tring->number ma
3a70: 78 2d 72 65 74 72 69 65 73 29 20 31 30 30 29 29  x-retries) 100))
3a80: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e  .    (if (not (n
3a90: 75 6c 6c 3f 20 73 6f 72 74 65 64 2d 74 65 73 74  ull? sorted-test
3aa0: 2d 6e 61 6d 65 73 29 29 0a 09 28 6c 65 74 20 6c  -names))..(let l
3ab0: 6f 6f 70 20 28 28 68 65 64 20 20 20 20 20 20 20  oop ((hed       
3ac0: 20 20 28 63 61 72 20 73 6f 72 74 65 64 2d 74 65    (car sorted-te
3ad0: 73 74 2d 6e 61 6d 65 73 29 29 0a 09 09 20 20 20  st-names))...   
3ae0: 28 74 61 6c 20 20 20 20 20 20 20 20 20 28 63 64  (tal         (cd
3af0: 72 20 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61  r sorted-test-na
3b00: 6d 65 73 29 29 0a 09 09 20 20 20 28 72 65 72 75  mes))...   (reru
3b10: 6e 73 20 20 20 20 20 20 27 28 29 29 29 0a 09 20  ns      '())).. 
3b20: 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f   (if (not (null?
3b30: 20 72 65 72 75 6e 73 29 29 28 64 65 62 75 67 3a   reruns))(debug:
3b40: 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 72 65  print-info 4 "re
3b50: 72 75 6e 73 3d 22 20 72 65 72 75 6e 73 29 29 0a  runs=" reruns)).
3b60: 09 20 20 3b 3b 20 28 70 72 69 6e 74 20 22 54 6f  .  ;; (print "To
3b70: 70 20 6f 66 20 6c 6f 6f 70 2c 20 68 65 64 3d 22  p of loop, hed="
3b80: 20 68 65 64 20 22 2c 20 74 61 6c 3d 22 20 74 61   hed ", tal=" ta
3b90: 6c 20 22 20 2c 72 65 72 75 6e 73 3d 22 20 72 65  l " ,reruns=" re
3ba0: 72 75 6e 73 29 0a 09 20 20 28 6c 65 74 2a 20 28  runs)..  (let* (
3bb0: 28 74 65 73 74 2d 72 65 63 6f 72 64 20 28 68 61  (test-record (ha
3bc0: 73 68 2d 74 61 62 6c 65 2d 72 65 66 20 74 65 73  sh-table-ref tes
3bd0: 74 2d 72 65 63 6f 72 64 73 20 68 65 64 29 29 0a  t-records hed)).
3be0: 09 09 20 28 74 65 73 74 2d 6e 61 6d 65 20 20 20  .. (test-name   
3bf0: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65  (tests:testqueue
3c00: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65  -get-testname te
3c10: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 28  st-record))... (
3c20: 74 63 6f 6e 66 69 67 20 20 20 20 20 28 74 65 73  tconfig     (tes
3c30: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
3c40: 2d 74 65 73 74 63 6f 6e 66 69 67 20 74 65 73 74  -testconfig test
3c50: 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 28 74 65  -record))... (te
3c60: 73 74 6d 6f 64 65 20 20 20 20 28 6c 65 74 20 28  stmode    (let (
3c70: 28 6d 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75  (m (config-looku
3c80: 70 20 74 63 6f 6e 66 69 67 20 22 72 65 71 75 69  p tconfig "requi
3c90: 72 65 6d 65 6e 74 73 22 20 22 6d 6f 64 65 22 29  rements" "mode")
3ca0: 29 29 0a 09 09 09 09 28 69 66 20 6d 20 28 73 74  )).....(if m (st
3cb0: 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c 20 6d 29 20  ring->symbol m) 
3cc0: 27 6e 6f 72 6d 61 6c 29 29 29 0a 09 09 20 28 77  'normal)))... (w
3cd0: 61 69 74 6f 6e 73 20 20 20 20 20 28 74 65 73 74  aitons     (test
3ce0: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d  s:testqueue-get-
3cf0: 77 61 69 74 6f 6e 73 20 20 20 20 74 65 73 74 2d  waitons    test-
3d00: 72 65 63 6f 72 64 29 29 0a 09 09 20 28 70 72 69  record))... (pri
3d10: 6f 72 69 74 79 20 20 20 20 28 74 65 73 74 73 3a  ority    (tests:
3d20: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 70 72  testqueue-get-pr
3d30: 69 6f 72 69 74 79 20 20 20 74 65 73 74 2d 72 65  iority   test-re
3d40: 63 6f 72 64 29 29 0a 09 09 20 28 69 74 65 6d 64  cord))... (itemd
3d50: 61 74 20 20 20 20 20 28 74 65 73 74 73 3a 74 65  at     (tests:te
3d60: 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d  stqueue-get-item
3d70: 64 61 74 20 20 20 20 74 65 73 74 2d 72 65 63 6f  dat    test-reco
3d80: 72 64 29 29 20 3b 3b 20 69 74 65 6d 64 61 74 20  rd)) ;; itemdat 
3d90: 63 61 6e 20 62 65 20 61 20 73 74 72 69 6e 67 2c  can be a string,
3da0: 20 6c 69 73 74 20 6f 72 20 23 66 0a 09 09 20 28   list or #f... (
3db0: 69 74 65 6d 73 20 20 20 20 20 20 20 28 74 65 73  items       (tes
3dc0: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
3dd0: 2d 69 74 65 6d 73 20 20 20 20 20 20 74 65 73 74  -items      test
3de0: 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 28 69 74  -record))... (it
3df0: 65 6d 2d 70 61 74 68 20 20 20 28 69 74 65 6d 2d  em-path   (item-
3e00: 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64  list->path itemd
3e10: 61 74 29 29 0a 09 09 20 28 6e 65 77 74 61 6c 20  at))... (newtal 
3e20: 20 20 20 20 20 28 61 70 70 65 6e 64 20 74 61 6c       (append tal
3e30: 20 28 6c 69 73 74 20 68 65 64 29 29 29 29 0a 09   (list hed))))..
3e40: 20 20 20 20 0a 09 20 20 20 20 28 64 65 62 75 67      ..    (debug
3e50: 3a 70 72 69 6e 74 20 36 0a 09 09 09 20 22 74 65  :print 6.... "te
3e60: 73 74 2d 6e 61 6d 65 3a 20 22 20 74 65 73 74 2d  st-name: " test-
3e70: 6e 61 6d 65 0a 09 09 09 20 22 5c 6e 20 20 68 65  name.... "\n  he
3e80: 64 3a 20 20 20 20 20 20 20 20 20 22 20 68 65 64  d:         " hed
3e90: 0a 09 09 09 20 22 5c 6e 20 20 69 74 65 6d 64 61  .... "\n  itemda
3ea0: 74 3a 20 20 20 20 20 22 20 69 74 65 6d 64 61 74  t:     " itemdat
3eb0: 0a 09 09 09 20 22 5c 6e 20 20 69 74 65 6d 73 3a  .... "\n  items:
3ec0: 20 20 20 20 20 20 20 22 20 69 74 65 6d 73 0a 09         " items..
3ed0: 09 09 20 22 5c 6e 20 20 69 74 65 6d 2d 70 61 74  .. "\n  item-pat
3ee0: 68 3a 20 20 20 22 20 69 74 65 6d 2d 70 61 74 68  h:   " item-path
3ef0: 0a 09 09 09 20 22 5c 6e 20 20 77 61 69 74 6f 6e  .... "\n  waiton
3f00: 73 3a 20 20 20 20 20 22 20 77 61 69 74 6f 6e 73  s:     " waitons
3f10: 0a 09 09 09 20 22 5c 6e 20 20 6e 75 6d 2d 72 65  .... "\n  num-re
3f20: 74 72 69 65 73 3a 20 22 20 6e 75 6d 2d 72 65 74  tries: " num-ret
3f30: 72 69 65 73 0a 09 09 09 20 22 5c 6e 20 20 74 61  ries.... "\n  ta
3f40: 6c 3a 20 20 20 20 20 20 20 20 20 22 20 74 61 6c  l:         " tal
3f50: 0a 09 09 09 20 22 5c 6e 20 20 72 65 72 75 6e 73  .... "\n  reruns
3f60: 3a 20 20 20 20 20 20 22 20 72 65 72 75 6e 73 29  :      " reruns)
3f70: 0a 0a 09 20 20 20 20 3b 3b 20 63 68 65 63 6b 20  ...    ;; check 
3f80: 66 6f 72 20 68 65 64 20 69 6e 20 77 61 69 74 6f  for hed in waito
3f90: 6e 73 20 3d 3e 20 74 68 69 73 20 77 6f 75 6c 64  ns => this would
3fa0: 20 62 65 20 63 69 72 63 75 6c 61 72 2c 20 72 65   be circular, re
3fb0: 6d 6f 76 65 20 69 74 20 61 6e 64 20 69 73 73 75  move it and issu
3fc0: 65 20 61 6e 0a 09 20 20 20 20 3b 3b 20 65 72 72  e an..    ;; err
3fd0: 6f 72 0a 09 20 20 20 20 28 69 66 20 28 6d 65 6d  or..    (if (mem
3fe0: 62 65 72 20 74 65 73 74 2d 6e 61 6d 65 20 77 61  ber test-name wa
3ff0: 69 74 6f 6e 73 29 0a 09 09 28 62 65 67 69 6e 0a  itons)...(begin.
4000: 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ..  (debug:print
4010: 20 30 20 22 45 52 52 4f 52 3a 20 74 65 73 74 20   0 "ERROR: test 
4020: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 68 61  " test-name " ha
4030: 73 20 6c 69 73 74 65 64 20 69 74 73 65 6c 66 20  s listed itself 
4040: 61 73 20 61 20 77 61 69 74 6f 6e 2c 20 70 6c 65  as a waiton, ple
4050: 61 73 65 20 63 6f 72 72 65 63 74 20 74 68 69 73  ase correct this
4060: 21 22 29 0a 09 09 20 20 28 73 65 74 21 20 77 61  !")...  (set! wa
4070: 69 74 6f 6e 20 28 66 69 6c 74 65 72 20 28 6c 61  iton (filter (la
4080: 6d 62 64 61 20 28 78 29 28 6e 6f 74 20 28 65 71  mbda (x)(not (eq
4090: 75 61 6c 3f 20 78 20 68 65 64 29 29 29 20 77 61  ual? x hed))) wa
40a0: 69 74 6f 6e 73 29 29 29 29 0a 0a 09 20 20 20 20  itons))))...    
40b0: 28 63 6f 6e 64 20 3b 3b 20 4f 55 54 45 52 20 43  (cond ;; OUTER C
40c0: 4f 4e 44 0a 09 20 20 20 20 20 28 28 6e 6f 74 20  OND..     ((not 
40d0: 69 74 65 6d 73 29 20 3b 3b 20 77 68 65 6e 20 66  items) ;; when f
40e0: 61 6c 73 65 20 74 68 65 20 74 65 73 74 20 69 73  alse the test is
40f0: 20 6f 6b 20 74 6f 20 62 65 20 68 61 6e 64 65 64   ok to be handed
4100: 20 6f 66 66 20 74 6f 20 6c 61 75 6e 63 68 20 28   off to launch (
4110: 62 75 74 20 6e 6f 74 20 62 65 66 6f 72 65 29 0a  but not before).
4120: 09 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 72  .      (let* ((r
4130: 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 20  un-limits-info  
4140: 20 20 20 20 20 20 20 28 72 75 6e 73 3a 63 61 6e         (runs:can
4150: 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20  -run-more-tests 
4160: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 20 3b 3b  test-record)) ;;
4170: 20 6c 6f 6f 6b 20 61 74 20 74 68 65 20 74 65 73   look at the tes
4180: 74 20 6a 6f 62 67 72 6f 75 70 20 61 6e 64 20 74  t jobgroup and t
4190: 6f 74 20 6a 6f 62 73 20 72 75 6e 6e 69 6e 67 0a  ot jobs running.
41a0: 09 09 20 20 20 20 20 28 68 61 76 65 2d 72 65 73  ..     (have-res
41b0: 6f 75 72 63 65 73 20 20 20 20 20 20 20 20 20 20  ources          
41c0: 28 63 61 72 20 72 75 6e 2d 6c 69 6d 69 74 73 2d  (car run-limits-
41d0: 69 6e 66 6f 29 29 0a 09 09 20 20 20 20 20 28 6e  info))...     (n
41e0: 75 6d 2d 72 75 6e 6e 69 6e 67 20 20 20 20 20 20  um-running      
41f0: 20 20 20 20 20 20 20 28 6c 69 73 74 2d 72 65 66         (list-ref
4200: 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f   run-limits-info
4210: 20 31 29 29 0a 09 09 20 20 20 20 20 28 6e 75 6d   1))...     (num
4220: 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67  -running-in-jobg
4230: 72 6f 75 70 20 28 6c 69 73 74 2d 72 65 66 20 72  roup (list-ref r
4240: 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 32  un-limits-info 2
4250: 29 29 0a 09 09 20 20 20 20 20 28 6d 61 78 2d 63  ))...     (max-c
4260: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 20  oncurrent-jobs  
4270: 20 20 20 28 6c 69 73 74 2d 72 65 66 20 72 75 6e     (list-ref run
4280: 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 33 29 29  -limits-info 3))
4290: 0a 09 09 20 20 20 20 20 28 6a 6f 62 2d 67 72 6f  ...     (job-gro
42a0: 75 70 2d 6c 69 6d 69 74 20 20 20 20 20 20 20 20  up-limit        
42b0: 20 28 6c 69 73 74 2d 72 65 66 20 72 75 6e 2d 6c   (list-ref run-l
42c0: 69 6d 69 74 73 2d 69 6e 66 6f 20 34 29 29 0a 09  imits-info 4))..
42d0: 09 20 20 20 20 20 28 70 72 65 72 65 71 73 2d 6e  .     (prereqs-n
42e0: 6f 74 2d 6d 65 74 20 20 20 20 20 20 20 20 20 28  ot-met         (
42f0: 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64  cdb:remote-run d
4300: 62 3a 67 65 74 2d 70 72 65 72 65 71 73 2d 6e 6f  b:get-prereqs-no
4310: 74 2d 6d 65 74 20 23 66 20 72 75 6e 2d 69 64 20  t-met #f run-id 
4320: 77 61 69 74 6f 6e 73 20 69 74 65 6d 2d 70 61 74  waitons item-pat
4330: 68 20 6d 6f 64 65 3a 20 74 65 73 74 6d 6f 64 65  h mode: testmode
4340: 29 29 0a 09 09 20 20 20 20 20 28 66 61 69 6c 73  ))...     (fails
4350: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
4360: 20 20 20 28 72 75 6e 73 3a 63 61 6c 63 2d 66 61     (runs:calc-fa
4370: 69 6c 73 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d  ils prereqs-not-
4380: 6d 65 74 29 29 0a 09 09 20 20 20 20 20 28 6e 6f  met))...     (no
4390: 6e 2d 63 6f 6d 70 6c 65 74 65 64 20 20 20 20 20  n-completed     
43a0: 20 20 20 20 20 20 28 72 75 6e 73 3a 63 61 6c 63        (runs:calc
43b0: 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 74 65 64 20 70  -not-completed p
43c0: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29  rereqs-not-met))
43d0: 29 0a 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74  )...(debug:print
43e0: 2d 69 6e 66 6f 20 38 20 22 68 61 76 65 2d 72 65  -info 8 "have-re
43f0: 73 6f 75 72 63 65 73 3a 20 22 20 68 61 76 65 2d  sources: " have-
4400: 72 65 73 6f 75 72 63 65 73 20 22 20 70 72 65 72  resources " prer
4410: 65 71 73 2d 6e 6f 74 2d 6d 65 74 3a 20 22 20 0a  eqs-not-met: " .
4420: 09 09 09 20 20 20 20 20 28 73 74 72 69 6e 67 2d  ...     (string-
4430: 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09 09 09  intersperse ....
4440: 20 20 20 20 20 20 28 6d 61 70 20 28 6c 61 6d 62        (map (lamb
4450: 64 61 20 28 74 29 0a 09 09 09 09 20 20 20 20 20  da (t).....     
4460: 28 69 66 20 28 76 65 63 74 6f 72 3f 20 74 29 0a  (if (vector? t).
4470: 09 09 09 09 09 20 28 63 6f 6e 63 20 28 64 62 3a  ..... (conc (db:
4480: 74 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74  test-get-state t
4490: 29 20 22 2f 22 20 28 64 62 3a 74 65 73 74 2d 67  ) "/" (db:test-g
44a0: 65 74 2d 73 74 61 74 75 73 20 74 29 29 0a 09 09  et-status t))...
44b0: 09 09 09 20 28 63 6f 6e 63 20 22 20 57 41 52 4e  ... (conc " WARN
44c0: 49 4e 47 3a 20 74 20 69 73 20 6e 6f 74 20 61 20  ING: t is not a 
44d0: 76 65 63 74 6f 72 3d 22 20 74 20 29 29 29 0a 09  vector=" t )))..
44e0: 09 09 09 20 20 20 70 72 65 72 65 71 73 2d 6e 6f  ...   prereqs-no
44f0: 74 2d 6d 65 74 29 20 22 2c 20 22 29 20 22 20 66  t-met) ", ") " f
4500: 61 69 6c 73 3a 20 22 20 66 61 69 6c 73 29 0a 09  ails: " fails)..
4510: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e  .(debug:print-in
4520: 66 6f 20 34 20 22 68 65 64 3d 22 20 68 65 64 20  fo 4 "hed=" hed 
4530: 22 5c 6e 20 20 74 65 73 74 2d 72 65 63 6f 72 64  "\n  test-record
4540: 3d 22 20 74 65 73 74 2d 72 65 63 6f 72 64 20 22  =" test-record "
4550: 5c 6e 20 20 74 65 73 74 2d 6e 61 6d 65 3a 20 22  \n  test-name: "
4560: 20 74 65 73 74 2d 6e 61 6d 65 20 22 5c 6e 20 20   test-name "\n  
4570: 69 74 65 6d 2d 70 61 74 68 3a 20 22 20 69 74 65  item-path: " ite
4580: 6d 2d 70 61 74 68 20 22 5c 6e 20 20 74 65 73 74  m-path "\n  test
4590: 2d 70 61 74 74 73 3a 20 22 20 74 65 73 74 2d 70  -patts: " test-p
45a0: 61 74 74 73 29 0a 0a 09 09 3b 3b 20 44 6f 6e 27  atts)....;; Don'
45b0: 74 20 6b 6e 6f 77 20 61 74 20 74 68 69 73 20 74  t know at this t
45c0: 69 6d 65 20 69 66 20 74 68 65 20 74 65 73 74 20  ime if the test 
45d0: 68 61 76 65 20 62 65 65 6e 20 6c 61 75 6e 63 68  have been launch
45e0: 65 64 20 61 74 20 73 6f 6d 65 20 74 69 6d 65 20  ed at some time 
45f0: 69 6e 20 74 68 65 20 70 61 73 74 0a 09 09 3b 3b  in the past...;;
4600: 20 69 2e 65 2e 20 69 73 20 74 68 69 73 20 61 20   i.e. is this a 
4610: 72 65 2d 6c 61 75 6e 63 68 3f 0a 09 09 28 64 65  re-launch?...(de
4620: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34  bug:print-info 4
4630: 20 22 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66   "run-limits-inf
4640: 6f 20 3d 20 22 20 72 75 6e 2d 6c 69 6d 69 74 73  o = " run-limits
4650: 2d 69 6e 66 6f 29 0a 09 09 28 63 6f 6e 64 20 3b  -info)...(cond ;
4660: 3b 20 49 4e 4e 45 52 20 43 4f 4e 44 20 23 31 20  ; INNER COND #1 
4670: 66 6f 72 20 61 20 6c 61 75 6e 63 68 61 62 6c 65  for a launchable
4680: 20 74 65 73 74 0a 09 09 20 3b 3b 20 43 68 65 63   test... ;; Chec
4690: 6b 20 69 74 65 6d 20 70 61 74 68 20 61 67 61 69  k item path agai
46a0: 6e 73 74 20 69 74 65 6d 2d 70 61 74 74 73 0a 09  nst item-patts..
46b0: 09 20 28 28 6e 6f 74 20 28 74 65 73 74 73 3a 6d  . ((not (tests:m
46c0: 61 74 63 68 20 74 65 73 74 2d 70 61 74 74 73 20  atch test-patts 
46d0: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65  (tests:testqueue
46e0: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65  -get-testname te
46f0: 73 74 2d 72 65 63 6f 72 64 29 20 69 74 65 6d 2d  st-record) item-
4700: 70 61 74 68 29 29 20 3b 3b 20 54 68 69 73 20 74  path)) ;; This t
4710: 65 73 74 2f 69 74 65 6d 70 61 74 68 20 69 73 20  est/itempath is 
4720: 6e 6f 74 20 74 6f 20 62 65 20 72 75 6e 0a 09 09  not to be run...
4730: 20 20 3b 3b 20 65 6c 73 65 20 74 68 65 20 72 75    ;; else the ru
4740: 6e 20 69 73 20 73 74 75 63 6b 2c 20 74 65 6d 70  n is stuck, temp
4750: 6f 72 61 72 69 6c 79 20 6f 72 20 70 65 72 6d 61  orarily or perma
4760: 6e 65 6e 74 6c 79 0a 09 09 20 20 3b 3b 20 62 75  nently...  ;; bu
4770: 74 20 73 68 6f 75 6c 64 20 63 68 65 63 6b 20 69  t should check i
4780: 66 20 69 74 20 69 73 20 64 75 65 20 74 6f 20 6c  f it is due to l
4790: 61 63 6b 20 6f 66 20 72 65 73 6f 75 72 63 65 73  ack of resources
47a0: 20 76 73 2e 20 70 72 65 72 65 71 75 69 73 69 74   vs. prerequisit
47b0: 65 73 0a 09 09 20 20 28 64 65 62 75 67 3a 70 72  es...  (debug:pr
47c0: 69 6e 74 2d 69 6e 66 6f 20 31 20 22 53 6b 69 70  int-info 1 "Skip
47d0: 70 69 6e 67 20 22 20 28 74 65 73 74 73 3a 74 65  ping " (tests:te
47e0: 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74  stqueue-get-test
47f0: 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64  name test-record
4800: 29 20 22 20 22 20 69 74 65 6d 2d 70 61 74 68 20  ) " " item-path 
4810: 22 20 61 73 20 69 74 20 64 6f 65 73 6e 27 74 20  " as it doesn't 
4820: 6d 61 74 63 68 20 22 20 74 65 73 74 2d 70 61 74  match " test-pat
4830: 74 73 29 0a 09 09 20 20 3b 3b 20 28 74 68 72 65  ts)...  ;; (thre
4840: 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61  ad-sleep! *globa
4850: 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 20 20 28 69  l-delta*)...  (i
4860: 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61  f (not (null? ta
4870: 6c 29 29 0a 09 09 20 20 20 20 20 20 28 6c 6f 6f  l))...      (loo
4880: 70 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20  p (car tal)(cdr 
4890: 74 61 6c 29 20 72 65 72 75 6e 73 29 29 29 0a 09  tal) reruns)))..
48a0: 09 20 3b 3b 20 52 65 67 69 73 74 65 72 79 20 68  . ;; Registery h
48b0: 61 73 20 62 65 65 6e 20 73 74 61 72 74 65 64 20  as been started 
48c0: 66 6f 72 20 74 68 69 73 20 74 65 73 74 20 62 75  for this test bu
48d0: 74 20 68 61 73 20 6e 6f 74 20 79 65 74 20 63 6f  t has not yet co
48e0: 6d 70 6c 65 74 65 64 0a 09 09 20 3b 3b 20 74 68  mpleted... ;; th
48f0: 69 73 20 73 68 6f 75 6c 64 20 62 65 20 72 61 72  is should be rar
4900: 65 2c 20 74 68 65 20 63 61 73 65 20 77 68 65 72  e, the case wher
4910: 65 20 74 68 65 72 65 20 61 72 65 20 6f 6e 6c 79  e there are only
4920: 20 61 20 63 6f 75 70 6c 65 20 6f 66 20 74 65 73   a couple of tes
4930: 74 73 20 61 6e 64 20 74 68 65 20 64 62 20 69 73  ts and the db is
4940: 20 73 6c 6f 77 0a 09 09 20 3b 3b 20 64 65 6c 61   slow... ;; dela
4950: 79 20 61 20 73 68 6f 72 74 20 77 68 69 6c 65 20  y a short while 
4960: 61 6e 64 20 63 6f 6e 74 69 6e 75 65 0a 09 09 20  and continue... 
4970: 3b 3b 20 28 28 65 71 3f 20 28 68 61 73 68 2d 74  ;; ((eq? (hash-t
4980: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74  able-ref/default
4990: 20 74 65 73 74 2d 72 65 67 69 73 74 65 72 79 20   test-registery 
49a0: 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d  (runs:make-full-
49b0: 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 6e  test-name test-n
49c0: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 20 23  ame item-path) #
49d0: 66 29 20 27 73 74 61 72 74 29 0a 09 09 20 3b 3b  f) 'start)... ;;
49e0: 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21    (thread-sleep!
49f0: 20 30 2e 30 31 29 0a 09 09 20 3b 3b 20 20 28 6c   0.01)... ;;  (l
4a00: 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61 6c 29  oop (car newtal)
4a10: 28 63 64 72 20 6e 65 77 74 61 6c 29 20 72 65 72  (cdr newtal) rer
4a20: 75 6e 73 29 29 0a 09 09 20 28 28 6e 6f 74 20 28  uns))... ((not (
4a30: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64  hash-table-ref/d
4a40: 65 66 61 75 6c 74 20 74 65 73 74 2d 72 65 67 69  efault test-regi
4a50: 73 74 65 72 79 20 28 72 75 6e 73 3a 6d 61 6b 65  stery (runs:make
4a60: 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 20  -full-test-name 
4a70: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70  test-name item-p
4a80: 61 74 68 29 20 23 66 29 29 0a 09 09 20 20 28 64  ath) #f))...  (d
4a90: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
4aa0: 34 20 22 50 72 65 2d 72 65 67 69 73 74 65 72 69  4 "Pre-registeri
4ab0: 6e 67 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e  ng test " test-n
4ac0: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74  ame "/" item-pat
4ad0: 68 20 22 20 74 6f 20 63 72 65 61 74 65 20 70 6c  h " to create pl
4ae0: 61 63 65 68 6f 6c 64 65 72 22 20 29 0a 09 09 20  aceholder" )... 
4af0: 20 3b 3b 20 4e 45 45 44 20 54 4f 20 54 48 52 45   ;; NEED TO THRE
4b00: 41 44 49 46 59 20 54 48 49 53 0a 09 09 20 20 28  ADIFY THIS...  (
4b10: 6c 65 74 20 28 28 74 68 20 28 6d 61 6b 65 2d 74  let ((th (make-t
4b20: 68 72 65 61 64 20 28 6c 61 6d 62 64 61 20 28 29  hread (lambda ()
4b30: 0a 09 09 20 20 20 20 20 20 20 20 09 09 20 20 20  ...        ..   
4b40: 28 6d 75 74 65 78 2d 6c 6f 63 6b 21 20 72 65 67  (mutex-lock! reg
4b50: 69 73 74 65 72 79 2d 6d 75 74 65 78 29 0a 09 09  istery-mutex)...
4b60: 20 20 20 20 20 20 20 20 09 09 20 20 20 28 68 61          ..   (ha
4b70: 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 65  sh-table-set! te
4b80: 73 74 2d 72 65 67 69 73 74 65 72 79 20 28 72 75  st-registery (ru
4b90: 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 73  ns:make-full-tes
4ba0: 74 2d 6e 61 6d 65 20 74 65 73 74 2d 6e 61 6d 65  t-name test-name
4bb0: 20 69 74 65 6d 2d 70 61 74 68 29 20 27 73 74 61   item-path) 'sta
4bc0: 72 74 29 0a 09 09 20 20 20 20 20 20 20 20 09 09  rt)...        ..
4bd0: 20 20 20 28 6d 75 74 65 78 2d 75 6e 6c 6f 63 6b     (mutex-unlock
4be0: 21 20 72 65 67 69 73 74 65 72 79 2d 6d 75 74 65  ! registery-mute
4bf0: 78 29 0a 09 09 09 09 09 20 20 20 3b 3b 20 49 66  x)......   ;; If
4c00: 20 68 61 76 65 6e 27 74 20 64 6f 6e 65 20 69 74   haven't done it
4c10: 20 62 65 66 6f 72 65 20 72 65 67 69 73 74 65 72   before register
4c20: 20 61 20 74 6f 70 20 6c 65 76 65 6c 20 74 65 73   a top level tes
4c30: 74 20 69 66 20 74 68 69 73 20 69 73 20 61 6e 20  t if this is an 
4c40: 69 74 65 6d 69 7a 65 64 20 74 65 73 74 0a 09 09  itemized test...
4c50: 09 09 09 20 20 20 28 69 66 20 28 6e 6f 74 20 28  ...   (if (not (
4c60: 65 71 3f 20 28 68 61 73 68 2d 74 61 62 6c 65 2d  eq? (hash-table-
4c70: 72 65 66 2f 64 65 66 61 75 6c 74 20 74 65 73 74  ref/default test
4c80: 2d 72 65 67 69 73 74 65 72 79 20 28 72 75 6e 73  -registery (runs
4c90: 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d  :make-full-test-
4ca0: 6e 61 6d 65 20 74 65 73 74 2d 6e 61 6d 65 20 22  name test-name "
4cb0: 22 29 20 23 66 29 20 27 64 6f 6e 65 29 29 0a 09  ") #f) 'done))..
4cc0: 09 09 09 09 20 20 20 20 20 20 20 28 63 64 62 3a  ....       (cdb:
4cd0: 74 65 73 74 73 2d 72 65 67 69 73 74 65 72 2d 74  tests-register-t
4ce0: 65 73 74 20 2a 72 75 6e 72 65 6d 6f 74 65 2a 20  est *runremote* 
4cf0: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65  run-id test-name
4d00: 20 22 22 29 29 0a 09 09 09 09 09 20 20 20 28 63   ""))......   (c
4d10: 64 62 3a 74 65 73 74 73 2d 72 65 67 69 73 74 65  db:tests-registe
4d20: 72 2d 74 65 73 74 20 2a 72 75 6e 72 65 6d 6f 74  r-test *runremot
4d30: 65 2a 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e  e* run-id test-n
4d40: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 09  ame item-path)..
4d50: 09 20 20 20 20 20 20 20 20 09 09 20 20 20 28 6d  .        ..   (m
4d60: 75 74 65 78 2d 6c 6f 63 6b 21 20 72 65 67 69 73  utex-lock! regis
4d70: 74 65 72 79 2d 6d 75 74 65 78 29 0a 09 09 09 09  tery-mutex).....
4d80: 09 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d  .   (hash-table-
4d90: 73 65 74 21 20 74 65 73 74 2d 72 65 67 69 73 74  set! test-regist
4da0: 65 72 79 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66  ery (runs:make-f
4db0: 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65  ull-test-name te
4dc0: 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74  st-name item-pat
4dd0: 68 29 20 27 64 6f 6e 65 29 0a 09 09 20 20 20 20  h) 'done)...    
4de0: 20 20 20 20 09 09 20 20 20 28 6d 75 74 65 78 2d      ..   (mutex-
4df0: 75 6e 6c 6f 63 6b 21 20 72 65 67 69 73 74 65 72  unlock! register
4e00: 79 2d 6d 75 74 65 78 29 29 0a 09 09 20 20 20 20  y-mutex))...    
4e10: 20 20 20 20 09 09 20 28 63 6f 6e 63 20 74 65 73      .. (conc tes
4e20: 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d  t-name "/" item-
4e30: 70 61 74 68 29 29 29 29 0a 09 09 20 20 20 20 28  path))))...    (
4e40: 74 68 72 65 61 64 2d 73 74 61 72 74 21 20 74 68  thread-start! th
4e50: 29 29 0a 09 09 20 20 28 74 68 72 65 61 64 2d 73  ))...  (thread-s
4e60: 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65  leep! *global-de
4e70: 6c 74 61 2a 29 0a 09 09 20 20 28 72 75 6e 73 3a  lta*)...  (runs:
4e80: 73 68 72 69 6e 6b 2d 63 61 6e 2d 72 75 6e 2d 6d  shrink-can-run-m
4e90: 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c 61 79 29  ore-tests-delay)
4ea0: 20 20 20 3b 3b 20 44 45 4c 41 59 20 54 57 45 41     ;; DELAY TWEA
4eb0: 4b 45 52 20 28 73 74 69 6c 6c 20 6e 65 65 64 65  KER (still neede
4ec0: 64 3f 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63  d?)...  (loop (c
4ed0: 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e  ar newtal)(cdr n
4ee0: 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29 29 0a  ewtal) reruns)).
4ef0: 09 09 20 3b 3b 20 41 74 20 74 68 69 73 20 70 6f  .. ;; At this po
4f00: 69 6e 74 20 2a 61 6c 6c 2a 20 74 65 73 74 20 72  int *all* test r
4f10: 65 67 69 73 74 72 61 74 69 6f 6e 73 20 6d 75 73  egistrations mus
4f20: 74 20 62 65 20 63 6f 6d 70 6c 65 74 65 64 2e 0a  t be completed..
4f30: 09 09 20 28 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20  .. ((not (null? 
4f40: 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20  (filter (lambda 
4f50: 28 78 29 28 6e 6f 74 20 28 65 71 3f 20 27 64 6f  (x)(not (eq? 'do
4f60: 6e 65 20 78 29 29 29 20 28 68 61 73 68 2d 74 61  ne x))) (hash-ta
4f70: 62 6c 65 2d 76 61 6c 75 65 73 20 74 65 73 74 2d  ble-values test-
4f80: 72 65 67 69 73 74 65 72 79 29 29 29 29 0a 09 09  registery))))...
4f90: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69    (debug:print-i
4fa0: 6e 66 6f 20 30 20 22 57 61 69 74 69 6e 67 20 6f  nfo 0 "Waiting o
4fb0: 6e 20 74 65 73 74 20 72 65 67 69 73 74 72 61 74  n test registrat
4fc0: 69 6f 6e 73 3a 20 22 20 28 73 74 72 69 6e 67 2d  ions: " (string-
4fd0: 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09 09 09  intersperse ....
4fe0: 09 09 09 09 09 09 20 28 66 69 6c 74 65 72 20 28  ...... (filter (
4ff0: 6c 61 6d 62 64 61 20 28 78 29 0a 09 09 09 09 09  lambda (x)......
5000: 09 09 09 09 09 20 20 20 28 6e 6f 74 20 28 65 71  .....   (not (eq
5010: 3f 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65  ? (hash-table-re
5020: 66 2f 64 65 66 61 75 6c 74 20 74 65 73 74 2d 72  f/default test-r
5030: 65 67 69 73 74 65 72 79 20 78 20 23 66 29 20 27  egistery x #f) '
5040: 64 6f 6e 65 29 29 29 0a 09 09 09 09 09 09 09 09  done))).........
5050: 09 09 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 6b  .. (hash-table-k
5060: 65 79 73 20 74 65 73 74 2d 72 65 67 69 73 74 65  eys test-registe
5070: 72 79 29 29 0a 09 09 09 09 09 09 09 09 09 20 22  ry)).......... "
5080: 2c 20 22 29 29 0a 09 09 20 20 28 74 68 72 65 61  , "))...  (threa
5090: 64 2d 73 6c 65 65 70 21 20 30 2e 31 29 0a 09 09  d-sleep! 0.1)...
50a0: 20 20 28 6c 6f 6f 70 20 68 65 64 20 74 61 6c 20    (loop hed tal 
50b0: 72 65 72 75 6e 73 29 29 0a 09 09 20 28 28 6e 6f  reruns))... ((no
50c0: 74 20 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73  t have-resources
50d0: 29 20 3b 3b 20 73 69 6d 70 6c 79 20 74 72 79 20  ) ;; simply try 
50e0: 61 67 61 69 6e 20 61 66 74 65 72 20 77 61 69 74  again after wait
50f0: 69 6e 67 20 61 20 73 65 63 6f 6e 64 0a 09 09 20  ing a second... 
5100: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
5110: 66 6f 20 31 20 22 6e 6f 20 72 65 73 6f 75 72 63  fo 1 "no resourc
5120: 65 73 20 74 6f 20 72 75 6e 20 6e 65 77 20 74 65  es to run new te
5130: 73 74 73 2c 20 77 61 69 74 69 6e 67 20 2e 2e 2e  sts, waiting ...
5140: 22 29 0a 09 09 20 20 3b 3b 20 28 74 68 72 65 61  ")...  ;; (threa
5150: 64 2d 73 6c 65 65 70 21 20 28 2b 20 32 20 2a 67  d-sleep! (+ 2 *g
5160: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09  lobal-delta*))..
5170: 09 20 20 3b 3b 20 63 6f 75 6c 64 20 68 61 76 65  .  ;; could have
5180: 20 64 6f 6e 65 20 68 65 64 20 74 61 6c 20 68 65   done hed tal he
5190: 72 65 20 62 75 74 20 64 6f 69 6e 67 20 63 61 72  re but doing car
51a0: 2f 63 64 72 20 6f 66 20 6e 65 77 74 61 6c 20 74  /cdr of newtal t
51b0: 6f 20 72 6f 74 61 74 65 20 74 65 73 74 73 0a 09  o rotate tests..
51c0: 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65  .  (loop (car ne
51d0: 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c  wtal)(cdr newtal
51e0: 29 20 72 65 72 75 6e 73 29 29 0a 09 09 20 28 28  ) reruns))... ((
51f0: 61 6e 64 20 68 61 76 65 2d 72 65 73 6f 75 72 63  and have-resourc
5200: 65 73 0a 09 09 20 20 20 20 20 20 20 28 6f 72 20  es...       (or 
5210: 28 6e 75 6c 6c 3f 20 70 72 65 72 65 71 73 2d 6e  (null? prereqs-n
5220: 6f 74 2d 6d 65 74 29 0a 09 09 09 20 20 20 28 61  ot-met)....   (a
5230: 6e 64 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 65  nd (eq? testmode
5240: 20 27 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09   'toplevel).....
5250: 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c  (null? non-compl
5260: 65 74 65 64 29 29 29 29 0a 09 09 20 20 28 72 75  eted))))...  (ru
5270: 6e 3a 74 65 73 74 20 72 75 6e 2d 69 64 20 72 75  n:test run-id ru
5280: 6e 6e 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20  nname keyvallst 
5290: 74 65 73 74 2d 72 65 63 6f 72 64 20 66 6c 61 67  test-record flag
52a0: 73 20 23 66 29 0a 09 09 20 20 28 72 75 6e 73 3a  s #f)...  (runs:
52b0: 73 68 72 69 6e 6b 2d 63 61 6e 2d 72 75 6e 2d 6d  shrink-can-run-m
52c0: 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c 61 79 29  ore-tests-delay)
52d0: 20 20 3b 3b 20 44 45 4c 41 59 20 54 57 45 41 4b    ;; DELAY TWEAK
52e0: 45 52 20 28 73 74 69 6c 6c 20 6e 65 65 64 65 64  ER (still needed
52f0: 3f 29 0a 09 09 20 20 3b 3b 20 28 74 68 72 65 61  ?)...  ;; (threa
5300: 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c  d-sleep! *global
5310: 2d 64 65 6c 74 61 2a 29 0a 09 09 20 20 28 69 66  -delta*)...  (if
5320: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c   (not (null? tal
5330: 29 29 0a 09 09 20 20 20 20 20 20 28 6c 6f 6f 70  ))...      (loop
5340: 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74   (car tal)(cdr t
5350: 61 6c 29 20 72 65 72 75 6e 73 29 29 29 0a 09 09  al) reruns)))...
5360: 20 28 65 6c 73 65 20 3b 3b 20 6d 75 73 74 20 62   (else ;; must b
5370: 65 20 77 65 20 68 61 76 65 20 75 6e 6d 65 74 20  e we have unmet 
5380: 70 72 65 72 65 71 75 69 73 69 74 65 73 0a 09 09  prerequisites...
5390: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
53a0: 20 34 20 22 46 41 49 4c 53 3a 20 22 20 66 61 69   4 "FAILS: " fai
53b0: 6c 73 29 0a 09 09 20 20 20 20 3b 3b 20 49 66 20  ls)...    ;; If 
53c0: 6f 6e 65 20 6f 72 20 6d 6f 72 65 20 6f 66 20 74  one or more of t
53d0: 68 65 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d  he prereqs-not-m
53e0: 65 74 20 61 72 65 20 46 41 49 4c 20 74 68 65 6e  et are FAIL then
53f0: 20 77 65 20 63 61 6e 20 69 73 73 75 65 0a 09 09   we can issue...
5400: 20 20 20 20 3b 3b 20 61 20 6d 65 73 73 61 67 65      ;; a message
5410: 20 61 6e 64 20 64 72 6f 70 20 68 65 64 20 66 72   and drop hed fr
5420: 6f 6d 20 74 68 65 20 69 74 65 6d 73 20 74 6f 20  om the items to 
5430: 62 65 20 70 72 6f 63 65 73 73 65 64 2e 0a 09 09  be processed....
5440: 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 66      (if (null? f
5450: 61 69 6c 73 29 0a 09 09 09 28 62 65 67 69 6e 0a  ails)....(begin.
5460: 09 09 09 20 20 3b 3b 20 63 6f 75 6c 64 6e 27 74  ...  ;; couldn't
5470: 20 72 75 6e 2c 20 74 61 6b 65 20 61 20 62 72 65   run, take a bre
5480: 61 74 68 65 72 0a 09 09 09 20 20 28 64 65 62 75  ather....  (debu
5490: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22  g:print-info 4 "
54a0: 53 68 6f 75 6c 64 6e 27 74 20 72 65 61 6c 6c 79  Shouldn't really
54b0: 20 67 65 74 20 68 65 72 65 2c 20 72 61 63 65 20   get here, race 
54c0: 63 6f 6e 64 69 74 69 6f 6e 3f 20 55 6e 61 62 6c  condition? Unabl
54d0: 65 20 74 6f 20 6c 61 75 6e 63 68 20 6d 6f 72 65  e to launch more
54e0: 20 74 65 73 74 73 20 61 74 20 74 68 69 73 20 6d   tests at this m
54f0: 6f 6d 65 6e 74 2c 20 6b 69 6c 6c 69 6e 67 20 74  oment, killing t
5500: 69 6d 65 20 2e 2e 2e 22 29 0a 09 09 09 20 20 3b  ime ...")....  ;
5510: 3b 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21  ; (thread-sleep!
5520: 20 28 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c   (+ 0.01 *global
5530: 2d 64 65 6c 74 61 2a 29 29 20 3b 3b 20 6c 6f 6e  -delta*)) ;; lon
5540: 67 20 73 6c 65 65 70 20 68 65 72 65 20 2d 20 6e  g sleep here - n
5550: 6f 20 72 65 73 6f 75 72 63 65 73 2c 20 6d 61 79  o resources, may
5560: 20 61 73 20 77 65 6c 6c 20 62 65 20 70 61 74 69   as well be pati
5570: 65 6e 74 0a 09 09 09 20 20 3b 3b 20 77 65 20 6d  ent....  ;; we m
5580: 61 64 65 20 6e 65 77 20 74 61 6c 20 62 79 20 73  ade new tal by s
5590: 74 69 63 6b 69 6e 67 20 68 65 64 20 61 74 20 74  ticking hed at t
55a0: 68 65 20 62 61 63 6b 20 6f 66 20 74 68 65 20 6c  he back of the l
55b0: 69 73 74 0a 09 09 09 20 20 28 6c 6f 6f 70 20 28  ist....  (loop (
55c0: 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20  car newtal)(cdr 
55d0: 6e 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29 29  newtal) reruns))
55e0: 0a 09 09 09 3b 3b 20 74 68 65 20 77 61 69 74 6f  ....;; the waito
55f0: 6e 20 69 73 20 46 41 49 4c 20 73 6f 20 6e 6f 20  n is FAIL so no 
5600: 70 6f 69 6e 74 20 69 6e 20 74 72 79 69 6e 67 20  point in trying 
5610: 74 6f 20 72 75 6e 20 68 65 64 20 65 76 65 72 20  to run hed ever 
5620: 61 67 61 69 6e 0a 09 09 09 28 69 66 20 28 6e 6f  again....(if (no
5630: 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09  t (null? tal))..
5640: 09 09 20 20 20 20 28 69 66 20 28 76 65 63 74 6f  ..    (if (vecto
5650: 72 3f 20 68 65 64 29 0a 09 09 09 09 28 62 65 67  r? hed).....(beg
5660: 69 6e 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  in (debug:print 
5670: 31 20 22 57 41 52 4e 3a 20 44 72 6f 70 70 69 6e  1 "WARN: Droppin
5680: 67 20 74 65 73 74 20 22 20 28 64 62 3a 74 65 73  g test " (db:tes
5690: 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 68  t-get-testname h
56a0: 65 64 29 20 22 2f 22 20 28 64 62 3a 74 65 73 74  ed) "/" (db:test
56b0: 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 68  -get-item-path h
56c0: 65 64 29 0a 09 09 09 09 09 09 20 20 20 20 22 20  ed).......    " 
56d0: 66 72 6f 6d 20 74 68 65 20 6c 61 75 6e 63 68 20  from the launch 
56e0: 6c 69 73 74 20 61 73 20 69 74 20 68 61 73 20 70  list as it has p
56f0: 72 65 72 65 71 75 69 73 74 65 73 20 74 68 61 74  rerequistes that
5700: 20 61 72 65 20 46 41 49 4c 22 29 0a 28 72 75 6e   are FAIL").(run
5710: 73 3a 73 68 72 69 6e 6b 2d 63 61 6e 2d 72 75 6e  s:shrink-can-run
5720: 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c 61  -more-tests-dela
5730: 79 29 0a 09 09 09 09 20 20 20 20 20 20 20 3b 3b  y).....       ;;
5740: 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20   (thread-sleep! 
5750: 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a  *global-delta*).
5760: 09 09 09 09 20 20 20 20 20 20 20 28 6c 6f 6f 70  ....       (loop
5770: 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74   (car tal)(cdr t
5780: 61 6c 29 20 28 63 6f 6e 73 20 68 65 64 20 72 65  al) (cons hed re
5790: 72 75 6e 73 29 29 29 0a 09 09 09 09 28 62 65 67  runs))).....(beg
57a0: 69 6e 0a 09 09 09 09 20 20 28 64 65 62 75 67 3a  in.....  (debug:
57b0: 70 72 69 6e 74 20 31 20 22 57 41 52 4e 3a 20 54  print 1 "WARN: T
57c0: 65 73 74 20 6e 6f 74 20 70 72 6f 63 65 73 73 65  est not processe
57d0: 64 20 63 6f 72 72 65 63 74 6c 79 2e 20 43 6f 75  d correctly. Cou
57e0: 6c 64 20 62 65 20 61 20 72 61 63 65 20 63 6f 6e  ld be a race con
57f0: 64 69 74 69 6f 6e 20 69 6e 20 79 6f 75 72 20 74  dition in your t
5800: 65 73 74 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69  est implementati
5810: 6f 6e 3f 20 22 20 68 65 64 29 20 3b 3b 20 20 22  on? " hed) ;;  "
5820: 20 61 73 20 69 74 20 68 61 73 20 70 72 65 72 65   as it has prere
5830: 71 75 69 73 74 65 73 20 74 68 61 74 20 61 72 65  quistes that are
5840: 20 46 41 49 4c 2e 20 28 4e 4f 54 45 3a 20 68 65   FAIL. (NOTE: he
5850: 64 20 69 73 20 6e 6f 74 20 61 20 76 65 63 74 6f  d is not a vecto
5860: 72 29 22 29 0a 28 72 75 6e 73 3a 73 68 72 69 6e  r)").(runs:shrin
5870: 6b 2d 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74  k-can-run-more-t
5880: 65 73 74 73 2d 64 65 6c 61 79 29 0a 09 09 09 09  ests-delay).....
5890: 20 20 3b 3b 20 28 74 68 72 65 61 64 2d 73 6c 65    ;; (thread-sle
58a0: 65 70 21 20 28 2b 20 30 2e 30 31 20 2a 67 6c 6f  ep! (+ 0.01 *glo
58b0: 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09 09  bal-delta*))....
58c0: 09 20 20 28 6c 6f 6f 70 20 68 65 64 20 74 61 6c  .  (loop hed tal
58d0: 20 72 65 72 75 6e 73 29 29 29 29 29 29 29 29 29   reruns)))))))))
58e0: 20 3b 3b 20 45 4e 44 20 4f 46 20 49 4e 4e 45 52   ;; END OF INNER
58f0: 20 43 4f 4e 44 0a 09 20 20 20 20 20 0a 09 20 20   COND..     ..  
5900: 20 20 20 3b 3b 20 63 61 73 65 20 77 68 65 72 65     ;; case where
5910: 20 61 6e 20 69 74 65 6d 73 20 63 61 6d 65 20 69   an items came i
5920: 6e 20 61 73 20 61 20 6c 69 73 74 20 62 65 65 6e  n as a list been
5930: 20 70 72 6f 63 65 73 73 65 64 0a 09 20 20 20 20   processed..    
5940: 20 28 28 61 6e 64 20 28 6c 69 73 74 3f 20 69 74   ((and (list? it
5950: 65 6d 73 29 20 20 20 20 20 3b 3b 20 74 68 75 73  ems)     ;; thus
5960: 20 77 65 20 6b 6e 6f 77 20 6f 75 72 20 69 74 65   we know our ite
5970: 6d 73 20 61 72 65 20 61 6c 72 65 61 64 79 20 63  ms are already c
5980: 61 6c 63 75 6c 61 74 65 64 0a 09 09 20 20 20 28  alculated...   (
5990: 6e 6f 74 20 20 20 69 74 65 6d 64 61 74 29 29 20  not   itemdat)) 
59a0: 3b 3b 20 61 6e 64 20 6e 6f 74 20 79 65 74 20 65  ;; and not yet e
59b0: 78 70 61 6e 64 65 64 20 69 6e 74 6f 20 74 68 65  xpanded into the
59c0: 20 6c 69 73 74 20 6f 66 20 74 68 69 6e 67 73 20   list of things 
59d0: 74 6f 20 62 65 20 64 6f 6e 65 0a 09 20 20 20 20  to be done..    
59e0: 20 20 28 69 66 20 28 61 6e 64 20 28 64 65 62 75    (if (and (debu
59f0: 67 3a 64 65 62 75 67 2d 6d 6f 64 65 20 31 29 20  g:debug-mode 1) 
5a00: 3b 3b 20 28 3e 3d 20 2a 76 65 72 62 6f 73 69 74  ;; (>= *verbosit
5a10: 79 2a 20 31 29 0a 09 09 20 20 20 20 20 20 20 28  y* 1)...       (
5a20: 3e 20 28 6c 65 6e 67 74 68 20 69 74 65 6d 73 29  > (length items)
5a30: 20 30 29 0a 09 09 20 20 20 20 20 20 20 28 3e 20   0)...       (> 
5a40: 28 6c 65 6e 67 74 68 20 28 63 61 72 20 69 74 65  (length (car ite
5a50: 6d 73 29 29 20 30 29 29 0a 09 09 20 20 28 70 70  ms)) 0))...  (pp
5a60: 20 69 74 65 6d 73 29 29 0a 09 20 20 20 20 20 20   items))..      
5a70: 28 66 6f 72 2d 65 61 63 68 0a 09 20 20 20 20 20  (for-each..     
5a80: 20 20 28 6c 61 6d 62 64 61 20 28 6d 79 2d 69 74    (lambda (my-it
5a90: 65 6d 64 61 74 29 0a 09 09 20 28 6c 65 74 2a 20  emdat)... (let* 
5aa0: 28 28 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72  ((new-test-recor
5ab0: 64 20 28 6c 65 74 20 28 28 6e 65 77 72 65 63 20  d (let ((newrec 
5ac0: 28 6d 61 6b 65 2d 74 65 73 74 73 3a 74 65 73 74  (make-tests:test
5ad0: 71 75 65 75 65 29 29 29 0a 09 09 09 09 09 20 20  queue)))......  
5ae0: 20 28 76 65 63 74 6f 72 2d 63 6f 70 79 21 20 74   (vector-copy! t
5af0: 65 73 74 2d 72 65 63 6f 72 64 20 6e 65 77 72 65  est-record newre
5b00: 63 29 0a 09 09 09 09 09 20 20 20 6e 65 77 72 65  c)......   newre
5b10: 63 29 29 0a 09 09 09 28 6d 79 2d 69 74 65 6d 2d  c))....(my-item-
5b20: 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d  path (item-list-
5b30: 3e 70 61 74 68 20 6d 79 2d 69 74 65 6d 64 61 74  >path my-itemdat
5b40: 29 29 29 0a 09 09 20 20 20 28 69 66 20 28 74 65  )))...   (if (te
5b50: 73 74 73 3a 6d 61 74 63 68 20 74 65 73 74 2d 70  sts:match test-p
5b60: 61 74 74 73 20 68 65 64 20 6d 79 2d 69 74 65 6d  atts hed my-item
5b70: 2d 70 61 74 68 29 20 3b 3b 20 28 70 61 74 74 2d  -path) ;; (patt-
5b80: 6c 69 73 74 2d 6d 61 74 63 68 20 6d 79 2d 69 74  list-match my-it
5b90: 65 6d 2d 70 61 74 68 20 69 74 65 6d 2d 70 61 74  em-path item-pat
5ba0: 74 73 29 20 20 20 20 20 20 20 20 20 20 20 3b 3b  ts)           ;;
5bb0: 20 79 65 73 2c 20 77 65 20 77 61 6e 74 20 74 6f   yes, we want to
5bc0: 20 70 72 6f 63 65 73 73 20 74 68 69 73 20 69 74   process this it
5bd0: 65 6d 2c 20 4e 4f 54 45 3a 20 53 68 6f 75 6c 64  em, NOTE: Should
5be0: 20 6e 6f 74 20 6e 65 65 64 20 74 68 69 73 20 63   not need this c
5bf0: 68 65 63 6b 20 68 65 72 65 21 0a 09 09 20 20 20  heck here!...   
5c00: 20 20 20 20 28 6c 65 74 20 28 28 6e 65 77 74 65      (let ((newte
5c10: 73 74 6e 61 6d 65 20 28 72 75 6e 73 3a 6d 61 6b  stname (runs:mak
5c20: 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65  e-full-test-name
5c30: 20 68 65 64 20 6d 79 2d 69 74 65 6d 2d 70 61 74   hed my-item-pat
5c40: 68 29 29 29 20 20 20 20 3b 3b 20 74 65 73 74 20  h)))    ;; test 
5c50: 6e 61 6d 65 73 20 61 72 65 20 75 6e 69 71 75 65  names are unique
5c60: 20 6f 6e 20 74 65 73 74 6e 61 6d 65 2f 69 74 65   on testname/ite
5c70: 6d 2d 70 61 74 68 0a 09 09 09 20 28 74 65 73 74  m-path.... (test
5c80: 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d  s:testqueue-set-
5c90: 69 74 65 6d 73 21 20 20 20 20 20 6e 65 77 2d 74  items!     new-t
5ca0: 65 73 74 2d 72 65 63 6f 72 64 20 23 66 29 0a 09  est-record #f)..
5cb0: 09 09 20 28 74 65 73 74 73 3a 74 65 73 74 71 75  .. (tests:testqu
5cc0: 65 75 65 2d 73 65 74 2d 69 74 65 6d 64 61 74 21  eue-set-itemdat!
5cd0: 20 20 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f     new-test-reco
5ce0: 72 64 20 6d 79 2d 69 74 65 6d 64 61 74 29 0a 09  rd my-itemdat)..
5cf0: 09 09 20 28 74 65 73 74 73 3a 74 65 73 74 71 75  .. (tests:testqu
5d00: 65 75 65 2d 73 65 74 2d 69 74 65 6d 5f 70 61 74  eue-set-item_pat
5d10: 68 21 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f  h! new-test-reco
5d20: 72 64 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68 29  rd my-item-path)
5d30: 0a 09 09 09 20 28 68 61 73 68 2d 74 61 62 6c 65  .... (hash-table
5d40: 2d 73 65 74 21 20 74 65 73 74 2d 72 65 63 6f 72  -set! test-recor
5d50: 64 73 20 6e 65 77 74 65 73 74 6e 61 6d 65 20 6e  ds newtestname n
5d60: 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 29 0a  ew-test-record).
5d70: 09 09 09 20 28 73 65 74 21 20 74 61 6c 20 28 63  ... (set! tal (c
5d80: 6f 6e 73 20 6e 65 77 74 65 73 74 6e 61 6d 65 20  ons newtestname 
5d90: 74 61 6c 29 29 29 29 29 29 20 3b 3b 20 73 69 6e  tal)))))) ;; sin
5da0: 63 65 20 74 68 65 73 65 20 61 72 65 20 69 74 65  ce these are ite
5db0: 6d 69 7a 65 64 20 63 72 65 61 74 65 20 6e 65 77  mized create new
5dc0: 20 74 65 73 74 20 6e 61 6d 65 73 20 74 65 73 74   test names test
5dd0: 6e 61 6d 65 2f 69 74 65 6d 70 61 74 68 0a 09 20  name/itempath.. 
5de0: 20 20 20 20 20 20 69 74 65 6d 73 29 0a 09 20 20        items)..  
5df0: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75      (if (not (nu
5e00: 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 20 20 28 62  ll? tal))...  (b
5e10: 65 67 69 6e 0a 09 09 20 20 20 20 28 64 65 62 75  egin...    (debu
5e20: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22  g:print-info 4 "
5e30: 45 6e 64 20 6f 66 20 69 74 65 6d 73 20 6c 69 73  End of items lis
5e40: 74 2c 20 6c 6f 6f 70 69 6e 67 20 77 69 74 68 20  t, looping with 
5e50: 6e 65 78 74 20 61 66 74 65 72 20 73 68 6f 72 74  next after short
5e60: 20 64 65 6c 61 79 22 29 0a 20 20 20 20 20 20 20   delay").       
5e70: 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20               ;; 
5e80: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28  (thread-sleep! (
5e90: 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d 64  + 0.01 *global-d
5ea0: 65 6c 74 61 2a 29 29 0a 09 09 20 20 20 20 28 6c  elta*))...    (l
5eb0: 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63 64  oop (car tal)(cd
5ec0: 72 20 74 61 6c 29 20 72 65 72 75 6e 73 29 29 29  r tal) reruns)))
5ed0: 29 0a 0a 09 20 20 20 20 20 3b 3b 20 69 66 20 69  )...     ;; if i
5ee0: 74 65 6d 73 20 69 73 20 61 20 70 72 6f 63 20 74  tems is a proc t
5ef0: 68 65 6e 20 6e 65 65 64 20 74 6f 20 72 75 6e 20  hen need to run 
5f00: 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d  items:get-items-
5f10: 66 72 6f 6d 2d 63 6f 6e 66 69 67 2c 20 67 65 74  from-config, get
5f20: 20 74 68 65 20 6c 69 73 74 20 61 6e 64 20 6c 6f   the list and lo
5f30: 6f 70 20 0a 09 20 20 20 20 20 3b 3b 20 20 20 20  op ..     ;;    
5f40: 2d 20 62 75 74 20 6f 6e 6c 79 20 64 6f 20 74 68  - but only do th
5f50: 61 74 20 69 66 20 72 65 73 6f 75 72 63 65 73 20  at if resources 
5f60: 65 78 69 73 74 20 74 6f 20 6b 69 63 6b 20 6f 66  exist to kick of
5f70: 66 20 74 68 65 20 6a 6f 62 0a 09 20 20 20 20 20  f the job..     
5f80: 28 28 6f 72 20 28 70 72 6f 63 65 64 75 72 65 3f  ((or (procedure?
5f90: 20 69 74 65 6d 73 29 28 65 71 3f 20 69 74 65 6d   items)(eq? item
5fa0: 73 20 27 68 61 76 65 2d 70 72 6f 63 65 64 75 72  s 'have-procedur
5fb0: 65 29 29 0a 09 20 20 20 20 20 20 28 6c 65 74 20  e))..      (let 
5fc0: 28 28 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 20 20  ((can-run-more  
5fd0: 20 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d    (runs:can-run-
5fe0: 6d 6f 72 65 2d 74 65 73 74 73 20 74 65 73 74 2d  more-tests test-
5ff0: 72 65 63 6f 72 64 29 29 29 0a 09 09 28 69 66 20  record)))...(if 
6000: 28 61 6e 64 20 28 6c 69 73 74 3f 20 63 61 6e 2d  (and (list? can-
6010: 72 75 6e 2d 6d 6f 72 65 29 0a 09 09 09 20 28 63  run-more).... (c
6020: 61 72 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 29  ar can-run-more)
6030: 29 0a 09 09 20 20 20 20 28 6c 65 74 2a 20 28 28  )...    (let* ((
6040: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20  prereqs-not-met 
6050: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
6060: 64 62 3a 67 65 74 2d 70 72 65 72 65 71 73 2d 6e  db:get-prereqs-n
6070: 6f 74 2d 6d 65 74 20 23 66 20 72 75 6e 2d 69 64  ot-met #f run-id
6080: 20 77 61 69 74 6f 6e 73 20 69 74 65 6d 2d 70 61   waitons item-pa
6090: 74 68 20 6d 6f 64 65 3a 20 74 65 73 74 6d 6f 64  th mode: testmod
60a0: 65 29 29 0a 09 09 09 20 20 20 28 66 61 69 6c 73  e))....   (fails
60b0: 20 20 20 20 20 20 20 20 20 20 20 28 72 75 6e 73             (runs
60c0: 3a 63 61 6c 63 2d 66 61 69 6c 73 20 70 72 65 72  :calc-fails prer
60d0: 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 09 09  eqs-not-met))...
60e0: 09 20 20 20 28 6e 6f 6e 2d 63 6f 6d 70 6c 65 74  .   (non-complet
60f0: 65 64 20 20 20 28 72 75 6e 73 3a 63 61 6c 63 2d  ed   (runs:calc-
6100: 6e 6f 74 2d 63 6f 6d 70 6c 65 74 65 64 20 70 72  not-completed pr
6110: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 29  ereqs-not-met)))
6120: 0a 09 09 20 20 20 20 20 20 28 64 65 62 75 67 3a  ...      (debug:
6130: 70 72 69 6e 74 2d 69 6e 66 6f 20 38 20 22 63 61  print-info 8 "ca
6140: 6e 2d 72 75 6e 2d 6d 6f 72 65 3a 20 22 20 63 61  n-run-more: " ca
6150: 6e 2d 72 75 6e 2d 6d 6f 72 65 0a 09 09 09 09 20  n-run-more..... 
6160: 20 20 22 5c 6e 20 74 65 73 74 6e 61 6d 65 3a 20    "\n testname: 
6170: 20 20 20 20 20 20 20 22 20 68 65 64 0a 09 09 09         " hed....
6180: 09 20 20 20 22 5c 6e 20 70 72 65 72 65 71 73 2d  .   "\n prereqs-
6190: 6e 6f 74 2d 6d 65 74 3a 20 22 20 28 72 75 6e 73  not-met: " (runs
61a0: 3a 70 72 65 74 74 79 2d 73 74 72 69 6e 67 20 70  :pretty-string p
61b0: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a  rereqs-not-met).
61c0: 09 09 09 09 20 20 20 22 5c 6e 20 6e 6f 6e 2d 63  ....   "\n non-c
61d0: 6f 6d 70 6c 65 74 65 64 3a 20 20 20 22 20 28 72  ompleted:   " (r
61e0: 75 6e 73 3a 70 72 65 74 74 79 2d 73 74 72 69 6e  uns:pretty-strin
61f0: 67 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29  g non-completed)
6200: 20 0a 09 09 09 09 20 20 20 22 5c 6e 20 66 61 69   .....   "\n fai
6210: 6c 73 3a 20 20 20 20 20 20 20 20 20 20 20 22 20  ls:           " 
6220: 28 72 75 6e 73 3a 70 72 65 74 74 79 2d 73 74 72  (runs:pretty-str
6230: 69 6e 67 20 66 61 69 6c 73 29 0a 09 09 09 09 20  ing fails)..... 
6240: 20 20 22 5c 6e 20 74 65 73 74 6d 6f 64 65 3a 20    "\n testmode: 
6250: 20 20 20 20 20 20 20 22 20 74 65 73 74 6d 6f 64         " testmod
6260: 65 0a 09 09 09 09 20 20 20 22 5c 6e 20 6e 75 6d  e.....   "\n num
6270: 2d 72 65 74 72 69 65 73 3a 20 20 20 20 20 22 20  -retries:     " 
6280: 6e 75 6d 2d 72 65 74 72 69 65 73 0a 09 09 09 09  num-retries.....
6290: 20 20 20 22 5c 6e 20 28 65 71 3f 20 74 65 73 74     "\n (eq? test
62a0: 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c 29 3a  mode 'toplevel):
62b0: 20 22 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 65   " (eq? testmode
62c0: 20 27 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09   'toplevel).....
62d0: 20 20 20 22 5c 6e 20 28 6e 75 6c 6c 3f 20 6e 6f     "\n (null? no
62e0: 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 3a 20 20 20  n-completed):   
62f0: 20 22 20 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f   " (null? non-co
6300: 6d 70 6c 65 74 65 64 29 0a 09 09 09 09 20 20 20  mpleted).....   
6310: 22 5c 6e 20 72 65 72 75 6e 73 3a 20 20 20 20 20  "\n reruns:     
6320: 20 20 20 20 20 22 20 72 65 72 75 6e 73 0a 09 09       " reruns...
6330: 09 09 20 20 20 22 5c 6e 20 69 74 65 6d 73 3a 20  ..   "\n items: 
6340: 20 20 20 20 20 20 20 20 20 20 22 20 69 74 65 6d            " item
6350: 73 0a 09 09 09 09 20 20 20 22 5c 6e 20 63 61 6e  s.....   "\n can
6360: 2d 72 75 6e 2d 6d 6f 72 65 3a 20 20 20 20 22 20  -run-more:    " 
6370: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 29 0a 09 09  can-run-more)...
6380: 20 20 20 20 20 20 3b 3b 20 28 74 68 72 65 61 64        ;; (thread
6390: 2d 73 6c 65 65 70 21 20 28 2b 20 30 2e 30 31 20  -sleep! (+ 0.01 
63a0: 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29  *global-delta*))
63b0: 0a 09 09 20 20 20 20 20 20 28 63 6f 6e 64 20 3b  ...      (cond ;
63c0: 3b 20 49 4e 4e 45 52 20 43 4f 4e 44 20 23 32 0a  ; INNER COND #2.
63d0: 09 09 20 20 20 20 20 20 20 28 28 6f 72 20 28 6e  ..       ((or (n
63e0: 75 6c 6c 3f 20 70 72 65 72 65 71 73 2d 6e 6f 74  ull? prereqs-not
63f0: 2d 6d 65 74 29 20 3b 3b 20 61 6c 6c 20 70 72 65  -met) ;; all pre
6400: 72 65 71 73 20 6d 65 74 2c 20 66 69 72 65 20 6f  reqs met, fire o
6410: 66 66 20 74 68 65 20 74 65 73 74 0a 09 09 09 20  ff the test.... 
6420: 20 20 20 3b 3b 20 6f 72 2c 20 69 66 20 69 74 20     ;; or, if it 
6430: 69 73 20 61 20 27 74 6f 70 6c 65 76 65 6c 20 74  is a 'toplevel t
6440: 65 73 74 20 61 6e 64 20 61 6c 6c 20 70 72 65 72  est and all prer
6450: 65 71 73 20 6e 6f 74 20 6d 65 74 20 61 72 65 20  eqs not met are 
6460: 43 4f 4d 50 4c 45 54 45 44 20 74 68 65 6e 20 6c  COMPLETED then l
6470: 61 75 6e 63 68 0a 09 09 09 20 20 20 20 28 61 6e  aunch....    (an
6480: 64 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20  d (eq? testmode 
6490: 27 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09 20  'toplevel)..... 
64a0: 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c  (null? non-compl
64b0: 65 74 65 64 29 29 29 0a 09 09 09 28 6c 65 74 20  eted)))....(let 
64c0: 28 28 74 65 73 74 2d 6e 61 6d 65 20 28 74 65 73  ((test-name (tes
64d0: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
64e0: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72  -testname test-r
64f0: 65 63 6f 72 64 29 29 29 0a 09 09 09 20 20 28 73  ecord)))....  (s
6500: 65 74 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e  etenv "MT_TEST_N
6510: 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 20  AME" test-name) 
6520: 3b 3b 20 0a 09 09 09 20 20 28 73 65 74 65 6e 76  ;; ....  (setenv
6530: 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20   "MT_RUNNAME"   
6540: 72 75 6e 6e 61 6d 65 29 0a 09 09 09 20 20 28 73  runname)....  (s
6550: 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d  et-megatest-env-
6560: 76 61 72 73 20 72 75 6e 2d 69 64 29 20 3b 3b 20  vars run-id) ;; 
6570: 74 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65  these may be nee
6580: 64 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63  ded by the launc
6590: 68 69 6e 67 20 70 72 6f 63 65 73 73 0a 09 09 09  hing process....
65a0: 20 20 28 6c 65 74 20 28 28 69 74 65 6d 73 2d 6c    (let ((items-l
65b0: 69 73 74 20 28 69 74 65 6d 73 3a 67 65 74 2d 69  ist (items:get-i
65c0: 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67  tems-from-config
65d0: 20 74 63 6f 6e 66 69 67 29 29 29 0a 09 09 09 20   tconfig))).... 
65e0: 20 20 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74     (if (list? it
65f0: 65 6d 73 2d 6c 69 73 74 29 0a 09 09 09 09 28 62  ems-list).....(b
6600: 65 67 69 6e 0a 09 09 09 09 20 20 28 74 65 73 74  egin.....  (test
6610: 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d  s:testqueue-set-
6620: 69 74 65 6d 73 21 20 74 65 73 74 2d 72 65 63 6f  items! test-reco
6630: 72 64 20 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09  rd items-list)..
6640: 09 09 09 20 20 3b 3b 20 28 74 68 72 65 61 64 2d  ...  ;; (thread-
6650: 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64  sleep! *global-d
6660: 65 6c 74 61 2a 29 0a 09 09 09 09 20 20 28 6c 6f  elta*).....  (lo
6670: 6f 70 20 68 65 64 20 74 61 6c 20 72 65 72 75 6e  op hed tal rerun
6680: 73 29 29 0a 09 09 09 09 28 62 65 67 69 6e 0a 09  s)).....(begin..
6690: 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e  ...  (debug:prin
66a0: 74 20 30 20 22 45 52 52 4f 52 3a 20 54 68 65 20  t 0 "ERROR: The 
66b0: 70 72 6f 63 20 66 72 6f 6d 20 72 65 61 64 69 6e  proc from readin
66c0: 67 20 74 68 65 20 73 65 74 75 70 20 64 69 64 20  g the setup did 
66d0: 6e 6f 74 20 79 69 65 6c 64 20 61 20 6c 69 73 74  not yield a list
66e0: 20 2d 20 70 6c 65 61 73 65 20 72 65 70 6f 72 74   - please report
66f0: 20 74 68 69 73 22 29 0a 09 09 09 09 20 20 28 65   this").....  (e
6700: 78 69 74 20 31 29 29 29 29 29 29 0a 09 09 20 20  xit 1))))))...  
6710: 20 20 20 20 20 28 28 6e 75 6c 6c 3f 20 66 61 69       ((null? fai
6720: 6c 73 29 0a 09 09 09 28 64 65 62 75 67 3a 70 72  ls)....(debug:pr
6730: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 66 61 69 6c  int-info 4 "fail
6740: 73 20 69 73 20 6e 75 6c 6c 2c 20 6d 6f 76 69 6e  s is null, movin
6750: 67 20 6f 6e 20 69 6e 20 74 68 65 20 71 75 65 75  g on in the queu
6760: 65 20 62 75 74 20 6b 65 65 70 69 6e 67 20 22 20  e but keeping " 
6770: 68 65 64 20 22 20 66 6f 72 20 6e 6f 77 22 29 0a  hed " for now").
6780: 09 09 09 3b 3b 20 6f 6e 6c 79 20 69 6e 63 72 65  ...;; only incre
6790: 6d 65 6e 74 20 6e 75 6d 2d 72 65 74 72 69 65 73  ment num-retries
67a0: 20 77 68 65 6e 20 74 68 65 72 65 20 61 72 65 20   when there are 
67b0: 6e 6f 20 74 65 73 74 73 20 72 75 6e 69 6e 67 0a  no tests runing.
67c0: 09 09 09 28 69 66 20 28 65 71 3f 20 30 20 28 6c  ...(if (eq? 0 (l
67d0: 69 73 74 2d 72 65 66 20 63 61 6e 2d 72 75 6e 2d  ist-ref can-run-
67e0: 6d 6f 72 65 20 31 29 29 0a 09 09 09 20 20 20 20  more 1))....    
67f0: 28 62 65 67 69 6e 0a 09 09 09 20 20 20 20 20 20  (begin....      
6800: 28 69 66 20 28 3e 20 6e 75 6d 2d 72 65 74 72 69  (if (> num-retri
6810: 65 73 20 31 30 30 29 20 3b 3b 20 66 69 72 73 74  es 100) ;; first
6820: 20 31 30 30 20 72 65 74 72 69 65 73 20 61 72 65   100 retries are
6830: 20 6c 6f 77 20 74 69 6d 65 20 63 6f 73 74 0a 09   low time cost..
6840: 09 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65  ...  (thread-sle
6850: 65 70 21 20 28 2b 20 32 20 2a 67 6c 6f 62 61 6c  ep! (+ 2 *global
6860: 2d 64 65 6c 74 61 2a 29 29 0a 09 09 09 09 20 20  -delta*)).....  
6870: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28  (thread-sleep! (
6880: 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d 64  + 0.01 *global-d
6890: 65 6c 74 61 2a 29 29 29 0a 09 09 09 20 20 20 20  elta*)))....    
68a0: 20 20 28 73 65 74 21 20 6e 75 6d 2d 72 65 74 72    (set! num-retr
68b0: 69 65 73 20 28 2b 20 6e 75 6d 2d 72 65 74 72 69  ies (+ num-retri
68c0: 65 73 20 31 29 29 29 29 0a 09 09 09 28 69 66 20  es 1))))....(if 
68d0: 28 3e 20 6e 75 6d 2d 72 65 74 72 69 65 73 20 20  (> num-retries  
68e0: 6d 61 78 2d 72 65 74 72 69 65 73 29 0a 09 09 09  max-retries)....
68f0: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75      (if (not (nu
6900: 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 09 09 28 6c  ll? tal)).....(l
6910: 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63 64  oop (car tal)(cd
6920: 72 20 74 61 6c 29 20 72 65 72 75 6e 73 29 29 0a  r tal) reruns)).
6930: 09 09 09 20 20 20 20 28 6c 6f 6f 70 20 28 63 61  ...    (loop (ca
6940: 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65  r newtal)(cdr ne
6950: 77 74 61 6c 29 20 72 65 72 75 6e 73 29 29 29 20  wtal) reruns))) 
6960: 3b 3b 20 61 6e 20 69 73 73 75 65 20 77 69 74 68  ;; an issue with
6970: 20 70 72 65 72 65 71 73 20 6e 6f 74 20 79 65 74   prereqs not yet
6980: 20 6d 65 74 3f 0a 09 09 20 20 20 20 20 20 20 28   met?...       (
6990: 28 61 6e 64 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f  (and (not (null?
69a0: 20 66 61 69 6c 73 29 29 28 65 71 3f 20 74 65 73   fails))(eq? tes
69b0: 74 6d 6f 64 65 20 27 6e 6f 72 6d 61 6c 29 29 0a  tmode 'normal)).
69c0: 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 2d  ...(debug:print-
69d0: 69 6e 66 6f 20 31 20 22 74 65 73 74 20 22 20 20  info 1 "test "  
69e0: 68 65 64 20 22 20 28 6d 6f 64 65 3d 22 20 74 65  hed " (mode=" te
69f0: 73 74 6d 6f 64 65 20 22 29 20 68 61 73 20 66 61  stmode ") has fa
6a00: 69 6c 65 64 20 70 72 65 72 65 71 75 69 73 69 74  iled prerequisit
6a10: 65 28 73 29 3b 20 22 0a 09 09 09 09 20 20 20 20  e(s); ".....    
6a20: 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70   (string-intersp
6a30: 65 72 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 64  erse (map (lambd
6a40: 61 20 28 74 29 28 63 6f 6e 63 20 28 64 62 3a 74  a (t)(conc (db:t
6a50: 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65  est-get-testname
6a60: 20 74 29 20 22 3a 22 20 28 64 62 3a 74 65 73 74   t) ":" (db:test
6a70: 2d 67 65 74 2d 73 74 61 74 65 20 74 29 22 2f 22  -get-state t)"/"
6a80: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61  (db:test-get-sta
6a90: 74 75 73 20 74 29 29 29 20 66 61 69 6c 73 29 20  tus t))) fails) 
6aa0: 22 2c 20 22 29 0a 09 09 09 09 20 20 20 20 20 22  ", ").....     "
6ab0: 2c 20 72 65 6d 6f 76 69 6e 67 20 69 74 20 66 72  , removing it fr
6ac0: 6f 6d 20 74 6f 2d 64 6f 20 6c 69 73 74 22 29 0a  om to-do list").
6ad0: 09 09 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c  ...(if (not (nul
6ae0: 6c 3f 20 74 61 6c 29 29 0a 09 09 09 20 20 20 20  l? tal))....    
6af0: 28 62 65 67 69 6e 0a 20 20 20 20 20 20 20 20 20  (begin.         
6b00: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
6b10: 20 20 20 20 20 3b 3b 20 28 74 68 72 65 61 64 2d       ;; (thread-
6b20: 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64  sleep! *global-d
6b30: 65 6c 74 61 2a 29 0a 09 09 09 20 20 20 20 20 20  elta*)....      
6b40: 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28  (loop (car tal)(
6b50: 63 64 72 20 74 61 6c 29 28 63 6f 6e 73 20 68 65  cdr tal)(cons he
6b60: 64 20 72 65 72 75 6e 73 29 29 29 29 29 0a 09 09  d reruns)))))...
6b70: 20 20 20 20 20 20 20 28 65 6c 73 65 0a 09 09 09         (else....
6b80: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 38 20 22  (debug:print 8 "
6b90: 45 52 52 4f 52 3a 20 4e 6f 20 68 61 6e 64 6c 65  ERROR: No handle
6ba0: 72 20 66 6f 72 20 74 68 69 73 20 63 6f 6e 64 69  r for this condi
6bb0: 74 69 6f 6e 2e 22 29 0a 09 09 09 28 74 68 72 65  tion.")....(thre
6bc0: 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 31 20 2a  ad-sleep! (+ 1 *
6bd0: 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a  global-delta*)).
6be0: 09 09 09 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65  ...(loop (car ne
6bf0: 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c  wtal)(cdr newtal
6c00: 29 20 72 65 72 75 6e 73 29 29 29 29 20 3b 3b 20  ) reruns)))) ;; 
6c10: 45 4e 44 20 4f 46 20 49 46 20 43 41 4e 20 52 55  END OF IF CAN RU
6c20: 4e 20 4d 4f 52 45 0a 0a 09 09 20 20 20 20 3b 3b  N MORE....    ;;
6c30: 20 69 66 20 63 61 6e 27 74 20 72 75 6e 20 6d 6f   if can't run mo
6c40: 72 65 20 6a 75 73 74 20 6c 6f 6f 70 20 77 69 74  re just loop wit
6c50: 68 20 6e 65 78 74 20 70 6f 73 73 69 62 6c 65 20  h next possible 
6c60: 74 65 73 74 0a 09 09 20 20 20 20 28 62 65 67 69  test...    (begi
6c70: 6e 0a 09 09 20 20 20 20 20 20 28 64 65 62 75 67  n...      (debug
6c80: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 70  :print-info 4 "p
6c90: 72 6f 63 65 73 73 69 6e 67 20 74 68 65 20 63 61  rocessing the ca
6ca0: 73 65 20 77 69 74 68 20 61 20 6c 61 6d 62 64 61  se with a lambda
6cb0: 20 66 6f 72 20 69 74 65 6d 73 20 6f 72 20 27 68   for items or 'h
6cc0: 61 76 65 2d 70 72 6f 63 65 64 75 72 65 2e 20 4d  ave-procedure. M
6cd0: 6f 76 69 6e 67 20 74 68 72 6f 75 67 68 20 74 68  oving through th
6ce0: 65 20 71 75 65 75 65 20 77 69 74 68 6f 75 74 20  e queue without 
6cf0: 64 72 6f 70 70 69 6e 67 20 22 20 68 65 64 29 0a  dropping " hed).
6d00: 09 09 20 20 20 20 20 20 3b 3b 20 28 74 68 72 65  ..      ;; (thre
6d10: 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 32 20 2a  ad-sleep! (+ 2 *
6d20: 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a  global-delta*)).
6d30: 09 09 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63  ..      (loop (c
6d40: 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e  ar newtal)(cdr n
6d50: 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29 29 29  ewtal) reruns)))
6d60: 29 29 20 3b 3b 20 45 4e 44 20 4f 46 20 28 6f 72  )) ;; END OF (or
6d70: 20 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65   (procedure? ite
6d80: 6d 73 29 28 65 71 3f 20 69 74 65 6d 73 20 27 68  ms)(eq? items 'h
6d90: 61 76 65 2d 70 72 6f 63 65 64 75 72 65 29 29 0a  ave-procedure)).
6da0: 09 20 20 20 20 20 0a 09 20 20 20 20 20 3b 3b 20  .     ..     ;; 
6db0: 74 68 69 73 20 63 61 73 65 20 73 68 6f 75 6c 64  this case should
6dc0: 20 6e 6f 74 20 68 61 70 70 65 6e 2c 20 61 64 64   not happen, add
6dd0: 65 64 20 74 6f 20 68 65 6c 70 20 63 61 74 63 68  ed to help catch
6de0: 20 61 6e 79 20 62 75 67 73 0a 09 20 20 20 20 20   any bugs..     
6df0: 28 28 61 6e 64 20 28 6c 69 73 74 3f 20 69 74 65  ((and (list? ite
6e00: 6d 73 29 20 69 74 65 6d 64 61 74 29 0a 09 20 20  ms) itemdat)..  
6e10: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
6e20: 20 30 20 22 45 52 52 4f 52 3a 20 53 68 6f 75 6c   0 "ERROR: Shoul
6e30: 64 20 6e 6f 74 20 68 61 76 65 20 61 20 6c 69 73  d not have a lis
6e40: 74 20 6f 66 20 69 74 65 6d 73 20 69 6e 20 61 20  t of items in a 
6e50: 74 65 73 74 20 61 6e 64 20 74 68 65 20 69 74 65  test and the ite
6e60: 6d 73 70 61 74 68 20 73 65 74 20 2d 20 70 6c 65  mspath set - ple
6e70: 61 73 65 20 72 65 70 6f 72 74 20 74 68 69 73 22  ase report this"
6e80: 29 0a 09 20 20 20 20 20 20 28 65 78 69 74 20 31  )..      (exit 1
6e90: 29 29 0a 09 20 20 20 20 20 28 28 6e 6f 74 20 28  ))..     ((not (
6ea0: 6e 75 6c 6c 3f 20 72 65 72 75 6e 73 29 29 0a 09  null? reruns))..
6eb0: 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 6e 65        (let* ((ne
6ec0: 77 6c 73 74 20 28 74 65 73 74 73 3a 66 69 6c 74  wlst (tests:filt
6ed0: 65 72 2d 6e 6f 6e 2d 72 75 6e 6e 61 62 6c 65 20  er-non-runnable 
6ee0: 72 75 6e 2d 69 64 20 74 61 6c 20 74 65 73 74 2d  run-id tal test-
6ef0: 72 65 63 6f 72 64 73 29 29 20 3b 3b 20 69 2e 65  records)) ;; i.e
6f00: 2e 20 6e 6f 74 20 46 41 49 4c 2c 20 57 41 49 56  . not FAIL, WAIV
6f10: 45 44 2c 20 49 4e 43 4f 4d 50 4c 45 54 45 2c 20  ED, INCOMPLETE, 
6f20: 50 41 53 53 2c 20 4b 49 4c 4c 45 44 2c 0a 09 09  PASS, KILLED,...
6f30: 20 20 20 20 20 28 6a 75 6e 6b 65 64 20 28 6c 73       (junked (ls
6f40: 65 74 2d 64 69 66 66 65 72 65 6e 63 65 20 65 71  et-difference eq
6f50: 75 61 6c 3f 20 74 61 6c 20 6e 65 77 6c 73 74 29  ual? tal newlst)
6f60: 29 29 0a 09 09 28 64 65 62 75 67 3a 70 72 69 6e  ))...(debug:prin
6f70: 74 2d 69 6e 66 6f 20 34 20 22 66 75 6c 6c 20 64  t-info 4 "full d
6f80: 72 6f 70 20 74 68 72 6f 75 67 68 2c 20 69 66 20  rop through, if 
6f90: 72 65 72 75 6e 73 20 69 73 20 6c 65 73 73 20 74  reruns is less t
6fa0: 68 61 6e 20 31 30 30 20 77 65 20 77 69 6c 6c 20  han 100 we will 
6fb0: 66 6f 72 63 65 20 72 65 74 72 79 20 74 68 65 6d  force retry them
6fc0: 2c 20 72 65 72 75 6e 73 3d 22 20 72 65 72 75 6e  , reruns=" rerun
6fd0: 73 20 22 2c 20 74 61 6c 3d 22 20 74 61 6c 29 0a  s ", tal=" tal).
6fe0: 09 09 28 69 66 20 28 3c 20 6e 75 6d 2d 72 65 74  ..(if (< num-ret
6ff0: 72 69 65 73 20 6d 61 78 2d 72 65 74 72 69 65 73  ries max-retries
7000: 29 0a 09 09 20 20 20 20 28 73 65 74 21 20 6e 65  )...    (set! ne
7010: 77 6c 73 74 20 28 61 70 70 65 6e 64 20 72 65 72  wlst (append rer
7020: 75 6e 73 20 6e 65 77 6c 73 74 29 29 29 0a 09 09  uns newlst)))...
7030: 28 73 65 74 21 20 6e 75 6d 2d 72 65 74 72 69 65  (set! num-retrie
7040: 73 20 28 2b 20 6e 75 6d 2d 72 65 74 72 69 65 73  s (+ num-retries
7050: 20 31 29 29 0a 09 09 3b 3b 20 28 74 68 72 65 61   1))...;; (threa
7060: 64 2d 73 6c 65 65 70 21 20 28 2b 20 31 20 2a 67  d-sleep! (+ 1 *g
7070: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09  lobal-delta*))..
7080: 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f  .(if (not (null?
7090: 20 6e 65 77 6c 73 74 29 29 0a 09 09 20 20 20 20   newlst))...    
70a0: 3b 3b 20 73 69 6e 63 65 20 72 65 72 75 6e 73 20  ;; since reruns 
70b0: 68 61 76 65 20 62 65 65 6e 20 74 61 63 6b 65 64  have been tacked
70c0: 20 6f 6e 20 74 6f 20 6e 65 77 6c 73 74 20 63 72   on to newlst cr
70d0: 65 61 74 65 20 6e 65 77 20 72 65 72 75 6e 73 20  eate new reruns 
70e0: 66 72 6f 6d 20 6a 75 6e 6b 65 64 0a 09 09 20 20  from junked...  
70f0: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77    (loop (car new
7100: 6c 73 74 29 28 63 64 72 20 6e 65 77 6c 73 74 29  lst)(cdr newlst)
7110: 28 64 65 6c 65 74 65 2d 64 75 70 6c 69 63 61 74  (delete-duplicat
7120: 65 73 20 6a 75 6e 6b 65 64 29 29 29 29 29 0a 09  es junked)))))..
7130: 20 20 20 20 20 28 28 6e 6f 74 20 28 6e 75 6c 6c       ((not (null
7140: 3f 20 74 61 6c 29 29 0a 09 20 20 20 20 20 20 28  ? tal))..      (
7150: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
7160: 20 34 20 22 49 27 6d 20 70 72 65 74 74 79 20 73   4 "I'm pretty s
7170: 75 72 65 20 49 20 73 68 6f 75 6c 64 6e 27 74 20  ure I shouldn't 
7180: 67 65 74 20 68 65 72 65 2e 22 29 29 0a 09 20 20  get here."))..  
7190: 20 20 20 28 65 6c 73 65 0a 09 20 20 20 20 20 20     (else..      
71a0: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
71b0: 6f 20 34 20 22 45 78 69 74 69 6e 67 20 6c 6f 6f  o 4 "Exiting loo
71c0: 70 20 77 69 74 68 2e 2e 2e 5c 6e 20 20 68 65 64  p with...\n  hed
71d0: 3d 22 20 68 65 64 20 22 5c 6e 20 20 74 61 6c 3d  =" hed "\n  tal=
71e0: 22 20 74 61 6c 20 22 5c 6e 20 20 72 65 72 75 6e  " tal "\n  rerun
71f0: 73 3d 22 20 72 65 72 75 6e 73 29 29 0a 09 20 20  s=" reruns))..  
7200: 20 20 20 29 29 29 29 20 3b 3b 20 4c 45 54 2a 20     )))) ;; LET* 
7210: 28 28 74 65 73 74 2d 72 65 63 6f 72 64 0a 0a 20  ((test-record.. 
7220: 20 20 20 3b 3b 20 77 65 20 67 65 74 20 68 65 72     ;; we get her
7230: 65 20 6f 6e 20 22 64 72 6f 70 20 74 68 72 6f 75  e on "drop throu
7240: 67 68 22 20 2d 20 6c 6f 6f 70 20 66 6f 72 20 6e  gh" - loop for n
7250: 65 78 74 20 74 65 73 74 20 69 6e 20 71 75 65 75  ext test in queu
7260: 65 0a 20 20 20 20 3b 3b 20 46 49 58 4d 45 21 21  e.    ;; FIXME!!
7270: 21 21 20 54 48 49 53 20 53 48 4f 55 4c 44 20 4e  !! THIS SHOULD N
7280: 4f 54 20 52 45 51 55 49 52 45 20 41 4e 20 45 58  OT REQUIRE AN EX
7290: 49 54 21 21 21 21 21 21 21 0a 20 20 20 20 0a 20  IT!!!!!!!.    . 
72a0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d     (debug:print-
72b0: 69 6e 66 6f 20 31 20 22 41 6c 6c 20 74 65 73 74  info 1 "All test
72c0: 73 20 6c 61 75 6e 63 68 65 64 22 29 0a 20 20 20  s launched").   
72d0: 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20   (thread-sleep! 
72e0: 30 2e 35 29 0a 20 20 20 20 3b 3b 20 46 49 58 4d  0.5).    ;; FIXM
72f0: 45 21 20 54 68 69 73 20 68 61 72 73 68 20 65 78  E! This harsh ex
7300: 69 74 20 73 68 6f 75 6c 64 20 6e 6f 74 20 62 65  it should not be
7310: 20 6e 65 63 65 73 73 61 72 79 2e 2e 2e 2e 0a 20   necessary..... 
7320: 20 20 20 3b 3b 20 28 69 66 20 28 6e 6f 74 20 2a     ;; (if (not *
7330: 72 75 6e 72 65 6d 6f 74 65 2a 29 28 65 78 69 74  runremote*)(exit
7340: 29 29 20 3b 3b 20 0a 20 20 20 20 23 66 29 29 20  )) ;; .    #f)) 
7350: 3b 3b 20 72 65 74 75 72 6e 20 61 20 23 66 20 61  ;; return a #f a
7360: 73 20 61 20 68 69 6e 74 20 74 68 61 74 20 77 65  s a hint that we
7370: 20 61 72 65 20 64 6f 6e 65 0a 20 20 3b 3b 20 48   are done.  ;; H
7380: 65 72 65 20 77 65 20 6e 65 65 64 20 74 6f 20 63  ere we need to c
7390: 68 65 63 6b 20 74 68 61 74 20 61 6c 6c 20 74 68  heck that all th
73a0: 65 20 74 65 73 74 73 20 72 65 6d 61 69 6e 69 6e  e tests remainin
73b0: 67 20 74 6f 20 62 65 20 72 75 6e 20 61 72 65 20  g to be run are 
73c0: 65 6c 69 67 69 62 6c 65 20 74 6f 20 72 75 6e 0a  eligible to run.
73d0: 20 20 3b 3b 20 61 6e 64 20 61 72 65 20 6e 6f 74    ;; and are not
73e0: 20 62 6c 6f 63 6b 65 64 20 62 79 20 66 61 69 6c   blocked by fail
73f0: 65 64 0a 20 20 0a 0a 3b 3b 20 70 61 72 65 6e 74  ed.  ..;; parent
7400: 2d 74 65 73 74 20 69 73 20 74 68 65 72 65 20 61  -test is there a
7410: 73 20 61 20 70 6c 61 63 65 68 6f 6c 64 65 72 20  s a placeholder 
7420: 66 6f 72 20 77 68 65 6e 20 70 61 72 65 6e 74 2d  for when parent-
7430: 74 65 73 74 73 20 63 61 6e 20 62 65 20 72 75 6e  tests can be run
7440: 20 61 73 20 61 20 73 65 74 75 70 20 73 74 65 70   as a setup step
7450: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 3a 74 65  .(define (run:te
7460: 73 74 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d  st run-id runnam
7470: 65 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 73 74  e keyvallst test
7480: 2d 72 65 63 6f 72 64 20 66 6c 61 67 73 20 70 61  -record flags pa
7490: 72 65 6e 74 2d 74 65 73 74 29 0a 20 20 3b 3b 20  rent-test).  ;; 
74a0: 41 6c 6c 20 74 68 65 73 65 20 76 61 72 73 20 6d  All these vars m
74b0: 69 67 68 74 20 62 65 20 72 65 66 65 72 65 6e 63  ight be referenc
74c0: 65 64 20 62 79 20 74 68 65 20 74 65 73 74 63 6f  ed by the testco
74d0: 6e 66 69 67 20 66 69 6c 65 20 72 65 61 64 65 72  nfig file reader
74e0: 0a 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d  .  (let* ((test-
74f0: 6e 61 6d 65 20 20 20 20 28 74 65 73 74 73 3a 74  name    (tests:t
7500: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73  estqueue-get-tes
7510: 74 6e 61 6d 65 20 20 20 74 65 73 74 2d 72 65 63  tname   test-rec
7520: 6f 72 64 29 29 0a 09 20 28 74 65 73 74 2d 77 61  ord)).. (test-wa
7530: 69 74 6f 6e 73 20 28 74 65 73 74 73 3a 74 65 73  itons (tests:tes
7540: 74 71 75 65 75 65 2d 67 65 74 2d 77 61 69 74 6f  tqueue-get-waito
7550: 6e 73 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72  ns    test-recor
7560: 64 29 29 0a 09 20 28 74 65 73 74 2d 63 6f 6e 66  d)).. (test-conf
7570: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71      (tests:testq
7580: 75 65 75 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e  ueue-get-testcon
7590: 66 69 67 20 74 65 73 74 2d 72 65 63 6f 72 64 29  fig test-record)
75a0: 29 0a 09 20 28 69 74 65 6d 64 61 74 20 20 20 20  ).. (itemdat    
75b0: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65    (tests:testque
75c0: 75 65 2d 67 65 74 2d 69 74 65 6d 64 61 74 20 20  ue-get-itemdat  
75d0: 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a    test-record)).
75e0: 09 20 28 74 65 73 74 2d 70 61 74 68 20 20 20 20  . (test-path    
75f0: 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20  (conc *toppath* 
7600: 22 2f 74 65 73 74 73 2f 22 20 74 65 73 74 2d 6e  "/tests/" test-n
7610: 61 6d 65 29 29 20 3b 3b 20 63 6f 75 6c 64 20 75  ame)) ;; could u
7620: 73 65 20 74 65 73 74 73 3a 67 65 74 2d 74 65 73  se tests:get-tes
7630: 74 63 6f 6e 66 69 67 20 68 65 72 65 20 2e 2e 2e  tconfig here ...
7640: 0a 09 20 28 66 6f 72 63 65 20 20 20 20 20 20 20  .. (force       
7650: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66   (hash-table-ref
7660: 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22  /default flags "
7670: 2d 66 6f 72 63 65 22 20 23 66 29 29 0a 09 20 28  -force" #f)).. (
7680: 72 65 72 75 6e 20 20 20 20 20 20 20 20 28 68 61  rerun        (ha
7690: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66  sh-table-ref/def
76a0: 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 72 65 72  ault flags "-rer
76b0: 75 6e 22 20 23 66 29 29 0a 09 20 28 6b 65 65 70  un" #f)).. (keep
76c0: 67 6f 69 6e 67 20 20 20 20 28 68 61 73 68 2d 74  going    (hash-t
76d0: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74  able-ref/default
76e0: 20 66 6c 61 67 73 20 22 2d 6b 65 65 70 67 6f 69   flags "-keepgoi
76f0: 6e 67 22 20 23 66 29 29 0a 09 20 28 69 74 65 6d  ng" #f)).. (item
7700: 2d 70 61 74 68 20 20 20 20 20 22 22 29 0a 09 20  -path     "").. 
7710: 28 64 62 20 20 20 20 20 20 20 20 20 20 20 23 66  (db           #f
7720: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72  )).    (debug:pr
7730: 69 6e 74 20 34 0a 09 09 20 22 74 65 73 74 2d 63  int 4... "test-c
7740: 6f 6e 66 69 67 3a 20 22 20 28 68 61 73 68 2d 74  onfig: " (hash-t
7750: 61 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65 73 74  able->alist test
7760: 2d 63 6f 6e 66 29 0a 09 09 20 22 5c 6e 20 20 20  -conf)... "\n   
7770: 69 74 65 6d 64 61 74 3a 20 22 20 69 74 65 6d 64  itemdat: " itemd
7780: 61 74 0a 09 09 20 29 0a 20 20 20 20 3b 3b 20 73  at... ).    ;; s
7790: 65 74 74 69 6e 67 20 69 74 65 6d 64 61 74 20 74  etting itemdat t
77a0: 6f 20 61 20 6c 69 73 74 20 69 66 20 69 74 20 69  o a list if it i
77b0: 73 20 23 66 0a 20 20 20 20 28 69 66 20 28 6e 6f  s #f.    (if (no
77c0: 74 20 69 74 65 6d 64 61 74 29 28 73 65 74 21 20  t itemdat)(set! 
77d0: 69 74 65 6d 64 61 74 20 27 28 29 29 29 0a 20 20  itemdat '())).  
77e0: 20 20 28 73 65 74 21 20 69 74 65 6d 2d 70 61 74    (set! item-pat
77f0: 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61  h (item-list->pa
7800: 74 68 20 69 74 65 6d 64 61 74 29 29 0a 20 20 20  th itemdat)).   
7810: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20   (debug:print 2 
7820: 22 41 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 6c  "Attempting to l
7830: 61 75 6e 63 68 20 74 65 73 74 20 22 20 74 65 73  aunch test " tes
7840: 74 2d 6e 61 6d 65 20 28 69 66 20 28 65 71 75 61  t-name (if (equa
7850: 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 2f 22  l? item-path "/"
7860: 29 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29  ) "/" item-path)
7870: 29 0a 20 20 20 20 28 73 65 74 65 6e 76 20 22 4d  ).    (setenv "M
7880: 54 5f 54 45 53 54 5f 4e 41 4d 45 22 20 74 65 73  T_TEST_NAME" tes
7890: 74 2d 6e 61 6d 65 29 20 3b 3b 20 0a 20 20 20 20  t-name) ;; .    
78a0: 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e 4e  (setenv "MT_RUNN
78b0: 41 4d 45 22 20 20 20 72 75 6e 6e 61 6d 65 29 0a  AME"   runname).
78c0: 20 20 20 20 28 73 65 74 2d 6d 65 67 61 74 65 73      (set-megates
78d0: 74 2d 65 6e 76 2d 76 61 72 73 20 72 75 6e 2d 69  t-env-vars run-i
78e0: 64 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20  d) ;; these may 
78f0: 62 65 20 6e 65 65 64 65 64 20 62 79 20 74 68 65  be needed by the
7900: 20 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65   launching proce
7910: 73 73 0a 20 20 20 20 28 63 68 61 6e 67 65 2d 64  ss.    (change-d
7920: 69 72 65 63 74 6f 72 79 20 2a 74 6f 70 70 61 74  irectory *toppat
7930: 68 2a 29 0a 0a 20 20 20 20 3b 3b 20 48 65 72 65  h*)..    ;; Here
7940: 20 69 73 20 77 68 65 72 65 20 74 68 65 20 74 65   is where the te
7950: 73 74 5f 6d 65 74 61 20 74 61 62 6c 65 20 69 73  st_meta table is
7960: 20 62 65 73 74 20 75 70 64 61 74 65 64 0a 20 20   best updated.  
7970: 20 20 3b 3b 20 59 65 73 2c 20 61 6e 6f 74 68 65    ;; Yes, anothe
7980: 72 20 75 73 65 20 6f 66 20 61 20 67 6c 6f 62 61  r use of a globa
7990: 6c 20 66 6f 72 20 63 61 63 68 69 6e 67 2e 20 4e  l for caching. N
79a0: 65 65 64 20 61 20 62 65 74 74 65 72 20 77 61 79  eed a better way
79b0: 3f 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28  ?.    (if (not (
79c0: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64  hash-table-ref/d
79d0: 65 66 61 75 6c 74 20 2a 74 65 73 74 2d 6d 65 74  efault *test-met
79e0: 61 2d 75 70 64 61 74 65 64 2a 20 74 65 73 74 2d  a-updated* test-
79f0: 6e 61 6d 65 20 23 66 29 29 0a 20 20 20 20 20 20  name #f)).      
7a00: 20 20 28 62 65 67 69 6e 0a 09 20 20 20 28 68 61    (begin..   (ha
7a10: 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 2a 74  sh-table-set! *t
7a20: 65 73 74 2d 6d 65 74 61 2d 75 70 64 61 74 65 64  est-meta-updated
7a30: 2a 20 74 65 73 74 2d 6e 61 6d 65 20 23 74 29 0a  * test-name #t).
7a40: 20 20 20 20 20 20 20 20 20 20 20 28 6f 70 65 6e             (open
7a50: 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 3a  -run-close runs:
7a60: 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 61  update-test_meta
7a70: 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 65   db test-name te
7a80: 73 74 2d 63 6f 6e 66 29 29 29 0a 20 20 20 20 0a  st-conf))).    .
7a90: 20 20 20 20 3b 3b 20 28 6c 61 6d 62 64 61 20 28      ;; (lambda (
7aa0: 69 74 65 6d 64 61 74 29 20 3b 3b 3b 20 28 28 72  itemdat) ;;; ((r
7ab0: 69 70 65 6e 65 73 73 20 22 6f 76 65 72 72 69 70  ipeness "overrip
7ac0: 65 22 29 20 28 74 65 6d 70 65 72 61 74 75 72 65  e") (temperature
7ad0: 20 22 63 6f 6f 6c 22 29 20 28 73 65 61 73 6f 6e   "cool") (season
7ae0: 20 22 73 75 6d 6d 65 72 22 29 29 0a 20 20 20 20   "summer")).    
7af0: 28 6c 65 74 2a 20 28 28 6e 65 77 2d 74 65 73 74  (let* ((new-test
7b00: 2d 70 61 74 68 20 28 73 74 72 69 6e 67 2d 69 6e  -path (string-in
7b10: 74 65 72 73 70 65 72 73 65 20 28 63 6f 6e 73 20  tersperse (cons 
7b20: 74 65 73 74 2d 70 61 74 68 20 28 6d 61 70 20 63  test-path (map c
7b30: 61 64 72 20 69 74 65 6d 64 61 74 29 29 20 22 2f  adr itemdat)) "/
7b40: 22 29 29 0a 09 20 20 20 28 6e 65 77 2d 74 65 73  "))..   (new-tes
7b50: 74 2d 6e 61 6d 65 20 28 69 66 20 28 65 71 75 61  t-name (if (equa
7b60: 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29  l? item-path "")
7b70: 20 74 65 73 74 2d 6e 61 6d 65 20 28 63 6f 6e 63   test-name (conc
7b80: 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69   test-name "/" i
7b90: 74 65 6d 2d 70 61 74 68 29 29 29 20 3b 3b 20 6a  tem-path))) ;; j
7ba0: 75 73 74 20 6e 65 65 64 20 69 74 20 74 6f 20 62  ust need it to b
7bb0: 65 20 75 6e 69 71 75 65 0a 09 20 20 20 28 74 65  e unique..   (te
7bc0: 73 74 2d 69 64 20 20 20 20 20 20 20 28 63 64 62  st-id       (cdb
7bd0: 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64 62 3a 67  :remote-run db:g
7be0: 65 74 2d 74 65 73 74 2d 69 64 20 23 66 20 20 72  et-test-id #f  r
7bf0: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20  un-id test-name 
7c00: 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 20 20 20  item-path))..   
7c10: 28 74 65 73 74 64 61 74 20 20 20 20 20 20 20 28  (testdat       (
7c20: 63 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66  cdb:get-test-inf
7c30: 6f 2d 62 79 2d 69 64 20 2a 72 75 6e 72 65 6d 6f  o-by-id *runremo
7c40: 74 65 2a 20 74 65 73 74 2d 69 64 29 29 29 0a 20  te* test-id))). 
7c50: 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 74 65       (if (not te
7c60: 73 74 64 61 74 29 0a 09 20 20 28 62 65 67 69 6e  stdat)..  (begin
7c70: 0a 09 20 20 20 20 3b 3b 20 65 6e 73 75 72 65 20  ..    ;; ensure 
7c80: 74 68 61 74 20 74 68 65 20 70 61 74 68 20 65 78  that the path ex
7c90: 69 73 74 73 20 62 65 66 6f 72 65 20 72 65 67 69  ists before regi
7ca0: 73 74 65 72 69 6e 67 20 74 68 65 20 74 65 73 74  stering the test
7cb0: 0a 09 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 43  ..    ;; NOPE: C
7cc0: 61 6e 6e 6f 74 21 20 44 6f 6e 27 74 20 6b 6e 6f  annot! Don't kno
7cd0: 77 20 79 65 74 20 77 68 69 63 68 20 64 69 73 6b  w yet which disk
7ce0: 20 61 72 65 61 20 77 69 6c 6c 20 62 65 20 61 73   area will be as
7cf0: 73 69 67 6e 65 64 2e 2e 2e 2e 0a 09 20 20 20 20  signed......    
7d00: 3b 3b 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63  ;; (system (conc
7d10: 20 22 6d 6b 64 69 72 20 2d 70 20 22 20 6e 65 77   "mkdir -p " new
7d20: 2d 74 65 73 74 2d 70 61 74 68 29 29 0a 09 20 20  -test-path))..  
7d30: 20 20 3b 3b 0a 09 20 20 20 20 3b 3b 20 28 6f 70    ;;..    ;; (op
7d40: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 74 65 73  en-run-close tes
7d50: 74 73 3a 72 65 67 69 73 74 65 72 2d 74 65 73 74  ts:register-test
7d60: 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d   db run-id test-
7d70: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a  name item-path).
7d80: 09 20 20 20 20 3b 3b 0a 09 20 20 20 20 3b 3b 20  .    ;;..    ;; 
7d90: 4e 42 2f 2f 20 66 6f 72 20 74 68 65 20 61 62 6f  NB// for the abo
7da0: 76 65 20 6c 69 6e 65 2e 20 49 20 77 61 6e 74 20  ve line. I want 
7db0: 74 68 65 20 74 65 73 74 20 74 6f 20 62 65 20 72  the test to be r
7dc0: 65 67 69 73 74 65 72 65 64 20 6c 6f 6e 67 20 62  egistered long b
7dd0: 65 66 6f 72 65 20 74 68 69 73 20 72 6f 75 74 69  efore this routi
7de0: 6e 65 20 67 65 74 73 20 63 61 6c 6c 65 64 21 0a  ne gets called!.
7df0: 09 20 20 20 20 3b 3b 0a 09 20 20 20 20 28 73 65  .    ;;..    (se
7e00: 74 21 20 74 65 73 74 2d 69 64 20 28 6f 70 65 6e  t! test-id (open
7e10: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65  -run-close db:ge
7e20: 74 2d 74 65 73 74 2d 69 64 20 64 62 20 72 75 6e  t-test-id db run
7e30: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74  -id test-name it
7e40: 65 6d 2d 70 61 74 68 29 29 0a 09 20 20 20 20 28  em-path))..    (
7e50: 69 66 20 28 6e 6f 74 20 74 65 73 74 2d 69 64 29  if (not test-id)
7e60: 0a 09 09 28 62 65 67 69 6e 0a 09 09 20 20 28 64  ...(begin...  (d
7e70: 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 57 41  ebug:print 2 "WA
7e80: 52 4e 3a 20 54 65 73 74 20 6e 6f 74 20 70 72 65  RN: Test not pre
7e90: 2d 63 72 65 61 74 65 64 3f 20 74 65 73 74 2d 6e  -created? test-n
7ea0: 61 6d 65 3d 22 20 74 65 73 74 2d 6e 61 6d 65 20  ame=" test-name 
7eb0: 22 2c 20 69 74 65 6d 2d 70 61 74 68 3d 22 20 69  ", item-path=" i
7ec0: 74 65 6d 2d 70 61 74 68 20 22 2c 20 72 75 6e 2d  tem-path ", run-
7ed0: 69 64 3d 22 20 72 75 6e 2d 69 64 29 0a 09 09 20  id=" run-id)... 
7ee0: 20 28 63 64 62 3a 74 65 73 74 73 2d 72 65 67 69   (cdb:tests-regi
7ef0: 73 74 65 72 2d 74 65 73 74 20 2a 72 75 6e 2d 72  ster-test *run-r
7f00: 65 6d 6f 74 65 2a 20 72 75 6e 2d 69 64 20 74 65  emote* run-id te
7f10: 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74  st-name item-pat
7f20: 68 29 0a 09 09 20 20 28 73 65 74 21 20 74 65 73  h)...  (set! tes
7f30: 74 2d 69 64 20 28 6f 70 65 6e 2d 72 75 6e 2d 63  t-id (open-run-c
7f40: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74  lose db:get-test
7f50: 2d 69 64 20 64 62 20 72 75 6e 2d 69 64 20 74 65  -id db run-id te
7f60: 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74  st-name item-pat
7f70: 68 29 29 29 29 0a 09 20 20 20 20 28 64 65 62 75  h))))..    (debu
7f80: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22  g:print-info 4 "
7f90: 74 65 73 74 2d 69 64 3d 22 20 74 65 73 74 2d 69  test-id=" test-i
7fa0: 64 20 22 2c 20 72 75 6e 2d 69 64 3d 22 20 72 75  d ", run-id=" ru
7fb0: 6e 2d 69 64 20 22 2c 20 74 65 73 74 2d 6e 61 6d  n-id ", test-nam
7fc0: 65 3d 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2c  e=" test-name ",
7fd0: 20 69 74 65 6d 2d 70 61 74 68 3d 5c 22 22 20 69   item-path=\"" i
7fe0: 74 65 6d 2d 70 61 74 68 20 22 5c 22 22 29 0a 09  tem-path "\"")..
7ff0: 20 20 20 20 28 73 65 74 21 20 74 65 73 74 64 61      (set! testda
8000: 74 20 28 63 64 62 3a 67 65 74 2d 74 65 73 74 2d  t (cdb:get-test-
8010: 69 6e 66 6f 2d 62 79 2d 69 64 20 2a 72 75 6e 72  info-by-id *runr
8020: 65 6d 6f 74 65 2a 20 74 65 73 74 2d 69 64 29 29  emote* test-id))
8030: 29 29 0a 20 20 20 20 20 20 28 73 65 74 21 20 74  )).      (set! t
8040: 65 73 74 2d 69 64 20 28 64 62 3a 74 65 73 74 2d  est-id (db:test-
8050: 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 29  get-id testdat))
8060: 0a 20 20 20 20 20 20 28 63 68 61 6e 67 65 2d 64  .      (change-d
8070: 69 72 65 63 74 6f 72 79 20 74 65 73 74 2d 70 61  irectory test-pa
8080: 74 68 29 0a 20 20 20 20 20 20 28 63 61 73 65 20  th).      (case 
8090: 28 69 66 20 66 6f 72 63 65 20 3b 3b 20 28 61 72  (if force ;; (ar
80a0: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 66 6f 72  gs:get-arg "-for
80b0: 63 65 22 29 0a 09 09 27 4e 4f 54 5f 53 54 41 52  ce")...'NOT_STAR
80c0: 54 45 44 0a 09 09 28 69 66 20 74 65 73 74 64 61  TED...(if testda
80d0: 74 0a 09 09 20 20 20 20 28 73 74 72 69 6e 67 2d  t...    (string-
80e0: 3e 73 79 6d 62 6f 6c 20 28 74 65 73 74 3a 67 65  >symbol (test:ge
80f0: 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29  t-state testdat)
8100: 29 0a 09 09 20 20 20 20 27 66 61 69 6c 65 64 2d  )...    'failed-
8110: 74 6f 2d 69 6e 73 65 72 74 29 29 0a 09 28 28 66  to-insert))..((f
8120: 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 72 74 29  ailed-to-insert)
8130: 0a 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  .. (debug:print 
8140: 30 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64  0 "ERROR: Failed
8150: 20 74 6f 20 69 6e 73 65 72 74 20 74 68 65 20 72   to insert the r
8160: 65 63 6f 72 64 20 69 6e 74 6f 20 74 68 65 20 64  ecord into the d
8170: 62 22 29 29 0a 09 28 28 4e 4f 54 5f 53 54 41 52  b"))..((NOT_STAR
8180: 54 45 44 20 43 4f 4d 50 4c 45 54 45 44 20 44 45  TED COMPLETED DE
8190: 4c 45 54 45 44 29 0a 09 20 28 6c 65 74 20 28 28  LETED).. (let ((
81a0: 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 20  runflag #f))..  
81b0: 20 28 63 6f 6e 64 0a 09 20 20 20 20 3b 3b 20 2d   (cond..    ;; -
81c0: 66 6f 72 63 65 2c 20 72 75 6e 20 6e 6f 20 6d 61  force, run no ma
81d0: 74 74 65 72 20 77 68 61 74 0a 09 20 20 20 20 28  tter what..    (
81e0: 66 6f 72 63 65 20 28 73 65 74 21 20 72 75 6e 66  force (set! runf
81f0: 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b 3b  lag #t))..    ;;
8200: 20 4e 4f 54 5f 53 54 41 52 54 45 44 2c 20 72 75   NOT_STARTED, ru
8210: 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77 68 61 74  n no matter what
8220: 0a 09 20 20 20 20 28 28 6d 65 6d 62 65 72 20 28  ..    ((member (
8230: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74  test:get-state t
8240: 65 73 74 64 61 74 29 20 27 28 22 44 45 4c 45 54  estdat) '("DELET
8250: 45 44 22 20 22 4e 4f 54 5f 53 54 41 52 54 45 44  ED" "NOT_STARTED
8260: 22 29 29 28 73 65 74 21 20 72 75 6e 66 6c 61 67  "))(set! runflag
8270: 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 6e 6f   #t))..    ;; no
8280: 74 20 2d 72 65 72 75 6e 20 61 6e 64 20 50 41 53  t -rerun and PAS
8290: 53 2c 20 57 41 52 4e 20 6f 72 20 43 48 45 43 4b  S, WARN or CHECK
82a0: 2c 20 64 6f 20 6e 6f 20 72 75 6e 0a 09 20 20 20  , do no run..   
82b0: 20 28 28 61 6e 64 20 28 6f 72 20 28 6e 6f 74 20   ((and (or (not 
82c0: 72 65 72 75 6e 29 0a 09 09 20 20 20 20 20 20 6b  rerun)...      k
82d0: 65 65 70 67 6f 69 6e 67 29 0a 09 09 20 20 3b 3b  eepgoing)...  ;;
82e0: 20 52 65 71 75 69 72 65 20 74 6f 20 66 6f 72 63   Require to forc
82f0: 65 20 72 65 2d 72 75 6e 20 66 6f 72 20 43 4f 4d  e re-run for COM
8300: 50 4c 45 54 45 44 20 6f 72 20 2a 61 6e 79 74 68  PLETED or *anyth
8310: 69 6e 67 2a 20 2b 20 50 41 53 53 2c 57 41 52 4e  ing* + PASS,WARN
8320: 20 6f 72 20 43 48 45 43 4b 0a 09 09 20 20 28 6f   or CHECK...  (o
8330: 72 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a  r (member (test:
8340: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64  get-status testd
8350: 61 74 29 20 27 28 22 50 41 53 53 22 20 22 57 41  at) '("PASS" "WA
8360: 52 4e 22 20 22 43 48 45 43 4b 22 20 22 53 4b 49  RN" "CHECK" "SKI
8370: 50 22 29 29 0a 09 09 20 20 20 20 20 20 28 6d 65  P"))...      (me
8380: 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73  mber (test:get-s
8390: 74 61 74 65 20 20 74 65 73 74 64 61 74 29 20 27  tate  testdat) '
83a0: 28 22 43 4f 4d 50 4c 45 54 45 44 22 29 29 29 29  ("COMPLETED"))))
83b0: 20 0a 09 20 20 20 20 20 28 64 65 62 75 67 3a 70   ..     (debug:p
83c0: 72 69 6e 74 2d 69 6e 66 6f 20 32 20 22 72 75 6e  rint-info 2 "run
83d0: 6e 69 6e 67 20 74 65 73 74 20 22 20 74 65 73 74  ning test " test
83e0: 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70  -name "/" item-p
83f0: 61 74 68 20 22 20 73 75 70 70 72 65 73 73 65 64  ath " suppressed
8400: 20 61 73 20 69 74 20 69 73 20 22 20 28 74 65 73   as it is " (tes
8410: 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74  t:get-state test
8420: 64 61 74 29 20 22 20 61 6e 64 20 22 20 28 74 65  dat) " and " (te
8430: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65  st:get-status te
8440: 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 28 73  stdat))..     (s
8450: 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29  et! runflag #f))
8460: 0a 09 20 20 20 20 3b 3b 20 2d 72 65 72 75 6e 20  ..    ;; -rerun 
8470: 61 6e 64 20 73 74 61 74 75 73 20 69 73 20 6f 6e  and status is on
8480: 65 20 6f 66 20 74 68 65 20 73 70 65 63 69 66 65  e of the specife
8490: 64 2c 20 72 75 6e 20 69 74 0a 09 20 20 20 20 28  d, run it..    (
84a0: 28 61 6e 64 20 72 65 72 75 6e 0a 09 09 20 20 28  (and rerun...  (
84b0: 6c 65 74 2a 20 28 28 72 65 72 75 6e 6c 73 74 20  let* ((rerunlst 
84c0: 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20    (string-split 
84d0: 72 65 72 75 6e 20 22 2c 22 29 29 0a 09 09 09 20  rerun ",")).... 
84e0: 28 6d 75 73 74 2d 72 65 72 75 6e 20 28 6d 65 6d  (must-rerun (mem
84f0: 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74  ber (test:get-st
8500: 61 74 75 73 20 74 65 73 74 64 61 74 29 20 72 65  atus testdat) re
8510: 72 75 6e 6c 73 74 29 29 29 0a 09 09 20 20 20 20  runlst)))...    
8520: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
8530: 6f 20 33 20 22 2d 72 65 72 75 6e 20 6c 69 73 74  o 3 "-rerun list
8540: 3a 20 22 20 72 65 72 75 6e 20 22 2c 20 74 65 73  : " rerun ", tes
8550: 74 2d 73 74 61 74 75 73 3a 20 22 20 28 74 65 73  t-status: " (tes
8560: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73  t:get-status tes
8570: 74 64 61 74 29 22 2c 20 6d 75 73 74 2d 72 65 72  tdat)", must-rer
8580: 75 6e 3a 20 22 20 6d 75 73 74 2d 72 65 72 75 6e  un: " must-rerun
8590: 29 0a 09 09 20 20 20 20 6d 75 73 74 2d 72 65 72  )...    must-rer
85a0: 75 6e 29 29 0a 09 20 20 20 20 20 28 64 65 62 75  un))..     (debu
85b0: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 32 20 22  g:print-info 2 "
85c0: 52 65 72 75 6e 20 66 6f 72 63 65 64 20 66 6f 72  Rerun forced for
85d0: 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d   test " test-nam
85e0: 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29  e "/" item-path)
85f0: 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 75 6e  ..     (set! run
8600: 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b  flag #t))..    ;
8610: 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 2c 20 64 6f  ; -keepgoing, do
8620: 20 6e 6f 74 20 72 65 72 75 6e 20 46 41 49 4c 0a   not rerun FAIL.
8630: 09 20 20 20 20 28 28 61 6e 64 20 6b 65 65 70 67  .    ((and keepg
8640: 6f 69 6e 67 0a 09 09 20 20 28 6d 65 6d 62 65 72  oing...  (member
8650: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75   (test:get-statu
8660: 73 20 74 65 73 74 64 61 74 29 20 27 28 22 46 41  s testdat) '("FA
8670: 49 4c 22 29 29 29 0a 09 20 20 20 20 20 28 73 65  IL")))..     (se
8680: 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 0a  t! runflag #f)).
8690: 09 20 20 20 20 28 28 61 6e 64 20 28 6e 6f 74 20  .    ((and (not 
86a0: 72 65 72 75 6e 29 0a 09 09 20 20 28 6d 65 6d 62  rerun)...  (memb
86b0: 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61  er (test:get-sta
86c0: 74 75 73 20 74 65 73 74 64 61 74 29 20 27 28 22  tus testdat) '("
86d0: 46 41 49 4c 22 20 22 6e 2f 61 22 29 29 29 0a 09  FAIL" "n/a")))..
86e0: 20 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c       (set! runfl
86f0: 61 67 20 23 74 29 29 0a 09 20 20 20 20 28 65 6c  ag #t))..    (el
8700: 73 65 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67  se (set! runflag
8710: 20 23 66 29 29 29 0a 09 20 20 20 28 64 65 62 75   #f)))..   (debu
8720: 67 3a 70 72 69 6e 74 20 36 20 22 52 55 4e 4e 49  g:print 6 "RUNNI
8730: 4e 47 20 3d 3e 20 72 75 6e 66 6c 61 67 3a 20 22  NG => runflag: "
8740: 20 72 75 6e 66 6c 61 67 20 22 20 53 54 41 54 45   runflag " STATE
8750: 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74  : " (test:get-st
8760: 61 74 65 20 74 65 73 74 64 61 74 29 20 22 20 53  ate testdat) " S
8770: 54 41 54 55 53 3a 20 22 20 28 74 65 73 74 3a 67  TATUS: " (test:g
8780: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61  et-status testda
8790: 74 29 29 0a 09 20 20 20 28 69 66 20 28 6e 6f 74  t))..   (if (not
87a0: 20 72 75 6e 66 6c 61 67 29 0a 09 20 20 20 20 20   runflag)..     
87b0: 20 20 28 69 66 20 28 6e 6f 74 20 70 61 72 65 6e    (if (not paren
87c0: 74 2d 74 65 73 74 29 0a 09 09 20 20 20 28 64 65  t-test)...   (de
87d0: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54  bug:print 1 "NOT
87e0: 45 3a 20 4e 6f 74 20 73 74 61 72 74 69 6e 67 20  E: Not starting 
87f0: 74 65 73 74 20 22 20 6e 65 77 2d 74 65 73 74 2d  test " new-test-
8800: 6e 61 6d 65 20 22 20 61 73 20 69 74 20 69 73 20  name " as it is 
8810: 73 74 61 74 65 20 5c 22 22 20 28 74 65 73 74 3a  state \"" (test:
8820: 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61  get-state testda
8830: 74 29 20 0a 09 09 09 09 22 5c 22 20 61 6e 64 20  t) ....."\" and 
8840: 73 74 61 74 75 73 20 5c 22 22 20 28 74 65 73 74  status \"" (test
8850: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74  :get-status test
8860: 64 61 74 29 20 22 5c 22 2c 20 75 73 65 20 2d 72  dat) "\", use -r
8870: 65 72 75 6e 20 5c 22 22 20 28 74 65 73 74 3a 67  erun \"" (test:g
8880: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61  et-status testda
8890: 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20  t).             
88a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
88b0: 20 20 20 22 5c 22 20 6f 72 20 2d 66 6f 72 63 65     "\" or -force
88c0: 20 74 6f 20 6f 76 65 72 72 69 64 65 22 29 29 0a   to override")).
88d0: 09 20 20 20 20 20 20 20 3b 3b 20 4e 4f 54 45 3a  .       ;; NOTE:
88e0: 20 4e 6f 20 6c 6f 6e 67 65 72 20 62 65 20 63 68   No longer be ch
88f0: 65 63 6b 69 6e 67 20 70 72 65 72 65 71 75 69 73  ecking prerequis
8900: 69 74 65 73 20 68 65 72 65 21 20 57 69 6c 6c 20  ites here! Will 
8910: 6e 65 76 65 72 20 67 65 74 20 68 65 72 65 20 75  never get here u
8920: 6e 6c 65 73 73 20 70 72 65 72 65 71 73 20 61 72  nless prereqs ar
8930: 65 0a 09 20 20 20 20 20 20 20 3b 3b 20 20 20 20  e..       ;;    
8940: 20 20 20 61 6c 72 65 61 64 79 20 6d 65 74 2e 0a     already met..
8950: 09 20 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74  .       (if (not
8960: 20 28 6c 61 75 6e 63 68 2d 74 65 73 74 20 23 66   (launch-test #f
8970: 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20   run-id runname 
8980: 74 65 73 74 2d 63 6f 6e 66 20 6b 65 79 76 61 6c  test-conf keyval
8990: 6c 73 74 20 74 65 73 74 2d 6e 61 6d 65 20 74 65  lst test-name te
89a0: 73 74 2d 70 61 74 68 20 69 74 65 6d 64 61 74 20  st-path itemdat 
89b0: 66 6c 61 67 73 29 29 0a 09 09 20 20 20 28 62 65  flags))...   (be
89c0: 67 69 6e 0a 09 09 20 20 20 20 20 28 70 72 69 6e  gin...     (prin
89d0: 74 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64  t "ERROR: Failed
89e0: 20 74 6f 20 6c 61 75 6e 63 68 20 74 68 65 20 74   to launch the t
89f0: 65 73 74 2e 20 45 78 69 74 69 6e 67 20 61 73 20  est. Exiting as 
8a00: 73 6f 6f 6e 20 61 73 20 70 6f 73 73 69 62 6c 65  soon as possible
8a10: 22 29 0a 09 09 20 20 20 20 20 28 73 65 74 21 20  ")...     (set! 
8a20: 2a 67 6c 6f 62 61 6c 65 78 69 74 73 74 61 74 75  *globalexitstatu
8a30: 73 2a 20 31 29 20 3b 3b 20 0a 09 09 20 20 20 20  s* 1) ;; ...    
8a40: 20 28 70 72 6f 63 65 73 73 2d 73 69 67 6e 61 6c   (process-signal
8a50: 20 28 63 75 72 72 65 6e 74 2d 70 72 6f 63 65 73   (current-proces
8a60: 73 2d 69 64 29 20 73 69 67 6e 61 6c 2f 6b 69 6c  s-id) signal/kil
8a70: 6c 29 29 29 29 29 29 0a 09 28 28 4b 49 4c 4c 45  l))))))..((KILLE
8a80: 44 29 20 0a 09 20 28 64 65 62 75 67 3a 70 72 69  D) .. (debug:pri
8a90: 6e 74 20 31 20 22 4e 4f 54 45 3a 20 22 20 6e 65  nt 1 "NOTE: " ne
8aa0: 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 73  w-test-name " is
8ab0: 20 61 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e 67   already running
8ac0: 20 6f 72 20 77 61 73 20 65 78 70 6c 69 63 74 6c   or was explictl
8ad0: 79 20 6b 69 6c 6c 65 64 2c 20 75 73 65 20 2d 66  y killed, use -f
8ae0: 6f 72 63 65 20 74 6f 20 6c 61 75 6e 63 68 20 69  orce to launch i
8af0: 74 2e 22 29 29 0a 09 28 28 4c 41 55 4e 43 48 45  t."))..((LAUNCHE
8b00: 44 20 52 45 4d 4f 54 45 48 4f 53 54 53 54 41 52  D REMOTEHOSTSTAR
8b10: 54 20 52 55 4e 4e 49 4e 47 29 20 20 0a 09 20 28  T RUNNING)  .. (
8b20: 69 66 20 28 3e 20 28 2d 20 28 63 75 72 72 65 6e  if (> (- (curren
8b30: 74 2d 73 65 63 6f 6e 64 73 29 28 2b 20 28 64 62  t-seconds)(+ (db
8b40: 3a 74 65 73 74 2d 67 65 74 2d 65 76 65 6e 74 5f  :test-get-event_
8b50: 74 69 6d 65 20 74 65 73 74 64 61 74 29 0a 09 09  time testdat)...
8b60: 09 09 20 20 20 20 20 20 20 28 64 62 3a 74 65 73  ..       (db:tes
8b70: 74 2d 67 65 74 2d 72 75 6e 5f 64 75 72 61 74 69  t-get-run_durati
8b80: 6f 6e 20 74 65 73 74 64 61 74 29 29 29 0a 09 09  on testdat)))...
8b90: 36 30 30 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f 20  600) ;; i.e. no 
8ba0: 75 70 64 61 74 65 20 66 6f 72 20 6d 6f 72 65 20  update for more 
8bb0: 74 68 61 6e 20 36 30 30 20 73 65 63 6f 6e 64 73  than 600 seconds
8bc0: 0a 09 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20  ..     (begin.. 
8bd0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
8be0: 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 54  nt 0 "WARNING: T
8bf0: 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20  est " test-name 
8c00: 22 20 61 70 70 65 61 72 73 20 74 6f 20 62 65 20  " appears to be 
8c10: 64 65 61 64 2e 20 46 6f 72 63 69 6e 67 20 69 74  dead. Forcing it
8c20: 20 74 6f 20 73 74 61 74 65 20 49 4e 43 4f 4d 50   to state INCOMP
8c30: 4c 45 54 45 20 61 6e 64 20 73 74 61 74 75 73 20  LETE and status 
8c40: 53 54 55 43 4b 2f 44 45 41 44 22 29 0a 09 20 20  STUCK/DEAD")..  
8c50: 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74       (tests:test
8c60: 2d 73 65 74 2d 73 74 61 74 75 73 21 20 74 65 73  -set-status! tes
8c70: 74 2d 69 64 20 22 49 4e 43 4f 4d 50 4c 45 54 45  t-id "INCOMPLETE
8c80: 22 20 22 53 54 55 43 4b 2f 44 45 41 44 22 20 22  " "STUCK/DEAD" "
8c90: 54 65 73 74 20 69 73 20 73 74 75 63 6b 20 6f 72  Test is stuck or
8ca0: 20 64 65 61 64 22 20 23 66 29 29 0a 09 20 20 20   dead" #f))..   
8cb0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32    (debug:print 2
8cc0: 20 22 4e 4f 54 45 3a 20 22 20 74 65 73 74 2d 6e   "NOTE: " test-n
8cd0: 61 6d 65 20 22 20 69 73 20 61 6c 72 65 61 64 79  ame " is already
8ce0: 20 72 75 6e 6e 69 6e 67 22 29 29 29 0a 09 28 65   running")))..(e
8cf0: 6c 73 65 20 20 20 20 20 20 20 28 64 65 62 75 67  lse       (debug
8d00: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a  :print 0 "ERROR:
8d10: 20 46 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63   Failed to launc
8d20: 68 20 74 65 73 74 20 22 20 6e 65 77 2d 74 65 73  h test " new-tes
8d30: 74 2d 6e 61 6d 65 20 22 2e 20 55 6e 72 65 63 6f  t-name ". Unreco
8d40: 67 6e 69 73 65 64 20 73 74 61 74 65 20 22 20 28  gnised state " (
8d50: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74  test:get-state t
8d60: 65 73 74 64 61 74 29 29 29 29 29 29 29 0a 0a 3b  estdat)))))))..;
8d70: 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;===============
8d80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8d90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8da0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8db0: 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 45 4e 44 20 4f  =======.;; END O
8dc0: 46 20 4e 45 57 20 53 54 55 46 46 0a 3b 3b 3d 3d  F NEW STUFF.;;==
8dd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8de0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8df0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8e00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8e10: 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65 20 28 67  ====..(define (g
8e20: 65 74 2d 64 69 72 2d 75 70 2d 6e 20 64 69 72 20  et-dir-up-n dir 
8e30: 2e 20 70 61 72 61 6d 73 29 20 0a 20 20 28 6c 65  . params) .  (le
8e40: 74 20 28 28 64 70 61 72 74 73 20 20 28 73 74 72  t ((dparts  (str
8e50: 69 6e 67 2d 73 70 6c 69 74 20 64 69 72 20 22 2f  ing-split dir "/
8e60: 22 29 29 0a 09 28 63 6f 75 6e 74 20 20 20 28 69  "))..(count   (i
8e70: 66 20 28 6e 75 6c 6c 3f 20 70 61 72 61 6d 73 29  f (null? params)
8e80: 20 31 20 28 63 61 72 20 70 61 72 61 6d 73 29 29   1 (car params))
8e90: 29 29 0a 20 20 20 20 28 63 6f 6e 63 20 22 2f 22  )).    (conc "/"
8ea0: 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70   (string-intersp
8eb0: 65 72 73 65 20 0a 09 20 20 20 20 20 20 20 28 74  erse ..       (t
8ec0: 61 6b 65 20 64 70 61 72 74 73 20 28 2d 20 28 6c  ake dparts (- (l
8ed0: 65 6e 67 74 68 20 64 70 61 72 74 73 29 20 63 6f  ength dparts) co
8ee0: 75 6e 74 29 29 0a 09 20 20 20 20 20 20 20 22 2f  unt))..       "/
8ef0: 22 29 29 29 29 0a 3b 3b 20 52 65 6d 6f 76 65 20  ")))).;; Remove 
8f00: 72 75 6e 73 0a 3b 3b 20 66 69 65 6c 64 73 20 61  runs.;; fields a
8f10: 72 65 20 70 61 73 73 69 6e 67 20 69 6e 20 74 68  re passing in th
8f20: 72 6f 75 67 68 20 0a 3b 3b 20 61 63 74 69 6f 6e  rough .;; action
8f30: 3a 0a 3b 3b 20 20 20 20 27 72 65 6d 6f 76 65 2d  :.;;    'remove-
8f40: 72 75 6e 73 0a 3b 3b 20 20 20 20 27 73 65 74 2d  runs.;;    'set-
8f50: 73 74 61 74 65 2d 73 74 61 74 75 73 0a 3b 3b 0a  state-status.;;.
8f60: 3b 3b 20 4e 42 2f 2f 20 73 68 6f 75 6c 64 20 70  ;; NB// should p
8f70: 61 73 73 20 69 6e 20 6b 65 79 73 3f 0a 3b 3b 0a  ass in keys?.;;.
8f80: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 6f 70  (define (runs:op
8f90: 65 72 61 74 65 2d 6f 6e 20 61 63 74 69 6f 6e 20  erate-on action 
8fa0: 72 75 6e 6e 61 6d 65 70 61 74 74 20 74 65 73 74  runnamepatt test
8fb0: 70 61 74 74 20 23 21 6b 65 79 20 28 73 74 61 74  patt #!key (stat
8fc0: 65 20 23 66 29 28 73 74 61 74 75 73 20 23 66 29  e #f)(status #f)
8fd0: 28 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75  (new-state-statu
8fe0: 73 20 23 66 29 29 0a 20 20 28 63 6f 6d 6d 6f 6e  s #f)).  (common
8ff0: 3a 63 6c 65 61 72 2d 63 61 63 68 65 73 29 20 3b  :clear-caches) ;
9000: 3b 20 63 6c 65 61 72 20 61 6c 6c 20 63 61 63 68  ; clear all cach
9010: 65 73 0a 20 20 28 6c 65 74 2a 20 28 28 64 62 20  es.  (let* ((db 
9020: 20 20 20 20 20 20 20 20 20 20 23 66 29 0a 09 20            #f).. 
9030: 28 6b 65 79 73 20 20 20 20 20 20 20 20 20 28 6f  (keys         (o
9040: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62  pen-run-close db
9050: 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09  :get-keys db))..
9060: 20 28 72 75 6e 64 61 74 20 20 20 20 20 20 20 28   (rundat       (
9070: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72  open-run-close r
9080: 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d  uns:get-runs-by-
9090: 70 61 74 74 20 64 62 20 6b 65 79 73 20 72 75 6e  patt db keys run
90a0: 6e 61 6d 65 70 61 74 74 29 29 0a 09 20 28 68 65  namepatt)).. (he
90b0: 61 64 65 72 20 20 20 20 20 20 20 28 76 65 63 74  ader       (vect
90c0: 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 30 29  or-ref rundat 0)
90d0: 29 0a 09 20 28 72 75 6e 73 20 20 20 20 20 20 20  ).. (runs       
90e0: 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75    (vector-ref ru
90f0: 6e 64 61 74 20 31 29 29 0a 09 20 28 73 74 61 74  ndat 1)).. (stat
9100: 65 73 20 20 20 20 20 20 20 28 69 66 20 73 74 61  es       (if sta
9110: 74 65 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69  te  (string-spli
9120: 74 20 73 74 61 74 65 20 20 22 2c 22 29 20 27 28  t state  ",") '(
9130: 29 29 29 0a 09 20 28 73 74 61 74 75 73 65 73 20  ))).. (statuses 
9140: 20 20 20 20 28 69 66 20 73 74 61 74 75 73 20 28      (if status (
9150: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 73 74 61  string-split sta
9160: 74 75 73 20 22 2c 22 29 20 27 28 29 29 29 0a 09  tus ",") '()))..
9170: 20 28 73 74 61 74 65 2d 73 74 61 74 75 73 20 28   (state-status (
9180: 69 66 20 28 73 74 72 69 6e 67 3f 20 6e 65 77 2d  if (string? new-
9190: 73 74 61 74 65 2d 73 74 61 74 75 73 29 20 28 73  state-status) (s
91a0: 74 72 69 6e 67 2d 73 70 6c 69 74 20 6e 65 77 2d  tring-split new-
91b0: 73 74 61 74 65 2d 73 74 61 74 75 73 20 22 2c 22  state-status ","
91c0: 29 20 27 28 23 66 20 23 66 29 29 29 29 0a 20 20  ) '(#f #f)))).  
91d0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69    (debug:print-i
91e0: 6e 66 6f 20 34 20 22 72 75 6e 73 3a 6f 70 65 72  nfo 4 "runs:oper
91f0: 61 74 65 2d 6f 6e 20 3d 3e 20 48 65 61 64 65 72  ate-on => Header
9200: 3a 20 22 20 68 65 61 64 65 72 20 22 20 61 63 74  : " header " act
9210: 69 6f 6e 3a 20 22 20 61 63 74 69 6f 6e 20 22 20  ion: " action " 
9220: 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73  new-state-status
9230: 3a 20 22 20 6e 65 77 2d 73 74 61 74 65 2d 73 74  : " new-state-st
9240: 61 74 75 73 29 0a 20 20 20 20 28 69 66 20 28 3e  atus).    (if (>
9250: 20 32 20 28 6c 65 6e 67 74 68 20 73 74 61 74 65   2 (length state
9260: 2d 73 74 61 74 75 73 29 29 0a 09 28 62 65 67 69  -status))..(begi
9270: 6e 0a 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e  n..  (debug:prin
9280: 74 20 30 20 22 45 52 52 4f 52 3a 20 74 68 65 20  t 0 "ERROR: the 
9290: 70 61 72 61 6d 65 74 65 72 20 74 6f 20 2d 73 65  parameter to -se
92a0: 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73 20 69  t-state-status i
92b0: 73 20 61 20 63 6f 6d 6d 61 20 64 65 6c 69 6d 69  s a comma delimi
92c0: 74 65 64 20 73 74 72 69 6e 67 2e 20 45 2e 67 2e  ted string. E.g.
92d0: 20 43 4f 4d 50 4c 45 54 45 44 2c 46 41 49 4c 22   COMPLETED,FAIL"
92e0: 29 0a 09 20 20 28 65 78 69 74 29 29 29 0a 20 20  )..  (exit))).  
92f0: 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 20    (for-each.    
9300: 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a 20   (lambda (run). 
9310: 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 75 6e        (let ((run
9320: 6b 65 79 20 28 73 74 72 69 6e 67 2d 69 6e 74 65  key (string-inte
9330: 72 73 70 65 72 73 65 20 28 6d 61 70 20 28 6c 61  rsperse (map (la
9340: 6d 62 64 61 20 28 6b 29 0a 09 09 09 09 09 09 28  mbda (k).......(
9350: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d  db:get-value-by-
9360: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65  header run heade
9370: 72 20 28 76 65 63 74 6f 72 2d 72 65 66 20 6b 20  r (vector-ref k 
9380: 30 29 29 29 20 6b 65 79 73 29 20 22 2f 22 29 29  0))) keys) "/"))
9390: 0a 09 20 20 20 20 20 28 64 69 72 73 2d 74 6f 2d  ..     (dirs-to-
93a0: 72 65 6d 6f 76 65 20 28 6d 61 6b 65 2d 68 61 73  remove (make-has
93b0: 68 2d 74 61 62 6c 65 29 29 29 0a 09 20 28 6c 65  h-table))).. (le
93c0: 74 2a 20 28 28 72 75 6e 2d 69 64 20 20 20 20 28  t* ((run-id    (
93d0: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d  db:get-value-by-
93e0: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65  header run heade
93f0: 72 20 22 69 64 22 29 29 0a 09 09 28 72 75 6e 2d  r "id"))...(run-
9400: 73 74 61 74 65 20 28 64 62 3a 67 65 74 2d 76 61  state (db:get-va
9410: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75  lue-by-header ru
9420: 6e 20 68 65 61 64 65 72 20 22 73 74 61 74 65 22  n header "state"
9430: 29 29 0a 09 09 28 74 65 73 74 73 20 20 20 20 20  ))...(tests     
9440: 28 69 66 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f  (if (not (equal?
9450: 20 72 75 6e 2d 73 74 61 74 65 20 22 6c 6f 63 6b   run-state "lock
9460: 65 64 22 29 29 0a 09 09 09 20 20 20 20 20 20 20  ed"))....       
9470: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
9480: 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72  db:get-tests-for
9490: 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 0a 09  -run db run-id..
94a0: 09 09 09 09 09 20 20 20 20 20 20 74 65 73 74 70  .....      testp
94b0: 61 74 74 20 73 74 61 74 65 73 20 73 74 61 74 75  att states statu
94c0: 73 65 73 0a 09 09 09 09 09 09 20 20 20 20 20 20  ses.......      
94d0: 6e 6f 74 2d 69 6e 3a 20 20 23 66 0a 09 09 09 09  not-in:  #f.....
94e0: 09 09 20 20 20 20 20 20 73 6f 72 74 2d 62 79 3a  ..      sort-by:
94f0: 20 28 63 61 73 65 20 61 63 74 69 6f 6e 0a 09 09   (case action...
9500: 09 09 09 09 09 09 20 28 28 72 65 6d 6f 76 65 2d  ...... ((remove-
9510: 72 75 6e 73 29 20 27 72 75 6e 64 69 72 29 0a 09  runs) 'rundir)..
9520: 09 09 09 09 09 09 09 20 28 65 6c 73 65 20 20 20  ....... (else   
9530: 20 20 20 20 20 20 20 27 65 76 65 6e 74 5f 74 69         'event_ti
9540: 6d 65 29 29 29 0a 09 09 09 20 20 20 20 20 20 20  me)))....       
9550: 27 28 29 29 29 0a 09 09 28 6c 61 73 74 74 70 61  '()))...(lasttpa
9560: 74 68 20 22 2f 64 6f 65 73 2f 6e 6f 74 2f 65 78  th "/does/not/ex
9570: 69 73 74 2f 49 2f 68 6f 70 65 22 29 29 0a 09 20  ist/I/hope")).. 
9580: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69    (debug:print-i
9590: 6e 66 6f 20 34 20 22 72 75 6e 73 3a 6f 70 65 72  nfo 4 "runs:oper
95a0: 61 74 65 2d 6f 6e 20 72 75 6e 3d 22 20 72 75 6e  ate-on run=" run
95b0: 20 22 2c 20 68 65 61 64 65 72 3d 22 20 68 65 61   ", header=" hea
95c0: 64 65 72 29 0a 09 20 20 20 28 69 66 20 28 6e 6f  der)..   (if (no
95d0: 74 20 28 6e 75 6c 6c 3f 20 74 65 73 74 73 29 29  t (null? tests))
95e0: 0a 09 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a  ..       (begin.
95f0: 09 09 20 28 63 61 73 65 20 61 63 74 69 6f 6e 0a  .. (case action.
9600: 09 09 20 20 20 28 28 72 65 6d 6f 76 65 2d 72 75  ..   ((remove-ru
9610: 6e 73 29 0a 09 09 20 20 20 20 28 64 65 62 75 67  ns)...    (debug
9620: 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69  :print 1 "Removi
9630: 6e 67 20 74 65 73 74 73 20 66 6f 72 20 72 75 6e  ng tests for run
9640: 3a 20 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28  : " runkey " " (
9650: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d  db:get-value-by-
9660: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65  header run heade
9670: 72 20 22 72 75 6e 6e 61 6d 65 22 29 29 29 0a 09  r "runname")))..
9680: 09 20 20 20 28 28 73 65 74 2d 73 74 61 74 65 2d  .   ((set-state-
9690: 73 74 61 74 75 73 29 0a 09 09 20 20 20 20 28 64  status)...    (d
96a0: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4d 6f  ebug:print 1 "Mo
96b0: 64 69 66 79 69 6e 67 20 73 74 61 74 65 20 61 6e  difying state an
96c0: 64 20 73 74 61 75 73 20 66 6f 72 20 74 65 73 74  d staus for test
96d0: 73 20 66 6f 72 20 72 75 6e 3a 20 22 20 72 75 6e  s for run: " run
96e0: 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d  key " " (db:get-
96f0: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20  value-by-header 
9700: 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e  run header "runn
9710: 61 6d 65 22 29 29 29 0a 09 09 20 20 20 28 28 70  ame")))...   ((p
9720: 72 69 6e 74 2d 72 75 6e 29 0a 09 09 20 20 20 20  rint-run)...    
9730: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22  (debug:print 1 "
9740: 50 72 69 6e 74 69 6e 67 20 69 6e 66 6f 20 66 6f  Printing info fo
9750: 72 20 72 75 6e 20 22 20 72 75 6e 6b 65 79 20 22  r run " runkey "
9760: 2c 20 72 75 6e 3d 22 20 72 75 6e 20 22 2c 20 74  , run=" run ", t
9770: 65 73 74 73 3d 22 20 74 65 73 74 73 20 22 2c 20  ests=" tests ", 
9780: 68 65 61 64 65 72 3d 22 20 68 65 61 64 65 72 29  header=" header)
9790: 0a 09 09 20 20 20 20 61 63 74 69 6f 6e 29 0a 09  ...    action)..
97a0: 09 20 20 20 28 65 6c 73 65 0a 09 09 20 20 20 20  .   (else...    
97b0: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
97c0: 6f 20 30 20 22 61 63 74 69 6f 6e 20 6e 6f 74 20  o 0 "action not 
97d0: 72 65 63 6f 67 6e 69 73 65 64 20 22 20 61 63 74  recognised " act
97e0: 69 6f 6e 29 29 29 0a 09 09 20 28 66 6f 72 2d 65  ion)))... (for-e
97f0: 61 63 68 0a 09 09 20 20 28 6c 61 6d 62 64 61 20  ach...  (lambda 
9800: 28 74 65 73 74 29 0a 09 09 20 20 20 20 28 6c 65  (test)...    (le
9810: 74 2a 20 28 28 69 74 65 6d 2d 70 61 74 68 20 28  t* ((item-path (
9820: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d  db:test-get-item
9830: 2d 70 61 74 68 20 74 65 73 74 29 29 0a 09 09 09  -path test))....
9840: 20 20 20 28 74 65 73 74 2d 6e 61 6d 65 20 28 64     (test-name (d
9850: 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e  b:test-get-testn
9860: 61 6d 65 20 74 65 73 74 29 29 0a 09 09 09 20 20  ame test))....  
9870: 20 28 72 75 6e 2d 64 69 72 20 20 20 28 64 62 3a   (run-dir   (db:
9880: 74 65 73 74 2d 67 65 74 2d 72 75 6e 64 69 72 20  test-get-rundir 
9890: 74 65 73 74 29 29 20 20 20 20 3b 3b 20 72 75 6e  test))    ;; run
98a0: 20 64 69 72 20 69 73 20 66 72 6f 6d 20 74 68 65   dir is from the
98b0: 20 6c 69 6e 6b 20 74 72 65 65 0a 09 09 09 20 20   link tree....  
98c0: 20 28 72 65 61 6c 2d 64 69 72 20 20 28 69 66 20   (real-dir  (if 
98d0: 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 75  (file-exists? ru
98e0: 6e 2d 64 69 72 29 0a 09 09 09 09 09 20 20 28 72  n-dir)......  (r
98f0: 65 73 6f 6c 76 65 2d 70 61 74 68 6e 61 6d 65 20  esolve-pathname 
9900: 72 75 6e 2d 64 69 72 29 0a 09 09 09 09 09 20 20  run-dir)......  
9910: 23 66 29 29 0a 09 09 09 20 20 20 28 74 65 73 74  #f))....   (test
9920: 2d 69 64 20 20 20 28 64 62 3a 74 65 73 74 2d 67  -id   (db:test-g
9930: 65 74 2d 69 64 20 74 65 73 74 29 29 29 0a 09 09  et-id test)))...
9940: 20 20 20 20 20 20 3b 3b 20 20 20 28 74 64 62 20        ;;   (tdb 
9950: 20 20 20 20 20 20 28 64 62 3a 6f 70 65 6e 2d 74        (db:open-t
9960: 65 73 74 2d 64 62 20 72 75 6e 2d 64 69 72 29 29  est-db run-dir))
9970: 29 0a 09 09 20 20 20 20 20 20 28 64 65 62 75 67  )...      (debug
9980: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 74  :print-info 4 "t
9990: 65 73 74 3d 22 20 74 65 73 74 29 20 3b 3b 20 20  est=" test) ;;  
99a0: 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d   " (db:test-get-
99b0: 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29 20 22  testname test) "
99c0: 20 69 64 3a 20 22 20 28 64 62 3a 74 65 73 74 2d   id: " (db:test-
99d0: 67 65 74 2d 69 64 20 74 65 73 74 29 20 22 20 22  get-id test) " "
99e0: 20 69 74 65 6d 2d 70 61 74 68 20 22 20 61 63 74   item-path " act
99f0: 69 6f 6e 3a 20 22 20 61 63 74 69 6f 6e 29 0a 09  ion: " action)..
9a00: 09 20 20 20 20 20 20 28 63 61 73 65 20 61 63 74  .      (case act
9a10: 69 6f 6e 0a 09 09 09 28 28 72 65 6d 6f 76 65 2d  ion....((remove-
9a20: 72 75 6e 73 29 20 3b 3b 20 74 68 65 20 74 64 62  runs) ;; the tdb
9a30: 20 69 73 20 66 6f 72 20 66 75 74 75 72 65 20 70   is for future p
9a40: 6f 73 73 69 62 6c 65 2e 20 0a 09 09 09 20 28 6f  ossible. .... (o
9a50: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62  pen-run-close db
9a60: 3a 64 65 6c 65 74 65 2d 74 65 73 74 2d 72 65 63  :delete-test-rec
9a70: 6f 72 64 73 20 64 62 20 23 66 20 28 64 62 3a 74  ords db #f (db:t
9a80: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29  est-get-id test)
9a90: 29 0a 09 09 09 20 28 64 65 62 75 67 3a 70 72 69  ).... (debug:pri
9aa0: 6e 74 2d 69 6e 66 6f 20 31 20 22 41 74 74 65 6d  nt-info 1 "Attem
9ab0: 70 74 69 6e 67 20 74 6f 20 72 65 6d 6f 76 65 20  pting to remove 
9ac0: 22 20 28 69 66 20 72 65 61 6c 2d 64 69 72 20 28  " (if real-dir (
9ad0: 63 6f 6e 63 20 22 20 64 69 72 20 22 20 72 65 61  conc " dir " rea
9ae0: 6c 2d 64 69 72 20 22 20 61 6e 64 20 22 29 20 22  l-dir " and ") "
9af0: 22 29 20 22 20 6c 69 6e 6b 20 22 20 72 75 6e 2d  ") " link " run-
9b00: 64 69 72 29 0a 09 09 09 20 28 69 66 20 28 61 6e  dir).... (if (an
9b10: 64 20 72 65 61 6c 2d 64 69 72 20 0a 09 09 09 09  d real-dir .....
9b20: 20 20 28 3e 20 28 73 74 72 69 6e 67 2d 6c 65 6e    (> (string-len
9b30: 67 74 68 20 72 65 61 6c 2d 64 69 72 29 20 35 29  gth real-dir) 5)
9b40: 0a 09 09 09 09 20 20 28 66 69 6c 65 2d 65 78 69  .....  (file-exi
9b50: 73 74 73 3f 20 72 65 61 6c 2d 64 69 72 29 29 20  sts? real-dir)) 
9b60: 3b 3b 20 62 61 64 20 68 65 75 72 69 73 74 69 63  ;; bad heuristic
9b70: 20 62 75 74 20 73 68 6f 75 6c 64 20 70 72 65 76   but should prev
9b80: 65 6e 74 20 2f 74 6d 70 20 2f 68 6f 6d 65 20 65  ent /tmp /home e
9b90: 74 63 2e 0a 09 09 09 20 20 20 20 20 28 62 65 67  tc.....     (beg
9ba0: 69 6e 20 3b 3b 20 6c 65 74 2a 20 28 28 72 65 61  in ;; let* ((rea
9bb0: 6c 70 61 74 68 20 28 72 65 73 6f 6c 76 65 2d 70  lpath (resolve-p
9bc0: 61 74 68 6e 61 6d 65 20 72 75 6e 2d 64 69 72 29  athname run-dir)
9bd0: 29 29 0a 09 09 09 20 20 20 20 20 20 20 28 64 65  ))....       (de
9be0: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31  bug:print-info 1
9bf0: 20 22 52 65 63 75 72 73 69 76 65 6c 79 20 72 65   "Recursively re
9c00: 6d 6f 76 69 6e 67 20 22 20 72 65 61 6c 2d 64 69  moving " real-di
9c10: 72 29 0a 09 09 09 20 20 20 20 20 20 20 28 69 66  r)....       (if
9c20: 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 72   (file-exists? r
9c30: 65 61 6c 2d 64 69 72 29 0a 09 09 09 09 20 20 20  eal-dir).....   
9c40: 28 69 66 20 28 3e 20 28 73 79 73 74 65 6d 20 28  (if (> (system (
9c50: 63 6f 6e 63 20 22 72 6d 20 2d 72 66 20 22 20 72  conc "rm -rf " r
9c60: 65 61 6c 2d 64 69 72 29 29 20 30 29 0a 09 09 09  eal-dir)) 0)....
9c70: 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70  .       (debug:p
9c80: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 54  rint 0 "ERROR: T
9c90: 68 65 72 65 20 77 61 73 20 61 20 70 72 6f 62 6c  here was a probl
9ca0: 65 6d 20 72 65 6d 6f 76 69 6e 67 20 22 20 72 65  em removing " re
9cb0: 61 6c 2d 64 69 72 20 22 20 77 69 74 68 20 72 6d  al-dir " with rm
9cc0: 20 2d 66 22 29 29 0a 09 09 09 09 20 20 20 28 64   -f")).....   (d
9cd0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41  ebug:print 0 "WA
9ce0: 52 4e 49 4e 47 3a 20 74 65 73 74 20 64 69 72 20  RNING: test dir 
9cf0: 22 20 72 65 61 6c 2d 64 69 72 20 22 20 61 70 70  " real-dir " app
9d00: 65 61 72 73 20 74 6f 20 6e 6f 74 20 65 78 69 73  ears to not exis
9d10: 74 20 6f 72 20 69 73 20 6e 6f 74 20 72 65 61 64  t or is not read
9d20: 61 62 6c 65 22 29 29 29 0a 09 09 09 20 20 20 20  able")))....    
9d30: 20 28 69 66 20 72 65 61 6c 2d 64 69 72 20 0a 09   (if real-dir ..
9d40: 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ... (debug:print
9d50: 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 64 69 72   0 "WARNING: dir
9d60: 65 63 74 6f 72 79 20 22 20 72 65 61 6c 2d 64 69  ectory " real-di
9d70: 72 20 22 20 64 6f 65 73 20 6e 6f 74 20 65 78 69  r " does not exi
9d80: 73 74 22 29 0a 09 09 09 09 20 28 64 65 62 75 67  st")..... (debug
9d90: 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e  :print 0 "WARNIN
9da0: 47 3a 20 6e 6f 20 72 65 61 6c 20 64 69 72 65 63  G: no real direc
9db0: 74 6f 72 79 20 63 6f 72 72 6f 73 70 6f 6e 64 69  tory corrospondi
9dc0: 6e 67 20 74 6f 20 6c 69 6e 6b 20 22 20 72 75 6e  ng to link " run
9dd0: 2d 64 69 72 20 22 2c 20 6e 6f 74 68 69 6e 67 20  -dir ", nothing 
9de0: 64 6f 6e 65 22 29 29 29 0a 09 09 09 20 28 69 66  done"))).... (if
9df0: 20 28 73 79 6d 62 6f 6c 69 63 2d 6c 69 6e 6b 3f   (symbolic-link?
9e00: 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 20 20 20   run-dir)....   
9e10: 20 20 28 62 65 67 69 6e 0a 09 09 09 20 20 20 20    (begin....    
9e20: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d     (debug:print-
9e30: 69 6e 66 6f 20 31 20 22 52 65 6d 6f 76 69 6e 67  info 1 "Removing
9e40: 20 73 79 6d 6c 69 6e 6b 20 22 20 72 75 6e 2d 64   symlink " run-d
9e50: 69 72 29 0a 09 09 09 20 20 20 20 20 20 20 28 68  ir)....       (h
9e60: 61 6e 64 6c 65 2d 65 78 63 65 70 74 69 6f 6e 73  andle-exceptions
9e70: 0a 09 09 09 09 65 78 6e 0a 09 09 09 09 28 64 65  .....exn.....(de
9e80: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52  bug:print 0 "ERR
9e90: 4f 52 3a 20 20 46 61 69 6c 65 64 20 74 6f 20 72  OR:  Failed to r
9ea0: 65 6d 6f 76 65 20 73 79 6d 6c 69 6e 6b 20 22 20  emove symlink " 
9eb0: 72 75 6e 2d 64 69 72 20 28 28 63 6f 6e 64 69 74  run-dir ((condit
9ec0: 69 6f 6e 2d 70 72 6f 70 65 72 74 79 2d 61 63 63  ion-property-acc
9ed0: 65 73 73 6f 72 20 27 65 78 6e 20 27 6d 65 73 73  essor 'exn 'mess
9ee0: 61 67 65 29 20 65 78 6e 29 20 22 2c 20 61 74 74  age) exn) ", att
9ef0: 65 6d 70 74 69 6e 67 20 74 6f 20 63 6f 6e 74 69  empting to conti
9f00: 6e 75 65 22 29 0a 09 09 09 09 28 64 65 6c 65 74  nue").....(delet
9f10: 65 2d 66 69 6c 65 20 72 75 6e 2d 64 69 72 29 29  e-file run-dir))
9f20: 29 0a 09 09 09 20 20 20 20 20 28 69 66 20 28 64  )....     (if (d
9f30: 69 72 65 63 74 6f 72 79 3f 20 72 75 6e 2d 64 69  irectory? run-di
9f40: 72 29 0a 09 09 09 09 20 28 69 66 20 28 3e 20 28  r)..... (if (> (
9f50: 64 69 72 65 63 74 6f 72 79 2d 66 6f 6c 64 20 28  directory-fold (
9f60: 6c 61 6d 62 64 61 20 28 66 20 78 29 28 2b 20 31  lambda (f x)(+ 1
9f70: 20 78 29 29 20 30 20 72 75 6e 2d 64 69 72 29 20   x)) 0 run-dir) 
9f80: 30 29 0a 09 09 09 09 20 20 20 20 20 28 64 65 62  0).....     (deb
9f90: 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e  ug:print 0 "WARN
9fa0: 49 4e 47 3a 20 72 65 66 75 73 69 6e 67 20 74 6f  ING: refusing to
9fb0: 20 72 65 6d 6f 76 65 20 22 20 72 75 6e 2d 64 69   remove " run-di
9fc0: 72 20 22 20 61 73 20 69 74 20 69 73 20 6e 6f 74  r " as it is not
9fd0: 20 65 6d 70 74 79 22 29 0a 09 09 09 09 20 20 20   empty").....   
9fe0: 20 20 20 28 68 61 6e 64 6c 65 2d 65 78 63 65 70     (handle-excep
9ff0: 74 69 6f 6e 73 0a 09 09 09 09 20 20 20 20 20 20  tions.....      
a000: 20 65 78 6e 0a 09 09 09 09 20 20 20 20 20 20 20   exn.....       
a010: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
a020: 45 52 52 4f 52 3a 20 20 46 61 69 6c 65 64 20 74  ERROR:  Failed t
a030: 6f 20 72 65 6d 6f 76 65 20 64 69 72 65 63 74 6f  o remove directo
a040: 72 79 20 22 20 72 75 6e 2d 64 69 72 20 28 28 63  ry " run-dir ((c
a050: 6f 6e 64 69 74 69 6f 6e 2d 70 72 6f 70 65 72 74  ondition-propert
a060: 79 2d 61 63 63 65 73 73 6f 72 20 27 65 78 6e 20  y-accessor 'exn 
a070: 27 6d 65 73 73 61 67 65 29 20 65 78 6e 29 20 22  'message) exn) "
a080: 2c 20 61 74 74 65 6d 70 74 69 6e 67 20 74 6f 20  , attempting to 
a090: 63 6f 6e 74 69 6e 75 65 22 29 0a 09 09 09 09 20  continue")..... 
a0a0: 20 20 20 20 20 20 28 64 65 6c 65 74 65 2d 64 69        (delete-di
a0b0: 72 65 63 74 6f 72 79 20 72 75 6e 2d 64 69 72 29  rectory run-dir)
a0c0: 29 29 0a 09 09 09 09 20 28 69 66 20 72 75 6e 2d  ))..... (if run-
a0d0: 64 69 72 0a 09 09 09 09 20 20 20 20 20 28 64 65  dir.....     (de
a0e0: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52  bug:print 0 "WAR
a0f0: 4e 49 4e 47 3a 20 6e 6f 74 20 72 65 6d 6f 76 69  NING: not removi
a100: 6e 67 20 22 20 72 75 6e 2d 64 69 72 20 22 20 61  ng " run-dir " a
a110: 73 20 69 74 20 65 69 74 68 65 72 20 64 6f 65 73  s it either does
a120: 6e 27 74 20 65 78 69 73 74 20 6f 72 20 69 73 20  n't exist or is 
a130: 6e 6f 74 20 61 20 73 79 6d 6c 69 6e 6b 22 29 0a  not a symlink").
a140: 09 09 09 09 20 20 20 20 20 28 64 65 62 75 67 3a  ....     (debug:
a150: 70 72 69 6e 74 20 30 20 22 4e 4f 54 45 3a 20 74  print 0 "NOTE: t
a160: 68 65 20 72 75 6e 20 64 69 72 20 66 6f 72 20 74  he run dir for t
a170: 68 69 73 20 74 65 73 74 20 69 73 20 75 6e 64 65  his test is unde
a180: 66 69 6e 65 64 2e 20 54 65 73 74 20 6d 61 79 20  fined. Test may 
a190: 68 61 76 65 20 61 6c 72 65 61 64 79 20 62 65 65  have already bee
a1a0: 6e 20 64 65 6c 65 74 65 64 2e 22 29 29 0a 09 09  n deleted."))...
a1b0: 09 09 20 29 29 29 0a 09 09 09 28 28 73 65 74 2d  .. )))....((set-
a1c0: 73 74 61 74 65 2d 73 74 61 74 75 73 29 0a 09 09  state-status)...
a1d0: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69  . (debug:print-i
a1e0: 6e 66 6f 20 32 20 22 6e 65 77 20 73 74 61 74 65  nfo 2 "new state
a1f0: 20 22 20 28 63 61 72 20 73 74 61 74 65 2d 73 74   " (car state-st
a200: 61 74 75 73 29 20 22 2c 20 6e 65 77 20 73 74 61  atus) ", new sta
a210: 74 75 73 20 22 20 28 63 61 64 72 20 73 74 61 74  tus " (cadr stat
a220: 65 2d 73 74 61 74 75 73 29 29 0a 09 09 09 20 28  e-status)).... (
a230: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64  open-run-close d
a240: 62 3a 74 65 73 74 2d 73 65 74 2d 73 74 61 74 65  b:test-set-state
a250: 2d 73 74 61 74 75 73 2d 62 79 2d 69 64 20 64 62  -status-by-id db
a260: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64   (db:test-get-id
a270: 20 74 65 73 74 29 20 28 63 61 72 20 73 74 61 74   test) (car stat
a280: 65 2d 73 74 61 74 75 73 29 28 63 61 64 72 20 73  e-status)(cadr s
a290: 74 61 74 65 2d 73 74 61 74 75 73 29 20 23 66 29  tate-status) #f)
a2a0: 29 29 29 29 0a 09 09 20 20 28 73 6f 72 74 20 74  ))))...  (sort t
a2b0: 65 73 74 73 20 28 6c 61 6d 62 64 61 20 28 61 20  ests (lambda (a 
a2c0: 62 29 28 6c 65 74 20 28 28 64 69 72 61 20 28 64  b)(let ((dira (d
a2d0: 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 64 69  b:test-get-rundi
a2e0: 72 20 61 29 29 0a 09 09 09 09 09 09 20 28 64 69  r a))....... (di
a2f0: 72 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  rb (db:test-get-
a300: 72 75 6e 64 69 72 20 62 29 29 29 0a 09 09 09 09  rundir b))).....
a310: 09 20 20 20 20 20 28 69 66 20 28 61 6e 64 20 28  .     (if (and (
a320: 73 74 72 69 6e 67 3f 20 64 69 72 61 29 28 73 74  string? dira)(st
a330: 72 69 6e 67 3f 20 64 69 72 62 29 29 0a 09 09 09  ring? dirb))....
a340: 09 09 09 20 28 3e 20 28 73 74 72 69 6e 67 2d 6c  ... (> (string-l
a350: 65 6e 67 74 68 20 64 69 72 61 29 28 73 74 72 69  ength dira)(stri
a360: 6e 67 2d 6c 65 6e 67 74 68 20 64 69 72 62 29 29  ng-length dirb))
a370: 0a 09 09 09 09 09 09 20 23 66 29 29 29 29 29 29  ....... #f))))))
a380: 29 0a 09 20 20 20 3b 3b 20 72 65 6d 6f 76 65 20  )..   ;; remove 
a390: 74 68 65 20 72 75 6e 20 69 66 20 7a 65 72 6f 20  the run if zero 
a3a0: 74 65 73 74 73 20 72 65 6d 61 69 6e 0a 09 20 20  tests remain..  
a3b0: 20 28 69 66 20 28 65 71 3f 20 61 63 74 69 6f 6e   (if (eq? action
a3c0: 20 27 72 65 6d 6f 76 65 2d 72 75 6e 73 29 0a 09   'remove-runs)..
a3d0: 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 65         (let ((re
a3e0: 6d 74 65 73 74 73 20 28 6f 70 65 6e 2d 72 75 6e  mtests (open-run
a3f0: 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65  -close db:get-te
a400: 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28  sts-for-run db (
a410: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d  db:get-value-by-
a420: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65  header run heade
a430: 72 20 22 69 64 22 29 20 23 66 20 27 28 22 44 45  r "id") #f '("DE
a440: 4c 45 54 45 44 22 29 20 27 28 22 6e 2f 61 22 29  LETED") '("n/a")
a450: 20 6e 6f 74 2d 69 6e 3a 20 23 74 29 29 29 0a 09   not-in: #t)))..
a460: 09 20 28 69 66 20 28 6e 75 6c 6c 3f 20 72 65 6d  . (if (null? rem
a470: 74 65 73 74 73 29 20 3b 3b 20 6e 6f 20 6d 6f 72  tests) ;; no mor
a480: 65 20 74 65 73 74 73 20 72 65 6d 61 69 6e 69 6e  e tests remainin
a490: 67 0a 09 09 20 20 20 20 20 28 6c 65 74 2a 20 28  g...     (let* (
a4a0: 28 64 70 61 72 74 73 20 20 28 73 74 72 69 6e 67  (dparts  (string
a4b0: 2d 73 70 6c 69 74 20 6c 61 73 74 74 70 61 74 68  -split lasttpath
a4c0: 20 22 2f 22 29 29 0a 09 09 09 20 20 20 20 28 72   "/"))....    (r
a4d0: 75 6e 70 61 74 68 20 28 63 6f 6e 63 20 22 2f 22  unpath (conc "/"
a4e0: 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70   (string-intersp
a4f0: 65 72 73 65 20 0a 09 09 09 09 09 09 28 74 61 6b  erse .......(tak
a500: 65 20 64 70 61 72 74 73 20 28 2d 20 28 6c 65 6e  e dparts (- (len
a510: 67 74 68 20 64 70 61 72 74 73 29 20 31 29 29 0a  gth dparts) 1)).
a520: 09 09 09 09 09 09 22 2f 22 29 29 29 29 0a 09 09  ......"/"))))...
a530: 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72         (debug:pr
a540: 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20  int 1 "Removing 
a550: 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20  run: " runkey " 
a560: 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d  " (db:get-value-
a570: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65  by-header run he
a580: 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 20  ader "runname") 
a590: 22 20 61 6e 64 20 72 65 6c 61 74 65 64 20 72 65  " and related re
a5a0: 63 6f 72 64 22 29 0a 09 09 20 20 20 20 20 20 20  cord")...       
a5b0: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
a5c0: 64 62 3a 64 65 6c 65 74 65 2d 72 75 6e 20 64 62  db:delete-run db
a5d0: 20 72 75 6e 2d 69 64 29 0a 09 09 20 20 20 20 20   run-id)...     
a5e0: 20 20 3b 3b 20 54 68 69 73 20 69 73 20 61 20 70    ;; This is a p
a5f0: 72 65 74 74 79 20 67 6f 6f 64 20 70 6c 61 63 65  retty good place
a600: 20 74 6f 20 70 75 72 67 65 20 6f 6c 64 20 44 45   to purge old DE
a610: 4c 45 54 45 44 20 74 65 73 74 73 0a 09 09 20 20  LETED tests...  
a620: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
a630: 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 2d 74  lose db:delete-t
a640: 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20  ests-for-run db 
a650: 72 75 6e 2d 69 64 29 0a 09 09 20 20 20 20 20 20  run-id)...      
a660: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
a670: 20 64 62 3a 64 65 6c 65 74 65 2d 6f 6c 64 2d 64   db:delete-old-d
a680: 65 6c 65 74 65 64 2d 74 65 73 74 2d 72 65 63 6f  eleted-test-reco
a690: 72 64 73 20 64 62 29 0a 09 09 20 20 20 20 20 20  rds db)...      
a6a0: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
a6b0: 20 64 62 3a 73 65 74 2d 76 61 72 20 64 62 20 22   db:set-var db "
a6c0: 44 45 4c 45 54 45 44 5f 54 45 53 54 53 22 20 28  DELETED_TESTS" (
a6d0: 63 75 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73 29  current-seconds)
a6e0: 29 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 6e 65  )...       ;; ne
a6f0: 65 64 20 74 6f 20 66 69 67 75 72 65 20 6f 75 74  ed to figure out
a700: 20 74 68 65 20 70 61 74 68 20 74 6f 20 74 68 65   the path to the
a710: 20 72 75 6e 20 64 69 72 20 61 6e 64 20 72 65 6d   run dir and rem
a720: 6f 76 65 20 69 74 20 69 66 20 65 6d 70 74 79 0a  ove it if empty.
a730: 09 09 20 20 20 20 20 20 20 3b 3b 20 20 20 20 28  ..       ;;    (
a740: 69 66 20 28 6e 75 6c 6c 3f 20 28 67 6c 6f 62 20  if (null? (glob 
a750: 28 63 6f 6e 63 20 72 75 6e 70 61 74 68 20 22 2f  (conc runpath "/
a760: 2a 22 29 29 29 0a 09 09 20 20 20 20 20 20 20 3b  *")))...       ;
a770: 3b 20 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a  ;        (begin.
a780: 09 09 20 20 20 20 20 20 20 3b 3b 20 09 20 28 64  ..       ;; . (d
a790: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65  ebug:print 1 "Re
a7a0: 6d 6f 76 69 6e 67 20 72 75 6e 20 64 69 72 20 22  moving run dir "
a7b0: 20 72 75 6e 70 61 74 68 29 0a 09 09 20 20 20 20   runpath)...    
a7c0: 20 20 20 3b 3b 20 09 20 28 73 79 73 74 65 6d 20     ;; . (system 
a7d0: 28 63 6f 6e 63 20 22 72 6d 64 69 72 20 2d 70 20  (conc "rmdir -p 
a7e0: 22 20 72 75 6e 70 61 74 68 29 29 29 29 0a 09 09  " runpath))))...
a7f0: 20 20 20 20 20 20 20 29 29 29 29 29 0a 09 20 29         ))))).. )
a800: 29 0a 20 20 20 20 20 72 75 6e 73 29 29 0a 20 20  ).     runs)).  
a810: 23 74 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d  #t)..;;=========
a820: 3d 3d 3d 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 0a 3b 3b  =============.;;
a860: 20 52 6f 75 74 69 6e 65 73 20 66 6f 72 20 6d 61   Routines for ma
a870: 6e 69 70 75 6c 61 74 69 6e 67 20 72 75 6e 73 0a  nipulating runs.
a880: 3b 3b 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 3d 3d 0a 0a 3b 3b 20 53 69 6e  ========..;; Sin
a8d0: 63 65 20 6d 61 6e 79 20 63 61 6c 6c 73 20 74 6f  ce many calls to
a8e0: 20 61 20 72 75 6e 20 72 65 71 75 69 72 65 20 70   a run require p
a8f0: 72 65 74 74 79 20 6d 75 63 68 20 74 68 65 20 73  retty much the s
a900: 61 6d 65 20 73 65 74 75 70 20 0a 3b 3b 20 74 68  ame setup .;; th
a910: 69 73 20 77 72 61 70 70 65 72 20 69 73 20 75 73  is wrapper is us
a920: 65 64 20 74 6f 20 72 65 64 75 63 65 20 74 68 65  ed to reduce the
a930: 20 72 65 70 6c 69 63 61 74 69 6f 6e 20 6f 66 20   replication of 
a940: 63 6f 64 65 0a 28 64 65 66 69 6e 65 20 28 67 65  code.(define (ge
a950: 6e 65 72 61 6c 2d 72 75 6e 2d 63 61 6c 6c 20 73  neral-run-call s
a960: 77 69 74 63 68 6e 61 6d 65 20 61 63 74 69 6f 6e  witchname action
a970: 2d 64 65 73 63 20 70 72 6f 63 29 0a 20 20 28 6c  -desc proc).  (l
a980: 65 74 20 28 28 72 75 6e 6e 61 6d 65 20 28 61 72  et ((runname (ar
a990: 67 73 3a 67 65 74 2d 61 72 67 20 22 3a 72 75 6e  gs:get-arg ":run
a9a0: 6e 61 6d 65 22 29 29 0a 09 28 74 61 72 67 65 74  name"))..(target
a9b0: 20 20 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d    (if (args:get-
a9c0: 61 72 67 20 22 2d 74 61 72 67 65 74 22 29 0a 09  arg "-target")..
a9d0: 09 20 20 20 20 20 28 61 72 67 73 3a 67 65 74 2d  .     (args:get-
a9e0: 61 72 67 20 22 2d 74 61 72 67 65 74 22 29 0a 09  arg "-target")..
a9f0: 09 20 20 20 20 20 28 61 72 67 73 3a 67 65 74 2d  .     (args:get-
aa00: 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 29  arg "-reqtarg"))
aa10: 29 0a 09 28 74 68 31 20 20 20 20 20 23 66 29 29  )..(th1     #f))
aa20: 0a 20 20 20 20 28 63 6f 6e 64 0a 20 20 20 20 20  .    (cond.     
aa30: 28 28 6e 6f 74 20 74 61 72 67 65 74 29 0a 20 20  ((not target).  
aa40: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
aa50: 20 30 20 22 45 52 52 4f 52 3a 20 4d 69 73 73 69   0 "ERROR: Missi
aa60: 6e 67 20 72 65 71 75 69 72 65 64 20 70 61 72 61  ng required para
aa70: 6d 65 74 65 72 20 66 6f 72 20 22 20 73 77 69 74  meter for " swit
aa80: 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d 75  chname ", you mu
aa90: 73 74 20 73 70 65 63 69 66 79 20 74 68 65 20 74  st specify the t
aaa0: 61 72 67 65 74 20 77 69 74 68 20 2d 74 61 72 67  arget with -targ
aab0: 65 74 22 29 0a 20 20 20 20 20 20 28 65 78 69 74  et").      (exit
aac0: 20 33 29 29 0a 20 20 20 20 20 28 28 6e 6f 74 20   3)).     ((not 
aad0: 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20 20 20 28  runname).      (
aae0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45  debug:print 0 "E
aaf0: 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67 20 72 65  RROR: Missing re
ab00: 71 75 69 72 65 64 20 70 61 72 61 6d 65 74 65 72  quired parameter
ab10: 20 66 6f 72 20 22 20 73 77 69 74 63 68 6e 61 6d   for " switchnam
ab20: 65 20 22 2c 20 79 6f 75 20 6d 75 73 74 20 73 70  e ", you must sp
ab30: 65 63 69 66 79 20 74 68 65 20 72 75 6e 20 6e 61  ecify the run na
ab40: 6d 65 20 77 69 74 68 20 3a 72 75 6e 6e 61 6d 65  me with :runname
ab50: 20 72 75 6e 6e 61 6d 65 22 29 0a 20 20 20 20 20   runname").     
ab60: 20 28 65 78 69 74 20 33 29 29 0a 20 20 20 20 20   (exit 3)).     
ab70: 28 65 6c 73 65 0a 20 20 20 20 20 20 28 6c 65 74  (else.      (let
ab80: 20 28 28 64 62 20 20 20 23 66 29 0a 09 20 20 20   ((db   #f)..   
ab90: 20 28 6b 65 79 73 20 23 66 29 29 0a 09 28 69 66   (keys #f))..(if
aba0: 20 28 6e 6f 74 20 28 73 65 74 75 70 2d 66 6f 72   (not (setup-for
abb0: 2d 72 75 6e 29 29 0a 09 20 20 20 20 28 62 65 67  -run))..    (beg
abc0: 69 6e 20 0a 09 20 20 20 20 20 20 28 64 65 62 75  in ..      (debu
abd0: 67 3a 70 72 69 6e 74 20 30 20 22 46 61 69 6c 65  g:print 0 "Faile
abe0: 64 20 74 6f 20 73 65 74 75 70 2c 20 65 78 69 74  d to setup, exit
abf0: 69 6e 67 22 29 0a 09 20 20 20 20 20 20 28 65 78  ing")..      (ex
ac00: 69 74 20 31 29 29 29 0a 09 28 69 66 20 28 61 72  it 1)))..(if (ar
ac10: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 73 65 72  gs:get-arg "-ser
ac20: 76 65 72 22 29 0a 09 20 20 20 20 28 6f 70 65 6e  ver")..    (open
ac30: 2d 72 75 6e 2d 63 6c 6f 73 65 20 73 65 72 76 65  -run-close serve
ac40: 72 3a 73 74 61 72 74 20 64 62 20 28 61 72 67 73  r:start db (args
ac50: 3a 67 65 74 2d 61 72 67 20 22 2d 73 65 72 76 65  :get-arg "-serve
ac60: 72 22 29 29 29 0a 20 09 20 20 20 20 3b 3b 20 28  r"))). .    ;; (
ac70: 69 66 20 28 6e 6f 74 20 28 6f 72 20 28 61 72 67  if (not (or (arg
ac80: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 75 6e 61  s:get-arg "-runa
ac90: 6c 6c 22 29 20 20 20 20 20 3b 3b 20 72 75 6e 61  ll")     ;; runa
aca0: 6c 6c 20 61 6e 64 20 72 75 6e 74 65 73 74 73 20  ll and runtests 
acb0: 61 72 65 20 61 6c 6c 6f 77 65 64 20 74 6f 20 62  are allowed to b
acc0: 65 20 73 65 72 76 65 72 73 0a 20 09 20 20 20 20  e servers. .    
acd0: 3b 3b 20 20 20 20 20 09 20 28 61 72 67 73 3a 67  ;;     . (args:g
ace0: 65 74 2d 61 72 67 20 22 2d 72 75 6e 74 65 73 74  et-arg "-runtest
acf0: 73 22 29 29 29 0a 09 20 20 20 20 3b 3b 20 20 20  s")))..    ;;   
ad00: 20 20 28 63 6c 69 65 6e 74 3a 73 65 74 75 70 29    (client:setup)
ad10: 20 3b 3b 20 54 68 69 73 20 69 73 20 61 20 64 75   ;; This is a du
ad20: 70 6c 69 63 61 74 65 20 73 74 61 72 74 75 70 21  plicate startup!
ad30: 21 21 3f 3f 3f 20 42 55 47 3f 0a 09 20 20 20 20  !!??? BUG?..    
ad40: 3b 3b 20 20 20 20 20 29 29 0a 09 28 73 65 74 21  ;;     ))..(set!
ad50: 20 6b 65 79 73 20 28 6f 70 65 6e 2d 72 75 6e 2d   keys (open-run-
ad60: 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 6b 65 79  close db:get-key
ad70: 73 20 64 62 29 29 0a 09 3b 3b 20 68 61 76 65 20  s db))..;; have 
ad80: 65 6e 6f 75 67 68 20 74 6f 20 70 72 6f 63 65 73  enough to proces
ad90: 73 20 2d 74 61 72 67 65 74 20 6f 72 20 2d 72 65  s -target or -re
ada0: 71 74 61 72 67 20 68 65 72 65 0a 09 28 69 66 20  qtarg here..(if 
adb0: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
adc0: 72 65 71 74 61 72 67 22 29 0a 09 20 20 20 20 28  reqtarg")..    (
add0: 6c 65 74 2a 20 28 28 72 75 6e 63 6f 6e 66 69 67  let* ((runconfig
ade0: 66 20 28 63 6f 6e 63 20 20 2a 74 6f 70 70 61 74  f (conc  *toppat
adf0: 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 69 67 73 2e  h* "/runconfigs.
ae00: 63 6f 6e 66 69 67 22 29 29 20 3b 3b 20 44 4f 20  config")) ;; DO 
ae10: 4e 4f 54 20 45 56 41 4c 55 41 54 45 20 41 4c 4c  NOT EVALUATE ALL
ae20: 20 0a 09 09 20 20 20 28 72 75 6e 63 6f 6e 66 69   ...   (runconfi
ae30: 67 20 20 28 72 65 61 64 2d 63 6f 6e 66 69 67 20  g  (read-config 
ae40: 72 75 6e 63 6f 6e 66 69 67 66 20 23 66 20 23 74  runconfigf #f #t
ae50: 20 65 6e 76 69 72 6f 6e 2d 70 61 74 74 3a 20 23   environ-patt: #
ae60: 66 29 29 29 20 0a 09 20 20 20 20 20 20 28 69 66  f))) ..      (if
ae70: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66   (hash-table-ref
ae80: 2f 64 65 66 61 75 6c 74 20 72 75 6e 63 6f 6e 66  /default runconf
ae90: 69 67 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  ig (args:get-arg
aea0: 20 22 2d 72 65 71 74 61 72 67 22 29 20 23 66 29   "-reqtarg") #f)
aeb0: 0a 09 09 20 20 28 6b 65 79 73 3a 74 61 72 67 65  ...  (keys:targe
aec0: 74 2d 73 65 74 2d 61 72 67 73 20 6b 65 79 73 20  t-set-args keys 
aed0: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
aee0: 72 65 71 74 61 72 67 22 29 20 61 72 67 73 3a 61  reqtarg") args:a
aef0: 72 67 2d 68 61 73 68 29 0a 09 09 20 20 28 62 65  rg-hash)...  (be
af00: 67 69 6e 0a 09 09 20 20 20 20 28 64 65 62 75 67  gin...    (debug
af10: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a  :print 0 "ERROR:
af20: 20 5b 22 20 28 61 72 67 73 3a 67 65 74 2d 61 72   [" (args:get-ar
af30: 67 20 22 2d 72 65 71 74 61 72 67 22 29 20 22 5d  g "-reqtarg") "]
af40: 20 6e 6f 74 20 66 6f 75 6e 64 20 69 6e 20 22 20   not found in " 
af50: 72 75 6e 63 6f 6e 66 69 67 66 29 0a 09 09 20 20  runconfigf)...  
af60: 20 20 28 69 66 20 64 62 20 28 73 71 6c 69 74 65    (if db (sqlite
af70: 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 29 29  3:finalize! db))
af80: 0a 09 09 20 20 20 20 28 65 78 69 74 20 31 29 29  ...    (exit 1))
af90: 29 29 0a 09 20 20 20 20 28 69 66 20 28 61 72 67  ))..    (if (arg
afa0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67  s:get-arg "-targ
afb0: 65 74 22 29 0a 09 09 28 6b 65 79 73 3a 74 61 72  et")...(keys:tar
afc0: 67 65 74 2d 73 65 74 2d 61 72 67 73 20 6b 65 79  get-set-args key
afd0: 73 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20  s (args:get-arg 
afe0: 22 2d 74 61 72 67 65 74 22 20 61 72 67 73 3a 61  "-target" args:a
aff0: 72 67 2d 68 61 73 68 29 20 61 72 67 73 3a 61 72  rg-hash) args:ar
b000: 67 2d 68 61 73 68 29 29 29 0a 09 28 69 66 20 28  g-hash)))..(if (
b010: 6e 6f 74 20 28 63 61 72 20 2a 63 6f 6e 66 69 67  not (car *config
b020: 69 6e 66 6f 2a 29 29 0a 09 20 20 20 20 28 62 65  info*))..    (be
b030: 67 69 6e 0a 09 20 20 20 20 20 20 28 64 65 62 75  gin..      (debu
b040: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52  g:print 0 "ERROR
b050: 3a 20 41 74 74 65 6d 70 74 65 64 20 74 6f 20 22  : Attempted to "
b060: 20 61 63 74 69 6f 6e 2d 64 65 73 63 20 22 20 62   action-desc " b
b070: 75 74 20 72 75 6e 20 61 72 65 61 20 63 6f 6e 66  ut run area conf
b080: 69 67 20 66 69 6c 65 20 6e 6f 74 20 66 6f 75 6e  ig file not foun
b090: 64 22 29 0a 09 20 20 20 20 20 20 28 65 78 69 74  d")..      (exit
b0a0: 20 31 29 29 0a 09 20 20 20 20 3b 3b 20 45 78 74   1))..    ;; Ext
b0b0: 72 61 63 74 20 6f 75 74 20 73 74 75 66 66 20 6e  ract out stuff n
b0c0: 65 65 64 65 64 20 69 6e 20 6d 6f 73 74 20 6f 72  eeded in most or
b0d0: 20 6d 61 6e 79 20 63 61 6c 6c 73 0a 09 20 20 20   many calls..   
b0e0: 20 3b 3b 20 68 65 72 65 20 74 68 65 6e 20 63 61   ;; here then ca
b0f0: 6c 6c 20 70 72 6f 63 0a 09 20 20 20 20 28 6c 65  ll proc..    (le
b100: 74 2a 20 28 28 6b 65 79 6e 61 6d 65 73 20 20 20  t* ((keynames   
b110: 28 6d 61 70 20 6b 65 79 3a 67 65 74 2d 66 69 65  (map key:get-fie
b120: 6c 64 6e 61 6d 65 20 6b 65 79 73 29 29 0a 09 09  ldname keys))...
b130: 20 20 20 28 6b 65 79 76 61 6c 6c 73 74 20 20 28     (keyvallst  (
b140: 6b 65 79 73 2d 3e 76 61 6c 6c 69 73 74 20 6b 65  keys->vallist ke
b150: 79 73 20 23 74 29 29 29 0a 09 20 20 20 20 20 20  ys #t)))..      
b160: 28 70 72 6f 63 20 74 61 72 67 65 74 20 72 75 6e  (proc target run
b170: 6e 61 6d 65 20 6b 65 79 73 20 6b 65 79 6e 61 6d  name keys keynam
b180: 65 73 20 6b 65 79 76 61 6c 6c 73 74 29 29 29 0a  es keyvallst))).
b190: 09 28 69 66 20 74 68 31 20 28 74 68 72 65 61 64  .(if th1 (thread
b1a0: 2d 6a 6f 69 6e 21 20 74 68 31 29 29 0a 09 28 69  -join! th1))..(i
b1b0: 66 20 64 62 20 28 73 71 6c 69 74 65 33 3a 66 69  f db (sqlite3:fi
b1c0: 6e 61 6c 69 7a 65 21 20 64 62 29 29 0a 09 28 73  nalize! db))..(s
b1d0: 65 74 21 20 2a 64 69 64 73 6f 6d 65 74 68 69 6e  et! *didsomethin
b1e0: 67 2a 20 23 74 29 29 29 29 29 29 0a 0a 3b 3b 3d  g* #t))))))..;;=
b1f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b200: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b210: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b220: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b230: 3d 3d 3d 3d 3d 0a 3b 3b 20 4c 6f 63 6b 2f 75 6e  =====.;; Lock/un
b240: 6c 6f 63 6b 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d  lock runs.;;====
b250: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b260: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b270: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b280: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b290: 3d 3d 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e  ==..(define (run
b2a0: 73 3a 68 61 6e 64 6c 65 2d 6c 6f 63 6b 69 6e 67  s:handle-locking
b2b0: 20 74 61 72 67 65 74 20 6b 65 79 73 20 72 75 6e   target keys run
b2c0: 6e 61 6d 65 20 6c 6f 63 6b 20 75 6e 6c 6f 63 6b  name lock unlock
b2d0: 20 75 73 65 72 29 0a 20 20 28 6c 65 74 2a 20 28   user).  (let* (
b2e0: 28 64 62 20 20 20 20 20 20 20 23 66 29 0a 09 20  (db       #f).. 
b2f0: 28 72 75 6e 64 61 74 20 20 20 28 6f 70 65 6e 2d  (rundat   (open-
b300: 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 3a 67  run-close runs:g
b310: 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74 74 20  et-runs-by-patt 
b320: 64 62 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65 29  db keys runname)
b330: 29 0a 09 20 28 68 65 61 64 65 72 20 20 20 28 76  ).. (header   (v
b340: 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74  ector-ref rundat
b350: 20 30 29 29 0a 09 20 28 72 75 6e 73 20 20 20 20   0)).. (runs    
b360: 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e   (vector-ref run
b370: 64 61 74 20 31 29 29 29 0a 20 20 20 20 28 66 6f  dat 1))).    (fo
b380: 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 61 20 28  r-each (lambda (
b390: 72 75 6e 29 0a 09 09 28 6c 65 74 20 28 28 72 75  run)...(let ((ru
b3a0: 6e 2d 69 64 20 28 64 62 3a 67 65 74 2d 76 61 6c  n-id (db:get-val
b3b0: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e  ue-by-header run
b3c0: 20 68 65 61 64 65 72 20 22 69 64 22 29 29 29 0a   header "id"))).
b3d0: 09 09 20 20 28 69 66 20 28 6f 72 20 6c 6f 63 6b  ..  (if (or lock
b3e0: 0a 09 09 09 20 20 28 61 6e 64 20 75 6e 6c 6f 63  ....  (and unloc
b3f0: 6b 0a 09 09 09 20 20 20 20 20 20 20 28 62 65 67  k....       (beg
b400: 69 6e 0a 09 09 09 09 20 28 70 72 69 6e 74 20 22  in..... (print "
b410: 44 6f 20 79 6f 75 20 72 65 61 6c 6c 79 20 77 69  Do you really wi
b420: 73 68 20 74 6f 20 75 6e 6c 6f 63 6b 20 72 75 6e  sh to unlock run
b430: 20 22 20 72 75 6e 2d 69 64 20 22 3f 5c 6e 20 20   " run-id "?\n  
b440: 20 79 2f 6e 3a 20 22 29 0a 09 09 09 09 20 28 65   y/n: ")..... (e
b450: 71 75 61 6c 3f 20 22 79 22 20 28 72 65 61 64 2d  qual? "y" (read-
b460: 6c 69 6e 65 29 29 29 29 29 0a 09 09 20 20 20 20  line)))))...    
b470: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73    (open-run-clos
b480: 65 20 64 62 3a 6c 6f 63 6b 2f 75 6e 6c 6f 63 6b  e db:lock/unlock
b490: 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 20 6c  -run db run-id l
b4a0: 6f 63 6b 20 75 6e 6c 6f 63 6b 20 75 73 65 72 29  ock unlock user)
b4b0: 0a 09 09 20 20 20 20 20 20 28 64 65 62 75 67 3a  ...      (debug:
b4c0: 70 72 69 6e 74 2d 69 6e 66 6f 20 30 20 22 53 6b  print-info 0 "Sk
b4d0: 69 70 70 69 6e 67 20 6c 6f 63 6b 2f 75 6e 6c 6f  ipping lock/unlo
b4e0: 63 6b 20 6f 6e 20 22 20 72 75 6e 2d 69 64 29 29  ck on " run-id))
b4f0: 29 29 0a 09 20 20 20 20 20 20 72 75 6e 73 29 29  ))..      runs))
b500: 29 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ).;;============
b510: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b520: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b530: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b540: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f  ==========.;; Ro
b550: 6c 6c 75 70 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d  llup runs.;;====
b560: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b570: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b580: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b590: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b5a0: 3d 3d 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74 68  ==..;; Update th
b5b0: 65 20 74 65 73 74 5f 6d 65 74 61 20 74 61 62 6c  e test_meta tabl
b5c0: 65 20 66 6f 72 20 74 68 69 73 20 74 65 73 74 0a  e for this test.
b5d0: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 75 70  (define (runs:up
b5e0: 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 64  date-test_meta d
b5f0: 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74  b test-name test
b600: 2d 63 6f 6e 66 29 0a 20 20 28 6c 65 74 20 28 28  -conf).  (let ((
b610: 63 75 72 72 72 65 63 6f 72 64 20 28 63 64 62 3a  currrecord (cdb:
b620: 72 65 6d 6f 74 65 2d 72 75 6e 20 64 62 3a 74 65  remote-run db:te
b630: 73 74 6d 65 74 61 2d 67 65 74 2d 72 65 63 6f 72  stmeta-get-recor
b640: 64 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 29 29  d db test-name))
b650: 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 63  ).    (if (not c
b660: 75 72 72 72 65 63 6f 72 64 29 0a 09 28 62 65 67  urrrecord)..(beg
b670: 69 6e 0a 09 20 20 28 73 65 74 21 20 63 75 72 72  in..  (set! curr
b680: 72 65 63 6f 72 64 20 28 6d 61 6b 65 2d 76 65 63  record (make-vec
b690: 74 6f 72 20 31 30 20 23 66 29 29 0a 09 20 20 28  tor 10 #f))..  (
b6a0: 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64  cdb:remote-run d
b6b0: 62 3a 74 65 73 74 6d 65 74 61 2d 61 64 64 2d 72  b:testmeta-add-r
b6c0: 65 63 6f 72 64 20 64 62 20 74 65 73 74 2d 6e 61  ecord db test-na
b6d0: 6d 65 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65  me))).    (for-e
b6e0: 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64  ach .     (lambd
b6f0: 61 20 28 6b 65 79 29 0a 20 20 20 20 20 20 20 28  a (key).       (
b700: 6c 65 74 2a 20 28 28 69 64 78 20 28 63 61 64 72  let* ((idx (cadr
b710: 20 6b 65 79 29 29 0a 09 20 20 20 20 20 20 28 66   key))..      (f
b720: 6c 64 20 28 63 61 72 20 20 6b 65 79 29 29 0a 09  ld (car  key))..
b730: 20 20 20 20 20 20 28 76 61 6c 20 28 63 6f 6e 66        (val (conf
b740: 69 67 2d 6c 6f 6f 6b 75 70 20 74 65 73 74 2d 63  ig-lookup test-c
b750: 6f 6e 66 20 22 74 65 73 74 5f 6d 65 74 61 22 20  onf "test_meta" 
b760: 66 6c 64 29 29 29 0a 09 20 3b 3b 20 28 64 65 62  fld))).. ;; (deb
b770: 75 67 3a 70 72 69 6e 74 20 35 20 22 69 64 78 3a  ug:print 5 "idx:
b780: 20 22 20 69 64 78 20 22 20 66 6c 64 3a 20 22 20   " idx " fld: " 
b790: 66 6c 64 20 22 20 76 61 6c 3a 20 22 20 76 61 6c  fld " val: " val
b7a0: 29 0a 09 20 28 69 66 20 28 61 6e 64 20 76 61 6c  ).. (if (and val
b7b0: 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 28 76   (not (equal? (v
b7c0: 65 63 74 6f 72 2d 72 65 66 20 63 75 72 72 72 65  ector-ref currre
b7d0: 63 6f 72 64 20 69 64 78 29 20 76 61 6c 29 29 29  cord idx) val)))
b7e0: 0a 09 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20  ..     (begin.. 
b7f0: 20 20 20 20 20 20 28 70 72 69 6e 74 20 22 55 70        (print "Up
b800: 64 61 74 69 6e 67 20 22 20 74 65 73 74 2d 6e 61  dating " test-na
b810: 6d 65 20 22 20 22 20 66 6c 64 20 22 20 74 6f 20  me " " fld " to 
b820: 22 20 76 61 6c 29 0a 09 20 20 20 20 20 20 20 28  " val)..       (
b830: 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64  cdb:remote-run d
b840: 62 3a 74 65 73 74 6d 65 74 61 2d 75 70 64 61 74  b:testmeta-updat
b850: 65 2d 66 69 65 6c 64 20 64 62 20 74 65 73 74 2d  e-field db test-
b860: 6e 61 6d 65 20 66 6c 64 20 76 61 6c 29 29 29 29  name fld val))))
b870: 29 0a 20 20 20 20 20 27 28 28 22 61 75 74 68 6f  ).     '(("autho
b880: 72 22 20 32 29 28 22 6f 77 6e 65 72 22 20 33 29  r" 2)("owner" 3)
b890: 28 22 64 65 73 63 72 69 70 74 69 6f 6e 22 20 34  ("description" 4
b8a0: 29 28 22 72 65 76 69 65 77 65 64 22 20 35 29 28  )("reviewed" 5)(
b8b0: 22 74 61 67 73 22 20 39 29 29 29 29 29 0a 0a 3b  "tags" 9)))))..;
b8c0: 3b 20 55 70 64 61 74 65 20 74 65 73 74 5f 6d 65  ; Update test_me
b8d0: 74 61 20 66 6f 72 20 61 6c 6c 20 74 65 73 74 73  ta for all tests
b8e0: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 75  .(define (runs:u
b8f0: 70 64 61 74 65 2d 61 6c 6c 2d 74 65 73 74 5f 6d  pdate-all-test_m
b900: 65 74 61 20 64 62 29 0a 20 20 28 6c 65 74 20 28  eta db).  (let (
b910: 28 74 65 73 74 2d 6e 61 6d 65 73 20 28 67 65 74  (test-names (get
b920: 2d 61 6c 6c 2d 6c 65 67 61 6c 2d 74 65 73 74 73  -all-legal-tests
b930: 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63  ))).    (for-eac
b940: 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20  h .     (lambda 
b950: 28 74 65 73 74 2d 6e 61 6d 65 29 0a 20 20 20 20  (test-name).    
b960: 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d     (let* ((test-
b970: 70 61 74 68 20 20 20 20 28 63 6f 6e 63 20 2a 74  path    (conc *t
b980: 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f  oppath* "/tests/
b990: 22 20 74 65 73 74 2d 6e 61 6d 65 29 29 0a 09 20  " test-name)).. 
b9a0: 20 20 20 20 20 28 74 65 73 74 2d 63 6f 6e 66 69       (test-confi
b9b0: 67 66 20 28 63 6f 6e 63 20 74 65 73 74 2d 70 61  gf (conc test-pa
b9c0: 74 68 20 22 2f 74 65 73 74 63 6f 6e 66 69 67 22  th "/testconfig"
b9d0: 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 65  ))..      (teste
b9e0: 78 69 73 74 73 20 20 20 28 61 6e 64 20 28 66 69  xists   (and (fi
b9f0: 6c 65 2d 65 78 69 73 74 73 3f 20 74 65 73 74 2d  le-exists? test-
ba00: 63 6f 6e 66 69 67 66 29 28 66 69 6c 65 2d 72 65  configf)(file-re
ba10: 61 64 2d 61 63 63 65 73 73 3f 20 74 65 73 74 2d  ad-access? test-
ba20: 63 6f 6e 66 69 67 66 29 29 29 0a 09 20 20 20 20  configf)))..    
ba30: 20 20 3b 3b 20 72 65 61 64 20 63 6f 6e 66 69 67    ;; read config
ba40: 73 20 77 69 74 68 20 74 72 69 63 6b 73 20 74 75  s with tricks tu
ba50: 72 6e 65 64 20 6f 66 66 20 28 69 2e 65 2e 20 6e  rned off (i.e. n
ba60: 6f 20 73 79 73 74 65 6d 29 0a 09 20 20 20 20 20  o system)..     
ba70: 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 20 28   (test-conf    (
ba80: 69 66 20 74 65 73 74 65 78 69 73 74 73 20 28 72  if testexists (r
ba90: 65 61 64 2d 63 6f 6e 66 69 67 20 74 65 73 74 2d  ead-config test-
baa0: 63 6f 6e 66 69 67 66 20 23 66 20 23 66 29 28 6d  configf #f #f)(m
bab0: 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29  ake-hash-table))
bac0: 29 29 0a 09 20 3b 3b 20 75 73 65 20 74 68 65 20  )).. ;; use the 
bad0: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 69  open-run-close i
bae0: 6e 73 74 65 61 64 20 6f 66 20 70 61 73 73 69 6e  nstead of passin
baf0: 67 20 69 6e 20 64 62 0a 09 20 28 72 75 6e 73 3a  g in db.. (runs:
bb00: 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 61  update-test_meta
bb10: 20 23 66 20 74 65 73 74 2d 6e 61 6d 65 20 74 65   #f test-name te
bb20: 73 74 2d 63 6f 6e 66 29 29 29 0a 20 20 20 20 20  st-conf))).     
bb30: 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a 0a 3b  test-names)))..;
bb40: 3b 20 54 68 69 73 20 63 6f 75 6c 64 20 70 72 6f  ; This could pro
bb50: 62 61 62 6c 79 20 62 65 20 72 65 66 61 63 74 6f  bably be refacto
bb60: 72 65 64 20 69 6e 74 6f 20 6f 6e 65 20 63 6f 6d  red into one com
bb70: 70 6c 65 78 20 71 75 65 72 79 20 2e 2e 2e 0a 28  plex query ....(
bb80: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 6f 6c  define (runs:rol
bb90: 6c 75 70 2d 72 75 6e 20 6b 65 79 73 20 6b 65 79  lup-run keys key
bba0: 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 75  vallst runname u
bbb0: 73 65 72 29 20 3b 3b 20 77 61 73 20 74 61 72 67  ser) ;; was targ
bbc0: 65 74 2c 20 6e 6f 77 20 6b 65 79 76 61 6c 6c 73  et, now keyvalls
bbd0: 74 0a 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74  t.  (debug:print
bbe0: 20 34 20 22 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d   4 "runs:rollup-
bbf0: 72 75 6e 2c 20 6b 65 79 73 3a 20 22 20 6b 65 79  run, keys: " key
bc00: 73 20 22 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22  s " keyvallst: "
bc10: 20 6b 65 79 76 61 6c 6c 73 74 20 22 20 3a 72 75   keyvallst " :ru
bc20: 6e 6e 61 6d 65 20 22 20 72 75 6e 6e 61 6d 65 20  nname " runname 
bc30: 22 20 75 73 65 72 3a 20 22 20 75 73 65 72 29 0a  " user: " user).
bc40: 20 20 28 6c 65 74 2a 20 28 28 64 62 20 20 20 20    (let* ((db    
bc50: 20 20 20 20 20 20 20 20 20 20 23 66 29 20 3b 3b            #f) ;;
bc60: 20 28 6b 65 79 76 61 6c 6c 6c 73 74 20 20 20 20   (keyvalllst    
bc70: 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 3e    (keys:target->
bc80: 6b 65 79 76 61 6c 20 6b 65 79 73 20 74 61 72 67  keyval keys targ
bc90: 65 74 29 29 0a 09 20 28 6e 65 77 2d 72 75 6e 2d  et)).. (new-run-
bca0: 69 64 20 20 20 20 20 20 28 63 64 62 3a 72 65 6d  id      (cdb:rem
bcb0: 6f 74 65 2d 72 75 6e 20 64 62 3a 72 65 67 69 73  ote-run db:regis
bcc0: 74 65 72 2d 72 75 6e 20 23 66 20 6b 65 79 73 20  ter-run #f keys 
bcd0: 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d  keyvallst runnam
bce0: 65 20 22 6e 65 77 22 20 22 6e 2f 61 22 20 75 73  e "new" "n/a" us
bcf0: 65 72 29 29 0a 09 20 28 70 72 65 76 2d 74 65 73  er)).. (prev-tes
bd00: 74 73 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75  ts      (open-ru
bd10: 6e 2d 63 6c 6f 73 65 20 74 65 73 74 3a 67 65 74  n-close test:get
bd20: 2d 6d 61 74 63 68 69 6e 67 2d 70 72 65 76 69 6f  -matching-previo
bd30: 75 73 2d 74 65 73 74 2d 72 75 6e 2d 72 65 63 6f  us-test-run-reco
bd40: 72 64 73 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69  rds db new-run-i
bd50: 64 20 22 25 22 20 22 25 22 29 29 0a 09 20 28 63  d "%" "%")).. (c
bd60: 75 72 72 2d 74 65 73 74 73 20 20 20 20 20 20 28  urr-tests      (
bd70: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64  open-run-close d
bd80: 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d  b:get-tests-for-
bd90: 72 75 6e 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69  run db new-run-i
bda0: 64 20 22 25 2f 25 22 20 27 28 29 20 27 28 29 29  d "%/%" '() '())
bdb0: 29 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73 2d  ).. (curr-tests-
bdc0: 68 61 73 68 20 28 6d 61 6b 65 2d 68 61 73 68 2d  hash (make-hash-
bdd0: 74 61 62 6c 65 29 29 29 0a 20 20 20 20 28 6f 70  table))).    (op
bde0: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a  en-run-close db:
bdf0: 75 70 64 61 74 65 2d 72 75 6e 2d 65 76 65 6e 74  update-run-event
be00: 5f 74 69 6d 65 20 64 62 20 6e 65 77 2d 72 75 6e  _time db new-run
be10: 2d 69 64 29 0a 20 20 20 20 3b 3b 20 69 6e 64 65  -id).    ;; inde
be20: 78 20 74 68 65 20 61 6c 72 65 61 64 79 20 73 61  x the already sa
be30: 76 65 64 20 74 65 73 74 73 20 62 79 20 74 65 73  ved tests by tes
be40: 74 6e 61 6d 65 20 61 6e 64 20 69 74 65 6d 64 61  tname and itemda
be50: 74 20 69 6e 20 63 75 72 72 2d 74 65 73 74 73 2d  t in curr-tests-
be60: 68 61 73 68 0a 20 20 20 20 28 66 6f 72 2d 65 61  hash.    (for-ea
be70: 63 68 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20  ch.     (lambda 
be80: 28 74 65 73 74 64 61 74 29 0a 20 20 20 20 20 20  (testdat).      
be90: 20 28 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 6d   (let* ((testnam
bea0: 65 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  e  (db:test-get-
beb0: 74 65 73 74 6e 61 6d 65 20 74 65 73 74 64 61 74  testname testdat
bec0: 29 29 0a 09 20 20 20 20 20 20 28 69 74 65 6d 2d  ))..      (item-
bed0: 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65  path (db:test-ge
bee0: 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74  t-item-path test
bef0: 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 66 75  dat))..      (fu
bf00: 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65  ll-name (conc te
bf10: 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d  stname "/" item-
bf20: 70 61 74 68 29 29 29 0a 09 20 28 68 61 73 68 2d  path))).. (hash-
bf30: 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72 72 2d  table-set! curr-
bf40: 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d  tests-hash full-
bf50: 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29 29 0a  name testdat))).
bf60: 20 20 20 20 20 63 75 72 72 2d 74 65 73 74 73 29       curr-tests)
bf70: 0a 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 4e 6f  .    ;; NOPE: No
bf80: 6e 2d 6f 70 74 69 6d 61 6c 20 61 70 70 72 6f 61  n-optimal approa
bf90: 63 68 2e 20 54 72 79 20 74 68 69 73 20 69 6e 73  ch. Try this ins
bfa0: 74 65 61 64 2e 0a 20 20 20 20 3b 3b 20 20 20 31  tead..    ;;   1
bfb0: 2e 20 74 65 73 74 73 20 61 72 65 20 72 65 63 65  . tests are rece
bfc0: 69 76 65 64 20 69 6e 20 61 20 6c 69 73 74 2c 20  ived in a list, 
bfd0: 6d 6f 73 74 20 72 65 63 65 6e 74 20 66 69 72 73  most recent firs
bfe0: 74 0a 20 20 20 20 3b 3b 20 20 20 32 2e 20 72 65  t.    ;;   2. re
bff0: 70 6c 61 63 65 20 74 68 65 20 72 6f 6c 6c 75 70  place the rollup
c000: 20 74 65 73 74 20 77 69 74 68 20 74 68 65 20 6e   test with the n
c010: 65 77 20 2a 61 6c 77 61 79 73 2a 0a 20 20 20 20  ew *always*.    
c020: 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20  (for-each .     
c030: 28 6c 61 6d 62 64 61 20 28 74 65 73 74 64 61 74  (lambda (testdat
c040: 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28  ).       (let* (
c050: 28 74 65 73 74 6e 61 6d 65 20 20 28 64 62 3a 74  (testname  (db:t
c060: 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65  est-get-testname
c070: 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20   testdat))..    
c080: 20 20 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62    (item-path (db
c090: 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70  :test-get-item-p
c0a0: 61 74 68 20 74 65 73 74 64 61 74 29 29 0a 09 20  ath testdat)).. 
c0b0: 20 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20       (full-name 
c0c0: 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22  (conc testname "
c0d0: 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 09  /" item-path))..
c0e0: 20 20 20 20 20 20 28 70 72 65 76 2d 74 65 73 74        (prev-test
c0f0: 2d 64 61 74 20 28 68 61 73 68 2d 74 61 62 6c 65  -dat (hash-table
c100: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63 75 72  -ref/default cur
c110: 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c  r-tests-hash ful
c120: 6c 2d 6e 61 6d 65 20 23 66 29 29 0a 09 20 20 20  l-name #f))..   
c130: 20 20 20 28 74 65 73 74 2d 73 74 65 70 73 20 20     (test-steps  
c140: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c      (open-run-cl
c150: 6f 73 65 20 64 62 3a 67 65 74 2d 73 74 65 70 73  ose db:get-steps
c160: 2d 66 6f 72 2d 74 65 73 74 20 64 62 20 28 64 62  -for-test db (db
c170: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73  :test-get-id tes
c180: 74 64 61 74 29 29 29 0a 09 20 20 20 20 20 20 28  tdat)))..      (
c190: 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20  new-test-record 
c1a0: 23 66 29 29 0a 09 20 3b 3b 20 72 65 70 6c 61 63  #f)).. ;; replac
c1b0: 65 20 74 68 65 73 65 20 77 69 74 68 20 69 6e 73  e these with ins
c1c0: 65 72 74 20 2e 2e 2e 20 73 65 6c 65 63 74 0a 09  ert ... select..
c1d0: 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a   (apply sqlite3:
c1e0: 65 78 65 63 75 74 65 20 0a 09 09 64 62 20 0a 09  execute ...db ..
c1f0: 09 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f  .(conc "INSERT O
c200: 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74  R REPLACE INTO t
c210: 65 73 74 73 20 28 72 75 6e 5f 69 64 2c 74 65 73  ests (run_id,tes
c220: 74 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74  tname,state,stat
c230: 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 68 6f  us,event_time,ho
c240: 73 74 2c 63 70 75 6c 6f 61 64 2c 64 69 73 6b 66  st,cpuload,diskf
c250: 72 65 65 2c 75 6e 61 6d 65 2c 72 75 6e 64 69 72  ree,uname,rundir
c260: 2c 69 74 65 6d 5f 70 61 74 68 2c 72 75 6e 5f 64  ,item_path,run_d
c270: 75 72 61 74 69 6f 6e 2c 66 69 6e 61 6c 5f 6c 6f  uration,final_lo
c280: 67 66 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09  gf,comment) "...
c290: 20 20 20 20 20 20 22 56 41 4c 55 45 53 20 28 3f        "VALUES (?
c2a0: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f  ,?,?,?,?,?,?,?,?
c2b0: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 29 3b 22 29 0a 09  ,?,?,?,?,?);")..
c2c0: 09 6e 65 77 2d 72 75 6e 2d 69 64 20 28 63 64 64  .new-run-id (cdd
c2d0: 72 20 28 76 65 63 74 6f 72 2d 3e 6c 69 73 74 20  r (vector->list 
c2e0: 74 65 73 74 64 61 74 29 29 29 0a 09 20 28 73 65  testdat))).. (se
c2f0: 74 21 20 6e 65 77 2d 74 65 73 74 64 61 74 20 28  t! new-testdat (
c300: 63 61 72 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c  car (open-run-cl
c310: 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 73  ose db:get-tests
c320: 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77 2d  -for-run db new-
c330: 72 75 6e 2d 69 64 20 28 63 6f 6e 63 20 74 65 73  run-id (conc tes
c340: 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70  tname "/" item-p
c350: 61 74 68 29 20 27 28 29 20 27 28 29 29 29 29 0a  ath) '() '()))).
c360: 09 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65  . (hash-table-se
c370: 74 21 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61  t! curr-tests-ha
c380: 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 6e 65 77  sh full-name new
c390: 2d 74 65 73 74 64 61 74 29 20 3b 3b 20 74 68 69  -testdat) ;; thi
c3a0: 73 20 63 6f 75 6c 64 20 62 65 20 63 6f 6e 66 75  s could be confu
c3b0: 73 69 6e 67 2c 20 77 68 69 63 68 20 72 65 63 6f  sing, which reco
c3c0: 72 64 20 73 68 6f 75 6c 64 20 67 6f 20 69 6e 74  rd should go int
c3d0: 6f 20 74 68 65 20 6c 6f 6f 6b 75 70 20 74 61 62  o the lookup tab
c3e0: 6c 65 3f 0a 09 20 3b 3b 20 4e 6f 77 20 64 75 70  le?.. ;; Now dup
c3f0: 6c 69 63 61 74 65 20 74 68 65 20 74 65 73 74 20  licate the test 
c400: 73 74 65 70 73 0a 09 20 28 64 65 62 75 67 3a 70  steps.. (debug:p
c410: 72 69 6e 74 20 34 20 22 43 6f 70 79 69 6e 67 20  rint 4 "Copying 
c420: 72 65 63 6f 72 64 73 20 69 6e 20 74 65 73 74 5f  records in test_
c430: 73 74 65 70 73 20 66 72 6f 6d 20 74 65 73 74 5f  steps from test_
c440: 69 64 3d 22 20 28 64 62 3a 74 65 73 74 2d 67 65  id=" (db:test-ge
c450: 74 2d 69 64 20 74 65 73 74 64 61 74 29 20 22 20  t-id testdat) " 
c460: 74 6f 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65  to " (db:test-ge
c470: 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74  t-id new-testdat
c480: 29 29 0a 09 20 28 6f 70 65 6e 2d 72 75 6e 2d 63  )).. (open-run-c
c490: 6c 6f 73 65 20 0a 09 20 20 28 6c 61 6d 62 64 61  lose ..  (lambda
c4a0: 20 28 29 0a 09 20 20 20 20 28 73 71 6c 69 74 65   ()..    (sqlite
c4b0: 33 3a 65 78 65 63 75 74 65 20 0a 09 20 20 20 20  3:execute ..    
c4c0: 20 64 62 20 0a 09 20 20 20 20 20 28 63 6f 6e 63   db ..     (conc
c4d0: 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c   "INSERT OR REPL
c4e0: 41 43 45 20 49 4e 54 4f 20 74 65 73 74 5f 73 74  ACE INTO test_st
c4f0: 65 70 73 20 28 74 65 73 74 5f 69 64 2c 73 74 65  eps (test_id,ste
c500: 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74  pname,state,stat
c510: 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f  us,event_time,co
c520: 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 22 53  mment) "...   "S
c530: 45 4c 45 43 54 20 22 20 28 64 62 3a 74 65 73 74  ELECT " (db:test
c540: 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74  -get-id new-test
c550: 64 61 74 29 20 22 2c 73 74 65 70 6e 61 6d 65 2c  dat) ",stepname,
c560: 73 74 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65  state,status,eve
c570: 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 20  nt_time,comment 
c580: 46 52 4f 4d 20 74 65 73 74 5f 73 74 65 70 73 20  FROM test_steps 
c590: 57 48 45 52 45 20 74 65 73 74 5f 69 64 3d 3f 3b  WHERE test_id=?;
c5a0: 22 29 0a 09 20 20 20 20 20 28 64 62 3a 74 65 73  ")..     (db:tes
c5b0: 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 74  t-get-id testdat
c5c0: 29 29 0a 09 20 20 20 20 3b 3b 20 4e 6f 77 20 64  ))..    ;; Now d
c5d0: 75 70 6c 69 63 61 74 65 20 74 68 65 20 74 65 73  uplicate the tes
c5e0: 74 20 64 61 74 61 0a 09 20 20 20 20 28 64 65 62  t data..    (deb
c5f0: 75 67 3a 70 72 69 6e 74 20 34 20 22 43 6f 70 79  ug:print 4 "Copy
c600: 69 6e 67 20 72 65 63 6f 72 64 73 20 69 6e 20 74  ing records in t
c610: 65 73 74 5f 64 61 74 61 20 66 72 6f 6d 20 74 65  est_data from te
c620: 73 74 5f 69 64 3d 22 20 28 64 62 3a 74 65 73 74  st_id=" (db:test
c630: 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29  -get-id testdat)
c640: 20 22 20 74 6f 20 22 20 28 64 62 3a 74 65 73 74   " to " (db:test
c650: 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74  -get-id new-test
c660: 64 61 74 29 29 0a 09 20 20 20 20 28 73 71 6c 69  dat))..    (sqli
c670: 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09 20 20  te3:execute ..  
c680: 20 20 20 64 62 20 0a 09 20 20 20 20 20 28 63 6f     db ..     (co
c690: 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45  nc "INSERT OR RE
c6a0: 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 74 5f  PLACE INTO test_
c6b0: 64 61 74 61 20 28 74 65 73 74 5f 69 64 2c 63 61  data (test_id,ca
c6c0: 74 65 67 6f 72 79 2c 76 61 72 69 61 62 6c 65 2c  tegory,variable,
c6d0: 76 61 6c 75 65 2c 65 78 70 65 63 74 65 64 2c 74  value,expected,t
c6e0: 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65 6e 74  ol,units,comment
c6f0: 29 20 22 0a 09 09 20 20 20 22 53 45 4c 45 43 54  ) "...   "SELECT
c700: 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d   " (db:test-get-
c710: 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20  id new-testdat) 
c720: 22 2c 63 61 74 65 67 6f 72 79 2c 76 61 72 69 61  ",category,varia
c730: 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65 63 74  ble,value,expect
c740: 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d  ed,tol,units,com
c750: 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f 64  ment FROM test_d
c760: 61 74 61 20 57 48 45 52 45 20 74 65 73 74 5f 69  ata WHERE test_i
c770: 64 3d 3f 3b 22 29 0a 09 20 20 20 20 20 28 64 62  d=?;")..     (db
c780: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73  :test-get-id tes
c790: 74 64 61 74 29 29 29 29 0a 09 20 29 29 0a 20 20  tdat)))).. )).  
c7a0: 20 20 20 70 72 65 76 2d 74 65 73 74 73 29 29 29     prev-tests)))
c7b0: 0a 09 20 0a 20 20 20 20 20 0a                    .. .     .