Megatest

Hex Artifact Content
Login

Artifact bcbe9d3015b55bd274d7a48e5a1e67e86e763950:


0000: 0a 3b 3b 20 43 6f 70 79 72 69 67 68 74 20 32 30  .;; Copyright 20
0010: 30 36 2d 32 30 31 32 2c 20 4d 61 74 74 68 65 77  06-2012, Matthew
0020: 20 57 65 6c 6c 61 6e 64 2e 0a 3b 3b 20 0a 3b 3b   Welland..;; .;;
0030: 20 20 54 68 69 73 20 70 72 6f 67 72 61 6d 20 69    This program i
0040: 73 20 6d 61 64 65 20 61 76 61 69 6c 61 62 6c 65  s made available
0050: 20 75 6e 64 65 72 20 74 68 65 20 47 4e 55 20 47   under the GNU G
0060: 50 4c 20 76 65 72 73 69 6f 6e 20 32 2e 30 20 6f  PL version 2.0 o
0070: 72 0a 3b 3b 20 20 67 72 65 61 74 65 72 2e 20 53  r.;;  greater. S
0080: 65 65 20 74 68 65 20 61 63 63 6f 6d 70 61 6e 79  ee the accompany
0090: 69 6e 67 20 66 69 6c 65 20 43 4f 50 59 49 4e 47  ing file COPYING
00a0: 20 66 6f 72 20 64 65 74 61 69 6c 73 2e 0a 3b 3b   for details..;;
00b0: 20 0a 3b 3b 20 20 54 68 69 73 20 70 72 6f 67 72   .;;  This progr
00c0: 61 6d 20 69 73 20 64 69 73 74 72 69 62 75 74 65  am is distribute
00d0: 64 20 57 49 54 48 4f 55 54 20 41 4e 59 20 57 41  d WITHOUT ANY WA
00e0: 52 52 41 4e 54 59 3b 20 77 69 74 68 6f 75 74 20  RRANTY; without 
00f0: 65 76 65 6e 20 74 68 65 0a 3b 3b 20 20 69 6d 70  even the.;;  imp
0100: 6c 69 65 64 20 77 61 72 72 61 6e 74 79 20 6f 66  lied warranty of
0110: 20 4d 45 52 43 48 41 4e 54 41 42 49 4c 49 54 59   MERCHANTABILITY
0120: 20 6f 72 20 46 49 54 4e 45 53 53 20 46 4f 52 20   or FITNESS FOR 
0130: 41 20 50 41 52 54 49 43 55 4c 41 52 0a 3b 3b 20  A PARTICULAR.;; 
0140: 20 50 55 52 50 4f 53 45 2e 0a 0a 3b 3b 20 20 73   PURPOSE...;;  s
0150: 74 72 66 74 69 6d 65 28 27 25 6d 2f 25 64 2f 25  trftime('%m/%d/%
0160: 59 20 25 48 3a 25 4d 3a 25 53 27 2c 27 6e 6f 77  Y %H:%M:%S','now
0170: 27 2c 27 6c 6f 63 61 6c 74 69 6d 65 27 29 0a 0a  ','localtime')..
0180: 28 75 73 65 20 73 71 6c 69 74 65 33 20 73 72 66  (use sqlite3 srf
0190: 69 2d 31 20 70 6f 73 69 78 20 72 65 67 65 78 20  i-1 posix regex 
01a0: 72 65 67 65 78 2d 63 61 73 65 20 73 72 66 69 2d  regex-case srfi-
01b0: 36 39 20 64 6f 74 2d 6c 6f 63 6b 69 6e 67 20 28  69 dot-locking (
01c0: 73 72 66 69 20 31 38 29 20 70 6f 73 69 78 2d 65  srfi 18) posix-e
01d0: 78 74 72 61 73 20 64 69 72 65 63 74 6f 72 79 2d  xtras directory-
01e0: 75 74 69 6c 73 29 0a 28 69 6d 70 6f 72 74 20 28  utils).(import (
01f0: 70 72 65 66 69 78 20 73 71 6c 69 74 65 33 20 73  prefix sqlite3 s
0200: 71 6c 69 74 65 33 3a 29 29 0a 0a 28 64 65 63 6c  qlite3:))..(decl
0210: 61 72 65 20 28 75 6e 69 74 20 72 75 6e 73 29 29  are (unit runs))
0220: 0a 28 64 65 63 6c 61 72 65 20 28 75 73 65 73 20  .(declare (uses 
0230: 64 62 29 29 0a 28 64 65 63 6c 61 72 65 20 28 75  db)).(declare (u
0240: 73 65 73 20 63 6f 6d 6d 6f 6e 29 29 0a 28 64 65  ses common)).(de
0250: 63 6c 61 72 65 20 28 75 73 65 73 20 69 74 65 6d  clare (uses item
0260: 73 29 29 0a 28 64 65 63 6c 61 72 65 20 28 75 73  s)).(declare (us
0270: 65 73 20 72 75 6e 63 6f 6e 66 69 67 29 29 0a 28  es runconfig)).(
0280: 64 65 63 6c 61 72 65 20 28 75 73 65 73 20 74 65  declare (uses te
0290: 73 74 73 29 29 0a 28 64 65 63 6c 61 72 65 20 28  sts)).(declare (
02a0: 75 73 65 73 20 73 65 72 76 65 72 29 29 0a 0a 28  uses server))..(
02b0: 69 6e 63 6c 75 64 65 20 22 63 6f 6d 6d 6f 6e 5f  include "common_
02c0: 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 0a 28 69  records.scm").(i
02d0: 6e 63 6c 75 64 65 20 22 6b 65 79 5f 72 65 63 6f  nclude "key_reco
02e0: 72 64 73 2e 73 63 6d 22 29 0a 28 69 6e 63 6c 75  rds.scm").(inclu
02f0: 64 65 20 22 64 62 5f 72 65 63 6f 72 64 73 2e 73  de "db_records.s
0300: 63 6d 22 29 0a 28 69 6e 63 6c 75 64 65 20 22 72  cm").(include "r
0310: 75 6e 5f 72 65 63 6f 72 64 73 2e 73 63 6d 22 29  un_records.scm")
0320: 0a 28 69 6e 63 6c 75 64 65 20 22 74 65 73 74 5f  .(include "test_
0330: 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 0a 0a 3b  records.scm")..;
0340: 3b 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d  ; runs:get-runs-
0350: 62 79 2d 70 61 74 74 0a 3b 3b 20 67 65 74 20 72  by-patt.;; get r
0360: 75 6e 73 20 62 79 20 6c 69 73 74 20 6f 66 20 63  uns by list of c
0370: 72 69 74 65 72 69 61 0a 3b 3b 20 72 65 67 69 73  riteria.;; regis
0380: 74 65 72 20 61 20 74 65 73 74 20 72 75 6e 20 77  ter a test run w
0390: 69 74 68 20 74 68 65 20 64 62 0a 3b 3b 0a 3b 3b  ith the db.;;.;;
03a0: 20 55 73 65 3a 20 28 64 62 2d 67 65 74 2d 76 61   Use: (db-get-va
03b0: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 28 64  lue-by-header (d
03c0: 62 3a 67 65 74 2d 68 65 61 64 65 72 20 72 75 6e  b:get-header run
03d0: 69 6e 66 6f 29 28 64 62 3a 67 65 74 2d 72 6f 77  info)(db:get-row
03e0: 20 72 75 6e 69 6e 66 6f 29 29 0a 3b 3b 20 20 74   runinfo)).;;  t
03f0: 6f 20 65 78 74 72 61 63 74 20 69 6e 66 6f 20 66  o extract info f
0400: 72 6f 6d 20 74 68 65 20 73 74 72 75 63 74 75 72  rom the structur
0410: 65 20 72 65 74 75 72 6e 65 64 0a 3b 3b 0a 28 64  e returned.;;.(d
0420: 65 66 69 6e 65 20 28 72 75 6e 73 3a 67 65 74 2d  efine (runs:get-
0430: 72 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20  runs-by-patt db 
0440: 6b 65 79 73 20 72 75 6e 6e 61 6d 65 70 61 74 74  keys runnamepatt
0450: 29 20 3b 3b 20 74 65 73 74 2d 6e 61 6d 65 29 0a  ) ;; test-name).
0460: 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 76 61 6c    (let* ((keyval
0470: 6c 73 74 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69  lst (keys->valli
0480: 73 74 20 6b 65 79 73 29 29 0a 09 20 28 74 6d 70  st keys)).. (tmp
0490: 20 20 20 20 20 20 28 72 75 6e 73 3a 67 65 74 2d        (runs:get-
04a0: 73 74 64 2d 72 75 6e 2d 66 69 65 6c 64 73 20 6b  std-run-fields k
04b0: 65 79 73 20 27 28 22 69 64 22 20 22 72 75 6e 6e  eys '("id" "runn
04c0: 61 6d 65 22 20 22 73 74 61 74 65 22 20 22 73 74  ame" "state" "st
04d0: 61 74 75 73 22 20 22 6f 77 6e 65 72 22 20 22 65  atus" "owner" "e
04e0: 76 65 6e 74 5f 74 69 6d 65 22 29 29 29 0a 09 20  vent_time"))).. 
04f0: 28 6b 65 79 73 74 72 20 20 20 28 63 61 72 20 74  (keystr   (car t
0500: 6d 70 29 29 0a 09 20 28 68 65 61 64 65 72 20 20  mp)).. (header  
0510: 20 28 63 61 64 72 20 74 6d 70 29 29 0a 09 20 28   (cadr tmp)).. (
0520: 72 65 73 20 20 20 20 20 27 28 29 29 0a 09 20 28  res     '()).. (
0530: 6b 65 79 2d 70 61 74 74 20 22 22 29 0a 09 20 28  key-patt "").. (
0540: 72 75 6e 77 69 6c 64 74 79 70 65 20 28 69 66 20  runwildtype (if 
0550: 28 73 75 62 73 74 72 69 6e 67 2d 69 6e 64 65 78  (substring-index
0560: 20 22 25 22 20 72 75 6e 6e 61 6d 65 70 61 74 74   "%" runnamepatt
0570: 29 20 22 6c 69 6b 65 22 20 22 67 6c 6f 62 22 29  ) "like" "glob")
0580: 29 0a 09 20 28 71 72 79 2d 73 74 72 20 20 23 66  ).. (qry-str  #f
0590: 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68  )).    (for-each
05a0: 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 76 61 6c   (lambda (keyval
05b0: 29 0a 09 09 28 6c 65 74 2a 20 28 28 6b 65 79 20  )...(let* ((key 
05c0: 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 6b     (vector-ref k
05d0: 65 79 76 61 6c 20 30 29 29 0a 09 09 20 20 20 20  eyval 0))...    
05e0: 20 20 20 28 66 75 6c 6b 65 79 20 28 63 6f 6e 63     (fulkey (conc
05f0: 20 22 3a 22 20 6b 65 79 29 29 0a 09 09 20 20 20   ":" key))...   
0600: 20 20 20 20 28 70 61 74 74 20 20 20 28 61 72 67      (patt   (arg
0610: 73 3a 67 65 74 2d 61 72 67 20 66 75 6c 6b 65 79  s:get-arg fulkey
0620: 29 29 0a 09 09 20 20 20 20 20 20 20 28 77 69 6c  ))...       (wil
0630: 64 74 79 70 65 20 28 69 66 20 28 73 75 62 73 74  dtype (if (subst
0640: 72 69 6e 67 2d 69 6e 64 65 78 20 22 25 22 20 70  ring-index "%" p
0650: 61 74 74 29 20 22 6c 69 6b 65 22 20 22 67 6c 6f  att) "like" "glo
0660: 62 22 29 29 29 0a 09 09 20 20 28 69 66 20 70 61  b")))...  (if pa
0670: 74 74 0a 09 09 20 20 20 20 20 20 28 73 65 74 21  tt...      (set!
0680: 20 6b 65 79 2d 70 61 74 74 20 28 63 6f 6e 63 20   key-patt (conc 
0690: 6b 65 79 2d 70 61 74 74 20 22 20 41 4e 44 20 22  key-patt " AND "
06a0: 20 6b 65 79 20 22 20 22 20 77 69 6c 64 74 79 70   key " " wildtyp
06b0: 65 20 22 20 27 22 20 70 61 74 74 20 22 27 22 29  e " '" patt "'")
06c0: 29 0a 09 09 20 20 20 20 20 20 28 62 65 67 69 6e  )...      (begin
06d0: 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74  ....(debug:print
06e0: 20 30 20 22 45 52 52 4f 52 3a 20 73 65 61 72 63   0 "ERROR: searc
06f0: 68 69 6e 67 20 66 6f 72 20 72 75 6e 73 20 77 69  hing for runs wi
0700: 74 68 20 6e 6f 20 70 61 74 74 65 72 6e 20 73 65  th no pattern se
0710: 74 20 66 6f 72 20 22 20 66 75 6c 6b 65 79 29 0a  t for " fulkey).
0720: 09 09 09 28 65 78 69 74 20 36 29 29 29 29 29 0a  ...(exit 6))))).
0730: 09 20 20 20 20 20 20 6b 65 79 73 29 0a 20 20 20  .      keys).   
0740: 20 28 73 65 74 21 20 71 72 79 2d 73 74 72 20 28   (set! qry-str (
0750: 63 6f 6e 63 20 22 53 45 4c 45 43 54 20 22 20 6b  conc "SELECT " k
0760: 65 79 73 74 72 20 22 20 46 52 4f 4d 20 72 75 6e  eystr " FROM run
0770: 73 20 57 48 45 52 45 20 72 75 6e 6e 61 6d 65 20  s WHERE runname 
0780: 22 20 72 75 6e 77 69 6c 64 74 79 70 65 20 22 20  " runwildtype " 
0790: 3f 20 22 20 6b 65 79 2d 70 61 74 74 20 22 3b 22  ? " key-patt ";"
07a0: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72  )).    (debug:pr
07b0: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 72 75 6e 73  int-info 4 "runs
07c0: 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74  :get-runs-by-pat
07d0: 74 20 71 72 79 3d 22 20 71 72 79 2d 73 74 72 20  t qry=" qry-str 
07e0: 22 20 22 20 72 75 6e 6e 61 6d 65 70 61 74 74 29  " " runnamepatt)
07f0: 0a 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66 6f  .    (sqlite3:fo
0800: 72 2d 65 61 63 68 2d 72 6f 77 20 0a 20 20 20 20  r-each-row .    
0810: 20 28 6c 61 6d 62 64 61 20 28 61 20 2e 20 72 29   (lambda (a . r)
0820: 0a 20 20 20 20 20 20 20 28 73 65 74 21 20 72 65  .       (set! re
0830: 73 20 28 63 6f 6e 73 20 28 6c 69 73 74 2d 3e 76  s (cons (list->v
0840: 65 63 74 6f 72 20 28 63 6f 6e 73 20 61 20 72 29  ector (cons a r)
0850: 29 20 72 65 73 29 29 29 0a 20 20 20 20 20 64 62  ) res))).     db
0860: 20 0a 20 20 20 20 20 71 72 79 2d 73 74 72 0a 20   .     qry-str. 
0870: 20 20 20 20 72 75 6e 6e 61 6d 65 70 61 74 74 29      runnamepatt)
0880: 0a 20 20 20 20 28 76 65 63 74 6f 72 20 68 65 61  .    (vector hea
0890: 64 65 72 20 72 65 73 29 29 29 0a 0a 28 64 65 66  der res)))..(def
08a0: 69 6e 65 20 28 72 75 6e 73 3a 74 65 73 74 2d 67  ine (runs:test-g
08b0: 65 74 2d 66 75 6c 6c 2d 70 61 74 68 20 74 65 73  et-full-path tes
08c0: 74 29 0a 20 20 28 6c 65 74 2a 20 28 28 74 65 73  t).  (let* ((tes
08d0: 74 6e 61 6d 65 20 28 64 62 3a 74 65 73 74 2d 67  tname (db:test-g
08e0: 65 74 2d 74 65 73 74 6e 61 6d 65 20 20 20 74 65  et-testname   te
08f0: 73 74 29 29 0a 09 20 28 69 74 65 6d 70 61 74 68  st)).. (itempath
0900: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74   (db:test-get-it
0910: 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29 29 0a  em-path test))).
0920: 20 20 20 20 28 63 6f 6e 63 20 74 65 73 74 6e 61      (conc testna
0930: 6d 65 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69  me (if (equal? i
0940: 74 65 6d 70 61 74 68 20 22 22 29 20 22 22 20 28  tempath "") "" (
0950: 63 6f 6e 63 20 22 28 22 20 69 74 65 6d 70 61 74  conc "(" itempat
0960: 68 20 22 29 22 29 29 29 29 29 0a 0a 28 64 65 66  h ")")))))..(def
0970: 69 6e 65 20 28 64 62 3a 67 65 74 2d 72 75 6e 2d  ine (db:get-run-
0980: 6b 65 79 2d 76 61 6c 20 64 62 20 72 75 6e 2d 69  key-val db run-i
0990: 64 20 6b 65 79 29 0a 20 20 28 6c 65 74 20 28 28  d key).  (let ((
09a0: 72 65 73 20 23 66 29 29 0a 20 20 20 20 28 73 71  res #f)).    (sq
09b0: 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72  lite3:for-each-r
09c0: 6f 77 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20  ow.     (lambda 
09d0: 28 76 61 6c 29 0a 20 20 20 20 20 20 20 28 73 65  (val).       (se
09e0: 74 21 20 72 65 73 20 76 61 6c 29 29 0a 20 20 20  t! res val)).   
09f0: 20 20 64 62 20 0a 20 20 20 20 20 28 63 6f 6e 63    db .     (conc
0a00: 20 22 53 45 4c 45 43 54 20 22 20 28 6b 65 79 3a   "SELECT " (key:
0a10: 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65  get-fieldname ke
0a20: 79 29 20 22 20 46 52 4f 4d 20 72 75 6e 73 20 57  y) " FROM runs W
0a30: 48 45 52 45 20 69 64 3d 3f 3b 22 29 0a 20 20 20  HERE id=?;").   
0a40: 20 20 72 75 6e 2d 69 64 29 0a 20 20 20 20 72 65    run-id).    re
0a50: 73 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 64 62  s))..(define (db
0a60: 3a 67 65 74 2d 72 75 6e 2d 6e 61 6d 65 2d 66 72  :get-run-name-fr
0a70: 6f 6d 2d 69 64 20 64 62 20 72 75 6e 2d 69 64 29  om-id db run-id)
0a80: 0a 20 20 28 6c 65 74 20 28 28 72 65 73 20 23 66  .  (let ((res #f
0a90: 29 29 0a 20 20 20 20 28 73 71 6c 69 74 65 33 3a  )).    (sqlite3:
0aa0: 66 6f 72 2d 65 61 63 68 2d 72 6f 77 0a 20 20 20  for-each-row.   
0ab0: 20 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 6e 61    (lambda (runna
0ac0: 6d 65 29 0a 20 20 20 20 20 20 20 28 73 65 74 21  me).       (set!
0ad0: 20 72 65 73 20 72 75 6e 6e 61 6d 65 29 29 0a 20   res runname)). 
0ae0: 20 20 20 20 64 62 0a 20 20 20 20 20 22 53 45 4c      db.     "SEL
0af0: 45 43 54 20 72 75 6e 6e 61 6d 65 20 46 52 4f 4d  ECT runname FROM
0b00: 20 72 75 6e 73 20 57 48 45 52 45 20 69 64 3d 3f   runs WHERE id=?
0b10: 3b 22 0a 20 20 20 20 20 72 75 6e 2d 69 64 29 0a  ;".     run-id).
0b20: 20 20 20 20 72 65 73 29 29 0a 0a 28 64 65 66 69      res))..(defi
0b30: 6e 65 20 28 73 65 74 2d 6d 65 67 61 74 65 73 74  ne (set-megatest
0b40: 2d 65 6e 76 2d 76 61 72 73 20 72 75 6e 2d 69 64  -env-vars run-id
0b50: 29 0a 20 20 28 6c 65 74 20 28 28 6b 65 79 73 20  ).  (let ((keys 
0b60: 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20  (cdb:remote-run 
0b70: 64 62 3a 67 65 74 2d 6b 65 79 73 20 23 66 29 29  db:get-keys #f))
0b80: 0a 09 28 76 61 6c 73 20 28 68 61 73 68 2d 74 61  ..(vals (hash-ta
0b90: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20  ble-ref/default 
0ba0: 2a 65 6e 76 2d 76 61 72 73 2d 62 79 2d 72 75 6e  *env-vars-by-run
0bb0: 2d 69 64 2a 20 72 75 6e 2d 69 64 20 23 66 29 29  -id* run-id #f))
0bc0: 29 0a 20 20 20 20 3b 3b 20 67 65 74 20 74 68 65  ).    ;; get the
0bd0: 20 69 6e 66 6f 20 66 72 6f 6d 20 74 68 65 20 64   info from the d
0be0: 62 20 61 6e 64 20 70 75 74 20 69 74 20 69 6e 20  b and put it in 
0bf0: 74 68 65 20 63 61 63 68 65 0a 20 20 20 20 28 69  the cache.    (i
0c00: 66 20 28 6e 6f 74 20 76 61 6c 73 29 0a 09 28 6c  f (not vals)..(l
0c10: 65 74 20 28 28 68 74 20 28 6d 61 6b 65 2d 68 61  et ((ht (make-ha
0c20: 73 68 2d 74 61 62 6c 65 29 29 29 0a 09 20 20 28  sh-table)))..  (
0c30: 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20  hash-table-set! 
0c40: 2a 65 6e 76 2d 76 61 72 73 2d 62 79 2d 72 75 6e  *env-vars-by-run
0c50: 2d 69 64 2a 20 72 75 6e 2d 69 64 20 68 74 29 0a  -id* run-id ht).
0c60: 09 20 20 28 73 65 74 21 20 76 61 6c 73 20 68 74  .  (set! vals ht
0c70: 29 0a 09 20 20 28 66 6f 72 2d 65 61 63 68 0a 09  )..  (for-each..
0c80: 20 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 29     (lambda (key)
0c90: 0a 09 20 20 20 20 20 28 68 61 73 68 2d 74 61 62  ..     (hash-tab
0ca0: 6c 65 2d 73 65 74 21 20 76 61 6c 73 20 6b 65 79  le-set! vals key
0cb0: 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e   (cdb:remote-run
0cc0: 20 64 62 3a 67 65 74 2d 72 75 6e 2d 6b 65 79 2d   db:get-run-key-
0cd0: 76 61 6c 20 23 66 20 72 75 6e 2d 69 64 20 6b 65  val #f run-id ke
0ce0: 79 29 29 29 0a 09 20 20 20 6b 65 79 73 29 29 29  y)))..   keys)))
0cf0: 0a 20 20 20 20 3b 3b 20 66 72 6f 6d 20 74 68 65  .    ;; from the
0d00: 20 63 61 63 68 65 64 20 64 61 74 61 20 73 65 74   cached data set
0d10: 20 74 68 65 20 76 61 72 73 0a 20 20 20 20 28 68   the vars.    (h
0d20: 61 73 68 2d 74 61 62 6c 65 2d 66 6f 72 2d 65 61  ash-table-for-ea
0d30: 63 68 0a 20 20 20 20 20 76 61 6c 73 0a 20 20 20  ch.     vals.   
0d40: 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 20 76    (lambda (key v
0d50: 61 6c 29 0a 20 20 20 20 20 20 20 28 64 65 62 75  al).       (debu
0d60: 67 3a 70 72 69 6e 74 20 32 20 22 73 65 74 65 6e  g:print 2 "seten
0d70: 76 20 22 20 28 6b 65 79 3a 67 65 74 2d 66 69 65  v " (key:get-fie
0d80: 6c 64 6e 61 6d 65 20 6b 65 79 29 20 22 20 22 20  ldname key) " " 
0d90: 76 61 6c 29 0a 20 20 20 20 20 20 20 28 73 65 74  val).       (set
0da0: 65 6e 76 20 28 6b 65 79 3a 67 65 74 2d 66 69 65  env (key:get-fie
0db0: 6c 64 6e 61 6d 65 20 6b 65 79 29 20 76 61 6c 29  ldname key) val)
0dc0: 29 29 0a 20 20 20 20 28 61 6c 69 73 74 2d 3e 65  )).    (alist->e
0dd0: 6e 76 2d 76 61 72 73 20 28 68 61 73 68 2d 74 61  nv-vars (hash-ta
0de0: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20  ble-ref/default 
0df0: 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 65 6e 76  *configdat* "env
0e00: 2d 6f 76 65 72 72 69 64 65 22 20 27 28 29 29 29  -override" '()))
0e10: 0a 20 20 20 20 3b 3b 20 4c 65 74 73 20 75 73 65  .    ;; Lets use
0e20: 20 74 68 69 73 20 61 73 20 61 6e 20 6f 70 70 6f   this as an oppo
0e30: 72 74 75 6e 69 74 79 20 74 6f 20 70 75 74 20 4d  rtunity to put M
0e40: 54 5f 52 55 4e 4e 41 4d 45 20 69 6e 20 74 68 65  T_RUNNAME in the
0e50: 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 20 20 20   environment.   
0e60: 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e   (setenv "MT_RUN
0e70: 4e 41 4d 45 22 20 28 63 64 62 3a 72 65 6d 6f 74  NAME" (cdb:remot
0e80: 65 2d 72 75 6e 20 64 62 3a 67 65 74 2d 72 75 6e  e-run db:get-run
0e90: 2d 6e 61 6d 65 2d 66 72 6f 6d 2d 69 64 20 23 66  -name-from-id #f
0ea0: 20 72 75 6e 2d 69 64 29 29 0a 20 20 20 20 28 73   run-id)).    (s
0eb0: 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e 5f 41 52  etenv "MT_RUN_AR
0ec0: 45 41 5f 48 4f 4d 45 22 20 2a 74 6f 70 70 61 74  EA_HOME" *toppat
0ed0: 68 2a 29 0a 20 20 20 20 29 29 0a 0a 28 64 65 66  h*).    ))..(def
0ee0: 69 6e 65 20 28 73 65 74 2d 69 74 65 6d 2d 65 6e  ine (set-item-en
0ef0: 76 2d 76 61 72 73 20 69 74 65 6d 64 61 74 29 0a  v-vars itemdat).
0f00: 20 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d    (for-each (lam
0f10: 62 64 61 20 28 69 74 65 6d 29 0a 09 20 20 20 20  bda (item)..    
0f20: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32    (debug:print 2
0f30: 20 22 73 65 74 65 6e 76 20 22 20 28 63 61 72 20   "setenv " (car 
0f40: 69 74 65 6d 29 20 22 20 22 20 28 63 61 64 72 20  item) " " (cadr 
0f50: 69 74 65 6d 29 29 0a 09 20 20 20 20 20 20 28 73  item))..      (s
0f60: 65 74 65 6e 76 20 28 63 61 72 20 69 74 65 6d 29  etenv (car item)
0f70: 20 28 63 61 64 72 20 69 74 65 6d 29 29 29 0a 09   (cadr item)))..
0f80: 20 20 20 20 69 74 65 6d 64 61 74 29 29 0a 0a 28      itemdat))..(
0f90: 64 65 66 69 6e 65 20 2a 6c 61 73 74 2d 6e 75 6d  define *last-num
0fa0: 2d 72 75 6e 6e 69 6e 67 2d 74 65 73 74 73 2a 20  -running-tests* 
0fb0: 30 29 0a 28 64 65 66 69 6e 65 20 2a 72 75 6e 73  0).(define *runs
0fc0: 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65  :can-run-more-te
0fd0: 73 74 73 2d 64 65 6c 61 79 2a 20 30 29 0a 28 64  sts-delay* 0).(d
0fe0: 65 66 69 6e 65 20 28 72 75 6e 73 3a 73 68 72 69  efine (runs:shri
0ff0: 6e 6b 2d 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d  nk-can-run-more-
1000: 74 65 73 74 73 2d 64 65 6c 61 79 29 0a 20 20 28  tests-delay).  (
1010: 73 65 74 21 20 2a 72 75 6e 73 3a 63 61 6e 2d 72  set! *runs:can-r
1020: 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65  un-more-tests-de
1030: 6c 61 79 2a 20 30 29 29 20 3b 3b 20 28 2f 20 2a  lay* 0)) ;; (/ *
1040: 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72  runs:can-run-mor
1050: 65 2d 74 65 73 74 73 2d 64 65 6c 61 79 2a 20 32  e-tests-delay* 2
1060: 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75  )))..(define (ru
1070: 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d  ns:can-run-more-
1080: 74 65 73 74 73 20 74 65 73 74 2d 72 65 63 6f 72  tests test-recor
1090: 64 29 0a 20 20 28 74 68 72 65 61 64 2d 73 6c 65  d).  (thread-sle
10a0: 65 70 21 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75  ep! *runs:can-ru
10b0: 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c  n-more-tests-del
10c0: 61 79 2a 29 0a 20 20 28 6c 65 74 2a 20 28 28 74  ay*).  (let* ((t
10d0: 63 6f 6e 66 69 67 20 20 20 20 20 20 20 20 20 20  config          
10e0: 20 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 65         (tests:te
10f0: 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74  stqueue-get-test
1100: 63 6f 6e 66 69 67 20 74 65 73 74 2d 72 65 63 6f  config test-reco
1110: 72 64 29 29 0a 09 20 28 6a 6f 62 67 72 6f 75 70  rd)).. (jobgroup
1120: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1130: 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74  (config-lookup t
1140: 63 6f 6e 66 69 67 20 22 72 65 71 75 69 72 65 6d  config "requirem
1150: 65 6e 74 73 22 20 22 6a 6f 62 67 72 6f 75 70 22  ents" "jobgroup"
1160: 29 29 0a 09 20 3b 3b 20 48 65 75 72 69 73 74 69  )).. ;; Heuristi
1170: 63 20 66 69 78 2e 20 54 68 65 73 65 20 61 72 65  c fix. These are
1180: 20 67 65 74 74 69 6e 67 20 63 61 6c 6c 65 64 20   getting called 
1190: 74 6f 6f 20 72 61 70 69 64 6c 79 20 77 68 65 6e  too rapidly when
11a0: 20 6a 6f 62 73 20 61 72 65 20 72 75 6e 6e 69 6e   jobs are runnin
11b0: 67 20 6f 72 20 73 74 75 63 6b 0a 09 20 3b 3b 20  g or stuck.. ;; 
11c0: 73 6f 20 77 65 20 61 72 65 20 67 6f 69 6e 67 20  so we are going 
11d0: 74 6f 20 69 6e 63 72 65 6d 65 6e 74 20 61 20 67  to increment a g
11e0: 6c 6f 62 61 6c 20 64 65 6c 61 79 20 62 79 20 30  lobal delay by 0
11f0: 2e 31 20 73 65 63 6f 6e 64 73 20 75 70 20 74 6f  .1 seconds up to
1200: 20 31 30 20 73 65 63 6f 6e 64 73 0a 09 20 3b 3b   10 seconds.. ;;
1210: 20 65 76 65 72 79 20 74 69 6d 65 20 72 75 6e 73   every time runs
1220: 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65  :can-run-more-te
1230: 73 74 73 20 69 73 20 63 61 6c 6c 65 64 2e 0a 09  sts is called...
1240: 20 3b 3b 20 77 68 65 6e 20 61 20 74 65 73 74 20   ;; when a test 
1250: 69 73 20 6c 61 75 6e 63 68 65 64 20 6f 72 20 6f  is launched or o
1260: 74 68 65 72 20 61 63 74 69 76 69 74 79 20 6f 63  ther activity oc
1270: 63 75 72 73 20 64 69 76 69 64 65 20 74 68 65 20  curs divide the 
1280: 64 65 6c 61 79 20 62 79 20 32 0a 09 20 28 6e 75  delay by 2.. (nu
1290: 6d 2d 72 75 6e 6e 69 6e 67 20 20 20 20 20 20 20  m-running       
12a0: 20 20 20 20 20 20 28 63 64 62 3a 72 65 6d 6f 74        (cdb:remot
12b0: 65 2d 72 75 6e 20 64 62 3a 67 65 74 2d 63 6f 75  e-run db:get-cou
12c0: 6e 74 2d 74 65 73 74 73 2d 72 75 6e 6e 69 6e 67  nt-tests-running
12d0: 20 23 66 29 29 0a 09 20 28 6e 75 6d 2d 72 75 6e   #f)).. (num-run
12e0: 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70  ning-in-jobgroup
12f0: 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e   (cdb:remote-run
1300: 20 64 62 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 65   db:get-count-te
1310: 73 74 73 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a  sts-running-in-j
1320: 6f 62 67 72 6f 75 70 20 23 66 20 6a 6f 62 67 72  obgroup #f jobgr
1330: 6f 75 70 29 29 0a 09 20 28 6d 61 78 2d 63 6f 6e  oup)).. (max-con
1340: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 20 20 20  current-jobs    
1350: 20 28 6c 65 74 20 28 28 6d 63 6a 20 28 63 6f 6e   (let ((mcj (con
1360: 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66  fig-lookup *conf
1370: 69 67 64 61 74 2a 20 22 73 65 74 75 70 22 20 20  igdat* "setup"  
1380: 20 20 20 22 6d 61 78 5f 63 6f 6e 63 75 72 72 65     "max_concurre
1390: 6e 74 5f 6a 6f 62 73 22 29 29 29 0a 09 09 09 09  nt_jobs"))).....
13a0: 20 20 20 20 28 69 66 20 28 61 6e 64 20 6d 63 6a      (if (and mcj
13b0: 20 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72   (string->number
13c0: 20 6d 63 6a 29 29 0a 09 09 09 09 09 28 73 74 72   mcj))......(str
13d0: 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 63 6a 29  ing->number mcj)
13e0: 0a 09 09 09 09 09 31 29 29 29 0a 09 20 28 6a 6f  ......1))).. (jo
13f0: 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 20 20 20  b-group-limit   
1400: 20 20 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f        (config-lo
1410: 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a  okup *configdat*
1420: 20 22 6a 6f 62 67 72 6f 75 70 73 22 20 6a 6f 62   "jobgroups" job
1430: 67 72 6f 75 70 29 29 29 0a 20 20 20 20 28 69 66  group))).    (if
1440: 20 28 61 6e 64 20 28 3e 20 28 2b 20 6e 75 6d 2d   (and (> (+ num-
1450: 72 75 6e 6e 69 6e 67 20 6e 75 6d 2d 72 75 6e 6e  running num-runn
1460: 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 29  ing-in-jobgroup)
1470: 20 30 29 0a 09 20 20 20 20 20 28 3c 20 2a 72 75   0)..     (< *ru
1480: 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d  ns:can-run-more-
1490: 74 65 73 74 73 2d 64 65 6c 61 79 2a 20 31 29 29  tests-delay* 1))
14a0: 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 73 65 74  ..(begin..  (set
14b0: 21 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d  ! *runs:can-run-
14c0: 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c 61 79  more-tests-delay
14d0: 2a 20 28 2b 20 2a 72 75 6e 73 3a 63 61 6e 2d 72  * (+ *runs:can-r
14e0: 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65  un-more-tests-de
14f0: 6c 61 79 2a 20 30 2e 30 30 39 29 29 0a 09 20 20  lay* 0.009))..  
1500: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
1510: 6f 20 31 34 20 22 63 61 6e 2d 72 75 6e 2d 6d 6f  o 14 "can-run-mo
1520: 72 65 2d 74 65 73 74 73 2d 64 65 6c 61 79 3a 20  re-tests-delay: 
1530: 22 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d  " *runs:can-run-
1540: 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c 61 79  more-tests-delay
1550: 2a 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e 6f  *))).    (if (no
1560: 74 20 28 65 71 3f 20 2a 6c 61 73 74 2d 6e 75 6d  t (eq? *last-num
1570: 2d 72 75 6e 6e 69 6e 67 2d 74 65 73 74 73 2a 20  -running-tests* 
1580: 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 29 0a 09 28  num-running))..(
1590: 62 65 67 69 6e 0a 09 20 20 28 64 65 62 75 67 3a  begin..  (debug:
15a0: 70 72 69 6e 74 20 32 20 22 6d 61 78 2d 63 6f 6e  print 2 "max-con
15b0: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 3a 20 22 20  current-jobs: " 
15c0: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a  max-concurrent-j
15d0: 6f 62 73 20 22 2c 20 6e 75 6d 2d 72 75 6e 6e 69  obs ", num-runni
15e0: 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e  ng: " num-runnin
15f0: 67 29 0a 09 20 20 28 73 65 74 21 20 2a 6c 61 73  g)..  (set! *las
1600: 74 2d 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 74 65  t-num-running-te
1610: 73 74 73 2a 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67  sts* num-running
1620: 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74  ))).    (if (not
1630: 20 28 65 71 3f 20 30 20 2a 67 6c 6f 62 61 6c 65   (eq? 0 *globale
1640: 78 69 74 73 74 61 74 75 73 2a 29 29 0a 09 28 6c  xitstatus*))..(l
1650: 69 73 74 20 23 66 20 6e 75 6d 2d 72 75 6e 6e 69  ist #f num-runni
1660: 6e 67 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69  ng num-running-i
1670: 6e 2d 6a 6f 62 67 72 6f 75 70 20 6d 61 78 2d 63  n-jobgroup max-c
1680: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 6a  oncurrent-jobs j
1690: 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 29 0a  ob-group-limit).
16a0: 09 28 6c 65 74 20 28 28 63 61 6e 2d 6e 6f 74 2d  .(let ((can-not-
16b0: 72 75 6e 2d 6d 6f 72 65 20 28 63 6f 6e 64 0a 09  run-more (cond..
16c0: 09 09 09 20 3b 3b 20 69 66 20 6d 61 78 2d 63 6f  ... ;; if max-co
16d0: 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 69 73  ncurrent-jobs is
16e0: 20 73 65 74 20 61 6e 64 20 74 68 65 20 6e 75 6d   set and the num
16f0: 62 65 72 20 72 75 6e 6e 69 6e 67 20 69 73 20 67  ber running is g
1700: 72 65 61 74 65 72 20 0a 09 09 09 09 20 3b 3b 20  reater ..... ;; 
1710: 74 68 61 6e 20 69 74 20 74 68 61 6e 20 63 61 6e  than it than can
1720: 6e 6f 74 20 72 75 6e 20 6d 6f 72 65 20 6a 6f 62  not run more job
1730: 73 0a 09 09 09 09 20 28 28 61 6e 64 20 6d 61 78  s..... ((and max
1740: 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73  -concurrent-jobs
1750: 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67   (>= num-running
1760: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d   max-concurrent-
1770: 6a 6f 62 73 29 29 0a 09 09 09 09 20 20 28 64 65  jobs)).....  (de
1780: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52  bug:print 0 "WAR
1790: 4e 49 4e 47 3a 20 4d 61 78 20 72 75 6e 6e 69 6e  NING: Max runnin
17a0: 67 20 6a 6f 62 73 20 65 78 63 65 65 64 65 64 2c  g jobs exceeded,
17b0: 20 63 75 72 72 65 6e 74 20 6e 75 6d 62 65 72 20   current number 
17c0: 72 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d 72  running: " num-r
17d0: 75 6e 6e 69 6e 67 20 0a 09 09 09 09 09 20 20 20  unning ......   
17e0: 20 20 20 20 22 2c 20 6d 61 78 5f 63 6f 6e 63 75      ", max_concu
17f0: 72 72 65 6e 74 5f 6a 6f 62 73 3a 20 22 20 6d 61  rrent_jobs: " ma
1800: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62  x-concurrent-job
1810: 73 29 0a 09 09 09 09 20 20 23 74 29 0a 09 09 09  s).....  #t)....
1820: 09 20 3b 3b 20 69 66 20 6a 6f 62 2d 67 72 6f 75  . ;; if job-grou
1830: 70 2d 6c 69 6d 69 74 20 69 73 20 73 65 74 20 61  p-limit is set a
1840: 6e 64 20 6e 75 6d 62 65 72 20 6f 66 20 6a 6f 62  nd number of job
1850: 73 20 69 6e 20 74 68 65 20 67 72 6f 75 70 20 69  s in the group i
1860: 73 20 67 72 65 61 74 65 72 0a 09 09 09 09 20 3b  s greater..... ;
1870: 3b 20 74 68 61 6e 20 74 68 65 20 6c 69 6d 69 74  ; than the limit
1880: 20 74 68 65 6e 20 63 61 6e 6e 6f 74 20 72 75 6e   then cannot run
1890: 20 6d 6f 72 65 20 6a 6f 62 73 20 6f 66 20 74 68   more jobs of th
18a0: 69 73 20 6b 69 6e 64 0a 09 09 09 09 20 28 28 61  is kind..... ((a
18b0: 6e 64 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d  nd job-group-lim
18c0: 69 74 0a 09 09 09 09 20 20 20 20 20 20 20 28 3e  it.....       (>
18d0: 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e  = num-running-in
18e0: 2d 6a 6f 62 67 72 6f 75 70 20 6a 6f 62 2d 67 72  -jobgroup job-gr
18f0: 6f 75 70 2d 6c 69 6d 69 74 29 29 0a 09 09 09 09  oup-limit)).....
1900: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31    (debug:print 1
1910: 20 22 57 41 52 4e 49 4e 47 3a 20 6e 75 6d 62 65   "WARNING: numbe
1920: 72 20 6f 66 20 6a 6f 62 73 20 22 20 6e 75 6d 2d  r of jobs " num-
1930: 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72  running-in-jobgr
1940: 6f 75 70 20 0a 09 09 09 09 09 20 20 20 20 20 20  oup ......      
1950: 20 22 20 69 6e 20 22 20 6a 6f 62 67 72 6f 75 70   " in " jobgroup
1960: 20 22 20 65 78 63 65 65 64 65 64 2c 20 77 69 6c   " exceeded, wil
1970: 6c 20 6e 6f 74 20 72 75 6e 20 22 20 28 74 65 73  l not run " (tes
1980: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
1990: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72  -testname test-r
19a0: 65 63 6f 72 64 29 29 0a 09 09 09 09 20 20 23 74  ecord)).....  #t
19b0: 29 0a 09 09 09 09 20 28 65 6c 73 65 20 23 66 29  )..... (else #f)
19c0: 29 29 29 0a 09 20 20 28 6c 69 73 74 20 28 6e 6f  )))..  (list (no
19d0: 74 20 63 61 6e 2d 6e 6f 74 2d 72 75 6e 2d 6d 6f  t can-not-run-mo
19e0: 72 65 29 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20  re) num-running 
19f0: 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a  num-running-in-j
1a00: 6f 62 67 72 6f 75 70 20 6d 61 78 2d 63 6f 6e 63  obgroup max-conc
1a10: 75 72 72 65 6e 74 2d 6a 6f 62 73 20 6a 6f 62 2d  urrent-jobs job-
1a20: 67 72 6f 75 70 2d 6c 69 6d 69 74 29 29 29 29 29  group-limit)))))
1a30: 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ..;;============
1a40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1a50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1a60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1a70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4e 65  ==========.;; Ne
1a80: 77 20 6d 65 74 68 6f 64 6f 6c 6f 67 79 2e 20 54  w methodology. T
1a90: 68 65 73 65 20 72 6f 75 74 69 6e 65 73 20 77 69  hese routines wi
1aa0: 6c 6c 20 72 65 70 6c 61 63 65 20 74 68 65 20 61  ll replace the a
1ab0: 62 6f 76 65 20 69 6e 20 74 69 6d 65 2e 20 46 6f  bove in time. Fo
1ac0: 72 0a 3b 3b 20 6e 6f 77 20 74 68 65 20 63 6f 64  r.;; now the cod
1ad0: 65 20 69 73 20 64 75 70 6c 69 63 61 74 65 64 2e  e is duplicated.
1ae0: 20 54 68 69 73 20 73 74 75 66 66 20 69 73 20 69   This stuff is i
1af0: 6e 69 74 69 61 6c 6c 79 20 75 73 65 64 20 69 6e  nitially used in
1b00: 20 74 68 65 20 6d 6f 6e 69 74 6f 72 0a 3b 3b 20   the monitor.;; 
1b10: 62 61 73 65 64 20 63 6f 64 65 2e 0a 3b 3b 3d 3d  based code..;;==
1b20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1b30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1b40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1b50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1b60: 3d 3d 3d 3d 0a 0a 0a 3b 3b 20 54 68 69 73 20 69  ====...;; This i
1b70: 73 20 61 20 64 75 70 6c 69 63 61 74 65 20 6f 66  s a duplicate of
1b80: 20 72 75 6e 2d 74 65 73 74 73 20 28 77 68 69 63   run-tests (whic
1b90: 68 20 68 61 73 20 62 65 65 6e 20 64 65 70 72 65  h has been depre
1ba0: 63 61 74 65 64 29 2e 20 55 73 65 20 74 68 69 73  cated). Use this
1bb0: 20 6f 6e 65 20 69 6e 73 74 65 61 64 20 6f 66 20   one instead of 
1bc0: 72 75 6e 20 74 65 73 74 73 2e 0a 3b 3b 20 6b 65  run tests..;; ke
1bd0: 79 76 61 6c 73 2e 0a 3b 3b 0a 3b 3b 20 20 74 65  yvals..;;.;;  te
1be0: 73 74 2d 6e 61 6d 65 73 3a 20 43 6f 6d 6d 61 20  st-names: Comma 
1bf0: 73 65 70 61 72 61 74 65 64 20 70 61 74 74 65 72  separated patter
1c00: 6e 73 20 73 61 6d 65 20 61 73 20 74 65 73 74 2d  ns same as test-
1c10: 70 61 74 74 73 20 62 75 74 20 75 73 65 64 20 69  patts but used i
1c20: 6e 20 73 65 6c 65 63 74 69 6f 6e 20 0a 3b 3b 20  n selection .;; 
1c30: 20 20 20 20 20 20 20 20 20 20 20 20 20 6f 66 20               of 
1c40: 74 65 73 74 73 20 74 6f 20 72 75 6e 2e 20 54 68  tests to run. Th
1c50: 65 20 69 74 65 6d 20 70 6f 72 74 69 6f 6e 73 20  e item portions 
1c60: 61 72 65 20 6e 6f 74 20 72 65 73 70 65 63 74 65  are not respecte
1c70: 64 2e 0a 3b 3b 20 20 20 20 20 20 20 20 20 20 20  d..;;           
1c80: 20 20 20 46 49 58 4d 45 3a 20 65 72 72 6f 72 20     FIXME: error 
1c90: 6f 75 74 20 69 66 20 2f 70 61 74 74 20 73 70 65  out if /patt spe
1ca0: 63 69 66 69 65 64 0a 3b 3b 20 20 20 20 20 20 20  cified.;;       
1cb0: 20 20 20 20 20 0a 28 64 65 66 69 6e 65 20 28 72       .(define (r
1cc0: 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 20 74 61  uns:run-tests ta
1cd0: 72 67 65 74 20 72 75 6e 6e 61 6d 65 20 74 65 73  rget runname tes
1ce0: 74 2d 6e 61 6d 65 73 20 74 65 73 74 2d 70 61 74  t-names test-pat
1cf0: 74 73 20 75 73 65 72 20 66 6c 61 67 73 29 0a 20  ts user flags). 
1d00: 20 28 63 6f 6d 6d 6f 6e 3a 63 6c 65 61 72 2d 63   (common:clear-c
1d10: 61 63 68 65 73 29 20 3b 3b 20 63 6c 65 61 72 20  aches) ;; clear 
1d20: 61 6c 6c 20 63 61 63 68 65 73 0a 20 20 28 6c 65  all caches.  (le
1d30: 74 2a 20 28 28 64 62 20 20 20 20 20 20 20 20 20  t* ((db         
1d40: 20 23 66 29 0a 09 20 28 6b 65 79 73 20 20 20 20   #f).. (keys    
1d50: 20 20 20 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d      (cdb:remote-
1d60: 72 75 6e 20 64 62 3a 67 65 74 2d 6b 65 79 73 20  run db:get-keys 
1d70: 23 66 29 29 0a 09 20 28 6b 65 79 76 61 6c 6c 73  #f)).. (keyvalls
1d80: 74 20 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74  t   (keys:target
1d90: 2d 3e 6b 65 79 76 61 6c 20 6b 65 79 73 20 74 61  ->keyval keys ta
1da0: 72 67 65 74 29 29 0a 09 20 28 72 75 6e 2d 69 64  rget)).. (run-id
1db0: 20 20 20 20 20 20 28 63 64 62 3a 72 65 6d 6f 74        (cdb:remot
1dc0: 65 2d 72 75 6e 20 64 62 3a 72 65 67 69 73 74 65  e-run db:registe
1dd0: 72 2d 72 75 6e 20 23 66 20 6b 65 79 73 20 6b 65  r-run #f keys ke
1de0: 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20  yvallst runname 
1df0: 22 6e 65 77 22 20 22 6e 2f 61 22 20 75 73 65 72  "new" "n/a" user
1e00: 29 29 20 20 3b 3b 20 20 74 65 73 74 2d 6e 61 6d  ))  ;;  test-nam
1e10: 65 29 29 29 0a 09 20 28 6b 65 79 76 61 6c 73 20  e))).. (keyvals 
1e20: 20 20 20 20 28 69 66 20 72 75 6e 2d 69 64 20 28      (if run-id (
1e30: 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64  cdb:remote-run d
1e40: 62 3a 67 65 74 2d 6b 65 79 2d 76 61 6c 73 20 23  b:get-key-vals #
1e50: 66 20 72 75 6e 2d 69 64 29 20 23 66 29 29 0a 09  f run-id) #f))..
1e60: 20 28 64 65 66 65 72 72 65 64 20 20 20 20 27 28   (deferred    '(
1e70: 29 29 20 3b 3b 20 64 65 6c 61 79 20 72 75 6e 6e  )) ;; delay runn
1e80: 69 6e 67 20 74 68 65 73 65 20 73 69 6e 63 65 20  ing these since 
1e90: 74 68 65 79 20 68 61 76 65 20 61 20 77 61 69 74  they have a wait
1ea0: 6f 6e 20 63 6c 61 75 73 65 0a 09 20 3b 3b 20 6b  on clause.. ;; k
1eb0: 65 65 70 67 6f 69 6e 67 20 69 73 20 74 68 65 20  eepgoing is the 
1ec0: 64 65 66 61 63 74 6f 20 6d 6f 64 61 6c 69 74 79  defacto modality
1ed0: 20 6e 6f 77 2c 20 77 69 6c 6c 20 61 64 64 20 68   now, will add h
1ee0: 69 74 2d 6e 2d 72 75 6e 20 61 20 62 69 74 20 6c  it-n-run a bit l
1ef0: 61 74 65 72 0a 09 20 3b 3b 20 28 6b 65 65 70 67  ater.. ;; (keepg
1f00: 6f 69 6e 67 20 20 20 28 68 61 73 68 2d 74 61 62  oing   (hash-tab
1f10: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66  le-ref/default f
1f20: 6c 61 67 73 20 22 2d 6b 65 65 70 67 6f 69 6e 67  lags "-keepgoing
1f30: 22 20 23 66 29 29 0a 09 20 28 72 75 6e 63 6f 6e  " #f)).. (runcon
1f40: 66 69 67 66 20 20 20 28 63 6f 6e 63 20 20 2a 74  figf   (conc  *t
1f50: 6f 70 70 61 74 68 2a 20 22 2f 72 75 6e 63 6f 6e  oppath* "/runcon
1f60: 66 69 67 73 2e 63 6f 6e 66 69 67 22 29 29 0a 09  figs.config"))..
1f70: 20 28 72 65 71 75 69 72 65 64 2d 74 65 73 74 73   (required-tests
1f80: 20 27 28 29 29 0a 09 20 28 74 65 73 74 2d 72 65   '()).. (test-re
1f90: 63 6f 72 64 73 20 28 6d 61 6b 65 2d 68 61 73 68  cords (make-hash
1fa0: 2d 74 61 62 6c 65 29 29 29 0a 0a 20 20 20 20 28  -table)))..    (
1fb0: 73 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76  set-megatest-env
1fc0: 2d 76 61 72 73 20 72 75 6e 2d 69 64 29 20 3b 3b  -vars run-id) ;;
1fd0: 20 74 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65   these may be ne
1fe0: 65 64 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e  eded by the laun
1ff0: 63 68 69 6e 67 20 70 72 6f 63 65 73 73 0a 0a 20  ching process.. 
2000: 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69     (if (file-exi
2010: 73 74 73 3f 20 72 75 6e 63 6f 6e 66 69 67 66 29  sts? runconfigf)
2020: 0a 09 28 73 65 74 75 70 2d 65 6e 76 2d 64 65 66  ..(setup-env-def
2030: 61 75 6c 74 73 20 72 75 6e 63 6f 6e 66 69 67 66  aults runconfigf
2040: 20 72 75 6e 2d 69 64 20 2a 61 6c 72 65 61 64 79   run-id *already
2050: 2d 73 65 65 6e 2d 72 75 6e 63 6f 6e 66 69 67 2d  -seen-runconfig-
2060: 69 6e 66 6f 2a 20 6b 65 79 73 20 6b 65 79 76 61  info* keys keyva
2070: 6c 73 20 22 70 72 65 2d 6c 61 75 6e 63 68 2d 65  ls "pre-launch-e
2080: 6e 76 2d 76 61 72 73 22 29 0a 09 28 64 65 62 75  nv-vars")..(debu
2090: 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49  g:print 0 "WARNI
20a0: 4e 47 3a 20 59 6f 75 20 64 6f 20 6e 6f 74 20 68  NG: You do not h
20b0: 61 76 65 20 61 20 72 75 6e 20 63 6f 6e 66 69 67  ave a run config
20c0: 20 66 69 6c 65 3a 20 22 20 72 75 6e 63 6f 6e 66   file: " runconf
20d0: 69 67 66 29 29 0a 20 20 20 20 0a 20 20 20 20 3b  igf)).    .    ;
20e0: 3b 20 6c 6f 6f 6b 20 75 70 20 61 6c 6c 20 74 65  ; look up all te
20f0: 73 74 73 20 6d 61 74 63 68 69 6e 67 20 74 68 65  sts matching the
2100: 20 63 6f 6d 6d 61 20 73 65 70 61 72 61 74 65 64   comma separated
2110: 20 6c 69 73 74 20 6f 66 20 67 6c 6f 62 73 20 69   list of globs i
2120: 6e 0a 20 20 20 20 3b 3b 20 74 65 73 74 2d 70 61  n.    ;; test-pa
2130: 74 74 73 20 28 75 73 69 6e 67 20 25 20 61 73 20  tts (using % as 
2140: 77 69 6c 64 63 61 72 64 29 0a 0a 20 20 20 20 28  wildcard)..    (
2150: 73 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20  set! test-names 
2160: 28 74 65 73 74 73 3a 67 65 74 2d 76 61 6c 69 64  (tests:get-valid
2170: 2d 74 65 73 74 73 20 2a 74 6f 70 70 61 74 68 2a  -tests *toppath*
2180: 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 20 20   test-names)).  
2190: 20 20 28 73 65 74 21 20 74 65 73 74 2d 6e 61 6d    (set! test-nam
21a0: 65 73 20 28 64 65 6c 65 74 65 2d 64 75 70 6c 69  es (delete-dupli
21b0: 63 61 74 65 73 20 74 65 73 74 2d 6e 61 6d 65 73  cates test-names
21c0: 29 29 0a 0a 20 20 20 20 28 64 65 62 75 67 3a 70  ))..    (debug:p
21d0: 72 69 6e 74 2d 69 6e 66 6f 20 30 20 22 74 65 73  rint-info 0 "tes
21e0: 74 20 6e 61 6d 65 73 20 22 20 74 65 73 74 2d 6e  t names " test-n
21f0: 61 6d 65 73 29 0a 0a 20 20 20 20 3b 3b 20 6f 6e  ames)..    ;; on
2200: 20 74 68 65 20 66 69 72 73 74 20 70 61 73 73 20   the first pass 
2210: 6f 72 20 63 61 6c 6c 20 74 6f 20 72 75 6e 2d 74  or call to run-t
2220: 65 73 74 73 20 73 65 74 20 46 41 49 4c 53 20 74  ests set FAILS t
2230: 6f 20 4e 4f 54 5f 53 54 41 52 54 45 44 20 69 66  o NOT_STARTED if
2240: 0a 20 20 20 20 3b 3b 20 2d 6b 65 65 70 67 6f 69  .    ;; -keepgoi
2250: 6e 67 20 69 73 20 73 70 65 63 69 66 69 65 64 0a  ng is specified.
2260: 20 20 20 20 28 69 66 20 28 65 71 3f 20 2a 70 61      (if (eq? *pa
2270: 73 73 6e 75 6d 2a 20 30 29 0a 09 28 62 65 67 69  ssnum* 0)..(begi
2280: 6e 0a 09 20 20 3b 3b 20 68 61 76 65 20 74 6f 20  n..  ;; have to 
2290: 64 65 6c 65 74 65 20 74 65 73 74 20 72 65 63 6f  delete test reco
22a0: 72 64 73 20 77 68 65 72 65 20 4e 4f 54 5f 53 54  rds where NOT_ST
22b0: 41 52 54 45 44 20 73 69 6e 63 65 20 74 68 65 79  ARTED since they
22c0: 20 63 61 6e 20 63 61 75 73 65 20 2d 6b 65 65 70   can cause -keep
22d0: 67 6f 69 6e 67 20 74 6f 20 0a 09 20 20 3b 3b 20  going to ..  ;; 
22e0: 67 65 74 20 73 74 75 63 6b 20 64 75 65 20 74 6f  get stuck due to
22f0: 20 62 65 63 6f 6d 69 6e 67 20 69 6e 61 63 63 65   becoming inacce
2300: 73 73 69 62 6c 65 20 66 72 6f 6d 20 61 20 66 61  ssible from a fa
2310: 69 6c 65 64 20 74 65 73 74 2e 20 49 2e 65 2e 20  iled test. I.e. 
2320: 69 66 20 74 65 73 74 20 42 20 64 65 70 65 6e 64  if test B depend
2330: 73 20 0a 09 20 20 3b 3b 20 6f 6e 20 74 65 73 74  s ..  ;; on test
2340: 20 41 20 62 75 74 20 74 65 73 74 20 42 20 72 65   A but test B re
2350: 61 63 68 65 64 20 74 68 65 20 70 6f 69 6e 74 20  ached the point 
2360: 6f 6e 20 62 65 69 6e 67 20 72 65 67 69 73 74 65  on being registe
2370: 72 65 64 20 61 73 20 4e 4f 54 5f 53 54 41 52 54  red as NOT_START
2380: 45 44 20 61 6e 64 20 74 65 73 74 0a 09 20 20 3b  ED and test..  ;
2390: 3b 20 41 20 66 61 69 6c 65 64 20 66 6f 72 20 73  ; A failed for s
23a0: 6f 6d 65 20 72 65 61 73 6f 6e 20 74 68 65 6e 20  ome reason then 
23b0: 6f 6e 20 72 65 2d 72 75 6e 20 75 73 69 6e 67 20  on re-run using 
23c0: 2d 6b 65 65 70 67 6f 69 6e 67 20 74 68 65 20 72  -keepgoing the r
23d0: 75 6e 20 63 61 6e 20 6e 65 76 65 72 20 63 6f 6d  un can never com
23e0: 70 6c 65 74 65 2e 0a 09 20 20 28 63 64 62 3a 64  plete...  (cdb:d
23f0: 65 6c 65 74 65 2d 74 65 73 74 73 2d 69 6e 2d 73  elete-tests-in-s
2400: 74 61 74 65 20 2a 72 75 6e 72 65 6d 6f 74 65 2a  tate *runremote*
2410: 20 72 75 6e 2d 69 64 20 22 4e 4f 54 5f 53 54 41   run-id "NOT_STA
2420: 52 54 45 44 22 29 0a 09 20 20 28 63 64 62 3a 72  RTED")..  (cdb:r
2430: 65 6d 6f 74 65 2d 72 75 6e 20 64 62 3a 73 65 74  emote-run db:set
2440: 2d 74 65 73 74 73 2d 73 74 61 74 65 2d 73 74 61  -tests-state-sta
2450: 74 75 73 20 23 66 20 72 75 6e 2d 69 64 20 74 65  tus #f run-id te
2460: 73 74 2d 6e 61 6d 65 73 20 23 66 20 22 46 41 49  st-names #f "FAI
2470: 4c 22 20 22 4e 4f 54 5f 53 54 41 52 54 45 44 22  L" "NOT_STARTED"
2480: 20 22 46 41 49 4c 22 29 29 29 0a 0a 20 20 20 20   "FAIL")))..    
2490: 3b 3b 20 66 72 6f 6d 20 68 65 72 65 20 6f 6e 20  ;; from here on 
24a0: 6f 75 74 20 74 68 65 20 64 62 20 77 69 6c 6c 20  out the db will 
24b0: 62 65 20 6f 70 65 6e 65 64 20 61 6e 64 20 63 6c  be opened and cl
24c0: 6f 73 65 64 20 6f 6e 20 65 76 65 72 79 20 63 61  osed on every ca
24d0: 6c 6c 20 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74  ll runs:run-test
24e0: 73 2d 71 75 65 75 65 0a 20 20 20 20 3b 3b 20 28  s-queue.    ;; (
24f0: 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65  sqlite3:finalize
2500: 21 20 64 62 29 20 0a 20 20 20 20 3b 3b 20 6e 6f  ! db) .    ;; no
2510: 77 20 61 64 64 20 6e 6f 6e 2d 64 69 72 65 63 74  w add non-direct
2520: 6c 79 20 72 65 66 65 72 65 6e 63 65 64 20 64 65  ly referenced de
2530: 70 65 6e 64 65 6e 63 69 65 73 20 28 69 2e 65 2e  pendencies (i.e.
2540: 20 77 61 69 74 6f 6e 29 0a 20 20 20 20 28 69 66   waiton).    (if
2550: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 73   (not (null? tes
2560: 74 2d 6e 61 6d 65 73 29 29 0a 09 28 6c 65 74 20  t-names))..(let 
2570: 6c 6f 6f 70 20 28 28 68 65 64 20 28 63 61 72 20  loop ((hed (car 
2580: 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 09 20  test-names))... 
2590: 20 20 28 74 61 6c 20 28 63 64 72 20 74 65 73 74    (tal (cdr test
25a0: 2d 6e 61 6d 65 73 29 29 29 20 20 20 20 20 20 20  -names)))       
25b0: 20 20 3b 3b 20 27 72 65 74 75 72 6e 2d 70 72 6f    ;; 'return-pro
25c0: 63 73 20 74 65 6c 6c 73 20 74 68 65 20 63 6f 6e  cs tells the con
25d0: 66 69 67 20 72 65 61 64 65 72 20 74 6f 20 70 72  fig reader to pr
25e0: 65 70 20 72 75 6e 6e 69 6e 67 20 73 79 73 74 65  ep running syste
25f0: 6d 20 62 75 74 20 72 65 74 75 72 6e 20 61 20 70  m but return a p
2600: 72 6f 63 0a 09 20 20 28 64 65 62 75 67 3a 70 72  roc..  (debug:pr
2610: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 68 65 64 3d  int-info 4 "hed=
2620: 22 20 68 65 64 20 22 20 61 74 20 74 6f 70 20 6f  " hed " at top o
2630: 66 20 6c 6f 6f 70 22 29 0a 09 20 20 28 6c 65 74  f loop")..  (let
2640: 2a 20 28 28 63 6f 6e 66 69 67 20 20 28 74 65 73  * ((config  (tes
2650: 74 73 3a 67 65 74 2d 74 65 73 74 63 6f 6e 66 69  ts:get-testconfi
2660: 67 20 68 65 64 20 27 72 65 74 75 72 6e 2d 70 72  g hed 'return-pr
2670: 6f 63 73 29 29 0a 09 09 20 28 77 61 69 74 6f 6e  ocs))... (waiton
2680: 73 20 28 6c 65 74 20 28 28 69 6e 73 74 72 20 28  s (let ((instr (
2690: 69 66 20 63 6f 6e 66 69 67 20 0a 09 09 09 09 09  if config ......
26a0: 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75     (config-looku
26b0: 70 20 63 6f 6e 66 69 67 20 22 72 65 71 75 69 72  p config "requir
26c0: 65 6d 65 6e 74 73 22 20 22 77 61 69 74 6f 6e 22  ements" "waiton"
26d0: 29 0a 09 09 09 09 09 20 20 20 28 62 65 67 69 6e  )......   (begin
26e0: 20 3b 3b 20 4e 6f 20 63 6f 6e 66 69 67 20 6d 65   ;; No config me
26f0: 61 6e 73 20 74 68 69 73 20 69 73 20 61 20 6e 6f  ans this is a no
2700: 6e 2d 65 78 69 73 74 61 6e 74 20 74 65 73 74 0a  n-existant test.
2710: 09 09 09 09 09 20 20 20 20 20 28 64 65 62 75 67  .....     (debug
2720: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a  :print 0 "ERROR:
2730: 20 6e 6f 6e 2d 65 78 69 73 74 65 6e 74 20 72 65   non-existent re
2740: 71 75 69 72 65 64 20 74 65 73 74 20 5c 22 22 20  quired test \"" 
2750: 68 65 64 20 22 5c 22 22 29 0a 09 09 09 09 09 20  hed "\"")...... 
2760: 20 20 20 20 28 69 66 20 64 62 20 28 73 71 6c 69      (if db (sqli
2770: 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62  te3:finalize! db
2780: 29 29 0a 09 09 09 09 09 20 20 20 20 20 28 65 78  ))......     (ex
2790: 69 74 20 31 29 29 29 29 29 0a 09 09 09 20 20 20  it 1)))))....   
27a0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
27b0: 66 6f 20 38 20 22 77 61 69 74 6f 6e 73 20 73 74  fo 8 "waitons st
27c0: 72 69 6e 67 20 69 73 20 22 20 69 6e 73 74 72 29  ring is " instr)
27d0: 0a 09 09 09 20 20 20 20 28 73 74 72 69 6e 67 2d  ....    (string-
27e0: 73 70 6c 69 74 20 28 63 6f 6e 64 0a 09 09 09 09  split (cond.....
27f0: 09 20 20 20 28 28 70 72 6f 63 65 64 75 72 65 3f  .   ((procedure?
2800: 20 69 6e 73 74 72 29 0a 09 09 09 09 09 20 20 20   instr)......   
2810: 20 28 6c 65 74 20 28 28 72 65 73 20 28 69 6e 73   (let ((res (ins
2820: 74 72 29 29 29 0a 09 09 09 09 09 20 20 20 20 20  tr)))......     
2830: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
2840: 66 6f 20 38 20 22 77 61 69 74 6f 6e 20 70 72 6f  fo 8 "waiton pro
2850: 63 65 64 75 72 65 20 72 65 73 75 6c 74 73 20 69  cedure results i
2860: 6e 20 73 74 72 69 6e 67 20 22 20 72 65 73 20 22  n string " res "
2870: 20 66 6f 72 20 74 65 73 74 20 22 20 68 65 64 29   for test " hed)
2880: 0a 09 09 09 09 09 20 20 20 20 20 20 72 65 73 29  ......      res)
2890: 29 0a 09 09 09 09 09 20 20 20 28 28 73 74 72 69  )......   ((stri
28a0: 6e 67 3f 20 69 6e 73 74 72 29 20 20 20 20 20 69  ng? instr)     i
28b0: 6e 73 74 72 29 0a 09 09 09 09 09 20 20 20 28 65  nstr)......   (e
28c0: 6c 73 65 20 0a 09 09 09 09 09 20 20 20 20 3b 3b  lse ......    ;;
28d0: 20 4e 4f 54 45 3a 20 54 68 69 73 20 69 73 20 61   NOTE: This is a
28e0: 63 74 75 61 6c 6c 79 20 74 68 65 20 63 61 73 65  ctually the case
28f0: 20 6f 66 20 2a 6e 6f 2a 20 77 61 69 74 6f 6e 73   of *no* waitons
2900: 21 20 3b 3b 20 28 64 65 62 75 67 3a 70 72 69 6e  ! ;; (debug:prin
2910: 74 20 30 20 22 45 52 52 4f 52 3a 20 73 6f 6d 65  t 0 "ERROR: some
2920: 74 68 69 6e 67 20 77 65 6e 74 20 77 72 6f 6e 67  thing went wrong
2930: 20 69 6e 20 70 72 6f 63 65 73 73 69 6e 67 20 77   in processing w
2940: 61 69 74 6f 6e 73 20 66 6f 72 20 74 65 73 74 20  aitons for test 
2950: 22 20 68 65 64 29 0a 09 09 09 09 09 20 20 20 20  " hed)......    
2960: 22 22 29 29 29 29 29 29 0a 09 20 20 20 20 28 64  ""))))))..    (d
2970: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
2980: 38 20 22 77 61 69 74 6f 6e 73 3a 20 22 20 77 61  8 "waitons: " wa
2990: 69 74 6f 6e 73 29 0a 09 20 20 20 20 3b 3b 20 63  itons)..    ;; c
29a0: 68 65 63 6b 20 66 6f 72 20 68 65 64 20 69 6e 20  heck for hed in 
29b0: 77 61 69 74 6f 6e 73 20 3d 3e 20 74 68 69 73 20  waitons => this 
29c0: 77 6f 75 6c 64 20 62 65 20 63 69 72 63 75 6c 61  would be circula
29d0: 72 2c 20 72 65 6d 6f 76 65 20 69 74 20 61 6e 64  r, remove it and
29e0: 20 69 73 73 75 65 20 61 6e 0a 09 20 20 20 20 3b   issue an..    ;
29f0: 3b 20 65 72 72 6f 72 0a 09 20 20 20 20 28 69 66  ; error..    (if
2a00: 20 28 6d 65 6d 62 65 72 20 68 65 64 20 77 61 69   (member hed wai
2a10: 74 6f 6e 73 29 0a 09 09 28 62 65 67 69 6e 0a 09  tons)...(begin..
2a20: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  .  (debug:print 
2a30: 30 20 22 45 52 52 4f 52 3a 20 74 65 73 74 20 22  0 "ERROR: test "
2a40: 20 68 65 64 20 22 20 68 61 73 20 6c 69 73 74 65   hed " has liste
2a50: 64 20 69 74 73 65 6c 66 20 61 73 20 61 20 77 61  d itself as a wa
2a60: 69 74 6f 6e 2c 20 70 6c 65 61 73 65 20 63 6f 72  iton, please cor
2a70: 72 65 63 74 20 74 68 69 73 21 22 29 0a 09 09 20  rect this!")... 
2a80: 20 28 73 65 74 21 20 77 61 69 74 6f 6e 73 20 28   (set! waitons (
2a90: 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28  filter (lambda (
2aa0: 78 29 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 78  x)(not (equal? x
2ab0: 20 68 65 64 29 29 29 20 77 61 69 74 6f 6e 73 29   hed))) waitons)
2ac0: 29 29 29 0a 09 20 20 20 20 0a 09 20 20 20 20 3b  )))..    ..    ;
2ad0: 3b 20 28 69 74 65 6d 73 20 20 20 28 69 74 65 6d  ; (items   (item
2ae0: 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d  s:get-items-from
2af0: 2d 63 6f 6e 66 69 67 20 63 6f 6e 66 69 67 29 29  -config config))
2b00: 29 0a 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20  )..    (if (not 
2b10: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f  (hash-table-ref/
2b20: 64 65 66 61 75 6c 74 20 74 65 73 74 2d 72 65 63  default test-rec
2b30: 6f 72 64 73 20 68 65 64 20 23 66 29 29 0a 09 09  ords hed #f))...
2b40: 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21  (hash-table-set!
2b50: 20 74 65 73 74 2d 72 65 63 6f 72 64 73 0a 09 09   test-records...
2b60: 09 09 20 68 65 64 20 28 76 65 63 74 6f 72 20 68  .. hed (vector h
2b70: 65 64 20 20 20 20 20 3b 3b 20 30 0a 09 09 09 09  ed     ;; 0.....
2b80: 09 20 20 20 20 20 63 6f 6e 66 69 67 20 20 3b 3b  .     config  ;;
2b90: 20 31 0a 09 09 09 09 09 20 20 20 20 20 77 61 69   1......     wai
2ba0: 74 6f 6e 73 20 3b 3b 20 32 0a 09 09 09 09 09 20  tons ;; 2...... 
2bb0: 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b      (config-look
2bc0: 75 70 20 63 6f 6e 66 69 67 20 22 72 65 71 75 69  up config "requi
2bd0: 72 65 6d 65 6e 74 73 22 20 22 70 72 69 6f 72 69  rements" "priori
2be0: 74 79 22 29 20 20 20 20 20 3b 3b 20 70 72 69 6f  ty")     ;; prio
2bf0: 72 69 74 79 20 33 0a 09 09 09 09 09 20 20 20 20  rity 3......    
2c00: 20 28 6c 65 74 20 28 28 69 74 65 6d 73 20 20 20   (let ((items   
2c10: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72     (hash-table-r
2c20: 65 66 2f 64 65 66 61 75 6c 74 20 63 6f 6e 66 69  ef/default confi
2c30: 67 20 22 69 74 65 6d 73 22 20 23 66 29 29 20 3b  g "items" #f)) ;
2c40: 3b 20 69 74 65 6d 73 20 34 0a 09 09 09 09 09 09  ; items 4.......
2c50: 20 20 20 28 69 74 65 6d 73 74 61 62 6c 65 20 28     (itemstable (
2c60: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64  hash-table-ref/d
2c70: 65 66 61 75 6c 74 20 63 6f 6e 66 69 67 20 22 69  efault config "i
2c80: 74 65 6d 73 74 61 62 6c 65 22 20 23 66 29 29 29  temstable" #f)))
2c90: 20 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b   ......       ;;
2ca0: 20 69 66 20 65 69 74 68 65 72 20 69 74 65 6d 73   if either items
2cb0: 20 6f 72 20 69 74 65 6d 73 20 74 61 62 6c 65 20   or items table 
2cc0: 69 73 20 61 20 70 72 6f 63 20 72 65 74 75 72 6e  is a proc return
2cd0: 20 69 74 20 73 6f 20 74 65 73 74 20 72 75 6e 6e   it so test runn
2ce0: 69 6e 67 0a 09 09 09 09 09 20 20 20 20 20 20 20  ing......       
2cf0: 3b 3b 20 70 72 6f 63 65 73 73 20 63 61 6e 20 6b  ;; process can k
2d00: 6e 6f 77 20 74 6f 20 63 61 6c 6c 20 69 74 65 6d  now to call item
2d10: 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d  s:get-items-from
2d20: 2d 63 6f 6e 66 69 67 0a 09 09 09 09 09 20 20 20  -config......   
2d30: 20 20 20 20 3b 3b 20 69 66 20 65 69 74 68 65 72      ;; if either
2d40: 20 69 73 20 61 20 6c 69 73 74 20 61 6e 64 20 6e   is a list and n
2d50: 6f 6e 65 20 69 73 20 61 20 70 72 6f 63 20 67 6f  one is a proc go
2d60: 20 61 68 65 61 64 20 61 6e 64 20 63 61 6c 6c 20   ahead and call 
2d70: 67 65 74 2d 69 74 65 6d 73 0a 09 09 09 09 09 20  get-items...... 
2d80: 20 20 20 20 20 20 3b 3b 20 6f 74 68 65 72 77 69        ;; otherwi
2d90: 73 65 20 72 65 74 75 72 6e 20 23 66 20 2d 20 74  se return #f - t
2da0: 68 69 73 20 69 73 20 6e 6f 74 20 61 6e 20 69 74  his is not an it
2db0: 65 72 61 74 65 64 20 74 65 73 74 0a 09 09 09 09  erated test.....
2dc0: 09 20 20 20 20 20 20 20 28 63 6f 6e 64 0a 09 09  .       (cond...
2dd0: 09 09 09 09 28 28 70 72 6f 63 65 64 75 72 65 3f  ....((procedure?
2de0: 20 69 74 65 6d 73 29 20 20 20 20 20 20 0a 09 09   items)      ...
2df0: 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e  .... (debug:prin
2e00: 74 2d 69 6e 66 6f 20 34 20 22 69 74 65 6d 73 20  t-info 4 "items 
2e10: 69 73 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20  is a procedure, 
2e20: 77 69 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72 22  will calc later"
2e30: 29 0a 09 09 09 09 09 09 20 69 74 65 6d 73 29 20  )....... items) 
2e40: 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 63 61             ;; ca
2e50: 6c 63 20 6c 61 74 65 72 0a 09 09 09 09 09 09 28  lc later.......(
2e60: 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d  (procedure? item
2e70: 73 74 61 62 6c 65 29 0a 09 09 09 09 09 09 20 28  stable)....... (
2e80: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
2e90: 20 34 20 22 69 74 65 6d 73 74 61 62 6c 65 20 69   4 "itemstable i
2ea0: 73 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20 77  s a procedure, w
2eb0: 69 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72 22 29  ill calc later")
2ec0: 0a 09 09 09 09 09 09 20 69 74 65 6d 73 74 61 62  ....... itemstab
2ed0: 6c 65 29 20 20 20 20 20 20 20 3b 3b 20 63 61 6c  le)       ;; cal
2ee0: 63 20 6c 61 74 65 72 0a 09 09 09 09 09 09 28 28  c later.......((
2ef0: 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28  filter (lambda (
2f00: 78 29 0a 09 09 09 09 09 09 09 20 20 20 28 6c 65  x)........   (le
2f10: 74 20 28 28 76 61 6c 20 28 63 61 72 20 78 29 29  t ((val (car x))
2f20: 29 0a 09 09 09 09 09 09 09 20 20 20 20 20 28 69  )........     (i
2f30: 66 20 28 70 72 6f 63 65 64 75 72 65 3f 20 76 61  f (procedure? va
2f40: 6c 29 20 76 61 6c 20 23 66 29 29 29 0a 09 09 09  l) val #f)))....
2f50: 09 09 09 09 20 28 61 70 70 65 6e 64 20 28 69 66  .... (append (if
2f60: 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 69   (list? items) i
2f70: 74 65 6d 73 20 27 28 29 29 0a 09 09 09 09 09 09  tems '()).......
2f80: 09 09 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74  .. (if (list? it
2f90: 65 6d 73 74 61 62 6c 65 29 20 69 74 65 6d 73 74  emstable) itemst
2fa0: 61 62 6c 65 20 27 28 29 29 29 29 0a 09 09 09 09  able '()))).....
2fb0: 09 09 20 27 68 61 76 65 2d 70 72 6f 63 65 64 75  .. 'have-procedu
2fc0: 72 65 29 0a 09 09 09 09 09 09 28 28 6f 72 20 28  re).......((or (
2fd0: 6c 69 73 74 3f 20 69 74 65 6d 73 29 28 6c 69 73  list? items)(lis
2fe0: 74 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 29 20  t? itemstable)) 
2ff0: 3b 3b 20 63 61 6c 63 20 6e 6f 77 0a 09 09 09 09  ;; calc now.....
3000: 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d  .. (debug:print-
3010: 69 6e 66 6f 20 34 20 22 69 74 65 6d 73 20 61 6e  info 4 "items an
3020: 64 20 69 74 65 6d 73 74 61 62 6c 65 20 61 72 65  d itemstable are
3030: 20 6c 69 73 74 73 2c 20 63 61 6c 63 20 6e 6f 77   lists, calc now
3040: 5c 6e 22 0a 09 09 09 09 09 09 09 20 20 20 20 20  \n"........     
3050: 20 22 20 20 20 20 69 74 65 6d 73 3a 20 22 20 69   "    items: " i
3060: 74 65 6d 73 20 22 20 69 74 65 6d 73 74 61 62 6c  tems " itemstabl
3070: 65 3a 20 22 20 69 74 65 6d 73 74 61 62 6c 65 29  e: " itemstable)
3080: 0a 09 09 09 09 09 09 20 28 69 74 65 6d 73 3a 67  ....... (items:g
3090: 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f  et-items-from-co
30a0: 6e 66 69 67 20 63 6f 6e 66 69 67 29 29 0a 09 09  nfig config))...
30b0: 09 09 09 09 28 65 6c 73 65 20 23 66 29 29 29 20  ....(else #f))) 
30c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
30d0: 20 20 20 20 20 20 20 20 20 20 3b 3b 20 6e 6f 74            ;; not
30e0: 20 69 74 65 72 61 74 65 64 0a 09 09 09 09 09 20   iterated...... 
30f0: 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b 20 69      #f      ;; i
3100: 74 65 6d 73 64 61 74 20 35 0a 09 09 09 09 09 20  temsdat 5...... 
3110: 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b 20 73      #f      ;; s
3120: 70 61 72 65 20 2d 20 75 73 65 64 20 66 6f 72 20  pare - used for 
3130: 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 09 09 20  item-path...... 
3140: 20 20 20 20 29 29 29 0a 09 20 20 20 20 28 66 6f      )))..    (fo
3150: 72 2d 65 61 63 68 20 0a 09 20 20 20 20 20 28 6c  r-each ..     (l
3160: 61 6d 62 64 61 20 28 77 61 69 74 6f 6e 29 0a 09  ambda (waiton)..
3170: 20 20 20 20 20 20 20 28 69 66 20 28 61 6e 64 20         (if (and 
3180: 77 61 69 74 6f 6e 20 28 6e 6f 74 20 28 6d 65 6d  waiton (not (mem
3190: 62 65 72 20 77 61 69 74 6f 6e 20 74 65 73 74 2d  ber waiton test-
31a0: 6e 61 6d 65 73 29 29 29 0a 09 09 20 20 20 28 62  names)))...   (b
31b0: 65 67 69 6e 0a 09 09 20 20 20 20 20 28 73 65 74  egin...     (set
31c0: 21 20 72 65 71 75 69 72 65 64 2d 74 65 73 74 73  ! required-tests
31d0: 20 28 63 6f 6e 73 20 77 61 69 74 6f 6e 20 72 65   (cons waiton re
31e0: 71 75 69 72 65 64 2d 74 65 73 74 73 29 29 0a 09  quired-tests))..
31f0: 09 20 20 20 20 20 28 73 65 74 21 20 74 65 73 74  .     (set! test
3200: 2d 6e 61 6d 65 73 20 28 63 6f 6e 73 20 77 61 69  -names (cons wai
3210: 74 6f 6e 20 74 65 73 74 2d 6e 61 6d 65 73 29 29  ton test-names))
3220: 29 29 29 20 3b 3b 20 77 61 73 20 61 6e 20 61 70  ))) ;; was an ap
3230: 70 65 6e 64 2c 20 6e 6f 77 20 61 20 63 6f 6e 73  pend, now a cons
3240: 0a 09 20 20 20 20 20 77 61 69 74 6f 6e 73 29 0a  ..     waitons).
3250: 09 20 20 20 20 28 6c 65 74 20 28 28 72 65 6d 74  .    (let ((remt
3260: 65 73 74 73 20 28 64 65 6c 65 74 65 2d 64 75 70  ests (delete-dup
3270: 6c 69 63 61 74 65 73 20 28 61 70 70 65 6e 64 20  licates (append 
3280: 77 61 69 74 6f 6e 73 20 74 61 6c 29 29 29 29 0a  waitons tal)))).
3290: 09 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20  .      (if (not 
32a0: 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29  (null? remtests)
32b0: 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72  )...  (loop (car
32c0: 20 72 65 6d 74 65 73 74 73 29 28 63 64 72 20 72   remtests)(cdr r
32d0: 65 6d 74 65 73 74 73 29 29 29 29 29 29 29 0a 0a  emtests)))))))..
32e0: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75      (if (not (nu
32f0: 6c 6c 3f 20 72 65 71 75 69 72 65 64 2d 74 65 73  ll? required-tes
3300: 74 73 29 29 0a 09 28 64 65 62 75 67 3a 70 72 69  ts))..(debug:pri
3310: 6e 74 2d 69 6e 66 6f 20 31 20 22 41 64 64 69 6e  nt-info 1 "Addin
3320: 67 20 22 20 72 65 71 75 69 72 65 64 2d 74 65 73  g " required-tes
3330: 74 73 20 22 20 74 6f 20 74 68 65 20 72 75 6e 20  ts " to the run 
3340: 71 75 65 75 65 22 29 29 0a 20 20 20 20 3b 3b 20  queue")).    ;; 
3350: 4e 4f 54 45 3a 20 74 68 65 73 65 20 61 72 65 20  NOTE: these are 
3360: 61 6c 6c 20 70 61 72 65 6e 74 20 74 65 73 74 73  all parent tests
3370: 2c 20 69 74 65 6d 73 20 61 72 65 20 6e 6f 74 20  , items are not 
3380: 65 78 70 61 6e 64 65 64 20 79 65 74 2e 0a 20 20  expanded yet..  
3390: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69    (debug:print-i
33a0: 6e 66 6f 20 34 20 22 74 65 73 74 2d 72 65 63 6f  nfo 4 "test-reco
33b0: 72 64 73 3d 22 20 28 68 61 73 68 2d 74 61 62 6c  rds=" (hash-tabl
33c0: 65 2d 3e 61 6c 69 73 74 20 74 65 73 74 2d 72 65  e->alist test-re
33d0: 63 6f 72 64 73 29 29 0a 20 20 20 20 28 72 75 6e  cords)).    (run
33e0: 73 3a 72 75 6e 2d 74 65 73 74 73 2d 71 75 65 75  s:run-tests-queu
33f0: 65 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65  e run-id runname
3400: 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 6b 65   test-records ke
3410: 79 76 61 6c 6c 73 74 20 66 6c 61 67 73 20 74 65  yvallst flags te
3420: 73 74 2d 70 61 74 74 73 29 0a 20 20 20 20 28 64  st-patts).    (d
3430: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
3440: 34 20 22 41 6c 6c 20 64 6f 6e 65 20 62 79 20 68  4 "All done by h
3450: 65 72 65 22 29 29 29 0a 0a 28 64 65 66 69 6e 65  ere")))..(define
3460: 20 28 72 75 6e 73 3a 63 61 6c 63 2d 66 61 69 6c   (runs:calc-fail
3470: 73 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65  s prereqs-not-me
3480: 74 29 0a 20 20 28 66 69 6c 74 65 72 20 28 6c 61  t).  (filter (la
3490: 6d 62 64 61 20 28 74 65 73 74 29 0a 09 20 20 20  mbda (test)..   
34a0: 20 28 61 6e 64 20 28 76 65 63 74 6f 72 3f 20 74   (and (vector? t
34b0: 65 73 74 29 20 3b 3b 20 6e 6f 74 20 28 73 74 72  est) ;; not (str
34c0: 69 6e 67 3f 20 74 65 73 74 29 29 0a 09 09 20 28  ing? test))... (
34d0: 65 71 75 61 6c 3f 20 28 64 62 3a 74 65 73 74 2d  equal? (db:test-
34e0: 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 29 20  get-state test) 
34f0: 22 43 4f 4d 50 4c 45 54 45 44 22 29 0a 09 09 20  "COMPLETED")... 
3500: 28 6e 6f 74 20 28 6d 65 6d 62 65 72 20 28 64 62  (not (member (db
3510: 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73  :test-get-status
3520: 20 74 65 73 74 29 0a 09 09 09 20 20 20 20 20 20   test)....      
3530: 27 28 22 50 41 53 53 22 20 22 57 41 52 4e 22 20  '("PASS" "WARN" 
3540: 22 43 48 45 43 4b 22 20 22 57 41 49 56 45 44 22  "CHECK" "WAIVED"
3550: 20 22 53 4b 49 50 22 29 29 29 29 29 0a 09 20 20   "SKIP")))))..  
3560: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29  prereqs-not-met)
3570: 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73  )..(define (runs
3580: 3a 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65  :calc-not-comple
3590: 74 65 64 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d  ted prereqs-not-
35a0: 6d 65 74 29 0a 20 20 28 66 69 6c 74 65 72 0a 20  met).  (filter. 
35b0: 20 20 28 6c 61 6d 62 64 61 20 28 74 29 0a 20 20    (lambda (t).  
35c0: 20 20 20 28 6f 72 20 28 6e 6f 74 20 28 76 65 63     (or (not (vec
35d0: 74 6f 72 3f 20 74 29 29 0a 09 20 28 6e 6f 74 20  tor? t)).. (not 
35e0: 28 65 71 75 61 6c 3f 20 22 43 4f 4d 50 4c 45 54  (equal? "COMPLET
35f0: 45 44 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74  ED" (db:test-get
3600: 2d 73 74 61 74 65 20 74 29 29 29 29 29 0a 20 20  -state t))))).  
3610: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74   prereqs-not-met
3620: 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e  ))..(define (run
3630: 73 3a 70 72 65 74 74 79 2d 73 74 72 69 6e 67 20  s:pretty-string 
3640: 6c 73 74 29 0a 20 20 28 6d 61 70 20 28 6c 61 6d  lst).  (map (lam
3650: 62 64 61 20 28 74 29 0a 09 20 28 69 66 20 28 6e  bda (t).. (if (n
3660: 6f 74 20 28 76 65 63 74 6f 72 3f 20 74 29 29 0a  ot (vector? t)).
3670: 09 20 20 20 20 20 28 63 6f 6e 63 20 74 29 0a 09  .     (conc t)..
3680: 20 20 20 20 20 28 63 6f 6e 63 20 28 64 62 3a 74       (conc (db:t
3690: 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65  est-get-testname
36a0: 20 74 29 20 22 3a 22 20 28 64 62 3a 74 65 73 74   t) ":" (db:test
36b0: 2d 67 65 74 2d 73 74 61 74 65 20 74 29 20 22 2f  -get-state t) "/
36c0: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73  " (db:test-get-s
36d0: 74 61 74 75 73 20 74 29 29 29 29 0a 20 20 20 20  tatus t)))).    
36e0: 20 20 20 6c 73 74 29 29 0a 0a 28 64 65 66 69 6e     lst))..(defin
36f0: 65 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c  e (runs:make-ful
3700: 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74  l-test-name test
3710: 6e 61 6d 65 20 69 74 65 6d 70 61 74 68 29 0a 20  name itempath). 
3720: 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65   (if (equal? ite
3730: 6d 70 61 74 68 20 22 22 29 20 74 65 73 74 6e 61  mpath "") testna
3740: 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d  me (conc testnam
3750: 65 20 22 2f 22 20 69 74 65 6d 70 61 74 68 29 29  e "/" itempath))
3760: 29 0a 0a 3b 3b 20 74 65 73 74 2d 72 65 63 6f 72  )..;; test-recor
3770: 64 73 20 69 73 20 61 20 68 61 73 68 20 74 61 62  ds is a hash tab
3780: 6c 65 20 74 65 73 74 6e 61 6d 65 3a 69 74 65 6d  le testname:item
3790: 5f 70 61 74 68 20 3d 3e 20 76 65 63 74 6f 72 20  _path => vector 
37a0: 3c 20 74 65 73 74 6e 61 6d 65 20 74 65 73 74 63  < testname testc
37b0: 6f 6e 66 69 67 20 77 61 69 74 6f 6e 73 20 70 72  onfig waitons pr
37c0: 69 6f 72 69 74 79 20 69 74 65 6d 73 2d 69 6e 66  iority items-inf
37d0: 6f 20 2e 2e 2e 20 3e 0a 28 64 65 66 69 6e 65 20  o ... >.(define 
37e0: 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d  (runs:run-tests-
37f0: 71 75 65 75 65 20 72 75 6e 2d 69 64 20 72 75 6e  queue run-id run
3800: 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64  name test-record
3810: 73 20 6b 65 79 76 61 6c 6c 73 74 20 66 6c 61 67  s keyvallst flag
3820: 73 20 74 65 73 74 2d 70 61 74 74 73 29 0a 20 20  s test-patts).  
3830: 20 20 3b 3b 20 41 74 20 74 68 69 73 20 70 6f 69    ;; At this poi
3840: 6e 74 20 74 68 65 20 6c 69 73 74 20 6f 66 20 70  nt the list of p
3850: 61 72 65 6e 74 20 74 65 73 74 73 20 69 73 20 65  arent tests is e
3860: 78 70 61 6e 64 65 64 20 0a 20 20 20 20 3b 3b 20  xpanded .    ;; 
3870: 4e 42 2f 2f 20 53 68 6f 75 6c 64 20 65 78 70 61  NB// Should expa
3880: 6e 64 20 69 74 65 6d 73 20 68 65 72 65 20 61 6e  nd items here an
3890: 64 20 74 68 65 6e 20 69 6e 73 65 72 74 20 69 6e  d then insert in
38a0: 74 6f 20 74 68 65 20 72 75 6e 20 71 75 65 75 65  to the run queue
38b0: 2e 0a 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ..  (debug:print
38c0: 20 35 20 22 74 65 73 74 2d 72 65 63 6f 72 64 73   5 "test-records
38d0: 3a 20 22 20 74 65 73 74 2d 72 65 63 6f 72 64 73  : " test-records
38e0: 20 22 2c 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22   ", keyvallst: "
38f0: 20 6b 65 79 76 61 6c 6c 73 74 20 22 20 66 6c 61   keyvallst " fla
3900: 67 73 3a 20 22 20 28 68 61 73 68 2d 74 61 62 6c  gs: " (hash-tabl
3910: 65 2d 3e 61 6c 69 73 74 20 66 6c 61 67 73 29 29  e->alist flags))
3920: 0a 20 20 28 6c 65 74 20 28 28 73 6f 72 74 65 64  .  (let ((sorted
3930: 2d 74 65 73 74 2d 6e 61 6d 65 73 20 28 74 65 73  -test-names (tes
3940: 74 73 3a 73 6f 72 74 2d 62 79 2d 70 72 69 6f 72  ts:sort-by-prior
3950: 69 74 79 2d 61 6e 64 2d 77 61 69 74 6f 6e 20 74  ity-and-waiton t
3960: 65 73 74 2d 72 65 63 6f 72 64 73 29 29 0a 09 28  est-records))..(
3970: 74 65 73 74 2d 72 65 67 69 73 74 65 72 79 20 20  test-registery  
3980: 20 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62    (make-hash-tab
3990: 6c 65 29 29 0a 09 28 72 65 67 69 73 74 65 72 79  le))..(registery
39a0: 2d 6d 75 74 65 78 20 20 20 28 6d 61 6b 65 2d 6d  -mutex   (make-m
39b0: 75 74 65 78 29 29 0a 09 28 6e 75 6d 2d 72 65 74  utex))..(num-ret
39c0: 72 69 65 73 20 20 20 20 20 20 20 20 30 29 0a 09  ries        0)..
39d0: 28 6d 61 78 2d 72 65 74 72 69 65 73 20 20 20 20  (max-retries    
39e0: 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75     (config-looku
39f0: 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 73  p *configdat* "s
3a00: 65 74 75 70 22 20 22 6d 61 78 72 65 74 72 69 65  etup" "maxretrie
3a10: 73 22 29 29 29 0a 20 20 20 20 28 73 65 74 21 20  s"))).    (set! 
3a20: 6d 61 78 2d 72 65 74 72 69 65 73 20 28 69 66 20  max-retries (if 
3a30: 28 61 6e 64 20 6d 61 78 2d 72 65 74 72 69 65 73  (and max-retries
3a40: 20 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72   (string->number
3a50: 20 6d 61 78 2d 72 65 74 72 69 65 73 29 29 28 73   max-retries))(s
3a60: 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 61  tring->number ma
3a70: 78 2d 72 65 74 72 69 65 73 29 20 31 30 30 29 29  x-retries) 100))
3a80: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e  .    (if (not (n
3a90: 75 6c 6c 3f 20 73 6f 72 74 65 64 2d 74 65 73 74  ull? sorted-test
3aa0: 2d 6e 61 6d 65 73 29 29 0a 09 28 6c 65 74 20 6c  -names))..(let l
3ab0: 6f 6f 70 20 28 28 68 65 64 20 20 20 20 20 20 20  oop ((hed       
3ac0: 20 20 28 63 61 72 20 73 6f 72 74 65 64 2d 74 65    (car sorted-te
3ad0: 73 74 2d 6e 61 6d 65 73 29 29 0a 09 09 20 20 20  st-names))...   
3ae0: 28 74 61 6c 20 20 20 20 20 20 20 20 20 28 63 64  (tal         (cd
3af0: 72 20 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61  r sorted-test-na
3b00: 6d 65 73 29 29 0a 09 09 20 20 20 28 72 65 72 75  mes))...   (reru
3b10: 6e 73 20 20 20 20 20 20 27 28 29 29 29 0a 09 20  ns      '())).. 
3b20: 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f   (if (not (null?
3b30: 20 72 65 72 75 6e 73 29 29 28 64 65 62 75 67 3a   reruns))(debug:
3b40: 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 72 65  print-info 4 "re
3b50: 72 75 6e 73 3d 22 20 72 65 72 75 6e 73 29 29 0a  runs=" reruns)).
3b60: 09 20 20 3b 3b 20 28 70 72 69 6e 74 20 22 54 6f  .  ;; (print "To
3b70: 70 20 6f 66 20 6c 6f 6f 70 2c 20 68 65 64 3d 22  p of loop, hed="
3b80: 20 68 65 64 20 22 2c 20 74 61 6c 3d 22 20 74 61   hed ", tal=" ta
3b90: 6c 20 22 20 2c 72 65 72 75 6e 73 3d 22 20 72 65  l " ,reruns=" re
3ba0: 72 75 6e 73 29 0a 09 20 20 28 6c 65 74 2a 20 28  runs)..  (let* (
3bb0: 28 74 65 73 74 2d 72 65 63 6f 72 64 20 28 68 61  (test-record (ha
3bc0: 73 68 2d 74 61 62 6c 65 2d 72 65 66 20 74 65 73  sh-table-ref tes
3bd0: 74 2d 72 65 63 6f 72 64 73 20 68 65 64 29 29 0a  t-records hed)).
3be0: 09 09 20 28 74 65 73 74 2d 6e 61 6d 65 20 20 20  .. (test-name   
3bf0: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65  (tests:testqueue
3c00: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65  -get-testname te
3c10: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 28  st-record))... (
3c20: 74 63 6f 6e 66 69 67 20 20 20 20 20 28 74 65 73  tconfig     (tes
3c30: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
3c40: 2d 74 65 73 74 63 6f 6e 66 69 67 20 74 65 73 74  -testconfig test
3c50: 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 28 74 65  -record))... (te
3c60: 73 74 6d 6f 64 65 20 20 20 20 28 6c 65 74 20 28  stmode    (let (
3c70: 28 6d 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75  (m (config-looku
3c80: 70 20 74 63 6f 6e 66 69 67 20 22 72 65 71 75 69  p tconfig "requi
3c90: 72 65 6d 65 6e 74 73 22 20 22 6d 6f 64 65 22 29  rements" "mode")
3ca0: 29 29 0a 09 09 09 09 28 69 66 20 6d 20 28 73 74  )).....(if m (st
3cb0: 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c 20 6d 29 20  ring->symbol m) 
3cc0: 27 6e 6f 72 6d 61 6c 29 29 29 0a 09 09 20 28 77  'normal)))... (w
3cd0: 61 69 74 6f 6e 73 20 20 20 20 20 28 74 65 73 74  aitons     (test
3ce0: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d  s:testqueue-get-
3cf0: 77 61 69 74 6f 6e 73 20 20 20 20 74 65 73 74 2d  waitons    test-
3d00: 72 65 63 6f 72 64 29 29 0a 09 09 20 28 70 72 69  record))... (pri
3d10: 6f 72 69 74 79 20 20 20 20 28 74 65 73 74 73 3a  ority    (tests:
3d20: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 70 72  testqueue-get-pr
3d30: 69 6f 72 69 74 79 20 20 20 74 65 73 74 2d 72 65  iority   test-re
3d40: 63 6f 72 64 29 29 0a 09 09 20 28 69 74 65 6d 64  cord))... (itemd
3d50: 61 74 20 20 20 20 20 28 74 65 73 74 73 3a 74 65  at     (tests:te
3d60: 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d  stqueue-get-item
3d70: 64 61 74 20 20 20 20 74 65 73 74 2d 72 65 63 6f  dat    test-reco
3d80: 72 64 29 29 20 3b 3b 20 69 74 65 6d 64 61 74 20  rd)) ;; itemdat 
3d90: 63 61 6e 20 62 65 20 61 20 73 74 72 69 6e 67 2c  can be a string,
3da0: 20 6c 69 73 74 20 6f 72 20 23 66 0a 09 09 20 28   list or #f... (
3db0: 69 74 65 6d 73 20 20 20 20 20 20 20 28 74 65 73  items       (tes
3dc0: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
3dd0: 2d 69 74 65 6d 73 20 20 20 20 20 20 74 65 73 74  -items      test
3de0: 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 28 69 74  -record))... (it
3df0: 65 6d 2d 70 61 74 68 20 20 20 28 69 74 65 6d 2d  em-path   (item-
3e00: 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64  list->path itemd
3e10: 61 74 29 29 0a 09 09 20 28 6e 65 77 74 61 6c 20  at))... (newtal 
3e20: 20 20 20 20 20 28 61 70 70 65 6e 64 20 74 61 6c       (append tal
3e30: 20 28 6c 69 73 74 20 68 65 64 29 29 29 29 0a 09   (list hed))))..
3e40: 20 20 20 20 0a 09 20 20 20 20 28 64 65 62 75 67      ..    (debug
3e50: 3a 70 72 69 6e 74 20 36 0a 09 09 09 20 22 74 65  :print 6.... "te
3e60: 73 74 2d 6e 61 6d 65 3a 20 22 20 74 65 73 74 2d  st-name: " test-
3e70: 6e 61 6d 65 0a 09 09 09 20 22 5c 6e 20 20 68 65  name.... "\n  he
3e80: 64 3a 20 20 20 20 20 20 20 20 20 22 20 68 65 64  d:         " hed
3e90: 0a 09 09 09 20 22 5c 6e 20 20 69 74 65 6d 64 61  .... "\n  itemda
3ea0: 74 3a 20 20 20 20 20 22 20 69 74 65 6d 64 61 74  t:     " itemdat
3eb0: 0a 09 09 09 20 22 5c 6e 20 20 69 74 65 6d 73 3a  .... "\n  items:
3ec0: 20 20 20 20 20 20 20 22 20 69 74 65 6d 73 0a 09         " items..
3ed0: 09 09 20 22 5c 6e 20 20 69 74 65 6d 2d 70 61 74  .. "\n  item-pat
3ee0: 68 3a 20 20 20 22 20 69 74 65 6d 2d 70 61 74 68  h:   " item-path
3ef0: 0a 09 09 09 20 22 5c 6e 20 20 77 61 69 74 6f 6e  .... "\n  waiton
3f00: 73 3a 20 20 20 20 20 22 20 77 61 69 74 6f 6e 73  s:     " waitons
3f10: 0a 09 09 09 20 22 5c 6e 20 20 6e 75 6d 2d 72 65  .... "\n  num-re
3f20: 74 72 69 65 73 3a 20 22 20 6e 75 6d 2d 72 65 74  tries: " num-ret
3f30: 72 69 65 73 0a 09 09 09 20 22 5c 6e 20 20 74 61  ries.... "\n  ta
3f40: 6c 3a 20 20 20 20 20 20 20 20 20 22 20 74 61 6c  l:         " tal
3f50: 0a 09 09 09 20 22 5c 6e 20 20 72 65 72 75 6e 73  .... "\n  reruns
3f60: 3a 20 20 20 20 20 20 22 20 72 65 72 75 6e 73 29  :      " reruns)
3f70: 0a 0a 09 20 20 20 20 3b 3b 20 63 68 65 63 6b 20  ...    ;; check 
3f80: 66 6f 72 20 68 65 64 20 69 6e 20 77 61 69 74 6f  for hed in waito
3f90: 6e 73 20 3d 3e 20 74 68 69 73 20 77 6f 75 6c 64  ns => this would
3fa0: 20 62 65 20 63 69 72 63 75 6c 61 72 2c 20 72 65   be circular, re
3fb0: 6d 6f 76 65 20 69 74 20 61 6e 64 20 69 73 73 75  move it and issu
3fc0: 65 20 61 6e 0a 09 20 20 20 20 3b 3b 20 65 72 72  e an..    ;; err
3fd0: 6f 72 0a 09 20 20 20 20 28 69 66 20 28 6d 65 6d  or..    (if (mem
3fe0: 62 65 72 20 74 65 73 74 2d 6e 61 6d 65 20 77 61  ber test-name wa
3ff0: 69 74 6f 6e 73 29 0a 09 09 28 62 65 67 69 6e 0a  itons)...(begin.
4000: 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ..  (debug:print
4010: 20 30 20 22 45 52 52 4f 52 3a 20 74 65 73 74 20   0 "ERROR: test 
4020: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 68 61  " test-name " ha
4030: 73 20 6c 69 73 74 65 64 20 69 74 73 65 6c 66 20  s listed itself 
4040: 61 73 20 61 20 77 61 69 74 6f 6e 2c 20 70 6c 65  as a waiton, ple
4050: 61 73 65 20 63 6f 72 72 65 63 74 20 74 68 69 73  ase correct this
4060: 21 22 29 0a 09 09 20 20 28 73 65 74 21 20 77 61  !")...  (set! wa
4070: 69 74 6f 6e 20 28 66 69 6c 74 65 72 20 28 6c 61  iton (filter (la
4080: 6d 62 64 61 20 28 78 29 28 6e 6f 74 20 28 65 71  mbda (x)(not (eq
4090: 75 61 6c 3f 20 78 20 68 65 64 29 29 29 20 77 61  ual? x hed))) wa
40a0: 69 74 6f 6e 73 29 29 29 29 0a 0a 09 20 20 20 20  itons))))...    
40b0: 28 63 6f 6e 64 20 3b 3b 20 4f 55 54 45 52 20 43  (cond ;; OUTER C
40c0: 4f 4e 44 0a 09 20 20 20 20 20 28 28 6e 6f 74 20  OND..     ((not 
40d0: 69 74 65 6d 73 29 20 3b 3b 20 77 68 65 6e 20 66  items) ;; when f
40e0: 61 6c 73 65 20 74 68 65 20 74 65 73 74 20 69 73  alse the test is
40f0: 20 6f 6b 20 74 6f 20 62 65 20 68 61 6e 64 65 64   ok to be handed
4100: 20 6f 66 66 20 74 6f 20 6c 61 75 6e 63 68 20 28   off to launch (
4110: 62 75 74 20 6e 6f 74 20 62 65 66 6f 72 65 29 0a  but not before).
4120: 09 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 72  .      (let* ((r
4130: 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 20  un-limits-info  
4140: 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e         (open-run
4150: 2d 63 6c 6f 73 65 20 72 75 6e 73 3a 63 61 6e 2d  -close runs:can-
4160: 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 74  run-more-tests t
4170: 65 73 74 2d 72 65 63 6f 72 64 29 29 20 3b 3b 20  est-record)) ;; 
4180: 6c 6f 6f 6b 20 61 74 20 74 68 65 20 74 65 73 74  look at the test
4190: 20 6a 6f 62 67 72 6f 75 70 20 61 6e 64 20 74 6f   jobgroup and to
41a0: 74 20 6a 6f 62 73 20 72 75 6e 6e 69 6e 67 0a 09  t jobs running..
41b0: 09 20 20 20 20 20 28 68 61 76 65 2d 72 65 73 6f  .     (have-reso
41c0: 75 72 63 65 73 20 20 20 20 20 20 20 20 20 20 28  urces          (
41d0: 63 61 72 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69  car run-limits-i
41e0: 6e 66 6f 29 29 0a 09 09 20 20 20 20 20 28 6e 75  nfo))...     (nu
41f0: 6d 2d 72 75 6e 6e 69 6e 67 20 20 20 20 20 20 20  m-running       
4200: 20 20 20 20 20 20 28 6c 69 73 74 2d 72 65 66 20        (list-ref 
4210: 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 20  run-limits-info 
4220: 31 29 29 0a 09 09 20 20 20 20 20 28 6e 75 6d 2d  1))...     (num-
4230: 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72  running-in-jobgr
4240: 6f 75 70 20 28 6c 69 73 74 2d 72 65 66 20 72 75  oup (list-ref ru
4250: 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 32 29  n-limits-info 2)
4260: 29 0a 09 09 20 20 20 20 20 28 6d 61 78 2d 63 6f  )...     (max-co
4270: 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 20 20  ncurrent-jobs   
4280: 20 20 28 6c 69 73 74 2d 72 65 66 20 72 75 6e 2d    (list-ref run-
4290: 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 33 29 29 0a  limits-info 3)).
42a0: 09 09 20 20 20 20 20 28 6a 6f 62 2d 67 72 6f 75  ..     (job-grou
42b0: 70 2d 6c 69 6d 69 74 20 20 20 20 20 20 20 20 20  p-limit         
42c0: 28 6c 69 73 74 2d 72 65 66 20 72 75 6e 2d 6c 69  (list-ref run-li
42d0: 6d 69 74 73 2d 69 6e 66 6f 20 34 29 29 0a 09 09  mits-info 4))...
42e0: 20 20 20 20 20 28 70 72 65 72 65 71 73 2d 6e 6f       (prereqs-no
42f0: 74 2d 6d 65 74 20 20 20 20 20 20 20 20 20 28 6f  t-met         (o
4300: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62  pen-run-close db
4310: 3a 67 65 74 2d 70 72 65 72 65 71 73 2d 6e 6f 74  :get-prereqs-not
4320: 2d 6d 65 74 20 23 66 20 72 75 6e 2d 69 64 20 77  -met #f run-id w
4330: 61 69 74 6f 6e 73 20 69 74 65 6d 2d 70 61 74 68  aitons item-path
4340: 20 6d 6f 64 65 3a 20 74 65 73 74 6d 6f 64 65 29   mode: testmode)
4350: 29 0a 09 09 20 20 20 20 20 28 66 61 69 6c 73 20  )...     (fails 
4360: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
4370: 20 20 28 72 75 6e 73 3a 63 61 6c 63 2d 66 61 69    (runs:calc-fai
4380: 6c 73 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d  ls prereqs-not-m
4390: 65 74 29 29 0a 09 09 20 20 20 20 20 28 6e 6f 6e  et))...     (non
43a0: 2d 63 6f 6d 70 6c 65 74 65 64 20 20 20 20 20 20  -completed      
43b0: 20 20 20 20 20 28 72 75 6e 73 3a 63 61 6c 63 2d       (runs:calc-
43c0: 6e 6f 74 2d 63 6f 6d 70 6c 65 74 65 64 20 70 72  not-completed pr
43d0: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 29  ereqs-not-met)))
43e0: 0a 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 2d  ...(debug:print-
43f0: 69 6e 66 6f 20 38 20 22 68 61 76 65 2d 72 65 73  info 8 "have-res
4400: 6f 75 72 63 65 73 3a 20 22 20 68 61 76 65 2d 72  ources: " have-r
4410: 65 73 6f 75 72 63 65 73 20 22 20 70 72 65 72 65  esources " prere
4420: 71 73 2d 6e 6f 74 2d 6d 65 74 3a 20 22 20 0a 09  qs-not-met: " ..
4430: 09 09 20 20 20 20 20 28 73 74 72 69 6e 67 2d 69  ..     (string-i
4440: 6e 74 65 72 73 70 65 72 73 65 20 0a 09 09 09 20  ntersperse .... 
4450: 20 20 20 20 20 28 6d 61 70 20 28 6c 61 6d 62 64       (map (lambd
4460: 61 20 28 74 29 0a 09 09 09 09 20 20 20 20 20 28  a (t).....     (
4470: 69 66 20 28 76 65 63 74 6f 72 3f 20 74 29 0a 09  if (vector? t)..
4480: 09 09 09 09 20 28 63 6f 6e 63 20 28 64 62 3a 74  .... (conc (db:t
4490: 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74 29  est-get-state t)
44a0: 20 22 2f 22 20 28 64 62 3a 74 65 73 74 2d 67 65   "/" (db:test-ge
44b0: 74 2d 73 74 61 74 75 73 20 74 29 29 0a 09 09 09  t-status t))....
44c0: 09 09 20 28 63 6f 6e 63 20 22 20 57 41 52 4e 49  .. (conc " WARNI
44d0: 4e 47 3a 20 74 20 69 73 20 6e 6f 74 20 61 20 76  NG: t is not a v
44e0: 65 63 74 6f 72 3d 22 20 74 20 29 29 29 0a 09 09  ector=" t )))...
44f0: 09 09 20 20 20 70 72 65 72 65 71 73 2d 6e 6f 74  ..   prereqs-not
4500: 2d 6d 65 74 29 20 22 2c 20 22 29 20 22 20 66 61  -met) ", ") " fa
4510: 69 6c 73 3a 20 22 20 66 61 69 6c 73 29 0a 09 09  ils: " fails)...
4520: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
4530: 6f 20 34 20 22 68 65 64 3d 22 20 68 65 64 20 22  o 4 "hed=" hed "
4540: 5c 6e 20 20 74 65 73 74 2d 72 65 63 6f 72 64 3d  \n  test-record=
4550: 22 20 74 65 73 74 2d 72 65 63 6f 72 64 20 22 5c  " test-record "\
4560: 6e 20 20 74 65 73 74 2d 6e 61 6d 65 3a 20 22 20  n  test-name: " 
4570: 74 65 73 74 2d 6e 61 6d 65 20 22 5c 6e 20 20 69  test-name "\n  i
4580: 74 65 6d 2d 70 61 74 68 3a 20 22 20 69 74 65 6d  tem-path: " item
4590: 2d 70 61 74 68 20 22 5c 6e 20 20 74 65 73 74 2d  -path "\n  test-
45a0: 70 61 74 74 73 3a 20 22 20 74 65 73 74 2d 70 61  patts: " test-pa
45b0: 74 74 73 29 0a 0a 09 09 3b 3b 20 44 6f 6e 27 74  tts)....;; Don't
45c0: 20 6b 6e 6f 77 20 61 74 20 74 68 69 73 20 74 69   know at this ti
45d0: 6d 65 20 69 66 20 74 68 65 20 74 65 73 74 20 68  me if the test h
45e0: 61 76 65 20 62 65 65 6e 20 6c 61 75 6e 63 68 65  ave been launche
45f0: 64 20 61 74 20 73 6f 6d 65 20 74 69 6d 65 20 69  d at some time i
4600: 6e 20 74 68 65 20 70 61 73 74 0a 09 09 3b 3b 20  n the past...;; 
4610: 69 2e 65 2e 20 69 73 20 74 68 69 73 20 61 20 72  i.e. is this a r
4620: 65 2d 6c 61 75 6e 63 68 3f 0a 09 09 28 64 65 62  e-launch?...(deb
4630: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20  ug:print-info 4 
4640: 22 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f  "run-limits-info
4650: 20 3d 20 22 20 72 75 6e 2d 6c 69 6d 69 74 73 2d   = " run-limits-
4660: 69 6e 66 6f 29 0a 09 09 28 63 6f 6e 64 20 3b 3b  info)...(cond ;;
4670: 20 49 4e 4e 45 52 20 43 4f 4e 44 20 23 31 20 66   INNER COND #1 f
4680: 6f 72 20 61 20 6c 61 75 6e 63 68 61 62 6c 65 20  or a launchable 
4690: 74 65 73 74 0a 09 09 20 3b 3b 20 43 68 65 63 6b  test... ;; Check
46a0: 20 69 74 65 6d 20 70 61 74 68 20 61 67 61 69 6e   item path again
46b0: 73 74 20 69 74 65 6d 2d 70 61 74 74 73 0a 09 09  st item-patts...
46c0: 20 28 28 6e 6f 74 20 28 74 65 73 74 73 3a 6d 61   ((not (tests:ma
46d0: 74 63 68 20 74 65 73 74 2d 70 61 74 74 73 20 28  tch test-patts (
46e0: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
46f0: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73  get-testname tes
4700: 74 2d 72 65 63 6f 72 64 29 20 69 74 65 6d 2d 70  t-record) item-p
4710: 61 74 68 29 29 20 3b 3b 20 54 68 69 73 20 74 65  ath)) ;; This te
4720: 73 74 2f 69 74 65 6d 70 61 74 68 20 69 73 20 6e  st/itempath is n
4730: 6f 74 20 74 6f 20 62 65 20 72 75 6e 0a 09 09 20  ot to be run... 
4740: 20 3b 3b 20 65 6c 73 65 20 74 68 65 20 72 75 6e   ;; else the run
4750: 20 69 73 20 73 74 75 63 6b 2c 20 74 65 6d 70 6f   is stuck, tempo
4760: 72 61 72 69 6c 79 20 6f 72 20 70 65 72 6d 61 6e  rarily or perman
4770: 65 6e 74 6c 79 0a 09 09 20 20 3b 3b 20 62 75 74  ently...  ;; but
4780: 20 73 68 6f 75 6c 64 20 63 68 65 63 6b 20 69 66   should check if
4790: 20 69 74 20 69 73 20 64 75 65 20 74 6f 20 6c 61   it is due to la
47a0: 63 6b 20 6f 66 20 72 65 73 6f 75 72 63 65 73 20  ck of resources 
47b0: 76 73 2e 20 70 72 65 72 65 71 75 69 73 69 74 65  vs. prerequisite
47c0: 73 0a 09 09 20 20 28 64 65 62 75 67 3a 70 72 69  s...  (debug:pri
47d0: 6e 74 2d 69 6e 66 6f 20 31 20 22 53 6b 69 70 70  nt-info 1 "Skipp
47e0: 69 6e 67 20 22 20 28 74 65 73 74 73 3a 74 65 73  ing " (tests:tes
47f0: 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e  tqueue-get-testn
4800: 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 29  ame test-record)
4810: 20 22 20 22 20 69 74 65 6d 2d 70 61 74 68 20 22   " " item-path "
4820: 20 61 73 20 69 74 20 64 6f 65 73 6e 27 74 20 6d   as it doesn't m
4830: 61 74 63 68 20 22 20 74 65 73 74 2d 70 61 74 74  atch " test-patt
4840: 73 29 0a 09 09 20 20 3b 3b 20 28 74 68 72 65 61  s)...  ;; (threa
4850: 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c  d-sleep! *global
4860: 2d 64 65 6c 74 61 2a 29 0a 09 09 20 20 28 69 66  -delta*)...  (if
4870: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c   (not (null? tal
4880: 29 29 0a 09 09 20 20 20 20 20 20 28 6c 6f 6f 70  ))...      (loop
4890: 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74   (car tal)(cdr t
48a0: 61 6c 29 20 72 65 72 75 6e 73 29 29 29 0a 09 09  al) reruns)))...
48b0: 20 3b 3b 20 52 65 67 69 73 74 65 72 79 20 68 61   ;; Registery ha
48c0: 73 20 62 65 65 6e 20 73 74 61 72 74 65 64 20 66  s been started f
48d0: 6f 72 20 74 68 69 73 20 74 65 73 74 20 62 75 74  or this test but
48e0: 20 68 61 73 20 6e 6f 74 20 79 65 74 20 63 6f 6d   has not yet com
48f0: 70 6c 65 74 65 64 0a 09 09 20 3b 3b 20 74 68 69  pleted... ;; thi
4900: 73 20 73 68 6f 75 6c 64 20 62 65 20 72 61 72 65  s should be rare
4910: 2c 20 74 68 65 20 63 61 73 65 20 77 68 65 72 65  , the case where
4920: 20 74 68 65 72 65 20 61 72 65 20 6f 6e 6c 79 20   there are only 
4930: 61 20 63 6f 75 70 6c 65 20 6f 66 20 74 65 73 74  a couple of test
4940: 73 20 61 6e 64 20 74 68 65 20 64 62 20 69 73 20  s and the db is 
4950: 73 6c 6f 77 0a 09 09 20 3b 3b 20 64 65 6c 61 79  slow... ;; delay
4960: 20 61 20 73 68 6f 72 74 20 77 68 69 6c 65 20 61   a short while a
4970: 6e 64 20 63 6f 6e 74 69 6e 75 65 0a 09 09 20 28  nd continue... (
4980: 28 65 71 3f 20 28 68 61 73 68 2d 74 61 62 6c 65  (eq? (hash-table
4990: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 74 65 73  -ref/default tes
49a0: 74 2d 72 65 67 69 73 74 65 72 79 20 28 72 75 6e  t-registery (run
49b0: 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 73 74  s:make-full-test
49c0: 2d 6e 61 6d 65 20 74 65 73 74 2d 6e 61 6d 65 20  -name test-name 
49d0: 69 74 65 6d 2d 70 61 74 68 29 20 23 66 29 20 27  item-path) #f) '
49e0: 73 74 61 72 74 29 0a 09 09 20 20 28 74 68 72 65  start)...  (thre
49f0: 61 64 2d 73 6c 65 65 70 21 20 30 2e 30 31 29 0a  ad-sleep! 0.01).
4a00: 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e  ..  (loop (car n
4a10: 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61  ewtal)(cdr newta
4a20: 6c 29 20 72 65 72 75 6e 73 29 29 0a 09 09 20 28  l) reruns))... (
4a30: 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 62 6c 65  (not (hash-table
4a40: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 74 65 73  -ref/default tes
4a50: 74 2d 72 65 67 69 73 74 65 72 79 20 28 72 75 6e  t-registery (run
4a60: 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 73 74  s:make-full-test
4a70: 2d 6e 61 6d 65 20 74 65 73 74 2d 6e 61 6d 65 20  -name test-name 
4a80: 69 74 65 6d 2d 70 61 74 68 29 20 23 66 29 29 0a  item-path) #f)).
4a90: 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ..  (debug:print
4aa0: 2d 69 6e 66 6f 20 34 20 22 50 72 65 2d 72 65 67  -info 4 "Pre-reg
4ab0: 69 73 74 65 72 69 6e 67 20 74 65 73 74 20 22 20  istering test " 
4ac0: 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74  test-name "/" it
4ad0: 65 6d 2d 70 61 74 68 20 22 20 74 6f 20 63 72 65  em-path " to cre
4ae0: 61 74 65 20 70 6c 61 63 65 68 6f 6c 64 65 72 22  ate placeholder"
4af0: 20 29 0a 09 09 20 20 3b 3b 20 4e 45 45 44 20 54   )...  ;; NEED T
4b00: 4f 20 54 48 52 45 41 44 49 46 59 20 54 48 49 53  O THREADIFY THIS
4b10: 0a 09 09 20 20 28 6c 65 74 20 28 28 74 68 20 28  ...  (let ((th (
4b20: 6d 61 6b 65 2d 74 68 72 65 61 64 20 28 6c 61 6d  make-thread (lam
4b30: 62 64 61 20 28 29 0a 09 09 20 20 20 20 20 20 20  bda ()...       
4b40: 20 09 09 20 20 20 28 6d 75 74 65 78 2d 6c 6f 63   ..   (mutex-loc
4b50: 6b 21 20 72 65 67 69 73 74 65 72 79 2d 6d 75 74  k! registery-mut
4b60: 65 78 29 0a 09 09 20 20 20 20 20 20 20 20 09 09  ex)...        ..
4b70: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73     (hash-table-s
4b80: 65 74 21 20 74 65 73 74 2d 72 65 67 69 73 74 65  et! test-registe
4b90: 72 79 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75  ry (runs:make-fu
4ba0: 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 73  ll-test-name tes
4bb0: 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68  t-name item-path
4bc0: 29 20 27 73 74 61 72 74 29 0a 09 09 20 20 20 20  ) 'start)...    
4bd0: 20 20 20 20 09 09 20 20 20 28 6d 75 74 65 78 2d      ..   (mutex-
4be0: 75 6e 6c 6f 63 6b 21 20 72 65 67 69 73 74 65 72  unlock! register
4bf0: 79 2d 6d 75 74 65 78 29 0a 09 09 20 20 20 20 20  y-mutex)...     
4c00: 20 09 09 20 20 20 28 63 64 62 3a 74 65 73 74 73   ..   (cdb:tests
4c10: 2d 72 65 67 69 73 74 65 72 2d 74 65 73 74 20 2a  -register-test *
4c20: 72 75 6e 72 65 6d 6f 74 65 2a 20 72 75 6e 2d 69  runremote* run-i
4c30: 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d  d test-name item
4c40: 2d 70 61 74 68 29 0a 09 09 20 20 20 20 20 20 20  -path)...       
4c50: 20 09 09 20 20 20 28 6d 75 74 65 78 2d 6c 6f 63   ..   (mutex-loc
4c60: 6b 21 20 72 65 67 69 73 74 65 72 79 2d 6d 75 74  k! registery-mut
4c70: 65 78 29 0a 09 09 20 20 20 20 20 20 09 09 20 20  ex)...      ..  
4c80: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74   (hash-table-set
4c90: 21 20 74 65 73 74 2d 72 65 67 69 73 74 65 72 79  ! test-registery
4ca0: 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c   (runs:make-full
4cb0: 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d  -test-name test-
4cc0: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 20  name item-path) 
4cd0: 27 64 6f 6e 65 29 0a 09 09 20 20 20 20 20 20 20  'done)...       
4ce0: 20 09 09 20 20 20 28 6d 75 74 65 78 2d 75 6e 6c   ..   (mutex-unl
4cf0: 6f 63 6b 21 20 72 65 67 69 73 74 65 72 79 2d 6d  ock! registery-m
4d00: 75 74 65 78 29 29 0a 09 09 20 20 20 20 20 20 20  utex))...       
4d10: 20 09 09 20 28 63 6f 6e 63 20 74 65 73 74 2d 6e   .. (conc test-n
4d20: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74  ame "/" item-pat
4d30: 68 29 29 29 29 0a 09 09 20 20 20 20 28 74 68 72  h))))...    (thr
4d40: 65 61 64 2d 73 74 61 72 74 21 20 74 68 29 29 0a  ead-start! th)).
4d50: 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65  ..  (thread-slee
4d60: 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61  p! *global-delta
4d70: 2a 29 0a 28 72 75 6e 73 3a 73 68 72 69 6e 6b 2d  *).(runs:shrink-
4d80: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73  can-run-more-tes
4d90: 74 73 2d 64 65 6c 61 79 29 0a 09 09 20 20 28 6c  ts-delay)...  (l
4da0: 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61 6c 29  oop (car newtal)
4db0: 28 63 64 72 20 6e 65 77 74 61 6c 29 20 72 65 72  (cdr newtal) rer
4dc0: 75 6e 73 29 29 0a 09 09 20 28 28 6e 6f 74 20 68  uns))... ((not h
4dd0: 61 76 65 2d 72 65 73 6f 75 72 63 65 73 29 20 3b  ave-resources) ;
4de0: 3b 20 73 69 6d 70 6c 79 20 74 72 79 20 61 67 61  ; simply try aga
4df0: 69 6e 20 61 66 74 65 72 20 77 61 69 74 69 6e 67  in after waiting
4e00: 20 61 20 73 65 63 6f 6e 64 0a 09 09 20 20 28 64   a second...  (d
4e10: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
4e20: 31 20 22 6e 6f 20 72 65 73 6f 75 72 63 65 73 20  1 "no resources 
4e30: 74 6f 20 72 75 6e 20 6e 65 77 20 74 65 73 74 73  to run new tests
4e40: 2c 20 77 61 69 74 69 6e 67 20 2e 2e 2e 22 29 0a  , waiting ...").
4e50: 09 09 20 20 3b 3b 20 28 74 68 72 65 61 64 2d 73  ..  ;; (thread-s
4e60: 6c 65 65 70 21 20 28 2b 20 32 20 2a 67 6c 6f 62  leep! (+ 2 *glob
4e70: 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09 20 20  al-delta*))...  
4e80: 3b 3b 20 63 6f 75 6c 64 20 68 61 76 65 20 64 6f  ;; could have do
4e90: 6e 65 20 68 65 64 20 74 61 6c 20 68 65 72 65 20  ne hed tal here 
4ea0: 62 75 74 20 64 6f 69 6e 67 20 63 61 72 2f 63 64  but doing car/cd
4eb0: 72 20 6f 66 20 6e 65 77 74 61 6c 20 74 6f 20 72  r of newtal to r
4ec0: 6f 74 61 74 65 20 74 65 73 74 73 0a 09 09 20 20  otate tests...  
4ed0: 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61  (loop (car newta
4ee0: 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20 72  l)(cdr newtal) r
4ef0: 65 72 75 6e 73 29 29 0a 09 09 20 28 28 61 6e 64  eruns))... ((and
4f00: 20 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 0a   have-resources.
4f10: 09 09 20 20 20 20 20 20 20 28 6f 72 20 28 6e 75  ..       (or (nu
4f20: 6c 6c 3f 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d  ll? prereqs-not-
4f30: 6d 65 74 29 0a 09 09 09 20 20 20 28 61 6e 64 20  met)....   (and 
4f40: 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 74  (eq? testmode 't
4f50: 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09 28 6e 75  oplevel).....(nu
4f60: 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65  ll? non-complete
4f70: 64 29 29 29 29 0a 09 09 20 20 28 72 75 6e 3a 74  d))))...  (run:t
4f80: 65 73 74 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61  est run-id runna
4f90: 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 73  me keyvallst tes
4fa0: 74 2d 72 65 63 6f 72 64 20 66 6c 61 67 73 20 23  t-record flags #
4fb0: 66 29 0a 28 72 75 6e 73 3a 73 68 72 69 6e 6b 2d  f).(runs:shrink-
4fc0: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73  can-run-more-tes
4fd0: 74 73 2d 64 65 6c 61 79 29 0a 09 09 20 20 3b 3b  ts-delay)...  ;;
4fe0: 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20   (thread-sleep! 
4ff0: 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a  *global-delta*).
5000: 09 09 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75  ..  (if (not (nu
5010: 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 20 20 20 20  ll? tal))...    
5020: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c    (loop (car tal
5030: 29 28 63 64 72 20 74 61 6c 29 20 72 65 72 75 6e  )(cdr tal) rerun
5040: 73 29 29 29 0a 09 09 20 28 65 6c 73 65 20 3b 3b  s)))... (else ;;
5050: 20 6d 75 73 74 20 62 65 20 77 65 20 68 61 76 65   must be we have
5060: 20 75 6e 6d 65 74 20 70 72 65 72 65 71 75 69 73   unmet prerequis
5070: 69 74 65 73 0a 09 09 20 20 20 20 28 64 65 62 75  ites...    (debu
5080: 67 3a 70 72 69 6e 74 20 34 20 22 46 41 49 4c 53  g:print 4 "FAILS
5090: 3a 20 22 20 66 61 69 6c 73 29 0a 09 09 20 20 20  : " fails)...   
50a0: 20 3b 3b 20 49 66 20 6f 6e 65 20 6f 72 20 6d 6f   ;; If one or mo
50b0: 72 65 20 6f 66 20 74 68 65 20 70 72 65 72 65 71  re of the prereq
50c0: 73 2d 6e 6f 74 2d 6d 65 74 20 61 72 65 20 46 41  s-not-met are FA
50d0: 49 4c 20 74 68 65 6e 20 77 65 20 63 61 6e 20 69  IL then we can i
50e0: 73 73 75 65 0a 09 09 20 20 20 20 3b 3b 20 61 20  ssue...    ;; a 
50f0: 6d 65 73 73 61 67 65 20 61 6e 64 20 64 72 6f 70  message and drop
5100: 20 68 65 64 20 66 72 6f 6d 20 74 68 65 20 69 74   hed from the it
5110: 65 6d 73 20 74 6f 20 62 65 20 70 72 6f 63 65 73  ems to be proces
5120: 73 65 64 2e 0a 09 09 20 20 20 20 28 69 66 20 28  sed....    (if (
5130: 6e 75 6c 6c 3f 20 66 61 69 6c 73 29 0a 09 09 09  null? fails)....
5140: 28 62 65 67 69 6e 0a 09 09 09 20 20 3b 3b 20 63  (begin....  ;; c
5150: 6f 75 6c 64 6e 27 74 20 72 75 6e 2c 20 74 61 6b  ouldn't run, tak
5160: 65 20 61 20 62 72 65 61 74 68 65 72 0a 09 09 09  e a breather....
5170: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69    (debug:print-i
5180: 6e 66 6f 20 34 20 22 53 68 6f 75 6c 64 6e 27 74  nfo 4 "Shouldn't
5190: 20 72 65 61 6c 6c 79 20 67 65 74 20 68 65 72 65   really get here
51a0: 2c 20 72 61 63 65 20 63 6f 6e 64 69 74 69 6f 6e  , race condition
51b0: 3f 20 55 6e 61 62 6c 65 20 74 6f 20 6c 61 75 6e  ? Unable to laun
51c0: 63 68 20 6d 6f 72 65 20 74 65 73 74 73 20 61 74  ch more tests at
51d0: 20 74 68 69 73 20 6d 6f 6d 65 6e 74 2c 20 6b 69   this moment, ki
51e0: 6c 6c 69 6e 67 20 74 69 6d 65 20 2e 2e 2e 22 29  lling time ...")
51f0: 0a 09 09 09 20 20 3b 3b 20 28 74 68 72 65 61 64  ....  ;; (thread
5200: 2d 73 6c 65 65 70 21 20 28 2b 20 30 2e 30 31 20  -sleep! (+ 0.01 
5210: 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29  *global-delta*))
5220: 20 3b 3b 20 6c 6f 6e 67 20 73 6c 65 65 70 20 68   ;; long sleep h
5230: 65 72 65 20 2d 20 6e 6f 20 72 65 73 6f 75 72 63  ere - no resourc
5240: 65 73 2c 20 6d 61 79 20 61 73 20 77 65 6c 6c 20  es, may as well 
5250: 62 65 20 70 61 74 69 65 6e 74 0a 09 09 09 20 20  be patient....  
5260: 3b 3b 20 77 65 20 6d 61 64 65 20 6e 65 77 20 74  ;; we made new t
5270: 61 6c 20 62 79 20 73 74 69 63 6b 69 6e 67 20 68  al by sticking h
5280: 65 64 20 61 74 20 74 68 65 20 62 61 63 6b 20 6f  ed at the back o
5290: 66 20 74 68 65 20 6c 69 73 74 0a 09 09 09 20 20  f the list....  
52a0: 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61  (loop (car newta
52b0: 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20 72  l)(cdr newtal) r
52c0: 65 72 75 6e 73 29 29 0a 09 09 09 3b 3b 20 74 68  eruns))....;; th
52d0: 65 20 77 61 69 74 6f 6e 20 69 73 20 46 41 49 4c  e waiton is FAIL
52e0: 20 73 6f 20 6e 6f 20 70 6f 69 6e 74 20 69 6e 20   so no point in 
52f0: 74 72 79 69 6e 67 20 74 6f 20 72 75 6e 20 68 65  trying to run he
5300: 64 20 65 76 65 72 20 61 67 61 69 6e 0a 09 09 09  d ever again....
5310: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20  (if (not (null? 
5320: 74 61 6c 29 29 0a 09 09 09 20 20 20 20 28 69 66  tal))....    (if
5330: 20 28 76 65 63 74 6f 72 3f 20 68 65 64 29 0a 09   (vector? hed)..
5340: 09 09 09 28 62 65 67 69 6e 20 28 64 65 62 75 67  ...(begin (debug
5350: 3a 70 72 69 6e 74 20 31 20 22 57 41 52 4e 3a 20  :print 1 "WARN: 
5360: 44 72 6f 70 70 69 6e 67 20 74 65 73 74 20 22 20  Dropping test " 
5370: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73  (db:test-get-tes
5380: 74 6e 61 6d 65 20 68 65 64 29 20 22 2f 22 20 28  tname hed) "/" (
5390: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d  db:test-get-item
53a0: 2d 70 61 74 68 20 68 65 64 29 0a 09 09 09 09 09  -path hed)......
53b0: 09 20 20 20 20 22 20 66 72 6f 6d 20 74 68 65 20  .    " from the 
53c0: 6c 61 75 6e 63 68 20 6c 69 73 74 20 61 73 20 69  launch list as i
53d0: 74 20 68 61 73 20 70 72 65 72 65 71 75 69 73 74  t has prerequist
53e0: 65 73 20 74 68 61 74 20 61 72 65 20 46 41 49 4c  es that are FAIL
53f0: 22 29 0a 28 72 75 6e 73 3a 73 68 72 69 6e 6b 2d  ").(runs:shrink-
5400: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73  can-run-more-tes
5410: 74 73 2d 64 65 6c 61 79 29 0a 09 09 09 09 20 20  ts-delay).....  
5420: 20 20 20 20 20 3b 3b 20 28 74 68 72 65 61 64 2d       ;; (thread-
5430: 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64  sleep! *global-d
5440: 65 6c 74 61 2a 29 0a 09 09 09 09 20 20 20 20 20  elta*).....     
5450: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c    (loop (car tal
5460: 29 28 63 64 72 20 74 61 6c 29 20 28 63 6f 6e 73  )(cdr tal) (cons
5470: 20 68 65 64 20 72 65 72 75 6e 73 29 29 29 0a 09   hed reruns)))..
5480: 09 09 09 28 62 65 67 69 6e 0a 09 09 09 09 20 20  ...(begin.....  
5490: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22  (debug:print 1 "
54a0: 57 41 52 4e 3a 20 54 65 73 74 20 6e 6f 74 20 70  WARN: Test not p
54b0: 72 6f 63 65 73 73 65 64 20 63 6f 72 72 65 63 74  rocessed correct
54c0: 6c 79 2e 20 43 6f 75 6c 64 20 62 65 20 61 20 72  ly. Could be a r
54d0: 61 63 65 20 63 6f 6e 64 69 74 69 6f 6e 20 69 6e  ace condition in
54e0: 20 79 6f 75 72 20 74 65 73 74 20 69 6d 70 6c 65   your test imple
54f0: 6d 65 6e 74 61 74 69 6f 6e 3f 20 22 20 68 65 64  mentation? " hed
5500: 29 20 3b 3b 20 20 22 20 61 73 20 69 74 20 68 61  ) ;;  " as it ha
5510: 73 20 70 72 65 72 65 71 75 69 73 74 65 73 20 74  s prerequistes t
5520: 68 61 74 20 61 72 65 20 46 41 49 4c 2e 20 28 4e  hat are FAIL. (N
5530: 4f 54 45 3a 20 68 65 64 20 69 73 20 6e 6f 74 20  OTE: hed is not 
5540: 61 20 76 65 63 74 6f 72 29 22 29 0a 28 72 75 6e  a vector)").(run
5550: 73 3a 73 68 72 69 6e 6b 2d 63 61 6e 2d 72 75 6e  s:shrink-can-run
5560: 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c 61  -more-tests-dela
5570: 79 29 0a 09 09 09 09 20 20 3b 3b 20 28 74 68 72  y).....  ;; (thr
5580: 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 30 2e  ead-sleep! (+ 0.
5590: 30 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61  01 *global-delta
55a0: 2a 29 29 0a 09 09 09 09 20 20 28 6c 6f 6f 70 20  *)).....  (loop 
55b0: 68 65 64 20 74 61 6c 20 72 65 72 75 6e 73 29 29  hed tal reruns))
55c0: 29 29 29 29 29 29 29 20 3b 3b 20 45 4e 44 20 4f  ))))))) ;; END O
55d0: 46 20 49 4e 4e 45 52 20 43 4f 4e 44 0a 09 20 20  F INNER COND..  
55e0: 20 20 20 0a 09 20 20 20 20 20 3b 3b 20 63 61 73     ..     ;; cas
55f0: 65 20 77 68 65 72 65 20 61 6e 20 69 74 65 6d 73  e where an items
5600: 20 63 61 6d 65 20 69 6e 20 61 73 20 61 20 6c 69   came in as a li
5610: 73 74 20 62 65 65 6e 20 70 72 6f 63 65 73 73 65  st been processe
5620: 64 0a 09 20 20 20 20 20 28 28 61 6e 64 20 28 6c  d..     ((and (l
5630: 69 73 74 3f 20 69 74 65 6d 73 29 20 20 20 20 20  ist? items)     
5640: 3b 3b 20 74 68 75 73 20 77 65 20 6b 6e 6f 77 20  ;; thus we know 
5650: 6f 75 72 20 69 74 65 6d 73 20 61 72 65 20 61 6c  our items are al
5660: 72 65 61 64 79 20 63 61 6c 63 75 6c 61 74 65 64  ready calculated
5670: 0a 09 09 20 20 20 28 6e 6f 74 20 20 20 69 74 65  ...   (not   ite
5680: 6d 64 61 74 29 29 20 3b 3b 20 61 6e 64 20 6e 6f  mdat)) ;; and no
5690: 74 20 79 65 74 20 65 78 70 61 6e 64 65 64 20 69  t yet expanded i
56a0: 6e 74 6f 20 74 68 65 20 6c 69 73 74 20 6f 66 20  nto the list of 
56b0: 74 68 69 6e 67 73 20 74 6f 20 62 65 20 64 6f 6e  things to be don
56c0: 65 0a 09 20 20 20 20 20 20 28 69 66 20 28 61 6e  e..      (if (an
56d0: 64 20 28 64 65 62 75 67 3a 64 65 62 75 67 2d 6d  d (debug:debug-m
56e0: 6f 64 65 20 31 29 20 3b 3b 20 28 3e 3d 20 2a 76  ode 1) ;; (>= *v
56f0: 65 72 62 6f 73 69 74 79 2a 20 31 29 0a 09 09 20  erbosity* 1)... 
5700: 20 20 20 20 20 20 28 3e 20 28 6c 65 6e 67 74 68        (> (length
5710: 20 69 74 65 6d 73 29 20 30 29 0a 09 09 20 20 20   items) 0)...   
5720: 20 20 20 20 28 3e 20 28 6c 65 6e 67 74 68 20 28      (> (length (
5730: 63 61 72 20 69 74 65 6d 73 29 29 20 30 29 29 0a  car items)) 0)).
5740: 09 09 20 20 28 70 70 20 69 74 65 6d 73 29 29 0a  ..  (pp items)).
5750: 09 20 20 20 20 20 20 28 66 6f 72 2d 65 61 63 68  .      (for-each
5760: 0a 09 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61  ..       (lambda
5770: 20 28 6d 79 2d 69 74 65 6d 64 61 74 29 0a 09 09   (my-itemdat)...
5780: 20 28 6c 65 74 2a 20 28 28 6e 65 77 2d 74 65 73   (let* ((new-tes
5790: 74 2d 72 65 63 6f 72 64 20 28 6c 65 74 20 28 28  t-record (let ((
57a0: 6e 65 77 72 65 63 20 28 6d 61 6b 65 2d 74 65 73  newrec (make-tes
57b0: 74 73 3a 74 65 73 74 71 75 65 75 65 29 29 29 0a  ts:testqueue))).
57c0: 09 09 09 09 09 20 20 20 28 76 65 63 74 6f 72 2d  .....   (vector-
57d0: 63 6f 70 79 21 20 74 65 73 74 2d 72 65 63 6f 72  copy! test-recor
57e0: 64 20 6e 65 77 72 65 63 29 0a 09 09 09 09 09 20  d newrec)...... 
57f0: 20 20 6e 65 77 72 65 63 29 29 0a 09 09 09 28 6d    newrec))....(m
5800: 79 2d 69 74 65 6d 2d 70 61 74 68 20 28 69 74 65  y-item-path (ite
5810: 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 6d 79 2d  m-list->path my-
5820: 69 74 65 6d 64 61 74 29 29 29 0a 09 09 20 20 20  itemdat)))...   
5830: 28 69 66 20 28 74 65 73 74 73 3a 6d 61 74 63 68  (if (tests:match
5840: 20 74 65 73 74 2d 70 61 74 74 73 20 68 65 64 20   test-patts hed 
5850: 6d 79 2d 69 74 65 6d 2d 70 61 74 68 29 20 3b 3b  my-item-path) ;;
5860: 20 28 70 61 74 74 2d 6c 69 73 74 2d 6d 61 74 63   (patt-list-matc
5870: 68 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68 20 69  h my-item-path i
5880: 74 65 6d 2d 70 61 74 74 73 29 20 20 20 20 20 20  tem-patts)      
5890: 20 20 20 20 20 3b 3b 20 79 65 73 2c 20 77 65 20       ;; yes, we 
58a0: 77 61 6e 74 20 74 6f 20 70 72 6f 63 65 73 73 20  want to process 
58b0: 74 68 69 73 20 69 74 65 6d 2c 20 4e 4f 54 45 3a  this item, NOTE:
58c0: 20 53 68 6f 75 6c 64 20 6e 6f 74 20 6e 65 65 64   Should not need
58d0: 20 74 68 69 73 20 63 68 65 63 6b 20 68 65 72 65   this check here
58e0: 21 0a 09 09 20 20 20 20 20 20 20 28 6c 65 74 20  !...       (let 
58f0: 28 28 6e 65 77 74 65 73 74 6e 61 6d 65 20 28 72  ((newtestname (r
5900: 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65  uns:make-full-te
5910: 73 74 2d 6e 61 6d 65 20 68 65 64 20 6d 79 2d 69  st-name hed my-i
5920: 74 65 6d 2d 70 61 74 68 29 29 29 20 20 20 20 3b  tem-path)))    ;
5930: 3b 20 74 65 73 74 20 6e 61 6d 65 73 20 61 72 65  ; test names are
5940: 20 75 6e 69 71 75 65 20 6f 6e 20 74 65 73 74 6e   unique on testn
5950: 61 6d 65 2f 69 74 65 6d 2d 70 61 74 68 0a 09 09  ame/item-path...
5960: 09 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65  . (tests:testque
5970: 75 65 2d 73 65 74 2d 69 74 65 6d 73 21 20 20 20  ue-set-items!   
5980: 20 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72    new-test-recor
5990: 64 20 23 66 29 0a 09 09 09 20 28 74 65 73 74 73  d #f).... (tests
59a0: 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69  :testqueue-set-i
59b0: 74 65 6d 64 61 74 21 20 20 20 6e 65 77 2d 74 65  temdat!   new-te
59c0: 73 74 2d 72 65 63 6f 72 64 20 6d 79 2d 69 74 65  st-record my-ite
59d0: 6d 64 61 74 29 0a 09 09 09 20 28 74 65 73 74 73  mdat).... (tests
59e0: 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69  :testqueue-set-i
59f0: 74 65 6d 5f 70 61 74 68 21 20 6e 65 77 2d 74 65  tem_path! new-te
5a00: 73 74 2d 72 65 63 6f 72 64 20 6d 79 2d 69 74 65  st-record my-ite
5a10: 6d 2d 70 61 74 68 29 0a 09 09 09 20 28 68 61 73  m-path).... (has
5a20: 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 65 73  h-table-set! tes
5a30: 74 2d 72 65 63 6f 72 64 73 20 6e 65 77 74 65 73  t-records newtes
5a40: 74 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74 2d 72  tname new-test-r
5a50: 65 63 6f 72 64 29 0a 09 09 09 20 28 73 65 74 21  ecord).... (set!
5a60: 20 74 61 6c 20 28 63 6f 6e 73 20 6e 65 77 74 65   tal (cons newte
5a70: 73 74 6e 61 6d 65 20 74 61 6c 29 29 29 29 29 29  stname tal))))))
5a80: 20 3b 3b 20 73 69 6e 63 65 20 74 68 65 73 65 20   ;; since these 
5a90: 61 72 65 20 69 74 65 6d 69 7a 65 64 20 63 72 65  are itemized cre
5aa0: 61 74 65 20 6e 65 77 20 74 65 73 74 20 6e 61 6d  ate new test nam
5ab0: 65 73 20 74 65 73 74 6e 61 6d 65 2f 69 74 65 6d  es testname/item
5ac0: 70 61 74 68 0a 09 20 20 20 20 20 20 20 69 74 65  path..       ite
5ad0: 6d 73 29 0a 09 20 20 20 20 20 20 28 69 66 20 28  ms)..      (if (
5ae0: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29  not (null? tal))
5af0: 0a 09 09 20 20 28 62 65 67 69 6e 0a 09 09 20 20  ...  (begin...  
5b00: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69    (debug:print-i
5b10: 6e 66 6f 20 34 20 22 45 6e 64 20 6f 66 20 69 74  nfo 4 "End of it
5b20: 65 6d 73 20 6c 69 73 74 2c 20 6c 6f 6f 70 69 6e  ems list, loopin
5b30: 67 20 77 69 74 68 20 6e 65 78 74 20 61 66 74 65  g with next afte
5b40: 72 20 73 68 6f 72 74 20 64 65 6c 61 79 22 29 0a  r short delay").
5b50: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
5b60: 20 20 20 20 3b 3b 20 28 74 68 72 65 61 64 2d 73      ;; (thread-s
5b70: 6c 65 65 70 21 20 28 2b 20 30 2e 30 31 20 2a 67  leep! (+ 0.01 *g
5b80: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09  lobal-delta*))..
5b90: 09 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20  .    (loop (car 
5ba0: 74 61 6c 29 28 63 64 72 20 74 61 6c 29 20 72 65  tal)(cdr tal) re
5bb0: 72 75 6e 73 29 29 29 29 0a 0a 09 20 20 20 20 20  runs))))...     
5bc0: 3b 3b 20 69 66 20 69 74 65 6d 73 20 69 73 20 61  ;; if items is a
5bd0: 20 70 72 6f 63 20 74 68 65 6e 20 6e 65 65 64 20   proc then need 
5be0: 74 6f 20 72 75 6e 20 69 74 65 6d 73 3a 67 65 74  to run items:get
5bf0: 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66  -items-from-conf
5c00: 69 67 2c 20 67 65 74 20 74 68 65 20 6c 69 73 74  ig, get the list
5c10: 20 61 6e 64 20 6c 6f 6f 70 20 0a 09 20 20 20 20   and loop ..    
5c20: 20 3b 3b 20 20 20 20 2d 20 62 75 74 20 6f 6e 6c   ;;    - but onl
5c30: 79 20 64 6f 20 74 68 61 74 20 69 66 20 72 65 73  y do that if res
5c40: 6f 75 72 63 65 73 20 65 78 69 73 74 20 74 6f 20  ources exist to 
5c50: 6b 69 63 6b 20 6f 66 66 20 74 68 65 20 6a 6f 62  kick off the job
5c60: 0a 09 20 20 20 20 20 28 28 6f 72 20 28 70 72 6f  ..     ((or (pro
5c70: 63 65 64 75 72 65 3f 20 69 74 65 6d 73 29 28 65  cedure? items)(e
5c80: 71 3f 20 69 74 65 6d 73 20 27 68 61 76 65 2d 70  q? items 'have-p
5c90: 72 6f 63 65 64 75 72 65 29 29 0a 09 20 20 20 20  rocedure))..    
5ca0: 20 20 28 6c 65 74 20 28 28 63 61 6e 2d 72 75 6e    (let ((can-run
5cb0: 2d 6d 6f 72 65 20 20 20 20 28 72 75 6e 73 3a 63  -more    (runs:c
5cc0: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74  an-run-more-test
5cd0: 73 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 29  s test-record)))
5ce0: 0a 09 09 28 69 66 20 28 61 6e 64 20 28 6c 69 73  ...(if (and (lis
5cf0: 74 3f 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 29  t? can-run-more)
5d00: 0a 09 09 09 20 28 63 61 72 20 63 61 6e 2d 72 75  .... (car can-ru
5d10: 6e 2d 6d 6f 72 65 29 29 0a 09 09 20 20 20 20 28  n-more))...    (
5d20: 6c 65 74 2a 20 28 28 70 72 65 72 65 71 73 2d 6e  let* ((prereqs-n
5d30: 6f 74 2d 6d 65 74 20 28 6f 70 65 6e 2d 72 75 6e  ot-met (open-run
5d40: 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 70 72  -close db:get-pr
5d50: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 23 66  ereqs-not-met #f
5d60: 20 72 75 6e 2d 69 64 20 77 61 69 74 6f 6e 73 20   run-id waitons 
5d70: 69 74 65 6d 2d 70 61 74 68 20 6d 6f 64 65 3a 20  item-path mode: 
5d80: 74 65 73 74 6d 6f 64 65 29 29 0a 09 09 09 20 20  testmode))....  
5d90: 20 28 66 61 69 6c 73 20 20 20 20 20 20 20 20 20   (fails         
5da0: 20 20 28 72 75 6e 73 3a 63 61 6c 63 2d 66 61 69    (runs:calc-fai
5db0: 6c 73 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d  ls prereqs-not-m
5dc0: 65 74 29 29 0a 09 09 09 20 20 20 28 6e 6f 6e 2d  et))....   (non-
5dd0: 63 6f 6d 70 6c 65 74 65 64 20 20 20 28 72 75 6e  completed   (run
5de0: 73 3a 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c  s:calc-not-compl
5df0: 65 74 65 64 20 70 72 65 72 65 71 73 2d 6e 6f 74  eted prereqs-not
5e00: 2d 6d 65 74 29 29 29 0a 09 09 20 20 20 20 20 20  -met)))...      
5e10: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
5e20: 6f 20 38 20 22 63 61 6e 2d 72 75 6e 2d 6d 6f 72  o 8 "can-run-mor
5e30: 65 3a 20 22 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72  e: " can-run-mor
5e40: 65 0a 09 09 09 09 20 20 20 22 5c 6e 20 74 65 73  e.....   "\n tes
5e50: 74 6e 61 6d 65 3a 20 20 20 20 20 20 20 20 22 20  tname:        " 
5e60: 68 65 64 0a 09 09 09 09 20 20 20 22 5c 6e 20 70  hed.....   "\n p
5e70: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 3a 20  rereqs-not-met: 
5e80: 22 20 28 72 75 6e 73 3a 70 72 65 74 74 79 2d 73  " (runs:pretty-s
5e90: 74 72 69 6e 67 20 70 72 65 72 65 71 73 2d 6e 6f  tring prereqs-no
5ea0: 74 2d 6d 65 74 29 0a 09 09 09 09 20 20 20 22 5c  t-met).....   "\
5eb0: 6e 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 3a  n non-completed:
5ec0: 20 20 20 22 20 28 72 75 6e 73 3a 70 72 65 74 74     " (runs:prett
5ed0: 79 2d 73 74 72 69 6e 67 20 6e 6f 6e 2d 63 6f 6d  y-string non-com
5ee0: 70 6c 65 74 65 64 29 20 0a 09 09 09 09 20 20 20  pleted) .....   
5ef0: 22 5c 6e 20 66 61 69 6c 73 3a 20 20 20 20 20 20  "\n fails:      
5f00: 20 20 20 20 20 22 20 28 72 75 6e 73 3a 70 72 65       " (runs:pre
5f10: 74 74 79 2d 73 74 72 69 6e 67 20 66 61 69 6c 73  tty-string fails
5f20: 29 0a 09 09 09 09 20 20 20 22 5c 6e 20 74 65 73  ).....   "\n tes
5f30: 74 6d 6f 64 65 3a 20 20 20 20 20 20 20 20 22 20  tmode:        " 
5f40: 74 65 73 74 6d 6f 64 65 0a 09 09 09 09 20 20 20  testmode.....   
5f50: 22 5c 6e 20 6e 75 6d 2d 72 65 74 72 69 65 73 3a  "\n num-retries:
5f60: 20 20 20 20 20 22 20 6e 75 6d 2d 72 65 74 72 69       " num-retri
5f70: 65 73 0a 09 09 09 09 20 20 20 22 5c 6e 20 28 65  es.....   "\n (e
5f80: 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 74 6f 70  q? testmode 'top
5f90: 6c 65 76 65 6c 29 3a 20 22 20 28 65 71 3f 20 74  level): " (eq? t
5fa0: 65 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65  estmode 'topleve
5fb0: 6c 29 0a 09 09 09 09 20 20 20 22 5c 6e 20 28 6e  l).....   "\n (n
5fc0: 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74  ull? non-complet
5fd0: 65 64 29 3a 20 20 20 20 22 20 28 6e 75 6c 6c 3f  ed):    " (null?
5fe0: 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 0a   non-completed).
5ff0: 09 09 09 09 20 20 20 22 5c 6e 20 72 65 72 75 6e  ....   "\n rerun
6000: 73 3a 20 20 20 20 20 20 20 20 20 20 22 20 72 65  s:          " re
6010: 72 75 6e 73 0a 09 09 09 09 20 20 20 22 5c 6e 20  runs.....   "\n 
6020: 69 74 65 6d 73 3a 20 20 20 20 20 20 20 20 20 20  items:          
6030: 20 22 20 69 74 65 6d 73 0a 09 09 09 09 20 20 20   " items.....   
6040: 22 5c 6e 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65  "\n can-run-more
6050: 3a 20 20 20 20 22 20 63 61 6e 2d 72 75 6e 2d 6d  :    " can-run-m
6060: 6f 72 65 29 0a 09 09 20 20 20 20 20 20 3b 3b 20  ore)...      ;; 
6070: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28  (thread-sleep! (
6080: 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d 64  + 0.01 *global-d
6090: 65 6c 74 61 2a 29 29 0a 09 09 20 20 20 20 20 20  elta*))...      
60a0: 28 63 6f 6e 64 20 3b 3b 20 49 4e 4e 45 52 20 43  (cond ;; INNER C
60b0: 4f 4e 44 20 23 32 0a 09 09 20 20 20 20 20 20 20  OND #2...       
60c0: 28 28 6f 72 20 28 6e 75 6c 6c 3f 20 70 72 65 72  ((or (null? prer
60d0: 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 20 3b 3b 20  eqs-not-met) ;; 
60e0: 61 6c 6c 20 70 72 65 72 65 71 73 20 6d 65 74 2c  all prereqs met,
60f0: 20 66 69 72 65 20 6f 66 66 20 74 68 65 20 74 65   fire off the te
6100: 73 74 0a 09 09 09 20 20 20 20 3b 3b 20 6f 72 2c  st....    ;; or,
6110: 20 69 66 20 69 74 20 69 73 20 61 20 27 74 6f 70   if it is a 'top
6120: 6c 65 76 65 6c 20 74 65 73 74 20 61 6e 64 20 61  level test and a
6130: 6c 6c 20 70 72 65 72 65 71 73 20 6e 6f 74 20 6d  ll prereqs not m
6140: 65 74 20 61 72 65 20 43 4f 4d 50 4c 45 54 45 44  et are COMPLETED
6150: 20 74 68 65 6e 20 6c 61 75 6e 63 68 0a 09 09 09   then launch....
6160: 20 20 20 20 28 61 6e 64 20 28 65 71 3f 20 74 65      (and (eq? te
6170: 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c  stmode 'toplevel
6180: 29 0a 09 09 09 09 20 28 6e 75 6c 6c 3f 20 6e 6f  )..... (null? no
6190: 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 29 29 0a 09  n-completed)))..
61a0: 09 09 28 6c 65 74 20 28 28 74 65 73 74 2d 6e 61  ..(let ((test-na
61b0: 6d 65 20 28 74 65 73 74 73 3a 74 65 73 74 71 75  me (tests:testqu
61c0: 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65  eue-get-testname
61d0: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 29 0a   test-record))).
61e0: 09 09 09 20 20 28 73 65 74 65 6e 76 20 22 4d 54  ...  (setenv "MT
61f0: 5f 54 45 53 54 5f 4e 41 4d 45 22 20 74 65 73 74  _TEST_NAME" test
6200: 2d 6e 61 6d 65 29 20 3b 3b 20 0a 09 09 09 20 20  -name) ;; ....  
6210: 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e 4e  (setenv "MT_RUNN
6220: 41 4d 45 22 20 20 20 72 75 6e 6e 61 6d 65 29 0a  AME"   runname).
6230: 09 09 09 20 20 28 73 65 74 2d 6d 65 67 61 74 65  ...  (set-megate
6240: 73 74 2d 65 6e 76 2d 76 61 72 73 20 72 75 6e 2d  st-env-vars run-
6250: 69 64 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79  id) ;; these may
6260: 20 62 65 20 6e 65 65 64 65 64 20 62 79 20 74 68   be needed by th
6270: 65 20 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63  e launching proc
6280: 65 73 73 0a 09 09 09 20 20 28 6c 65 74 20 28 28  ess....  (let ((
6290: 69 74 65 6d 73 2d 6c 69 73 74 20 28 69 74 65 6d  items-list (item
62a0: 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d  s:get-items-from
62b0: 2d 63 6f 6e 66 69 67 20 74 63 6f 6e 66 69 67 29  -config tconfig)
62c0: 29 29 0a 09 09 09 20 20 20 20 28 69 66 20 28 6c  ))....    (if (l
62d0: 69 73 74 3f 20 69 74 65 6d 73 2d 6c 69 73 74 29  ist? items-list)
62e0: 0a 09 09 09 09 28 62 65 67 69 6e 0a 09 09 09 09  .....(begin.....
62f0: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65    (tests:testque
6300: 75 65 2d 73 65 74 2d 69 74 65 6d 73 21 20 74 65  ue-set-items! te
6310: 73 74 2d 72 65 63 6f 72 64 20 69 74 65 6d 73 2d  st-record items-
6320: 6c 69 73 74 29 0a 09 09 09 09 20 20 3b 3b 20 28  list).....  ;; (
6330: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67  thread-sleep! *g
6340: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09  lobal-delta*)...
6350: 09 09 20 20 28 6c 6f 6f 70 20 68 65 64 20 74 61  ..  (loop hed ta
6360: 6c 20 72 65 72 75 6e 73 29 29 0a 09 09 09 09 28  l reruns)).....(
6370: 62 65 67 69 6e 0a 09 09 09 09 20 20 28 64 65 62  begin.....  (deb
6380: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f  ug:print 0 "ERRO
6390: 52 3a 20 54 68 65 20 70 72 6f 63 20 66 72 6f 6d  R: The proc from
63a0: 20 72 65 61 64 69 6e 67 20 74 68 65 20 73 65 74   reading the set
63b0: 75 70 20 64 69 64 20 6e 6f 74 20 79 69 65 6c 64  up did not yield
63c0: 20 61 20 6c 69 73 74 20 2d 20 70 6c 65 61 73 65   a list - please
63d0: 20 72 65 70 6f 72 74 20 74 68 69 73 22 29 0a 09   report this")..
63e0: 09 09 09 20 20 28 65 78 69 74 20 31 29 29 29 29  ...  (exit 1))))
63f0: 29 29 0a 09 09 20 20 20 20 20 20 20 28 28 6e 75  ))...       ((nu
6400: 6c 6c 3f 20 66 61 69 6c 73 29 0a 09 09 09 28 64  ll? fails)....(d
6410: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
6420: 34 20 22 66 61 69 6c 73 20 69 73 20 6e 75 6c 6c  4 "fails is null
6430: 2c 20 6d 6f 76 69 6e 67 20 6f 6e 20 69 6e 20 74  , moving on in t
6440: 68 65 20 71 75 65 75 65 20 62 75 74 20 6b 65 65  he queue but kee
6450: 70 69 6e 67 20 22 20 68 65 64 20 22 20 66 6f 72  ping " hed " for
6460: 20 6e 6f 77 22 29 0a 09 09 09 3b 3b 20 6f 6e 6c   now")....;; onl
6470: 79 20 69 6e 63 72 65 6d 65 6e 74 20 6e 75 6d 2d  y increment num-
6480: 72 65 74 72 69 65 73 20 77 68 65 6e 20 74 68 65  retries when the
6490: 72 65 20 61 72 65 20 6e 6f 20 74 65 73 74 73 20  re are no tests 
64a0: 72 75 6e 69 6e 67 0a 09 09 09 28 69 66 20 28 65  runing....(if (e
64b0: 71 3f 20 30 20 28 6c 69 73 74 2d 72 65 66 20 63  q? 0 (list-ref c
64c0: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 20 31 29 29 0a  an-run-more 1)).
64d0: 09 09 09 20 20 20 20 28 62 65 67 69 6e 0a 09 09  ...    (begin...
64e0: 09 20 20 20 20 20 20 28 69 66 20 28 3e 20 6e 75  .      (if (> nu
64f0: 6d 2d 72 65 74 72 69 65 73 20 31 30 30 29 20 3b  m-retries 100) ;
6500: 3b 20 66 69 72 73 74 20 31 30 30 20 72 65 74 72  ; first 100 retr
6510: 69 65 73 20 61 72 65 20 6c 6f 77 20 74 69 6d 65  ies are low time
6520: 20 63 6f 73 74 0a 09 09 09 09 20 20 28 74 68 72   cost.....  (thr
6530: 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 32 20  ead-sleep! (+ 2 
6540: 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29  *global-delta*))
6550: 0a 09 09 09 09 20 20 28 74 68 72 65 61 64 2d 73  .....  (thread-s
6560: 6c 65 65 70 21 20 28 2b 20 30 2e 30 31 20 2a 67  leep! (+ 0.01 *g
6570: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 29 0a  lobal-delta*))).
6580: 09 09 09 20 20 20 20 20 20 28 73 65 74 21 20 6e  ...      (set! n
6590: 75 6d 2d 72 65 74 72 69 65 73 20 28 2b 20 6e 75  um-retries (+ nu
65a0: 6d 2d 72 65 74 72 69 65 73 20 31 29 29 29 29 0a  m-retries 1)))).
65b0: 09 09 09 28 69 66 20 28 3e 20 6e 75 6d 2d 72 65  ...(if (> num-re
65c0: 74 72 69 65 73 20 20 6d 61 78 2d 72 65 74 72 69  tries  max-retri
65d0: 65 73 29 0a 09 09 09 20 20 20 20 28 69 66 20 28  es)....    (if (
65e0: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29  not (null? tal))
65f0: 0a 09 09 09 09 28 6c 6f 6f 70 20 28 63 61 72 20  .....(loop (car 
6600: 74 61 6c 29 28 63 64 72 20 74 61 6c 29 20 72 65  tal)(cdr tal) re
6610: 72 75 6e 73 29 29 0a 09 09 09 20 20 20 20 28 6c  runs))....    (l
6620: 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61 6c 29  oop (car newtal)
6630: 28 63 64 72 20 6e 65 77 74 61 6c 29 20 72 65 72  (cdr newtal) rer
6640: 75 6e 73 29 29 29 20 3b 3b 20 61 6e 20 69 73 73  uns))) ;; an iss
6650: 75 65 20 77 69 74 68 20 70 72 65 72 65 71 73 20  ue with prereqs 
6660: 6e 6f 74 20 79 65 74 20 6d 65 74 3f 0a 09 09 20  not yet met?... 
6670: 20 20 20 20 20 20 28 28 61 6e 64 20 28 6e 6f 74        ((and (not
6680: 20 28 6e 75 6c 6c 3f 20 66 61 69 6c 73 29 29 28   (null? fails))(
6690: 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 6e 6f  eq? testmode 'no
66a0: 72 6d 61 6c 29 29 0a 09 09 09 28 64 65 62 75 67  rmal))....(debug
66b0: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 74  :print-info 1 "t
66c0: 65 73 74 20 22 20 20 68 65 64 20 22 20 28 6d 6f  est "  hed " (mo
66d0: 64 65 3d 22 20 74 65 73 74 6d 6f 64 65 20 22 29  de=" testmode ")
66e0: 20 68 61 73 20 66 61 69 6c 65 64 20 70 72 65 72   has failed prer
66f0: 65 71 75 69 73 69 74 65 28 73 29 3b 20 22 0a 09  equisite(s); "..
6700: 09 09 09 20 20 20 20 20 28 73 74 72 69 6e 67 2d  ...     (string-
6710: 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61 70  intersperse (map
6720: 20 28 6c 61 6d 62 64 61 20 28 74 29 28 63 6f 6e   (lambda (t)(con
6730: 63 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74  c (db:test-get-t
6740: 65 73 74 6e 61 6d 65 20 74 29 20 22 3a 22 20 28  estname t) ":" (
6750: 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74  db:test-get-stat
6760: 65 20 74 29 22 2f 22 28 64 62 3a 74 65 73 74 2d  e t)"/"(db:test-
6770: 67 65 74 2d 73 74 61 74 75 73 20 74 29 29 29 20  get-status t))) 
6780: 66 61 69 6c 73 29 20 22 2c 20 22 29 0a 09 09 09  fails) ", ")....
6790: 09 20 20 20 20 20 22 2c 20 72 65 6d 6f 76 69 6e  .     ", removin
67a0: 67 20 69 74 20 66 72 6f 6d 20 74 6f 2d 64 6f 20  g it from to-do 
67b0: 6c 69 73 74 22 29 0a 09 09 09 28 69 66 20 28 6e  list")....(if (n
67c0: 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a  ot (null? tal)).
67d0: 09 09 09 20 20 20 20 28 62 65 67 69 6e 0a 20 20  ...    (begin.  
67e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
67f0: 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 28              ;; (
6800: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67  thread-sleep! *g
6810: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09  lobal-delta*)...
6820: 09 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61  .      (loop (ca
6830: 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 28  r tal)(cdr tal)(
6840: 63 6f 6e 73 20 68 65 64 20 72 65 72 75 6e 73 29  cons hed reruns)
6850: 29 29 29 29 0a 09 09 20 20 20 20 20 20 20 28 65  ))))...       (e
6860: 6c 73 65 0a 09 09 09 28 64 65 62 75 67 3a 70 72  lse....(debug:pr
6870: 69 6e 74 20 38 20 22 45 52 52 4f 52 3a 20 4e 6f  int 8 "ERROR: No
6880: 20 68 61 6e 64 6c 65 72 20 66 6f 72 20 74 68 69   handler for thi
6890: 73 20 63 6f 6e 64 69 74 69 6f 6e 2e 22 29 0a 09  s condition.")..
68a0: 09 09 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21  ..(thread-sleep!
68b0: 20 28 2b 20 31 20 2a 67 6c 6f 62 61 6c 2d 64 65   (+ 1 *global-de
68c0: 6c 74 61 2a 29 29 0a 09 09 09 28 6c 6f 6f 70 20  lta*))....(loop 
68d0: 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72  (car newtal)(cdr
68e0: 20 6e 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29   newtal) reruns)
68f0: 29 29 29 20 3b 3b 20 45 4e 44 20 4f 46 20 49 46  ))) ;; END OF IF
6900: 20 43 41 4e 20 52 55 4e 20 4d 4f 52 45 0a 0a 09   CAN RUN MORE...
6910: 09 20 20 20 20 3b 3b 20 69 66 20 63 61 6e 27 74  .    ;; if can't
6920: 20 72 75 6e 20 6d 6f 72 65 20 6a 75 73 74 20 6c   run more just l
6930: 6f 6f 70 20 77 69 74 68 20 6e 65 78 74 20 70 6f  oop with next po
6940: 73 73 69 62 6c 65 20 74 65 73 74 0a 09 09 20 20  ssible test...  
6950: 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20    (begin...     
6960: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
6970: 66 6f 20 34 20 22 70 72 6f 63 65 73 73 69 6e 67  fo 4 "processing
6980: 20 74 68 65 20 63 61 73 65 20 77 69 74 68 20 61   the case with a
6990: 20 6c 61 6d 62 64 61 20 66 6f 72 20 69 74 65 6d   lambda for item
69a0: 73 20 6f 72 20 27 68 61 76 65 2d 70 72 6f 63 65  s or 'have-proce
69b0: 64 75 72 65 2e 20 4d 6f 76 69 6e 67 20 74 68 72  dure. Moving thr
69c0: 6f 75 67 68 20 74 68 65 20 71 75 65 75 65 20 77  ough the queue w
69d0: 69 74 68 6f 75 74 20 64 72 6f 70 70 69 6e 67 20  ithout dropping 
69e0: 22 20 68 65 64 29 0a 09 09 20 20 20 20 20 20 3b  " hed)...      ;
69f0: 3b 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21  ; (thread-sleep!
6a00: 20 28 2b 20 32 20 2a 67 6c 6f 62 61 6c 2d 64 65   (+ 2 *global-de
6a10: 6c 74 61 2a 29 29 0a 09 09 20 20 20 20 20 20 28  lta*))...      (
6a20: 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61 6c  loop (car newtal
6a30: 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20 72 65  )(cdr newtal) re
6a40: 72 75 6e 73 29 29 29 29 29 20 3b 3b 20 45 4e 44  runs))))) ;; END
6a50: 20 4f 46 20 28 6f 72 20 28 70 72 6f 63 65 64 75   OF (or (procedu
6a60: 72 65 3f 20 69 74 65 6d 73 29 28 65 71 3f 20 69  re? items)(eq? i
6a70: 74 65 6d 73 20 27 68 61 76 65 2d 70 72 6f 63 65  tems 'have-proce
6a80: 64 75 72 65 29 29 0a 09 20 20 20 20 20 0a 09 20  dure))..     .. 
6a90: 20 20 20 20 3b 3b 20 74 68 69 73 20 63 61 73 65      ;; this case
6aa0: 20 73 68 6f 75 6c 64 20 6e 6f 74 20 68 61 70 70   should not happ
6ab0: 65 6e 2c 20 61 64 64 65 64 20 74 6f 20 68 65 6c  en, added to hel
6ac0: 70 20 63 61 74 63 68 20 61 6e 79 20 62 75 67 73  p catch any bugs
6ad0: 0a 09 20 20 20 20 20 28 28 61 6e 64 20 28 6c 69  ..     ((and (li
6ae0: 73 74 3f 20 69 74 65 6d 73 29 20 69 74 65 6d 64  st? items) itemd
6af0: 61 74 29 0a 09 20 20 20 20 20 20 28 64 65 62 75  at)..      (debu
6b00: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52  g:print 0 "ERROR
6b10: 3a 20 53 68 6f 75 6c 64 20 6e 6f 74 20 68 61 76  : Should not hav
6b20: 65 20 61 20 6c 69 73 74 20 6f 66 20 69 74 65 6d  e a list of item
6b30: 73 20 69 6e 20 61 20 74 65 73 74 20 61 6e 64 20  s in a test and 
6b40: 74 68 65 20 69 74 65 6d 73 70 61 74 68 20 73 65  the itemspath se
6b50: 74 20 2d 20 70 6c 65 61 73 65 20 72 65 70 6f 72  t - please repor
6b60: 74 20 74 68 69 73 22 29 0a 09 20 20 20 20 20 20  t this")..      
6b70: 28 65 78 69 74 20 31 29 29 0a 09 20 20 20 20 20  (exit 1))..     
6b80: 28 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 72  ((not (null? rer
6b90: 75 6e 73 29 29 0a 09 20 20 20 20 20 20 28 6c 65  uns))..      (le
6ba0: 74 2a 20 28 28 6e 65 77 6c 73 74 20 28 74 65 73  t* ((newlst (tes
6bb0: 74 73 3a 66 69 6c 74 65 72 2d 6e 6f 6e 2d 72 75  ts:filter-non-ru
6bc0: 6e 6e 61 62 6c 65 20 72 75 6e 2d 69 64 20 74 61  nnable run-id ta
6bd0: 6c 20 74 65 73 74 2d 72 65 63 6f 72 64 73 29 29  l test-records))
6be0: 20 3b 3b 20 69 2e 65 2e 20 6e 6f 74 20 46 41 49   ;; i.e. not FAI
6bf0: 4c 2c 20 57 41 49 56 45 44 2c 20 49 4e 43 4f 4d  L, WAIVED, INCOM
6c00: 50 4c 45 54 45 2c 20 50 41 53 53 2c 20 4b 49 4c  PLETE, PASS, KIL
6c10: 4c 45 44 2c 0a 09 09 20 20 20 20 20 28 6a 75 6e  LED,...     (jun
6c20: 6b 65 64 20 28 6c 73 65 74 2d 64 69 66 66 65 72  ked (lset-differ
6c30: 65 6e 63 65 20 65 71 75 61 6c 3f 20 74 61 6c 20  ence equal? tal 
6c40: 6e 65 77 6c 73 74 29 29 29 0a 09 09 28 64 65 62  newlst)))...(deb
6c50: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20  ug:print-info 4 
6c60: 22 66 75 6c 6c 20 64 72 6f 70 20 74 68 72 6f 75  "full drop throu
6c70: 67 68 2c 20 69 66 20 72 65 72 75 6e 73 20 69 73  gh, if reruns is
6c80: 20 6c 65 73 73 20 74 68 61 6e 20 31 30 30 20 77   less than 100 w
6c90: 65 20 77 69 6c 6c 20 66 6f 72 63 65 20 72 65 74  e will force ret
6ca0: 72 79 20 74 68 65 6d 2c 20 72 65 72 75 6e 73 3d  ry them, reruns=
6cb0: 22 20 72 65 72 75 6e 73 20 22 2c 20 74 61 6c 3d  " reruns ", tal=
6cc0: 22 20 74 61 6c 29 0a 09 09 28 69 66 20 28 3c 20  " tal)...(if (< 
6cd0: 6e 75 6d 2d 72 65 74 72 69 65 73 20 6d 61 78 2d  num-retries max-
6ce0: 72 65 74 72 69 65 73 29 0a 09 09 20 20 20 20 28  retries)...    (
6cf0: 73 65 74 21 20 6e 65 77 6c 73 74 20 28 61 70 70  set! newlst (app
6d00: 65 6e 64 20 72 65 72 75 6e 73 20 6e 65 77 6c 73  end reruns newls
6d10: 74 29 29 29 0a 09 09 28 73 65 74 21 20 6e 75 6d  t)))...(set! num
6d20: 2d 72 65 74 72 69 65 73 20 28 2b 20 6e 75 6d 2d  -retries (+ num-
6d30: 72 65 74 72 69 65 73 20 31 29 29 0a 09 09 3b 3b  retries 1))...;;
6d40: 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20   (thread-sleep! 
6d50: 28 2b 20 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c  (+ 1 *global-del
6d60: 74 61 2a 29 29 0a 09 09 28 69 66 20 28 6e 6f 74  ta*))...(if (not
6d70: 20 28 6e 75 6c 6c 3f 20 6e 65 77 6c 73 74 29 29   (null? newlst))
6d80: 0a 09 09 20 20 20 20 3b 3b 20 73 69 6e 63 65 20  ...    ;; since 
6d90: 72 65 72 75 6e 73 20 68 61 76 65 20 62 65 65 6e  reruns have been
6da0: 20 74 61 63 6b 65 64 20 6f 6e 20 74 6f 20 6e 65   tacked on to ne
6db0: 77 6c 73 74 20 63 72 65 61 74 65 20 6e 65 77 20  wlst create new 
6dc0: 72 65 72 75 6e 73 20 66 72 6f 6d 20 6a 75 6e 6b  reruns from junk
6dd0: 65 64 0a 09 09 20 20 20 20 28 6c 6f 6f 70 20 28  ed...    (loop (
6de0: 63 61 72 20 6e 65 77 6c 73 74 29 28 63 64 72 20  car newlst)(cdr 
6df0: 6e 65 77 6c 73 74 29 28 64 65 6c 65 74 65 2d 64  newlst)(delete-d
6e00: 75 70 6c 69 63 61 74 65 73 20 6a 75 6e 6b 65 64  uplicates junked
6e10: 29 29 29 29 29 0a 09 20 20 20 20 20 28 28 6e 6f  )))))..     ((no
6e20: 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09  t (null? tal))..
6e30: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
6e40: 6e 74 2d 69 6e 66 6f 20 34 20 22 49 27 6d 20 70  nt-info 4 "I'm p
6e50: 72 65 74 74 79 20 73 75 72 65 20 49 20 73 68 6f  retty sure I sho
6e60: 75 6c 64 6e 27 74 20 67 65 74 20 68 65 72 65 2e  uldn't get here.
6e70: 22 29 29 0a 09 20 20 20 20 20 28 65 6c 73 65 0a  "))..     (else.
6e80: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72  .      (debug:pr
6e90: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 45 78 69 74  int-info 4 "Exit
6ea0: 69 6e 67 20 6c 6f 6f 70 20 77 69 74 68 2e 2e 2e  ing loop with...
6eb0: 5c 6e 20 20 68 65 64 3d 22 20 68 65 64 20 22 5c  \n  hed=" hed "\
6ec0: 6e 20 20 74 61 6c 3d 22 20 74 61 6c 20 22 5c 6e  n  tal=" tal "\n
6ed0: 20 20 72 65 72 75 6e 73 3d 22 20 72 65 72 75 6e    reruns=" rerun
6ee0: 73 29 29 0a 09 20 20 20 20 20 29 29 29 29 20 3b  s))..     )))) ;
6ef0: 3b 20 4c 45 54 2a 20 28 28 74 65 73 74 2d 72 65  ; LET* ((test-re
6f00: 63 6f 72 64 0a 0a 20 20 20 20 3b 3b 20 77 65 20  cord..    ;; we 
6f10: 67 65 74 20 68 65 72 65 20 6f 6e 20 22 64 72 6f  get here on "dro
6f20: 70 20 74 68 72 6f 75 67 68 22 20 2d 20 6c 6f 6f  p through" - loo
6f30: 70 20 66 6f 72 20 6e 65 78 74 20 74 65 73 74 20  p for next test 
6f40: 69 6e 20 71 75 65 75 65 0a 20 20 20 20 3b 3b 20  in queue.    ;; 
6f50: 46 49 58 4d 45 21 21 21 21 20 54 48 49 53 20 53  FIXME!!!! THIS S
6f60: 48 4f 55 4c 44 20 4e 4f 54 20 52 45 51 55 49 52  HOULD NOT REQUIR
6f70: 45 20 41 4e 20 45 58 49 54 21 21 21 21 21 21 21  E AN EXIT!!!!!!!
6f80: 0a 20 20 20 20 0a 20 20 20 20 28 64 65 62 75 67  .    .    (debug
6f90: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 41  :print-info 1 "A
6fa0: 6c 6c 20 74 65 73 74 73 20 6c 61 75 6e 63 68 65  ll tests launche
6fb0: 64 22 29 0a 20 20 20 20 28 74 68 72 65 61 64 2d  d").    (thread-
6fc0: 73 6c 65 65 70 21 20 30 2e 35 29 0a 20 20 20 20  sleep! 0.5).    
6fd0: 3b 3b 20 46 49 58 4d 45 21 20 54 68 69 73 20 68  ;; FIXME! This h
6fe0: 61 72 73 68 20 65 78 69 74 20 73 68 6f 75 6c 64  arsh exit should
6ff0: 20 6e 6f 74 20 62 65 20 6e 65 63 65 73 73 61 72   not be necessar
7000: 79 2e 2e 2e 2e 0a 20 20 20 20 3b 3b 20 28 69 66  y.....    ;; (if
7010: 20 28 6e 6f 74 20 2a 72 75 6e 72 65 6d 6f 74 65   (not *runremote
7020: 2a 29 28 65 78 69 74 29 29 20 3b 3b 20 0a 20 20  *)(exit)) ;; .  
7030: 20 20 23 66 29 29 20 3b 3b 20 72 65 74 75 72 6e    #f)) ;; return
7040: 20 61 20 23 66 20 61 73 20 61 20 68 69 6e 74 20   a #f as a hint 
7050: 74 68 61 74 20 77 65 20 61 72 65 20 64 6f 6e 65  that we are done
7060: 0a 20 20 3b 3b 20 48 65 72 65 20 77 65 20 6e 65  .  ;; Here we ne
7070: 65 64 20 74 6f 20 63 68 65 63 6b 20 74 68 61 74  ed to check that
7080: 20 61 6c 6c 20 74 68 65 20 74 65 73 74 73 20 72   all the tests r
7090: 65 6d 61 69 6e 69 6e 67 20 74 6f 20 62 65 20 72  emaining to be r
70a0: 75 6e 20 61 72 65 20 65 6c 69 67 69 62 6c 65 20  un are eligible 
70b0: 74 6f 20 72 75 6e 0a 20 20 3b 3b 20 61 6e 64 20  to run.  ;; and 
70c0: 61 72 65 20 6e 6f 74 20 62 6c 6f 63 6b 65 64 20  are not blocked 
70d0: 62 79 20 66 61 69 6c 65 64 0a 20 20 0a 0a 3b 3b  by failed.  ..;;
70e0: 20 70 61 72 65 6e 74 2d 74 65 73 74 20 69 73 20   parent-test is 
70f0: 74 68 65 72 65 20 61 73 20 61 20 70 6c 61 63 65  there as a place
7100: 68 6f 6c 64 65 72 20 66 6f 72 20 77 68 65 6e 20  holder for when 
7110: 70 61 72 65 6e 74 2d 74 65 73 74 73 20 63 61 6e  parent-tests can
7120: 20 62 65 20 72 75 6e 20 61 73 20 61 20 73 65 74   be run as a set
7130: 75 70 20 73 74 65 70 0a 28 64 65 66 69 6e 65 20  up step.(define 
7140: 28 72 75 6e 3a 74 65 73 74 20 72 75 6e 2d 69 64  (run:test run-id
7150: 20 72 75 6e 6e 61 6d 65 20 6b 65 79 76 61 6c 6c   runname keyvall
7160: 73 74 20 74 65 73 74 2d 72 65 63 6f 72 64 20 66  st test-record f
7170: 6c 61 67 73 20 70 61 72 65 6e 74 2d 74 65 73 74  lags parent-test
7180: 29 0a 20 20 3b 3b 20 41 6c 6c 20 74 68 65 73 65  ).  ;; All these
7190: 20 76 61 72 73 20 6d 69 67 68 74 20 62 65 20 72   vars might be r
71a0: 65 66 65 72 65 6e 63 65 64 20 62 79 20 74 68 65  eferenced by the
71b0: 20 74 65 73 74 63 6f 6e 66 69 67 20 66 69 6c 65   testconfig file
71c0: 20 72 65 61 64 65 72 0a 20 20 28 6c 65 74 2a 20   reader.  (let* 
71d0: 28 28 74 65 73 74 2d 6e 61 6d 65 20 20 20 20 28  ((test-name    (
71e0: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
71f0: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 20 20 74  get-testname   t
7200: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28  est-record)).. (
7210: 74 65 73 74 2d 77 61 69 74 6f 6e 73 20 28 74 65  test-waitons (te
7220: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65  sts:testqueue-ge
7230: 74 2d 77 61 69 74 6f 6e 73 20 20 20 20 74 65 73  t-waitons    tes
7240: 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65  t-record)).. (te
7250: 73 74 2d 63 6f 6e 66 20 20 20 20 28 74 65 73 74  st-conf    (test
7260: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d  s:testqueue-get-
7270: 74 65 73 74 63 6f 6e 66 69 67 20 74 65 73 74 2d  testconfig test-
7280: 72 65 63 6f 72 64 29 29 0a 09 20 28 69 74 65 6d  record)).. (item
7290: 64 61 74 20 20 20 20 20 20 28 74 65 73 74 73 3a  dat      (tests:
72a0: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74  testqueue-get-it
72b0: 65 6d 64 61 74 20 20 20 20 74 65 73 74 2d 72 65  emdat    test-re
72c0: 63 6f 72 64 29 29 0a 09 20 28 74 65 73 74 2d 70  cord)).. (test-p
72d0: 61 74 68 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f  ath    (conc *to
72e0: 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 22  ppath* "/tests/"
72f0: 20 74 65 73 74 2d 6e 61 6d 65 29 29 20 3b 3b 20   test-name)) ;; 
7300: 63 6f 75 6c 64 20 75 73 65 20 74 65 73 74 73 3a  could use tests:
7310: 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 68  get-testconfig h
7320: 65 72 65 20 2e 2e 2e 0a 09 20 28 66 6f 72 63 65  ere ..... (force
7330: 20 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 61          (hash-ta
7340: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20  ble-ref/default 
7350: 66 6c 61 67 73 20 22 2d 66 6f 72 63 65 22 20 23  flags "-force" #
7360: 66 29 29 0a 09 20 28 72 65 72 75 6e 20 20 20 20  f)).. (rerun    
7370: 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d      (hash-table-
7380: 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67  ref/default flag
7390: 73 20 22 2d 72 65 72 75 6e 22 20 23 66 29 29 0a  s "-rerun" #f)).
73a0: 09 20 28 6b 65 65 70 67 6f 69 6e 67 20 20 20 20  . (keepgoing    
73b0: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f  (hash-table-ref/
73c0: 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d  default flags "-
73d0: 6b 65 65 70 67 6f 69 6e 67 22 20 23 66 29 29 0a  keepgoing" #f)).
73e0: 09 20 28 69 74 65 6d 2d 70 61 74 68 20 20 20 20  . (item-path    
73f0: 20 22 22 29 0a 09 20 28 64 62 20 20 20 20 20 20   "").. (db      
7400: 20 20 20 20 20 23 66 29 29 0a 20 20 20 20 28 64       #f)).    (d
7410: 65 62 75 67 3a 70 72 69 6e 74 20 34 0a 09 09 20  ebug:print 4... 
7420: 22 74 65 73 74 2d 63 6f 6e 66 69 67 3a 20 22 20  "test-config: " 
7430: 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61 6c 69  (hash-table->ali
7440: 73 74 20 74 65 73 74 2d 63 6f 6e 66 29 0a 09 09  st test-conf)...
7450: 20 22 5c 6e 20 20 20 69 74 65 6d 64 61 74 3a 20   "\n   itemdat: 
7460: 22 20 69 74 65 6d 64 61 74 0a 09 09 20 29 0a 20  " itemdat... ). 
7470: 20 20 20 3b 3b 20 73 65 74 74 69 6e 67 20 69 74     ;; setting it
7480: 65 6d 64 61 74 20 74 6f 20 61 20 6c 69 73 74 20  emdat to a list 
7490: 69 66 20 69 74 20 69 73 20 23 66 0a 20 20 20 20  if it is #f.    
74a0: 28 69 66 20 28 6e 6f 74 20 69 74 65 6d 64 61 74  (if (not itemdat
74b0: 29 28 73 65 74 21 20 69 74 65 6d 64 61 74 20 27  )(set! itemdat '
74c0: 28 29 29 29 0a 20 20 20 20 28 73 65 74 21 20 69  ())).    (set! i
74d0: 74 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c  tem-path (item-l
74e0: 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61  ist->path itemda
74f0: 74 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70  t)).    (debug:p
7500: 72 69 6e 74 20 32 20 22 41 74 74 65 6d 70 74 69  rint 2 "Attempti
7510: 6e 67 20 74 6f 20 6c 61 75 6e 63 68 20 74 65 73  ng to launch tes
7520: 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 28 69  t " test-name (i
7530: 66 20 28 65 71 75 61 6c 3f 20 69 74 65 6d 2d 70  f (equal? item-p
7540: 61 74 68 20 22 2f 22 29 20 22 2f 22 20 69 74 65  ath "/") "/" ite
7550: 6d 2d 70 61 74 68 29 29 0a 20 20 20 20 28 73 65  m-path)).    (se
7560: 74 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41  tenv "MT_TEST_NA
7570: 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b  ME" test-name) ;
7580: 3b 20 0a 20 20 20 20 28 73 65 74 65 6e 76 20 22  ; .    (setenv "
7590: 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20 72 75  MT_RUNNAME"   ru
75a0: 6e 6e 61 6d 65 29 0a 20 20 20 20 28 73 65 74 2d  nname).    (set-
75b0: 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72  megatest-env-var
75c0: 73 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65  s run-id) ;; the
75d0: 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64  se may be needed
75e0: 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e   by the launchin
75f0: 67 20 70 72 6f 63 65 73 73 0a 20 20 20 20 28 63  g process.    (c
7600: 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 79 20  hange-directory 
7610: 2a 74 6f 70 70 61 74 68 2a 29 0a 0a 20 20 20 20  *toppath*)..    
7620: 3b 3b 20 48 65 72 65 20 69 73 20 77 68 65 72 65  ;; Here is where
7630: 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61 20 74   the test_meta t
7640: 61 62 6c 65 20 69 73 20 62 65 73 74 20 75 70 64  able is best upd
7650: 61 74 65 64 0a 20 20 20 20 3b 3b 20 59 65 73 2c  ated.    ;; Yes,
7660: 20 61 6e 6f 74 68 65 72 20 75 73 65 20 6f 66 20   another use of 
7670: 61 20 67 6c 6f 62 61 6c 20 66 6f 72 20 63 61 63  a global for cac
7680: 68 69 6e 67 2e 20 4e 65 65 64 20 61 20 62 65 74  hing. Need a bet
7690: 74 65 72 20 77 61 79 3f 0a 20 20 20 20 28 69 66  ter way?.    (if
76a0: 20 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 62 6c   (not (hash-tabl
76b0: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 2a 74  e-ref/default *t
76c0: 65 73 74 2d 6d 65 74 61 2d 75 70 64 61 74 65 64  est-meta-updated
76d0: 2a 20 74 65 73 74 2d 6e 61 6d 65 20 23 66 29 29  * test-name #f))
76e0: 0a 20 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a  .        (begin.
76f0: 09 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d  .   (hash-table-
7700: 73 65 74 21 20 2a 74 65 73 74 2d 6d 65 74 61 2d  set! *test-meta-
7710: 75 70 64 61 74 65 64 2a 20 74 65 73 74 2d 6e 61  updated* test-na
7720: 6d 65 20 23 74 29 0a 20 20 20 20 20 20 20 20 20  me #t).         
7730: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73    (open-run-clos
7740: 65 20 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65  e runs:update-te
7750: 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74 2d  st_meta db test-
7760: 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 29  name test-conf))
7770: 29 0a 20 20 20 20 0a 20 20 20 20 3b 3b 20 28 6c  ).    .    ;; (l
7780: 61 6d 62 64 61 20 28 69 74 65 6d 64 61 74 29 20  ambda (itemdat) 
7790: 3b 3b 3b 20 28 28 72 69 70 65 6e 65 73 73 20 22  ;;; ((ripeness "
77a0: 6f 76 65 72 72 69 70 65 22 29 20 28 74 65 6d 70  overripe") (temp
77b0: 65 72 61 74 75 72 65 20 22 63 6f 6f 6c 22 29 20  erature "cool") 
77c0: 28 73 65 61 73 6f 6e 20 22 73 75 6d 6d 65 72 22  (season "summer"
77d0: 29 29 0a 20 20 20 20 28 6c 65 74 2a 20 28 28 6e  )).    (let* ((n
77e0: 65 77 2d 74 65 73 74 2d 70 61 74 68 20 28 73 74  ew-test-path (st
77f0: 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65  ring-intersperse
7800: 20 28 63 6f 6e 73 20 74 65 73 74 2d 70 61 74 68   (cons test-path
7810: 20 28 6d 61 70 20 63 61 64 72 20 69 74 65 6d 64   (map cadr itemd
7820: 61 74 29 29 20 22 2f 22 29 29 0a 09 20 20 20 28  at)) "/"))..   (
7830: 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 28 69  new-test-name (i
7840: 66 20 28 65 71 75 61 6c 3f 20 69 74 65 6d 2d 70  f (equal? item-p
7850: 61 74 68 20 22 22 29 20 74 65 73 74 2d 6e 61 6d  ath "") test-nam
7860: 65 20 28 63 6f 6e 63 20 74 65 73 74 2d 6e 61 6d  e (conc test-nam
7870: 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29  e "/" item-path)
7880: 29 29 20 3b 3b 20 6a 75 73 74 20 6e 65 65 64 20  )) ;; just need 
7890: 69 74 20 74 6f 20 62 65 20 75 6e 69 71 75 65 0a  it to be unique.
78a0: 09 20 20 20 28 74 65 73 74 2d 69 64 20 20 20 20  .   (test-id    
78b0: 20 20 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72     (cdb:remote-r
78c0: 75 6e 20 64 62 3a 67 65 74 2d 74 65 73 74 2d 69  un db:get-test-i
78d0: 64 20 23 66 20 20 72 75 6e 2d 69 64 20 74 65 73  d #f  run-id tes
78e0: 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68  t-name item-path
78f0: 29 29 0a 09 20 20 20 28 74 65 73 74 64 61 74 20  ))..   (testdat 
7900: 20 20 20 20 20 20 28 63 64 62 3a 67 65 74 2d 74        (cdb:get-t
7910: 65 73 74 2d 69 6e 66 6f 2d 62 79 2d 69 64 20 2a  est-info-by-id *
7920: 72 75 6e 72 65 6d 6f 74 65 2a 20 74 65 73 74 2d  runremote* test-
7930: 69 64 29 29 29 0a 20 20 20 20 20 20 28 69 66 20  id))).      (if 
7940: 28 6e 6f 74 20 74 65 73 74 64 61 74 29 0a 09 20  (not testdat).. 
7950: 20 28 62 65 67 69 6e 0a 09 20 20 20 20 3b 3b 20   (begin..    ;; 
7960: 65 6e 73 75 72 65 20 74 68 61 74 20 74 68 65 20  ensure that the 
7970: 70 61 74 68 20 65 78 69 73 74 73 20 62 65 66 6f  path exists befo
7980: 72 65 20 72 65 67 69 73 74 65 72 69 6e 67 20 74  re registering t
7990: 68 65 20 74 65 73 74 0a 09 20 20 20 20 3b 3b 20  he test..    ;; 
79a0: 4e 4f 50 45 3a 20 43 61 6e 6e 6f 74 21 20 44 6f  NOPE: Cannot! Do
79b0: 6e 27 74 20 6b 6e 6f 77 20 79 65 74 20 77 68 69  n't know yet whi
79c0: 63 68 20 64 69 73 6b 20 61 72 65 61 20 77 69 6c  ch disk area wil
79d0: 6c 20 62 65 20 61 73 73 69 67 6e 65 64 2e 2e 2e  l be assigned...
79e0: 2e 0a 09 20 20 20 20 3b 3b 20 28 73 79 73 74 65  ...    ;; (syste
79f0: 6d 20 28 63 6f 6e 63 20 22 6d 6b 64 69 72 20 2d  m (conc "mkdir -
7a00: 70 20 22 20 6e 65 77 2d 74 65 73 74 2d 70 61 74  p " new-test-pat
7a10: 68 29 29 0a 09 20 20 20 20 3b 3b 0a 09 20 20 20  h))..    ;;..   
7a20: 20 3b 3b 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c   ;; (open-run-cl
7a30: 6f 73 65 20 74 65 73 74 73 3a 72 65 67 69 73 74  ose tests:regist
7a40: 65 72 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69  er-test db run-i
7a50: 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d  d test-name item
7a60: 2d 70 61 74 68 29 0a 09 20 20 20 20 3b 3b 0a 09  -path)..    ;;..
7a70: 20 20 20 20 3b 3b 20 4e 42 2f 2f 20 66 6f 72 20      ;; NB// for 
7a80: 74 68 65 20 61 62 6f 76 65 20 6c 69 6e 65 2e 20  the above line. 
7a90: 49 20 77 61 6e 74 20 74 68 65 20 74 65 73 74 20  I want the test 
7aa0: 74 6f 20 62 65 20 72 65 67 69 73 74 65 72 65 64  to be registered
7ab0: 20 6c 6f 6e 67 20 62 65 66 6f 72 65 20 74 68 69   long before thi
7ac0: 73 20 72 6f 75 74 69 6e 65 20 67 65 74 73 20 63  s routine gets c
7ad0: 61 6c 6c 65 64 21 0a 09 20 20 20 20 3b 3b 0a 09  alled!..    ;;..
7ae0: 20 20 20 20 28 73 65 74 21 20 74 65 73 74 2d 69      (set! test-i
7af0: 64 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73  d (open-run-clos
7b00: 65 20 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 64  e db:get-test-id
7b10: 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d   db run-id test-
7b20: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29  name item-path))
7b30: 0a 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20 74  ..    (if (not t
7b40: 65 73 74 2d 69 64 29 0a 09 09 28 62 65 67 69 6e  est-id)...(begin
7b50: 0a 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e  ...  (debug:prin
7b60: 74 20 32 20 22 57 41 52 4e 3a 20 54 65 73 74 20  t 2 "WARN: Test 
7b70: 6e 6f 74 20 70 72 65 2d 63 72 65 61 74 65 64 3f  not pre-created?
7b80: 20 74 65 73 74 2d 6e 61 6d 65 3d 22 20 74 65 73   test-name=" tes
7b90: 74 2d 6e 61 6d 65 20 22 2c 20 69 74 65 6d 2d 70  t-name ", item-p
7ba0: 61 74 68 3d 22 20 69 74 65 6d 2d 70 61 74 68 20  ath=" item-path 
7bb0: 22 2c 20 72 75 6e 2d 69 64 3d 22 20 72 75 6e 2d  ", run-id=" run-
7bc0: 69 64 29 0a 09 09 20 20 28 63 64 62 3a 74 65 73  id)...  (cdb:tes
7bd0: 74 73 2d 72 65 67 69 73 74 65 72 2d 74 65 73 74  ts-register-test
7be0: 20 2a 72 75 6e 72 65 6d 6f 74 65 2a 20 72 75 6e   *runremote* run
7bf0: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74  -id test-name it
7c00: 65 6d 2d 70 61 74 68 29 0a 09 09 20 20 28 73 65  em-path)...  (se
7c10: 74 21 20 74 65 73 74 2d 69 64 20 28 6f 70 65 6e  t! test-id (open
7c20: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65  -run-close db:ge
7c30: 74 2d 74 65 73 74 2d 69 64 20 64 62 20 72 75 6e  t-test-id db run
7c40: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74  -id test-name it
7c50: 65 6d 2d 70 61 74 68 29 29 29 29 0a 09 20 20 20  em-path))))..   
7c60: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
7c70: 66 6f 20 34 20 22 74 65 73 74 2d 69 64 3d 22 20  fo 4 "test-id=" 
7c80: 74 65 73 74 2d 69 64 20 22 2c 20 72 75 6e 2d 69  test-id ", run-i
7c90: 64 3d 22 20 72 75 6e 2d 69 64 20 22 2c 20 74 65  d=" run-id ", te
7ca0: 73 74 2d 6e 61 6d 65 3d 22 20 74 65 73 74 2d 6e  st-name=" test-n
7cb0: 61 6d 65 20 22 2c 20 69 74 65 6d 2d 70 61 74 68  ame ", item-path
7cc0: 3d 5c 22 22 20 69 74 65 6d 2d 70 61 74 68 20 22  =\"" item-path "
7cd0: 5c 22 22 29 0a 09 20 20 20 20 28 73 65 74 21 20  \"")..    (set! 
7ce0: 74 65 73 74 64 61 74 20 28 63 64 62 3a 67 65 74  testdat (cdb:get
7cf0: 2d 74 65 73 74 2d 69 6e 66 6f 2d 62 79 2d 69 64  -test-info-by-id
7d00: 20 2a 72 75 6e 72 65 6d 6f 74 65 2a 20 74 65 73   *runremote* tes
7d10: 74 2d 69 64 29 29 29 29 0a 20 20 20 20 20 20 28  t-id)))).      (
7d20: 73 65 74 21 20 74 65 73 74 2d 69 64 20 28 64 62  set! test-id (db
7d30: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73  :test-get-id tes
7d40: 74 64 61 74 29 29 0a 20 20 20 20 20 20 28 63 68  tdat)).      (ch
7d50: 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 79 20 74  ange-directory t
7d60: 65 73 74 2d 70 61 74 68 29 0a 20 20 20 20 20 20  est-path).      
7d70: 28 63 61 73 65 20 28 69 66 20 66 6f 72 63 65 20  (case (if force 
7d80: 3b 3b 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  ;; (args:get-arg
7d90: 20 22 2d 66 6f 72 63 65 22 29 0a 09 09 27 4e 4f   "-force")...'NO
7da0: 54 5f 53 54 41 52 54 45 44 0a 09 09 28 69 66 20  T_STARTED...(if 
7db0: 74 65 73 74 64 61 74 0a 09 09 20 20 20 20 28 73  testdat...    (s
7dc0: 74 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c 20 28 74  tring->symbol (t
7dd0: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65  est:get-state te
7de0: 73 74 64 61 74 29 29 0a 09 09 20 20 20 20 27 66  stdat))...    'f
7df0: 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 72 74 29  ailed-to-insert)
7e00: 29 0a 09 28 28 66 61 69 6c 65 64 2d 74 6f 2d 69  )..((failed-to-i
7e10: 6e 73 65 72 74 29 0a 09 20 28 64 65 62 75 67 3a  nsert).. (debug:
7e20: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
7e30: 46 61 69 6c 65 64 20 74 6f 20 69 6e 73 65 72 74  Failed to insert
7e40: 20 74 68 65 20 72 65 63 6f 72 64 20 69 6e 74 6f   the record into
7e50: 20 74 68 65 20 64 62 22 29 29 0a 09 28 28 4e 4f   the db"))..((NO
7e60: 54 5f 53 54 41 52 54 45 44 20 43 4f 4d 50 4c 45  T_STARTED COMPLE
7e70: 54 45 44 20 44 45 4c 45 54 45 44 29 0a 09 20 28  TED DELETED).. (
7e80: 6c 65 74 20 28 28 72 75 6e 66 6c 61 67 20 23 66  let ((runflag #f
7e90: 29 29 0a 09 20 20 20 28 63 6f 6e 64 0a 09 20 20  ))..   (cond..  
7ea0: 20 20 3b 3b 20 2d 66 6f 72 63 65 2c 20 72 75 6e    ;; -force, run
7eb0: 20 6e 6f 20 6d 61 74 74 65 72 20 77 68 61 74 0a   no matter what.
7ec0: 09 20 20 20 20 28 66 6f 72 63 65 20 28 73 65 74  .    (force (set
7ed0: 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09  ! runflag #t))..
7ee0: 20 20 20 20 3b 3b 20 4e 4f 54 5f 53 54 41 52 54      ;; NOT_START
7ef0: 45 44 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65  ED, run no matte
7f00: 72 20 77 68 61 74 0a 09 20 20 20 20 28 28 6d 65  r what..    ((me
7f10: 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73  mber (test:get-s
7f20: 74 61 74 65 20 74 65 73 74 64 61 74 29 20 27 28  tate testdat) '(
7f30: 22 44 45 4c 45 54 45 44 22 20 22 4e 4f 54 5f 53  "DELETED" "NOT_S
7f40: 54 41 52 54 45 44 22 29 29 28 73 65 74 21 20 72  TARTED"))(set! r
7f50: 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20  unflag #t))..   
7f60: 20 3b 3b 20 6e 6f 74 20 2d 72 65 72 75 6e 20 61   ;; not -rerun a
7f70: 6e 64 20 50 41 53 53 2c 20 57 41 52 4e 20 6f 72  nd PASS, WARN or
7f80: 20 43 48 45 43 4b 2c 20 64 6f 20 6e 6f 20 72 75   CHECK, do no ru
7f90: 6e 0a 09 20 20 20 20 28 28 61 6e 64 20 28 6f 72  n..    ((and (or
7fa0: 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09 20   (not rerun)... 
7fb0: 20 20 20 20 20 6b 65 65 70 67 6f 69 6e 67 29 0a       keepgoing).
7fc0: 09 09 20 20 3b 3b 20 52 65 71 75 69 72 65 20 74  ..  ;; Require t
7fd0: 6f 20 66 6f 72 63 65 20 72 65 2d 72 75 6e 20 66  o force re-run f
7fe0: 6f 72 20 43 4f 4d 50 4c 45 54 45 44 20 6f 72 20  or COMPLETED or 
7ff0: 2a 61 6e 79 74 68 69 6e 67 2a 20 2b 20 50 41 53  *anything* + PAS
8000: 53 2c 57 41 52 4e 20 6f 72 20 43 48 45 43 4b 0a  S,WARN or CHECK.
8010: 09 09 20 20 28 6f 72 20 28 6d 65 6d 62 65 72 20  ..  (or (member 
8020: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73  (test:get-status
8030: 20 74 65 73 74 64 61 74 29 20 27 28 22 50 41 53   testdat) '("PAS
8040: 53 22 20 22 57 41 52 4e 22 20 22 43 48 45 43 4b  S" "WARN" "CHECK
8050: 22 20 22 53 4b 49 50 22 29 29 0a 09 09 20 20 20  " "SKIP"))...   
8060: 20 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74     (member (test
8070: 3a 67 65 74 2d 73 74 61 74 65 20 20 74 65 73 74  :get-state  test
8080: 64 61 74 29 20 27 28 22 43 4f 4d 50 4c 45 54 45  dat) '("COMPLETE
8090: 44 22 29 29 29 29 20 0a 09 20 20 20 20 20 28 64  D")))) ..     (d
80a0: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
80b0: 32 20 22 72 75 6e 6e 69 6e 67 20 74 65 73 74 20  2 "running test 
80c0: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20  " test-name "/" 
80d0: 69 74 65 6d 2d 70 61 74 68 20 22 20 73 75 70 70  item-path " supp
80e0: 72 65 73 73 65 64 20 61 73 20 69 74 20 69 73 20  ressed as it is 
80f0: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  " (test:get-stat
8100: 65 20 74 65 73 74 64 61 74 29 20 22 20 61 6e 64  e testdat) " and
8110: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61   " (test:get-sta
8120: 74 75 73 20 74 65 73 74 64 61 74 29 29 0a 09 20  tus testdat)).. 
8130: 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61      (set! runfla
8140: 67 20 23 66 29 29 0a 09 20 20 20 20 3b 3b 20 2d  g #f))..    ;; -
8150: 72 65 72 75 6e 20 61 6e 64 20 73 74 61 74 75 73  rerun and status
8160: 20 69 73 20 6f 6e 65 20 6f 66 20 74 68 65 20 73   is one of the s
8170: 70 65 63 69 66 65 64 2c 20 72 75 6e 20 69 74 0a  pecifed, run it.
8180: 09 20 20 20 20 28 28 61 6e 64 20 72 65 72 75 6e  .    ((and rerun
8190: 0a 09 09 20 20 28 6c 65 74 2a 20 28 28 72 65 72  ...  (let* ((rer
81a0: 75 6e 6c 73 74 20 20 20 28 73 74 72 69 6e 67 2d  unlst   (string-
81b0: 73 70 6c 69 74 20 72 65 72 75 6e 20 22 2c 22 29  split rerun ",")
81c0: 29 0a 09 09 09 20 28 6d 75 73 74 2d 72 65 72 75  ).... (must-reru
81d0: 6e 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a  n (member (test:
81e0: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64  get-status testd
81f0: 61 74 29 20 72 65 72 75 6e 6c 73 74 29 29 29 0a  at) rerunlst))).
8200: 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ..    (debug:pri
8210: 6e 74 2d 69 6e 66 6f 20 33 20 22 2d 72 65 72 75  nt-info 3 "-reru
8220: 6e 20 6c 69 73 74 3a 20 22 20 72 65 72 75 6e 20  n list: " rerun 
8230: 22 2c 20 74 65 73 74 2d 73 74 61 74 75 73 3a 20  ", test-status: 
8240: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  " (test:get-stat
8250: 75 73 20 74 65 73 74 64 61 74 29 22 2c 20 6d 75  us testdat)", mu
8260: 73 74 2d 72 65 72 75 6e 3a 20 22 20 6d 75 73 74  st-rerun: " must
8270: 2d 72 65 72 75 6e 29 0a 09 09 20 20 20 20 6d 75  -rerun)...    mu
8280: 73 74 2d 72 65 72 75 6e 29 29 0a 09 20 20 20 20  st-rerun))..    
8290: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
82a0: 66 6f 20 32 20 22 52 65 72 75 6e 20 66 6f 72 63  fo 2 "Rerun forc
82b0: 65 64 20 66 6f 72 20 74 65 73 74 20 22 20 74 65  ed for test " te
82c0: 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d  st-name "/" item
82d0: 2d 70 61 74 68 29 0a 09 20 20 20 20 20 28 73 65  -path)..     (se
82e0: 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a  t! runflag #t)).
82f0: 09 20 20 20 20 3b 3b 20 2d 6b 65 65 70 67 6f 69  .    ;; -keepgoi
8300: 6e 67 2c 20 64 6f 20 6e 6f 74 20 72 65 72 75 6e  ng, do not rerun
8310: 20 46 41 49 4c 0a 09 20 20 20 20 28 28 61 6e 64   FAIL..    ((and
8320: 20 6b 65 65 70 67 6f 69 6e 67 0a 09 09 20 20 28   keepgoing...  (
8330: 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74  member (test:get
8340: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29  -status testdat)
8350: 20 27 28 22 46 41 49 4c 22 29 29 29 0a 09 20 20   '("FAIL")))..  
8360: 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67     (set! runflag
8370: 20 23 66 29 29 0a 09 20 20 20 20 28 28 61 6e 64   #f))..    ((and
8380: 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09 20   (not rerun)... 
8390: 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67   (member (test:g
83a0: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61  et-status testda
83b0: 74 29 20 27 28 22 46 41 49 4c 22 20 22 6e 2f 61  t) '("FAIL" "n/a
83c0: 22 29 29 29 0a 09 20 20 20 20 20 28 73 65 74 21  ")))..     (set!
83d0: 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20   runflag #t)).. 
83e0: 20 20 20 28 65 6c 73 65 20 28 73 65 74 21 20 72     (else (set! r
83f0: 75 6e 66 6c 61 67 20 23 66 29 29 29 0a 09 20 20  unflag #f)))..  
8400: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 36 20   (debug:print 6 
8410: 22 52 55 4e 4e 49 4e 47 20 3d 3e 20 72 75 6e 66  "RUNNING => runf
8420: 6c 61 67 3a 20 22 20 72 75 6e 66 6c 61 67 20 22  lag: " runflag "
8430: 20 53 54 41 54 45 3a 20 22 20 28 74 65 73 74 3a   STATE: " (test:
8440: 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61  get-state testda
8450: 74 29 20 22 20 53 54 41 54 55 53 3a 20 22 20 28  t) " STATUS: " (
8460: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20  test:get-status 
8470: 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 28 69  testdat))..   (i
8480: 66 20 28 6e 6f 74 20 72 75 6e 66 6c 61 67 29 0a  f (not runflag).
8490: 09 20 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74  .       (if (not
84a0: 20 70 61 72 65 6e 74 2d 74 65 73 74 29 0a 09 09   parent-test)...
84b0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
84c0: 31 20 22 4e 4f 54 45 3a 20 4e 6f 74 20 73 74 61  1 "NOTE: Not sta
84d0: 72 74 69 6e 67 20 74 65 73 74 20 22 20 6e 65 77  rting test " new
84e0: 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 73 20  -test-name " as 
84f0: 69 74 20 69 73 20 73 74 61 74 65 20 5c 22 22 20  it is state \"" 
8500: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20  (test:get-state 
8510: 74 65 73 74 64 61 74 29 20 0a 09 09 09 09 22 5c  testdat) ....."\
8520: 22 20 61 6e 64 20 73 74 61 74 75 73 20 5c 22 22  " and status \""
8530: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75   (test:get-statu
8540: 73 20 74 65 73 74 64 61 74 29 20 22 5c 22 2c 20  s testdat) "\", 
8550: 75 73 65 20 2d 72 65 72 75 6e 20 5c 22 22 20 28  use -rerun \"" (
8560: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20  test:get-status 
8570: 74 65 73 74 64 61 74 29 0a 20 20 20 20 20 20 20  testdat).       
8580: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
8590: 20 20 20 20 20 20 20 20 20 22 5c 22 20 6f 72 20           "\" or 
85a0: 2d 66 6f 72 63 65 20 74 6f 20 6f 76 65 72 72 69  -force to overri
85b0: 64 65 22 29 29 0a 09 20 20 20 20 20 20 20 3b 3b  de"))..       ;;
85c0: 20 4e 4f 54 45 3a 20 4e 6f 20 6c 6f 6e 67 65 72   NOTE: No longer
85d0: 20 62 65 20 63 68 65 63 6b 69 6e 67 20 70 72 65   be checking pre
85e0: 72 65 71 75 69 73 69 74 65 73 20 68 65 72 65 21  requisites here!
85f0: 20 57 69 6c 6c 20 6e 65 76 65 72 20 67 65 74 20   Will never get 
8600: 68 65 72 65 20 75 6e 6c 65 73 73 20 70 72 65 72  here unless prer
8610: 65 71 73 20 61 72 65 0a 09 20 20 20 20 20 20 20  eqs are..       
8620: 3b 3b 20 20 20 20 20 20 20 61 6c 72 65 61 64 79  ;;       already
8630: 20 6d 65 74 2e 0a 09 20 20 20 20 20 20 20 28 69   met...       (i
8640: 66 20 28 6e 6f 74 20 28 6c 61 75 6e 63 68 2d 74  f (not (launch-t
8650: 65 73 74 20 23 66 20 72 75 6e 2d 69 64 20 72 75  est #f run-id ru
8660: 6e 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 20  nname test-conf 
8670: 6b 65 79 76 61 6c 6c 73 74 20 74 65 73 74 2d 6e  keyvallst test-n
8680: 61 6d 65 20 74 65 73 74 2d 70 61 74 68 20 69 74  ame test-path it
8690: 65 6d 64 61 74 20 66 6c 61 67 73 29 29 0a 09 09  emdat flags))...
86a0: 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20     (begin...    
86b0: 20 28 70 72 69 6e 74 20 22 45 52 52 4f 52 3a 20   (print "ERROR: 
86c0: 46 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68  Failed to launch
86d0: 20 74 68 65 20 74 65 73 74 2e 20 45 78 69 74 69   the test. Exiti
86e0: 6e 67 20 61 73 20 73 6f 6f 6e 20 61 73 20 70 6f  ng as soon as po
86f0: 73 73 69 62 6c 65 22 29 0a 09 09 20 20 20 20 20  ssible")...     
8700: 28 73 65 74 21 20 2a 67 6c 6f 62 61 6c 65 78 69  (set! *globalexi
8710: 74 73 74 61 74 75 73 2a 20 31 29 20 3b 3b 20 0a  tstatus* 1) ;; .
8720: 09 09 20 20 20 20 20 28 70 72 6f 63 65 73 73 2d  ..     (process-
8730: 73 69 67 6e 61 6c 20 28 63 75 72 72 65 6e 74 2d  signal (current-
8740: 70 72 6f 63 65 73 73 2d 69 64 29 20 73 69 67 6e  process-id) sign
8750: 61 6c 2f 6b 69 6c 6c 29 29 29 29 29 29 0a 09 28  al/kill))))))..(
8760: 28 4b 49 4c 4c 45 44 29 20 0a 09 20 28 64 65 62  (KILLED) .. (deb
8770: 75 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 45  ug:print 1 "NOTE
8780: 3a 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d  : " new-test-nam
8790: 65 20 22 20 69 73 20 61 6c 72 65 61 64 79 20 72  e " is already r
87a0: 75 6e 6e 69 6e 67 20 6f 72 20 77 61 73 20 65 78  unning or was ex
87b0: 70 6c 69 63 74 6c 79 20 6b 69 6c 6c 65 64 2c 20  plictly killed, 
87c0: 75 73 65 20 2d 66 6f 72 63 65 20 74 6f 20 6c 61  use -force to la
87d0: 75 6e 63 68 20 69 74 2e 22 29 29 0a 09 28 28 4c  unch it."))..((L
87e0: 41 55 4e 43 48 45 44 20 52 45 4d 4f 54 45 48 4f  AUNCHED REMOTEHO
87f0: 53 54 53 54 41 52 54 20 52 55 4e 4e 49 4e 47 29  STSTART RUNNING)
8800: 20 20 0a 09 20 28 69 66 20 28 3e 20 28 2d 20 28    .. (if (> (- (
8810: 63 75 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73 29  current-seconds)
8820: 28 2b 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  (+ (db:test-get-
8830: 65 76 65 6e 74 5f 74 69 6d 65 20 74 65 73 74 64  event_time testd
8840: 61 74 29 0a 09 09 09 09 20 20 20 20 20 20 20 28  at).....       (
8850: 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 5f  db:test-get-run_
8860: 64 75 72 61 74 69 6f 6e 20 74 65 73 74 64 61 74  duration testdat
8870: 29 29 29 0a 09 09 36 30 30 29 20 3b 3b 20 69 2e  )))...600) ;; i.
8880: 65 2e 20 6e 6f 20 75 70 64 61 74 65 20 66 6f 72  e. no update for
8890: 20 6d 6f 72 65 20 74 68 61 6e 20 36 30 30 20 73   more than 600 s
88a0: 65 63 6f 6e 64 73 0a 09 20 20 20 20 20 28 62 65  econds..     (be
88b0: 67 69 6e 0a 09 20 20 20 20 20 20 20 28 64 65 62  gin..       (deb
88c0: 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e  ug:print 0 "WARN
88d0: 49 4e 47 3a 20 54 65 73 74 20 22 20 74 65 73 74  ING: Test " test
88e0: 2d 6e 61 6d 65 20 22 20 61 70 70 65 61 72 73 20  -name " appears 
88f0: 74 6f 20 62 65 20 64 65 61 64 2e 20 46 6f 72 63  to be dead. Forc
8900: 69 6e 67 20 69 74 20 74 6f 20 73 74 61 74 65 20  ing it to state 
8910: 49 4e 43 4f 4d 50 4c 45 54 45 20 61 6e 64 20 73  INCOMPLETE and s
8920: 74 61 74 75 73 20 53 54 55 43 4b 2f 44 45 41 44  tatus STUCK/DEAD
8930: 22 29 0a 09 20 20 20 20 20 20 20 28 74 65 73 74  ")..       (test
8940: 73 3a 74 65 73 74 2d 73 65 74 2d 73 74 61 74 75  s:test-set-statu
8950: 73 21 20 74 65 73 74 2d 69 64 20 22 49 4e 43 4f  s! test-id "INCO
8960: 4d 50 4c 45 54 45 22 20 22 53 54 55 43 4b 2f 44  MPLETE" "STUCK/D
8970: 45 41 44 22 20 22 54 65 73 74 20 69 73 20 73 74  EAD" "Test is st
8980: 75 63 6b 20 6f 72 20 64 65 61 64 22 20 23 66 29  uck or dead" #f)
8990: 29 0a 09 20 20 20 20 20 28 64 65 62 75 67 3a 70  )..     (debug:p
89a0: 72 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 22 20  rint 2 "NOTE: " 
89b0: 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61  test-name " is a
89c0: 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e 67 22 29  lready running")
89d0: 29 29 0a 09 28 65 6c 73 65 20 20 20 20 20 20 20  ))..(else       
89e0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
89f0: 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f  ERROR: Failed to
8a00: 20 6c 61 75 6e 63 68 20 74 65 73 74 20 22 20 6e   launch test " n
8a10: 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 2e 20  ew-test-name ". 
8a20: 55 6e 72 65 63 6f 67 6e 69 73 65 64 20 73 74 61  Unrecognised sta
8a30: 74 65 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73  te " (test:get-s
8a40: 74 61 74 65 20 74 65 73 74 64 61 74 29 29 29 29  tate testdat))))
8a50: 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d  )))..;;=========
8a60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8a70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8a80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8a90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b  =============.;;
8aa0: 20 45 4e 44 20 4f 46 20 4e 45 57 20 53 54 55 46   END OF NEW STUF
8ab0: 46 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  F.;;============
8ac0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8ad0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8ae0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8af0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66  ==========..(def
8b00: 69 6e 65 20 28 67 65 74 2d 64 69 72 2d 75 70 2d  ine (get-dir-up-
8b10: 6e 20 64 69 72 20 2e 20 70 61 72 61 6d 73 29 20  n dir . params) 
8b20: 0a 20 20 28 6c 65 74 20 28 28 64 70 61 72 74 73  .  (let ((dparts
8b30: 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20    (string-split 
8b40: 64 69 72 20 22 2f 22 29 29 0a 09 28 63 6f 75 6e  dir "/"))..(coun
8b50: 74 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 70  t   (if (null? p
8b60: 61 72 61 6d 73 29 20 31 20 28 63 61 72 20 70 61  arams) 1 (car pa
8b70: 72 61 6d 73 29 29 29 29 0a 20 20 20 20 28 63 6f  rams)))).    (co
8b80: 6e 63 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69  nc "/" (string-i
8b90: 6e 74 65 72 73 70 65 72 73 65 20 0a 09 20 20 20  ntersperse ..   
8ba0: 20 20 20 20 28 74 61 6b 65 20 64 70 61 72 74 73      (take dparts
8bb0: 20 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72   (- (length dpar
8bc0: 74 73 29 20 63 6f 75 6e 74 29 29 0a 09 20 20 20  ts) count))..   
8bd0: 20 20 20 20 22 2f 22 29 29 29 29 0a 3b 3b 20 52      "/")))).;; R
8be0: 65 6d 6f 76 65 20 72 75 6e 73 0a 3b 3b 20 66 69  emove runs.;; fi
8bf0: 65 6c 64 73 20 61 72 65 20 70 61 73 73 69 6e 67  elds are passing
8c00: 20 69 6e 20 74 68 72 6f 75 67 68 20 0a 3b 3b 20   in through .;; 
8c10: 61 63 74 69 6f 6e 3a 0a 3b 3b 20 20 20 20 27 72  action:.;;    'r
8c20: 65 6d 6f 76 65 2d 72 75 6e 73 0a 3b 3b 20 20 20  emove-runs.;;   
8c30: 20 27 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74   'set-state-stat
8c40: 75 73 0a 3b 3b 0a 3b 3b 20 4e 42 2f 2f 20 73 68  us.;;.;; NB// sh
8c50: 6f 75 6c 64 20 70 61 73 73 20 69 6e 20 6b 65 79  ould pass in key
8c60: 73 3f 0a 3b 3b 0a 28 64 65 66 69 6e 65 20 28 72  s?.;;.(define (r
8c70: 75 6e 73 3a 6f 70 65 72 61 74 65 2d 6f 6e 20 61  uns:operate-on a
8c80: 63 74 69 6f 6e 20 72 75 6e 6e 61 6d 65 70 61 74  ction runnamepat
8c90: 74 20 74 65 73 74 70 61 74 74 20 23 21 6b 65 79  t testpatt #!key
8ca0: 20 28 73 74 61 74 65 20 23 66 29 28 73 74 61 74   (state #f)(stat
8cb0: 75 73 20 23 66 29 28 6e 65 77 2d 73 74 61 74 65  us #f)(new-state
8cc0: 2d 73 74 61 74 75 73 20 23 66 29 29 0a 20 20 28  -status #f)).  (
8cd0: 63 6f 6d 6d 6f 6e 3a 63 6c 65 61 72 2d 63 61 63  common:clear-cac
8ce0: 68 65 73 29 20 3b 3b 20 63 6c 65 61 72 20 61 6c  hes) ;; clear al
8cf0: 6c 20 63 61 63 68 65 73 0a 20 20 28 6c 65 74 2a  l caches.  (let*
8d00: 20 28 28 64 62 20 20 20 20 20 20 20 20 20 20 20   ((db           
8d10: 23 66 29 0a 09 20 28 6b 65 79 73 20 20 20 20 20  #f).. (keys     
8d20: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c      (open-run-cl
8d30: 6f 73 65 20 64 62 3a 67 65 74 2d 6b 65 79 73 20  ose db:get-keys 
8d40: 64 62 29 29 0a 09 20 28 72 75 6e 64 61 74 20 20  db)).. (rundat  
8d50: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
8d60: 6c 6f 73 65 20 72 75 6e 73 3a 67 65 74 2d 72 75  lose runs:get-ru
8d70: 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20 6b 65  ns-by-patt db ke
8d80: 79 73 20 72 75 6e 6e 61 6d 65 70 61 74 74 29 29  ys runnamepatt))
8d90: 0a 09 20 28 68 65 61 64 65 72 20 20 20 20 20 20  .. (header      
8da0: 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e   (vector-ref run
8db0: 64 61 74 20 30 29 29 0a 09 20 28 72 75 6e 73 20  dat 0)).. (runs 
8dc0: 20 20 20 20 20 20 20 20 28 76 65 63 74 6f 72 2d          (vector-
8dd0: 72 65 66 20 72 75 6e 64 61 74 20 31 29 29 0a 09  ref rundat 1))..
8de0: 20 28 73 74 61 74 65 73 20 20 20 20 20 20 20 28   (states       (
8df0: 69 66 20 73 74 61 74 65 20 20 28 73 74 72 69 6e  if state  (strin
8e00: 67 2d 73 70 6c 69 74 20 73 74 61 74 65 20 20 22  g-split state  "
8e10: 2c 22 29 20 27 28 29 29 29 0a 09 20 28 73 74 61  ,") '())).. (sta
8e20: 74 75 73 65 73 20 20 20 20 20 28 69 66 20 73 74  tuses     (if st
8e30: 61 74 75 73 20 28 73 74 72 69 6e 67 2d 73 70 6c  atus (string-spl
8e40: 69 74 20 73 74 61 74 75 73 20 22 2c 22 29 20 27  it status ",") '
8e50: 28 29 29 29 0a 09 20 28 73 74 61 74 65 2d 73 74  ())).. (state-st
8e60: 61 74 75 73 20 28 69 66 20 28 73 74 72 69 6e 67  atus (if (string
8e70: 3f 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74  ? new-state-stat
8e80: 75 73 29 20 28 73 74 72 69 6e 67 2d 73 70 6c 69  us) (string-spli
8e90: 74 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74  t new-state-stat
8ea0: 75 73 20 22 2c 22 29 20 27 28 23 66 20 23 66 29  us ",") '(#f #f)
8eb0: 29 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70  ))).    (debug:p
8ec0: 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 72 75 6e  rint-info 4 "run
8ed0: 73 3a 6f 70 65 72 61 74 65 2d 6f 6e 20 3d 3e 20  s:operate-on => 
8ee0: 48 65 61 64 65 72 3a 20 22 20 68 65 61 64 65 72  Header: " header
8ef0: 20 22 20 61 63 74 69 6f 6e 3a 20 22 20 61 63 74   " action: " act
8f00: 69 6f 6e 20 22 20 6e 65 77 2d 73 74 61 74 65 2d  ion " new-state-
8f10: 73 74 61 74 75 73 3a 20 22 20 6e 65 77 2d 73 74  status: " new-st
8f20: 61 74 65 2d 73 74 61 74 75 73 29 0a 20 20 20 20  ate-status).    
8f30: 28 69 66 20 28 3e 20 32 20 28 6c 65 6e 67 74 68  (if (> 2 (length
8f40: 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 29 0a   state-status)).
8f50: 09 28 62 65 67 69 6e 0a 09 20 20 28 64 65 62 75  .(begin..  (debu
8f60: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52  g:print 0 "ERROR
8f70: 3a 20 74 68 65 20 70 61 72 61 6d 65 74 65 72 20  : the parameter 
8f80: 74 6f 20 2d 73 65 74 2d 73 74 61 74 65 2d 73 74  to -set-state-st
8f90: 61 74 75 73 20 69 73 20 61 20 63 6f 6d 6d 61 20  atus is a comma 
8fa0: 64 65 6c 69 6d 69 74 65 64 20 73 74 72 69 6e 67  delimited string
8fb0: 2e 20 45 2e 67 2e 20 43 4f 4d 50 4c 45 54 45 44  . E.g. COMPLETED
8fc0: 2c 46 41 49 4c 22 29 0a 09 20 20 28 65 78 69 74  ,FAIL")..  (exit
8fd0: 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63  ))).    (for-eac
8fe0: 68 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28  h.     (lambda (
8ff0: 72 75 6e 29 0a 20 20 20 20 20 20 20 28 6c 65 74  run).       (let
9000: 20 28 28 72 75 6e 6b 65 79 20 28 73 74 72 69 6e   ((runkey (strin
9010: 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d  g-intersperse (m
9020: 61 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 0a 09  ap (lambda (k)..
9030: 09 09 09 09 09 28 64 62 3a 67 65 74 2d 76 61 6c  .....(db:get-val
9040: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e  ue-by-header run
9050: 20 68 65 61 64 65 72 20 28 76 65 63 74 6f 72 2d   header (vector-
9060: 72 65 66 20 6b 20 30 29 29 29 20 6b 65 79 73 29  ref k 0))) keys)
9070: 20 22 2f 22 29 29 0a 09 20 20 20 20 20 28 64 69   "/"))..     (di
9080: 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 28 6d 61  rs-to-remove (ma
9090: 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29  ke-hash-table)))
90a0: 0a 09 20 28 6c 65 74 2a 20 28 28 72 75 6e 2d 69  .. (let* ((run-i
90b0: 64 20 20 20 20 28 64 62 3a 67 65 74 2d 76 61 6c  d    (db:get-val
90c0: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e  ue-by-header run
90d0: 20 68 65 61 64 65 72 20 22 69 64 22 29 29 0a 09   header "id"))..
90e0: 09 28 72 75 6e 2d 73 74 61 74 65 20 28 64 62 3a  .(run-state (db:
90f0: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61  get-value-by-hea
9100: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22  der run header "
9110: 73 74 61 74 65 22 29 29 0a 09 09 28 74 65 73 74  state"))...(test
9120: 73 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28  s     (if (not (
9130: 65 71 75 61 6c 3f 20 72 75 6e 2d 73 74 61 74 65  equal? run-state
9140: 20 22 6c 6f 63 6b 65 64 22 29 29 0a 09 09 09 20   "locked")).... 
9150: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d        (open-run-
9160: 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73  close db:get-tes
9170: 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 72 75  ts-for-run db ru
9180: 6e 2d 69 64 0a 09 09 09 09 09 09 20 20 20 20 20  n-id.......     
9190: 20 74 65 73 74 70 61 74 74 20 73 74 61 74 65 73   testpatt states
91a0: 20 73 74 61 74 75 73 65 73 0a 09 09 09 09 09 09   statuses.......
91b0: 20 20 20 20 20 20 6e 6f 74 2d 69 6e 3a 20 20 23        not-in:  #
91c0: 66 0a 09 09 09 09 09 09 20 20 20 20 20 20 73 6f  f.......      so
91d0: 72 74 2d 62 79 3a 20 28 63 61 73 65 20 61 63 74  rt-by: (case act
91e0: 69 6f 6e 0a 09 09 09 09 09 09 09 09 20 28 28 72  ion......... ((r
91f0: 65 6d 6f 76 65 2d 72 75 6e 73 29 20 27 72 75 6e  emove-runs) 'run
9200: 64 69 72 29 0a 09 09 09 09 09 09 09 09 20 28 65  dir)......... (e
9210: 6c 73 65 20 20 20 20 20 20 20 20 20 20 27 65 76  lse          'ev
9220: 65 6e 74 5f 74 69 6d 65 29 29 29 0a 09 09 09 20  ent_time))).... 
9230: 20 20 20 20 20 20 27 28 29 29 29 0a 09 09 28 6c        '()))...(l
9240: 61 73 74 74 70 61 74 68 20 22 2f 64 6f 65 73 2f  asttpath "/does/
9250: 6e 6f 74 2f 65 78 69 73 74 2f 49 2f 68 6f 70 65  not/exist/I/hope
9260: 22 29 29 0a 09 20 20 20 28 64 65 62 75 67 3a 70  "))..   (debug:p
9270: 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 72 75 6e  rint-info 4 "run
9280: 73 3a 6f 70 65 72 61 74 65 2d 6f 6e 20 72 75 6e  s:operate-on run
9290: 3d 22 20 72 75 6e 20 22 2c 20 68 65 61 64 65 72  =" run ", header
92a0: 3d 22 20 68 65 61 64 65 72 29 0a 09 20 20 20 28  =" header)..   (
92b0: 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74  if (not (null? t
92c0: 65 73 74 73 29 29 0a 09 20 20 20 20 20 20 20 28  ests))..       (
92d0: 62 65 67 69 6e 0a 09 09 20 28 63 61 73 65 20 61  begin... (case a
92e0: 63 74 69 6f 6e 0a 09 09 20 20 20 28 28 72 65 6d  ction...   ((rem
92f0: 6f 76 65 2d 72 75 6e 73 29 0a 09 09 20 20 20 20  ove-runs)...    
9300: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22  (debug:print 1 "
9310: 52 65 6d 6f 76 69 6e 67 20 74 65 73 74 73 20 66  Removing tests f
9320: 6f 72 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79  or run: " runkey
9330: 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c   " " (db:get-val
9340: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e  ue-by-header run
9350: 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65   header "runname
9360: 22 29 29 29 0a 09 09 20 20 20 28 28 73 65 74 2d  ")))...   ((set-
9370: 73 74 61 74 65 2d 73 74 61 74 75 73 29 0a 09 09  state-status)...
9380: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
9390: 20 31 20 22 4d 6f 64 69 66 79 69 6e 67 20 73 74   1 "Modifying st
93a0: 61 74 65 20 61 6e 64 20 73 74 61 75 73 20 66 6f  ate and staus fo
93b0: 72 20 74 65 73 74 73 20 66 6f 72 20 72 75 6e 3a  r tests for run:
93c0: 20 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64   " runkey " " (d
93d0: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68  b:get-value-by-h
93e0: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72  eader run header
93f0: 20 22 72 75 6e 6e 61 6d 65 22 29 29 29 0a 09 09   "runname")))...
9400: 20 20 20 28 28 70 72 69 6e 74 2d 72 75 6e 29 0a     ((print-run).
9410: 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ..    (debug:pri
9420: 6e 74 20 31 20 22 50 72 69 6e 74 69 6e 67 20 69  nt 1 "Printing i
9430: 6e 66 6f 20 66 6f 72 20 72 75 6e 20 22 20 72 75  nfo for run " ru
9440: 6e 6b 65 79 20 22 2c 20 72 75 6e 3d 22 20 72 75  nkey ", run=" ru
9450: 6e 20 22 2c 20 74 65 73 74 73 3d 22 20 74 65 73  n ", tests=" tes
9460: 74 73 20 22 2c 20 68 65 61 64 65 72 3d 22 20 68  ts ", header=" h
9470: 65 61 64 65 72 29 0a 09 09 20 20 20 20 61 63 74  eader)...    act
9480: 69 6f 6e 29 0a 09 09 20 20 20 28 65 6c 73 65 0a  ion)...   (else.
9490: 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ..    (debug:pri
94a0: 6e 74 2d 69 6e 66 6f 20 30 20 22 61 63 74 69 6f  nt-info 0 "actio
94b0: 6e 20 6e 6f 74 20 72 65 63 6f 67 6e 69 73 65 64  n not recognised
94c0: 20 22 20 61 63 74 69 6f 6e 29 29 29 0a 09 09 20   " action)))... 
94d0: 28 66 6f 72 2d 65 61 63 68 0a 09 09 20 20 28 6c  (for-each...  (l
94e0: 61 6d 62 64 61 20 28 74 65 73 74 29 0a 09 09 20  ambda (test)... 
94f0: 20 20 20 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d     (let* ((item-
9500: 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65  path (db:test-ge
9510: 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74  t-item-path test
9520: 29 29 0a 09 09 09 20 20 20 28 74 65 73 74 2d 6e  ))....   (test-n
9530: 61 6d 65 20 28 64 62 3a 74 65 73 74 2d 67 65 74  ame (db:test-get
9540: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29 29  -testname test))
9550: 0a 09 09 09 20 20 20 28 72 75 6e 2d 64 69 72 20  ....   (run-dir 
9560: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72    (db:test-get-r
9570: 75 6e 64 69 72 20 74 65 73 74 29 29 20 20 20 20  undir test))    
9580: 3b 3b 20 72 75 6e 20 64 69 72 20 69 73 20 66 72  ;; run dir is fr
9590: 6f 6d 20 74 68 65 20 6c 69 6e 6b 20 74 72 65 65  om the link tree
95a0: 0a 09 09 09 20 20 20 28 72 65 61 6c 2d 64 69 72  ....   (real-dir
95b0: 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73    (if (file-exis
95c0: 74 73 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09 09  ts? run-dir)....
95d0: 09 09 20 20 28 72 65 73 6f 6c 76 65 2d 70 61 74  ..  (resolve-pat
95e0: 68 6e 61 6d 65 20 72 75 6e 2d 64 69 72 29 0a 09  hname run-dir)..
95f0: 09 09 09 09 20 20 23 66 29 29 0a 09 09 09 20 20  ....  #f))....  
9600: 20 28 74 65 73 74 2d 69 64 20 20 20 28 64 62 3a   (test-id   (db:
9610: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74  test-get-id test
9620: 29 29 29 0a 09 09 20 20 20 20 20 20 3b 3b 20 20  )))...      ;;  
9630: 20 28 74 64 62 20 20 20 20 20 20 20 28 64 62 3a   (tdb       (db:
9640: 6f 70 65 6e 2d 74 65 73 74 2d 64 62 20 72 75 6e  open-test-db run
9650: 2d 64 69 72 29 29 29 0a 09 09 20 20 20 20 20 20  -dir)))...      
9660: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
9670: 6f 20 34 20 22 74 65 73 74 3d 22 20 74 65 73 74  o 4 "test=" test
9680: 29 20 3b 3b 20 20 20 22 20 28 64 62 3a 74 65 73  ) ;;   " (db:tes
9690: 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74  t-get-testname t
96a0: 65 73 74 29 20 22 20 69 64 3a 20 22 20 28 64 62  est) " id: " (db
96b0: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73  :test-get-id tes
96c0: 74 29 20 22 20 22 20 69 74 65 6d 2d 70 61 74 68  t) " " item-path
96d0: 20 22 20 61 63 74 69 6f 6e 3a 20 22 20 61 63 74   " action: " act
96e0: 69 6f 6e 29 0a 09 09 20 20 20 20 20 20 28 63 61  ion)...      (ca
96f0: 73 65 20 61 63 74 69 6f 6e 0a 09 09 09 28 28 72  se action....((r
9700: 65 6d 6f 76 65 2d 72 75 6e 73 29 20 3b 3b 20 74  emove-runs) ;; t
9710: 68 65 20 74 64 62 20 69 73 20 66 6f 72 20 66 75  he tdb is for fu
9720: 74 75 72 65 20 70 6f 73 73 69 62 6c 65 2e 20 0a  ture possible. .
9730: 09 09 09 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c  ... (open-run-cl
9740: 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 2d 74 65  ose db:delete-te
9750: 73 74 2d 72 65 63 6f 72 64 73 20 64 62 20 23 66  st-records db #f
9760: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64   (db:test-get-id
9770: 20 74 65 73 74 29 29 0a 09 09 09 20 28 64 65 62   test)).... (deb
9780: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20  ug:print-info 1 
9790: 22 41 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 72  "Attempting to r
97a0: 65 6d 6f 76 65 20 22 20 28 69 66 20 72 65 61 6c  emove " (if real
97b0: 2d 64 69 72 20 28 63 6f 6e 63 20 22 20 64 69 72  -dir (conc " dir
97c0: 20 22 20 72 65 61 6c 2d 64 69 72 20 22 20 61 6e   " real-dir " an
97d0: 64 20 22 29 20 22 22 29 20 22 20 6c 69 6e 6b 20  d ") "") " link 
97e0: 22 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 20 28  " run-dir).... (
97f0: 69 66 20 28 61 6e 64 20 72 65 61 6c 2d 64 69 72  if (and real-dir
9800: 20 0a 09 09 09 09 20 20 28 3e 20 28 73 74 72 69   .....  (> (stri
9810: 6e 67 2d 6c 65 6e 67 74 68 20 72 65 61 6c 2d 64  ng-length real-d
9820: 69 72 29 20 35 29 0a 09 09 09 09 20 20 28 66 69  ir) 5).....  (fi
9830: 6c 65 2d 65 78 69 73 74 73 3f 20 72 65 61 6c 2d  le-exists? real-
9840: 64 69 72 29 29 20 3b 3b 20 62 61 64 20 68 65 75  dir)) ;; bad heu
9850: 72 69 73 74 69 63 20 62 75 74 20 73 68 6f 75 6c  ristic but shoul
9860: 64 20 70 72 65 76 65 6e 74 20 2f 74 6d 70 20 2f  d prevent /tmp /
9870: 68 6f 6d 65 20 65 74 63 2e 0a 09 09 09 20 20 20  home etc.....   
9880: 20 20 28 62 65 67 69 6e 20 3b 3b 20 6c 65 74 2a    (begin ;; let*
9890: 20 28 28 72 65 61 6c 70 61 74 68 20 28 72 65 73   ((realpath (res
98a0: 6f 6c 76 65 2d 70 61 74 68 6e 61 6d 65 20 72 75  olve-pathname ru
98b0: 6e 2d 64 69 72 29 29 29 0a 09 09 09 20 20 20 20  n-dir)))....    
98c0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d     (debug:print-
98d0: 69 6e 66 6f 20 31 20 22 52 65 63 75 72 73 69 76  info 1 "Recursiv
98e0: 65 6c 79 20 72 65 6d 6f 76 69 6e 67 20 22 20 72  ely removing " r
98f0: 65 61 6c 2d 64 69 72 29 0a 09 09 09 20 20 20 20  eal-dir)....    
9900: 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69     (if (file-exi
9910: 73 74 73 3f 20 72 65 61 6c 2d 64 69 72 29 0a 09  sts? real-dir)..
9920: 09 09 09 20 20 20 28 69 66 20 28 3e 20 28 73 79  ...   (if (> (sy
9930: 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 20 2d  stem (conc "rm -
9940: 72 66 20 22 20 72 65 61 6c 2d 64 69 72 29 29 20  rf " real-dir)) 
9950: 30 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 64  0).....       (d
9960: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
9970: 52 4f 52 3a 20 54 68 65 72 65 20 77 61 73 20 61  ROR: There was a
9980: 20 70 72 6f 62 6c 65 6d 20 72 65 6d 6f 76 69 6e   problem removin
9990: 67 20 22 20 72 65 61 6c 2d 64 69 72 20 22 20 77  g " real-dir " w
99a0: 69 74 68 20 72 6d 20 2d 66 22 29 29 0a 09 09 09  ith rm -f"))....
99b0: 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74  .   (debug:print
99c0: 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 74 65 73   0 "WARNING: tes
99d0: 74 20 64 69 72 20 22 20 72 65 61 6c 2d 64 69 72  t dir " real-dir
99e0: 20 22 20 61 70 70 65 61 72 73 20 74 6f 20 6e 6f   " appears to no
99f0: 74 20 65 78 69 73 74 20 6f 72 20 69 73 20 6e 6f  t exist or is no
9a00: 74 20 72 65 61 64 61 62 6c 65 22 29 29 29 0a 09  t readable")))..
9a10: 09 09 20 20 20 20 20 28 69 66 20 72 65 61 6c 2d  ..     (if real-
9a20: 64 69 72 20 0a 09 09 09 09 20 28 64 65 62 75 67  dir ..... (debug
9a30: 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e  :print 0 "WARNIN
9a40: 47 3a 20 64 69 72 65 63 74 6f 72 79 20 22 20 72  G: directory " r
9a50: 65 61 6c 2d 64 69 72 20 22 20 64 6f 65 73 20 6e  eal-dir " does n
9a60: 6f 74 20 65 78 69 73 74 22 29 0a 09 09 09 09 20  ot exist")..... 
9a70: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
9a80: 57 41 52 4e 49 4e 47 3a 20 6e 6f 20 72 65 61 6c  WARNING: no real
9a90: 20 64 69 72 65 63 74 6f 72 79 20 63 6f 72 72 6f   directory corro
9aa0: 73 70 6f 6e 64 69 6e 67 20 74 6f 20 6c 69 6e 6b  sponding to link
9ab0: 20 22 20 72 75 6e 2d 64 69 72 20 22 2c 20 6e 6f   " run-dir ", no
9ac0: 74 68 69 6e 67 20 64 6f 6e 65 22 29 29 29 0a 09  thing done")))..
9ad0: 09 09 20 28 69 66 20 28 73 79 6d 62 6f 6c 69 63  .. (if (symbolic
9ae0: 2d 6c 69 6e 6b 3f 20 72 75 6e 2d 64 69 72 29 0a  -link? run-dir).
9af0: 09 09 09 20 20 20 20 20 28 62 65 67 69 6e 0a 09  ...     (begin..
9b00: 09 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a  ..       (debug:
9b10: 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 52 65  print-info 1 "Re
9b20: 6d 6f 76 69 6e 67 20 73 79 6d 6c 69 6e 6b 20 22  moving symlink "
9b30: 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 20 20 20   run-dir)....   
9b40: 20 20 20 20 28 68 61 6e 64 6c 65 2d 65 78 63 65      (handle-exce
9b50: 70 74 69 6f 6e 73 0a 09 09 09 09 65 78 6e 0a 09  ptions.....exn..
9b60: 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20  ...(debug:print 
9b70: 30 20 22 45 52 52 4f 52 3a 20 20 46 61 69 6c 65  0 "ERROR:  Faile
9b80: 64 20 74 6f 20 72 65 6d 6f 76 65 20 73 79 6d 6c  d to remove syml
9b90: 69 6e 6b 20 22 20 72 75 6e 2d 64 69 72 20 28 28  ink " run-dir ((
9ba0: 63 6f 6e 64 69 74 69 6f 6e 2d 70 72 6f 70 65 72  condition-proper
9bb0: 74 79 2d 61 63 63 65 73 73 6f 72 20 27 65 78 6e  ty-accessor 'exn
9bc0: 20 27 6d 65 73 73 61 67 65 29 20 65 78 6e 29 20   'message) exn) 
9bd0: 22 2c 20 61 74 74 65 6d 70 74 69 6e 67 20 74 6f  ", attempting to
9be0: 20 63 6f 6e 74 69 6e 75 65 22 29 0a 09 09 09 09   continue").....
9bf0: 28 64 65 6c 65 74 65 2d 66 69 6c 65 20 72 75 6e  (delete-file run
9c00: 2d 64 69 72 29 29 29 0a 09 09 09 20 20 20 20 20  -dir)))....     
9c10: 28 69 66 20 28 64 69 72 65 63 74 6f 72 79 3f 20  (if (directory? 
9c20: 72 75 6e 2d 64 69 72 29 0a 09 09 09 09 20 28 69  run-dir)..... (i
9c30: 66 20 28 3e 20 28 64 69 72 65 63 74 6f 72 79 2d  f (> (directory-
9c40: 66 6f 6c 64 20 28 6c 61 6d 62 64 61 20 28 66 20  fold (lambda (f 
9c50: 78 29 28 2b 20 31 20 78 29 29 20 30 20 72 75 6e  x)(+ 1 x)) 0 run
9c60: 2d 64 69 72 29 20 30 29 0a 09 09 09 09 20 20 20  -dir) 0).....   
9c70: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
9c80: 20 22 57 41 52 4e 49 4e 47 3a 20 72 65 66 75 73   "WARNING: refus
9c90: 69 6e 67 20 74 6f 20 72 65 6d 6f 76 65 20 22 20  ing to remove " 
9ca0: 72 75 6e 2d 64 69 72 20 22 20 61 73 20 69 74 20  run-dir " as it 
9cb0: 69 73 20 6e 6f 74 20 65 6d 70 74 79 22 29 0a 09  is not empty")..
9cc0: 09 09 09 20 20 20 20 20 20 28 68 61 6e 64 6c 65  ...      (handle
9cd0: 2d 65 78 63 65 70 74 69 6f 6e 73 0a 09 09 09 09  -exceptions.....
9ce0: 20 20 20 20 20 20 20 65 78 6e 0a 09 09 09 09 20         exn..... 
9cf0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
9d00: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 20 46 61  nt 0 "ERROR:  Fa
9d10: 69 6c 65 64 20 74 6f 20 72 65 6d 6f 76 65 20 64  iled to remove d
9d20: 69 72 65 63 74 6f 72 79 20 22 20 72 75 6e 2d 64  irectory " run-d
9d30: 69 72 20 28 28 63 6f 6e 64 69 74 69 6f 6e 2d 70  ir ((condition-p
9d40: 72 6f 70 65 72 74 79 2d 61 63 63 65 73 73 6f 72  roperty-accessor
9d50: 20 27 65 78 6e 20 27 6d 65 73 73 61 67 65 29 20   'exn 'message) 
9d60: 65 78 6e 29 20 22 2c 20 61 74 74 65 6d 70 74 69  exn) ", attempti
9d70: 6e 67 20 74 6f 20 63 6f 6e 74 69 6e 75 65 22 29  ng to continue")
9d80: 0a 09 09 09 09 20 20 20 20 20 20 20 28 64 65 6c  .....       (del
9d90: 65 74 65 2d 64 69 72 65 63 74 6f 72 79 20 72 75  ete-directory ru
9da0: 6e 2d 64 69 72 29 29 29 0a 09 09 09 09 20 28 69  n-dir)))..... (i
9db0: 66 20 72 75 6e 2d 64 69 72 0a 09 09 09 09 20 20  f run-dir.....  
9dc0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
9dd0: 30 20 22 57 41 52 4e 49 4e 47 3a 20 6e 6f 74 20  0 "WARNING: not 
9de0: 72 65 6d 6f 76 69 6e 67 20 22 20 72 75 6e 2d 64  removing " run-d
9df0: 69 72 20 22 20 61 73 20 69 74 20 65 69 74 68 65  ir " as it eithe
9e00: 72 20 64 6f 65 73 6e 27 74 20 65 78 69 73 74 20  r doesn't exist 
9e10: 6f 72 20 69 73 20 6e 6f 74 20 61 20 73 79 6d 6c  or is not a syml
9e20: 69 6e 6b 22 29 0a 09 09 09 09 20 20 20 20 20 28  ink").....     (
9e30: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 4e  debug:print 0 "N
9e40: 4f 54 45 3a 20 74 68 65 20 72 75 6e 20 64 69 72  OTE: the run dir
9e50: 20 66 6f 72 20 74 68 69 73 20 74 65 73 74 20 69   for this test i
9e60: 73 20 75 6e 64 65 66 69 6e 65 64 2e 20 54 65 73  s undefined. Tes
9e70: 74 20 6d 61 79 20 68 61 76 65 20 61 6c 72 65 61  t may have alrea
9e80: 64 79 20 62 65 65 6e 20 64 65 6c 65 74 65 64 2e  dy been deleted.
9e90: 22 29 29 0a 09 09 09 09 20 29 29 29 0a 09 09 09  "))..... )))....
9ea0: 28 28 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74  ((set-state-stat
9eb0: 75 73 29 0a 09 09 09 20 28 64 65 62 75 67 3a 70  us).... (debug:p
9ec0: 72 69 6e 74 2d 69 6e 66 6f 20 32 20 22 6e 65 77  rint-info 2 "new
9ed0: 20 73 74 61 74 65 20 22 20 28 63 61 72 20 73 74   state " (car st
9ee0: 61 74 65 2d 73 74 61 74 75 73 29 20 22 2c 20 6e  ate-status) ", n
9ef0: 65 77 20 73 74 61 74 75 73 20 22 20 28 63 61 64  ew status " (cad
9f00: 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 29  r state-status))
9f10: 0a 09 09 09 20 28 6f 70 65 6e 2d 72 75 6e 2d 63  .... (open-run-c
9f20: 6c 6f 73 65 20 64 62 3a 74 65 73 74 2d 73 65 74  lose db:test-set
9f30: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 2d 62 79  -state-status-by
9f40: 2d 69 64 20 64 62 20 28 64 62 3a 74 65 73 74 2d  -id db (db:test-
9f50: 67 65 74 2d 69 64 20 74 65 73 74 29 20 28 63 61  get-id test) (ca
9f60: 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 28  r state-status)(
9f70: 63 61 64 72 20 73 74 61 74 65 2d 73 74 61 74 75  cadr state-statu
9f80: 73 29 20 23 66 29 29 29 29 29 0a 09 09 20 20 28  s) #f)))))...  (
9f90: 73 6f 72 74 20 74 65 73 74 73 20 28 6c 61 6d 62  sort tests (lamb
9fa0: 64 61 20 28 61 20 62 29 28 6c 65 74 20 28 28 64  da (a b)(let ((d
9fb0: 69 72 61 20 28 64 62 3a 74 65 73 74 2d 67 65 74  ira (db:test-get
9fc0: 2d 72 75 6e 64 69 72 20 61 29 29 0a 09 09 09 09  -rundir a)).....
9fd0: 09 09 20 28 64 69 72 62 20 28 64 62 3a 74 65 73  .. (dirb (db:tes
9fe0: 74 2d 67 65 74 2d 72 75 6e 64 69 72 20 62 29 29  t-get-rundir b))
9ff0: 29 0a 09 09 09 09 09 20 20 20 20 20 28 69 66 20  )......     (if 
a000: 28 61 6e 64 20 28 73 74 72 69 6e 67 3f 20 64 69  (and (string? di
a010: 72 61 29 28 73 74 72 69 6e 67 3f 20 64 69 72 62  ra)(string? dirb
a020: 29 29 0a 09 09 09 09 09 09 20 28 3e 20 28 73 74  ))....... (> (st
a030: 72 69 6e 67 2d 6c 65 6e 67 74 68 20 64 69 72 61  ring-length dira
a040: 29 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20  )(string-length 
a050: 64 69 72 62 29 29 0a 09 09 09 09 09 09 20 23 66  dirb))....... #f
a060: 29 29 29 29 29 29 29 0a 09 20 20 20 3b 3b 20 72  )))))))..   ;; r
a070: 65 6d 6f 76 65 20 74 68 65 20 72 75 6e 20 69 66  emove the run if
a080: 20 7a 65 72 6f 20 74 65 73 74 73 20 72 65 6d 61   zero tests rema
a090: 69 6e 0a 09 20 20 20 28 69 66 20 28 65 71 3f 20  in..   (if (eq? 
a0a0: 61 63 74 69 6f 6e 20 27 72 65 6d 6f 76 65 2d 72  action 'remove-r
a0b0: 75 6e 73 29 0a 09 20 20 20 20 20 20 20 28 6c 65  uns)..       (le
a0c0: 74 20 28 28 72 65 6d 74 65 73 74 73 20 28 6f 70  t ((remtests (op
a0d0: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a  en-run-close db:
a0e0: 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75  get-tests-for-ru
a0f0: 6e 20 64 62 20 28 64 62 3a 67 65 74 2d 76 61 6c  n db (db:get-val
a100: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e  ue-by-header run
a110: 20 68 65 61 64 65 72 20 22 69 64 22 29 20 23 66   header "id") #f
a120: 20 27 28 22 44 45 4c 45 54 45 44 22 29 20 27 28   '("DELETED") '(
a130: 22 6e 2f 61 22 29 20 6e 6f 74 2d 69 6e 3a 20 23  "n/a") not-in: #
a140: 74 29 29 29 0a 09 09 20 28 69 66 20 28 6e 75 6c  t)))... (if (nul
a150: 6c 3f 20 72 65 6d 74 65 73 74 73 29 20 3b 3b 20  l? remtests) ;; 
a160: 6e 6f 20 6d 6f 72 65 20 74 65 73 74 73 20 72 65  no more tests re
a170: 6d 61 69 6e 69 6e 67 0a 09 09 20 20 20 20 20 28  maining...     (
a180: 6c 65 74 2a 20 28 28 64 70 61 72 74 73 20 20 28  let* ((dparts  (
a190: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 6c 61 73  string-split las
a1a0: 74 74 70 61 74 68 20 22 2f 22 29 29 0a 09 09 09  ttpath "/"))....
a1b0: 20 20 20 20 28 72 75 6e 70 61 74 68 20 28 63 6f      (runpath (co
a1c0: 6e 63 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69  nc "/" (string-i
a1d0: 6e 74 65 72 73 70 65 72 73 65 20 0a 09 09 09 09  ntersperse .....
a1e0: 09 09 28 74 61 6b 65 20 64 70 61 72 74 73 20 28  ..(take dparts (
a1f0: 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73  - (length dparts
a200: 29 20 31 29 29 0a 09 09 09 09 09 09 22 2f 22 29  ) 1))......."/")
a210: 29 29 29 0a 09 09 20 20 20 20 20 20 20 28 64 65  )))...       (de
a220: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d  bug:print 1 "Rem
a230: 6f 76 69 6e 67 20 72 75 6e 3a 20 22 20 72 75 6e  oving run: " run
a240: 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d  key " " (db:get-
a250: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20  value-by-header 
a260: 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e  run header "runn
a270: 61 6d 65 22 29 20 22 20 61 6e 64 20 72 65 6c 61  ame") " and rela
a280: 74 65 64 20 72 65 63 6f 72 64 22 29 0a 09 09 20  ted record")... 
a290: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d        (open-run-
a2a0: 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 2d  close db:delete-
a2b0: 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 29 0a 09  run db run-id)..
a2c0: 09 20 20 20 20 20 20 20 3b 3b 20 54 68 69 73 20  .       ;; This 
a2d0: 69 73 20 61 20 70 72 65 74 74 79 20 67 6f 6f 64  is a pretty good
a2e0: 20 70 6c 61 63 65 20 74 6f 20 70 75 72 67 65 20   place to purge 
a2f0: 6f 6c 64 20 44 45 4c 45 54 45 44 20 74 65 73 74  old DELETED test
a300: 73 0a 09 09 20 20 20 20 20 20 20 28 6f 70 65 6e  s...       (open
a310: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65  -run-close db:de
a320: 6c 65 74 65 2d 74 65 73 74 73 2d 66 6f 72 2d 72  lete-tests-for-r
a330: 75 6e 20 64 62 20 72 75 6e 2d 69 64 29 0a 09 09  un db run-id)...
a340: 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e         (open-run
a350: 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65  -close db:delete
a360: 2d 6f 6c 64 2d 64 65 6c 65 74 65 64 2d 74 65 73  -old-deleted-tes
a370: 74 2d 72 65 63 6f 72 64 73 20 64 62 29 0a 09 09  t-records db)...
a380: 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e         (open-run
a390: 2d 63 6c 6f 73 65 20 64 62 3a 73 65 74 2d 76 61  -close db:set-va
a3a0: 72 20 64 62 20 22 44 45 4c 45 54 45 44 5f 54 45  r db "DELETED_TE
a3b0: 53 54 53 22 20 28 63 75 72 72 65 6e 74 2d 73 65  STS" (current-se
a3c0: 63 6f 6e 64 73 29 29 0a 09 09 20 20 20 20 20 20  conds))...      
a3d0: 20 3b 3b 20 6e 65 65 64 20 74 6f 20 66 69 67 75   ;; need to figu
a3e0: 72 65 20 6f 75 74 20 74 68 65 20 70 61 74 68 20  re out the path 
a3f0: 74 6f 20 74 68 65 20 72 75 6e 20 64 69 72 20 61  to the run dir a
a400: 6e 64 20 72 65 6d 6f 76 65 20 69 74 20 69 66 20  nd remove it if 
a410: 65 6d 70 74 79 0a 09 09 20 20 20 20 20 20 20 3b  empty...       ;
a420: 3b 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20  ;    (if (null? 
a430: 28 67 6c 6f 62 20 28 63 6f 6e 63 20 72 75 6e 70  (glob (conc runp
a440: 61 74 68 20 22 2f 2a 22 29 29 29 0a 09 09 20 20  ath "/*")))...  
a450: 20 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20 28       ;;        (
a460: 62 65 67 69 6e 0a 09 09 20 20 20 20 20 20 20 3b  begin...       ;
a470: 3b 20 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ; . (debug:print
a480: 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e   1 "Removing run
a490: 20 64 69 72 20 22 20 72 75 6e 70 61 74 68 29 0a   dir " runpath).
a4a0: 09 09 20 20 20 20 20 20 20 3b 3b 20 09 20 28 73  ..       ;; . (s
a4b0: 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 64  ystem (conc "rmd
a4c0: 69 72 20 2d 70 20 22 20 72 75 6e 70 61 74 68 29  ir -p " runpath)
a4d0: 29 29 29 0a 09 09 20 20 20 20 20 20 20 29 29 29  )))...       )))
a4e0: 29 29 0a 09 20 29 29 0a 20 20 20 20 20 72 75 6e  )).. )).     run
a4f0: 73 29 29 0a 20 20 23 74 29 0a 0a 3b 3b 3d 3d 3d  s)).  #t)..;;===
a500: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a510: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a520: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a530: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a540: 3d 3d 3d 0a 3b 3b 20 52 6f 75 74 69 6e 65 73 20  ===.;; Routines 
a550: 66 6f 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67  for manipulating
a560: 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d   runs.;;========
a570: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a580: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a590: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a5a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a  ==============..
a5b0: 3b 3b 20 53 69 6e 63 65 20 6d 61 6e 79 20 63 61  ;; Since many ca
a5c0: 6c 6c 73 20 74 6f 20 61 20 72 75 6e 20 72 65 71  lls to a run req
a5d0: 75 69 72 65 20 70 72 65 74 74 79 20 6d 75 63 68  uire pretty much
a5e0: 20 74 68 65 20 73 61 6d 65 20 73 65 74 75 70 20   the same setup 
a5f0: 0a 3b 3b 20 74 68 69 73 20 77 72 61 70 70 65 72  .;; this wrapper
a600: 20 69 73 20 75 73 65 64 20 74 6f 20 72 65 64 75   is used to redu
a610: 63 65 20 74 68 65 20 72 65 70 6c 69 63 61 74 69  ce the replicati
a620: 6f 6e 20 6f 66 20 63 6f 64 65 0a 28 64 65 66 69  on of code.(defi
a630: 6e 65 20 28 67 65 6e 65 72 61 6c 2d 72 75 6e 2d  ne (general-run-
a640: 63 61 6c 6c 20 73 77 69 74 63 68 6e 61 6d 65 20  call switchname 
a650: 61 63 74 69 6f 6e 2d 64 65 73 63 20 70 72 6f 63  action-desc proc
a660: 29 0a 20 20 28 6c 65 74 20 28 28 72 75 6e 6e 61  ).  (let ((runna
a670: 6d 65 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  me (args:get-arg
a680: 20 22 3a 72 75 6e 6e 61 6d 65 22 29 29 0a 09 28   ":runname"))..(
a690: 74 61 72 67 65 74 20 20 28 69 66 20 28 61 72 67  target  (if (arg
a6a0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67  s:get-arg "-targ
a6b0: 65 74 22 29 0a 09 09 20 20 20 20 20 28 61 72 67  et")...     (arg
a6c0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67  s:get-arg "-targ
a6d0: 65 74 22 29 0a 09 09 20 20 20 20 20 28 61 72 67  et")...     (arg
a6e0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74  s:get-arg "-reqt
a6f0: 61 72 67 22 29 29 29 0a 09 28 74 68 31 20 20 20  arg")))..(th1   
a700: 20 20 23 66 29 29 0a 20 20 20 20 28 63 6f 6e 64    #f)).    (cond
a710: 0a 20 20 20 20 20 28 28 6e 6f 74 20 74 61 72 67  .     ((not targ
a720: 65 74 29 0a 20 20 20 20 20 20 28 64 65 62 75 67  et).      (debug
a730: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a  :print 0 "ERROR:
a740: 20 4d 69 73 73 69 6e 67 20 72 65 71 75 69 72 65   Missing require
a750: 64 20 70 61 72 61 6d 65 74 65 72 20 66 6f 72 20  d parameter for 
a760: 22 20 73 77 69 74 63 68 6e 61 6d 65 20 22 2c 20  " switchname ", 
a770: 79 6f 75 20 6d 75 73 74 20 73 70 65 63 69 66 79  you must specify
a780: 20 74 68 65 20 74 61 72 67 65 74 20 77 69 74 68   the target with
a790: 20 2d 74 61 72 67 65 74 22 29 0a 20 20 20 20 20   -target").     
a7a0: 20 28 65 78 69 74 20 33 29 29 0a 20 20 20 20 20   (exit 3)).     
a7b0: 28 28 6e 6f 74 20 72 75 6e 6e 61 6d 65 29 0a 20  ((not runname). 
a7c0: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
a7d0: 74 20 30 20 22 45 52 52 4f 52 3a 20 4d 69 73 73  t 0 "ERROR: Miss
a7e0: 69 6e 67 20 72 65 71 75 69 72 65 64 20 70 61 72  ing required par
a7f0: 61 6d 65 74 65 72 20 66 6f 72 20 22 20 73 77 69  ameter for " swi
a800: 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d  tchname ", you m
a810: 75 73 74 20 73 70 65 63 69 66 79 20 74 68 65 20  ust specify the 
a820: 72 75 6e 20 6e 61 6d 65 20 77 69 74 68 20 3a 72  run name with :r
a830: 75 6e 6e 61 6d 65 20 72 75 6e 6e 61 6d 65 22 29  unname runname")
a840: 0a 20 20 20 20 20 20 28 65 78 69 74 20 33 29 29  .      (exit 3))
a850: 0a 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20  .     (else.    
a860: 20 20 28 6c 65 74 20 28 28 64 62 20 20 20 23 66    (let ((db   #f
a870: 29 0a 09 20 20 20 20 28 6b 65 79 73 20 23 66 29  )..    (keys #f)
a880: 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 73 65 74  )..(if (not (set
a890: 75 70 2d 66 6f 72 2d 72 75 6e 29 29 0a 09 20 20  up-for-run))..  
a8a0: 20 20 28 62 65 67 69 6e 20 0a 09 20 20 20 20 20    (begin ..     
a8b0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
a8c0: 22 46 61 69 6c 65 64 20 74 6f 20 73 65 74 75 70  "Failed to setup
a8d0: 2c 20 65 78 69 74 69 6e 67 22 29 0a 09 20 20 20  , exiting")..   
a8e0: 20 20 20 28 65 78 69 74 20 31 29 29 29 0a 09 28     (exit 1)))..(
a8f0: 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  if (args:get-arg
a900: 20 22 2d 73 65 72 76 65 72 22 29 0a 09 20 20 20   "-server")..   
a910: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
a920: 20 73 65 72 76 65 72 3a 73 74 61 72 74 20 64 62   server:start db
a930: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
a940: 2d 73 65 72 76 65 72 22 29 29 29 0a 20 09 20 20  -server"))). .  
a950: 20 20 3b 3b 20 28 69 66 20 28 6e 6f 74 20 28 6f    ;; (if (not (o
a960: 72 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20  r (args:get-arg 
a970: 22 2d 72 75 6e 61 6c 6c 22 29 20 20 20 20 20 3b  "-runall")     ;
a980: 3b 20 72 75 6e 61 6c 6c 20 61 6e 64 20 72 75 6e  ; runall and run
a990: 74 65 73 74 73 20 61 72 65 20 61 6c 6c 6f 77 65  tests are allowe
a9a0: 64 20 74 6f 20 62 65 20 73 65 72 76 65 72 73 0a  d to be servers.
a9b0: 20 09 20 20 20 20 3b 3b 20 20 20 20 20 09 20 28   .    ;;     . (
a9c0: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72  args:get-arg "-r
a9d0: 75 6e 74 65 73 74 73 22 29 29 29 0a 09 20 20 20  untests")))..   
a9e0: 20 3b 3b 20 20 20 20 20 28 63 6c 69 65 6e 74 3a   ;;     (client:
a9f0: 73 65 74 75 70 29 20 3b 3b 20 54 68 69 73 20 69  setup) ;; This i
aa00: 73 20 61 20 64 75 70 6c 69 63 61 74 65 20 73 74  s a duplicate st
aa10: 61 72 74 75 70 21 21 21 3f 3f 3f 20 42 55 47 3f  artup!!!??? BUG?
aa20: 0a 09 20 20 20 20 3b 3b 20 20 20 20 20 29 29 0a  ..    ;;     )).
aa30: 09 28 73 65 74 21 20 6b 65 79 73 20 28 6f 70 65  .(set! keys (ope
aa40: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67  n-run-close db:g
aa50: 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 3b 3b  et-keys db))..;;
aa60: 20 68 61 76 65 20 65 6e 6f 75 67 68 20 74 6f 20   have enough to 
aa70: 70 72 6f 63 65 73 73 20 2d 74 61 72 67 65 74 20  process -target 
aa80: 6f 72 20 2d 72 65 71 74 61 72 67 20 68 65 72 65  or -reqtarg here
aa90: 0a 09 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d  ..(if (args:get-
aaa0: 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 0a  arg "-reqtarg").
aab0: 09 20 20 20 20 28 6c 65 74 2a 20 28 28 72 75 6e  .    (let* ((run
aac0: 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 20 2a  configf (conc  *
aad0: 74 6f 70 70 61 74 68 2a 20 22 2f 72 75 6e 63 6f  toppath* "/runco
aae0: 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22 29 29 20  nfigs.config")) 
aaf0: 3b 3b 20 44 4f 20 4e 4f 54 20 45 56 41 4c 55 41  ;; DO NOT EVALUA
ab00: 54 45 20 41 4c 4c 20 0a 09 09 20 20 20 28 72 75  TE ALL ...   (ru
ab10: 6e 63 6f 6e 66 69 67 20 20 28 72 65 61 64 2d 63  nconfig  (read-c
ab20: 6f 6e 66 69 67 20 72 75 6e 63 6f 6e 66 69 67 66  onfig runconfigf
ab30: 20 23 66 20 23 74 20 65 6e 76 69 72 6f 6e 2d 70   #f #t environ-p
ab40: 61 74 74 3a 20 23 66 29 29 29 20 0a 09 20 20 20  att: #f))) ..   
ab50: 20 20 20 28 69 66 20 28 68 61 73 68 2d 74 61 62     (if (hash-tab
ab60: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 72  le-ref/default r
ab70: 75 6e 63 6f 6e 66 69 67 20 28 61 72 67 73 3a 67  unconfig (args:g
ab80: 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67  et-arg "-reqtarg
ab90: 22 29 20 23 66 29 0a 09 09 20 20 28 6b 65 79 73  ") #f)...  (keys
aba0: 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 72 67 73  :target-set-args
abb0: 20 6b 65 79 73 20 28 61 72 67 73 3a 67 65 74 2d   keys (args:get-
abc0: 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 20  arg "-reqtarg") 
abd0: 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 0a 09  args:arg-hash)..
abe0: 09 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20  .  (begin...    
abf0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
ac00: 45 52 52 4f 52 3a 20 5b 22 20 28 61 72 67 73 3a  ERROR: [" (args:
ac10: 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72  get-arg "-reqtar
ac20: 67 22 29 20 22 5d 20 6e 6f 74 20 66 6f 75 6e 64  g") "] not found
ac30: 20 69 6e 20 22 20 72 75 6e 63 6f 6e 66 69 67 66   in " runconfigf
ac40: 29 0a 09 09 20 20 20 20 28 69 66 20 64 62 20 28  )...    (if db (
ac50: 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65  sqlite3:finalize
ac60: 21 20 64 62 29 29 0a 09 09 20 20 20 20 28 65 78  ! db))...    (ex
ac70: 69 74 20 31 29 29 29 29 0a 09 20 20 20 20 28 69  it 1))))..    (i
ac80: 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20  f (args:get-arg 
ac90: 22 2d 74 61 72 67 65 74 22 29 0a 09 09 28 6b 65  "-target")...(ke
aca0: 79 73 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 72  ys:target-set-ar
acb0: 67 73 20 6b 65 79 73 20 28 61 72 67 73 3a 67 65  gs keys (args:ge
acc0: 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 20  t-arg "-target" 
acd0: 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 20 61  args:arg-hash) a
ace0: 72 67 73 3a 61 72 67 2d 68 61 73 68 29 29 29 0a  rgs:arg-hash))).
acf0: 09 28 69 66 20 28 6e 6f 74 20 28 63 61 72 20 2a  .(if (not (car *
ad00: 63 6f 6e 66 69 67 69 6e 66 6f 2a 29 29 0a 09 20  configinfo*)).. 
ad10: 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20     (begin..     
ad20: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
ad30: 22 45 52 52 4f 52 3a 20 41 74 74 65 6d 70 74 65  "ERROR: Attempte
ad40: 64 20 74 6f 20 22 20 61 63 74 69 6f 6e 2d 64 65  d to " action-de
ad50: 73 63 20 22 20 62 75 74 20 72 75 6e 20 61 72 65  sc " but run are
ad60: 61 20 63 6f 6e 66 69 67 20 66 69 6c 65 20 6e 6f  a config file no
ad70: 74 20 66 6f 75 6e 64 22 29 0a 09 20 20 20 20 20  t found")..     
ad80: 20 28 65 78 69 74 20 31 29 29 0a 09 20 20 20 20   (exit 1))..    
ad90: 3b 3b 20 45 78 74 72 61 63 74 20 6f 75 74 20 73  ;; Extract out s
ada0: 74 75 66 66 20 6e 65 65 64 65 64 20 69 6e 20 6d  tuff needed in m
adb0: 6f 73 74 20 6f 72 20 6d 61 6e 79 20 63 61 6c 6c  ost or many call
adc0: 73 0a 09 20 20 20 20 3b 3b 20 68 65 72 65 20 74  s..    ;; here t
add0: 68 65 6e 20 63 61 6c 6c 20 70 72 6f 63 0a 09 20  hen call proc.. 
ade0: 20 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 6e 61     (let* ((keyna
adf0: 6d 65 73 20 20 20 28 6d 61 70 20 6b 65 79 3a 67  mes   (map key:g
ae00: 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79  et-fieldname key
ae10: 73 29 29 0a 09 09 20 20 20 28 6b 65 79 76 61 6c  s))...   (keyval
ae20: 6c 73 74 20 20 28 6b 65 79 73 2d 3e 76 61 6c 6c  lst  (keys->vall
ae30: 69 73 74 20 6b 65 79 73 20 23 74 29 29 29 0a 09  ist keys #t)))..
ae40: 20 20 20 20 20 20 28 70 72 6f 63 20 74 61 72 67        (proc targ
ae50: 65 74 20 72 75 6e 6e 61 6d 65 20 6b 65 79 73 20  et runname keys 
ae60: 6b 65 79 6e 61 6d 65 73 20 6b 65 79 76 61 6c 6c  keynames keyvall
ae70: 73 74 29 29 29 0a 09 28 69 66 20 74 68 31 20 28  st)))..(if th1 (
ae80: 74 68 72 65 61 64 2d 6a 6f 69 6e 21 20 74 68 31  thread-join! th1
ae90: 29 29 0a 09 28 69 66 20 64 62 20 28 73 71 6c 69  ))..(if db (sqli
aea0: 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62  te3:finalize! db
aeb0: 29 29 0a 09 28 73 65 74 21 20 2a 64 69 64 73 6f  ))..(set! *didso
aec0: 6d 65 74 68 69 6e 67 2a 20 23 74 29 29 29 29 29  mething* #t)))))
aed0: 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  )..;;===========
aee0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
aef0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
af00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
af10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4c  ===========.;; L
af20: 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 72 75 6e 73 0a  ock/unlock runs.
af30: 3b 3b 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 3d 3d 3d 3d  ================
af70: 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e  ========..(defin
af80: 65 20 28 72 75 6e 73 3a 68 61 6e 64 6c 65 2d 6c  e (runs:handle-l
af90: 6f 63 6b 69 6e 67 20 74 61 72 67 65 74 20 6b 65  ocking target ke
afa0: 79 73 20 72 75 6e 6e 61 6d 65 20 6c 6f 63 6b 20  ys runname lock 
afb0: 75 6e 6c 6f 63 6b 20 75 73 65 72 29 0a 20 20 28  unlock user).  (
afc0: 6c 65 74 2a 20 28 28 64 62 20 20 20 20 20 20 20  let* ((db       
afd0: 23 66 29 0a 09 20 28 72 75 6e 64 61 74 20 20 20  #f).. (rundat   
afe0: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
aff0: 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79  runs:get-runs-by
b000: 2d 70 61 74 74 20 64 62 20 6b 65 79 73 20 72 75  -patt db keys ru
b010: 6e 6e 61 6d 65 29 29 0a 09 20 28 68 65 61 64 65  nname)).. (heade
b020: 72 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20  r   (vector-ref 
b030: 72 75 6e 64 61 74 20 30 29 29 0a 09 20 28 72 75  rundat 0)).. (ru
b040: 6e 73 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72  ns     (vector-r
b050: 65 66 20 72 75 6e 64 61 74 20 31 29 29 29 0a 20  ef rundat 1))). 
b060: 20 20 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61     (for-each (la
b070: 6d 62 64 61 20 28 72 75 6e 29 0a 09 09 28 6c 65  mbda (run)...(le
b080: 74 20 28 28 72 75 6e 2d 69 64 20 28 64 62 3a 67  t ((run-id (db:g
b090: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64  et-value-by-head
b0a0: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 69  er run header "i
b0b0: 64 22 29 29 29 0a 09 09 20 20 28 69 66 20 28 6f  d")))...  (if (o
b0c0: 72 20 6c 6f 63 6b 0a 09 09 09 20 20 28 61 6e 64  r lock....  (and
b0d0: 20 75 6e 6c 6f 63 6b 0a 09 09 09 20 20 20 20 20   unlock....     
b0e0: 20 20 28 62 65 67 69 6e 0a 09 09 09 09 20 28 70    (begin..... (p
b0f0: 72 69 6e 74 20 22 44 6f 20 79 6f 75 20 72 65 61  rint "Do you rea
b100: 6c 6c 79 20 77 69 73 68 20 74 6f 20 75 6e 6c 6f  lly wish to unlo
b110: 63 6b 20 72 75 6e 20 22 20 72 75 6e 2d 69 64 20  ck run " run-id 
b120: 22 3f 5c 6e 20 20 20 79 2f 6e 3a 20 22 29 0a 09  "?\n   y/n: ")..
b130: 09 09 09 20 28 65 71 75 61 6c 3f 20 22 79 22 20  ... (equal? "y" 
b140: 28 72 65 61 64 2d 6c 69 6e 65 29 29 29 29 29 0a  (read-line))))).
b150: 09 09 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75  ..      (open-ru
b160: 6e 2d 63 6c 6f 73 65 20 64 62 3a 6c 6f 63 6b 2f  n-close db:lock/
b170: 75 6e 6c 6f 63 6b 2d 72 75 6e 20 64 62 20 72 75  unlock-run db ru
b180: 6e 2d 69 64 20 6c 6f 63 6b 20 75 6e 6c 6f 63 6b  n-id lock unlock
b190: 20 75 73 65 72 29 0a 09 09 20 20 20 20 20 20 28   user)...      (
b1a0: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
b1b0: 20 30 20 22 53 6b 69 70 70 69 6e 67 20 6c 6f 63   0 "Skipping loc
b1c0: 6b 2f 75 6e 6c 6f 63 6b 20 6f 6e 20 22 20 72 75  k/unlock on " ru
b1d0: 6e 2d 69 64 29 29 29 29 0a 09 20 20 20 20 20 20  n-id))))..      
b1e0: 72 75 6e 73 29 29 29 0a 3b 3b 3d 3d 3d 3d 3d 3d  runs))).;;======
b1f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b200: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b210: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b220: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b230: 0a 3b 3b 20 52 6f 6c 6c 75 70 20 72 75 6e 73 0a  .;; Rollup runs.
b240: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;;==============
b250: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b260: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b270: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b280: 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 55 70 64  ========..;; Upd
b290: 61 74 65 20 74 68 65 20 74 65 73 74 5f 6d 65 74  ate the test_met
b2a0: 61 20 74 61 62 6c 65 20 66 6f 72 20 74 68 69 73  a table for this
b2b0: 20 74 65 73 74 0a 28 64 65 66 69 6e 65 20 28 72   test.(define (r
b2c0: 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f  uns:update-test_
b2d0: 6d 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d  meta db test-nam
b2e0: 65 20 74 65 73 74 2d 63 6f 6e 66 29 0a 20 20 28  e test-conf).  (
b2f0: 6c 65 74 20 28 28 63 75 72 72 72 65 63 6f 72 64  let ((currrecord
b300: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
b310: 20 64 62 3a 74 65 73 74 6d 65 74 61 2d 67 65 74   db:testmeta-get
b320: 2d 72 65 63 6f 72 64 20 64 62 20 74 65 73 74 2d  -record db test-
b330: 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 69 66 20  name))).    (if 
b340: 28 6e 6f 74 20 63 75 72 72 72 65 63 6f 72 64 29  (not currrecord)
b350: 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 73 65 74  ..(begin..  (set
b360: 21 20 63 75 72 72 72 65 63 6f 72 64 20 28 6d 61  ! currrecord (ma
b370: 6b 65 2d 76 65 63 74 6f 72 20 31 30 20 23 66 29  ke-vector 10 #f)
b380: 29 0a 09 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63  )..  (open-run-c
b390: 6c 6f 73 65 20 64 62 3a 74 65 73 74 6d 65 74 61  lose db:testmeta
b3a0: 2d 61 64 64 2d 72 65 63 6f 72 64 20 64 62 20 74  -add-record db t
b3b0: 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20  est-name))).    
b3c0: 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20  (for-each .     
b3d0: 28 6c 61 6d 62 64 61 20 28 6b 65 79 29 0a 20 20  (lambda (key).  
b3e0: 20 20 20 20 20 28 6c 65 74 2a 20 28 28 69 64 78       (let* ((idx
b3f0: 20 28 63 61 64 72 20 6b 65 79 29 29 0a 09 20 20   (cadr key))..  
b400: 20 20 20 20 28 66 6c 64 20 28 63 61 72 20 20 6b      (fld (car  k
b410: 65 79 29 29 0a 09 20 20 20 20 20 20 28 76 61 6c  ey))..      (val
b420: 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20   (config-lookup 
b430: 74 65 73 74 2d 63 6f 6e 66 20 22 74 65 73 74 5f  test-conf "test_
b440: 6d 65 74 61 22 20 66 6c 64 29 29 29 0a 09 20 3b  meta" fld))).. ;
b450: 3b 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 35  ; (debug:print 5
b460: 20 22 69 64 78 3a 20 22 20 69 64 78 20 22 20 66   "idx: " idx " f
b470: 6c 64 3a 20 22 20 66 6c 64 20 22 20 76 61 6c 3a  ld: " fld " val:
b480: 20 22 20 76 61 6c 29 0a 09 20 28 69 66 20 28 61   " val).. (if (a
b490: 6e 64 20 76 61 6c 20 28 6e 6f 74 20 28 65 71 75  nd val (not (equ
b4a0: 61 6c 3f 20 28 76 65 63 74 6f 72 2d 72 65 66 20  al? (vector-ref 
b4b0: 63 75 72 72 72 65 63 6f 72 64 20 69 64 78 29 20  currrecord idx) 
b4c0: 76 61 6c 29 29 29 0a 09 20 20 20 20 20 28 62 65  val)))..     (be
b4d0: 67 69 6e 0a 09 20 20 20 20 20 20 20 28 70 72 69  gin..       (pri
b4e0: 6e 74 20 22 55 70 64 61 74 69 6e 67 20 22 20 74  nt "Updating " t
b4f0: 65 73 74 2d 6e 61 6d 65 20 22 20 22 20 66 6c 64  est-name " " fld
b500: 20 22 20 74 6f 20 22 20 76 61 6c 29 0a 09 20 20   " to " val)..  
b510: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
b520: 6c 6f 73 65 20 64 62 3a 74 65 73 74 6d 65 74 61  lose db:testmeta
b530: 2d 75 70 64 61 74 65 2d 66 69 65 6c 64 20 64 62  -update-field db
b540: 20 74 65 73 74 2d 6e 61 6d 65 20 66 6c 64 20 76   test-name fld v
b550: 61 6c 29 29 29 29 29 0a 20 20 20 20 20 27 28 28  al))))).     '((
b560: 22 61 75 74 68 6f 72 22 20 32 29 28 22 6f 77 6e  "author" 2)("own
b570: 65 72 22 20 33 29 28 22 64 65 73 63 72 69 70 74  er" 3)("descript
b580: 69 6f 6e 22 20 34 29 28 22 72 65 76 69 65 77 65  ion" 4)("reviewe
b590: 64 22 20 35 29 28 22 74 61 67 73 22 20 39 29 29  d" 5)("tags" 9))
b5a0: 29 29 29 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74  )))..;; Update t
b5b0: 65 73 74 5f 6d 65 74 61 20 66 6f 72 20 61 6c 6c  est_meta for all
b5c0: 20 74 65 73 74 73 0a 28 64 65 66 69 6e 65 20 28   tests.(define (
b5d0: 72 75 6e 73 3a 75 70 64 61 74 65 2d 61 6c 6c 2d  runs:update-all-
b5e0: 74 65 73 74 5f 6d 65 74 61 20 64 62 29 0a 20 20  test_meta db).  
b5f0: 28 6c 65 74 20 28 28 74 65 73 74 2d 6e 61 6d 65  (let ((test-name
b600: 73 20 28 67 65 74 2d 61 6c 6c 2d 6c 65 67 61 6c  s (get-all-legal
b610: 2d 74 65 73 74 73 29 29 29 0a 20 20 20 20 28 66  -tests))).    (f
b620: 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c  or-each .     (l
b630: 61 6d 62 64 61 20 28 74 65 73 74 2d 6e 61 6d 65  ambda (test-name
b640: 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28  ).       (let* (
b650: 28 74 65 73 74 2d 70 61 74 68 20 20 20 20 28 63  (test-path    (c
b660: 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f  onc *toppath* "/
b670: 74 65 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d  tests/" test-nam
b680: 65 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 74  e))..      (test
b690: 2d 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 74  -configf (conc t
b6a0: 65 73 74 2d 70 61 74 68 20 22 2f 74 65 73 74 63  est-path "/testc
b6b0: 6f 6e 66 69 67 22 29 29 0a 09 20 20 20 20 20 20  onfig"))..      
b6c0: 28 74 65 73 74 65 78 69 73 74 73 20 20 20 28 61  (testexists   (a
b6d0: 6e 64 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f  nd (file-exists?
b6e0: 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 28 66   test-configf)(f
b6f0: 69 6c 65 2d 72 65 61 64 2d 61 63 63 65 73 73 3f  ile-read-access?
b700: 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 29 29   test-configf)))
b710: 0a 09 20 20 20 20 20 20 3b 3b 20 72 65 61 64 20  ..      ;; read 
b720: 63 6f 6e 66 69 67 73 20 77 69 74 68 20 74 72 69  configs with tri
b730: 63 6b 73 20 74 75 72 6e 65 64 20 6f 66 66 20 28  cks turned off (
b740: 69 2e 65 2e 20 6e 6f 20 73 79 73 74 65 6d 29 0a  i.e. no system).
b750: 09 20 20 20 20 20 20 28 74 65 73 74 2d 63 6f 6e  .      (test-con
b760: 66 20 20 20 20 28 69 66 20 74 65 73 74 65 78 69  f    (if testexi
b770: 73 74 73 20 28 72 65 61 64 2d 63 6f 6e 66 69 67  sts (read-config
b780: 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 23 66   test-configf #f
b790: 20 23 66 29 28 6d 61 6b 65 2d 68 61 73 68 2d 74   #f)(make-hash-t
b7a0: 61 62 6c 65 29 29 29 29 0a 09 20 3b 3b 20 75 73  able)))).. ;; us
b7b0: 65 20 74 68 65 20 6f 70 65 6e 2d 72 75 6e 2d 63  e the open-run-c
b7c0: 6c 6f 73 65 20 69 6e 73 74 65 61 64 20 6f 66 20  lose instead of 
b7d0: 70 61 73 73 69 6e 67 20 69 6e 20 64 62 0a 09 20  passing in db.. 
b7e0: 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73  (runs:update-tes
b7f0: 74 5f 6d 65 74 61 20 23 66 20 74 65 73 74 2d 6e  t_meta #f test-n
b800: 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 29 29  ame test-conf)))
b810: 0a 20 20 20 20 20 74 65 73 74 2d 6e 61 6d 65 73  .     test-names
b820: 29 29 29 0a 0a 3b 3b 20 54 68 69 73 20 63 6f 75  )))..;; This cou
b830: 6c 64 20 70 72 6f 62 61 62 6c 79 20 62 65 20 72  ld probably be r
b840: 65 66 61 63 74 6f 72 65 64 20 69 6e 74 6f 20 6f  efactored into o
b850: 6e 65 20 63 6f 6d 70 6c 65 78 20 71 75 65 72 79  ne complex query
b860: 20 2e 2e 2e 0a 28 64 65 66 69 6e 65 20 28 72 75   ....(define (ru
b870: 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 20 6b 65  ns:rollup-run ke
b880: 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e  ys keyvallst run
b890: 6e 61 6d 65 20 75 73 65 72 29 20 3b 3b 20 77 61  name user) ;; wa
b8a0: 73 20 74 61 72 67 65 74 2c 20 6e 6f 77 20 6b 65  s target, now ke
b8b0: 79 76 61 6c 6c 73 74 0a 20 20 28 64 65 62 75 67  yvallst.  (debug
b8c0: 3a 70 72 69 6e 74 20 34 20 22 72 75 6e 73 3a 72  :print 4 "runs:r
b8d0: 6f 6c 6c 75 70 2d 72 75 6e 2c 20 6b 65 79 73 3a  ollup-run, keys:
b8e0: 20 22 20 6b 65 79 73 20 22 20 6b 65 79 76 61 6c   " keys " keyval
b8f0: 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74  lst: " keyvallst
b900: 20 22 20 3a 72 75 6e 6e 61 6d 65 20 22 20 72 75   " :runname " ru
b910: 6e 6e 61 6d 65 20 22 20 75 73 65 72 3a 20 22 20  nname " user: " 
b920: 75 73 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 28  user).  (let* ((
b930: 64 62 20 20 20 20 20 20 20 20 20 20 20 20 20 20  db              
b940: 23 66 29 20 3b 3b 20 28 6b 65 79 76 61 6c 6c 6c  #f) ;; (keyvalll
b950: 73 74 20 20 20 20 20 20 28 6b 65 79 73 3a 74 61  st      (keys:ta
b960: 72 67 65 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 79  rget->keyval key
b970: 73 20 74 61 72 67 65 74 29 29 0a 09 20 28 6e 65  s target)).. (ne
b980: 77 2d 72 75 6e 2d 69 64 20 20 20 20 20 20 28 63  w-run-id      (c
b990: 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64 62  db:remote-run db
b9a0: 3a 72 65 67 69 73 74 65 72 2d 72 75 6e 20 23 66  :register-run #f
b9b0: 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20   keys keyvallst 
b9c0: 72 75 6e 6e 61 6d 65 20 22 6e 65 77 22 20 22 6e  runname "new" "n
b9d0: 2f 61 22 20 75 73 65 72 29 29 0a 09 20 28 70 72  /a" user)).. (pr
b9e0: 65 76 2d 74 65 73 74 73 20 20 20 20 20 20 28 6f  ev-tests      (o
b9f0: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 74 65  pen-run-close te
ba00: 73 74 3a 67 65 74 2d 6d 61 74 63 68 69 6e 67 2d  st:get-matching-
ba10: 70 72 65 76 69 6f 75 73 2d 74 65 73 74 2d 72 75  previous-test-ru
ba20: 6e 2d 72 65 63 6f 72 64 73 20 64 62 20 6e 65 77  n-records db new
ba30: 2d 72 75 6e 2d 69 64 20 22 25 22 20 22 25 22 29  -run-id "%" "%")
ba40: 29 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73 20  ).. (curr-tests 
ba50: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
ba60: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74  lose db:get-test
ba70: 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77  s-for-run db new
ba80: 2d 72 75 6e 2d 69 64 20 22 25 2f 25 22 20 27 28  -run-id "%/%" '(
ba90: 29 20 27 28 29 29 29 0a 09 20 28 63 75 72 72 2d  ) '())).. (curr-
baa0: 74 65 73 74 73 2d 68 61 73 68 20 28 6d 61 6b 65  tests-hash (make
bab0: 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 20  -hash-table))). 
bac0: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f     (open-run-clo
bad0: 73 65 20 64 62 3a 75 70 64 61 74 65 2d 72 75 6e  se db:update-run
bae0: 2d 65 76 65 6e 74 5f 74 69 6d 65 20 64 62 20 6e  -event_time db n
baf0: 65 77 2d 72 75 6e 2d 69 64 29 0a 20 20 20 20 3b  ew-run-id).    ;
bb00: 3b 20 69 6e 64 65 78 20 74 68 65 20 61 6c 72 65  ; index the alre
bb10: 61 64 79 20 73 61 76 65 64 20 74 65 73 74 73 20  ady saved tests 
bb20: 62 79 20 74 65 73 74 6e 61 6d 65 20 61 6e 64 20  by testname and 
bb30: 69 74 65 6d 64 61 74 20 69 6e 20 63 75 72 72 2d  itemdat in curr-
bb40: 74 65 73 74 73 2d 68 61 73 68 0a 20 20 20 20 28  tests-hash.    (
bb50: 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 28 6c  for-each.     (l
bb60: 61 6d 62 64 61 20 28 74 65 73 74 64 61 74 29 0a  ambda (testdat).
bb70: 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74         (let* ((t
bb80: 65 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 65 73  estname  (db:tes
bb90: 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74  t-get-testname t
bba0: 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20  estdat))..      
bbb0: 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74  (item-path (db:t
bbc0: 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74  est-get-item-pat
bbd0: 68 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20  h testdat))..   
bbe0: 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 63     (full-name (c
bbf0: 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22  onc testname "/"
bc00: 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 09 20   item-path))).. 
bc10: 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21  (hash-table-set!
bc20: 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68   curr-tests-hash
bc30: 20 66 75 6c 6c 2d 6e 61 6d 65 20 74 65 73 74 64   full-name testd
bc40: 61 74 29 29 29 0a 20 20 20 20 20 63 75 72 72 2d  at))).     curr-
bc50: 74 65 73 74 73 29 0a 20 20 20 20 3b 3b 20 4e 4f  tests).    ;; NO
bc60: 50 45 3a 20 4e 6f 6e 2d 6f 70 74 69 6d 61 6c 20  PE: Non-optimal 
bc70: 61 70 70 72 6f 61 63 68 2e 20 54 72 79 20 74 68  approach. Try th
bc80: 69 73 20 69 6e 73 74 65 61 64 2e 0a 20 20 20 20  is instead..    
bc90: 3b 3b 20 20 20 31 2e 20 74 65 73 74 73 20 61 72  ;;   1. tests ar
bca0: 65 20 72 65 63 65 69 76 65 64 20 69 6e 20 61 20  e received in a 
bcb0: 6c 69 73 74 2c 20 6d 6f 73 74 20 72 65 63 65 6e  list, most recen
bcc0: 74 20 66 69 72 73 74 0a 20 20 20 20 3b 3b 20 20  t first.    ;;  
bcd0: 20 32 2e 20 72 65 70 6c 61 63 65 20 74 68 65 20   2. replace the 
bce0: 72 6f 6c 6c 75 70 20 74 65 73 74 20 77 69 74 68  rollup test with
bcf0: 20 74 68 65 20 6e 65 77 20 2a 61 6c 77 61 79 73   the new *always
bd00: 2a 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20  *.    (for-each 
bd10: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74  .     (lambda (t
bd20: 65 73 74 64 61 74 29 0a 20 20 20 20 20 20 20 28  estdat).       (
bd30: 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 20  let* ((testname 
bd40: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65   (db:test-get-te
bd50: 73 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29  stname testdat))
bd60: 0a 09 20 20 20 20 20 20 28 69 74 65 6d 2d 70 61  ..      (item-pa
bd70: 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  th (db:test-get-
bd80: 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 64 61  item-path testda
bd90: 74 29 29 0a 09 20 20 20 20 20 20 28 66 75 6c 6c  t))..      (full
bda0: 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74  -name (conc test
bdb0: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61  name "/" item-pa
bdc0: 74 68 29 29 0a 09 20 20 20 20 20 20 28 70 72 65  th))..      (pre
bdd0: 76 2d 74 65 73 74 2d 64 61 74 20 28 68 61 73 68  v-test-dat (hash
bde0: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75  -table-ref/defau
bdf0: 6c 74 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61  lt curr-tests-ha
be00: 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 23 66 29  sh full-name #f)
be10: 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d 73  )..      (test-s
be20: 74 65 70 73 20 20 20 20 20 20 28 6f 70 65 6e 2d  teps      (open-
be30: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
be40: 2d 73 74 65 70 73 2d 66 6f 72 2d 74 65 73 74 20  -steps-for-test 
be50: 64 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  db (db:test-get-
be60: 69 64 20 74 65 73 74 64 61 74 29 29 29 0a 09 20  id testdat))).. 
be70: 20 20 20 20 20 28 6e 65 77 2d 74 65 73 74 2d 72       (new-test-r
be80: 65 63 6f 72 64 20 23 66 29 29 0a 09 20 3b 3b 20  ecord #f)).. ;; 
be90: 72 65 70 6c 61 63 65 20 74 68 65 73 65 20 77 69  replace these wi
bea0: 74 68 20 69 6e 73 65 72 74 20 2e 2e 2e 20 73 65  th insert ... se
beb0: 6c 65 63 74 0a 09 20 28 61 70 70 6c 79 20 73 71  lect.. (apply sq
bec0: 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09  lite3:execute ..
bed0: 09 64 62 20 0a 09 09 28 63 6f 6e 63 20 22 49 4e  .db ...(conc "IN
bee0: 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20  SERT OR REPLACE 
bef0: 49 4e 54 4f 20 74 65 73 74 73 20 28 72 75 6e 5f  INTO tests (run_
bf00: 69 64 2c 74 65 73 74 6e 61 6d 65 2c 73 74 61 74  id,testname,stat
bf10: 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74  e,status,event_t
bf20: 69 6d 65 2c 68 6f 73 74 2c 63 70 75 6c 6f 61 64  ime,host,cpuload
bf30: 2c 64 69 73 6b 66 72 65 65 2c 75 6e 61 6d 65 2c  ,diskfree,uname,
bf40: 72 75 6e 64 69 72 2c 69 74 65 6d 5f 70 61 74 68  rundir,item_path
bf50: 2c 72 75 6e 5f 64 75 72 61 74 69 6f 6e 2c 66 69  ,run_duration,fi
bf60: 6e 61 6c 5f 6c 6f 67 66 2c 63 6f 6d 6d 65 6e 74  nal_logf,comment
bf70: 29 20 22 0a 09 09 20 20 20 20 20 20 22 56 41 4c  ) "...      "VAL
bf80: 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f  UES (?,?,?,?,?,?
bf90: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f  ,?,?,?,?,?,?,?,?
bfa0: 29 3b 22 29 0a 09 09 6e 65 77 2d 72 75 6e 2d 69  );")...new-run-i
bfb0: 64 20 28 63 64 64 72 20 28 76 65 63 74 6f 72 2d  d (cddr (vector-
bfc0: 3e 6c 69 73 74 20 74 65 73 74 64 61 74 29 29 29  >list testdat)))
bfd0: 0a 09 20 28 73 65 74 21 20 6e 65 77 2d 74 65 73  .. (set! new-tes
bfe0: 74 64 61 74 20 28 63 61 72 20 28 6f 70 65 6e 2d  tdat (car (open-
bff0: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
c000: 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64  -tests-for-run d
c010: 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 28 63 6f  b new-run-id (co
c020: 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22 20  nc testname "/" 
c030: 69 74 65 6d 2d 70 61 74 68 29 20 27 28 29 20 27  item-path) '() '
c040: 28 29 29 29 29 0a 09 20 28 68 61 73 68 2d 74 61  ()))).. (hash-ta
c050: 62 6c 65 2d 73 65 74 21 20 63 75 72 72 2d 74 65  ble-set! curr-te
c060: 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61  sts-hash full-na
c070: 6d 65 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20  me new-testdat) 
c080: 3b 3b 20 74 68 69 73 20 63 6f 75 6c 64 20 62 65  ;; this could be
c090: 20 63 6f 6e 66 75 73 69 6e 67 2c 20 77 68 69 63   confusing, whic
c0a0: 68 20 72 65 63 6f 72 64 20 73 68 6f 75 6c 64 20  h record should 
c0b0: 67 6f 20 69 6e 74 6f 20 74 68 65 20 6c 6f 6f 6b  go into the look
c0c0: 75 70 20 74 61 62 6c 65 3f 0a 09 20 3b 3b 20 4e  up table?.. ;; N
c0d0: 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74 68 65  ow duplicate the
c0e0: 20 74 65 73 74 20 73 74 65 70 73 0a 09 20 28 64   test steps.. (d
c0f0: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 43 6f  ebug:print 4 "Co
c100: 70 79 69 6e 67 20 72 65 63 6f 72 64 73 20 69 6e  pying records in
c110: 20 74 65 73 74 5f 73 74 65 70 73 20 66 72 6f 6d   test_steps from
c120: 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62 3a 74   test_id=" (db:t
c130: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64  est-get-id testd
c140: 61 74 29 20 22 20 74 6f 20 22 20 28 64 62 3a 74  at) " to " (db:t
c150: 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74  est-get-id new-t
c160: 65 73 74 64 61 74 29 29 0a 09 20 28 6f 70 65 6e  estdat)).. (open
c170: 2d 72 75 6e 2d 63 6c 6f 73 65 20 0a 09 20 20 28  -run-close ..  (
c180: 6c 61 6d 62 64 61 20 28 29 0a 09 20 20 20 20 28  lambda ()..    (
c190: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20  sqlite3:execute 
c1a0: 0a 09 20 20 20 20 20 64 62 20 0a 09 20 20 20 20  ..     db ..    
c1b0: 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f   (conc "INSERT O
c1c0: 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74  R REPLACE INTO t
c1d0: 65 73 74 5f 73 74 65 70 73 20 28 74 65 73 74 5f  est_steps (test_
c1e0: 69 64 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 74  id,stepname,stat
c1f0: 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74  e,status,event_t
c200: 69 6d 65 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09  ime,comment) "..
c210: 09 20 20 20 22 53 45 4c 45 43 54 20 22 20 28 64  .   "SELECT " (d
c220: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65  b:test-get-id ne
c230: 77 2d 74 65 73 74 64 61 74 29 20 22 2c 73 74 65  w-testdat) ",ste
c240: 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74  pname,state,stat
c250: 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f  us,event_time,co
c260: 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f  mment FROM test_
c270: 73 74 65 70 73 20 57 48 45 52 45 20 74 65 73 74  steps WHERE test
c280: 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 20 20 20 28  _id=?;")..     (
c290: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74  db:test-get-id t
c2a0: 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 3b 3b  estdat))..    ;;
c2b0: 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74   Now duplicate t
c2c0: 68 65 20 74 65 73 74 20 64 61 74 61 0a 09 20 20  he test data..  
c2d0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34    (debug:print 4
c2e0: 20 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64   "Copying record
c2f0: 73 20 69 6e 20 74 65 73 74 5f 64 61 74 61 20 66  s in test_data f
c300: 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64  rom test_id=" (d
c310: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65  b:test-get-id te
c320: 73 74 64 61 74 29 20 22 20 74 6f 20 22 20 28 64  stdat) " to " (d
c330: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65  b:test-get-id ne
c340: 77 2d 74 65 73 74 64 61 74 29 29 0a 09 20 20 20  w-testdat))..   
c350: 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74   (sqlite3:execut
c360: 65 20 0a 09 20 20 20 20 20 64 62 20 0a 09 20 20  e ..     db ..  
c370: 20 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54     (conc "INSERT
c380: 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f   OR REPLACE INTO
c390: 20 74 65 73 74 5f 64 61 74 61 20 28 74 65 73 74   test_data (test
c3a0: 5f 69 64 2c 63 61 74 65 67 6f 72 79 2c 76 61 72  _id,category,var
c3b0: 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65  iable,value,expe
c3c0: 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63  cted,tol,units,c
c3d0: 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 22  omment) "...   "
c3e0: 53 45 4c 45 43 54 20 22 20 28 64 62 3a 74 65 73  SELECT " (db:tes
c3f0: 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73  t-get-id new-tes
c400: 74 64 61 74 29 20 22 2c 63 61 74 65 67 6f 72 79  tdat) ",category
c410: 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c  ,variable,value,
c420: 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69  expected,tol,uni
c430: 74 73 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20  ts,comment FROM 
c440: 74 65 73 74 5f 64 61 74 61 20 57 48 45 52 45 20  test_data WHERE 
c450: 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20  test_id=?;")..  
c460: 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d     (db:test-get-
c470: 69 64 20 74 65 73 74 64 61 74 29 29 29 29 0a 09  id testdat))))..
c480: 20 29 29 0a 20 20 20 20 20 70 72 65 76 2d 74 65   )).     prev-te
c490: 73 74 73 29 29 29 0a 09 20 0a 20 20 20 20 20 0a  sts))).. .     .