Megatest

Hex Artifact Content
Login

Artifact 4810b06fd31a21ed67e6044224d18feedcd53617:


0000: 0a 3b 3b 20 43 6f 70 79 72 69 67 68 74 20 32 30  .;; Copyright 20
0010: 30 36 2d 32 30 31 32 2c 20 4d 61 74 74 68 65 77  06-2012, Matthew
0020: 20 57 65 6c 6c 61 6e 64 2e 0a 3b 3b 20 0a 3b 3b   Welland..;; .;;
0030: 20 20 54 68 69 73 20 70 72 6f 67 72 61 6d 20 69    This program i
0040: 73 20 6d 61 64 65 20 61 76 61 69 6c 61 62 6c 65  s made available
0050: 20 75 6e 64 65 72 20 74 68 65 20 47 4e 55 20 47   under the GNU G
0060: 50 4c 20 76 65 72 73 69 6f 6e 20 32 2e 30 20 6f  PL version 2.0 o
0070: 72 0a 3b 3b 20 20 67 72 65 61 74 65 72 2e 20 53  r.;;  greater. S
0080: 65 65 20 74 68 65 20 61 63 63 6f 6d 70 61 6e 79  ee the accompany
0090: 69 6e 67 20 66 69 6c 65 20 43 4f 50 59 49 4e 47  ing file COPYING
00a0: 20 66 6f 72 20 64 65 74 61 69 6c 73 2e 0a 3b 3b   for details..;;
00b0: 20 0a 3b 3b 20 20 54 68 69 73 20 70 72 6f 67 72   .;;  This progr
00c0: 61 6d 20 69 73 20 64 69 73 74 72 69 62 75 74 65  am is distribute
00d0: 64 20 57 49 54 48 4f 55 54 20 41 4e 59 20 57 41  d WITHOUT ANY WA
00e0: 52 52 41 4e 54 59 3b 20 77 69 74 68 6f 75 74 20  RRANTY; without 
00f0: 65 76 65 6e 20 74 68 65 0a 3b 3b 20 20 69 6d 70  even the.;;  imp
0100: 6c 69 65 64 20 77 61 72 72 61 6e 74 79 20 6f 66  lied warranty of
0110: 20 4d 45 52 43 48 41 4e 54 41 42 49 4c 49 54 59   MERCHANTABILITY
0120: 20 6f 72 20 46 49 54 4e 45 53 53 20 46 4f 52 20   or FITNESS FOR 
0130: 41 20 50 41 52 54 49 43 55 4c 41 52 0a 3b 3b 20  A PARTICULAR.;; 
0140: 20 50 55 52 50 4f 53 45 2e 0a 0a 3b 3b 20 20 73   PURPOSE...;;  s
0150: 74 72 66 74 69 6d 65 28 27 25 6d 2f 25 64 2f 25  trftime('%m/%d/%
0160: 59 20 25 48 3a 25 4d 3a 25 53 27 2c 27 6e 6f 77  Y %H:%M:%S','now
0170: 27 2c 27 6c 6f 63 61 6c 74 69 6d 65 27 29 0a 0a  ','localtime')..
0180: 28 75 73 65 20 73 71 6c 69 74 65 33 20 73 72 66  (use sqlite3 srf
0190: 69 2d 31 20 70 6f 73 69 78 20 72 65 67 65 78 20  i-1 posix regex 
01a0: 72 65 67 65 78 2d 63 61 73 65 20 73 72 66 69 2d  regex-case srfi-
01b0: 36 39 20 64 6f 74 2d 6c 6f 63 6b 69 6e 67 20 28  69 dot-locking (
01c0: 73 72 66 69 20 31 38 29 20 70 6f 73 69 78 2d 65  srfi 18) posix-e
01d0: 78 74 72 61 73 20 64 69 72 65 63 74 6f 72 79 2d  xtras directory-
01e0: 75 74 69 6c 73 29 0a 28 69 6d 70 6f 72 74 20 28  utils).(import (
01f0: 70 72 65 66 69 78 20 73 71 6c 69 74 65 33 20 73  prefix sqlite3 s
0200: 71 6c 69 74 65 33 3a 29 29 0a 0a 28 64 65 63 6c  qlite3:))..(decl
0210: 61 72 65 20 28 75 6e 69 74 20 72 75 6e 73 29 29  are (unit runs))
0220: 0a 28 64 65 63 6c 61 72 65 20 28 75 73 65 73 20  .(declare (uses 
0230: 64 62 29 29 0a 28 64 65 63 6c 61 72 65 20 28 75  db)).(declare (u
0240: 73 65 73 20 63 6f 6d 6d 6f 6e 29 29 0a 28 64 65  ses common)).(de
0250: 63 6c 61 72 65 20 28 75 73 65 73 20 69 74 65 6d  clare (uses item
0260: 73 29 29 0a 28 64 65 63 6c 61 72 65 20 28 75 73  s)).(declare (us
0270: 65 73 20 72 75 6e 63 6f 6e 66 69 67 29 29 0a 28  es runconfig)).(
0280: 64 65 63 6c 61 72 65 20 28 75 73 65 73 20 74 65  declare (uses te
0290: 73 74 73 29 29 0a 28 64 65 63 6c 61 72 65 20 28  sts)).(declare (
02a0: 75 73 65 73 20 73 65 72 76 65 72 29 29 0a 0a 28  uses server))..(
02b0: 69 6e 63 6c 75 64 65 20 22 63 6f 6d 6d 6f 6e 5f  include "common_
02c0: 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 0a 28 69  records.scm").(i
02d0: 6e 63 6c 75 64 65 20 22 6b 65 79 5f 72 65 63 6f  nclude "key_reco
02e0: 72 64 73 2e 73 63 6d 22 29 0a 28 69 6e 63 6c 75  rds.scm").(inclu
02f0: 64 65 20 22 64 62 5f 72 65 63 6f 72 64 73 2e 73  de "db_records.s
0300: 63 6d 22 29 0a 28 69 6e 63 6c 75 64 65 20 22 72  cm").(include "r
0310: 75 6e 5f 72 65 63 6f 72 64 73 2e 73 63 6d 22 29  un_records.scm")
0320: 0a 28 69 6e 63 6c 75 64 65 20 22 74 65 73 74 5f  .(include "test_
0330: 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 0a 0a 3b  records.scm")..;
0340: 3b 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d  ; runs:get-runs-
0350: 62 79 2d 70 61 74 74 0a 3b 3b 20 67 65 74 20 72  by-patt.;; get r
0360: 75 6e 73 20 62 79 20 6c 69 73 74 20 6f 66 20 63  uns by list of c
0370: 72 69 74 65 72 69 61 0a 3b 3b 20 72 65 67 69 73  riteria.;; regis
0380: 74 65 72 20 61 20 74 65 73 74 20 72 75 6e 20 77  ter a test run w
0390: 69 74 68 20 74 68 65 20 64 62 0a 3b 3b 0a 3b 3b  ith the db.;;.;;
03a0: 20 55 73 65 3a 20 28 64 62 2d 67 65 74 2d 76 61   Use: (db-get-va
03b0: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 28 64  lue-by-header (d
03c0: 62 3a 67 65 74 2d 68 65 61 64 65 72 20 72 75 6e  b:get-header run
03d0: 69 6e 66 6f 29 28 64 62 3a 67 65 74 2d 72 6f 77  info)(db:get-row
03e0: 20 72 75 6e 69 6e 66 6f 29 29 0a 3b 3b 20 20 74   runinfo)).;;  t
03f0: 6f 20 65 78 74 72 61 63 74 20 69 6e 66 6f 20 66  o extract info f
0400: 72 6f 6d 20 74 68 65 20 73 74 72 75 63 74 75 72  rom the structur
0410: 65 20 72 65 74 75 72 6e 65 64 0a 3b 3b 0a 28 64  e returned.;;.(d
0420: 65 66 69 6e 65 20 28 72 75 6e 73 3a 67 65 74 2d  efine (runs:get-
0430: 72 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20  runs-by-patt db 
0440: 6b 65 79 73 20 72 75 6e 6e 61 6d 65 70 61 74 74  keys runnamepatt
0450: 29 20 3b 3b 20 74 65 73 74 2d 6e 61 6d 65 29 0a  ) ;; test-name).
0460: 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 76 61 6c    (let* ((keyval
0470: 6c 73 74 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69  lst (keys->valli
0480: 73 74 20 6b 65 79 73 29 29 0a 09 20 28 74 6d 70  st keys)).. (tmp
0490: 20 20 20 20 20 20 28 72 75 6e 73 3a 67 65 74 2d        (runs:get-
04a0: 73 74 64 2d 72 75 6e 2d 66 69 65 6c 64 73 20 6b  std-run-fields k
04b0: 65 79 73 20 27 28 22 69 64 22 20 22 72 75 6e 6e  eys '("id" "runn
04c0: 61 6d 65 22 20 22 73 74 61 74 65 22 20 22 73 74  ame" "state" "st
04d0: 61 74 75 73 22 20 22 6f 77 6e 65 72 22 20 22 65  atus" "owner" "e
04e0: 76 65 6e 74 5f 74 69 6d 65 22 29 29 29 0a 09 20  vent_time"))).. 
04f0: 28 6b 65 79 73 74 72 20 20 20 28 63 61 72 20 74  (keystr   (car t
0500: 6d 70 29 29 0a 09 20 28 68 65 61 64 65 72 20 20  mp)).. (header  
0510: 20 28 63 61 64 72 20 74 6d 70 29 29 0a 09 20 28   (cadr tmp)).. (
0520: 72 65 73 20 20 20 20 20 27 28 29 29 0a 09 20 28  res     '()).. (
0530: 6b 65 79 2d 70 61 74 74 20 22 22 29 0a 09 20 28  key-patt "").. (
0540: 72 75 6e 77 69 6c 64 74 79 70 65 20 28 69 66 20  runwildtype (if 
0550: 28 73 75 62 73 74 72 69 6e 67 2d 69 6e 64 65 78  (substring-index
0560: 20 22 25 22 20 72 75 6e 6e 61 6d 65 70 61 74 74   "%" runnamepatt
0570: 29 20 22 6c 69 6b 65 22 20 22 67 6c 6f 62 22 29  ) "like" "glob")
0580: 29 0a 09 20 28 71 72 79 2d 73 74 72 20 20 23 66  ).. (qry-str  #f
0590: 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68  )).    (for-each
05a0: 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 76 61 6c   (lambda (keyval
05b0: 29 0a 09 09 28 6c 65 74 2a 20 28 28 6b 65 79 20  )...(let* ((key 
05c0: 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 6b     (vector-ref k
05d0: 65 79 76 61 6c 20 30 29 29 0a 09 09 20 20 20 20  eyval 0))...    
05e0: 20 20 20 28 66 75 6c 6b 65 79 20 28 63 6f 6e 63     (fulkey (conc
05f0: 20 22 3a 22 20 6b 65 79 29 29 0a 09 09 20 20 20   ":" key))...   
0600: 20 20 20 20 28 70 61 74 74 20 20 20 28 61 72 67      (patt   (arg
0610: 73 3a 67 65 74 2d 61 72 67 20 66 75 6c 6b 65 79  s:get-arg fulkey
0620: 29 29 0a 09 09 20 20 20 20 20 20 20 28 77 69 6c  ))...       (wil
0630: 64 74 79 70 65 20 28 69 66 20 28 73 75 62 73 74  dtype (if (subst
0640: 72 69 6e 67 2d 69 6e 64 65 78 20 22 25 22 20 70  ring-index "%" p
0650: 61 74 74 29 20 22 6c 69 6b 65 22 20 22 67 6c 6f  att) "like" "glo
0660: 62 22 29 29 29 0a 09 09 20 20 28 69 66 20 70 61  b")))...  (if pa
0670: 74 74 0a 09 09 20 20 20 20 20 20 28 73 65 74 21  tt...      (set!
0680: 20 6b 65 79 2d 70 61 74 74 20 28 63 6f 6e 63 20   key-patt (conc 
0690: 6b 65 79 2d 70 61 74 74 20 22 20 41 4e 44 20 22  key-patt " AND "
06a0: 20 6b 65 79 20 22 20 22 20 77 69 6c 64 74 79 70   key " " wildtyp
06b0: 65 20 22 20 27 22 20 70 61 74 74 20 22 27 22 29  e " '" patt "'")
06c0: 29 0a 09 09 20 20 20 20 20 20 28 62 65 67 69 6e  )...      (begin
06d0: 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74  ....(debug:print
06e0: 20 30 20 22 45 52 52 4f 52 3a 20 73 65 61 72 63   0 "ERROR: searc
06f0: 68 69 6e 67 20 66 6f 72 20 72 75 6e 73 20 77 69  hing for runs wi
0700: 74 68 20 6e 6f 20 70 61 74 74 65 72 6e 20 73 65  th no pattern se
0710: 74 20 66 6f 72 20 22 20 66 75 6c 6b 65 79 29 0a  t for " fulkey).
0720: 09 09 09 28 65 78 69 74 20 36 29 29 29 29 29 0a  ...(exit 6))))).
0730: 09 20 20 20 20 20 20 6b 65 79 73 29 0a 20 20 20  .      keys).   
0740: 20 28 73 65 74 21 20 71 72 79 2d 73 74 72 20 28   (set! qry-str (
0750: 63 6f 6e 63 20 22 53 45 4c 45 43 54 20 22 20 6b  conc "SELECT " k
0760: 65 79 73 74 72 20 22 20 46 52 4f 4d 20 72 75 6e  eystr " FROM run
0770: 73 20 57 48 45 52 45 20 72 75 6e 6e 61 6d 65 20  s WHERE runname 
0780: 22 20 72 75 6e 77 69 6c 64 74 79 70 65 20 22 20  " runwildtype " 
0790: 3f 20 22 20 6b 65 79 2d 70 61 74 74 20 22 3b 22  ? " key-patt ";"
07a0: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72  )).    (debug:pr
07b0: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 72 75 6e 73  int-info 4 "runs
07c0: 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74  :get-runs-by-pat
07d0: 74 20 71 72 79 3d 22 20 71 72 79 2d 73 74 72 20  t qry=" qry-str 
07e0: 22 20 22 20 72 75 6e 6e 61 6d 65 70 61 74 74 29  " " runnamepatt)
07f0: 0a 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66 6f  .    (sqlite3:fo
0800: 72 2d 65 61 63 68 2d 72 6f 77 20 0a 20 20 20 20  r-each-row .    
0810: 20 28 6c 61 6d 62 64 61 20 28 61 20 2e 20 72 29   (lambda (a . r)
0820: 0a 20 20 20 20 20 20 20 28 73 65 74 21 20 72 65  .       (set! re
0830: 73 20 28 63 6f 6e 73 20 28 6c 69 73 74 2d 3e 76  s (cons (list->v
0840: 65 63 74 6f 72 20 28 63 6f 6e 73 20 61 20 72 29  ector (cons a r)
0850: 29 20 72 65 73 29 29 29 0a 20 20 20 20 20 64 62  ) res))).     db
0860: 20 0a 20 20 20 20 20 71 72 79 2d 73 74 72 0a 20   .     qry-str. 
0870: 20 20 20 20 72 75 6e 6e 61 6d 65 70 61 74 74 29      runnamepatt)
0880: 0a 20 20 20 20 28 76 65 63 74 6f 72 20 68 65 61  .    (vector hea
0890: 64 65 72 20 72 65 73 29 29 29 0a 0a 28 64 65 66  der res)))..(def
08a0: 69 6e 65 20 28 72 75 6e 73 3a 74 65 73 74 2d 67  ine (runs:test-g
08b0: 65 74 2d 66 75 6c 6c 2d 70 61 74 68 20 74 65 73  et-full-path tes
08c0: 74 29 0a 20 20 28 6c 65 74 2a 20 28 28 74 65 73  t).  (let* ((tes
08d0: 74 6e 61 6d 65 20 28 64 62 3a 74 65 73 74 2d 67  tname (db:test-g
08e0: 65 74 2d 74 65 73 74 6e 61 6d 65 20 20 20 74 65  et-testname   te
08f0: 73 74 29 29 0a 09 20 28 69 74 65 6d 70 61 74 68  st)).. (itempath
0900: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74   (db:test-get-it
0910: 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29 29 0a  em-path test))).
0920: 20 20 20 20 28 63 6f 6e 63 20 74 65 73 74 6e 61      (conc testna
0930: 6d 65 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69  me (if (equal? i
0940: 74 65 6d 70 61 74 68 20 22 22 29 20 22 22 20 28  tempath "") "" (
0950: 63 6f 6e 63 20 22 28 22 20 69 74 65 6d 70 61 74  conc "(" itempat
0960: 68 20 22 29 22 29 29 29 29 29 0a 0a 28 64 65 66  h ")")))))..(def
0970: 69 6e 65 20 28 64 62 3a 67 65 74 2d 72 75 6e 2d  ine (db:get-run-
0980: 6b 65 79 2d 76 61 6c 20 64 62 20 72 75 6e 2d 69  key-val db run-i
0990: 64 20 6b 65 79 29 0a 20 20 28 6c 65 74 20 28 28  d key).  (let ((
09a0: 72 65 73 20 23 66 29 29 0a 20 20 20 20 28 73 71  res #f)).    (sq
09b0: 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72  lite3:for-each-r
09c0: 6f 77 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20  ow.     (lambda 
09d0: 28 76 61 6c 29 0a 20 20 20 20 20 20 20 28 73 65  (val).       (se
09e0: 74 21 20 72 65 73 20 76 61 6c 29 29 0a 20 20 20  t! res val)).   
09f0: 20 20 64 62 20 0a 20 20 20 20 20 28 63 6f 6e 63    db .     (conc
0a00: 20 22 53 45 4c 45 43 54 20 22 20 28 6b 65 79 3a   "SELECT " (key:
0a10: 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65  get-fieldname ke
0a20: 79 29 20 22 20 46 52 4f 4d 20 72 75 6e 73 20 57  y) " FROM runs W
0a30: 48 45 52 45 20 69 64 3d 3f 3b 22 29 0a 20 20 20  HERE id=?;").   
0a40: 20 20 72 75 6e 2d 69 64 29 0a 20 20 20 20 72 65    run-id).    re
0a50: 73 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 64 62  s))..(define (db
0a60: 3a 67 65 74 2d 72 75 6e 2d 6e 61 6d 65 2d 66 72  :get-run-name-fr
0a70: 6f 6d 2d 69 64 20 64 62 20 72 75 6e 2d 69 64 29  om-id db run-id)
0a80: 0a 20 20 28 6c 65 74 20 28 28 72 65 73 20 23 66  .  (let ((res #f
0a90: 29 29 0a 20 20 20 20 28 73 71 6c 69 74 65 33 3a  )).    (sqlite3:
0aa0: 66 6f 72 2d 65 61 63 68 2d 72 6f 77 0a 20 20 20  for-each-row.   
0ab0: 20 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 6e 61    (lambda (runna
0ac0: 6d 65 29 0a 20 20 20 20 20 20 20 28 73 65 74 21  me).       (set!
0ad0: 20 72 65 73 20 72 75 6e 6e 61 6d 65 29 29 0a 20   res runname)). 
0ae0: 20 20 20 20 64 62 0a 20 20 20 20 20 22 53 45 4c      db.     "SEL
0af0: 45 43 54 20 72 75 6e 6e 61 6d 65 20 46 52 4f 4d  ECT runname FROM
0b00: 20 72 75 6e 73 20 57 48 45 52 45 20 69 64 3d 3f   runs WHERE id=?
0b10: 3b 22 0a 20 20 20 20 20 72 75 6e 2d 69 64 29 0a  ;".     run-id).
0b20: 20 20 20 20 72 65 73 29 29 0a 0a 28 64 65 66 69      res))..(defi
0b30: 6e 65 20 28 73 65 74 2d 6d 65 67 61 74 65 73 74  ne (set-megatest
0b40: 2d 65 6e 76 2d 76 61 72 73 20 72 75 6e 2d 69 64  -env-vars run-id
0b50: 29 0a 20 20 28 6c 65 74 20 28 28 6b 65 79 73 20  ).  (let ((keys 
0b60: 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20  (cdb:remote-run 
0b70: 64 62 3a 67 65 74 2d 6b 65 79 73 20 23 66 29 29  db:get-keys #f))
0b80: 0a 09 28 76 61 6c 73 20 28 68 61 73 68 2d 74 61  ..(vals (hash-ta
0b90: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20  ble-ref/default 
0ba0: 2a 65 6e 76 2d 76 61 72 73 2d 62 79 2d 72 75 6e  *env-vars-by-run
0bb0: 2d 69 64 2a 20 72 75 6e 2d 69 64 20 23 66 29 29  -id* run-id #f))
0bc0: 29 0a 20 20 20 20 3b 3b 20 67 65 74 20 74 68 65  ).    ;; get the
0bd0: 20 69 6e 66 6f 20 66 72 6f 6d 20 74 68 65 20 64   info from the d
0be0: 62 20 61 6e 64 20 70 75 74 20 69 74 20 69 6e 20  b and put it in 
0bf0: 74 68 65 20 63 61 63 68 65 0a 20 20 20 20 28 69  the cache.    (i
0c00: 66 20 28 6e 6f 74 20 76 61 6c 73 29 0a 09 28 6c  f (not vals)..(l
0c10: 65 74 20 28 28 68 74 20 28 6d 61 6b 65 2d 68 61  et ((ht (make-ha
0c20: 73 68 2d 74 61 62 6c 65 29 29 29 0a 09 20 20 28  sh-table)))..  (
0c30: 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20  hash-table-set! 
0c40: 2a 65 6e 76 2d 76 61 72 73 2d 62 79 2d 72 75 6e  *env-vars-by-run
0c50: 2d 69 64 2a 20 72 75 6e 2d 69 64 20 68 74 29 0a  -id* run-id ht).
0c60: 09 20 20 28 73 65 74 21 20 76 61 6c 73 20 68 74  .  (set! vals ht
0c70: 29 0a 09 20 20 28 66 6f 72 2d 65 61 63 68 0a 09  )..  (for-each..
0c80: 20 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 29     (lambda (key)
0c90: 0a 09 20 20 20 20 20 28 68 61 73 68 2d 74 61 62  ..     (hash-tab
0ca0: 6c 65 2d 73 65 74 21 20 76 61 6c 73 20 6b 65 79  le-set! vals key
0cb0: 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e   (cdb:remote-run
0cc0: 20 64 62 3a 67 65 74 2d 72 75 6e 2d 6b 65 79 2d   db:get-run-key-
0cd0: 76 61 6c 20 23 66 20 72 75 6e 2d 69 64 20 6b 65  val #f run-id ke
0ce0: 79 29 29 29 0a 09 20 20 20 6b 65 79 73 29 29 29  y)))..   keys)))
0cf0: 0a 20 20 20 20 3b 3b 20 66 72 6f 6d 20 74 68 65  .    ;; from the
0d00: 20 63 61 63 68 65 64 20 64 61 74 61 20 73 65 74   cached data set
0d10: 20 74 68 65 20 76 61 72 73 0a 20 20 20 20 28 68   the vars.    (h
0d20: 61 73 68 2d 74 61 62 6c 65 2d 66 6f 72 2d 65 61  ash-table-for-ea
0d30: 63 68 0a 20 20 20 20 20 76 61 6c 73 0a 20 20 20  ch.     vals.   
0d40: 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 20 76    (lambda (key v
0d50: 61 6c 29 0a 20 20 20 20 20 20 20 28 64 65 62 75  al).       (debu
0d60: 67 3a 70 72 69 6e 74 20 32 20 22 73 65 74 65 6e  g:print 2 "seten
0d70: 76 20 22 20 28 6b 65 79 3a 67 65 74 2d 66 69 65  v " (key:get-fie
0d80: 6c 64 6e 61 6d 65 20 6b 65 79 29 20 22 20 22 20  ldname key) " " 
0d90: 76 61 6c 29 0a 20 20 20 20 20 20 20 28 73 65 74  val).       (set
0da0: 65 6e 76 20 28 6b 65 79 3a 67 65 74 2d 66 69 65  env (key:get-fie
0db0: 6c 64 6e 61 6d 65 20 6b 65 79 29 20 76 61 6c 29  ldname key) val)
0dc0: 29 29 0a 20 20 20 20 28 61 6c 69 73 74 2d 3e 65  )).    (alist->e
0dd0: 6e 76 2d 76 61 72 73 20 28 68 61 73 68 2d 74 61  nv-vars (hash-ta
0de0: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20  ble-ref/default 
0df0: 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 65 6e 76  *configdat* "env
0e00: 2d 6f 76 65 72 72 69 64 65 22 20 27 28 29 29 29  -override" '()))
0e10: 0a 20 20 20 20 3b 3b 20 4c 65 74 73 20 75 73 65  .    ;; Lets use
0e20: 20 74 68 69 73 20 61 73 20 61 6e 20 6f 70 70 6f   this as an oppo
0e30: 72 74 75 6e 69 74 79 20 74 6f 20 70 75 74 20 4d  rtunity to put M
0e40: 54 5f 52 55 4e 4e 41 4d 45 20 69 6e 20 74 68 65  T_RUNNAME in the
0e50: 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 20 20 20   environment.   
0e60: 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e   (setenv "MT_RUN
0e70: 4e 41 4d 45 22 20 28 63 64 62 3a 72 65 6d 6f 74  NAME" (cdb:remot
0e80: 65 2d 72 75 6e 20 64 62 3a 67 65 74 2d 72 75 6e  e-run db:get-run
0e90: 2d 6e 61 6d 65 2d 66 72 6f 6d 2d 69 64 20 23 66  -name-from-id #f
0ea0: 20 72 75 6e 2d 69 64 29 29 0a 20 20 20 20 28 73   run-id)).    (s
0eb0: 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e 5f 41 52  etenv "MT_RUN_AR
0ec0: 45 41 5f 48 4f 4d 45 22 20 2a 74 6f 70 70 61 74  EA_HOME" *toppat
0ed0: 68 2a 29 0a 20 20 20 20 29 29 0a 0a 28 64 65 66  h*).    ))..(def
0ee0: 69 6e 65 20 28 73 65 74 2d 69 74 65 6d 2d 65 6e  ine (set-item-en
0ef0: 76 2d 76 61 72 73 20 69 74 65 6d 64 61 74 29 0a  v-vars itemdat).
0f00: 20 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d    (for-each (lam
0f10: 62 64 61 20 28 69 74 65 6d 29 0a 09 20 20 20 20  bda (item)..    
0f20: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32    (debug:print 2
0f30: 20 22 73 65 74 65 6e 76 20 22 20 28 63 61 72 20   "setenv " (car 
0f40: 69 74 65 6d 29 20 22 20 22 20 28 63 61 64 72 20  item) " " (cadr 
0f50: 69 74 65 6d 29 29 0a 09 20 20 20 20 20 20 28 73  item))..      (s
0f60: 65 74 65 6e 76 20 28 63 61 72 20 69 74 65 6d 29  etenv (car item)
0f70: 20 28 63 61 64 72 20 69 74 65 6d 29 29 29 0a 09   (cadr item)))..
0f80: 20 20 20 20 69 74 65 6d 64 61 74 29 29 0a 0a 28      itemdat))..(
0f90: 64 65 66 69 6e 65 20 2a 6c 61 73 74 2d 6e 75 6d  define *last-num
0fa0: 2d 72 75 6e 6e 69 6e 67 2d 74 65 73 74 73 2a 20  -running-tests* 
0fb0: 30 29 0a 28 64 65 66 69 6e 65 20 2a 72 75 6e 73  0).(define *runs
0fc0: 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65  :can-run-more-te
0fd0: 73 74 73 2d 64 65 6c 61 79 2a 20 30 29 0a 28 64  sts-delay* 0).(d
0fe0: 65 66 69 6e 65 20 28 72 75 6e 73 3a 73 68 72 69  efine (runs:shri
0ff0: 6e 6b 2d 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d  nk-can-run-more-
1000: 74 65 73 74 73 2d 64 65 6c 61 79 29 0a 20 20 28  tests-delay).  (
1010: 73 65 74 21 20 2a 72 75 6e 73 3a 63 61 6e 2d 72  set! *runs:can-r
1020: 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65  un-more-tests-de
1030: 6c 61 79 2a 20 30 29 29 20 3b 3b 20 28 2f 20 2a  lay* 0)) ;; (/ *
1040: 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72  runs:can-run-mor
1050: 65 2d 74 65 73 74 73 2d 64 65 6c 61 79 2a 20 32  e-tests-delay* 2
1060: 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75  )))..(define (ru
1070: 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d  ns:can-run-more-
1080: 74 65 73 74 73 20 74 65 73 74 2d 72 65 63 6f 72  tests test-recor
1090: 64 29 0a 20 20 28 74 68 72 65 61 64 2d 73 6c 65  d).  (thread-sle
10a0: 65 70 21 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75  ep! *runs:can-ru
10b0: 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c  n-more-tests-del
10c0: 61 79 2a 29 0a 20 20 28 6c 65 74 2a 20 28 28 74  ay*).  (let* ((t
10d0: 63 6f 6e 66 69 67 20 20 20 20 20 20 20 20 20 20  config          
10e0: 20 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 65         (tests:te
10f0: 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74  stqueue-get-test
1100: 63 6f 6e 66 69 67 20 74 65 73 74 2d 72 65 63 6f  config test-reco
1110: 72 64 29 29 0a 09 20 28 6a 6f 62 67 72 6f 75 70  rd)).. (jobgroup
1120: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1130: 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74  (config-lookup t
1140: 63 6f 6e 66 69 67 20 22 72 65 71 75 69 72 65 6d  config "requirem
1150: 65 6e 74 73 22 20 22 6a 6f 62 67 72 6f 75 70 22  ents" "jobgroup"
1160: 29 29 0a 09 20 3b 3b 20 48 65 75 72 69 73 74 69  )).. ;; Heuristi
1170: 63 20 66 69 78 2e 20 54 68 65 73 65 20 61 72 65  c fix. These are
1180: 20 67 65 74 74 69 6e 67 20 63 61 6c 6c 65 64 20   getting called 
1190: 74 6f 6f 20 72 61 70 69 64 6c 79 20 77 68 65 6e  too rapidly when
11a0: 20 6a 6f 62 73 20 61 72 65 20 72 75 6e 6e 69 6e   jobs are runnin
11b0: 67 20 6f 72 20 73 74 75 63 6b 0a 09 20 3b 3b 20  g or stuck.. ;; 
11c0: 73 6f 20 77 65 20 61 72 65 20 67 6f 69 6e 67 20  so we are going 
11d0: 74 6f 20 69 6e 63 72 65 6d 65 6e 74 20 61 20 67  to increment a g
11e0: 6c 6f 62 61 6c 20 64 65 6c 61 79 20 62 79 20 30  lobal delay by 0
11f0: 2e 31 20 73 65 63 6f 6e 64 73 20 75 70 20 74 6f  .1 seconds up to
1200: 20 31 30 20 73 65 63 6f 6e 64 73 0a 09 20 3b 3b   10 seconds.. ;;
1210: 20 65 76 65 72 79 20 74 69 6d 65 20 72 75 6e 73   every time runs
1220: 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65  :can-run-more-te
1230: 73 74 73 20 69 73 20 63 61 6c 6c 65 64 2e 0a 09  sts is called...
1240: 20 3b 3b 20 77 68 65 6e 20 61 20 74 65 73 74 20   ;; when a test 
1250: 69 73 20 6c 61 75 6e 63 68 65 64 20 6f 72 20 6f  is launched or o
1260: 74 68 65 72 20 61 63 74 69 76 69 74 79 20 6f 63  ther activity oc
1270: 63 75 72 73 20 64 69 76 69 64 65 20 74 68 65 20  curs divide the 
1280: 64 65 6c 61 79 20 62 79 20 32 0a 09 20 28 6e 75  delay by 2.. (nu
1290: 6d 2d 72 75 6e 6e 69 6e 67 20 20 20 20 20 20 20  m-running       
12a0: 20 20 20 20 20 20 28 63 64 62 3a 72 65 6d 6f 74        (cdb:remot
12b0: 65 2d 72 75 6e 20 64 62 3a 67 65 74 2d 63 6f 75  e-run db:get-cou
12c0: 6e 74 2d 74 65 73 74 73 2d 72 75 6e 6e 69 6e 67  nt-tests-running
12d0: 20 23 66 29 29 0a 09 20 28 6e 75 6d 2d 72 75 6e   #f)).. (num-run
12e0: 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70  ning-in-jobgroup
12f0: 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e   (cdb:remote-run
1300: 20 64 62 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 65   db:get-count-te
1310: 73 74 73 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a  sts-running-in-j
1320: 6f 62 67 72 6f 75 70 20 23 66 20 6a 6f 62 67 72  obgroup #f jobgr
1330: 6f 75 70 29 29 0a 09 20 28 6d 61 78 2d 63 6f 6e  oup)).. (max-con
1340: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 20 20 20  current-jobs    
1350: 20 28 6c 65 74 20 28 28 6d 63 6a 20 28 63 6f 6e   (let ((mcj (con
1360: 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66  fig-lookup *conf
1370: 69 67 64 61 74 2a 20 22 73 65 74 75 70 22 20 20  igdat* "setup"  
1380: 20 20 20 22 6d 61 78 5f 63 6f 6e 63 75 72 72 65     "max_concurre
1390: 6e 74 5f 6a 6f 62 73 22 29 29 29 0a 09 09 09 09  nt_jobs"))).....
13a0: 20 20 20 20 28 69 66 20 28 61 6e 64 20 6d 63 6a      (if (and mcj
13b0: 20 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72   (string->number
13c0: 20 6d 63 6a 29 29 0a 09 09 09 09 09 28 73 74 72   mcj))......(str
13d0: 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 63 6a 29  ing->number mcj)
13e0: 0a 09 09 09 09 09 31 29 29 29 0a 09 20 28 6a 6f  ......1))).. (jo
13f0: 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 20 20 20  b-group-limit   
1400: 20 20 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f        (config-lo
1410: 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a  okup *configdat*
1420: 20 22 6a 6f 62 67 72 6f 75 70 73 22 20 6a 6f 62   "jobgroups" job
1430: 67 72 6f 75 70 29 29 29 0a 20 20 20 20 28 69 66  group))).    (if
1440: 20 28 61 6e 64 20 28 3e 20 28 2b 20 6e 75 6d 2d   (and (> (+ num-
1450: 72 75 6e 6e 69 6e 67 20 6e 75 6d 2d 72 75 6e 6e  running num-runn
1460: 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 29  ing-in-jobgroup)
1470: 20 30 29 0a 09 20 20 20 20 20 28 3c 20 2a 72 75   0)..     (< *ru
1480: 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d  ns:can-run-more-
1490: 74 65 73 74 73 2d 64 65 6c 61 79 2a 20 31 29 29  tests-delay* 1))
14a0: 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 73 65 74  ..(begin..  (set
14b0: 21 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d  ! *runs:can-run-
14c0: 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c 61 79  more-tests-delay
14d0: 2a 20 28 2b 20 2a 72 75 6e 73 3a 63 61 6e 2d 72  * (+ *runs:can-r
14e0: 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65  un-more-tests-de
14f0: 6c 61 79 2a 20 30 2e 30 30 39 29 29 0a 09 20 20  lay* 0.009))..  
1500: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
1510: 6f 20 31 34 20 22 63 61 6e 2d 72 75 6e 2d 6d 6f  o 14 "can-run-mo
1520: 72 65 2d 74 65 73 74 73 2d 64 65 6c 61 79 3a 20  re-tests-delay: 
1530: 22 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d  " *runs:can-run-
1540: 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c 61 79  more-tests-delay
1550: 2a 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e 6f  *))).    (if (no
1560: 74 20 28 65 71 3f 20 2a 6c 61 73 74 2d 6e 75 6d  t (eq? *last-num
1570: 2d 72 75 6e 6e 69 6e 67 2d 74 65 73 74 73 2a 20  -running-tests* 
1580: 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 29 0a 09 28  num-running))..(
1590: 62 65 67 69 6e 0a 09 20 20 28 64 65 62 75 67 3a  begin..  (debug:
15a0: 70 72 69 6e 74 20 32 20 22 6d 61 78 2d 63 6f 6e  print 2 "max-con
15b0: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 3a 20 22 20  current-jobs: " 
15c0: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a  max-concurrent-j
15d0: 6f 62 73 20 22 2c 20 6e 75 6d 2d 72 75 6e 6e 69  obs ", num-runni
15e0: 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e  ng: " num-runnin
15f0: 67 29 0a 09 20 20 28 73 65 74 21 20 2a 6c 61 73  g)..  (set! *las
1600: 74 2d 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 74 65  t-num-running-te
1610: 73 74 73 2a 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67  sts* num-running
1620: 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74  ))).    (if (not
1630: 20 28 65 71 3f 20 30 20 2a 67 6c 6f 62 61 6c 65   (eq? 0 *globale
1640: 78 69 74 73 74 61 74 75 73 2a 29 29 0a 09 28 6c  xitstatus*))..(l
1650: 69 73 74 20 23 66 20 6e 75 6d 2d 72 75 6e 6e 69  ist #f num-runni
1660: 6e 67 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69  ng num-running-i
1670: 6e 2d 6a 6f 62 67 72 6f 75 70 20 6d 61 78 2d 63  n-jobgroup max-c
1680: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 6a  oncurrent-jobs j
1690: 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 29 0a  ob-group-limit).
16a0: 09 28 6c 65 74 20 28 28 63 61 6e 2d 6e 6f 74 2d  .(let ((can-not-
16b0: 72 75 6e 2d 6d 6f 72 65 20 28 63 6f 6e 64 0a 09  run-more (cond..
16c0: 09 09 09 20 3b 3b 20 69 66 20 6d 61 78 2d 63 6f  ... ;; if max-co
16d0: 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 69 73  ncurrent-jobs is
16e0: 20 73 65 74 20 61 6e 64 20 74 68 65 20 6e 75 6d   set and the num
16f0: 62 65 72 20 72 75 6e 6e 69 6e 67 20 69 73 20 67  ber running is g
1700: 72 65 61 74 65 72 20 0a 09 09 09 09 20 3b 3b 20  reater ..... ;; 
1710: 74 68 61 6e 20 69 74 20 74 68 61 6e 20 63 61 6e  than it than can
1720: 6e 6f 74 20 72 75 6e 20 6d 6f 72 65 20 6a 6f 62  not run more job
1730: 73 0a 09 09 09 09 20 28 28 61 6e 64 20 6d 61 78  s..... ((and max
1740: 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73  -concurrent-jobs
1750: 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67   (>= num-running
1760: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d   max-concurrent-
1770: 6a 6f 62 73 29 29 0a 09 09 09 09 20 20 28 64 65  jobs)).....  (de
1780: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52  bug:print 0 "WAR
1790: 4e 49 4e 47 3a 20 4d 61 78 20 72 75 6e 6e 69 6e  NING: Max runnin
17a0: 67 20 6a 6f 62 73 20 65 78 63 65 65 64 65 64 2c  g jobs exceeded,
17b0: 20 63 75 72 72 65 6e 74 20 6e 75 6d 62 65 72 20   current number 
17c0: 72 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d 72  running: " num-r
17d0: 75 6e 6e 69 6e 67 20 0a 09 09 09 09 09 20 20 20  unning ......   
17e0: 20 20 20 20 22 2c 20 6d 61 78 5f 63 6f 6e 63 75      ", max_concu
17f0: 72 72 65 6e 74 5f 6a 6f 62 73 3a 20 22 20 6d 61  rrent_jobs: " ma
1800: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62  x-concurrent-job
1810: 73 29 0a 09 09 09 09 20 20 23 74 29 0a 09 09 09  s).....  #t)....
1820: 09 20 3b 3b 20 69 66 20 6a 6f 62 2d 67 72 6f 75  . ;; if job-grou
1830: 70 2d 6c 69 6d 69 74 20 69 73 20 73 65 74 20 61  p-limit is set a
1840: 6e 64 20 6e 75 6d 62 65 72 20 6f 66 20 6a 6f 62  nd number of job
1850: 73 20 69 6e 20 74 68 65 20 67 72 6f 75 70 20 69  s in the group i
1860: 73 20 67 72 65 61 74 65 72 0a 09 09 09 09 20 3b  s greater..... ;
1870: 3b 20 74 68 61 6e 20 74 68 65 20 6c 69 6d 69 74  ; than the limit
1880: 20 74 68 65 6e 20 63 61 6e 6e 6f 74 20 72 75 6e   then cannot run
1890: 20 6d 6f 72 65 20 6a 6f 62 73 20 6f 66 20 74 68   more jobs of th
18a0: 69 73 20 6b 69 6e 64 0a 09 09 09 09 20 28 28 61  is kind..... ((a
18b0: 6e 64 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d  nd job-group-lim
18c0: 69 74 0a 09 09 09 09 20 20 20 20 20 20 20 28 3e  it.....       (>
18d0: 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e  = num-running-in
18e0: 2d 6a 6f 62 67 72 6f 75 70 20 6a 6f 62 2d 67 72  -jobgroup job-gr
18f0: 6f 75 70 2d 6c 69 6d 69 74 29 29 0a 09 09 09 09  oup-limit)).....
1900: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31    (debug:print 1
1910: 20 22 57 41 52 4e 49 4e 47 3a 20 6e 75 6d 62 65   "WARNING: numbe
1920: 72 20 6f 66 20 6a 6f 62 73 20 22 20 6e 75 6d 2d  r of jobs " num-
1930: 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72  running-in-jobgr
1940: 6f 75 70 20 0a 09 09 09 09 09 20 20 20 20 20 20  oup ......      
1950: 20 22 20 69 6e 20 22 20 6a 6f 62 67 72 6f 75 70   " in " jobgroup
1960: 20 22 20 65 78 63 65 65 64 65 64 2c 20 77 69 6c   " exceeded, wil
1970: 6c 20 6e 6f 74 20 72 75 6e 20 22 20 28 74 65 73  l not run " (tes
1980: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
1990: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72  -testname test-r
19a0: 65 63 6f 72 64 29 29 0a 09 09 09 09 20 20 23 74  ecord)).....  #t
19b0: 29 0a 09 09 09 09 20 28 65 6c 73 65 20 23 66 29  )..... (else #f)
19c0: 29 29 29 0a 09 20 20 28 6c 69 73 74 20 28 6e 6f  )))..  (list (no
19d0: 74 20 63 61 6e 2d 6e 6f 74 2d 72 75 6e 2d 6d 6f  t can-not-run-mo
19e0: 72 65 29 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20  re) num-running 
19f0: 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a  num-running-in-j
1a00: 6f 62 67 72 6f 75 70 20 6d 61 78 2d 63 6f 6e 63  obgroup max-conc
1a10: 75 72 72 65 6e 74 2d 6a 6f 62 73 20 6a 6f 62 2d  urrent-jobs job-
1a20: 67 72 6f 75 70 2d 6c 69 6d 69 74 29 29 29 29 29  group-limit)))))
1a30: 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ..;;============
1a40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1a50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1a60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1a70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4e 65  ==========.;; Ne
1a80: 77 20 6d 65 74 68 6f 64 6f 6c 6f 67 79 2e 20 54  w methodology. T
1a90: 68 65 73 65 20 72 6f 75 74 69 6e 65 73 20 77 69  hese routines wi
1aa0: 6c 6c 20 72 65 70 6c 61 63 65 20 74 68 65 20 61  ll replace the a
1ab0: 62 6f 76 65 20 69 6e 20 74 69 6d 65 2e 20 46 6f  bove in time. Fo
1ac0: 72 0a 3b 3b 20 6e 6f 77 20 74 68 65 20 63 6f 64  r.;; now the cod
1ad0: 65 20 69 73 20 64 75 70 6c 69 63 61 74 65 64 2e  e is duplicated.
1ae0: 20 54 68 69 73 20 73 74 75 66 66 20 69 73 20 69   This stuff is i
1af0: 6e 69 74 69 61 6c 6c 79 20 75 73 65 64 20 69 6e  nitially used in
1b00: 20 74 68 65 20 6d 6f 6e 69 74 6f 72 0a 3b 3b 20   the monitor.;; 
1b10: 62 61 73 65 64 20 63 6f 64 65 2e 0a 3b 3b 3d 3d  based code..;;==
1b20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1b30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1b40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1b50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1b60: 3d 3d 3d 3d 0a 0a 0a 3b 3b 20 54 68 69 73 20 69  ====...;; This i
1b70: 73 20 61 20 64 75 70 6c 69 63 61 74 65 20 6f 66  s a duplicate of
1b80: 20 72 75 6e 2d 74 65 73 74 73 20 28 77 68 69 63   run-tests (whic
1b90: 68 20 68 61 73 20 62 65 65 6e 20 64 65 70 72 65  h has been depre
1ba0: 63 61 74 65 64 29 2e 20 55 73 65 20 74 68 69 73  cated). Use this
1bb0: 20 6f 6e 65 20 69 6e 73 74 65 61 64 20 6f 66 20   one instead of 
1bc0: 72 75 6e 20 74 65 73 74 73 2e 0a 3b 3b 20 6b 65  run tests..;; ke
1bd0: 79 76 61 6c 73 2e 0a 3b 3b 0a 3b 3b 20 20 74 65  yvals..;;.;;  te
1be0: 73 74 2d 6e 61 6d 65 73 3a 20 43 6f 6d 6d 61 20  st-names: Comma 
1bf0: 73 65 70 61 72 61 74 65 64 20 70 61 74 74 65 72  separated patter
1c00: 6e 73 20 73 61 6d 65 20 61 73 20 74 65 73 74 2d  ns same as test-
1c10: 70 61 74 74 73 20 62 75 74 20 75 73 65 64 20 69  patts but used i
1c20: 6e 20 73 65 6c 65 63 74 69 6f 6e 20 0a 3b 3b 20  n selection .;; 
1c30: 20 20 20 20 20 20 20 20 20 20 20 20 20 6f 66 20               of 
1c40: 74 65 73 74 73 20 74 6f 20 72 75 6e 2e 20 54 68  tests to run. Th
1c50: 65 20 69 74 65 6d 20 70 6f 72 74 69 6f 6e 73 20  e item portions 
1c60: 61 72 65 20 6e 6f 74 20 72 65 73 70 65 63 74 65  are not respecte
1c70: 64 2e 0a 3b 3b 20 20 20 20 20 20 20 20 20 20 20  d..;;           
1c80: 20 20 20 46 49 58 4d 45 3a 20 65 72 72 6f 72 20     FIXME: error 
1c90: 6f 75 74 20 69 66 20 2f 70 61 74 74 20 73 70 65  out if /patt spe
1ca0: 63 69 66 69 65 64 0a 3b 3b 20 20 20 20 20 20 20  cified.;;       
1cb0: 20 20 20 20 20 0a 28 64 65 66 69 6e 65 20 28 72       .(define (r
1cc0: 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 20 74 61  uns:run-tests ta
1cd0: 72 67 65 74 20 72 75 6e 6e 61 6d 65 20 74 65 73  rget runname tes
1ce0: 74 2d 6e 61 6d 65 73 20 74 65 73 74 2d 70 61 74  t-names test-pat
1cf0: 74 73 20 75 73 65 72 20 66 6c 61 67 73 29 0a 20  ts user flags). 
1d00: 20 28 63 6f 6d 6d 6f 6e 3a 63 6c 65 61 72 2d 63   (common:clear-c
1d10: 61 63 68 65 73 29 20 3b 3b 20 63 6c 65 61 72 20  aches) ;; clear 
1d20: 61 6c 6c 20 63 61 63 68 65 73 0a 20 20 28 6c 65  all caches.  (le
1d30: 74 2a 20 28 28 64 62 20 20 20 20 20 20 20 20 20  t* ((db         
1d40: 20 23 66 29 0a 09 20 28 6b 65 79 73 20 20 20 20   #f).. (keys    
1d50: 20 20 20 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d      (cdb:remote-
1d60: 72 75 6e 20 64 62 3a 67 65 74 2d 6b 65 79 73 20  run db:get-keys 
1d70: 23 66 29 29 0a 09 20 28 6b 65 79 76 61 6c 6c 73  #f)).. (keyvalls
1d80: 74 20 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74  t   (keys:target
1d90: 2d 3e 6b 65 79 76 61 6c 20 6b 65 79 73 20 74 61  ->keyval keys ta
1da0: 72 67 65 74 29 29 0a 09 20 28 72 75 6e 2d 69 64  rget)).. (run-id
1db0: 20 20 20 20 20 20 28 63 64 62 3a 72 65 6d 6f 74        (cdb:remot
1dc0: 65 2d 72 75 6e 20 64 62 3a 72 65 67 69 73 74 65  e-run db:registe
1dd0: 72 2d 72 75 6e 20 23 66 20 6b 65 79 73 20 6b 65  r-run #f keys ke
1de0: 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20  yvallst runname 
1df0: 22 6e 65 77 22 20 22 6e 2f 61 22 20 75 73 65 72  "new" "n/a" user
1e00: 29 29 20 20 3b 3b 20 20 74 65 73 74 2d 6e 61 6d  ))  ;;  test-nam
1e10: 65 29 29 29 0a 09 20 28 6b 65 79 76 61 6c 73 20  e))).. (keyvals 
1e20: 20 20 20 20 28 69 66 20 72 75 6e 2d 69 64 20 28      (if run-id (
1e30: 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64  cdb:remote-run d
1e40: 62 3a 67 65 74 2d 6b 65 79 2d 76 61 6c 73 20 23  b:get-key-vals #
1e50: 66 20 72 75 6e 2d 69 64 29 20 23 66 29 29 0a 09  f run-id) #f))..
1e60: 20 28 64 65 66 65 72 72 65 64 20 20 20 20 27 28   (deferred    '(
1e70: 29 29 20 3b 3b 20 64 65 6c 61 79 20 72 75 6e 6e  )) ;; delay runn
1e80: 69 6e 67 20 74 68 65 73 65 20 73 69 6e 63 65 20  ing these since 
1e90: 74 68 65 79 20 68 61 76 65 20 61 20 77 61 69 74  they have a wait
1ea0: 6f 6e 20 63 6c 61 75 73 65 0a 09 20 3b 3b 20 6b  on clause.. ;; k
1eb0: 65 65 70 67 6f 69 6e 67 20 69 73 20 74 68 65 20  eepgoing is the 
1ec0: 64 65 66 61 63 74 6f 20 6d 6f 64 61 6c 69 74 79  defacto modality
1ed0: 20 6e 6f 77 2c 20 77 69 6c 6c 20 61 64 64 20 68   now, will add h
1ee0: 69 74 2d 6e 2d 72 75 6e 20 61 20 62 69 74 20 6c  it-n-run a bit l
1ef0: 61 74 65 72 0a 09 20 3b 3b 20 28 6b 65 65 70 67  ater.. ;; (keepg
1f00: 6f 69 6e 67 20 20 20 28 68 61 73 68 2d 74 61 62  oing   (hash-tab
1f10: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66  le-ref/default f
1f20: 6c 61 67 73 20 22 2d 6b 65 65 70 67 6f 69 6e 67  lags "-keepgoing
1f30: 22 20 23 66 29 29 0a 09 20 28 72 75 6e 63 6f 6e  " #f)).. (runcon
1f40: 66 69 67 66 20 20 20 28 63 6f 6e 63 20 20 2a 74  figf   (conc  *t
1f50: 6f 70 70 61 74 68 2a 20 22 2f 72 75 6e 63 6f 6e  oppath* "/runcon
1f60: 66 69 67 73 2e 63 6f 6e 66 69 67 22 29 29 0a 09  figs.config"))..
1f70: 20 28 72 65 71 75 69 72 65 64 2d 74 65 73 74 73   (required-tests
1f80: 20 27 28 29 29 0a 09 20 28 74 65 73 74 2d 72 65   '()).. (test-re
1f90: 63 6f 72 64 73 20 28 6d 61 6b 65 2d 68 61 73 68  cords (make-hash
1fa0: 2d 74 61 62 6c 65 29 29 29 0a 0a 20 20 20 20 28  -table)))..    (
1fb0: 73 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76  set-megatest-env
1fc0: 2d 76 61 72 73 20 72 75 6e 2d 69 64 29 20 3b 3b  -vars run-id) ;;
1fd0: 20 74 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65   these may be ne
1fe0: 65 64 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e  eded by the laun
1ff0: 63 68 69 6e 67 20 70 72 6f 63 65 73 73 0a 0a 20  ching process.. 
2000: 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69     (if (file-exi
2010: 73 74 73 3f 20 72 75 6e 63 6f 6e 66 69 67 66 29  sts? runconfigf)
2020: 0a 09 28 73 65 74 75 70 2d 65 6e 76 2d 64 65 66  ..(setup-env-def
2030: 61 75 6c 74 73 20 72 75 6e 63 6f 6e 66 69 67 66  aults runconfigf
2040: 20 72 75 6e 2d 69 64 20 2a 61 6c 72 65 61 64 79   run-id *already
2050: 2d 73 65 65 6e 2d 72 75 6e 63 6f 6e 66 69 67 2d  -seen-runconfig-
2060: 69 6e 66 6f 2a 20 6b 65 79 73 20 6b 65 79 76 61  info* keys keyva
2070: 6c 73 20 22 70 72 65 2d 6c 61 75 6e 63 68 2d 65  ls "pre-launch-e
2080: 6e 76 2d 76 61 72 73 22 29 0a 09 28 64 65 62 75  nv-vars")..(debu
2090: 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49  g:print 0 "WARNI
20a0: 4e 47 3a 20 59 6f 75 20 64 6f 20 6e 6f 74 20 68  NG: You do not h
20b0: 61 76 65 20 61 20 72 75 6e 20 63 6f 6e 66 69 67  ave a run config
20c0: 20 66 69 6c 65 3a 20 22 20 72 75 6e 63 6f 6e 66   file: " runconf
20d0: 69 67 66 29 29 0a 20 20 20 20 0a 20 20 20 20 3b  igf)).    .    ;
20e0: 3b 20 6c 6f 6f 6b 20 75 70 20 61 6c 6c 20 74 65  ; look up all te
20f0: 73 74 73 20 6d 61 74 63 68 69 6e 67 20 74 68 65  sts matching the
2100: 20 63 6f 6d 6d 61 20 73 65 70 61 72 61 74 65 64   comma separated
2110: 20 6c 69 73 74 20 6f 66 20 67 6c 6f 62 73 20 69   list of globs i
2120: 6e 0a 20 20 20 20 3b 3b 20 74 65 73 74 2d 70 61  n.    ;; test-pa
2130: 74 74 73 20 28 75 73 69 6e 67 20 25 20 61 73 20  tts (using % as 
2140: 77 69 6c 64 63 61 72 64 29 0a 0a 20 20 20 20 28  wildcard)..    (
2150: 73 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20  set! test-names 
2160: 28 74 65 73 74 73 3a 67 65 74 2d 76 61 6c 69 64  (tests:get-valid
2170: 2d 74 65 73 74 73 20 2a 74 6f 70 70 61 74 68 2a  -tests *toppath*
2180: 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 20 20   test-names)).  
2190: 20 20 28 73 65 74 21 20 74 65 73 74 2d 6e 61 6d    (set! test-nam
21a0: 65 73 20 28 64 65 6c 65 74 65 2d 64 75 70 6c 69  es (delete-dupli
21b0: 63 61 74 65 73 20 74 65 73 74 2d 6e 61 6d 65 73  cates test-names
21c0: 29 29 0a 0a 20 20 20 20 28 64 65 62 75 67 3a 70  ))..    (debug:p
21d0: 72 69 6e 74 2d 69 6e 66 6f 20 30 20 22 74 65 73  rint-info 0 "tes
21e0: 74 20 6e 61 6d 65 73 20 22 20 74 65 73 74 2d 6e  t names " test-n
21f0: 61 6d 65 73 29 0a 0a 20 20 20 20 3b 3b 20 6f 6e  ames)..    ;; on
2200: 20 74 68 65 20 66 69 72 73 74 20 70 61 73 73 20   the first pass 
2210: 6f 72 20 63 61 6c 6c 20 74 6f 20 72 75 6e 2d 74  or call to run-t
2220: 65 73 74 73 20 73 65 74 20 46 41 49 4c 53 20 74  ests set FAILS t
2230: 6f 20 4e 4f 54 5f 53 54 41 52 54 45 44 20 69 66  o NOT_STARTED if
2240: 0a 20 20 20 20 3b 3b 20 2d 6b 65 65 70 67 6f 69  .    ;; -keepgoi
2250: 6e 67 20 69 73 20 73 70 65 63 69 66 69 65 64 0a  ng is specified.
2260: 20 20 20 20 28 69 66 20 28 65 71 3f 20 2a 70 61      (if (eq? *pa
2270: 73 73 6e 75 6d 2a 20 30 29 0a 09 28 62 65 67 69  ssnum* 0)..(begi
2280: 6e 0a 09 20 20 3b 3b 20 68 61 76 65 20 74 6f 20  n..  ;; have to 
2290: 64 65 6c 65 74 65 20 74 65 73 74 20 72 65 63 6f  delete test reco
22a0: 72 64 73 20 77 68 65 72 65 20 4e 4f 54 5f 53 54  rds where NOT_ST
22b0: 41 52 54 45 44 20 73 69 6e 63 65 20 74 68 65 79  ARTED since they
22c0: 20 63 61 6e 20 63 61 75 73 65 20 2d 6b 65 65 70   can cause -keep
22d0: 67 6f 69 6e 67 20 74 6f 20 0a 09 20 20 3b 3b 20  going to ..  ;; 
22e0: 67 65 74 20 73 74 75 63 6b 20 64 75 65 20 74 6f  get stuck due to
22f0: 20 62 65 63 6f 6d 69 6e 67 20 69 6e 61 63 63 65   becoming inacce
2300: 73 73 69 62 6c 65 20 66 72 6f 6d 20 61 20 66 61  ssible from a fa
2310: 69 6c 65 64 20 74 65 73 74 2e 20 49 2e 65 2e 20  iled test. I.e. 
2320: 69 66 20 74 65 73 74 20 42 20 64 65 70 65 6e 64  if test B depend
2330: 73 20 0a 09 20 20 3b 3b 20 6f 6e 20 74 65 73 74  s ..  ;; on test
2340: 20 41 20 62 75 74 20 74 65 73 74 20 42 20 72 65   A but test B re
2350: 61 63 68 65 64 20 74 68 65 20 70 6f 69 6e 74 20  ached the point 
2360: 6f 6e 20 62 65 69 6e 67 20 72 65 67 69 73 74 65  on being registe
2370: 72 65 64 20 61 73 20 4e 4f 54 5f 53 54 41 52 54  red as NOT_START
2380: 45 44 20 61 6e 64 20 74 65 73 74 0a 09 20 20 3b  ED and test..  ;
2390: 3b 20 41 20 66 61 69 6c 65 64 20 66 6f 72 20 73  ; A failed for s
23a0: 6f 6d 65 20 72 65 61 73 6f 6e 20 74 68 65 6e 20  ome reason then 
23b0: 6f 6e 20 72 65 2d 72 75 6e 20 75 73 69 6e 67 20  on re-run using 
23c0: 2d 6b 65 65 70 67 6f 69 6e 67 20 74 68 65 20 72  -keepgoing the r
23d0: 75 6e 20 63 61 6e 20 6e 65 76 65 72 20 63 6f 6d  un can never com
23e0: 70 6c 65 74 65 2e 0a 09 20 20 28 63 64 62 3a 64  plete...  (cdb:d
23f0: 65 6c 65 74 65 2d 74 65 73 74 73 2d 69 6e 2d 73  elete-tests-in-s
2400: 74 61 74 65 20 2a 72 75 6e 72 65 6d 6f 74 65 2a  tate *runremote*
2410: 20 72 75 6e 2d 69 64 20 22 4e 4f 54 5f 53 54 41   run-id "NOT_STA
2420: 52 54 45 44 22 29 0a 09 20 20 28 63 64 62 3a 72  RTED")..  (cdb:r
2430: 65 6d 6f 74 65 2d 72 75 6e 20 64 62 3a 73 65 74  emote-run db:set
2440: 2d 74 65 73 74 73 2d 73 74 61 74 65 2d 73 74 61  -tests-state-sta
2450: 74 75 73 20 23 66 20 72 75 6e 2d 69 64 20 74 65  tus #f run-id te
2460: 73 74 2d 6e 61 6d 65 73 20 23 66 20 22 46 41 49  st-names #f "FAI
2470: 4c 22 20 22 4e 4f 54 5f 53 54 41 52 54 45 44 22  L" "NOT_STARTED"
2480: 20 22 46 41 49 4c 22 29 29 29 0a 0a 20 20 20 20   "FAIL")))..    
2490: 3b 3b 20 66 72 6f 6d 20 68 65 72 65 20 6f 6e 20  ;; from here on 
24a0: 6f 75 74 20 74 68 65 20 64 62 20 77 69 6c 6c 20  out the db will 
24b0: 62 65 20 6f 70 65 6e 65 64 20 61 6e 64 20 63 6c  be opened and cl
24c0: 6f 73 65 64 20 6f 6e 20 65 76 65 72 79 20 63 61  osed on every ca
24d0: 6c 6c 20 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74  ll runs:run-test
24e0: 73 2d 71 75 65 75 65 0a 20 20 20 20 3b 3b 20 28  s-queue.    ;; (
24f0: 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65  sqlite3:finalize
2500: 21 20 64 62 29 20 0a 20 20 20 20 3b 3b 20 6e 6f  ! db) .    ;; no
2510: 77 20 61 64 64 20 6e 6f 6e 2d 64 69 72 65 63 74  w add non-direct
2520: 6c 79 20 72 65 66 65 72 65 6e 63 65 64 20 64 65  ly referenced de
2530: 70 65 6e 64 65 6e 63 69 65 73 20 28 69 2e 65 2e  pendencies (i.e.
2540: 20 77 61 69 74 6f 6e 29 0a 20 20 20 20 28 69 66   waiton).    (if
2550: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 73   (not (null? tes
2560: 74 2d 6e 61 6d 65 73 29 29 0a 09 28 6c 65 74 20  t-names))..(let 
2570: 6c 6f 6f 70 20 28 28 68 65 64 20 28 63 61 72 20  loop ((hed (car 
2580: 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 09 20  test-names))... 
2590: 20 20 28 74 61 6c 20 28 63 64 72 20 74 65 73 74    (tal (cdr test
25a0: 2d 6e 61 6d 65 73 29 29 29 20 20 20 20 20 20 20  -names)))       
25b0: 20 20 3b 3b 20 27 72 65 74 75 72 6e 2d 70 72 6f    ;; 'return-pro
25c0: 63 73 20 74 65 6c 6c 73 20 74 68 65 20 63 6f 6e  cs tells the con
25d0: 66 69 67 20 72 65 61 64 65 72 20 74 6f 20 70 72  fig reader to pr
25e0: 65 70 20 72 75 6e 6e 69 6e 67 20 73 79 73 74 65  ep running syste
25f0: 6d 20 62 75 74 20 72 65 74 75 72 6e 20 61 20 70  m but return a p
2600: 72 6f 63 0a 09 20 20 28 64 65 62 75 67 3a 70 72  roc..  (debug:pr
2610: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 68 65 64 3d  int-info 4 "hed=
2620: 22 20 68 65 64 20 22 20 61 74 20 74 6f 70 20 6f  " hed " at top o
2630: 66 20 6c 6f 6f 70 22 29 0a 09 20 20 28 6c 65 74  f loop")..  (let
2640: 2a 20 28 28 63 6f 6e 66 69 67 20 20 28 74 65 73  * ((config  (tes
2650: 74 73 3a 67 65 74 2d 74 65 73 74 63 6f 6e 66 69  ts:get-testconfi
2660: 67 20 68 65 64 20 27 72 65 74 75 72 6e 2d 70 72  g hed 'return-pr
2670: 6f 63 73 29 29 0a 09 09 20 28 77 61 69 74 6f 6e  ocs))... (waiton
2680: 73 20 28 6c 65 74 20 28 28 69 6e 73 74 72 20 28  s (let ((instr (
2690: 69 66 20 63 6f 6e 66 69 67 20 0a 09 09 09 09 09  if config ......
26a0: 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75     (config-looku
26b0: 70 20 63 6f 6e 66 69 67 20 22 72 65 71 75 69 72  p config "requir
26c0: 65 6d 65 6e 74 73 22 20 22 77 61 69 74 6f 6e 22  ements" "waiton"
26d0: 29 0a 09 09 09 09 09 20 20 20 28 62 65 67 69 6e  )......   (begin
26e0: 20 3b 3b 20 4e 6f 20 63 6f 6e 66 69 67 20 6d 65   ;; No config me
26f0: 61 6e 73 20 74 68 69 73 20 69 73 20 61 20 6e 6f  ans this is a no
2700: 6e 2d 65 78 69 73 74 61 6e 74 20 74 65 73 74 0a  n-existant test.
2710: 09 09 09 09 09 20 20 20 20 20 28 64 65 62 75 67  .....     (debug
2720: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a  :print 0 "ERROR:
2730: 20 6e 6f 6e 2d 65 78 69 73 74 65 6e 74 20 72 65   non-existent re
2740: 71 75 69 72 65 64 20 74 65 73 74 20 5c 22 22 20  quired test \"" 
2750: 68 65 64 20 22 5c 22 22 29 0a 09 09 09 09 09 20  hed "\"")...... 
2760: 20 20 20 20 28 69 66 20 64 62 20 28 73 71 6c 69      (if db (sqli
2770: 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62  te3:finalize! db
2780: 29 29 0a 09 09 09 09 09 20 20 20 20 20 28 65 78  ))......     (ex
2790: 69 74 20 31 29 29 29 29 29 0a 09 09 09 20 20 20  it 1)))))....   
27a0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
27b0: 66 6f 20 38 20 22 77 61 69 74 6f 6e 73 20 73 74  fo 8 "waitons st
27c0: 72 69 6e 67 20 69 73 20 22 20 69 6e 73 74 72 29  ring is " instr)
27d0: 0a 09 09 09 20 20 20 20 28 73 74 72 69 6e 67 2d  ....    (string-
27e0: 73 70 6c 69 74 20 28 63 6f 6e 64 0a 09 09 09 09  split (cond.....
27f0: 09 20 20 20 28 28 70 72 6f 63 65 64 75 72 65 3f  .   ((procedure?
2800: 20 69 6e 73 74 72 29 0a 09 09 09 09 09 20 20 20   instr)......   
2810: 20 28 6c 65 74 20 28 28 72 65 73 20 28 69 6e 73   (let ((res (ins
2820: 74 72 29 29 29 0a 09 09 09 09 09 20 20 20 20 20  tr)))......     
2830: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
2840: 66 6f 20 38 20 22 77 61 69 74 6f 6e 20 70 72 6f  fo 8 "waiton pro
2850: 63 65 64 75 72 65 20 72 65 73 75 6c 74 73 20 69  cedure results i
2860: 6e 20 73 74 72 69 6e 67 20 22 20 72 65 73 20 22  n string " res "
2870: 20 66 6f 72 20 74 65 73 74 20 22 20 68 65 64 29   for test " hed)
2880: 0a 09 09 09 09 09 20 20 20 20 20 20 72 65 73 29  ......      res)
2890: 29 0a 09 09 09 09 09 20 20 20 28 28 73 74 72 69  )......   ((stri
28a0: 6e 67 3f 20 69 6e 73 74 72 29 20 20 20 20 20 69  ng? instr)     i
28b0: 6e 73 74 72 29 0a 09 09 09 09 09 20 20 20 28 65  nstr)......   (e
28c0: 6c 73 65 20 0a 09 09 09 09 09 20 20 20 20 3b 3b  lse ......    ;;
28d0: 20 4e 4f 54 45 3a 20 54 68 69 73 20 69 73 20 61   NOTE: This is a
28e0: 63 74 75 61 6c 6c 79 20 74 68 65 20 63 61 73 65  ctually the case
28f0: 20 6f 66 20 2a 6e 6f 2a 20 77 61 69 74 6f 6e 73   of *no* waitons
2900: 21 20 3b 3b 20 28 64 65 62 75 67 3a 70 72 69 6e  ! ;; (debug:prin
2910: 74 20 30 20 22 45 52 52 4f 52 3a 20 73 6f 6d 65  t 0 "ERROR: some
2920: 74 68 69 6e 67 20 77 65 6e 74 20 77 72 6f 6e 67  thing went wrong
2930: 20 69 6e 20 70 72 6f 63 65 73 73 69 6e 67 20 77   in processing w
2940: 61 69 74 6f 6e 73 20 66 6f 72 20 74 65 73 74 20  aitons for test 
2950: 22 20 68 65 64 29 0a 09 09 09 09 09 20 20 20 20  " hed)......    
2960: 22 22 29 29 29 29 29 29 0a 09 20 20 20 20 28 64  ""))))))..    (d
2970: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
2980: 38 20 22 77 61 69 74 6f 6e 73 3a 20 22 20 77 61  8 "waitons: " wa
2990: 69 74 6f 6e 73 29 0a 09 20 20 20 20 3b 3b 20 63  itons)..    ;; c
29a0: 68 65 63 6b 20 66 6f 72 20 68 65 64 20 69 6e 20  heck for hed in 
29b0: 77 61 69 74 6f 6e 73 20 3d 3e 20 74 68 69 73 20  waitons => this 
29c0: 77 6f 75 6c 64 20 62 65 20 63 69 72 63 75 6c 61  would be circula
29d0: 72 2c 20 72 65 6d 6f 76 65 20 69 74 20 61 6e 64  r, remove it and
29e0: 20 69 73 73 75 65 20 61 6e 0a 09 20 20 20 20 3b   issue an..    ;
29f0: 3b 20 65 72 72 6f 72 0a 09 20 20 20 20 28 69 66  ; error..    (if
2a00: 20 28 6d 65 6d 62 65 72 20 68 65 64 20 77 61 69   (member hed wai
2a10: 74 6f 6e 73 29 0a 09 09 28 62 65 67 69 6e 0a 09  tons)...(begin..
2a20: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  .  (debug:print 
2a30: 30 20 22 45 52 52 4f 52 3a 20 74 65 73 74 20 22  0 "ERROR: test "
2a40: 20 68 65 64 20 22 20 68 61 73 20 6c 69 73 74 65   hed " has liste
2a50: 64 20 69 74 73 65 6c 66 20 61 73 20 61 20 77 61  d itself as a wa
2a60: 69 74 6f 6e 2c 20 70 6c 65 61 73 65 20 63 6f 72  iton, please cor
2a70: 72 65 63 74 20 74 68 69 73 21 22 29 0a 09 09 20  rect this!")... 
2a80: 20 28 73 65 74 21 20 77 61 69 74 6f 6e 73 20 28   (set! waitons (
2a90: 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28  filter (lambda (
2aa0: 78 29 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 78  x)(not (equal? x
2ab0: 20 68 65 64 29 29 29 20 77 61 69 74 6f 6e 73 29   hed))) waitons)
2ac0: 29 29 29 0a 09 20 20 20 20 0a 09 20 20 20 20 3b  )))..    ..    ;
2ad0: 3b 20 28 69 74 65 6d 73 20 20 20 28 69 74 65 6d  ; (items   (item
2ae0: 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d  s:get-items-from
2af0: 2d 63 6f 6e 66 69 67 20 63 6f 6e 66 69 67 29 29  -config config))
2b00: 29 0a 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20  )..    (if (not 
2b10: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f  (hash-table-ref/
2b20: 64 65 66 61 75 6c 74 20 74 65 73 74 2d 72 65 63  default test-rec
2b30: 6f 72 64 73 20 68 65 64 20 23 66 29 29 0a 09 09  ords hed #f))...
2b40: 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21  (hash-table-set!
2b50: 20 74 65 73 74 2d 72 65 63 6f 72 64 73 0a 09 09   test-records...
2b60: 09 09 20 68 65 64 20 28 76 65 63 74 6f 72 20 68  .. hed (vector h
2b70: 65 64 20 20 20 20 20 3b 3b 20 30 0a 09 09 09 09  ed     ;; 0.....
2b80: 09 20 20 20 20 20 63 6f 6e 66 69 67 20 20 3b 3b  .     config  ;;
2b90: 20 31 0a 09 09 09 09 09 20 20 20 20 20 77 61 69   1......     wai
2ba0: 74 6f 6e 73 20 3b 3b 20 32 0a 09 09 09 09 09 20  tons ;; 2...... 
2bb0: 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b      (config-look
2bc0: 75 70 20 63 6f 6e 66 69 67 20 22 72 65 71 75 69  up config "requi
2bd0: 72 65 6d 65 6e 74 73 22 20 22 70 72 69 6f 72 69  rements" "priori
2be0: 74 79 22 29 20 20 20 20 20 3b 3b 20 70 72 69 6f  ty")     ;; prio
2bf0: 72 69 74 79 20 33 0a 09 09 09 09 09 20 20 20 20  rity 3......    
2c00: 20 28 6c 65 74 20 28 28 69 74 65 6d 73 20 20 20   (let ((items   
2c10: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72     (hash-table-r
2c20: 65 66 2f 64 65 66 61 75 6c 74 20 63 6f 6e 66 69  ef/default confi
2c30: 67 20 22 69 74 65 6d 73 22 20 23 66 29 29 20 3b  g "items" #f)) ;
2c40: 3b 20 69 74 65 6d 73 20 34 0a 09 09 09 09 09 09  ; items 4.......
2c50: 20 20 20 28 69 74 65 6d 73 74 61 62 6c 65 20 28     (itemstable (
2c60: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64  hash-table-ref/d
2c70: 65 66 61 75 6c 74 20 63 6f 6e 66 69 67 20 22 69  efault config "i
2c80: 74 65 6d 73 74 61 62 6c 65 22 20 23 66 29 29 29  temstable" #f)))
2c90: 20 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b   ......       ;;
2ca0: 20 69 66 20 65 69 74 68 65 72 20 69 74 65 6d 73   if either items
2cb0: 20 6f 72 20 69 74 65 6d 73 20 74 61 62 6c 65 20   or items table 
2cc0: 69 73 20 61 20 70 72 6f 63 20 72 65 74 75 72 6e  is a proc return
2cd0: 20 69 74 20 73 6f 20 74 65 73 74 20 72 75 6e 6e   it so test runn
2ce0: 69 6e 67 0a 09 09 09 09 09 20 20 20 20 20 20 20  ing......       
2cf0: 3b 3b 20 70 72 6f 63 65 73 73 20 63 61 6e 20 6b  ;; process can k
2d00: 6e 6f 77 20 74 6f 20 63 61 6c 6c 20 69 74 65 6d  now to call item
2d10: 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d  s:get-items-from
2d20: 2d 63 6f 6e 66 69 67 0a 09 09 09 09 09 20 20 20  -config......   
2d30: 20 20 20 20 3b 3b 20 69 66 20 65 69 74 68 65 72      ;; if either
2d40: 20 69 73 20 61 20 6c 69 73 74 20 61 6e 64 20 6e   is a list and n
2d50: 6f 6e 65 20 69 73 20 61 20 70 72 6f 63 20 67 6f  one is a proc go
2d60: 20 61 68 65 61 64 20 61 6e 64 20 63 61 6c 6c 20   ahead and call 
2d70: 67 65 74 2d 69 74 65 6d 73 0a 09 09 09 09 09 20  get-items...... 
2d80: 20 20 20 20 20 20 3b 3b 20 6f 74 68 65 72 77 69        ;; otherwi
2d90: 73 65 20 72 65 74 75 72 6e 20 23 66 20 2d 20 74  se return #f - t
2da0: 68 69 73 20 69 73 20 6e 6f 74 20 61 6e 20 69 74  his is not an it
2db0: 65 72 61 74 65 64 20 74 65 73 74 0a 09 09 09 09  erated test.....
2dc0: 09 20 20 20 20 20 20 20 28 63 6f 6e 64 0a 09 09  .       (cond...
2dd0: 09 09 09 09 28 28 70 72 6f 63 65 64 75 72 65 3f  ....((procedure?
2de0: 20 69 74 65 6d 73 29 20 20 20 20 20 20 0a 09 09   items)      ...
2df0: 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e  .... (debug:prin
2e00: 74 2d 69 6e 66 6f 20 34 20 22 69 74 65 6d 73 20  t-info 4 "items 
2e10: 69 73 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20  is a procedure, 
2e20: 77 69 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72 22  will calc later"
2e30: 29 0a 09 09 09 09 09 09 20 69 74 65 6d 73 29 20  )....... items) 
2e40: 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 63 61             ;; ca
2e50: 6c 63 20 6c 61 74 65 72 0a 09 09 09 09 09 09 28  lc later.......(
2e60: 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d  (procedure? item
2e70: 73 74 61 62 6c 65 29 0a 09 09 09 09 09 09 20 28  stable)....... (
2e80: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
2e90: 20 34 20 22 69 74 65 6d 73 74 61 62 6c 65 20 69   4 "itemstable i
2ea0: 73 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20 77  s a procedure, w
2eb0: 69 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72 22 29  ill calc later")
2ec0: 0a 09 09 09 09 09 09 20 69 74 65 6d 73 74 61 62  ....... itemstab
2ed0: 6c 65 29 20 20 20 20 20 20 20 3b 3b 20 63 61 6c  le)       ;; cal
2ee0: 63 20 6c 61 74 65 72 0a 09 09 09 09 09 09 28 28  c later.......((
2ef0: 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28  filter (lambda (
2f00: 78 29 0a 09 09 09 09 09 09 09 20 20 20 28 6c 65  x)........   (le
2f10: 74 20 28 28 76 61 6c 20 28 63 61 72 20 78 29 29  t ((val (car x))
2f20: 29 0a 09 09 09 09 09 09 09 20 20 20 20 20 28 69  )........     (i
2f30: 66 20 28 70 72 6f 63 65 64 75 72 65 3f 20 76 61  f (procedure? va
2f40: 6c 29 20 76 61 6c 20 23 66 29 29 29 0a 09 09 09  l) val #f)))....
2f50: 09 09 09 09 20 28 61 70 70 65 6e 64 20 28 69 66  .... (append (if
2f60: 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 69   (list? items) i
2f70: 74 65 6d 73 20 27 28 29 29 0a 09 09 09 09 09 09  tems '()).......
2f80: 09 09 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74  .. (if (list? it
2f90: 65 6d 73 74 61 62 6c 65 29 20 69 74 65 6d 73 74  emstable) itemst
2fa0: 61 62 6c 65 20 27 28 29 29 29 29 0a 09 09 09 09  able '()))).....
2fb0: 09 09 20 27 68 61 76 65 2d 70 72 6f 63 65 64 75  .. 'have-procedu
2fc0: 72 65 29 0a 09 09 09 09 09 09 28 28 6f 72 20 28  re).......((or (
2fd0: 6c 69 73 74 3f 20 69 74 65 6d 73 29 28 6c 69 73  list? items)(lis
2fe0: 74 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 29 20  t? itemstable)) 
2ff0: 3b 3b 20 63 61 6c 63 20 6e 6f 77 0a 09 09 09 09  ;; calc now.....
3000: 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d  .. (debug:print-
3010: 69 6e 66 6f 20 34 20 22 69 74 65 6d 73 20 61 6e  info 4 "items an
3020: 64 20 69 74 65 6d 73 74 61 62 6c 65 20 61 72 65  d itemstable are
3030: 20 6c 69 73 74 73 2c 20 63 61 6c 63 20 6e 6f 77   lists, calc now
3040: 5c 6e 22 0a 09 09 09 09 09 09 09 20 20 20 20 20  \n"........     
3050: 20 22 20 20 20 20 69 74 65 6d 73 3a 20 22 20 69   "    items: " i
3060: 74 65 6d 73 20 22 20 69 74 65 6d 73 74 61 62 6c  tems " itemstabl
3070: 65 3a 20 22 20 69 74 65 6d 73 74 61 62 6c 65 29  e: " itemstable)
3080: 0a 09 09 09 09 09 09 20 28 69 74 65 6d 73 3a 67  ....... (items:g
3090: 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f  et-items-from-co
30a0: 6e 66 69 67 20 63 6f 6e 66 69 67 29 29 0a 09 09  nfig config))...
30b0: 09 09 09 09 28 65 6c 73 65 20 23 66 29 29 29 20  ....(else #f))) 
30c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
30d0: 20 20 20 20 20 20 20 20 20 20 3b 3b 20 6e 6f 74            ;; not
30e0: 20 69 74 65 72 61 74 65 64 0a 09 09 09 09 09 20   iterated...... 
30f0: 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b 20 69      #f      ;; i
3100: 74 65 6d 73 64 61 74 20 35 0a 09 09 09 09 09 20  temsdat 5...... 
3110: 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b 20 73      #f      ;; s
3120: 70 61 72 65 20 2d 20 75 73 65 64 20 66 6f 72 20  pare - used for 
3130: 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 09 09 20  item-path...... 
3140: 20 20 20 20 29 29 29 0a 09 20 20 20 20 28 66 6f      )))..    (fo
3150: 72 2d 65 61 63 68 20 0a 09 20 20 20 20 20 28 6c  r-each ..     (l
3160: 61 6d 62 64 61 20 28 77 61 69 74 6f 6e 29 0a 09  ambda (waiton)..
3170: 20 20 20 20 20 20 20 28 69 66 20 28 61 6e 64 20         (if (and 
3180: 77 61 69 74 6f 6e 20 28 6e 6f 74 20 28 6d 65 6d  waiton (not (mem
3190: 62 65 72 20 77 61 69 74 6f 6e 20 74 65 73 74 2d  ber waiton test-
31a0: 6e 61 6d 65 73 29 29 29 0a 09 09 20 20 20 28 62  names)))...   (b
31b0: 65 67 69 6e 0a 09 09 20 20 20 20 20 28 73 65 74  egin...     (set
31c0: 21 20 72 65 71 75 69 72 65 64 2d 74 65 73 74 73  ! required-tests
31d0: 20 28 63 6f 6e 73 20 77 61 69 74 6f 6e 20 72 65   (cons waiton re
31e0: 71 75 69 72 65 64 2d 74 65 73 74 73 29 29 0a 09  quired-tests))..
31f0: 09 20 20 20 20 20 28 73 65 74 21 20 74 65 73 74  .     (set! test
3200: 2d 6e 61 6d 65 73 20 28 63 6f 6e 73 20 77 61 69  -names (cons wai
3210: 74 6f 6e 20 74 65 73 74 2d 6e 61 6d 65 73 29 29  ton test-names))
3220: 29 29 29 20 3b 3b 20 77 61 73 20 61 6e 20 61 70  ))) ;; was an ap
3230: 70 65 6e 64 2c 20 6e 6f 77 20 61 20 63 6f 6e 73  pend, now a cons
3240: 0a 09 20 20 20 20 20 77 61 69 74 6f 6e 73 29 0a  ..     waitons).
3250: 09 20 20 20 20 28 6c 65 74 20 28 28 72 65 6d 74  .    (let ((remt
3260: 65 73 74 73 20 28 64 65 6c 65 74 65 2d 64 75 70  ests (delete-dup
3270: 6c 69 63 61 74 65 73 20 28 61 70 70 65 6e 64 20  licates (append 
3280: 77 61 69 74 6f 6e 73 20 74 61 6c 29 29 29 29 0a  waitons tal)))).
3290: 09 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20  .      (if (not 
32a0: 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29  (null? remtests)
32b0: 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72  )...  (loop (car
32c0: 20 72 65 6d 74 65 73 74 73 29 28 63 64 72 20 72   remtests)(cdr r
32d0: 65 6d 74 65 73 74 73 29 29 29 29 29 29 29 0a 0a  emtests)))))))..
32e0: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75      (if (not (nu
32f0: 6c 6c 3f 20 72 65 71 75 69 72 65 64 2d 74 65 73  ll? required-tes
3300: 74 73 29 29 0a 09 28 64 65 62 75 67 3a 70 72 69  ts))..(debug:pri
3310: 6e 74 2d 69 6e 66 6f 20 31 20 22 41 64 64 69 6e  nt-info 1 "Addin
3320: 67 20 22 20 72 65 71 75 69 72 65 64 2d 74 65 73  g " required-tes
3330: 74 73 20 22 20 74 6f 20 74 68 65 20 72 75 6e 20  ts " to the run 
3340: 71 75 65 75 65 22 29 29 0a 20 20 20 20 3b 3b 20  queue")).    ;; 
3350: 4e 4f 54 45 3a 20 74 68 65 73 65 20 61 72 65 20  NOTE: these are 
3360: 61 6c 6c 20 70 61 72 65 6e 74 20 74 65 73 74 73  all parent tests
3370: 2c 20 69 74 65 6d 73 20 61 72 65 20 6e 6f 74 20  , items are not 
3380: 65 78 70 61 6e 64 65 64 20 79 65 74 2e 0a 20 20  expanded yet..  
3390: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69    (debug:print-i
33a0: 6e 66 6f 20 34 20 22 74 65 73 74 2d 72 65 63 6f  nfo 4 "test-reco
33b0: 72 64 73 3d 22 20 28 68 61 73 68 2d 74 61 62 6c  rds=" (hash-tabl
33c0: 65 2d 3e 61 6c 69 73 74 20 74 65 73 74 2d 72 65  e->alist test-re
33d0: 63 6f 72 64 73 29 29 0a 20 20 20 20 28 72 75 6e  cords)).    (run
33e0: 73 3a 72 75 6e 2d 74 65 73 74 73 2d 71 75 65 75  s:run-tests-queu
33f0: 65 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65  e run-id runname
3400: 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 6b 65   test-records ke
3410: 79 76 61 6c 6c 73 74 20 66 6c 61 67 73 20 74 65  yvallst flags te
3420: 73 74 2d 70 61 74 74 73 29 0a 20 20 20 20 28 64  st-patts).    (d
3430: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
3440: 34 20 22 41 6c 6c 20 64 6f 6e 65 20 62 79 20 68  4 "All done by h
3450: 65 72 65 22 29 29 29 0a 0a 28 64 65 66 69 6e 65  ere")))..(define
3460: 20 28 72 75 6e 73 3a 63 61 6c 63 2d 66 61 69 6c   (runs:calc-fail
3470: 73 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65  s prereqs-not-me
3480: 74 29 0a 20 20 28 66 69 6c 74 65 72 20 28 6c 61  t).  (filter (la
3490: 6d 62 64 61 20 28 74 65 73 74 29 0a 09 20 20 20  mbda (test)..   
34a0: 20 28 61 6e 64 20 28 76 65 63 74 6f 72 3f 20 74   (and (vector? t
34b0: 65 73 74 29 20 3b 3b 20 6e 6f 74 20 28 73 74 72  est) ;; not (str
34c0: 69 6e 67 3f 20 74 65 73 74 29 29 0a 09 09 20 28  ing? test))... (
34d0: 65 71 75 61 6c 3f 20 28 64 62 3a 74 65 73 74 2d  equal? (db:test-
34e0: 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 29 20  get-state test) 
34f0: 22 43 4f 4d 50 4c 45 54 45 44 22 29 0a 09 09 20  "COMPLETED")... 
3500: 28 6e 6f 74 20 28 6d 65 6d 62 65 72 20 28 64 62  (not (member (db
3510: 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73  :test-get-status
3520: 20 74 65 73 74 29 0a 09 09 09 20 20 20 20 20 20   test)....      
3530: 27 28 22 50 41 53 53 22 20 22 57 41 52 4e 22 20  '("PASS" "WARN" 
3540: 22 43 48 45 43 4b 22 20 22 57 41 49 56 45 44 22  "CHECK" "WAIVED"
3550: 20 22 53 4b 49 50 22 29 29 29 29 29 0a 09 20 20   "SKIP")))))..  
3560: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29  prereqs-not-met)
3570: 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73  )..(define (runs
3580: 3a 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65  :calc-not-comple
3590: 74 65 64 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d  ted prereqs-not-
35a0: 6d 65 74 29 0a 20 20 28 66 69 6c 74 65 72 0a 20  met).  (filter. 
35b0: 20 20 28 6c 61 6d 62 64 61 20 28 74 29 0a 20 20    (lambda (t).  
35c0: 20 20 20 28 6f 72 20 28 6e 6f 74 20 28 76 65 63     (or (not (vec
35d0: 74 6f 72 3f 20 74 29 29 0a 09 20 28 6e 6f 74 20  tor? t)).. (not 
35e0: 28 65 71 75 61 6c 3f 20 22 43 4f 4d 50 4c 45 54  (equal? "COMPLET
35f0: 45 44 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74  ED" (db:test-get
3600: 2d 73 74 61 74 65 20 74 29 29 29 29 29 0a 20 20  -state t))))).  
3610: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74   prereqs-not-met
3620: 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e  ))..(define (run
3630: 73 3a 70 72 65 74 74 79 2d 73 74 72 69 6e 67 20  s:pretty-string 
3640: 6c 73 74 29 0a 20 20 28 6d 61 70 20 28 6c 61 6d  lst).  (map (lam
3650: 62 64 61 20 28 74 29 0a 09 20 28 69 66 20 28 6e  bda (t).. (if (n
3660: 6f 74 20 28 76 65 63 74 6f 72 3f 20 74 29 29 0a  ot (vector? t)).
3670: 09 20 20 20 20 20 28 63 6f 6e 63 20 74 29 0a 09  .     (conc t)..
3680: 20 20 20 20 20 28 63 6f 6e 63 20 28 64 62 3a 74       (conc (db:t
3690: 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65  est-get-testname
36a0: 20 74 29 20 22 3a 22 20 28 64 62 3a 74 65 73 74   t) ":" (db:test
36b0: 2d 67 65 74 2d 73 74 61 74 65 20 74 29 20 22 2f  -get-state t) "/
36c0: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73  " (db:test-get-s
36d0: 74 61 74 75 73 20 74 29 29 29 29 0a 20 20 20 20  tatus t)))).    
36e0: 20 20 20 6c 73 74 29 29 0a 0a 28 64 65 66 69 6e     lst))..(defin
36f0: 65 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c  e (runs:make-ful
3700: 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74  l-test-name test
3710: 6e 61 6d 65 20 69 74 65 6d 70 61 74 68 29 0a 20  name itempath). 
3720: 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65   (if (equal? ite
3730: 6d 70 61 74 68 20 22 22 29 20 74 65 73 74 6e 61  mpath "") testna
3740: 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d  me (conc testnam
3750: 65 20 22 2f 22 20 69 74 65 6d 70 61 74 68 29 29  e "/" itempath))
3760: 29 0a 0a 3b 3b 20 74 65 73 74 2d 72 65 63 6f 72  )..;; test-recor
3770: 64 73 20 69 73 20 61 20 68 61 73 68 20 74 61 62  ds is a hash tab
3780: 6c 65 20 74 65 73 74 6e 61 6d 65 3a 69 74 65 6d  le testname:item
3790: 5f 70 61 74 68 20 3d 3e 20 76 65 63 74 6f 72 20  _path => vector 
37a0: 3c 20 74 65 73 74 6e 61 6d 65 20 74 65 73 74 63  < testname testc
37b0: 6f 6e 66 69 67 20 77 61 69 74 6f 6e 73 20 70 72  onfig waitons pr
37c0: 69 6f 72 69 74 79 20 69 74 65 6d 73 2d 69 6e 66  iority items-inf
37d0: 6f 20 2e 2e 2e 20 3e 0a 28 64 65 66 69 6e 65 20  o ... >.(define 
37e0: 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d  (runs:run-tests-
37f0: 71 75 65 75 65 20 72 75 6e 2d 69 64 20 72 75 6e  queue run-id run
3800: 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64  name test-record
3810: 73 20 6b 65 79 76 61 6c 6c 73 74 20 66 6c 61 67  s keyvallst flag
3820: 73 20 74 65 73 74 2d 70 61 74 74 73 29 0a 20 20  s test-patts).  
3830: 20 20 3b 3b 20 41 74 20 74 68 69 73 20 70 6f 69    ;; At this poi
3840: 6e 74 20 74 68 65 20 6c 69 73 74 20 6f 66 20 70  nt the list of p
3850: 61 72 65 6e 74 20 74 65 73 74 73 20 69 73 20 65  arent tests is e
3860: 78 70 61 6e 64 65 64 20 0a 20 20 20 20 3b 3b 20  xpanded .    ;; 
3870: 4e 42 2f 2f 20 53 68 6f 75 6c 64 20 65 78 70 61  NB// Should expa
3880: 6e 64 20 69 74 65 6d 73 20 68 65 72 65 20 61 6e  nd items here an
3890: 64 20 74 68 65 6e 20 69 6e 73 65 72 74 20 69 6e  d then insert in
38a0: 74 6f 20 74 68 65 20 72 75 6e 20 71 75 65 75 65  to the run queue
38b0: 2e 0a 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ..  (debug:print
38c0: 20 35 20 22 74 65 73 74 2d 72 65 63 6f 72 64 73   5 "test-records
38d0: 3a 20 22 20 74 65 73 74 2d 72 65 63 6f 72 64 73  : " test-records
38e0: 20 22 2c 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22   ", keyvallst: "
38f0: 20 6b 65 79 76 61 6c 6c 73 74 20 22 20 66 6c 61   keyvallst " fla
3900: 67 73 3a 20 22 20 28 68 61 73 68 2d 74 61 62 6c  gs: " (hash-tabl
3910: 65 2d 3e 61 6c 69 73 74 20 66 6c 61 67 73 29 29  e->alist flags))
3920: 0a 20 20 28 6c 65 74 20 28 28 73 6f 72 74 65 64  .  (let ((sorted
3930: 2d 74 65 73 74 2d 6e 61 6d 65 73 20 28 74 65 73  -test-names (tes
3940: 74 73 3a 73 6f 72 74 2d 62 79 2d 70 72 69 6f 72  ts:sort-by-prior
3950: 69 74 79 2d 61 6e 64 2d 77 61 69 74 6f 6e 20 74  ity-and-waiton t
3960: 65 73 74 2d 72 65 63 6f 72 64 73 29 29 0a 09 28  est-records))..(
3970: 74 65 73 74 2d 72 65 67 69 73 74 65 72 79 20 20  test-registery  
3980: 20 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62    (make-hash-tab
3990: 6c 65 29 29 0a 09 28 6e 75 6d 2d 72 65 74 72 69  le))..(num-retri
39a0: 65 73 20 20 20 20 20 20 20 20 30 29 0a 09 28 6d  es        0)..(m
39b0: 61 78 2d 72 65 74 72 69 65 73 20 20 20 20 20 20  ax-retries      
39c0: 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20   (config-lookup 
39d0: 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 73 65 74  *configdat* "set
39e0: 75 70 22 20 22 6d 61 78 72 65 74 72 69 65 73 22  up" "maxretries"
39f0: 29 29 29 0a 20 20 20 20 28 73 65 74 21 20 6d 61  ))).    (set! ma
3a00: 78 2d 72 65 74 72 69 65 73 20 28 69 66 20 28 61  x-retries (if (a
3a10: 6e 64 20 6d 61 78 2d 72 65 74 72 69 65 73 20 28  nd max-retries (
3a20: 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d  string->number m
3a30: 61 78 2d 72 65 74 72 69 65 73 29 29 28 73 74 72  ax-retries))(str
3a40: 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 61 78 2d  ing->number max-
3a50: 72 65 74 72 69 65 73 29 20 31 30 30 29 29 0a 20  retries) 100)). 
3a60: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c     (if (not (nul
3a70: 6c 3f 20 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e  l? sorted-test-n
3a80: 61 6d 65 73 29 29 0a 09 28 6c 65 74 20 6c 6f 6f  ames))..(let loo
3a90: 70 20 28 28 68 65 64 20 20 20 20 20 20 20 20 20  p ((hed         
3aa0: 28 63 61 72 20 73 6f 72 74 65 64 2d 74 65 73 74  (car sorted-test
3ab0: 2d 6e 61 6d 65 73 29 29 0a 09 09 20 20 20 28 74  -names))...   (t
3ac0: 61 6c 20 20 20 20 20 20 20 20 20 28 63 64 72 20  al         (cdr 
3ad0: 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65  sorted-test-name
3ae0: 73 29 29 0a 09 09 20 20 20 28 72 65 72 75 6e 73  s))...   (reruns
3af0: 20 20 20 20 20 20 27 28 29 29 29 0a 09 20 20 28        '()))..  (
3b00: 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72  if (not (null? r
3b10: 65 72 75 6e 73 29 29 28 64 65 62 75 67 3a 70 72  eruns))(debug:pr
3b20: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 72 65 72 75  int-info 4 "reru
3b30: 6e 73 3d 22 20 72 65 72 75 6e 73 29 29 0a 09 20  ns=" reruns)).. 
3b40: 20 3b 3b 20 28 70 72 69 6e 74 20 22 54 6f 70 20   ;; (print "Top 
3b50: 6f 66 20 6c 6f 6f 70 2c 20 68 65 64 3d 22 20 68  of loop, hed=" h
3b60: 65 64 20 22 2c 20 74 61 6c 3d 22 20 74 61 6c 20  ed ", tal=" tal 
3b70: 22 20 2c 72 65 72 75 6e 73 3d 22 20 72 65 72 75  " ,reruns=" reru
3b80: 6e 73 29 0a 09 20 20 28 6c 65 74 2a 20 28 28 74  ns)..  (let* ((t
3b90: 65 73 74 2d 72 65 63 6f 72 64 20 28 68 61 73 68  est-record (hash
3ba0: 2d 74 61 62 6c 65 2d 72 65 66 20 74 65 73 74 2d  -table-ref test-
3bb0: 72 65 63 6f 72 64 73 20 68 65 64 29 29 0a 09 09  records hed))...
3bc0: 20 28 74 65 73 74 2d 6e 61 6d 65 20 20 20 28 74   (test-name   (t
3bd0: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67  ests:testqueue-g
3be0: 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74  et-testname test
3bf0: 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 28 74 63  -record))... (tc
3c00: 6f 6e 66 69 67 20 20 20 20 20 28 74 65 73 74 73  onfig     (tests
3c10: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74  :testqueue-get-t
3c20: 65 73 74 63 6f 6e 66 69 67 20 74 65 73 74 2d 72  estconfig test-r
3c30: 65 63 6f 72 64 29 29 0a 09 09 20 28 74 65 73 74  ecord))... (test
3c40: 6d 6f 64 65 20 20 20 20 28 6c 65 74 20 28 28 6d  mode    (let ((m
3c50: 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20   (config-lookup 
3c60: 74 63 6f 6e 66 69 67 20 22 72 65 71 75 69 72 65  tconfig "require
3c70: 6d 65 6e 74 73 22 20 22 6d 6f 64 65 22 29 29 29  ments" "mode")))
3c80: 0a 09 09 09 09 28 69 66 20 6d 20 28 73 74 72 69  .....(if m (stri
3c90: 6e 67 2d 3e 73 79 6d 62 6f 6c 20 6d 29 20 27 6e  ng->symbol m) 'n
3ca0: 6f 72 6d 61 6c 29 29 29 0a 09 09 20 28 77 61 69  ormal)))... (wai
3cb0: 74 6f 6e 73 20 20 20 20 20 28 74 65 73 74 73 3a  tons     (tests:
3cc0: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 77 61  testqueue-get-wa
3cd0: 69 74 6f 6e 73 20 20 20 20 74 65 73 74 2d 72 65  itons    test-re
3ce0: 63 6f 72 64 29 29 0a 09 09 20 28 70 72 69 6f 72  cord))... (prior
3cf0: 69 74 79 20 20 20 20 28 74 65 73 74 73 3a 74 65  ity    (tests:te
3d00: 73 74 71 75 65 75 65 2d 67 65 74 2d 70 72 69 6f  stqueue-get-prio
3d10: 72 69 74 79 20 20 20 74 65 73 74 2d 72 65 63 6f  rity   test-reco
3d20: 72 64 29 29 0a 09 09 20 28 69 74 65 6d 64 61 74  rd))... (itemdat
3d30: 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74       (tests:test
3d40: 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d 64 61  queue-get-itemda
3d50: 74 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64  t    test-record
3d60: 29 29 20 3b 3b 20 69 74 65 6d 64 61 74 20 63 61  )) ;; itemdat ca
3d70: 6e 20 62 65 20 61 20 73 74 72 69 6e 67 2c 20 6c  n be a string, l
3d80: 69 73 74 20 6f 72 20 23 66 0a 09 09 20 28 69 74  ist or #f... (it
3d90: 65 6d 73 20 20 20 20 20 20 20 28 74 65 73 74 73  ems       (tests
3da0: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 69  :testqueue-get-i
3db0: 74 65 6d 73 20 20 20 20 20 20 74 65 73 74 2d 72  tems      test-r
3dc0: 65 63 6f 72 64 29 29 0a 09 09 20 28 69 74 65 6d  ecord))... (item
3dd0: 2d 70 61 74 68 20 20 20 28 69 74 65 6d 2d 6c 69  -path   (item-li
3de0: 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74  st->path itemdat
3df0: 29 29 0a 09 09 20 28 6e 65 77 74 61 6c 20 20 20  ))... (newtal   
3e00: 20 20 20 28 61 70 70 65 6e 64 20 74 61 6c 20 28     (append tal (
3e10: 6c 69 73 74 20 68 65 64 29 29 29 29 0a 09 20 20  list hed))))..  
3e20: 20 20 0a 09 20 20 20 20 28 64 65 62 75 67 3a 70    ..    (debug:p
3e30: 72 69 6e 74 20 36 0a 09 09 09 20 22 74 65 73 74  rint 6.... "test
3e40: 2d 6e 61 6d 65 3a 20 22 20 74 65 73 74 2d 6e 61  -name: " test-na
3e50: 6d 65 0a 09 09 09 20 22 5c 6e 20 20 68 65 64 3a  me.... "\n  hed:
3e60: 20 20 20 20 20 20 20 20 20 22 20 68 65 64 0a 09           " hed..
3e70: 09 09 20 22 5c 6e 20 20 69 74 65 6d 64 61 74 3a  .. "\n  itemdat:
3e80: 20 20 20 20 20 22 20 69 74 65 6d 64 61 74 0a 09       " itemdat..
3e90: 09 09 20 22 5c 6e 20 20 69 74 65 6d 73 3a 20 20  .. "\n  items:  
3ea0: 20 20 20 20 20 22 20 69 74 65 6d 73 0a 09 09 09       " items....
3eb0: 20 22 5c 6e 20 20 69 74 65 6d 2d 70 61 74 68 3a   "\n  item-path:
3ec0: 20 20 20 22 20 69 74 65 6d 2d 70 61 74 68 0a 09     " item-path..
3ed0: 09 09 20 22 5c 6e 20 20 77 61 69 74 6f 6e 73 3a  .. "\n  waitons:
3ee0: 20 20 20 20 20 22 20 77 61 69 74 6f 6e 73 0a 09       " waitons..
3ef0: 09 09 20 22 5c 6e 20 20 6e 75 6d 2d 72 65 74 72  .. "\n  num-retr
3f00: 69 65 73 3a 20 22 20 6e 75 6d 2d 72 65 74 72 69  ies: " num-retri
3f10: 65 73 0a 09 09 09 20 22 5c 6e 20 20 74 61 6c 3a  es.... "\n  tal:
3f20: 20 20 20 20 20 20 20 20 20 22 20 74 61 6c 0a 09           " tal..
3f30: 09 09 20 22 5c 6e 20 20 72 65 72 75 6e 73 3a 20  .. "\n  reruns: 
3f40: 20 20 20 20 20 22 20 72 65 72 75 6e 73 29 0a 0a       " reruns)..
3f50: 09 20 20 20 20 3b 3b 20 63 68 65 63 6b 20 66 6f  .    ;; check fo
3f60: 72 20 68 65 64 20 69 6e 20 77 61 69 74 6f 6e 73  r hed in waitons
3f70: 20 3d 3e 20 74 68 69 73 20 77 6f 75 6c 64 20 62   => this would b
3f80: 65 20 63 69 72 63 75 6c 61 72 2c 20 72 65 6d 6f  e circular, remo
3f90: 76 65 20 69 74 20 61 6e 64 20 69 73 73 75 65 20  ve it and issue 
3fa0: 61 6e 0a 09 20 20 20 20 3b 3b 20 65 72 72 6f 72  an..    ;; error
3fb0: 0a 09 20 20 20 20 28 69 66 20 28 6d 65 6d 62 65  ..    (if (membe
3fc0: 72 20 74 65 73 74 2d 6e 61 6d 65 20 77 61 69 74  r test-name wait
3fd0: 6f 6e 73 29 0a 09 09 28 62 65 67 69 6e 0a 09 09  ons)...(begin...
3fe0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
3ff0: 20 22 45 52 52 4f 52 3a 20 74 65 73 74 20 22 20   "ERROR: test " 
4000: 74 65 73 74 2d 6e 61 6d 65 20 22 20 68 61 73 20  test-name " has 
4010: 6c 69 73 74 65 64 20 69 74 73 65 6c 66 20 61 73  listed itself as
4020: 20 61 20 77 61 69 74 6f 6e 2c 20 70 6c 65 61 73   a waiton, pleas
4030: 65 20 63 6f 72 72 65 63 74 20 74 68 69 73 21 22  e correct this!"
4040: 29 0a 09 09 20 20 28 73 65 74 21 20 77 61 69 74  )...  (set! wait
4050: 6f 6e 20 28 66 69 6c 74 65 72 20 28 6c 61 6d 62  on (filter (lamb
4060: 64 61 20 28 78 29 28 6e 6f 74 20 28 65 71 75 61  da (x)(not (equa
4070: 6c 3f 20 78 20 68 65 64 29 29 29 20 77 61 69 74  l? x hed))) wait
4080: 6f 6e 73 29 29 29 29 0a 0a 09 20 20 20 20 28 63  ons))))...    (c
4090: 6f 6e 64 20 3b 3b 20 4f 55 54 45 52 20 43 4f 4e  ond ;; OUTER CON
40a0: 44 0a 09 20 20 20 20 20 28 28 6e 6f 74 20 69 74  D..     ((not it
40b0: 65 6d 73 29 20 3b 3b 20 77 68 65 6e 20 66 61 6c  ems) ;; when fal
40c0: 73 65 20 74 68 65 20 74 65 73 74 20 69 73 20 6f  se the test is o
40d0: 6b 20 74 6f 20 62 65 20 68 61 6e 64 65 64 20 6f  k to be handed o
40e0: 66 66 20 74 6f 20 6c 61 75 6e 63 68 20 28 62 75  ff to launch (bu
40f0: 74 20 6e 6f 74 20 62 65 66 6f 72 65 29 0a 09 20  t not before).. 
4100: 20 20 20 20 20 28 6c 65 74 2a 20 28 28 72 75 6e       (let* ((run
4110: 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 20 20 20  -limits-info    
4120: 20 20 20 20 20 28 72 75 6e 73 3a 63 61 6e 2d 72       (runs:can-r
4130: 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 74 65  un-more-tests te
4140: 73 74 2d 72 65 63 6f 72 64 29 29 20 3b 3b 20 6c  st-record)) ;; l
4150: 6f 6f 6b 20 61 74 20 74 68 65 20 74 65 73 74 20  ook at the test 
4160: 6a 6f 62 67 72 6f 75 70 20 61 6e 64 20 74 6f 74  jobgroup and tot
4170: 20 6a 6f 62 73 20 72 75 6e 6e 69 6e 67 0a 09 09   jobs running...
4180: 20 20 20 20 20 28 68 61 76 65 2d 72 65 73 6f 75       (have-resou
4190: 72 63 65 73 20 20 20 20 20 20 20 20 20 20 28 63  rces          (c
41a0: 61 72 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e  ar run-limits-in
41b0: 66 6f 29 29 0a 09 09 20 20 20 20 20 28 6e 75 6d  fo))...     (num
41c0: 2d 72 75 6e 6e 69 6e 67 20 20 20 20 20 20 20 20  -running        
41d0: 20 20 20 20 20 28 6c 69 73 74 2d 72 65 66 20 72       (list-ref r
41e0: 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 31  un-limits-info 1
41f0: 29 29 0a 09 09 20 20 20 20 20 28 6e 75 6d 2d 72  ))...     (num-r
4200: 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f  unning-in-jobgro
4210: 75 70 20 28 6c 69 73 74 2d 72 65 66 20 72 75 6e  up (list-ref run
4220: 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 32 29 29  -limits-info 2))
4230: 0a 09 09 20 20 20 20 20 28 6d 61 78 2d 63 6f 6e  ...     (max-con
4240: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 20 20 20  current-jobs    
4250: 20 28 6c 69 73 74 2d 72 65 66 20 72 75 6e 2d 6c   (list-ref run-l
4260: 69 6d 69 74 73 2d 69 6e 66 6f 20 33 29 29 0a 09  imits-info 3))..
4270: 09 20 20 20 20 20 28 6a 6f 62 2d 67 72 6f 75 70  .     (job-group
4280: 2d 6c 69 6d 69 74 20 20 20 20 20 20 20 20 20 28  -limit         (
4290: 6c 69 73 74 2d 72 65 66 20 72 75 6e 2d 6c 69 6d  list-ref run-lim
42a0: 69 74 73 2d 69 6e 66 6f 20 34 29 29 0a 09 09 20  its-info 4))... 
42b0: 20 20 20 20 28 70 72 65 72 65 71 73 2d 6e 6f 74      (prereqs-not
42c0: 2d 6d 65 74 20 20 20 20 20 20 20 20 20 28 63 64  -met         (cd
42d0: 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64 62 3a  b:remote-run db:
42e0: 67 65 74 2d 70 72 65 72 65 71 73 2d 6e 6f 74 2d  get-prereqs-not-
42f0: 6d 65 74 20 23 66 20 72 75 6e 2d 69 64 20 77 61  met #f run-id wa
4300: 69 74 6f 6e 73 20 69 74 65 6d 2d 70 61 74 68 20  itons item-path 
4310: 6d 6f 64 65 3a 20 74 65 73 74 6d 6f 64 65 29 29  mode: testmode))
4320: 0a 09 09 20 20 20 20 20 28 66 61 69 6c 73 20 20  ...     (fails  
4330: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
4340: 20 28 72 75 6e 73 3a 63 61 6c 63 2d 66 61 69 6c   (runs:calc-fail
4350: 73 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65  s prereqs-not-me
4360: 74 29 29 0a 09 09 20 20 20 20 20 28 6e 6f 6e 2d  t))...     (non-
4370: 63 6f 6d 70 6c 65 74 65 64 20 20 20 20 20 20 20  completed       
4380: 20 20 20 20 28 72 75 6e 73 3a 63 61 6c 63 2d 6e      (runs:calc-n
4390: 6f 74 2d 63 6f 6d 70 6c 65 74 65 64 20 70 72 65  ot-completed pre
43a0: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a  reqs-not-met))).
43b0: 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69  ..(debug:print-i
43c0: 6e 66 6f 20 38 20 22 68 61 76 65 2d 72 65 73 6f  nfo 8 "have-reso
43d0: 75 72 63 65 73 3a 20 22 20 68 61 76 65 2d 72 65  urces: " have-re
43e0: 73 6f 75 72 63 65 73 20 22 20 70 72 65 72 65 71  sources " prereq
43f0: 73 2d 6e 6f 74 2d 6d 65 74 3a 20 22 20 0a 09 09  s-not-met: " ...
4400: 09 20 20 20 20 20 28 73 74 72 69 6e 67 2d 69 6e  .     (string-in
4410: 74 65 72 73 70 65 72 73 65 20 0a 09 09 09 20 20  tersperse ....  
4420: 20 20 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 61      (map (lambda
4430: 20 28 74 29 0a 09 09 09 09 20 20 20 20 20 28 69   (t).....     (i
4440: 66 20 28 76 65 63 74 6f 72 3f 20 74 29 0a 09 09  f (vector? t)...
4450: 09 09 09 20 28 63 6f 6e 63 20 28 64 62 3a 74 65  ... (conc (db:te
4460: 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74 29 20  st-get-state t) 
4470: 22 2f 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74  "/" (db:test-get
4480: 2d 73 74 61 74 75 73 20 74 29 29 0a 09 09 09 09  -status t)).....
4490: 09 20 28 63 6f 6e 63 20 22 20 57 41 52 4e 49 4e  . (conc " WARNIN
44a0: 47 3a 20 74 20 69 73 20 6e 6f 74 20 61 20 76 65  G: t is not a ve
44b0: 63 74 6f 72 3d 22 20 74 20 29 29 29 0a 09 09 09  ctor=" t )))....
44c0: 09 20 20 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d  .   prereqs-not-
44d0: 6d 65 74 29 20 22 2c 20 22 29 20 22 20 66 61 69  met) ", ") " fai
44e0: 6c 73 3a 20 22 20 66 61 69 6c 73 29 0a 09 09 28  ls: " fails)...(
44f0: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
4500: 20 34 20 22 68 65 64 3d 22 20 68 65 64 20 22 5c   4 "hed=" hed "\
4510: 6e 20 20 74 65 73 74 2d 72 65 63 6f 72 64 3d 22  n  test-record="
4520: 20 74 65 73 74 2d 72 65 63 6f 72 64 20 22 5c 6e   test-record "\n
4530: 20 20 74 65 73 74 2d 6e 61 6d 65 3a 20 22 20 74    test-name: " t
4540: 65 73 74 2d 6e 61 6d 65 20 22 5c 6e 20 20 69 74  est-name "\n  it
4550: 65 6d 2d 70 61 74 68 3a 20 22 20 69 74 65 6d 2d  em-path: " item-
4560: 70 61 74 68 20 22 5c 6e 20 20 74 65 73 74 2d 70  path "\n  test-p
4570: 61 74 74 73 3a 20 22 20 74 65 73 74 2d 70 61 74  atts: " test-pat
4580: 74 73 29 0a 0a 09 09 3b 3b 20 44 6f 6e 27 74 20  ts)....;; Don't 
4590: 6b 6e 6f 77 20 61 74 20 74 68 69 73 20 74 69 6d  know at this tim
45a0: 65 20 69 66 20 74 68 65 20 74 65 73 74 20 68 61  e if the test ha
45b0: 76 65 20 62 65 65 6e 20 6c 61 75 6e 63 68 65 64  ve been launched
45c0: 20 61 74 20 73 6f 6d 65 20 74 69 6d 65 20 69 6e   at some time in
45d0: 20 74 68 65 20 70 61 73 74 0a 09 09 3b 3b 20 69   the past...;; i
45e0: 2e 65 2e 20 69 73 20 74 68 69 73 20 61 20 72 65  .e. is this a re
45f0: 2d 6c 61 75 6e 63 68 3f 0a 09 09 28 64 65 62 75  -launch?...(debu
4600: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22  g:print-info 4 "
4610: 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 20  run-limits-info 
4620: 3d 20 22 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69  = " run-limits-i
4630: 6e 66 6f 29 0a 09 09 28 63 6f 6e 64 20 3b 3b 20  nfo)...(cond ;; 
4640: 49 4e 4e 45 52 20 43 4f 4e 44 20 23 31 20 66 6f  INNER COND #1 fo
4650: 72 20 61 20 6c 61 75 6e 63 68 61 62 6c 65 20 74  r a launchable t
4660: 65 73 74 0a 09 09 20 3b 3b 20 43 68 65 63 6b 20  est... ;; Check 
4670: 69 74 65 6d 20 70 61 74 68 20 61 67 61 69 6e 73  item path agains
4680: 74 20 69 74 65 6d 2d 70 61 74 74 73 0a 09 09 20  t item-patts... 
4690: 28 28 6e 6f 74 20 28 74 65 73 74 73 3a 6d 61 74  ((not (tests:mat
46a0: 63 68 20 74 65 73 74 2d 70 61 74 74 73 20 28 74  ch test-patts (t
46b0: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67  ests:testqueue-g
46c0: 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74  et-testname test
46d0: 2d 72 65 63 6f 72 64 29 20 69 74 65 6d 2d 70 61  -record) item-pa
46e0: 74 68 29 29 20 3b 3b 20 54 68 69 73 20 74 65 73  th)) ;; This tes
46f0: 74 2f 69 74 65 6d 70 61 74 68 20 69 73 20 6e 6f  t/itempath is no
4700: 74 20 74 6f 20 62 65 20 72 75 6e 0a 09 09 20 20  t to be run...  
4710: 3b 3b 20 65 6c 73 65 20 74 68 65 20 72 75 6e 20  ;; else the run 
4720: 69 73 20 73 74 75 63 6b 2c 20 74 65 6d 70 6f 72  is stuck, tempor
4730: 61 72 69 6c 79 20 6f 72 20 70 65 72 6d 61 6e 65  arily or permane
4740: 6e 74 6c 79 0a 09 09 20 20 3b 3b 20 62 75 74 20  ntly...  ;; but 
4750: 73 68 6f 75 6c 64 20 63 68 65 63 6b 20 69 66 20  should check if 
4760: 69 74 20 69 73 20 64 75 65 20 74 6f 20 6c 61 63  it is due to lac
4770: 6b 20 6f 66 20 72 65 73 6f 75 72 63 65 73 20 76  k of resources v
4780: 73 2e 20 70 72 65 72 65 71 75 69 73 69 74 65 73  s. prerequisites
4790: 0a 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e  ...  (debug:prin
47a0: 74 2d 69 6e 66 6f 20 31 20 22 53 6b 69 70 70 69  t-info 1 "Skippi
47b0: 6e 67 20 22 20 28 74 65 73 74 73 3a 74 65 73 74  ng " (tests:test
47c0: 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61  queue-get-testna
47d0: 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 29 20  me test-record) 
47e0: 22 20 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20  " " item-path " 
47f0: 61 73 20 69 74 20 64 6f 65 73 6e 27 74 20 6d 61  as it doesn't ma
4800: 74 63 68 20 22 20 74 65 73 74 2d 70 61 74 74 73  tch " test-patts
4810: 29 0a 09 09 20 20 3b 3b 20 28 74 68 72 65 61 64  )...  ;; (thread
4820: 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d  -sleep! *global-
4830: 64 65 6c 74 61 2a 29 0a 09 09 20 20 28 69 66 20  delta*)...  (if 
4840: 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29  (not (null? tal)
4850: 29 0a 09 09 20 20 20 20 20 20 28 6c 6f 6f 70 20  )...      (loop 
4860: 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74 61  (car tal)(cdr ta
4870: 6c 29 20 72 65 72 75 6e 73 29 29 29 0a 09 09 20  l) reruns)))... 
4880: 28 20 3b 3b 20 28 61 6e 64 0a 09 09 20 20 28 6e  ( ;; (and...  (n
4890: 6f 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72  ot (hash-table-r
48a0: 65 66 2f 64 65 66 61 75 6c 74 20 74 65 73 74 2d  ef/default test-
48b0: 72 65 67 69 73 74 65 72 79 20 28 72 75 6e 73 3a  registery (runs:
48c0: 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e  make-full-test-n
48d0: 61 6d 65 20 74 65 73 74 2d 6e 61 6d 65 20 69 74  ame test-name it
48e0: 65 6d 2d 70 61 74 68 29 20 23 66 29 29 0a 09 09  em-path) #f))...
48f0: 20 20 20 20 20 20 3b 3b 20 28 61 6e 64 20 6d 61        ;; (and ma
4900: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62  x-concurrent-job
4910: 73 20 28 3e 20 28 2d 20 6d 61 78 2d 63 6f 6e 63  s (> (- max-conc
4920: 75 72 72 65 6e 74 2d 6a 6f 62 73 20 6e 75 6d 2d  urrent-jobs num-
4930: 72 75 6e 6e 69 6e 67 29 20 35 29 29 29 0a 09 09  running) 5)))...
4940: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69    (debug:print-i
4950: 6e 66 6f 20 34 20 22 50 72 65 2d 72 65 67 69 73  nfo 4 "Pre-regis
4960: 74 65 72 69 6e 67 20 74 65 73 74 20 22 20 74 65  tering test " te
4970: 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d  st-name "/" item
4980: 2d 70 61 74 68 20 22 20 74 6f 20 63 72 65 61 74  -path " to creat
4990: 65 20 70 6c 61 63 65 68 6f 6c 64 65 72 22 20 29  e placeholder" )
49a0: 0a 09 09 20 20 28 64 62 3a 74 65 73 74 73 2d 72  ...  (db:tests-r
49b0: 65 67 69 73 74 65 72 2d 74 65 73 74 20 72 75 6e  egister-test run
49c0: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74  -id test-name it
49d0: 65 6d 2d 70 61 74 68 29 0a 09 09 20 20 28 68 61  em-path)...  (ha
49e0: 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 65  sh-table-set! te
49f0: 73 74 2d 72 65 67 69 73 74 65 72 79 20 28 72 75  st-registery (ru
4a00: 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 73  ns:make-full-tes
4a10: 74 2d 6e 61 6d 65 20 74 65 73 74 2d 6e 61 6d 65  t-name test-name
4a20: 20 69 74 65 6d 2d 70 61 74 68 29 20 23 74 29 0a   item-path) #t).
4a30: 09 09 20 20 3b 3b 20 28 74 68 72 65 61 64 2d 73  ..  ;; (thread-s
4a40: 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65  leep! *global-de
4a50: 6c 74 61 2a 29 0a 28 72 75 6e 73 3a 73 68 72 69  lta*).(runs:shri
4a60: 6e 6b 2d 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d  nk-can-run-more-
4a70: 74 65 73 74 73 2d 64 65 6c 61 79 29 0a 09 09 20  tests-delay)... 
4a80: 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74   (loop (car newt
4a90: 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20  al)(cdr newtal) 
4aa0: 72 65 72 75 6e 73 29 29 0a 09 09 20 28 28 6e 6f  reruns))... ((no
4ab0: 74 20 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73  t have-resources
4ac0: 29 20 3b 3b 20 73 69 6d 70 6c 79 20 74 72 79 20  ) ;; simply try 
4ad0: 61 67 61 69 6e 20 61 66 74 65 72 20 77 61 69 74  again after wait
4ae0: 69 6e 67 20 61 20 73 65 63 6f 6e 64 0a 09 09 20  ing a second... 
4af0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
4b00: 66 6f 20 31 20 22 6e 6f 20 72 65 73 6f 75 72 63  fo 1 "no resourc
4b10: 65 73 20 74 6f 20 72 75 6e 20 6e 65 77 20 74 65  es to run new te
4b20: 73 74 73 2c 20 77 61 69 74 69 6e 67 20 2e 2e 2e  sts, waiting ...
4b30: 22 29 0a 09 09 20 20 3b 3b 20 28 74 68 72 65 61  ")...  ;; (threa
4b40: 64 2d 73 6c 65 65 70 21 20 28 2b 20 32 20 2a 67  d-sleep! (+ 2 *g
4b50: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09  lobal-delta*))..
4b60: 09 20 20 3b 3b 20 63 6f 75 6c 64 20 68 61 76 65  .  ;; could have
4b70: 20 64 6f 6e 65 20 68 65 64 20 74 61 6c 20 68 65   done hed tal he
4b80: 72 65 20 62 75 74 20 64 6f 69 6e 67 20 63 61 72  re but doing car
4b90: 2f 63 64 72 20 6f 66 20 6e 65 77 74 61 6c 20 74  /cdr of newtal t
4ba0: 6f 20 72 6f 74 61 74 65 20 74 65 73 74 73 0a 09  o rotate tests..
4bb0: 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65  .  (loop (car ne
4bc0: 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c  wtal)(cdr newtal
4bd0: 29 20 72 65 72 75 6e 73 29 29 0a 09 09 20 28 28  ) reruns))... ((
4be0: 61 6e 64 20 68 61 76 65 2d 72 65 73 6f 75 72 63  and have-resourc
4bf0: 65 73 0a 09 09 20 20 20 20 20 20 20 28 6f 72 20  es...       (or 
4c00: 28 6e 75 6c 6c 3f 20 70 72 65 72 65 71 73 2d 6e  (null? prereqs-n
4c10: 6f 74 2d 6d 65 74 29 0a 09 09 09 20 20 20 28 61  ot-met)....   (a
4c20: 6e 64 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 65  nd (eq? testmode
4c30: 20 27 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09   'toplevel).....
4c40: 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c  (null? non-compl
4c50: 65 74 65 64 29 29 29 29 0a 09 09 20 20 28 72 75  eted))))...  (ru
4c60: 6e 3a 74 65 73 74 20 72 75 6e 2d 69 64 20 72 75  n:test run-id ru
4c70: 6e 6e 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20  nname keyvallst 
4c80: 74 65 73 74 2d 72 65 63 6f 72 64 20 66 6c 61 67  test-record flag
4c90: 73 20 23 66 29 0a 28 72 75 6e 73 3a 73 68 72 69  s #f).(runs:shri
4ca0: 6e 6b 2d 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d  nk-can-run-more-
4cb0: 74 65 73 74 73 2d 64 65 6c 61 79 29 0a 09 09 20  tests-delay)... 
4cc0: 20 3b 3b 20 28 74 68 72 65 61 64 2d 73 6c 65 65   ;; (thread-slee
4cd0: 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61  p! *global-delta
4ce0: 2a 29 0a 09 09 20 20 28 69 66 20 28 6e 6f 74 20  *)...  (if (not 
4cf0: 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 20  (null? tal))... 
4d00: 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20       (loop (car 
4d10: 74 61 6c 29 28 63 64 72 20 74 61 6c 29 20 72 65  tal)(cdr tal) re
4d20: 72 75 6e 73 29 29 29 0a 09 09 20 28 65 6c 73 65  runs)))... (else
4d30: 20 3b 3b 20 6d 75 73 74 20 62 65 20 77 65 20 68   ;; must be we h
4d40: 61 76 65 20 75 6e 6d 65 74 20 70 72 65 72 65 71  ave unmet prereq
4d50: 75 69 73 69 74 65 73 0a 09 09 20 20 20 20 28 64  uisites...    (d
4d60: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 46 41  ebug:print 4 "FA
4d70: 49 4c 53 3a 20 22 20 66 61 69 6c 73 29 0a 09 09  ILS: " fails)...
4d80: 20 20 20 20 3b 3b 20 49 66 20 6f 6e 65 20 6f 72      ;; If one or
4d90: 20 6d 6f 72 65 20 6f 66 20 74 68 65 20 70 72 65   more of the pre
4da0: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 61 72 65  reqs-not-met are
4db0: 20 46 41 49 4c 20 74 68 65 6e 20 77 65 20 63 61   FAIL then we ca
4dc0: 6e 20 69 73 73 75 65 0a 09 09 20 20 20 20 3b 3b  n issue...    ;;
4dd0: 20 61 20 6d 65 73 73 61 67 65 20 61 6e 64 20 64   a message and d
4de0: 72 6f 70 20 68 65 64 20 66 72 6f 6d 20 74 68 65  rop hed from the
4df0: 20 69 74 65 6d 73 20 74 6f 20 62 65 20 70 72 6f   items to be pro
4e00: 63 65 73 73 65 64 2e 0a 09 09 20 20 20 20 28 69  cessed....    (i
4e10: 66 20 28 6e 75 6c 6c 3f 20 66 61 69 6c 73 29 0a  f (null? fails).
4e20: 09 09 09 28 62 65 67 69 6e 0a 09 09 09 20 20 3b  ...(begin....  ;
4e30: 3b 20 63 6f 75 6c 64 6e 27 74 20 72 75 6e 2c 20  ; couldn't run, 
4e40: 74 61 6b 65 20 61 20 62 72 65 61 74 68 65 72 0a  take a breather.
4e50: 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e  ...  (debug:prin
4e60: 74 2d 69 6e 66 6f 20 34 20 22 53 68 6f 75 6c 64  t-info 4 "Should
4e70: 6e 27 74 20 72 65 61 6c 6c 79 20 67 65 74 20 68  n't really get h
4e80: 65 72 65 2c 20 72 61 63 65 20 63 6f 6e 64 69 74  ere, race condit
4e90: 69 6f 6e 3f 20 55 6e 61 62 6c 65 20 74 6f 20 6c  ion? Unable to l
4ea0: 61 75 6e 63 68 20 6d 6f 72 65 20 74 65 73 74 73  aunch more tests
4eb0: 20 61 74 20 74 68 69 73 20 6d 6f 6d 65 6e 74 2c   at this moment,
4ec0: 20 6b 69 6c 6c 69 6e 67 20 74 69 6d 65 20 2e 2e   killing time ..
4ed0: 2e 22 29 0a 09 09 09 20 20 3b 3b 20 28 74 68 72  .")....  ;; (thr
4ee0: 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 30 2e  ead-sleep! (+ 0.
4ef0: 30 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61  01 *global-delta
4f00: 2a 29 29 20 3b 3b 20 6c 6f 6e 67 20 73 6c 65 65  *)) ;; long slee
4f10: 70 20 68 65 72 65 20 2d 20 6e 6f 20 72 65 73 6f  p here - no reso
4f20: 75 72 63 65 73 2c 20 6d 61 79 20 61 73 20 77 65  urces, may as we
4f30: 6c 6c 20 62 65 20 70 61 74 69 65 6e 74 0a 09 09  ll be patient...
4f40: 09 20 20 3b 3b 20 77 65 20 6d 61 64 65 20 6e 65  .  ;; we made ne
4f50: 77 20 74 61 6c 20 62 79 20 73 74 69 63 6b 69 6e  w tal by stickin
4f60: 67 20 68 65 64 20 61 74 20 74 68 65 20 62 61 63  g hed at the bac
4f70: 6b 20 6f 66 20 74 68 65 20 6c 69 73 74 0a 09 09  k of the list...
4f80: 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65  .  (loop (car ne
4f90: 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c  wtal)(cdr newtal
4fa0: 29 20 72 65 72 75 6e 73 29 29 0a 09 09 09 3b 3b  ) reruns))....;;
4fb0: 20 74 68 65 20 77 61 69 74 6f 6e 20 69 73 20 46   the waiton is F
4fc0: 41 49 4c 20 73 6f 20 6e 6f 20 70 6f 69 6e 74 20  AIL so no point 
4fd0: 69 6e 20 74 72 79 69 6e 67 20 74 6f 20 72 75 6e  in trying to run
4fe0: 20 68 65 64 20 65 76 65 72 20 61 67 61 69 6e 0a   hed ever again.
4ff0: 09 09 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c  ...(if (not (nul
5000: 6c 3f 20 74 61 6c 29 29 0a 09 09 09 20 20 20 20  l? tal))....    
5010: 28 69 66 20 28 76 65 63 74 6f 72 3f 20 68 65 64  (if (vector? hed
5020: 29 0a 09 09 09 09 28 62 65 67 69 6e 20 28 64 65  ).....(begin (de
5030: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 57 41 52  bug:print 1 "WAR
5040: 4e 3a 20 44 72 6f 70 70 69 6e 67 20 74 65 73 74  N: Dropping test
5050: 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d   " (db:test-get-
5060: 74 65 73 74 6e 61 6d 65 20 68 65 64 29 20 22 2f  testname hed) "/
5070: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  " (db:test-get-i
5080: 74 65 6d 2d 70 61 74 68 20 68 65 64 29 0a 09 09  tem-path hed)...
5090: 09 09 09 09 20 20 20 20 22 20 66 72 6f 6d 20 74  ....    " from t
50a0: 68 65 20 6c 61 75 6e 63 68 20 6c 69 73 74 20 61  he launch list a
50b0: 73 20 69 74 20 68 61 73 20 70 72 65 72 65 71 75  s it has prerequ
50c0: 69 73 74 65 73 20 74 68 61 74 20 61 72 65 20 46  istes that are F
50d0: 41 49 4c 22 29 0a 28 72 75 6e 73 3a 73 68 72 69  AIL").(runs:shri
50e0: 6e 6b 2d 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d  nk-can-run-more-
50f0: 74 65 73 74 73 2d 64 65 6c 61 79 29 0a 09 09 09  tests-delay)....
5100: 09 20 20 20 20 20 20 20 3b 3b 20 28 74 68 72 65  .       ;; (thre
5110: 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61  ad-sleep! *globa
5120: 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 09 09 20 20  l-delta*).....  
5130: 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20       (loop (car 
5140: 74 61 6c 29 28 63 64 72 20 74 61 6c 29 20 28 63  tal)(cdr tal) (c
5150: 6f 6e 73 20 68 65 64 20 72 65 72 75 6e 73 29 29  ons hed reruns))
5160: 29 0a 09 09 09 09 28 62 65 67 69 6e 0a 09 09 09  ).....(begin....
5170: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  .  (debug:print 
5180: 31 20 22 57 41 52 4e 3a 20 54 65 73 74 20 6e 6f  1 "WARN: Test no
5190: 74 20 70 72 6f 63 65 73 73 65 64 20 63 6f 72 72  t processed corr
51a0: 65 63 74 6c 79 2e 20 43 6f 75 6c 64 20 62 65 20  ectly. Could be 
51b0: 61 20 72 61 63 65 20 63 6f 6e 64 69 74 69 6f 6e  a race condition
51c0: 20 69 6e 20 79 6f 75 72 20 74 65 73 74 20 69 6d   in your test im
51d0: 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 3f 20 22 20  plementation? " 
51e0: 68 65 64 29 20 3b 3b 20 20 22 20 61 73 20 69 74  hed) ;;  " as it
51f0: 20 68 61 73 20 70 72 65 72 65 71 75 69 73 74 65   has prerequiste
5200: 73 20 74 68 61 74 20 61 72 65 20 46 41 49 4c 2e  s that are FAIL.
5210: 20 28 4e 4f 54 45 3a 20 68 65 64 20 69 73 20 6e   (NOTE: hed is n
5220: 6f 74 20 61 20 76 65 63 74 6f 72 29 22 29 0a 28  ot a vector)").(
5230: 72 75 6e 73 3a 73 68 72 69 6e 6b 2d 63 61 6e 2d  runs:shrink-can-
5240: 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64  run-more-tests-d
5250: 65 6c 61 79 29 0a 09 09 09 09 20 20 3b 3b 20 28  elay).....  ;; (
5260: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b  thread-sleep! (+
5270: 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d 64 65   0.01 *global-de
5280: 6c 74 61 2a 29 29 0a 09 09 09 09 20 20 28 6c 6f  lta*)).....  (lo
5290: 6f 70 20 68 65 64 20 74 61 6c 20 72 65 72 75 6e  op hed tal rerun
52a0: 73 29 29 29 29 29 29 29 29 29 20 3b 3b 20 45 4e  s))))))))) ;; EN
52b0: 44 20 4f 46 20 49 4e 4e 45 52 20 43 4f 4e 44 0a  D OF INNER COND.
52c0: 09 20 20 20 20 20 0a 09 20 20 20 20 20 3b 3b 20  .     ..     ;; 
52d0: 63 61 73 65 20 77 68 65 72 65 20 61 6e 20 69 74  case where an it
52e0: 65 6d 73 20 63 61 6d 65 20 69 6e 20 61 73 20 61  ems came in as a
52f0: 20 6c 69 73 74 20 62 65 65 6e 20 70 72 6f 63 65   list been proce
5300: 73 73 65 64 0a 09 20 20 20 20 20 28 28 61 6e 64  ssed..     ((and
5310: 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 20   (list? items)  
5320: 20 20 20 3b 3b 20 74 68 75 73 20 77 65 20 6b 6e     ;; thus we kn
5330: 6f 77 20 6f 75 72 20 69 74 65 6d 73 20 61 72 65  ow our items are
5340: 20 61 6c 72 65 61 64 79 20 63 61 6c 63 75 6c 61   already calcula
5350: 74 65 64 0a 09 09 20 20 20 28 6e 6f 74 20 20 20  ted...   (not   
5360: 69 74 65 6d 64 61 74 29 29 20 3b 3b 20 61 6e 64  itemdat)) ;; and
5370: 20 6e 6f 74 20 79 65 74 20 65 78 70 61 6e 64 65   not yet expande
5380: 64 20 69 6e 74 6f 20 74 68 65 20 6c 69 73 74 20  d into the list 
5390: 6f 66 20 74 68 69 6e 67 73 20 74 6f 20 62 65 20  of things to be 
53a0: 64 6f 6e 65 0a 09 20 20 20 20 20 20 28 69 66 20  done..      (if 
53b0: 28 61 6e 64 20 28 64 65 62 75 67 3a 64 65 62 75  (and (debug:debu
53c0: 67 2d 6d 6f 64 65 20 31 29 20 3b 3b 20 28 3e 3d  g-mode 1) ;; (>=
53d0: 20 2a 76 65 72 62 6f 73 69 74 79 2a 20 31 29 0a   *verbosity* 1).
53e0: 09 09 20 20 20 20 20 20 20 28 3e 20 28 6c 65 6e  ..       (> (len
53f0: 67 74 68 20 69 74 65 6d 73 29 20 30 29 0a 09 09  gth items) 0)...
5400: 20 20 20 20 20 20 20 28 3e 20 28 6c 65 6e 67 74         (> (lengt
5410: 68 20 28 63 61 72 20 69 74 65 6d 73 29 29 20 30  h (car items)) 0
5420: 29 29 0a 09 09 20 20 28 70 70 20 69 74 65 6d 73  ))...  (pp items
5430: 29 29 0a 09 20 20 20 20 20 20 28 66 6f 72 2d 65  ))..      (for-e
5440: 61 63 68 0a 09 20 20 20 20 20 20 20 28 6c 61 6d  ach..       (lam
5450: 62 64 61 20 28 6d 79 2d 69 74 65 6d 64 61 74 29  bda (my-itemdat)
5460: 0a 09 09 20 28 6c 65 74 2a 20 28 28 6e 65 77 2d  ... (let* ((new-
5470: 74 65 73 74 2d 72 65 63 6f 72 64 20 28 6c 65 74  test-record (let
5480: 20 28 28 6e 65 77 72 65 63 20 28 6d 61 6b 65 2d   ((newrec (make-
5490: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 29  tests:testqueue)
54a0: 29 29 0a 09 09 09 09 09 20 20 20 28 76 65 63 74  ))......   (vect
54b0: 6f 72 2d 63 6f 70 79 21 20 74 65 73 74 2d 72 65  or-copy! test-re
54c0: 63 6f 72 64 20 6e 65 77 72 65 63 29 0a 09 09 09  cord newrec)....
54d0: 09 09 20 20 20 6e 65 77 72 65 63 29 29 0a 09 09  ..   newrec))...
54e0: 09 28 6d 79 2d 69 74 65 6d 2d 70 61 74 68 20 28  .(my-item-path (
54f0: 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20  item-list->path 
5500: 6d 79 2d 69 74 65 6d 64 61 74 29 29 29 0a 09 09  my-itemdat)))...
5510: 20 20 20 28 69 66 20 28 74 65 73 74 73 3a 6d 61     (if (tests:ma
5520: 74 63 68 20 74 65 73 74 2d 70 61 74 74 73 20 68  tch test-patts h
5530: 65 64 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68 29  ed my-item-path)
5540: 20 3b 3b 20 28 70 61 74 74 2d 6c 69 73 74 2d 6d   ;; (patt-list-m
5550: 61 74 63 68 20 6d 79 2d 69 74 65 6d 2d 70 61 74  atch my-item-pat
5560: 68 20 69 74 65 6d 2d 70 61 74 74 73 29 20 20 20  h item-patts)   
5570: 20 20 20 20 20 20 20 20 3b 3b 20 79 65 73 2c 20          ;; yes, 
5580: 77 65 20 77 61 6e 74 20 74 6f 20 70 72 6f 63 65  we want to proce
5590: 73 73 20 74 68 69 73 20 69 74 65 6d 2c 20 4e 4f  ss this item, NO
55a0: 54 45 3a 20 53 68 6f 75 6c 64 20 6e 6f 74 20 6e  TE: Should not n
55b0: 65 65 64 20 74 68 69 73 20 63 68 65 63 6b 20 68  eed this check h
55c0: 65 72 65 21 0a 09 09 20 20 20 20 20 20 20 28 6c  ere!...       (l
55d0: 65 74 20 28 28 6e 65 77 74 65 73 74 6e 61 6d 65  et ((newtestname
55e0: 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c   (runs:make-full
55f0: 2d 74 65 73 74 2d 6e 61 6d 65 20 68 65 64 20 6d  -test-name hed m
5600: 79 2d 69 74 65 6d 2d 70 61 74 68 29 29 29 20 20  y-item-path)))  
5610: 20 20 3b 3b 20 74 65 73 74 20 6e 61 6d 65 73 20    ;; test names 
5620: 61 72 65 20 75 6e 69 71 75 65 20 6f 6e 20 74 65  are unique on te
5630: 73 74 6e 61 6d 65 2f 69 74 65 6d 2d 70 61 74 68  stname/item-path
5640: 0a 09 09 09 20 28 74 65 73 74 73 3a 74 65 73 74  .... (tests:test
5650: 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 73 21  queue-set-items!
5660: 20 20 20 20 20 6e 65 77 2d 74 65 73 74 2d 72 65       new-test-re
5670: 63 6f 72 64 20 23 66 29 0a 09 09 09 20 28 74 65  cord #f).... (te
5680: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65  sts:testqueue-se
5690: 74 2d 69 74 65 6d 64 61 74 21 20 20 20 6e 65 77  t-itemdat!   new
56a0: 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 6d 79 2d  -test-record my-
56b0: 69 74 65 6d 64 61 74 29 0a 09 09 09 20 28 74 65  itemdat).... (te
56c0: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65  sts:testqueue-se
56d0: 74 2d 69 74 65 6d 5f 70 61 74 68 21 20 6e 65 77  t-item_path! new
56e0: 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 6d 79 2d  -test-record my-
56f0: 69 74 65 6d 2d 70 61 74 68 29 0a 09 09 09 20 28  item-path).... (
5700: 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20  hash-table-set! 
5710: 74 65 73 74 2d 72 65 63 6f 72 64 73 20 6e 65 77  test-records new
5720: 74 65 73 74 6e 61 6d 65 20 6e 65 77 2d 74 65 73  testname new-tes
5730: 74 2d 72 65 63 6f 72 64 29 0a 09 09 09 20 28 73  t-record).... (s
5740: 65 74 21 20 74 61 6c 20 28 63 6f 6e 73 20 6e 65  et! tal (cons ne
5750: 77 74 65 73 74 6e 61 6d 65 20 74 61 6c 29 29 29  wtestname tal)))
5760: 29 29 29 20 3b 3b 20 73 69 6e 63 65 20 74 68 65  ))) ;; since the
5770: 73 65 20 61 72 65 20 69 74 65 6d 69 7a 65 64 20  se are itemized 
5780: 63 72 65 61 74 65 20 6e 65 77 20 74 65 73 74 20  create new test 
5790: 6e 61 6d 65 73 20 74 65 73 74 6e 61 6d 65 2f 69  names testname/i
57a0: 74 65 6d 70 61 74 68 0a 09 20 20 20 20 20 20 20  tempath..       
57b0: 69 74 65 6d 73 29 0a 09 20 20 20 20 20 20 28 69  items)..      (i
57c0: 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61  f (not (null? ta
57d0: 6c 29 29 0a 09 09 20 20 28 62 65 67 69 6e 0a 09  l))...  (begin..
57e0: 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  .    (debug:prin
57f0: 74 2d 69 6e 66 6f 20 34 20 22 45 6e 64 20 6f 66  t-info 4 "End of
5800: 20 69 74 65 6d 73 20 6c 69 73 74 2c 20 6c 6f 6f   items list, loo
5810: 70 69 6e 67 20 77 69 74 68 20 6e 65 78 74 20 61  ping with next a
5820: 66 74 65 72 20 73 68 6f 72 74 20 64 65 6c 61 79  fter short delay
5830: 22 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20  ").             
5840: 20 20 20 20 20 20 20 3b 3b 20 28 74 68 72 65 61         ;; (threa
5850: 64 2d 73 6c 65 65 70 21 20 28 2b 20 30 2e 30 31  d-sleep! (+ 0.01
5860: 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29   *global-delta*)
5870: 29 0a 09 09 20 20 20 20 28 6c 6f 6f 70 20 28 63  )...    (loop (c
5880: 61 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29  ar tal)(cdr tal)
5890: 20 72 65 72 75 6e 73 29 29 29 29 0a 0a 09 20 20   reruns))))...  
58a0: 20 20 20 3b 3b 20 69 66 20 69 74 65 6d 73 20 69     ;; if items i
58b0: 73 20 61 20 70 72 6f 63 20 74 68 65 6e 20 6e 65  s a proc then ne
58c0: 65 64 20 74 6f 20 72 75 6e 20 69 74 65 6d 73 3a  ed to run items:
58d0: 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63  get-items-from-c
58e0: 6f 6e 66 69 67 2c 20 67 65 74 20 74 68 65 20 6c  onfig, get the l
58f0: 69 73 74 20 61 6e 64 20 6c 6f 6f 70 20 0a 09 20  ist and loop .. 
5900: 20 20 20 20 3b 3b 20 20 20 20 2d 20 62 75 74 20      ;;    - but 
5910: 6f 6e 6c 79 20 64 6f 20 74 68 61 74 20 69 66 20  only do that if 
5920: 72 65 73 6f 75 72 63 65 73 20 65 78 69 73 74 20  resources exist 
5930: 74 6f 20 6b 69 63 6b 20 6f 66 66 20 74 68 65 20  to kick off the 
5940: 6a 6f 62 0a 09 20 20 20 20 20 28 28 6f 72 20 28  job..     ((or (
5950: 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73  procedure? items
5960: 29 28 65 71 3f 20 69 74 65 6d 73 20 27 68 61 76  )(eq? items 'hav
5970: 65 2d 70 72 6f 63 65 64 75 72 65 29 29 0a 09 20  e-procedure)).. 
5980: 20 20 20 20 20 28 6c 65 74 20 28 28 63 61 6e 2d       (let ((can-
5990: 72 75 6e 2d 6d 6f 72 65 20 20 20 20 28 72 75 6e  run-more    (run
59a0: 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74  s:can-run-more-t
59b0: 65 73 74 73 20 74 65 73 74 2d 72 65 63 6f 72 64  ests test-record
59c0: 29 29 29 0a 09 09 28 69 66 20 28 61 6e 64 20 28  )))...(if (and (
59d0: 6c 69 73 74 3f 20 63 61 6e 2d 72 75 6e 2d 6d 6f  list? can-run-mo
59e0: 72 65 29 0a 09 09 09 20 28 63 61 72 20 63 61 6e  re).... (car can
59f0: 2d 72 75 6e 2d 6d 6f 72 65 29 29 0a 09 09 20 20  -run-more))...  
5a00: 20 20 28 6c 65 74 2a 20 28 28 70 72 65 72 65 71    (let* ((prereq
5a10: 73 2d 6e 6f 74 2d 6d 65 74 20 28 6f 70 65 6e 2d  s-not-met (open-
5a20: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
5a30: 2d 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74  -prereqs-not-met
5a40: 20 23 66 20 72 75 6e 2d 69 64 20 77 61 69 74 6f   #f run-id waito
5a50: 6e 73 20 69 74 65 6d 2d 70 61 74 68 20 6d 6f 64  ns item-path mod
5a60: 65 3a 20 74 65 73 74 6d 6f 64 65 29 29 0a 09 09  e: testmode))...
5a70: 09 20 20 20 28 66 61 69 6c 73 20 20 20 20 20 20  .   (fails      
5a80: 20 20 20 20 20 28 72 75 6e 73 3a 63 61 6c 63 2d       (runs:calc-
5a90: 66 61 69 6c 73 20 70 72 65 72 65 71 73 2d 6e 6f  fails prereqs-no
5aa0: 74 2d 6d 65 74 29 29 0a 09 09 09 20 20 20 28 6e  t-met))....   (n
5ab0: 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 20 20 20 28  on-completed   (
5ac0: 72 75 6e 73 3a 63 61 6c 63 2d 6e 6f 74 2d 63 6f  runs:calc-not-co
5ad0: 6d 70 6c 65 74 65 64 20 70 72 65 72 65 71 73 2d  mpleted prereqs-
5ae0: 6e 6f 74 2d 6d 65 74 29 29 29 0a 09 09 20 20 20  not-met)))...   
5af0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d     (debug:print-
5b00: 69 6e 66 6f 20 38 20 22 63 61 6e 2d 72 75 6e 2d  info 8 "can-run-
5b10: 6d 6f 72 65 3a 20 22 20 63 61 6e 2d 72 75 6e 2d  more: " can-run-
5b20: 6d 6f 72 65 0a 09 09 09 09 20 20 20 22 5c 6e 20  more.....   "\n 
5b30: 74 65 73 74 6e 61 6d 65 3a 20 20 20 20 20 20 20  testname:       
5b40: 20 22 20 68 65 64 0a 09 09 09 09 20 20 20 22 5c   " hed.....   "\
5b50: 6e 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65  n prereqs-not-me
5b60: 74 3a 20 22 20 28 72 75 6e 73 3a 70 72 65 74 74  t: " (runs:prett
5b70: 79 2d 73 74 72 69 6e 67 20 70 72 65 72 65 71 73  y-string prereqs
5b80: 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09 09 09 20 20  -not-met).....  
5b90: 20 22 5c 6e 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74   "\n non-complet
5ba0: 65 64 3a 20 20 20 22 20 28 72 75 6e 73 3a 70 72  ed:   " (runs:pr
5bb0: 65 74 74 79 2d 73 74 72 69 6e 67 20 6e 6f 6e 2d  etty-string non-
5bc0: 63 6f 6d 70 6c 65 74 65 64 29 20 0a 09 09 09 09  completed) .....
5bd0: 20 20 20 22 5c 6e 20 66 61 69 6c 73 3a 20 20 20     "\n fails:   
5be0: 20 20 20 20 20 20 20 20 22 20 28 72 75 6e 73 3a          " (runs:
5bf0: 70 72 65 74 74 79 2d 73 74 72 69 6e 67 20 66 61  pretty-string fa
5c00: 69 6c 73 29 0a 09 09 09 09 20 20 20 22 5c 6e 20  ils).....   "\n 
5c10: 74 65 73 74 6d 6f 64 65 3a 20 20 20 20 20 20 20  testmode:       
5c20: 20 22 20 74 65 73 74 6d 6f 64 65 0a 09 09 09 09   " testmode.....
5c30: 20 20 20 22 5c 6e 20 6e 75 6d 2d 72 65 74 72 69     "\n num-retri
5c40: 65 73 3a 20 20 20 20 20 22 20 6e 75 6d 2d 72 65  es:     " num-re
5c50: 74 72 69 65 73 0a 09 09 09 09 20 20 20 22 5c 6e  tries.....   "\n
5c60: 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27   (eq? testmode '
5c70: 74 6f 70 6c 65 76 65 6c 29 3a 20 22 20 28 65 71  toplevel): " (eq
5c80: 3f 20 74 65 73 74 6d 6f 64 65 20 27 74 6f 70 6c  ? testmode 'topl
5c90: 65 76 65 6c 29 0a 09 09 09 09 20 20 20 22 5c 6e  evel).....   "\n
5ca0: 20 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70   (null? non-comp
5cb0: 6c 65 74 65 64 29 3a 20 20 20 20 22 20 28 6e 75  leted):    " (nu
5cc0: 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65  ll? non-complete
5cd0: 64 29 0a 09 09 09 09 20 20 20 22 5c 6e 20 72 65  d).....   "\n re
5ce0: 72 75 6e 73 3a 20 20 20 20 20 20 20 20 20 20 22  runs:          "
5cf0: 20 72 65 72 75 6e 73 0a 09 09 09 09 20 20 20 22   reruns.....   "
5d00: 5c 6e 20 69 74 65 6d 73 3a 20 20 20 20 20 20 20  \n items:       
5d10: 20 20 20 20 22 20 69 74 65 6d 73 0a 09 09 09 09      " items.....
5d20: 20 20 20 22 5c 6e 20 63 61 6e 2d 72 75 6e 2d 6d     "\n can-run-m
5d30: 6f 72 65 3a 20 20 20 20 22 20 63 61 6e 2d 72 75  ore:    " can-ru
5d40: 6e 2d 6d 6f 72 65 29 0a 09 09 20 20 20 20 20 20  n-more)...      
5d50: 3b 3b 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70  ;; (thread-sleep
5d60: 21 20 28 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61  ! (+ 0.01 *globa
5d70: 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09 20 20 20  l-delta*))...   
5d80: 20 20 20 28 63 6f 6e 64 20 3b 3b 20 49 4e 4e 45     (cond ;; INNE
5d90: 52 20 43 4f 4e 44 20 23 32 0a 09 09 20 20 20 20  R COND #2...    
5da0: 20 20 20 28 28 6f 72 20 28 6e 75 6c 6c 3f 20 70     ((or (null? p
5db0: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 20  rereqs-not-met) 
5dc0: 3b 3b 20 61 6c 6c 20 70 72 65 72 65 71 73 20 6d  ;; all prereqs m
5dd0: 65 74 2c 20 66 69 72 65 20 6f 66 66 20 74 68 65  et, fire off the
5de0: 20 74 65 73 74 0a 09 09 09 20 20 20 20 3b 3b 20   test....    ;; 
5df0: 6f 72 2c 20 69 66 20 69 74 20 69 73 20 61 20 27  or, if it is a '
5e00: 74 6f 70 6c 65 76 65 6c 20 74 65 73 74 20 61 6e  toplevel test an
5e10: 64 20 61 6c 6c 20 70 72 65 72 65 71 73 20 6e 6f  d all prereqs no
5e20: 74 20 6d 65 74 20 61 72 65 20 43 4f 4d 50 4c 45  t met are COMPLE
5e30: 54 45 44 20 74 68 65 6e 20 6c 61 75 6e 63 68 0a  TED then launch.
5e40: 09 09 09 20 20 20 20 28 61 6e 64 20 28 65 71 3f  ...    (and (eq?
5e50: 20 74 65 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65   testmode 'tople
5e60: 76 65 6c 29 0a 09 09 09 09 20 28 6e 75 6c 6c 3f  vel)..... (null?
5e70: 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 29   non-completed))
5e80: 29 0a 09 09 09 28 6c 65 74 20 28 28 74 65 73 74  )....(let ((test
5e90: 2d 6e 61 6d 65 20 28 74 65 73 74 73 3a 74 65 73  -name (tests:tes
5ea0: 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e  tqueue-get-testn
5eb0: 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 29  ame test-record)
5ec0: 29 29 0a 09 09 09 20 20 28 73 65 74 65 6e 76 20  ))....  (setenv 
5ed0: 22 4d 54 5f 54 45 53 54 5f 4e 41 4d 45 22 20 74  "MT_TEST_NAME" t
5ee0: 65 73 74 2d 6e 61 6d 65 29 20 3b 3b 20 0a 09 09  est-name) ;; ...
5ef0: 09 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 52  .  (setenv "MT_R
5f00: 55 4e 4e 41 4d 45 22 20 20 20 72 75 6e 6e 61 6d  UNNAME"   runnam
5f10: 65 29 0a 09 09 09 20 20 28 73 65 74 2d 6d 65 67  e)....  (set-meg
5f20: 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 72  atest-env-vars r
5f30: 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73 65 20  un-id) ;; these 
5f40: 6d 61 79 20 62 65 20 6e 65 65 64 65 64 20 62 79  may be needed by
5f50: 20 74 68 65 20 6c 61 75 6e 63 68 69 6e 67 20 70   the launching p
5f60: 72 6f 63 65 73 73 0a 09 09 09 20 20 28 6c 65 74  rocess....  (let
5f70: 20 28 28 69 74 65 6d 73 2d 6c 69 73 74 20 28 69   ((items-list (i
5f80: 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66  tems:get-items-f
5f90: 72 6f 6d 2d 63 6f 6e 66 69 67 20 74 63 6f 6e 66  rom-config tconf
5fa0: 69 67 29 29 29 0a 09 09 09 20 20 20 20 28 69 66  ig)))....    (if
5fb0: 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 2d 6c 69   (list? items-li
5fc0: 73 74 29 0a 09 09 09 09 28 62 65 67 69 6e 0a 09  st).....(begin..
5fd0: 09 09 09 20 20 28 74 65 73 74 73 3a 74 65 73 74  ...  (tests:test
5fe0: 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 73 21  queue-set-items!
5ff0: 20 74 65 73 74 2d 72 65 63 6f 72 64 20 69 74 65   test-record ite
6000: 6d 73 2d 6c 69 73 74 29 0a 09 09 09 09 20 20 3b  ms-list).....  ;
6010: 3b 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21  ; (thread-sleep!
6020: 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29   *global-delta*)
6030: 0a 09 09 09 09 20 20 28 6c 6f 6f 70 20 68 65 64  .....  (loop hed
6040: 20 74 61 6c 20 72 65 72 75 6e 73 29 29 0a 09 09   tal reruns))...
6050: 09 09 28 62 65 67 69 6e 0a 09 09 09 09 20 20 28  ..(begin.....  (
6060: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45  debug:print 0 "E
6070: 52 52 4f 52 3a 20 54 68 65 20 70 72 6f 63 20 66  RROR: The proc f
6080: 72 6f 6d 20 72 65 61 64 69 6e 67 20 74 68 65 20  rom reading the 
6090: 73 65 74 75 70 20 64 69 64 20 6e 6f 74 20 79 69  setup did not yi
60a0: 65 6c 64 20 61 20 6c 69 73 74 20 2d 20 70 6c 65  eld a list - ple
60b0: 61 73 65 20 72 65 70 6f 72 74 20 74 68 69 73 22  ase report this"
60c0: 29 0a 09 09 09 09 20 20 28 65 78 69 74 20 31 29  ).....  (exit 1)
60d0: 29 29 29 29 29 0a 09 09 20 20 20 20 20 20 20 28  )))))...       (
60e0: 28 6e 75 6c 6c 3f 20 66 61 69 6c 73 29 0a 09 09  (null? fails)...
60f0: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e  .(debug:print-in
6100: 66 6f 20 34 20 22 66 61 69 6c 73 20 69 73 20 6e  fo 4 "fails is n
6110: 75 6c 6c 2c 20 6d 6f 76 69 6e 67 20 6f 6e 20 69  ull, moving on i
6120: 6e 20 74 68 65 20 71 75 65 75 65 20 62 75 74 20  n the queue but 
6130: 6b 65 65 70 69 6e 67 20 22 20 68 65 64 20 22 20  keeping " hed " 
6140: 66 6f 72 20 6e 6f 77 22 29 0a 09 09 09 3b 3b 20  for now")....;; 
6150: 6f 6e 6c 79 20 69 6e 63 72 65 6d 65 6e 74 20 6e  only increment n
6160: 75 6d 2d 72 65 74 72 69 65 73 20 77 68 65 6e 20  um-retries when 
6170: 74 68 65 72 65 20 61 72 65 20 6e 6f 20 74 65 73  there are no tes
6180: 74 73 20 72 75 6e 69 6e 67 0a 09 09 09 28 69 66  ts runing....(if
6190: 20 28 65 71 3f 20 30 20 28 6c 69 73 74 2d 72 65   (eq? 0 (list-re
61a0: 66 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 20 31  f can-run-more 1
61b0: 29 29 0a 09 09 09 20 20 20 20 28 62 65 67 69 6e  ))....    (begin
61c0: 0a 09 09 09 20 20 20 20 20 20 28 69 66 20 28 3e  ....      (if (>
61d0: 20 6e 75 6d 2d 72 65 74 72 69 65 73 20 31 30 30   num-retries 100
61e0: 29 20 3b 3b 20 66 69 72 73 74 20 31 30 30 20 72  ) ;; first 100 r
61f0: 65 74 72 69 65 73 20 61 72 65 20 6c 6f 77 20 74  etries are low t
6200: 69 6d 65 20 63 6f 73 74 0a 09 09 09 09 20 20 28  ime cost.....  (
6210: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b  thread-sleep! (+
6220: 20 32 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61   2 *global-delta
6230: 2a 29 29 0a 09 09 09 09 20 20 28 74 68 72 65 61  *)).....  (threa
6240: 64 2d 73 6c 65 65 70 21 20 28 2b 20 30 2e 30 31  d-sleep! (+ 0.01
6250: 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29   *global-delta*)
6260: 29 29 0a 09 09 09 20 20 20 20 20 20 28 73 65 74  ))....      (set
6270: 21 20 6e 75 6d 2d 72 65 74 72 69 65 73 20 28 2b  ! num-retries (+
6280: 20 6e 75 6d 2d 72 65 74 72 69 65 73 20 31 29 29   num-retries 1))
6290: 29 29 0a 09 09 09 28 69 66 20 28 3e 20 6e 75 6d  ))....(if (> num
62a0: 2d 72 65 74 72 69 65 73 20 20 6d 61 78 2d 72 65  -retries  max-re
62b0: 74 72 69 65 73 29 0a 09 09 09 20 20 20 20 28 69  tries)....    (i
62c0: 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61  f (not (null? ta
62d0: 6c 29 29 0a 09 09 09 09 28 6c 6f 6f 70 20 28 63  l)).....(loop (c
62e0: 61 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29  ar tal)(cdr tal)
62f0: 20 72 65 72 75 6e 73 29 29 0a 09 09 09 20 20 20   reruns))....   
6300: 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74   (loop (car newt
6310: 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20  al)(cdr newtal) 
6320: 72 65 72 75 6e 73 29 29 29 20 3b 3b 20 61 6e 20  reruns))) ;; an 
6330: 69 73 73 75 65 20 77 69 74 68 20 70 72 65 72 65  issue with prere
6340: 71 73 20 6e 6f 74 20 79 65 74 20 6d 65 74 3f 0a  qs not yet met?.
6350: 09 09 20 20 20 20 20 20 20 28 28 61 6e 64 20 28  ..       ((and (
6360: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 66 61 69 6c 73  not (null? fails
6370: 29 29 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20  ))(eq? testmode 
6380: 27 6e 6f 72 6d 61 6c 29 29 0a 09 09 09 28 64 65  'normal))....(de
6390: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31  bug:print-info 1
63a0: 20 22 74 65 73 74 20 22 20 20 68 65 64 20 22 20   "test "  hed " 
63b0: 28 6d 6f 64 65 3d 22 20 74 65 73 74 6d 6f 64 65  (mode=" testmode
63c0: 20 22 29 20 68 61 73 20 66 61 69 6c 65 64 20 70   ") has failed p
63d0: 72 65 72 65 71 75 69 73 69 74 65 28 73 29 3b 20  rerequisite(s); 
63e0: 22 0a 09 09 09 09 20 20 20 20 20 28 73 74 72 69  ".....     (stri
63f0: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28  ng-intersperse (
6400: 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 74 29 28  map (lambda (t)(
6410: 63 6f 6e 63 20 28 64 62 3a 74 65 73 74 2d 67 65  conc (db:test-ge
6420: 74 2d 74 65 73 74 6e 61 6d 65 20 74 29 20 22 3a  t-testname t) ":
6430: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73  " (db:test-get-s
6440: 74 61 74 65 20 74 29 22 2f 22 28 64 62 3a 74 65  tate t)"/"(db:te
6450: 73 74 2d 67 65 74 2d 73 74 61 74 75 73 20 74 29  st-get-status t)
6460: 29 29 20 66 61 69 6c 73 29 20 22 2c 20 22 29 0a  )) fails) ", ").
6470: 09 09 09 09 20 20 20 20 20 22 2c 20 72 65 6d 6f  ....     ", remo
6480: 76 69 6e 67 20 69 74 20 66 72 6f 6d 20 74 6f 2d  ving it from to-
6490: 64 6f 20 6c 69 73 74 22 29 0a 09 09 09 28 69 66  do list")....(if
64a0: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c   (not (null? tal
64b0: 29 29 0a 09 09 09 20 20 20 20 28 62 65 67 69 6e  ))....    (begin
64c0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  .               
64d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b                 ;
64e0: 3b 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21  ; (thread-sleep!
64f0: 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29   *global-delta*)
6500: 0a 09 09 09 20 20 20 20 20 20 28 6c 6f 6f 70 20  ....      (loop 
6510: 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74 61  (car tal)(cdr ta
6520: 6c 29 28 63 6f 6e 73 20 68 65 64 20 72 65 72 75  l)(cons hed reru
6530: 6e 73 29 29 29 29 29 0a 09 09 20 20 20 20 20 20  ns)))))...      
6540: 20 28 65 6c 73 65 0a 09 09 09 28 64 65 62 75 67   (else....(debug
6550: 3a 70 72 69 6e 74 20 38 20 22 45 52 52 4f 52 3a  :print 8 "ERROR:
6560: 20 4e 6f 20 68 61 6e 64 6c 65 72 20 66 6f 72 20   No handler for 
6570: 74 68 69 73 20 63 6f 6e 64 69 74 69 6f 6e 2e 22  this condition."
6580: 29 0a 09 09 09 28 74 68 72 65 61 64 2d 73 6c 65  )....(thread-sle
6590: 65 70 21 20 28 2b 20 31 20 2a 67 6c 6f 62 61 6c  ep! (+ 1 *global
65a0: 2d 64 65 6c 74 61 2a 29 29 0a 09 09 09 28 6c 6f  -delta*))....(lo
65b0: 6f 70 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28  op (car newtal)(
65c0: 63 64 72 20 6e 65 77 74 61 6c 29 20 72 65 72 75  cdr newtal) reru
65d0: 6e 73 29 29 29 29 20 3b 3b 20 45 4e 44 20 4f 46  ns)))) ;; END OF
65e0: 20 49 46 20 43 41 4e 20 52 55 4e 20 4d 4f 52 45   IF CAN RUN MORE
65f0: 0a 0a 09 09 20 20 20 20 3b 3b 20 69 66 20 63 61  ....    ;; if ca
6600: 6e 27 74 20 72 75 6e 20 6d 6f 72 65 20 6a 75 73  n't run more jus
6610: 74 20 6c 6f 6f 70 20 77 69 74 68 20 6e 65 78 74  t loop with next
6620: 20 70 6f 73 73 69 62 6c 65 20 74 65 73 74 0a 09   possible test..
6630: 09 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20  .    (begin...  
6640: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
6650: 2d 69 6e 66 6f 20 34 20 22 70 72 6f 63 65 73 73  -info 4 "process
6660: 69 6e 67 20 74 68 65 20 63 61 73 65 20 77 69 74  ing the case wit
6670: 68 20 61 20 6c 61 6d 62 64 61 20 66 6f 72 20 69  h a lambda for i
6680: 74 65 6d 73 20 6f 72 20 27 68 61 76 65 2d 70 72  tems or 'have-pr
6690: 6f 63 65 64 75 72 65 2e 20 4d 6f 76 69 6e 67 20  ocedure. Moving 
66a0: 74 68 72 6f 75 67 68 20 74 68 65 20 71 75 65 75  through the queu
66b0: 65 20 77 69 74 68 6f 75 74 20 64 72 6f 70 70 69  e without droppi
66c0: 6e 67 20 22 20 68 65 64 29 0a 09 09 20 20 20 20  ng " hed)...    
66d0: 20 20 3b 3b 20 28 74 68 72 65 61 64 2d 73 6c 65    ;; (thread-sle
66e0: 65 70 21 20 28 2b 20 32 20 2a 67 6c 6f 62 61 6c  ep! (+ 2 *global
66f0: 2d 64 65 6c 74 61 2a 29 29 0a 09 09 20 20 20 20  -delta*))...    
6700: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77    (loop (car new
6710: 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29  tal)(cdr newtal)
6720: 20 72 65 72 75 6e 73 29 29 29 29 29 20 3b 3b 20   reruns))))) ;; 
6730: 45 4e 44 20 4f 46 20 28 6f 72 20 28 70 72 6f 63  END OF (or (proc
6740: 65 64 75 72 65 3f 20 69 74 65 6d 73 29 28 65 71  edure? items)(eq
6750: 3f 20 69 74 65 6d 73 20 27 68 61 76 65 2d 70 72  ? items 'have-pr
6760: 6f 63 65 64 75 72 65 29 29 0a 09 20 20 20 20 20  ocedure))..     
6770: 0a 09 20 20 20 20 20 3b 3b 20 74 68 69 73 20 63  ..     ;; this c
6780: 61 73 65 20 73 68 6f 75 6c 64 20 6e 6f 74 20 68  ase should not h
6790: 61 70 70 65 6e 2c 20 61 64 64 65 64 20 74 6f 20  appen, added to 
67a0: 68 65 6c 70 20 63 61 74 63 68 20 61 6e 79 20 62  help catch any b
67b0: 75 67 73 0a 09 20 20 20 20 20 28 28 61 6e 64 20  ugs..     ((and 
67c0: 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 69 74  (list? items) it
67d0: 65 6d 64 61 74 29 0a 09 20 20 20 20 20 20 28 64  emdat)..      (d
67e0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
67f0: 52 4f 52 3a 20 53 68 6f 75 6c 64 20 6e 6f 74 20  ROR: Should not 
6800: 68 61 76 65 20 61 20 6c 69 73 74 20 6f 66 20 69  have a list of i
6810: 74 65 6d 73 20 69 6e 20 61 20 74 65 73 74 20 61  tems in a test a
6820: 6e 64 20 74 68 65 20 69 74 65 6d 73 70 61 74 68  nd the itemspath
6830: 20 73 65 74 20 2d 20 70 6c 65 61 73 65 20 72 65   set - please re
6840: 70 6f 72 74 20 74 68 69 73 22 29 0a 09 20 20 20  port this")..   
6850: 20 20 20 28 65 78 69 74 20 31 29 29 0a 09 20 20     (exit 1))..  
6860: 20 20 20 28 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20     ((not (null? 
6870: 72 65 72 75 6e 73 29 29 0a 09 20 20 20 20 20 20  reruns))..      
6880: 28 6c 65 74 2a 20 28 28 6e 65 77 6c 73 74 20 28  (let* ((newlst (
6890: 74 65 73 74 73 3a 66 69 6c 74 65 72 2d 6e 6f 6e  tests:filter-non
68a0: 2d 72 75 6e 6e 61 62 6c 65 20 72 75 6e 2d 69 64  -runnable run-id
68b0: 20 74 61 6c 20 74 65 73 74 2d 72 65 63 6f 72 64   tal test-record
68c0: 73 29 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f 74 20  s)) ;; i.e. not 
68d0: 46 41 49 4c 2c 20 57 41 49 56 45 44 2c 20 49 4e  FAIL, WAIVED, IN
68e0: 43 4f 4d 50 4c 45 54 45 2c 20 50 41 53 53 2c 20  COMPLETE, PASS, 
68f0: 4b 49 4c 4c 45 44 2c 0a 09 09 20 20 20 20 20 28  KILLED,...     (
6900: 6a 75 6e 6b 65 64 20 28 6c 73 65 74 2d 64 69 66  junked (lset-dif
6910: 66 65 72 65 6e 63 65 20 65 71 75 61 6c 3f 20 74  ference equal? t
6920: 61 6c 20 6e 65 77 6c 73 74 29 29 29 0a 09 09 28  al newlst)))...(
6930: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
6940: 20 34 20 22 66 75 6c 6c 20 64 72 6f 70 20 74 68   4 "full drop th
6950: 72 6f 75 67 68 2c 20 69 66 20 72 65 72 75 6e 73  rough, if reruns
6960: 20 69 73 20 6c 65 73 73 20 74 68 61 6e 20 31 30   is less than 10
6970: 30 20 77 65 20 77 69 6c 6c 20 66 6f 72 63 65 20  0 we will force 
6980: 72 65 74 72 79 20 74 68 65 6d 2c 20 72 65 72 75  retry them, reru
6990: 6e 73 3d 22 20 72 65 72 75 6e 73 20 22 2c 20 74  ns=" reruns ", t
69a0: 61 6c 3d 22 20 74 61 6c 29 0a 09 09 28 69 66 20  al=" tal)...(if 
69b0: 28 3c 20 6e 75 6d 2d 72 65 74 72 69 65 73 20 6d  (< num-retries m
69c0: 61 78 2d 72 65 74 72 69 65 73 29 0a 09 09 20 20  ax-retries)...  
69d0: 20 20 28 73 65 74 21 20 6e 65 77 6c 73 74 20 28    (set! newlst (
69e0: 61 70 70 65 6e 64 20 72 65 72 75 6e 73 20 6e 65  append reruns ne
69f0: 77 6c 73 74 29 29 29 0a 09 09 28 73 65 74 21 20  wlst)))...(set! 
6a00: 6e 75 6d 2d 72 65 74 72 69 65 73 20 28 2b 20 6e  num-retries (+ n
6a10: 75 6d 2d 72 65 74 72 69 65 73 20 31 29 29 0a 09  um-retries 1))..
6a20: 09 3b 3b 20 28 74 68 72 65 61 64 2d 73 6c 65 65  .;; (thread-slee
6a30: 70 21 20 28 2b 20 31 20 2a 67 6c 6f 62 61 6c 2d  p! (+ 1 *global-
6a40: 64 65 6c 74 61 2a 29 29 0a 09 09 28 69 66 20 28  delta*))...(if (
6a50: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 6e 65 77 6c 73  not (null? newls
6a60: 74 29 29 0a 09 09 20 20 20 20 3b 3b 20 73 69 6e  t))...    ;; sin
6a70: 63 65 20 72 65 72 75 6e 73 20 68 61 76 65 20 62  ce reruns have b
6a80: 65 65 6e 20 74 61 63 6b 65 64 20 6f 6e 20 74 6f  een tacked on to
6a90: 20 6e 65 77 6c 73 74 20 63 72 65 61 74 65 20 6e   newlst create n
6aa0: 65 77 20 72 65 72 75 6e 73 20 66 72 6f 6d 20 6a  ew reruns from j
6ab0: 75 6e 6b 65 64 0a 09 09 20 20 20 20 28 6c 6f 6f  unked...    (loo
6ac0: 70 20 28 63 61 72 20 6e 65 77 6c 73 74 29 28 63  p (car newlst)(c
6ad0: 64 72 20 6e 65 77 6c 73 74 29 28 64 65 6c 65 74  dr newlst)(delet
6ae0: 65 2d 64 75 70 6c 69 63 61 74 65 73 20 6a 75 6e  e-duplicates jun
6af0: 6b 65 64 29 29 29 29 29 0a 09 20 20 20 20 20 28  ked)))))..     (
6b00: 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29  (not (null? tal)
6b10: 29 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 3a  )..      (debug:
6b20: 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 49 27  print-info 4 "I'
6b30: 6d 20 70 72 65 74 74 79 20 73 75 72 65 20 49 20  m pretty sure I 
6b40: 73 68 6f 75 6c 64 6e 27 74 20 67 65 74 20 68 65  shouldn't get he
6b50: 72 65 2e 22 29 29 0a 09 20 20 20 20 20 28 65 6c  re."))..     (el
6b60: 73 65 0a 09 20 20 20 20 20 20 28 64 65 62 75 67  se..      (debug
6b70: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 45  :print-info 4 "E
6b80: 78 69 74 69 6e 67 20 6c 6f 6f 70 20 77 69 74 68  xiting loop with
6b90: 2e 2e 2e 5c 6e 20 20 68 65 64 3d 22 20 68 65 64  ...\n  hed=" hed
6ba0: 20 22 5c 6e 20 20 74 61 6c 3d 22 20 74 61 6c 20   "\n  tal=" tal 
6bb0: 22 5c 6e 20 20 72 65 72 75 6e 73 3d 22 20 72 65  "\n  reruns=" re
6bc0: 72 75 6e 73 29 29 0a 09 20 20 20 20 20 29 29 29  runs))..     )))
6bd0: 29 20 3b 3b 20 4c 45 54 2a 20 28 28 74 65 73 74  ) ;; LET* ((test
6be0: 2d 72 65 63 6f 72 64 0a 0a 20 20 20 20 3b 3b 20  -record..    ;; 
6bf0: 77 65 20 67 65 74 20 68 65 72 65 20 6f 6e 20 22  we get here on "
6c00: 64 72 6f 70 20 74 68 72 6f 75 67 68 22 20 2d 20  drop through" - 
6c10: 6c 6f 6f 70 20 66 6f 72 20 6e 65 78 74 20 74 65  loop for next te
6c20: 73 74 20 69 6e 20 71 75 65 75 65 0a 20 20 20 20  st in queue.    
6c30: 3b 3b 20 46 49 58 4d 45 21 21 21 21 20 54 48 49  ;; FIXME!!!! THI
6c40: 53 20 53 48 4f 55 4c 44 20 4e 4f 54 20 52 45 51  S SHOULD NOT REQ
6c50: 55 49 52 45 20 41 4e 20 45 58 49 54 21 21 21 21  UIRE AN EXIT!!!!
6c60: 21 21 21 0a 20 20 20 20 0a 20 20 20 20 28 64 65  !!!.    .    (de
6c70: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31  bug:print-info 1
6c80: 20 22 41 6c 6c 20 74 65 73 74 73 20 6c 61 75 6e   "All tests laun
6c90: 63 68 65 64 22 29 0a 20 20 20 20 28 74 68 72 65  ched").    (thre
6ca0: 61 64 2d 73 6c 65 65 70 21 20 30 2e 35 29 0a 20  ad-sleep! 0.5). 
6cb0: 20 20 20 3b 3b 20 46 49 58 4d 45 21 20 54 68 69     ;; FIXME! Thi
6cc0: 73 20 68 61 72 73 68 20 65 78 69 74 20 73 68 6f  s harsh exit sho
6cd0: 75 6c 64 20 6e 6f 74 20 62 65 20 6e 65 63 65 73  uld not be neces
6ce0: 73 61 72 79 2e 2e 2e 2e 0a 20 20 20 20 3b 3b 20  sary.....    ;; 
6cf0: 28 69 66 20 28 6e 6f 74 20 2a 72 75 6e 72 65 6d  (if (not *runrem
6d00: 6f 74 65 2a 29 28 65 78 69 74 29 29 20 3b 3b 20  ote*)(exit)) ;; 
6d10: 0a 20 20 20 20 23 66 29 29 20 3b 3b 20 72 65 74  .    #f)) ;; ret
6d20: 75 72 6e 20 61 20 23 66 20 61 73 20 61 20 68 69  urn a #f as a hi
6d30: 6e 74 20 74 68 61 74 20 77 65 20 61 72 65 20 64  nt that we are d
6d40: 6f 6e 65 0a 20 20 3b 3b 20 48 65 72 65 20 77 65  one.  ;; Here we
6d50: 20 6e 65 65 64 20 74 6f 20 63 68 65 63 6b 20 74   need to check t
6d60: 68 61 74 20 61 6c 6c 20 74 68 65 20 74 65 73 74  hat all the test
6d70: 73 20 72 65 6d 61 69 6e 69 6e 67 20 74 6f 20 62  s remaining to b
6d80: 65 20 72 75 6e 20 61 72 65 20 65 6c 69 67 69 62  e run are eligib
6d90: 6c 65 20 74 6f 20 72 75 6e 0a 20 20 3b 3b 20 61  le to run.  ;; a
6da0: 6e 64 20 61 72 65 20 6e 6f 74 20 62 6c 6f 63 6b  nd are not block
6db0: 65 64 20 62 79 20 66 61 69 6c 65 64 0a 20 20 0a  ed by failed.  .
6dc0: 0a 3b 3b 20 70 61 72 65 6e 74 2d 74 65 73 74 20  .;; parent-test 
6dd0: 69 73 20 74 68 65 72 65 20 61 73 20 61 20 70 6c  is there as a pl
6de0: 61 63 65 68 6f 6c 64 65 72 20 66 6f 72 20 77 68  aceholder for wh
6df0: 65 6e 20 70 61 72 65 6e 74 2d 74 65 73 74 73 20  en parent-tests 
6e00: 63 61 6e 20 62 65 20 72 75 6e 20 61 73 20 61 20  can be run as a 
6e10: 73 65 74 75 70 20 73 74 65 70 0a 28 64 65 66 69  setup step.(defi
6e20: 6e 65 20 28 72 75 6e 3a 74 65 73 74 20 72 75 6e  ne (run:test run
6e30: 2d 69 64 20 72 75 6e 6e 61 6d 65 20 6b 65 79 76  -id runname keyv
6e40: 61 6c 6c 73 74 20 74 65 73 74 2d 72 65 63 6f 72  allst test-recor
6e50: 64 20 66 6c 61 67 73 20 70 61 72 65 6e 74 2d 74  d flags parent-t
6e60: 65 73 74 29 0a 20 20 3b 3b 20 41 6c 6c 20 74 68  est).  ;; All th
6e70: 65 73 65 20 76 61 72 73 20 6d 69 67 68 74 20 62  ese vars might b
6e80: 65 20 72 65 66 65 72 65 6e 63 65 64 20 62 79 20  e referenced by 
6e90: 74 68 65 20 74 65 73 74 63 6f 6e 66 69 67 20 66  the testconfig f
6ea0: 69 6c 65 20 72 65 61 64 65 72 0a 20 20 28 6c 65  ile reader.  (le
6eb0: 74 2a 20 28 28 74 65 73 74 2d 6e 61 6d 65 20 20  t* ((test-name  
6ec0: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65    (tests:testque
6ed0: 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20  ue-get-testname 
6ee0: 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a    test-record)).
6ef0: 09 20 28 74 65 73 74 2d 77 61 69 74 6f 6e 73 20  . (test-waitons 
6f00: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65  (tests:testqueue
6f10: 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20 20 20 20  -get-waitons    
6f20: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20  test-record)).. 
6f30: 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 20 28 74  (test-conf    (t
6f40: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67  ests:testqueue-g
6f50: 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 74 65  et-testconfig te
6f60: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 69  st-record)).. (i
6f70: 74 65 6d 64 61 74 20 20 20 20 20 20 28 74 65 73  temdat      (tes
6f80: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
6f90: 2d 69 74 65 6d 64 61 74 20 20 20 20 74 65 73 74  -itemdat    test
6fa0: 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65 73  -record)).. (tes
6fb0: 74 2d 70 61 74 68 20 20 20 20 28 63 6f 6e 63 20  t-path    (conc 
6fc0: 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74  *toppath* "/test
6fd0: 73 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29 29 20  s/" test-name)) 
6fe0: 3b 3b 20 63 6f 75 6c 64 20 75 73 65 20 74 65 73  ;; could use tes
6ff0: 74 73 3a 67 65 74 2d 74 65 73 74 63 6f 6e 66 69  ts:get-testconfi
7000: 67 20 68 65 72 65 20 2e 2e 2e 0a 09 20 28 66 6f  g here ..... (fo
7010: 72 63 65 20 20 20 20 20 20 20 20 28 68 61 73 68  rce        (hash
7020: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75  -table-ref/defau
7030: 6c 74 20 66 6c 61 67 73 20 22 2d 66 6f 72 63 65  lt flags "-force
7040: 22 20 23 66 29 29 0a 09 20 28 72 65 72 75 6e 20  " #f)).. (rerun 
7050: 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 62         (hash-tab
7060: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66  le-ref/default f
7070: 6c 61 67 73 20 22 2d 72 65 72 75 6e 22 20 23 66  lags "-rerun" #f
7080: 29 29 0a 09 20 28 6b 65 65 70 67 6f 69 6e 67 20  )).. (keepgoing 
7090: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72     (hash-table-r
70a0: 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73  ef/default flags
70b0: 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 20 23 66   "-keepgoing" #f
70c0: 29 29 0a 09 20 28 69 74 65 6d 2d 70 61 74 68 20  )).. (item-path 
70d0: 20 20 20 20 22 22 29 0a 09 20 28 64 62 20 20 20      "").. (db   
70e0: 20 20 20 20 20 20 20 20 23 66 29 29 0a 20 20 20          #f)).   
70f0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 0a   (debug:print 4.
7100: 09 09 20 22 74 65 73 74 2d 63 6f 6e 66 69 67 3a  .. "test-config:
7110: 20 22 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e   " (hash-table->
7120: 61 6c 69 73 74 20 74 65 73 74 2d 63 6f 6e 66 29  alist test-conf)
7130: 0a 09 09 20 22 5c 6e 20 20 20 69 74 65 6d 64 61  ... "\n   itemda
7140: 74 3a 20 22 20 69 74 65 6d 64 61 74 0a 09 09 20  t: " itemdat... 
7150: 29 0a 20 20 20 20 3b 3b 20 73 65 74 74 69 6e 67  ).    ;; setting
7160: 20 69 74 65 6d 64 61 74 20 74 6f 20 61 20 6c 69   itemdat to a li
7170: 73 74 20 69 66 20 69 74 20 69 73 20 23 66 0a 20  st if it is #f. 
7180: 20 20 20 28 69 66 20 28 6e 6f 74 20 69 74 65 6d     (if (not item
7190: 64 61 74 29 28 73 65 74 21 20 69 74 65 6d 64 61  dat)(set! itemda
71a0: 74 20 27 28 29 29 29 0a 20 20 20 20 28 73 65 74  t '())).    (set
71b0: 21 20 69 74 65 6d 2d 70 61 74 68 20 28 69 74 65  ! item-path (ite
71c0: 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 65  m-list->path ite
71d0: 6d 64 61 74 29 29 0a 20 20 20 20 28 64 65 62 75  mdat)).    (debu
71e0: 67 3a 70 72 69 6e 74 20 32 20 22 41 74 74 65 6d  g:print 2 "Attem
71f0: 70 74 69 6e 67 20 74 6f 20 6c 61 75 6e 63 68 20  pting to launch 
7200: 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65  test " test-name
7210: 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65   (if (equal? ite
7220: 6d 2d 70 61 74 68 20 22 2f 22 29 20 22 2f 22 20  m-path "/") "/" 
7230: 69 74 65 6d 2d 70 61 74 68 29 29 0a 20 20 20 20  item-path)).    
7240: 28 73 65 74 65 6e 76 20 22 4d 54 5f 54 45 53 54  (setenv "MT_TEST
7250: 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65  _NAME" test-name
7260: 29 20 3b 3b 20 0a 20 20 20 20 28 73 65 74 65 6e  ) ;; .    (seten
7270: 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20  v "MT_RUNNAME"  
7280: 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20 28 73   runname).    (s
7290: 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d  et-megatest-env-
72a0: 76 61 72 73 20 72 75 6e 2d 69 64 29 20 3b 3b 20  vars run-id) ;; 
72b0: 74 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65  these may be nee
72c0: 64 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63  ded by the launc
72d0: 68 69 6e 67 20 70 72 6f 63 65 73 73 0a 20 20 20  hing process.   
72e0: 20 28 63 68 61 6e 67 65 2d 64 69 72 65 63 74 6f   (change-directo
72f0: 72 79 20 2a 74 6f 70 70 61 74 68 2a 29 0a 0a 20  ry *toppath*).. 
7300: 20 20 20 3b 3b 20 48 65 72 65 20 69 73 20 77 68     ;; Here is wh
7310: 65 72 65 20 74 68 65 20 74 65 73 74 5f 6d 65 74  ere the test_met
7320: 61 20 74 61 62 6c 65 20 69 73 20 62 65 73 74 20  a table is best 
7330: 75 70 64 61 74 65 64 0a 20 20 20 20 3b 3b 20 59  updated.    ;; Y
7340: 65 73 2c 20 61 6e 6f 74 68 65 72 20 75 73 65 20  es, another use 
7350: 6f 66 20 61 20 67 6c 6f 62 61 6c 20 66 6f 72 20  of a global for 
7360: 63 61 63 68 69 6e 67 2e 20 4e 65 65 64 20 61 20  caching. Need a 
7370: 62 65 74 74 65 72 20 77 61 79 3f 0a 20 20 20 20  better way?.    
7380: 28 69 66 20 28 6e 6f 74 20 28 68 61 73 68 2d 74  (if (not (hash-t
7390: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74  able-ref/default
73a0: 20 2a 74 65 73 74 2d 6d 65 74 61 2d 75 70 64 61   *test-meta-upda
73b0: 74 65 64 2a 20 74 65 73 74 2d 6e 61 6d 65 20 23  ted* test-name #
73c0: 66 29 29 0a 20 20 20 20 20 20 20 20 28 62 65 67  f)).        (beg
73d0: 69 6e 0a 09 20 20 20 28 68 61 73 68 2d 74 61 62  in..   (hash-tab
73e0: 6c 65 2d 73 65 74 21 20 2a 74 65 73 74 2d 6d 65  le-set! *test-me
73f0: 74 61 2d 75 70 64 61 74 65 64 2a 20 74 65 73 74  ta-updated* test
7400: 2d 6e 61 6d 65 20 23 74 29 0a 20 20 20 20 20 20  -name #t).      
7410: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
7420: 6c 6f 73 65 20 72 75 6e 73 3a 75 70 64 61 74 65  lose runs:update
7430: 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20 74 65  -test_meta db te
7440: 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e  st-name test-con
7450: 66 29 29 29 0a 20 20 20 20 0a 20 20 20 20 3b 3b  f))).    .    ;;
7460: 20 28 6c 61 6d 62 64 61 20 28 69 74 65 6d 64 61   (lambda (itemda
7470: 74 29 20 3b 3b 3b 20 28 28 72 69 70 65 6e 65 73  t) ;;; ((ripenes
7480: 73 20 22 6f 76 65 72 72 69 70 65 22 29 20 28 74  s "overripe") (t
7490: 65 6d 70 65 72 61 74 75 72 65 20 22 63 6f 6f 6c  emperature "cool
74a0: 22 29 20 28 73 65 61 73 6f 6e 20 22 73 75 6d 6d  ") (season "summ
74b0: 65 72 22 29 29 0a 20 20 20 20 28 6c 65 74 2a 20  er")).    (let* 
74c0: 28 28 6e 65 77 2d 74 65 73 74 2d 70 61 74 68 20  ((new-test-path 
74d0: 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65  (string-interspe
74e0: 72 73 65 20 28 63 6f 6e 73 20 74 65 73 74 2d 70  rse (cons test-p
74f0: 61 74 68 20 28 6d 61 70 20 63 61 64 72 20 69 74  ath (map cadr it
7500: 65 6d 64 61 74 29 29 20 22 2f 22 29 29 0a 09 20  emdat)) "/")).. 
7510: 20 20 28 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65    (new-test-name
7520: 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65   (if (equal? ite
7530: 6d 2d 70 61 74 68 20 22 22 29 20 74 65 73 74 2d  m-path "") test-
7540: 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 2d  name (conc test-
7550: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61  name "/" item-pa
7560: 74 68 29 29 29 20 3b 3b 20 6a 75 73 74 20 6e 65  th))) ;; just ne
7570: 65 64 20 69 74 20 74 6f 20 62 65 20 75 6e 69 71  ed it to be uniq
7580: 75 65 0a 09 20 20 20 28 74 65 73 74 2d 69 64 20  ue..   (test-id 
7590: 20 20 20 20 20 20 28 63 64 62 3a 72 65 6d 6f 74        (cdb:remot
75a0: 65 2d 72 75 6e 20 64 62 3a 67 65 74 2d 74 65 73  e-run db:get-tes
75b0: 74 2d 69 64 20 23 66 20 20 72 75 6e 2d 69 64 20  t-id #f  run-id 
75c0: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70  test-name item-p
75d0: 61 74 68 29 29 0a 09 20 20 20 28 74 65 73 74 64  ath))..   (testd
75e0: 61 74 20 20 20 20 20 20 20 28 63 64 62 3a 67 65  at       (cdb:ge
75f0: 74 2d 74 65 73 74 2d 69 6e 66 6f 2d 62 79 2d 69  t-test-info-by-i
7600: 64 20 2a 72 75 6e 72 65 6d 6f 74 65 2a 20 74 65  d *runremote* te
7610: 73 74 2d 69 64 29 29 29 0a 20 20 20 20 20 20 28  st-id))).      (
7620: 69 66 20 28 6e 6f 74 20 74 65 73 74 64 61 74 29  if (not testdat)
7630: 0a 09 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20  ..  (begin..    
7640: 3b 3b 20 65 6e 73 75 72 65 20 74 68 61 74 20 74  ;; ensure that t
7650: 68 65 20 70 61 74 68 20 65 78 69 73 74 73 20 62  he path exists b
7660: 65 66 6f 72 65 20 72 65 67 69 73 74 65 72 69 6e  efore registerin
7670: 67 20 74 68 65 20 74 65 73 74 0a 09 20 20 20 20  g the test..    
7680: 3b 3b 20 4e 4f 50 45 3a 20 43 61 6e 6e 6f 74 21  ;; NOPE: Cannot!
7690: 20 44 6f 6e 27 74 20 6b 6e 6f 77 20 79 65 74 20   Don't know yet 
76a0: 77 68 69 63 68 20 64 69 73 6b 20 61 72 65 61 20  which disk area 
76b0: 77 69 6c 6c 20 62 65 20 61 73 73 69 67 6e 65 64  will be assigned
76c0: 2e 2e 2e 2e 0a 09 20 20 20 20 3b 3b 20 28 73 79  ......    ;; (sy
76d0: 73 74 65 6d 20 28 63 6f 6e 63 20 22 6d 6b 64 69  stem (conc "mkdi
76e0: 72 20 2d 70 20 22 20 6e 65 77 2d 74 65 73 74 2d  r -p " new-test-
76f0: 70 61 74 68 29 29 0a 09 20 20 20 20 3b 3b 0a 09  path))..    ;;..
7700: 20 20 20 20 3b 3b 20 28 6f 70 65 6e 2d 72 75 6e      ;; (open-run
7710: 2d 63 6c 6f 73 65 20 74 65 73 74 73 3a 72 65 67  -close tests:reg
7720: 69 73 74 65 72 2d 74 65 73 74 20 64 62 20 72 75  ister-test db ru
7730: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69  n-id test-name i
7740: 74 65 6d 2d 70 61 74 68 29 0a 09 20 20 20 20 3b  tem-path)..    ;
7750: 3b 0a 09 20 20 20 20 3b 3b 20 4e 42 2f 2f 20 66  ;..    ;; NB// f
7760: 6f 72 20 74 68 65 20 61 62 6f 76 65 20 6c 69 6e  or the above lin
7770: 65 2e 20 49 20 77 61 6e 74 20 74 68 65 20 74 65  e. I want the te
7780: 73 74 20 74 6f 20 62 65 20 72 65 67 69 73 74 65  st to be registe
7790: 72 65 64 20 6c 6f 6e 67 20 62 65 66 6f 72 65 20  red long before 
77a0: 74 68 69 73 20 72 6f 75 74 69 6e 65 20 67 65 74  this routine get
77b0: 73 20 63 61 6c 6c 65 64 21 0a 09 20 20 20 20 3b  s called!..    ;
77c0: 3b 0a 09 20 20 20 20 28 73 65 74 21 20 74 65 73  ;..    (set! tes
77d0: 74 2d 69 64 20 28 6f 70 65 6e 2d 72 75 6e 2d 63  t-id (open-run-c
77e0: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74  lose db:get-test
77f0: 2d 69 64 20 64 62 20 72 75 6e 2d 69 64 20 74 65  -id db run-id te
7800: 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74  st-name item-pat
7810: 68 29 29 0a 09 20 20 20 20 28 69 66 20 28 6e 6f  h))..    (if (no
7820: 74 20 74 65 73 74 2d 69 64 29 0a 09 09 28 62 65  t test-id)...(be
7830: 67 69 6e 0a 09 09 20 20 28 64 65 62 75 67 3a 70  gin...  (debug:p
7840: 72 69 6e 74 20 32 20 22 57 41 52 4e 3a 20 54 65  rint 2 "WARN: Te
7850: 73 74 20 6e 6f 74 20 70 72 65 2d 63 72 65 61 74  st not pre-creat
7860: 65 64 3f 20 74 65 73 74 2d 6e 61 6d 65 3d 22 20  ed? test-name=" 
7870: 74 65 73 74 2d 6e 61 6d 65 20 22 2c 20 69 74 65  test-name ", ite
7880: 6d 2d 70 61 74 68 3d 22 20 69 74 65 6d 2d 70 61  m-path=" item-pa
7890: 74 68 20 22 2c 20 72 75 6e 2d 69 64 3d 22 20 72  th ", run-id=" r
78a0: 75 6e 2d 69 64 29 0a 09 09 20 20 28 63 64 62 3a  un-id)...  (cdb:
78b0: 74 65 73 74 73 2d 72 65 67 69 73 74 65 72 2d 74  tests-register-t
78c0: 65 73 74 20 2a 72 75 6e 2d 72 65 6d 6f 74 65 2a  est *run-remote*
78d0: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d   run-id test-nam
78e0: 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 09 20  e item-path)... 
78f0: 20 28 73 65 74 21 20 74 65 73 74 2d 69 64 20 28   (set! test-id (
7900: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64  open-run-close d
7910: 62 3a 67 65 74 2d 74 65 73 74 2d 69 64 20 64 62  b:get-test-id db
7920: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d   run-id test-nam
7930: 65 20 69 74 65 6d 2d 70 61 74 68 29 29 29 29 0a  e item-path)))).
7940: 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  .    (debug:prin
7950: 74 2d 69 6e 66 6f 20 34 20 22 74 65 73 74 2d 69  t-info 4 "test-i
7960: 64 3d 22 20 74 65 73 74 2d 69 64 20 22 2c 20 72  d=" test-id ", r
7970: 75 6e 2d 69 64 3d 22 20 72 75 6e 2d 69 64 20 22  un-id=" run-id "
7980: 2c 20 74 65 73 74 2d 6e 61 6d 65 3d 22 20 74 65  , test-name=" te
7990: 73 74 2d 6e 61 6d 65 20 22 2c 20 69 74 65 6d 2d  st-name ", item-
79a0: 70 61 74 68 3d 5c 22 22 20 69 74 65 6d 2d 70 61  path=\"" item-pa
79b0: 74 68 20 22 5c 22 22 29 0a 09 20 20 20 20 28 73  th "\"")..    (s
79c0: 65 74 21 20 74 65 73 74 64 61 74 20 28 63 64 62  et! testdat (cdb
79d0: 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 2d 62  :get-test-info-b
79e0: 79 2d 69 64 20 2a 72 75 6e 72 65 6d 6f 74 65 2a  y-id *runremote*
79f0: 20 74 65 73 74 2d 69 64 29 29 29 29 0a 20 20 20   test-id)))).   
7a00: 20 20 20 28 73 65 74 21 20 74 65 73 74 2d 69 64     (set! test-id
7a10: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64   (db:test-get-id
7a20: 20 74 65 73 74 64 61 74 29 29 0a 20 20 20 20 20   testdat)).     
7a30: 20 28 63 68 61 6e 67 65 2d 64 69 72 65 63 74 6f   (change-directo
7a40: 72 79 20 74 65 73 74 2d 70 61 74 68 29 0a 20 20  ry test-path).  
7a50: 20 20 20 20 28 63 61 73 65 20 28 69 66 20 66 6f      (case (if fo
7a60: 72 63 65 20 3b 3b 20 28 61 72 67 73 3a 67 65 74  rce ;; (args:get
7a70: 2d 61 72 67 20 22 2d 66 6f 72 63 65 22 29 0a 09  -arg "-force")..
7a80: 09 27 4e 4f 54 5f 53 54 41 52 54 45 44 0a 09 09  .'NOT_STARTED...
7a90: 28 69 66 20 74 65 73 74 64 61 74 0a 09 09 20 20  (if testdat...  
7aa0: 20 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62 6f    (string->symbo
7ab0: 6c 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  l (test:get-stat
7ac0: 65 20 74 65 73 74 64 61 74 29 29 0a 09 09 20 20  e testdat))...  
7ad0: 20 20 27 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73    'failed-to-ins
7ae0: 65 72 74 29 29 0a 09 28 28 66 61 69 6c 65 64 2d  ert))..((failed-
7af0: 74 6f 2d 69 6e 73 65 72 74 29 0a 09 20 28 64 65  to-insert).. (de
7b00: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52  bug:print 0 "ERR
7b10: 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 69 6e  OR: Failed to in
7b20: 73 65 72 74 20 74 68 65 20 72 65 63 6f 72 64 20  sert the record 
7b30: 69 6e 74 6f 20 74 68 65 20 64 62 22 29 29 0a 09  into the db"))..
7b40: 28 28 4e 4f 54 5f 53 54 41 52 54 45 44 20 43 4f  ((NOT_STARTED CO
7b50: 4d 50 4c 45 54 45 44 20 44 45 4c 45 54 45 44 29  MPLETED DELETED)
7b60: 0a 09 20 28 6c 65 74 20 28 28 72 75 6e 66 6c 61  .. (let ((runfla
7b70: 67 20 23 66 29 29 0a 09 20 20 20 28 63 6f 6e 64  g #f))..   (cond
7b80: 0a 09 20 20 20 20 3b 3b 20 2d 66 6f 72 63 65 2c  ..    ;; -force,
7b90: 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77   run no matter w
7ba0: 68 61 74 0a 09 20 20 20 20 28 66 6f 72 63 65 20  hat..    (force 
7bb0: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74  (set! runflag #t
7bc0: 29 29 0a 09 20 20 20 20 3b 3b 20 4e 4f 54 5f 53  ))..    ;; NOT_S
7bd0: 54 41 52 54 45 44 2c 20 72 75 6e 20 6e 6f 20 6d  TARTED, run no m
7be0: 61 74 74 65 72 20 77 68 61 74 0a 09 20 20 20 20  atter what..    
7bf0: 28 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67  ((member (test:g
7c00: 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74  et-state testdat
7c10: 29 20 27 28 22 44 45 4c 45 54 45 44 22 20 22 4e  ) '("DELETED" "N
7c20: 4f 54 5f 53 54 41 52 54 45 44 22 29 29 28 73 65  OT_STARTED"))(se
7c30: 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a  t! runflag #t)).
7c40: 09 20 20 20 20 3b 3b 20 6e 6f 74 20 2d 72 65 72  .    ;; not -rer
7c50: 75 6e 20 61 6e 64 20 50 41 53 53 2c 20 57 41 52  un and PASS, WAR
7c60: 4e 20 6f 72 20 43 48 45 43 4b 2c 20 64 6f 20 6e  N or CHECK, do n
7c70: 6f 20 72 75 6e 0a 09 20 20 20 20 28 28 61 6e 64  o run..    ((and
7c80: 20 28 6f 72 20 28 6e 6f 74 20 72 65 72 75 6e 29   (or (not rerun)
7c90: 0a 09 09 20 20 20 20 20 20 6b 65 65 70 67 6f 69  ...      keepgoi
7ca0: 6e 67 29 0a 09 09 20 20 3b 3b 20 52 65 71 75 69  ng)...  ;; Requi
7cb0: 72 65 20 74 6f 20 66 6f 72 63 65 20 72 65 2d 72  re to force re-r
7cc0: 75 6e 20 66 6f 72 20 43 4f 4d 50 4c 45 54 45 44  un for COMPLETED
7cd0: 20 6f 72 20 2a 61 6e 79 74 68 69 6e 67 2a 20 2b   or *anything* +
7ce0: 20 50 41 53 53 2c 57 41 52 4e 20 6f 72 20 43 48   PASS,WARN or CH
7cf0: 45 43 4b 0a 09 09 20 20 28 6f 72 20 28 6d 65 6d  ECK...  (or (mem
7d00: 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74  ber (test:get-st
7d10: 61 74 75 73 20 74 65 73 74 64 61 74 29 20 27 28  atus testdat) '(
7d20: 22 50 41 53 53 22 20 22 57 41 52 4e 22 20 22 43  "PASS" "WARN" "C
7d30: 48 45 43 4b 22 20 22 53 4b 49 50 22 29 29 0a 09  HECK" "SKIP"))..
7d40: 09 20 20 20 20 20 20 28 6d 65 6d 62 65 72 20 28  .      (member (
7d50: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 20  test:get-state  
7d60: 74 65 73 74 64 61 74 29 20 27 28 22 43 4f 4d 50  testdat) '("COMP
7d70: 4c 45 54 45 44 22 29 29 29 29 20 0a 09 20 20 20  LETED")))) ..   
7d80: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69    (debug:print-i
7d90: 6e 66 6f 20 32 20 22 72 75 6e 6e 69 6e 67 20 74  nfo 2 "running t
7da0: 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20  est " test-name 
7db0: 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20  "/" item-path " 
7dc0: 73 75 70 70 72 65 73 73 65 64 20 61 73 20 69 74  suppressed as it
7dd0: 20 69 73 20 22 20 28 74 65 73 74 3a 67 65 74 2d   is " (test:get-
7de0: 73 74 61 74 65 20 74 65 73 74 64 61 74 29 20 22  state testdat) "
7df0: 20 61 6e 64 20 22 20 28 74 65 73 74 3a 67 65 74   and " (test:get
7e00: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29  -status testdat)
7e10: 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 75  )..     (set! ru
7e20: 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20 20  nflag #f))..    
7e30: 3b 3b 20 2d 72 65 72 75 6e 20 61 6e 64 20 73 74  ;; -rerun and st
7e40: 61 74 75 73 20 69 73 20 6f 6e 65 20 6f 66 20 74  atus is one of t
7e50: 68 65 20 73 70 65 63 69 66 65 64 2c 20 72 75 6e  he specifed, run
7e60: 20 69 74 0a 09 20 20 20 20 28 28 61 6e 64 20 72   it..    ((and r
7e70: 65 72 75 6e 0a 09 09 20 20 28 6c 65 74 2a 20 28  erun...  (let* (
7e80: 28 72 65 72 75 6e 6c 73 74 20 20 20 28 73 74 72  (rerunlst   (str
7e90: 69 6e 67 2d 73 70 6c 69 74 20 72 65 72 75 6e 20  ing-split rerun 
7ea0: 22 2c 22 29 29 0a 09 09 09 20 28 6d 75 73 74 2d  ",")).... (must-
7eb0: 72 65 72 75 6e 20 28 6d 65 6d 62 65 72 20 28 74  rerun (member (t
7ec0: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74  est:get-status t
7ed0: 65 73 74 64 61 74 29 20 72 65 72 75 6e 6c 73 74  estdat) rerunlst
7ee0: 29 29 29 0a 09 09 20 20 20 20 28 64 65 62 75 67  )))...    (debug
7ef0: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 33 20 22 2d  :print-info 3 "-
7f00: 72 65 72 75 6e 20 6c 69 73 74 3a 20 22 20 72 65  rerun list: " re
7f10: 72 75 6e 20 22 2c 20 74 65 73 74 2d 73 74 61 74  run ", test-stat
7f20: 75 73 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d  us: " (test:get-
7f30: 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 22  status testdat)"
7f40: 2c 20 6d 75 73 74 2d 72 65 72 75 6e 3a 20 22 20  , must-rerun: " 
7f50: 6d 75 73 74 2d 72 65 72 75 6e 29 0a 09 09 20 20  must-rerun)...  
7f60: 20 20 6d 75 73 74 2d 72 65 72 75 6e 29 29 0a 09    must-rerun))..
7f70: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
7f80: 74 2d 69 6e 66 6f 20 32 20 22 52 65 72 75 6e 20  t-info 2 "Rerun 
7f90: 66 6f 72 63 65 64 20 66 6f 72 20 74 65 73 74 20  forced for test 
7fa0: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20  " test-name "/" 
7fb0: 69 74 65 6d 2d 70 61 74 68 29 0a 09 20 20 20 20  item-path)..    
7fc0: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23   (set! runflag #
7fd0: 74 29 29 0a 09 20 20 20 20 3b 3b 20 2d 6b 65 65  t))..    ;; -kee
7fe0: 70 67 6f 69 6e 67 2c 20 64 6f 20 6e 6f 74 20 72  pgoing, do not r
7ff0: 65 72 75 6e 20 46 41 49 4c 0a 09 20 20 20 20 28  erun FAIL..    (
8000: 28 61 6e 64 20 6b 65 65 70 67 6f 69 6e 67 0a 09  (and keepgoing..
8010: 09 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74  .  (member (test
8020: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74  :get-status test
8030: 64 61 74 29 20 27 28 22 46 41 49 4c 22 29 29 29  dat) '("FAIL")))
8040: 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 75 6e  ..     (set! run
8050: 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20 20 28  flag #f))..    (
8060: 28 61 6e 64 20 28 6e 6f 74 20 72 65 72 75 6e 29  (and (not rerun)
8070: 0a 09 09 20 20 28 6d 65 6d 62 65 72 20 28 74 65  ...  (member (te
8080: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65  st:get-status te
8090: 73 74 64 61 74 29 20 27 28 22 46 41 49 4c 22 20  stdat) '("FAIL" 
80a0: 22 6e 2f 61 22 29 29 29 0a 09 20 20 20 20 20 28  "n/a")))..     (
80b0: 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29  set! runflag #t)
80c0: 29 0a 09 20 20 20 20 28 65 6c 73 65 20 28 73 65  )..    (else (se
80d0: 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 29  t! runflag #f)))
80e0: 0a 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  ..   (debug:prin
80f0: 74 20 36 20 22 52 55 4e 4e 49 4e 47 20 3d 3e 20  t 6 "RUNNING => 
8100: 72 75 6e 66 6c 61 67 3a 20 22 20 72 75 6e 66 6c  runflag: " runfl
8110: 61 67 20 22 20 53 54 41 54 45 3a 20 22 20 28 74  ag " STATE: " (t
8120: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65  est:get-state te
8130: 73 74 64 61 74 29 20 22 20 53 54 41 54 55 53 3a  stdat) " STATUS:
8140: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61   " (test:get-sta
8150: 74 75 73 20 74 65 73 74 64 61 74 29 29 0a 09 20  tus testdat)).. 
8160: 20 20 28 69 66 20 28 6e 6f 74 20 72 75 6e 66 6c    (if (not runfl
8170: 61 67 29 0a 09 20 20 20 20 20 20 20 28 69 66 20  ag)..       (if 
8180: 28 6e 6f 74 20 70 61 72 65 6e 74 2d 74 65 73 74  (not parent-test
8190: 29 0a 09 09 20 20 20 28 64 65 62 75 67 3a 70 72  )...   (debug:pr
81a0: 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 4e 6f 74  int 1 "NOTE: Not
81b0: 20 73 74 61 72 74 69 6e 67 20 74 65 73 74 20 22   starting test "
81c0: 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22   new-test-name "
81d0: 20 61 73 20 69 74 20 69 73 20 73 74 61 74 65 20   as it is state 
81e0: 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74  \"" (test:get-st
81f0: 61 74 65 20 74 65 73 74 64 61 74 29 20 0a 09 09  ate testdat) ...
8200: 09 09 22 5c 22 20 61 6e 64 20 73 74 61 74 75 73  .."\" and status
8210: 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73   \"" (test:get-s
8220: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20 22  tatus testdat) "
8230: 5c 22 2c 20 75 73 65 20 2d 72 65 72 75 6e 20 5c  \", use -rerun \
8240: 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61  "" (test:get-sta
8250: 74 75 73 20 74 65 73 74 64 61 74 29 0a 20 20 20  tus testdat).   
8260: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
8270: 20 20 20 20 20 20 20 20 20 20 20 20 20 22 5c 22               "\"
8280: 20 6f 72 20 2d 66 6f 72 63 65 20 74 6f 20 6f 76   or -force to ov
8290: 65 72 72 69 64 65 22 29 29 0a 09 20 20 20 20 20  erride"))..     
82a0: 20 20 3b 3b 20 4e 4f 54 45 3a 20 4e 6f 20 6c 6f    ;; NOTE: No lo
82b0: 6e 67 65 72 20 62 65 20 63 68 65 63 6b 69 6e 67  nger be checking
82c0: 20 70 72 65 72 65 71 75 69 73 69 74 65 73 20 68   prerequisites h
82d0: 65 72 65 21 20 57 69 6c 6c 20 6e 65 76 65 72 20  ere! Will never 
82e0: 67 65 74 20 68 65 72 65 20 75 6e 6c 65 73 73 20  get here unless 
82f0: 70 72 65 72 65 71 73 20 61 72 65 0a 09 20 20 20  prereqs are..   
8300: 20 20 20 20 3b 3b 20 20 20 20 20 20 20 61 6c 72      ;;       alr
8310: 65 61 64 79 20 6d 65 74 2e 0a 09 20 20 20 20 20  eady met...     
8320: 20 20 28 69 66 20 28 6e 6f 74 20 28 6c 61 75 6e    (if (not (laun
8330: 63 68 2d 74 65 73 74 20 23 66 20 72 75 6e 2d 69  ch-test #f run-i
8340: 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d 63  d runname test-c
8350: 6f 6e 66 20 6b 65 79 76 61 6c 6c 73 74 20 74 65  onf keyvallst te
8360: 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 70 61 74  st-name test-pat
8370: 68 20 69 74 65 6d 64 61 74 20 66 6c 61 67 73 29  h itemdat flags)
8380: 29 0a 09 09 20 20 20 28 62 65 67 69 6e 0a 09 09  )...   (begin...
8390: 20 20 20 20 20 28 70 72 69 6e 74 20 22 45 52 52       (print "ERR
83a0: 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c 61  OR: Failed to la
83b0: 75 6e 63 68 20 74 68 65 20 74 65 73 74 2e 20 45  unch the test. E
83c0: 78 69 74 69 6e 67 20 61 73 20 73 6f 6f 6e 20 61  xiting as soon a
83d0: 73 20 70 6f 73 73 69 62 6c 65 22 29 0a 09 09 20  s possible")... 
83e0: 20 20 20 20 28 73 65 74 21 20 2a 67 6c 6f 62 61      (set! *globa
83f0: 6c 65 78 69 74 73 74 61 74 75 73 2a 20 31 29 20  lexitstatus* 1) 
8400: 3b 3b 20 0a 09 09 20 20 20 20 20 28 70 72 6f 63  ;; ...     (proc
8410: 65 73 73 2d 73 69 67 6e 61 6c 20 28 63 75 72 72  ess-signal (curr
8420: 65 6e 74 2d 70 72 6f 63 65 73 73 2d 69 64 29 20  ent-process-id) 
8430: 73 69 67 6e 61 6c 2f 6b 69 6c 6c 29 29 29 29 29  signal/kill)))))
8440: 29 0a 09 28 28 4b 49 4c 4c 45 44 29 20 0a 09 20  )..((KILLED) .. 
8450: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22  (debug:print 1 "
8460: 4e 4f 54 45 3a 20 22 20 6e 65 77 2d 74 65 73 74  NOTE: " new-test
8470: 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72 65 61  -name " is alrea
8480: 64 79 20 72 75 6e 6e 69 6e 67 20 6f 72 20 77 61  dy running or wa
8490: 73 20 65 78 70 6c 69 63 74 6c 79 20 6b 69 6c 6c  s explictly kill
84a0: 65 64 2c 20 75 73 65 20 2d 66 6f 72 63 65 20 74  ed, use -force t
84b0: 6f 20 6c 61 75 6e 63 68 20 69 74 2e 22 29 29 0a  o launch it.")).
84c0: 09 28 28 4c 41 55 4e 43 48 45 44 20 52 45 4d 4f  .((LAUNCHED REMO
84d0: 54 45 48 4f 53 54 53 54 41 52 54 20 52 55 4e 4e  TEHOSTSTART RUNN
84e0: 49 4e 47 29 20 20 0a 09 20 28 69 66 20 28 3e 20  ING)  .. (if (> 
84f0: 28 2d 20 28 63 75 72 72 65 6e 74 2d 73 65 63 6f  (- (current-seco
8500: 6e 64 73 29 28 2b 20 28 64 62 3a 74 65 73 74 2d  nds)(+ (db:test-
8510: 67 65 74 2d 65 76 65 6e 74 5f 74 69 6d 65 20 74  get-event_time t
8520: 65 73 74 64 61 74 29 0a 09 09 09 09 20 20 20 20  estdat).....    
8530: 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d     (db:test-get-
8540: 72 75 6e 5f 64 75 72 61 74 69 6f 6e 20 74 65 73  run_duration tes
8550: 74 64 61 74 29 29 29 0a 09 09 36 30 30 29 20 3b  tdat)))...600) ;
8560: 3b 20 69 2e 65 2e 20 6e 6f 20 75 70 64 61 74 65  ; i.e. no update
8570: 20 66 6f 72 20 6d 6f 72 65 20 74 68 61 6e 20 36   for more than 6
8580: 30 30 20 73 65 63 6f 6e 64 73 0a 09 20 20 20 20  00 seconds..    
8590: 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 20   (begin..       
85a0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
85b0: 57 41 52 4e 49 4e 47 3a 20 54 65 73 74 20 22 20  WARNING: Test " 
85c0: 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 70 70 65  test-name " appe
85d0: 61 72 73 20 74 6f 20 62 65 20 64 65 61 64 2e 20  ars to be dead. 
85e0: 46 6f 72 63 69 6e 67 20 69 74 20 74 6f 20 73 74  Forcing it to st
85f0: 61 74 65 20 49 4e 43 4f 4d 50 4c 45 54 45 20 61  ate INCOMPLETE a
8600: 6e 64 20 73 74 61 74 75 73 20 53 54 55 43 4b 2f  nd status STUCK/
8610: 44 45 41 44 22 29 0a 09 20 20 20 20 20 20 20 28  DEAD")..       (
8620: 74 65 73 74 73 3a 74 65 73 74 2d 73 65 74 2d 73  tests:test-set-s
8630: 74 61 74 75 73 21 20 74 65 73 74 2d 69 64 20 22  tatus! test-id "
8640: 49 4e 43 4f 4d 50 4c 45 54 45 22 20 22 53 54 55  INCOMPLETE" "STU
8650: 43 4b 2f 44 45 41 44 22 20 22 54 65 73 74 20 69  CK/DEAD" "Test i
8660: 73 20 73 74 75 63 6b 20 6f 72 20 64 65 61 64 22  s stuck or dead"
8670: 20 23 66 29 29 0a 09 20 20 20 20 20 28 64 65 62   #f))..     (deb
8680: 75 67 3a 70 72 69 6e 74 20 32 20 22 4e 4f 54 45  ug:print 2 "NOTE
8690: 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20  : " test-name " 
86a0: 69 73 20 61 6c 72 65 61 64 79 20 72 75 6e 6e 69  is already runni
86b0: 6e 67 22 29 29 29 0a 09 28 65 6c 73 65 20 20 20  ng")))..(else   
86c0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
86d0: 20 30 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65   0 "ERROR: Faile
86e0: 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 65 73 74  d to launch test
86f0: 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65   " new-test-name
8700: 20 22 2e 20 55 6e 72 65 63 6f 67 6e 69 73 65 64   ". Unrecognised
8710: 20 73 74 61 74 65 20 22 20 28 74 65 73 74 3a 67   state " (test:g
8720: 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74  et-state testdat
8730: 29 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d  )))))))..;;=====
8740: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8750: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8760: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8770: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8780: 3d 0a 3b 3b 20 45 4e 44 20 4f 46 20 4e 45 57 20  =.;; END OF NEW 
8790: 53 54 55 46 46 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d  STUFF.;;========
87a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
87b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
87c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
87d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a  ==============..
87e0: 28 64 65 66 69 6e 65 20 28 67 65 74 2d 64 69 72  (define (get-dir
87f0: 2d 75 70 2d 6e 20 64 69 72 20 2e 20 70 61 72 61  -up-n dir . para
8800: 6d 73 29 20 0a 20 20 28 6c 65 74 20 28 28 64 70  ms) .  (let ((dp
8810: 61 72 74 73 20 20 28 73 74 72 69 6e 67 2d 73 70  arts  (string-sp
8820: 6c 69 74 20 64 69 72 20 22 2f 22 29 29 0a 09 28  lit dir "/"))..(
8830: 63 6f 75 6e 74 20 20 20 28 69 66 20 28 6e 75 6c  count   (if (nul
8840: 6c 3f 20 70 61 72 61 6d 73 29 20 31 20 28 63 61  l? params) 1 (ca
8850: 72 20 70 61 72 61 6d 73 29 29 29 29 0a 20 20 20  r params)))).   
8860: 20 28 63 6f 6e 63 20 22 2f 22 20 28 73 74 72 69   (conc "/" (stri
8870: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 0a  ng-intersperse .
8880: 09 20 20 20 20 20 20 20 28 74 61 6b 65 20 64 70  .       (take dp
8890: 61 72 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 20  arts (- (length 
88a0: 64 70 61 72 74 73 29 20 63 6f 75 6e 74 29 29 0a  dparts) count)).
88b0: 09 20 20 20 20 20 20 20 22 2f 22 29 29 29 29 0a  .       "/")))).
88c0: 3b 3b 20 52 65 6d 6f 76 65 20 72 75 6e 73 0a 3b  ;; Remove runs.;
88d0: 3b 20 66 69 65 6c 64 73 20 61 72 65 20 70 61 73  ; fields are pas
88e0: 73 69 6e 67 20 69 6e 20 74 68 72 6f 75 67 68 20  sing in through 
88f0: 0a 3b 3b 20 61 63 74 69 6f 6e 3a 0a 3b 3b 20 20  .;; action:.;;  
8900: 20 20 27 72 65 6d 6f 76 65 2d 72 75 6e 73 0a 3b    'remove-runs.;
8910: 3b 20 20 20 20 27 73 65 74 2d 73 74 61 74 65 2d  ;    'set-state-
8920: 73 74 61 74 75 73 0a 3b 3b 0a 3b 3b 20 4e 42 2f  status.;;.;; NB/
8930: 2f 20 73 68 6f 75 6c 64 20 70 61 73 73 20 69 6e  / should pass in
8940: 20 6b 65 79 73 3f 0a 3b 3b 0a 28 64 65 66 69 6e   keys?.;;.(defin
8950: 65 20 28 72 75 6e 73 3a 6f 70 65 72 61 74 65 2d  e (runs:operate-
8960: 6f 6e 20 61 63 74 69 6f 6e 20 72 75 6e 6e 61 6d  on action runnam
8970: 65 70 61 74 74 20 74 65 73 74 70 61 74 74 20 23  epatt testpatt #
8980: 21 6b 65 79 20 28 73 74 61 74 65 20 23 66 29 28  !key (state #f)(
8990: 73 74 61 74 75 73 20 23 66 29 28 6e 65 77 2d 73  status #f)(new-s
89a0: 74 61 74 65 2d 73 74 61 74 75 73 20 23 66 29 29  tate-status #f))
89b0: 0a 20 20 28 63 6f 6d 6d 6f 6e 3a 63 6c 65 61 72  .  (common:clear
89c0: 2d 63 61 63 68 65 73 29 20 3b 3b 20 63 6c 65 61  -caches) ;; clea
89d0: 72 20 61 6c 6c 20 63 61 63 68 65 73 0a 20 20 28  r all caches.  (
89e0: 6c 65 74 2a 20 28 28 64 62 20 20 20 20 20 20 20  let* ((db       
89f0: 20 20 20 20 23 66 29 0a 09 20 28 6b 65 79 73 20      #f).. (keys 
8a00: 20 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75          (open-ru
8a10: 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 6b  n-close db:get-k
8a20: 65 79 73 20 64 62 29 29 0a 09 20 28 72 75 6e 64  eys db)).. (rund
8a30: 61 74 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72  at       (open-r
8a40: 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 3a 67 65  un-close runs:ge
8a50: 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74 74 20 64  t-runs-by-patt d
8a60: 62 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65 70 61  b keys runnamepa
8a70: 74 74 29 29 0a 09 20 28 68 65 61 64 65 72 20 20  tt)).. (header  
8a80: 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66       (vector-ref
8a90: 20 72 75 6e 64 61 74 20 30 29 29 0a 09 20 28 72   rundat 0)).. (r
8aa0: 75 6e 73 20 20 20 20 20 20 20 20 20 28 76 65 63  uns         (vec
8ab0: 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 31  tor-ref rundat 1
8ac0: 29 29 0a 09 20 28 73 74 61 74 65 73 20 20 20 20  )).. (states    
8ad0: 20 20 20 28 69 66 20 73 74 61 74 65 20 20 28 73     (if state  (s
8ae0: 74 72 69 6e 67 2d 73 70 6c 69 74 20 73 74 61 74  tring-split stat
8af0: 65 20 20 22 2c 22 29 20 27 28 29 29 29 0a 09 20  e  ",") '())).. 
8b00: 28 73 74 61 74 75 73 65 73 20 20 20 20 20 28 69  (statuses     (i
8b10: 66 20 73 74 61 74 75 73 20 28 73 74 72 69 6e 67  f status (string
8b20: 2d 73 70 6c 69 74 20 73 74 61 74 75 73 20 22 2c  -split status ",
8b30: 22 29 20 27 28 29 29 29 0a 09 20 28 73 74 61 74  ") '())).. (stat
8b40: 65 2d 73 74 61 74 75 73 20 28 69 66 20 28 73 74  e-status (if (st
8b50: 72 69 6e 67 3f 20 6e 65 77 2d 73 74 61 74 65 2d  ring? new-state-
8b60: 73 74 61 74 75 73 29 20 28 73 74 72 69 6e 67 2d  status) (string-
8b70: 73 70 6c 69 74 20 6e 65 77 2d 73 74 61 74 65 2d  split new-state-
8b80: 73 74 61 74 75 73 20 22 2c 22 29 20 27 28 23 66  status ",") '(#f
8b90: 20 23 66 29 29 29 29 0a 20 20 20 20 28 64 65 62   #f)))).    (deb
8ba0: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20  ug:print-info 4 
8bb0: 22 72 75 6e 73 3a 6f 70 65 72 61 74 65 2d 6f 6e  "runs:operate-on
8bc0: 20 3d 3e 20 48 65 61 64 65 72 3a 20 22 20 68 65   => Header: " he
8bd0: 61 64 65 72 20 22 20 61 63 74 69 6f 6e 3a 20 22  ader " action: "
8be0: 20 61 63 74 69 6f 6e 20 22 20 6e 65 77 2d 73 74   action " new-st
8bf0: 61 74 65 2d 73 74 61 74 75 73 3a 20 22 20 6e 65  ate-status: " ne
8c00: 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73 29 0a  w-state-status).
8c10: 20 20 20 20 28 69 66 20 28 3e 20 32 20 28 6c 65      (if (> 2 (le
8c20: 6e 67 74 68 20 73 74 61 74 65 2d 73 74 61 74 75  ngth state-statu
8c30: 73 29 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 28  s))..(begin..  (
8c40: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45  debug:print 0 "E
8c50: 52 52 4f 52 3a 20 74 68 65 20 70 61 72 61 6d 65  RROR: the parame
8c60: 74 65 72 20 74 6f 20 2d 73 65 74 2d 73 74 61 74  ter to -set-stat
8c70: 65 2d 73 74 61 74 75 73 20 69 73 20 61 20 63 6f  e-status is a co
8c80: 6d 6d 61 20 64 65 6c 69 6d 69 74 65 64 20 73 74  mma delimited st
8c90: 72 69 6e 67 2e 20 45 2e 67 2e 20 43 4f 4d 50 4c  ring. E.g. COMPL
8ca0: 45 54 45 44 2c 46 41 49 4c 22 29 0a 09 20 20 28  ETED,FAIL")..  (
8cb0: 65 78 69 74 29 29 29 0a 20 20 20 20 28 66 6f 72  exit))).    (for
8cc0: 2d 65 61 63 68 0a 20 20 20 20 20 28 6c 61 6d 62  -each.     (lamb
8cd0: 64 61 20 28 72 75 6e 29 0a 20 20 20 20 20 20 20  da (run).       
8ce0: 28 6c 65 74 20 28 28 72 75 6e 6b 65 79 20 28 73  (let ((runkey (s
8cf0: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73  tring-interspers
8d00: 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28  e (map (lambda (
8d10: 6b 29 0a 09 09 09 09 09 09 28 64 62 3a 67 65 74  k).......(db:get
8d20: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72  -value-by-header
8d30: 20 72 75 6e 20 68 65 61 64 65 72 20 28 76 65 63   run header (vec
8d40: 74 6f 72 2d 72 65 66 20 6b 20 30 29 29 29 20 6b  tor-ref k 0))) k
8d50: 65 79 73 29 20 22 2f 22 29 29 0a 09 20 20 20 20  eys) "/"))..    
8d60: 20 28 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65   (dirs-to-remove
8d70: 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c   (make-hash-tabl
8d80: 65 29 29 29 0a 09 20 28 6c 65 74 2a 20 28 28 72  e))).. (let* ((r
8d90: 75 6e 2d 69 64 20 20 20 20 28 64 62 3a 67 65 74  un-id    (db:get
8da0: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72  -value-by-header
8db0: 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 22   run header "id"
8dc0: 29 29 0a 09 09 28 72 75 6e 2d 73 74 61 74 65 20  ))...(run-state 
8dd0: 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79  (db:get-value-by
8de0: 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64  -header run head
8df0: 65 72 20 22 73 74 61 74 65 22 29 29 0a 09 09 28  er "state"))...(
8e00: 74 65 73 74 73 20 20 20 20 20 28 69 66 20 28 6e  tests     (if (n
8e10: 6f 74 20 28 65 71 75 61 6c 3f 20 72 75 6e 2d 73  ot (equal? run-s
8e20: 74 61 74 65 20 22 6c 6f 63 6b 65 64 22 29 29 0a  tate "locked")).
8e30: 09 09 09 20 20 20 20 20 20 20 28 6f 70 65 6e 2d  ...       (open-
8e40: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
8e50: 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64  -tests-for-run d
8e60: 62 20 72 75 6e 2d 69 64 0a 09 09 09 09 09 09 20  b run-id....... 
8e70: 20 20 20 20 20 74 65 73 74 70 61 74 74 20 73 74       testpatt st
8e80: 61 74 65 73 20 73 74 61 74 75 73 65 73 0a 09 09  ates statuses...
8e90: 09 09 09 09 20 20 20 20 20 20 6e 6f 74 2d 69 6e  ....      not-in
8ea0: 3a 20 20 23 66 0a 09 09 09 09 09 09 20 20 20 20  :  #f.......    
8eb0: 20 20 73 6f 72 74 2d 62 79 3a 20 28 63 61 73 65    sort-by: (case
8ec0: 20 61 63 74 69 6f 6e 0a 09 09 09 09 09 09 09 09   action.........
8ed0: 20 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29 20   ((remove-runs) 
8ee0: 27 72 75 6e 64 69 72 29 0a 09 09 09 09 09 09 09  'rundir)........
8ef0: 09 20 28 65 6c 73 65 20 20 20 20 20 20 20 20 20  . (else         
8f00: 20 27 65 76 65 6e 74 5f 74 69 6d 65 29 29 29 0a   'event_time))).
8f10: 09 09 09 20 20 20 20 20 20 20 27 28 29 29 29 0a  ...       '())).
8f20: 09 09 28 6c 61 73 74 74 70 61 74 68 20 22 2f 64  ..(lasttpath "/d
8f30: 6f 65 73 2f 6e 6f 74 2f 65 78 69 73 74 2f 49 2f  oes/not/exist/I/
8f40: 68 6f 70 65 22 29 29 0a 09 20 20 20 28 64 65 62  hope"))..   (deb
8f50: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20  ug:print-info 4 
8f60: 22 72 75 6e 73 3a 6f 70 65 72 61 74 65 2d 6f 6e  "runs:operate-on
8f70: 20 72 75 6e 3d 22 20 72 75 6e 20 22 2c 20 68 65   run=" run ", he
8f80: 61 64 65 72 3d 22 20 68 65 61 64 65 72 29 0a 09  ader=" header)..
8f90: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c     (if (not (nul
8fa0: 6c 3f 20 74 65 73 74 73 29 29 0a 09 20 20 20 20  l? tests))..    
8fb0: 20 20 20 28 62 65 67 69 6e 0a 09 09 20 28 63 61     (begin... (ca
8fc0: 73 65 20 61 63 74 69 6f 6e 0a 09 09 20 20 20 28  se action...   (
8fd0: 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29 0a 09 09  (remove-runs)...
8fe0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
8ff0: 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 74 65 73   1 "Removing tes
9000: 74 73 20 66 6f 72 20 72 75 6e 3a 20 22 20 72 75  ts for run: " ru
9010: 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74  nkey " " (db:get
9020: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72  -value-by-header
9030: 20 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e   run header "run
9040: 6e 61 6d 65 22 29 29 29 0a 09 09 20 20 20 28 28  name")))...   ((
9050: 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73  set-state-status
9060: 29 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70  )...    (debug:p
9070: 72 69 6e 74 20 31 20 22 4d 6f 64 69 66 79 69 6e  rint 1 "Modifyin
9080: 67 20 73 74 61 74 65 20 61 6e 64 20 73 74 61 75  g state and stau
9090: 73 20 66 6f 72 20 74 65 73 74 73 20 66 6f 72 20  s for tests for 
90a0: 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20  run: " runkey " 
90b0: 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d  " (db:get-value-
90c0: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65  by-header run he
90d0: 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 29  ader "runname"))
90e0: 29 0a 09 09 20 20 20 28 28 70 72 69 6e 74 2d 72  )...   ((print-r
90f0: 75 6e 29 0a 09 09 20 20 20 20 28 64 65 62 75 67  un)...    (debug
9100: 3a 70 72 69 6e 74 20 31 20 22 50 72 69 6e 74 69  :print 1 "Printi
9110: 6e 67 20 69 6e 66 6f 20 66 6f 72 20 72 75 6e 20  ng info for run 
9120: 22 20 72 75 6e 6b 65 79 20 22 2c 20 72 75 6e 3d  " runkey ", run=
9130: 22 20 72 75 6e 20 22 2c 20 74 65 73 74 73 3d 22  " run ", tests="
9140: 20 74 65 73 74 73 20 22 2c 20 68 65 61 64 65 72   tests ", header
9150: 3d 22 20 68 65 61 64 65 72 29 0a 09 09 20 20 20  =" header)...   
9160: 20 61 63 74 69 6f 6e 29 0a 09 09 20 20 20 28 65   action)...   (e
9170: 6c 73 65 0a 09 09 20 20 20 20 28 64 65 62 75 67  lse...    (debug
9180: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 30 20 22 61  :print-info 0 "a
9190: 63 74 69 6f 6e 20 6e 6f 74 20 72 65 63 6f 67 6e  ction not recogn
91a0: 69 73 65 64 20 22 20 61 63 74 69 6f 6e 29 29 29  ised " action)))
91b0: 0a 09 09 20 28 66 6f 72 2d 65 61 63 68 0a 09 09  ... (for-each...
91c0: 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 29    (lambda (test)
91d0: 0a 09 09 20 20 20 20 28 6c 65 74 2a 20 28 28 69  ...    (let* ((i
91e0: 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 73  tem-path (db:tes
91f0: 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20  t-get-item-path 
9200: 74 65 73 74 29 29 0a 09 09 09 20 20 20 28 74 65  test))....   (te
9210: 73 74 2d 6e 61 6d 65 20 28 64 62 3a 74 65 73 74  st-name (db:test
9220: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65  -get-testname te
9230: 73 74 29 29 0a 09 09 09 20 20 20 28 72 75 6e 2d  st))....   (run-
9240: 64 69 72 20 20 20 28 64 62 3a 74 65 73 74 2d 67  dir   (db:test-g
9250: 65 74 2d 72 75 6e 64 69 72 20 74 65 73 74 29 29  et-rundir test))
9260: 20 20 20 20 3b 3b 20 72 75 6e 20 64 69 72 20 69      ;; run dir i
9270: 73 20 66 72 6f 6d 20 74 68 65 20 6c 69 6e 6b 20  s from the link 
9280: 74 72 65 65 0a 09 09 09 20 20 20 28 72 65 61 6c  tree....   (real
9290: 2d 64 69 72 20 20 28 69 66 20 28 66 69 6c 65 2d  -dir  (if (file-
92a0: 65 78 69 73 74 73 3f 20 72 75 6e 2d 64 69 72 29  exists? run-dir)
92b0: 0a 09 09 09 09 09 20 20 28 72 65 73 6f 6c 76 65  ......  (resolve
92c0: 2d 70 61 74 68 6e 61 6d 65 20 72 75 6e 2d 64 69  -pathname run-di
92d0: 72 29 0a 09 09 09 09 09 20 20 23 66 29 29 0a 09  r)......  #f))..
92e0: 09 09 20 20 20 28 74 65 73 74 2d 69 64 20 20 20  ..   (test-id   
92f0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20  (db:test-get-id 
9300: 74 65 73 74 29 29 29 0a 09 09 20 20 20 20 20 20  test)))...      
9310: 3b 3b 20 20 20 28 74 64 62 20 20 20 20 20 20 20  ;;   (tdb       
9320: 28 64 62 3a 6f 70 65 6e 2d 74 65 73 74 2d 64 62  (db:open-test-db
9330: 20 72 75 6e 2d 64 69 72 29 29 29 0a 09 09 20 20   run-dir)))...  
9340: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
9350: 2d 69 6e 66 6f 20 34 20 22 74 65 73 74 3d 22 20  -info 4 "test=" 
9360: 74 65 73 74 29 20 3b 3b 20 20 20 22 20 28 64 62  test) ;;   " (db
9370: 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61  :test-get-testna
9380: 6d 65 20 74 65 73 74 29 20 22 20 69 64 3a 20 22  me test) " id: "
9390: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64   (db:test-get-id
93a0: 20 74 65 73 74 29 20 22 20 22 20 69 74 65 6d 2d   test) " " item-
93b0: 70 61 74 68 20 22 20 61 63 74 69 6f 6e 3a 20 22  path " action: "
93c0: 20 61 63 74 69 6f 6e 29 0a 09 09 20 20 20 20 20   action)...     
93d0: 20 28 63 61 73 65 20 61 63 74 69 6f 6e 0a 09 09   (case action...
93e0: 09 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29 20  .((remove-runs) 
93f0: 3b 3b 20 74 68 65 20 74 64 62 20 69 73 20 66 6f  ;; the tdb is fo
9400: 72 20 66 75 74 75 72 65 20 70 6f 73 73 69 62 6c  r future possibl
9410: 65 2e 20 0a 09 09 09 20 28 6f 70 65 6e 2d 72 75  e. .... (open-ru
9420: 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74  n-close db:delet
9430: 65 2d 74 65 73 74 2d 72 65 63 6f 72 64 73 20 64  e-test-records d
9440: 62 20 23 66 20 28 64 62 3a 74 65 73 74 2d 67 65  b #f (db:test-ge
9450: 74 2d 69 64 20 74 65 73 74 29 29 0a 09 09 09 20  t-id test)).... 
9460: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
9470: 6f 20 31 20 22 41 74 74 65 6d 70 74 69 6e 67 20  o 1 "Attempting 
9480: 74 6f 20 72 65 6d 6f 76 65 20 22 20 28 69 66 20  to remove " (if 
9490: 72 65 61 6c 2d 64 69 72 20 28 63 6f 6e 63 20 22  real-dir (conc "
94a0: 20 64 69 72 20 22 20 72 65 61 6c 2d 64 69 72 20   dir " real-dir 
94b0: 22 20 61 6e 64 20 22 29 20 22 22 29 20 22 20 6c  " and ") "") " l
94c0: 69 6e 6b 20 22 20 72 75 6e 2d 64 69 72 29 0a 09  ink " run-dir)..
94d0: 09 09 20 28 69 66 20 28 61 6e 64 20 72 65 61 6c  .. (if (and real
94e0: 2d 64 69 72 20 0a 09 09 09 09 20 20 28 3e 20 28  -dir .....  (> (
94f0: 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 72 65  string-length re
9500: 61 6c 2d 64 69 72 29 20 35 29 0a 09 09 09 09 20  al-dir) 5)..... 
9510: 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 72   (file-exists? r
9520: 65 61 6c 2d 64 69 72 29 29 20 3b 3b 20 62 61 64  eal-dir)) ;; bad
9530: 20 68 65 75 72 69 73 74 69 63 20 62 75 74 20 73   heuristic but s
9540: 68 6f 75 6c 64 20 70 72 65 76 65 6e 74 20 2f 74  hould prevent /t
9550: 6d 70 20 2f 68 6f 6d 65 20 65 74 63 2e 0a 09 09  mp /home etc....
9560: 09 20 20 20 20 20 28 62 65 67 69 6e 20 3b 3b 20  .     (begin ;; 
9570: 6c 65 74 2a 20 28 28 72 65 61 6c 70 61 74 68 20  let* ((realpath 
9580: 28 72 65 73 6f 6c 76 65 2d 70 61 74 68 6e 61 6d  (resolve-pathnam
9590: 65 20 72 75 6e 2d 64 69 72 29 29 29 0a 09 09 09  e run-dir)))....
95a0: 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72         (debug:pr
95b0: 69 6e 74 2d 69 6e 66 6f 20 31 20 22 52 65 63 75  int-info 1 "Recu
95c0: 72 73 69 76 65 6c 79 20 72 65 6d 6f 76 69 6e 67  rsively removing
95d0: 20 22 20 72 65 61 6c 2d 64 69 72 29 0a 09 09 09   " real-dir)....
95e0: 20 20 20 20 20 20 20 28 69 66 20 28 66 69 6c 65         (if (file
95f0: 2d 65 78 69 73 74 73 3f 20 72 65 61 6c 2d 64 69  -exists? real-di
9600: 72 29 0a 09 09 09 09 20 20 20 28 69 66 20 28 3e  r).....   (if (>
9610: 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 22   (system (conc "
9620: 72 6d 20 2d 72 66 20 22 20 72 65 61 6c 2d 64 69  rm -rf " real-di
9630: 72 29 29 20 30 29 0a 09 09 09 09 20 20 20 20 20  r)) 0).....     
9640: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
9650: 20 22 45 52 52 4f 52 3a 20 54 68 65 72 65 20 77   "ERROR: There w
9660: 61 73 20 61 20 70 72 6f 62 6c 65 6d 20 72 65 6d  as a problem rem
9670: 6f 76 69 6e 67 20 22 20 72 65 61 6c 2d 64 69 72  oving " real-dir
9680: 20 22 20 77 69 74 68 20 72 6d 20 2d 66 22 29 29   " with rm -f"))
9690: 0a 09 09 09 09 20 20 20 28 64 65 62 75 67 3a 70  .....   (debug:p
96a0: 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a  rint 0 "WARNING:
96b0: 20 74 65 73 74 20 64 69 72 20 22 20 72 65 61 6c   test dir " real
96c0: 2d 64 69 72 20 22 20 61 70 70 65 61 72 73 20 74  -dir " appears t
96d0: 6f 20 6e 6f 74 20 65 78 69 73 74 20 6f 72 20 69  o not exist or i
96e0: 73 20 6e 6f 74 20 72 65 61 64 61 62 6c 65 22 29  s not readable")
96f0: 29 29 0a 09 09 09 20 20 20 20 20 28 69 66 20 72  ))....     (if r
9700: 65 61 6c 2d 64 69 72 20 0a 09 09 09 09 20 28 64  eal-dir ..... (d
9710: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41  ebug:print 0 "WA
9720: 52 4e 49 4e 47 3a 20 64 69 72 65 63 74 6f 72 79  RNING: directory
9730: 20 22 20 72 65 61 6c 2d 64 69 72 20 22 20 64 6f   " real-dir " do
9740: 65 73 20 6e 6f 74 20 65 78 69 73 74 22 29 0a 09  es not exist")..
9750: 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ... (debug:print
9760: 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 6e 6f 20   0 "WARNING: no 
9770: 72 65 61 6c 20 64 69 72 65 63 74 6f 72 79 20 63  real directory c
9780: 6f 72 72 6f 73 70 6f 6e 64 69 6e 67 20 74 6f 20  orrosponding to 
9790: 6c 69 6e 6b 20 22 20 72 75 6e 2d 64 69 72 20 22  link " run-dir "
97a0: 2c 20 6e 6f 74 68 69 6e 67 20 64 6f 6e 65 22 29  , nothing done")
97b0: 29 29 0a 09 09 09 20 28 69 66 20 28 73 79 6d 62  )).... (if (symb
97c0: 6f 6c 69 63 2d 6c 69 6e 6b 3f 20 72 75 6e 2d 64  olic-link? run-d
97d0: 69 72 29 0a 09 09 09 20 20 20 20 20 28 62 65 67  ir)....     (beg
97e0: 69 6e 0a 09 09 09 20 20 20 20 20 20 20 28 64 65  in....       (de
97f0: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31  bug:print-info 1
9800: 20 22 52 65 6d 6f 76 69 6e 67 20 73 79 6d 6c 69   "Removing symli
9810: 6e 6b 20 22 20 72 75 6e 2d 64 69 72 29 0a 09 09  nk " run-dir)...
9820: 09 20 20 20 20 20 20 20 28 68 61 6e 64 6c 65 2d  .       (handle-
9830: 65 78 63 65 70 74 69 6f 6e 73 0a 09 09 09 09 65  exceptions.....e
9840: 78 6e 0a 09 09 09 09 28 64 65 62 75 67 3a 70 72  xn.....(debug:pr
9850: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 20 46  int 0 "ERROR:  F
9860: 61 69 6c 65 64 20 74 6f 20 72 65 6d 6f 76 65 20  ailed to remove 
9870: 73 79 6d 6c 69 6e 6b 20 22 20 72 75 6e 2d 64 69  symlink " run-di
9880: 72 20 28 28 63 6f 6e 64 69 74 69 6f 6e 2d 70 72  r ((condition-pr
9890: 6f 70 65 72 74 79 2d 61 63 63 65 73 73 6f 72 20  operty-accessor 
98a0: 27 65 78 6e 20 27 6d 65 73 73 61 67 65 29 20 65  'exn 'message) e
98b0: 78 6e 29 20 22 2c 20 61 74 74 65 6d 70 74 69 6e  xn) ", attemptin
98c0: 67 20 74 6f 20 63 6f 6e 74 69 6e 75 65 22 29 0a  g to continue").
98d0: 09 09 09 09 28 64 65 6c 65 74 65 2d 66 69 6c 65  ....(delete-file
98e0: 20 72 75 6e 2d 64 69 72 29 29 29 0a 09 09 09 20   run-dir))).... 
98f0: 20 20 20 20 28 69 66 20 28 64 69 72 65 63 74 6f      (if (directo
9900: 72 79 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09 09  ry? run-dir)....
9910: 09 20 28 69 66 20 28 3e 20 28 64 69 72 65 63 74  . (if (> (direct
9920: 6f 72 79 2d 66 6f 6c 64 20 28 6c 61 6d 62 64 61  ory-fold (lambda
9930: 20 28 66 20 78 29 28 2b 20 31 20 78 29 29 20 30   (f x)(+ 1 x)) 0
9940: 20 72 75 6e 2d 64 69 72 29 20 30 29 0a 09 09 09   run-dir) 0)....
9950: 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  .     (debug:pri
9960: 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 72  nt 0 "WARNING: r
9970: 65 66 75 73 69 6e 67 20 74 6f 20 72 65 6d 6f 76  efusing to remov
9980: 65 20 22 20 72 75 6e 2d 64 69 72 20 22 20 61 73  e " run-dir " as
9990: 20 69 74 20 69 73 20 6e 6f 74 20 65 6d 70 74 79   it is not empty
99a0: 22 29 0a 09 09 09 09 20 20 20 20 20 20 28 68 61  ").....      (ha
99b0: 6e 64 6c 65 2d 65 78 63 65 70 74 69 6f 6e 73 0a  ndle-exceptions.
99c0: 09 09 09 09 20 20 20 20 20 20 20 65 78 6e 0a 09  ....       exn..
99d0: 09 09 09 20 20 20 20 20 20 20 28 64 65 62 75 67  ...       (debug
99e0: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a  :print 0 "ERROR:
99f0: 20 20 46 61 69 6c 65 64 20 74 6f 20 72 65 6d 6f    Failed to remo
9a00: 76 65 20 64 69 72 65 63 74 6f 72 79 20 22 20 72  ve directory " r
9a10: 75 6e 2d 64 69 72 20 28 28 63 6f 6e 64 69 74 69  un-dir ((conditi
9a20: 6f 6e 2d 70 72 6f 70 65 72 74 79 2d 61 63 63 65  on-property-acce
9a30: 73 73 6f 72 20 27 65 78 6e 20 27 6d 65 73 73 61  ssor 'exn 'messa
9a40: 67 65 29 20 65 78 6e 29 20 22 2c 20 61 74 74 65  ge) exn) ", atte
9a50: 6d 70 74 69 6e 67 20 74 6f 20 63 6f 6e 74 69 6e  mpting to contin
9a60: 75 65 22 29 0a 09 09 09 09 20 20 20 20 20 20 20  ue").....       
9a70: 28 64 65 6c 65 74 65 2d 64 69 72 65 63 74 6f 72  (delete-director
9a80: 79 20 72 75 6e 2d 64 69 72 29 29 29 0a 09 09 09  y run-dir)))....
9a90: 09 20 28 69 66 20 72 75 6e 2d 64 69 72 0a 09 09  . (if run-dir...
9aa0: 09 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72  ..     (debug:pr
9ab0: 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20  int 0 "WARNING: 
9ac0: 6e 6f 74 20 72 65 6d 6f 76 69 6e 67 20 22 20 72  not removing " r
9ad0: 75 6e 2d 64 69 72 20 22 20 61 73 20 69 74 20 65  un-dir " as it e
9ae0: 69 74 68 65 72 20 64 6f 65 73 6e 27 74 20 65 78  ither doesn't ex
9af0: 69 73 74 20 6f 72 20 69 73 20 6e 6f 74 20 61 20  ist or is not a 
9b00: 73 79 6d 6c 69 6e 6b 22 29 0a 09 09 09 09 20 20  symlink").....  
9b10: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
9b20: 30 20 22 4e 4f 54 45 3a 20 74 68 65 20 72 75 6e  0 "NOTE: the run
9b30: 20 64 69 72 20 66 6f 72 20 74 68 69 73 20 74 65   dir for this te
9b40: 73 74 20 69 73 20 75 6e 64 65 66 69 6e 65 64 2e  st is undefined.
9b50: 20 54 65 73 74 20 6d 61 79 20 68 61 76 65 20 61   Test may have a
9b60: 6c 72 65 61 64 79 20 62 65 65 6e 20 64 65 6c 65  lready been dele
9b70: 74 65 64 2e 22 29 29 0a 09 09 09 09 20 29 29 29  ted."))..... )))
9b80: 0a 09 09 09 28 28 73 65 74 2d 73 74 61 74 65 2d  ....((set-state-
9b90: 73 74 61 74 75 73 29 0a 09 09 09 20 28 64 65 62  status).... (deb
9ba0: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 32 20  ug:print-info 2 
9bb0: 22 6e 65 77 20 73 74 61 74 65 20 22 20 28 63 61  "new state " (ca
9bc0: 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 20  r state-status) 
9bd0: 22 2c 20 6e 65 77 20 73 74 61 74 75 73 20 22 20  ", new status " 
9be0: 28 63 61 64 72 20 73 74 61 74 65 2d 73 74 61 74  (cadr state-stat
9bf0: 75 73 29 29 0a 09 09 09 20 28 6f 70 65 6e 2d 72  us)).... (open-r
9c00: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 74 65 73 74  un-close db:test
9c10: 2d 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75  -set-state-statu
9c20: 73 2d 62 79 2d 69 64 20 64 62 20 28 64 62 3a 74  s-by-id db (db:t
9c30: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29  est-get-id test)
9c40: 20 28 63 61 72 20 73 74 61 74 65 2d 73 74 61 74   (car state-stat
9c50: 75 73 29 28 63 61 64 72 20 73 74 61 74 65 2d 73  us)(cadr state-s
9c60: 74 61 74 75 73 29 20 23 66 29 29 29 29 29 0a 09  tatus) #f)))))..
9c70: 09 20 20 28 73 6f 72 74 20 74 65 73 74 73 20 28  .  (sort tests (
9c80: 6c 61 6d 62 64 61 20 28 61 20 62 29 28 6c 65 74  lambda (a b)(let
9c90: 20 28 28 64 69 72 61 20 28 64 62 3a 74 65 73 74   ((dira (db:test
9ca0: 2d 67 65 74 2d 72 75 6e 64 69 72 20 61 29 29 0a  -get-rundir a)).
9cb0: 09 09 09 09 09 09 20 28 64 69 72 62 20 28 64 62  ...... (dirb (db
9cc0: 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 64 69 72  :test-get-rundir
9cd0: 20 62 29 29 29 0a 09 09 09 09 09 20 20 20 20 20   b)))......     
9ce0: 28 69 66 20 28 61 6e 64 20 28 73 74 72 69 6e 67  (if (and (string
9cf0: 3f 20 64 69 72 61 29 28 73 74 72 69 6e 67 3f 20  ? dira)(string? 
9d00: 64 69 72 62 29 29 0a 09 09 09 09 09 09 20 28 3e  dirb))....... (>
9d10: 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20   (string-length 
9d20: 64 69 72 61 29 28 73 74 72 69 6e 67 2d 6c 65 6e  dira)(string-len
9d30: 67 74 68 20 64 69 72 62 29 29 0a 09 09 09 09 09  gth dirb))......
9d40: 09 20 23 66 29 29 29 29 29 29 29 0a 09 20 20 20  . #f)))))))..   
9d50: 3b 3b 20 72 65 6d 6f 76 65 20 74 68 65 20 72 75  ;; remove the ru
9d60: 6e 20 69 66 20 7a 65 72 6f 20 74 65 73 74 73 20  n if zero tests 
9d70: 72 65 6d 61 69 6e 0a 09 20 20 20 28 69 66 20 28  remain..   (if (
9d80: 65 71 3f 20 61 63 74 69 6f 6e 20 27 72 65 6d 6f  eq? action 'remo
9d90: 76 65 2d 72 75 6e 73 29 0a 09 20 20 20 20 20 20  ve-runs)..      
9da0: 20 28 6c 65 74 20 28 28 72 65 6d 74 65 73 74 73   (let ((remtests
9db0: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
9dc0: 20 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f   db:get-tests-fo
9dd0: 72 2d 72 75 6e 20 64 62 20 28 64 62 3a 67 65 74  r-run db (db:get
9de0: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72  -value-by-header
9df0: 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 22   run header "id"
9e00: 29 20 23 66 20 27 28 22 44 45 4c 45 54 45 44 22  ) #f '("DELETED"
9e10: 29 20 27 28 22 6e 2f 61 22 29 20 6e 6f 74 2d 69  ) '("n/a") not-i
9e20: 6e 3a 20 23 74 29 29 29 0a 09 09 20 28 69 66 20  n: #t)))... (if 
9e30: 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29  (null? remtests)
9e40: 20 3b 3b 20 6e 6f 20 6d 6f 72 65 20 74 65 73 74   ;; no more test
9e50: 73 20 72 65 6d 61 69 6e 69 6e 67 0a 09 09 20 20  s remaining...  
9e60: 20 20 20 28 6c 65 74 2a 20 28 28 64 70 61 72 74     (let* ((dpart
9e70: 73 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74  s  (string-split
9e80: 20 6c 61 73 74 74 70 61 74 68 20 22 2f 22 29 29   lasttpath "/"))
9e90: 0a 09 09 09 20 20 20 20 28 72 75 6e 70 61 74 68  ....    (runpath
9ea0: 20 28 63 6f 6e 63 20 22 2f 22 20 28 73 74 72 69   (conc "/" (stri
9eb0: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 0a  ng-intersperse .
9ec0: 09 09 09 09 09 09 28 74 61 6b 65 20 64 70 61 72  ......(take dpar
9ed0: 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 20 64 70  ts (- (length dp
9ee0: 61 72 74 73 29 20 31 29 29 0a 09 09 09 09 09 09  arts) 1)).......
9ef0: 22 2f 22 29 29 29 29 0a 09 09 20 20 20 20 20 20  "/"))))...      
9f00: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20   (debug:print 1 
9f10: 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 3a 20 22  "Removing run: "
9f20: 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a   runkey " " (db:
9f30: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61  get-value-by-hea
9f40: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22  der run header "
9f50: 72 75 6e 6e 61 6d 65 22 29 20 22 20 61 6e 64 20  runname") " and 
9f60: 72 65 6c 61 74 65 64 20 72 65 63 6f 72 64 22 29  related record")
9f70: 0a 09 09 20 20 20 20 20 20 20 28 6f 70 65 6e 2d  ...       (open-
9f80: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c  run-close db:del
9f90: 65 74 65 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69  ete-run db run-i
9fa0: 64 29 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 54  d)...       ;; T
9fb0: 68 69 73 20 69 73 20 61 20 70 72 65 74 74 79 20  his is a pretty 
9fc0: 67 6f 6f 64 20 70 6c 61 63 65 20 74 6f 20 70 75  good place to pu
9fd0: 72 67 65 20 6f 6c 64 20 44 45 4c 45 54 45 44 20  rge old DELETED 
9fe0: 74 65 73 74 73 0a 09 09 20 20 20 20 20 20 20 28  tests...       (
9ff0: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64  open-run-close d
a000: 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 73 2d 66  b:delete-tests-f
a010: 6f 72 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 64  or-run db run-id
a020: 29 0a 09 09 20 20 20 20 20 20 20 28 6f 70 65 6e  )...       (open
a030: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65  -run-close db:de
a040: 6c 65 74 65 2d 6f 6c 64 2d 64 65 6c 65 74 65 64  lete-old-deleted
a050: 2d 74 65 73 74 2d 72 65 63 6f 72 64 73 20 64 62  -test-records db
a060: 29 0a 09 09 20 20 20 20 20 20 20 28 6f 70 65 6e  )...       (open
a070: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 73 65  -run-close db:se
a080: 74 2d 76 61 72 20 64 62 20 22 44 45 4c 45 54 45  t-var db "DELETE
a090: 44 5f 54 45 53 54 53 22 20 28 63 75 72 72 65 6e  D_TESTS" (curren
a0a0: 74 2d 73 65 63 6f 6e 64 73 29 29 0a 09 09 20 20  t-seconds))...  
a0b0: 20 20 20 20 20 3b 3b 20 6e 65 65 64 20 74 6f 20       ;; need to 
a0c0: 66 69 67 75 72 65 20 6f 75 74 20 74 68 65 20 70  figure out the p
a0d0: 61 74 68 20 74 6f 20 74 68 65 20 72 75 6e 20 64  ath to the run d
a0e0: 69 72 20 61 6e 64 20 72 65 6d 6f 76 65 20 69 74  ir and remove it
a0f0: 20 69 66 20 65 6d 70 74 79 0a 09 09 20 20 20 20   if empty...    
a100: 20 20 20 3b 3b 20 20 20 20 28 69 66 20 28 6e 75     ;;    (if (nu
a110: 6c 6c 3f 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20  ll? (glob (conc 
a120: 72 75 6e 70 61 74 68 20 22 2f 2a 22 29 29 29 0a  runpath "/*"))).
a130: 09 09 20 20 20 20 20 20 20 3b 3b 20 20 20 20 20  ..       ;;     
a140: 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20     (begin...    
a150: 20 20 20 3b 3b 20 09 20 28 64 65 62 75 67 3a 70     ;; . (debug:p
a160: 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67  rint 1 "Removing
a170: 20 72 75 6e 20 64 69 72 20 22 20 72 75 6e 70 61   run dir " runpa
a180: 74 68 29 0a 09 09 20 20 20 20 20 20 20 3b 3b 20  th)...       ;; 
a190: 09 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20  . (system (conc 
a1a0: 22 72 6d 64 69 72 20 2d 70 20 22 20 72 75 6e 70  "rmdir -p " runp
a1b0: 61 74 68 29 29 29 29 0a 09 09 20 20 20 20 20 20  ath))))...      
a1c0: 20 29 29 29 29 29 0a 09 20 29 29 0a 20 20 20 20   ))))).. )).    
a1d0: 20 72 75 6e 73 29 29 0a 20 20 23 74 29 0a 0a 3b   runs)).  #t)..;
a1e0: 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;===============
a1f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a200: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a210: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a220: 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 75 74 69  =======.;; Routi
a230: 6e 65 73 20 66 6f 72 20 6d 61 6e 69 70 75 6c 61  nes for manipula
a240: 74 69 6e 67 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d  ting runs.;;====
a250: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a260: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a270: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a280: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a290: 3d 3d 0a 0a 3b 3b 20 53 69 6e 63 65 20 6d 61 6e  ==..;; Since man
a2a0: 79 20 63 61 6c 6c 73 20 74 6f 20 61 20 72 75 6e  y calls to a run
a2b0: 20 72 65 71 75 69 72 65 20 70 72 65 74 74 79 20   require pretty 
a2c0: 6d 75 63 68 20 74 68 65 20 73 61 6d 65 20 73 65  much the same se
a2d0: 74 75 70 20 0a 3b 3b 20 74 68 69 73 20 77 72 61  tup .;; this wra
a2e0: 70 70 65 72 20 69 73 20 75 73 65 64 20 74 6f 20  pper is used to 
a2f0: 72 65 64 75 63 65 20 74 68 65 20 72 65 70 6c 69  reduce the repli
a300: 63 61 74 69 6f 6e 20 6f 66 20 63 6f 64 65 0a 28  cation of code.(
a310: 64 65 66 69 6e 65 20 28 67 65 6e 65 72 61 6c 2d  define (general-
a320: 72 75 6e 2d 63 61 6c 6c 20 73 77 69 74 63 68 6e  run-call switchn
a330: 61 6d 65 20 61 63 74 69 6f 6e 2d 64 65 73 63 20  ame action-desc 
a340: 70 72 6f 63 29 0a 20 20 28 6c 65 74 20 28 28 72  proc).  (let ((r
a350: 75 6e 6e 61 6d 65 20 28 61 72 67 73 3a 67 65 74  unname (args:get
a360: 2d 61 72 67 20 22 3a 72 75 6e 6e 61 6d 65 22 29  -arg ":runname")
a370: 29 0a 09 28 74 61 72 67 65 74 20 20 28 69 66 20  )..(target  (if 
a380: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
a390: 74 61 72 67 65 74 22 29 0a 09 09 20 20 20 20 20  target")...     
a3a0: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
a3b0: 74 61 72 67 65 74 22 29 0a 09 09 20 20 20 20 20  target")...     
a3c0: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
a3d0: 72 65 71 74 61 72 67 22 29 29 29 0a 09 28 74 68  reqtarg")))..(th
a3e0: 31 20 20 20 20 20 23 66 29 29 0a 20 20 20 20 28  1     #f)).    (
a3f0: 63 6f 6e 64 0a 20 20 20 20 20 28 28 6e 6f 74 20  cond.     ((not 
a400: 74 61 72 67 65 74 29 0a 20 20 20 20 20 20 28 64  target).      (d
a410: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
a420: 52 4f 52 3a 20 4d 69 73 73 69 6e 67 20 72 65 71  ROR: Missing req
a430: 75 69 72 65 64 20 70 61 72 61 6d 65 74 65 72 20  uired parameter 
a440: 66 6f 72 20 22 20 73 77 69 74 63 68 6e 61 6d 65  for " switchname
a450: 20 22 2c 20 79 6f 75 20 6d 75 73 74 20 73 70 65   ", you must spe
a460: 63 69 66 79 20 74 68 65 20 74 61 72 67 65 74 20  cify the target 
a470: 77 69 74 68 20 2d 74 61 72 67 65 74 22 29 0a 20  with -target"). 
a480: 20 20 20 20 20 28 65 78 69 74 20 33 29 29 0a 20       (exit 3)). 
a490: 20 20 20 20 28 28 6e 6f 74 20 72 75 6e 6e 61 6d      ((not runnam
a4a0: 65 29 0a 20 20 20 20 20 20 28 64 65 62 75 67 3a  e).      (debug:
a4b0: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
a4c0: 4d 69 73 73 69 6e 67 20 72 65 71 75 69 72 65 64  Missing required
a4d0: 20 70 61 72 61 6d 65 74 65 72 20 66 6f 72 20 22   parameter for "
a4e0: 20 73 77 69 74 63 68 6e 61 6d 65 20 22 2c 20 79   switchname ", y
a4f0: 6f 75 20 6d 75 73 74 20 73 70 65 63 69 66 79 20  ou must specify 
a500: 74 68 65 20 72 75 6e 20 6e 61 6d 65 20 77 69 74  the run name wit
a510: 68 20 3a 72 75 6e 6e 61 6d 65 20 72 75 6e 6e 61  h :runname runna
a520: 6d 65 22 29 0a 20 20 20 20 20 20 28 65 78 69 74  me").      (exit
a530: 20 33 29 29 0a 20 20 20 20 20 28 65 6c 73 65 0a   3)).     (else.
a540: 20 20 20 20 20 20 28 6c 65 74 20 28 28 64 62 20        (let ((db 
a550: 20 20 23 66 29 0a 09 20 20 20 20 28 6b 65 79 73    #f)..    (keys
a560: 20 23 66 29 29 0a 09 28 69 66 20 28 6e 6f 74 20   #f))..(if (not 
a570: 28 73 65 74 75 70 2d 66 6f 72 2d 72 75 6e 29 29  (setup-for-run))
a580: 0a 09 20 20 20 20 28 62 65 67 69 6e 20 0a 09 20  ..    (begin .. 
a590: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
a5a0: 74 20 30 20 22 46 61 69 6c 65 64 20 74 6f 20 73  t 0 "Failed to s
a5b0: 65 74 75 70 2c 20 65 78 69 74 69 6e 67 22 29 0a  etup, exiting").
a5c0: 09 20 20 20 20 20 20 28 65 78 69 74 20 31 29 29  .      (exit 1))
a5d0: 29 0a 09 28 69 66 20 28 61 72 67 73 3a 67 65 74  )..(if (args:get
a5e0: 2d 61 72 67 20 22 2d 73 65 72 76 65 72 22 29 0a  -arg "-server").
a5f0: 09 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63  .    (open-run-c
a600: 6c 6f 73 65 20 73 65 72 76 65 72 3a 73 74 61 72  lose server:star
a610: 74 20 64 62 20 28 61 72 67 73 3a 67 65 74 2d 61  t db (args:get-a
a620: 72 67 20 22 2d 73 65 72 76 65 72 22 29 29 29 0a  rg "-server"))).
a630: 20 09 20 20 20 20 3b 3b 20 28 69 66 20 28 6e 6f   .    ;; (if (no
a640: 74 20 28 6f 72 20 28 61 72 67 73 3a 67 65 74 2d  t (or (args:get-
a650: 61 72 67 20 22 2d 72 75 6e 61 6c 6c 22 29 20 20  arg "-runall")  
a660: 20 20 20 3b 3b 20 72 75 6e 61 6c 6c 20 61 6e 64     ;; runall and
a670: 20 72 75 6e 74 65 73 74 73 20 61 72 65 20 61 6c   runtests are al
a680: 6c 6f 77 65 64 20 74 6f 20 62 65 20 73 65 72 76  lowed to be serv
a690: 65 72 73 0a 20 09 20 20 20 20 3b 3b 20 20 20 20  ers. .    ;;    
a6a0: 20 09 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67   . (args:get-arg
a6b0: 20 22 2d 72 75 6e 74 65 73 74 73 22 29 29 29 0a   "-runtests"))).
a6c0: 09 20 20 20 20 3b 3b 20 20 20 20 20 28 63 6c 69  .    ;;     (cli
a6d0: 65 6e 74 3a 73 65 74 75 70 29 20 3b 3b 20 54 68  ent:setup) ;; Th
a6e0: 69 73 20 69 73 20 61 20 64 75 70 6c 69 63 61 74  is is a duplicat
a6f0: 65 20 73 74 61 72 74 75 70 21 21 21 3f 3f 3f 20  e startup!!!??? 
a700: 42 55 47 3f 0a 09 20 20 20 20 3b 3b 20 20 20 20  BUG?..    ;;    
a710: 20 29 29 0a 09 28 73 65 74 21 20 6b 65 79 73 20   ))..(set! keys 
a720: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
a730: 64 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29  db:get-keys db))
a740: 0a 09 3b 3b 20 68 61 76 65 20 65 6e 6f 75 67 68  ..;; have enough
a750: 20 74 6f 20 70 72 6f 63 65 73 73 20 2d 74 61 72   to process -tar
a760: 67 65 74 20 6f 72 20 2d 72 65 71 74 61 72 67 20  get or -reqtarg 
a770: 68 65 72 65 0a 09 28 69 66 20 28 61 72 67 73 3a  here..(if (args:
a780: 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72  get-arg "-reqtar
a790: 67 22 29 0a 09 20 20 20 20 28 6c 65 74 2a 20 28  g")..    (let* (
a7a0: 28 72 75 6e 63 6f 6e 66 69 67 66 20 28 63 6f 6e  (runconfigf (con
a7b0: 63 20 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72  c  *toppath* "/r
a7c0: 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67  unconfigs.config
a7d0: 22 29 29 20 3b 3b 20 44 4f 20 4e 4f 54 20 45 56  ")) ;; DO NOT EV
a7e0: 41 4c 55 41 54 45 20 41 4c 4c 20 0a 09 09 20 20  ALUATE ALL ...  
a7f0: 20 28 72 75 6e 63 6f 6e 66 69 67 20 20 28 72 65   (runconfig  (re
a800: 61 64 2d 63 6f 6e 66 69 67 20 72 75 6e 63 6f 6e  ad-config runcon
a810: 66 69 67 66 20 23 66 20 23 74 20 65 6e 76 69 72  figf #f #t envir
a820: 6f 6e 2d 70 61 74 74 3a 20 23 66 29 29 29 20 0a  on-patt: #f))) .
a830: 09 20 20 20 20 20 20 28 69 66 20 28 68 61 73 68  .      (if (hash
a840: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75  -table-ref/defau
a850: 6c 74 20 72 75 6e 63 6f 6e 66 69 67 20 28 61 72  lt runconfig (ar
a860: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71  gs:get-arg "-req
a870: 74 61 72 67 22 29 20 23 66 29 0a 09 09 20 20 28  targ") #f)...  (
a880: 6b 65 79 73 3a 74 61 72 67 65 74 2d 73 65 74 2d  keys:target-set-
a890: 61 72 67 73 20 6b 65 79 73 20 28 61 72 67 73 3a  args keys (args:
a8a0: 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72  get-arg "-reqtar
a8b0: 67 22 29 20 61 72 67 73 3a 61 72 67 2d 68 61 73  g") args:arg-has
a8c0: 68 29 0a 09 09 20 20 28 62 65 67 69 6e 0a 09 09  h)...  (begin...
a8d0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
a8e0: 20 30 20 22 45 52 52 4f 52 3a 20 5b 22 20 28 61   0 "ERROR: [" (a
a8f0: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65  rgs:get-arg "-re
a900: 71 74 61 72 67 22 29 20 22 5d 20 6e 6f 74 20 66  qtarg") "] not f
a910: 6f 75 6e 64 20 69 6e 20 22 20 72 75 6e 63 6f 6e  ound in " runcon
a920: 66 69 67 66 29 0a 09 09 20 20 20 20 28 69 66 20  figf)...    (if 
a930: 64 62 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61  db (sqlite3:fina
a940: 6c 69 7a 65 21 20 64 62 29 29 0a 09 09 20 20 20  lize! db))...   
a950: 20 28 65 78 69 74 20 31 29 29 29 29 0a 09 20 20   (exit 1))))..  
a960: 20 20 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d    (if (args:get-
a970: 61 72 67 20 22 2d 74 61 72 67 65 74 22 29 0a 09  arg "-target")..
a980: 09 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 73 65  .(keys:target-se
a990: 74 2d 61 72 67 73 20 6b 65 79 73 20 28 61 72 67  t-args keys (arg
a9a0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67  s:get-arg "-targ
a9b0: 65 74 22 20 61 72 67 73 3a 61 72 67 2d 68 61 73  et" args:arg-has
a9c0: 68 29 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68  h) args:arg-hash
a9d0: 29 29 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 63  )))..(if (not (c
a9e0: 61 72 20 2a 63 6f 6e 66 69 67 69 6e 66 6f 2a 29  ar *configinfo*)
a9f0: 29 0a 09 20 20 20 20 28 62 65 67 69 6e 0a 09 20  )..    (begin.. 
aa00: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
aa10: 74 20 30 20 22 45 52 52 4f 52 3a 20 41 74 74 65  t 0 "ERROR: Atte
aa20: 6d 70 74 65 64 20 74 6f 20 22 20 61 63 74 69 6f  mpted to " actio
aa30: 6e 2d 64 65 73 63 20 22 20 62 75 74 20 72 75 6e  n-desc " but run
aa40: 20 61 72 65 61 20 63 6f 6e 66 69 67 20 66 69 6c   area config fil
aa50: 65 20 6e 6f 74 20 66 6f 75 6e 64 22 29 0a 09 20  e not found").. 
aa60: 20 20 20 20 20 28 65 78 69 74 20 31 29 29 0a 09       (exit 1))..
aa70: 20 20 20 20 3b 3b 20 45 78 74 72 61 63 74 20 6f      ;; Extract o
aa80: 75 74 20 73 74 75 66 66 20 6e 65 65 64 65 64 20  ut stuff needed 
aa90: 69 6e 20 6d 6f 73 74 20 6f 72 20 6d 61 6e 79 20  in most or many 
aaa0: 63 61 6c 6c 73 0a 09 20 20 20 20 3b 3b 20 68 65  calls..    ;; he
aab0: 72 65 20 74 68 65 6e 20 63 61 6c 6c 20 70 72 6f  re then call pro
aac0: 63 0a 09 20 20 20 20 28 6c 65 74 2a 20 28 28 6b  c..    (let* ((k
aad0: 65 79 6e 61 6d 65 73 20 20 20 28 6d 61 70 20 6b  eynames   (map k
aae0: 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65  ey:get-fieldname
aaf0: 20 6b 65 79 73 29 29 0a 09 09 20 20 20 28 6b 65   keys))...   (ke
ab00: 79 76 61 6c 6c 73 74 20 20 28 6b 65 79 73 2d 3e  yvallst  (keys->
ab10: 76 61 6c 6c 69 73 74 20 6b 65 79 73 20 23 74 29  vallist keys #t)
ab20: 29 29 0a 09 20 20 20 20 20 20 28 70 72 6f 63 20  ))..      (proc 
ab30: 74 61 72 67 65 74 20 72 75 6e 6e 61 6d 65 20 6b  target runname k
ab40: 65 79 73 20 6b 65 79 6e 61 6d 65 73 20 6b 65 79  eys keynames key
ab50: 76 61 6c 6c 73 74 29 29 29 0a 09 28 69 66 20 74  vallst)))..(if t
ab60: 68 31 20 28 74 68 72 65 61 64 2d 6a 6f 69 6e 21  h1 (thread-join!
ab70: 20 74 68 31 29 29 0a 09 28 69 66 20 64 62 20 28   th1))..(if db (
ab80: 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65  sqlite3:finalize
ab90: 21 20 64 62 29 29 0a 09 28 73 65 74 21 20 2a 64  ! db))..(set! *d
aba0: 69 64 73 6f 6d 65 74 68 69 6e 67 2a 20 23 74 29  idsomething* #t)
abb0: 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d  )))))..;;=======
abc0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
abd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
abe0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
abf0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a  ===============.
ac00: 3b 3b 20 4c 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 72  ;; Lock/unlock r
ac10: 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  uns.;;==========
ac20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
ac30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
ac40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
ac50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64  ============..(d
ac60: 65 66 69 6e 65 20 28 72 75 6e 73 3a 68 61 6e 64  efine (runs:hand
ac70: 6c 65 2d 6c 6f 63 6b 69 6e 67 20 74 61 72 67 65  le-locking targe
ac80: 74 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65 20 6c  t keys runname l
ac90: 6f 63 6b 20 75 6e 6c 6f 63 6b 20 75 73 65 72 29  ock unlock user)
aca0: 0a 20 20 28 6c 65 74 2a 20 28 28 64 62 20 20 20  .  (let* ((db   
acb0: 20 20 20 20 23 66 29 0a 09 20 28 72 75 6e 64 61      #f).. (runda
acc0: 74 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c  t   (open-run-cl
acd0: 6f 73 65 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e  ose runs:get-run
ace0: 73 2d 62 79 2d 70 61 74 74 20 64 62 20 6b 65 79  s-by-patt db key
acf0: 73 20 72 75 6e 6e 61 6d 65 29 29 0a 09 20 28 68  s runname)).. (h
ad00: 65 61 64 65 72 20 20 20 28 76 65 63 74 6f 72 2d  eader   (vector-
ad10: 72 65 66 20 72 75 6e 64 61 74 20 30 29 29 0a 09  ref rundat 0))..
ad20: 20 28 72 75 6e 73 20 20 20 20 20 28 76 65 63 74   (runs     (vect
ad30: 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 31 29  or-ref rundat 1)
ad40: 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68  )).    (for-each
ad50: 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a 09   (lambda (run)..
ad60: 09 28 6c 65 74 20 28 28 72 75 6e 2d 69 64 20 28  .(let ((run-id (
ad70: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d  db:get-value-by-
ad80: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65  header run heade
ad90: 72 20 22 69 64 22 29 29 29 0a 09 09 20 20 28 69  r "id")))...  (i
ada0: 66 20 28 6f 72 20 6c 6f 63 6b 0a 09 09 09 20 20  f (or lock....  
adb0: 28 61 6e 64 20 75 6e 6c 6f 63 6b 0a 09 09 09 20  (and unlock.... 
adc0: 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09        (begin....
add0: 09 20 28 70 72 69 6e 74 20 22 44 6f 20 79 6f 75  . (print "Do you
ade0: 20 72 65 61 6c 6c 79 20 77 69 73 68 20 74 6f 20   really wish to 
adf0: 75 6e 6c 6f 63 6b 20 72 75 6e 20 22 20 72 75 6e  unlock run " run
ae00: 2d 69 64 20 22 3f 5c 6e 20 20 20 79 2f 6e 3a 20  -id "?\n   y/n: 
ae10: 22 29 0a 09 09 09 09 20 28 65 71 75 61 6c 3f 20  ")..... (equal? 
ae20: 22 79 22 20 28 72 65 61 64 2d 6c 69 6e 65 29 29  "y" (read-line))
ae30: 29 29 29 0a 09 09 20 20 20 20 20 20 28 6f 70 65  )))...      (ope
ae40: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 6c  n-run-close db:l
ae50: 6f 63 6b 2f 75 6e 6c 6f 63 6b 2d 72 75 6e 20 64  ock/unlock-run d
ae60: 62 20 72 75 6e 2d 69 64 20 6c 6f 63 6b 20 75 6e  b run-id lock un
ae70: 6c 6f 63 6b 20 75 73 65 72 29 0a 09 09 20 20 20  lock user)...   
ae80: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d     (debug:print-
ae90: 69 6e 66 6f 20 30 20 22 53 6b 69 70 70 69 6e 67  info 0 "Skipping
aea0: 20 6c 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 6f 6e 20   lock/unlock on 
aeb0: 22 20 72 75 6e 2d 69 64 29 29 29 29 0a 09 20 20  " run-id))))..  
aec0: 20 20 20 20 72 75 6e 73 29 29 29 0a 3b 3b 3d 3d      runs))).;;==
aed0: 3d 3d 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 0a 3b 3b 20 52 6f 6c 6c 75 70 20 72  ====.;; Rollup r
af20: 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  uns.;;==========
af30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
af40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
af50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
af60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b  ============..;;
af70: 20 55 70 64 61 74 65 20 74 68 65 20 74 65 73 74   Update the test
af80: 5f 6d 65 74 61 20 74 61 62 6c 65 20 66 6f 72 20  _meta table for 
af90: 74 68 69 73 20 74 65 73 74 0a 28 64 65 66 69 6e  this test.(defin
afa0: 65 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74  e (runs:update-t
afb0: 65 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74  est_meta db test
afc0: 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29  -name test-conf)
afd0: 0a 20 20 28 6c 65 74 20 28 28 63 75 72 72 72 65  .  (let ((currre
afe0: 63 6f 72 64 20 28 63 64 62 3a 72 65 6d 6f 74 65  cord (cdb:remote
aff0: 2d 72 75 6e 20 64 62 3a 74 65 73 74 6d 65 74 61  -run db:testmeta
b000: 2d 67 65 74 2d 72 65 63 6f 72 64 20 64 62 20 74  -get-record db t
b010: 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20  est-name))).    
b020: 28 69 66 20 28 6e 6f 74 20 63 75 72 72 72 65 63  (if (not currrec
b030: 6f 72 64 29 0a 09 28 62 65 67 69 6e 0a 09 20 20  ord)..(begin..  
b040: 28 73 65 74 21 20 63 75 72 72 72 65 63 6f 72 64  (set! currrecord
b050: 20 28 6d 61 6b 65 2d 76 65 63 74 6f 72 20 31 30   (make-vector 10
b060: 20 23 66 29 29 0a 09 20 20 28 63 64 62 3a 72 65   #f))..  (cdb:re
b070: 6d 6f 74 65 2d 72 75 6e 20 64 62 3a 74 65 73 74  mote-run db:test
b080: 6d 65 74 61 2d 61 64 64 2d 72 65 63 6f 72 64 20  meta-add-record 
b090: 64 62 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a  db test-name))).
b0a0: 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20      (for-each . 
b0b0: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79      (lambda (key
b0c0: 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28  ).       (let* (
b0d0: 28 69 64 78 20 28 63 61 64 72 20 6b 65 79 29 29  (idx (cadr key))
b0e0: 0a 09 20 20 20 20 20 20 28 66 6c 64 20 28 63 61  ..      (fld (ca
b0f0: 72 20 20 6b 65 79 29 29 0a 09 20 20 20 20 20 20  r  key))..      
b100: 28 76 61 6c 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f  (val (config-loo
b110: 6b 75 70 20 74 65 73 74 2d 63 6f 6e 66 20 22 74  kup test-conf "t
b120: 65 73 74 5f 6d 65 74 61 22 20 66 6c 64 29 29 29  est_meta" fld)))
b130: 0a 09 20 3b 3b 20 28 64 65 62 75 67 3a 70 72 69  .. ;; (debug:pri
b140: 6e 74 20 35 20 22 69 64 78 3a 20 22 20 69 64 78  nt 5 "idx: " idx
b150: 20 22 20 66 6c 64 3a 20 22 20 66 6c 64 20 22 20   " fld: " fld " 
b160: 76 61 6c 3a 20 22 20 76 61 6c 29 0a 09 20 28 69  val: " val).. (i
b170: 66 20 28 61 6e 64 20 76 61 6c 20 28 6e 6f 74 20  f (and val (not 
b180: 28 65 71 75 61 6c 3f 20 28 76 65 63 74 6f 72 2d  (equal? (vector-
b190: 72 65 66 20 63 75 72 72 72 65 63 6f 72 64 20 69  ref currrecord i
b1a0: 64 78 29 20 76 61 6c 29 29 29 0a 09 20 20 20 20  dx) val)))..    
b1b0: 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 20   (begin..       
b1c0: 28 70 72 69 6e 74 20 22 55 70 64 61 74 69 6e 67  (print "Updating
b1d0: 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 22   " test-name " "
b1e0: 20 66 6c 64 20 22 20 74 6f 20 22 20 76 61 6c 29   fld " to " val)
b1f0: 0a 09 20 20 20 20 20 20 20 28 63 64 62 3a 72 65  ..       (cdb:re
b200: 6d 6f 74 65 2d 72 75 6e 20 64 62 3a 74 65 73 74  mote-run db:test
b210: 6d 65 74 61 2d 75 70 64 61 74 65 2d 66 69 65 6c  meta-update-fiel
b220: 64 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 66  d db test-name f
b230: 6c 64 20 76 61 6c 29 29 29 29 29 0a 20 20 20 20  ld val))))).    
b240: 20 27 28 28 22 61 75 74 68 6f 72 22 20 32 29 28   '(("author" 2)(
b250: 22 6f 77 6e 65 72 22 20 33 29 28 22 64 65 73 63  "owner" 3)("desc
b260: 72 69 70 74 69 6f 6e 22 20 34 29 28 22 72 65 76  ription" 4)("rev
b270: 69 65 77 65 64 22 20 35 29 28 22 74 61 67 73 22  iewed" 5)("tags"
b280: 20 39 29 29 29 29 29 0a 0a 3b 3b 20 55 70 64 61   9)))))..;; Upda
b290: 74 65 20 74 65 73 74 5f 6d 65 74 61 20 66 6f 72  te test_meta for
b2a0: 20 61 6c 6c 20 74 65 73 74 73 0a 28 64 65 66 69   all tests.(defi
b2b0: 6e 65 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d  ne (runs:update-
b2c0: 61 6c 6c 2d 74 65 73 74 5f 6d 65 74 61 20 64 62  all-test_meta db
b2d0: 29 0a 20 20 28 6c 65 74 20 28 28 74 65 73 74 2d  ).  (let ((test-
b2e0: 6e 61 6d 65 73 20 28 67 65 74 2d 61 6c 6c 2d 6c  names (get-all-l
b2f0: 65 67 61 6c 2d 74 65 73 74 73 29 29 29 0a 20 20  egal-tests))).  
b300: 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20    (for-each .   
b310: 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 2d    (lambda (test-
b320: 6e 61 6d 65 29 0a 20 20 20 20 20 20 20 28 6c 65  name).       (le
b330: 74 2a 20 28 28 74 65 73 74 2d 70 61 74 68 20 20  t* ((test-path  
b340: 20 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68    (conc *toppath
b350: 2a 20 22 2f 74 65 73 74 73 2f 22 20 74 65 73 74  * "/tests/" test
b360: 2d 6e 61 6d 65 29 29 0a 09 20 20 20 20 20 20 28  -name))..      (
b370: 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 28 63 6f  test-configf (co
b380: 6e 63 20 74 65 73 74 2d 70 61 74 68 20 22 2f 74  nc test-path "/t
b390: 65 73 74 63 6f 6e 66 69 67 22 29 29 0a 09 20 20  estconfig"))..  
b3a0: 20 20 20 20 28 74 65 73 74 65 78 69 73 74 73 20      (testexists 
b3b0: 20 20 28 61 6e 64 20 28 66 69 6c 65 2d 65 78 69    (and (file-exi
b3c0: 73 74 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67  sts? test-config
b3d0: 66 29 28 66 69 6c 65 2d 72 65 61 64 2d 61 63 63  f)(file-read-acc
b3e0: 65 73 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67  ess? test-config
b3f0: 66 29 29 29 0a 09 20 20 20 20 20 20 3b 3b 20 72  f)))..      ;; r
b400: 65 61 64 20 63 6f 6e 66 69 67 73 20 77 69 74 68  ead configs with
b410: 20 74 72 69 63 6b 73 20 74 75 72 6e 65 64 20 6f   tricks turned o
b420: 66 66 20 28 69 2e 65 2e 20 6e 6f 20 73 79 73 74  ff (i.e. no syst
b430: 65 6d 29 0a 09 20 20 20 20 20 20 28 74 65 73 74  em)..      (test
b440: 2d 63 6f 6e 66 20 20 20 20 28 69 66 20 74 65 73  -conf    (if tes
b450: 74 65 78 69 73 74 73 20 28 72 65 61 64 2d 63 6f  texists (read-co
b460: 6e 66 69 67 20 74 65 73 74 2d 63 6f 6e 66 69 67  nfig test-config
b470: 66 20 23 66 20 23 66 29 28 6d 61 6b 65 2d 68 61  f #f #f)(make-ha
b480: 73 68 2d 74 61 62 6c 65 29 29 29 29 0a 09 20 3b  sh-table)))).. ;
b490: 3b 20 75 73 65 20 74 68 65 20 6f 70 65 6e 2d 72  ; use the open-r
b4a0: 75 6e 2d 63 6c 6f 73 65 20 69 6e 73 74 65 61 64  un-close instead
b4b0: 20 6f 66 20 70 61 73 73 69 6e 67 20 69 6e 20 64   of passing in d
b4c0: 62 0a 09 20 28 72 75 6e 73 3a 75 70 64 61 74 65  b.. (runs:update
b4d0: 2d 74 65 73 74 5f 6d 65 74 61 20 23 66 20 74 65  -test_meta #f te
b4e0: 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e  st-name test-con
b4f0: 66 29 29 29 0a 20 20 20 20 20 74 65 73 74 2d 6e  f))).     test-n
b500: 61 6d 65 73 29 29 29 0a 0a 3b 3b 20 54 68 69 73  ames)))..;; This
b510: 20 63 6f 75 6c 64 20 70 72 6f 62 61 62 6c 79 20   could probably 
b520: 62 65 20 72 65 66 61 63 74 6f 72 65 64 20 69 6e  be refactored in
b530: 74 6f 20 6f 6e 65 20 63 6f 6d 70 6c 65 78 20 71  to one complex q
b540: 75 65 72 79 20 2e 2e 2e 0a 28 64 65 66 69 6e 65  uery ....(define
b550: 20 28 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75   (runs:rollup-ru
b560: 6e 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74  n keys keyvallst
b570: 20 72 75 6e 6e 61 6d 65 20 75 73 65 72 29 20 3b   runname user) ;
b580: 3b 20 77 61 73 20 74 61 72 67 65 74 2c 20 6e 6f  ; was target, no
b590: 77 20 6b 65 79 76 61 6c 6c 73 74 0a 20 20 28 64  w keyvallst.  (d
b5a0: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 72 75  ebug:print 4 "ru
b5b0: 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 2c 20 6b  ns:rollup-run, k
b5c0: 65 79 73 3a 20 22 20 6b 65 79 73 20 22 20 6b 65  eys: " keys " ke
b5d0: 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61  yvallst: " keyva
b5e0: 6c 6c 73 74 20 22 20 3a 72 75 6e 6e 61 6d 65 20  llst " :runname 
b5f0: 22 20 72 75 6e 6e 61 6d 65 20 22 20 75 73 65 72  " runname " user
b600: 3a 20 22 20 75 73 65 72 29 0a 20 20 28 6c 65 74  : " user).  (let
b610: 2a 20 28 28 64 62 20 20 20 20 20 20 20 20 20 20  * ((db          
b620: 20 20 20 20 23 66 29 20 3b 3b 20 28 6b 65 79 76      #f) ;; (keyv
b630: 61 6c 6c 6c 73 74 20 20 20 20 20 20 28 6b 65 79  alllst      (key
b640: 73 3a 74 61 72 67 65 74 2d 3e 6b 65 79 76 61 6c  s:target->keyval
b650: 20 6b 65 79 73 20 74 61 72 67 65 74 29 29 0a 09   keys target))..
b660: 20 28 6e 65 77 2d 72 75 6e 2d 69 64 20 20 20 20   (new-run-id    
b670: 20 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75    (cdb:remote-ru
b680: 6e 20 64 62 3a 72 65 67 69 73 74 65 72 2d 72 75  n db:register-ru
b690: 6e 20 23 66 20 6b 65 79 73 20 6b 65 79 76 61 6c  n #f keys keyval
b6a0: 6c 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e 65 77  lst runname "new
b6b0: 22 20 22 6e 2f 61 22 20 75 73 65 72 29 29 0a 09  " "n/a" user))..
b6c0: 20 28 70 72 65 76 2d 74 65 73 74 73 20 20 20 20   (prev-tests    
b6d0: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73    (open-run-clos
b6e0: 65 20 74 65 73 74 3a 67 65 74 2d 6d 61 74 63 68  e test:get-match
b6f0: 69 6e 67 2d 70 72 65 76 69 6f 75 73 2d 74 65 73  ing-previous-tes
b700: 74 2d 72 75 6e 2d 72 65 63 6f 72 64 73 20 64 62  t-run-records db
b710: 20 6e 65 77 2d 72 75 6e 2d 69 64 20 22 25 22 20   new-run-id "%" 
b720: 22 25 22 29 29 0a 09 20 28 63 75 72 72 2d 74 65  "%")).. (curr-te
b730: 73 74 73 20 20 20 20 20 20 28 6f 70 65 6e 2d 72  sts      (open-r
b740: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d  un-close db:get-
b750: 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62  tests-for-run db
b760: 20 6e 65 77 2d 72 75 6e 2d 69 64 20 22 25 2f 25   new-run-id "%/%
b770: 22 20 27 28 29 20 27 28 29 29 29 0a 09 20 28 63  " '() '())).. (c
b780: 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 28  urr-tests-hash (
b790: 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29  make-hash-table)
b7a0: 29 29 0a 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e  )).    (open-run
b7b0: 2d 63 6c 6f 73 65 20 64 62 3a 75 70 64 61 74 65  -close db:update
b7c0: 2d 72 75 6e 2d 65 76 65 6e 74 5f 74 69 6d 65 20  -run-event_time 
b7d0: 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 29 0a 20  db new-run-id). 
b7e0: 20 20 20 3b 3b 20 69 6e 64 65 78 20 74 68 65 20     ;; index the 
b7f0: 61 6c 72 65 61 64 79 20 73 61 76 65 64 20 74 65  already saved te
b800: 73 74 73 20 62 79 20 74 65 73 74 6e 61 6d 65 20  sts by testname 
b810: 61 6e 64 20 69 74 65 6d 64 61 74 20 69 6e 20 63  and itemdat in c
b820: 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 0a 20  urr-tests-hash. 
b830: 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 20     (for-each.   
b840: 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 64    (lambda (testd
b850: 61 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a  at).       (let*
b860: 20 28 28 74 65 73 74 6e 61 6d 65 20 20 28 64 62   ((testname  (db
b870: 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61  :test-get-testna
b880: 6d 65 20 74 65 73 74 64 61 74 29 29 0a 09 20 20  me testdat))..  
b890: 20 20 20 20 28 69 74 65 6d 2d 70 61 74 68 20 28      (item-path (
b8a0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d  db:test-get-item
b8b0: 2d 70 61 74 68 20 74 65 73 74 64 61 74 29 29 0a  -path testdat)).
b8c0: 09 20 20 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d  .      (full-nam
b8d0: 65 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65  e (conc testname
b8e0: 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29   "/" item-path))
b8f0: 29 0a 09 20 28 68 61 73 68 2d 74 61 62 6c 65 2d  ).. (hash-table-
b900: 73 65 74 21 20 63 75 72 72 2d 74 65 73 74 73 2d  set! curr-tests-
b910: 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 74  hash full-name t
b920: 65 73 74 64 61 74 29 29 29 0a 20 20 20 20 20 63  estdat))).     c
b930: 75 72 72 2d 74 65 73 74 73 29 0a 20 20 20 20 3b  urr-tests).    ;
b940: 3b 20 4e 4f 50 45 3a 20 4e 6f 6e 2d 6f 70 74 69  ; NOPE: Non-opti
b950: 6d 61 6c 20 61 70 70 72 6f 61 63 68 2e 20 54 72  mal approach. Tr
b960: 79 20 74 68 69 73 20 69 6e 73 74 65 61 64 2e 0a  y this instead..
b970: 20 20 20 20 3b 3b 20 20 20 31 2e 20 74 65 73 74      ;;   1. test
b980: 73 20 61 72 65 20 72 65 63 65 69 76 65 64 20 69  s are received i
b990: 6e 20 61 20 6c 69 73 74 2c 20 6d 6f 73 74 20 72  n a list, most r
b9a0: 65 63 65 6e 74 20 66 69 72 73 74 0a 20 20 20 20  ecent first.    
b9b0: 3b 3b 20 20 20 32 2e 20 72 65 70 6c 61 63 65 20  ;;   2. replace 
b9c0: 74 68 65 20 72 6f 6c 6c 75 70 20 74 65 73 74 20  the rollup test 
b9d0: 77 69 74 68 20 74 68 65 20 6e 65 77 20 2a 61 6c  with the new *al
b9e0: 77 61 79 73 2a 0a 20 20 20 20 28 66 6f 72 2d 65  ways*.    (for-e
b9f0: 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64  ach .     (lambd
ba00: 61 20 28 74 65 73 74 64 61 74 29 0a 20 20 20 20  a (testdat).    
ba10: 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 6e     (let* ((testn
ba20: 61 6d 65 20 20 28 64 62 3a 74 65 73 74 2d 67 65  ame  (db:test-ge
ba30: 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 64  t-testname testd
ba40: 61 74 29 29 0a 09 20 20 20 20 20 20 28 69 74 65  at))..      (ite
ba50: 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d  m-path (db:test-
ba60: 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65  get-item-path te
ba70: 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28  stdat))..      (
ba80: 66 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20  full-name (conc 
ba90: 74 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65  testname "/" ite
baa0: 6d 2d 70 61 74 68 29 29 0a 09 20 20 20 20 20 20  m-path))..      
bab0: 28 70 72 65 76 2d 74 65 73 74 2d 64 61 74 20 28  (prev-test-dat (
bac0: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64  hash-table-ref/d
bad0: 65 66 61 75 6c 74 20 63 75 72 72 2d 74 65 73 74  efault curr-test
bae0: 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65  s-hash full-name
baf0: 20 23 66 29 29 0a 09 20 20 20 20 20 20 28 74 65   #f))..      (te
bb00: 73 74 2d 73 74 65 70 73 20 20 20 20 20 20 28 6f  st-steps      (o
bb10: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62  pen-run-close db
bb20: 3a 67 65 74 2d 73 74 65 70 73 2d 66 6f 72 2d 74  :get-steps-for-t
bb30: 65 73 74 20 64 62 20 28 64 62 3a 74 65 73 74 2d  est db (db:test-
bb40: 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 29  get-id testdat))
bb50: 29 0a 09 20 20 20 20 20 20 28 6e 65 77 2d 74 65  )..      (new-te
bb60: 73 74 2d 72 65 63 6f 72 64 20 23 66 29 29 0a 09  st-record #f))..
bb70: 20 3b 3b 20 72 65 70 6c 61 63 65 20 74 68 65 73   ;; replace thes
bb80: 65 20 77 69 74 68 20 69 6e 73 65 72 74 20 2e 2e  e with insert ..
bb90: 2e 20 73 65 6c 65 63 74 0a 09 20 28 61 70 70 6c  . select.. (appl
bba0: 79 20 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74  y sqlite3:execut
bbb0: 65 20 0a 09 09 64 62 20 0a 09 09 28 63 6f 6e 63  e ...db ...(conc
bbc0: 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c   "INSERT OR REPL
bbd0: 41 43 45 20 49 4e 54 4f 20 74 65 73 74 73 20 28  ACE INTO tests (
bbe0: 72 75 6e 5f 69 64 2c 74 65 73 74 6e 61 6d 65 2c  run_id,testname,
bbf0: 73 74 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65  state,status,eve
bc00: 6e 74 5f 74 69 6d 65 2c 68 6f 73 74 2c 63 70 75  nt_time,host,cpu
bc10: 6c 6f 61 64 2c 64 69 73 6b 66 72 65 65 2c 75 6e  load,diskfree,un
bc20: 61 6d 65 2c 72 75 6e 64 69 72 2c 69 74 65 6d 5f  ame,rundir,item_
bc30: 70 61 74 68 2c 72 75 6e 5f 64 75 72 61 74 69 6f  path,run_duratio
bc40: 6e 2c 66 69 6e 61 6c 5f 6c 6f 67 66 2c 63 6f 6d  n,final_logf,com
bc50: 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 20 20 20  ment) "...      
bc60: 22 56 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f  "VALUES (?,?,?,?
bc70: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f  ,?,?,?,?,?,?,?,?
bc80: 2c 3f 2c 3f 29 3b 22 29 0a 09 09 6e 65 77 2d 72  ,?,?);")...new-r
bc90: 75 6e 2d 69 64 20 28 63 64 64 72 20 28 76 65 63  un-id (cddr (vec
bca0: 74 6f 72 2d 3e 6c 69 73 74 20 74 65 73 74 64 61  tor->list testda
bcb0: 74 29 29 29 0a 09 20 28 73 65 74 21 20 6e 65 77  t))).. (set! new
bcc0: 2d 74 65 73 74 64 61 74 20 28 63 61 72 20 28 6f  -testdat (car (o
bcd0: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62  pen-run-close db
bce0: 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72  :get-tests-for-r
bcf0: 75 6e 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64  un db new-run-id
bd00: 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20   (conc testname 
bd10: 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 20 27  "/" item-path) '
bd20: 28 29 20 27 28 29 29 29 29 0a 09 20 28 68 61 73  () '()))).. (has
bd30: 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72  h-table-set! cur
bd40: 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c  r-tests-hash ful
bd50: 6c 2d 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74 64  l-name new-testd
bd60: 61 74 29 20 3b 3b 20 74 68 69 73 20 63 6f 75 6c  at) ;; this coul
bd70: 64 20 62 65 20 63 6f 6e 66 75 73 69 6e 67 2c 20  d be confusing, 
bd80: 77 68 69 63 68 20 72 65 63 6f 72 64 20 73 68 6f  which record sho
bd90: 75 6c 64 20 67 6f 20 69 6e 74 6f 20 74 68 65 20  uld go into the 
bda0: 6c 6f 6f 6b 75 70 20 74 61 62 6c 65 3f 0a 09 20  lookup table?.. 
bdb0: 3b 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65  ;; Now duplicate
bdc0: 20 74 68 65 20 74 65 73 74 20 73 74 65 70 73 0a   the test steps.
bdd0: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34  . (debug:print 4
bde0: 20 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64   "Copying record
bdf0: 73 20 69 6e 20 74 65 73 74 5f 73 74 65 70 73 20  s in test_steps 
be00: 66 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28  from test_id=" (
be10: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74  db:test-get-id t
be20: 65 73 74 64 61 74 29 20 22 20 74 6f 20 22 20 28  estdat) " to " (
be30: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e  db:test-get-id n
be40: 65 77 2d 74 65 73 74 64 61 74 29 29 0a 09 20 28  ew-testdat)).. (
be50: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 0a  open-run-close .
be60: 09 20 20 28 6c 61 6d 62 64 61 20 28 29 0a 09 20  .  (lambda ().. 
be70: 20 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63     (sqlite3:exec
be80: 75 74 65 20 0a 09 20 20 20 20 20 64 62 20 0a 09  ute ..     db ..
be90: 20 20 20 20 20 28 63 6f 6e 63 20 22 49 4e 53 45       (conc "INSE
bea0: 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e  RT OR REPLACE IN
beb0: 54 4f 20 74 65 73 74 5f 73 74 65 70 73 20 28 74  TO test_steps (t
bec0: 65 73 74 5f 69 64 2c 73 74 65 70 6e 61 6d 65 2c  est_id,stepname,
bed0: 73 74 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65  state,status,eve
bee0: 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 29  nt_time,comment)
bef0: 20 22 0a 09 09 20 20 20 22 53 45 4c 45 43 54 20   "...   "SELECT 
bf00: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  " (db:test-get-i
bf10: 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20 22  d new-testdat) "
bf20: 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 74 65 2c  ,stepname,state,
bf30: 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d  status,event_tim
bf40: 65 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 74  e,comment FROM t
bf50: 65 73 74 5f 73 74 65 70 73 20 57 48 45 52 45 20  est_steps WHERE 
bf60: 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20  test_id=?;")..  
bf70: 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d     (db:test-get-
bf80: 69 64 20 74 65 73 74 64 61 74 29 29 0a 09 20 20  id testdat))..  
bf90: 20 20 3b 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61    ;; Now duplica
bfa0: 74 65 20 74 68 65 20 74 65 73 74 20 64 61 74 61  te the test data
bfb0: 0a 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ..    (debug:pri
bfc0: 6e 74 20 34 20 22 43 6f 70 79 69 6e 67 20 72 65  nt 4 "Copying re
bfd0: 63 6f 72 64 73 20 69 6e 20 74 65 73 74 5f 64 61  cords in test_da
bfe0: 74 61 20 66 72 6f 6d 20 74 65 73 74 5f 69 64 3d  ta from test_id=
bff0: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  " (db:test-get-i
c000: 64 20 74 65 73 74 64 61 74 29 20 22 20 74 6f 20  d testdat) " to 
c010: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  " (db:test-get-i
c020: 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 29 0a  d new-testdat)).
c030: 09 20 20 20 20 28 73 71 6c 69 74 65 33 3a 65 78  .    (sqlite3:ex
c040: 65 63 75 74 65 20 0a 09 20 20 20 20 20 64 62 20  ecute ..     db 
c050: 0a 09 20 20 20 20 20 28 63 6f 6e 63 20 22 49 4e  ..     (conc "IN
c060: 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20  SERT OR REPLACE 
c070: 49 4e 54 4f 20 74 65 73 74 5f 64 61 74 61 20 28  INTO test_data (
c080: 74 65 73 74 5f 69 64 2c 63 61 74 65 67 6f 72 79  test_id,category
c090: 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c  ,variable,value,
c0a0: 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69  expected,tol,uni
c0b0: 74 73 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09  ts,comment) "...
c0c0: 20 20 20 22 53 45 4c 45 43 54 20 22 20 28 64 62     "SELECT " (db
c0d0: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77  :test-get-id new
c0e0: 2d 74 65 73 74 64 61 74 29 20 22 2c 63 61 74 65  -testdat) ",cate
c0f0: 67 6f 72 79 2c 76 61 72 69 61 62 6c 65 2c 76 61  gory,variable,va
c100: 6c 75 65 2c 65 78 70 65 63 74 65 64 2c 74 6f 6c  lue,expected,tol
c110: 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65 6e 74 20 46  ,units,comment F
c120: 52 4f 4d 20 74 65 73 74 5f 64 61 74 61 20 57 48  ROM test_data WH
c130: 45 52 45 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29  ERE test_id=?;")
c140: 0a 09 20 20 20 20 20 28 64 62 3a 74 65 73 74 2d  ..     (db:test-
c150: 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 29  get-id testdat))
c160: 29 29 0a 09 20 29 29 0a 20 20 20 20 20 70 72 65  )).. )).     pre
c170: 76 2d 74 65 73 74 73 29 29 29 0a 09 20 0a 20 20  v-tests))).. .  
c180: 20 20 20 0a                                         .