Megatest

Hex Artifact Content
Login

Artifact b02ed68626b1aab496b59a673e9f0a272ead6a33:


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 3b 3b 20 72 65 67 69 73 74 65  ====..;; registe
1b70: 72 20 61 20 74 65 73 74 20 72 75 6e 20 77 69 74  r a test run wit
1b80: 68 20 74 68 65 20 64 62 0a 28 64 65 66 69 6e 65  h the db.(define
1b90: 20 28 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d   (runs:register-
1ba0: 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76  run db keys keyv
1bb0: 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 73 74  allst runname st
1bc0: 61 74 65 20 73 74 61 74 75 73 20 75 73 65 72 29  ate status user)
1bd0: 0a 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  .  (debug:print 
1be0: 33 20 22 72 75 6e 73 3a 72 65 67 69 73 74 65 72  3 "runs:register
1bf0: 2d 72 75 6e 2c 20 6b 65 79 73 3a 20 22 20 6b 65  -run, keys: " ke
1c00: 79 73 20 22 20 6b 65 79 76 61 6c 6c 73 74 3a 20  ys " keyvallst: 
1c10: 22 20 6b 65 79 76 61 6c 6c 73 74 20 22 20 72 75  " keyvallst " ru
1c20: 6e 6e 61 6d 65 3a 20 22 20 72 75 6e 6e 61 6d 65  nname: " runname
1c30: 20 22 20 73 74 61 74 65 3a 20 22 20 73 74 61 74   " state: " stat
1c40: 65 20 22 20 73 74 61 74 75 73 3a 20 22 20 73 74  e " status: " st
1c50: 61 74 75 73 20 22 20 75 73 65 72 3a 20 22 20 75  atus " user: " u
1c60: 73 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 28 6b  ser).  (let* ((k
1c70: 65 79 73 74 72 20 20 20 20 28 6b 65 79 73 2d 3e  eystr    (keys->
1c80: 6b 65 79 73 74 72 20 6b 65 79 73 29 29 0a 09 20  keystr keys)).. 
1c90: 28 63 6f 6d 6d 61 20 20 20 20 20 28 69 66 20 28  (comma     (if (
1ca0: 3e 20 28 6c 65 6e 67 74 68 20 6b 65 79 73 29 20  > (length keys) 
1cb0: 30 29 20 22 2c 22 20 22 22 29 29 0a 09 20 28 61  0) "," "")).. (a
1cc0: 6e 64 73 74 72 20 20 20 20 28 69 66 20 28 3e 20  ndstr    (if (> 
1cd0: 28 6c 65 6e 67 74 68 20 6b 65 79 73 29 20 30 29  (length keys) 0)
1ce0: 20 22 20 41 4e 44 20 22 20 22 22 29 29 0a 09 20   " AND " "")).. 
1cf0: 28 76 61 6c 73 6c 6f 74 73 20 20 28 6b 65 79 73  (valslots  (keys
1d00: 2d 3e 76 61 6c 73 6c 6f 74 73 20 6b 65 79 73 29  ->valslots keys)
1d10: 29 20 3b 3b 20 3f 2c 3f 2c 3f 20 2e 2e 2e 0a 09  ) ;; ?,?,? .....
1d20: 20 28 6b 65 79 76 61 6c 73 20 20 20 28 6d 61 70   (keyvals   (map
1d30: 20 63 61 64 72 20 6b 65 79 76 61 6c 6c 73 74 29   cadr keyvallst)
1d40: 29 0a 09 20 28 61 6c 6c 76 61 6c 73 20 20 20 28  ).. (allvals   (
1d50: 61 70 70 65 6e 64 20 28 6c 69 73 74 20 72 75 6e  append (list run
1d60: 6e 61 6d 65 20 73 74 61 74 65 20 73 74 61 74 75  name state statu
1d70: 73 20 75 73 65 72 29 20 6b 65 79 76 61 6c 73 29  s user) keyvals)
1d80: 29 0a 09 20 28 71 72 79 76 61 6c 73 20 20 20 28  ).. (qryvals   (
1d90: 61 70 70 65 6e 64 20 28 6c 69 73 74 20 72 75 6e  append (list run
1da0: 6e 61 6d 65 29 20 6b 65 79 76 61 6c 73 29 29 0a  name) keyvals)).
1db0: 09 20 28 6b 65 79 3d 3f 73 74 72 20 20 28 73 74  . (key=?str  (st
1dc0: 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65  ring-intersperse
1dd0: 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 6b   (map (lambda (k
1de0: 29 28 63 6f 6e 63 20 28 6b 65 79 3a 67 65 74 2d  )(conc (key:get-
1df0: 66 69 65 6c 64 6e 61 6d 65 20 6b 29 20 22 3d 3f  fieldname k) "=?
1e00: 22 29 29 20 6b 65 79 73 29 20 22 20 41 4e 44 20  ")) keys) " AND 
1e10: 22 29 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a  "))).    (debug:
1e20: 70 72 69 6e 74 20 33 20 22 6b 65 79 73 3a 20 22  print 3 "keys: "
1e30: 20 6b 65 79 73 20 22 20 61 6c 6c 76 61 6c 73 3a   keys " allvals:
1e40: 20 22 20 61 6c 6c 76 61 6c 73 20 22 20 6b 65 79   " allvals " key
1e50: 76 61 6c 73 3a 20 22 20 6b 65 79 76 61 6c 73 29  vals: " keyvals)
1e60: 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  .    (debug:prin
1e70: 74 20 32 20 22 4e 4f 54 45 3a 20 75 73 69 6e 67  t 2 "NOTE: using
1e80: 20 74 61 72 67 65 74 20 22 20 28 73 74 72 69 6e   target " (strin
1e90: 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 6b 65  g-intersperse ke
1ea0: 79 76 61 6c 73 20 22 2f 22 29 20 22 20 66 6f 72  yvals "/") " for
1eb0: 20 74 68 69 73 20 72 75 6e 22 29 0a 20 20 20 20   this run").    
1ec0: 28 69 66 20 28 61 6e 64 20 72 75 6e 6e 61 6d 65  (if (and runname
1ed0: 20 28 6e 75 6c 6c 3f 20 28 66 69 6c 74 65 72 20   (null? (filter 
1ee0: 28 6c 61 6d 62 64 61 20 28 78 29 28 6e 6f 74 20  (lambda (x)(not 
1ef0: 78 29 29 20 6b 65 79 76 61 6c 73 29 29 29 20 3b  x)) keyvals))) ;
1f00: 3b 20 74 68 65 72 65 20 6d 75 73 74 20 62 65 20  ; there must be 
1f10: 61 20 62 65 74 74 65 72 20 77 61 79 20 74 6f 20  a better way to 
1f20: 22 61 70 70 6c 79 20 61 6e 64 22 0a 09 28 6c 65  "apply and"..(le
1f30: 74 20 28 28 72 65 73 20 23 66 29 29 0a 09 20 20  t ((res #f))..  
1f40: 28 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a 65  (apply sqlite3:e
1f50: 78 65 63 75 74 65 20 64 62 20 28 63 6f 6e 63 20  xecute db (conc 
1f60: 22 49 4e 53 45 52 54 20 4f 52 20 49 47 4e 4f 52  "INSERT OR IGNOR
1f70: 45 20 49 4e 54 4f 20 72 75 6e 73 20 28 72 75 6e  E INTO runs (run
1f80: 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75  name,state,statu
1f90: 73 2c 6f 77 6e 65 72 2c 65 76 65 6e 74 5f 74 69  s,owner,event_ti
1fa0: 6d 65 22 20 63 6f 6d 6d 61 20 6b 65 79 73 74 72  me" comma keystr
1fb0: 20 22 29 20 56 41 4c 55 45 53 20 28 3f 2c 3f 2c   ") VALUES (?,?,
1fc0: 3f 2c 3f 2c 73 74 72 66 74 69 6d 65 28 27 25 73  ?,?,strftime('%s
1fd0: 27 2c 27 6e 6f 77 27 29 22 20 63 6f 6d 6d 61 20  ','now')" comma 
1fe0: 76 61 6c 73 6c 6f 74 73 20 22 29 3b 22 29 0a 09  valslots ");")..
1ff0: 09 20 61 6c 6c 76 61 6c 73 29 0a 09 20 20 28 61  . allvals)..  (a
2000: 70 70 6c 79 20 73 71 6c 69 74 65 33 3a 66 6f 72  pply sqlite3:for
2010: 2d 65 61 63 68 2d 72 6f 77 20 0a 09 20 20 20 28  -each-row ..   (
2020: 6c 61 6d 62 64 61 20 28 69 64 29 0a 09 20 20 20  lambda (id)..   
2030: 20 20 28 73 65 74 21 20 72 65 73 20 69 64 29 29    (set! res id))
2040: 0a 09 20 20 20 64 62 0a 09 20 20 20 28 6c 65 74  ..   db..   (let
2050: 20 28 28 71 72 79 20 28 63 6f 6e 63 20 22 53 45   ((qry (conc "SE
2060: 4c 45 43 54 20 69 64 20 46 52 4f 4d 20 72 75 6e  LECT id FROM run
2070: 73 20 57 48 45 52 45 20 28 72 75 6e 6e 61 6d 65  s WHERE (runname
2080: 3d 3f 20 22 20 61 6e 64 73 74 72 20 6b 65 79 3d  =? " andstr key=
2090: 3f 73 74 72 20 22 29 3b 22 29 29 29 0a 09 20 20  ?str ");")))..  
20a0: 20 20 20 3b 28 64 65 62 75 67 3a 70 72 69 6e 74     ;(debug:print
20b0: 20 34 20 22 71 72 79 3a 20 22 20 71 72 79 29 20   4 "qry: " qry) 
20c0: 0a 09 20 20 20 20 20 71 72 79 29 0a 09 20 20 20  ..     qry)..   
20d0: 71 72 79 76 61 6c 73 29 0a 09 20 20 28 73 71 6c  qryvals)..  (sql
20e0: 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 20  ite3:execute db 
20f0: 22 55 50 44 41 54 45 20 72 75 6e 73 20 53 45 54  "UPDATE runs SET
2100: 20 73 74 61 74 65 3d 3f 2c 73 74 61 74 75 73 3d   state=?,status=
2110: 3f 20 57 48 45 52 45 20 69 64 3d 3f 3b 22 20 73  ? WHERE id=?;" s
2120: 74 61 74 65 20 73 74 61 74 75 73 20 72 65 73 29  tate status res)
2130: 0a 09 20 20 72 65 73 29 20 0a 09 28 62 65 67 69  ..  res) ..(begi
2140: 6e 0a 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e  n..  (debug:prin
2150: 74 20 30 20 22 45 52 52 4f 52 3a 20 43 61 6c 6c  t 0 "ERROR: Call
2160: 65 64 20 77 69 74 68 6f 75 74 20 61 6c 6c 20 6e  ed without all n
2170: 65 63 65 73 73 61 72 79 20 6b 65 79 73 22 29 0a  ecessary keys").
2180: 09 20 20 23 66 29 29 29 29 0a 0a 3b 3b 20 54 68  .  #f))))..;; Th
2190: 69 73 20 69 73 20 61 20 64 75 70 6c 69 63 61 74  is is a duplicat
21a0: 65 20 6f 66 20 72 75 6e 2d 74 65 73 74 73 20 28  e of run-tests (
21b0: 77 68 69 63 68 20 68 61 73 20 62 65 65 6e 20 64  which has been d
21c0: 65 70 72 65 63 61 74 65 64 29 2e 20 55 73 65 20  eprecated). Use 
21d0: 74 68 69 73 20 6f 6e 65 20 69 6e 73 74 65 61 64  this one instead
21e0: 20 6f 66 20 72 75 6e 20 74 65 73 74 73 2e 0a 3b   of run tests..;
21f0: 3b 20 6b 65 79 76 61 6c 73 2e 0a 3b 3b 0a 3b 3b  ; keyvals..;;.;;
2200: 20 20 74 65 73 74 2d 6e 61 6d 65 73 3a 20 43 6f    test-names: Co
2210: 6d 6d 61 20 73 65 70 61 72 61 74 65 64 20 70 61  mma separated pa
2220: 74 74 65 72 6e 73 20 73 61 6d 65 20 61 73 20 74  tterns same as t
2230: 65 73 74 2d 70 61 74 74 73 20 62 75 74 20 75 73  est-patts but us
2240: 65 64 20 69 6e 20 73 65 6c 65 63 74 69 6f 6e 20  ed in selection 
2250: 0a 3b 3b 20 20 20 20 20 20 20 20 20 20 20 20 20  .;;             
2260: 20 6f 66 20 74 65 73 74 73 20 74 6f 20 72 75 6e   of tests to run
2270: 2e 20 54 68 65 20 69 74 65 6d 20 70 6f 72 74 69  . The item porti
2280: 6f 6e 73 20 61 72 65 20 6e 6f 74 20 72 65 73 70  ons are not resp
2290: 65 63 74 65 64 2e 0a 3b 3b 20 20 20 20 20 20 20  ected..;;       
22a0: 20 20 20 20 20 20 20 46 49 58 4d 45 3a 20 65 72         FIXME: er
22b0: 72 6f 72 20 6f 75 74 20 69 66 20 2f 70 61 74 74  ror out if /patt
22c0: 20 73 70 65 63 69 66 69 65 64 0a 3b 3b 20 20 20   specified.;;   
22d0: 20 20 20 20 20 20 20 20 20 0a 28 64 65 66 69 6e           .(defin
22e0: 65 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74  e (runs:run-test
22f0: 73 20 74 61 72 67 65 74 20 72 75 6e 6e 61 6d 65  s target runname
2300: 20 74 65 73 74 2d 6e 61 6d 65 73 20 74 65 73 74   test-names test
2310: 2d 70 61 74 74 73 20 75 73 65 72 20 66 6c 61 67  -patts user flag
2320: 73 29 0a 20 20 28 63 6f 6d 6d 6f 6e 3a 63 6c 65  s).  (common:cle
2330: 61 72 2d 63 61 63 68 65 73 29 20 3b 3b 20 63 6c  ar-caches) ;; cl
2340: 65 61 72 20 61 6c 6c 20 63 61 63 68 65 73 0a 20  ear all caches. 
2350: 20 28 6c 65 74 2a 20 28 28 64 62 20 20 20 20 20   (let* ((db     
2360: 20 20 20 20 20 23 66 29 0a 09 20 28 6b 65 79 73       #f).. (keys
2370: 20 20 20 20 20 20 20 20 28 63 64 62 3a 72 65 6d          (cdb:rem
2380: 6f 74 65 2d 72 75 6e 20 64 62 3a 67 65 74 2d 6b  ote-run db:get-k
2390: 65 79 73 20 23 66 29 29 0a 09 20 28 6b 65 79 76  eys #f)).. (keyv
23a0: 61 6c 6c 73 74 20 20 20 28 6b 65 79 73 3a 74 61  allst   (keys:ta
23b0: 72 67 65 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 79  rget->keyval key
23c0: 73 20 74 61 72 67 65 74 29 29 0a 09 20 28 72 75  s target)).. (ru
23d0: 6e 2d 69 64 20 20 20 20 20 20 28 63 64 62 3a 72  n-id      (cdb:r
23e0: 65 6d 6f 74 65 2d 72 75 6e 20 72 75 6e 73 3a 72  emote-run runs:r
23f0: 65 67 69 73 74 65 72 2d 72 75 6e 20 23 66 20 6b  egister-run #f k
2400: 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75  eys keyvallst ru
2410: 6e 6e 61 6d 65 20 22 6e 65 77 22 20 22 6e 2f 61  nname "new" "n/a
2420: 22 20 75 73 65 72 29 29 20 20 3b 3b 20 20 74 65  " user))  ;;  te
2430: 73 74 2d 6e 61 6d 65 29 29 29 0a 09 20 28 6b 65  st-name))).. (ke
2440: 79 76 61 6c 73 20 20 20 20 20 28 69 66 20 72 75  yvals     (if ru
2450: 6e 2d 69 64 20 28 63 64 62 3a 72 65 6d 6f 74 65  n-id (cdb:remote
2460: 2d 72 75 6e 20 64 62 3a 67 65 74 2d 6b 65 79 2d  -run db:get-key-
2470: 76 61 6c 73 20 23 66 20 72 75 6e 2d 69 64 29 20  vals #f run-id) 
2480: 23 66 29 29 0a 09 20 28 64 65 66 65 72 72 65 64  #f)).. (deferred
2490: 20 20 20 20 27 28 29 29 20 3b 3b 20 64 65 6c 61      '()) ;; dela
24a0: 79 20 72 75 6e 6e 69 6e 67 20 74 68 65 73 65 20  y running these 
24b0: 73 69 6e 63 65 20 74 68 65 79 20 68 61 76 65 20  since they have 
24c0: 61 20 77 61 69 74 6f 6e 20 63 6c 61 75 73 65 0a  a waiton clause.
24d0: 09 20 3b 3b 20 6b 65 65 70 67 6f 69 6e 67 20 69  . ;; keepgoing i
24e0: 73 20 74 68 65 20 64 65 66 61 63 74 6f 20 6d 6f  s the defacto mo
24f0: 64 61 6c 69 74 79 20 6e 6f 77 2c 20 77 69 6c 6c  dality now, will
2500: 20 61 64 64 20 68 69 74 2d 6e 2d 72 75 6e 20 61   add hit-n-run a
2510: 20 62 69 74 20 6c 61 74 65 72 0a 09 20 3b 3b 20   bit later.. ;; 
2520: 28 6b 65 65 70 67 6f 69 6e 67 20 20 20 28 68 61  (keepgoing   (ha
2530: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66  sh-table-ref/def
2540: 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 65  ault flags "-kee
2550: 70 67 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 28  pgoing" #f)).. (
2560: 72 75 6e 63 6f 6e 66 69 67 66 20 20 20 28 63 6f  runconfigf   (co
2570: 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f  nc  *toppath* "/
2580: 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69  runconfigs.confi
2590: 67 22 29 29 0a 09 20 28 72 65 71 75 69 72 65 64  g")).. (required
25a0: 2d 74 65 73 74 73 20 27 28 29 29 0a 09 20 28 74  -tests '()).. (t
25b0: 65 73 74 2d 72 65 63 6f 72 64 73 20 28 6d 61 6b  est-records (mak
25c0: 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a  e-hash-table))).
25d0: 0a 20 20 20 20 28 73 65 74 2d 6d 65 67 61 74 65  .    (set-megate
25e0: 73 74 2d 65 6e 76 2d 76 61 72 73 20 72 75 6e 2d  st-env-vars run-
25f0: 69 64 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79  id) ;; these may
2600: 20 62 65 20 6e 65 65 64 65 64 20 62 79 20 74 68   be needed by th
2610: 65 20 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63  e launching proc
2620: 65 73 73 0a 0a 20 20 20 20 28 69 66 20 28 66 69  ess..    (if (fi
2630: 6c 65 2d 65 78 69 73 74 73 3f 20 72 75 6e 63 6f  le-exists? runco
2640: 6e 66 69 67 66 29 0a 09 28 73 65 74 75 70 2d 65  nfigf)..(setup-e
2650: 6e 76 2d 64 65 66 61 75 6c 74 73 20 72 75 6e 63  nv-defaults runc
2660: 6f 6e 66 69 67 66 20 72 75 6e 2d 69 64 20 2a 61  onfigf run-id *a
2670: 6c 72 65 61 64 79 2d 73 65 65 6e 2d 72 75 6e 63  lready-seen-runc
2680: 6f 6e 66 69 67 2d 69 6e 66 6f 2a 20 6b 65 79 73  onfig-info* keys
2690: 20 6b 65 79 76 61 6c 73 20 22 70 72 65 2d 6c 61   keyvals "pre-la
26a0: 75 6e 63 68 2d 65 6e 76 2d 76 61 72 73 22 29 0a  unch-env-vars").
26b0: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20  .(debug:print 0 
26c0: 22 57 41 52 4e 49 4e 47 3a 20 59 6f 75 20 64 6f  "WARNING: You do
26d0: 20 6e 6f 74 20 68 61 76 65 20 61 20 72 75 6e 20   not have a run 
26e0: 63 6f 6e 66 69 67 20 66 69 6c 65 3a 20 22 20 72  config file: " r
26f0: 75 6e 63 6f 6e 66 69 67 66 29 29 0a 20 20 20 20  unconfigf)).    
2700: 0a 20 20 20 20 3b 3b 20 6c 6f 6f 6b 20 75 70 20  .    ;; look up 
2710: 61 6c 6c 20 74 65 73 74 73 20 6d 61 74 63 68 69  all tests matchi
2720: 6e 67 20 74 68 65 20 63 6f 6d 6d 61 20 73 65 70  ng the comma sep
2730: 61 72 61 74 65 64 20 6c 69 73 74 20 6f 66 20 67  arated list of g
2740: 6c 6f 62 73 20 69 6e 0a 20 20 20 20 3b 3b 20 74  lobs in.    ;; t
2750: 65 73 74 2d 70 61 74 74 73 20 28 75 73 69 6e 67  est-patts (using
2760: 20 25 20 61 73 20 77 69 6c 64 63 61 72 64 29 0a   % as wildcard).
2770: 0a 20 20 20 20 28 73 65 74 21 20 74 65 73 74 2d  .    (set! test-
2780: 6e 61 6d 65 73 20 28 74 65 73 74 73 3a 67 65 74  names (tests:get
2790: 2d 76 61 6c 69 64 2d 74 65 73 74 73 20 2a 74 6f  -valid-tests *to
27a0: 70 70 61 74 68 2a 20 74 65 73 74 2d 6e 61 6d 65  ppath* test-name
27b0: 73 29 29 0a 20 20 20 20 28 73 65 74 21 20 74 65  s)).    (set! te
27c0: 73 74 2d 6e 61 6d 65 73 20 28 64 65 6c 65 74 65  st-names (delete
27d0: 2d 64 75 70 6c 69 63 61 74 65 73 20 74 65 73 74  -duplicates test
27e0: 2d 6e 61 6d 65 73 29 29 0a 0a 20 20 20 20 28 64  -names))..    (d
27f0: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
2800: 30 20 22 74 65 73 74 20 6e 61 6d 65 73 20 22 20  0 "test names " 
2810: 74 65 73 74 2d 6e 61 6d 65 73 29 0a 0a 20 20 20  test-names)..   
2820: 20 3b 3b 20 6f 6e 20 74 68 65 20 66 69 72 73 74   ;; on the first
2830: 20 70 61 73 73 20 6f 72 20 63 61 6c 6c 20 74 6f   pass or call to
2840: 20 72 75 6e 2d 74 65 73 74 73 20 73 65 74 20 46   run-tests set F
2850: 41 49 4c 53 20 74 6f 20 4e 4f 54 5f 53 54 41 52  AILS to NOT_STAR
2860: 54 45 44 20 69 66 0a 20 20 20 20 3b 3b 20 2d 6b  TED if.    ;; -k
2870: 65 65 70 67 6f 69 6e 67 20 69 73 20 73 70 65 63  eepgoing is spec
2880: 69 66 69 65 64 0a 20 20 20 20 28 69 66 20 28 65  ified.    (if (e
2890: 71 3f 20 2a 70 61 73 73 6e 75 6d 2a 20 30 29 0a  q? *passnum* 0).
28a0: 09 28 62 65 67 69 6e 0a 09 20 20 3b 3b 20 68 61  .(begin..  ;; ha
28b0: 76 65 20 74 6f 20 64 65 6c 65 74 65 20 74 65 73  ve to delete tes
28c0: 74 20 72 65 63 6f 72 64 73 20 77 68 65 72 65 20  t records where 
28d0: 4e 4f 54 5f 53 54 41 52 54 45 44 20 73 69 6e 63  NOT_STARTED sinc
28e0: 65 20 74 68 65 79 20 63 61 6e 20 63 61 75 73 65  e they can cause
28f0: 20 2d 6b 65 65 70 67 6f 69 6e 67 20 74 6f 20 0a   -keepgoing to .
2900: 09 20 20 3b 3b 20 67 65 74 20 73 74 75 63 6b 20  .  ;; get stuck 
2910: 64 75 65 20 74 6f 20 62 65 63 6f 6d 69 6e 67 20  due to becoming 
2920: 69 6e 61 63 63 65 73 73 69 62 6c 65 20 66 72 6f  inaccessible fro
2930: 6d 20 61 20 66 61 69 6c 65 64 20 74 65 73 74 2e  m a failed test.
2940: 20 49 2e 65 2e 20 69 66 20 74 65 73 74 20 42 20   I.e. if test B 
2950: 64 65 70 65 6e 64 73 20 0a 09 20 20 3b 3b 20 6f  depends ..  ;; o
2960: 6e 20 74 65 73 74 20 41 20 62 75 74 20 74 65 73  n test A but tes
2970: 74 20 42 20 72 65 61 63 68 65 64 20 74 68 65 20  t B reached the 
2980: 70 6f 69 6e 74 20 6f 6e 20 62 65 69 6e 67 20 72  point on being r
2990: 65 67 69 73 74 65 72 65 64 20 61 73 20 4e 4f 54  egistered as NOT
29a0: 5f 53 54 41 52 54 45 44 20 61 6e 64 20 74 65 73  _STARTED and tes
29b0: 74 0a 09 20 20 3b 3b 20 41 20 66 61 69 6c 65 64  t..  ;; A failed
29c0: 20 66 6f 72 20 73 6f 6d 65 20 72 65 61 73 6f 6e   for some reason
29d0: 20 74 68 65 6e 20 6f 6e 20 72 65 2d 72 75 6e 20   then on re-run 
29e0: 75 73 69 6e 67 20 2d 6b 65 65 70 67 6f 69 6e 67  using -keepgoing
29f0: 20 74 68 65 20 72 75 6e 20 63 61 6e 20 6e 65 76   the run can nev
2a00: 65 72 20 63 6f 6d 70 6c 65 74 65 2e 0a 09 20 20  er complete...  
2a10: 28 63 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74  (cdb:delete-test
2a20: 73 2d 69 6e 2d 73 74 61 74 65 20 2a 72 75 6e 72  s-in-state *runr
2a30: 65 6d 6f 74 65 2a 20 72 75 6e 2d 69 64 20 22 4e  emote* run-id "N
2a40: 4f 54 5f 53 54 41 52 54 45 44 22 29 0a 09 20 20  OT_STARTED")..  
2a50: 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20  (cdb:remote-run 
2a60: 64 62 3a 73 65 74 2d 74 65 73 74 73 2d 73 74 61  db:set-tests-sta
2a70: 74 65 2d 73 74 61 74 75 73 20 23 66 20 72 75 6e  te-status #f run
2a80: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 73 20 23  -id test-names #
2a90: 66 20 22 46 41 49 4c 22 20 22 4e 4f 54 5f 53 54  f "FAIL" "NOT_ST
2aa0: 41 52 54 45 44 22 20 22 46 41 49 4c 22 29 29 29  ARTED" "FAIL")))
2ab0: 0a 0a 20 20 20 20 3b 3b 20 66 72 6f 6d 20 68 65  ..    ;; from he
2ac0: 72 65 20 6f 6e 20 6f 75 74 20 74 68 65 20 64 62  re on out the db
2ad0: 20 77 69 6c 6c 20 62 65 20 6f 70 65 6e 65 64 20   will be opened 
2ae0: 61 6e 64 20 63 6c 6f 73 65 64 20 6f 6e 20 65 76  and closed on ev
2af0: 65 72 79 20 63 61 6c 6c 20 72 75 6e 73 3a 72 75  ery call runs:ru
2b00: 6e 2d 74 65 73 74 73 2d 71 75 65 75 65 0a 20 20  n-tests-queue.  
2b10: 20 20 3b 3b 20 28 73 71 6c 69 74 65 33 3a 66 69    ;; (sqlite3:fi
2b20: 6e 61 6c 69 7a 65 21 20 64 62 29 20 0a 20 20 20  nalize! db) .   
2b30: 20 3b 3b 20 6e 6f 77 20 61 64 64 20 6e 6f 6e 2d   ;; now add non-
2b40: 64 69 72 65 63 74 6c 79 20 72 65 66 65 72 65 6e  directly referen
2b50: 63 65 64 20 64 65 70 65 6e 64 65 6e 63 69 65 73  ced dependencies
2b60: 20 28 69 2e 65 2e 20 77 61 69 74 6f 6e 29 0a 20   (i.e. waiton). 
2b70: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c     (if (not (nul
2b80: 6c 3f 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a  l? test-names)).
2b90: 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68 65 64  .(let loop ((hed
2ba0: 20 28 63 61 72 20 74 65 73 74 2d 6e 61 6d 65 73   (car test-names
2bb0: 29 29 0a 09 09 20 20 20 28 74 61 6c 20 28 63 64  ))...   (tal (cd
2bc0: 72 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 20  r test-names))) 
2bd0: 20 20 20 20 20 20 20 20 3b 3b 20 27 72 65 74 75          ;; 'retu
2be0: 72 6e 2d 70 72 6f 63 73 20 74 65 6c 6c 73 20 74  rn-procs tells t
2bf0: 68 65 20 63 6f 6e 66 69 67 20 72 65 61 64 65 72  he config reader
2c00: 20 74 6f 20 70 72 65 70 20 72 75 6e 6e 69 6e 67   to prep running
2c10: 20 73 79 73 74 65 6d 20 62 75 74 20 72 65 74 75   system but retu
2c20: 72 6e 20 61 20 70 72 6f 63 0a 09 20 20 28 64 65  rn a proc..  (de
2c30: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34  bug:print-info 4
2c40: 20 22 68 65 64 3d 22 20 68 65 64 20 22 20 61 74   "hed=" hed " at
2c50: 20 74 6f 70 20 6f 66 20 6c 6f 6f 70 22 29 0a 09   top of loop")..
2c60: 20 20 28 6c 65 74 2a 20 28 28 63 6f 6e 66 69 67    (let* ((config
2c70: 20 20 28 74 65 73 74 73 3a 67 65 74 2d 74 65 73    (tests:get-tes
2c80: 74 63 6f 6e 66 69 67 20 68 65 64 20 27 72 65 74  tconfig hed 'ret
2c90: 75 72 6e 2d 70 72 6f 63 73 29 29 0a 09 09 20 28  urn-procs))... (
2ca0: 77 61 69 74 6f 6e 73 20 28 6c 65 74 20 28 28 69  waitons (let ((i
2cb0: 6e 73 74 72 20 28 69 66 20 63 6f 6e 66 69 67 20  nstr (if config 
2cc0: 0a 09 09 09 09 09 20 20 20 28 63 6f 6e 66 69 67  ......   (config
2cd0: 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 20 22  -lookup config "
2ce0: 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 77  requirements" "w
2cf0: 61 69 74 6f 6e 22 29 0a 09 09 09 09 09 20 20 20  aiton")......   
2d00: 28 62 65 67 69 6e 20 3b 3b 20 4e 6f 20 63 6f 6e  (begin ;; No con
2d10: 66 69 67 20 6d 65 61 6e 73 20 74 68 69 73 20 69  fig means this i
2d20: 73 20 61 20 6e 6f 6e 2d 65 78 69 73 74 61 6e 74  s a non-existant
2d30: 20 74 65 73 74 0a 09 09 09 09 09 20 20 20 20 20   test......     
2d40: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
2d50: 45 52 52 4f 52 3a 20 6e 6f 6e 2d 65 78 69 73 74  ERROR: non-exist
2d60: 65 6e 74 20 72 65 71 75 69 72 65 64 20 74 65 73  ent required tes
2d70: 74 20 5c 22 22 20 68 65 64 20 22 5c 22 22 29 0a  t \"" hed "\"").
2d80: 09 09 09 09 09 20 20 20 20 20 28 69 66 20 64 62  .....     (if db
2d90: 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69   (sqlite3:finali
2da0: 7a 65 21 20 64 62 29 29 0a 09 09 09 09 09 20 20  ze! db))......  
2db0: 20 20 20 28 65 78 69 74 20 31 29 29 29 29 29 0a     (exit 1))))).
2dc0: 09 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72  ...    (debug:pr
2dd0: 69 6e 74 2d 69 6e 66 6f 20 38 20 22 77 61 69 74  int-info 8 "wait
2de0: 6f 6e 73 20 73 74 72 69 6e 67 20 69 73 20 22 20  ons string is " 
2df0: 69 6e 73 74 72 29 0a 09 09 09 20 20 20 20 28 73  instr)....    (s
2e00: 74 72 69 6e 67 2d 73 70 6c 69 74 20 28 63 6f 6e  tring-split (con
2e10: 64 0a 09 09 09 09 09 20 20 20 28 28 70 72 6f 63  d......   ((proc
2e20: 65 64 75 72 65 3f 20 69 6e 73 74 72 29 0a 09 09  edure? instr)...
2e30: 09 09 09 20 20 20 20 28 6c 65 74 20 28 28 72 65  ...    (let ((re
2e40: 73 20 28 69 6e 73 74 72 29 29 29 0a 09 09 09 09  s (instr))).....
2e50: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72  .      (debug:pr
2e60: 69 6e 74 2d 69 6e 66 6f 20 38 20 22 77 61 69 74  int-info 8 "wait
2e70: 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 72 65 73  on procedure res
2e80: 75 6c 74 73 20 69 6e 20 73 74 72 69 6e 67 20 22  ults in string "
2e90: 20 72 65 73 20 22 20 66 6f 72 20 74 65 73 74 20   res " for test 
2ea0: 22 20 68 65 64 29 0a 09 09 09 09 09 20 20 20 20  " hed)......    
2eb0: 20 20 72 65 73 29 29 0a 09 09 09 09 09 20 20 20    res))......   
2ec0: 28 28 73 74 72 69 6e 67 3f 20 69 6e 73 74 72 29  ((string? instr)
2ed0: 20 20 20 20 20 69 6e 73 74 72 29 0a 09 09 09 09       instr).....
2ee0: 09 20 20 20 28 65 6c 73 65 20 0a 09 09 09 09 09  .   (else ......
2ef0: 20 20 20 20 3b 3b 20 4e 4f 54 45 3a 20 54 68 69      ;; NOTE: Thi
2f00: 73 20 69 73 20 61 63 74 75 61 6c 6c 79 20 74 68  s is actually th
2f10: 65 20 63 61 73 65 20 6f 66 20 2a 6e 6f 2a 20 77  e case of *no* w
2f20: 61 69 74 6f 6e 73 21 20 3b 3b 20 28 64 65 62 75  aitons! ;; (debu
2f30: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52  g:print 0 "ERROR
2f40: 3a 20 73 6f 6d 65 74 68 69 6e 67 20 77 65 6e 74  : something went
2f50: 20 77 72 6f 6e 67 20 69 6e 20 70 72 6f 63 65 73   wrong in proces
2f60: 73 69 6e 67 20 77 61 69 74 6f 6e 73 20 66 6f 72  sing waitons for
2f70: 20 74 65 73 74 20 22 20 68 65 64 29 0a 09 09 09   test " hed)....
2f80: 09 09 20 20 20 20 22 22 29 29 29 29 29 29 0a 09  ..    ""))))))..
2f90: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
2fa0: 2d 69 6e 66 6f 20 38 20 22 77 61 69 74 6f 6e 73  -info 8 "waitons
2fb0: 3a 20 22 20 77 61 69 74 6f 6e 73 29 0a 09 20 20  : " waitons)..  
2fc0: 20 20 3b 3b 20 63 68 65 63 6b 20 66 6f 72 20 68    ;; check for h
2fd0: 65 64 20 69 6e 20 77 61 69 74 6f 6e 73 20 3d 3e  ed in waitons =>
2fe0: 20 74 68 69 73 20 77 6f 75 6c 64 20 62 65 20 63   this would be c
2ff0: 69 72 63 75 6c 61 72 2c 20 72 65 6d 6f 76 65 20  ircular, remove 
3000: 69 74 20 61 6e 64 20 69 73 73 75 65 20 61 6e 0a  it and issue an.
3010: 09 20 20 20 20 3b 3b 20 65 72 72 6f 72 0a 09 20  .    ;; error.. 
3020: 20 20 20 28 69 66 20 28 6d 65 6d 62 65 72 20 68     (if (member h
3030: 65 64 20 77 61 69 74 6f 6e 73 29 0a 09 09 28 62  ed waitons)...(b
3040: 65 67 69 6e 0a 09 09 20 20 28 64 65 62 75 67 3a  egin...  (debug:
3050: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
3060: 74 65 73 74 20 22 20 68 65 64 20 22 20 68 61 73  test " hed " has
3070: 20 6c 69 73 74 65 64 20 69 74 73 65 6c 66 20 61   listed itself a
3080: 73 20 61 20 77 61 69 74 6f 6e 2c 20 70 6c 65 61  s a waiton, plea
3090: 73 65 20 63 6f 72 72 65 63 74 20 74 68 69 73 21  se correct this!
30a0: 22 29 0a 09 09 20 20 28 73 65 74 21 20 77 61 69  ")...  (set! wai
30b0: 74 6f 6e 73 20 28 66 69 6c 74 65 72 20 28 6c 61  tons (filter (la
30c0: 6d 62 64 61 20 28 78 29 28 6e 6f 74 20 28 65 71  mbda (x)(not (eq
30d0: 75 61 6c 3f 20 78 20 68 65 64 29 29 29 20 77 61  ual? x hed))) wa
30e0: 69 74 6f 6e 73 29 29 29 29 0a 09 20 20 20 20 0a  itons))))..    .
30f0: 09 20 20 20 20 3b 3b 20 28 69 74 65 6d 73 20 20  .    ;; (items  
3100: 20 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d   (items:get-item
3110: 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 63 6f  s-from-config co
3120: 6e 66 69 67 29 29 29 0a 09 20 20 20 20 28 69 66  nfig)))..    (if
3130: 20 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 62 6c   (not (hash-tabl
3140: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 74 65  e-ref/default te
3150: 73 74 2d 72 65 63 6f 72 64 73 20 68 65 64 20 23  st-records hed #
3160: 66 29 29 0a 09 09 28 68 61 73 68 2d 74 61 62 6c  f))...(hash-tabl
3170: 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 63 6f  e-set! test-reco
3180: 72 64 73 0a 09 09 09 09 20 68 65 64 20 28 76 65  rds..... hed (ve
3190: 63 74 6f 72 20 68 65 64 20 20 20 20 20 3b 3b 20  ctor hed     ;; 
31a0: 30 0a 09 09 09 09 09 20 20 20 20 20 63 6f 6e 66  0......     conf
31b0: 69 67 20 20 3b 3b 20 31 0a 09 09 09 09 09 20 20  ig  ;; 1......  
31c0: 20 20 20 77 61 69 74 6f 6e 73 20 3b 3b 20 32 0a     waitons ;; 2.
31d0: 09 09 09 09 09 20 20 20 20 20 28 63 6f 6e 66 69  .....     (confi
31e0: 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 20  g-lookup config 
31f0: 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22  "requirements" "
3200: 70 72 69 6f 72 69 74 79 22 29 20 20 20 20 20 3b  priority")     ;
3210: 3b 20 70 72 69 6f 72 69 74 79 20 33 0a 09 09 09  ; priority 3....
3220: 09 09 20 20 20 20 20 28 6c 65 74 20 28 28 69 74  ..     (let ((it
3230: 65 6d 73 20 20 20 20 20 20 28 68 61 73 68 2d 74  ems      (hash-t
3240: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74  able-ref/default
3250: 20 63 6f 6e 66 69 67 20 22 69 74 65 6d 73 22 20   config "items" 
3260: 23 66 29 29 20 3b 3b 20 69 74 65 6d 73 20 34 0a  #f)) ;; items 4.
3270: 09 09 09 09 09 09 20 20 20 28 69 74 65 6d 73 74  ......   (itemst
3280: 61 62 6c 65 20 28 68 61 73 68 2d 74 61 62 6c 65  able (hash-table
3290: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63 6f 6e  -ref/default con
32a0: 66 69 67 20 22 69 74 65 6d 73 74 61 62 6c 65 22  fig "itemstable"
32b0: 20 23 66 29 29 29 20 0a 09 09 09 09 09 20 20 20   #f))) ......   
32c0: 20 20 20 20 3b 3b 20 69 66 20 65 69 74 68 65 72      ;; if either
32d0: 20 69 74 65 6d 73 20 6f 72 20 69 74 65 6d 73 20   items or items 
32e0: 74 61 62 6c 65 20 69 73 20 61 20 70 72 6f 63 20  table is a proc 
32f0: 72 65 74 75 72 6e 20 69 74 20 73 6f 20 74 65 73  return it so tes
3300: 74 20 72 75 6e 6e 69 6e 67 0a 09 09 09 09 09 20  t running...... 
3310: 20 20 20 20 20 20 3b 3b 20 70 72 6f 63 65 73 73        ;; process
3320: 20 63 61 6e 20 6b 6e 6f 77 20 74 6f 20 63 61 6c   can know to cal
3330: 6c 20 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d  l items:get-item
3340: 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 0a 09 09  s-from-config...
3350: 09 09 09 20 20 20 20 20 20 20 3b 3b 20 69 66 20  ...       ;; if 
3360: 65 69 74 68 65 72 20 69 73 20 61 20 6c 69 73 74  either is a list
3370: 20 61 6e 64 20 6e 6f 6e 65 20 69 73 20 61 20 70   and none is a p
3380: 72 6f 63 20 67 6f 20 61 68 65 61 64 20 61 6e 64  roc go ahead and
3390: 20 63 61 6c 6c 20 67 65 74 2d 69 74 65 6d 73 0a   call get-items.
33a0: 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20 6f  .....       ;; o
33b0: 74 68 65 72 77 69 73 65 20 72 65 74 75 72 6e 20  therwise return 
33c0: 23 66 20 2d 20 74 68 69 73 20 69 73 20 6e 6f 74  #f - this is not
33d0: 20 61 6e 20 69 74 65 72 61 74 65 64 20 74 65 73   an iterated tes
33e0: 74 0a 09 09 09 09 09 20 20 20 20 20 20 20 28 63  t......       (c
33f0: 6f 6e 64 0a 09 09 09 09 09 09 28 28 70 72 6f 63  ond.......((proc
3400: 65 64 75 72 65 3f 20 69 74 65 6d 73 29 20 20 20  edure? items)   
3410: 20 20 20 0a 09 09 09 09 09 09 20 28 64 65 62 75     ....... (debu
3420: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22  g:print-info 4 "
3430: 69 74 65 6d 73 20 69 73 20 61 20 70 72 6f 63 65  items is a proce
3440: 64 75 72 65 2c 20 77 69 6c 6c 20 63 61 6c 63 20  dure, will calc 
3450: 6c 61 74 65 72 22 29 0a 09 09 09 09 09 09 20 69  later")....... i
3460: 74 65 6d 73 29 20 20 20 20 20 20 20 20 20 20 20  tems)           
3470: 20 3b 3b 20 63 61 6c 63 20 6c 61 74 65 72 0a 09   ;; calc later..
3480: 09 09 09 09 09 28 28 70 72 6f 63 65 64 75 72 65  .....((procedure
3490: 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 0a 09 09  ? itemstable)...
34a0: 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e  .... (debug:prin
34b0: 74 2d 69 6e 66 6f 20 34 20 22 69 74 65 6d 73 74  t-info 4 "itemst
34c0: 61 62 6c 65 20 69 73 20 61 20 70 72 6f 63 65 64  able is a proced
34d0: 75 72 65 2c 20 77 69 6c 6c 20 63 61 6c 63 20 6c  ure, will calc l
34e0: 61 74 65 72 22 29 0a 09 09 09 09 09 09 20 69 74  ater")....... it
34f0: 65 6d 73 74 61 62 6c 65 29 20 20 20 20 20 20 20  emstable)       
3500: 3b 3b 20 63 61 6c 63 20 6c 61 74 65 72 0a 09 09  ;; calc later...
3510: 09 09 09 09 28 28 66 69 6c 74 65 72 20 28 6c 61  ....((filter (la
3520: 6d 62 64 61 20 28 78 29 0a 09 09 09 09 09 09 09  mbda (x)........
3530: 20 20 20 28 6c 65 74 20 28 28 76 61 6c 20 28 63     (let ((val (c
3540: 61 72 20 78 29 29 29 0a 09 09 09 09 09 09 09 20  ar x)))........ 
3550: 20 20 20 20 28 69 66 20 28 70 72 6f 63 65 64 75      (if (procedu
3560: 72 65 3f 20 76 61 6c 29 20 76 61 6c 20 23 66 29  re? val) val #f)
3570: 29 29 0a 09 09 09 09 09 09 09 20 28 61 70 70 65  ))........ (appe
3580: 6e 64 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74  nd (if (list? it
3590: 65 6d 73 29 20 69 74 65 6d 73 20 27 28 29 29 0a  ems) items '()).
35a0: 09 09 09 09 09 09 09 09 20 28 69 66 20 28 6c 69  ........ (if (li
35b0: 73 74 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 20  st? itemstable) 
35c0: 69 74 65 6d 73 74 61 62 6c 65 20 27 28 29 29 29  itemstable '()))
35d0: 29 0a 09 09 09 09 09 09 20 27 68 61 76 65 2d 70  )....... 'have-p
35e0: 72 6f 63 65 64 75 72 65 29 0a 09 09 09 09 09 09  rocedure).......
35f0: 28 28 6f 72 20 28 6c 69 73 74 3f 20 69 74 65 6d  ((or (list? item
3600: 73 29 28 6c 69 73 74 3f 20 69 74 65 6d 73 74 61  s)(list? itemsta
3610: 62 6c 65 29 29 20 3b 3b 20 63 61 6c 63 20 6e 6f  ble)) ;; calc no
3620: 77 0a 09 09 09 09 09 09 20 28 64 65 62 75 67 3a  w....... (debug:
3630: 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 69 74  print-info 4 "it
3640: 65 6d 73 20 61 6e 64 20 69 74 65 6d 73 74 61 62  ems and itemstab
3650: 6c 65 20 61 72 65 20 6c 69 73 74 73 2c 20 63 61  le are lists, ca
3660: 6c 63 20 6e 6f 77 5c 6e 22 0a 09 09 09 09 09 09  lc now\n".......
3670: 09 20 20 20 20 20 20 22 20 20 20 20 69 74 65 6d  .      "    item
3680: 73 3a 20 22 20 69 74 65 6d 73 20 22 20 69 74 65  s: " items " ite
3690: 6d 73 74 61 62 6c 65 3a 20 22 20 69 74 65 6d 73  mstable: " items
36a0: 74 61 62 6c 65 29 0a 09 09 09 09 09 09 20 28 69  table)....... (i
36b0: 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66  tems:get-items-f
36c0: 72 6f 6d 2d 63 6f 6e 66 69 67 20 63 6f 6e 66 69  rom-config confi
36d0: 67 29 29 0a 09 09 09 09 09 09 28 65 6c 73 65 20  g)).......(else 
36e0: 23 66 29 29 29 20 20 20 20 20 20 20 20 20 20 20  #f)))           
36f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
3700: 3b 3b 20 6e 6f 74 20 69 74 65 72 61 74 65 64 0a  ;; not iterated.
3710: 09 09 09 09 09 20 20 20 20 20 23 66 20 20 20 20  .....     #f    
3720: 20 20 3b 3b 20 69 74 65 6d 73 64 61 74 20 35 0a    ;; itemsdat 5.
3730: 09 09 09 09 09 20 20 20 20 20 23 66 20 20 20 20  .....     #f    
3740: 20 20 3b 3b 20 73 70 61 72 65 20 2d 20 75 73 65    ;; spare - use
3750: 64 20 66 6f 72 20 69 74 65 6d 2d 70 61 74 68 0a  d for item-path.
3760: 09 09 09 09 09 20 20 20 20 20 29 29 29 0a 09 20  .....     ))).. 
3770: 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 09 20     (for-each .. 
3780: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 77 61 69      (lambda (wai
3790: 74 6f 6e 29 0a 09 20 20 20 20 20 20 20 28 69 66  ton)..       (if
37a0: 20 28 61 6e 64 20 77 61 69 74 6f 6e 20 28 6e 6f   (and waiton (no
37b0: 74 20 28 6d 65 6d 62 65 72 20 77 61 69 74 6f 6e  t (member waiton
37c0: 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a 09   test-names)))..
37d0: 09 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20  .   (begin...   
37e0: 20 20 28 73 65 74 21 20 72 65 71 75 69 72 65 64    (set! required
37f0: 2d 74 65 73 74 73 20 28 63 6f 6e 73 20 77 61 69  -tests (cons wai
3800: 74 6f 6e 20 72 65 71 75 69 72 65 64 2d 74 65 73  ton required-tes
3810: 74 73 29 29 0a 09 09 20 20 20 20 20 28 73 65 74  ts))...     (set
3820: 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 28 63 6f  ! test-names (co
3830: 6e 73 20 77 61 69 74 6f 6e 20 74 65 73 74 2d 6e  ns waiton test-n
3840: 61 6d 65 73 29 29 29 29 29 20 3b 3b 20 77 61 73  ames))))) ;; was
3850: 20 61 6e 20 61 70 70 65 6e 64 2c 20 6e 6f 77 20   an append, now 
3860: 61 20 63 6f 6e 73 0a 09 20 20 20 20 20 77 61 69  a cons..     wai
3870: 74 6f 6e 73 29 0a 09 20 20 20 20 28 6c 65 74 20  tons)..    (let 
3880: 28 28 72 65 6d 74 65 73 74 73 20 28 64 65 6c 65  ((remtests (dele
3890: 74 65 2d 64 75 70 6c 69 63 61 74 65 73 20 28 61  te-duplicates (a
38a0: 70 70 65 6e 64 20 77 61 69 74 6f 6e 73 20 74 61  ppend waitons ta
38b0: 6c 29 29 29 29 0a 09 20 20 20 20 20 20 28 69 66  l))))..      (if
38c0: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 6d   (not (null? rem
38d0: 74 65 73 74 73 29 29 0a 09 09 20 20 28 6c 6f 6f  tests))...  (loo
38e0: 70 20 28 63 61 72 20 72 65 6d 74 65 73 74 73 29  p (car remtests)
38f0: 28 63 64 72 20 72 65 6d 74 65 73 74 73 29 29 29  (cdr remtests)))
3900: 29 29 29 29 0a 0a 20 20 20 20 28 69 66 20 28 6e  ))))..    (if (n
3910: 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 71 75 69 72  ot (null? requir
3920: 65 64 2d 74 65 73 74 73 29 29 0a 09 28 64 65 62  ed-tests))..(deb
3930: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20  ug:print-info 1 
3940: 22 41 64 64 69 6e 67 20 22 20 72 65 71 75 69 72  "Adding " requir
3950: 65 64 2d 74 65 73 74 73 20 22 20 74 6f 20 74 68  ed-tests " to th
3960: 65 20 72 75 6e 20 71 75 65 75 65 22 29 29 0a 20  e run queue")). 
3970: 20 20 20 3b 3b 20 4e 4f 54 45 3a 20 74 68 65 73     ;; NOTE: thes
3980: 65 20 61 72 65 20 61 6c 6c 20 70 61 72 65 6e 74  e are all parent
3990: 20 74 65 73 74 73 2c 20 69 74 65 6d 73 20 61 72   tests, items ar
39a0: 65 20 6e 6f 74 20 65 78 70 61 6e 64 65 64 20 79  e not expanded y
39b0: 65 74 2e 0a 20 20 20 20 28 64 65 62 75 67 3a 70  et..    (debug:p
39c0: 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 74 65 73  rint-info 4 "tes
39d0: 74 2d 72 65 63 6f 72 64 73 3d 22 20 28 68 61 73  t-records=" (has
39e0: 68 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 74  h-table->alist t
39f0: 65 73 74 2d 72 65 63 6f 72 64 73 29 29 0a 20 20  est-records)).  
3a00: 20 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74    (runs:run-test
3a10: 73 2d 71 75 65 75 65 20 72 75 6e 2d 69 64 20 72  s-queue run-id r
3a20: 75 6e 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f  unname test-reco
3a30: 72 64 73 20 6b 65 79 76 61 6c 6c 73 74 20 66 6c  rds keyvallst fl
3a40: 61 67 73 20 74 65 73 74 2d 70 61 74 74 73 29 0a  ags test-patts).
3a50: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
3a60: 2d 69 6e 66 6f 20 34 20 22 41 6c 6c 20 64 6f 6e  -info 4 "All don
3a70: 65 20 62 79 20 68 65 72 65 22 29 29 29 0a 0a 28  e by here")))..(
3a80: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 63 61 6c  define (runs:cal
3a90: 63 2d 66 61 69 6c 73 20 70 72 65 72 65 71 73 2d  c-fails prereqs-
3aa0: 6e 6f 74 2d 6d 65 74 29 0a 20 20 28 66 69 6c 74  not-met).  (filt
3ab0: 65 72 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74  er (lambda (test
3ac0: 29 0a 09 20 20 20 20 28 61 6e 64 20 28 76 65 63  )..    (and (vec
3ad0: 74 6f 72 3f 20 74 65 73 74 29 20 3b 3b 20 6e 6f  tor? test) ;; no
3ae0: 74 20 28 73 74 72 69 6e 67 3f 20 74 65 73 74 29  t (string? test)
3af0: 29 0a 09 09 20 28 65 71 75 61 6c 3f 20 28 64 62  )... (equal? (db
3b00: 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20  :test-get-state 
3b10: 74 65 73 74 29 20 22 43 4f 4d 50 4c 45 54 45 44  test) "COMPLETED
3b20: 22 29 0a 09 09 20 28 6e 6f 74 20 28 6d 65 6d 62  ")... (not (memb
3b30: 65 72 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  er (db:test-get-
3b40: 73 74 61 74 75 73 20 74 65 73 74 29 0a 09 09 09  status test)....
3b50: 20 20 20 20 20 20 27 28 22 50 41 53 53 22 20 22        '("PASS" "
3b60: 57 41 52 4e 22 20 22 43 48 45 43 4b 22 20 22 57  WARN" "CHECK" "W
3b70: 41 49 56 45 44 22 20 22 53 4b 49 50 22 29 29 29  AIVED" "SKIP")))
3b80: 29 29 0a 09 20 20 70 72 65 72 65 71 73 2d 6e 6f  ))..  prereqs-no
3b90: 74 2d 6d 65 74 29 29 0a 0a 28 64 65 66 69 6e 65  t-met))..(define
3ba0: 20 28 72 75 6e 73 3a 63 61 6c 63 2d 6e 6f 74 2d   (runs:calc-not-
3bb0: 63 6f 6d 70 6c 65 74 65 64 20 70 72 65 72 65 71  completed prereq
3bc0: 73 2d 6e 6f 74 2d 6d 65 74 29 0a 20 20 28 66 69  s-not-met).  (fi
3bd0: 6c 74 65 72 0a 20 20 20 28 6c 61 6d 62 64 61 20  lter.   (lambda 
3be0: 28 74 29 0a 20 20 20 20 20 28 6f 72 20 28 6e 6f  (t).     (or (no
3bf0: 74 20 28 76 65 63 74 6f 72 3f 20 74 29 29 0a 09  t (vector? t))..
3c00: 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 22 43   (not (equal? "C
3c10: 4f 4d 50 4c 45 54 45 44 22 20 28 64 62 3a 74 65  OMPLETED" (db:te
3c20: 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74 29 29  st-get-state t))
3c30: 29 29 29 0a 20 20 20 70 72 65 72 65 71 73 2d 6e  ))).   prereqs-n
3c40: 6f 74 2d 6d 65 74 29 29 0a 0a 28 64 65 66 69 6e  ot-met))..(defin
3c50: 65 20 28 72 75 6e 73 3a 70 72 65 74 74 79 2d 73  e (runs:pretty-s
3c60: 74 72 69 6e 67 20 6c 73 74 29 0a 20 20 28 6d 61  tring lst).  (ma
3c70: 70 20 28 6c 61 6d 62 64 61 20 28 74 29 0a 09 20  p (lambda (t).. 
3c80: 28 69 66 20 28 6e 6f 74 20 28 76 65 63 74 6f 72  (if (not (vector
3c90: 3f 20 74 29 29 0a 09 20 20 20 20 20 28 63 6f 6e  ? t))..     (con
3ca0: 63 20 74 29 0a 09 20 20 20 20 20 28 63 6f 6e 63  c t)..     (conc
3cb0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65   (db:test-get-te
3cc0: 73 74 6e 61 6d 65 20 74 29 20 22 3a 22 20 28 64  stname t) ":" (d
3cd0: 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 65  b:test-get-state
3ce0: 20 74 29 20 22 2f 22 20 28 64 62 3a 74 65 73 74   t) "/" (db:test
3cf0: 2d 67 65 74 2d 73 74 61 74 75 73 20 74 29 29 29  -get-status t)))
3d00: 29 0a 20 20 20 20 20 20 20 6c 73 74 29 29 0a 0a  ).       lst))..
3d10: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 6d 61  (define (runs:ma
3d20: 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d  ke-full-test-nam
3d30: 65 20 74 65 73 74 6e 61 6d 65 20 69 74 65 6d 70  e testname itemp
3d40: 61 74 68 29 0a 20 20 28 69 66 20 28 65 71 75 61  ath).  (if (equa
3d50: 6c 3f 20 69 74 65 6d 70 61 74 68 20 22 22 29 20  l? itempath "") 
3d60: 74 65 73 74 6e 61 6d 65 20 28 63 6f 6e 63 20 74  testname (conc t
3d70: 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d  estname "/" item
3d80: 70 61 74 68 29 29 29 0a 0a 3b 3b 20 74 65 73 74  path)))..;; test
3d90: 2d 72 65 63 6f 72 64 73 20 69 73 20 61 20 68 61  -records is a ha
3da0: 73 68 20 74 61 62 6c 65 20 74 65 73 74 6e 61 6d  sh table testnam
3db0: 65 3a 69 74 65 6d 5f 70 61 74 68 20 3d 3e 20 76  e:item_path => v
3dc0: 65 63 74 6f 72 20 3c 20 74 65 73 74 6e 61 6d 65  ector < testname
3dd0: 20 74 65 73 74 63 6f 6e 66 69 67 20 77 61 69 74   testconfig wait
3de0: 6f 6e 73 20 70 72 69 6f 72 69 74 79 20 69 74 65  ons priority ite
3df0: 6d 73 2d 69 6e 66 6f 20 2e 2e 2e 20 3e 0a 28 64  ms-info ... >.(d
3e00: 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 75 6e 2d  efine (runs:run-
3e10: 74 65 73 74 73 2d 71 75 65 75 65 20 72 75 6e 2d  tests-queue run-
3e20: 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d  id runname test-
3e30: 72 65 63 6f 72 64 73 20 6b 65 79 76 61 6c 6c 73  records keyvalls
3e40: 74 20 66 6c 61 67 73 20 74 65 73 74 2d 70 61 74  t flags test-pat
3e50: 74 73 29 0a 20 20 20 20 3b 3b 20 41 74 20 74 68  ts).    ;; At th
3e60: 69 73 20 70 6f 69 6e 74 20 74 68 65 20 6c 69 73  is point the lis
3e70: 74 20 6f 66 20 70 61 72 65 6e 74 20 74 65 73 74  t of parent test
3e80: 73 20 69 73 20 65 78 70 61 6e 64 65 64 20 0a 20  s is expanded . 
3e90: 20 20 20 3b 3b 20 4e 42 2f 2f 20 53 68 6f 75 6c     ;; NB// Shoul
3ea0: 64 20 65 78 70 61 6e 64 20 69 74 65 6d 73 20 68  d expand items h
3eb0: 65 72 65 20 61 6e 64 20 74 68 65 6e 20 69 6e 73  ere and then ins
3ec0: 65 72 74 20 69 6e 74 6f 20 74 68 65 20 72 75 6e  ert into the run
3ed0: 20 71 75 65 75 65 2e 0a 20 20 28 64 65 62 75 67   queue..  (debug
3ee0: 3a 70 72 69 6e 74 20 35 20 22 74 65 73 74 2d 72  :print 5 "test-r
3ef0: 65 63 6f 72 64 73 3a 20 22 20 74 65 73 74 2d 72  ecords: " test-r
3f00: 65 63 6f 72 64 73 20 22 2c 20 6b 65 79 76 61 6c  ecords ", keyval
3f10: 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74  lst: " keyvallst
3f20: 20 22 20 66 6c 61 67 73 3a 20 22 20 28 68 61 73   " flags: " (has
3f30: 68 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 66  h-table->alist f
3f40: 6c 61 67 73 29 29 0a 20 20 28 6c 65 74 20 28 28  lags)).  (let ((
3f50: 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65  sorted-test-name
3f60: 73 20 28 74 65 73 74 73 3a 73 6f 72 74 2d 62 79  s (tests:sort-by
3f70: 2d 70 72 69 6f 72 69 74 79 2d 61 6e 64 2d 77 61  -priority-and-wa
3f80: 69 74 6f 6e 20 74 65 73 74 2d 72 65 63 6f 72 64  iton test-record
3f90: 73 29 29 0a 09 28 74 65 73 74 2d 72 65 67 69 73  s))..(test-regis
3fa0: 74 65 72 79 20 20 20 20 28 6d 61 6b 65 2d 68 61  tery    (make-ha
3fb0: 73 68 2d 74 61 62 6c 65 29 29 0a 09 28 72 65 67  sh-table))..(reg
3fc0: 69 73 74 65 72 79 2d 6d 75 74 65 78 20 20 20 28  istery-mutex   (
3fd0: 6d 61 6b 65 2d 6d 75 74 65 78 29 29 0a 09 28 6e  make-mutex))..(n
3fe0: 75 6d 2d 72 65 74 72 69 65 73 20 20 20 20 20 20  um-retries      
3ff0: 20 20 30 29 0a 09 28 6d 61 78 2d 72 65 74 72 69    0)..(max-retri
4000: 65 73 20 20 20 20 20 20 20 28 63 6f 6e 66 69 67  es       (config
4010: 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64  -lookup *configd
4020: 61 74 2a 20 22 73 65 74 75 70 22 20 22 6d 61 78  at* "setup" "max
4030: 72 65 74 72 69 65 73 22 29 29 29 0a 20 20 20 20  retries"))).    
4040: 28 73 65 74 21 20 6d 61 78 2d 72 65 74 72 69 65  (set! max-retrie
4050: 73 20 28 69 66 20 28 61 6e 64 20 6d 61 78 2d 72  s (if (and max-r
4060: 65 74 72 69 65 73 20 28 73 74 72 69 6e 67 2d 3e  etries (string->
4070: 6e 75 6d 62 65 72 20 6d 61 78 2d 72 65 74 72 69  number max-retri
4080: 65 73 29 29 28 73 74 72 69 6e 67 2d 3e 6e 75 6d  es))(string->num
4090: 62 65 72 20 6d 61 78 2d 72 65 74 72 69 65 73 29  ber max-retries)
40a0: 20 31 30 30 29 29 0a 20 20 20 20 28 69 66 20 28   100)).    (if (
40b0: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 73 6f 72 74 65  not (null? sorte
40c0: 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09  d-test-names))..
40d0: 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68 65 64 20  (let loop ((hed 
40e0: 20 20 20 20 20 20 20 20 28 63 61 72 20 73 6f 72          (car sor
40f0: 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29  ted-test-names))
4100: 0a 09 09 20 20 20 28 74 61 6c 20 20 20 20 20 20  ...   (tal      
4110: 20 20 20 28 63 64 72 20 73 6f 72 74 65 64 2d 74     (cdr sorted-t
4120: 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 09 20 20  est-names))...  
4130: 20 28 72 65 72 75 6e 73 20 20 20 20 20 20 27 28   (reruns      '(
4140: 29 29 29 0a 09 20 20 28 69 66 20 28 6e 6f 74 20  )))..  (if (not 
4150: 28 6e 75 6c 6c 3f 20 72 65 72 75 6e 73 29 29 28  (null? reruns))(
4160: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
4170: 20 34 20 22 72 65 72 75 6e 73 3d 22 20 72 65 72   4 "reruns=" rer
4180: 75 6e 73 29 29 0a 09 20 20 3b 3b 20 28 70 72 69  uns))..  ;; (pri
4190: 6e 74 20 22 54 6f 70 20 6f 66 20 6c 6f 6f 70 2c  nt "Top of loop,
41a0: 20 68 65 64 3d 22 20 68 65 64 20 22 2c 20 74 61   hed=" hed ", ta
41b0: 6c 3d 22 20 74 61 6c 20 22 20 2c 72 65 72 75 6e  l=" tal " ,rerun
41c0: 73 3d 22 20 72 65 72 75 6e 73 29 0a 09 20 20 28  s=" reruns)..  (
41d0: 6c 65 74 2a 20 28 28 74 65 73 74 2d 72 65 63 6f  let* ((test-reco
41e0: 72 64 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72  rd (hash-table-r
41f0: 65 66 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20  ef test-records 
4200: 68 65 64 29 29 0a 09 09 20 28 74 65 73 74 2d 6e  hed))... (test-n
4210: 61 6d 65 20 20 20 28 74 65 73 74 73 3a 74 65 73  ame   (tests:tes
4220: 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e  tqueue-get-testn
4230: 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 29  ame test-record)
4240: 29 0a 09 09 20 28 74 63 6f 6e 66 69 67 20 20 20  )... (tconfig   
4250: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65    (tests:testque
4260: 75 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66 69  ue-get-testconfi
4270: 67 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a  g test-record)).
4280: 09 09 20 28 74 65 73 74 6d 6f 64 65 20 20 20 20  .. (testmode    
4290: 28 6c 65 74 20 28 28 6d 20 28 63 6f 6e 66 69 67  (let ((m (config
42a0: 2d 6c 6f 6f 6b 75 70 20 74 63 6f 6e 66 69 67 20  -lookup tconfig 
42b0: 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22  "requirements" "
42c0: 6d 6f 64 65 22 29 29 29 0a 09 09 09 09 28 69 66  mode"))).....(if
42d0: 20 6d 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62   m (string->symb
42e0: 6f 6c 20 6d 29 20 27 6e 6f 72 6d 61 6c 29 29 29  ol m) 'normal)))
42f0: 0a 09 09 20 28 77 61 69 74 6f 6e 73 20 20 20 20  ... (waitons    
4300: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75   (tests:testqueu
4310: 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20 20 20  e-get-waitons   
4320: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09   test-record))..
4330: 09 20 28 70 72 69 6f 72 69 74 79 20 20 20 20 28  . (priority    (
4340: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
4350: 67 65 74 2d 70 72 69 6f 72 69 74 79 20 20 20 74  get-priority   t
4360: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 20  est-record))... 
4370: 28 69 74 65 6d 64 61 74 20 20 20 20 20 28 74 65  (itemdat     (te
4380: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65  sts:testqueue-ge
4390: 74 2d 69 74 65 6d 64 61 74 20 20 20 20 74 65 73  t-itemdat    tes
43a0: 74 2d 72 65 63 6f 72 64 29 29 20 3b 3b 20 69 74  t-record)) ;; it
43b0: 65 6d 64 61 74 20 63 61 6e 20 62 65 20 61 20 73  emdat can be a s
43c0: 74 72 69 6e 67 2c 20 6c 69 73 74 20 6f 72 20 23  tring, list or #
43d0: 66 0a 09 09 20 28 69 74 65 6d 73 20 20 20 20 20  f... (items     
43e0: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65    (tests:testque
43f0: 75 65 2d 67 65 74 2d 69 74 65 6d 73 20 20 20 20  ue-get-items    
4400: 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a    test-record)).
4410: 09 09 20 28 69 74 65 6d 2d 70 61 74 68 20 20 20  .. (item-path   
4420: 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68  (item-list->path
4430: 20 69 74 65 6d 64 61 74 29 29 0a 09 09 20 28 6e   itemdat))... (n
4440: 65 77 74 61 6c 20 20 20 20 20 20 28 61 70 70 65  ewtal      (appe
4450: 6e 64 20 74 61 6c 20 28 6c 69 73 74 20 68 65 64  nd tal (list hed
4460: 29 29 29 29 0a 09 20 20 20 20 0a 09 20 20 20 20  ))))..    ..    
4470: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 36 0a 09  (debug:print 6..
4480: 09 09 20 22 74 65 73 74 2d 6e 61 6d 65 3a 20 22  .. "test-name: "
4490: 20 74 65 73 74 2d 6e 61 6d 65 0a 09 09 09 20 22   test-name.... "
44a0: 5c 6e 20 20 68 65 64 3a 20 20 20 20 20 20 20 20  \n  hed:        
44b0: 20 22 20 68 65 64 0a 09 09 09 20 22 5c 6e 20 20   " hed.... "\n  
44c0: 69 74 65 6d 64 61 74 3a 20 20 20 20 20 22 20 69  itemdat:     " i
44d0: 74 65 6d 64 61 74 0a 09 09 09 20 22 5c 6e 20 20  temdat.... "\n  
44e0: 69 74 65 6d 73 3a 20 20 20 20 20 20 20 22 20 69  items:       " i
44f0: 74 65 6d 73 0a 09 09 09 20 22 5c 6e 20 20 69 74  tems.... "\n  it
4500: 65 6d 2d 70 61 74 68 3a 20 20 20 22 20 69 74 65  em-path:   " ite
4510: 6d 2d 70 61 74 68 0a 09 09 09 20 22 5c 6e 20 20  m-path.... "\n  
4520: 77 61 69 74 6f 6e 73 3a 20 20 20 20 20 22 20 77  waitons:     " w
4530: 61 69 74 6f 6e 73 0a 09 09 09 20 22 5c 6e 20 20  aitons.... "\n  
4540: 6e 75 6d 2d 72 65 74 72 69 65 73 3a 20 22 20 6e  num-retries: " n
4550: 75 6d 2d 72 65 74 72 69 65 73 0a 09 09 09 20 22  um-retries.... "
4560: 5c 6e 20 20 74 61 6c 3a 20 20 20 20 20 20 20 20  \n  tal:        
4570: 20 22 20 74 61 6c 0a 09 09 09 20 22 5c 6e 20 20   " tal.... "\n  
4580: 72 65 72 75 6e 73 3a 20 20 20 20 20 20 22 20 72  reruns:      " r
4590: 65 72 75 6e 73 29 0a 0a 09 20 20 20 20 3b 3b 20  eruns)...    ;; 
45a0: 63 68 65 63 6b 20 66 6f 72 20 68 65 64 20 69 6e  check for hed in
45b0: 20 77 61 69 74 6f 6e 73 20 3d 3e 20 74 68 69 73   waitons => this
45c0: 20 77 6f 75 6c 64 20 62 65 20 63 69 72 63 75 6c   would be circul
45d0: 61 72 2c 20 72 65 6d 6f 76 65 20 69 74 20 61 6e  ar, remove it an
45e0: 64 20 69 73 73 75 65 20 61 6e 0a 09 20 20 20 20  d issue an..    
45f0: 3b 3b 20 65 72 72 6f 72 0a 09 20 20 20 20 28 69  ;; error..    (i
4600: 66 20 28 6d 65 6d 62 65 72 20 74 65 73 74 2d 6e  f (member test-n
4610: 61 6d 65 20 77 61 69 74 6f 6e 73 29 0a 09 09 28  ame waitons)...(
4620: 62 65 67 69 6e 0a 09 09 20 20 28 64 65 62 75 67  begin...  (debug
4630: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a  :print 0 "ERROR:
4640: 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d   test " test-nam
4650: 65 20 22 20 68 61 73 20 6c 69 73 74 65 64 20 69  e " has listed i
4660: 74 73 65 6c 66 20 61 73 20 61 20 77 61 69 74 6f  tself as a waito
4670: 6e 2c 20 70 6c 65 61 73 65 20 63 6f 72 72 65 63  n, please correc
4680: 74 20 74 68 69 73 21 22 29 0a 09 09 20 20 28 73  t this!")...  (s
4690: 65 74 21 20 77 61 69 74 6f 6e 20 28 66 69 6c 74  et! waiton (filt
46a0: 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29 28 6e  er (lambda (x)(n
46b0: 6f 74 20 28 65 71 75 61 6c 3f 20 78 20 68 65 64  ot (equal? x hed
46c0: 29 29 29 20 77 61 69 74 6f 6e 73 29 29 29 29 0a  ))) waitons)))).
46d0: 0a 09 20 20 20 20 28 63 6f 6e 64 20 3b 3b 20 4f  ..    (cond ;; O
46e0: 55 54 45 52 20 43 4f 4e 44 0a 09 20 20 20 20 20  UTER COND..     
46f0: 28 28 6e 6f 74 20 69 74 65 6d 73 29 20 3b 3b 20  ((not items) ;; 
4700: 77 68 65 6e 20 66 61 6c 73 65 20 74 68 65 20 74  when false the t
4710: 65 73 74 20 69 73 20 6f 6b 20 74 6f 20 62 65 20  est is ok to be 
4720: 68 61 6e 64 65 64 20 6f 66 66 20 74 6f 20 6c 61  handed off to la
4730: 75 6e 63 68 20 28 62 75 74 20 6e 6f 74 20 62 65  unch (but not be
4740: 66 6f 72 65 29 0a 09 20 20 20 20 20 20 28 6c 65  fore)..      (le
4750: 74 2a 20 28 28 72 75 6e 2d 6c 69 6d 69 74 73 2d  t* ((run-limits-
4760: 69 6e 66 6f 20 20 20 20 20 20 20 20 20 28 6f 70  info         (op
4770: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e  en-run-close run
4780: 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74  s:can-run-more-t
4790: 65 73 74 73 20 74 65 73 74 2d 72 65 63 6f 72 64  ests test-record
47a0: 29 29 20 3b 3b 20 6c 6f 6f 6b 20 61 74 20 74 68  )) ;; look at th
47b0: 65 20 74 65 73 74 20 6a 6f 62 67 72 6f 75 70 20  e test jobgroup 
47c0: 61 6e 64 20 74 6f 74 20 6a 6f 62 73 20 72 75 6e  and tot jobs run
47d0: 6e 69 6e 67 0a 09 09 20 20 20 20 20 28 68 61 76  ning...     (hav
47e0: 65 2d 72 65 73 6f 75 72 63 65 73 20 20 20 20 20  e-resources     
47f0: 20 20 20 20 20 28 63 61 72 20 72 75 6e 2d 6c 69       (car run-li
4800: 6d 69 74 73 2d 69 6e 66 6f 29 29 0a 09 09 20 20  mits-info))...  
4810: 20 20 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20     (num-running 
4820: 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73              (lis
4830: 74 2d 72 65 66 20 72 75 6e 2d 6c 69 6d 69 74 73  t-ref run-limits
4840: 2d 69 6e 66 6f 20 31 29 29 0a 09 09 20 20 20 20  -info 1))...    
4850: 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e   (num-running-in
4860: 2d 6a 6f 62 67 72 6f 75 70 20 28 6c 69 73 74 2d  -jobgroup (list-
4870: 72 65 66 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69  ref run-limits-i
4880: 6e 66 6f 20 32 29 29 0a 09 09 20 20 20 20 20 28  nfo 2))...     (
4890: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a  max-concurrent-j
48a0: 6f 62 73 20 20 20 20 20 28 6c 69 73 74 2d 72 65  obs     (list-re
48b0: 66 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66  f run-limits-inf
48c0: 6f 20 33 29 29 0a 09 09 20 20 20 20 20 28 6a 6f  o 3))...     (jo
48d0: 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 20 20 20  b-group-limit   
48e0: 20 20 20 20 20 20 28 6c 69 73 74 2d 72 65 66 20        (list-ref 
48f0: 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 20  run-limits-info 
4900: 34 29 29 0a 09 09 20 20 20 20 20 28 70 72 65 72  4))...     (prer
4910: 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 20 20 20 20  eqs-not-met     
4920: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c      (open-run-cl
4930: 6f 73 65 20 64 62 3a 67 65 74 2d 70 72 65 72 65  ose db:get-prere
4940: 71 73 2d 6e 6f 74 2d 6d 65 74 20 23 66 20 72 75  qs-not-met #f ru
4950: 6e 2d 69 64 20 77 61 69 74 6f 6e 73 20 69 74 65  n-id waitons ite
4960: 6d 2d 70 61 74 68 20 6d 6f 64 65 3a 20 74 65 73  m-path mode: tes
4970: 74 6d 6f 64 65 29 29 0a 09 09 20 20 20 20 20 28  tmode))...     (
4980: 66 61 69 6c 73 20 20 20 20 20 20 20 20 20 20 20  fails           
4990: 20 20 20 20 20 20 20 20 28 72 75 6e 73 3a 63 61          (runs:ca
49a0: 6c 63 2d 66 61 69 6c 73 20 70 72 65 72 65 71 73  lc-fails prereqs
49b0: 2d 6e 6f 74 2d 6d 65 74 29 29 0a 09 09 20 20 20  -not-met))...   
49c0: 20 20 28 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64    (non-completed
49d0: 20 20 20 20 20 20 20 20 20 20 20 28 72 75 6e 73             (runs
49e0: 3a 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65  :calc-not-comple
49f0: 74 65 64 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d  ted prereqs-not-
4a00: 6d 65 74 29 29 29 0a 09 09 28 64 65 62 75 67 3a  met)))...(debug:
4a10: 70 72 69 6e 74 2d 69 6e 66 6f 20 38 20 22 68 61  print-info 8 "ha
4a20: 76 65 2d 72 65 73 6f 75 72 63 65 73 3a 20 22 20  ve-resources: " 
4a30: 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 20 22  have-resources "
4a40: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74   prereqs-not-met
4a50: 3a 20 22 20 0a 09 09 09 20 20 20 20 20 28 73 74  : " ....     (st
4a60: 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65  ring-intersperse
4a70: 20 0a 09 09 09 20 20 20 20 20 20 28 6d 61 70 20   ....      (map 
4a80: 28 6c 61 6d 62 64 61 20 28 74 29 0a 09 09 09 09  (lambda (t).....
4a90: 20 20 20 20 20 28 69 66 20 28 76 65 63 74 6f 72       (if (vector
4aa0: 3f 20 74 29 0a 09 09 09 09 09 20 28 63 6f 6e 63  ? t)...... (conc
4ab0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74   (db:test-get-st
4ac0: 61 74 65 20 74 29 20 22 2f 22 20 28 64 62 3a 74  ate t) "/" (db:t
4ad0: 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73 20 74  est-get-status t
4ae0: 29 29 0a 09 09 09 09 09 20 28 63 6f 6e 63 20 22  ))...... (conc "
4af0: 20 57 41 52 4e 49 4e 47 3a 20 74 20 69 73 20 6e   WARNING: t is n
4b00: 6f 74 20 61 20 76 65 63 74 6f 72 3d 22 20 74 20  ot a vector=" t 
4b10: 29 29 29 0a 09 09 09 09 20 20 20 70 72 65 72 65  ))).....   prere
4b20: 71 73 2d 6e 6f 74 2d 6d 65 74 29 20 22 2c 20 22  qs-not-met) ", "
4b30: 29 20 22 20 66 61 69 6c 73 3a 20 22 20 66 61 69  ) " fails: " fai
4b40: 6c 73 29 0a 09 09 28 64 65 62 75 67 3a 70 72 69  ls)...(debug:pri
4b50: 6e 74 2d 69 6e 66 6f 20 34 20 22 68 65 64 3d 22  nt-info 4 "hed="
4b60: 20 68 65 64 20 22 5c 6e 20 20 74 65 73 74 2d 72   hed "\n  test-r
4b70: 65 63 6f 72 64 3d 22 20 74 65 73 74 2d 72 65 63  ecord=" test-rec
4b80: 6f 72 64 20 22 5c 6e 20 20 74 65 73 74 2d 6e 61  ord "\n  test-na
4b90: 6d 65 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 20  me: " test-name 
4ba0: 22 5c 6e 20 20 69 74 65 6d 2d 70 61 74 68 3a 20  "\n  item-path: 
4bb0: 22 20 69 74 65 6d 2d 70 61 74 68 20 22 5c 6e 20  " item-path "\n 
4bc0: 20 74 65 73 74 2d 70 61 74 74 73 3a 20 22 20 74   test-patts: " t
4bd0: 65 73 74 2d 70 61 74 74 73 29 0a 0a 09 09 3b 3b  est-patts)....;;
4be0: 20 44 6f 6e 27 74 20 6b 6e 6f 77 20 61 74 20 74   Don't know at t
4bf0: 68 69 73 20 74 69 6d 65 20 69 66 20 74 68 65 20  his time if the 
4c00: 74 65 73 74 20 68 61 76 65 20 62 65 65 6e 20 6c  test have been l
4c10: 61 75 6e 63 68 65 64 20 61 74 20 73 6f 6d 65 20  aunched at some 
4c20: 74 69 6d 65 20 69 6e 20 74 68 65 20 70 61 73 74  time in the past
4c30: 0a 09 09 3b 3b 20 69 2e 65 2e 20 69 73 20 74 68  ...;; i.e. is th
4c40: 69 73 20 61 20 72 65 2d 6c 61 75 6e 63 68 3f 0a  is a re-launch?.
4c50: 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69  ..(debug:print-i
4c60: 6e 66 6f 20 34 20 22 72 75 6e 2d 6c 69 6d 69 74  nfo 4 "run-limit
4c70: 73 2d 69 6e 66 6f 20 3d 20 22 20 72 75 6e 2d 6c  s-info = " run-l
4c80: 69 6d 69 74 73 2d 69 6e 66 6f 29 0a 09 09 28 63  imits-info)...(c
4c90: 6f 6e 64 20 3b 3b 20 49 4e 4e 45 52 20 43 4f 4e  ond ;; INNER CON
4ca0: 44 20 23 31 20 66 6f 72 20 61 20 6c 61 75 6e 63  D #1 for a launc
4cb0: 68 61 62 6c 65 20 74 65 73 74 0a 09 09 20 3b 3b  hable test... ;;
4cc0: 20 43 68 65 63 6b 20 69 74 65 6d 20 70 61 74 68   Check item path
4cd0: 20 61 67 61 69 6e 73 74 20 69 74 65 6d 2d 70 61   against item-pa
4ce0: 74 74 73 0a 09 09 20 28 28 6e 6f 74 20 28 74 65  tts... ((not (te
4cf0: 73 74 73 3a 6d 61 74 63 68 20 74 65 73 74 2d 70  sts:match test-p
4d00: 61 74 74 73 20 28 74 65 73 74 73 3a 74 65 73 74  atts (tests:test
4d10: 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61  queue-get-testna
4d20: 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 29 20  me test-record) 
4d30: 69 74 65 6d 2d 70 61 74 68 29 29 20 3b 3b 20 54  item-path)) ;; T
4d40: 68 69 73 20 74 65 73 74 2f 69 74 65 6d 70 61 74  his test/itempat
4d50: 68 20 69 73 20 6e 6f 74 20 74 6f 20 62 65 20 72  h is not to be r
4d60: 75 6e 0a 09 09 20 20 3b 3b 20 65 6c 73 65 20 74  un...  ;; else t
4d70: 68 65 20 72 75 6e 20 69 73 20 73 74 75 63 6b 2c  he run is stuck,
4d80: 20 74 65 6d 70 6f 72 61 72 69 6c 79 20 6f 72 20   temporarily or 
4d90: 70 65 72 6d 61 6e 65 6e 74 6c 79 0a 09 09 20 20  permanently...  
4da0: 3b 3b 20 62 75 74 20 73 68 6f 75 6c 64 20 63 68  ;; but should ch
4db0: 65 63 6b 20 69 66 20 69 74 20 69 73 20 64 75 65  eck if it is due
4dc0: 20 74 6f 20 6c 61 63 6b 20 6f 66 20 72 65 73 6f   to lack of reso
4dd0: 75 72 63 65 73 20 76 73 2e 20 70 72 65 72 65 71  urces vs. prereq
4de0: 75 69 73 69 74 65 73 0a 09 09 20 20 28 64 65 62  uisites...  (deb
4df0: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20  ug:print-info 1 
4e00: 22 53 6b 69 70 70 69 6e 67 20 22 20 28 74 65 73  "Skipping " (tes
4e10: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
4e20: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72  -testname test-r
4e30: 65 63 6f 72 64 29 20 22 20 22 20 69 74 65 6d 2d  ecord) " " item-
4e40: 70 61 74 68 20 22 20 61 73 20 69 74 20 64 6f 65  path " as it doe
4e50: 73 6e 27 74 20 6d 61 74 63 68 20 22 20 74 65 73  sn't match " tes
4e60: 74 2d 70 61 74 74 73 29 0a 09 09 20 20 3b 3b 20  t-patts)...  ;; 
4e70: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a  (thread-sleep! *
4e80: 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09  global-delta*)..
4e90: 09 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c  .  (if (not (nul
4ea0: 6c 3f 20 74 61 6c 29 29 0a 09 09 20 20 20 20 20  l? tal))...     
4eb0: 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29   (loop (car tal)
4ec0: 28 63 64 72 20 74 61 6c 29 20 72 65 72 75 6e 73  (cdr tal) reruns
4ed0: 29 29 29 0a 09 09 20 3b 3b 20 52 65 67 69 73 74  )))... ;; Regist
4ee0: 65 72 79 20 68 61 73 20 62 65 65 6e 20 73 74 61  ery has been sta
4ef0: 72 74 65 64 20 66 6f 72 20 74 68 69 73 20 74 65  rted for this te
4f00: 73 74 20 62 75 74 20 68 61 73 20 6e 6f 74 20 79  st but has not y
4f10: 65 74 20 63 6f 6d 70 6c 65 74 65 64 0a 09 09 20  et completed... 
4f20: 3b 3b 20 74 68 69 73 20 73 68 6f 75 6c 64 20 62  ;; this should b
4f30: 65 20 72 61 72 65 2c 20 74 68 65 20 63 61 73 65  e rare, the case
4f40: 20 77 68 65 72 65 20 74 68 65 72 65 20 61 72 65   where there are
4f50: 20 6f 6e 6c 79 20 61 20 63 6f 75 70 6c 65 20 6f   only a couple o
4f60: 66 20 74 65 73 74 73 20 61 6e 64 20 74 68 65 20  f tests and the 
4f70: 64 62 20 69 73 20 73 6c 6f 77 0a 09 09 20 3b 3b  db is slow... ;;
4f80: 20 64 65 6c 61 79 20 61 20 73 68 6f 72 74 20 77   delay a short w
4f90: 68 69 6c 65 20 61 6e 64 20 63 6f 6e 74 69 6e 75  hile and continu
4fa0: 65 0a 09 09 20 28 28 65 71 3f 20 28 68 61 73 68  e... ((eq? (hash
4fb0: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75  -table-ref/defau
4fc0: 6c 74 20 74 65 73 74 2d 72 65 67 69 73 74 65 72  lt test-register
4fd0: 79 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c  y (runs:make-ful
4fe0: 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74  l-test-name test
4ff0: 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29  -name item-path)
5000: 20 23 66 29 20 27 73 74 61 72 74 29 0a 09 09 20   #f) 'start)... 
5010: 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20   (thread-sleep! 
5020: 30 2e 30 31 29 0a 09 09 20 20 28 6c 6f 6f 70 20  0.01)...  (loop 
5030: 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72  (car newtal)(cdr
5040: 20 6e 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29   newtal) reruns)
5050: 29 0a 09 09 20 28 28 6e 6f 74 20 28 68 61 73 68  )... ((not (hash
5060: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75  -table-ref/defau
5070: 6c 74 20 74 65 73 74 2d 72 65 67 69 73 74 65 72  lt test-register
5080: 79 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c  y (runs:make-ful
5090: 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74  l-test-name test
50a0: 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29  -name item-path)
50b0: 20 23 66 29 29 0a 09 09 20 20 28 64 65 62 75 67   #f))...  (debug
50c0: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 50  :print-info 4 "P
50d0: 72 65 2d 72 65 67 69 73 74 65 72 69 6e 67 20 74  re-registering t
50e0: 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20  est " test-name 
50f0: 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20  "/" item-path " 
5100: 74 6f 20 63 72 65 61 74 65 20 70 6c 61 63 65 68  to create placeh
5110: 6f 6c 64 65 72 22 20 29 0a 09 09 20 20 3b 3b 20  older" )...  ;; 
5120: 4e 45 45 44 20 54 4f 20 54 48 52 45 41 44 49 46  NEED TO THREADIF
5130: 59 20 54 48 49 53 0a 09 09 20 20 28 6c 65 74 20  Y THIS...  (let 
5140: 28 28 74 68 20 28 6d 61 6b 65 2d 74 68 72 65 61  ((th (make-threa
5150: 64 20 28 6c 61 6d 62 64 61 20 28 29 0a 09 09 20  d (lambda ()... 
5160: 20 20 20 20 20 20 20 09 09 20 20 20 28 6d 75 74         ..   (mut
5170: 65 78 2d 6c 6f 63 6b 21 20 72 65 67 69 73 74 65  ex-lock! registe
5180: 72 79 2d 6d 75 74 65 78 29 0a 09 09 20 20 20 20  ry-mutex)...    
5190: 20 20 20 20 09 09 20 20 20 28 68 61 73 68 2d 74      ..   (hash-t
51a0: 61 62 6c 65 2d 73 65 74 21 20 74 65 73 74 2d 72  able-set! test-r
51b0: 65 67 69 73 74 65 72 79 20 28 72 75 6e 73 3a 6d  egistery (runs:m
51c0: 61 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61  ake-full-test-na
51d0: 6d 65 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65  me test-name ite
51e0: 6d 2d 70 61 74 68 29 20 27 73 74 61 72 74 29 0a  m-path) 'start).
51f0: 09 09 20 20 20 20 20 20 20 20 09 09 20 20 20 28  ..        ..   (
5200: 6d 75 74 65 78 2d 75 6e 6c 6f 63 6b 21 20 72 65  mutex-unlock! re
5210: 67 69 73 74 65 72 79 2d 6d 75 74 65 78 29 0a 09  gistery-mutex)..
5220: 09 20 20 20 20 20 20 09 09 20 20 20 28 63 64 62  .      ..   (cdb
5230: 3a 74 65 73 74 73 2d 72 65 67 69 73 74 65 72 2d  :tests-register-
5240: 74 65 73 74 20 2a 72 75 6e 72 65 6d 6f 74 65 2a  test *runremote*
5250: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d   run-id test-nam
5260: 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 09 20  e item-path)... 
5270: 20 20 20 20 20 20 20 09 09 20 20 20 28 6d 75 74         ..   (mut
5280: 65 78 2d 6c 6f 63 6b 21 20 72 65 67 69 73 74 65  ex-lock! registe
5290: 72 79 2d 6d 75 74 65 78 29 0a 09 09 20 20 20 20  ry-mutex)...    
52a0: 20 20 09 09 20 20 20 28 68 61 73 68 2d 74 61 62    ..   (hash-tab
52b0: 6c 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 67  le-set! test-reg
52c0: 69 73 74 65 72 79 20 28 72 75 6e 73 3a 6d 61 6b  istery (runs:mak
52d0: 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65  e-full-test-name
52e0: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d   test-name item-
52f0: 70 61 74 68 29 20 27 64 6f 6e 65 29 0a 09 09 20  path) 'done)... 
5300: 20 20 20 20 20 20 20 09 09 20 20 20 28 6d 75 74         ..   (mut
5310: 65 78 2d 75 6e 6c 6f 63 6b 21 20 72 65 67 69 73  ex-unlock! regis
5320: 74 65 72 79 2d 6d 75 74 65 78 29 29 0a 09 09 20  tery-mutex))... 
5330: 20 20 20 20 20 20 20 09 09 20 28 63 6f 6e 63 20         .. (conc 
5340: 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74  test-name "/" it
5350: 65 6d 2d 70 61 74 68 29 29 29 29 0a 09 09 20 20  em-path))))...  
5360: 20 20 28 74 68 72 65 61 64 2d 73 74 61 72 74 21    (thread-start!
5370: 20 74 68 29 29 0a 09 09 20 20 28 74 68 72 65 61   th))...  (threa
5380: 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c  d-sleep! *global
5390: 2d 64 65 6c 74 61 2a 29 0a 28 72 75 6e 73 3a 73  -delta*).(runs:s
53a0: 68 72 69 6e 6b 2d 63 61 6e 2d 72 75 6e 2d 6d 6f  hrink-can-run-mo
53b0: 72 65 2d 74 65 73 74 73 2d 64 65 6c 61 79 29 0a  re-tests-delay).
53c0: 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e  ..  (loop (car n
53d0: 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61  ewtal)(cdr newta
53e0: 6c 29 20 72 65 72 75 6e 73 29 29 0a 09 09 20 28  l) reruns))... (
53f0: 28 6e 6f 74 20 68 61 76 65 2d 72 65 73 6f 75 72  (not have-resour
5400: 63 65 73 29 20 3b 3b 20 73 69 6d 70 6c 79 20 74  ces) ;; simply t
5410: 72 79 20 61 67 61 69 6e 20 61 66 74 65 72 20 77  ry again after w
5420: 61 69 74 69 6e 67 20 61 20 73 65 63 6f 6e 64 0a  aiting a second.
5430: 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ..  (debug:print
5440: 2d 69 6e 66 6f 20 31 20 22 6e 6f 20 72 65 73 6f  -info 1 "no reso
5450: 75 72 63 65 73 20 74 6f 20 72 75 6e 20 6e 65 77  urces to run new
5460: 20 74 65 73 74 73 2c 20 77 61 69 74 69 6e 67 20   tests, waiting 
5470: 2e 2e 2e 22 29 0a 09 09 20 20 3b 3b 20 28 74 68  ...")...  ;; (th
5480: 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 32  read-sleep! (+ 2
5490: 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29   *global-delta*)
54a0: 29 0a 09 09 20 20 3b 3b 20 63 6f 75 6c 64 20 68  )...  ;; could h
54b0: 61 76 65 20 64 6f 6e 65 20 68 65 64 20 74 61 6c  ave done hed tal
54c0: 20 68 65 72 65 20 62 75 74 20 64 6f 69 6e 67 20   here but doing 
54d0: 63 61 72 2f 63 64 72 20 6f 66 20 6e 65 77 74 61  car/cdr of newta
54e0: 6c 20 74 6f 20 72 6f 74 61 74 65 20 74 65 73 74  l to rotate test
54f0: 73 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72  s...  (loop (car
5500: 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77   newtal)(cdr new
5510: 74 61 6c 29 20 72 65 72 75 6e 73 29 29 0a 09 09  tal) reruns))...
5520: 20 28 28 61 6e 64 20 68 61 76 65 2d 72 65 73 6f   ((and have-reso
5530: 75 72 63 65 73 0a 09 09 20 20 20 20 20 20 20 28  urces...       (
5540: 6f 72 20 28 6e 75 6c 6c 3f 20 70 72 65 72 65 71  or (null? prereq
5550: 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09 09 20 20  s-not-met)....  
5560: 20 28 61 6e 64 20 28 65 71 3f 20 74 65 73 74 6d   (and (eq? testm
5570: 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c 29 0a 09  ode 'toplevel)..
5580: 09 09 09 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f  ...(null? non-co
5590: 6d 70 6c 65 74 65 64 29 29 29 29 0a 09 09 20 20  mpleted))))...  
55a0: 28 72 75 6e 3a 74 65 73 74 20 72 75 6e 2d 69 64  (run:test run-id
55b0: 20 72 75 6e 6e 61 6d 65 20 6b 65 79 76 61 6c 6c   runname keyvall
55c0: 73 74 20 74 65 73 74 2d 72 65 63 6f 72 64 20 66  st test-record f
55d0: 6c 61 67 73 20 23 66 29 0a 28 72 75 6e 73 3a 73  lags #f).(runs:s
55e0: 68 72 69 6e 6b 2d 63 61 6e 2d 72 75 6e 2d 6d 6f  hrink-can-run-mo
55f0: 72 65 2d 74 65 73 74 73 2d 64 65 6c 61 79 29 0a  re-tests-delay).
5600: 09 09 20 20 3b 3b 20 28 74 68 72 65 61 64 2d 73  ..  ;; (thread-s
5610: 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65  leep! *global-de
5620: 6c 74 61 2a 29 0a 09 09 20 20 28 69 66 20 28 6e  lta*)...  (if (n
5630: 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a  ot (null? tal)).
5640: 09 09 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63  ..      (loop (c
5650: 61 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29  ar tal)(cdr tal)
5660: 20 72 65 72 75 6e 73 29 29 29 0a 09 09 20 28 65   reruns)))... (e
5670: 6c 73 65 20 3b 3b 20 6d 75 73 74 20 62 65 20 77  lse ;; must be w
5680: 65 20 68 61 76 65 20 75 6e 6d 65 74 20 70 72 65  e have unmet pre
5690: 72 65 71 75 69 73 69 74 65 73 0a 09 09 20 20 20  requisites...   
56a0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20   (debug:print 4 
56b0: 22 46 41 49 4c 53 3a 20 22 20 66 61 69 6c 73 29  "FAILS: " fails)
56c0: 0a 09 09 20 20 20 20 3b 3b 20 49 66 20 6f 6e 65  ...    ;; If one
56d0: 20 6f 72 20 6d 6f 72 65 20 6f 66 20 74 68 65 20   or more of the 
56e0: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20  prereqs-not-met 
56f0: 61 72 65 20 46 41 49 4c 20 74 68 65 6e 20 77 65  are FAIL then we
5700: 20 63 61 6e 20 69 73 73 75 65 0a 09 09 20 20 20   can issue...   
5710: 20 3b 3b 20 61 20 6d 65 73 73 61 67 65 20 61 6e   ;; a message an
5720: 64 20 64 72 6f 70 20 68 65 64 20 66 72 6f 6d 20  d drop hed from 
5730: 74 68 65 20 69 74 65 6d 73 20 74 6f 20 62 65 20  the items to be 
5740: 70 72 6f 63 65 73 73 65 64 2e 0a 09 09 20 20 20  processed....   
5750: 20 28 69 66 20 28 6e 75 6c 6c 3f 20 66 61 69 6c   (if (null? fail
5760: 73 29 0a 09 09 09 28 62 65 67 69 6e 0a 09 09 09  s)....(begin....
5770: 20 20 3b 3b 20 63 6f 75 6c 64 6e 27 74 20 72 75    ;; couldn't ru
5780: 6e 2c 20 74 61 6b 65 20 61 20 62 72 65 61 74 68  n, take a breath
5790: 65 72 0a 09 09 09 20 20 28 64 65 62 75 67 3a 70  er....  (debug:p
57a0: 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 53 68 6f  rint-info 4 "Sho
57b0: 75 6c 64 6e 27 74 20 72 65 61 6c 6c 79 20 67 65  uldn't really ge
57c0: 74 20 68 65 72 65 2c 20 72 61 63 65 20 63 6f 6e  t here, race con
57d0: 64 69 74 69 6f 6e 3f 20 55 6e 61 62 6c 65 20 74  dition? Unable t
57e0: 6f 20 6c 61 75 6e 63 68 20 6d 6f 72 65 20 74 65  o launch more te
57f0: 73 74 73 20 61 74 20 74 68 69 73 20 6d 6f 6d 65  sts at this mome
5800: 6e 74 2c 20 6b 69 6c 6c 69 6e 67 20 74 69 6d 65  nt, killing time
5810: 20 2e 2e 2e 22 29 0a 09 09 09 20 20 3b 3b 20 28   ...")....  ;; (
5820: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b  thread-sleep! (+
5830: 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d 64 65   0.01 *global-de
5840: 6c 74 61 2a 29 29 20 3b 3b 20 6c 6f 6e 67 20 73  lta*)) ;; long s
5850: 6c 65 65 70 20 68 65 72 65 20 2d 20 6e 6f 20 72  leep here - no r
5860: 65 73 6f 75 72 63 65 73 2c 20 6d 61 79 20 61 73  esources, may as
5870: 20 77 65 6c 6c 20 62 65 20 70 61 74 69 65 6e 74   well be patient
5880: 0a 09 09 09 20 20 3b 3b 20 77 65 20 6d 61 64 65  ....  ;; we made
5890: 20 6e 65 77 20 74 61 6c 20 62 79 20 73 74 69 63   new tal by stic
58a0: 6b 69 6e 67 20 68 65 64 20 61 74 20 74 68 65 20  king hed at the 
58b0: 62 61 63 6b 20 6f 66 20 74 68 65 20 6c 69 73 74  back of the list
58c0: 0a 09 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72  ....  (loop (car
58d0: 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77   newtal)(cdr new
58e0: 74 61 6c 29 20 72 65 72 75 6e 73 29 29 0a 09 09  tal) reruns))...
58f0: 09 3b 3b 20 74 68 65 20 77 61 69 74 6f 6e 20 69  .;; the waiton i
5900: 73 20 46 41 49 4c 20 73 6f 20 6e 6f 20 70 6f 69  s FAIL so no poi
5910: 6e 74 20 69 6e 20 74 72 79 69 6e 67 20 74 6f 20  nt in trying to 
5920: 72 75 6e 20 68 65 64 20 65 76 65 72 20 61 67 61  run hed ever aga
5930: 69 6e 0a 09 09 09 28 69 66 20 28 6e 6f 74 20 28  in....(if (not (
5940: 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 09 20  null? tal)).... 
5950: 20 20 20 28 69 66 20 28 76 65 63 74 6f 72 3f 20     (if (vector? 
5960: 68 65 64 29 0a 09 09 09 09 28 62 65 67 69 6e 20  hed).....(begin 
5970: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22  (debug:print 1 "
5980: 57 41 52 4e 3a 20 44 72 6f 70 70 69 6e 67 20 74  WARN: Dropping t
5990: 65 73 74 20 22 20 28 64 62 3a 74 65 73 74 2d 67  est " (db:test-g
59a0: 65 74 2d 74 65 73 74 6e 61 6d 65 20 68 65 64 29  et-testname hed)
59b0: 20 22 2f 22 20 28 64 62 3a 74 65 73 74 2d 67 65   "/" (db:test-ge
59c0: 74 2d 69 74 65 6d 2d 70 61 74 68 20 68 65 64 29  t-item-path hed)
59d0: 0a 09 09 09 09 09 09 20 20 20 20 22 20 66 72 6f  .......    " fro
59e0: 6d 20 74 68 65 20 6c 61 75 6e 63 68 20 6c 69 73  m the launch lis
59f0: 74 20 61 73 20 69 74 20 68 61 73 20 70 72 65 72  t as it has prer
5a00: 65 71 75 69 73 74 65 73 20 74 68 61 74 20 61 72  equistes that ar
5a10: 65 20 46 41 49 4c 22 29 0a 28 72 75 6e 73 3a 73  e FAIL").(runs:s
5a20: 68 72 69 6e 6b 2d 63 61 6e 2d 72 75 6e 2d 6d 6f  hrink-can-run-mo
5a30: 72 65 2d 74 65 73 74 73 2d 64 65 6c 61 79 29 0a  re-tests-delay).
5a40: 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20 28 74  ....       ;; (t
5a50: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c  hread-sleep! *gl
5a60: 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 09  obal-delta*)....
5a70: 09 20 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63  .       (loop (c
5a80: 61 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29  ar tal)(cdr tal)
5a90: 20 28 63 6f 6e 73 20 68 65 64 20 72 65 72 75 6e   (cons hed rerun
5aa0: 73 29 29 29 0a 09 09 09 09 28 62 65 67 69 6e 0a  s))).....(begin.
5ab0: 09 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 69  ....  (debug:pri
5ac0: 6e 74 20 31 20 22 57 41 52 4e 3a 20 54 65 73 74  nt 1 "WARN: Test
5ad0: 20 6e 6f 74 20 70 72 6f 63 65 73 73 65 64 20 63   not processed c
5ae0: 6f 72 72 65 63 74 6c 79 2e 20 43 6f 75 6c 64 20  orrectly. Could 
5af0: 62 65 20 61 20 72 61 63 65 20 63 6f 6e 64 69 74  be a race condit
5b00: 69 6f 6e 20 69 6e 20 79 6f 75 72 20 74 65 73 74  ion in your test
5b10: 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 3f   implementation?
5b20: 20 22 20 68 65 64 29 20 3b 3b 20 20 22 20 61 73   " hed) ;;  " as
5b30: 20 69 74 20 68 61 73 20 70 72 65 72 65 71 75 69   it has prerequi
5b40: 73 74 65 73 20 74 68 61 74 20 61 72 65 20 46 41  stes that are FA
5b50: 49 4c 2e 20 28 4e 4f 54 45 3a 20 68 65 64 20 69  IL. (NOTE: hed i
5b60: 73 20 6e 6f 74 20 61 20 76 65 63 74 6f 72 29 22  s not a vector)"
5b70: 29 0a 28 72 75 6e 73 3a 73 68 72 69 6e 6b 2d 63  ).(runs:shrink-c
5b80: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74  an-run-more-test
5b90: 73 2d 64 65 6c 61 79 29 0a 09 09 09 09 20 20 3b  s-delay).....  ;
5ba0: 3b 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21  ; (thread-sleep!
5bb0: 20 28 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c   (+ 0.01 *global
5bc0: 2d 64 65 6c 74 61 2a 29 29 0a 09 09 09 09 20 20  -delta*)).....  
5bd0: 28 6c 6f 6f 70 20 68 65 64 20 74 61 6c 20 72 65  (loop hed tal re
5be0: 72 75 6e 73 29 29 29 29 29 29 29 29 29 20 3b 3b  runs))))))))) ;;
5bf0: 20 45 4e 44 20 4f 46 20 49 4e 4e 45 52 20 43 4f   END OF INNER CO
5c00: 4e 44 0a 09 20 20 20 20 20 0a 09 20 20 20 20 20  ND..     ..     
5c10: 3b 3b 20 63 61 73 65 20 77 68 65 72 65 20 61 6e  ;; case where an
5c20: 20 69 74 65 6d 73 20 63 61 6d 65 20 69 6e 20 61   items came in a
5c30: 73 20 61 20 6c 69 73 74 20 62 65 65 6e 20 70 72  s a list been pr
5c40: 6f 63 65 73 73 65 64 0a 09 20 20 20 20 20 28 28  ocessed..     ((
5c50: 61 6e 64 20 28 6c 69 73 74 3f 20 69 74 65 6d 73  and (list? items
5c60: 29 20 20 20 20 20 3b 3b 20 74 68 75 73 20 77 65  )     ;; thus we
5c70: 20 6b 6e 6f 77 20 6f 75 72 20 69 74 65 6d 73 20   know our items 
5c80: 61 72 65 20 61 6c 72 65 61 64 79 20 63 61 6c 63  are already calc
5c90: 75 6c 61 74 65 64 0a 09 09 20 20 20 28 6e 6f 74  ulated...   (not
5ca0: 20 20 20 69 74 65 6d 64 61 74 29 29 20 3b 3b 20     itemdat)) ;; 
5cb0: 61 6e 64 20 6e 6f 74 20 79 65 74 20 65 78 70 61  and not yet expa
5cc0: 6e 64 65 64 20 69 6e 74 6f 20 74 68 65 20 6c 69  nded into the li
5cd0: 73 74 20 6f 66 20 74 68 69 6e 67 73 20 74 6f 20  st of things to 
5ce0: 62 65 20 64 6f 6e 65 0a 09 20 20 20 20 20 20 28  be done..      (
5cf0: 69 66 20 28 61 6e 64 20 28 64 65 62 75 67 3a 64  if (and (debug:d
5d00: 65 62 75 67 2d 6d 6f 64 65 20 31 29 20 3b 3b 20  ebug-mode 1) ;; 
5d10: 28 3e 3d 20 2a 76 65 72 62 6f 73 69 74 79 2a 20  (>= *verbosity* 
5d20: 31 29 0a 09 09 20 20 20 20 20 20 20 28 3e 20 28  1)...       (> (
5d30: 6c 65 6e 67 74 68 20 69 74 65 6d 73 29 20 30 29  length items) 0)
5d40: 0a 09 09 20 20 20 20 20 20 20 28 3e 20 28 6c 65  ...       (> (le
5d50: 6e 67 74 68 20 28 63 61 72 20 69 74 65 6d 73 29  ngth (car items)
5d60: 29 20 30 29 29 0a 09 09 20 20 28 70 70 20 69 74  ) 0))...  (pp it
5d70: 65 6d 73 29 29 0a 09 20 20 20 20 20 20 28 66 6f  ems))..      (fo
5d80: 72 2d 65 61 63 68 0a 09 20 20 20 20 20 20 20 28  r-each..       (
5d90: 6c 61 6d 62 64 61 20 28 6d 79 2d 69 74 65 6d 64  lambda (my-itemd
5da0: 61 74 29 0a 09 09 20 28 6c 65 74 2a 20 28 28 6e  at)... (let* ((n
5db0: 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 28  ew-test-record (
5dc0: 6c 65 74 20 28 28 6e 65 77 72 65 63 20 28 6d 61  let ((newrec (ma
5dd0: 6b 65 2d 74 65 73 74 73 3a 74 65 73 74 71 75 65  ke-tests:testque
5de0: 75 65 29 29 29 0a 09 09 09 09 09 20 20 20 28 76  ue)))......   (v
5df0: 65 63 74 6f 72 2d 63 6f 70 79 21 20 74 65 73 74  ector-copy! test
5e00: 2d 72 65 63 6f 72 64 20 6e 65 77 72 65 63 29 0a  -record newrec).
5e10: 09 09 09 09 09 20 20 20 6e 65 77 72 65 63 29 29  .....   newrec))
5e20: 0a 09 09 09 28 6d 79 2d 69 74 65 6d 2d 70 61 74  ....(my-item-pat
5e30: 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61  h (item-list->pa
5e40: 74 68 20 6d 79 2d 69 74 65 6d 64 61 74 29 29 29  th my-itemdat)))
5e50: 0a 09 09 20 20 20 28 69 66 20 28 74 65 73 74 73  ...   (if (tests
5e60: 3a 6d 61 74 63 68 20 74 65 73 74 2d 70 61 74 74  :match test-patt
5e70: 73 20 68 65 64 20 6d 79 2d 69 74 65 6d 2d 70 61  s hed my-item-pa
5e80: 74 68 29 20 3b 3b 20 28 70 61 74 74 2d 6c 69 73  th) ;; (patt-lis
5e90: 74 2d 6d 61 74 63 68 20 6d 79 2d 69 74 65 6d 2d  t-match my-item-
5ea0: 70 61 74 68 20 69 74 65 6d 2d 70 61 74 74 73 29  path item-patts)
5eb0: 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 79 65             ;; ye
5ec0: 73 2c 20 77 65 20 77 61 6e 74 20 74 6f 20 70 72  s, we want to pr
5ed0: 6f 63 65 73 73 20 74 68 69 73 20 69 74 65 6d 2c  ocess this item,
5ee0: 20 4e 4f 54 45 3a 20 53 68 6f 75 6c 64 20 6e 6f   NOTE: Should no
5ef0: 74 20 6e 65 65 64 20 74 68 69 73 20 63 68 65 63  t need this chec
5f00: 6b 20 68 65 72 65 21 0a 09 09 20 20 20 20 20 20  k here!...      
5f10: 20 28 6c 65 74 20 28 28 6e 65 77 74 65 73 74 6e   (let ((newtestn
5f20: 61 6d 65 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66  ame (runs:make-f
5f30: 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 68 65  ull-test-name he
5f40: 64 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68 29 29  d my-item-path))
5f50: 29 20 20 20 20 3b 3b 20 74 65 73 74 20 6e 61 6d  )    ;; test nam
5f60: 65 73 20 61 72 65 20 75 6e 69 71 75 65 20 6f 6e  es are unique on
5f70: 20 74 65 73 74 6e 61 6d 65 2f 69 74 65 6d 2d 70   testname/item-p
5f80: 61 74 68 0a 09 09 09 20 28 74 65 73 74 73 3a 74  ath.... (tests:t
5f90: 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65  estqueue-set-ite
5fa0: 6d 73 21 20 20 20 20 20 6e 65 77 2d 74 65 73 74  ms!     new-test
5fb0: 2d 72 65 63 6f 72 64 20 23 66 29 0a 09 09 09 20  -record #f).... 
5fc0: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65  (tests:testqueue
5fd0: 2d 73 65 74 2d 69 74 65 6d 64 61 74 21 20 20 20  -set-itemdat!   
5fe0: 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20  new-test-record 
5ff0: 6d 79 2d 69 74 65 6d 64 61 74 29 0a 09 09 09 20  my-itemdat).... 
6000: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65  (tests:testqueue
6010: 2d 73 65 74 2d 69 74 65 6d 5f 70 61 74 68 21 20  -set-item_path! 
6020: 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20  new-test-record 
6030: 6d 79 2d 69 74 65 6d 2d 70 61 74 68 29 0a 09 09  my-item-path)...
6040: 09 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65  . (hash-table-se
6050: 74 21 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20  t! test-records 
6060: 6e 65 77 74 65 73 74 6e 61 6d 65 20 6e 65 77 2d  newtestname new-
6070: 74 65 73 74 2d 72 65 63 6f 72 64 29 0a 09 09 09  test-record)....
6080: 20 28 73 65 74 21 20 74 61 6c 20 28 63 6f 6e 73   (set! tal (cons
6090: 20 6e 65 77 74 65 73 74 6e 61 6d 65 20 74 61 6c   newtestname tal
60a0: 29 29 29 29 29 29 20 3b 3b 20 73 69 6e 63 65 20  )))))) ;; since 
60b0: 74 68 65 73 65 20 61 72 65 20 69 74 65 6d 69 7a  these are itemiz
60c0: 65 64 20 63 72 65 61 74 65 20 6e 65 77 20 74 65  ed create new te
60d0: 73 74 20 6e 61 6d 65 73 20 74 65 73 74 6e 61 6d  st names testnam
60e0: 65 2f 69 74 65 6d 70 61 74 68 0a 09 20 20 20 20  e/itempath..    
60f0: 20 20 20 69 74 65 6d 73 29 0a 09 20 20 20 20 20     items)..     
6100: 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f   (if (not (null?
6110: 20 74 61 6c 29 29 0a 09 09 20 20 28 62 65 67 69   tal))...  (begi
6120: 6e 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70  n...    (debug:p
6130: 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 45 6e 64  rint-info 4 "End
6140: 20 6f 66 20 69 74 65 6d 73 20 6c 69 73 74 2c 20   of items list, 
6150: 6c 6f 6f 70 69 6e 67 20 77 69 74 68 20 6e 65 78  looping with nex
6160: 74 20 61 66 74 65 72 20 73 68 6f 72 74 20 64 65  t after short de
6170: 6c 61 79 22 29 0a 20 20 20 20 20 20 20 20 20 20  lay").          
6180: 20 20 20 20 20 20 20 20 20 20 3b 3b 20 28 74 68            ;; (th
6190: 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 30  read-sleep! (+ 0
61a0: 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74  .01 *global-delt
61b0: 61 2a 29 29 0a 09 09 20 20 20 20 28 6c 6f 6f 70  a*))...    (loop
61c0: 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74   (car tal)(cdr t
61d0: 61 6c 29 20 72 65 72 75 6e 73 29 29 29 29 0a 0a  al) reruns))))..
61e0: 09 20 20 20 20 20 3b 3b 20 69 66 20 69 74 65 6d  .     ;; if item
61f0: 73 20 69 73 20 61 20 70 72 6f 63 20 74 68 65 6e  s is a proc then
6200: 20 6e 65 65 64 20 74 6f 20 72 75 6e 20 69 74 65   need to run ite
6210: 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f  ms:get-items-fro
6220: 6d 2d 63 6f 6e 66 69 67 2c 20 67 65 74 20 74 68  m-config, get th
6230: 65 20 6c 69 73 74 20 61 6e 64 20 6c 6f 6f 70 20  e list and loop 
6240: 0a 09 20 20 20 20 20 3b 3b 20 20 20 20 2d 20 62  ..     ;;    - b
6250: 75 74 20 6f 6e 6c 79 20 64 6f 20 74 68 61 74 20  ut only do that 
6260: 69 66 20 72 65 73 6f 75 72 63 65 73 20 65 78 69  if resources exi
6270: 73 74 20 74 6f 20 6b 69 63 6b 20 6f 66 66 20 74  st to kick off t
6280: 68 65 20 6a 6f 62 0a 09 20 20 20 20 20 28 28 6f  he job..     ((o
6290: 72 20 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74  r (procedure? it
62a0: 65 6d 73 29 28 65 71 3f 20 69 74 65 6d 73 20 27  ems)(eq? items '
62b0: 68 61 76 65 2d 70 72 6f 63 65 64 75 72 65 29 29  have-procedure))
62c0: 0a 09 20 20 20 20 20 20 28 6c 65 74 20 28 28 63  ..      (let ((c
62d0: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 20 20 20 20 28  an-run-more    (
62e0: 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72  runs:can-run-mor
62f0: 65 2d 74 65 73 74 73 20 74 65 73 74 2d 72 65 63  e-tests test-rec
6300: 6f 72 64 29 29 29 0a 09 09 28 69 66 20 28 61 6e  ord)))...(if (an
6310: 64 20 28 6c 69 73 74 3f 20 63 61 6e 2d 72 75 6e  d (list? can-run
6320: 2d 6d 6f 72 65 29 0a 09 09 09 20 28 63 61 72 20  -more).... (car 
6330: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 29 29 0a 09  can-run-more))..
6340: 09 20 20 20 20 28 6c 65 74 2a 20 28 28 70 72 65  .    (let* ((pre
6350: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 28 6f 70  reqs-not-met (op
6360: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a  en-run-close db:
6370: 67 65 74 2d 70 72 65 72 65 71 73 2d 6e 6f 74 2d  get-prereqs-not-
6380: 6d 65 74 20 23 66 20 72 75 6e 2d 69 64 20 77 61  met #f run-id wa
6390: 69 74 6f 6e 73 20 69 74 65 6d 2d 70 61 74 68 20  itons item-path 
63a0: 6d 6f 64 65 3a 20 74 65 73 74 6d 6f 64 65 29 29  mode: testmode))
63b0: 0a 09 09 09 20 20 20 28 66 61 69 6c 73 20 20 20  ....   (fails   
63c0: 20 20 20 20 20 20 20 20 28 72 75 6e 73 3a 63 61          (runs:ca
63d0: 6c 63 2d 66 61 69 6c 73 20 70 72 65 72 65 71 73  lc-fails prereqs
63e0: 2d 6e 6f 74 2d 6d 65 74 29 29 0a 09 09 09 20 20  -not-met))....  
63f0: 20 28 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 20   (non-completed 
6400: 20 20 28 72 75 6e 73 3a 63 61 6c 63 2d 6e 6f 74    (runs:calc-not
6410: 2d 63 6f 6d 70 6c 65 74 65 64 20 70 72 65 72 65  -completed prere
6420: 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a 09 09  qs-not-met)))...
6430: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
6440: 6e 74 2d 69 6e 66 6f 20 38 20 22 63 61 6e 2d 72  nt-info 8 "can-r
6450: 75 6e 2d 6d 6f 72 65 3a 20 22 20 63 61 6e 2d 72  un-more: " can-r
6460: 75 6e 2d 6d 6f 72 65 0a 09 09 09 09 20 20 20 22  un-more.....   "
6470: 5c 6e 20 74 65 73 74 6e 61 6d 65 3a 20 20 20 20  \n testname:    
6480: 20 20 20 20 22 20 68 65 64 0a 09 09 09 09 20 20      " hed.....  
6490: 20 22 5c 6e 20 70 72 65 72 65 71 73 2d 6e 6f 74   "\n prereqs-not
64a0: 2d 6d 65 74 3a 20 22 20 28 72 75 6e 73 3a 70 72  -met: " (runs:pr
64b0: 65 74 74 79 2d 73 74 72 69 6e 67 20 70 72 65 72  etty-string prer
64c0: 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09 09  eqs-not-met)....
64d0: 09 20 20 20 22 5c 6e 20 6e 6f 6e 2d 63 6f 6d 70  .   "\n non-comp
64e0: 6c 65 74 65 64 3a 20 20 20 22 20 28 72 75 6e 73  leted:   " (runs
64f0: 3a 70 72 65 74 74 79 2d 73 74 72 69 6e 67 20 6e  :pretty-string n
6500: 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 20 0a 09  on-completed) ..
6510: 09 09 09 20 20 20 22 5c 6e 20 66 61 69 6c 73 3a  ...   "\n fails:
6520: 20 20 20 20 20 20 20 20 20 20 20 22 20 28 72 75             " (ru
6530: 6e 73 3a 70 72 65 74 74 79 2d 73 74 72 69 6e 67  ns:pretty-string
6540: 20 66 61 69 6c 73 29 0a 09 09 09 09 20 20 20 22   fails).....   "
6550: 5c 6e 20 74 65 73 74 6d 6f 64 65 3a 20 20 20 20  \n testmode:    
6560: 20 20 20 20 22 20 74 65 73 74 6d 6f 64 65 0a 09      " testmode..
6570: 09 09 09 20 20 20 22 5c 6e 20 6e 75 6d 2d 72 65  ...   "\n num-re
6580: 74 72 69 65 73 3a 20 20 20 20 20 22 20 6e 75 6d  tries:     " num
6590: 2d 72 65 74 72 69 65 73 0a 09 09 09 09 20 20 20  -retries.....   
65a0: 22 5c 6e 20 28 65 71 3f 20 74 65 73 74 6d 6f 64  "\n (eq? testmod
65b0: 65 20 27 74 6f 70 6c 65 76 65 6c 29 3a 20 22 20  e 'toplevel): " 
65c0: 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 74  (eq? testmode 't
65d0: 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09 20 20 20  oplevel).....   
65e0: 22 5c 6e 20 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63  "\n (null? non-c
65f0: 6f 6d 70 6c 65 74 65 64 29 3a 20 20 20 20 22 20  ompleted):    " 
6600: 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c  (null? non-compl
6610: 65 74 65 64 29 0a 09 09 09 09 20 20 20 22 5c 6e  eted).....   "\n
6620: 20 72 65 72 75 6e 73 3a 20 20 20 20 20 20 20 20   reruns:        
6630: 20 20 22 20 72 65 72 75 6e 73 0a 09 09 09 09 20    " reruns..... 
6640: 20 20 22 5c 6e 20 69 74 65 6d 73 3a 20 20 20 20    "\n items:    
6650: 20 20 20 20 20 20 20 22 20 69 74 65 6d 73 0a 09         " items..
6660: 09 09 09 20 20 20 22 5c 6e 20 63 61 6e 2d 72 75  ...   "\n can-ru
6670: 6e 2d 6d 6f 72 65 3a 20 20 20 20 22 20 63 61 6e  n-more:    " can
6680: 2d 72 75 6e 2d 6d 6f 72 65 29 0a 09 09 20 20 20  -run-more)...   
6690: 20 20 20 3b 3b 20 28 74 68 72 65 61 64 2d 73 6c     ;; (thread-sl
66a0: 65 65 70 21 20 28 2b 20 30 2e 30 31 20 2a 67 6c  eep! (+ 0.01 *gl
66b0: 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09  obal-delta*))...
66c0: 20 20 20 20 20 20 28 63 6f 6e 64 20 3b 3b 20 49        (cond ;; I
66d0: 4e 4e 45 52 20 43 4f 4e 44 20 23 32 0a 09 09 20  NNER COND #2... 
66e0: 20 20 20 20 20 20 28 28 6f 72 20 28 6e 75 6c 6c        ((or (null
66f0: 3f 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65  ? prereqs-not-me
6700: 74 29 20 3b 3b 20 61 6c 6c 20 70 72 65 72 65 71  t) ;; all prereq
6710: 73 20 6d 65 74 2c 20 66 69 72 65 20 6f 66 66 20  s met, fire off 
6720: 74 68 65 20 74 65 73 74 0a 09 09 09 20 20 20 20  the test....    
6730: 3b 3b 20 6f 72 2c 20 69 66 20 69 74 20 69 73 20  ;; or, if it is 
6740: 61 20 27 74 6f 70 6c 65 76 65 6c 20 74 65 73 74  a 'toplevel test
6750: 20 61 6e 64 20 61 6c 6c 20 70 72 65 72 65 71 73   and all prereqs
6760: 20 6e 6f 74 20 6d 65 74 20 61 72 65 20 43 4f 4d   not met are COM
6770: 50 4c 45 54 45 44 20 74 68 65 6e 20 6c 61 75 6e  PLETED then laun
6780: 63 68 0a 09 09 09 20 20 20 20 28 61 6e 64 20 28  ch....    (and (
6790: 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 74 6f  eq? testmode 'to
67a0: 70 6c 65 76 65 6c 29 0a 09 09 09 09 20 28 6e 75  plevel)..... (nu
67b0: 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65  ll? non-complete
67c0: 64 29 29 29 0a 09 09 09 28 6c 65 74 20 28 28 74  d)))....(let ((t
67d0: 65 73 74 2d 6e 61 6d 65 20 28 74 65 73 74 73 3a  est-name (tests:
67e0: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65  testqueue-get-te
67f0: 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f  stname test-reco
6800: 72 64 29 29 29 0a 09 09 09 20 20 28 73 65 74 65  rd)))....  (sete
6810: 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d 45  nv "MT_TEST_NAME
6820: 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b 20  " test-name) ;; 
6830: 0a 09 09 09 20 20 28 73 65 74 65 6e 76 20 22 4d  ....  (setenv "M
6840: 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20 72 75 6e  T_RUNNAME"   run
6850: 6e 61 6d 65 29 0a 09 09 09 20 20 28 73 65 74 2d  name)....  (set-
6860: 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72  megatest-env-var
6870: 73 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65  s run-id) ;; the
6880: 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64  se may be needed
6890: 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e   by the launchin
68a0: 67 20 70 72 6f 63 65 73 73 0a 09 09 09 20 20 28  g process....  (
68b0: 6c 65 74 20 28 28 69 74 65 6d 73 2d 6c 69 73 74  let ((items-list
68c0: 20 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d   (items:get-item
68d0: 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 74 63  s-from-config tc
68e0: 6f 6e 66 69 67 29 29 29 0a 09 09 09 20 20 20 20  onfig)))....    
68f0: 28 69 66 20 28 6c 69 73 74 3f 20 69 74 65 6d 73  (if (list? items
6900: 2d 6c 69 73 74 29 0a 09 09 09 09 28 62 65 67 69  -list).....(begi
6910: 6e 0a 09 09 09 09 20 20 28 74 65 73 74 73 3a 74  n.....  (tests:t
6920: 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65  estqueue-set-ite
6930: 6d 73 21 20 74 65 73 74 2d 72 65 63 6f 72 64 20  ms! test-record 
6940: 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09 09 09 09  items-list).....
6950: 20 20 3b 3b 20 28 74 68 72 65 61 64 2d 73 6c 65    ;; (thread-sle
6960: 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74  ep! *global-delt
6970: 61 2a 29 0a 09 09 09 09 20 20 28 6c 6f 6f 70 20  a*).....  (loop 
6980: 68 65 64 20 74 61 6c 20 72 65 72 75 6e 73 29 29  hed tal reruns))
6990: 0a 09 09 09 09 28 62 65 67 69 6e 0a 09 09 09 09  .....(begin.....
69a0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
69b0: 20 22 45 52 52 4f 52 3a 20 54 68 65 20 70 72 6f   "ERROR: The pro
69c0: 63 20 66 72 6f 6d 20 72 65 61 64 69 6e 67 20 74  c from reading t
69d0: 68 65 20 73 65 74 75 70 20 64 69 64 20 6e 6f 74  he setup did not
69e0: 20 79 69 65 6c 64 20 61 20 6c 69 73 74 20 2d 20   yield a list - 
69f0: 70 6c 65 61 73 65 20 72 65 70 6f 72 74 20 74 68  please report th
6a00: 69 73 22 29 0a 09 09 09 09 20 20 28 65 78 69 74  is").....  (exit
6a10: 20 31 29 29 29 29 29 29 0a 09 09 20 20 20 20 20   1))))))...     
6a20: 20 20 28 28 6e 75 6c 6c 3f 20 66 61 69 6c 73 29    ((null? fails)
6a30: 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74  ....(debug:print
6a40: 2d 69 6e 66 6f 20 34 20 22 66 61 69 6c 73 20 69  -info 4 "fails i
6a50: 73 20 6e 75 6c 6c 2c 20 6d 6f 76 69 6e 67 20 6f  s null, moving o
6a60: 6e 20 69 6e 20 74 68 65 20 71 75 65 75 65 20 62  n in the queue b
6a70: 75 74 20 6b 65 65 70 69 6e 67 20 22 20 68 65 64  ut keeping " hed
6a80: 20 22 20 66 6f 72 20 6e 6f 77 22 29 0a 09 09 09   " for now")....
6a90: 3b 3b 20 6f 6e 6c 79 20 69 6e 63 72 65 6d 65 6e  ;; only incremen
6aa0: 74 20 6e 75 6d 2d 72 65 74 72 69 65 73 20 77 68  t num-retries wh
6ab0: 65 6e 20 74 68 65 72 65 20 61 72 65 20 6e 6f 20  en there are no 
6ac0: 74 65 73 74 73 20 72 75 6e 69 6e 67 0a 09 09 09  tests runing....
6ad0: 28 69 66 20 28 65 71 3f 20 30 20 28 6c 69 73 74  (if (eq? 0 (list
6ae0: 2d 72 65 66 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72  -ref can-run-mor
6af0: 65 20 31 29 29 0a 09 09 09 20 20 20 20 28 62 65  e 1))....    (be
6b00: 67 69 6e 0a 09 09 09 20 20 20 20 20 20 28 69 66  gin....      (if
6b10: 20 28 3e 20 6e 75 6d 2d 72 65 74 72 69 65 73 20   (> num-retries 
6b20: 31 30 30 29 20 3b 3b 20 66 69 72 73 74 20 31 30  100) ;; first 10
6b30: 30 20 72 65 74 72 69 65 73 20 61 72 65 20 6c 6f  0 retries are lo
6b40: 77 20 74 69 6d 65 20 63 6f 73 74 0a 09 09 09 09  w time cost.....
6b50: 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21    (thread-sleep!
6b60: 20 28 2b 20 32 20 2a 67 6c 6f 62 61 6c 2d 64 65   (+ 2 *global-de
6b70: 6c 74 61 2a 29 29 0a 09 09 09 09 20 20 28 74 68  lta*)).....  (th
6b80: 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 30  read-sleep! (+ 0
6b90: 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74  .01 *global-delt
6ba0: 61 2a 29 29 29 0a 09 09 09 20 20 20 20 20 20 28  a*)))....      (
6bb0: 73 65 74 21 20 6e 75 6d 2d 72 65 74 72 69 65 73  set! num-retries
6bc0: 20 28 2b 20 6e 75 6d 2d 72 65 74 72 69 65 73 20   (+ num-retries 
6bd0: 31 29 29 29 29 0a 09 09 09 28 69 66 20 28 3e 20  1))))....(if (> 
6be0: 6e 75 6d 2d 72 65 74 72 69 65 73 20 20 6d 61 78  num-retries  max
6bf0: 2d 72 65 74 72 69 65 73 29 0a 09 09 09 20 20 20  -retries)....   
6c00: 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f   (if (not (null?
6c10: 20 74 61 6c 29 29 0a 09 09 09 09 28 6c 6f 6f 70   tal)).....(loop
6c20: 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74   (car tal)(cdr t
6c30: 61 6c 29 20 72 65 72 75 6e 73 29 29 0a 09 09 09  al) reruns))....
6c40: 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e      (loop (car n
6c50: 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61  ewtal)(cdr newta
6c60: 6c 29 20 72 65 72 75 6e 73 29 29 29 20 3b 3b 20  l) reruns))) ;; 
6c70: 61 6e 20 69 73 73 75 65 20 77 69 74 68 20 70 72  an issue with pr
6c80: 65 72 65 71 73 20 6e 6f 74 20 79 65 74 20 6d 65  ereqs not yet me
6c90: 74 3f 0a 09 09 20 20 20 20 20 20 20 28 28 61 6e  t?...       ((an
6ca0: 64 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 66 61  d (not (null? fa
6cb0: 69 6c 73 29 29 28 65 71 3f 20 74 65 73 74 6d 6f  ils))(eq? testmo
6cc0: 64 65 20 27 6e 6f 72 6d 61 6c 29 29 0a 09 09 09  de 'normal))....
6cd0: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
6ce0: 6f 20 31 20 22 74 65 73 74 20 22 20 20 68 65 64  o 1 "test "  hed
6cf0: 20 22 20 28 6d 6f 64 65 3d 22 20 74 65 73 74 6d   " (mode=" testm
6d00: 6f 64 65 20 22 29 20 68 61 73 20 66 61 69 6c 65  ode ") has faile
6d10: 64 20 70 72 65 72 65 71 75 69 73 69 74 65 28 73  d prerequisite(s
6d20: 29 3b 20 22 0a 09 09 09 09 20 20 20 20 20 28 73  ); ".....     (s
6d30: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73  tring-interspers
6d40: 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28  e (map (lambda (
6d50: 74 29 28 63 6f 6e 63 20 28 64 62 3a 74 65 73 74  t)(conc (db:test
6d60: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 29  -get-testname t)
6d70: 20 22 3a 22 20 28 64 62 3a 74 65 73 74 2d 67 65   ":" (db:test-ge
6d80: 74 2d 73 74 61 74 65 20 74 29 22 2f 22 28 64 62  t-state t)"/"(db
6d90: 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73  :test-get-status
6da0: 20 74 29 29 29 20 66 61 69 6c 73 29 20 22 2c 20   t))) fails) ", 
6db0: 22 29 0a 09 09 09 09 20 20 20 20 20 22 2c 20 72  ").....     ", r
6dc0: 65 6d 6f 76 69 6e 67 20 69 74 20 66 72 6f 6d 20  emoving it from 
6dd0: 74 6f 2d 64 6f 20 6c 69 73 74 22 29 0a 09 09 09  to-do list")....
6de0: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20  (if (not (null? 
6df0: 74 61 6c 29 29 0a 09 09 09 20 20 20 20 28 62 65  tal))....    (be
6e00: 67 69 6e 0a 20 20 20 20 20 20 20 20 20 20 20 20  gin.            
6e10: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
6e20: 20 20 3b 3b 20 28 74 68 72 65 61 64 2d 73 6c 65    ;; (thread-sle
6e30: 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74  ep! *global-delt
6e40: 61 2a 29 0a 09 09 09 20 20 20 20 20 20 28 6c 6f  a*)....      (lo
6e50: 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63 64 72  op (car tal)(cdr
6e60: 20 74 61 6c 29 28 63 6f 6e 73 20 68 65 64 20 72   tal)(cons hed r
6e70: 65 72 75 6e 73 29 29 29 29 29 0a 09 09 20 20 20  eruns)))))...   
6e80: 20 20 20 20 28 65 6c 73 65 0a 09 09 09 28 64 65      (else....(de
6e90: 62 75 67 3a 70 72 69 6e 74 20 38 20 22 45 52 52  bug:print 8 "ERR
6ea0: 4f 52 3a 20 4e 6f 20 68 61 6e 64 6c 65 72 20 66  OR: No handler f
6eb0: 6f 72 20 74 68 69 73 20 63 6f 6e 64 69 74 69 6f  or this conditio
6ec0: 6e 2e 22 29 0a 09 09 09 28 74 68 72 65 61 64 2d  n.")....(thread-
6ed0: 73 6c 65 65 70 21 20 28 2b 20 31 20 2a 67 6c 6f  sleep! (+ 1 *glo
6ee0: 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09 09  bal-delta*))....
6ef0: 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61  (loop (car newta
6f00: 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20 72  l)(cdr newtal) r
6f10: 65 72 75 6e 73 29 29 29 29 20 3b 3b 20 45 4e 44  eruns)))) ;; END
6f20: 20 4f 46 20 49 46 20 43 41 4e 20 52 55 4e 20 4d   OF IF CAN RUN M
6f30: 4f 52 45 0a 0a 09 09 20 20 20 20 3b 3b 20 69 66  ORE....    ;; if
6f40: 20 63 61 6e 27 74 20 72 75 6e 20 6d 6f 72 65 20   can't run more 
6f50: 6a 75 73 74 20 6c 6f 6f 70 20 77 69 74 68 20 6e  just loop with n
6f60: 65 78 74 20 70 6f 73 73 69 62 6c 65 20 74 65 73  ext possible tes
6f70: 74 0a 09 09 20 20 20 20 28 62 65 67 69 6e 0a 09  t...    (begin..
6f80: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72  .      (debug:pr
6f90: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 70 72 6f 63  int-info 4 "proc
6fa0: 65 73 73 69 6e 67 20 74 68 65 20 63 61 73 65 20  essing the case 
6fb0: 77 69 74 68 20 61 20 6c 61 6d 62 64 61 20 66 6f  with a lambda fo
6fc0: 72 20 69 74 65 6d 73 20 6f 72 20 27 68 61 76 65  r items or 'have
6fd0: 2d 70 72 6f 63 65 64 75 72 65 2e 20 4d 6f 76 69  -procedure. Movi
6fe0: 6e 67 20 74 68 72 6f 75 67 68 20 74 68 65 20 71  ng through the q
6ff0: 75 65 75 65 20 77 69 74 68 6f 75 74 20 64 72 6f  ueue without dro
7000: 70 70 69 6e 67 20 22 20 68 65 64 29 0a 09 09 20  pping " hed)... 
7010: 20 20 20 20 20 3b 3b 20 28 74 68 72 65 61 64 2d       ;; (thread-
7020: 73 6c 65 65 70 21 20 28 2b 20 32 20 2a 67 6c 6f  sleep! (+ 2 *glo
7030: 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09 20  bal-delta*))... 
7040: 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20       (loop (car 
7050: 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74  newtal)(cdr newt
7060: 61 6c 29 20 72 65 72 75 6e 73 29 29 29 29 29 20  al) reruns))))) 
7070: 3b 3b 20 45 4e 44 20 4f 46 20 28 6f 72 20 28 70  ;; END OF (or (p
7080: 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73 29  rocedure? items)
7090: 28 65 71 3f 20 69 74 65 6d 73 20 27 68 61 76 65  (eq? items 'have
70a0: 2d 70 72 6f 63 65 64 75 72 65 29 29 0a 09 20 20  -procedure))..  
70b0: 20 20 20 0a 09 20 20 20 20 20 3b 3b 20 74 68 69     ..     ;; thi
70c0: 73 20 63 61 73 65 20 73 68 6f 75 6c 64 20 6e 6f  s case should no
70d0: 74 20 68 61 70 70 65 6e 2c 20 61 64 64 65 64 20  t happen, added 
70e0: 74 6f 20 68 65 6c 70 20 63 61 74 63 68 20 61 6e  to help catch an
70f0: 79 20 62 75 67 73 0a 09 20 20 20 20 20 28 28 61  y bugs..     ((a
7100: 6e 64 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29  nd (list? items)
7110: 20 69 74 65 6d 64 61 74 29 0a 09 20 20 20 20 20   itemdat)..     
7120: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
7130: 22 45 52 52 4f 52 3a 20 53 68 6f 75 6c 64 20 6e  "ERROR: Should n
7140: 6f 74 20 68 61 76 65 20 61 20 6c 69 73 74 20 6f  ot have a list o
7150: 66 20 69 74 65 6d 73 20 69 6e 20 61 20 74 65 73  f items in a tes
7160: 74 20 61 6e 64 20 74 68 65 20 69 74 65 6d 73 70  t and the itemsp
7170: 61 74 68 20 73 65 74 20 2d 20 70 6c 65 61 73 65  ath set - please
7180: 20 72 65 70 6f 72 74 20 74 68 69 73 22 29 0a 09   report this")..
7190: 20 20 20 20 20 20 28 65 78 69 74 20 31 29 29 0a        (exit 1)).
71a0: 09 20 20 20 20 20 28 28 6e 6f 74 20 28 6e 75 6c  .     ((not (nul
71b0: 6c 3f 20 72 65 72 75 6e 73 29 29 0a 09 20 20 20  l? reruns))..   
71c0: 20 20 20 28 6c 65 74 2a 20 28 28 6e 65 77 6c 73     (let* ((newls
71d0: 74 20 28 74 65 73 74 73 3a 66 69 6c 74 65 72 2d  t (tests:filter-
71e0: 6e 6f 6e 2d 72 75 6e 6e 61 62 6c 65 20 72 75 6e  non-runnable run
71f0: 2d 69 64 20 74 61 6c 20 74 65 73 74 2d 72 65 63  -id tal test-rec
7200: 6f 72 64 73 29 29 20 3b 3b 20 69 2e 65 2e 20 6e  ords)) ;; i.e. n
7210: 6f 74 20 46 41 49 4c 2c 20 57 41 49 56 45 44 2c  ot FAIL, WAIVED,
7220: 20 49 4e 43 4f 4d 50 4c 45 54 45 2c 20 50 41 53   INCOMPLETE, PAS
7230: 53 2c 20 4b 49 4c 4c 45 44 2c 0a 09 09 20 20 20  S, KILLED,...   
7240: 20 20 28 6a 75 6e 6b 65 64 20 28 6c 73 65 74 2d    (junked (lset-
7250: 64 69 66 66 65 72 65 6e 63 65 20 65 71 75 61 6c  difference equal
7260: 3f 20 74 61 6c 20 6e 65 77 6c 73 74 29 29 29 0a  ? tal newlst))).
7270: 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69  ..(debug:print-i
7280: 6e 66 6f 20 34 20 22 66 75 6c 6c 20 64 72 6f 70  nfo 4 "full drop
7290: 20 74 68 72 6f 75 67 68 2c 20 69 66 20 72 65 72   through, if rer
72a0: 75 6e 73 20 69 73 20 6c 65 73 73 20 74 68 61 6e  uns is less than
72b0: 20 31 30 30 20 77 65 20 77 69 6c 6c 20 66 6f 72   100 we will for
72c0: 63 65 20 72 65 74 72 79 20 74 68 65 6d 2c 20 72  ce retry them, r
72d0: 65 72 75 6e 73 3d 22 20 72 65 72 75 6e 73 20 22  eruns=" reruns "
72e0: 2c 20 74 61 6c 3d 22 20 74 61 6c 29 0a 09 09 28  , tal=" tal)...(
72f0: 69 66 20 28 3c 20 6e 75 6d 2d 72 65 74 72 69 65  if (< num-retrie
7300: 73 20 6d 61 78 2d 72 65 74 72 69 65 73 29 0a 09  s max-retries)..
7310: 09 20 20 20 20 28 73 65 74 21 20 6e 65 77 6c 73  .    (set! newls
7320: 74 20 28 61 70 70 65 6e 64 20 72 65 72 75 6e 73  t (append reruns
7330: 20 6e 65 77 6c 73 74 29 29 29 0a 09 09 28 73 65   newlst)))...(se
7340: 74 21 20 6e 75 6d 2d 72 65 74 72 69 65 73 20 28  t! num-retries (
7350: 2b 20 6e 75 6d 2d 72 65 74 72 69 65 73 20 31 29  + num-retries 1)
7360: 29 0a 09 09 3b 3b 20 28 74 68 72 65 61 64 2d 73  )...;; (thread-s
7370: 6c 65 65 70 21 20 28 2b 20 31 20 2a 67 6c 6f 62  leep! (+ 1 *glob
7380: 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09 28 69  al-delta*))...(i
7390: 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 6e 65  f (not (null? ne
73a0: 77 6c 73 74 29 29 0a 09 09 20 20 20 20 3b 3b 20  wlst))...    ;; 
73b0: 73 69 6e 63 65 20 72 65 72 75 6e 73 20 68 61 76  since reruns hav
73c0: 65 20 62 65 65 6e 20 74 61 63 6b 65 64 20 6f 6e  e been tacked on
73d0: 20 74 6f 20 6e 65 77 6c 73 74 20 63 72 65 61 74   to newlst creat
73e0: 65 20 6e 65 77 20 72 65 72 75 6e 73 20 66 72 6f  e new reruns fro
73f0: 6d 20 6a 75 6e 6b 65 64 0a 09 09 20 20 20 20 28  m junked...    (
7400: 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 6c 73 74  loop (car newlst
7410: 29 28 63 64 72 20 6e 65 77 6c 73 74 29 28 64 65  )(cdr newlst)(de
7420: 6c 65 74 65 2d 64 75 70 6c 69 63 61 74 65 73 20  lete-duplicates 
7430: 6a 75 6e 6b 65 64 29 29 29 29 29 0a 09 20 20 20  junked)))))..   
7440: 20 20 28 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74    ((not (null? t
7450: 61 6c 29 29 0a 09 20 20 20 20 20 20 28 64 65 62  al))..      (deb
7460: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20  ug:print-info 4 
7470: 22 49 27 6d 20 70 72 65 74 74 79 20 73 75 72 65  "I'm pretty sure
7480: 20 49 20 73 68 6f 75 6c 64 6e 27 74 20 67 65 74   I shouldn't get
7490: 20 68 65 72 65 2e 22 29 29 0a 09 20 20 20 20 20   here."))..     
74a0: 28 65 6c 73 65 0a 09 20 20 20 20 20 20 28 64 65  (else..      (de
74b0: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34  bug:print-info 4
74c0: 20 22 45 78 69 74 69 6e 67 20 6c 6f 6f 70 20 77   "Exiting loop w
74d0: 69 74 68 2e 2e 2e 5c 6e 20 20 68 65 64 3d 22 20  ith...\n  hed=" 
74e0: 68 65 64 20 22 5c 6e 20 20 74 61 6c 3d 22 20 74  hed "\n  tal=" t
74f0: 61 6c 20 22 5c 6e 20 20 72 65 72 75 6e 73 3d 22  al "\n  reruns="
7500: 20 72 65 72 75 6e 73 29 29 0a 09 20 20 20 20 20   reruns))..     
7510: 29 29 29 29 20 3b 3b 20 4c 45 54 2a 20 28 28 74  )))) ;; LET* ((t
7520: 65 73 74 2d 72 65 63 6f 72 64 0a 0a 20 20 20 20  est-record..    
7530: 3b 3b 20 77 65 20 67 65 74 20 68 65 72 65 20 6f  ;; we get here o
7540: 6e 20 22 64 72 6f 70 20 74 68 72 6f 75 67 68 22  n "drop through"
7550: 20 2d 20 6c 6f 6f 70 20 66 6f 72 20 6e 65 78 74   - loop for next
7560: 20 74 65 73 74 20 69 6e 20 71 75 65 75 65 0a 20   test in queue. 
7570: 20 20 20 3b 3b 20 46 49 58 4d 45 21 21 21 21 20     ;; FIXME!!!! 
7580: 54 48 49 53 20 53 48 4f 55 4c 44 20 4e 4f 54 20  THIS SHOULD NOT 
7590: 52 45 51 55 49 52 45 20 41 4e 20 45 58 49 54 21  REQUIRE AN EXIT!
75a0: 21 21 21 21 21 21 0a 20 20 20 20 0a 20 20 20 20  !!!!!!.    .    
75b0: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
75c0: 6f 20 31 20 22 41 6c 6c 20 74 65 73 74 73 20 6c  o 1 "All tests l
75d0: 61 75 6e 63 68 65 64 22 29 0a 20 20 20 20 28 74  aunched").    (t
75e0: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 30 2e 35  hread-sleep! 0.5
75f0: 29 0a 20 20 20 20 3b 3b 20 46 49 58 4d 45 21 20  ).    ;; FIXME! 
7600: 54 68 69 73 20 68 61 72 73 68 20 65 78 69 74 20  This harsh exit 
7610: 73 68 6f 75 6c 64 20 6e 6f 74 20 62 65 20 6e 65  should not be ne
7620: 63 65 73 73 61 72 79 2e 2e 2e 2e 0a 20 20 20 20  cessary.....    
7630: 3b 3b 20 28 69 66 20 28 6e 6f 74 20 2a 72 75 6e  ;; (if (not *run
7640: 72 65 6d 6f 74 65 2a 29 28 65 78 69 74 29 29 20  remote*)(exit)) 
7650: 3b 3b 20 0a 20 20 20 20 23 66 29 29 20 3b 3b 20  ;; .    #f)) ;; 
7660: 72 65 74 75 72 6e 20 61 20 23 66 20 61 73 20 61  return a #f as a
7670: 20 68 69 6e 74 20 74 68 61 74 20 77 65 20 61 72   hint that we ar
7680: 65 20 64 6f 6e 65 0a 20 20 3b 3b 20 48 65 72 65  e done.  ;; Here
7690: 20 77 65 20 6e 65 65 64 20 74 6f 20 63 68 65 63   we need to chec
76a0: 6b 20 74 68 61 74 20 61 6c 6c 20 74 68 65 20 74  k that all the t
76b0: 65 73 74 73 20 72 65 6d 61 69 6e 69 6e 67 20 74  ests remaining t
76c0: 6f 20 62 65 20 72 75 6e 20 61 72 65 20 65 6c 69  o be run are eli
76d0: 67 69 62 6c 65 20 74 6f 20 72 75 6e 0a 20 20 3b  gible to run.  ;
76e0: 3b 20 61 6e 64 20 61 72 65 20 6e 6f 74 20 62 6c  ; and are not bl
76f0: 6f 63 6b 65 64 20 62 79 20 66 61 69 6c 65 64 0a  ocked by failed.
7700: 20 20 0a 0a 3b 3b 20 70 61 72 65 6e 74 2d 74 65    ..;; parent-te
7710: 73 74 20 69 73 20 74 68 65 72 65 20 61 73 20 61  st is there as a
7720: 20 70 6c 61 63 65 68 6f 6c 64 65 72 20 66 6f 72   placeholder for
7730: 20 77 68 65 6e 20 70 61 72 65 6e 74 2d 74 65 73   when parent-tes
7740: 74 73 20 63 61 6e 20 62 65 20 72 75 6e 20 61 73  ts can be run as
7750: 20 61 20 73 65 74 75 70 20 73 74 65 70 0a 28 64   a setup step.(d
7760: 65 66 69 6e 65 20 28 72 75 6e 3a 74 65 73 74 20  efine (run:test 
7770: 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 6b  run-id runname k
7780: 65 79 76 61 6c 6c 73 74 20 74 65 73 74 2d 72 65  eyvallst test-re
7790: 63 6f 72 64 20 66 6c 61 67 73 20 70 61 72 65 6e  cord flags paren
77a0: 74 2d 74 65 73 74 29 0a 20 20 3b 3b 20 41 6c 6c  t-test).  ;; All
77b0: 20 74 68 65 73 65 20 76 61 72 73 20 6d 69 67 68   these vars migh
77c0: 74 20 62 65 20 72 65 66 65 72 65 6e 63 65 64 20  t be referenced 
77d0: 62 79 20 74 68 65 20 74 65 73 74 63 6f 6e 66 69  by the testconfi
77e0: 67 20 66 69 6c 65 20 72 65 61 64 65 72 0a 20 20  g file reader.  
77f0: 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 6e 61 6d  (let* ((test-nam
7800: 65 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74  e    (tests:test
7810: 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61  queue-get-testna
7820: 6d 65 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64  me   test-record
7830: 29 29 0a 09 20 28 74 65 73 74 2d 77 61 69 74 6f  )).. (test-waito
7840: 6e 73 20 28 74 65 73 74 73 3a 74 65 73 74 71 75  ns (tests:testqu
7850: 65 75 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20  eue-get-waitons 
7860: 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29     test-record))
7870: 0a 09 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 20  .. (test-conf   
7880: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75   (tests:testqueu
7890: 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67  e-get-testconfig
78a0: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09   test-record))..
78b0: 20 28 69 74 65 6d 64 61 74 20 20 20 20 20 20 28   (itemdat      (
78c0: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
78d0: 67 65 74 2d 69 74 65 6d 64 61 74 20 20 20 20 74  get-itemdat    t
78e0: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28  est-record)).. (
78f0: 74 65 73 74 2d 70 61 74 68 20 20 20 20 28 63 6f  test-path    (co
7900: 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74  nc *toppath* "/t
7910: 65 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d 65  ests/" test-name
7920: 29 29 20 3b 3b 20 63 6f 75 6c 64 20 75 73 65 20  )) ;; could use 
7930: 74 65 73 74 73 3a 67 65 74 2d 74 65 73 74 63 6f  tests:get-testco
7940: 6e 66 69 67 20 68 65 72 65 20 2e 2e 2e 0a 09 20  nfig here ..... 
7950: 28 66 6f 72 63 65 20 20 20 20 20 20 20 20 28 68  (force        (h
7960: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65  ash-table-ref/de
7970: 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 66 6f  fault flags "-fo
7980: 72 63 65 22 20 23 66 29 29 0a 09 20 28 72 65 72  rce" #f)).. (rer
7990: 75 6e 20 20 20 20 20 20 20 20 28 68 61 73 68 2d  un        (hash-
79a0: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c  table-ref/defaul
79b0: 74 20 66 6c 61 67 73 20 22 2d 72 65 72 75 6e 22  t flags "-rerun"
79c0: 20 23 66 29 29 0a 09 20 28 6b 65 65 70 67 6f 69   #f)).. (keepgoi
79d0: 6e 67 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c  ng    (hash-tabl
79e0: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c  e-ref/default fl
79f0: 61 67 73 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22  ags "-keepgoing"
7a00: 20 23 66 29 29 0a 09 20 28 69 74 65 6d 2d 70 61   #f)).. (item-pa
7a10: 74 68 20 20 20 20 20 22 22 29 0a 09 20 28 64 62  th     "").. (db
7a20: 20 20 20 20 20 20 20 20 20 20 20 23 66 29 29 0a             #f)).
7a30: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
7a40: 20 34 0a 09 09 20 22 74 65 73 74 2d 63 6f 6e 66   4... "test-conf
7a50: 69 67 3a 20 22 20 28 68 61 73 68 2d 74 61 62 6c  ig: " (hash-tabl
7a60: 65 2d 3e 61 6c 69 73 74 20 74 65 73 74 2d 63 6f  e->alist test-co
7a70: 6e 66 29 0a 09 09 20 22 5c 6e 20 20 20 69 74 65  nf)... "\n   ite
7a80: 6d 64 61 74 3a 20 22 20 69 74 65 6d 64 61 74 0a  mdat: " itemdat.
7a90: 09 09 20 29 0a 20 20 20 20 3b 3b 20 73 65 74 74  .. ).    ;; sett
7aa0: 69 6e 67 20 69 74 65 6d 64 61 74 20 74 6f 20 61  ing itemdat to a
7ab0: 20 6c 69 73 74 20 69 66 20 69 74 20 69 73 20 23   list if it is #
7ac0: 66 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 69  f.    (if (not i
7ad0: 74 65 6d 64 61 74 29 28 73 65 74 21 20 69 74 65  temdat)(set! ite
7ae0: 6d 64 61 74 20 27 28 29 29 29 0a 20 20 20 20 28  mdat '())).    (
7af0: 73 65 74 21 20 69 74 65 6d 2d 70 61 74 68 20 28  set! item-path (
7b00: 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20  item-list->path 
7b10: 69 74 65 6d 64 61 74 29 29 0a 20 20 20 20 28 64  itemdat)).    (d
7b20: 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 41 74  ebug:print 2 "At
7b30: 74 65 6d 70 74 69 6e 67 20 74 6f 20 6c 61 75 6e  tempting to laun
7b40: 63 68 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e  ch test " test-n
7b50: 61 6d 65 20 28 69 66 20 28 65 71 75 61 6c 3f 20  ame (if (equal? 
7b60: 69 74 65 6d 2d 70 61 74 68 20 22 2f 22 29 20 22  item-path "/") "
7b70: 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 20  /" item-path)). 
7b80: 20 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 54     (setenv "MT_T
7b90: 45 53 54 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e  EST_NAME" test-n
7ba0: 61 6d 65 29 20 3b 3b 20 0a 20 20 20 20 28 73 65  ame) ;; .    (se
7bb0: 74 65 6e 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45  tenv "MT_RUNNAME
7bc0: 22 20 20 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20  "   runname).   
7bd0: 20 28 73 65 74 2d 6d 65 67 61 74 65 73 74 2d 65   (set-megatest-e
7be0: 6e 76 2d 76 61 72 73 20 72 75 6e 2d 69 64 29 20  nv-vars run-id) 
7bf0: 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62 65 20  ;; these may be 
7c00: 6e 65 65 64 65 64 20 62 79 20 74 68 65 20 6c 61  needed by the la
7c10: 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 73 0a  unching process.
7c20: 20 20 20 20 28 63 68 61 6e 67 65 2d 64 69 72 65      (change-dire
7c30: 63 74 6f 72 79 20 2a 74 6f 70 70 61 74 68 2a 29  ctory *toppath*)
7c40: 0a 0a 20 20 20 20 3b 3b 20 48 65 72 65 20 69 73  ..    ;; Here is
7c50: 20 77 68 65 72 65 20 74 68 65 20 74 65 73 74 5f   where the test_
7c60: 6d 65 74 61 20 74 61 62 6c 65 20 69 73 20 62 65  meta table is be
7c70: 73 74 20 75 70 64 61 74 65 64 0a 20 20 20 20 3b  st updated.    ;
7c80: 3b 20 59 65 73 2c 20 61 6e 6f 74 68 65 72 20 75  ; Yes, another u
7c90: 73 65 20 6f 66 20 61 20 67 6c 6f 62 61 6c 20 66  se of a global f
7ca0: 6f 72 20 63 61 63 68 69 6e 67 2e 20 4e 65 65 64  or caching. Need
7cb0: 20 61 20 62 65 74 74 65 72 20 77 61 79 3f 0a 20   a better way?. 
7cc0: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 68 61 73     (if (not (has
7cd0: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61  h-table-ref/defa
7ce0: 75 6c 74 20 2a 74 65 73 74 2d 6d 65 74 61 2d 75  ult *test-meta-u
7cf0: 70 64 61 74 65 64 2a 20 74 65 73 74 2d 6e 61 6d  pdated* test-nam
7d00: 65 20 23 66 29 29 0a 20 20 20 20 20 20 20 20 28  e #f)).        (
7d10: 62 65 67 69 6e 0a 09 20 20 20 28 68 61 73 68 2d  begin..   (hash-
7d20: 74 61 62 6c 65 2d 73 65 74 21 20 2a 74 65 73 74  table-set! *test
7d30: 2d 6d 65 74 61 2d 75 70 64 61 74 65 64 2a 20 74  -meta-updated* t
7d40: 65 73 74 2d 6e 61 6d 65 20 23 74 29 0a 20 20 20  est-name #t).   
7d50: 20 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75          (open-ru
7d60: 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 3a 75 70 64  n-close runs:upd
7d70: 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62  ate-test_meta db
7d80: 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d   test-name test-
7d90: 63 6f 6e 66 29 29 29 0a 20 20 20 20 0a 20 20 20  conf))).    .   
7da0: 20 3b 3b 20 28 6c 61 6d 62 64 61 20 28 69 74 65   ;; (lambda (ite
7db0: 6d 64 61 74 29 20 3b 3b 3b 20 28 28 72 69 70 65  mdat) ;;; ((ripe
7dc0: 6e 65 73 73 20 22 6f 76 65 72 72 69 70 65 22 29  ness "overripe")
7dd0: 20 28 74 65 6d 70 65 72 61 74 75 72 65 20 22 63   (temperature "c
7de0: 6f 6f 6c 22 29 20 28 73 65 61 73 6f 6e 20 22 73  ool") (season "s
7df0: 75 6d 6d 65 72 22 29 29 0a 20 20 20 20 28 6c 65  ummer")).    (le
7e00: 74 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d 70 61  t* ((new-test-pa
7e10: 74 68 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72  th (string-inter
7e20: 73 70 65 72 73 65 20 28 63 6f 6e 73 20 74 65 73  sperse (cons tes
7e30: 74 2d 70 61 74 68 20 28 6d 61 70 20 63 61 64 72  t-path (map cadr
7e40: 20 69 74 65 6d 64 61 74 29 29 20 22 2f 22 29 29   itemdat)) "/"))
7e50: 0a 09 20 20 20 28 6e 65 77 2d 74 65 73 74 2d 6e  ..   (new-test-n
7e60: 61 6d 65 20 28 69 66 20 28 65 71 75 61 6c 3f 20  ame (if (equal? 
7e70: 69 74 65 6d 2d 70 61 74 68 20 22 22 29 20 74 65  item-path "") te
7e80: 73 74 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65  st-name (conc te
7e90: 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d  st-name "/" item
7ea0: 2d 70 61 74 68 29 29 29 20 3b 3b 20 6a 75 73 74  -path))) ;; just
7eb0: 20 6e 65 65 64 20 69 74 20 74 6f 20 62 65 20 75   need it to be u
7ec0: 6e 69 71 75 65 0a 09 20 20 20 28 74 65 73 74 2d  nique..   (test-
7ed0: 69 64 20 20 20 20 20 20 20 28 63 64 62 3a 72 65  id       (cdb:re
7ee0: 6d 6f 74 65 2d 72 75 6e 20 64 62 3a 67 65 74 2d  mote-run db:get-
7ef0: 74 65 73 74 2d 69 64 20 23 66 20 20 72 75 6e 2d  test-id #f  run-
7f00: 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65  id test-name ite
7f10: 6d 2d 70 61 74 68 29 29 0a 09 20 20 20 28 74 65  m-path))..   (te
7f20: 73 74 64 61 74 20 20 20 20 20 20 20 28 63 64 62  stdat       (cdb
7f30: 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 2d 62  :get-test-info-b
7f40: 79 2d 69 64 20 2a 72 75 6e 72 65 6d 6f 74 65 2a  y-id *runremote*
7f50: 20 74 65 73 74 2d 69 64 29 29 29 0a 20 20 20 20   test-id))).    
7f60: 20 20 28 69 66 20 28 6e 6f 74 20 74 65 73 74 64    (if (not testd
7f70: 61 74 29 0a 09 20 20 28 62 65 67 69 6e 0a 09 20  at)..  (begin.. 
7f80: 20 20 20 3b 3b 20 65 6e 73 75 72 65 20 74 68 61     ;; ensure tha
7f90: 74 20 74 68 65 20 70 61 74 68 20 65 78 69 73 74  t the path exist
7fa0: 73 20 62 65 66 6f 72 65 20 72 65 67 69 73 74 65  s before registe
7fb0: 72 69 6e 67 20 74 68 65 20 74 65 73 74 0a 09 20  ring the test.. 
7fc0: 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 43 61 6e 6e     ;; NOPE: Cann
7fd0: 6f 74 21 20 44 6f 6e 27 74 20 6b 6e 6f 77 20 79  ot! Don't know y
7fe0: 65 74 20 77 68 69 63 68 20 64 69 73 6b 20 61 72  et which disk ar
7ff0: 65 61 20 77 69 6c 6c 20 62 65 20 61 73 73 69 67  ea will be assig
8000: 6e 65 64 2e 2e 2e 2e 0a 09 20 20 20 20 3b 3b 20  ned......    ;; 
8010: 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 6d  (system (conc "m
8020: 6b 64 69 72 20 2d 70 20 22 20 6e 65 77 2d 74 65  kdir -p " new-te
8030: 73 74 2d 70 61 74 68 29 29 0a 09 20 20 20 20 3b  st-path))..    ;
8040: 3b 0a 09 20 20 20 20 3b 3b 20 28 6f 70 65 6e 2d  ;..    ;; (open-
8050: 72 75 6e 2d 63 6c 6f 73 65 20 74 65 73 74 73 3a  run-close tests:
8060: 72 65 67 69 73 74 65 72 2d 74 65 73 74 20 64 62  register-test db
8070: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d   run-id test-nam
8080: 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 20 20  e item-path)..  
8090: 20 20 3b 3b 0a 09 20 20 20 20 3b 3b 20 4e 42 2f    ;;..    ;; NB/
80a0: 2f 20 66 6f 72 20 74 68 65 20 61 62 6f 76 65 20  / for the above 
80b0: 6c 69 6e 65 2e 20 49 20 77 61 6e 74 20 74 68 65  line. I want the
80c0: 20 74 65 73 74 20 74 6f 20 62 65 20 72 65 67 69   test to be regi
80d0: 73 74 65 72 65 64 20 6c 6f 6e 67 20 62 65 66 6f  stered long befo
80e0: 72 65 20 74 68 69 73 20 72 6f 75 74 69 6e 65 20  re this routine 
80f0: 67 65 74 73 20 63 61 6c 6c 65 64 21 0a 09 20 20  gets called!..  
8100: 20 20 3b 3b 0a 09 20 20 20 20 28 73 65 74 21 20    ;;..    (set! 
8110: 74 65 73 74 2d 69 64 20 28 6f 70 65 6e 2d 72 75  test-id (open-ru
8120: 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74  n-close db:get-t
8130: 65 73 74 2d 69 64 20 64 62 20 72 75 6e 2d 69 64  est-id db run-id
8140: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d   test-name item-
8150: 70 61 74 68 29 29 0a 09 20 20 20 20 28 69 66 20  path))..    (if 
8160: 28 6e 6f 74 20 74 65 73 74 2d 69 64 29 0a 09 09  (not test-id)...
8170: 28 62 65 67 69 6e 0a 09 09 20 20 28 64 65 62 75  (begin...  (debu
8180: 67 3a 70 72 69 6e 74 20 32 20 22 57 41 52 4e 3a  g:print 2 "WARN:
8190: 20 54 65 73 74 20 6e 6f 74 20 70 72 65 2d 63 72   Test not pre-cr
81a0: 65 61 74 65 64 3f 20 74 65 73 74 2d 6e 61 6d 65  eated? test-name
81b0: 3d 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2c 20  =" test-name ", 
81c0: 69 74 65 6d 2d 70 61 74 68 3d 22 20 69 74 65 6d  item-path=" item
81d0: 2d 70 61 74 68 20 22 2c 20 72 75 6e 2d 69 64 3d  -path ", run-id=
81e0: 22 20 72 75 6e 2d 69 64 29 0a 09 09 20 20 28 63  " run-id)...  (c
81f0: 64 62 3a 74 65 73 74 73 2d 72 65 67 69 73 74 65  db:tests-registe
8200: 72 2d 74 65 73 74 20 2a 72 75 6e 72 65 6d 6f 74  r-test *runremot
8210: 65 2a 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e  e* run-id test-n
8220: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 09  ame item-path)..
8230: 09 20 20 28 73 65 74 21 20 74 65 73 74 2d 69 64  .  (set! test-id
8240: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
8250: 20 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 64 20   db:get-test-id 
8260: 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e  db run-id test-n
8270: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29 29  ame item-path)))
8280: 29 0a 09 20 20 20 20 28 64 65 62 75 67 3a 70 72  )..    (debug:pr
8290: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 74 65 73 74  int-info 4 "test
82a0: 2d 69 64 3d 22 20 74 65 73 74 2d 69 64 20 22 2c  -id=" test-id ",
82b0: 20 72 75 6e 2d 69 64 3d 22 20 72 75 6e 2d 69 64   run-id=" run-id
82c0: 20 22 2c 20 74 65 73 74 2d 6e 61 6d 65 3d 22 20   ", test-name=" 
82d0: 74 65 73 74 2d 6e 61 6d 65 20 22 2c 20 69 74 65  test-name ", ite
82e0: 6d 2d 70 61 74 68 3d 5c 22 22 20 69 74 65 6d 2d  m-path=\"" item-
82f0: 70 61 74 68 20 22 5c 22 22 29 0a 09 20 20 20 20  path "\"")..    
8300: 28 73 65 74 21 20 74 65 73 74 64 61 74 20 28 63  (set! testdat (c
8310: 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f  db:get-test-info
8320: 2d 62 79 2d 69 64 20 2a 72 75 6e 72 65 6d 6f 74  -by-id *runremot
8330: 65 2a 20 74 65 73 74 2d 69 64 29 29 29 29 0a 20  e* test-id)))). 
8340: 20 20 20 20 20 28 73 65 74 21 20 74 65 73 74 2d       (set! test-
8350: 69 64 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  id (db:test-get-
8360: 69 64 20 74 65 73 74 64 61 74 29 29 0a 20 20 20  id testdat)).   
8370: 20 20 20 28 63 68 61 6e 67 65 2d 64 69 72 65 63     (change-direc
8380: 74 6f 72 79 20 74 65 73 74 2d 70 61 74 68 29 0a  tory test-path).
8390: 20 20 20 20 20 20 28 63 61 73 65 20 28 69 66 20        (case (if 
83a0: 66 6f 72 63 65 20 3b 3b 20 28 61 72 67 73 3a 67  force ;; (args:g
83b0: 65 74 2d 61 72 67 20 22 2d 66 6f 72 63 65 22 29  et-arg "-force")
83c0: 0a 09 09 27 4e 4f 54 5f 53 54 41 52 54 45 44 0a  ...'NOT_STARTED.
83d0: 09 09 28 69 66 20 74 65 73 74 64 61 74 0a 09 09  ..(if testdat...
83e0: 20 20 20 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d      (string->sym
83f0: 62 6f 6c 20 28 74 65 73 74 3a 67 65 74 2d 73 74  bol (test:get-st
8400: 61 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 09  ate testdat))...
8410: 20 20 20 20 27 66 61 69 6c 65 64 2d 74 6f 2d 69      'failed-to-i
8420: 6e 73 65 72 74 29 29 0a 09 28 28 66 61 69 6c 65  nsert))..((faile
8430: 64 2d 74 6f 2d 69 6e 73 65 72 74 29 0a 09 20 28  d-to-insert).. (
8440: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45  debug:print 0 "E
8450: 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20  RROR: Failed to 
8460: 69 6e 73 65 72 74 20 74 68 65 20 72 65 63 6f 72  insert the recor
8470: 64 20 69 6e 74 6f 20 74 68 65 20 64 62 22 29 29  d into the db"))
8480: 0a 09 28 28 4e 4f 54 5f 53 54 41 52 54 45 44 20  ..((NOT_STARTED 
8490: 43 4f 4d 50 4c 45 54 45 44 20 44 45 4c 45 54 45  COMPLETED DELETE
84a0: 44 29 0a 09 20 28 6c 65 74 20 28 28 72 75 6e 66  D).. (let ((runf
84b0: 6c 61 67 20 23 66 29 29 0a 09 20 20 20 28 63 6f  lag #f))..   (co
84c0: 6e 64 0a 09 20 20 20 20 3b 3b 20 2d 66 6f 72 63  nd..    ;; -forc
84d0: 65 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72  e, run no matter
84e0: 20 77 68 61 74 0a 09 20 20 20 20 28 66 6f 72 63   what..    (forc
84f0: 65 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20  e (set! runflag 
8500: 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 4e 4f 54  #t))..    ;; NOT
8510: 5f 53 54 41 52 54 45 44 2c 20 72 75 6e 20 6e 6f  _STARTED, run no
8520: 20 6d 61 74 74 65 72 20 77 68 61 74 0a 09 20 20   matter what..  
8530: 20 20 28 28 6d 65 6d 62 65 72 20 28 74 65 73 74    ((member (test
8540: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64  :get-state testd
8550: 61 74 29 20 27 28 22 44 45 4c 45 54 45 44 22 20  at) '("DELETED" 
8560: 22 4e 4f 54 5f 53 54 41 52 54 45 44 22 29 29 28  "NOT_STARTED"))(
8570: 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29  set! runflag #t)
8580: 29 0a 09 20 20 20 20 3b 3b 20 6e 6f 74 20 2d 72  )..    ;; not -r
8590: 65 72 75 6e 20 61 6e 64 20 50 41 53 53 2c 20 57  erun and PASS, W
85a0: 41 52 4e 20 6f 72 20 43 48 45 43 4b 2c 20 64 6f  ARN or CHECK, do
85b0: 20 6e 6f 20 72 75 6e 0a 09 20 20 20 20 28 28 61   no run..    ((a
85c0: 6e 64 20 28 6f 72 20 28 6e 6f 74 20 72 65 72 75  nd (or (not reru
85d0: 6e 29 0a 09 09 20 20 20 20 20 20 6b 65 65 70 67  n)...      keepg
85e0: 6f 69 6e 67 29 0a 09 09 20 20 3b 3b 20 52 65 71  oing)...  ;; Req
85f0: 75 69 72 65 20 74 6f 20 66 6f 72 63 65 20 72 65  uire to force re
8600: 2d 72 75 6e 20 66 6f 72 20 43 4f 4d 50 4c 45 54  -run for COMPLET
8610: 45 44 20 6f 72 20 2a 61 6e 79 74 68 69 6e 67 2a  ED or *anything*
8620: 20 2b 20 50 41 53 53 2c 57 41 52 4e 20 6f 72 20   + PASS,WARN or 
8630: 43 48 45 43 4b 0a 09 09 20 20 28 6f 72 20 28 6d  CHECK...  (or (m
8640: 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d  ember (test:get-
8650: 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20  status testdat) 
8660: 27 28 22 50 41 53 53 22 20 22 57 41 52 4e 22 20  '("PASS" "WARN" 
8670: 22 43 48 45 43 4b 22 20 22 53 4b 49 50 22 29 29  "CHECK" "SKIP"))
8680: 0a 09 09 20 20 20 20 20 20 28 6d 65 6d 62 65 72  ...      (member
8690: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65   (test:get-state
86a0: 20 20 74 65 73 74 64 61 74 29 20 27 28 22 43 4f    testdat) '("CO
86b0: 4d 50 4c 45 54 45 44 22 29 29 29 29 20 0a 09 20  MPLETED")))) .. 
86c0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
86d0: 2d 69 6e 66 6f 20 32 20 22 72 75 6e 6e 69 6e 67  -info 2 "running
86e0: 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d   test " test-nam
86f0: 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 20  e "/" item-path 
8700: 22 20 73 75 70 70 72 65 73 73 65 64 20 61 73 20  " suppressed as 
8710: 69 74 20 69 73 20 22 20 28 74 65 73 74 3a 67 65  it is " (test:ge
8720: 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29  t-state testdat)
8730: 20 22 20 61 6e 64 20 22 20 28 74 65 73 74 3a 67   " and " (test:g
8740: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61  et-status testda
8750: 74 29 29 0a 09 20 20 20 20 20 28 73 65 74 21 20  t))..     (set! 
8760: 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 20  runflag #f))..  
8770: 20 20 3b 3b 20 2d 72 65 72 75 6e 20 61 6e 64 20    ;; -rerun and 
8780: 73 74 61 74 75 73 20 69 73 20 6f 6e 65 20 6f 66  status is one of
8790: 20 74 68 65 20 73 70 65 63 69 66 65 64 2c 20 72   the specifed, r
87a0: 75 6e 20 69 74 0a 09 20 20 20 20 28 28 61 6e 64  un it..    ((and
87b0: 20 72 65 72 75 6e 0a 09 09 20 20 28 6c 65 74 2a   rerun...  (let*
87c0: 20 28 28 72 65 72 75 6e 6c 73 74 20 20 20 28 73   ((rerunlst   (s
87d0: 74 72 69 6e 67 2d 73 70 6c 69 74 20 72 65 72 75  tring-split reru
87e0: 6e 20 22 2c 22 29 29 0a 09 09 09 20 28 6d 75 73  n ",")).... (mus
87f0: 74 2d 72 65 72 75 6e 20 28 6d 65 6d 62 65 72 20  t-rerun (member 
8800: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73  (test:get-status
8810: 20 74 65 73 74 64 61 74 29 20 72 65 72 75 6e 6c   testdat) rerunl
8820: 73 74 29 29 29 0a 09 09 20 20 20 20 28 64 65 62  st)))...    (deb
8830: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 33 20  ug:print-info 3 
8840: 22 2d 72 65 72 75 6e 20 6c 69 73 74 3a 20 22 20  "-rerun list: " 
8850: 72 65 72 75 6e 20 22 2c 20 74 65 73 74 2d 73 74  rerun ", test-st
8860: 61 74 75 73 3a 20 22 20 28 74 65 73 74 3a 67 65  atus: " (test:ge
8870: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74  t-status testdat
8880: 29 22 2c 20 6d 75 73 74 2d 72 65 72 75 6e 3a 20  )", must-rerun: 
8890: 22 20 6d 75 73 74 2d 72 65 72 75 6e 29 0a 09 09  " must-rerun)...
88a0: 20 20 20 20 6d 75 73 74 2d 72 65 72 75 6e 29 29      must-rerun))
88b0: 0a 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72  ..     (debug:pr
88c0: 69 6e 74 2d 69 6e 66 6f 20 32 20 22 52 65 72 75  int-info 2 "Reru
88d0: 6e 20 66 6f 72 63 65 64 20 66 6f 72 20 74 65 73  n forced for tes
88e0: 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f  t " test-name "/
88f0: 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 20 20  " item-path)..  
8900: 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67     (set! runflag
8910: 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 2d 6b   #t))..    ;; -k
8920: 65 65 70 67 6f 69 6e 67 2c 20 64 6f 20 6e 6f 74  eepgoing, do not
8930: 20 72 65 72 75 6e 20 46 41 49 4c 0a 09 20 20 20   rerun FAIL..   
8940: 20 28 28 61 6e 64 20 6b 65 65 70 67 6f 69 6e 67   ((and keepgoing
8950: 0a 09 09 20 20 28 6d 65 6d 62 65 72 20 28 74 65  ...  (member (te
8960: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65  st:get-status te
8970: 73 74 64 61 74 29 20 27 28 22 46 41 49 4c 22 29  stdat) '("FAIL")
8980: 29 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72  ))..     (set! r
8990: 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20  unflag #f))..   
89a0: 20 28 28 61 6e 64 20 28 6e 6f 74 20 72 65 72 75   ((and (not reru
89b0: 6e 29 0a 09 09 20 20 28 6d 65 6d 62 65 72 20 28  n)...  (member (
89c0: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20  test:get-status 
89d0: 74 65 73 74 64 61 74 29 20 27 28 22 46 41 49 4c  testdat) '("FAIL
89e0: 22 20 22 6e 2f 61 22 29 29 29 0a 09 20 20 20 20  " "n/a")))..    
89f0: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23   (set! runflag #
8a00: 74 29 29 0a 09 20 20 20 20 28 65 6c 73 65 20 28  t))..    (else (
8a10: 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29  set! runflag #f)
8a20: 29 29 0a 09 20 20 20 28 64 65 62 75 67 3a 70 72  ))..   (debug:pr
8a30: 69 6e 74 20 36 20 22 52 55 4e 4e 49 4e 47 20 3d  int 6 "RUNNING =
8a40: 3e 20 72 75 6e 66 6c 61 67 3a 20 22 20 72 75 6e  > runflag: " run
8a50: 66 6c 61 67 20 22 20 53 54 41 54 45 3a 20 22 20  flag " STATE: " 
8a60: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20  (test:get-state 
8a70: 74 65 73 74 64 61 74 29 20 22 20 53 54 41 54 55  testdat) " STATU
8a80: 53 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73  S: " (test:get-s
8a90: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 29 0a  tatus testdat)).
8aa0: 09 20 20 20 28 69 66 20 28 6e 6f 74 20 72 75 6e  .   (if (not run
8ab0: 66 6c 61 67 29 0a 09 20 20 20 20 20 20 20 28 69  flag)..       (i
8ac0: 66 20 28 6e 6f 74 20 70 61 72 65 6e 74 2d 74 65  f (not parent-te
8ad0: 73 74 29 0a 09 09 20 20 20 28 64 65 62 75 67 3a  st)...   (debug:
8ae0: 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 4e  print 1 "NOTE: N
8af0: 6f 74 20 73 74 61 72 74 69 6e 67 20 74 65 73 74  ot starting test
8b00: 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65   " new-test-name
8b10: 20 22 20 61 73 20 69 74 20 69 73 20 73 74 61 74   " as it is stat
8b20: 65 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d  e \"" (test:get-
8b30: 73 74 61 74 65 20 74 65 73 74 64 61 74 29 20 0a  state testdat) .
8b40: 09 09 09 09 22 5c 22 20 61 6e 64 20 73 74 61 74  ...."\" and stat
8b50: 75 73 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74  us \"" (test:get
8b60: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29  -status testdat)
8b70: 20 22 5c 22 2c 20 75 73 65 20 2d 72 65 72 75 6e   "\", use -rerun
8b80: 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73   \"" (test:get-s
8b90: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 0a 20  tatus testdat). 
8ba0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
8bb0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22                 "
8bc0: 5c 22 20 6f 72 20 2d 66 6f 72 63 65 20 74 6f 20  \" or -force to 
8bd0: 6f 76 65 72 72 69 64 65 22 29 29 0a 09 20 20 20  override"))..   
8be0: 20 20 20 20 3b 3b 20 4e 4f 54 45 3a 20 4e 6f 20      ;; NOTE: No 
8bf0: 6c 6f 6e 67 65 72 20 62 65 20 63 68 65 63 6b 69  longer be checki
8c00: 6e 67 20 70 72 65 72 65 71 75 69 73 69 74 65 73  ng prerequisites
8c10: 20 68 65 72 65 21 20 57 69 6c 6c 20 6e 65 76 65   here! Will neve
8c20: 72 20 67 65 74 20 68 65 72 65 20 75 6e 6c 65 73  r get here unles
8c30: 73 20 70 72 65 72 65 71 73 20 61 72 65 0a 09 20  s prereqs are.. 
8c40: 20 20 20 20 20 20 3b 3b 20 20 20 20 20 20 20 61        ;;       a
8c50: 6c 72 65 61 64 79 20 6d 65 74 2e 0a 09 20 20 20  lready met...   
8c60: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6c 61      (if (not (la
8c70: 75 6e 63 68 2d 74 65 73 74 20 23 66 20 72 75 6e  unch-test #f run
8c80: 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74  -id runname test
8c90: 2d 63 6f 6e 66 20 6b 65 79 76 61 6c 6c 73 74 20  -conf keyvallst 
8ca0: 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 70  test-name test-p
8cb0: 61 74 68 20 69 74 65 6d 64 61 74 20 66 6c 61 67  ath itemdat flag
8cc0: 73 29 29 0a 09 09 20 20 20 28 62 65 67 69 6e 0a  s))...   (begin.
8cd0: 09 09 20 20 20 20 20 28 70 72 69 6e 74 20 22 45  ..     (print "E
8ce0: 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20  RROR: Failed to 
8cf0: 6c 61 75 6e 63 68 20 74 68 65 20 74 65 73 74 2e  launch the test.
8d00: 20 45 78 69 74 69 6e 67 20 61 73 20 73 6f 6f 6e   Exiting as soon
8d10: 20 61 73 20 70 6f 73 73 69 62 6c 65 22 29 0a 09   as possible")..
8d20: 09 20 20 20 20 20 28 73 65 74 21 20 2a 67 6c 6f  .     (set! *glo
8d30: 62 61 6c 65 78 69 74 73 74 61 74 75 73 2a 20 31  balexitstatus* 1
8d40: 29 20 3b 3b 20 0a 09 09 20 20 20 20 20 28 70 72  ) ;; ...     (pr
8d50: 6f 63 65 73 73 2d 73 69 67 6e 61 6c 20 28 63 75  ocess-signal (cu
8d60: 72 72 65 6e 74 2d 70 72 6f 63 65 73 73 2d 69 64  rrent-process-id
8d70: 29 20 73 69 67 6e 61 6c 2f 6b 69 6c 6c 29 29 29  ) signal/kill)))
8d80: 29 29 29 0a 09 28 28 4b 49 4c 4c 45 44 29 20 0a  )))..((KILLED) .
8d90: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31  . (debug:print 1
8da0: 20 22 4e 4f 54 45 3a 20 22 20 6e 65 77 2d 74 65   "NOTE: " new-te
8db0: 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72  st-name " is alr
8dc0: 65 61 64 79 20 72 75 6e 6e 69 6e 67 20 6f 72 20  eady running or 
8dd0: 77 61 73 20 65 78 70 6c 69 63 74 6c 79 20 6b 69  was explictly ki
8de0: 6c 6c 65 64 2c 20 75 73 65 20 2d 66 6f 72 63 65  lled, use -force
8df0: 20 74 6f 20 6c 61 75 6e 63 68 20 69 74 2e 22 29   to launch it.")
8e00: 29 0a 09 28 28 4c 41 55 4e 43 48 45 44 20 52 45  )..((LAUNCHED RE
8e10: 4d 4f 54 45 48 4f 53 54 53 54 41 52 54 20 52 55  MOTEHOSTSTART RU
8e20: 4e 4e 49 4e 47 29 20 20 0a 09 20 28 69 66 20 28  NNING)  .. (if (
8e30: 3e 20 28 2d 20 28 63 75 72 72 65 6e 74 2d 73 65  > (- (current-se
8e40: 63 6f 6e 64 73 29 28 2b 20 28 64 62 3a 74 65 73  conds)(+ (db:tes
8e50: 74 2d 67 65 74 2d 65 76 65 6e 74 5f 74 69 6d 65  t-get-event_time
8e60: 20 74 65 73 74 64 61 74 29 0a 09 09 09 09 20 20   testdat).....  
8e70: 20 20 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65       (db:test-ge
8e80: 74 2d 72 75 6e 5f 64 75 72 61 74 69 6f 6e 20 74  t-run_duration t
8e90: 65 73 74 64 61 74 29 29 29 0a 09 09 36 30 30 29  estdat)))...600)
8ea0: 20 3b 3b 20 69 2e 65 2e 20 6e 6f 20 75 70 64 61   ;; i.e. no upda
8eb0: 74 65 20 66 6f 72 20 6d 6f 72 65 20 74 68 61 6e  te for more than
8ec0: 20 36 30 30 20 73 65 63 6f 6e 64 73 0a 09 20 20   600 seconds..  
8ed0: 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20     (begin..     
8ee0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
8ef0: 20 22 57 41 52 4e 49 4e 47 3a 20 54 65 73 74 20   "WARNING: Test 
8f00: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 70  " test-name " ap
8f10: 70 65 61 72 73 20 74 6f 20 62 65 20 64 65 61 64  pears to be dead
8f20: 2e 20 46 6f 72 63 69 6e 67 20 69 74 20 74 6f 20  . Forcing it to 
8f30: 73 74 61 74 65 20 49 4e 43 4f 4d 50 4c 45 54 45  state INCOMPLETE
8f40: 20 61 6e 64 20 73 74 61 74 75 73 20 53 54 55 43   and status STUC
8f50: 4b 2f 44 45 41 44 22 29 0a 09 20 20 20 20 20 20  K/DEAD")..      
8f60: 20 28 74 65 73 74 73 3a 74 65 73 74 2d 73 65 74   (tests:test-set
8f70: 2d 73 74 61 74 75 73 21 20 74 65 73 74 2d 69 64  -status! test-id
8f80: 20 22 49 4e 43 4f 4d 50 4c 45 54 45 22 20 22 53   "INCOMPLETE" "S
8f90: 54 55 43 4b 2f 44 45 41 44 22 20 22 54 65 73 74  TUCK/DEAD" "Test
8fa0: 20 69 73 20 73 74 75 63 6b 20 6f 72 20 64 65 61   is stuck or dea
8fb0: 64 22 20 23 66 29 29 0a 09 20 20 20 20 20 28 64  d" #f))..     (d
8fc0: 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 4e 4f  ebug:print 2 "NO
8fd0: 54 45 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 20  TE: " test-name 
8fe0: 22 20 69 73 20 61 6c 72 65 61 64 79 20 72 75 6e  " is already run
8ff0: 6e 69 6e 67 22 29 29 29 0a 09 28 65 6c 73 65 20  ning")))..(else 
9000: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
9010: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 46 61 69  nt 0 "ERROR: Fai
9020: 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 65  led to launch te
9030: 73 74 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61  st " new-test-na
9040: 6d 65 20 22 2e 20 55 6e 72 65 63 6f 67 6e 69 73  me ". Unrecognis
9050: 65 64 20 73 74 61 74 65 20 22 20 28 74 65 73 74  ed state " (test
9060: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64  :get-state testd
9070: 61 74 29 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d  at)))))))..;;===
9080: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9090: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
90a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
90b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
90c0: 3d 3d 3d 0a 3b 3b 20 45 4e 44 20 4f 46 20 4e 45  ===.;; END OF NE
90d0: 57 20 53 54 55 46 46 0a 3b 3b 3d 3d 3d 3d 3d 3d  W STUFF.;;======
90e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
90f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9100: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9110: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9120: 0a 0a 28 64 65 66 69 6e 65 20 28 67 65 74 2d 64  ..(define (get-d
9130: 69 72 2d 75 70 2d 6e 20 64 69 72 20 2e 20 70 61  ir-up-n dir . pa
9140: 72 61 6d 73 29 20 0a 20 20 28 6c 65 74 20 28 28  rams) .  (let ((
9150: 64 70 61 72 74 73 20 20 28 73 74 72 69 6e 67 2d  dparts  (string-
9160: 73 70 6c 69 74 20 64 69 72 20 22 2f 22 29 29 0a  split dir "/")).
9170: 09 28 63 6f 75 6e 74 20 20 20 28 69 66 20 28 6e  .(count   (if (n
9180: 75 6c 6c 3f 20 70 61 72 61 6d 73 29 20 31 20 28  ull? params) 1 (
9190: 63 61 72 20 70 61 72 61 6d 73 29 29 29 29 0a 20  car params)))). 
91a0: 20 20 20 28 63 6f 6e 63 20 22 2f 22 20 28 73 74     (conc "/" (st
91b0: 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65  ring-intersperse
91c0: 20 0a 09 20 20 20 20 20 20 20 28 74 61 6b 65 20   ..       (take 
91d0: 64 70 61 72 74 73 20 28 2d 20 28 6c 65 6e 67 74  dparts (- (lengt
91e0: 68 20 64 70 61 72 74 73 29 20 63 6f 75 6e 74 29  h dparts) count)
91f0: 29 0a 09 20 20 20 20 20 20 20 22 2f 22 29 29 29  )..       "/")))
9200: 29 0a 3b 3b 20 52 65 6d 6f 76 65 20 72 75 6e 73  ).;; Remove runs
9210: 0a 3b 3b 20 66 69 65 6c 64 73 20 61 72 65 20 70  .;; fields are p
9220: 61 73 73 69 6e 67 20 69 6e 20 74 68 72 6f 75 67  assing in throug
9230: 68 20 0a 3b 3b 20 61 63 74 69 6f 6e 3a 0a 3b 3b  h .;; action:.;;
9240: 20 20 20 20 27 72 65 6d 6f 76 65 2d 72 75 6e 73      'remove-runs
9250: 0a 3b 3b 20 20 20 20 27 73 65 74 2d 73 74 61 74  .;;    'set-stat
9260: 65 2d 73 74 61 74 75 73 0a 3b 3b 0a 3b 3b 20 4e  e-status.;;.;; N
9270: 42 2f 2f 20 73 68 6f 75 6c 64 20 70 61 73 73 20  B// should pass 
9280: 69 6e 20 6b 65 79 73 3f 0a 3b 3b 0a 28 64 65 66  in keys?.;;.(def
9290: 69 6e 65 20 28 72 75 6e 73 3a 6f 70 65 72 61 74  ine (runs:operat
92a0: 65 2d 6f 6e 20 61 63 74 69 6f 6e 20 72 75 6e 6e  e-on action runn
92b0: 61 6d 65 70 61 74 74 20 74 65 73 74 70 61 74 74  amepatt testpatt
92c0: 20 23 21 6b 65 79 20 28 73 74 61 74 65 20 23 66   #!key (state #f
92d0: 29 28 73 74 61 74 75 73 20 23 66 29 28 6e 65 77  )(status #f)(new
92e0: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 20 23 66  -state-status #f
92f0: 29 29 0a 20 20 28 63 6f 6d 6d 6f 6e 3a 63 6c 65  )).  (common:cle
9300: 61 72 2d 63 61 63 68 65 73 29 20 3b 3b 20 63 6c  ar-caches) ;; cl
9310: 65 61 72 20 61 6c 6c 20 63 61 63 68 65 73 0a 20  ear all caches. 
9320: 20 28 6c 65 74 2a 20 28 28 64 62 20 20 20 20 20   (let* ((db     
9330: 20 20 20 20 20 20 23 66 29 0a 09 20 28 6b 65 79        #f).. (key
9340: 73 20 20 20 20 20 20 20 20 20 28 6f 70 65 6e 2d  s         (open-
9350: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
9360: 2d 6b 65 79 73 20 64 62 29 29 0a 09 20 28 72 75  -keys db)).. (ru
9370: 6e 64 61 74 20 20 20 20 20 20 20 28 6f 70 65 6e  ndat       (open
9380: 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 3a  -run-close runs:
9390: 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74 74  get-runs-by-patt
93a0: 20 64 62 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65   db keys runname
93b0: 70 61 74 74 29 29 0a 09 20 28 68 65 61 64 65 72  patt)).. (header
93c0: 20 20 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72         (vector-r
93d0: 65 66 20 72 75 6e 64 61 74 20 30 29 29 0a 09 20  ef rundat 0)).. 
93e0: 28 72 75 6e 73 20 20 20 20 20 20 20 20 20 28 76  (runs         (v
93f0: 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74  ector-ref rundat
9400: 20 31 29 29 0a 09 20 28 73 74 61 74 65 73 20 20   1)).. (states  
9410: 20 20 20 20 20 28 69 66 20 73 74 61 74 65 20 20       (if state  
9420: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 73 74  (string-split st
9430: 61 74 65 20 20 22 2c 22 29 20 27 28 29 29 29 0a  ate  ",") '())).
9440: 09 20 28 73 74 61 74 75 73 65 73 20 20 20 20 20  . (statuses     
9450: 28 69 66 20 73 74 61 74 75 73 20 28 73 74 72 69  (if status (stri
9460: 6e 67 2d 73 70 6c 69 74 20 73 74 61 74 75 73 20  ng-split status 
9470: 22 2c 22 29 20 27 28 29 29 29 0a 09 20 28 73 74  ",") '())).. (st
9480: 61 74 65 2d 73 74 61 74 75 73 20 28 69 66 20 28  ate-status (if (
9490: 73 74 72 69 6e 67 3f 20 6e 65 77 2d 73 74 61 74  string? new-stat
94a0: 65 2d 73 74 61 74 75 73 29 20 28 73 74 72 69 6e  e-status) (strin
94b0: 67 2d 73 70 6c 69 74 20 6e 65 77 2d 73 74 61 74  g-split new-stat
94c0: 65 2d 73 74 61 74 75 73 20 22 2c 22 29 20 27 28  e-status ",") '(
94d0: 23 66 20 23 66 29 29 29 29 0a 20 20 20 20 28 64  #f #f)))).    (d
94e0: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
94f0: 34 20 22 72 75 6e 73 3a 6f 70 65 72 61 74 65 2d  4 "runs:operate-
9500: 6f 6e 20 3d 3e 20 48 65 61 64 65 72 3a 20 22 20  on => Header: " 
9510: 68 65 61 64 65 72 20 22 20 61 63 74 69 6f 6e 3a  header " action:
9520: 20 22 20 61 63 74 69 6f 6e 20 22 20 6e 65 77 2d   " action " new-
9530: 73 74 61 74 65 2d 73 74 61 74 75 73 3a 20 22 20  state-status: " 
9540: 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73  new-state-status
9550: 29 0a 20 20 20 20 28 69 66 20 28 3e 20 32 20 28  ).    (if (> 2 (
9560: 6c 65 6e 67 74 68 20 73 74 61 74 65 2d 73 74 61  length state-sta
9570: 74 75 73 29 29 0a 09 28 62 65 67 69 6e 0a 09 20  tus))..(begin.. 
9580: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
9590: 22 45 52 52 4f 52 3a 20 74 68 65 20 70 61 72 61  "ERROR: the para
95a0: 6d 65 74 65 72 20 74 6f 20 2d 73 65 74 2d 73 74  meter to -set-st
95b0: 61 74 65 2d 73 74 61 74 75 73 20 69 73 20 61 20  ate-status is a 
95c0: 63 6f 6d 6d 61 20 64 65 6c 69 6d 69 74 65 64 20  comma delimited 
95d0: 73 74 72 69 6e 67 2e 20 45 2e 67 2e 20 43 4f 4d  string. E.g. COM
95e0: 50 4c 45 54 45 44 2c 46 41 49 4c 22 29 0a 09 20  PLETED,FAIL").. 
95f0: 20 28 65 78 69 74 29 29 29 0a 20 20 20 20 28 66   (exit))).    (f
9600: 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 28 6c 61  or-each.     (la
9610: 6d 62 64 61 20 28 72 75 6e 29 0a 20 20 20 20 20  mbda (run).     
9620: 20 20 28 6c 65 74 20 28 28 72 75 6e 6b 65 79 20    (let ((runkey 
9630: 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65  (string-interspe
9640: 72 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61  rse (map (lambda
9650: 20 28 6b 29 0a 09 09 09 09 09 09 28 64 62 3a 67   (k).......(db:g
9660: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64  et-value-by-head
9670: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 28 76  er run header (v
9680: 65 63 74 6f 72 2d 72 65 66 20 6b 20 30 29 29 29  ector-ref k 0)))
9690: 20 6b 65 79 73 29 20 22 2f 22 29 29 0a 09 20 20   keys) "/"))..  
96a0: 20 20 20 28 64 69 72 73 2d 74 6f 2d 72 65 6d 6f     (dirs-to-remo
96b0: 76 65 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61  ve (make-hash-ta
96c0: 62 6c 65 29 29 29 0a 09 20 28 6c 65 74 2a 20 28  ble))).. (let* (
96d0: 28 72 75 6e 2d 69 64 20 20 20 20 28 64 62 3a 67  (run-id    (db:g
96e0: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64  et-value-by-head
96f0: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 69  er run header "i
9700: 64 22 29 29 0a 09 09 28 72 75 6e 2d 73 74 61 74  d"))...(run-stat
9710: 65 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d  e (db:get-value-
9720: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65  by-header run he
9730: 61 64 65 72 20 22 73 74 61 74 65 22 29 29 0a 09  ader "state"))..
9740: 09 28 74 65 73 74 73 20 20 20 20 20 28 69 66 20  .(tests     (if 
9750: 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 72 75 6e  (not (equal? run
9760: 2d 73 74 61 74 65 20 22 6c 6f 63 6b 65 64 22 29  -state "locked")
9770: 29 0a 09 09 09 20 20 20 20 20 20 20 28 6f 70 65  )....       (ope
9780: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67  n-run-close db:g
9790: 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e  et-tests-for-run
97a0: 20 64 62 20 72 75 6e 2d 69 64 0a 09 09 09 09 09   db run-id......
97b0: 09 20 20 20 20 20 20 74 65 73 74 70 61 74 74 20  .      testpatt 
97c0: 73 74 61 74 65 73 20 73 74 61 74 75 73 65 73 0a  states statuses.
97d0: 09 09 09 09 09 09 20 20 20 20 20 20 6e 6f 74 2d  ......      not-
97e0: 69 6e 3a 20 20 23 66 0a 09 09 09 09 09 09 20 20  in:  #f.......  
97f0: 20 20 20 20 73 6f 72 74 2d 62 79 3a 20 28 63 61      sort-by: (ca
9800: 73 65 20 61 63 74 69 6f 6e 0a 09 09 09 09 09 09  se action.......
9810: 09 09 20 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73  .. ((remove-runs
9820: 29 20 27 72 75 6e 64 69 72 29 0a 09 09 09 09 09  ) 'rundir)......
9830: 09 09 09 20 28 65 6c 73 65 20 20 20 20 20 20 20  ... (else       
9840: 20 20 20 27 65 76 65 6e 74 5f 74 69 6d 65 29 29     'event_time))
9850: 29 0a 09 09 09 20 20 20 20 20 20 20 27 28 29 29  )....       '())
9860: 29 0a 09 09 28 6c 61 73 74 74 70 61 74 68 20 22  )...(lasttpath "
9870: 2f 64 6f 65 73 2f 6e 6f 74 2f 65 78 69 73 74 2f  /does/not/exist/
9880: 49 2f 68 6f 70 65 22 29 29 0a 09 20 20 20 28 64  I/hope"))..   (d
9890: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
98a0: 34 20 22 72 75 6e 73 3a 6f 70 65 72 61 74 65 2d  4 "runs:operate-
98b0: 6f 6e 20 72 75 6e 3d 22 20 72 75 6e 20 22 2c 20  on run=" run ", 
98c0: 68 65 61 64 65 72 3d 22 20 68 65 61 64 65 72 29  header=" header)
98d0: 0a 09 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e  ..   (if (not (n
98e0: 75 6c 6c 3f 20 74 65 73 74 73 29 29 0a 09 20 20  ull? tests))..  
98f0: 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 28       (begin... (
9900: 63 61 73 65 20 61 63 74 69 6f 6e 0a 09 09 20 20  case action...  
9910: 20 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29 0a   ((remove-runs).
9920: 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ..    (debug:pri
9930: 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 74  nt 1 "Removing t
9940: 65 73 74 73 20 66 6f 72 20 72 75 6e 3a 20 22 20  ests for run: " 
9950: 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67  runkey " " (db:g
9960: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64  et-value-by-head
9970: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 72  er run header "r
9980: 75 6e 6e 61 6d 65 22 29 29 29 0a 09 09 20 20 20  unname")))...   
9990: 28 28 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74  ((set-state-stat
99a0: 75 73 29 0a 09 09 20 20 20 20 28 64 65 62 75 67  us)...    (debug
99b0: 3a 70 72 69 6e 74 20 31 20 22 4d 6f 64 69 66 79  :print 1 "Modify
99c0: 69 6e 67 20 73 74 61 74 65 20 61 6e 64 20 73 74  ing state and st
99d0: 61 75 73 20 66 6f 72 20 74 65 73 74 73 20 66 6f  aus for tests fo
99e0: 72 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20  r run: " runkey 
99f0: 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75  " " (db:get-valu
9a00: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20  e-by-header run 
9a10: 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22  header "runname"
9a20: 29 29 29 0a 09 09 20 20 20 28 28 70 72 69 6e 74  )))...   ((print
9a30: 2d 72 75 6e 29 0a 09 09 20 20 20 20 28 64 65 62  -run)...    (deb
9a40: 75 67 3a 70 72 69 6e 74 20 31 20 22 50 72 69 6e  ug:print 1 "Prin
9a50: 74 69 6e 67 20 69 6e 66 6f 20 66 6f 72 20 72 75  ting info for ru
9a60: 6e 20 22 20 72 75 6e 6b 65 79 20 22 2c 20 72 75  n " runkey ", ru
9a70: 6e 3d 22 20 72 75 6e 20 22 2c 20 74 65 73 74 73  n=" run ", tests
9a80: 3d 22 20 74 65 73 74 73 20 22 2c 20 68 65 61 64  =" tests ", head
9a90: 65 72 3d 22 20 68 65 61 64 65 72 29 0a 09 09 20  er=" header)... 
9aa0: 20 20 20 61 63 74 69 6f 6e 29 0a 09 09 20 20 20     action)...   
9ab0: 28 65 6c 73 65 0a 09 09 20 20 20 20 28 64 65 62  (else...    (deb
9ac0: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 30 20  ug:print-info 0 
9ad0: 22 61 63 74 69 6f 6e 20 6e 6f 74 20 72 65 63 6f  "action not reco
9ae0: 67 6e 69 73 65 64 20 22 20 61 63 74 69 6f 6e 29  gnised " action)
9af0: 29 29 0a 09 09 20 28 66 6f 72 2d 65 61 63 68 0a  ))... (for-each.
9b00: 09 09 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73  ..  (lambda (tes
9b10: 74 29 0a 09 09 20 20 20 20 28 6c 65 74 2a 20 28  t)...    (let* (
9b20: 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74  (item-path (db:t
9b30: 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74  est-get-item-pat
9b40: 68 20 74 65 73 74 29 29 0a 09 09 09 20 20 20 28  h test))....   (
9b50: 74 65 73 74 2d 6e 61 6d 65 20 28 64 62 3a 74 65  test-name (db:te
9b60: 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20  st-get-testname 
9b70: 74 65 73 74 29 29 0a 09 09 09 20 20 20 28 72 75  test))....   (ru
9b80: 6e 2d 64 69 72 20 20 20 28 64 62 3a 74 65 73 74  n-dir   (db:test
9b90: 2d 67 65 74 2d 72 75 6e 64 69 72 20 74 65 73 74  -get-rundir test
9ba0: 29 29 20 20 20 20 3b 3b 20 72 75 6e 20 64 69 72  ))    ;; run dir
9bb0: 20 69 73 20 66 72 6f 6d 20 74 68 65 20 6c 69 6e   is from the lin
9bc0: 6b 20 74 72 65 65 0a 09 09 09 20 20 20 28 72 65  k tree....   (re
9bd0: 61 6c 2d 64 69 72 20 20 28 69 66 20 28 66 69 6c  al-dir  (if (fil
9be0: 65 2d 65 78 69 73 74 73 3f 20 72 75 6e 2d 64 69  e-exists? run-di
9bf0: 72 29 0a 09 09 09 09 09 20 20 28 72 65 73 6f 6c  r)......  (resol
9c00: 76 65 2d 70 61 74 68 6e 61 6d 65 20 72 75 6e 2d  ve-pathname run-
9c10: 64 69 72 29 0a 09 09 09 09 09 20 20 23 66 29 29  dir)......  #f))
9c20: 0a 09 09 09 20 20 20 28 74 65 73 74 2d 69 64 20  ....   (test-id 
9c30: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69    (db:test-get-i
9c40: 64 20 74 65 73 74 29 29 29 0a 09 09 20 20 20 20  d test)))...    
9c50: 20 20 3b 3b 20 20 20 28 74 64 62 20 20 20 20 20    ;;   (tdb     
9c60: 20 20 28 64 62 3a 6f 70 65 6e 2d 74 65 73 74 2d    (db:open-test-
9c70: 64 62 20 72 75 6e 2d 64 69 72 29 29 29 0a 09 09  db run-dir)))...
9c80: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
9c90: 6e 74 2d 69 6e 66 6f 20 34 20 22 74 65 73 74 3d  nt-info 4 "test=
9ca0: 22 20 74 65 73 74 29 20 3b 3b 20 20 20 22 20 28  " test) ;;   " (
9cb0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74  db:test-get-test
9cc0: 6e 61 6d 65 20 74 65 73 74 29 20 22 20 69 64 3a  name test) " id:
9cd0: 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d   " (db:test-get-
9ce0: 69 64 20 74 65 73 74 29 20 22 20 22 20 69 74 65  id test) " " ite
9cf0: 6d 2d 70 61 74 68 20 22 20 61 63 74 69 6f 6e 3a  m-path " action:
9d00: 20 22 20 61 63 74 69 6f 6e 29 0a 09 09 20 20 20   " action)...   
9d10: 20 20 20 28 63 61 73 65 20 61 63 74 69 6f 6e 0a     (case action.
9d20: 09 09 09 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73  ...((remove-runs
9d30: 29 20 3b 3b 20 74 68 65 20 74 64 62 20 69 73 20  ) ;; the tdb is 
9d40: 66 6f 72 20 66 75 74 75 72 65 20 70 6f 73 73 69  for future possi
9d50: 62 6c 65 2e 20 0a 09 09 09 20 28 6f 70 65 6e 2d  ble. .... (open-
9d60: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c  run-close db:del
9d70: 65 74 65 2d 74 65 73 74 2d 72 65 63 6f 72 64 73  ete-test-records
9d80: 20 64 62 20 23 66 20 28 64 62 3a 74 65 73 74 2d   db #f (db:test-
9d90: 67 65 74 2d 69 64 20 74 65 73 74 29 29 0a 09 09  get-id test))...
9da0: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69  . (debug:print-i
9db0: 6e 66 6f 20 31 20 22 41 74 74 65 6d 70 74 69 6e  nfo 1 "Attemptin
9dc0: 67 20 74 6f 20 72 65 6d 6f 76 65 20 22 20 28 69  g to remove " (i
9dd0: 66 20 72 65 61 6c 2d 64 69 72 20 28 63 6f 6e 63  f real-dir (conc
9de0: 20 22 20 64 69 72 20 22 20 72 65 61 6c 2d 64 69   " dir " real-di
9df0: 72 20 22 20 61 6e 64 20 22 29 20 22 22 29 20 22  r " and ") "") "
9e00: 20 6c 69 6e 6b 20 22 20 72 75 6e 2d 64 69 72 29   link " run-dir)
9e10: 0a 09 09 09 20 28 69 66 20 28 61 6e 64 20 72 65  .... (if (and re
9e20: 61 6c 2d 64 69 72 20 0a 09 09 09 09 20 20 28 3e  al-dir .....  (>
9e30: 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20   (string-length 
9e40: 72 65 61 6c 2d 64 69 72 29 20 35 29 0a 09 09 09  real-dir) 5)....
9e50: 09 20 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f  .  (file-exists?
9e60: 20 72 65 61 6c 2d 64 69 72 29 29 20 3b 3b 20 62   real-dir)) ;; b
9e70: 61 64 20 68 65 75 72 69 73 74 69 63 20 62 75 74  ad heuristic but
9e80: 20 73 68 6f 75 6c 64 20 70 72 65 76 65 6e 74 20   should prevent 
9e90: 2f 74 6d 70 20 2f 68 6f 6d 65 20 65 74 63 2e 0a  /tmp /home etc..
9ea0: 09 09 09 20 20 20 20 20 28 62 65 67 69 6e 20 3b  ...     (begin ;
9eb0: 3b 20 6c 65 74 2a 20 28 28 72 65 61 6c 70 61 74  ; let* ((realpat
9ec0: 68 20 28 72 65 73 6f 6c 76 65 2d 70 61 74 68 6e  h (resolve-pathn
9ed0: 61 6d 65 20 72 75 6e 2d 64 69 72 29 29 29 0a 09  ame run-dir)))..
9ee0: 09 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a  ..       (debug:
9ef0: 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 52 65  print-info 1 "Re
9f00: 63 75 72 73 69 76 65 6c 79 20 72 65 6d 6f 76 69  cursively removi
9f10: 6e 67 20 22 20 72 65 61 6c 2d 64 69 72 29 0a 09  ng " real-dir)..
9f20: 09 09 20 20 20 20 20 20 20 28 69 66 20 28 66 69  ..       (if (fi
9f30: 6c 65 2d 65 78 69 73 74 73 3f 20 72 65 61 6c 2d  le-exists? real-
9f40: 64 69 72 29 0a 09 09 09 09 20 20 20 28 69 66 20  dir).....   (if 
9f50: 28 3e 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63  (> (system (conc
9f60: 20 22 72 6d 20 2d 72 66 20 22 20 72 65 61 6c 2d   "rm -rf " real-
9f70: 64 69 72 29 29 20 30 29 0a 09 09 09 09 20 20 20  dir)) 0).....   
9f80: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
9f90: 20 30 20 22 45 52 52 4f 52 3a 20 54 68 65 72 65   0 "ERROR: There
9fa0: 20 77 61 73 20 61 20 70 72 6f 62 6c 65 6d 20 72   was a problem r
9fb0: 65 6d 6f 76 69 6e 67 20 22 20 72 65 61 6c 2d 64  emoving " real-d
9fc0: 69 72 20 22 20 77 69 74 68 20 72 6d 20 2d 66 22  ir " with rm -f"
9fd0: 29 29 0a 09 09 09 09 20 20 20 28 64 65 62 75 67  )).....   (debug
9fe0: 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e  :print 0 "WARNIN
9ff0: 47 3a 20 74 65 73 74 20 64 69 72 20 22 20 72 65  G: test dir " re
a000: 61 6c 2d 64 69 72 20 22 20 61 70 70 65 61 72 73  al-dir " appears
a010: 20 74 6f 20 6e 6f 74 20 65 78 69 73 74 20 6f 72   to not exist or
a020: 20 69 73 20 6e 6f 74 20 72 65 61 64 61 62 6c 65   is not readable
a030: 22 29 29 29 0a 09 09 09 20 20 20 20 20 28 69 66  ")))....     (if
a040: 20 72 65 61 6c 2d 64 69 72 20 0a 09 09 09 09 20   real-dir ..... 
a050: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
a060: 57 41 52 4e 49 4e 47 3a 20 64 69 72 65 63 74 6f  WARNING: directo
a070: 72 79 20 22 20 72 65 61 6c 2d 64 69 72 20 22 20  ry " real-dir " 
a080: 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 74 22 29  does not exist")
a090: 0a 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 69  ..... (debug:pri
a0a0: 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 6e  nt 0 "WARNING: n
a0b0: 6f 20 72 65 61 6c 20 64 69 72 65 63 74 6f 72 79  o real directory
a0c0: 20 63 6f 72 72 6f 73 70 6f 6e 64 69 6e 67 20 74   corrosponding t
a0d0: 6f 20 6c 69 6e 6b 20 22 20 72 75 6e 2d 64 69 72  o link " run-dir
a0e0: 20 22 2c 20 6e 6f 74 68 69 6e 67 20 64 6f 6e 65   ", nothing done
a0f0: 22 29 29 29 0a 09 09 09 20 28 69 66 20 28 73 79  "))).... (if (sy
a100: 6d 62 6f 6c 69 63 2d 6c 69 6e 6b 3f 20 72 75 6e  mbolic-link? run
a110: 2d 64 69 72 29 0a 09 09 09 20 20 20 20 20 28 62  -dir)....     (b
a120: 65 67 69 6e 0a 09 09 09 20 20 20 20 20 20 20 28  egin....       (
a130: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
a140: 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 73 79 6d   1 "Removing sym
a150: 6c 69 6e 6b 20 22 20 72 75 6e 2d 64 69 72 29 0a  link " run-dir).
a160: 09 09 09 20 20 20 20 20 20 20 28 68 61 6e 64 6c  ...       (handl
a170: 65 2d 65 78 63 65 70 74 69 6f 6e 73 0a 09 09 09  e-exceptions....
a180: 09 65 78 6e 0a 09 09 09 09 28 64 65 62 75 67 3a  .exn.....(debug:
a190: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
a1a0: 20 46 61 69 6c 65 64 20 74 6f 20 72 65 6d 6f 76   Failed to remov
a1b0: 65 20 73 79 6d 6c 69 6e 6b 20 22 20 72 75 6e 2d  e symlink " run-
a1c0: 64 69 72 20 28 28 63 6f 6e 64 69 74 69 6f 6e 2d  dir ((condition-
a1d0: 70 72 6f 70 65 72 74 79 2d 61 63 63 65 73 73 6f  property-accesso
a1e0: 72 20 27 65 78 6e 20 27 6d 65 73 73 61 67 65 29  r 'exn 'message)
a1f0: 20 65 78 6e 29 20 22 2c 20 61 74 74 65 6d 70 74   exn) ", attempt
a200: 69 6e 67 20 74 6f 20 63 6f 6e 74 69 6e 75 65 22  ing to continue"
a210: 29 0a 09 09 09 09 28 64 65 6c 65 74 65 2d 66 69  ).....(delete-fi
a220: 6c 65 20 72 75 6e 2d 64 69 72 29 29 29 0a 09 09  le run-dir)))...
a230: 09 20 20 20 20 20 28 69 66 20 28 64 69 72 65 63  .     (if (direc
a240: 74 6f 72 79 3f 20 72 75 6e 2d 64 69 72 29 0a 09  tory? run-dir)..
a250: 09 09 09 20 28 69 66 20 28 3e 20 28 64 69 72 65  ... (if (> (dire
a260: 63 74 6f 72 79 2d 66 6f 6c 64 20 28 6c 61 6d 62  ctory-fold (lamb
a270: 64 61 20 28 66 20 78 29 28 2b 20 31 20 78 29 29  da (f x)(+ 1 x))
a280: 20 30 20 72 75 6e 2d 64 69 72 29 20 30 29 0a 09   0 run-dir) 0)..
a290: 09 09 09 20 20 20 20 20 28 64 65 62 75 67 3a 70  ...     (debug:p
a2a0: 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a  rint 0 "WARNING:
a2b0: 20 72 65 66 75 73 69 6e 67 20 74 6f 20 72 65 6d   refusing to rem
a2c0: 6f 76 65 20 22 20 72 75 6e 2d 64 69 72 20 22 20  ove " run-dir " 
a2d0: 61 73 20 69 74 20 69 73 20 6e 6f 74 20 65 6d 70  as it is not emp
a2e0: 74 79 22 29 0a 09 09 09 09 20 20 20 20 20 20 28  ty").....      (
a2f0: 68 61 6e 64 6c 65 2d 65 78 63 65 70 74 69 6f 6e  handle-exception
a300: 73 0a 09 09 09 09 20 20 20 20 20 20 20 65 78 6e  s.....       exn
a310: 0a 09 09 09 09 20 20 20 20 20 20 20 28 64 65 62  .....       (deb
a320: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f  ug:print 0 "ERRO
a330: 52 3a 20 20 46 61 69 6c 65 64 20 74 6f 20 72 65  R:  Failed to re
a340: 6d 6f 76 65 20 64 69 72 65 63 74 6f 72 79 20 22  move directory "
a350: 20 72 75 6e 2d 64 69 72 20 28 28 63 6f 6e 64 69   run-dir ((condi
a360: 74 69 6f 6e 2d 70 72 6f 70 65 72 74 79 2d 61 63  tion-property-ac
a370: 63 65 73 73 6f 72 20 27 65 78 6e 20 27 6d 65 73  cessor 'exn 'mes
a380: 73 61 67 65 29 20 65 78 6e 29 20 22 2c 20 61 74  sage) exn) ", at
a390: 74 65 6d 70 74 69 6e 67 20 74 6f 20 63 6f 6e 74  tempting to cont
a3a0: 69 6e 75 65 22 29 0a 09 09 09 09 20 20 20 20 20  inue").....     
a3b0: 20 20 28 64 65 6c 65 74 65 2d 64 69 72 65 63 74    (delete-direct
a3c0: 6f 72 79 20 72 75 6e 2d 64 69 72 29 29 29 0a 09  ory run-dir)))..
a3d0: 09 09 09 20 28 69 66 20 72 75 6e 2d 64 69 72 0a  ... (if run-dir.
a3e0: 09 09 09 09 20 20 20 20 20 28 64 65 62 75 67 3a  ....     (debug:
a3f0: 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47  print 0 "WARNING
a400: 3a 20 6e 6f 74 20 72 65 6d 6f 76 69 6e 67 20 22  : not removing "
a410: 20 72 75 6e 2d 64 69 72 20 22 20 61 73 20 69 74   run-dir " as it
a420: 20 65 69 74 68 65 72 20 64 6f 65 73 6e 27 74 20   either doesn't 
a430: 65 78 69 73 74 20 6f 72 20 69 73 20 6e 6f 74 20  exist or is not 
a440: 61 20 73 79 6d 6c 69 6e 6b 22 29 0a 09 09 09 09  a symlink").....
a450: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
a460: 74 20 30 20 22 4e 4f 54 45 3a 20 74 68 65 20 72  t 0 "NOTE: the r
a470: 75 6e 20 64 69 72 20 66 6f 72 20 74 68 69 73 20  un dir for this 
a480: 74 65 73 74 20 69 73 20 75 6e 64 65 66 69 6e 65  test is undefine
a490: 64 2e 20 54 65 73 74 20 6d 61 79 20 68 61 76 65  d. Test may have
a4a0: 20 61 6c 72 65 61 64 79 20 62 65 65 6e 20 64 65   already been de
a4b0: 6c 65 74 65 64 2e 22 29 29 0a 09 09 09 09 20 29  leted."))..... )
a4c0: 29 29 0a 09 09 09 28 28 73 65 74 2d 73 74 61 74  ))....((set-stat
a4d0: 65 2d 73 74 61 74 75 73 29 0a 09 09 09 20 28 64  e-status).... (d
a4e0: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
a4f0: 32 20 22 6e 65 77 20 73 74 61 74 65 20 22 20 28  2 "new state " (
a500: 63 61 72 20 73 74 61 74 65 2d 73 74 61 74 75 73  car state-status
a510: 29 20 22 2c 20 6e 65 77 20 73 74 61 74 75 73 20  ) ", new status 
a520: 22 20 28 63 61 64 72 20 73 74 61 74 65 2d 73 74  " (cadr state-st
a530: 61 74 75 73 29 29 0a 09 09 09 20 28 6f 70 65 6e  atus)).... (open
a540: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 74 65  -run-close db:te
a550: 73 74 2d 73 65 74 2d 73 74 61 74 65 2d 73 74 61  st-set-state-sta
a560: 74 75 73 2d 62 79 2d 69 64 20 64 62 20 28 64 62  tus-by-id db (db
a570: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73  :test-get-id tes
a580: 74 29 20 28 63 61 72 20 73 74 61 74 65 2d 73 74  t) (car state-st
a590: 61 74 75 73 29 28 63 61 64 72 20 73 74 61 74 65  atus)(cadr state
a5a0: 2d 73 74 61 74 75 73 29 20 23 66 29 29 29 29 29  -status) #f)))))
a5b0: 0a 09 09 20 20 28 73 6f 72 74 20 74 65 73 74 73  ...  (sort tests
a5c0: 20 28 6c 61 6d 62 64 61 20 28 61 20 62 29 28 6c   (lambda (a b)(l
a5d0: 65 74 20 28 28 64 69 72 61 20 28 64 62 3a 74 65  et ((dira (db:te
a5e0: 73 74 2d 67 65 74 2d 72 75 6e 64 69 72 20 61 29  st-get-rundir a)
a5f0: 29 0a 09 09 09 09 09 09 20 28 64 69 72 62 20 28  )....... (dirb (
a600: 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 64  db:test-get-rund
a610: 69 72 20 62 29 29 29 0a 09 09 09 09 09 20 20 20  ir b)))......   
a620: 20 20 28 69 66 20 28 61 6e 64 20 28 73 74 72 69    (if (and (stri
a630: 6e 67 3f 20 64 69 72 61 29 28 73 74 72 69 6e 67  ng? dira)(string
a640: 3f 20 64 69 72 62 29 29 0a 09 09 09 09 09 09 20  ? dirb))....... 
a650: 28 3e 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74  (> (string-lengt
a660: 68 20 64 69 72 61 29 28 73 74 72 69 6e 67 2d 6c  h dira)(string-l
a670: 65 6e 67 74 68 20 64 69 72 62 29 29 0a 09 09 09  ength dirb))....
a680: 09 09 09 20 23 66 29 29 29 29 29 29 29 0a 09 20  ... #f))))))).. 
a690: 20 20 3b 3b 20 72 65 6d 6f 76 65 20 74 68 65 20    ;; remove the 
a6a0: 72 75 6e 20 69 66 20 7a 65 72 6f 20 74 65 73 74  run if zero test
a6b0: 73 20 72 65 6d 61 69 6e 0a 09 20 20 20 28 69 66  s remain..   (if
a6c0: 20 28 65 71 3f 20 61 63 74 69 6f 6e 20 27 72 65   (eq? action 're
a6d0: 6d 6f 76 65 2d 72 75 6e 73 29 0a 09 20 20 20 20  move-runs)..    
a6e0: 20 20 20 28 6c 65 74 20 28 28 72 65 6d 74 65 73     (let ((remtes
a6f0: 74 73 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f  ts (open-run-clo
a700: 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 73 2d  se db:get-tests-
a710: 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 62 3a 67  for-run db (db:g
a720: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64  et-value-by-head
a730: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 69  er run header "i
a740: 64 22 29 20 23 66 20 27 28 22 44 45 4c 45 54 45  d") #f '("DELETE
a750: 44 22 29 20 27 28 22 6e 2f 61 22 29 20 6e 6f 74  D") '("n/a") not
a760: 2d 69 6e 3a 20 23 74 29 29 29 0a 09 09 20 28 69  -in: #t)))... (i
a770: 66 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74  f (null? remtest
a780: 73 29 20 3b 3b 20 6e 6f 20 6d 6f 72 65 20 74 65  s) ;; no more te
a790: 73 74 73 20 72 65 6d 61 69 6e 69 6e 67 0a 09 09  sts remaining...
a7a0: 20 20 20 20 20 28 6c 65 74 2a 20 28 28 64 70 61       (let* ((dpa
a7b0: 72 74 73 20 20 28 73 74 72 69 6e 67 2d 73 70 6c  rts  (string-spl
a7c0: 69 74 20 6c 61 73 74 74 70 61 74 68 20 22 2f 22  it lasttpath "/"
a7d0: 29 29 0a 09 09 09 20 20 20 20 28 72 75 6e 70 61  ))....    (runpa
a7e0: 74 68 20 28 63 6f 6e 63 20 22 2f 22 20 28 73 74  th (conc "/" (st
a7f0: 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65  ring-intersperse
a800: 20 0a 09 09 09 09 09 09 28 74 61 6b 65 20 64 70   .......(take dp
a810: 61 72 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 20  arts (- (length 
a820: 64 70 61 72 74 73 29 20 31 29 29 0a 09 09 09 09  dparts) 1)).....
a830: 09 09 22 2f 22 29 29 29 29 0a 09 09 20 20 20 20  .."/"))))...    
a840: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
a850: 31 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 3a  1 "Removing run:
a860: 20 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64   " runkey " " (d
a870: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68  b:get-value-by-h
a880: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72  eader run header
a890: 20 22 72 75 6e 6e 61 6d 65 22 29 20 22 20 61 6e   "runname") " an
a8a0: 64 20 72 65 6c 61 74 65 64 20 72 65 63 6f 72 64  d related record
a8b0: 22 29 0a 09 09 20 20 20 20 20 20 20 28 6f 70 65  ")...       (ope
a8c0: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64  n-run-close db:d
a8d0: 65 6c 65 74 65 2d 72 75 6e 20 64 62 20 72 75 6e  elete-run db run
a8e0: 2d 69 64 29 0a 09 09 20 20 20 20 20 20 20 3b 3b  -id)...       ;;
a8f0: 20 54 68 69 73 20 69 73 20 61 20 70 72 65 74 74   This is a prett
a900: 79 20 67 6f 6f 64 20 70 6c 61 63 65 20 74 6f 20  y good place to 
a910: 70 75 72 67 65 20 6f 6c 64 20 44 45 4c 45 54 45  purge old DELETE
a920: 44 20 74 65 73 74 73 0a 09 09 20 20 20 20 20 20  D tests...      
a930: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
a940: 20 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 73   db:delete-tests
a950: 2d 66 6f 72 2d 72 75 6e 20 64 62 20 72 75 6e 2d  -for-run db run-
a960: 69 64 29 0a 09 09 20 20 20 20 20 20 20 28 6f 70  id)...       (op
a970: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a  en-run-close db:
a980: 64 65 6c 65 74 65 2d 6f 6c 64 2d 64 65 6c 65 74  delete-old-delet
a990: 65 64 2d 74 65 73 74 2d 72 65 63 6f 72 64 73 20  ed-test-records 
a9a0: 64 62 29 0a 09 09 20 20 20 20 20 20 20 28 6f 70  db)...       (op
a9b0: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a  en-run-close db:
a9c0: 73 65 74 2d 76 61 72 20 64 62 20 22 44 45 4c 45  set-var db "DELE
a9d0: 54 45 44 5f 54 45 53 54 53 22 20 28 63 75 72 72  TED_TESTS" (curr
a9e0: 65 6e 74 2d 73 65 63 6f 6e 64 73 29 29 0a 09 09  ent-seconds))...
a9f0: 20 20 20 20 20 20 20 3b 3b 20 6e 65 65 64 20 74         ;; need t
aa00: 6f 20 66 69 67 75 72 65 20 6f 75 74 20 74 68 65  o figure out the
aa10: 20 70 61 74 68 20 74 6f 20 74 68 65 20 72 75 6e   path to the run
aa20: 20 64 69 72 20 61 6e 64 20 72 65 6d 6f 76 65 20   dir and remove 
aa30: 69 74 20 69 66 20 65 6d 70 74 79 0a 09 09 20 20  it if empty...  
aa40: 20 20 20 20 20 3b 3b 20 20 20 20 28 69 66 20 28       ;;    (if (
aa50: 6e 75 6c 6c 3f 20 28 67 6c 6f 62 20 28 63 6f 6e  null? (glob (con
aa60: 63 20 72 75 6e 70 61 74 68 20 22 2f 2a 22 29 29  c runpath "/*"))
aa70: 29 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 20 20  )...       ;;   
aa80: 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20       (begin...  
aa90: 20 20 20 20 20 3b 3b 20 09 20 28 64 65 62 75 67       ;; . (debug
aaa0: 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69  :print 1 "Removi
aab0: 6e 67 20 72 75 6e 20 64 69 72 20 22 20 72 75 6e  ng run dir " run
aac0: 70 61 74 68 29 0a 09 09 20 20 20 20 20 20 20 3b  path)...       ;
aad0: 3b 20 09 20 28 73 79 73 74 65 6d 20 28 63 6f 6e  ; . (system (con
aae0: 63 20 22 72 6d 64 69 72 20 2d 70 20 22 20 72 75  c "rmdir -p " ru
aaf0: 6e 70 61 74 68 29 29 29 29 0a 09 09 20 20 20 20  npath))))...    
ab00: 20 20 20 29 29 29 29 29 0a 09 20 29 29 0a 20 20     ))))).. )).  
ab10: 20 20 20 72 75 6e 73 29 29 0a 20 20 23 74 29 0a     runs)).  #t).
ab20: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  .;;=============
ab30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
ab40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
ab50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
ab60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 75  =========.;; Rou
ab70: 74 69 6e 65 73 20 66 6f 72 20 6d 61 6e 69 70 75  tines for manipu
ab80: 6c 61 74 69 6e 67 20 72 75 6e 73 0a 3b 3b 3d 3d  lating runs.;;==
ab90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
aba0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
abb0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
abc0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
abd0: 3d 3d 3d 3d 0a 0a 3b 3b 20 53 69 6e 63 65 20 6d  ====..;; Since m
abe0: 61 6e 79 20 63 61 6c 6c 73 20 74 6f 20 61 20 72  any calls to a r
abf0: 75 6e 20 72 65 71 75 69 72 65 20 70 72 65 74 74  un require prett
ac00: 79 20 6d 75 63 68 20 74 68 65 20 73 61 6d 65 20  y much the same 
ac10: 73 65 74 75 70 20 0a 3b 3b 20 74 68 69 73 20 77  setup .;; this w
ac20: 72 61 70 70 65 72 20 69 73 20 75 73 65 64 20 74  rapper is used t
ac30: 6f 20 72 65 64 75 63 65 20 74 68 65 20 72 65 70  o reduce the rep
ac40: 6c 69 63 61 74 69 6f 6e 20 6f 66 20 63 6f 64 65  lication of code
ac50: 0a 28 64 65 66 69 6e 65 20 28 67 65 6e 65 72 61  .(define (genera
ac60: 6c 2d 72 75 6e 2d 63 61 6c 6c 20 73 77 69 74 63  l-run-call switc
ac70: 68 6e 61 6d 65 20 61 63 74 69 6f 6e 2d 64 65 73  hname action-des
ac80: 63 20 70 72 6f 63 29 0a 20 20 28 6c 65 74 20 28  c proc).  (let (
ac90: 28 72 75 6e 6e 61 6d 65 20 28 61 72 67 73 3a 67  (runname (args:g
aca0: 65 74 2d 61 72 67 20 22 3a 72 75 6e 6e 61 6d 65  et-arg ":runname
acb0: 22 29 29 0a 09 28 74 61 72 67 65 74 20 20 28 69  "))..(target  (i
acc0: 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20  f (args:get-arg 
acd0: 22 2d 74 61 72 67 65 74 22 29 0a 09 09 20 20 20  "-target")...   
ace0: 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20    (args:get-arg 
acf0: 22 2d 74 61 72 67 65 74 22 29 0a 09 09 20 20 20  "-target")...   
ad00: 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20    (args:get-arg 
ad10: 22 2d 72 65 71 74 61 72 67 22 29 29 29 0a 09 28  "-reqtarg")))..(
ad20: 74 68 31 20 20 20 20 20 23 66 29 29 0a 20 20 20  th1     #f)).   
ad30: 20 28 63 6f 6e 64 0a 20 20 20 20 20 28 28 6e 6f   (cond.     ((no
ad40: 74 20 74 61 72 67 65 74 29 0a 20 20 20 20 20 20  t target).      
ad50: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
ad60: 45 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67 20 72  ERROR: Missing r
ad70: 65 71 75 69 72 65 64 20 70 61 72 61 6d 65 74 65  equired paramete
ad80: 72 20 66 6f 72 20 22 20 73 77 69 74 63 68 6e 61  r for " switchna
ad90: 6d 65 20 22 2c 20 79 6f 75 20 6d 75 73 74 20 73  me ", you must s
ada0: 70 65 63 69 66 79 20 74 68 65 20 74 61 72 67 65  pecify the targe
adb0: 74 20 77 69 74 68 20 2d 74 61 72 67 65 74 22 29  t with -target")
adc0: 0a 20 20 20 20 20 20 28 65 78 69 74 20 33 29 29  .      (exit 3))
add0: 0a 20 20 20 20 20 28 28 6e 6f 74 20 72 75 6e 6e  .     ((not runn
ade0: 61 6d 65 29 0a 20 20 20 20 20 20 28 64 65 62 75  ame).      (debu
adf0: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52  g:print 0 "ERROR
ae00: 3a 20 4d 69 73 73 69 6e 67 20 72 65 71 75 69 72  : Missing requir
ae10: 65 64 20 70 61 72 61 6d 65 74 65 72 20 66 6f 72  ed parameter for
ae20: 20 22 20 73 77 69 74 63 68 6e 61 6d 65 20 22 2c   " switchname ",
ae30: 20 79 6f 75 20 6d 75 73 74 20 73 70 65 63 69 66   you must specif
ae40: 79 20 74 68 65 20 72 75 6e 20 6e 61 6d 65 20 77  y the run name w
ae50: 69 74 68 20 3a 72 75 6e 6e 61 6d 65 20 72 75 6e  ith :runname run
ae60: 6e 61 6d 65 22 29 0a 20 20 20 20 20 20 28 65 78  name").      (ex
ae70: 69 74 20 33 29 29 0a 20 20 20 20 20 28 65 6c 73  it 3)).     (els
ae80: 65 0a 20 20 20 20 20 20 28 6c 65 74 20 28 28 64  e.      (let ((d
ae90: 62 20 20 20 23 66 29 0a 09 20 20 20 20 28 6b 65  b   #f)..    (ke
aea0: 79 73 20 23 66 29 29 0a 09 28 69 66 20 28 6e 6f  ys #f))..(if (no
aeb0: 74 20 28 73 65 74 75 70 2d 66 6f 72 2d 72 75 6e  t (setup-for-run
aec0: 29 29 0a 09 20 20 20 20 28 62 65 67 69 6e 20 0a  ))..    (begin .
aed0: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72  .      (debug:pr
aee0: 69 6e 74 20 30 20 22 46 61 69 6c 65 64 20 74 6f  int 0 "Failed to
aef0: 20 73 65 74 75 70 2c 20 65 78 69 74 69 6e 67 22   setup, exiting"
af00: 29 0a 09 20 20 20 20 20 20 28 65 78 69 74 20 31  )..      (exit 1
af10: 29 29 29 0a 09 28 69 66 20 28 61 72 67 73 3a 67  )))..(if (args:g
af20: 65 74 2d 61 72 67 20 22 2d 73 65 72 76 65 72 22  et-arg "-server"
af30: 29 0a 09 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e  )..    (open-run
af40: 2d 63 6c 6f 73 65 20 73 65 72 76 65 72 3a 73 74  -close server:st
af50: 61 72 74 20 64 62 20 28 61 72 67 73 3a 67 65 74  art db (args:get
af60: 2d 61 72 67 20 22 2d 73 65 72 76 65 72 22 29 29  -arg "-server"))
af70: 29 0a 20 09 20 20 20 20 3b 3b 20 28 69 66 20 28  ). .    ;; (if (
af80: 6e 6f 74 20 28 6f 72 20 28 61 72 67 73 3a 67 65  not (or (args:ge
af90: 74 2d 61 72 67 20 22 2d 72 75 6e 61 6c 6c 22 29  t-arg "-runall")
afa0: 20 20 20 20 20 3b 3b 20 72 75 6e 61 6c 6c 20 61       ;; runall a
afb0: 6e 64 20 72 75 6e 74 65 73 74 73 20 61 72 65 20  nd runtests are 
afc0: 61 6c 6c 6f 77 65 64 20 74 6f 20 62 65 20 73 65  allowed to be se
afd0: 72 76 65 72 73 0a 20 09 20 20 20 20 3b 3b 20 20  rvers. .    ;;  
afe0: 20 20 20 09 20 28 61 72 67 73 3a 67 65 74 2d 61     . (args:get-a
aff0: 72 67 20 22 2d 72 75 6e 74 65 73 74 73 22 29 29  rg "-runtests"))
b000: 29 0a 09 20 20 20 20 3b 3b 20 20 20 20 20 28 63  )..    ;;     (c
b010: 6c 69 65 6e 74 3a 73 65 74 75 70 29 20 3b 3b 20  lient:setup) ;; 
b020: 54 68 69 73 20 69 73 20 61 20 64 75 70 6c 69 63  This is a duplic
b030: 61 74 65 20 73 74 61 72 74 75 70 21 21 21 3f 3f  ate startup!!!??
b040: 3f 20 42 55 47 3f 0a 09 20 20 20 20 3b 3b 20 20  ? BUG?..    ;;  
b050: 20 20 20 29 29 0a 09 28 73 65 74 21 20 6b 65 79     ))..(set! key
b060: 73 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73  s (open-run-clos
b070: 65 20 64 62 3a 67 65 74 2d 6b 65 79 73 20 64 62  e db:get-keys db
b080: 29 29 0a 09 3b 3b 20 68 61 76 65 20 65 6e 6f 75  ))..;; have enou
b090: 67 68 20 74 6f 20 70 72 6f 63 65 73 73 20 2d 74  gh to process -t
b0a0: 61 72 67 65 74 20 6f 72 20 2d 72 65 71 74 61 72  arget or -reqtar
b0b0: 67 20 68 65 72 65 0a 09 28 69 66 20 28 61 72 67  g here..(if (arg
b0c0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74  s:get-arg "-reqt
b0d0: 61 72 67 22 29 0a 09 20 20 20 20 28 6c 65 74 2a  arg")..    (let*
b0e0: 20 28 28 72 75 6e 63 6f 6e 66 69 67 66 20 28 63   ((runconfigf (c
b0f0: 6f 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a 20 22  onc  *toppath* "
b100: 2f 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66  /runconfigs.conf
b110: 69 67 22 29 29 20 3b 3b 20 44 4f 20 4e 4f 54 20  ig")) ;; DO NOT 
b120: 45 56 41 4c 55 41 54 45 20 41 4c 4c 20 0a 09 09  EVALUATE ALL ...
b130: 20 20 20 28 72 75 6e 63 6f 6e 66 69 67 20 20 28     (runconfig  (
b140: 72 65 61 64 2d 63 6f 6e 66 69 67 20 72 75 6e 63  read-config runc
b150: 6f 6e 66 69 67 66 20 23 66 20 23 74 20 65 6e 76  onfigf #f #t env
b160: 69 72 6f 6e 2d 70 61 74 74 3a 20 23 66 29 29 29  iron-patt: #f)))
b170: 20 0a 09 20 20 20 20 20 20 28 69 66 20 28 68 61   ..      (if (ha
b180: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66  sh-table-ref/def
b190: 61 75 6c 74 20 72 75 6e 63 6f 6e 66 69 67 20 28  ault runconfig (
b1a0: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72  args:get-arg "-r
b1b0: 65 71 74 61 72 67 22 29 20 23 66 29 0a 09 09 20  eqtarg") #f)... 
b1c0: 20 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 73 65   (keys:target-se
b1d0: 74 2d 61 72 67 73 20 6b 65 79 73 20 28 61 72 67  t-args keys (arg
b1e0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74  s:get-arg "-reqt
b1f0: 61 72 67 22 29 20 61 72 67 73 3a 61 72 67 2d 68  arg") args:arg-h
b200: 61 73 68 29 0a 09 09 20 20 28 62 65 67 69 6e 0a  ash)...  (begin.
b210: 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ..    (debug:pri
b220: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 5b 22 20  nt 0 "ERROR: [" 
b230: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
b240: 72 65 71 74 61 72 67 22 29 20 22 5d 20 6e 6f 74  reqtarg") "] not
b250: 20 66 6f 75 6e 64 20 69 6e 20 22 20 72 75 6e 63   found in " runc
b260: 6f 6e 66 69 67 66 29 0a 09 09 20 20 20 20 28 69  onfigf)...    (i
b270: 66 20 64 62 20 28 73 71 6c 69 74 65 33 3a 66 69  f db (sqlite3:fi
b280: 6e 61 6c 69 7a 65 21 20 64 62 29 29 0a 09 09 20  nalize! db))... 
b290: 20 20 20 28 65 78 69 74 20 31 29 29 29 29 0a 09     (exit 1))))..
b2a0: 20 20 20 20 28 69 66 20 28 61 72 67 73 3a 67 65      (if (args:ge
b2b0: 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 29  t-arg "-target")
b2c0: 0a 09 09 28 6b 65 79 73 3a 74 61 72 67 65 74 2d  ...(keys:target-
b2d0: 73 65 74 2d 61 72 67 73 20 6b 65 79 73 20 28 61  set-args keys (a
b2e0: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61  rgs:get-arg "-ta
b2f0: 72 67 65 74 22 20 61 72 67 73 3a 61 72 67 2d 68  rget" args:arg-h
b300: 61 73 68 29 20 61 72 67 73 3a 61 72 67 2d 68 61  ash) args:arg-ha
b310: 73 68 29 29 29 0a 09 28 69 66 20 28 6e 6f 74 20  sh)))..(if (not 
b320: 28 63 61 72 20 2a 63 6f 6e 66 69 67 69 6e 66 6f  (car *configinfo
b330: 2a 29 29 0a 09 20 20 20 20 28 62 65 67 69 6e 0a  *))..    (begin.
b340: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72  .      (debug:pr
b350: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 41 74  int 0 "ERROR: At
b360: 74 65 6d 70 74 65 64 20 74 6f 20 22 20 61 63 74  tempted to " act
b370: 69 6f 6e 2d 64 65 73 63 20 22 20 62 75 74 20 72  ion-desc " but r
b380: 75 6e 20 61 72 65 61 20 63 6f 6e 66 69 67 20 66  un area config f
b390: 69 6c 65 20 6e 6f 74 20 66 6f 75 6e 64 22 29 0a  ile not found").
b3a0: 09 20 20 20 20 20 20 28 65 78 69 74 20 31 29 29  .      (exit 1))
b3b0: 0a 09 20 20 20 20 3b 3b 20 45 78 74 72 61 63 74  ..    ;; Extract
b3c0: 20 6f 75 74 20 73 74 75 66 66 20 6e 65 65 64 65   out stuff neede
b3d0: 64 20 69 6e 20 6d 6f 73 74 20 6f 72 20 6d 61 6e  d in most or man
b3e0: 79 20 63 61 6c 6c 73 0a 09 20 20 20 20 3b 3b 20  y calls..    ;; 
b3f0: 68 65 72 65 20 74 68 65 6e 20 63 61 6c 6c 20 70  here then call p
b400: 72 6f 63 0a 09 20 20 20 20 28 6c 65 74 2a 20 28  roc..    (let* (
b410: 28 6b 65 79 6e 61 6d 65 73 20 20 20 28 6d 61 70  (keynames   (map
b420: 20 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61   key:get-fieldna
b430: 6d 65 20 6b 65 79 73 29 29 0a 09 09 20 20 20 28  me keys))...   (
b440: 6b 65 79 76 61 6c 6c 73 74 20 20 28 6b 65 79 73  keyvallst  (keys
b450: 2d 3e 76 61 6c 6c 69 73 74 20 6b 65 79 73 20 23  ->vallist keys #
b460: 74 29 29 29 0a 09 20 20 20 20 20 20 28 70 72 6f  t)))..      (pro
b470: 63 20 74 61 72 67 65 74 20 72 75 6e 6e 61 6d 65  c target runname
b480: 20 6b 65 79 73 20 6b 65 79 6e 61 6d 65 73 20 6b   keys keynames k
b490: 65 79 76 61 6c 6c 73 74 29 29 29 0a 09 28 69 66  eyvallst)))..(if
b4a0: 20 74 68 31 20 28 74 68 72 65 61 64 2d 6a 6f 69   th1 (thread-joi
b4b0: 6e 21 20 74 68 31 29 29 0a 09 28 69 66 20 64 62  n! th1))..(if db
b4c0: 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69   (sqlite3:finali
b4d0: 7a 65 21 20 64 62 29 29 0a 09 28 73 65 74 21 20  ze! db))..(set! 
b4e0: 2a 64 69 64 73 6f 6d 65 74 68 69 6e 67 2a 20 23  *didsomething* #
b4f0: 74 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d  t))))))..;;=====
b500: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b510: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b520: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b530: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b540: 3d 0a 3b 3b 20 4c 6f 63 6b 2f 75 6e 6c 6f 63 6b  =.;; Lock/unlock
b550: 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d   runs.;;========
b560: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b570: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b580: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b590: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a  ==============..
b5a0: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 68 61  (define (runs:ha
b5b0: 6e 64 6c 65 2d 6c 6f 63 6b 69 6e 67 20 74 61 72  ndle-locking tar
b5c0: 67 65 74 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65  get keys runname
b5d0: 20 6c 6f 63 6b 20 75 6e 6c 6f 63 6b 20 75 73 65   lock unlock use
b5e0: 72 29 0a 20 20 28 6c 65 74 2a 20 28 28 64 62 20  r).  (let* ((db 
b5f0: 20 20 20 20 20 20 23 66 29 0a 09 20 28 72 75 6e        #f).. (run
b600: 64 61 74 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d  dat   (open-run-
b610: 63 6c 6f 73 65 20 72 75 6e 73 3a 67 65 74 2d 72  close runs:get-r
b620: 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20 6b  uns-by-patt db k
b630: 65 79 73 20 72 75 6e 6e 61 6d 65 29 29 0a 09 20  eys runname)).. 
b640: 28 68 65 61 64 65 72 20 20 20 28 76 65 63 74 6f  (header   (vecto
b650: 72 2d 72 65 66 20 72 75 6e 64 61 74 20 30 29 29  r-ref rundat 0))
b660: 0a 09 20 28 72 75 6e 73 20 20 20 20 20 28 76 65  .. (runs     (ve
b670: 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20  ctor-ref rundat 
b680: 31 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61  1))).    (for-ea
b690: 63 68 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 29  ch (lambda (run)
b6a0: 0a 09 09 28 6c 65 74 20 28 28 72 75 6e 2d 69 64  ...(let ((run-id
b6b0: 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62   (db:get-value-b
b6c0: 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61  y-header run hea
b6d0: 64 65 72 20 22 69 64 22 29 29 29 0a 09 09 20 20  der "id")))...  
b6e0: 28 69 66 20 28 6f 72 20 6c 6f 63 6b 0a 09 09 09  (if (or lock....
b6f0: 20 20 28 61 6e 64 20 75 6e 6c 6f 63 6b 0a 09 09    (and unlock...
b700: 09 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09  .       (begin..
b710: 09 09 09 20 28 70 72 69 6e 74 20 22 44 6f 20 79  ... (print "Do y
b720: 6f 75 20 72 65 61 6c 6c 79 20 77 69 73 68 20 74  ou really wish t
b730: 6f 20 75 6e 6c 6f 63 6b 20 72 75 6e 20 22 20 72  o unlock run " r
b740: 75 6e 2d 69 64 20 22 3f 5c 6e 20 20 20 79 2f 6e  un-id "?\n   y/n
b750: 3a 20 22 29 0a 09 09 09 09 20 28 65 71 75 61 6c  : ")..... (equal
b760: 3f 20 22 79 22 20 28 72 65 61 64 2d 6c 69 6e 65  ? "y" (read-line
b770: 29 29 29 29 29 0a 09 09 20 20 20 20 20 20 28 6f  )))))...      (o
b780: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62  pen-run-close db
b790: 3a 6c 6f 63 6b 2f 75 6e 6c 6f 63 6b 2d 72 75 6e  :lock/unlock-run
b7a0: 20 64 62 20 72 75 6e 2d 69 64 20 6c 6f 63 6b 20   db run-id lock 
b7b0: 75 6e 6c 6f 63 6b 20 75 73 65 72 29 0a 09 09 20  unlock user)... 
b7c0: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
b7d0: 74 2d 69 6e 66 6f 20 30 20 22 53 6b 69 70 70 69  t-info 0 "Skippi
b7e0: 6e 67 20 6c 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 6f  ng lock/unlock o
b7f0: 6e 20 22 20 72 75 6e 2d 69 64 29 29 29 29 0a 09  n " run-id))))..
b800: 20 20 20 20 20 20 72 75 6e 73 29 29 29 0a 3b 3b        runs))).;;
b810: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b820: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b830: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b840: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b850: 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 6c 6c 75 70  ======.;; Rollup
b860: 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d   runs.;;========
b870: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b880: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b890: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b8a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a  ==============..
b8b0: 3b 3b 20 55 70 64 61 74 65 20 74 68 65 20 74 65  ;; Update the te
b8c0: 73 74 5f 6d 65 74 61 20 74 61 62 6c 65 20 66 6f  st_meta table fo
b8d0: 72 20 74 68 69 73 20 74 65 73 74 0a 28 64 65 66  r this test.(def
b8e0: 69 6e 65 20 28 72 75 6e 73 3a 75 70 64 61 74 65  ine (runs:update
b8f0: 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20 74 65  -test_meta db te
b900: 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e  st-name test-con
b910: 66 29 0a 20 20 28 6c 65 74 20 28 28 63 75 72 72  f).  (let ((curr
b920: 72 65 63 6f 72 64 20 28 6f 70 65 6e 2d 72 75 6e  record (open-run
b930: 2d 63 6c 6f 73 65 20 64 62 3a 74 65 73 74 6d 65  -close db:testme
b940: 74 61 2d 67 65 74 2d 72 65 63 6f 72 64 20 64 62  ta-get-record db
b950: 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20   test-name))).  
b960: 20 20 28 69 66 20 28 6e 6f 74 20 63 75 72 72 72    (if (not currr
b970: 65 63 6f 72 64 29 0a 09 28 62 65 67 69 6e 0a 09  ecord)..(begin..
b980: 20 20 28 73 65 74 21 20 63 75 72 72 72 65 63 6f    (set! currreco
b990: 72 64 20 28 6d 61 6b 65 2d 76 65 63 74 6f 72 20  rd (make-vector 
b9a0: 31 30 20 23 66 29 29 0a 09 20 20 28 6f 70 65 6e  10 #f))..  (open
b9b0: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 74 65  -run-close db:te
b9c0: 73 74 6d 65 74 61 2d 61 64 64 2d 72 65 63 6f 72  stmeta-add-recor
b9d0: 64 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 29 29  d db test-name))
b9e0: 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20  ).    (for-each 
b9f0: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6b  .     (lambda (k
ba00: 65 79 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a  ey).       (let*
ba10: 20 28 28 69 64 78 20 28 63 61 64 72 20 6b 65 79   ((idx (cadr key
ba20: 29 29 0a 09 20 20 20 20 20 20 28 66 6c 64 20 28  ))..      (fld (
ba30: 63 61 72 20 20 6b 65 79 29 29 0a 09 20 20 20 20  car  key))..    
ba40: 20 20 28 76 61 6c 20 28 63 6f 6e 66 69 67 2d 6c    (val (config-l
ba50: 6f 6f 6b 75 70 20 74 65 73 74 2d 63 6f 6e 66 20  ookup test-conf 
ba60: 22 74 65 73 74 5f 6d 65 74 61 22 20 66 6c 64 29  "test_meta" fld)
ba70: 29 29 0a 09 20 3b 3b 20 28 64 65 62 75 67 3a 70  )).. ;; (debug:p
ba80: 72 69 6e 74 20 35 20 22 69 64 78 3a 20 22 20 69  rint 5 "idx: " i
ba90: 64 78 20 22 20 66 6c 64 3a 20 22 20 66 6c 64 20  dx " fld: " fld 
baa0: 22 20 76 61 6c 3a 20 22 20 76 61 6c 29 0a 09 20  " val: " val).. 
bab0: 28 69 66 20 28 61 6e 64 20 76 61 6c 20 28 6e 6f  (if (and val (no
bac0: 74 20 28 65 71 75 61 6c 3f 20 28 76 65 63 74 6f  t (equal? (vecto
bad0: 72 2d 72 65 66 20 63 75 72 72 72 65 63 6f 72 64  r-ref currrecord
bae0: 20 69 64 78 29 20 76 61 6c 29 29 29 0a 09 20 20   idx) val)))..  
baf0: 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20     (begin..     
bb00: 20 20 28 70 72 69 6e 74 20 22 55 70 64 61 74 69    (print "Updati
bb10: 6e 67 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22  ng " test-name "
bb20: 20 22 20 66 6c 64 20 22 20 74 6f 20 22 20 76 61   " fld " to " va
bb30: 6c 29 0a 09 20 20 20 20 20 20 20 28 6f 70 65 6e  l)..       (open
bb40: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 74 65  -run-close db:te
bb50: 73 74 6d 65 74 61 2d 75 70 64 61 74 65 2d 66 69  stmeta-update-fi
bb60: 65 6c 64 20 64 62 20 74 65 73 74 2d 6e 61 6d 65  eld db test-name
bb70: 20 66 6c 64 20 76 61 6c 29 29 29 29 29 0a 20 20   fld val))))).  
bb80: 20 20 20 27 28 28 22 61 75 74 68 6f 72 22 20 32     '(("author" 2
bb90: 29 28 22 6f 77 6e 65 72 22 20 33 29 28 22 64 65  )("owner" 3)("de
bba0: 73 63 72 69 70 74 69 6f 6e 22 20 34 29 28 22 72  scription" 4)("r
bbb0: 65 76 69 65 77 65 64 22 20 35 29 28 22 74 61 67  eviewed" 5)("tag
bbc0: 73 22 20 39 29 29 29 29 29 0a 0a 3b 3b 20 55 70  s" 9)))))..;; Up
bbd0: 64 61 74 65 20 74 65 73 74 5f 6d 65 74 61 20 66  date test_meta f
bbe0: 6f 72 20 61 6c 6c 20 74 65 73 74 73 0a 28 64 65  or all tests.(de
bbf0: 66 69 6e 65 20 28 72 75 6e 73 3a 75 70 64 61 74  fine (runs:updat
bc00: 65 2d 61 6c 6c 2d 74 65 73 74 5f 6d 65 74 61 20  e-all-test_meta 
bc10: 64 62 29 0a 20 20 28 6c 65 74 20 28 28 74 65 73  db).  (let ((tes
bc20: 74 2d 6e 61 6d 65 73 20 28 67 65 74 2d 61 6c 6c  t-names (get-all
bc30: 2d 6c 65 67 61 6c 2d 74 65 73 74 73 29 29 29 0a  -legal-tests))).
bc40: 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20      (for-each . 
bc50: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73      (lambda (tes
bc60: 74 2d 6e 61 6d 65 29 0a 20 20 20 20 20 20 20 28  t-name).       (
bc70: 6c 65 74 2a 20 28 28 74 65 73 74 2d 70 61 74 68  let* ((test-path
bc80: 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61      (conc *toppa
bc90: 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 20 74 65  th* "/tests/" te
bca0: 73 74 2d 6e 61 6d 65 29 29 0a 09 20 20 20 20 20  st-name))..     
bcb0: 20 28 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 28   (test-configf (
bcc0: 63 6f 6e 63 20 74 65 73 74 2d 70 61 74 68 20 22  conc test-path "
bcd0: 2f 74 65 73 74 63 6f 6e 66 69 67 22 29 29 0a 09  /testconfig"))..
bce0: 20 20 20 20 20 20 28 74 65 73 74 65 78 69 73 74        (testexist
bcf0: 73 20 20 20 28 61 6e 64 20 28 66 69 6c 65 2d 65  s   (and (file-e
bd00: 78 69 73 74 73 3f 20 74 65 73 74 2d 63 6f 6e 66  xists? test-conf
bd10: 69 67 66 29 28 66 69 6c 65 2d 72 65 61 64 2d 61  igf)(file-read-a
bd20: 63 63 65 73 73 3f 20 74 65 73 74 2d 63 6f 6e 66  ccess? test-conf
bd30: 69 67 66 29 29 29 0a 09 20 20 20 20 20 20 3b 3b  igf)))..      ;;
bd40: 20 72 65 61 64 20 63 6f 6e 66 69 67 73 20 77 69   read configs wi
bd50: 74 68 20 74 72 69 63 6b 73 20 74 75 72 6e 65 64  th tricks turned
bd60: 20 6f 66 66 20 28 69 2e 65 2e 20 6e 6f 20 73 79   off (i.e. no sy
bd70: 73 74 65 6d 29 0a 09 20 20 20 20 20 20 28 74 65  stem)..      (te
bd80: 73 74 2d 63 6f 6e 66 20 20 20 20 28 69 66 20 74  st-conf    (if t
bd90: 65 73 74 65 78 69 73 74 73 20 28 72 65 61 64 2d  estexists (read-
bda0: 63 6f 6e 66 69 67 20 74 65 73 74 2d 63 6f 6e 66  config test-conf
bdb0: 69 67 66 20 23 66 20 23 66 29 28 6d 61 6b 65 2d  igf #f #f)(make-
bdc0: 68 61 73 68 2d 74 61 62 6c 65 29 29 29 29 0a 09  hash-table))))..
bdd0: 20 3b 3b 20 75 73 65 20 74 68 65 20 6f 70 65 6e   ;; use the open
bde0: 2d 72 75 6e 2d 63 6c 6f 73 65 20 69 6e 73 74 65  -run-close inste
bdf0: 61 64 20 6f 66 20 70 61 73 73 69 6e 67 20 69 6e  ad of passing in
be00: 20 64 62 0a 09 20 28 72 75 6e 73 3a 75 70 64 61   db.. (runs:upda
be10: 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 23 66 20  te-test_meta #f 
be20: 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63  test-name test-c
be30: 6f 6e 66 29 29 29 0a 20 20 20 20 20 74 65 73 74  onf))).     test
be40: 2d 6e 61 6d 65 73 29 29 29 0a 0a 3b 3b 20 54 68  -names)))..;; Th
be50: 69 73 20 63 6f 75 6c 64 20 70 72 6f 62 61 62 6c  is could probabl
be60: 79 20 62 65 20 72 65 66 61 63 74 6f 72 65 64 20  y be refactored 
be70: 69 6e 74 6f 20 6f 6e 65 20 63 6f 6d 70 6c 65 78  into one complex
be80: 20 71 75 65 72 79 20 2e 2e 2e 0a 28 64 65 66 69   query ....(defi
be90: 6e 65 20 28 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d  ne (runs:rollup-
bea0: 72 75 6e 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c  run keys keyvall
beb0: 73 74 20 72 75 6e 6e 61 6d 65 20 75 73 65 72 29  st runname user)
bec0: 20 3b 3b 20 77 61 73 20 74 61 72 67 65 74 2c 20   ;; was target, 
bed0: 6e 6f 77 20 6b 65 79 76 61 6c 6c 73 74 0a 20 20  now keyvallst.  
bee0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22  (debug:print 4 "
bef0: 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 2c  runs:rollup-run,
bf00: 20 6b 65 79 73 3a 20 22 20 6b 65 79 73 20 22 20   keys: " keys " 
bf10: 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65 79  keyvallst: " key
bf20: 76 61 6c 6c 73 74 20 22 20 3a 72 75 6e 6e 61 6d  vallst " :runnam
bf30: 65 20 22 20 72 75 6e 6e 61 6d 65 20 22 20 75 73  e " runname " us
bf40: 65 72 3a 20 22 20 75 73 65 72 29 0a 20 20 28 6c  er: " user).  (l
bf50: 65 74 2a 20 28 28 64 62 20 20 20 20 20 20 20 20  et* ((db        
bf60: 20 20 20 20 20 20 23 66 29 20 3b 3b 20 28 6b 65        #f) ;; (ke
bf70: 79 76 61 6c 6c 6c 73 74 20 20 20 20 20 20 28 6b  yvalllst      (k
bf80: 65 79 73 3a 74 61 72 67 65 74 2d 3e 6b 65 79 76  eys:target->keyv
bf90: 61 6c 20 6b 65 79 73 20 74 61 72 67 65 74 29 29  al keys target))
bfa0: 0a 09 20 28 6e 65 77 2d 72 75 6e 2d 69 64 20 20  .. (new-run-id  
bfb0: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c      (open-run-cl
bfc0: 6f 73 65 20 72 75 6e 73 3a 72 65 67 69 73 74 65  ose runs:registe
bfd0: 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65  r-run db keys ke
bfe0: 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20  yvallst runname 
bff0: 22 6e 65 77 22 20 22 6e 2f 61 22 20 75 73 65 72  "new" "n/a" user
c000: 29 29 0a 09 20 28 70 72 65 76 2d 74 65 73 74 73  )).. (prev-tests
c010: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d        (open-run-
c020: 63 6c 6f 73 65 20 74 65 73 74 3a 67 65 74 2d 6d  close test:get-m
c030: 61 74 63 68 69 6e 67 2d 70 72 65 76 69 6f 75 73  atching-previous
c040: 2d 74 65 73 74 2d 72 75 6e 2d 72 65 63 6f 72 64  -test-run-record
c050: 73 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20  s db new-run-id 
c060: 22 25 22 20 22 25 22 29 29 0a 09 20 28 63 75 72  "%" "%")).. (cur
c070: 72 2d 74 65 73 74 73 20 20 20 20 20 20 28 6f 70  r-tests      (op
c080: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a  en-run-close db:
c090: 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75  get-tests-for-ru
c0a0: 6e 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20  n db new-run-id 
c0b0: 22 25 2f 25 22 20 27 28 29 20 27 28 29 29 29 0a  "%/%" '() '())).
c0c0: 09 20 28 63 75 72 72 2d 74 65 73 74 73 2d 68 61  . (curr-tests-ha
c0d0: 73 68 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61  sh (make-hash-ta
c0e0: 62 6c 65 29 29 29 0a 20 20 20 20 28 6f 70 65 6e  ble))).    (open
c0f0: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 75 70  -run-close db:up
c100: 64 61 74 65 2d 72 75 6e 2d 65 76 65 6e 74 5f 74  date-run-event_t
c110: 69 6d 65 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69  ime db new-run-i
c120: 64 29 0a 20 20 20 20 3b 3b 20 69 6e 64 65 78 20  d).    ;; index 
c130: 74 68 65 20 61 6c 72 65 61 64 79 20 73 61 76 65  the already save
c140: 64 20 74 65 73 74 73 20 62 79 20 74 65 73 74 6e  d tests by testn
c150: 61 6d 65 20 61 6e 64 20 69 74 65 6d 64 61 74 20  ame and itemdat 
c160: 69 6e 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61  in curr-tests-ha
c170: 73 68 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68  sh.    (for-each
c180: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74  .     (lambda (t
c190: 65 73 74 64 61 74 29 0a 20 20 20 20 20 20 20 28  estdat).       (
c1a0: 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 20  let* ((testname 
c1b0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65   (db:test-get-te
c1c0: 73 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29  stname testdat))
c1d0: 0a 09 20 20 20 20 20 20 28 69 74 65 6d 2d 70 61  ..      (item-pa
c1e0: 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  th (db:test-get-
c1f0: 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 64 61  item-path testda
c200: 74 29 29 0a 09 20 20 20 20 20 20 28 66 75 6c 6c  t))..      (full
c210: 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74  -name (conc test
c220: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61  name "/" item-pa
c230: 74 68 29 29 29 0a 09 20 28 68 61 73 68 2d 74 61  th))).. (hash-ta
c240: 62 6c 65 2d 73 65 74 21 20 63 75 72 72 2d 74 65  ble-set! curr-te
c250: 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61  sts-hash full-na
c260: 6d 65 20 74 65 73 74 64 61 74 29 29 29 0a 20 20  me testdat))).  
c270: 20 20 20 63 75 72 72 2d 74 65 73 74 73 29 0a 20     curr-tests). 
c280: 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 4e 6f 6e 2d     ;; NOPE: Non-
c290: 6f 70 74 69 6d 61 6c 20 61 70 70 72 6f 61 63 68  optimal approach
c2a0: 2e 20 54 72 79 20 74 68 69 73 20 69 6e 73 74 65  . Try this inste
c2b0: 61 64 2e 0a 20 20 20 20 3b 3b 20 20 20 31 2e 20  ad..    ;;   1. 
c2c0: 74 65 73 74 73 20 61 72 65 20 72 65 63 65 69 76  tests are receiv
c2d0: 65 64 20 69 6e 20 61 20 6c 69 73 74 2c 20 6d 6f  ed in a list, mo
c2e0: 73 74 20 72 65 63 65 6e 74 20 66 69 72 73 74 0a  st recent first.
c2f0: 20 20 20 20 3b 3b 20 20 20 32 2e 20 72 65 70 6c      ;;   2. repl
c300: 61 63 65 20 74 68 65 20 72 6f 6c 6c 75 70 20 74  ace the rollup t
c310: 65 73 74 20 77 69 74 68 20 74 68 65 20 6e 65 77  est with the new
c320: 20 2a 61 6c 77 61 79 73 2a 0a 20 20 20 20 28 66   *always*.    (f
c330: 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c  or-each .     (l
c340: 61 6d 62 64 61 20 28 74 65 73 74 64 61 74 29 0a  ambda (testdat).
c350: 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74         (let* ((t
c360: 65 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 65 73  estname  (db:tes
c370: 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74  t-get-testname t
c380: 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20  estdat))..      
c390: 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74  (item-path (db:t
c3a0: 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74  est-get-item-pat
c3b0: 68 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20  h testdat))..   
c3c0: 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 63     (full-name (c
c3d0: 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22  onc testname "/"
c3e0: 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 20 20   item-path))..  
c3f0: 20 20 20 20 28 70 72 65 76 2d 74 65 73 74 2d 64      (prev-test-d
c400: 61 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72  at (hash-table-r
c410: 65 66 2f 64 65 66 61 75 6c 74 20 63 75 72 72 2d  ef/default curr-
c420: 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d  tests-hash full-
c430: 6e 61 6d 65 20 23 66 29 29 0a 09 20 20 20 20 20  name #f))..     
c440: 20 28 74 65 73 74 2d 73 74 65 70 73 20 20 20 20   (test-steps    
c450: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73    (open-run-clos
c460: 65 20 64 62 3a 67 65 74 2d 73 74 65 70 73 2d 66  e db:get-steps-f
c470: 6f 72 2d 74 65 73 74 20 64 62 20 28 64 62 3a 74  or-test db (db:t
c480: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64  est-get-id testd
c490: 61 74 29 29 29 0a 09 20 20 20 20 20 20 28 6e 65  at)))..      (ne
c4a0: 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 23 66  w-test-record #f
c4b0: 29 29 0a 09 20 3b 3b 20 72 65 70 6c 61 63 65 20  )).. ;; replace 
c4c0: 74 68 65 73 65 20 77 69 74 68 20 69 6e 73 65 72  these with inser
c4d0: 74 20 2e 2e 2e 20 73 65 6c 65 63 74 0a 09 20 28  t ... select.. (
c4e0: 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a 65 78  apply sqlite3:ex
c4f0: 65 63 75 74 65 20 0a 09 09 64 62 20 0a 09 09 28  ecute ...db ...(
c500: 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20  conc "INSERT OR 
c510: 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 73  REPLACE INTO tes
c520: 74 73 20 28 72 75 6e 5f 69 64 2c 74 65 73 74 6e  ts (run_id,testn
c530: 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73  ame,state,status
c540: 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 68 6f 73 74  ,event_time,host
c550: 2c 63 70 75 6c 6f 61 64 2c 64 69 73 6b 66 72 65  ,cpuload,diskfre
c560: 65 2c 75 6e 61 6d 65 2c 72 75 6e 64 69 72 2c 69  e,uname,rundir,i
c570: 74 65 6d 5f 70 61 74 68 2c 72 75 6e 5f 64 75 72  tem_path,run_dur
c580: 61 74 69 6f 6e 2c 66 69 6e 61 6c 5f 6c 6f 67 66  ation,final_logf
c590: 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20  ,comment) "...  
c5a0: 20 20 20 20 22 56 41 4c 55 45 53 20 28 3f 2c 3f      "VALUES (?,?
c5b0: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f  ,?,?,?,?,?,?,?,?
c5c0: 2c 3f 2c 3f 2c 3f 2c 3f 29 3b 22 29 0a 09 09 6e  ,?,?,?,?);")...n
c5d0: 65 77 2d 72 75 6e 2d 69 64 20 28 63 64 64 72 20  ew-run-id (cddr 
c5e0: 28 76 65 63 74 6f 72 2d 3e 6c 69 73 74 20 74 65  (vector->list te
c5f0: 73 74 64 61 74 29 29 29 0a 09 20 28 73 65 74 21  stdat))).. (set!
c600: 20 6e 65 77 2d 74 65 73 74 64 61 74 20 28 63 61   new-testdat (ca
c610: 72 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73  r (open-run-clos
c620: 65 20 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66  e db:get-tests-f
c630: 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77 2d 72 75  or-run db new-ru
c640: 6e 2d 69 64 20 28 63 6f 6e 63 20 74 65 73 74 6e  n-id (conc testn
c650: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74  ame "/" item-pat
c660: 68 29 20 27 28 29 20 27 28 29 29 29 29 0a 09 20  h) '() '()))).. 
c670: 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21  (hash-table-set!
c680: 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68   curr-tests-hash
c690: 20 66 75 6c 6c 2d 6e 61 6d 65 20 6e 65 77 2d 74   full-name new-t
c6a0: 65 73 74 64 61 74 29 20 3b 3b 20 74 68 69 73 20  estdat) ;; this 
c6b0: 63 6f 75 6c 64 20 62 65 20 63 6f 6e 66 75 73 69  could be confusi
c6c0: 6e 67 2c 20 77 68 69 63 68 20 72 65 63 6f 72 64  ng, which record
c6d0: 20 73 68 6f 75 6c 64 20 67 6f 20 69 6e 74 6f 20   should go into 
c6e0: 74 68 65 20 6c 6f 6f 6b 75 70 20 74 61 62 6c 65  the lookup table
c6f0: 3f 0a 09 20 3b 3b 20 4e 6f 77 20 64 75 70 6c 69  ?.. ;; Now dupli
c700: 63 61 74 65 20 74 68 65 20 74 65 73 74 20 73 74  cate the test st
c710: 65 70 73 0a 09 20 28 64 65 62 75 67 3a 70 72 69  eps.. (debug:pri
c720: 6e 74 20 34 20 22 43 6f 70 79 69 6e 67 20 72 65  nt 4 "Copying re
c730: 63 6f 72 64 73 20 69 6e 20 74 65 73 74 5f 73 74  cords in test_st
c740: 65 70 73 20 66 72 6f 6d 20 74 65 73 74 5f 69 64  eps from test_id
c750: 3d 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  =" (db:test-get-
c760: 69 64 20 74 65 73 74 64 61 74 29 20 22 20 74 6f  id testdat) " to
c770: 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d   " (db:test-get-
c780: 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 29  id new-testdat))
c790: 0a 09 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f  .. (open-run-clo
c7a0: 73 65 20 0a 09 20 20 28 6c 61 6d 62 64 61 20 28  se ..  (lambda (
c7b0: 29 0a 09 20 20 20 20 28 73 71 6c 69 74 65 33 3a  )..    (sqlite3:
c7c0: 65 78 65 63 75 74 65 20 0a 09 20 20 20 20 20 64  execute ..     d
c7d0: 62 20 0a 09 20 20 20 20 20 28 63 6f 6e 63 20 22  b ..     (conc "
c7e0: 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43  INSERT OR REPLAC
c7f0: 45 20 49 4e 54 4f 20 74 65 73 74 5f 73 74 65 70  E INTO test_step
c800: 73 20 28 74 65 73 74 5f 69 64 2c 73 74 65 70 6e  s (test_id,stepn
c810: 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73  ame,state,status
c820: 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d  ,event_time,comm
c830: 65 6e 74 29 20 22 0a 09 09 20 20 20 22 53 45 4c  ent) "...   "SEL
c840: 45 43 54 20 22 20 28 64 62 3a 74 65 73 74 2d 67  ECT " (db:test-g
c850: 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61  et-id new-testda
c860: 74 29 20 22 2c 73 74 65 70 6e 61 6d 65 2c 73 74  t) ",stepname,st
c870: 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74  ate,status,event
c880: 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 20 46 52  _time,comment FR
c890: 4f 4d 20 74 65 73 74 5f 73 74 65 70 73 20 57 48  OM test_steps WH
c8a0: 45 52 45 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29  ERE test_id=?;")
c8b0: 0a 09 20 20 20 20 20 28 64 62 3a 74 65 73 74 2d  ..     (db:test-
c8c0: 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 29  get-id testdat))
c8d0: 0a 09 20 20 20 20 3b 3b 20 4e 6f 77 20 64 75 70  ..    ;; Now dup
c8e0: 6c 69 63 61 74 65 20 74 68 65 20 74 65 73 74 20  licate the test 
c8f0: 64 61 74 61 0a 09 20 20 20 20 28 64 65 62 75 67  data..    (debug
c900: 3a 70 72 69 6e 74 20 34 20 22 43 6f 70 79 69 6e  :print 4 "Copyin
c910: 67 20 72 65 63 6f 72 64 73 20 69 6e 20 74 65 73  g records in tes
c920: 74 5f 64 61 74 61 20 66 72 6f 6d 20 74 65 73 74  t_data from test
c930: 5f 69 64 3d 22 20 28 64 62 3a 74 65 73 74 2d 67  _id=" (db:test-g
c940: 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 20 22  et-id testdat) "
c950: 20 74 6f 20 22 20 28 64 62 3a 74 65 73 74 2d 67   to " (db:test-g
c960: 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61  et-id new-testda
c970: 74 29 29 0a 09 20 20 20 20 28 73 71 6c 69 74 65  t))..    (sqlite
c980: 33 3a 65 78 65 63 75 74 65 20 0a 09 20 20 20 20  3:execute ..    
c990: 20 64 62 20 0a 09 20 20 20 20 20 28 63 6f 6e 63   db ..     (conc
c9a0: 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c   "INSERT OR REPL
c9b0: 41 43 45 20 49 4e 54 4f 20 74 65 73 74 5f 64 61  ACE INTO test_da
c9c0: 74 61 20 28 74 65 73 74 5f 69 64 2c 63 61 74 65  ta (test_id,cate
c9d0: 67 6f 72 79 2c 76 61 72 69 61 62 6c 65 2c 76 61  gory,variable,va
c9e0: 6c 75 65 2c 65 78 70 65 63 74 65 64 2c 74 6f 6c  lue,expected,tol
c9f0: 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65 6e 74 29 20  ,units,comment) 
ca00: 22 0a 09 09 20 20 20 22 53 45 4c 45 43 54 20 22  "...   "SELECT "
ca10: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64   (db:test-get-id
ca20: 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20 22 2c   new-testdat) ",
ca30: 63 61 74 65 67 6f 72 79 2c 76 61 72 69 61 62 6c  category,variabl
ca40: 65 2c 76 61 6c 75 65 2c 65 78 70 65 63 74 65 64  e,value,expected
ca50: 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65  ,tol,units,comme
ca60: 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f 64 61 74  nt FROM test_dat
ca70: 61 20 57 48 45 52 45 20 74 65 73 74 5f 69 64 3d  a WHERE test_id=
ca80: 3f 3b 22 29 0a 09 20 20 20 20 20 28 64 62 3a 74  ?;")..     (db:t
ca90: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64  est-get-id testd
caa0: 61 74 29 29 29 29 0a 09 20 29 29 0a 20 20 20 20  at)))).. )).    
cab0: 20 70 72 65 76 2d 74 65 73 74 73 29 29 29 0a 09   prev-tests)))..
cac0: 20 0a 20 20 20 20 20 0a                           .     .