Megatest

Hex Artifact Content
Login

Artifact d3996a36c3c86f693da8d552b3c91861622f4b25:


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 30 29  tests-delay* 10)
14a0: 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 73 65  )..(begin..  (se
14b0: 74 21 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75 6e  t! *runs:can-run
14c0: 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c 61  -more-tests-dela
14d0: 79 2a 20 28 2b 20 2a 72 75 6e 73 3a 63 61 6e 2d  y* (+ *runs:can-
14e0: 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64  run-more-tests-d
14f0: 65 6c 61 79 2a 20 31 29 29 20 3b 3b 20 30 2e 31  elay* 1)) ;; 0.1
1500: 29 29 0a 09 20 20 28 64 65 62 75 67 3a 70 72 69  ))..  (debug:pri
1510: 6e 74 2d 69 6e 66 6f 20 31 34 20 22 63 61 6e 2d  nt-info 14 "can-
1520: 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64  run-more-tests-d
1530: 65 6c 61 79 3a 20 22 20 2a 72 75 6e 73 3a 63 61  elay: " *runs:ca
1540: 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73  n-run-more-tests
1550: 2d 64 65 6c 61 79 2a 29 29 29 0a 20 20 20 20 28  -delay*))).    (
1560: 69 66 20 28 6e 6f 74 20 28 65 71 3f 20 2a 6c 61  if (not (eq? *la
1570: 73 74 2d 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 74  st-num-running-t
1580: 65 73 74 73 2a 20 6e 75 6d 2d 72 75 6e 6e 69 6e  ests* num-runnin
1590: 67 29 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 28  g))..(begin..  (
15a0: 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 6d  debug:print 2 "m
15b0: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f  ax-concurrent-jo
15c0: 62 73 3a 20 22 20 6d 61 78 2d 63 6f 6e 63 75 72  bs: " max-concur
15d0: 72 65 6e 74 2d 6a 6f 62 73 20 22 2c 20 6e 75 6d  rent-jobs ", num
15e0: 2d 72 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d  -running: " num-
15f0: 72 75 6e 6e 69 6e 67 29 0a 09 20 20 28 73 65 74  running)..  (set
1600: 21 20 2a 6c 61 73 74 2d 6e 75 6d 2d 72 75 6e 6e  ! *last-num-runn
1610: 69 6e 67 2d 74 65 73 74 73 2a 20 6e 75 6d 2d 72  ing-tests* num-r
1620: 75 6e 6e 69 6e 67 29 29 29 0a 20 20 20 20 28 69  unning))).    (i
1630: 66 20 28 6e 6f 74 20 28 65 71 3f 20 30 20 2a 67  f (not (eq? 0 *g
1640: 6c 6f 62 61 6c 65 78 69 74 73 74 61 74 75 73 2a  lobalexitstatus*
1650: 29 29 0a 09 28 6c 69 73 74 20 23 66 20 6e 75 6d  ))..(list #f num
1660: 2d 72 75 6e 6e 69 6e 67 20 6e 75 6d 2d 72 75 6e  -running num-run
1670: 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70  ning-in-jobgroup
1680: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d   max-concurrent-
1690: 6a 6f 62 73 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c  jobs job-group-l
16a0: 69 6d 69 74 29 0a 09 28 6c 65 74 20 28 28 63 61  imit)..(let ((ca
16b0: 6e 2d 6e 6f 74 2d 72 75 6e 2d 6d 6f 72 65 20 28  n-not-run-more (
16c0: 63 6f 6e 64 0a 09 09 09 09 20 3b 3b 20 69 66 20  cond..... ;; if 
16d0: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a  max-concurrent-j
16e0: 6f 62 73 20 69 73 20 73 65 74 20 61 6e 64 20 74  obs is set and t
16f0: 68 65 20 6e 75 6d 62 65 72 20 72 75 6e 6e 69 6e  he number runnin
1700: 67 20 69 73 20 67 72 65 61 74 65 72 20 0a 09 09  g is greater ...
1710: 09 09 20 3b 3b 20 74 68 61 6e 20 69 74 20 74 68  .. ;; than it th
1720: 61 6e 20 63 61 6e 6e 6f 74 20 72 75 6e 20 6d 6f  an cannot run mo
1730: 72 65 20 6a 6f 62 73 0a 09 09 09 09 20 28 28 61  re jobs..... ((a
1740: 6e 64 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e  nd max-concurren
1750: 74 2d 6a 6f 62 73 20 28 3e 3d 20 6e 75 6d 2d 72  t-jobs (>= num-r
1760: 75 6e 6e 69 6e 67 20 6d 61 78 2d 63 6f 6e 63 75  unning max-concu
1770: 72 72 65 6e 74 2d 6a 6f 62 73 29 29 0a 09 09 09  rrent-jobs))....
1780: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  .  (debug:print 
1790: 30 20 22 57 41 52 4e 49 4e 47 3a 20 4d 61 78 20  0 "WARNING: Max 
17a0: 72 75 6e 6e 69 6e 67 20 6a 6f 62 73 20 65 78 63  running jobs exc
17b0: 65 65 64 65 64 2c 20 63 75 72 72 65 6e 74 20 6e  eeded, current n
17c0: 75 6d 62 65 72 20 72 75 6e 6e 69 6e 67 3a 20 22  umber running: "
17d0: 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 0a 09 09   num-running ...
17e0: 09 09 09 20 20 20 20 20 20 20 22 2c 20 6d 61 78  ...       ", max
17f0: 5f 63 6f 6e 63 75 72 72 65 6e 74 5f 6a 6f 62 73  _concurrent_jobs
1800: 3a 20 22 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65  : " max-concurre
1810: 6e 74 2d 6a 6f 62 73 29 0a 09 09 09 09 20 20 23  nt-jobs).....  #
1820: 74 29 0a 09 09 09 09 20 3b 3b 20 69 66 20 6a 6f  t)..... ;; if jo
1830: 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 20 69 73  b-group-limit is
1840: 20 73 65 74 20 61 6e 64 20 6e 75 6d 62 65 72 20   set and number 
1850: 6f 66 20 6a 6f 62 73 20 69 6e 20 74 68 65 20 67  of jobs in the g
1860: 72 6f 75 70 20 69 73 20 67 72 65 61 74 65 72 0a  roup is greater.
1870: 09 09 09 09 20 3b 3b 20 74 68 61 6e 20 74 68 65  .... ;; than the
1880: 20 6c 69 6d 69 74 20 74 68 65 6e 20 63 61 6e 6e   limit then cann
1890: 6f 74 20 72 75 6e 20 6d 6f 72 65 20 6a 6f 62 73  ot run more jobs
18a0: 20 6f 66 20 74 68 69 73 20 6b 69 6e 64 0a 09 09   of this kind...
18b0: 09 09 20 28 28 61 6e 64 20 6a 6f 62 2d 67 72 6f  .. ((and job-gro
18c0: 75 70 2d 6c 69 6d 69 74 0a 09 09 09 09 20 20 20  up-limit.....   
18d0: 20 20 20 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e      (>= num-runn
18e0: 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20  ing-in-jobgroup 
18f0: 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 29  job-group-limit)
1900: 29 0a 09 09 09 09 20 20 28 64 65 62 75 67 3a 70  ).....  (debug:p
1910: 72 69 6e 74 20 31 20 22 57 41 52 4e 49 4e 47 3a  rint 1 "WARNING:
1920: 20 6e 75 6d 62 65 72 20 6f 66 20 6a 6f 62 73 20   number of jobs 
1930: 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e  " num-running-in
1940: 2d 6a 6f 62 67 72 6f 75 70 20 0a 09 09 09 09 09  -jobgroup ......
1950: 20 20 20 20 20 20 20 22 20 69 6e 20 22 20 6a 6f         " in " jo
1960: 62 67 72 6f 75 70 20 22 20 65 78 63 65 65 64 65  bgroup " exceede
1970: 64 2c 20 77 69 6c 6c 20 6e 6f 74 20 72 75 6e 20  d, will not run 
1980: 22 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65  " (tests:testque
1990: 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20  ue-get-testname 
19a0: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09  test-record))...
19b0: 09 09 20 20 23 74 29 0a 09 09 09 09 20 28 65 6c  ..  #t)..... (el
19c0: 73 65 20 23 66 29 29 29 29 0a 09 20 20 28 6c 69  se #f))))..  (li
19d0: 73 74 20 28 6e 6f 74 20 63 61 6e 2d 6e 6f 74 2d  st (not can-not-
19e0: 72 75 6e 2d 6d 6f 72 65 29 20 6e 75 6d 2d 72 75  run-more) num-ru
19f0: 6e 6e 69 6e 67 20 6e 75 6d 2d 72 75 6e 6e 69 6e  nning num-runnin
1a00: 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 6d 61  g-in-jobgroup ma
1a10: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62  x-concurrent-job
1a20: 73 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69  s job-group-limi
1a30: 74 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d  t)))))..;;======
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 3d 3d 3d 3d 3d 3d  ================
1a80: 0a 3b 3b 20 4e 65 77 20 6d 65 74 68 6f 64 6f 6c  .;; New methodol
1a90: 6f 67 79 2e 20 54 68 65 73 65 20 72 6f 75 74 69  ogy. These routi
1aa0: 6e 65 73 20 77 69 6c 6c 20 72 65 70 6c 61 63 65  nes will replace
1ab0: 20 74 68 65 20 61 62 6f 76 65 20 69 6e 20 74 69   the above in ti
1ac0: 6d 65 2e 20 46 6f 72 0a 3b 3b 20 6e 6f 77 20 74  me. For.;; now t
1ad0: 68 65 20 63 6f 64 65 20 69 73 20 64 75 70 6c 69  he code is dupli
1ae0: 63 61 74 65 64 2e 20 54 68 69 73 20 73 74 75 66  cated. This stuf
1af0: 66 20 69 73 20 69 6e 69 74 69 61 6c 6c 79 20 75  f is initially u
1b00: 73 65 64 20 69 6e 20 74 68 65 20 6d 6f 6e 69 74  sed in the monit
1b10: 6f 72 0a 3b 3b 20 62 61 73 65 64 20 63 6f 64 65  or.;; based code
1b20: 2e 0a 3b 3b 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 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 72  ==========..;; r
1b70: 65 67 69 73 74 65 72 20 61 20 74 65 73 74 20 72  egister a test r
1b80: 75 6e 20 77 69 74 68 20 74 68 65 20 64 62 0a 28  un with the db.(
1b90: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 65 67  define (runs:reg
1ba0: 69 73 74 65 72 2d 72 75 6e 20 64 62 20 6b 65 79  ister-run db key
1bb0: 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e  s keyvallst runn
1bc0: 61 6d 65 20 73 74 61 74 65 20 73 74 61 74 75 73  ame state status
1bd0: 20 75 73 65 72 29 0a 20 20 28 64 65 62 75 67 3a   user).  (debug:
1be0: 70 72 69 6e 74 20 33 20 22 72 75 6e 73 3a 72 65  print 3 "runs:re
1bf0: 67 69 73 74 65 72 2d 72 75 6e 2c 20 6b 65 79 73  gister-run, keys
1c00: 3a 20 22 20 6b 65 79 73 20 22 20 6b 65 79 76 61  : " keys " keyva
1c10: 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73  llst: " keyvalls
1c20: 74 20 22 20 72 75 6e 6e 61 6d 65 3a 20 22 20 72  t " runname: " r
1c30: 75 6e 6e 61 6d 65 20 22 20 73 74 61 74 65 3a 20  unname " state: 
1c40: 22 20 73 74 61 74 65 20 22 20 73 74 61 74 75 73  " state " status
1c50: 3a 20 22 20 73 74 61 74 75 73 20 22 20 75 73 65  : " status " use
1c60: 72 3a 20 22 20 75 73 65 72 29 0a 20 20 28 6c 65  r: " user).  (le
1c70: 74 2a 20 28 28 6b 65 79 73 74 72 20 20 20 20 28  t* ((keystr    (
1c80: 6b 65 79 73 2d 3e 6b 65 79 73 74 72 20 6b 65 79  keys->keystr key
1c90: 73 29 29 0a 09 20 28 63 6f 6d 6d 61 20 20 20 20  s)).. (comma    
1ca0: 20 28 69 66 20 28 3e 20 28 6c 65 6e 67 74 68 20   (if (> (length 
1cb0: 6b 65 79 73 29 20 30 29 20 22 2c 22 20 22 22 29  keys) 0) "," "")
1cc0: 29 0a 09 20 28 61 6e 64 73 74 72 20 20 20 20 28  ).. (andstr    (
1cd0: 69 66 20 28 3e 20 28 6c 65 6e 67 74 68 20 6b 65  if (> (length ke
1ce0: 79 73 29 20 30 29 20 22 20 41 4e 44 20 22 20 22  ys) 0) " AND " "
1cf0: 22 29 29 0a 09 20 28 76 61 6c 73 6c 6f 74 73 20  ")).. (valslots 
1d00: 20 28 6b 65 79 73 2d 3e 76 61 6c 73 6c 6f 74 73   (keys->valslots
1d10: 20 6b 65 79 73 29 29 20 3b 3b 20 3f 2c 3f 2c 3f   keys)) ;; ?,?,?
1d20: 20 2e 2e 2e 0a 09 20 28 6b 65 79 76 61 6c 73 20   ..... (keyvals 
1d30: 20 20 28 6d 61 70 20 63 61 64 72 20 6b 65 79 76    (map cadr keyv
1d40: 61 6c 6c 73 74 29 29 0a 09 20 28 61 6c 6c 76 61  allst)).. (allva
1d50: 6c 73 20 20 20 28 61 70 70 65 6e 64 20 28 6c 69  ls   (append (li
1d60: 73 74 20 72 75 6e 6e 61 6d 65 20 73 74 61 74 65  st runname state
1d70: 20 73 74 61 74 75 73 20 75 73 65 72 29 20 6b 65   status user) ke
1d80: 79 76 61 6c 73 29 29 0a 09 20 28 71 72 79 76 61  yvals)).. (qryva
1d90: 6c 73 20 20 20 28 61 70 70 65 6e 64 20 28 6c 69  ls   (append (li
1da0: 73 74 20 72 75 6e 6e 61 6d 65 29 20 6b 65 79 76  st runname) keyv
1db0: 61 6c 73 29 29 0a 09 20 28 6b 65 79 3d 3f 73 74  als)).. (key=?st
1dc0: 72 20 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72  r  (string-inter
1dd0: 73 70 65 72 73 65 20 28 6d 61 70 20 28 6c 61 6d  sperse (map (lam
1de0: 62 64 61 20 28 6b 29 28 63 6f 6e 63 20 28 6b 65  bda (k)(conc (ke
1df0: 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20  y:get-fieldname 
1e00: 6b 29 20 22 3d 3f 22 29 29 20 6b 65 79 73 29 20  k) "=?")) keys) 
1e10: 22 20 41 4e 44 20 22 29 29 29 0a 20 20 20 20 28  " AND "))).    (
1e20: 64 65 62 75 67 3a 70 72 69 6e 74 20 33 20 22 6b  debug:print 3 "k
1e30: 65 79 73 3a 20 22 20 6b 65 79 73 20 22 20 61 6c  eys: " keys " al
1e40: 6c 76 61 6c 73 3a 20 22 20 61 6c 6c 76 61 6c 73  lvals: " allvals
1e50: 20 22 20 6b 65 79 76 61 6c 73 3a 20 22 20 6b 65   " keyvals: " ke
1e60: 79 76 61 6c 73 29 0a 20 20 20 20 28 64 65 62 75  yvals).    (debu
1e70: 67 3a 70 72 69 6e 74 20 32 20 22 4e 4f 54 45 3a  g:print 2 "NOTE:
1e80: 20 75 73 69 6e 67 20 74 61 72 67 65 74 20 22 20   using target " 
1e90: 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65  (string-interspe
1ea0: 72 73 65 20 6b 65 79 76 61 6c 73 20 22 2f 22 29  rse keyvals "/")
1eb0: 20 22 20 66 6f 72 20 74 68 69 73 20 72 75 6e 22   " for this run"
1ec0: 29 0a 20 20 20 20 28 69 66 20 28 61 6e 64 20 72  ).    (if (and r
1ed0: 75 6e 6e 61 6d 65 20 28 6e 75 6c 6c 3f 20 28 66  unname (null? (f
1ee0: 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78  ilter (lambda (x
1ef0: 29 28 6e 6f 74 20 78 29 29 20 6b 65 79 76 61 6c  )(not x)) keyval
1f00: 73 29 29 29 20 3b 3b 20 74 68 65 72 65 20 6d 75  s))) ;; there mu
1f10: 73 74 20 62 65 20 61 20 62 65 74 74 65 72 20 77  st be a better w
1f20: 61 79 20 74 6f 20 22 61 70 70 6c 79 20 61 6e 64  ay to "apply and
1f30: 22 0a 09 28 6c 65 74 20 28 28 72 65 73 20 23 66  "..(let ((res #f
1f40: 29 29 0a 09 20 20 28 61 70 70 6c 79 20 73 71 6c  ))..  (apply sql
1f50: 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 20  ite3:execute db 
1f60: 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52  (conc "INSERT OR
1f70: 20 49 47 4e 4f 52 45 20 49 4e 54 4f 20 72 75 6e   IGNORE INTO run
1f80: 73 20 28 72 75 6e 6e 61 6d 65 2c 73 74 61 74 65  s (runname,state
1f90: 2c 73 74 61 74 75 73 2c 6f 77 6e 65 72 2c 65 76  ,status,owner,ev
1fa0: 65 6e 74 5f 74 69 6d 65 22 20 63 6f 6d 6d 61 20  ent_time" comma 
1fb0: 6b 65 79 73 74 72 20 22 29 20 56 41 4c 55 45 53  keystr ") VALUES
1fc0: 20 28 3f 2c 3f 2c 3f 2c 3f 2c 73 74 72 66 74 69   (?,?,?,?,strfti
1fd0: 6d 65 28 27 25 73 27 2c 27 6e 6f 77 27 29 22 20  me('%s','now')" 
1fe0: 63 6f 6d 6d 61 20 76 61 6c 73 6c 6f 74 73 20 22  comma valslots "
1ff0: 29 3b 22 29 0a 09 09 20 61 6c 6c 76 61 6c 73 29  );")... allvals)
2000: 0a 09 20 20 28 61 70 70 6c 79 20 73 71 6c 69 74  ..  (apply sqlit
2010: 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 20  e3:for-each-row 
2020: 0a 09 20 20 20 28 6c 61 6d 62 64 61 20 28 69 64  ..   (lambda (id
2030: 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 65  )..     (set! re
2040: 73 20 69 64 29 29 0a 09 20 20 20 64 62 0a 09 20  s id))..   db.. 
2050: 20 20 28 6c 65 74 20 28 28 71 72 79 20 28 63 6f    (let ((qry (co
2060: 6e 63 20 22 53 45 4c 45 43 54 20 69 64 20 46 52  nc "SELECT id FR
2070: 4f 4d 20 72 75 6e 73 20 57 48 45 52 45 20 28 72  OM runs WHERE (r
2080: 75 6e 6e 61 6d 65 3d 3f 20 22 20 61 6e 64 73 74  unname=? " andst
2090: 72 20 6b 65 79 3d 3f 73 74 72 20 22 29 3b 22 29  r key=?str ");")
20a0: 29 29 0a 09 20 20 20 20 20 3b 28 64 65 62 75 67  ))..     ;(debug
20b0: 3a 70 72 69 6e 74 20 34 20 22 71 72 79 3a 20 22  :print 4 "qry: "
20c0: 20 71 72 79 29 20 0a 09 20 20 20 20 20 71 72 79   qry) ..     qry
20d0: 29 0a 09 20 20 20 71 72 79 76 61 6c 73 29 0a 09  )..   qryvals)..
20e0: 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75    (sqlite3:execu
20f0: 74 65 20 64 62 20 22 55 50 44 41 54 45 20 72 75  te db "UPDATE ru
2100: 6e 73 20 53 45 54 20 73 74 61 74 65 3d 3f 2c 73  ns SET state=?,s
2110: 74 61 74 75 73 3d 3f 20 57 48 45 52 45 20 69 64  tatus=? WHERE id
2120: 3d 3f 3b 22 20 73 74 61 74 65 20 73 74 61 74 75  =?;" state statu
2130: 73 20 72 65 73 29 0a 09 20 20 72 65 73 29 20 0a  s res)..  res) .
2140: 09 28 62 65 67 69 6e 0a 09 20 20 28 64 65 62 75  .(begin..  (debu
2150: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52  g:print 0 "ERROR
2160: 3a 20 43 61 6c 6c 65 64 20 77 69 74 68 6f 75 74  : Called without
2170: 20 61 6c 6c 20 6e 65 63 65 73 73 61 72 79 20 6b   all necessary k
2180: 65 79 73 22 29 0a 09 20 20 23 66 29 29 29 29 0a  eys")..  #f)))).
2190: 0a 3b 3b 20 54 68 69 73 20 69 73 20 61 20 64 75  .;; This is a du
21a0: 70 6c 69 63 61 74 65 20 6f 66 20 72 75 6e 2d 74  plicate of run-t
21b0: 65 73 74 73 20 28 77 68 69 63 68 20 68 61 73 20  ests (which has 
21c0: 62 65 65 6e 20 64 65 70 72 65 63 61 74 65 64 29  been deprecated)
21d0: 2e 20 55 73 65 20 74 68 69 73 20 6f 6e 65 20 69  . Use this one i
21e0: 6e 73 74 65 61 64 20 6f 66 20 72 75 6e 20 74 65  nstead of run te
21f0: 73 74 73 2e 0a 3b 3b 20 6b 65 79 76 61 6c 73 2e  sts..;; keyvals.
2200: 0a 3b 3b 0a 3b 3b 20 20 74 65 73 74 2d 6e 61 6d  .;;.;;  test-nam
2210: 65 73 3a 20 43 6f 6d 6d 61 20 73 65 70 61 72 61  es: Comma separa
2220: 74 65 64 20 70 61 74 74 65 72 6e 73 20 73 61 6d  ted patterns sam
2230: 65 20 61 73 20 74 65 73 74 2d 70 61 74 74 73 20  e as test-patts 
2240: 62 75 74 20 75 73 65 64 20 69 6e 20 73 65 6c 65  but used in sele
2250: 63 74 69 6f 6e 20 0a 3b 3b 20 20 20 20 20 20 20  ction .;;       
2260: 20 20 20 20 20 20 20 6f 66 20 74 65 73 74 73 20         of tests 
2270: 74 6f 20 72 75 6e 2e 20 54 68 65 20 69 74 65 6d  to run. The item
2280: 20 70 6f 72 74 69 6f 6e 73 20 61 72 65 20 6e 6f   portions are no
2290: 74 20 72 65 73 70 65 63 74 65 64 2e 0a 3b 3b 20  t respected..;; 
22a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 46 49 58               FIX
22b0: 4d 45 3a 20 65 72 72 6f 72 20 6f 75 74 20 69 66  ME: error out if
22c0: 20 2f 70 61 74 74 20 73 70 65 63 69 66 69 65 64   /patt specified
22d0: 0a 3b 3b 20 20 20 20 20 20 20 20 20 20 20 20 0a  .;;            .
22e0: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 75  (define (runs:ru
22f0: 6e 2d 74 65 73 74 73 20 74 61 72 67 65 74 20 72  n-tests target r
2300: 75 6e 6e 61 6d 65 20 74 65 73 74 2d 6e 61 6d 65  unname test-name
2310: 73 20 74 65 73 74 2d 70 61 74 74 73 20 75 73 65  s test-patts use
2320: 72 20 66 6c 61 67 73 29 0a 20 20 28 63 6f 6d 6d  r flags).  (comm
2330: 6f 6e 3a 63 6c 65 61 72 2d 63 61 63 68 65 73 29  on:clear-caches)
2340: 20 3b 3b 20 63 6c 65 61 72 20 61 6c 6c 20 63 61   ;; clear all ca
2350: 63 68 65 73 0a 20 20 28 6c 65 74 2a 20 28 28 64  ches.  (let* ((d
2360: 62 20 20 20 20 20 20 20 20 20 20 23 66 29 0a 09  b          #f)..
2370: 20 28 6b 65 79 73 20 20 20 20 20 20 20 20 28 63   (keys        (c
2380: 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64 62  db:remote-run db
2390: 3a 67 65 74 2d 6b 65 79 73 20 23 66 29 29 0a 09  :get-keys #f))..
23a0: 20 28 6b 65 79 76 61 6c 6c 73 74 20 20 20 28 6b   (keyvallst   (k
23b0: 65 79 73 3a 74 61 72 67 65 74 2d 3e 6b 65 79 76  eys:target->keyv
23c0: 61 6c 20 6b 65 79 73 20 74 61 72 67 65 74 29 29  al keys target))
23d0: 0a 09 20 28 72 75 6e 2d 69 64 20 20 20 20 20 20  .. (run-id      
23e0: 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20  (cdb:remote-run 
23f0: 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75  runs:register-ru
2400: 6e 20 23 66 20 6b 65 79 73 20 6b 65 79 76 61 6c  n #f keys keyval
2410: 6c 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e 65 77  lst runname "new
2420: 22 20 22 6e 2f 61 22 20 75 73 65 72 29 29 20 20  " "n/a" user))  
2430: 3b 3b 20 20 74 65 73 74 2d 6e 61 6d 65 29 29 29  ;;  test-name)))
2440: 0a 09 20 28 6b 65 79 76 61 6c 73 20 20 20 20 20  .. (keyvals     
2450: 28 69 66 20 72 75 6e 2d 69 64 20 28 63 64 62 3a  (if run-id (cdb:
2460: 72 65 6d 6f 74 65 2d 72 75 6e 20 64 62 3a 67 65  remote-run db:ge
2470: 74 2d 6b 65 79 2d 76 61 6c 73 20 23 66 20 72 75  t-key-vals #f ru
2480: 6e 2d 69 64 29 20 23 66 29 29 0a 09 20 28 64 65  n-id) #f)).. (de
2490: 66 65 72 72 65 64 20 20 20 20 27 28 29 29 20 3b  ferred    '()) ;
24a0: 3b 20 64 65 6c 61 79 20 72 75 6e 6e 69 6e 67 20  ; delay running 
24b0: 74 68 65 73 65 20 73 69 6e 63 65 20 74 68 65 79  these since they
24c0: 20 68 61 76 65 20 61 20 77 61 69 74 6f 6e 20 63   have a waiton c
24d0: 6c 61 75 73 65 0a 09 20 3b 3b 20 6b 65 65 70 67  lause.. ;; keepg
24e0: 6f 69 6e 67 20 69 73 20 74 68 65 20 64 65 66 61  oing is the defa
24f0: 63 74 6f 20 6d 6f 64 61 6c 69 74 79 20 6e 6f 77  cto modality now
2500: 2c 20 77 69 6c 6c 20 61 64 64 20 68 69 74 2d 6e  , will add hit-n
2510: 2d 72 75 6e 20 61 20 62 69 74 20 6c 61 74 65 72  -run a bit later
2520: 0a 09 20 3b 3b 20 28 6b 65 65 70 67 6f 69 6e 67  .. ;; (keepgoing
2530: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72     (hash-table-r
2540: 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73  ef/default flags
2550: 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 20 23 66   "-keepgoing" #f
2560: 29 29 0a 09 20 28 72 75 6e 63 6f 6e 66 69 67 66  )).. (runconfigf
2570: 20 20 20 28 63 6f 6e 63 20 20 2a 74 6f 70 70 61     (conc  *toppa
2580: 74 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 69 67 73  th* "/runconfigs
2590: 2e 63 6f 6e 66 69 67 22 29 29 0a 09 20 28 72 65  .config")).. (re
25a0: 71 75 69 72 65 64 2d 74 65 73 74 73 20 27 28 29  quired-tests '()
25b0: 29 0a 09 20 28 74 65 73 74 2d 72 65 63 6f 72 64  ).. (test-record
25c0: 73 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62  s (make-hash-tab
25d0: 6c 65 29 29 29 0a 0a 20 20 20 20 28 73 65 74 2d  le)))..    (set-
25e0: 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72  megatest-env-var
25f0: 73 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65  s run-id) ;; the
2600: 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64  se may be needed
2610: 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e   by the launchin
2620: 67 20 70 72 6f 63 65 73 73 0a 0a 20 20 20 20 28  g process..    (
2630: 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f  if (file-exists?
2640: 20 72 75 6e 63 6f 6e 66 69 67 66 29 0a 09 28 73   runconfigf)..(s
2650: 65 74 75 70 2d 65 6e 76 2d 64 65 66 61 75 6c 74  etup-env-default
2660: 73 20 72 75 6e 63 6f 6e 66 69 67 66 20 72 75 6e  s runconfigf run
2670: 2d 69 64 20 2a 61 6c 72 65 61 64 79 2d 73 65 65  -id *already-see
2680: 6e 2d 72 75 6e 63 6f 6e 66 69 67 2d 69 6e 66 6f  n-runconfig-info
2690: 2a 20 6b 65 79 73 20 6b 65 79 76 61 6c 73 20 22  * keys keyvals "
26a0: 70 72 65 2d 6c 61 75 6e 63 68 2d 65 6e 76 2d 76  pre-launch-env-v
26b0: 61 72 73 22 29 0a 09 28 64 65 62 75 67 3a 70 72  ars")..(debug:pr
26c0: 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20  int 0 "WARNING: 
26d0: 59 6f 75 20 64 6f 20 6e 6f 74 20 68 61 76 65 20  You do not have 
26e0: 61 20 72 75 6e 20 63 6f 6e 66 69 67 20 66 69 6c  a run config fil
26f0: 65 3a 20 22 20 72 75 6e 63 6f 6e 66 69 67 66 29  e: " runconfigf)
2700: 29 0a 20 20 20 20 0a 20 20 20 20 3b 3b 20 6c 6f  ).    .    ;; lo
2710: 6f 6b 20 75 70 20 61 6c 6c 20 74 65 73 74 73 20  ok up all tests 
2720: 6d 61 74 63 68 69 6e 67 20 74 68 65 20 63 6f 6d  matching the com
2730: 6d 61 20 73 65 70 61 72 61 74 65 64 20 6c 69 73  ma separated lis
2740: 74 20 6f 66 20 67 6c 6f 62 73 20 69 6e 0a 20 20  t of globs in.  
2750: 20 20 3b 3b 20 74 65 73 74 2d 70 61 74 74 73 20    ;; test-patts 
2760: 28 75 73 69 6e 67 20 25 20 61 73 20 77 69 6c 64  (using % as wild
2770: 63 61 72 64 29 0a 0a 20 20 20 20 28 73 65 74 21  card)..    (set!
2780: 20 74 65 73 74 2d 6e 61 6d 65 73 20 28 74 65 73   test-names (tes
2790: 74 73 3a 67 65 74 2d 76 61 6c 69 64 2d 74 65 73  ts:get-valid-tes
27a0: 74 73 20 2a 74 6f 70 70 61 74 68 2a 20 74 65 73  ts *toppath* tes
27b0: 74 2d 6e 61 6d 65 73 29 29 0a 20 20 20 20 28 73  t-names)).    (s
27c0: 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 28  et! test-names (
27d0: 64 65 6c 65 74 65 2d 64 75 70 6c 69 63 61 74 65  delete-duplicate
27e0: 73 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 0a  s test-names))..
27f0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
2800: 2d 69 6e 66 6f 20 30 20 22 74 65 73 74 20 6e 61  -info 0 "test na
2810: 6d 65 73 20 22 20 74 65 73 74 2d 6e 61 6d 65 73  mes " test-names
2820: 29 0a 0a 20 20 20 20 3b 3b 20 6f 6e 20 74 68 65  )..    ;; on the
2830: 20 66 69 72 73 74 20 70 61 73 73 20 6f 72 20 63   first pass or c
2840: 61 6c 6c 20 74 6f 20 72 75 6e 2d 74 65 73 74 73  all to run-tests
2850: 20 73 65 74 20 46 41 49 4c 53 20 74 6f 20 4e 4f   set FAILS to NO
2860: 54 5f 53 54 41 52 54 45 44 20 69 66 0a 20 20 20  T_STARTED if.   
2870: 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 20 69   ;; -keepgoing i
2880: 73 20 73 70 65 63 69 66 69 65 64 0a 20 20 20 20  s specified.    
2890: 28 69 66 20 28 65 71 3f 20 2a 70 61 73 73 6e 75  (if (eq? *passnu
28a0: 6d 2a 20 30 29 0a 09 28 62 65 67 69 6e 0a 09 20  m* 0)..(begin.. 
28b0: 20 3b 3b 20 68 61 76 65 20 74 6f 20 64 65 6c 65   ;; have to dele
28c0: 74 65 20 74 65 73 74 20 72 65 63 6f 72 64 73 20  te test records 
28d0: 77 68 65 72 65 20 4e 4f 54 5f 53 54 41 52 54 45  where NOT_STARTE
28e0: 44 20 73 69 6e 63 65 20 74 68 65 79 20 63 61 6e  D since they can
28f0: 20 63 61 75 73 65 20 2d 6b 65 65 70 67 6f 69 6e   cause -keepgoin
2900: 67 20 74 6f 20 0a 09 20 20 3b 3b 20 67 65 74 20  g to ..  ;; get 
2910: 73 74 75 63 6b 20 64 75 65 20 74 6f 20 62 65 63  stuck due to bec
2920: 6f 6d 69 6e 67 20 69 6e 61 63 63 65 73 73 69 62  oming inaccessib
2930: 6c 65 20 66 72 6f 6d 20 61 20 66 61 69 6c 65 64  le from a failed
2940: 20 74 65 73 74 2e 20 49 2e 65 2e 20 69 66 20 74   test. I.e. if t
2950: 65 73 74 20 42 20 64 65 70 65 6e 64 73 20 0a 09  est B depends ..
2960: 20 20 3b 3b 20 6f 6e 20 74 65 73 74 20 41 20 62    ;; on test A b
2970: 75 74 20 74 65 73 74 20 42 20 72 65 61 63 68 65  ut test B reache
2980: 64 20 74 68 65 20 70 6f 69 6e 74 20 6f 6e 20 62  d the point on b
2990: 65 69 6e 67 20 72 65 67 69 73 74 65 72 65 64 20  eing registered 
29a0: 61 73 20 4e 4f 54 5f 53 54 41 52 54 45 44 20 61  as NOT_STARTED a
29b0: 6e 64 20 74 65 73 74 0a 09 20 20 3b 3b 20 41 20  nd test..  ;; A 
29c0: 66 61 69 6c 65 64 20 66 6f 72 20 73 6f 6d 65 20  failed for some 
29d0: 72 65 61 73 6f 6e 20 74 68 65 6e 20 6f 6e 20 72  reason then on r
29e0: 65 2d 72 75 6e 20 75 73 69 6e 67 20 2d 6b 65 65  e-run using -kee
29f0: 70 67 6f 69 6e 67 20 74 68 65 20 72 75 6e 20 63  pgoing the run c
2a00: 61 6e 20 6e 65 76 65 72 20 63 6f 6d 70 6c 65 74  an never complet
2a10: 65 2e 0a 09 20 20 28 63 64 62 3a 64 65 6c 65 74  e...  (cdb:delet
2a20: 65 2d 74 65 73 74 73 2d 69 6e 2d 73 74 61 74 65  e-tests-in-state
2a30: 20 2a 72 75 6e 72 65 6d 6f 74 65 2a 20 72 75 6e   *runremote* run
2a40: 2d 69 64 20 22 4e 4f 54 5f 53 54 41 52 54 45 44  -id "NOT_STARTED
2a50: 22 29 0a 09 20 20 28 63 64 62 3a 72 65 6d 6f 74  ")..  (cdb:remot
2a60: 65 2d 72 75 6e 20 64 62 3a 73 65 74 2d 74 65 73  e-run db:set-tes
2a70: 74 73 2d 73 74 61 74 65 2d 73 74 61 74 75 73 20  ts-state-status 
2a80: 23 66 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e  #f run-id test-n
2a90: 61 6d 65 73 20 23 66 20 22 46 41 49 4c 22 20 22  ames #f "FAIL" "
2aa0: 4e 4f 54 5f 53 54 41 52 54 45 44 22 20 22 46 41  NOT_STARTED" "FA
2ab0: 49 4c 22 29 29 29 0a 0a 20 20 20 20 3b 3b 20 66  IL")))..    ;; f
2ac0: 72 6f 6d 20 68 65 72 65 20 6f 6e 20 6f 75 74 20  rom here on out 
2ad0: 74 68 65 20 64 62 20 77 69 6c 6c 20 62 65 20 6f  the db will be o
2ae0: 70 65 6e 65 64 20 61 6e 64 20 63 6c 6f 73 65 64  pened and closed
2af0: 20 6f 6e 20 65 76 65 72 79 20 63 61 6c 6c 20 72   on every call r
2b00: 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d 71 75  uns:run-tests-qu
2b10: 65 75 65 0a 20 20 20 20 3b 3b 20 28 73 71 6c 69  eue.    ;; (sqli
2b20: 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62  te3:finalize! db
2b30: 29 20 0a 20 20 20 20 3b 3b 20 6e 6f 77 20 61 64  ) .    ;; now ad
2b40: 64 20 6e 6f 6e 2d 64 69 72 65 63 74 6c 79 20 72  d non-directly r
2b50: 65 66 65 72 65 6e 63 65 64 20 64 65 70 65 6e 64  eferenced depend
2b60: 65 6e 63 69 65 73 20 28 69 2e 65 2e 20 77 61 69  encies (i.e. wai
2b70: 74 6f 6e 29 0a 20 20 20 20 28 69 66 20 28 6e 6f  ton).    (if (no
2b80: 74 20 28 6e 75 6c 6c 3f 20 74 65 73 74 2d 6e 61  t (null? test-na
2b90: 6d 65 73 29 29 0a 09 28 6c 65 74 20 6c 6f 6f 70  mes))..(let loop
2ba0: 20 28 28 68 65 64 20 28 63 61 72 20 74 65 73 74   ((hed (car test
2bb0: 2d 6e 61 6d 65 73 29 29 0a 09 09 20 20 20 28 74  -names))...   (t
2bc0: 61 6c 20 28 63 64 72 20 74 65 73 74 2d 6e 61 6d  al (cdr test-nam
2bd0: 65 73 29 29 29 20 20 20 20 20 20 20 20 20 3b 3b  es)))         ;;
2be0: 20 27 72 65 74 75 72 6e 2d 70 72 6f 63 73 20 74   'return-procs t
2bf0: 65 6c 6c 73 20 74 68 65 20 63 6f 6e 66 69 67 20  ells the config 
2c00: 72 65 61 64 65 72 20 74 6f 20 70 72 65 70 20 72  reader to prep r
2c10: 75 6e 6e 69 6e 67 20 73 79 73 74 65 6d 20 62 75  unning system bu
2c20: 74 20 72 65 74 75 72 6e 20 61 20 70 72 6f 63 0a  t return a proc.
2c30: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d  .  (debug:print-
2c40: 69 6e 66 6f 20 34 20 22 68 65 64 3d 22 20 68 65  info 4 "hed=" he
2c50: 64 20 22 20 61 74 20 74 6f 70 20 6f 66 20 6c 6f  d " at top of lo
2c60: 6f 70 22 29 0a 09 20 20 28 6c 65 74 2a 20 28 28  op")..  (let* ((
2c70: 63 6f 6e 66 69 67 20 20 28 74 65 73 74 73 3a 67  config  (tests:g
2c80: 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 68 65  et-testconfig he
2c90: 64 20 27 72 65 74 75 72 6e 2d 70 72 6f 63 73 29  d 'return-procs)
2ca0: 29 0a 09 09 20 28 77 61 69 74 6f 6e 73 20 28 69  )... (waitons (i
2cb0: 66 20 63 6f 6e 66 69 67 20 28 73 74 72 69 6e 67  f config (string
2cc0: 2d 73 70 6c 69 74 20 28 6c 65 74 20 28 28 77 20  -split (let ((w 
2cd0: 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 63  (config-lookup c
2ce0: 6f 6e 66 69 67 20 22 72 65 71 75 69 72 65 6d 65  onfig "requireme
2cf0: 6e 74 73 22 20 22 77 61 69 74 6f 6e 22 29 29 29  nts" "waiton")))
2d00: 0a 09 09 09 09 09 09 20 20 20 20 20 28 69 66 20  .......     (if 
2d10: 77 20 77 20 22 22 29 29 29 0a 09 09 09 20 20 20  w w "")))....   
2d20: 20 20 20 28 62 65 67 69 6e 0a 09 09 09 09 28 64     (begin.....(d
2d30: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
2d40: 52 4f 52 3a 20 6e 6f 6e 2d 65 78 69 73 74 65 6e  ROR: non-existen
2d50: 74 20 72 65 71 75 69 72 65 64 20 74 65 73 74 20  t required test 
2d60: 5c 22 22 20 68 65 64 20 22 5c 22 22 29 0a 20 20  \"" hed "\"").  
2d70: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
2d80: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69                (i
2d90: 66 20 64 62 20 28 73 71 6c 69 74 65 33 3a 66 69  f db (sqlite3:fi
2da0: 6e 61 6c 69 7a 65 21 20 64 62 29 29 0a 09 09 09  nalize! db))....
2db0: 09 28 65 78 69 74 20 31 29 29 29 29 29 0a 09 20  .(exit 1))))).. 
2dc0: 20 20 20 3b 3b 20 63 68 65 63 6b 20 66 6f 72 20     ;; check for 
2dd0: 68 65 64 20 69 6e 20 77 61 69 74 6f 6e 73 20 3d  hed in waitons =
2de0: 3e 20 74 68 69 73 20 77 6f 75 6c 64 20 62 65 20  > this would be 
2df0: 63 69 72 63 75 6c 61 72 2c 20 72 65 6d 6f 76 65  circular, remove
2e00: 20 69 74 20 61 6e 64 20 69 73 73 75 65 20 61 6e   it and issue an
2e10: 0a 09 20 20 20 20 3b 3b 20 65 72 72 6f 72 0a 09  ..    ;; error..
2e20: 20 20 20 20 28 69 66 20 28 6d 65 6d 62 65 72 20      (if (member 
2e30: 68 65 64 20 77 61 69 74 6f 6e 73 29 0a 09 09 28  hed waitons)...(
2e40: 62 65 67 69 6e 0a 09 09 20 20 28 64 65 62 75 67  begin...  (debug
2e50: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a  :print 0 "ERROR:
2e60: 20 74 65 73 74 20 22 20 68 65 64 20 22 20 68 61   test " hed " ha
2e70: 73 20 6c 69 73 74 65 64 20 69 74 73 65 6c 66 20  s listed itself 
2e80: 61 73 20 61 20 77 61 69 74 6f 6e 2c 20 70 6c 65  as a waiton, ple
2e90: 61 73 65 20 63 6f 72 72 65 63 74 20 74 68 69 73  ase correct this
2ea0: 21 22 29 0a 09 09 20 20 28 73 65 74 21 20 77 61  !")...  (set! wa
2eb0: 69 74 6f 6e 73 20 28 66 69 6c 74 65 72 20 28 6c  itons (filter (l
2ec0: 61 6d 62 64 61 20 28 78 29 28 6e 6f 74 20 28 65  ambda (x)(not (e
2ed0: 71 75 61 6c 3f 20 78 20 68 65 64 29 29 29 20 77  qual? x hed))) w
2ee0: 61 69 74 6f 6e 73 29 29 29 29 0a 09 20 20 20 20  aitons))))..    
2ef0: 0a 09 20 20 20 20 3b 3b 20 28 69 74 65 6d 73 20  ..    ;; (items 
2f00: 20 20 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 65    (items:get-ite
2f10: 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 63  ms-from-config c
2f20: 6f 6e 66 69 67 29 29 29 0a 09 20 20 20 20 28 69  onfig)))..    (i
2f30: 66 20 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 62  f (not (hash-tab
2f40: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 74  le-ref/default t
2f50: 65 73 74 2d 72 65 63 6f 72 64 73 20 68 65 64 20  est-records hed 
2f60: 23 66 29 29 0a 09 09 28 68 61 73 68 2d 74 61 62  #f))...(hash-tab
2f70: 6c 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 63  le-set! test-rec
2f80: 6f 72 64 73 0a 09 09 09 09 20 68 65 64 20 28 76  ords..... hed (v
2f90: 65 63 74 6f 72 20 68 65 64 20 20 20 20 20 3b 3b  ector hed     ;;
2fa0: 20 30 0a 09 09 09 09 09 20 20 20 20 20 63 6f 6e   0......     con
2fb0: 66 69 67 20 20 3b 3b 20 31 0a 09 09 09 09 09 20  fig  ;; 1...... 
2fc0: 20 20 20 20 77 61 69 74 6f 6e 73 20 3b 3b 20 32      waitons ;; 2
2fd0: 0a 09 09 09 09 09 20 20 20 20 20 28 63 6f 6e 66  ......     (conf
2fe0: 69 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 67  ig-lookup config
2ff0: 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20   "requirements" 
3000: 22 70 72 69 6f 72 69 74 79 22 29 20 20 20 20 20  "priority")     
3010: 3b 3b 20 70 72 69 6f 72 69 74 79 20 33 0a 09 09  ;; priority 3...
3020: 09 09 09 20 20 20 20 20 28 6c 65 74 20 28 28 69  ...     (let ((i
3030: 74 65 6d 73 20 20 20 20 20 20 28 68 61 73 68 2d  tems      (hash-
3040: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c  table-ref/defaul
3050: 74 20 63 6f 6e 66 69 67 20 22 69 74 65 6d 73 22  t config "items"
3060: 20 23 66 29 29 20 3b 3b 20 69 74 65 6d 73 20 34   #f)) ;; items 4
3070: 0a 09 09 09 09 09 09 20 20 20 28 69 74 65 6d 73  .......   (items
3080: 74 61 62 6c 65 20 28 68 61 73 68 2d 74 61 62 6c  table (hash-tabl
3090: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63 6f  e-ref/default co
30a0: 6e 66 69 67 20 22 69 74 65 6d 73 74 61 62 6c 65  nfig "itemstable
30b0: 22 20 23 66 29 29 29 20 0a 09 09 09 09 09 20 20  " #f))) ......  
30c0: 20 20 20 20 20 3b 3b 20 69 66 20 65 69 74 68 65       ;; if eithe
30d0: 72 20 69 74 65 6d 73 20 6f 72 20 69 74 65 6d 73  r items or items
30e0: 20 74 61 62 6c 65 20 69 73 20 61 20 70 72 6f 63   table is a proc
30f0: 20 72 65 74 75 72 6e 20 69 74 20 73 6f 20 74 65   return it so te
3100: 73 74 20 72 75 6e 6e 69 6e 67 0a 09 09 09 09 09  st running......
3110: 20 20 20 20 20 20 20 3b 3b 20 70 72 6f 63 65 73         ;; proces
3120: 73 20 63 61 6e 20 6b 6e 6f 77 20 74 6f 20 63 61  s can know to ca
3130: 6c 6c 20 69 74 65 6d 73 3a 67 65 74 2d 69 74 65  ll items:get-ite
3140: 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 0a 09  ms-from-config..
3150: 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20 69 66  ....       ;; if
3160: 20 65 69 74 68 65 72 20 69 73 20 61 20 6c 69 73   either is a lis
3170: 74 20 61 6e 64 20 6e 6f 6e 65 20 69 73 20 61 20  t and none is a 
3180: 70 72 6f 63 20 67 6f 20 61 68 65 61 64 20 61 6e  proc go ahead an
3190: 64 20 63 61 6c 6c 20 67 65 74 2d 69 74 65 6d 73  d call get-items
31a0: 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20  ......       ;; 
31b0: 6f 74 68 65 72 77 69 73 65 20 72 65 74 75 72 6e  otherwise return
31c0: 20 23 66 20 2d 20 74 68 69 73 20 69 73 20 6e 6f   #f - this is no
31d0: 74 20 61 6e 20 69 74 65 72 61 74 65 64 20 74 65  t an iterated te
31e0: 73 74 0a 09 09 09 09 09 20 20 20 20 20 20 20 28  st......       (
31f0: 63 6f 6e 64 0a 09 09 09 09 09 09 28 28 70 72 6f  cond.......((pro
3200: 63 65 64 75 72 65 3f 20 69 74 65 6d 73 29 20 20  cedure? items)  
3210: 20 20 20 20 0a 09 09 09 09 09 09 20 28 64 65 62      ....... (deb
3220: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20  ug:print-info 4 
3230: 22 69 74 65 6d 73 20 69 73 20 61 20 70 72 6f 63  "items is a proc
3240: 65 64 75 72 65 2c 20 77 69 6c 6c 20 63 61 6c 63  edure, will calc
3250: 20 6c 61 74 65 72 22 29 0a 09 09 09 09 09 09 20   later")....... 
3260: 69 74 65 6d 73 29 20 20 20 20 20 20 20 20 20 20  items)          
3270: 20 20 3b 3b 20 63 61 6c 63 20 6c 61 74 65 72 0a    ;; calc later.
3280: 09 09 09 09 09 09 28 28 70 72 6f 63 65 64 75 72  ......((procedur
3290: 65 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 0a 09  e? itemstable)..
32a0: 09 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 69  ..... (debug:pri
32b0: 6e 74 2d 69 6e 66 6f 20 34 20 22 69 74 65 6d 73  nt-info 4 "items
32c0: 74 61 62 6c 65 20 69 73 20 61 20 70 72 6f 63 65  table is a proce
32d0: 64 75 72 65 2c 20 77 69 6c 6c 20 63 61 6c 63 20  dure, will calc 
32e0: 6c 61 74 65 72 22 29 0a 09 09 09 09 09 09 20 69  later")....... i
32f0: 74 65 6d 73 74 61 62 6c 65 29 20 20 20 20 20 20  temstable)      
3300: 20 3b 3b 20 63 61 6c 63 20 6c 61 74 65 72 0a 09   ;; calc later..
3310: 09 09 09 09 09 28 28 66 69 6c 74 65 72 20 28 6c  .....((filter (l
3320: 61 6d 62 64 61 20 28 78 29 0a 09 09 09 09 09 09  ambda (x).......
3330: 09 20 20 20 28 6c 65 74 20 28 28 76 61 6c 20 28  .   (let ((val (
3340: 63 61 72 20 78 29 29 29 0a 09 09 09 09 09 09 09  car x)))........
3350: 20 20 20 20 20 28 69 66 20 28 70 72 6f 63 65 64       (if (proced
3360: 75 72 65 3f 20 76 61 6c 29 20 76 61 6c 20 23 66  ure? val) val #f
3370: 29 29 29 0a 09 09 09 09 09 09 09 20 28 61 70 70  )))........ (app
3380: 65 6e 64 20 28 69 66 20 28 6c 69 73 74 3f 20 69  end (if (list? i
3390: 74 65 6d 73 29 20 69 74 65 6d 73 20 27 28 29 29  tems) items '())
33a0: 0a 09 09 09 09 09 09 09 09 20 28 69 66 20 28 6c  ......... (if (l
33b0: 69 73 74 3f 20 69 74 65 6d 73 74 61 62 6c 65 29  ist? itemstable)
33c0: 20 69 74 65 6d 73 74 61 62 6c 65 20 27 28 29 29   itemstable '())
33d0: 29 29 0a 09 09 09 09 09 09 20 27 68 61 76 65 2d  ))....... 'have-
33e0: 70 72 6f 63 65 64 75 72 65 29 0a 09 09 09 09 09  procedure)......
33f0: 09 28 28 6f 72 20 28 6c 69 73 74 3f 20 69 74 65  .((or (list? ite
3400: 6d 73 29 28 6c 69 73 74 3f 20 69 74 65 6d 73 74  ms)(list? itemst
3410: 61 62 6c 65 29 29 20 3b 3b 20 63 61 6c 63 20 6e  able)) ;; calc n
3420: 6f 77 0a 09 09 09 09 09 09 20 28 64 65 62 75 67  ow....... (debug
3430: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 69  :print-info 4 "i
3440: 74 65 6d 73 20 61 6e 64 20 69 74 65 6d 73 74 61  tems and itemsta
3450: 62 6c 65 20 61 72 65 20 6c 69 73 74 73 2c 20 63  ble are lists, c
3460: 61 6c 63 20 6e 6f 77 5c 6e 22 0a 09 09 09 09 09  alc now\n"......
3470: 09 09 20 20 20 20 20 20 22 20 20 20 20 69 74 65  ..      "    ite
3480: 6d 73 3a 20 22 20 69 74 65 6d 73 20 22 20 69 74  ms: " items " it
3490: 65 6d 73 74 61 62 6c 65 3a 20 22 20 69 74 65 6d  emstable: " item
34a0: 73 74 61 62 6c 65 29 0a 09 09 09 09 09 09 20 28  stable)....... (
34b0: 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d  items:get-items-
34c0: 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 63 6f 6e 66  from-config conf
34d0: 69 67 29 29 0a 09 09 09 09 09 09 28 65 6c 73 65  ig)).......(else
34e0: 20 23 66 29 29 29 20 20 20 20 20 20 20 20 20 20   #f)))          
34f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
3500: 20 3b 3b 20 6e 6f 74 20 69 74 65 72 61 74 65 64   ;; not iterated
3510: 0a 09 09 09 09 09 20 20 20 20 20 23 66 20 20 20  ......     #f   
3520: 20 20 20 3b 3b 20 69 74 65 6d 73 64 61 74 20 35     ;; itemsdat 5
3530: 0a 09 09 09 09 09 20 20 20 20 20 23 66 20 20 20  ......     #f   
3540: 20 20 20 3b 3b 20 73 70 61 72 65 20 2d 20 75 73     ;; spare - us
3550: 65 64 20 66 6f 72 20 69 74 65 6d 2d 70 61 74 68  ed for item-path
3560: 0a 09 09 09 09 09 20 20 20 20 20 29 29 29 0a 09  ......     )))..
3570: 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 09      (for-each ..
3580: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 77 61       (lambda (wa
3590: 69 74 6f 6e 29 0a 09 20 20 20 20 20 20 20 28 69  iton)..       (i
35a0: 66 20 28 61 6e 64 20 77 61 69 74 6f 6e 20 28 6e  f (and waiton (n
35b0: 6f 74 20 28 6d 65 6d 62 65 72 20 77 61 69 74 6f  ot (member waito
35c0: 6e 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a  n test-names))).
35d0: 09 09 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20  ..   (begin...  
35e0: 20 20 20 28 73 65 74 21 20 72 65 71 75 69 72 65     (set! require
35f0: 64 2d 74 65 73 74 73 20 28 63 6f 6e 73 20 77 61  d-tests (cons wa
3600: 69 74 6f 6e 20 72 65 71 75 69 72 65 64 2d 74 65  iton required-te
3610: 73 74 73 29 29 0a 09 09 20 20 20 20 20 28 73 65  sts))...     (se
3620: 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 28 63  t! test-names (c
3630: 6f 6e 73 20 77 61 69 74 6f 6e 20 74 65 73 74 2d  ons waiton test-
3640: 6e 61 6d 65 73 29 29 29 29 29 20 3b 3b 20 77 61  names))))) ;; wa
3650: 73 20 61 6e 20 61 70 70 65 6e 64 2c 20 6e 6f 77  s an append, now
3660: 20 61 20 63 6f 6e 73 0a 09 20 20 20 20 20 77 61   a cons..     wa
3670: 69 74 6f 6e 73 29 0a 09 20 20 20 20 28 6c 65 74  itons)..    (let
3680: 20 28 28 72 65 6d 74 65 73 74 73 20 28 64 65 6c   ((remtests (del
3690: 65 74 65 2d 64 75 70 6c 69 63 61 74 65 73 20 28  ete-duplicates (
36a0: 61 70 70 65 6e 64 20 77 61 69 74 6f 6e 73 20 74  append waitons t
36b0: 61 6c 29 29 29 29 0a 09 20 20 20 20 20 20 28 69  al))))..      (i
36c0: 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65  f (not (null? re
36d0: 6d 74 65 73 74 73 29 29 0a 09 09 20 20 28 6c 6f  mtests))...  (lo
36e0: 6f 70 20 28 63 61 72 20 72 65 6d 74 65 73 74 73  op (car remtests
36f0: 29 28 63 64 72 20 72 65 6d 74 65 73 74 73 29 29  )(cdr remtests))
3700: 29 29 29 29 29 0a 0a 20 20 20 20 28 69 66 20 28  )))))..    (if (
3710: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 71 75 69  not (null? requi
3720: 72 65 64 2d 74 65 73 74 73 29 29 0a 09 28 64 65  red-tests))..(de
3730: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31  bug:print-info 1
3740: 20 22 41 64 64 69 6e 67 20 22 20 72 65 71 75 69   "Adding " requi
3750: 72 65 64 2d 74 65 73 74 73 20 22 20 74 6f 20 74  red-tests " to t
3760: 68 65 20 72 75 6e 20 71 75 65 75 65 22 29 29 0a  he run queue")).
3770: 20 20 20 20 3b 3b 20 4e 4f 54 45 3a 20 74 68 65      ;; NOTE: the
3780: 73 65 20 61 72 65 20 61 6c 6c 20 70 61 72 65 6e  se are all paren
3790: 74 20 74 65 73 74 73 2c 20 69 74 65 6d 73 20 61  t tests, items a
37a0: 72 65 20 6e 6f 74 20 65 78 70 61 6e 64 65 64 20  re not expanded 
37b0: 79 65 74 2e 0a 20 20 20 20 28 64 65 62 75 67 3a  yet..    (debug:
37c0: 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 74 65  print-info 4 "te
37d0: 73 74 2d 72 65 63 6f 72 64 73 3d 22 20 28 68 61  st-records=" (ha
37e0: 73 68 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20  sh-table->alist 
37f0: 74 65 73 74 2d 72 65 63 6f 72 64 73 29 29 0a 20  test-records)). 
3800: 20 20 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73     (runs:run-tes
3810: 74 73 2d 71 75 65 75 65 20 72 75 6e 2d 69 64 20  ts-queue run-id 
3820: 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d 72 65 63  runname test-rec
3830: 6f 72 64 73 20 6b 65 79 76 61 6c 6c 73 74 20 66  ords keyvallst f
3840: 6c 61 67 73 20 74 65 73 74 2d 70 61 74 74 73 29  lags test-patts)
3850: 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  .    (debug:prin
3860: 74 2d 69 6e 66 6f 20 34 20 22 41 6c 6c 20 64 6f  t-info 4 "All do
3870: 6e 65 20 62 79 20 68 65 72 65 22 29 29 29 0a 0a  ne by here")))..
3880: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 63 61  (define (runs:ca
3890: 6c 63 2d 66 61 69 6c 73 20 70 72 65 72 65 71 73  lc-fails prereqs
38a0: 2d 6e 6f 74 2d 6d 65 74 29 0a 20 20 28 66 69 6c  -not-met).  (fil
38b0: 74 65 72 20 28 6c 61 6d 62 64 61 20 28 74 65 73  ter (lambda (tes
38c0: 74 29 0a 09 20 20 20 20 28 61 6e 64 20 28 76 65  t)..    (and (ve
38d0: 63 74 6f 72 3f 20 74 65 73 74 29 20 3b 3b 20 6e  ctor? test) ;; n
38e0: 6f 74 20 28 73 74 72 69 6e 67 3f 20 74 65 73 74  ot (string? test
38f0: 29 29 0a 09 09 20 28 65 71 75 61 6c 3f 20 28 64  ))... (equal? (d
3900: 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 65  b:test-get-state
3910: 20 74 65 73 74 29 20 22 43 4f 4d 50 4c 45 54 45   test) "COMPLETE
3920: 44 22 29 0a 09 09 20 28 6e 6f 74 20 28 6d 65 6d  D")... (not (mem
3930: 62 65 72 20 28 64 62 3a 74 65 73 74 2d 67 65 74  ber (db:test-get
3940: 2d 73 74 61 74 75 73 20 74 65 73 74 29 0a 09 09  -status test)...
3950: 09 20 20 20 20 20 20 27 28 22 50 41 53 53 22 20  .      '("PASS" 
3960: 22 57 41 52 4e 22 20 22 43 48 45 43 4b 22 20 22  "WARN" "CHECK" "
3970: 57 41 49 56 45 44 22 29 29 29 29 29 0a 09 20 20  WAIVED")))))..  
3980: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29  prereqs-not-met)
3990: 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73  )..(define (runs
39a0: 3a 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65  :calc-not-comple
39b0: 74 65 64 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d  ted prereqs-not-
39c0: 6d 65 74 29 0a 20 20 28 66 69 6c 74 65 72 0a 20  met).  (filter. 
39d0: 20 20 28 6c 61 6d 62 64 61 20 28 74 29 0a 20 20    (lambda (t).  
39e0: 20 20 20 28 6f 72 20 28 6e 6f 74 20 28 76 65 63     (or (not (vec
39f0: 74 6f 72 3f 20 74 29 29 0a 09 20 28 6e 6f 74 20  tor? t)).. (not 
3a00: 28 65 71 75 61 6c 3f 20 22 43 4f 4d 50 4c 45 54  (equal? "COMPLET
3a10: 45 44 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74  ED" (db:test-get
3a20: 2d 73 74 61 74 65 20 74 29 29 29 29 29 0a 20 20  -state t))))).  
3a30: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74   prereqs-not-met
3a40: 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e  ))..(define (run
3a50: 73 3a 70 72 65 74 74 79 2d 73 74 72 69 6e 67 20  s:pretty-string 
3a60: 6c 73 74 29 0a 20 20 28 6d 61 70 20 28 6c 61 6d  lst).  (map (lam
3a70: 62 64 61 20 28 74 29 0a 09 20 28 69 66 20 28 6e  bda (t).. (if (n
3a80: 6f 74 20 28 76 65 63 74 6f 72 3f 20 74 29 29 0a  ot (vector? t)).
3a90: 09 20 20 20 20 20 28 63 6f 6e 63 20 74 29 0a 09  .     (conc t)..
3aa0: 20 20 20 20 20 28 63 6f 6e 63 20 28 64 62 3a 74       (conc (db:t
3ab0: 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65  est-get-testname
3ac0: 20 74 29 20 22 3a 22 20 28 64 62 3a 74 65 73 74   t) ":" (db:test
3ad0: 2d 67 65 74 2d 73 74 61 74 65 20 74 29 20 22 2f  -get-state t) "/
3ae0: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73  " (db:test-get-s
3af0: 74 61 74 75 73 20 74 29 29 29 29 0a 20 20 20 20  tatus t)))).    
3b00: 20 20 20 6c 73 74 29 29 0a 0a 28 64 65 66 69 6e     lst))..(defin
3b10: 65 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c  e (runs:make-ful
3b20: 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74  l-test-name test
3b30: 6e 61 6d 65 20 69 74 65 6d 70 61 74 68 29 0a 20  name itempath). 
3b40: 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65   (if (equal? ite
3b50: 6d 70 61 74 68 20 22 22 29 20 74 65 73 74 6e 61  mpath "") testna
3b60: 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d  me (conc testnam
3b70: 65 20 22 2f 22 20 69 74 65 6d 70 61 74 68 29 29  e "/" itempath))
3b80: 29 0a 0a 3b 3b 20 74 65 73 74 2d 72 65 63 6f 72  )..;; test-recor
3b90: 64 73 20 69 73 20 61 20 68 61 73 68 20 74 61 62  ds is a hash tab
3ba0: 6c 65 20 74 65 73 74 6e 61 6d 65 3a 69 74 65 6d  le testname:item
3bb0: 5f 70 61 74 68 20 3d 3e 20 76 65 63 74 6f 72 20  _path => vector 
3bc0: 3c 20 74 65 73 74 6e 61 6d 65 20 74 65 73 74 63  < testname testc
3bd0: 6f 6e 66 69 67 20 77 61 69 74 6f 6e 73 20 70 72  onfig waitons pr
3be0: 69 6f 72 69 74 79 20 69 74 65 6d 73 2d 69 6e 66  iority items-inf
3bf0: 6f 20 2e 2e 2e 20 3e 0a 28 64 65 66 69 6e 65 20  o ... >.(define 
3c00: 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d  (runs:run-tests-
3c10: 71 75 65 75 65 20 72 75 6e 2d 69 64 20 72 75 6e  queue run-id run
3c20: 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64  name test-record
3c30: 73 20 6b 65 79 76 61 6c 6c 73 74 20 66 6c 61 67  s keyvallst flag
3c40: 73 20 74 65 73 74 2d 70 61 74 74 73 29 0a 20 20  s test-patts).  
3c50: 20 20 3b 3b 20 41 74 20 74 68 69 73 20 70 6f 69    ;; At this poi
3c60: 6e 74 20 74 68 65 20 6c 69 73 74 20 6f 66 20 70  nt the list of p
3c70: 61 72 65 6e 74 20 74 65 73 74 73 20 69 73 20 65  arent tests is e
3c80: 78 70 61 6e 64 65 64 20 0a 20 20 20 20 3b 3b 20  xpanded .    ;; 
3c90: 4e 42 2f 2f 20 53 68 6f 75 6c 64 20 65 78 70 61  NB// Should expa
3ca0: 6e 64 20 69 74 65 6d 73 20 68 65 72 65 20 61 6e  nd items here an
3cb0: 64 20 74 68 65 6e 20 69 6e 73 65 72 74 20 69 6e  d then insert in
3cc0: 74 6f 20 74 68 65 20 72 75 6e 20 71 75 65 75 65  to the run queue
3cd0: 2e 0a 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ..  (debug:print
3ce0: 20 35 20 22 74 65 73 74 2d 72 65 63 6f 72 64 73   5 "test-records
3cf0: 3a 20 22 20 74 65 73 74 2d 72 65 63 6f 72 64 73  : " test-records
3d00: 20 22 2c 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22   ", keyvallst: "
3d10: 20 6b 65 79 76 61 6c 6c 73 74 20 22 20 66 6c 61   keyvallst " fla
3d20: 67 73 3a 20 22 20 28 68 61 73 68 2d 74 61 62 6c  gs: " (hash-tabl
3d30: 65 2d 3e 61 6c 69 73 74 20 66 6c 61 67 73 29 29  e->alist flags))
3d40: 0a 20 20 28 6c 65 74 20 28 28 73 6f 72 74 65 64  .  (let ((sorted
3d50: 2d 74 65 73 74 2d 6e 61 6d 65 73 20 28 74 65 73  -test-names (tes
3d60: 74 73 3a 73 6f 72 74 2d 62 79 2d 70 72 69 6f 72  ts:sort-by-prior
3d70: 69 74 79 2d 61 6e 64 2d 77 61 69 74 6f 6e 20 74  ity-and-waiton t
3d80: 65 73 74 2d 72 65 63 6f 72 64 73 29 29 0a 09 28  est-records))..(
3d90: 74 65 73 74 2d 72 65 67 69 73 74 65 72 79 20 20  test-registery  
3da0: 20 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62    (make-hash-tab
3db0: 6c 65 29 29 0a 09 28 6e 75 6d 2d 72 65 74 72 69  le))..(num-retri
3dc0: 65 73 20 20 20 20 20 20 20 20 30 29 0a 09 28 6d  es        0)..(m
3dd0: 61 78 2d 72 65 74 72 69 65 73 20 20 20 20 20 20  ax-retries      
3de0: 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20   (config-lookup 
3df0: 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 73 65 74  *configdat* "set
3e00: 75 70 22 20 22 6d 61 78 72 65 74 72 69 65 73 22  up" "maxretries"
3e10: 29 29 29 0a 20 20 20 20 28 73 65 74 21 20 6d 61  ))).    (set! ma
3e20: 78 2d 72 65 74 72 69 65 73 20 28 69 66 20 28 61  x-retries (if (a
3e30: 6e 64 20 6d 61 78 2d 72 65 74 72 69 65 73 20 28  nd max-retries (
3e40: 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d  string->number m
3e50: 61 78 2d 72 65 74 72 69 65 73 29 29 28 73 74 72  ax-retries))(str
3e60: 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 61 78 2d  ing->number max-
3e70: 72 65 74 72 69 65 73 29 20 31 30 30 29 29 0a 20  retries) 100)). 
3e80: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c     (if (not (nul
3e90: 6c 3f 20 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e  l? sorted-test-n
3ea0: 61 6d 65 73 29 29 0a 09 28 6c 65 74 20 6c 6f 6f  ames))..(let loo
3eb0: 70 20 28 28 68 65 64 20 20 20 20 20 20 20 20 20  p ((hed         
3ec0: 28 63 61 72 20 73 6f 72 74 65 64 2d 74 65 73 74  (car sorted-test
3ed0: 2d 6e 61 6d 65 73 29 29 0a 09 09 20 20 20 28 74  -names))...   (t
3ee0: 61 6c 20 20 20 20 20 20 20 20 20 28 63 64 72 20  al         (cdr 
3ef0: 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65  sorted-test-name
3f00: 73 29 29 0a 09 09 20 20 20 28 72 65 72 75 6e 73  s))...   (reruns
3f10: 20 20 20 20 20 20 27 28 29 29 29 0a 09 20 20 28        '()))..  (
3f20: 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72  if (not (null? r
3f30: 65 72 75 6e 73 29 29 28 64 65 62 75 67 3a 70 72  eruns))(debug:pr
3f40: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 72 65 72 75  int-info 4 "reru
3f50: 6e 73 3d 22 20 72 65 72 75 6e 73 29 29 0a 09 20  ns=" reruns)).. 
3f60: 20 3b 3b 20 28 70 72 69 6e 74 20 22 54 6f 70 20   ;; (print "Top 
3f70: 6f 66 20 6c 6f 6f 70 2c 20 68 65 64 3d 22 20 68  of loop, hed=" h
3f80: 65 64 20 22 2c 20 74 61 6c 3d 22 20 74 61 6c 20  ed ", tal=" tal 
3f90: 22 20 2c 72 65 72 75 6e 73 3d 22 20 72 65 72 75  " ,reruns=" reru
3fa0: 6e 73 29 0a 09 20 20 28 6c 65 74 2a 20 28 28 74  ns)..  (let* ((t
3fb0: 65 73 74 2d 72 65 63 6f 72 64 20 28 68 61 73 68  est-record (hash
3fc0: 2d 74 61 62 6c 65 2d 72 65 66 20 74 65 73 74 2d  -table-ref test-
3fd0: 72 65 63 6f 72 64 73 20 68 65 64 29 29 0a 09 09  records hed))...
3fe0: 20 28 74 65 73 74 2d 6e 61 6d 65 20 20 20 28 74   (test-name   (t
3ff0: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67  ests:testqueue-g
4000: 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74  et-testname test
4010: 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 28 74 63  -record))... (tc
4020: 6f 6e 66 69 67 20 20 20 20 20 28 74 65 73 74 73  onfig     (tests
4030: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74  :testqueue-get-t
4040: 65 73 74 63 6f 6e 66 69 67 20 74 65 73 74 2d 72  estconfig test-r
4050: 65 63 6f 72 64 29 29 0a 09 09 20 28 74 65 73 74  ecord))... (test
4060: 6d 6f 64 65 20 20 20 20 28 6c 65 74 20 28 28 6d  mode    (let ((m
4070: 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20   (config-lookup 
4080: 74 63 6f 6e 66 69 67 20 22 72 65 71 75 69 72 65  tconfig "require
4090: 6d 65 6e 74 73 22 20 22 6d 6f 64 65 22 29 29 29  ments" "mode")))
40a0: 0a 09 09 09 09 28 69 66 20 6d 20 28 73 74 72 69  .....(if m (stri
40b0: 6e 67 2d 3e 73 79 6d 62 6f 6c 20 6d 29 20 27 6e  ng->symbol m) 'n
40c0: 6f 72 6d 61 6c 29 29 29 0a 09 09 20 28 77 61 69  ormal)))... (wai
40d0: 74 6f 6e 73 20 20 20 20 20 28 74 65 73 74 73 3a  tons     (tests:
40e0: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 77 61  testqueue-get-wa
40f0: 69 74 6f 6e 73 20 20 20 20 74 65 73 74 2d 72 65  itons    test-re
4100: 63 6f 72 64 29 29 0a 09 09 20 28 70 72 69 6f 72  cord))... (prior
4110: 69 74 79 20 20 20 20 28 74 65 73 74 73 3a 74 65  ity    (tests:te
4120: 73 74 71 75 65 75 65 2d 67 65 74 2d 70 72 69 6f  stqueue-get-prio
4130: 72 69 74 79 20 20 20 74 65 73 74 2d 72 65 63 6f  rity   test-reco
4140: 72 64 29 29 0a 09 09 20 28 69 74 65 6d 64 61 74  rd))... (itemdat
4150: 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74       (tests:test
4160: 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d 64 61  queue-get-itemda
4170: 74 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64  t    test-record
4180: 29 29 20 3b 3b 20 69 74 65 6d 64 61 74 20 63 61  )) ;; itemdat ca
4190: 6e 20 62 65 20 61 20 73 74 72 69 6e 67 2c 20 6c  n be a string, l
41a0: 69 73 74 20 6f 72 20 23 66 0a 09 09 20 28 69 74  ist or #f... (it
41b0: 65 6d 73 20 20 20 20 20 20 20 28 74 65 73 74 73  ems       (tests
41c0: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 69  :testqueue-get-i
41d0: 74 65 6d 73 20 20 20 20 20 20 74 65 73 74 2d 72  tems      test-r
41e0: 65 63 6f 72 64 29 29 0a 09 09 20 28 69 74 65 6d  ecord))... (item
41f0: 2d 70 61 74 68 20 20 20 28 69 74 65 6d 2d 6c 69  -path   (item-li
4200: 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74  st->path itemdat
4210: 29 29 0a 09 09 20 28 6e 65 77 74 61 6c 20 20 20  ))... (newtal   
4220: 20 20 20 28 61 70 70 65 6e 64 20 74 61 6c 20 28     (append tal (
4230: 6c 69 73 74 20 68 65 64 29 29 29 29 0a 09 20 20  list hed))))..  
4240: 20 20 0a 09 20 20 20 20 28 64 65 62 75 67 3a 70    ..    (debug:p
4250: 72 69 6e 74 20 36 0a 09 09 09 20 22 74 65 73 74  rint 6.... "test
4260: 2d 6e 61 6d 65 3a 20 22 20 74 65 73 74 2d 6e 61  -name: " test-na
4270: 6d 65 0a 09 09 09 20 22 5c 6e 20 20 68 65 64 3a  me.... "\n  hed:
4280: 20 20 20 20 20 20 20 20 20 22 20 68 65 64 0a 09           " hed..
4290: 09 09 20 22 5c 6e 20 20 69 74 65 6d 64 61 74 3a  .. "\n  itemdat:
42a0: 20 20 20 20 20 22 20 69 74 65 6d 64 61 74 0a 09       " itemdat..
42b0: 09 09 20 22 5c 6e 20 20 69 74 65 6d 73 3a 20 20  .. "\n  items:  
42c0: 20 20 20 20 20 22 20 69 74 65 6d 73 0a 09 09 09       " items....
42d0: 20 22 5c 6e 20 20 69 74 65 6d 2d 70 61 74 68 3a   "\n  item-path:
42e0: 20 20 20 22 20 69 74 65 6d 2d 70 61 74 68 0a 09     " item-path..
42f0: 09 09 20 22 5c 6e 20 20 77 61 69 74 6f 6e 73 3a  .. "\n  waitons:
4300: 20 20 20 20 20 22 20 77 61 69 74 6f 6e 73 0a 09       " waitons..
4310: 09 09 20 22 5c 6e 20 20 6e 75 6d 2d 72 65 74 72  .. "\n  num-retr
4320: 69 65 73 3a 20 22 20 6e 75 6d 2d 72 65 74 72 69  ies: " num-retri
4330: 65 73 0a 09 09 09 20 22 5c 6e 20 20 74 61 6c 3a  es.... "\n  tal:
4340: 20 20 20 20 20 20 20 20 20 22 20 74 61 6c 0a 09           " tal..
4350: 09 09 20 22 5c 6e 20 20 72 65 72 75 6e 73 3a 20  .. "\n  reruns: 
4360: 20 20 20 20 20 22 20 72 65 72 75 6e 73 29 0a 0a       " reruns)..
4370: 09 20 20 20 20 3b 3b 20 63 68 65 63 6b 20 66 6f  .    ;; check fo
4380: 72 20 68 65 64 20 69 6e 20 77 61 69 74 6f 6e 73  r hed in waitons
4390: 20 3d 3e 20 74 68 69 73 20 77 6f 75 6c 64 20 62   => this would b
43a0: 65 20 63 69 72 63 75 6c 61 72 2c 20 72 65 6d 6f  e circular, remo
43b0: 76 65 20 69 74 20 61 6e 64 20 69 73 73 75 65 20  ve it and issue 
43c0: 61 6e 0a 09 20 20 20 20 3b 3b 20 65 72 72 6f 72  an..    ;; error
43d0: 0a 09 20 20 20 20 28 69 66 20 28 6d 65 6d 62 65  ..    (if (membe
43e0: 72 20 74 65 73 74 2d 6e 61 6d 65 20 77 61 69 74  r test-name wait
43f0: 6f 6e 73 29 0a 09 09 28 62 65 67 69 6e 0a 09 09  ons)...(begin...
4400: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
4410: 20 22 45 52 52 4f 52 3a 20 74 65 73 74 20 22 20   "ERROR: test " 
4420: 74 65 73 74 2d 6e 61 6d 65 20 22 20 68 61 73 20  test-name " has 
4430: 6c 69 73 74 65 64 20 69 74 73 65 6c 66 20 61 73  listed itself as
4440: 20 61 20 77 61 69 74 6f 6e 2c 20 70 6c 65 61 73   a waiton, pleas
4450: 65 20 63 6f 72 72 65 63 74 20 74 68 69 73 21 22  e correct this!"
4460: 29 0a 09 09 20 20 28 73 65 74 21 20 77 61 69 74  )...  (set! wait
4470: 6f 6e 20 28 66 69 6c 74 65 72 20 28 6c 61 6d 62  on (filter (lamb
4480: 64 61 20 28 78 29 28 6e 6f 74 20 28 65 71 75 61  da (x)(not (equa
4490: 6c 3f 20 78 20 68 65 64 29 29 29 20 77 61 69 74  l? x hed))) wait
44a0: 6f 6e 73 29 29 29 29 0a 0a 09 20 20 20 20 28 63  ons))))...    (c
44b0: 6f 6e 64 20 3b 3b 20 4f 55 54 45 52 20 43 4f 4e  ond ;; OUTER CON
44c0: 44 0a 09 20 20 20 20 20 28 28 6e 6f 74 20 69 74  D..     ((not it
44d0: 65 6d 73 29 20 3b 3b 20 77 68 65 6e 20 66 61 6c  ems) ;; when fal
44e0: 73 65 20 74 68 65 20 74 65 73 74 20 69 73 20 6f  se the test is o
44f0: 6b 20 74 6f 20 62 65 20 68 61 6e 64 65 64 20 6f  k to be handed o
4500: 66 66 20 74 6f 20 6c 61 75 6e 63 68 20 28 62 75  ff to launch (bu
4510: 74 20 6e 6f 74 20 62 65 66 6f 72 65 29 0a 09 20  t not before).. 
4520: 20 20 20 20 20 28 6c 65 74 2a 20 28 28 72 75 6e       (let* ((run
4530: 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 20 20 20  -limits-info    
4540: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
4550: 6c 6f 73 65 20 72 75 6e 73 3a 63 61 6e 2d 72 75  lose runs:can-ru
4560: 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 74 65 73  n-more-tests tes
4570: 74 2d 72 65 63 6f 72 64 29 29 20 3b 3b 20 6c 6f  t-record)) ;; lo
4580: 6f 6b 20 61 74 20 74 68 65 20 74 65 73 74 20 6a  ok at the test j
4590: 6f 62 67 72 6f 75 70 20 61 6e 64 20 74 6f 74 20  obgroup and tot 
45a0: 6a 6f 62 73 20 72 75 6e 6e 69 6e 67 0a 09 09 20  jobs running... 
45b0: 20 20 20 20 28 68 61 76 65 2d 72 65 73 6f 75 72      (have-resour
45c0: 63 65 73 20 20 20 20 20 20 20 20 20 20 28 63 61  ces          (ca
45d0: 72 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66  r run-limits-inf
45e0: 6f 29 29 0a 09 09 20 20 20 20 20 28 6e 75 6d 2d  o))...     (num-
45f0: 72 75 6e 6e 69 6e 67 20 20 20 20 20 20 20 20 20  running         
4600: 20 20 20 20 28 6c 69 73 74 2d 72 65 66 20 72 75      (list-ref ru
4610: 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 31 29  n-limits-info 1)
4620: 29 0a 09 09 20 20 20 20 20 28 6e 75 6d 2d 72 75  )...     (num-ru
4630: 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75  nning-in-jobgrou
4640: 70 20 28 6c 69 73 74 2d 72 65 66 20 72 75 6e 2d  p (list-ref run-
4650: 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 32 29 29 0a  limits-info 2)).
4660: 09 09 20 20 20 20 20 28 6d 61 78 2d 63 6f 6e 63  ..     (max-conc
4670: 75 72 72 65 6e 74 2d 6a 6f 62 73 20 20 20 20 20  urrent-jobs     
4680: 28 6c 69 73 74 2d 72 65 66 20 72 75 6e 2d 6c 69  (list-ref run-li
4690: 6d 69 74 73 2d 69 6e 66 6f 20 33 29 29 0a 09 09  mits-info 3))...
46a0: 20 20 20 20 20 28 6a 6f 62 2d 67 72 6f 75 70 2d       (job-group-
46b0: 6c 69 6d 69 74 20 20 20 20 20 20 20 20 20 28 6c  limit         (l
46c0: 69 73 74 2d 72 65 66 20 72 75 6e 2d 6c 69 6d 69  ist-ref run-limi
46d0: 74 73 2d 69 6e 66 6f 20 34 29 29 0a 09 09 20 20  ts-info 4))...  
46e0: 20 20 20 28 70 72 65 72 65 71 73 2d 6e 6f 74 2d     (prereqs-not-
46f0: 6d 65 74 20 20 20 20 20 20 20 20 20 28 6f 70 65  met         (ope
4700: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67  n-run-close db:g
4710: 65 74 2d 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d  et-prereqs-not-m
4720: 65 74 20 23 66 20 72 75 6e 2d 69 64 20 77 61 69  et #f run-id wai
4730: 74 6f 6e 73 20 69 74 65 6d 2d 70 61 74 68 20 6d  tons item-path m
4740: 6f 64 65 3a 20 74 65 73 74 6d 6f 64 65 29 29 0a  ode: testmode)).
4750: 09 09 20 20 20 20 20 28 66 61 69 6c 73 20 20 20  ..     (fails   
4760: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
4770: 28 72 75 6e 73 3a 63 61 6c 63 2d 66 61 69 6c 73  (runs:calc-fails
4780: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74   prereqs-not-met
4790: 29 29 0a 09 09 20 20 20 20 20 28 6e 6f 6e 2d 63  ))...     (non-c
47a0: 6f 6d 70 6c 65 74 65 64 20 20 20 20 20 20 20 20  ompleted        
47b0: 20 20 20 28 72 75 6e 73 3a 63 61 6c 63 2d 6e 6f     (runs:calc-no
47c0: 74 2d 63 6f 6d 70 6c 65 74 65 64 20 70 72 65 72  t-completed prer
47d0: 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a 09  eqs-not-met)))..
47e0: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e  .(debug:print-in
47f0: 66 6f 20 38 20 22 68 61 76 65 2d 72 65 73 6f 75  fo 8 "have-resou
4800: 72 63 65 73 3a 20 22 20 68 61 76 65 2d 72 65 73  rces: " have-res
4810: 6f 75 72 63 65 73 20 22 20 70 72 65 72 65 71 73  ources " prereqs
4820: 2d 6e 6f 74 2d 6d 65 74 3a 20 22 20 0a 09 09 09  -not-met: " ....
4830: 20 20 20 20 20 28 73 74 72 69 6e 67 2d 69 6e 74       (string-int
4840: 65 72 73 70 65 72 73 65 20 0a 09 09 09 20 20 20  ersperse ....   
4850: 20 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20     (map (lambda 
4860: 28 74 29 0a 09 09 09 09 20 20 20 20 20 28 69 66  (t).....     (if
4870: 20 28 76 65 63 74 6f 72 3f 20 74 29 0a 09 09 09   (vector? t)....
4880: 09 09 20 28 63 6f 6e 63 20 28 64 62 3a 74 65 73  .. (conc (db:tes
4890: 74 2d 67 65 74 2d 73 74 61 74 65 20 74 29 20 22  t-get-state t) "
48a0: 2f 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  /" (db:test-get-
48b0: 73 74 61 74 75 73 20 74 29 29 0a 09 09 09 09 09  status t))......
48c0: 20 28 63 6f 6e 63 20 22 20 57 41 52 4e 49 4e 47   (conc " WARNING
48d0: 3a 20 74 20 69 73 20 6e 6f 74 20 61 20 76 65 63  : t is not a vec
48e0: 74 6f 72 3d 22 20 74 20 29 29 29 0a 09 09 09 09  tor=" t ))).....
48f0: 20 20 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d     prereqs-not-m
4900: 65 74 29 20 22 2c 20 22 29 20 22 20 66 61 69 6c  et) ", ") " fail
4910: 73 3a 20 22 20 66 61 69 6c 73 29 0a 09 09 28 64  s: " fails)...(d
4920: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
4930: 34 20 22 68 65 64 3d 22 20 68 65 64 20 22 5c 6e  4 "hed=" hed "\n
4940: 20 20 74 65 73 74 2d 72 65 63 6f 72 64 3d 22 20    test-record=" 
4950: 74 65 73 74 2d 72 65 63 6f 72 64 20 22 5c 6e 20  test-record "\n 
4960: 20 74 65 73 74 2d 6e 61 6d 65 3a 20 22 20 74 65   test-name: " te
4970: 73 74 2d 6e 61 6d 65 20 22 5c 6e 20 20 69 74 65  st-name "\n  ite
4980: 6d 2d 70 61 74 68 3a 20 22 20 69 74 65 6d 2d 70  m-path: " item-p
4990: 61 74 68 20 22 5c 6e 20 20 74 65 73 74 2d 70 61  ath "\n  test-pa
49a0: 74 74 73 3a 20 22 20 74 65 73 74 2d 70 61 74 74  tts: " test-patt
49b0: 73 29 0a 0a 09 09 3b 3b 20 44 6f 6e 27 74 20 6b  s)....;; Don't k
49c0: 6e 6f 77 20 61 74 20 74 68 69 73 20 74 69 6d 65  now at this time
49d0: 20 69 66 20 74 68 65 20 74 65 73 74 20 68 61 76   if the test hav
49e0: 65 20 62 65 65 6e 20 6c 61 75 6e 63 68 65 64 20  e been launched 
49f0: 61 74 20 73 6f 6d 65 20 74 69 6d 65 20 69 6e 20  at some time in 
4a00: 74 68 65 20 70 61 73 74 0a 09 09 3b 3b 20 69 2e  the past...;; i.
4a10: 65 2e 20 69 73 20 74 68 69 73 20 61 20 72 65 2d  e. is this a re-
4a20: 6c 61 75 6e 63 68 3f 0a 09 09 28 64 65 62 75 67  launch?...(debug
4a30: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 72  :print-info 4 "r
4a40: 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 3d  un-limits-info =
4a50: 20 22 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e   " run-limits-in
4a60: 66 6f 29 0a 09 09 28 63 6f 6e 64 20 3b 3b 20 49  fo)...(cond ;; I
4a70: 4e 4e 45 52 20 43 4f 4e 44 20 23 31 20 66 6f 72  NNER COND #1 for
4a80: 20 61 20 6c 61 75 6e 63 68 61 62 6c 65 20 74 65   a launchable te
4a90: 73 74 0a 09 09 20 3b 3b 20 43 68 65 63 6b 20 69  st... ;; Check i
4aa0: 74 65 6d 20 70 61 74 68 20 61 67 61 69 6e 73 74  tem path against
4ab0: 20 69 74 65 6d 2d 70 61 74 74 73 0a 09 09 20 28   item-patts... (
4ac0: 28 6e 6f 74 20 28 74 65 73 74 73 3a 6d 61 74 63  (not (tests:matc
4ad0: 68 20 74 65 73 74 2d 70 61 74 74 73 20 28 74 65  h test-patts (te
4ae0: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65  sts:testqueue-ge
4af0: 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d  t-testname test-
4b00: 72 65 63 6f 72 64 29 20 69 74 65 6d 2d 70 61 74  record) item-pat
4b10: 68 29 29 20 3b 3b 20 54 68 69 73 20 74 65 73 74  h)) ;; This test
4b20: 2f 69 74 65 6d 70 61 74 68 20 69 73 20 6e 6f 74  /itempath is not
4b30: 20 74 6f 20 62 65 20 72 75 6e 0a 09 09 20 20 3b   to be run...  ;
4b40: 3b 20 65 6c 73 65 20 74 68 65 20 72 75 6e 20 69  ; else the run i
4b50: 73 20 73 74 75 63 6b 2c 20 74 65 6d 70 6f 72 61  s stuck, tempora
4b60: 72 69 6c 79 20 6f 72 20 70 65 72 6d 61 6e 65 6e  rily or permanen
4b70: 74 6c 79 0a 09 09 20 20 3b 3b 20 62 75 74 20 73  tly...  ;; but s
4b80: 68 6f 75 6c 64 20 63 68 65 63 6b 20 69 66 20 69  hould check if i
4b90: 74 20 69 73 20 64 75 65 20 74 6f 20 6c 61 63 6b  t is due to lack
4ba0: 20 6f 66 20 72 65 73 6f 75 72 63 65 73 20 76 73   of resources vs
4bb0: 2e 20 70 72 65 72 65 71 75 69 73 69 74 65 73 0a  . prerequisites.
4bc0: 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ..  (debug:print
4bd0: 2d 69 6e 66 6f 20 31 20 22 53 6b 69 70 70 69 6e  -info 1 "Skippin
4be0: 67 20 22 20 28 74 65 73 74 73 3a 74 65 73 74 71  g " (tests:testq
4bf0: 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d  ueue-get-testnam
4c00: 65 20 74 65 73 74 2d 72 65 63 6f 72 64 29 20 22  e test-record) "
4c10: 20 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20 61   " item-path " a
4c20: 73 20 69 74 20 64 6f 65 73 6e 27 74 20 6d 61 74  s it doesn't mat
4c30: 63 68 20 22 20 74 65 73 74 2d 70 61 74 74 73 29  ch " test-patts)
4c40: 0a 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65  ...  (thread-sle
4c50: 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74  ep! *global-delt
4c60: 61 2a 29 0a 09 09 20 20 28 69 66 20 28 6e 6f 74  a*)...  (if (not
4c70: 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09   (null? tal))...
4c80: 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72        (loop (car
4c90: 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 20 72   tal)(cdr tal) r
4ca0: 65 72 75 6e 73 29 29 29 0a 09 09 20 28 20 3b 3b  eruns)))... ( ;;
4cb0: 20 28 61 6e 64 0a 09 09 20 20 28 6e 6f 74 20 28   (and...  (not (
4cc0: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64  hash-table-ref/d
4cd0: 65 66 61 75 6c 74 20 74 65 73 74 2d 72 65 67 69  efault test-regi
4ce0: 73 74 65 72 79 20 28 72 75 6e 73 3a 6d 61 6b 65  stery (runs:make
4cf0: 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 20  -full-test-name 
4d00: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70  test-name item-p
4d10: 61 74 68 29 20 23 66 29 29 0a 09 09 20 20 20 20  ath) #f))...    
4d20: 20 20 3b 3b 20 28 61 6e 64 20 6d 61 78 2d 63 6f    ;; (and max-co
4d30: 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 28 3e  ncurrent-jobs (>
4d40: 20 28 2d 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65   (- max-concurre
4d50: 6e 74 2d 6a 6f 62 73 20 6e 75 6d 2d 72 75 6e 6e  nt-jobs num-runn
4d60: 69 6e 67 29 20 35 29 29 29 0a 09 09 20 20 28 64  ing) 5)))...  (d
4d70: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
4d80: 34 20 22 50 72 65 2d 72 65 67 69 73 74 65 72 69  4 "Pre-registeri
4d90: 6e 67 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e  ng test " test-n
4da0: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74  ame "/" item-pat
4db0: 68 20 22 20 74 6f 20 63 72 65 61 74 65 20 70 6c  h " to create pl
4dc0: 61 63 65 68 6f 6c 64 65 72 22 20 29 0a 09 09 20  aceholder" )... 
4dd0: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
4de0: 20 64 62 3a 74 65 73 74 73 2d 72 65 67 69 73 74   db:tests-regist
4df0: 65 72 2d 74 65 73 74 20 23 66 20 72 75 6e 2d 69  er-test #f run-i
4e00: 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d  d test-name item
4e10: 2d 70 61 74 68 29 0a 09 09 20 20 28 68 61 73 68  -path)...  (hash
4e20: 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 65 73 74  -table-set! test
4e30: 2d 72 65 67 69 73 74 65 72 79 20 28 72 75 6e 73  -registery (runs
4e40: 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d  :make-full-test-
4e50: 6e 61 6d 65 20 74 65 73 74 2d 6e 61 6d 65 20 69  name test-name i
4e60: 74 65 6d 2d 70 61 74 68 29 20 23 74 29 0a 09 09  tem-path) #t)...
4e70: 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21    (thread-sleep!
4e80: 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29   *global-delta*)
4e90: 0a 28 72 75 6e 73 3a 73 68 72 69 6e 6b 2d 63 61  .(runs:shrink-ca
4ea0: 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73  n-run-more-tests
4eb0: 2d 64 65 6c 61 79 29 0a 09 09 20 20 28 6c 6f 6f  -delay)...  (loo
4ec0: 70 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63  p (car newtal)(c
4ed0: 64 72 20 6e 65 77 74 61 6c 29 20 72 65 72 75 6e  dr newtal) rerun
4ee0: 73 29 29 0a 09 09 20 28 28 6e 6f 74 20 68 61 76  s))... ((not hav
4ef0: 65 2d 72 65 73 6f 75 72 63 65 73 29 20 3b 3b 20  e-resources) ;; 
4f00: 73 69 6d 70 6c 79 20 74 72 79 20 61 67 61 69 6e  simply try again
4f10: 20 61 66 74 65 72 20 77 61 69 74 69 6e 67 20 61   after waiting a
4f20: 20 73 65 63 6f 6e 64 0a 09 09 20 20 28 64 65 62   second...  (deb
4f30: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20  ug:print-info 1 
4f40: 22 6e 6f 20 72 65 73 6f 75 72 63 65 73 20 74 6f  "no resources to
4f50: 20 72 75 6e 20 6e 65 77 20 74 65 73 74 73 2c 20   run new tests, 
4f60: 77 61 69 74 69 6e 67 20 2e 2e 2e 22 29 0a 09 09  waiting ...")...
4f70: 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21    (thread-sleep!
4f80: 20 28 2b 20 32 20 2a 67 6c 6f 62 61 6c 2d 64 65   (+ 2 *global-de
4f90: 6c 74 61 2a 29 29 0a 09 09 20 20 3b 3b 20 63 6f  lta*))...  ;; co
4fa0: 75 6c 64 20 68 61 76 65 20 64 6f 6e 65 20 68 65  uld have done he
4fb0: 64 20 74 61 6c 20 68 65 72 65 20 62 75 74 20 64  d tal here but d
4fc0: 6f 69 6e 67 20 63 61 72 2f 63 64 72 20 6f 66 20  oing car/cdr of 
4fd0: 6e 65 77 74 61 6c 20 74 6f 20 72 6f 74 61 74 65  newtal to rotate
4fe0: 20 74 65 73 74 73 0a 09 09 20 20 28 6c 6f 6f 70   tests...  (loop
4ff0: 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64   (car newtal)(cd
5000: 72 20 6e 65 77 74 61 6c 29 20 72 65 72 75 6e 73  r newtal) reruns
5010: 29 29 0a 09 09 20 28 28 61 6e 64 20 68 61 76 65  ))... ((and have
5020: 2d 72 65 73 6f 75 72 63 65 73 0a 09 09 20 20 20  -resources...   
5030: 20 20 20 20 28 6f 72 20 28 6e 75 6c 6c 3f 20 70      (or (null? p
5040: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a  rereqs-not-met).
5050: 09 09 09 20 20 20 28 61 6e 64 20 28 65 71 3f 20  ...   (and (eq? 
5060: 74 65 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76  testmode 'toplev
5070: 65 6c 29 0a 09 09 09 09 28 6e 75 6c 6c 3f 20 6e  el).....(null? n
5080: 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 29 29 29  on-completed))))
5090: 0a 09 09 20 20 28 72 75 6e 3a 74 65 73 74 20 72  ...  (run:test r
50a0: 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 6b 65  un-id runname ke
50b0: 79 76 61 6c 6c 73 74 20 74 65 73 74 2d 72 65 63  yvallst test-rec
50c0: 6f 72 64 20 66 6c 61 67 73 20 23 66 29 0a 28 72  ord flags #f).(r
50d0: 75 6e 73 3a 73 68 72 69 6e 6b 2d 63 61 6e 2d 72  uns:shrink-can-r
50e0: 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65  un-more-tests-de
50f0: 6c 61 79 29 0a 09 09 20 20 28 74 68 72 65 61 64  lay)...  (thread
5100: 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d  -sleep! *global-
5110: 64 65 6c 74 61 2a 29 0a 09 09 20 20 28 69 66 20  delta*)...  (if 
5120: 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29  (not (null? tal)
5130: 29 0a 09 09 20 20 20 20 20 20 28 6c 6f 6f 70 20  )...      (loop 
5140: 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74 61  (car tal)(cdr ta
5150: 6c 29 20 72 65 72 75 6e 73 29 29 29 0a 09 09 20  l) reruns)))... 
5160: 28 65 6c 73 65 20 3b 3b 20 6d 75 73 74 20 62 65  (else ;; must be
5170: 20 77 65 20 68 61 76 65 20 75 6e 6d 65 74 20 70   we have unmet p
5180: 72 65 72 65 71 75 69 73 69 74 65 73 0a 09 09 20  rerequisites... 
5190: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
51a0: 34 20 22 46 41 49 4c 53 3a 20 22 20 66 61 69 6c  4 "FAILS: " fail
51b0: 73 29 0a 09 09 20 20 20 20 3b 3b 20 49 66 20 6f  s)...    ;; If o
51c0: 6e 65 20 6f 72 20 6d 6f 72 65 20 6f 66 20 74 68  ne or more of th
51d0: 65 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65  e prereqs-not-me
51e0: 74 20 61 72 65 20 46 41 49 4c 20 74 68 65 6e 20  t are FAIL then 
51f0: 77 65 20 63 61 6e 20 69 73 73 75 65 0a 09 09 20  we can issue... 
5200: 20 20 20 3b 3b 20 61 20 6d 65 73 73 61 67 65 20     ;; a message 
5210: 61 6e 64 20 64 72 6f 70 20 68 65 64 20 66 72 6f  and drop hed fro
5220: 6d 20 74 68 65 20 69 74 65 6d 73 20 74 6f 20 62  m the items to b
5230: 65 20 70 72 6f 63 65 73 73 65 64 2e 0a 09 09 20  e processed.... 
5240: 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 66 61     (if (null? fa
5250: 69 6c 73 29 0a 09 09 09 28 62 65 67 69 6e 0a 09  ils)....(begin..
5260: 09 09 20 20 3b 3b 20 63 6f 75 6c 64 6e 27 74 20  ..  ;; couldn't 
5270: 72 75 6e 2c 20 74 61 6b 65 20 61 20 62 72 65 61  run, take a brea
5280: 74 68 65 72 0a 09 09 09 20 20 28 64 65 62 75 67  ther....  (debug
5290: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 53  :print-info 4 "S
52a0: 68 6f 75 6c 64 6e 27 74 20 72 65 61 6c 6c 79 20  houldn't really 
52b0: 67 65 74 20 68 65 72 65 2c 20 72 61 63 65 20 63  get here, race c
52c0: 6f 6e 64 69 74 69 6f 6e 3f 20 55 6e 61 62 6c 65  ondition? Unable
52d0: 20 74 6f 20 6c 61 75 6e 63 68 20 6d 6f 72 65 20   to launch more 
52e0: 74 65 73 74 73 20 61 74 20 74 68 69 73 20 6d 6f  tests at this mo
52f0: 6d 65 6e 74 2c 20 6b 69 6c 6c 69 6e 67 20 74 69  ment, killing ti
5300: 6d 65 20 2e 2e 2e 22 29 0a 09 09 09 20 20 28 74  me ...")....  (t
5310: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20  hread-sleep! (+ 
5320: 30 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c  0.01 *global-del
5330: 74 61 2a 29 29 20 3b 3b 20 6c 6f 6e 67 20 73 6c  ta*)) ;; long sl
5340: 65 65 70 20 68 65 72 65 20 2d 20 6e 6f 20 72 65  eep here - no re
5350: 73 6f 75 72 63 65 73 2c 20 6d 61 79 20 61 73 20  sources, may as 
5360: 77 65 6c 6c 20 62 65 20 70 61 74 69 65 6e 74 0a  well be patient.
5370: 09 09 09 20 20 3b 3b 20 77 65 20 6d 61 64 65 20  ...  ;; we made 
5380: 6e 65 77 20 74 61 6c 20 62 79 20 73 74 69 63 6b  new tal by stick
5390: 69 6e 67 20 68 65 64 20 61 74 20 74 68 65 20 62  ing hed at the b
53a0: 61 63 6b 20 6f 66 20 74 68 65 20 6c 69 73 74 0a  ack of the list.
53b0: 09 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20  ...  (loop (car 
53c0: 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74  newtal)(cdr newt
53d0: 61 6c 29 20 72 65 72 75 6e 73 29 29 0a 09 09 09  al) reruns))....
53e0: 3b 3b 20 74 68 65 20 77 61 69 74 6f 6e 20 69 73  ;; the waiton is
53f0: 20 46 41 49 4c 20 73 6f 20 6e 6f 20 70 6f 69 6e   FAIL so no poin
5400: 74 20 69 6e 20 74 72 79 69 6e 67 20 74 6f 20 72  t in trying to r
5410: 75 6e 20 68 65 64 20 65 76 65 72 20 61 67 61 69  un hed ever agai
5420: 6e 0a 09 09 09 28 69 66 20 28 6e 6f 74 20 28 6e  n....(if (not (n
5430: 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 09 20 20  ull? tal))....  
5440: 20 20 28 69 66 20 28 76 65 63 74 6f 72 3f 20 68    (if (vector? h
5450: 65 64 29 0a 09 09 09 09 28 62 65 67 69 6e 20 28  ed).....(begin (
5460: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 57  debug:print 1 "W
5470: 41 52 4e 3a 20 44 72 6f 70 70 69 6e 67 20 74 65  ARN: Dropping te
5480: 73 74 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65  st " (db:test-ge
5490: 74 2d 74 65 73 74 6e 61 6d 65 20 68 65 64 29 20  t-testname hed) 
54a0: 22 2f 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74  "/" (db:test-get
54b0: 2d 69 74 65 6d 2d 70 61 74 68 20 68 65 64 29 0a  -item-path hed).
54c0: 09 09 09 09 09 09 20 20 20 20 22 20 66 72 6f 6d  ......    " from
54d0: 20 74 68 65 20 6c 61 75 6e 63 68 20 6c 69 73 74   the launch list
54e0: 20 61 73 20 69 74 20 68 61 73 20 70 72 65 72 65   as it has prere
54f0: 71 75 69 73 74 65 73 20 74 68 61 74 20 61 72 65  quistes that are
5500: 20 46 41 49 4c 22 29 0a 28 72 75 6e 73 3a 73 68   FAIL").(runs:sh
5510: 72 69 6e 6b 2d 63 61 6e 2d 72 75 6e 2d 6d 6f 72  rink-can-run-mor
5520: 65 2d 74 65 73 74 73 2d 64 65 6c 61 79 29 0a 09  e-tests-delay)..
5530: 09 09 09 20 20 20 20 20 20 20 28 74 68 72 65 61  ...       (threa
5540: 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c  d-sleep! *global
5550: 2d 64 65 6c 74 61 2a 29 0a 09 09 09 09 20 20 20  -delta*).....   
5560: 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74      (loop (car t
5570: 61 6c 29 28 63 64 72 20 74 61 6c 29 20 28 63 6f  al)(cdr tal) (co
5580: 6e 73 20 68 65 64 20 72 65 72 75 6e 73 29 29 29  ns hed reruns)))
5590: 0a 09 09 09 09 28 62 65 67 69 6e 0a 09 09 09 09  .....(begin.....
55a0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31    (debug:print 1
55b0: 20 22 57 41 52 4e 3a 20 54 65 73 74 20 6e 6f 74   "WARN: Test not
55c0: 20 70 72 6f 63 65 73 73 65 64 20 63 6f 72 72 65   processed corre
55d0: 63 74 6c 79 2e 20 43 6f 75 6c 64 20 62 65 20 61  ctly. Could be a
55e0: 20 72 61 63 65 20 63 6f 6e 64 69 74 69 6f 6e 20   race condition 
55f0: 69 6e 20 79 6f 75 72 20 74 65 73 74 20 69 6d 70  in your test imp
5600: 6c 65 6d 65 6e 74 61 74 69 6f 6e 3f 20 22 20 68  lementation? " h
5610: 65 64 29 20 3b 3b 20 20 22 20 61 73 20 69 74 20  ed) ;;  " as it 
5620: 68 61 73 20 70 72 65 72 65 71 75 69 73 74 65 73  has prerequistes
5630: 20 74 68 61 74 20 61 72 65 20 46 41 49 4c 2e 20   that are FAIL. 
5640: 28 4e 4f 54 45 3a 20 68 65 64 20 69 73 20 6e 6f  (NOTE: hed is no
5650: 74 20 61 20 76 65 63 74 6f 72 29 22 29 0a 28 72  t a vector)").(r
5660: 75 6e 73 3a 73 68 72 69 6e 6b 2d 63 61 6e 2d 72  uns:shrink-can-r
5670: 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65  un-more-tests-de
5680: 6c 61 79 29 0a 09 09 09 09 20 20 28 74 68 72 65  lay).....  (thre
5690: 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 30 2e 30  ad-sleep! (+ 0.0
56a0: 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a  1 *global-delta*
56b0: 29 29 0a 09 09 09 09 20 20 28 6c 6f 6f 70 20 68  )).....  (loop h
56c0: 65 64 20 74 61 6c 20 72 65 72 75 6e 73 29 29 29  ed tal reruns)))
56d0: 29 29 29 29 29 29 20 3b 3b 20 45 4e 44 20 4f 46  )))))) ;; END OF
56e0: 20 49 4e 4e 45 52 20 43 4f 4e 44 0a 09 20 20 20   INNER COND..   
56f0: 20 20 0a 09 20 20 20 20 20 3b 3b 20 63 61 73 65    ..     ;; case
5700: 20 77 68 65 72 65 20 61 6e 20 69 74 65 6d 73 20   where an items 
5710: 63 61 6d 65 20 69 6e 20 61 73 20 61 20 6c 69 73  came in as a lis
5720: 74 20 62 65 65 6e 20 70 72 6f 63 65 73 73 65 64  t been processed
5730: 0a 09 20 20 20 20 20 28 28 61 6e 64 20 28 6c 69  ..     ((and (li
5740: 73 74 3f 20 69 74 65 6d 73 29 20 20 20 20 20 3b  st? items)     ;
5750: 3b 20 74 68 75 73 20 77 65 20 6b 6e 6f 77 20 6f  ; thus we know o
5760: 75 72 20 69 74 65 6d 73 20 61 72 65 20 61 6c 72  ur items are alr
5770: 65 61 64 79 20 63 61 6c 63 75 6c 61 74 65 64 0a  eady calculated.
5780: 09 09 20 20 20 28 6e 6f 74 20 20 20 69 74 65 6d  ..   (not   item
5790: 64 61 74 29 29 20 3b 3b 20 61 6e 64 20 6e 6f 74  dat)) ;; and not
57a0: 20 79 65 74 20 65 78 70 61 6e 64 65 64 20 69 6e   yet expanded in
57b0: 74 6f 20 74 68 65 20 6c 69 73 74 20 6f 66 20 74  to the list of t
57c0: 68 69 6e 67 73 20 74 6f 20 62 65 20 64 6f 6e 65  hings to be done
57d0: 0a 09 20 20 20 20 20 20 28 69 66 20 28 61 6e 64  ..      (if (and
57e0: 20 28 64 65 62 75 67 3a 64 65 62 75 67 2d 6d 6f   (debug:debug-mo
57f0: 64 65 20 31 29 20 3b 3b 20 28 3e 3d 20 2a 76 65  de 1) ;; (>= *ve
5800: 72 62 6f 73 69 74 79 2a 20 31 29 0a 09 09 20 20  rbosity* 1)...  
5810: 20 20 20 20 20 28 3e 20 28 6c 65 6e 67 74 68 20       (> (length 
5820: 69 74 65 6d 73 29 20 30 29 0a 09 09 20 20 20 20  items) 0)...    
5830: 20 20 20 28 3e 20 28 6c 65 6e 67 74 68 20 28 63     (> (length (c
5840: 61 72 20 69 74 65 6d 73 29 29 20 30 29 29 0a 09  ar items)) 0))..
5850: 09 20 20 28 70 70 20 69 74 65 6d 73 29 29 0a 09  .  (pp items))..
5860: 20 20 20 20 20 20 28 66 6f 72 2d 65 61 63 68 0a        (for-each.
5870: 09 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20  .       (lambda 
5880: 28 6d 79 2d 69 74 65 6d 64 61 74 29 0a 09 09 20  (my-itemdat)... 
5890: 28 6c 65 74 2a 20 28 28 6e 65 77 2d 74 65 73 74  (let* ((new-test
58a0: 2d 72 65 63 6f 72 64 20 28 6c 65 74 20 28 28 6e  -record (let ((n
58b0: 65 77 72 65 63 20 28 6d 61 6b 65 2d 74 65 73 74  ewrec (make-test
58c0: 73 3a 74 65 73 74 71 75 65 75 65 29 29 29 0a 09  s:testqueue)))..
58d0: 09 09 09 09 20 20 20 28 76 65 63 74 6f 72 2d 63  ....   (vector-c
58e0: 6f 70 79 21 20 74 65 73 74 2d 72 65 63 6f 72 64  opy! test-record
58f0: 20 6e 65 77 72 65 63 29 0a 09 09 09 09 09 20 20   newrec)......  
5900: 20 6e 65 77 72 65 63 29 29 0a 09 09 09 28 6d 79   newrec))....(my
5910: 2d 69 74 65 6d 2d 70 61 74 68 20 28 69 74 65 6d  -item-path (item
5920: 2d 6c 69 73 74 2d 3e 70 61 74 68 20 6d 79 2d 69  -list->path my-i
5930: 74 65 6d 64 61 74 29 29 29 0a 09 09 20 20 20 28  temdat)))...   (
5940: 69 66 20 28 74 65 73 74 73 3a 6d 61 74 63 68 20  if (tests:match 
5950: 74 65 73 74 2d 70 61 74 74 73 20 68 65 64 20 6d  test-patts hed m
5960: 79 2d 69 74 65 6d 2d 70 61 74 68 29 20 3b 3b 20  y-item-path) ;; 
5970: 28 70 61 74 74 2d 6c 69 73 74 2d 6d 61 74 63 68  (patt-list-match
5980: 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68 20 69 74   my-item-path it
5990: 65 6d 2d 70 61 74 74 73 29 20 20 20 20 20 20 20  em-patts)       
59a0: 20 20 20 20 3b 3b 20 79 65 73 2c 20 77 65 20 77      ;; yes, we w
59b0: 61 6e 74 20 74 6f 20 70 72 6f 63 65 73 73 20 74  ant to process t
59c0: 68 69 73 20 69 74 65 6d 2c 20 4e 4f 54 45 3a 20  his item, NOTE: 
59d0: 53 68 6f 75 6c 64 20 6e 6f 74 20 6e 65 65 64 20  Should not need 
59e0: 74 68 69 73 20 63 68 65 63 6b 20 68 65 72 65 21  this check here!
59f0: 0a 09 09 20 20 20 20 20 20 20 28 6c 65 74 20 28  ...       (let (
5a00: 28 6e 65 77 74 65 73 74 6e 61 6d 65 20 28 72 75  (newtestname (ru
5a10: 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 73  ns:make-full-tes
5a20: 74 2d 6e 61 6d 65 20 68 65 64 20 6d 79 2d 69 74  t-name hed my-it
5a30: 65 6d 2d 70 61 74 68 29 29 29 20 20 20 20 3b 3b  em-path)))    ;;
5a40: 20 74 65 73 74 20 6e 61 6d 65 73 20 61 72 65 20   test names are 
5a50: 75 6e 69 71 75 65 20 6f 6e 20 74 65 73 74 6e 61  unique on testna
5a60: 6d 65 2f 69 74 65 6d 2d 70 61 74 68 0a 09 09 09  me/item-path....
5a70: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75   (tests:testqueu
5a80: 65 2d 73 65 74 2d 69 74 65 6d 73 21 20 20 20 20  e-set-items!    
5a90: 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64   new-test-record
5aa0: 20 23 66 29 0a 09 09 09 20 28 74 65 73 74 73 3a   #f).... (tests:
5ab0: 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74  testqueue-set-it
5ac0: 65 6d 64 61 74 21 20 20 20 6e 65 77 2d 74 65 73  emdat!   new-tes
5ad0: 74 2d 72 65 63 6f 72 64 20 6d 79 2d 69 74 65 6d  t-record my-item
5ae0: 64 61 74 29 0a 09 09 09 20 28 74 65 73 74 73 3a  dat).... (tests:
5af0: 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74  testqueue-set-it
5b00: 65 6d 5f 70 61 74 68 21 20 6e 65 77 2d 74 65 73  em_path! new-tes
5b10: 74 2d 72 65 63 6f 72 64 20 6d 79 2d 69 74 65 6d  t-record my-item
5b20: 2d 70 61 74 68 29 0a 09 09 09 20 28 68 61 73 68  -path).... (hash
5b30: 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 65 73 74  -table-set! test
5b40: 2d 72 65 63 6f 72 64 73 20 6e 65 77 74 65 73 74  -records newtest
5b50: 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74 2d 72 65  name new-test-re
5b60: 63 6f 72 64 29 0a 09 09 09 20 28 73 65 74 21 20  cord).... (set! 
5b70: 74 61 6c 20 28 63 6f 6e 73 20 6e 65 77 74 65 73  tal (cons newtes
5b80: 74 6e 61 6d 65 20 74 61 6c 29 29 29 29 29 29 20  tname tal)))))) 
5b90: 3b 3b 20 73 69 6e 63 65 20 74 68 65 73 65 20 61  ;; since these a
5ba0: 72 65 20 69 74 65 6d 69 7a 65 64 20 63 72 65 61  re itemized crea
5bb0: 74 65 20 6e 65 77 20 74 65 73 74 20 6e 61 6d 65  te new test name
5bc0: 73 20 74 65 73 74 6e 61 6d 65 2f 69 74 65 6d 70  s testname/itemp
5bd0: 61 74 68 0a 09 20 20 20 20 20 20 20 69 74 65 6d  ath..       item
5be0: 73 29 0a 09 20 20 20 20 20 20 28 69 66 20 28 6e  s)..      (if (n
5bf0: 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a  ot (null? tal)).
5c00: 09 09 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20  ..  (begin...   
5c10: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
5c20: 66 6f 20 34 20 22 45 6e 64 20 6f 66 20 69 74 65  fo 4 "End of ite
5c30: 6d 73 20 6c 69 73 74 2c 20 6c 6f 6f 70 69 6e 67  ms list, looping
5c40: 20 77 69 74 68 20 6e 65 78 74 20 61 66 74 65 72   with next after
5c50: 20 73 68 6f 72 74 20 64 65 6c 61 79 22 29 0a 09   short delay")..
5c60: 09 20 20 20 20 28 74 68 72 65 61 64 2d 73 6c 65  .    (thread-sle
5c70: 65 70 21 20 28 2b 20 30 2e 30 31 20 2a 67 6c 6f  ep! (+ 0.01 *glo
5c80: 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09 20  bal-delta*))... 
5c90: 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61     (loop (car ta
5ca0: 6c 29 28 63 64 72 20 74 61 6c 29 20 72 65 72 75  l)(cdr tal) reru
5cb0: 6e 73 29 29 29 29 0a 0a 09 20 20 20 20 20 3b 3b  ns))))...     ;;
5cc0: 20 69 66 20 69 74 65 6d 73 20 69 73 20 61 20 70   if items is a p
5cd0: 72 6f 63 20 74 68 65 6e 20 6e 65 65 64 20 74 6f  roc then need to
5ce0: 20 72 75 6e 20 69 74 65 6d 73 3a 67 65 74 2d 69   run items:get-i
5cf0: 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67  tems-from-config
5d00: 2c 20 67 65 74 20 74 68 65 20 6c 69 73 74 20 61  , get the list a
5d10: 6e 64 20 6c 6f 6f 70 20 0a 09 20 20 20 20 20 3b  nd loop ..     ;
5d20: 3b 20 20 20 20 2d 20 62 75 74 20 6f 6e 6c 79 20  ;    - but only 
5d30: 64 6f 20 74 68 61 74 20 69 66 20 72 65 73 6f 75  do that if resou
5d40: 72 63 65 73 20 65 78 69 73 74 20 74 6f 20 6b 69  rces exist to ki
5d50: 63 6b 20 6f 66 66 20 74 68 65 20 6a 6f 62 0a 09  ck off the job..
5d60: 20 20 20 20 20 28 28 6f 72 20 28 70 72 6f 63 65       ((or (proce
5d70: 64 75 72 65 3f 20 69 74 65 6d 73 29 28 65 71 3f  dure? items)(eq?
5d80: 20 69 74 65 6d 73 20 27 68 61 76 65 2d 70 72 6f   items 'have-pro
5d90: 63 65 64 75 72 65 29 29 0a 09 20 20 20 20 20 20  cedure))..      
5da0: 28 6c 65 74 20 28 28 63 61 6e 2d 72 75 6e 2d 6d  (let ((can-run-m
5db0: 6f 72 65 20 20 20 20 28 72 75 6e 73 3a 63 61 6e  ore    (runs:can
5dc0: 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20  -run-more-tests 
5dd0: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 29 0a 09  test-record)))..
5de0: 09 28 69 66 20 28 61 6e 64 20 28 6c 69 73 74 3f  .(if (and (list?
5df0: 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 29 0a 09   can-run-more)..
5e00: 09 09 20 28 63 61 72 20 63 61 6e 2d 72 75 6e 2d  .. (car can-run-
5e10: 6d 6f 72 65 29 29 0a 09 09 20 20 20 20 28 6c 65  more))...    (le
5e20: 74 2a 20 28 28 70 72 65 72 65 71 73 2d 6e 6f 74  t* ((prereqs-not
5e30: 2d 6d 65 74 20 28 6f 70 65 6e 2d 72 75 6e 2d 63  -met (open-run-c
5e40: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 70 72 65 72  lose db:get-prer
5e50: 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 23 66 20 72  eqs-not-met #f r
5e60: 75 6e 2d 69 64 20 77 61 69 74 6f 6e 73 20 69 74  un-id waitons it
5e70: 65 6d 2d 70 61 74 68 20 6d 6f 64 65 3a 20 74 65  em-path mode: te
5e80: 73 74 6d 6f 64 65 29 29 0a 09 09 09 20 20 20 28  stmode))....   (
5e90: 66 61 69 6c 73 20 20 20 20 20 20 20 20 20 20 20  fails           
5ea0: 28 72 75 6e 73 3a 63 61 6c 63 2d 66 61 69 6c 73  (runs:calc-fails
5eb0: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74   prereqs-not-met
5ec0: 29 29 0a 09 09 09 20 20 20 28 6e 6f 6e 2d 63 6f  ))....   (non-co
5ed0: 6d 70 6c 65 74 65 64 20 20 20 28 72 75 6e 73 3a  mpleted   (runs:
5ee0: 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 74  calc-not-complet
5ef0: 65 64 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d  ed prereqs-not-m
5f00: 65 74 29 29 29 0a 09 09 20 20 20 20 20 20 28 64  et)))...      (d
5f10: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
5f20: 38 20 22 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 3a  8 "can-run-more:
5f30: 20 22 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 0a   " can-run-more.
5f40: 09 09 09 09 20 20 20 22 5c 6e 20 74 65 73 74 6e  ....   "\n testn
5f50: 61 6d 65 3a 20 20 20 20 20 20 20 20 22 20 68 65  ame:        " he
5f60: 64 0a 09 09 09 09 20 20 20 22 5c 6e 20 70 72 65  d.....   "\n pre
5f70: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 3a 20 22 20  reqs-not-met: " 
5f80: 28 72 75 6e 73 3a 70 72 65 74 74 79 2d 73 74 72  (runs:pretty-str
5f90: 69 6e 67 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d  ing prereqs-not-
5fa0: 6d 65 74 29 0a 09 09 09 09 20 20 20 22 5c 6e 20  met).....   "\n 
5fb0: 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 3a 20 20  non-completed:  
5fc0: 20 22 20 28 72 75 6e 73 3a 70 72 65 74 74 79 2d   " (runs:pretty-
5fd0: 73 74 72 69 6e 67 20 6e 6f 6e 2d 63 6f 6d 70 6c  string non-compl
5fe0: 65 74 65 64 29 20 0a 09 09 09 09 20 20 20 22 5c  eted) .....   "\
5ff0: 6e 20 66 61 69 6c 73 3a 20 20 20 20 20 20 20 20  n fails:        
6000: 20 20 20 22 20 28 72 75 6e 73 3a 70 72 65 74 74     " (runs:prett
6010: 79 2d 73 74 72 69 6e 67 20 66 61 69 6c 73 29 0a  y-string fails).
6020: 09 09 09 09 20 20 20 22 5c 6e 20 74 65 73 74 6d  ....   "\n testm
6030: 6f 64 65 3a 20 20 20 20 20 20 20 20 22 20 74 65  ode:        " te
6040: 73 74 6d 6f 64 65 0a 09 09 09 09 20 20 20 22 5c  stmode.....   "\
6050: 6e 20 6e 75 6d 2d 72 65 74 72 69 65 73 3a 20 20  n num-retries:  
6060: 20 20 20 22 20 6e 75 6d 2d 72 65 74 72 69 65 73     " num-retries
6070: 0a 09 09 09 09 20 20 20 22 5c 6e 20 28 65 71 3f  .....   "\n (eq?
6080: 20 74 65 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65   testmode 'tople
6090: 76 65 6c 29 3a 20 22 20 28 65 71 3f 20 74 65 73  vel): " (eq? tes
60a0: 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c 29  tmode 'toplevel)
60b0: 0a 09 09 09 09 20 20 20 22 5c 6e 20 28 6e 75 6c  .....   "\n (nul
60c0: 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64  l? non-completed
60d0: 29 3a 20 20 20 20 22 20 28 6e 75 6c 6c 3f 20 6e  ):    " (null? n
60e0: 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 0a 09 09  on-completed)...
60f0: 09 09 20 20 20 22 5c 6e 20 72 65 72 75 6e 73 3a  ..   "\n reruns:
6100: 20 20 20 20 20 20 20 20 20 20 22 20 72 65 72 75            " reru
6110: 6e 73 0a 09 09 09 09 20 20 20 22 5c 6e 20 69 74  ns.....   "\n it
6120: 65 6d 73 3a 20 20 20 20 20 20 20 20 20 20 20 22  ems:           "
6130: 20 69 74 65 6d 73 0a 09 09 09 09 20 20 20 22 5c   items.....   "\
6140: 6e 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 3a 20  n can-run-more: 
6150: 20 20 20 22 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72     " can-run-mor
6160: 65 29 0a 09 09 20 20 20 20 20 20 3b 3b 20 28 74  e)...      ;; (t
6170: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20  hread-sleep! (+ 
6180: 30 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c  0.01 *global-del
6190: 74 61 2a 29 29 0a 09 09 20 20 20 20 20 20 28 63  ta*))...      (c
61a0: 6f 6e 64 20 3b 3b 20 49 4e 4e 45 52 20 43 4f 4e  ond ;; INNER CON
61b0: 44 20 23 32 0a 09 09 20 20 20 20 20 20 20 28 28  D #2...       ((
61c0: 6f 72 20 28 6e 75 6c 6c 3f 20 70 72 65 72 65 71  or (null? prereq
61d0: 73 2d 6e 6f 74 2d 6d 65 74 29 20 3b 3b 20 61 6c  s-not-met) ;; al
61e0: 6c 20 70 72 65 72 65 71 73 20 6d 65 74 2c 20 66  l prereqs met, f
61f0: 69 72 65 20 6f 66 66 20 74 68 65 20 74 65 73 74  ire off the test
6200: 0a 09 09 09 20 20 20 20 3b 3b 20 6f 72 2c 20 69  ....    ;; or, i
6210: 66 20 69 74 20 69 73 20 61 20 27 74 6f 70 6c 65  f it is a 'tople
6220: 76 65 6c 20 74 65 73 74 20 61 6e 64 20 61 6c 6c  vel test and all
6230: 20 70 72 65 72 65 71 73 20 6e 6f 74 20 6d 65 74   prereqs not met
6240: 20 61 72 65 20 43 4f 4d 50 4c 45 54 45 44 20 74   are COMPLETED t
6250: 68 65 6e 20 6c 61 75 6e 63 68 0a 09 09 09 20 20  hen launch....  
6260: 20 20 28 61 6e 64 20 28 65 71 3f 20 74 65 73 74    (and (eq? test
6270: 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c 29 0a  mode 'toplevel).
6280: 09 09 09 09 20 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d  .... (null? non-
6290: 63 6f 6d 70 6c 65 74 65 64 29 29 29 0a 09 09 09  completed)))....
62a0: 28 6c 65 74 20 28 28 74 65 73 74 2d 6e 61 6d 65  (let ((test-name
62b0: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75   (tests:testqueu
62c0: 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74  e-get-testname t
62d0: 65 73 74 2d 72 65 63 6f 72 64 29 29 29 0a 09 09  est-record)))...
62e0: 09 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 54  .  (setenv "MT_T
62f0: 45 53 54 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e  EST_NAME" test-n
6300: 61 6d 65 29 20 3b 3b 20 0a 09 09 09 20 20 28 73  ame) ;; ....  (s
6310: 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e 4e 41 4d  etenv "MT_RUNNAM
6320: 45 22 20 20 20 72 75 6e 6e 61 6d 65 29 0a 09 09  E"   runname)...
6330: 09 20 20 28 73 65 74 2d 6d 65 67 61 74 65 73 74  .  (set-megatest
6340: 2d 65 6e 76 2d 76 61 72 73 20 72 75 6e 2d 69 64  -env-vars run-id
6350: 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62  ) ;; these may b
6360: 65 20 6e 65 65 64 65 64 20 62 79 20 74 68 65 20  e needed by the 
6370: 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73  launching proces
6380: 73 0a 09 09 09 20 20 28 6c 65 74 20 28 28 69 74  s....  (let ((it
6390: 65 6d 73 2d 6c 69 73 74 20 28 69 74 65 6d 73 3a  ems-list (items:
63a0: 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63  get-items-from-c
63b0: 6f 6e 66 69 67 20 74 63 6f 6e 66 69 67 29 29 29  onfig tconfig)))
63c0: 0a 09 09 09 20 20 20 20 28 69 66 20 28 6c 69 73  ....    (if (lis
63d0: 74 3f 20 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09  t? items-list)..
63e0: 09 09 09 28 62 65 67 69 6e 0a 09 09 09 09 20 20  ...(begin.....  
63f0: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65  (tests:testqueue
6400: 2d 73 65 74 2d 69 74 65 6d 73 21 20 74 65 73 74  -set-items! test
6410: 2d 72 65 63 6f 72 64 20 69 74 65 6d 73 2d 6c 69  -record items-li
6420: 73 74 29 0a 09 09 09 09 20 20 28 74 68 72 65 61  st).....  (threa
6430: 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c  d-sleep! *global
6440: 2d 64 65 6c 74 61 2a 29 0a 09 09 09 09 20 20 28  -delta*).....  (
6450: 6c 6f 6f 70 20 68 65 64 20 74 61 6c 20 72 65 72  loop hed tal rer
6460: 75 6e 73 29 29 0a 09 09 09 09 28 62 65 67 69 6e  uns)).....(begin
6470: 0a 09 09 09 09 20 20 28 64 65 62 75 67 3a 70 72  .....  (debug:pr
6480: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 54 68  int 0 "ERROR: Th
6490: 65 20 70 72 6f 63 20 66 72 6f 6d 20 72 65 61 64  e proc from read
64a0: 69 6e 67 20 74 68 65 20 73 65 74 75 70 20 64 69  ing the setup di
64b0: 64 20 6e 6f 74 20 79 69 65 6c 64 20 61 20 6c 69  d not yield a li
64c0: 73 74 20 2d 20 70 6c 65 61 73 65 20 72 65 70 6f  st - please repo
64d0: 72 74 20 74 68 69 73 22 29 0a 09 09 09 09 20 20  rt this").....  
64e0: 28 65 78 69 74 20 31 29 29 29 29 29 29 0a 09 09  (exit 1))))))...
64f0: 20 20 20 20 20 20 20 28 28 6e 75 6c 6c 3f 20 66         ((null? f
6500: 61 69 6c 73 29 0a 09 09 09 28 64 65 62 75 67 3a  ails)....(debug:
6510: 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 66 61  print-info 4 "fa
6520: 69 6c 73 20 69 73 20 6e 75 6c 6c 2c 20 6d 6f 76  ils is null, mov
6530: 69 6e 67 20 6f 6e 20 69 6e 20 74 68 65 20 71 75  ing on in the qu
6540: 65 75 65 20 62 75 74 20 6b 65 65 70 69 6e 67 20  eue but keeping 
6550: 22 20 68 65 64 20 22 20 66 6f 72 20 6e 6f 77 22  " hed " for now"
6560: 29 0a 09 09 09 3b 3b 20 6f 6e 6c 79 20 69 6e 63  )....;; only inc
6570: 72 65 6d 65 6e 74 20 6e 75 6d 2d 72 65 74 72 69  rement num-retri
6580: 65 73 20 77 68 65 6e 20 74 68 65 72 65 20 61 72  es when there ar
6590: 65 20 6e 6f 20 74 65 73 74 73 20 72 75 6e 69 6e  e no tests runin
65a0: 67 0a 09 09 09 28 69 66 20 28 65 71 3f 20 30 20  g....(if (eq? 0 
65b0: 28 6c 69 73 74 2d 72 65 66 20 63 61 6e 2d 72 75  (list-ref can-ru
65c0: 6e 2d 6d 6f 72 65 20 31 29 29 0a 09 09 09 20 20  n-more 1))....  
65d0: 20 20 28 62 65 67 69 6e 0a 09 09 09 20 20 20 20    (begin....    
65e0: 20 20 28 69 66 20 28 3e 20 6e 75 6d 2d 72 65 74    (if (> num-ret
65f0: 72 69 65 73 20 31 30 30 29 20 3b 3b 20 66 69 72  ries 100) ;; fir
6600: 73 74 20 31 30 30 20 72 65 74 72 69 65 73 20 61  st 100 retries a
6610: 72 65 20 6c 6f 77 20 74 69 6d 65 20 63 6f 73 74  re low time cost
6620: 0a 09 09 09 09 20 20 28 74 68 72 65 61 64 2d 73  .....  (thread-s
6630: 6c 65 65 70 21 20 28 2b 20 32 20 2a 67 6c 6f 62  leep! (+ 2 *glob
6640: 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09 09 09  al-delta*)).....
6650: 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21    (thread-sleep!
6660: 20 28 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c   (+ 0.01 *global
6670: 2d 64 65 6c 74 61 2a 29 29 29 0a 09 09 09 20 20  -delta*)))....  
6680: 20 20 20 20 28 73 65 74 21 20 6e 75 6d 2d 72 65      (set! num-re
6690: 74 72 69 65 73 20 28 2b 20 6e 75 6d 2d 72 65 74  tries (+ num-ret
66a0: 72 69 65 73 20 31 29 29 29 29 0a 09 09 09 28 69  ries 1))))....(i
66b0: 66 20 28 3e 20 6e 75 6d 2d 72 65 74 72 69 65 73  f (> num-retries
66c0: 20 20 6d 61 78 2d 72 65 74 72 69 65 73 29 0a 09    max-retries)..
66d0: 09 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28  ..    (if (not (
66e0: 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 09 09  null? tal)).....
66f0: 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28  (loop (car tal)(
6700: 63 64 72 20 74 61 6c 29 20 72 65 72 75 6e 73 29  cdr tal) reruns)
6710: 29 0a 09 09 09 20 20 20 20 28 6c 6f 6f 70 20 28  )....    (loop (
6720: 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20  car newtal)(cdr 
6730: 6e 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29 29  newtal) reruns))
6740: 29 20 3b 3b 20 61 6e 20 69 73 73 75 65 20 77 69  ) ;; an issue wi
6750: 74 68 20 70 72 65 72 65 71 73 20 6e 6f 74 20 79  th prereqs not y
6760: 65 74 20 6d 65 74 3f 0a 09 09 20 20 20 20 20 20  et met?...      
6770: 20 28 28 61 6e 64 20 28 6e 6f 74 20 28 6e 75 6c   ((and (not (nul
6780: 6c 3f 20 66 61 69 6c 73 29 29 28 65 71 3f 20 74  l? fails))(eq? t
6790: 65 73 74 6d 6f 64 65 20 27 6e 6f 72 6d 61 6c 29  estmode 'normal)
67a0: 29 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e  )....(debug:prin
67b0: 74 2d 69 6e 66 6f 20 31 20 22 74 65 73 74 20 22  t-info 1 "test "
67c0: 20 20 68 65 64 20 22 20 28 6d 6f 64 65 3d 22 20    hed " (mode=" 
67d0: 74 65 73 74 6d 6f 64 65 20 22 29 20 68 61 73 20  testmode ") has 
67e0: 66 61 69 6c 65 64 20 70 72 65 72 65 71 75 69 73  failed prerequis
67f0: 69 74 65 28 73 29 3b 20 22 0a 09 09 09 09 20 20  ite(s); ".....  
6800: 20 20 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72     (string-inter
6810: 73 70 65 72 73 65 20 28 6d 61 70 20 28 6c 61 6d  sperse (map (lam
6820: 62 64 61 20 28 74 29 28 63 6f 6e 63 20 28 64 62  bda (t)(conc (db
6830: 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61  :test-get-testna
6840: 6d 65 20 74 29 20 22 3a 22 20 28 64 62 3a 74 65  me t) ":" (db:te
6850: 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74 29 22  st-get-state t)"
6860: 2f 22 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73  /"(db:test-get-s
6870: 74 61 74 75 73 20 74 29 29 29 20 66 61 69 6c 73  tatus t))) fails
6880: 29 20 22 2c 20 22 29 0a 09 09 09 09 20 20 20 20  ) ", ").....    
6890: 20 22 2c 20 72 65 6d 6f 76 69 6e 67 20 69 74 20   ", removing it 
68a0: 66 72 6f 6d 20 74 6f 2d 64 6f 20 6c 69 73 74 22  from to-do list"
68b0: 29 0a 09 09 09 28 69 66 20 28 6e 6f 74 20 28 6e  )....(if (not (n
68c0: 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 09 20 20  ull? tal))....  
68d0: 20 20 28 62 65 67 69 6e 0a 09 09 09 20 20 20 20    (begin....    
68e0: 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21    (thread-sleep!
68f0: 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29   *global-delta*)
6900: 0a 09 09 09 20 20 20 20 20 20 28 6c 6f 6f 70 20  ....      (loop 
6910: 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74 61  (car tal)(cdr ta
6920: 6c 29 28 63 6f 6e 73 20 68 65 64 20 72 65 72 75  l)(cons hed reru
6930: 6e 73 29 29 29 29 29 0a 09 09 20 20 20 20 20 20  ns)))))...      
6940: 20 28 65 6c 73 65 0a 09 09 09 28 64 65 62 75 67   (else....(debug
6950: 3a 70 72 69 6e 74 20 38 20 22 45 52 52 4f 52 3a  :print 8 "ERROR:
6960: 20 4e 6f 20 68 61 6e 64 6c 65 72 20 66 6f 72 20   No handler for 
6970: 74 68 69 73 20 63 6f 6e 64 69 74 69 6f 6e 2e 22  this condition."
6980: 29 0a 09 09 09 28 74 68 72 65 61 64 2d 73 6c 65  )....(thread-sle
6990: 65 70 21 20 28 2b 20 31 20 2a 67 6c 6f 62 61 6c  ep! (+ 1 *global
69a0: 2d 64 65 6c 74 61 2a 29 29 0a 09 09 09 28 6c 6f  -delta*))....(lo
69b0: 6f 70 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28  op (car newtal)(
69c0: 63 64 72 20 6e 65 77 74 61 6c 29 20 72 65 72 75  cdr newtal) reru
69d0: 6e 73 29 29 29 29 20 3b 3b 20 45 4e 44 20 4f 46  ns)))) ;; END OF
69e0: 20 49 46 20 43 41 4e 20 52 55 4e 20 4d 4f 52 45   IF CAN RUN MORE
69f0: 0a 0a 09 09 20 20 20 20 3b 3b 20 69 66 20 63 61  ....    ;; if ca
6a00: 6e 27 74 20 72 75 6e 20 6d 6f 72 65 20 6a 75 73  n't run more jus
6a10: 74 20 6c 6f 6f 70 20 77 69 74 68 20 6e 65 78 74  t loop with next
6a20: 20 70 6f 73 73 69 62 6c 65 20 74 65 73 74 0a 09   possible test..
6a30: 09 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20  .    (begin...  
6a40: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
6a50: 2d 69 6e 66 6f 20 34 20 22 70 72 6f 63 65 73 73  -info 4 "process
6a60: 69 6e 67 20 74 68 65 20 63 61 73 65 20 77 69 74  ing the case wit
6a70: 68 20 61 20 6c 61 6d 62 64 61 20 66 6f 72 20 69  h a lambda for i
6a80: 74 65 6d 73 20 6f 72 20 27 68 61 76 65 2d 70 72  tems or 'have-pr
6a90: 6f 63 65 64 75 72 65 2e 20 4d 6f 76 69 6e 67 20  ocedure. Moving 
6aa0: 74 68 72 6f 75 67 68 20 74 68 65 20 71 75 65 75  through the queu
6ab0: 65 20 77 69 74 68 6f 75 74 20 64 72 6f 70 70 69  e without droppi
6ac0: 6e 67 20 22 20 68 65 64 29 0a 09 09 20 20 20 20  ng " hed)...    
6ad0: 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21    (thread-sleep!
6ae0: 20 28 2b 20 32 20 2a 67 6c 6f 62 61 6c 2d 64 65   (+ 2 *global-de
6af0: 6c 74 61 2a 29 29 0a 09 09 20 20 20 20 20 20 28  lta*))...      (
6b00: 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61 6c  loop (car newtal
6b10: 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20 72 65  )(cdr newtal) re
6b20: 72 75 6e 73 29 29 29 29 29 20 3b 3b 20 45 4e 44  runs))))) ;; END
6b30: 20 4f 46 20 28 6f 72 20 28 70 72 6f 63 65 64 75   OF (or (procedu
6b40: 72 65 3f 20 69 74 65 6d 73 29 28 65 71 3f 20 69  re? items)(eq? i
6b50: 74 65 6d 73 20 27 68 61 76 65 2d 70 72 6f 63 65  tems 'have-proce
6b60: 64 75 72 65 29 29 0a 09 20 20 20 20 20 0a 09 20  dure))..     .. 
6b70: 20 20 20 20 3b 3b 20 74 68 69 73 20 63 61 73 65      ;; this case
6b80: 20 73 68 6f 75 6c 64 20 6e 6f 74 20 68 61 70 70   should not happ
6b90: 65 6e 2c 20 61 64 64 65 64 20 74 6f 20 68 65 6c  en, added to hel
6ba0: 70 20 63 61 74 63 68 20 61 6e 79 20 62 75 67 73  p catch any bugs
6bb0: 0a 09 20 20 20 20 20 28 28 61 6e 64 20 28 6c 69  ..     ((and (li
6bc0: 73 74 3f 20 69 74 65 6d 73 29 20 69 74 65 6d 64  st? items) itemd
6bd0: 61 74 29 0a 09 20 20 20 20 20 20 28 64 65 62 75  at)..      (debu
6be0: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52  g:print 0 "ERROR
6bf0: 3a 20 53 68 6f 75 6c 64 20 6e 6f 74 20 68 61 76  : Should not hav
6c00: 65 20 61 20 6c 69 73 74 20 6f 66 20 69 74 65 6d  e a list of item
6c10: 73 20 69 6e 20 61 20 74 65 73 74 20 61 6e 64 20  s in a test and 
6c20: 74 68 65 20 69 74 65 6d 73 70 61 74 68 20 73 65  the itemspath se
6c30: 74 20 2d 20 70 6c 65 61 73 65 20 72 65 70 6f 72  t - please repor
6c40: 74 20 74 68 69 73 22 29 0a 09 20 20 20 20 20 20  t this")..      
6c50: 28 65 78 69 74 20 31 29 29 0a 09 20 20 20 20 20  (exit 1))..     
6c60: 28 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 72  ((not (null? rer
6c70: 75 6e 73 29 29 0a 09 20 20 20 20 20 20 28 6c 65  uns))..      (le
6c80: 74 2a 20 28 28 6e 65 77 6c 73 74 20 28 74 65 73  t* ((newlst (tes
6c90: 74 73 3a 66 69 6c 74 65 72 2d 6e 6f 6e 2d 72 75  ts:filter-non-ru
6ca0: 6e 6e 61 62 6c 65 20 72 75 6e 2d 69 64 20 74 61  nnable run-id ta
6cb0: 6c 20 74 65 73 74 2d 72 65 63 6f 72 64 73 29 29  l test-records))
6cc0: 20 3b 3b 20 69 2e 65 2e 20 6e 6f 74 20 46 41 49   ;; i.e. not FAI
6cd0: 4c 2c 20 57 41 49 56 45 44 2c 20 49 4e 43 4f 4d  L, WAIVED, INCOM
6ce0: 50 4c 45 54 45 2c 20 50 41 53 53 2c 20 4b 49 4c  PLETE, PASS, KIL
6cf0: 4c 45 44 2c 0a 09 09 20 20 20 20 20 28 6a 75 6e  LED,...     (jun
6d00: 6b 65 64 20 28 6c 73 65 74 2d 64 69 66 66 65 72  ked (lset-differ
6d10: 65 6e 63 65 20 65 71 75 61 6c 3f 20 74 61 6c 20  ence equal? tal 
6d20: 6e 65 77 6c 73 74 29 29 29 0a 09 09 28 64 65 62  newlst)))...(deb
6d30: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20  ug:print-info 4 
6d40: 22 66 75 6c 6c 20 64 72 6f 70 20 74 68 72 6f 75  "full drop throu
6d50: 67 68 2c 20 69 66 20 72 65 72 75 6e 73 20 69 73  gh, if reruns is
6d60: 20 6c 65 73 73 20 74 68 61 6e 20 31 30 30 20 77   less than 100 w
6d70: 65 20 77 69 6c 6c 20 66 6f 72 63 65 20 72 65 74  e will force ret
6d80: 72 79 20 74 68 65 6d 2c 20 72 65 72 75 6e 73 3d  ry them, reruns=
6d90: 22 20 72 65 72 75 6e 73 20 22 2c 20 74 61 6c 3d  " reruns ", tal=
6da0: 22 20 74 61 6c 29 0a 09 09 28 69 66 20 28 3c 20  " tal)...(if (< 
6db0: 6e 75 6d 2d 72 65 74 72 69 65 73 20 6d 61 78 2d  num-retries max-
6dc0: 72 65 74 72 69 65 73 29 0a 09 09 20 20 20 20 28  retries)...    (
6dd0: 73 65 74 21 20 6e 65 77 6c 73 74 20 28 61 70 70  set! newlst (app
6de0: 65 6e 64 20 72 65 72 75 6e 73 20 6e 65 77 6c 73  end reruns newls
6df0: 74 29 29 29 0a 09 09 28 73 65 74 21 20 6e 75 6d  t)))...(set! num
6e00: 2d 72 65 74 72 69 65 73 20 28 2b 20 6e 75 6d 2d  -retries (+ num-
6e10: 72 65 74 72 69 65 73 20 31 29 29 0a 09 09 28 74  retries 1))...(t
6e20: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20  hread-sleep! (+ 
6e30: 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a  1 *global-delta*
6e40: 29 29 0a 09 09 28 69 66 20 28 6e 6f 74 20 28 6e  ))...(if (not (n
6e50: 75 6c 6c 3f 20 6e 65 77 6c 73 74 29 29 0a 09 09  ull? newlst))...
6e60: 20 20 20 20 3b 3b 20 73 69 6e 63 65 20 72 65 72      ;; since rer
6e70: 75 6e 73 20 68 61 76 65 20 62 65 65 6e 20 74 61  uns have been ta
6e80: 63 6b 65 64 20 6f 6e 20 74 6f 20 6e 65 77 6c 73  cked on to newls
6e90: 74 20 63 72 65 61 74 65 20 6e 65 77 20 72 65 72  t create new rer
6ea0: 75 6e 73 20 66 72 6f 6d 20 6a 75 6e 6b 65 64 0a  uns from junked.
6eb0: 09 09 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72  ..    (loop (car
6ec0: 20 6e 65 77 6c 73 74 29 28 63 64 72 20 6e 65 77   newlst)(cdr new
6ed0: 6c 73 74 29 28 64 65 6c 65 74 65 2d 64 75 70 6c  lst)(delete-dupl
6ee0: 69 63 61 74 65 73 20 6a 75 6e 6b 65 64 29 29 29  icates junked)))
6ef0: 29 29 0a 09 20 20 20 20 20 28 28 6e 6f 74 20 28  ))..     ((not (
6f00: 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 20 20 20  null? tal))..   
6f10: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d     (debug:print-
6f20: 69 6e 66 6f 20 34 20 22 49 27 6d 20 70 72 65 74  info 4 "I'm pret
6f30: 74 79 20 73 75 72 65 20 49 20 73 68 6f 75 6c 64  ty sure I should
6f40: 6e 27 74 20 67 65 74 20 68 65 72 65 2e 22 29 29  n't get here."))
6f50: 0a 09 20 20 20 20 20 28 65 6c 73 65 0a 09 20 20  ..     (else..  
6f60: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
6f70: 2d 69 6e 66 6f 20 34 20 22 45 78 69 74 69 6e 67  -info 4 "Exiting
6f80: 20 6c 6f 6f 70 20 77 69 74 68 2e 2e 2e 5c 6e 20   loop with...\n 
6f90: 20 68 65 64 3d 22 20 68 65 64 20 22 5c 6e 20 20   hed=" hed "\n  
6fa0: 74 61 6c 3d 22 20 74 61 6c 20 22 5c 6e 20 20 72  tal=" tal "\n  r
6fb0: 65 72 75 6e 73 3d 22 20 72 65 72 75 6e 73 29 29  eruns=" reruns))
6fc0: 0a 09 20 20 20 20 20 29 29 29 29 20 3b 3b 20 4c  ..     )))) ;; L
6fd0: 45 54 2a 20 28 28 74 65 73 74 2d 72 65 63 6f 72  ET* ((test-recor
6fe0: 64 0a 0a 20 20 20 20 3b 3b 20 77 65 20 67 65 74  d..    ;; we get
6ff0: 20 68 65 72 65 20 6f 6e 20 22 64 72 6f 70 20 74   here on "drop t
7000: 68 72 6f 75 67 68 22 20 2d 20 6c 6f 6f 70 20 66  hrough" - loop f
7010: 6f 72 20 6e 65 78 74 20 74 65 73 74 20 69 6e 20  or next test in 
7020: 71 75 65 75 65 0a 20 20 20 20 3b 3b 20 46 49 58  queue.    ;; FIX
7030: 4d 45 21 21 21 21 20 54 48 49 53 20 53 48 4f 55  ME!!!! THIS SHOU
7040: 4c 44 20 4e 4f 54 20 52 45 51 55 49 52 45 20 41  LD NOT REQUIRE A
7050: 4e 20 45 58 49 54 21 21 21 21 21 21 21 0a 20 20  N EXIT!!!!!!!.  
7060: 20 20 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72    .    (debug:pr
7070: 69 6e 74 2d 69 6e 66 6f 20 31 20 22 41 6c 6c 20  int-info 1 "All 
7080: 74 65 73 74 73 20 6c 61 75 6e 63 68 65 64 22 29  tests launched")
7090: 0a 20 20 20 20 28 74 68 72 65 61 64 2d 73 6c 65  .    (thread-sle
70a0: 65 70 21 20 30 2e 35 29 0a 20 20 20 20 3b 3b 20  ep! 0.5).    ;; 
70b0: 46 49 58 4d 45 21 20 54 68 69 73 20 68 61 72 73  FIXME! This hars
70c0: 68 20 65 78 69 74 20 73 68 6f 75 6c 64 20 6e 6f  h exit should no
70d0: 74 20 62 65 20 6e 65 63 65 73 73 61 72 79 2e 2e  t be necessary..
70e0: 2e 2e 0a 20 20 20 20 3b 3b 20 28 69 66 20 28 6e  ...    ;; (if (n
70f0: 6f 74 20 2a 72 75 6e 72 65 6d 6f 74 65 2a 29 28  ot *runremote*)(
7100: 65 78 69 74 29 29 20 3b 3b 20 0a 20 20 20 20 23  exit)) ;; .    #
7110: 66 29 29 20 3b 3b 20 72 65 74 75 72 6e 20 61 20  f)) ;; return a 
7120: 23 66 20 61 73 20 61 20 68 69 6e 74 20 74 68 61  #f as a hint tha
7130: 74 20 77 65 20 61 72 65 20 64 6f 6e 65 0a 20 20  t we are done.  
7140: 3b 3b 20 48 65 72 65 20 77 65 20 6e 65 65 64 20  ;; Here we need 
7150: 74 6f 20 63 68 65 63 6b 20 74 68 61 74 20 61 6c  to check that al
7160: 6c 20 74 68 65 20 74 65 73 74 73 20 72 65 6d 61  l the tests rema
7170: 69 6e 69 6e 67 20 74 6f 20 62 65 20 72 75 6e 20  ining to be run 
7180: 61 72 65 20 65 6c 69 67 69 62 6c 65 20 74 6f 20  are eligible to 
7190: 72 75 6e 0a 20 20 3b 3b 20 61 6e 64 20 61 72 65  run.  ;; and are
71a0: 20 6e 6f 74 20 62 6c 6f 63 6b 65 64 20 62 79 20   not blocked by 
71b0: 66 61 69 6c 65 64 0a 20 20 0a 0a 3b 3b 20 70 61  failed.  ..;; pa
71c0: 72 65 6e 74 2d 74 65 73 74 20 69 73 20 74 68 65  rent-test is the
71d0: 72 65 20 61 73 20 61 20 70 6c 61 63 65 68 6f 6c  re as a placehol
71e0: 64 65 72 20 66 6f 72 20 77 68 65 6e 20 70 61 72  der for when par
71f0: 65 6e 74 2d 74 65 73 74 73 20 63 61 6e 20 62 65  ent-tests can be
7200: 20 72 75 6e 20 61 73 20 61 20 73 65 74 75 70 20   run as a setup 
7210: 73 74 65 70 0a 28 64 65 66 69 6e 65 20 28 72 75  step.(define (ru
7220: 6e 3a 74 65 73 74 20 72 75 6e 2d 69 64 20 72 75  n:test run-id ru
7230: 6e 6e 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20  nname keyvallst 
7240: 74 65 73 74 2d 72 65 63 6f 72 64 20 66 6c 61 67  test-record flag
7250: 73 20 70 61 72 65 6e 74 2d 74 65 73 74 29 0a 20  s parent-test). 
7260: 20 3b 3b 20 41 6c 6c 20 74 68 65 73 65 20 76 61   ;; All these va
7270: 72 73 20 6d 69 67 68 74 20 62 65 20 72 65 66 65  rs might be refe
7280: 72 65 6e 63 65 64 20 62 79 20 74 68 65 20 74 65  renced by the te
7290: 73 74 63 6f 6e 66 69 67 20 66 69 6c 65 20 72 65  stconfig file re
72a0: 61 64 65 72 0a 20 20 28 6c 65 74 2a 20 28 28 74  ader.  (let* ((t
72b0: 65 73 74 2d 6e 61 6d 65 20 20 20 20 28 74 65 73  est-name    (tes
72c0: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
72d0: 2d 74 65 73 74 6e 61 6d 65 20 20 20 74 65 73 74  -testname   test
72e0: 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65 73  -record)).. (tes
72f0: 74 2d 77 61 69 74 6f 6e 73 20 28 74 65 73 74 73  t-waitons (tests
7300: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 77  :testqueue-get-w
7310: 61 69 74 6f 6e 73 20 20 20 20 74 65 73 74 2d 72  aitons    test-r
7320: 65 63 6f 72 64 29 29 0a 09 20 28 74 65 73 74 2d  ecord)).. (test-
7330: 63 6f 6e 66 20 20 20 20 28 74 65 73 74 73 3a 74  conf    (tests:t
7340: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73  estqueue-get-tes
7350: 74 63 6f 6e 66 69 67 20 74 65 73 74 2d 72 65 63  tconfig test-rec
7360: 6f 72 64 29 29 0a 09 20 28 69 74 65 6d 64 61 74  ord)).. (itemdat
7370: 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73        (tests:tes
7380: 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d 64  tqueue-get-itemd
7390: 61 74 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72  at    test-recor
73a0: 64 29 29 0a 09 20 28 74 65 73 74 2d 70 61 74 68  d)).. (test-path
73b0: 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61      (conc *toppa
73c0: 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 20 74 65  th* "/tests/" te
73d0: 73 74 2d 6e 61 6d 65 29 29 20 3b 3b 20 63 6f 75  st-name)) ;; cou
73e0: 6c 64 20 75 73 65 20 74 65 73 74 73 3a 67 65 74  ld use tests:get
73f0: 2d 74 65 73 74 63 6f 6e 66 69 67 20 68 65 72 65  -testconfig here
7400: 20 2e 2e 2e 0a 09 20 28 66 6f 72 63 65 20 20 20   ..... (force   
7410: 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65       (hash-table
7420: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61  -ref/default fla
7430: 67 73 20 22 2d 66 6f 72 63 65 22 20 23 66 29 29  gs "-force" #f))
7440: 0a 09 20 28 72 65 72 75 6e 20 20 20 20 20 20 20  .. (rerun       
7450: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66   (hash-table-ref
7460: 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22  /default flags "
7470: 2d 72 65 72 75 6e 22 20 23 66 29 29 0a 09 20 28  -rerun" #f)).. (
7480: 6b 65 65 70 67 6f 69 6e 67 20 20 20 20 28 68 61  keepgoing    (ha
7490: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66  sh-table-ref/def
74a0: 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 65  ault flags "-kee
74b0: 70 67 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 28  pgoing" #f)).. (
74c0: 69 74 65 6d 2d 70 61 74 68 20 20 20 20 20 22 22  item-path     ""
74d0: 29 0a 09 20 28 64 62 20 20 20 20 20 20 20 20 20  ).. (db         
74e0: 20 20 23 66 29 29 0a 20 20 20 20 28 64 65 62 75    #f)).    (debu
74f0: 67 3a 70 72 69 6e 74 20 34 0a 09 09 20 22 74 65  g:print 4... "te
7500: 73 74 2d 63 6f 6e 66 69 67 3a 20 22 20 28 68 61  st-config: " (ha
7510: 73 68 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20  sh-table->alist 
7520: 74 65 73 74 2d 63 6f 6e 66 29 0a 09 09 20 22 5c  test-conf)... "\
7530: 6e 20 20 20 69 74 65 6d 64 61 74 3a 20 22 20 69  n   itemdat: " i
7540: 74 65 6d 64 61 74 0a 09 09 20 29 0a 20 20 20 20  temdat... ).    
7550: 3b 3b 20 73 65 74 74 69 6e 67 20 69 74 65 6d 64  ;; setting itemd
7560: 61 74 20 74 6f 20 61 20 6c 69 73 74 20 69 66 20  at to a list if 
7570: 69 74 20 69 73 20 23 66 0a 20 20 20 20 28 69 66  it is #f.    (if
7580: 20 28 6e 6f 74 20 69 74 65 6d 64 61 74 29 28 73   (not itemdat)(s
7590: 65 74 21 20 69 74 65 6d 64 61 74 20 27 28 29 29  et! itemdat '())
75a0: 29 0a 20 20 20 20 28 73 65 74 21 20 69 74 65 6d  ).    (set! item
75b0: 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74  -path (item-list
75c0: 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74 29 29  ->path itemdat))
75d0: 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  .    (debug:prin
75e0: 74 20 32 20 22 41 74 74 65 6d 70 74 69 6e 67 20  t 2 "Attempting 
75f0: 74 6f 20 6c 61 75 6e 63 68 20 74 65 73 74 20 22  to launch test "
7600: 20 74 65 73 74 2d 6e 61 6d 65 20 28 69 66 20 28   test-name (if (
7610: 65 71 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68  equal? item-path
7620: 20 22 2f 22 29 20 22 2f 22 20 69 74 65 6d 2d 70   "/") "/" item-p
7630: 61 74 68 29 29 0a 20 20 20 20 28 73 65 74 65 6e  ath)).    (seten
7640: 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d 45 22  v "MT_TEST_NAME"
7650: 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b 20 0a   test-name) ;; .
7660: 20 20 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f      (setenv "MT_
7670: 52 55 4e 4e 41 4d 45 22 20 20 20 72 75 6e 6e 61  RUNNAME"   runna
7680: 6d 65 29 0a 20 20 20 20 28 73 65 74 2d 6d 65 67  me).    (set-meg
7690: 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 72  atest-env-vars r
76a0: 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73 65 20  un-id) ;; these 
76b0: 6d 61 79 20 62 65 20 6e 65 65 64 65 64 20 62 79  may be needed by
76c0: 20 74 68 65 20 6c 61 75 6e 63 68 69 6e 67 20 70   the launching p
76d0: 72 6f 63 65 73 73 0a 20 20 20 20 28 63 68 61 6e  rocess.    (chan
76e0: 67 65 2d 64 69 72 65 63 74 6f 72 79 20 2a 74 6f  ge-directory *to
76f0: 70 70 61 74 68 2a 29 0a 0a 20 20 20 20 3b 3b 20  ppath*)..    ;; 
7700: 48 65 72 65 20 69 73 20 77 68 65 72 65 20 74 68  Here is where th
7710: 65 20 74 65 73 74 5f 6d 65 74 61 20 74 61 62 6c  e test_meta tabl
7720: 65 20 69 73 20 62 65 73 74 20 75 70 64 61 74 65  e is best update
7730: 64 0a 20 20 20 20 3b 3b 20 59 65 73 2c 20 61 6e  d.    ;; Yes, an
7740: 6f 74 68 65 72 20 75 73 65 20 6f 66 20 61 20 67  other use of a g
7750: 6c 6f 62 61 6c 20 66 6f 72 20 63 61 63 68 69 6e  lobal for cachin
7760: 67 2e 20 4e 65 65 64 20 61 20 62 65 74 74 65 72  g. Need a better
7770: 20 77 61 79 3f 0a 20 20 20 20 28 69 66 20 28 6e   way?.    (if (n
7780: 6f 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72  ot (hash-table-r
7790: 65 66 2f 64 65 66 61 75 6c 74 20 2a 74 65 73 74  ef/default *test
77a0: 2d 6d 65 74 61 2d 75 70 64 61 74 65 64 2a 20 74  -meta-updated* t
77b0: 65 73 74 2d 6e 61 6d 65 20 23 66 29 29 0a 20 20  est-name #f)).  
77c0: 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20        (begin..  
77d0: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74   (hash-table-set
77e0: 21 20 2a 74 65 73 74 2d 6d 65 74 61 2d 75 70 64  ! *test-meta-upd
77f0: 61 74 65 64 2a 20 74 65 73 74 2d 6e 61 6d 65 20  ated* test-name 
7800: 23 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 28  #t).           (
7810: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72  open-run-close r
7820: 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f  uns:update-test_
7830: 6d 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d  meta db test-nam
7840: 65 20 74 65 73 74 2d 63 6f 6e 66 29 29 29 0a 20  e test-conf))). 
7850: 20 20 20 0a 20 20 20 20 3b 3b 20 28 6c 61 6d 62     .    ;; (lamb
7860: 64 61 20 28 69 74 65 6d 64 61 74 29 20 3b 3b 3b  da (itemdat) ;;;
7870: 20 28 28 72 69 70 65 6e 65 73 73 20 22 6f 76 65   ((ripeness "ove
7880: 72 72 69 70 65 22 29 20 28 74 65 6d 70 65 72 61  rripe") (tempera
7890: 74 75 72 65 20 22 63 6f 6f 6c 22 29 20 28 73 65  ture "cool") (se
78a0: 61 73 6f 6e 20 22 73 75 6d 6d 65 72 22 29 29 0a  ason "summer")).
78b0: 20 20 20 20 28 6c 65 74 2a 20 28 28 6e 65 77 2d      (let* ((new-
78c0: 74 65 73 74 2d 70 61 74 68 20 28 73 74 72 69 6e  test-path (strin
78d0: 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 63  g-intersperse (c
78e0: 6f 6e 73 20 74 65 73 74 2d 70 61 74 68 20 28 6d  ons test-path (m
78f0: 61 70 20 63 61 64 72 20 69 74 65 6d 64 61 74 29  ap cadr itemdat)
7900: 29 20 22 2f 22 29 29 0a 09 20 20 20 28 6e 65 77  ) "/"))..   (new
7910: 2d 74 65 73 74 2d 6e 61 6d 65 20 28 69 66 20 28  -test-name (if (
7920: 65 71 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68  equal? item-path
7930: 20 22 22 29 20 74 65 73 74 2d 6e 61 6d 65 20 28   "") test-name (
7940: 63 6f 6e 63 20 74 65 73 74 2d 6e 61 6d 65 20 22  conc test-name "
7950: 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 29 20  /" item-path))) 
7960: 3b 3b 20 6a 75 73 74 20 6e 65 65 64 20 69 74 20  ;; just need it 
7970: 74 6f 20 62 65 20 75 6e 69 71 75 65 0a 09 20 20  to be unique..  
7980: 20 28 74 65 73 74 2d 69 64 20 20 20 20 20 20 20   (test-id       
7990: 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20  (cdb:remote-run 
79a0: 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 64 20 23  db:get-test-id #
79b0: 66 20 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e  f  run-id test-n
79c0: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29 0a  ame item-path)).
79d0: 09 20 20 20 28 74 65 73 74 64 61 74 20 20 20 20  .   (testdat    
79e0: 20 20 20 28 63 64 62 3a 67 65 74 2d 74 65 73 74     (cdb:get-test
79f0: 2d 69 6e 66 6f 2d 62 79 2d 69 64 20 2a 72 75 6e  -info-by-id *run
7a00: 72 65 6d 6f 74 65 2a 20 74 65 73 74 2d 69 64 29  remote* test-id)
7a10: 29 29 0a 20 20 20 20 20 20 28 69 66 20 28 6e 6f  )).      (if (no
7a20: 74 20 74 65 73 74 64 61 74 29 0a 09 20 20 28 62  t testdat)..  (b
7a30: 65 67 69 6e 0a 09 20 20 20 20 3b 3b 20 65 6e 73  egin..    ;; ens
7a40: 75 72 65 20 74 68 61 74 20 74 68 65 20 70 61 74  ure that the pat
7a50: 68 20 65 78 69 73 74 73 20 62 65 66 6f 72 65 20  h exists before 
7a60: 72 65 67 69 73 74 65 72 69 6e 67 20 74 68 65 20  registering the 
7a70: 74 65 73 74 0a 09 20 20 20 20 3b 3b 20 4e 4f 50  test..    ;; NOP
7a80: 45 3a 20 43 61 6e 6e 6f 74 21 20 44 6f 6e 27 74  E: Cannot! Don't
7a90: 20 6b 6e 6f 77 20 79 65 74 20 77 68 69 63 68 20   know yet which 
7aa0: 64 69 73 6b 20 61 72 65 61 20 77 69 6c 6c 20 62  disk area will b
7ab0: 65 20 61 73 73 69 67 6e 65 64 2e 2e 2e 2e 0a 09  e assigned......
7ac0: 20 20 20 20 3b 3b 20 28 73 79 73 74 65 6d 20 28      ;; (system (
7ad0: 63 6f 6e 63 20 22 6d 6b 64 69 72 20 2d 70 20 22  conc "mkdir -p "
7ae0: 20 6e 65 77 2d 74 65 73 74 2d 70 61 74 68 29 29   new-test-path))
7af0: 0a 09 20 20 20 20 3b 3b 0a 09 20 20 20 20 3b 3b  ..    ;;..    ;;
7b00: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
7b10: 20 74 65 73 74 73 3a 72 65 67 69 73 74 65 72 2d   tests:register-
7b20: 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 74  test db run-id t
7b30: 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61  est-name item-pa
7b40: 74 68 29 0a 09 20 20 20 20 3b 3b 0a 09 20 20 20  th)..    ;;..   
7b50: 20 3b 3b 20 4e 42 2f 2f 20 66 6f 72 20 74 68 65   ;; NB// for the
7b60: 20 61 62 6f 76 65 20 6c 69 6e 65 2e 20 49 20 77   above line. I w
7b70: 61 6e 74 20 74 68 65 20 74 65 73 74 20 74 6f 20  ant the test to 
7b80: 62 65 20 72 65 67 69 73 74 65 72 65 64 20 6c 6f  be registered lo
7b90: 6e 67 20 62 65 66 6f 72 65 20 74 68 69 73 20 72  ng before this r
7ba0: 6f 75 74 69 6e 65 20 67 65 74 73 20 63 61 6c 6c  outine gets call
7bb0: 65 64 21 0a 09 20 20 20 20 3b 3b 0a 09 20 20 20  ed!..    ;;..   
7bc0: 20 28 73 65 74 21 20 74 65 73 74 2d 69 64 20 28   (set! test-id (
7bd0: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64  open-run-close d
7be0: 62 3a 67 65 74 2d 74 65 73 74 2d 69 64 20 64 62  b:get-test-id db
7bf0: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d   run-id test-nam
7c00: 65 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 20  e item-path)).. 
7c10: 20 20 20 28 69 66 20 28 6e 6f 74 20 74 65 73 74     (if (not test
7c20: 2d 69 64 29 0a 09 09 28 62 65 67 69 6e 0a 09 09  -id)...(begin...
7c30: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32    (debug:print 2
7c40: 20 22 57 41 52 4e 3a 20 54 65 73 74 20 6e 6f 74   "WARN: Test not
7c50: 20 70 72 65 2d 63 72 65 61 74 65 64 3f 20 74 65   pre-created? te
7c60: 73 74 2d 6e 61 6d 65 3d 22 20 74 65 73 74 2d 6e  st-name=" test-n
7c70: 61 6d 65 20 22 2c 20 69 74 65 6d 2d 70 61 74 68  ame ", item-path
7c80: 3d 22 20 69 74 65 6d 2d 70 61 74 68 20 22 2c 20  =" item-path ", 
7c90: 72 75 6e 2d 69 64 3d 22 20 72 75 6e 2d 69 64 29  run-id=" run-id)
7ca0: 0a 09 09 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63  ...  (open-run-c
7cb0: 6c 6f 73 65 20 64 62 3a 74 65 73 74 73 2d 72 65  lose db:tests-re
7cc0: 67 69 73 74 65 72 2d 74 65 73 74 20 23 66 20 72  gister-test #f r
7cd0: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20  un-id test-name 
7ce0: 69 74 65 6d 2d 70 61 74 68 29 0a 09 09 20 20 28  item-path)...  (
7cf0: 73 65 74 21 20 74 65 73 74 2d 69 64 20 28 6f 70  set! test-id (op
7d00: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a  en-run-close db:
7d10: 67 65 74 2d 74 65 73 74 2d 69 64 20 64 62 20 72  get-test-id db r
7d20: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20  un-id test-name 
7d30: 69 74 65 6d 2d 70 61 74 68 29 29 29 29 0a 09 20  item-path)))).. 
7d40: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d     (debug:print-
7d50: 69 6e 66 6f 20 34 20 22 74 65 73 74 2d 69 64 3d  info 4 "test-id=
7d60: 22 20 74 65 73 74 2d 69 64 20 22 2c 20 72 75 6e  " test-id ", run
7d70: 2d 69 64 3d 22 20 72 75 6e 2d 69 64 20 22 2c 20  -id=" run-id ", 
7d80: 74 65 73 74 2d 6e 61 6d 65 3d 22 20 74 65 73 74  test-name=" test
7d90: 2d 6e 61 6d 65 20 22 2c 20 69 74 65 6d 2d 70 61  -name ", item-pa
7da0: 74 68 3d 5c 22 22 20 69 74 65 6d 2d 70 61 74 68  th=\"" item-path
7db0: 20 22 5c 22 22 29 0a 09 20 20 20 20 28 73 65 74   "\"")..    (set
7dc0: 21 20 74 65 73 74 64 61 74 20 28 63 64 62 3a 67  ! testdat (cdb:g
7dd0: 65 74 2d 74 65 73 74 2d 69 6e 66 6f 2d 62 79 2d  et-test-info-by-
7de0: 69 64 20 2a 72 75 6e 72 65 6d 6f 74 65 2a 20 74  id *runremote* t
7df0: 65 73 74 2d 69 64 29 29 29 29 0a 20 20 20 20 20  est-id)))).     
7e00: 20 28 73 65 74 21 20 74 65 73 74 2d 69 64 20 28   (set! test-id (
7e10: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74  db:test-get-id t
7e20: 65 73 74 64 61 74 29 29 0a 20 20 20 20 20 20 28  estdat)).      (
7e30: 63 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 79  change-directory
7e40: 20 74 65 73 74 2d 70 61 74 68 29 0a 20 20 20 20   test-path).    
7e50: 20 20 28 63 61 73 65 20 28 69 66 20 66 6f 72 63    (case (if forc
7e60: 65 20 3b 3b 20 28 61 72 67 73 3a 67 65 74 2d 61  e ;; (args:get-a
7e70: 72 67 20 22 2d 66 6f 72 63 65 22 29 0a 09 09 27  rg "-force")...'
7e80: 4e 4f 54 5f 53 54 41 52 54 45 44 0a 09 09 28 69  NOT_STARTED...(i
7e90: 66 20 74 65 73 74 64 61 74 0a 09 09 20 20 20 20  f testdat...    
7ea0: 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c 20  (string->symbol 
7eb0: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20  (test:get-state 
7ec0: 74 65 73 74 64 61 74 29 29 0a 09 09 20 20 20 20  testdat))...    
7ed0: 27 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 72  'failed-to-inser
7ee0: 74 29 29 0a 09 28 28 66 61 69 6c 65 64 2d 74 6f  t))..((failed-to
7ef0: 2d 69 6e 73 65 72 74 29 0a 09 20 28 64 65 62 75  -insert).. (debu
7f00: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52  g:print 0 "ERROR
7f10: 3a 20 46 61 69 6c 65 64 20 74 6f 20 69 6e 73 65  : Failed to inse
7f20: 72 74 20 74 68 65 20 72 65 63 6f 72 64 20 69 6e  rt the record in
7f30: 74 6f 20 74 68 65 20 64 62 22 29 29 0a 09 28 28  to the db"))..((
7f40: 4e 4f 54 5f 53 54 41 52 54 45 44 20 43 4f 4d 50  NOT_STARTED COMP
7f50: 4c 45 54 45 44 20 44 45 4c 45 54 45 44 29 0a 09  LETED DELETED)..
7f60: 20 28 6c 65 74 20 28 28 72 75 6e 66 6c 61 67 20   (let ((runflag 
7f70: 23 66 29 29 0a 09 20 20 20 28 63 6f 6e 64 0a 09  #f))..   (cond..
7f80: 20 20 20 20 3b 3b 20 2d 66 6f 72 63 65 2c 20 72      ;; -force, r
7f90: 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77 68 61  un no matter wha
7fa0: 74 0a 09 20 20 20 20 28 66 6f 72 63 65 20 28 73  t..    (force (s
7fb0: 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29  et! runflag #t))
7fc0: 0a 09 20 20 20 20 3b 3b 20 4e 4f 54 5f 53 54 41  ..    ;; NOT_STA
7fd0: 52 54 45 44 2c 20 72 75 6e 20 6e 6f 20 6d 61 74  RTED, run no mat
7fe0: 74 65 72 20 77 68 61 74 0a 09 20 20 20 20 28 28  ter what..    ((
7ff0: 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74  member (test:get
8000: 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 20  -state testdat) 
8010: 27 28 22 44 45 4c 45 54 45 44 22 20 22 4e 4f 54  '("DELETED" "NOT
8020: 5f 53 54 41 52 54 45 44 22 29 29 28 73 65 74 21  _STARTED"))(set!
8030: 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20   runflag #t)).. 
8040: 20 20 20 3b 3b 20 6e 6f 74 20 2d 72 65 72 75 6e     ;; not -rerun
8050: 20 61 6e 64 20 50 41 53 53 2c 20 57 41 52 4e 20   and PASS, WARN 
8060: 6f 72 20 43 48 45 43 4b 2c 20 64 6f 20 6e 6f 20  or CHECK, do no 
8070: 72 75 6e 0a 09 20 20 20 20 28 28 61 6e 64 20 28  run..    ((and (
8080: 6f 72 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a 09  or (not rerun)..
8090: 09 20 20 20 20 20 20 6b 65 65 70 67 6f 69 6e 67  .      keepgoing
80a0: 29 0a 09 09 20 20 3b 3b 20 52 65 71 75 69 72 65  )...  ;; Require
80b0: 20 74 6f 20 66 6f 72 63 65 20 72 65 2d 72 75 6e   to force re-run
80c0: 20 66 6f 72 20 43 4f 4d 50 4c 45 54 45 44 20 6f   for COMPLETED o
80d0: 72 20 2a 61 6e 79 74 68 69 6e 67 2a 20 2b 20 50  r *anything* + P
80e0: 41 53 53 2c 57 41 52 4e 20 6f 72 20 43 48 45 43  ASS,WARN or CHEC
80f0: 4b 0a 09 09 20 20 28 6f 72 20 28 6d 65 6d 62 65  K...  (or (membe
8100: 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  r (test:get-stat
8110: 75 73 20 74 65 73 74 64 61 74 29 20 27 28 22 50  us testdat) '("P
8120: 41 53 53 22 20 22 57 41 52 4e 22 20 22 43 48 45  ASS" "WARN" "CHE
8130: 43 4b 22 29 29 0a 09 09 20 20 20 20 20 20 28 6d  CK"))...      (m
8140: 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d  ember (test:get-
8150: 73 74 61 74 65 20 20 74 65 73 74 64 61 74 29 20  state  testdat) 
8160: 27 28 22 43 4f 4d 50 4c 45 54 45 44 22 29 29 29  '("COMPLETED")))
8170: 29 20 0a 09 20 20 20 20 20 28 64 65 62 75 67 3a  ) ..     (debug:
8180: 70 72 69 6e 74 2d 69 6e 66 6f 20 32 20 22 72 75  print-info 2 "ru
8190: 6e 6e 69 6e 67 20 74 65 73 74 20 22 20 74 65 73  nning test " tes
81a0: 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d  t-name "/" item-
81b0: 70 61 74 68 20 22 20 73 75 70 70 72 65 73 73 65  path " suppresse
81c0: 64 20 61 73 20 69 74 20 69 73 20 22 20 28 74 65  d as it is " (te
81d0: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73  st:get-state tes
81e0: 74 64 61 74 29 20 22 20 61 6e 64 20 22 20 28 74  tdat) " and " (t
81f0: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74  est:get-status t
8200: 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 28  estdat))..     (
8210: 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29  set! runflag #f)
8220: 29 0a 09 20 20 20 20 3b 3b 20 2d 72 65 72 75 6e  )..    ;; -rerun
8230: 20 61 6e 64 20 73 74 61 74 75 73 20 69 73 20 6f   and status is o
8240: 6e 65 20 6f 66 20 74 68 65 20 73 70 65 63 69 66  ne of the specif
8250: 65 64 2c 20 72 75 6e 20 69 74 0a 09 20 20 20 20  ed, run it..    
8260: 28 28 61 6e 64 20 72 65 72 75 6e 0a 09 09 20 20  ((and rerun...  
8270: 28 6c 65 74 2a 20 28 28 72 65 72 75 6e 6c 73 74  (let* ((rerunlst
8280: 20 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74     (string-split
8290: 20 72 65 72 75 6e 20 22 2c 22 29 29 0a 09 09 09   rerun ","))....
82a0: 20 28 6d 75 73 74 2d 72 65 72 75 6e 20 28 6d 65   (must-rerun (me
82b0: 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73  mber (test:get-s
82c0: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20 72  tatus testdat) r
82d0: 65 72 75 6e 6c 73 74 29 29 29 0a 09 09 20 20 20  erunlst)))...   
82e0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
82f0: 66 6f 20 33 20 22 2d 72 65 72 75 6e 20 6c 69 73  fo 3 "-rerun lis
8300: 74 3a 20 22 20 72 65 72 75 6e 20 22 2c 20 74 65  t: " rerun ", te
8310: 73 74 2d 73 74 61 74 75 73 3a 20 22 20 28 74 65  st-status: " (te
8320: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65  st:get-status te
8330: 73 74 64 61 74 29 22 2c 20 6d 75 73 74 2d 72 65  stdat)", must-re
8340: 72 75 6e 3a 20 22 20 6d 75 73 74 2d 72 65 72 75  run: " must-reru
8350: 6e 29 0a 09 09 20 20 20 20 6d 75 73 74 2d 72 65  n)...    must-re
8360: 72 75 6e 29 29 0a 09 20 20 20 20 20 28 64 65 62  run))..     (deb
8370: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 32 20  ug:print-info 2 
8380: 22 52 65 72 75 6e 20 66 6f 72 63 65 64 20 66 6f  "Rerun forced fo
8390: 72 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61  r test " test-na
83a0: 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68  me "/" item-path
83b0: 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 75  )..     (set! ru
83c0: 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20  nflag #t))..    
83d0: 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 2c 20 64  ;; -keepgoing, d
83e0: 6f 20 6e 6f 74 20 72 65 72 75 6e 20 46 41 49 4c  o not rerun FAIL
83f0: 0a 09 20 20 20 20 28 28 61 6e 64 20 6b 65 65 70  ..    ((and keep
8400: 67 6f 69 6e 67 0a 09 09 20 20 28 6d 65 6d 62 65  going...  (membe
8410: 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  r (test:get-stat
8420: 75 73 20 74 65 73 74 64 61 74 29 20 27 28 22 46  us testdat) '("F
8430: 41 49 4c 22 29 29 29 0a 09 20 20 20 20 20 28 73  AIL")))..     (s
8440: 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29  et! runflag #f))
8450: 0a 09 20 20 20 20 28 28 61 6e 64 20 28 6e 6f 74  ..    ((and (not
8460: 20 72 65 72 75 6e 29 0a 09 09 20 20 28 6d 65 6d   rerun)...  (mem
8470: 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74  ber (test:get-st
8480: 61 74 75 73 20 74 65 73 74 64 61 74 29 20 27 28  atus testdat) '(
8490: 22 46 41 49 4c 22 20 22 6e 2f 61 22 29 29 29 0a  "FAIL" "n/a"))).
84a0: 09 20 20 20 20 20 28 73 65 74 21 20 72 75 6e 66  .     (set! runf
84b0: 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 28 65  lag #t))..    (e
84c0: 6c 73 65 20 28 73 65 74 21 20 72 75 6e 66 6c 61  lse (set! runfla
84d0: 67 20 23 66 29 29 29 0a 09 20 20 20 28 64 65 62  g #f)))..   (deb
84e0: 75 67 3a 70 72 69 6e 74 20 36 20 22 52 55 4e 4e  ug:print 6 "RUNN
84f0: 49 4e 47 20 3d 3e 20 72 75 6e 66 6c 61 67 3a 20  ING => runflag: 
8500: 22 20 72 75 6e 66 6c 61 67 20 22 20 53 54 41 54  " runflag " STAT
8510: 45 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73  E: " (test:get-s
8520: 74 61 74 65 20 74 65 73 74 64 61 74 29 20 22 20  tate testdat) " 
8530: 53 54 41 54 55 53 3a 20 22 20 28 74 65 73 74 3a  STATUS: " (test:
8540: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64  get-status testd
8550: 61 74 29 29 0a 09 20 20 20 28 69 66 20 28 6e 6f  at))..   (if (no
8560: 74 20 72 75 6e 66 6c 61 67 29 0a 09 20 20 20 20  t runflag)..    
8570: 20 20 20 28 69 66 20 28 6e 6f 74 20 70 61 72 65     (if (not pare
8580: 6e 74 2d 74 65 73 74 29 0a 09 09 20 20 20 28 64  nt-test)...   (d
8590: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f  ebug:print 1 "NO
85a0: 54 45 3a 20 4e 6f 74 20 73 74 61 72 74 69 6e 67  TE: Not starting
85b0: 20 74 65 73 74 20 22 20 6e 65 77 2d 74 65 73 74   test " new-test
85c0: 2d 6e 61 6d 65 20 22 20 61 73 20 69 74 20 69 73  -name " as it is
85d0: 20 73 74 61 74 65 20 5c 22 22 20 28 74 65 73 74   state \"" (test
85e0: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64  :get-state testd
85f0: 61 74 29 20 0a 09 09 09 09 22 5c 22 20 61 6e 64  at) ....."\" and
8600: 20 73 74 61 74 75 73 20 5c 22 22 20 28 74 65 73   status \"" (tes
8610: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73  t:get-status tes
8620: 74 64 61 74 29 20 22 5c 22 2c 20 75 73 65 20 2d  tdat) "\", use -
8630: 72 65 72 75 6e 20 5c 22 22 20 28 74 65 73 74 3a  rerun \"" (test:
8640: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64  get-status testd
8650: 61 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20  at).            
8660: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
8670: 20 20 20 20 22 5c 22 20 6f 72 20 2d 66 6f 72 63      "\" or -forc
8680: 65 20 74 6f 20 6f 76 65 72 72 69 64 65 22 29 29  e to override"))
8690: 0a 09 20 20 20 20 20 20 20 3b 3b 20 4e 4f 54 45  ..       ;; NOTE
86a0: 3a 20 4e 6f 20 6c 6f 6e 67 65 72 20 62 65 20 63  : No longer be c
86b0: 68 65 63 6b 69 6e 67 20 70 72 65 72 65 71 75 69  hecking prerequi
86c0: 73 69 74 65 73 20 68 65 72 65 21 20 57 69 6c 6c  sites here! Will
86d0: 20 6e 65 76 65 72 20 67 65 74 20 68 65 72 65 20   never get here 
86e0: 75 6e 6c 65 73 73 20 70 72 65 72 65 71 73 20 61  unless prereqs a
86f0: 72 65 0a 09 20 20 20 20 20 20 20 3b 3b 20 20 20  re..       ;;   
8700: 20 20 20 20 61 6c 72 65 61 64 79 20 6d 65 74 2e      already met.
8710: 0a 09 20 20 20 20 20 20 20 28 69 66 20 28 6e 6f  ..       (if (no
8720: 74 20 28 6c 61 75 6e 63 68 2d 74 65 73 74 20 23  t (launch-test #
8730: 66 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65  f run-id runname
8740: 20 74 65 73 74 2d 63 6f 6e 66 20 6b 65 79 76 61   test-conf keyva
8750: 6c 6c 73 74 20 74 65 73 74 2d 6e 61 6d 65 20 74  llst test-name t
8760: 65 73 74 2d 70 61 74 68 20 69 74 65 6d 64 61 74  est-path itemdat
8770: 20 66 6c 61 67 73 29 29 0a 09 09 20 20 20 28 62   flags))...   (b
8780: 65 67 69 6e 0a 09 09 20 20 20 20 20 28 70 72 69  egin...     (pri
8790: 6e 74 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65  nt "ERROR: Faile
87a0: 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 68 65 20  d to launch the 
87b0: 74 65 73 74 2e 20 45 78 69 74 69 6e 67 20 61 73  test. Exiting as
87c0: 20 73 6f 6f 6e 20 61 73 20 70 6f 73 73 69 62 6c   soon as possibl
87d0: 65 22 29 0a 09 09 20 20 20 20 20 28 73 65 74 21  e")...     (set!
87e0: 20 2a 67 6c 6f 62 61 6c 65 78 69 74 73 74 61 74   *globalexitstat
87f0: 75 73 2a 20 31 29 20 3b 3b 20 0a 09 09 20 20 20  us* 1) ;; ...   
8800: 20 20 28 70 72 6f 63 65 73 73 2d 73 69 67 6e 61    (process-signa
8810: 6c 20 28 63 75 72 72 65 6e 74 2d 70 72 6f 63 65  l (current-proce
8820: 73 73 2d 69 64 29 20 73 69 67 6e 61 6c 2f 6b 69  ss-id) signal/ki
8830: 6c 6c 29 29 29 29 29 29 0a 09 28 28 4b 49 4c 4c  ll))))))..((KILL
8840: 45 44 29 20 0a 09 20 28 64 65 62 75 67 3a 70 72  ED) .. (debug:pr
8850: 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 22 20 6e  int 1 "NOTE: " n
8860: 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 69  ew-test-name " i
8870: 73 20 61 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e  s already runnin
8880: 67 20 6f 72 20 77 61 73 20 65 78 70 6c 69 63 74  g or was explict
8890: 6c 79 20 6b 69 6c 6c 65 64 2c 20 75 73 65 20 2d  ly killed, use -
88a0: 66 6f 72 63 65 20 74 6f 20 6c 61 75 6e 63 68 20  force to launch 
88b0: 69 74 2e 22 29 29 0a 09 28 28 4c 41 55 4e 43 48  it."))..((LAUNCH
88c0: 45 44 20 52 45 4d 4f 54 45 48 4f 53 54 53 54 41  ED REMOTEHOSTSTA
88d0: 52 54 20 52 55 4e 4e 49 4e 47 29 20 20 0a 09 20  RT RUNNING)  .. 
88e0: 28 69 66 20 28 3e 20 28 2d 20 28 63 75 72 72 65  (if (> (- (curre
88f0: 6e 74 2d 73 65 63 6f 6e 64 73 29 28 2b 20 28 64  nt-seconds)(+ (d
8900: 62 3a 74 65 73 74 2d 67 65 74 2d 65 76 65 6e 74  b:test-get-event
8910: 5f 74 69 6d 65 20 74 65 73 74 64 61 74 29 0a 09  _time testdat)..
8920: 09 09 09 20 20 20 20 20 20 20 28 64 62 3a 74 65  ...       (db:te
8930: 73 74 2d 67 65 74 2d 72 75 6e 5f 64 75 72 61 74  st-get-run_durat
8940: 69 6f 6e 20 74 65 73 74 64 61 74 29 29 29 0a 09  ion testdat)))..
8950: 09 36 30 30 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f  .600) ;; i.e. no
8960: 20 75 70 64 61 74 65 20 66 6f 72 20 6d 6f 72 65   update for more
8970: 20 74 68 61 6e 20 36 30 30 20 73 65 63 6f 6e 64   than 600 second
8980: 73 0a 09 20 20 20 20 20 28 62 65 67 69 6e 0a 09  s..     (begin..
8990: 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72         (debug:pr
89a0: 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20  int 0 "WARNING: 
89b0: 54 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65  Test " test-name
89c0: 20 22 20 61 70 70 65 61 72 73 20 74 6f 20 62 65   " appears to be
89d0: 20 64 65 61 64 2e 20 46 6f 72 63 69 6e 67 20 69   dead. Forcing i
89e0: 74 20 74 6f 20 73 74 61 74 65 20 49 4e 43 4f 4d  t to state INCOM
89f0: 50 4c 45 54 45 20 61 6e 64 20 73 74 61 74 75 73  PLETE and status
8a00: 20 53 54 55 43 4b 2f 44 45 41 44 22 29 0a 09 20   STUCK/DEAD").. 
8a10: 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73        (tests:tes
8a20: 74 2d 73 65 74 2d 73 74 61 74 75 73 21 20 74 65  t-set-status! te
8a30: 73 74 2d 69 64 20 22 49 4e 43 4f 4d 50 4c 45 54  st-id "INCOMPLET
8a40: 45 22 20 22 53 54 55 43 4b 2f 44 45 41 44 22 20  E" "STUCK/DEAD" 
8a50: 22 54 65 73 74 20 69 73 20 73 74 75 63 6b 20 6f  "Test is stuck o
8a60: 72 20 64 65 61 64 22 20 23 66 29 29 0a 09 20 20  r dead" #f))..  
8a70: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
8a80: 32 20 22 4e 4f 54 45 3a 20 22 20 74 65 73 74 2d  2 "NOTE: " test-
8a90: 6e 61 6d 65 20 22 20 69 73 20 61 6c 72 65 61 64  name " is alread
8aa0: 79 20 72 75 6e 6e 69 6e 67 22 29 29 29 0a 09 28  y running")))..(
8ab0: 65 6c 73 65 20 20 20 20 20 20 20 28 64 65 62 75  else       (debu
8ac0: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52  g:print 0 "ERROR
8ad0: 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e  : Failed to laun
8ae0: 63 68 20 74 65 73 74 20 22 20 6e 65 77 2d 74 65  ch test " new-te
8af0: 73 74 2d 6e 61 6d 65 20 22 2e 20 55 6e 72 65 63  st-name ". Unrec
8b00: 6f 67 6e 69 73 65 64 20 73 74 61 74 65 20 22 20  ognised state " 
8b10: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20  (test:get-state 
8b20: 74 65 73 74 64 61 74 29 29 29 29 29 29 29 0a 0a  testdat)))))))..
8b30: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;;==============
8b40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8b50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8b60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8b70: 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 45 4e 44 20  ========.;; END 
8b80: 4f 46 20 4e 45 57 20 53 54 55 46 46 0a 3b 3b 3d  OF NEW STUFF.;;=
8b90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8ba0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8bb0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8bc0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8bd0: 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65 20 28  =====..(define (
8be0: 67 65 74 2d 64 69 72 2d 75 70 2d 6e 20 64 69 72  get-dir-up-n dir
8bf0: 20 2e 20 70 61 72 61 6d 73 29 20 0a 20 20 28 6c   . params) .  (l
8c00: 65 74 20 28 28 64 70 61 72 74 73 20 20 28 73 74  et ((dparts  (st
8c10: 72 69 6e 67 2d 73 70 6c 69 74 20 64 69 72 20 22  ring-split dir "
8c20: 2f 22 29 29 0a 09 28 63 6f 75 6e 74 20 20 20 28  /"))..(count   (
8c30: 69 66 20 28 6e 75 6c 6c 3f 20 70 61 72 61 6d 73  if (null? params
8c40: 29 20 31 20 28 63 61 72 20 70 61 72 61 6d 73 29  ) 1 (car params)
8c50: 29 29 29 0a 20 20 20 20 28 63 6f 6e 63 20 22 2f  ))).    (conc "/
8c60: 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73  " (string-inters
8c70: 70 65 72 73 65 20 0a 09 20 20 20 20 20 20 20 28  perse ..       (
8c80: 74 61 6b 65 20 64 70 61 72 74 73 20 28 2d 20 28  take dparts (- (
8c90: 6c 65 6e 67 74 68 20 64 70 61 72 74 73 29 20 63  length dparts) c
8ca0: 6f 75 6e 74 29 29 0a 09 20 20 20 20 20 20 20 22  ount))..       "
8cb0: 2f 22 29 29 29 29 0a 3b 3b 20 52 65 6d 6f 76 65  /")))).;; Remove
8cc0: 20 72 75 6e 73 0a 3b 3b 20 66 69 65 6c 64 73 20   runs.;; fields 
8cd0: 61 72 65 20 70 61 73 73 69 6e 67 20 69 6e 20 74  are passing in t
8ce0: 68 72 6f 75 67 68 20 0a 3b 3b 20 61 63 74 69 6f  hrough .;; actio
8cf0: 6e 3a 0a 3b 3b 20 20 20 20 27 72 65 6d 6f 76 65  n:.;;    'remove
8d00: 2d 72 75 6e 73 0a 3b 3b 20 20 20 20 27 73 65 74  -runs.;;    'set
8d10: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 0a 3b 3b  -state-status.;;
8d20: 0a 3b 3b 20 4e 42 2f 2f 20 73 68 6f 75 6c 64 20  .;; NB// should 
8d30: 70 61 73 73 20 69 6e 20 6b 65 79 73 3f 0a 3b 3b  pass in keys?.;;
8d40: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 6f  .(define (runs:o
8d50: 70 65 72 61 74 65 2d 6f 6e 20 61 63 74 69 6f 6e  perate-on action
8d60: 20 72 75 6e 6e 61 6d 65 70 61 74 74 20 74 65 73   runnamepatt tes
8d70: 74 70 61 74 74 20 23 21 6b 65 79 20 28 73 74 61  tpatt #!key (sta
8d80: 74 65 20 23 66 29 28 73 74 61 74 75 73 20 23 66  te #f)(status #f
8d90: 29 28 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74  )(new-state-stat
8da0: 75 73 20 23 66 29 29 0a 20 20 28 63 6f 6d 6d 6f  us #f)).  (commo
8db0: 6e 3a 63 6c 65 61 72 2d 63 61 63 68 65 73 29 20  n:clear-caches) 
8dc0: 3b 3b 20 63 6c 65 61 72 20 61 6c 6c 20 63 61 63  ;; clear all cac
8dd0: 68 65 73 0a 20 20 28 6c 65 74 2a 20 28 28 64 62  hes.  (let* ((db
8de0: 20 20 20 20 20 20 20 20 20 20 20 23 66 29 0a 09             #f)..
8df0: 20 28 6b 65 79 73 20 20 20 20 20 20 20 20 20 28   (keys         (
8e00: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64  open-run-close d
8e10: 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a  b:get-keys db)).
8e20: 09 20 28 72 75 6e 64 61 74 20 20 20 20 20 20 20  . (rundat       
8e30: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
8e40: 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79  runs:get-runs-by
8e50: 2d 70 61 74 74 20 64 62 20 6b 65 79 73 20 72 75  -patt db keys ru
8e60: 6e 6e 61 6d 65 70 61 74 74 29 29 0a 09 20 28 68  nnamepatt)).. (h
8e70: 65 61 64 65 72 20 20 20 20 20 20 20 28 76 65 63  eader       (vec
8e80: 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 30  tor-ref rundat 0
8e90: 29 29 0a 09 20 28 72 75 6e 73 20 20 20 20 20 20  )).. (runs      
8ea0: 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72     (vector-ref r
8eb0: 75 6e 64 61 74 20 31 29 29 0a 09 20 28 73 74 61  undat 1)).. (sta
8ec0: 74 65 73 20 20 20 20 20 20 20 28 69 66 20 73 74  tes       (if st
8ed0: 61 74 65 20 20 28 73 74 72 69 6e 67 2d 73 70 6c  ate  (string-spl
8ee0: 69 74 20 73 74 61 74 65 20 20 22 2c 22 29 20 27  it state  ",") '
8ef0: 28 29 29 29 0a 09 20 28 73 74 61 74 75 73 65 73  ())).. (statuses
8f00: 20 20 20 20 20 28 69 66 20 73 74 61 74 75 73 20       (if status 
8f10: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 73 74  (string-split st
8f20: 61 74 75 73 20 22 2c 22 29 20 27 28 29 29 29 0a  atus ",") '())).
8f30: 09 20 28 73 74 61 74 65 2d 73 74 61 74 75 73 20  . (state-status 
8f40: 28 69 66 20 28 73 74 72 69 6e 67 3f 20 6e 65 77  (if (string? new
8f50: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 29 20 28  -state-status) (
8f60: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 6e 65 77  string-split new
8f70: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 20 22 2c  -state-status ",
8f80: 22 29 20 27 28 23 66 20 23 66 29 29 29 29 0a 20  ") '(#f #f)))). 
8f90: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d     (debug:print-
8fa0: 69 6e 66 6f 20 34 20 22 72 75 6e 73 3a 6f 70 65  info 4 "runs:ope
8fb0: 72 61 74 65 2d 6f 6e 20 3d 3e 20 48 65 61 64 65  rate-on => Heade
8fc0: 72 3a 20 22 20 68 65 61 64 65 72 20 22 20 61 63  r: " header " ac
8fd0: 74 69 6f 6e 3a 20 22 20 61 63 74 69 6f 6e 20 22  tion: " action "
8fe0: 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75   new-state-statu
8ff0: 73 3a 20 22 20 6e 65 77 2d 73 74 61 74 65 2d 73  s: " new-state-s
9000: 74 61 74 75 73 29 0a 20 20 20 20 28 69 66 20 28  tatus).    (if (
9010: 3e 20 32 20 28 6c 65 6e 67 74 68 20 73 74 61 74  > 2 (length stat
9020: 65 2d 73 74 61 74 75 73 29 29 0a 09 28 62 65 67  e-status))..(beg
9030: 69 6e 0a 09 20 20 28 64 65 62 75 67 3a 70 72 69  in..  (debug:pri
9040: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 74 68 65  nt 0 "ERROR: the
9050: 20 70 61 72 61 6d 65 74 65 72 20 74 6f 20 2d 73   parameter to -s
9060: 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73 20  et-state-status 
9070: 69 73 20 61 20 63 6f 6d 6d 61 20 64 65 6c 69 6d  is a comma delim
9080: 69 74 65 64 20 73 74 72 69 6e 67 2e 20 45 2e 67  ited string. E.g
9090: 2e 20 43 4f 4d 50 4c 45 54 45 44 2c 46 41 49 4c  . COMPLETED,FAIL
90a0: 22 29 0a 09 20 20 28 65 78 69 74 29 29 29 0a 20  ")..  (exit))). 
90b0: 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 20     (for-each.   
90c0: 20 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a    (lambda (run).
90d0: 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 75         (let ((ru
90e0: 6e 6b 65 79 20 28 73 74 72 69 6e 67 2d 69 6e 74  nkey (string-int
90f0: 65 72 73 70 65 72 73 65 20 28 6d 61 70 20 28 6c  ersperse (map (l
9100: 61 6d 62 64 61 20 28 6b 29 0a 09 09 09 09 09 09  ambda (k).......
9110: 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79  (db:get-value-by
9120: 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64  -header run head
9130: 65 72 20 28 76 65 63 74 6f 72 2d 72 65 66 20 6b  er (vector-ref k
9140: 20 30 29 29 29 20 6b 65 79 73 29 20 22 2f 22 29   0))) keys) "/")
9150: 29 0a 09 20 20 20 20 20 28 64 69 72 73 2d 74 6f  )..     (dirs-to
9160: 2d 72 65 6d 6f 76 65 20 28 6d 61 6b 65 2d 68 61  -remove (make-ha
9170: 73 68 2d 74 61 62 6c 65 29 29 29 0a 09 20 28 6c  sh-table))).. (l
9180: 65 74 2a 20 28 28 72 75 6e 2d 69 64 20 20 20 20  et* ((run-id    
9190: 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79  (db:get-value-by
91a0: 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64  -header run head
91b0: 65 72 20 22 69 64 22 29 29 0a 09 09 28 72 75 6e  er "id"))...(run
91c0: 2d 73 74 61 74 65 20 28 64 62 3a 67 65 74 2d 76  -state (db:get-v
91d0: 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72  alue-by-header r
91e0: 75 6e 20 68 65 61 64 65 72 20 22 73 74 61 74 65  un header "state
91f0: 22 29 29 0a 09 09 28 74 65 73 74 73 20 20 20 20  "))...(tests    
9200: 20 28 69 66 20 28 6e 6f 74 20 28 65 71 75 61 6c   (if (not (equal
9210: 3f 20 72 75 6e 2d 73 74 61 74 65 20 22 6c 6f 63  ? run-state "loc
9220: 6b 65 64 22 29 29 0a 09 09 09 20 20 20 20 20 20  ked"))....      
9230: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
9240: 20 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f   db:get-tests-fo
9250: 72 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 0a  r-run db run-id.
9260: 09 09 09 09 09 09 20 20 20 20 20 20 74 65 73 74  ......      test
9270: 70 61 74 74 20 73 74 61 74 65 73 20 73 74 61 74  patt states stat
9280: 75 73 65 73 0a 09 09 09 09 09 09 20 20 20 20 20  uses.......     
9290: 20 6e 6f 74 2d 69 6e 3a 20 20 23 66 0a 09 09 09   not-in:  #f....
92a0: 09 09 09 20 20 20 20 20 20 73 6f 72 74 2d 62 79  ...      sort-by
92b0: 3a 20 28 63 61 73 65 20 61 63 74 69 6f 6e 0a 09  : (case action..
92c0: 09 09 09 09 09 09 09 20 28 28 72 65 6d 6f 76 65  ....... ((remove
92d0: 2d 72 75 6e 73 29 20 27 72 75 6e 64 69 72 29 0a  -runs) 'rundir).
92e0: 09 09 09 09 09 09 09 09 20 28 65 6c 73 65 20 20  ........ (else  
92f0: 20 20 20 20 20 20 20 20 27 65 76 65 6e 74 5f 74          'event_t
9300: 69 6d 65 29 29 29 0a 09 09 09 20 20 20 20 20 20  ime)))....      
9310: 20 27 28 29 29 29 0a 09 09 28 6c 61 73 74 74 70   '()))...(lasttp
9320: 61 74 68 20 22 2f 64 6f 65 73 2f 6e 6f 74 2f 65  ath "/does/not/e
9330: 78 69 73 74 2f 49 2f 68 6f 70 65 22 29 29 0a 09  xist/I/hope"))..
9340: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d     (debug:print-
9350: 69 6e 66 6f 20 34 20 22 72 75 6e 73 3a 6f 70 65  info 4 "runs:ope
9360: 72 61 74 65 2d 6f 6e 20 72 75 6e 3d 22 20 72 75  rate-on run=" ru
9370: 6e 20 22 2c 20 68 65 61 64 65 72 3d 22 20 68 65  n ", header=" he
9380: 61 64 65 72 29 0a 09 20 20 20 28 69 66 20 28 6e  ader)..   (if (n
9390: 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 73 74 73 29  ot (null? tests)
93a0: 29 0a 09 20 20 20 20 20 20 20 28 62 65 67 69 6e  )..       (begin
93b0: 0a 09 09 20 28 63 61 73 65 20 61 63 74 69 6f 6e  ... (case action
93c0: 0a 09 09 20 20 20 28 28 72 65 6d 6f 76 65 2d 72  ...   ((remove-r
93d0: 75 6e 73 29 0a 09 09 20 20 20 20 28 64 65 62 75  uns)...    (debu
93e0: 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76  g:print 1 "Remov
93f0: 69 6e 67 20 74 65 73 74 73 20 66 6f 72 20 72 75  ing tests for ru
9400: 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20 22 20  n: " runkey " " 
9410: 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79  (db:get-value-by
9420: 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64  -header run head
9430: 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 29 29 0a  er "runname"))).
9440: 09 09 20 20 20 28 28 73 65 74 2d 73 74 61 74 65  ..   ((set-state
9450: 2d 73 74 61 74 75 73 29 0a 09 09 20 20 20 20 28  -status)...    (
9460: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4d  debug:print 1 "M
9470: 6f 64 69 66 79 69 6e 67 20 73 74 61 74 65 20 61  odifying state a
9480: 6e 64 20 73 74 61 75 73 20 66 6f 72 20 74 65 73  nd staus for tes
9490: 74 73 20 66 6f 72 20 72 75 6e 3a 20 22 20 72 75  ts for run: " ru
94a0: 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74  nkey " " (db:get
94b0: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72  -value-by-header
94c0: 20 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e   run header "run
94d0: 6e 61 6d 65 22 29 29 29 0a 09 09 20 20 20 28 28  name")))...   ((
94e0: 70 72 69 6e 74 2d 72 75 6e 29 0a 09 09 20 20 20  print-run)...   
94f0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20   (debug:print 1 
9500: 22 50 72 69 6e 74 69 6e 67 20 69 6e 66 6f 20 66  "Printing info f
9510: 6f 72 20 72 75 6e 20 22 20 72 75 6e 6b 65 79 20  or run " runkey 
9520: 22 2c 20 72 75 6e 3d 22 20 72 75 6e 20 22 2c 20  ", run=" run ", 
9530: 74 65 73 74 73 3d 22 20 74 65 73 74 73 20 22 2c  tests=" tests ",
9540: 20 68 65 61 64 65 72 3d 22 20 68 65 61 64 65 72   header=" header
9550: 29 0a 09 09 20 20 20 20 61 63 74 69 6f 6e 29 0a  )...    action).
9560: 09 09 20 20 20 28 65 6c 73 65 0a 09 09 20 20 20  ..   (else...   
9570: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
9580: 66 6f 20 30 20 22 61 63 74 69 6f 6e 20 6e 6f 74  fo 0 "action not
9590: 20 72 65 63 6f 67 6e 69 73 65 64 20 22 20 61 63   recognised " ac
95a0: 74 69 6f 6e 29 29 29 0a 09 09 20 28 66 6f 72 2d  tion)))... (for-
95b0: 65 61 63 68 0a 09 09 20 20 28 6c 61 6d 62 64 61  each...  (lambda
95c0: 20 28 74 65 73 74 29 0a 09 09 20 20 20 20 28 6c   (test)...    (l
95d0: 65 74 2a 20 28 28 69 74 65 6d 2d 70 61 74 68 20  et* ((item-path 
95e0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65  (db:test-get-ite
95f0: 6d 2d 70 61 74 68 20 74 65 73 74 29 29 0a 09 09  m-path test))...
9600: 09 20 20 20 28 74 65 73 74 2d 6e 61 6d 65 20 28  .   (test-name (
9610: 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74  db:test-get-test
9620: 6e 61 6d 65 20 74 65 73 74 29 29 0a 09 09 09 20  name test)).... 
9630: 20 20 28 72 75 6e 2d 64 69 72 20 20 20 28 64 62    (run-dir   (db
9640: 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 64 69 72  :test-get-rundir
9650: 20 74 65 73 74 29 29 20 20 20 20 3b 3b 20 72 75   test))    ;; ru
9660: 6e 20 64 69 72 20 69 73 20 66 72 6f 6d 20 74 68  n dir is from th
9670: 65 20 6c 69 6e 6b 20 74 72 65 65 0a 09 09 09 20  e link tree.... 
9680: 20 20 28 72 65 61 6c 2d 64 69 72 20 20 28 69 66    (real-dir  (if
9690: 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 72   (file-exists? r
96a0: 75 6e 2d 64 69 72 29 0a 09 09 09 09 09 20 20 28  un-dir)......  (
96b0: 72 65 73 6f 6c 76 65 2d 70 61 74 68 6e 61 6d 65  resolve-pathname
96c0: 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 09 09 20   run-dir)...... 
96d0: 20 23 66 29 29 0a 09 09 09 20 20 20 28 74 65 73   #f))....   (tes
96e0: 74 2d 69 64 20 20 20 28 64 62 3a 74 65 73 74 2d  t-id   (db:test-
96f0: 67 65 74 2d 69 64 20 74 65 73 74 29 29 29 0a 09  get-id test)))..
9700: 09 20 20 20 20 20 20 3b 3b 20 20 20 28 74 64 62  .      ;;   (tdb
9710: 20 20 20 20 20 20 20 28 64 62 3a 6f 70 65 6e 2d         (db:open-
9720: 74 65 73 74 2d 64 62 20 72 75 6e 2d 64 69 72 29  test-db run-dir)
9730: 29 29 0a 09 09 20 20 20 20 20 20 28 64 65 62 75  ))...      (debu
9740: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22  g:print-info 4 "
9750: 74 65 73 74 3d 22 20 74 65 73 74 29 20 3b 3b 20  test=" test) ;; 
9760: 20 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74    " (db:test-get
9770: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29 20  -testname test) 
9780: 22 20 69 64 3a 20 22 20 28 64 62 3a 74 65 73 74  " id: " (db:test
9790: 2d 67 65 74 2d 69 64 20 74 65 73 74 29 20 22 20  -get-id test) " 
97a0: 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20 61 63  " item-path " ac
97b0: 74 69 6f 6e 3a 20 22 20 61 63 74 69 6f 6e 29 0a  tion: " action).
97c0: 09 09 20 20 20 20 20 20 28 63 61 73 65 20 61 63  ..      (case ac
97d0: 74 69 6f 6e 0a 09 09 09 28 28 72 65 6d 6f 76 65  tion....((remove
97e0: 2d 72 75 6e 73 29 20 3b 3b 20 74 68 65 20 74 64  -runs) ;; the td
97f0: 62 20 69 73 20 66 6f 72 20 66 75 74 75 72 65 20  b is for future 
9800: 70 6f 73 73 69 62 6c 65 2e 20 0a 09 09 09 20 28  possible. .... (
9810: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64  open-run-close d
9820: 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 2d 72 65  b:delete-test-re
9830: 63 6f 72 64 73 20 64 62 20 23 66 20 28 64 62 3a  cords db #f (db:
9840: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74  test-get-id test
9850: 29 29 0a 09 09 09 20 28 64 65 62 75 67 3a 70 72  )).... (debug:pr
9860: 69 6e 74 2d 69 6e 66 6f 20 31 20 22 41 74 74 65  int-info 1 "Atte
9870: 6d 70 74 69 6e 67 20 74 6f 20 72 65 6d 6f 76 65  mpting to remove
9880: 20 22 20 28 69 66 20 72 65 61 6c 2d 64 69 72 20   " (if real-dir 
9890: 28 63 6f 6e 63 20 22 20 64 69 72 20 22 20 72 65  (conc " dir " re
98a0: 61 6c 2d 64 69 72 20 22 20 61 6e 64 20 22 29 20  al-dir " and ") 
98b0: 22 22 29 20 22 20 6c 69 6e 6b 20 22 20 72 75 6e  "") " link " run
98c0: 2d 64 69 72 29 0a 09 09 09 20 28 69 66 20 28 61  -dir).... (if (a
98d0: 6e 64 20 72 65 61 6c 2d 64 69 72 20 0a 09 09 09  nd real-dir ....
98e0: 09 20 20 28 3e 20 28 73 74 72 69 6e 67 2d 6c 65  .  (> (string-le
98f0: 6e 67 74 68 20 72 65 61 6c 2d 64 69 72 29 20 35  ngth real-dir) 5
9900: 29 0a 09 09 09 09 20 20 28 66 69 6c 65 2d 65 78  ).....  (file-ex
9910: 69 73 74 73 3f 20 72 65 61 6c 2d 64 69 72 29 29  ists? real-dir))
9920: 20 3b 3b 20 62 61 64 20 68 65 75 72 69 73 74 69   ;; bad heuristi
9930: 63 20 62 75 74 20 73 68 6f 75 6c 64 20 70 72 65  c but should pre
9940: 76 65 6e 74 20 2f 74 6d 70 20 2f 68 6f 6d 65 20  vent /tmp /home 
9950: 65 74 63 2e 0a 09 09 09 20 20 20 20 20 28 62 65  etc.....     (be
9960: 67 69 6e 20 3b 3b 20 6c 65 74 2a 20 28 28 72 65  gin ;; let* ((re
9970: 61 6c 70 61 74 68 20 28 72 65 73 6f 6c 76 65 2d  alpath (resolve-
9980: 70 61 74 68 6e 61 6d 65 20 72 75 6e 2d 64 69 72  pathname run-dir
9990: 29 29 29 0a 09 09 09 20 20 20 20 20 20 20 28 64  )))....       (d
99a0: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
99b0: 31 20 22 52 65 63 75 72 73 69 76 65 6c 79 20 72  1 "Recursively r
99c0: 65 6d 6f 76 69 6e 67 20 22 20 72 65 61 6c 2d 64  emoving " real-d
99d0: 69 72 29 0a 09 09 09 20 20 20 20 20 20 20 28 69  ir)....       (i
99e0: 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20  f (file-exists? 
99f0: 72 65 61 6c 2d 64 69 72 29 0a 09 09 09 09 20 20  real-dir).....  
9a00: 20 28 69 66 20 28 3e 20 28 73 79 73 74 65 6d 20   (if (> (system 
9a10: 28 63 6f 6e 63 20 22 72 6d 20 2d 72 66 20 22 20  (conc "rm -rf " 
9a20: 72 65 61 6c 2d 64 69 72 29 29 20 30 29 0a 09 09  real-dir)) 0)...
9a30: 09 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a  ..       (debug:
9a40: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
9a50: 54 68 65 72 65 20 77 61 73 20 61 20 70 72 6f 62  There was a prob
9a60: 6c 65 6d 20 72 65 6d 6f 76 69 6e 67 20 22 20 72  lem removing " r
9a70: 65 61 6c 2d 64 69 72 20 22 20 77 69 74 68 20 72  eal-dir " with r
9a80: 6d 20 2d 66 22 29 29 0a 09 09 09 09 20 20 20 28  m -f")).....   (
9a90: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57  debug:print 0 "W
9aa0: 41 52 4e 49 4e 47 3a 20 74 65 73 74 20 64 69 72  ARNING: test dir
9ab0: 20 22 20 72 65 61 6c 2d 64 69 72 20 22 20 61 70   " real-dir " ap
9ac0: 70 65 61 72 73 20 74 6f 20 6e 6f 74 20 65 78 69  pears to not exi
9ad0: 73 74 20 6f 72 20 69 73 20 6e 6f 74 20 72 65 61  st or is not rea
9ae0: 64 61 62 6c 65 22 29 29 29 0a 09 09 09 20 20 20  dable")))....   
9af0: 20 20 28 69 66 20 72 65 61 6c 2d 64 69 72 20 0a    (if real-dir .
9b00: 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e  .... (debug:prin
9b10: 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 64 69  t 0 "WARNING: di
9b20: 72 65 63 74 6f 72 79 20 22 20 72 65 61 6c 2d 64  rectory " real-d
9b30: 69 72 20 22 20 64 6f 65 73 20 6e 6f 74 20 65 78  ir " does not ex
9b40: 69 73 74 22 29 0a 09 09 09 09 20 28 64 65 62 75  ist")..... (debu
9b50: 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49  g:print 0 "WARNI
9b60: 4e 47 3a 20 6e 6f 20 72 65 61 6c 20 64 69 72 65  NG: no real dire
9b70: 63 74 6f 72 79 20 63 6f 72 72 6f 73 70 6f 6e 64  ctory corrospond
9b80: 69 6e 67 20 74 6f 20 6c 69 6e 6b 20 22 20 72 75  ing to link " ru
9b90: 6e 2d 64 69 72 20 22 2c 20 6e 6f 74 68 69 6e 67  n-dir ", nothing
9ba0: 20 64 6f 6e 65 22 29 29 29 0a 09 09 09 20 28 69   done"))).... (i
9bb0: 66 20 28 73 79 6d 62 6f 6c 69 63 2d 6c 69 6e 6b  f (symbolic-link
9bc0: 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 20 20  ? run-dir)....  
9bd0: 20 20 20 28 62 65 67 69 6e 0a 09 09 09 20 20 20     (begin....   
9be0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
9bf0: 2d 69 6e 66 6f 20 31 20 22 52 65 6d 6f 76 69 6e  -info 1 "Removin
9c00: 67 20 73 79 6d 6c 69 6e 6b 20 22 20 72 75 6e 2d  g symlink " run-
9c10: 64 69 72 29 0a 09 09 09 20 20 20 20 20 20 20 28  dir)....       (
9c20: 64 65 6c 65 74 65 2d 66 69 6c 65 20 72 75 6e 2d  delete-file run-
9c30: 64 69 72 29 29 0a 09 09 09 20 20 20 20 20 28 69  dir))....     (i
9c40: 66 20 28 64 69 72 65 63 74 6f 72 79 3f 20 72 75  f (directory? ru
9c50: 6e 2d 64 69 72 29 0a 09 09 09 09 20 28 69 66 20  n-dir)..... (if 
9c60: 28 3e 20 28 64 69 72 65 63 74 6f 72 79 2d 66 6f  (> (directory-fo
9c70: 6c 64 20 28 6c 61 6d 62 64 61 20 28 66 20 78 29  ld (lambda (f x)
9c80: 28 2b 20 31 20 78 29 29 20 30 20 72 75 6e 2d 64  (+ 1 x)) 0 run-d
9c90: 69 72 29 20 30 29 0a 09 09 09 09 20 20 20 20 20  ir) 0).....     
9ca0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
9cb0: 57 41 52 4e 49 4e 47 3a 20 72 65 66 75 73 69 6e  WARNING: refusin
9cc0: 67 20 74 6f 20 72 65 6d 6f 76 65 20 22 20 72 75  g to remove " ru
9cd0: 6e 2d 64 69 72 20 22 20 61 73 20 69 74 20 69 73  n-dir " as it is
9ce0: 20 6e 6f 74 20 65 6d 70 74 79 22 29 0a 09 09 09   not empty")....
9cf0: 09 20 20 20 20 20 28 64 65 6c 65 74 65 2d 64 69  .     (delete-di
9d00: 72 65 63 74 6f 72 79 20 72 75 6e 2d 64 69 72 29  rectory run-dir)
9d10: 29 20 3b 3b 20 69 74 20 73 68 6f 75 6c 64 20 62  ) ;; it should b
9d20: 65 20 65 6d 70 74 79 20 62 79 20 68 65 72 65 20  e empty by here 
9d30: 42 55 47 20 42 55 47 2c 20 61 64 64 20 65 72 72  BUG BUG, add err
9d40: 6f 72 20 63 61 74 63 68 0a 09 09 09 09 20 28 69  or catch..... (i
9d50: 66 20 72 75 6e 2d 64 69 72 0a 09 09 09 09 20 20  f run-dir.....  
9d60: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
9d70: 30 20 22 57 41 52 4e 49 4e 47 3a 20 6e 6f 74 20  0 "WARNING: not 
9d80: 72 65 6d 6f 76 69 6e 67 20 22 20 72 75 6e 2d 64  removing " run-d
9d90: 69 72 20 22 20 61 73 20 69 74 20 65 69 74 68 65  ir " as it eithe
9da0: 72 20 64 6f 65 73 6e 27 74 20 65 78 69 73 74 20  r doesn't exist 
9db0: 6f 72 20 69 73 20 6e 6f 74 20 61 20 73 79 6d 6c  or is not a syml
9dc0: 69 6e 6b 22 29 0a 09 09 09 09 20 20 20 20 20 28  ink").....     (
9dd0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 4e  debug:print 0 "N
9de0: 4f 54 45 3a 20 74 68 65 20 72 75 6e 20 64 69 72  OTE: the run dir
9df0: 20 66 6f 72 20 74 68 69 73 20 74 65 73 74 20 69   for this test i
9e00: 73 20 75 6e 64 65 66 69 6e 65 64 2e 20 54 65 73  s undefined. Tes
9e10: 74 20 6d 61 79 20 68 61 76 65 20 61 6c 72 65 61  t may have alrea
9e20: 64 79 20 62 65 65 6e 20 64 65 6c 65 74 65 64 2e  dy been deleted.
9e30: 22 29 29 0a 09 09 09 09 20 29 29 29 0a 09 09 09  "))..... )))....
9e40: 28 28 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74  ((set-state-stat
9e50: 75 73 29 0a 09 09 09 20 28 64 65 62 75 67 3a 70  us).... (debug:p
9e60: 72 69 6e 74 2d 69 6e 66 6f 20 32 20 22 6e 65 77  rint-info 2 "new
9e70: 20 73 74 61 74 65 20 22 20 28 63 61 72 20 73 74   state " (car st
9e80: 61 74 65 2d 73 74 61 74 75 73 29 20 22 2c 20 6e  ate-status) ", n
9e90: 65 77 20 73 74 61 74 75 73 20 22 20 28 63 61 64  ew status " (cad
9ea0: 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 29  r state-status))
9eb0: 0a 09 09 09 20 28 6f 70 65 6e 2d 72 75 6e 2d 63  .... (open-run-c
9ec0: 6c 6f 73 65 20 64 62 3a 74 65 73 74 2d 73 65 74  lose db:test-set
9ed0: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 2d 62 79  -state-status-by
9ee0: 2d 69 64 20 64 62 20 28 64 62 3a 74 65 73 74 2d  -id db (db:test-
9ef0: 67 65 74 2d 69 64 20 74 65 73 74 29 20 28 63 61  get-id test) (ca
9f00: 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 28  r state-status)(
9f10: 63 61 64 72 20 73 74 61 74 65 2d 73 74 61 74 75  cadr state-statu
9f20: 73 29 20 23 66 29 29 29 29 29 0a 09 09 20 20 28  s) #f)))))...  (
9f30: 73 6f 72 74 20 74 65 73 74 73 20 28 6c 61 6d 62  sort tests (lamb
9f40: 64 61 20 28 61 20 62 29 28 6c 65 74 20 28 28 64  da (a b)(let ((d
9f50: 69 72 61 20 28 64 62 3a 74 65 73 74 2d 67 65 74  ira (db:test-get
9f60: 2d 72 75 6e 64 69 72 20 61 29 29 0a 09 09 09 09  -rundir a)).....
9f70: 09 09 20 28 64 69 72 62 20 28 64 62 3a 74 65 73  .. (dirb (db:tes
9f80: 74 2d 67 65 74 2d 72 75 6e 64 69 72 20 62 29 29  t-get-rundir b))
9f90: 29 0a 09 09 09 09 09 20 20 20 20 20 28 69 66 20  )......     (if 
9fa0: 28 61 6e 64 20 28 73 74 72 69 6e 67 3f 20 64 69  (and (string? di
9fb0: 72 61 29 28 73 74 72 69 6e 67 3f 20 64 69 72 62  ra)(string? dirb
9fc0: 29 29 0a 09 09 09 09 09 09 20 28 3e 20 28 73 74  ))....... (> (st
9fd0: 72 69 6e 67 2d 6c 65 6e 67 74 68 20 64 69 72 61  ring-length dira
9fe0: 29 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20  )(string-length 
9ff0: 64 69 72 62 29 29 0a 09 09 09 09 09 09 20 23 66  dirb))....... #f
a000: 29 29 29 29 29 29 29 0a 09 20 20 20 3b 3b 20 72  )))))))..   ;; r
a010: 65 6d 6f 76 65 20 74 68 65 20 72 75 6e 20 69 66  emove the run if
a020: 20 7a 65 72 6f 20 74 65 73 74 73 20 72 65 6d 61   zero tests rema
a030: 69 6e 0a 09 20 20 20 28 69 66 20 28 65 71 3f 20  in..   (if (eq? 
a040: 61 63 74 69 6f 6e 20 27 72 65 6d 6f 76 65 2d 72  action 'remove-r
a050: 75 6e 73 29 0a 09 20 20 20 20 20 20 20 28 6c 65  uns)..       (le
a060: 74 20 28 28 72 65 6d 74 65 73 74 73 20 28 6f 70  t ((remtests (op
a070: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a  en-run-close db:
a080: 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75  get-tests-for-ru
a090: 6e 20 64 62 20 28 64 62 3a 67 65 74 2d 76 61 6c  n db (db:get-val
a0a0: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e  ue-by-header run
a0b0: 20 68 65 61 64 65 72 20 22 69 64 22 29 20 23 66   header "id") #f
a0c0: 20 27 28 22 44 45 4c 45 54 45 44 22 29 20 27 28   '("DELETED") '(
a0d0: 22 6e 2f 61 22 29 20 6e 6f 74 2d 69 6e 3a 20 23  "n/a") not-in: #
a0e0: 74 29 29 29 0a 09 09 20 28 69 66 20 28 6e 75 6c  t)))... (if (nul
a0f0: 6c 3f 20 72 65 6d 74 65 73 74 73 29 20 3b 3b 20  l? remtests) ;; 
a100: 6e 6f 20 6d 6f 72 65 20 74 65 73 74 73 20 72 65  no more tests re
a110: 6d 61 69 6e 69 6e 67 0a 09 09 20 20 20 20 20 28  maining...     (
a120: 6c 65 74 2a 20 28 28 64 70 61 72 74 73 20 20 28  let* ((dparts  (
a130: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 6c 61 73  string-split las
a140: 74 74 70 61 74 68 20 22 2f 22 29 29 0a 09 09 09  ttpath "/"))....
a150: 20 20 20 20 28 72 75 6e 70 61 74 68 20 28 63 6f      (runpath (co
a160: 6e 63 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69  nc "/" (string-i
a170: 6e 74 65 72 73 70 65 72 73 65 20 0a 09 09 09 09  ntersperse .....
a180: 09 09 28 74 61 6b 65 20 64 70 61 72 74 73 20 28  ..(take dparts (
a190: 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73  - (length dparts
a1a0: 29 20 31 29 29 0a 09 09 09 09 09 09 22 2f 22 29  ) 1))......."/")
a1b0: 29 29 29 0a 09 09 20 20 20 20 20 20 20 28 64 65  )))...       (de
a1c0: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d  bug:print 1 "Rem
a1d0: 6f 76 69 6e 67 20 72 75 6e 3a 20 22 20 72 75 6e  oving run: " run
a1e0: 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d  key " " (db:get-
a1f0: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20  value-by-header 
a200: 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e  run header "runn
a210: 61 6d 65 22 29 20 22 20 61 6e 64 20 72 65 6c 61  ame") " and rela
a220: 74 65 64 20 72 65 63 6f 72 64 22 29 0a 09 09 20  ted record")... 
a230: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d        (open-run-
a240: 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 2d  close db:delete-
a250: 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 29 0a 09  run db run-id)..
a260: 09 20 20 20 20 20 20 20 3b 3b 20 54 68 69 73 20  .       ;; This 
a270: 69 73 20 61 20 70 72 65 74 74 79 20 67 6f 6f 64  is a pretty good
a280: 20 70 6c 61 63 65 20 74 6f 20 70 75 72 67 65 20   place to purge 
a290: 6f 6c 64 20 44 45 4c 45 54 45 44 20 74 65 73 74  old DELETED test
a2a0: 73 0a 09 09 20 20 20 20 20 20 20 28 6f 70 65 6e  s...       (open
a2b0: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65  -run-close db:de
a2c0: 6c 65 74 65 2d 74 65 73 74 73 2d 66 6f 72 2d 72  lete-tests-for-r
a2d0: 75 6e 20 64 62 20 72 75 6e 2d 69 64 29 0a 09 09  un db run-id)...
a2e0: 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e         (open-run
a2f0: 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65  -close db:delete
a300: 2d 6f 6c 64 2d 64 65 6c 65 74 65 64 2d 74 65 73  -old-deleted-tes
a310: 74 2d 72 65 63 6f 72 64 73 20 64 62 29 0a 09 09  t-records db)...
a320: 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e         (open-run
a330: 2d 63 6c 6f 73 65 20 64 62 3a 73 65 74 2d 76 61  -close db:set-va
a340: 72 20 64 62 20 22 44 45 4c 45 54 45 44 5f 54 45  r db "DELETED_TE
a350: 53 54 53 22 20 28 63 75 72 72 65 6e 74 2d 73 65  STS" (current-se
a360: 63 6f 6e 64 73 29 29 0a 09 09 20 20 20 20 20 20  conds))...      
a370: 20 3b 3b 20 6e 65 65 64 20 74 6f 20 66 69 67 75   ;; need to figu
a380: 72 65 20 6f 75 74 20 74 68 65 20 70 61 74 68 20  re out the path 
a390: 74 6f 20 74 68 65 20 72 75 6e 20 64 69 72 20 61  to the run dir a
a3a0: 6e 64 20 72 65 6d 6f 76 65 20 69 74 20 69 66 20  nd remove it if 
a3b0: 65 6d 70 74 79 0a 09 09 20 20 20 20 20 20 20 3b  empty...       ;
a3c0: 3b 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20  ;    (if (null? 
a3d0: 28 67 6c 6f 62 20 28 63 6f 6e 63 20 72 75 6e 70  (glob (conc runp
a3e0: 61 74 68 20 22 2f 2a 22 29 29 29 0a 09 09 20 20  ath "/*")))...  
a3f0: 20 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20 28       ;;        (
a400: 62 65 67 69 6e 0a 09 09 20 20 20 20 20 20 20 3b  begin...       ;
a410: 3b 20 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ; . (debug:print
a420: 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e   1 "Removing run
a430: 20 64 69 72 20 22 20 72 75 6e 70 61 74 68 29 0a   dir " runpath).
a440: 09 09 20 20 20 20 20 20 20 3b 3b 20 09 20 28 73  ..       ;; . (s
a450: 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 64  ystem (conc "rmd
a460: 69 72 20 2d 70 20 22 20 72 75 6e 70 61 74 68 29  ir -p " runpath)
a470: 29 29 29 0a 09 09 20 20 20 20 20 20 20 29 29 29  )))...       )))
a480: 29 29 0a 09 20 29 29 0a 20 20 20 20 20 72 75 6e  )).. )).     run
a490: 73 29 29 0a 20 20 23 74 29 0a 0a 3b 3b 3d 3d 3d  s)).  #t)..;;===
a4a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a4b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a4c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a4d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a4e0: 3d 3d 3d 0a 3b 3b 20 52 6f 75 74 69 6e 65 73 20  ===.;; Routines 
a4f0: 66 6f 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67  for manipulating
a500: 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d   runs.;;========
a510: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a520: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a530: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a540: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a  ==============..
a550: 3b 3b 20 53 69 6e 63 65 20 6d 61 6e 79 20 63 61  ;; Since many ca
a560: 6c 6c 73 20 74 6f 20 61 20 72 75 6e 20 72 65 71  lls to a run req
a570: 75 69 72 65 20 70 72 65 74 74 79 20 6d 75 63 68  uire pretty much
a580: 20 74 68 65 20 73 61 6d 65 20 73 65 74 75 70 20   the same setup 
a590: 0a 3b 3b 20 74 68 69 73 20 77 72 61 70 70 65 72  .;; this wrapper
a5a0: 20 69 73 20 75 73 65 64 20 74 6f 20 72 65 64 75   is used to redu
a5b0: 63 65 20 74 68 65 20 72 65 70 6c 69 63 61 74 69  ce the replicati
a5c0: 6f 6e 20 6f 66 20 63 6f 64 65 0a 28 64 65 66 69  on of code.(defi
a5d0: 6e 65 20 28 67 65 6e 65 72 61 6c 2d 72 75 6e 2d  ne (general-run-
a5e0: 63 61 6c 6c 20 73 77 69 74 63 68 6e 61 6d 65 20  call switchname 
a5f0: 61 63 74 69 6f 6e 2d 64 65 73 63 20 70 72 6f 63  action-desc proc
a600: 29 0a 20 20 28 6c 65 74 20 28 28 72 75 6e 6e 61  ).  (let ((runna
a610: 6d 65 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  me (args:get-arg
a620: 20 22 3a 72 75 6e 6e 61 6d 65 22 29 29 0a 09 28   ":runname"))..(
a630: 74 61 72 67 65 74 20 20 28 69 66 20 28 61 72 67  target  (if (arg
a640: 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67  s:get-arg "-targ
a650: 65 74 22 29 0a 09 09 20 20 20 20 20 28 61 72 67  et")...     (arg
a660: 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67  s:get-arg "-targ
a670: 65 74 22 29 0a 09 09 20 20 20 20 20 28 61 72 67  et")...     (arg
a680: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74  s:get-arg "-reqt
a690: 61 72 67 22 29 29 29 0a 09 28 74 68 31 20 20 20  arg")))..(th1   
a6a0: 20 20 23 66 29 29 0a 20 20 20 20 28 63 6f 6e 64    #f)).    (cond
a6b0: 0a 20 20 20 20 20 28 28 6e 6f 74 20 74 61 72 67  .     ((not targ
a6c0: 65 74 29 0a 20 20 20 20 20 20 28 64 65 62 75 67  et).      (debug
a6d0: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a  :print 0 "ERROR:
a6e0: 20 4d 69 73 73 69 6e 67 20 72 65 71 75 69 72 65   Missing require
a6f0: 64 20 70 61 72 61 6d 65 74 65 72 20 66 6f 72 20  d parameter for 
a700: 22 20 73 77 69 74 63 68 6e 61 6d 65 20 22 2c 20  " switchname ", 
a710: 79 6f 75 20 6d 75 73 74 20 73 70 65 63 69 66 79  you must specify
a720: 20 74 68 65 20 74 61 72 67 65 74 20 77 69 74 68   the target with
a730: 20 2d 74 61 72 67 65 74 22 29 0a 20 20 20 20 20   -target").     
a740: 20 28 65 78 69 74 20 33 29 29 0a 20 20 20 20 20   (exit 3)).     
a750: 28 28 6e 6f 74 20 72 75 6e 6e 61 6d 65 29 0a 20  ((not runname). 
a760: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
a770: 74 20 30 20 22 45 52 52 4f 52 3a 20 4d 69 73 73  t 0 "ERROR: Miss
a780: 69 6e 67 20 72 65 71 75 69 72 65 64 20 70 61 72  ing required par
a790: 61 6d 65 74 65 72 20 66 6f 72 20 22 20 73 77 69  ameter for " swi
a7a0: 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d  tchname ", you m
a7b0: 75 73 74 20 73 70 65 63 69 66 79 20 74 68 65 20  ust specify the 
a7c0: 72 75 6e 20 6e 61 6d 65 20 77 69 74 68 20 3a 72  run name with :r
a7d0: 75 6e 6e 61 6d 65 20 72 75 6e 6e 61 6d 65 22 29  unname runname")
a7e0: 0a 20 20 20 20 20 20 28 65 78 69 74 20 33 29 29  .      (exit 3))
a7f0: 0a 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20  .     (else.    
a800: 20 20 28 6c 65 74 20 28 28 64 62 20 20 20 23 66    (let ((db   #f
a810: 29 0a 09 20 20 20 20 28 6b 65 79 73 20 23 66 29  )..    (keys #f)
a820: 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 73 65 74  )..(if (not (set
a830: 75 70 2d 66 6f 72 2d 72 75 6e 29 29 0a 09 20 20  up-for-run))..  
a840: 20 20 28 62 65 67 69 6e 20 0a 09 20 20 20 20 20    (begin ..     
a850: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
a860: 22 46 61 69 6c 65 64 20 74 6f 20 73 65 74 75 70  "Failed to setup
a870: 2c 20 65 78 69 74 69 6e 67 22 29 0a 09 20 20 20  , exiting")..   
a880: 20 20 20 28 65 78 69 74 20 31 29 29 29 0a 09 28     (exit 1)))..(
a890: 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  if (args:get-arg
a8a0: 20 22 2d 73 65 72 76 65 72 22 29 0a 09 20 20 20   "-server")..   
a8b0: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
a8c0: 20 73 65 72 76 65 72 3a 73 74 61 72 74 20 64 62   server:start db
a8d0: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
a8e0: 2d 73 65 72 76 65 72 22 29 29 29 0a 20 09 20 20  -server"))). .  
a8f0: 20 20 3b 3b 20 28 69 66 20 28 6e 6f 74 20 28 6f    ;; (if (not (o
a900: 72 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20  r (args:get-arg 
a910: 22 2d 72 75 6e 61 6c 6c 22 29 20 20 20 20 20 3b  "-runall")     ;
a920: 3b 20 72 75 6e 61 6c 6c 20 61 6e 64 20 72 75 6e  ; runall and run
a930: 74 65 73 74 73 20 61 72 65 20 61 6c 6c 6f 77 65  tests are allowe
a940: 64 20 74 6f 20 62 65 20 73 65 72 76 65 72 73 0a  d to be servers.
a950: 20 09 20 20 20 20 3b 3b 20 20 20 20 20 09 20 28   .    ;;     . (
a960: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72  args:get-arg "-r
a970: 75 6e 74 65 73 74 73 22 29 29 29 0a 09 20 20 20  untests")))..   
a980: 20 3b 3b 20 20 20 20 20 28 63 6c 69 65 6e 74 3a   ;;     (client:
a990: 73 65 74 75 70 29 20 3b 3b 20 54 68 69 73 20 69  setup) ;; This i
a9a0: 73 20 61 20 64 75 70 6c 69 63 61 74 65 20 73 74  s a duplicate st
a9b0: 61 72 74 75 70 21 21 21 3f 3f 3f 20 42 55 47 3f  artup!!!??? BUG?
a9c0: 0a 09 20 20 20 20 3b 3b 20 20 20 20 20 29 29 0a  ..    ;;     )).
a9d0: 09 28 73 65 74 21 20 6b 65 79 73 20 28 6f 70 65  .(set! keys (ope
a9e0: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67  n-run-close db:g
a9f0: 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 3b 3b  et-keys db))..;;
aa00: 20 68 61 76 65 20 65 6e 6f 75 67 68 20 74 6f 20   have enough to 
aa10: 70 72 6f 63 65 73 73 20 2d 74 61 72 67 65 74 20  process -target 
aa20: 6f 72 20 2d 72 65 71 74 61 72 67 20 68 65 72 65  or -reqtarg here
aa30: 0a 09 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d  ..(if (args:get-
aa40: 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 0a  arg "-reqtarg").
aa50: 09 20 20 20 20 28 6c 65 74 2a 20 28 28 72 75 6e  .    (let* ((run
aa60: 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 20 2a  configf (conc  *
aa70: 74 6f 70 70 61 74 68 2a 20 22 2f 72 75 6e 63 6f  toppath* "/runco
aa80: 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22 29 29 20  nfigs.config")) 
aa90: 3b 3b 20 44 4f 20 4e 4f 54 20 45 56 41 4c 55 41  ;; DO NOT EVALUA
aaa0: 54 45 20 41 4c 4c 20 0a 09 09 20 20 20 28 72 75  TE ALL ...   (ru
aab0: 6e 63 6f 6e 66 69 67 20 20 28 72 65 61 64 2d 63  nconfig  (read-c
aac0: 6f 6e 66 69 67 20 72 75 6e 63 6f 6e 66 69 67 66  onfig runconfigf
aad0: 20 23 66 20 23 66 20 65 6e 76 69 72 6f 6e 2d 70   #f #f environ-p
aae0: 61 74 74 3a 20 23 66 29 29 29 20 0a 09 20 20 20  att: #f))) ..   
aaf0: 20 20 20 28 69 66 20 28 68 61 73 68 2d 74 61 62     (if (hash-tab
ab00: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 72  le-ref/default r
ab10: 75 6e 63 6f 6e 66 69 67 20 28 61 72 67 73 3a 67  unconfig (args:g
ab20: 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67  et-arg "-reqtarg
ab30: 22 29 20 23 66 29 0a 09 09 20 20 28 6b 65 79 73  ") #f)...  (keys
ab40: 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 72 67 73  :target-set-args
ab50: 20 6b 65 79 73 20 28 61 72 67 73 3a 67 65 74 2d   keys (args:get-
ab60: 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 20  arg "-reqtarg") 
ab70: 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 0a 09  args:arg-hash)..
ab80: 09 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20  .  (begin...    
ab90: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
aba0: 45 52 52 4f 52 3a 20 5b 22 20 28 61 72 67 73 3a  ERROR: [" (args:
abb0: 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72  get-arg "-reqtar
abc0: 67 22 29 20 22 5d 20 6e 6f 74 20 66 6f 75 6e 64  g") "] not found
abd0: 20 69 6e 20 22 20 72 75 6e 63 6f 6e 66 69 67 66   in " runconfigf
abe0: 29 0a 09 09 20 20 20 20 28 69 66 20 64 62 20 28  )...    (if db (
abf0: 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65  sqlite3:finalize
ac00: 21 20 64 62 29 29 0a 09 09 20 20 20 20 28 65 78  ! db))...    (ex
ac10: 69 74 20 31 29 29 29 29 0a 09 20 20 20 20 28 69  it 1))))..    (i
ac20: 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20  f (args:get-arg 
ac30: 22 2d 74 61 72 67 65 74 22 29 0a 09 09 28 6b 65  "-target")...(ke
ac40: 79 73 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 72  ys:target-set-ar
ac50: 67 73 20 6b 65 79 73 20 28 61 72 67 73 3a 67 65  gs keys (args:ge
ac60: 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 20  t-arg "-target" 
ac70: 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 20 61  args:arg-hash) a
ac80: 72 67 73 3a 61 72 67 2d 68 61 73 68 29 29 29 0a  rgs:arg-hash))).
ac90: 09 28 69 66 20 28 6e 6f 74 20 28 63 61 72 20 2a  .(if (not (car *
aca0: 63 6f 6e 66 69 67 69 6e 66 6f 2a 29 29 0a 09 20  configinfo*)).. 
acb0: 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20     (begin..     
acc0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
acd0: 22 45 52 52 4f 52 3a 20 41 74 74 65 6d 70 74 65  "ERROR: Attempte
ace0: 64 20 74 6f 20 22 20 61 63 74 69 6f 6e 2d 64 65  d to " action-de
acf0: 73 63 20 22 20 62 75 74 20 72 75 6e 20 61 72 65  sc " but run are
ad00: 61 20 63 6f 6e 66 69 67 20 66 69 6c 65 20 6e 6f  a config file no
ad10: 74 20 66 6f 75 6e 64 22 29 0a 09 20 20 20 20 20  t found")..     
ad20: 20 28 65 78 69 74 20 31 29 29 0a 09 20 20 20 20   (exit 1))..    
ad30: 3b 3b 20 45 78 74 72 61 63 74 20 6f 75 74 20 73  ;; Extract out s
ad40: 74 75 66 66 20 6e 65 65 64 65 64 20 69 6e 20 6d  tuff needed in m
ad50: 6f 73 74 20 6f 72 20 6d 61 6e 79 20 63 61 6c 6c  ost or many call
ad60: 73 0a 09 20 20 20 20 3b 3b 20 68 65 72 65 20 74  s..    ;; here t
ad70: 68 65 6e 20 63 61 6c 6c 20 70 72 6f 63 0a 09 20  hen call proc.. 
ad80: 20 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 6e 61     (let* ((keyna
ad90: 6d 65 73 20 20 20 28 6d 61 70 20 6b 65 79 3a 67  mes   (map key:g
ada0: 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79  et-fieldname key
adb0: 73 29 29 0a 09 09 20 20 20 28 6b 65 79 76 61 6c  s))...   (keyval
adc0: 6c 73 74 20 20 28 6b 65 79 73 2d 3e 76 61 6c 6c  lst  (keys->vall
add0: 69 73 74 20 6b 65 79 73 20 23 74 29 29 29 0a 09  ist keys #t)))..
ade0: 20 20 20 20 20 20 28 70 72 6f 63 20 74 61 72 67        (proc targ
adf0: 65 74 20 72 75 6e 6e 61 6d 65 20 6b 65 79 73 20  et runname keys 
ae00: 6b 65 79 6e 61 6d 65 73 20 6b 65 79 76 61 6c 6c  keynames keyvall
ae10: 73 74 29 29 29 0a 09 28 69 66 20 74 68 31 20 28  st)))..(if th1 (
ae20: 74 68 72 65 61 64 2d 6a 6f 69 6e 21 20 74 68 31  thread-join! th1
ae30: 29 29 0a 09 28 69 66 20 64 62 20 28 73 71 6c 69  ))..(if db (sqli
ae40: 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62  te3:finalize! db
ae50: 29 29 0a 09 28 73 65 74 21 20 2a 64 69 64 73 6f  ))..(set! *didso
ae60: 6d 65 74 68 69 6e 67 2a 20 23 74 29 29 29 29 29  mething* #t)))))
ae70: 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  )..;;===========
ae80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
ae90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
aea0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
aeb0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4c  ===========.;; L
aec0: 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 72 75 6e 73 0a  ock/unlock runs.
aed0: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;;==============
aee0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
aef0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
af00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
af10: 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e  ========..(defin
af20: 65 20 28 72 75 6e 73 3a 68 61 6e 64 6c 65 2d 6c  e (runs:handle-l
af30: 6f 63 6b 69 6e 67 20 74 61 72 67 65 74 20 6b 65  ocking target ke
af40: 79 73 20 72 75 6e 6e 61 6d 65 20 6c 6f 63 6b 20  ys runname lock 
af50: 75 6e 6c 6f 63 6b 20 75 73 65 72 29 0a 20 20 28  unlock user).  (
af60: 6c 65 74 2a 20 28 28 64 62 20 20 20 20 20 20 20  let* ((db       
af70: 23 66 29 0a 09 20 28 72 75 6e 64 61 74 20 20 20  #f).. (rundat   
af80: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
af90: 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79  runs:get-runs-by
afa0: 2d 70 61 74 74 20 64 62 20 6b 65 79 73 20 72 75  -patt db keys ru
afb0: 6e 6e 61 6d 65 29 29 0a 09 20 28 68 65 61 64 65  nname)).. (heade
afc0: 72 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20  r   (vector-ref 
afd0: 72 75 6e 64 61 74 20 30 29 29 0a 09 20 28 72 75  rundat 0)).. (ru
afe0: 6e 73 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72  ns     (vector-r
aff0: 65 66 20 72 75 6e 64 61 74 20 31 29 29 29 0a 20  ef rundat 1))). 
b000: 20 20 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61     (for-each (la
b010: 6d 62 64 61 20 28 72 75 6e 29 0a 09 09 28 6c 65  mbda (run)...(le
b020: 74 20 28 28 72 75 6e 2d 69 64 20 28 64 62 3a 67  t ((run-id (db:g
b030: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64  et-value-by-head
b040: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 69  er run header "i
b050: 64 22 29 29 29 0a 09 09 20 20 28 69 66 20 28 6f  d")))...  (if (o
b060: 72 20 6c 6f 63 6b 0a 09 09 09 20 20 28 61 6e 64  r lock....  (and
b070: 20 75 6e 6c 6f 63 6b 0a 09 09 09 20 20 20 20 20   unlock....     
b080: 20 20 28 62 65 67 69 6e 0a 09 09 09 09 20 28 70    (begin..... (p
b090: 72 69 6e 74 20 22 44 6f 20 79 6f 75 20 72 65 61  rint "Do you rea
b0a0: 6c 6c 79 20 77 69 73 68 20 74 6f 20 75 6e 6c 6f  lly wish to unlo
b0b0: 63 6b 20 72 75 6e 20 22 20 72 75 6e 2d 69 64 20  ck run " run-id 
b0c0: 22 3f 5c 6e 20 20 20 79 2f 6e 3a 20 22 29 0a 09  "?\n   y/n: ")..
b0d0: 09 09 09 20 28 65 71 75 61 6c 3f 20 22 79 22 20  ... (equal? "y" 
b0e0: 28 72 65 61 64 2d 6c 69 6e 65 29 29 29 29 29 0a  (read-line))))).
b0f0: 09 09 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75  ..      (open-ru
b100: 6e 2d 63 6c 6f 73 65 20 64 62 3a 6c 6f 63 6b 2f  n-close db:lock/
b110: 75 6e 6c 6f 63 6b 2d 72 75 6e 20 64 62 20 72 75  unlock-run db ru
b120: 6e 2d 69 64 20 6c 6f 63 6b 20 75 6e 6c 6f 63 6b  n-id lock unlock
b130: 20 75 73 65 72 29 0a 09 09 20 20 20 20 20 20 28   user)...      (
b140: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
b150: 20 30 20 22 53 6b 69 70 70 69 6e 67 20 6c 6f 63   0 "Skipping loc
b160: 6b 2f 75 6e 6c 6f 63 6b 20 6f 6e 20 22 20 72 75  k/unlock on " ru
b170: 6e 2d 69 64 29 29 29 29 0a 09 20 20 20 20 20 20  n-id))))..      
b180: 72 75 6e 73 29 29 29 0a 3b 3b 3d 3d 3d 3d 3d 3d  runs))).;;======
b190: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b1a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b1b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b1c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b1d0: 0a 3b 3b 20 52 6f 6c 6c 75 70 20 72 75 6e 73 0a  .;; Rollup runs.
b1e0: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;;==============
b1f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b200: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b210: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b220: 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 55 70 64  ========..;; Upd
b230: 61 74 65 20 74 68 65 20 74 65 73 74 5f 6d 65 74  ate the test_met
b240: 61 20 74 61 62 6c 65 20 66 6f 72 20 74 68 69 73  a table for this
b250: 20 74 65 73 74 0a 28 64 65 66 69 6e 65 20 28 72   test.(define (r
b260: 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f  uns:update-test_
b270: 6d 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d  meta db test-nam
b280: 65 20 74 65 73 74 2d 63 6f 6e 66 29 0a 20 20 28  e test-conf).  (
b290: 6c 65 74 20 28 28 63 75 72 72 72 65 63 6f 72 64  let ((currrecord
b2a0: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
b2b0: 20 64 62 3a 74 65 73 74 6d 65 74 61 2d 67 65 74   db:testmeta-get
b2c0: 2d 72 65 63 6f 72 64 20 64 62 20 74 65 73 74 2d  -record db test-
b2d0: 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 69 66 20  name))).    (if 
b2e0: 28 6e 6f 74 20 63 75 72 72 72 65 63 6f 72 64 29  (not currrecord)
b2f0: 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 73 65 74  ..(begin..  (set
b300: 21 20 63 75 72 72 72 65 63 6f 72 64 20 28 6d 61  ! currrecord (ma
b310: 6b 65 2d 76 65 63 74 6f 72 20 31 30 20 23 66 29  ke-vector 10 #f)
b320: 29 0a 09 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63  )..  (open-run-c
b330: 6c 6f 73 65 20 64 62 3a 74 65 73 74 6d 65 74 61  lose db:testmeta
b340: 2d 61 64 64 2d 72 65 63 6f 72 64 20 64 62 20 74  -add-record db t
b350: 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20  est-name))).    
b360: 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20  (for-each .     
b370: 28 6c 61 6d 62 64 61 20 28 6b 65 79 29 0a 20 20  (lambda (key).  
b380: 20 20 20 20 20 28 6c 65 74 2a 20 28 28 69 64 78       (let* ((idx
b390: 20 28 63 61 64 72 20 6b 65 79 29 29 0a 09 20 20   (cadr key))..  
b3a0: 20 20 20 20 28 66 6c 64 20 28 63 61 72 20 20 6b      (fld (car  k
b3b0: 65 79 29 29 0a 09 20 20 20 20 20 20 28 76 61 6c  ey))..      (val
b3c0: 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20   (config-lookup 
b3d0: 74 65 73 74 2d 63 6f 6e 66 20 22 74 65 73 74 5f  test-conf "test_
b3e0: 6d 65 74 61 22 20 66 6c 64 29 29 29 0a 09 20 3b  meta" fld))).. ;
b3f0: 3b 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 35  ; (debug:print 5
b400: 20 22 69 64 78 3a 20 22 20 69 64 78 20 22 20 66   "idx: " idx " f
b410: 6c 64 3a 20 22 20 66 6c 64 20 22 20 76 61 6c 3a  ld: " fld " val:
b420: 20 22 20 76 61 6c 29 0a 09 20 28 69 66 20 28 61   " val).. (if (a
b430: 6e 64 20 76 61 6c 20 28 6e 6f 74 20 28 65 71 75  nd val (not (equ
b440: 61 6c 3f 20 28 76 65 63 74 6f 72 2d 72 65 66 20  al? (vector-ref 
b450: 63 75 72 72 72 65 63 6f 72 64 20 69 64 78 29 20  currrecord idx) 
b460: 76 61 6c 29 29 29 0a 09 20 20 20 20 20 28 62 65  val)))..     (be
b470: 67 69 6e 0a 09 20 20 20 20 20 20 20 28 70 72 69  gin..       (pri
b480: 6e 74 20 22 55 70 64 61 74 69 6e 67 20 22 20 74  nt "Updating " t
b490: 65 73 74 2d 6e 61 6d 65 20 22 20 22 20 66 6c 64  est-name " " fld
b4a0: 20 22 20 74 6f 20 22 20 76 61 6c 29 0a 09 20 20   " to " val)..  
b4b0: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
b4c0: 6c 6f 73 65 20 64 62 3a 74 65 73 74 6d 65 74 61  lose db:testmeta
b4d0: 2d 75 70 64 61 74 65 2d 66 69 65 6c 64 20 64 62  -update-field db
b4e0: 20 74 65 73 74 2d 6e 61 6d 65 20 66 6c 64 20 76   test-name fld v
b4f0: 61 6c 29 29 29 29 29 0a 20 20 20 20 20 27 28 28  al))))).     '((
b500: 22 61 75 74 68 6f 72 22 20 32 29 28 22 6f 77 6e  "author" 2)("own
b510: 65 72 22 20 33 29 28 22 64 65 73 63 72 69 70 74  er" 3)("descript
b520: 69 6f 6e 22 20 34 29 28 22 72 65 76 69 65 77 65  ion" 4)("reviewe
b530: 64 22 20 35 29 28 22 74 61 67 73 22 20 39 29 29  d" 5)("tags" 9))
b540: 29 29 29 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74  )))..;; Update t
b550: 65 73 74 5f 6d 65 74 61 20 66 6f 72 20 61 6c 6c  est_meta for all
b560: 20 74 65 73 74 73 0a 28 64 65 66 69 6e 65 20 28   tests.(define (
b570: 72 75 6e 73 3a 75 70 64 61 74 65 2d 61 6c 6c 2d  runs:update-all-
b580: 74 65 73 74 5f 6d 65 74 61 20 64 62 29 0a 20 20  test_meta db).  
b590: 28 6c 65 74 20 28 28 74 65 73 74 2d 6e 61 6d 65  (let ((test-name
b5a0: 73 20 28 67 65 74 2d 61 6c 6c 2d 6c 65 67 61 6c  s (get-all-legal
b5b0: 2d 74 65 73 74 73 29 29 29 0a 20 20 20 20 28 66  -tests))).    (f
b5c0: 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c  or-each .     (l
b5d0: 61 6d 62 64 61 20 28 74 65 73 74 2d 6e 61 6d 65  ambda (test-name
b5e0: 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28  ).       (let* (
b5f0: 28 74 65 73 74 2d 70 61 74 68 20 20 20 20 28 63  (test-path    (c
b600: 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f  onc *toppath* "/
b610: 74 65 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d  tests/" test-nam
b620: 65 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 74  e))..      (test
b630: 2d 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 74  -configf (conc t
b640: 65 73 74 2d 70 61 74 68 20 22 2f 74 65 73 74 63  est-path "/testc
b650: 6f 6e 66 69 67 22 29 29 0a 09 20 20 20 20 20 20  onfig"))..      
b660: 28 74 65 73 74 65 78 69 73 74 73 20 20 20 28 61  (testexists   (a
b670: 6e 64 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f  nd (file-exists?
b680: 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 28 66   test-configf)(f
b690: 69 6c 65 2d 72 65 61 64 2d 61 63 63 65 73 73 3f  ile-read-access?
b6a0: 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 29 29   test-configf)))
b6b0: 0a 09 20 20 20 20 20 20 3b 3b 20 72 65 61 64 20  ..      ;; read 
b6c0: 63 6f 6e 66 69 67 73 20 77 69 74 68 20 74 72 69  configs with tri
b6d0: 63 6b 73 20 74 75 72 6e 65 64 20 6f 66 66 20 28  cks turned off (
b6e0: 69 2e 65 2e 20 6e 6f 20 73 79 73 74 65 6d 29 0a  i.e. no system).
b6f0: 09 20 20 20 20 20 20 28 74 65 73 74 2d 63 6f 6e  .      (test-con
b700: 66 20 20 20 20 28 69 66 20 74 65 73 74 65 78 69  f    (if testexi
b710: 73 74 73 20 28 72 65 61 64 2d 63 6f 6e 66 69 67  sts (read-config
b720: 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 23 66   test-configf #f
b730: 20 23 66 29 28 6d 61 6b 65 2d 68 61 73 68 2d 74   #f)(make-hash-t
b740: 61 62 6c 65 29 29 29 29 0a 09 20 3b 3b 20 75 73  able)))).. ;; us
b750: 65 20 74 68 65 20 6f 70 65 6e 2d 72 75 6e 2d 63  e the open-run-c
b760: 6c 6f 73 65 20 69 6e 73 74 65 61 64 20 6f 66 20  lose instead of 
b770: 70 61 73 73 69 6e 67 20 69 6e 20 64 62 0a 09 20  passing in db.. 
b780: 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73  (runs:update-tes
b790: 74 5f 6d 65 74 61 20 23 66 20 74 65 73 74 2d 6e  t_meta #f test-n
b7a0: 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 29 29  ame test-conf)))
b7b0: 0a 20 20 20 20 20 74 65 73 74 2d 6e 61 6d 65 73  .     test-names
b7c0: 29 29 29 0a 0a 3b 3b 20 54 68 69 73 20 63 6f 75  )))..;; This cou
b7d0: 6c 64 20 70 72 6f 62 61 62 6c 79 20 62 65 20 72  ld probably be r
b7e0: 65 66 61 63 74 6f 72 65 64 20 69 6e 74 6f 20 6f  efactored into o
b7f0: 6e 65 20 63 6f 6d 70 6c 65 78 20 71 75 65 72 79  ne complex query
b800: 20 2e 2e 2e 0a 28 64 65 66 69 6e 65 20 28 72 75   ....(define (ru
b810: 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 20 6b 65  ns:rollup-run ke
b820: 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e  ys keyvallst run
b830: 6e 61 6d 65 20 75 73 65 72 29 20 3b 3b 20 77 61  name user) ;; wa
b840: 73 20 74 61 72 67 65 74 2c 20 6e 6f 77 20 6b 65  s target, now ke
b850: 79 76 61 6c 6c 73 74 0a 20 20 28 64 65 62 75 67  yvallst.  (debug
b860: 3a 70 72 69 6e 74 20 34 20 22 72 75 6e 73 3a 72  :print 4 "runs:r
b870: 6f 6c 6c 75 70 2d 72 75 6e 2c 20 6b 65 79 73 3a  ollup-run, keys:
b880: 20 22 20 6b 65 79 73 20 22 20 6b 65 79 76 61 6c   " keys " keyval
b890: 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74  lst: " keyvallst
b8a0: 20 22 20 3a 72 75 6e 6e 61 6d 65 20 22 20 72 75   " :runname " ru
b8b0: 6e 6e 61 6d 65 20 22 20 75 73 65 72 3a 20 22 20  nname " user: " 
b8c0: 75 73 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 28  user).  (let* ((
b8d0: 64 62 20 20 20 20 20 20 20 20 20 20 20 20 20 20  db              
b8e0: 23 66 29 20 3b 3b 20 28 6b 65 79 76 61 6c 6c 6c  #f) ;; (keyvalll
b8f0: 73 74 20 20 20 20 20 20 28 6b 65 79 73 3a 74 61  st      (keys:ta
b900: 72 67 65 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 79  rget->keyval key
b910: 73 20 74 61 72 67 65 74 29 29 0a 09 20 28 6e 65  s target)).. (ne
b920: 77 2d 72 75 6e 2d 69 64 20 20 20 20 20 20 28 6f  w-run-id      (o
b930: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75  pen-run-close ru
b940: 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75 6e 20  ns:register-run 
b950: 64 62 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73  db keys keyvalls
b960: 74 20 72 75 6e 6e 61 6d 65 20 22 6e 65 77 22 20  t runname "new" 
b970: 22 6e 2f 61 22 20 75 73 65 72 29 29 0a 09 20 28  "n/a" user)).. (
b980: 70 72 65 76 2d 74 65 73 74 73 20 20 20 20 20 20  prev-tests      
b990: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
b9a0: 74 65 73 74 3a 67 65 74 2d 6d 61 74 63 68 69 6e  test:get-matchin
b9b0: 67 2d 70 72 65 76 69 6f 75 73 2d 74 65 73 74 2d  g-previous-test-
b9c0: 72 75 6e 2d 72 65 63 6f 72 64 73 20 64 62 20 6e  run-records db n
b9d0: 65 77 2d 72 75 6e 2d 69 64 20 22 25 22 20 22 25  ew-run-id "%" "%
b9e0: 22 29 29 0a 09 20 28 63 75 72 72 2d 74 65 73 74  ")).. (curr-test
b9f0: 73 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e  s      (open-run
ba00: 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65  -close db:get-te
ba10: 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e  sts-for-run db n
ba20: 65 77 2d 72 75 6e 2d 69 64 20 22 25 2f 25 22 20  ew-run-id "%/%" 
ba30: 27 28 29 20 27 28 29 29 29 0a 09 20 28 63 75 72  '() '())).. (cur
ba40: 72 2d 74 65 73 74 73 2d 68 61 73 68 20 28 6d 61  r-tests-hash (ma
ba50: 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29  ke-hash-table)))
ba60: 0a 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63  .    (open-run-c
ba70: 6c 6f 73 65 20 64 62 3a 75 70 64 61 74 65 2d 72  lose db:update-r
ba80: 75 6e 2d 65 76 65 6e 74 5f 74 69 6d 65 20 64 62  un-event_time db
ba90: 20 6e 65 77 2d 72 75 6e 2d 69 64 29 0a 20 20 20   new-run-id).   
baa0: 20 3b 3b 20 69 6e 64 65 78 20 74 68 65 20 61 6c   ;; index the al
bab0: 72 65 61 64 79 20 73 61 76 65 64 20 74 65 73 74  ready saved test
bac0: 73 20 62 79 20 74 65 73 74 6e 61 6d 65 20 61 6e  s by testname an
bad0: 64 20 69 74 65 6d 64 61 74 20 69 6e 20 63 75 72  d itemdat in cur
bae0: 72 2d 74 65 73 74 73 2d 68 61 73 68 0a 20 20 20  r-tests-hash.   
baf0: 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20   (for-each.     
bb00: 28 6c 61 6d 62 64 61 20 28 74 65 73 74 64 61 74  (lambda (testdat
bb10: 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28  ).       (let* (
bb20: 28 74 65 73 74 6e 61 6d 65 20 20 28 64 62 3a 74  (testname  (db:t
bb30: 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65  est-get-testname
bb40: 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20   testdat))..    
bb50: 20 20 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62    (item-path (db
bb60: 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70  :test-get-item-p
bb70: 61 74 68 20 74 65 73 74 64 61 74 29 29 0a 09 20  ath testdat)).. 
bb80: 20 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20       (full-name 
bb90: 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22  (conc testname "
bba0: 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a  /" item-path))).
bbb0: 09 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65  . (hash-table-se
bbc0: 74 21 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61  t! curr-tests-ha
bbd0: 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 74 65 73  sh full-name tes
bbe0: 74 64 61 74 29 29 29 0a 20 20 20 20 20 63 75 72  tdat))).     cur
bbf0: 72 2d 74 65 73 74 73 29 0a 20 20 20 20 3b 3b 20  r-tests).    ;; 
bc00: 4e 4f 50 45 3a 20 4e 6f 6e 2d 6f 70 74 69 6d 61  NOPE: Non-optima
bc10: 6c 20 61 70 70 72 6f 61 63 68 2e 20 54 72 79 20  l approach. Try 
bc20: 74 68 69 73 20 69 6e 73 74 65 61 64 2e 0a 20 20  this instead..  
bc30: 20 20 3b 3b 20 20 20 31 2e 20 74 65 73 74 73 20    ;;   1. tests 
bc40: 61 72 65 20 72 65 63 65 69 76 65 64 20 69 6e 20  are received in 
bc50: 61 20 6c 69 73 74 2c 20 6d 6f 73 74 20 72 65 63  a list, most rec
bc60: 65 6e 74 20 66 69 72 73 74 0a 20 20 20 20 3b 3b  ent first.    ;;
bc70: 20 20 20 32 2e 20 72 65 70 6c 61 63 65 20 74 68     2. replace th
bc80: 65 20 72 6f 6c 6c 75 70 20 74 65 73 74 20 77 69  e rollup test wi
bc90: 74 68 20 74 68 65 20 6e 65 77 20 2a 61 6c 77 61  th the new *alwa
bca0: 79 73 2a 0a 20 20 20 20 28 66 6f 72 2d 65 61 63  ys*.    (for-eac
bcb0: 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20  h .     (lambda 
bcc0: 28 74 65 73 74 64 61 74 29 0a 20 20 20 20 20 20  (testdat).      
bcd0: 20 28 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 6d   (let* ((testnam
bce0: 65 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  e  (db:test-get-
bcf0: 74 65 73 74 6e 61 6d 65 20 74 65 73 74 64 61 74  testname testdat
bd00: 29 29 0a 09 20 20 20 20 20 20 28 69 74 65 6d 2d  ))..      (item-
bd10: 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65  path (db:test-ge
bd20: 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74  t-item-path test
bd30: 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 66 75  dat))..      (fu
bd40: 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65  ll-name (conc te
bd50: 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d  stname "/" item-
bd60: 70 61 74 68 29 29 0a 09 20 20 20 20 20 20 28 70  path))..      (p
bd70: 72 65 76 2d 74 65 73 74 2d 64 61 74 20 28 68 61  rev-test-dat (ha
bd80: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66  sh-table-ref/def
bd90: 61 75 6c 74 20 63 75 72 72 2d 74 65 73 74 73 2d  ault curr-tests-
bda0: 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 23  hash full-name #
bdb0: 66 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 74  f))..      (test
bdc0: 2d 73 74 65 70 73 20 20 20 20 20 20 28 6f 70 65  -steps      (ope
bdd0: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67  n-run-close db:g
bde0: 65 74 2d 73 74 65 70 73 2d 66 6f 72 2d 74 65 73  et-steps-for-tes
bdf0: 74 20 64 62 20 28 64 62 3a 74 65 73 74 2d 67 65  t db (db:test-ge
be00: 74 2d 69 64 20 74 65 73 74 64 61 74 29 29 29 0a  t-id testdat))).
be10: 09 20 20 20 20 20 20 28 6e 65 77 2d 74 65 73 74  .      (new-test
be20: 2d 72 65 63 6f 72 64 20 23 66 29 29 0a 09 20 3b  -record #f)).. ;
be30: 3b 20 72 65 70 6c 61 63 65 20 74 68 65 73 65 20  ; replace these 
be40: 77 69 74 68 20 69 6e 73 65 72 74 20 2e 2e 2e 20  with insert ... 
be50: 73 65 6c 65 63 74 0a 09 20 28 61 70 70 6c 79 20  select.. (apply 
be60: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20  sqlite3:execute 
be70: 0a 09 09 64 62 20 0a 09 09 28 63 6f 6e 63 20 22  ...db ...(conc "
be80: 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43  INSERT OR REPLAC
be90: 45 20 49 4e 54 4f 20 74 65 73 74 73 20 28 72 75  E INTO tests (ru
bea0: 6e 5f 69 64 2c 74 65 73 74 6e 61 6d 65 2c 73 74  n_id,testname,st
beb0: 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74  ate,status,event
bec0: 5f 74 69 6d 65 2c 68 6f 73 74 2c 63 70 75 6c 6f  _time,host,cpulo
bed0: 61 64 2c 64 69 73 6b 66 72 65 65 2c 75 6e 61 6d  ad,diskfree,unam
bee0: 65 2c 72 75 6e 64 69 72 2c 69 74 65 6d 5f 70 61  e,rundir,item_pa
bef0: 74 68 2c 72 75 6e 5f 64 75 72 61 74 69 6f 6e 2c  th,run_duration,
bf00: 66 69 6e 61 6c 5f 6c 6f 67 66 2c 63 6f 6d 6d 65  final_logf,comme
bf10: 6e 74 29 20 22 0a 09 09 20 20 20 20 20 20 22 56  nt) "...      "V
bf20: 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c 3f  ALUES (?,?,?,?,?
bf30: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f  ,?,?,?,?,?,?,?,?
bf40: 2c 3f 29 3b 22 29 0a 09 09 6e 65 77 2d 72 75 6e  ,?);")...new-run
bf50: 2d 69 64 20 28 63 64 64 72 20 28 76 65 63 74 6f  -id (cddr (vecto
bf60: 72 2d 3e 6c 69 73 74 20 74 65 73 74 64 61 74 29  r->list testdat)
bf70: 29 29 0a 09 20 28 73 65 74 21 20 6e 65 77 2d 74  )).. (set! new-t
bf80: 65 73 74 64 61 74 20 28 63 61 72 20 28 6f 70 65  estdat (car (ope
bf90: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67  n-run-close db:g
bfa0: 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e  et-tests-for-run
bfb0: 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 28   db new-run-id (
bfc0: 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f  conc testname "/
bfd0: 22 20 69 74 65 6d 2d 70 61 74 68 29 20 27 28 29  " item-path) '()
bfe0: 20 27 28 29 29 29 29 0a 09 20 28 68 61 73 68 2d   '()))).. (hash-
bff0: 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72 72 2d  table-set! curr-
c000: 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d  tests-hash full-
c010: 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74 64 61 74  name new-testdat
c020: 29 20 3b 3b 20 74 68 69 73 20 63 6f 75 6c 64 20  ) ;; this could 
c030: 62 65 20 63 6f 6e 66 75 73 69 6e 67 2c 20 77 68  be confusing, wh
c040: 69 63 68 20 72 65 63 6f 72 64 20 73 68 6f 75 6c  ich record shoul
c050: 64 20 67 6f 20 69 6e 74 6f 20 74 68 65 20 6c 6f  d go into the lo
c060: 6f 6b 75 70 20 74 61 62 6c 65 3f 0a 09 20 3b 3b  okup table?.. ;;
c070: 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74   Now duplicate t
c080: 68 65 20 74 65 73 74 20 73 74 65 70 73 0a 09 20  he test steps.. 
c090: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22  (debug:print 4 "
c0a0: 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 73 20  Copying records 
c0b0: 69 6e 20 74 65 73 74 5f 73 74 65 70 73 20 66 72  in test_steps fr
c0c0: 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62  om test_id=" (db
c0d0: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73  :test-get-id tes
c0e0: 74 64 61 74 29 20 22 20 74 6f 20 22 20 28 64 62  tdat) " to " (db
c0f0: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77  :test-get-id new
c100: 2d 74 65 73 74 64 61 74 29 29 0a 09 20 28 6f 70  -testdat)).. (op
c110: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 0a 09 20  en-run-close .. 
c120: 20 28 6c 61 6d 62 64 61 20 28 29 0a 09 20 20 20   (lambda ()..   
c130: 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74   (sqlite3:execut
c140: 65 20 0a 09 20 20 20 20 20 64 62 20 0a 09 20 20  e ..     db ..  
c150: 20 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54     (conc "INSERT
c160: 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f   OR REPLACE INTO
c170: 20 74 65 73 74 5f 73 74 65 70 73 20 28 74 65 73   test_steps (tes
c180: 74 5f 69 64 2c 73 74 65 70 6e 61 6d 65 2c 73 74  t_id,stepname,st
c190: 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74  ate,status,event
c1a0: 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 29 20 22  _time,comment) "
c1b0: 0a 09 09 20 20 20 22 53 45 4c 45 43 54 20 22 20  ...   "SELECT " 
c1c0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20  (db:test-get-id 
c1d0: 6e 65 77 2d 74 65 73 74 64 61 74 29 20 22 2c 73  new-testdat) ",s
c1e0: 74 65 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74  tepname,state,st
c1f0: 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c  atus,event_time,
c200: 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73  comment FROM tes
c210: 74 5f 73 74 65 70 73 20 57 48 45 52 45 20 74 65  t_steps WHERE te
c220: 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 20 20  st_id=?;")..    
c230: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64   (db:test-get-id
c240: 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20   testdat))..    
c250: 3b 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65  ;; Now duplicate
c260: 20 74 68 65 20 74 65 73 74 20 64 61 74 61 0a 09   the test data..
c270: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
c280: 20 34 20 22 43 6f 70 79 69 6e 67 20 72 65 63 6f   4 "Copying reco
c290: 72 64 73 20 69 6e 20 74 65 73 74 5f 64 61 74 61  rds in test_data
c2a0: 20 66 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20   from test_id=" 
c2b0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20  (db:test-get-id 
c2c0: 74 65 73 74 64 61 74 29 20 22 20 74 6f 20 22 20  testdat) " to " 
c2d0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20  (db:test-get-id 
c2e0: 6e 65 77 2d 74 65 73 74 64 61 74 29 29 0a 09 20  new-testdat)).. 
c2f0: 20 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63     (sqlite3:exec
c300: 75 74 65 20 0a 09 20 20 20 20 20 64 62 20 0a 09  ute ..     db ..
c310: 20 20 20 20 20 28 63 6f 6e 63 20 22 49 4e 53 45       (conc "INSE
c320: 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e  RT OR REPLACE IN
c330: 54 4f 20 74 65 73 74 5f 64 61 74 61 20 28 74 65  TO test_data (te
c340: 73 74 5f 69 64 2c 63 61 74 65 67 6f 72 79 2c 76  st_id,category,v
c350: 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78  ariable,value,ex
c360: 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73  pected,tol,units
c370: 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20  ,comment) "...  
c380: 20 22 53 45 4c 45 43 54 20 22 20 28 64 62 3a 74   "SELECT " (db:t
c390: 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74  est-get-id new-t
c3a0: 65 73 74 64 61 74 29 20 22 2c 63 61 74 65 67 6f  estdat) ",catego
c3b0: 72 79 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75  ry,variable,valu
c3c0: 65 2c 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75  e,expected,tol,u
c3d0: 6e 69 74 73 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f  nits,comment FRO
c3e0: 4d 20 74 65 73 74 5f 64 61 74 61 20 57 48 45 52  M test_data WHER
c3f0: 45 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09  E test_id=?;")..
c400: 20 20 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65       (db:test-ge
c410: 74 2d 69 64 20 74 65 73 74 64 61 74 29 29 29 29  t-id testdat))))
c420: 0a 09 20 29 29 0a 20 20 20 20 20 70 72 65 76 2d  .. )).     prev-
c430: 74 65 73 74 73 29 29 29 0a 09 20 0a 20 20 20 20  tests))).. .    
c440: 20 0a                                             .