Megatest

Hex Artifact Content
Login

Artifact 6964d1aab5603104c30d2749eb33b3d6116178ae:


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 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d     ;;===========
2b80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
2b90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
2ba0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
2bb0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 20 20 20 20  ===========.    
2bc0: 3b 3b 20 72 65 66 61 63 74 6f 72 69 6e 67 20 74  ;; refactoring t
2bd0: 68 69 73 20 62 6c 6f 63 6b 20 69 6e 74 6f 20 74  his block into t
2be0: 65 73 74 73 3a 67 65 74 2d 66 75 6c 6c 2d 64 61  ests:get-full-da
2bf0: 74 61 0a 20 20 20 20 3b 3b 3d 3d 3d 3d 3d 3d 3d  ta.    ;;=======
2c00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
2c10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
2c20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
2c30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a  ===============.
2c40: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75      (if (not (nu
2c50: 6c 6c 3f 20 74 65 73 74 2d 6e 61 6d 65 73 29 29  ll? test-names))
2c60: 0a 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68 65  ..(let loop ((he
2c70: 64 20 28 63 61 72 20 74 65 73 74 2d 6e 61 6d 65  d (car test-name
2c80: 73 29 29 0a 09 09 20 20 20 28 74 61 6c 20 28 63  s))...   (tal (c
2c90: 64 72 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 29  dr test-names)))
2ca0: 20 20 20 20 20 20 20 20 20 3b 3b 20 27 72 65 74           ;; 'ret
2cb0: 75 72 6e 2d 70 72 6f 63 73 20 74 65 6c 6c 73 20  urn-procs tells 
2cc0: 74 68 65 20 63 6f 6e 66 69 67 20 72 65 61 64 65  the config reade
2cd0: 72 20 74 6f 20 70 72 65 70 20 72 75 6e 6e 69 6e  r to prep runnin
2ce0: 67 20 73 79 73 74 65 6d 20 62 75 74 20 72 65 74  g system but ret
2cf0: 75 72 6e 20 61 20 70 72 6f 63 0a 09 20 20 28 64  urn a proc..  (d
2d00: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
2d10: 34 20 22 68 65 64 3d 22 20 68 65 64 20 22 20 61  4 "hed=" hed " a
2d20: 74 20 74 6f 70 20 6f 66 20 6c 6f 6f 70 22 29 0a  t top of loop").
2d30: 09 20 20 28 6c 65 74 2a 20 28 28 63 6f 6e 66 69  .  (let* ((confi
2d40: 67 20 20 28 74 65 73 74 73 3a 67 65 74 2d 74 65  g  (tests:get-te
2d50: 73 74 63 6f 6e 66 69 67 20 68 65 64 20 27 72 65  stconfig hed 're
2d60: 74 75 72 6e 2d 70 72 6f 63 73 29 29 0a 09 09 20  turn-procs))... 
2d70: 28 77 61 69 74 6f 6e 73 20 28 6c 65 74 20 28 28  (waitons (let ((
2d80: 69 6e 73 74 72 20 28 69 66 20 63 6f 6e 66 69 67  instr (if config
2d90: 20 0a 09 09 09 09 09 20 20 20 28 63 6f 6e 66 69   ......   (confi
2da0: 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 20  g-lookup config 
2db0: 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22  "requirements" "
2dc0: 77 61 69 74 6f 6e 22 29 0a 09 09 09 09 09 20 20  waiton")......  
2dd0: 20 28 62 65 67 69 6e 20 3b 3b 20 4e 6f 20 63 6f   (begin ;; No co
2de0: 6e 66 69 67 20 6d 65 61 6e 73 20 74 68 69 73 20  nfig means this 
2df0: 69 73 20 61 20 6e 6f 6e 2d 65 78 69 73 74 61 6e  is a non-existan
2e00: 74 20 74 65 73 74 0a 09 09 09 09 09 20 20 20 20  t test......    
2e10: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
2e20: 22 45 52 52 4f 52 3a 20 6e 6f 6e 2d 65 78 69 73  "ERROR: non-exis
2e30: 74 65 6e 74 20 72 65 71 75 69 72 65 64 20 74 65  tent required te
2e40: 73 74 20 5c 22 22 20 68 65 64 20 22 5c 22 22 29  st \"" hed "\"")
2e50: 0a 09 09 09 09 09 20 20 20 20 20 28 69 66 20 64  ......     (if d
2e60: 62 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c  b (sqlite3:final
2e70: 69 7a 65 21 20 64 62 29 29 0a 09 09 09 09 09 20  ize! db))...... 
2e80: 20 20 20 20 28 65 78 69 74 20 31 29 29 29 29 29      (exit 1)))))
2e90: 0a 09 09 09 20 20 20 20 28 64 65 62 75 67 3a 70  ....    (debug:p
2ea0: 72 69 6e 74 2d 69 6e 66 6f 20 38 20 22 77 61 69  rint-info 8 "wai
2eb0: 74 6f 6e 73 20 73 74 72 69 6e 67 20 69 73 20 22  tons string is "
2ec0: 20 69 6e 73 74 72 29 0a 09 09 09 20 20 20 20 28   instr)....    (
2ed0: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 28 63 6f  string-split (co
2ee0: 6e 64 0a 09 09 09 09 09 20 20 20 28 28 70 72 6f  nd......   ((pro
2ef0: 63 65 64 75 72 65 3f 20 69 6e 73 74 72 29 0a 09  cedure? instr)..
2f00: 09 09 09 09 20 20 20 20 28 6c 65 74 20 28 28 72  ....    (let ((r
2f10: 65 73 20 28 69 6e 73 74 72 29 29 29 0a 09 09 09  es (instr)))....
2f20: 09 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70  ..      (debug:p
2f30: 72 69 6e 74 2d 69 6e 66 6f 20 38 20 22 77 61 69  rint-info 8 "wai
2f40: 74 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 72 65  ton procedure re
2f50: 73 75 6c 74 73 20 69 6e 20 73 74 72 69 6e 67 20  sults in string 
2f60: 22 20 72 65 73 20 22 20 66 6f 72 20 74 65 73 74  " res " for test
2f70: 20 22 20 68 65 64 29 0a 09 09 09 09 09 20 20 20   " hed)......   
2f80: 20 20 20 72 65 73 29 29 0a 09 09 09 09 09 20 20     res))......  
2f90: 20 28 28 73 74 72 69 6e 67 3f 20 69 6e 73 74 72   ((string? instr
2fa0: 29 20 20 20 20 20 69 6e 73 74 72 29 0a 09 09 09  )     instr)....
2fb0: 09 09 20 20 20 28 65 6c 73 65 20 0a 09 09 09 09  ..   (else .....
2fc0: 09 20 20 20 20 3b 3b 20 4e 4f 54 45 3a 20 54 68  .    ;; NOTE: Th
2fd0: 69 73 20 69 73 20 61 63 74 75 61 6c 6c 79 20 74  is is actually t
2fe0: 68 65 20 63 61 73 65 20 6f 66 20 2a 6e 6f 2a 20  he case of *no* 
2ff0: 77 61 69 74 6f 6e 73 21 20 3b 3b 20 28 64 65 62  waitons! ;; (deb
3000: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f  ug:print 0 "ERRO
3010: 52 3a 20 73 6f 6d 65 74 68 69 6e 67 20 77 65 6e  R: something wen
3020: 74 20 77 72 6f 6e 67 20 69 6e 20 70 72 6f 63 65  t wrong in proce
3030: 73 73 69 6e 67 20 77 61 69 74 6f 6e 73 20 66 6f  ssing waitons fo
3040: 72 20 74 65 73 74 20 22 20 68 65 64 29 0a 09 09  r test " hed)...
3050: 09 09 09 20 20 20 20 22 22 29 29 29 29 29 29 0a  ...    "")))))).
3060: 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  .    (debug:prin
3070: 74 2d 69 6e 66 6f 20 38 20 22 77 61 69 74 6f 6e  t-info 8 "waiton
3080: 73 3a 20 22 20 77 61 69 74 6f 6e 73 29 0a 09 20  s: " waitons).. 
3090: 20 20 20 3b 3b 20 63 68 65 63 6b 20 66 6f 72 20     ;; check for 
30a0: 68 65 64 20 69 6e 20 77 61 69 74 6f 6e 73 20 3d  hed in waitons =
30b0: 3e 20 74 68 69 73 20 77 6f 75 6c 64 20 62 65 20  > this would be 
30c0: 63 69 72 63 75 6c 61 72 2c 20 72 65 6d 6f 76 65  circular, remove
30d0: 20 69 74 20 61 6e 64 20 69 73 73 75 65 20 61 6e   it and issue an
30e0: 0a 09 20 20 20 20 3b 3b 20 65 72 72 6f 72 0a 09  ..    ;; error..
30f0: 20 20 20 20 28 69 66 20 28 6d 65 6d 62 65 72 20      (if (member 
3100: 68 65 64 20 77 61 69 74 6f 6e 73 29 0a 09 09 28  hed waitons)...(
3110: 62 65 67 69 6e 0a 09 09 20 20 28 64 65 62 75 67  begin...  (debug
3120: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a  :print 0 "ERROR:
3130: 20 74 65 73 74 20 22 20 68 65 64 20 22 20 68 61   test " hed " ha
3140: 73 20 6c 69 73 74 65 64 20 69 74 73 65 6c 66 20  s listed itself 
3150: 61 73 20 61 20 77 61 69 74 6f 6e 2c 20 70 6c 65  as a waiton, ple
3160: 61 73 65 20 63 6f 72 72 65 63 74 20 74 68 69 73  ase correct this
3170: 21 22 29 0a 09 09 20 20 28 73 65 74 21 20 77 61  !")...  (set! wa
3180: 69 74 6f 6e 73 20 28 66 69 6c 74 65 72 20 28 6c  itons (filter (l
3190: 61 6d 62 64 61 20 28 78 29 28 6e 6f 74 20 28 65  ambda (x)(not (e
31a0: 71 75 61 6c 3f 20 78 20 68 65 64 29 29 29 20 77  qual? x hed))) w
31b0: 61 69 74 6f 6e 73 29 29 29 29 0a 09 20 20 20 20  aitons))))..    
31c0: 0a 09 20 20 20 20 3b 3b 20 28 69 74 65 6d 73 20  ..    ;; (items 
31d0: 20 20 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 65    (items:get-ite
31e0: 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 63  ms-from-config c
31f0: 6f 6e 66 69 67 29 29 29 0a 09 20 20 20 20 28 69  onfig)))..    (i
3200: 66 20 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 62  f (not (hash-tab
3210: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 74  le-ref/default t
3220: 65 73 74 2d 72 65 63 6f 72 64 73 20 68 65 64 20  est-records hed 
3230: 23 66 29 29 0a 09 09 28 68 61 73 68 2d 74 61 62  #f))...(hash-tab
3240: 6c 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 63  le-set! test-rec
3250: 6f 72 64 73 0a 09 09 09 09 20 68 65 64 20 28 76  ords..... hed (v
3260: 65 63 74 6f 72 20 68 65 64 20 20 20 20 20 3b 3b  ector hed     ;;
3270: 20 30 0a 09 09 09 09 09 20 20 20 20 20 63 6f 6e   0......     con
3280: 66 69 67 20 20 3b 3b 20 31 0a 09 09 09 09 09 20  fig  ;; 1...... 
3290: 20 20 20 20 77 61 69 74 6f 6e 73 20 3b 3b 20 32      waitons ;; 2
32a0: 0a 09 09 09 09 09 20 20 20 20 20 28 63 6f 6e 66  ......     (conf
32b0: 69 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 67  ig-lookup config
32c0: 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20   "requirements" 
32d0: 22 70 72 69 6f 72 69 74 79 22 29 20 20 20 20 20  "priority")     
32e0: 3b 3b 20 70 72 69 6f 72 69 74 79 20 33 0a 09 09  ;; priority 3...
32f0: 09 09 09 20 20 20 20 20 28 6c 65 74 20 28 28 69  ...     (let ((i
3300: 74 65 6d 73 20 20 20 20 20 20 28 68 61 73 68 2d  tems      (hash-
3310: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c  table-ref/defaul
3320: 74 20 63 6f 6e 66 69 67 20 22 69 74 65 6d 73 22  t config "items"
3330: 20 23 66 29 29 20 3b 3b 20 69 74 65 6d 73 20 34   #f)) ;; items 4
3340: 0a 09 09 09 09 09 09 20 20 20 28 69 74 65 6d 73  .......   (items
3350: 74 61 62 6c 65 20 28 68 61 73 68 2d 74 61 62 6c  table (hash-tabl
3360: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63 6f  e-ref/default co
3370: 6e 66 69 67 20 22 69 74 65 6d 73 74 61 62 6c 65  nfig "itemstable
3380: 22 20 23 66 29 29 29 20 0a 09 09 09 09 09 20 20  " #f))) ......  
3390: 20 20 20 20 20 3b 3b 20 69 66 20 65 69 74 68 65       ;; if eithe
33a0: 72 20 69 74 65 6d 73 20 6f 72 20 69 74 65 6d 73  r items or items
33b0: 20 74 61 62 6c 65 20 69 73 20 61 20 70 72 6f 63   table is a proc
33c0: 20 72 65 74 75 72 6e 20 69 74 20 73 6f 20 74 65   return it so te
33d0: 73 74 20 72 75 6e 6e 69 6e 67 0a 09 09 09 09 09  st running......
33e0: 20 20 20 20 20 20 20 3b 3b 20 70 72 6f 63 65 73         ;; proces
33f0: 73 20 63 61 6e 20 6b 6e 6f 77 20 74 6f 20 63 61  s can know to ca
3400: 6c 6c 20 69 74 65 6d 73 3a 67 65 74 2d 69 74 65  ll items:get-ite
3410: 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 0a 09  ms-from-config..
3420: 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20 69 66  ....       ;; if
3430: 20 65 69 74 68 65 72 20 69 73 20 61 20 6c 69 73   either is a lis
3440: 74 20 61 6e 64 20 6e 6f 6e 65 20 69 73 20 61 20  t and none is a 
3450: 70 72 6f 63 20 67 6f 20 61 68 65 61 64 20 61 6e  proc go ahead an
3460: 64 20 63 61 6c 6c 20 67 65 74 2d 69 74 65 6d 73  d call get-items
3470: 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20  ......       ;; 
3480: 6f 74 68 65 72 77 69 73 65 20 72 65 74 75 72 6e  otherwise return
3490: 20 23 66 20 2d 20 74 68 69 73 20 69 73 20 6e 6f   #f - this is no
34a0: 74 20 61 6e 20 69 74 65 72 61 74 65 64 20 74 65  t an iterated te
34b0: 73 74 0a 09 09 09 09 09 20 20 20 20 20 20 20 28  st......       (
34c0: 63 6f 6e 64 0a 09 09 09 09 09 09 28 28 70 72 6f  cond.......((pro
34d0: 63 65 64 75 72 65 3f 20 69 74 65 6d 73 29 20 20  cedure? items)  
34e0: 20 20 20 20 0a 09 09 09 09 09 09 20 28 64 65 62      ....... (deb
34f0: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20  ug:print-info 4 
3500: 22 69 74 65 6d 73 20 69 73 20 61 20 70 72 6f 63  "items is a proc
3510: 65 64 75 72 65 2c 20 77 69 6c 6c 20 63 61 6c 63  edure, will calc
3520: 20 6c 61 74 65 72 22 29 0a 09 09 09 09 09 09 20   later")....... 
3530: 69 74 65 6d 73 29 20 20 20 20 20 20 20 20 20 20  items)          
3540: 20 20 3b 3b 20 63 61 6c 63 20 6c 61 74 65 72 0a    ;; calc later.
3550: 09 09 09 09 09 09 28 28 70 72 6f 63 65 64 75 72  ......((procedur
3560: 65 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 0a 09  e? itemstable)..
3570: 09 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 69  ..... (debug:pri
3580: 6e 74 2d 69 6e 66 6f 20 34 20 22 69 74 65 6d 73  nt-info 4 "items
3590: 74 61 62 6c 65 20 69 73 20 61 20 70 72 6f 63 65  table is a proce
35a0: 64 75 72 65 2c 20 77 69 6c 6c 20 63 61 6c 63 20  dure, will calc 
35b0: 6c 61 74 65 72 22 29 0a 09 09 09 09 09 09 20 69  later")....... i
35c0: 74 65 6d 73 74 61 62 6c 65 29 20 20 20 20 20 20  temstable)      
35d0: 20 3b 3b 20 63 61 6c 63 20 6c 61 74 65 72 0a 09   ;; calc later..
35e0: 09 09 09 09 09 28 28 66 69 6c 74 65 72 20 28 6c  .....((filter (l
35f0: 61 6d 62 64 61 20 28 78 29 0a 09 09 09 09 09 09  ambda (x).......
3600: 09 20 20 20 28 6c 65 74 20 28 28 76 61 6c 20 28  .   (let ((val (
3610: 63 61 72 20 78 29 29 29 0a 09 09 09 09 09 09 09  car x)))........
3620: 20 20 20 20 20 28 69 66 20 28 70 72 6f 63 65 64       (if (proced
3630: 75 72 65 3f 20 76 61 6c 29 20 76 61 6c 20 23 66  ure? val) val #f
3640: 29 29 29 0a 09 09 09 09 09 09 09 20 28 61 70 70  )))........ (app
3650: 65 6e 64 20 28 69 66 20 28 6c 69 73 74 3f 20 69  end (if (list? i
3660: 74 65 6d 73 29 20 69 74 65 6d 73 20 27 28 29 29  tems) items '())
3670: 0a 09 09 09 09 09 09 09 09 20 28 69 66 20 28 6c  ......... (if (l
3680: 69 73 74 3f 20 69 74 65 6d 73 74 61 62 6c 65 29  ist? itemstable)
3690: 20 69 74 65 6d 73 74 61 62 6c 65 20 27 28 29 29   itemstable '())
36a0: 29 29 0a 09 09 09 09 09 09 20 27 68 61 76 65 2d  ))....... 'have-
36b0: 70 72 6f 63 65 64 75 72 65 29 0a 09 09 09 09 09  procedure)......
36c0: 09 28 28 6f 72 20 28 6c 69 73 74 3f 20 69 74 65  .((or (list? ite
36d0: 6d 73 29 28 6c 69 73 74 3f 20 69 74 65 6d 73 74  ms)(list? itemst
36e0: 61 62 6c 65 29 29 20 3b 3b 20 63 61 6c 63 20 6e  able)) ;; calc n
36f0: 6f 77 0a 09 09 09 09 09 09 20 28 64 65 62 75 67  ow....... (debug
3700: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 69  :print-info 4 "i
3710: 74 65 6d 73 20 61 6e 64 20 69 74 65 6d 73 74 61  tems and itemsta
3720: 62 6c 65 20 61 72 65 20 6c 69 73 74 73 2c 20 63  ble are lists, c
3730: 61 6c 63 20 6e 6f 77 5c 6e 22 0a 09 09 09 09 09  alc now\n"......
3740: 09 09 20 20 20 20 20 20 22 20 20 20 20 69 74 65  ..      "    ite
3750: 6d 73 3a 20 22 20 69 74 65 6d 73 20 22 20 69 74  ms: " items " it
3760: 65 6d 73 74 61 62 6c 65 3a 20 22 20 69 74 65 6d  emstable: " item
3770: 73 74 61 62 6c 65 29 0a 09 09 09 09 09 09 20 28  stable)....... (
3780: 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d  items:get-items-
3790: 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 63 6f 6e 66  from-config conf
37a0: 69 67 29 29 0a 09 09 09 09 09 09 28 65 6c 73 65  ig)).......(else
37b0: 20 23 66 29 29 29 20 20 20 20 20 20 20 20 20 20   #f)))          
37c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
37d0: 20 3b 3b 20 6e 6f 74 20 69 74 65 72 61 74 65 64   ;; not iterated
37e0: 0a 09 09 09 09 09 20 20 20 20 20 23 66 20 20 20  ......     #f   
37f0: 20 20 20 3b 3b 20 69 74 65 6d 73 64 61 74 20 35     ;; itemsdat 5
3800: 0a 09 09 09 09 09 20 20 20 20 20 23 66 20 20 20  ......     #f   
3810: 20 20 20 3b 3b 20 73 70 61 72 65 20 2d 20 75 73     ;; spare - us
3820: 65 64 20 66 6f 72 20 69 74 65 6d 2d 70 61 74 68  ed for item-path
3830: 0a 09 09 09 09 09 20 20 20 20 20 29 29 29 0a 09  ......     )))..
3840: 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 09      (for-each ..
3850: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 77 61       (lambda (wa
3860: 69 74 6f 6e 29 0a 09 20 20 20 20 20 20 20 28 69  iton)..       (i
3870: 66 20 28 61 6e 64 20 77 61 69 74 6f 6e 20 28 6e  f (and waiton (n
3880: 6f 74 20 28 6d 65 6d 62 65 72 20 77 61 69 74 6f  ot (member waito
3890: 6e 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a  n test-names))).
38a0: 09 09 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20  ..   (begin...  
38b0: 20 20 20 28 73 65 74 21 20 72 65 71 75 69 72 65     (set! require
38c0: 64 2d 74 65 73 74 73 20 28 63 6f 6e 73 20 77 61  d-tests (cons wa
38d0: 69 74 6f 6e 20 72 65 71 75 69 72 65 64 2d 74 65  iton required-te
38e0: 73 74 73 29 29 0a 09 09 20 20 20 20 20 28 73 65  sts))...     (se
38f0: 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 28 63  t! test-names (c
3900: 6f 6e 73 20 77 61 69 74 6f 6e 20 74 65 73 74 2d  ons waiton test-
3910: 6e 61 6d 65 73 29 29 29 29 29 20 3b 3b 20 77 61  names))))) ;; wa
3920: 73 20 61 6e 20 61 70 70 65 6e 64 2c 20 6e 6f 77  s an append, now
3930: 20 61 20 63 6f 6e 73 0a 09 20 20 20 20 20 77 61   a cons..     wa
3940: 69 74 6f 6e 73 29 0a 09 20 20 20 20 28 6c 65 74  itons)..    (let
3950: 20 28 28 72 65 6d 74 65 73 74 73 20 28 64 65 6c   ((remtests (del
3960: 65 74 65 2d 64 75 70 6c 69 63 61 74 65 73 20 28  ete-duplicates (
3970: 61 70 70 65 6e 64 20 77 61 69 74 6f 6e 73 20 74  append waitons t
3980: 61 6c 29 29 29 29 0a 09 20 20 20 20 20 20 28 69  al))))..      (i
3990: 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65  f (not (null? re
39a0: 6d 74 65 73 74 73 29 29 0a 09 09 20 20 28 6c 6f  mtests))...  (lo
39b0: 6f 70 20 28 63 61 72 20 72 65 6d 74 65 73 74 73  op (car remtests
39c0: 29 28 63 64 72 20 72 65 6d 74 65 73 74 73 29 29  )(cdr remtests))
39d0: 29 29 29 29 29 0a 0a 20 20 20 20 28 69 66 20 28  )))))..    (if (
39e0: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 71 75 69  not (null? requi
39f0: 72 65 64 2d 74 65 73 74 73 29 29 0a 09 28 64 65  red-tests))..(de
3a00: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31  bug:print-info 1
3a10: 20 22 41 64 64 69 6e 67 20 22 20 72 65 71 75 69   "Adding " requi
3a20: 72 65 64 2d 74 65 73 74 73 20 22 20 74 6f 20 74  red-tests " to t
3a30: 68 65 20 72 75 6e 20 71 75 65 75 65 22 29 29 0a  he run queue")).
3a40: 20 20 20 20 3b 3b 20 4e 4f 54 45 3a 20 74 68 65      ;; NOTE: the
3a50: 73 65 20 61 72 65 20 61 6c 6c 20 70 61 72 65 6e  se are all paren
3a60: 74 20 74 65 73 74 73 2c 20 69 74 65 6d 73 20 61  t tests, items a
3a70: 72 65 20 6e 6f 74 20 65 78 70 61 6e 64 65 64 20  re not expanded 
3a80: 79 65 74 2e 0a 20 20 20 20 28 64 65 62 75 67 3a  yet..    (debug:
3a90: 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 74 65  print-info 4 "te
3aa0: 73 74 2d 72 65 63 6f 72 64 73 3d 22 20 28 68 61  st-records=" (ha
3ab0: 73 68 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20  sh-table->alist 
3ac0: 74 65 73 74 2d 72 65 63 6f 72 64 73 29 29 0a 20  test-records)). 
3ad0: 20 20 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73     (runs:run-tes
3ae0: 74 73 2d 71 75 65 75 65 20 72 75 6e 2d 69 64 20  ts-queue run-id 
3af0: 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d 72 65 63  runname test-rec
3b00: 6f 72 64 73 20 6b 65 79 76 61 6c 6c 73 74 20 66  ords keyvallst f
3b10: 6c 61 67 73 20 74 65 73 74 2d 70 61 74 74 73 29  lags test-patts)
3b20: 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  .    (debug:prin
3b30: 74 2d 69 6e 66 6f 20 34 20 22 41 6c 6c 20 64 6f  t-info 4 "All do
3b40: 6e 65 20 62 79 20 68 65 72 65 22 29 29 29 0a 0a  ne by here")))..
3b50: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 63 61  (define (runs:ca
3b60: 6c 63 2d 66 61 69 6c 73 20 70 72 65 72 65 71 73  lc-fails prereqs
3b70: 2d 6e 6f 74 2d 6d 65 74 29 0a 20 20 28 66 69 6c  -not-met).  (fil
3b80: 74 65 72 20 28 6c 61 6d 62 64 61 20 28 74 65 73  ter (lambda (tes
3b90: 74 29 0a 09 20 20 20 20 28 61 6e 64 20 28 76 65  t)..    (and (ve
3ba0: 63 74 6f 72 3f 20 74 65 73 74 29 20 3b 3b 20 6e  ctor? test) ;; n
3bb0: 6f 74 20 28 73 74 72 69 6e 67 3f 20 74 65 73 74  ot (string? test
3bc0: 29 29 0a 09 09 20 28 65 71 75 61 6c 3f 20 28 64  ))... (equal? (d
3bd0: 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 65  b:test-get-state
3be0: 20 74 65 73 74 29 20 22 43 4f 4d 50 4c 45 54 45   test) "COMPLETE
3bf0: 44 22 29 0a 09 09 20 28 6e 6f 74 20 28 6d 65 6d  D")... (not (mem
3c00: 62 65 72 20 28 64 62 3a 74 65 73 74 2d 67 65 74  ber (db:test-get
3c10: 2d 73 74 61 74 75 73 20 74 65 73 74 29 0a 09 09  -status test)...
3c20: 09 20 20 20 20 20 20 27 28 22 50 41 53 53 22 20  .      '("PASS" 
3c30: 22 57 41 52 4e 22 20 22 43 48 45 43 4b 22 20 22  "WARN" "CHECK" "
3c40: 57 41 49 56 45 44 22 20 22 53 4b 49 50 22 29 29  WAIVED" "SKIP"))
3c50: 29 29 29 0a 09 20 20 70 72 65 72 65 71 73 2d 6e  )))..  prereqs-n
3c60: 6f 74 2d 6d 65 74 29 29 0a 0a 28 64 65 66 69 6e  ot-met))..(defin
3c70: 65 20 28 72 75 6e 73 3a 63 61 6c 63 2d 6e 6f 74  e (runs:calc-not
3c80: 2d 63 6f 6d 70 6c 65 74 65 64 20 70 72 65 72 65  -completed prere
3c90: 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 20 20 28 66  qs-not-met).  (f
3ca0: 69 6c 74 65 72 0a 20 20 20 28 6c 61 6d 62 64 61  ilter.   (lambda
3cb0: 20 28 74 29 0a 20 20 20 20 20 28 6f 72 20 28 6e   (t).     (or (n
3cc0: 6f 74 20 28 76 65 63 74 6f 72 3f 20 74 29 29 0a  ot (vector? t)).
3cd0: 09 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 22  . (not (equal? "
3ce0: 43 4f 4d 50 4c 45 54 45 44 22 20 28 64 62 3a 74  COMPLETED" (db:t
3cf0: 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74 29  est-get-state t)
3d00: 29 29 29 29 0a 20 20 20 70 72 65 72 65 71 73 2d  )))).   prereqs-
3d10: 6e 6f 74 2d 6d 65 74 29 29 0a 0a 28 64 65 66 69  not-met))..(defi
3d20: 6e 65 20 28 72 75 6e 73 3a 70 72 65 74 74 79 2d  ne (runs:pretty-
3d30: 73 74 72 69 6e 67 20 6c 73 74 29 0a 20 20 28 6d  string lst).  (m
3d40: 61 70 20 28 6c 61 6d 62 64 61 20 28 74 29 0a 09  ap (lambda (t)..
3d50: 20 28 69 66 20 28 6e 6f 74 20 28 76 65 63 74 6f   (if (not (vecto
3d60: 72 3f 20 74 29 29 0a 09 20 20 20 20 20 28 63 6f  r? t))..     (co
3d70: 6e 63 20 74 29 0a 09 20 20 20 20 20 28 63 6f 6e  nc t)..     (con
3d80: 63 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74  c (db:test-get-t
3d90: 65 73 74 6e 61 6d 65 20 74 29 20 22 3a 22 20 28  estname t) ":" (
3da0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74  db:test-get-stat
3db0: 65 20 74 29 20 22 2f 22 20 28 64 62 3a 74 65 73  e t) "/" (db:tes
3dc0: 74 2d 67 65 74 2d 73 74 61 74 75 73 20 74 29 29  t-get-status t))
3dd0: 29 29 0a 20 20 20 20 20 20 20 6c 73 74 29 29 0a  )).       lst)).
3de0: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 6d  .(define (runs:m
3df0: 61 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61  ake-full-test-na
3e00: 6d 65 20 74 65 73 74 6e 61 6d 65 20 69 74 65 6d  me testname item
3e10: 70 61 74 68 29 0a 20 20 28 69 66 20 28 65 71 75  path).  (if (equ
3e20: 61 6c 3f 20 69 74 65 6d 70 61 74 68 20 22 22 29  al? itempath "")
3e30: 20 74 65 73 74 6e 61 6d 65 20 28 63 6f 6e 63 20   testname (conc 
3e40: 74 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65  testname "/" ite
3e50: 6d 70 61 74 68 29 29 29 0a 0a 3b 3b 20 74 65 73  mpath)))..;; tes
3e60: 74 2d 72 65 63 6f 72 64 73 20 69 73 20 61 20 68  t-records is a h
3e70: 61 73 68 20 74 61 62 6c 65 20 74 65 73 74 6e 61  ash table testna
3e80: 6d 65 3a 69 74 65 6d 5f 70 61 74 68 20 3d 3e 20  me:item_path => 
3e90: 76 65 63 74 6f 72 20 3c 20 74 65 73 74 6e 61 6d  vector < testnam
3ea0: 65 20 74 65 73 74 63 6f 6e 66 69 67 20 77 61 69  e testconfig wai
3eb0: 74 6f 6e 73 20 70 72 69 6f 72 69 74 79 20 69 74  tons priority it
3ec0: 65 6d 73 2d 69 6e 66 6f 20 2e 2e 2e 20 3e 0a 28  ems-info ... >.(
3ed0: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 75 6e  define (runs:run
3ee0: 2d 74 65 73 74 73 2d 71 75 65 75 65 20 72 75 6e  -tests-queue run
3ef0: 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74  -id runname test
3f00: 2d 72 65 63 6f 72 64 73 20 6b 65 79 76 61 6c 6c  -records keyvall
3f10: 73 74 20 66 6c 61 67 73 20 74 65 73 74 2d 70 61  st flags test-pa
3f20: 74 74 73 29 0a 20 20 20 20 3b 3b 20 41 74 20 74  tts).    ;; At t
3f30: 68 69 73 20 70 6f 69 6e 74 20 74 68 65 20 6c 69  his point the li
3f40: 73 74 20 6f 66 20 70 61 72 65 6e 74 20 74 65 73  st of parent tes
3f50: 74 73 20 69 73 20 65 78 70 61 6e 64 65 64 20 0a  ts is expanded .
3f60: 20 20 20 20 3b 3b 20 4e 42 2f 2f 20 53 68 6f 75      ;; NB// Shou
3f70: 6c 64 20 65 78 70 61 6e 64 20 69 74 65 6d 73 20  ld expand items 
3f80: 68 65 72 65 20 61 6e 64 20 74 68 65 6e 20 69 6e  here and then in
3f90: 73 65 72 74 20 69 6e 74 6f 20 74 68 65 20 72 75  sert into the ru
3fa0: 6e 20 71 75 65 75 65 2e 0a 20 20 28 64 65 62 75  n queue..  (debu
3fb0: 67 3a 70 72 69 6e 74 20 35 20 22 74 65 73 74 2d  g:print 5 "test-
3fc0: 72 65 63 6f 72 64 73 3a 20 22 20 74 65 73 74 2d  records: " test-
3fd0: 72 65 63 6f 72 64 73 20 22 2c 20 6b 65 79 76 61  records ", keyva
3fe0: 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73  llst: " keyvalls
3ff0: 74 20 22 20 66 6c 61 67 73 3a 20 22 20 28 68 61  t " flags: " (ha
4000: 73 68 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20  sh-table->alist 
4010: 66 6c 61 67 73 29 29 0a 20 20 28 6c 65 74 20 28  flags)).  (let (
4020: 28 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d  (sorted-test-nam
4030: 65 73 20 28 74 65 73 74 73 3a 73 6f 72 74 2d 62  es (tests:sort-b
4040: 79 2d 70 72 69 6f 72 69 74 79 2d 61 6e 64 2d 77  y-priority-and-w
4050: 61 69 74 6f 6e 20 74 65 73 74 2d 72 65 63 6f 72  aiton test-recor
4060: 64 73 29 29 0a 09 28 74 65 73 74 2d 72 65 67 69  ds))..(test-regi
4070: 73 74 65 72 79 20 20 20 20 28 6d 61 6b 65 2d 68  stery    (make-h
4080: 61 73 68 2d 74 61 62 6c 65 29 29 0a 09 28 6e 75  ash-table))..(nu
4090: 6d 2d 72 65 74 72 69 65 73 20 20 20 20 20 20 20  m-retries       
40a0: 20 30 29 0a 09 28 6d 61 78 2d 72 65 74 72 69 65   0)..(max-retrie
40b0: 73 20 20 20 20 20 20 20 28 63 6f 6e 66 69 67 2d  s       (config-
40c0: 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61  lookup *configda
40d0: 74 2a 20 22 73 65 74 75 70 22 20 22 6d 61 78 72  t* "setup" "maxr
40e0: 65 74 72 69 65 73 22 29 29 29 0a 20 20 20 20 28  etries"))).    (
40f0: 73 65 74 21 20 6d 61 78 2d 72 65 74 72 69 65 73  set! max-retries
4100: 20 28 69 66 20 28 61 6e 64 20 6d 61 78 2d 72 65   (if (and max-re
4110: 74 72 69 65 73 20 28 73 74 72 69 6e 67 2d 3e 6e  tries (string->n
4120: 75 6d 62 65 72 20 6d 61 78 2d 72 65 74 72 69 65  umber max-retrie
4130: 73 29 29 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62  s))(string->numb
4140: 65 72 20 6d 61 78 2d 72 65 74 72 69 65 73 29 20  er max-retries) 
4150: 31 30 30 29 29 0a 20 20 20 20 28 69 66 20 28 6e  100)).    (if (n
4160: 6f 74 20 28 6e 75 6c 6c 3f 20 73 6f 72 74 65 64  ot (null? sorted
4170: 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 28  -test-names))..(
4180: 6c 65 74 20 6c 6f 6f 70 20 28 28 68 65 64 20 20  let loop ((hed  
4190: 20 20 20 20 20 20 20 28 63 61 72 20 73 6f 72 74         (car sort
41a0: 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a  ed-test-names)).
41b0: 09 09 20 20 20 28 74 61 6c 20 20 20 20 20 20 20  ..   (tal       
41c0: 20 20 28 63 64 72 20 73 6f 72 74 65 64 2d 74 65    (cdr sorted-te
41d0: 73 74 2d 6e 61 6d 65 73 29 29 0a 09 09 20 20 20  st-names))...   
41e0: 28 72 65 72 75 6e 73 20 20 20 20 20 20 27 28 29  (reruns      '()
41f0: 29 29 0a 09 20 20 28 69 66 20 28 6e 6f 74 20 28  ))..  (if (not (
4200: 6e 75 6c 6c 3f 20 72 65 72 75 6e 73 29 29 28 64  null? reruns))(d
4210: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
4220: 34 20 22 72 65 72 75 6e 73 3d 22 20 72 65 72 75  4 "reruns=" reru
4230: 6e 73 29 29 0a 09 20 20 3b 3b 20 28 70 72 69 6e  ns))..  ;; (prin
4240: 74 20 22 54 6f 70 20 6f 66 20 6c 6f 6f 70 2c 20  t "Top of loop, 
4250: 68 65 64 3d 22 20 68 65 64 20 22 2c 20 74 61 6c  hed=" hed ", tal
4260: 3d 22 20 74 61 6c 20 22 20 2c 72 65 72 75 6e 73  =" tal " ,reruns
4270: 3d 22 20 72 65 72 75 6e 73 29 0a 09 20 20 28 6c  =" reruns)..  (l
4280: 65 74 2a 20 28 28 74 65 73 74 2d 72 65 63 6f 72  et* ((test-recor
4290: 64 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65  d (hash-table-re
42a0: 66 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 68  f test-records h
42b0: 65 64 29 29 0a 09 09 20 28 74 65 73 74 2d 6e 61  ed))... (test-na
42c0: 6d 65 20 20 20 28 74 65 73 74 73 3a 74 65 73 74  me   (tests:test
42d0: 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61  queue-get-testna
42e0: 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29  me test-record))
42f0: 0a 09 09 20 28 74 63 6f 6e 66 69 67 20 20 20 20  ... (tconfig    
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 74 65 73 74 63 6f 6e 66 69 67  e-get-testconfig
4320: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09   test-record))..
4330: 09 20 28 74 65 73 74 6d 6f 64 65 20 20 20 20 28  . (testmode    (
4340: 6c 65 74 20 28 28 6d 20 28 63 6f 6e 66 69 67 2d  let ((m (config-
4350: 6c 6f 6f 6b 75 70 20 74 63 6f 6e 66 69 67 20 22  lookup tconfig "
4360: 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 6d  requirements" "m
4370: 6f 64 65 22 29 29 29 0a 09 09 09 09 28 69 66 20  ode"))).....(if 
4380: 6d 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62 6f  m (string->symbo
4390: 6c 20 6d 29 20 27 6e 6f 72 6d 61 6c 29 29 29 0a  l m) 'normal))).
43a0: 09 09 20 28 77 61 69 74 6f 6e 73 20 20 20 20 20  .. (waitons     
43b0: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65  (tests:testqueue
43c0: 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20 20 20 20  -get-waitons    
43d0: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09  test-record))...
43e0: 20 28 70 72 69 6f 72 69 74 79 20 20 20 20 28 74   (priority    (t
43f0: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67  ests:testqueue-g
4400: 65 74 2d 70 72 69 6f 72 69 74 79 20 20 20 74 65  et-priority   te
4410: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 28  st-record))... (
4420: 69 74 65 6d 64 61 74 20 20 20 20 20 28 74 65 73  itemdat     (tes
4430: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
4440: 2d 69 74 65 6d 64 61 74 20 20 20 20 74 65 73 74  -itemdat    test
4450: 2d 72 65 63 6f 72 64 29 29 20 3b 3b 20 69 74 65  -record)) ;; ite
4460: 6d 64 61 74 20 63 61 6e 20 62 65 20 61 20 73 74  mdat can be a st
4470: 72 69 6e 67 2c 20 6c 69 73 74 20 6f 72 20 23 66  ring, list or #f
4480: 0a 09 09 20 28 69 74 65 6d 73 20 20 20 20 20 20  ... (items      
4490: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75   (tests:testqueu
44a0: 65 2d 67 65 74 2d 69 74 65 6d 73 20 20 20 20 20  e-get-items     
44b0: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09   test-record))..
44c0: 09 20 28 69 74 65 6d 2d 70 61 74 68 20 20 20 28  . (item-path   (
44d0: 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20  item-list->path 
44e0: 69 74 65 6d 64 61 74 29 29 0a 09 09 20 28 6e 65  itemdat))... (ne
44f0: 77 74 61 6c 20 20 20 20 20 20 28 61 70 70 65 6e  wtal      (appen
4500: 64 20 74 61 6c 20 28 6c 69 73 74 20 68 65 64 29  d tal (list hed)
4510: 29 29 29 0a 09 20 20 20 20 0a 09 20 20 20 20 28  )))..    ..    (
4520: 64 65 62 75 67 3a 70 72 69 6e 74 20 36 0a 09 09  debug:print 6...
4530: 09 20 22 74 65 73 74 2d 6e 61 6d 65 3a 20 22 20  . "test-name: " 
4540: 74 65 73 74 2d 6e 61 6d 65 0a 09 09 09 20 22 5c  test-name.... "\
4550: 6e 20 20 68 65 64 3a 20 20 20 20 20 20 20 20 20  n  hed:         
4560: 22 20 68 65 64 0a 09 09 09 20 22 5c 6e 20 20 69  " hed.... "\n  i
4570: 74 65 6d 64 61 74 3a 20 20 20 20 20 22 20 69 74  temdat:     " it
4580: 65 6d 64 61 74 0a 09 09 09 20 22 5c 6e 20 20 69  emdat.... "\n  i
4590: 74 65 6d 73 3a 20 20 20 20 20 20 20 22 20 69 74  tems:       " it
45a0: 65 6d 73 0a 09 09 09 20 22 5c 6e 20 20 69 74 65  ems.... "\n  ite
45b0: 6d 2d 70 61 74 68 3a 20 20 20 22 20 69 74 65 6d  m-path:   " item
45c0: 2d 70 61 74 68 0a 09 09 09 20 22 5c 6e 20 20 77  -path.... "\n  w
45d0: 61 69 74 6f 6e 73 3a 20 20 20 20 20 22 20 77 61  aitons:     " wa
45e0: 69 74 6f 6e 73 0a 09 09 09 20 22 5c 6e 20 20 6e  itons.... "\n  n
45f0: 75 6d 2d 72 65 74 72 69 65 73 3a 20 22 20 6e 75  um-retries: " nu
4600: 6d 2d 72 65 74 72 69 65 73 0a 09 09 09 20 22 5c  m-retries.... "\
4610: 6e 20 20 74 61 6c 3a 20 20 20 20 20 20 20 20 20  n  tal:         
4620: 22 20 74 61 6c 0a 09 09 09 20 22 5c 6e 20 20 72  " tal.... "\n  r
4630: 65 72 75 6e 73 3a 20 20 20 20 20 20 22 20 72 65  eruns:      " re
4640: 72 75 6e 73 29 0a 0a 09 20 20 20 20 3b 3b 20 63  runs)...    ;; c
4650: 68 65 63 6b 20 66 6f 72 20 68 65 64 20 69 6e 20  heck for hed in 
4660: 77 61 69 74 6f 6e 73 20 3d 3e 20 74 68 69 73 20  waitons => this 
4670: 77 6f 75 6c 64 20 62 65 20 63 69 72 63 75 6c 61  would be circula
4680: 72 2c 20 72 65 6d 6f 76 65 20 69 74 20 61 6e 64  r, remove it and
4690: 20 69 73 73 75 65 20 61 6e 0a 09 20 20 20 20 3b   issue an..    ;
46a0: 3b 20 65 72 72 6f 72 0a 09 20 20 20 20 28 69 66  ; error..    (if
46b0: 20 28 6d 65 6d 62 65 72 20 74 65 73 74 2d 6e 61   (member test-na
46c0: 6d 65 20 77 61 69 74 6f 6e 73 29 0a 09 09 28 62  me waitons)...(b
46d0: 65 67 69 6e 0a 09 09 20 20 28 64 65 62 75 67 3a  egin...  (debug:
46e0: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
46f0: 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65  test " test-name
4700: 20 22 20 68 61 73 20 6c 69 73 74 65 64 20 69 74   " has listed it
4710: 73 65 6c 66 20 61 73 20 61 20 77 61 69 74 6f 6e  self as a waiton
4720: 2c 20 70 6c 65 61 73 65 20 63 6f 72 72 65 63 74  , please correct
4730: 20 74 68 69 73 21 22 29 0a 09 09 20 20 28 73 65   this!")...  (se
4740: 74 21 20 77 61 69 74 6f 6e 20 28 66 69 6c 74 65  t! waiton (filte
4750: 72 20 28 6c 61 6d 62 64 61 20 28 78 29 28 6e 6f  r (lambda (x)(no
4760: 74 20 28 65 71 75 61 6c 3f 20 78 20 68 65 64 29  t (equal? x hed)
4770: 29 29 20 77 61 69 74 6f 6e 73 29 29 29 29 0a 0a  )) waitons))))..
4780: 09 20 20 20 20 28 63 6f 6e 64 20 3b 3b 20 4f 55  .    (cond ;; OU
4790: 54 45 52 20 43 4f 4e 44 0a 09 20 20 20 20 20 28  TER COND..     (
47a0: 28 6e 6f 74 20 69 74 65 6d 73 29 20 3b 3b 20 77  (not items) ;; w
47b0: 68 65 6e 20 66 61 6c 73 65 20 74 68 65 20 74 65  hen false the te
47c0: 73 74 20 69 73 20 6f 6b 20 74 6f 20 62 65 20 68  st is ok to be h
47d0: 61 6e 64 65 64 20 6f 66 66 20 74 6f 20 6c 61 75  anded off to lau
47e0: 6e 63 68 20 28 62 75 74 20 6e 6f 74 20 62 65 66  nch (but not bef
47f0: 6f 72 65 29 0a 09 20 20 20 20 20 20 28 6c 65 74  ore)..      (let
4800: 2a 20 28 28 72 75 6e 2d 6c 69 6d 69 74 73 2d 69  * ((run-limits-i
4810: 6e 66 6f 20 20 20 20 20 20 20 20 20 28 6f 70 65  nfo         (ope
4820: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73  n-run-close runs
4830: 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65  :can-run-more-te
4840: 73 74 73 20 74 65 73 74 2d 72 65 63 6f 72 64 29  sts test-record)
4850: 29 20 3b 3b 20 6c 6f 6f 6b 20 61 74 20 74 68 65  ) ;; look at the
4860: 20 74 65 73 74 20 6a 6f 62 67 72 6f 75 70 20 61   test jobgroup a
4870: 6e 64 20 74 6f 74 20 6a 6f 62 73 20 72 75 6e 6e  nd tot jobs runn
4880: 69 6e 67 0a 09 09 20 20 20 20 20 28 68 61 76 65  ing...     (have
4890: 2d 72 65 73 6f 75 72 63 65 73 20 20 20 20 20 20  -resources      
48a0: 20 20 20 20 28 63 61 72 20 72 75 6e 2d 6c 69 6d      (car run-lim
48b0: 69 74 73 2d 69 6e 66 6f 29 29 0a 09 09 20 20 20  its-info))...   
48c0: 20 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 20    (num-running  
48d0: 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74             (list
48e0: 2d 72 65 66 20 72 75 6e 2d 6c 69 6d 69 74 73 2d  -ref run-limits-
48f0: 69 6e 66 6f 20 31 29 29 0a 09 09 20 20 20 20 20  info 1))...     
4900: 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d  (num-running-in-
4910: 6a 6f 62 67 72 6f 75 70 20 28 6c 69 73 74 2d 72  jobgroup (list-r
4920: 65 66 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e  ef run-limits-in
4930: 66 6f 20 32 29 29 0a 09 09 20 20 20 20 20 28 6d  fo 2))...     (m
4940: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f  ax-concurrent-jo
4950: 62 73 20 20 20 20 20 28 6c 69 73 74 2d 72 65 66  bs     (list-ref
4960: 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f   run-limits-info
4970: 20 33 29 29 0a 09 09 20 20 20 20 20 28 6a 6f 62   3))...     (job
4980: 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 20 20 20 20  -group-limit    
4990: 20 20 20 20 20 28 6c 69 73 74 2d 72 65 66 20 72       (list-ref r
49a0: 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 34  un-limits-info 4
49b0: 29 29 0a 09 09 20 20 20 20 20 28 70 72 65 72 65  ))...     (prere
49c0: 71 73 2d 6e 6f 74 2d 6d 65 74 20 20 20 20 20 20  qs-not-met      
49d0: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f     (open-run-clo
49e0: 73 65 20 64 62 3a 67 65 74 2d 70 72 65 72 65 71  se db:get-prereq
49f0: 73 2d 6e 6f 74 2d 6d 65 74 20 23 66 20 72 75 6e  s-not-met #f run
4a00: 2d 69 64 20 77 61 69 74 6f 6e 73 20 69 74 65 6d  -id waitons item
4a10: 2d 70 61 74 68 20 6d 6f 64 65 3a 20 74 65 73 74  -path mode: test
4a20: 6d 6f 64 65 29 29 0a 09 09 20 20 20 20 20 28 66  mode))...     (f
4a30: 61 69 6c 73 20 20 20 20 20 20 20 20 20 20 20 20  ails            
4a40: 20 20 20 20 20 20 20 28 72 75 6e 73 3a 63 61 6c         (runs:cal
4a50: 63 2d 66 61 69 6c 73 20 70 72 65 72 65 71 73 2d  c-fails prereqs-
4a60: 6e 6f 74 2d 6d 65 74 29 29 0a 09 09 20 20 20 20  not-met))...    
4a70: 20 28 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 20   (non-completed 
4a80: 20 20 20 20 20 20 20 20 20 20 28 72 75 6e 73 3a            (runs:
4a90: 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 74  calc-not-complet
4aa0: 65 64 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d  ed prereqs-not-m
4ab0: 65 74 29 29 29 0a 09 09 28 64 65 62 75 67 3a 70  et)))...(debug:p
4ac0: 72 69 6e 74 2d 69 6e 66 6f 20 38 20 22 68 61 76  rint-info 8 "hav
4ad0: 65 2d 72 65 73 6f 75 72 63 65 73 3a 20 22 20 68  e-resources: " h
4ae0: 61 76 65 2d 72 65 73 6f 75 72 63 65 73 20 22 20  ave-resources " 
4af0: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 3a  prereqs-not-met:
4b00: 20 22 20 0a 09 09 09 20 20 20 20 20 28 73 74 72   " ....     (str
4b10: 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20  ing-intersperse 
4b20: 0a 09 09 09 20 20 20 20 20 20 28 6d 61 70 20 28  ....      (map (
4b30: 6c 61 6d 62 64 61 20 28 74 29 0a 09 09 09 09 20  lambda (t)..... 
4b40: 20 20 20 20 28 69 66 20 28 76 65 63 74 6f 72 3f      (if (vector?
4b50: 20 74 29 0a 09 09 09 09 09 20 28 63 6f 6e 63 20   t)...... (conc 
4b60: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61  (db:test-get-sta
4b70: 74 65 20 74 29 20 22 2f 22 20 28 64 62 3a 74 65  te t) "/" (db:te
4b80: 73 74 2d 67 65 74 2d 73 74 61 74 75 73 20 74 29  st-get-status t)
4b90: 29 0a 09 09 09 09 09 20 28 63 6f 6e 63 20 22 20  )...... (conc " 
4ba0: 57 41 52 4e 49 4e 47 3a 20 74 20 69 73 20 6e 6f  WARNING: t is no
4bb0: 74 20 61 20 76 65 63 74 6f 72 3d 22 20 74 20 29  t a vector=" t )
4bc0: 29 29 0a 09 09 09 09 20 20 20 70 72 65 72 65 71  )).....   prereq
4bd0: 73 2d 6e 6f 74 2d 6d 65 74 29 20 22 2c 20 22 29  s-not-met) ", ")
4be0: 20 22 20 66 61 69 6c 73 3a 20 22 20 66 61 69 6c   " fails: " fail
4bf0: 73 29 0a 09 09 28 64 65 62 75 67 3a 70 72 69 6e  s)...(debug:prin
4c00: 74 2d 69 6e 66 6f 20 34 20 22 68 65 64 3d 22 20  t-info 4 "hed=" 
4c10: 68 65 64 20 22 5c 6e 20 20 74 65 73 74 2d 72 65  hed "\n  test-re
4c20: 63 6f 72 64 3d 22 20 74 65 73 74 2d 72 65 63 6f  cord=" test-reco
4c30: 72 64 20 22 5c 6e 20 20 74 65 73 74 2d 6e 61 6d  rd "\n  test-nam
4c40: 65 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22  e: " test-name "
4c50: 5c 6e 20 20 69 74 65 6d 2d 70 61 74 68 3a 20 22  \n  item-path: "
4c60: 20 69 74 65 6d 2d 70 61 74 68 20 22 5c 6e 20 20   item-path "\n  
4c70: 74 65 73 74 2d 70 61 74 74 73 3a 20 22 20 74 65  test-patts: " te
4c80: 73 74 2d 70 61 74 74 73 29 0a 0a 09 09 3b 3b 20  st-patts)....;; 
4c90: 44 6f 6e 27 74 20 6b 6e 6f 77 20 61 74 20 74 68  Don't know at th
4ca0: 69 73 20 74 69 6d 65 20 69 66 20 74 68 65 20 74  is time if the t
4cb0: 65 73 74 20 68 61 76 65 20 62 65 65 6e 20 6c 61  est have been la
4cc0: 75 6e 63 68 65 64 20 61 74 20 73 6f 6d 65 20 74  unched at some t
4cd0: 69 6d 65 20 69 6e 20 74 68 65 20 70 61 73 74 0a  ime in the past.
4ce0: 09 09 3b 3b 20 69 2e 65 2e 20 69 73 20 74 68 69  ..;; i.e. is thi
4cf0: 73 20 61 20 72 65 2d 6c 61 75 6e 63 68 3f 0a 09  s a re-launch?..
4d00: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e  .(debug:print-in
4d10: 66 6f 20 34 20 22 72 75 6e 2d 6c 69 6d 69 74 73  fo 4 "run-limits
4d20: 2d 69 6e 66 6f 20 3d 20 22 20 72 75 6e 2d 6c 69  -info = " run-li
4d30: 6d 69 74 73 2d 69 6e 66 6f 29 0a 09 09 28 63 6f  mits-info)...(co
4d40: 6e 64 20 3b 3b 20 49 4e 4e 45 52 20 43 4f 4e 44  nd ;; INNER COND
4d50: 20 23 31 20 66 6f 72 20 61 20 6c 61 75 6e 63 68   #1 for a launch
4d60: 61 62 6c 65 20 74 65 73 74 0a 09 09 20 3b 3b 20  able test... ;; 
4d70: 43 68 65 63 6b 20 69 74 65 6d 20 70 61 74 68 20  Check item path 
4d80: 61 67 61 69 6e 73 74 20 69 74 65 6d 2d 70 61 74  against item-pat
4d90: 74 73 0a 09 09 20 28 28 6e 6f 74 20 28 74 65 73  ts... ((not (tes
4da0: 74 73 3a 6d 61 74 63 68 20 74 65 73 74 2d 70 61  ts:match test-pa
4db0: 74 74 73 20 28 74 65 73 74 73 3a 74 65 73 74 71  tts (tests:testq
4dc0: 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d  ueue-get-testnam
4dd0: 65 20 74 65 73 74 2d 72 65 63 6f 72 64 29 20 69  e test-record) i
4de0: 74 65 6d 2d 70 61 74 68 29 29 20 3b 3b 20 54 68  tem-path)) ;; Th
4df0: 69 73 20 74 65 73 74 2f 69 74 65 6d 70 61 74 68  is test/itempath
4e00: 20 69 73 20 6e 6f 74 20 74 6f 20 62 65 20 72 75   is not to be ru
4e10: 6e 0a 09 09 20 20 3b 3b 20 65 6c 73 65 20 74 68  n...  ;; else th
4e20: 65 20 72 75 6e 20 69 73 20 73 74 75 63 6b 2c 20  e run is stuck, 
4e30: 74 65 6d 70 6f 72 61 72 69 6c 79 20 6f 72 20 70  temporarily or p
4e40: 65 72 6d 61 6e 65 6e 74 6c 79 0a 09 09 20 20 3b  ermanently...  ;
4e50: 3b 20 62 75 74 20 73 68 6f 75 6c 64 20 63 68 65  ; but should che
4e60: 63 6b 20 69 66 20 69 74 20 69 73 20 64 75 65 20  ck if it is due 
4e70: 74 6f 20 6c 61 63 6b 20 6f 66 20 72 65 73 6f 75  to lack of resou
4e80: 72 63 65 73 20 76 73 2e 20 70 72 65 72 65 71 75  rces vs. prerequ
4e90: 69 73 69 74 65 73 0a 09 09 20 20 28 64 65 62 75  isites...  (debu
4ea0: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22  g:print-info 1 "
4eb0: 53 6b 69 70 70 69 6e 67 20 22 20 28 74 65 73 74  Skipping " (test
4ec0: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d  s:testqueue-get-
4ed0: 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65  testname test-re
4ee0: 63 6f 72 64 29 20 22 20 22 20 69 74 65 6d 2d 70  cord) " " item-p
4ef0: 61 74 68 20 22 20 61 73 20 69 74 20 64 6f 65 73  ath " as it does
4f00: 6e 27 74 20 6d 61 74 63 68 20 22 20 74 65 73 74  n't match " test
4f10: 2d 70 61 74 74 73 29 0a 09 09 20 20 3b 3b 20 28  -patts)...  ;; (
4f20: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67  thread-sleep! *g
4f30: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09  lobal-delta*)...
4f40: 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c    (if (not (null
4f50: 3f 20 74 61 6c 29 29 0a 09 09 20 20 20 20 20 20  ? tal))...      
4f60: 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28  (loop (car tal)(
4f70: 63 64 72 20 74 61 6c 29 20 72 65 72 75 6e 73 29  cdr tal) reruns)
4f80: 29 29 0a 09 09 20 28 20 3b 3b 20 28 61 6e 64 0a  ))... ( ;; (and.
4f90: 09 09 20 20 28 6e 6f 74 20 28 68 61 73 68 2d 74  ..  (not (hash-t
4fa0: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74  able-ref/default
4fb0: 20 74 65 73 74 2d 72 65 67 69 73 74 65 72 79 20   test-registery 
4fc0: 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d  (runs:make-full-
4fd0: 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 6e  test-name test-n
4fe0: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 20 23  ame item-path) #
4ff0: 66 29 29 0a 09 09 20 20 20 20 20 20 3b 3b 20 28  f))...      ;; (
5000: 61 6e 64 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65  and max-concurre
5010: 6e 74 2d 6a 6f 62 73 20 28 3e 20 28 2d 20 6d 61  nt-jobs (> (- ma
5020: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62  x-concurrent-job
5030: 73 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 20 35  s num-running) 5
5040: 29 29 29 0a 09 09 20 20 28 64 65 62 75 67 3a 70  )))...  (debug:p
5050: 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 50 72 65  rint-info 4 "Pre
5060: 2d 72 65 67 69 73 74 65 72 69 6e 67 20 74 65 73  -registering tes
5070: 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f  t " test-name "/
5080: 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20 74 6f  " item-path " to
5090: 20 63 72 65 61 74 65 20 70 6c 61 63 65 68 6f 6c   create placehol
50a0: 64 65 72 22 20 29 0a 09 09 20 20 28 6f 70 65 6e  der" )...  (open
50b0: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 74 65  -run-close db:te
50c0: 73 74 73 2d 72 65 67 69 73 74 65 72 2d 74 65 73  sts-register-tes
50d0: 74 20 23 66 20 72 75 6e 2d 69 64 20 74 65 73 74  t #f run-id test
50e0: 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29  -name item-path)
50f0: 0a 09 09 20 20 28 68 61 73 68 2d 74 61 62 6c 65  ...  (hash-table
5100: 2d 73 65 74 21 20 74 65 73 74 2d 72 65 67 69 73  -set! test-regis
5110: 74 65 72 79 20 28 72 75 6e 73 3a 6d 61 6b 65 2d  tery (runs:make-
5120: 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 74  full-test-name t
5130: 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61  est-name item-pa
5140: 74 68 29 20 23 74 29 0a 09 09 20 20 3b 3b 20 28  th) #t)...  ;; (
5150: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67  thread-sleep! *g
5160: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 28 72  lobal-delta*).(r
5170: 75 6e 73 3a 73 68 72 69 6e 6b 2d 63 61 6e 2d 72  uns:shrink-can-r
5180: 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65  un-more-tests-de
5190: 6c 61 79 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28  lay)...  (loop (
51a0: 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20  car newtal)(cdr 
51b0: 6e 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29 29  newtal) reruns))
51c0: 0a 09 09 20 28 28 6e 6f 74 20 68 61 76 65 2d 72  ... ((not have-r
51d0: 65 73 6f 75 72 63 65 73 29 20 3b 3b 20 73 69 6d  esources) ;; sim
51e0: 70 6c 79 20 74 72 79 20 61 67 61 69 6e 20 61 66  ply try again af
51f0: 74 65 72 20 77 61 69 74 69 6e 67 20 61 20 73 65  ter waiting a se
5200: 63 6f 6e 64 0a 09 09 20 20 28 64 65 62 75 67 3a  cond...  (debug:
5210: 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 6e 6f  print-info 1 "no
5220: 20 72 65 73 6f 75 72 63 65 73 20 74 6f 20 72 75   resources to ru
5230: 6e 20 6e 65 77 20 74 65 73 74 73 2c 20 77 61 69  n new tests, wai
5240: 74 69 6e 67 20 2e 2e 2e 22 29 0a 09 09 20 20 3b  ting ...")...  ;
5250: 3b 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21  ; (thread-sleep!
5260: 20 28 2b 20 32 20 2a 67 6c 6f 62 61 6c 2d 64 65   (+ 2 *global-de
5270: 6c 74 61 2a 29 29 0a 09 09 20 20 3b 3b 20 63 6f  lta*))...  ;; co
5280: 75 6c 64 20 68 61 76 65 20 64 6f 6e 65 20 68 65  uld have done he
5290: 64 20 74 61 6c 20 68 65 72 65 20 62 75 74 20 64  d tal here but d
52a0: 6f 69 6e 67 20 63 61 72 2f 63 64 72 20 6f 66 20  oing car/cdr of 
52b0: 6e 65 77 74 61 6c 20 74 6f 20 72 6f 74 61 74 65  newtal to rotate
52c0: 20 74 65 73 74 73 0a 09 09 20 20 28 6c 6f 6f 70   tests...  (loop
52d0: 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64   (car newtal)(cd
52e0: 72 20 6e 65 77 74 61 6c 29 20 72 65 72 75 6e 73  r newtal) reruns
52f0: 29 29 0a 09 09 20 28 28 61 6e 64 20 68 61 76 65  ))... ((and have
5300: 2d 72 65 73 6f 75 72 63 65 73 0a 09 09 20 20 20  -resources...   
5310: 20 20 20 20 28 6f 72 20 28 6e 75 6c 6c 3f 20 70      (or (null? p
5320: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a  rereqs-not-met).
5330: 09 09 09 20 20 20 28 61 6e 64 20 28 65 71 3f 20  ...   (and (eq? 
5340: 74 65 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76  testmode 'toplev
5350: 65 6c 29 0a 09 09 09 09 28 6e 75 6c 6c 3f 20 6e  el).....(null? n
5360: 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 29 29 29  on-completed))))
5370: 0a 09 09 20 20 28 72 75 6e 3a 74 65 73 74 20 72  ...  (run:test r
5380: 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 6b 65  un-id runname ke
5390: 79 76 61 6c 6c 73 74 20 74 65 73 74 2d 72 65 63  yvallst test-rec
53a0: 6f 72 64 20 66 6c 61 67 73 20 23 66 29 0a 28 72  ord flags #f).(r
53b0: 75 6e 73 3a 73 68 72 69 6e 6b 2d 63 61 6e 2d 72  uns:shrink-can-r
53c0: 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65  un-more-tests-de
53d0: 6c 61 79 29 0a 09 09 20 20 3b 3b 20 28 74 68 72  lay)...  ;; (thr
53e0: 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62  ead-sleep! *glob
53f0: 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 20 20 28  al-delta*)...  (
5400: 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74  if (not (null? t
5410: 61 6c 29 29 0a 09 09 20 20 20 20 20 20 28 6c 6f  al))...      (lo
5420: 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63 64 72  op (car tal)(cdr
5430: 20 74 61 6c 29 20 72 65 72 75 6e 73 29 29 29 0a   tal) reruns))).
5440: 09 09 20 28 65 6c 73 65 20 3b 3b 20 6d 75 73 74  .. (else ;; must
5450: 20 62 65 20 77 65 20 68 61 76 65 20 75 6e 6d 65   be we have unme
5460: 74 20 70 72 65 72 65 71 75 69 73 69 74 65 73 0a  t prerequisites.
5470: 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ..    (debug:pri
5480: 6e 74 20 34 20 22 46 41 49 4c 53 3a 20 22 20 66  nt 4 "FAILS: " f
5490: 61 69 6c 73 29 0a 09 09 20 20 20 20 3b 3b 20 49  ails)...    ;; I
54a0: 66 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 20 6f 66  f one or more of
54b0: 20 74 68 65 20 70 72 65 72 65 71 73 2d 6e 6f 74   the prereqs-not
54c0: 2d 6d 65 74 20 61 72 65 20 46 41 49 4c 20 74 68  -met are FAIL th
54d0: 65 6e 20 77 65 20 63 61 6e 20 69 73 73 75 65 0a  en we can issue.
54e0: 09 09 20 20 20 20 3b 3b 20 61 20 6d 65 73 73 61  ..    ;; a messa
54f0: 67 65 20 61 6e 64 20 64 72 6f 70 20 68 65 64 20  ge and drop hed 
5500: 66 72 6f 6d 20 74 68 65 20 69 74 65 6d 73 20 74  from the items t
5510: 6f 20 62 65 20 70 72 6f 63 65 73 73 65 64 2e 0a  o be processed..
5520: 09 09 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f  ..    (if (null?
5530: 20 66 61 69 6c 73 29 0a 09 09 09 28 62 65 67 69   fails)....(begi
5540: 6e 0a 09 09 09 20 20 3b 3b 20 63 6f 75 6c 64 6e  n....  ;; couldn
5550: 27 74 20 72 75 6e 2c 20 74 61 6b 65 20 61 20 62  't run, take a b
5560: 72 65 61 74 68 65 72 0a 09 09 09 20 20 28 64 65  reather....  (de
5570: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34  bug:print-info 4
5580: 20 22 53 68 6f 75 6c 64 6e 27 74 20 72 65 61 6c   "Shouldn't real
5590: 6c 79 20 67 65 74 20 68 65 72 65 2c 20 72 61 63  ly get here, rac
55a0: 65 20 63 6f 6e 64 69 74 69 6f 6e 3f 20 55 6e 61  e condition? Una
55b0: 62 6c 65 20 74 6f 20 6c 61 75 6e 63 68 20 6d 6f  ble to launch mo
55c0: 72 65 20 74 65 73 74 73 20 61 74 20 74 68 69 73  re tests at this
55d0: 20 6d 6f 6d 65 6e 74 2c 20 6b 69 6c 6c 69 6e 67   moment, killing
55e0: 20 74 69 6d 65 20 2e 2e 2e 22 29 0a 09 09 09 20   time ...").... 
55f0: 20 3b 3b 20 28 74 68 72 65 61 64 2d 73 6c 65 65   ;; (thread-slee
5600: 70 21 20 28 2b 20 30 2e 30 31 20 2a 67 6c 6f 62  p! (+ 0.01 *glob
5610: 61 6c 2d 64 65 6c 74 61 2a 29 29 20 3b 3b 20 6c  al-delta*)) ;; l
5620: 6f 6e 67 20 73 6c 65 65 70 20 68 65 72 65 20 2d  ong sleep here -
5630: 20 6e 6f 20 72 65 73 6f 75 72 63 65 73 2c 20 6d   no resources, m
5640: 61 79 20 61 73 20 77 65 6c 6c 20 62 65 20 70 61  ay as well be pa
5650: 74 69 65 6e 74 0a 09 09 09 20 20 3b 3b 20 77 65  tient....  ;; we
5660: 20 6d 61 64 65 20 6e 65 77 20 74 61 6c 20 62 79   made new tal by
5670: 20 73 74 69 63 6b 69 6e 67 20 68 65 64 20 61 74   sticking hed at
5680: 20 74 68 65 20 62 61 63 6b 20 6f 66 20 74 68 65   the back of the
5690: 20 6c 69 73 74 0a 09 09 09 20 20 28 6c 6f 6f 70   list....  (loop
56a0: 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64   (car newtal)(cd
56b0: 72 20 6e 65 77 74 61 6c 29 20 72 65 72 75 6e 73  r newtal) reruns
56c0: 29 29 0a 09 09 09 3b 3b 20 74 68 65 20 77 61 69  ))....;; the wai
56d0: 74 6f 6e 20 69 73 20 46 41 49 4c 20 73 6f 20 6e  ton is FAIL so n
56e0: 6f 20 70 6f 69 6e 74 20 69 6e 20 74 72 79 69 6e  o point in tryin
56f0: 67 20 74 6f 20 72 75 6e 20 68 65 64 20 65 76 65  g to run hed eve
5700: 72 20 61 67 61 69 6e 0a 09 09 09 28 69 66 20 28  r again....(if (
5710: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29  not (null? tal))
5720: 0a 09 09 09 20 20 20 20 28 69 66 20 28 76 65 63  ....    (if (vec
5730: 74 6f 72 3f 20 68 65 64 29 0a 09 09 09 09 28 62  tor? hed).....(b
5740: 65 67 69 6e 20 28 64 65 62 75 67 3a 70 72 69 6e  egin (debug:prin
5750: 74 20 31 20 22 57 41 52 4e 3a 20 44 72 6f 70 70  t 1 "WARN: Dropp
5760: 69 6e 67 20 74 65 73 74 20 22 20 28 64 62 3a 74  ing test " (db:t
5770: 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65  est-get-testname
5780: 20 68 65 64 29 20 22 2f 22 20 28 64 62 3a 74 65   hed) "/" (db:te
5790: 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68  st-get-item-path
57a0: 20 68 65 64 29 0a 09 09 09 09 09 09 20 20 20 20   hed).......    
57b0: 22 20 66 72 6f 6d 20 74 68 65 20 6c 61 75 6e 63  " from the launc
57c0: 68 20 6c 69 73 74 20 61 73 20 69 74 20 68 61 73  h list as it has
57d0: 20 70 72 65 72 65 71 75 69 73 74 65 73 20 74 68   prerequistes th
57e0: 61 74 20 61 72 65 20 46 41 49 4c 22 29 0a 28 72  at are FAIL").(r
57f0: 75 6e 73 3a 73 68 72 69 6e 6b 2d 63 61 6e 2d 72  uns:shrink-can-r
5800: 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65  un-more-tests-de
5810: 6c 61 79 29 0a 09 09 09 09 20 20 20 20 20 20 20  lay).....       
5820: 3b 3b 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70  ;; (thread-sleep
5830: 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a  ! *global-delta*
5840: 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 6c 6f  ).....       (lo
5850: 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63 64 72  op (car tal)(cdr
5860: 20 74 61 6c 29 20 28 63 6f 6e 73 20 68 65 64 20   tal) (cons hed 
5870: 72 65 72 75 6e 73 29 29 29 0a 09 09 09 09 28 62  reruns))).....(b
5880: 65 67 69 6e 0a 09 09 09 09 20 20 28 64 65 62 75  egin.....  (debu
5890: 67 3a 70 72 69 6e 74 20 31 20 22 57 41 52 4e 3a  g:print 1 "WARN:
58a0: 20 54 65 73 74 20 6e 6f 74 20 70 72 6f 63 65 73   Test not proces
58b0: 73 65 64 20 63 6f 72 72 65 63 74 6c 79 2e 20 43  sed correctly. C
58c0: 6f 75 6c 64 20 62 65 20 61 20 72 61 63 65 20 63  ould be a race c
58d0: 6f 6e 64 69 74 69 6f 6e 20 69 6e 20 79 6f 75 72  ondition in your
58e0: 20 74 65 73 74 20 69 6d 70 6c 65 6d 65 6e 74 61   test implementa
58f0: 74 69 6f 6e 3f 20 22 20 68 65 64 29 20 3b 3b 20  tion? " hed) ;; 
5900: 20 22 20 61 73 20 69 74 20 68 61 73 20 70 72 65   " as it has pre
5910: 72 65 71 75 69 73 74 65 73 20 74 68 61 74 20 61  requistes that a
5920: 72 65 20 46 41 49 4c 2e 20 28 4e 4f 54 45 3a 20  re FAIL. (NOTE: 
5930: 68 65 64 20 69 73 20 6e 6f 74 20 61 20 76 65 63  hed is not a vec
5940: 74 6f 72 29 22 29 0a 28 72 75 6e 73 3a 73 68 72  tor)").(runs:shr
5950: 69 6e 6b 2d 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65  ink-can-run-more
5960: 2d 74 65 73 74 73 2d 64 65 6c 61 79 29 0a 09 09  -tests-delay)...
5970: 09 09 20 20 3b 3b 20 28 74 68 72 65 61 64 2d 73  ..  ;; (thread-s
5980: 6c 65 65 70 21 20 28 2b 20 30 2e 30 31 20 2a 67  leep! (+ 0.01 *g
5990: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09  lobal-delta*))..
59a0: 09 09 09 20 20 28 6c 6f 6f 70 20 68 65 64 20 74  ...  (loop hed t
59b0: 61 6c 20 72 65 72 75 6e 73 29 29 29 29 29 29 29  al reruns)))))))
59c0: 29 29 20 3b 3b 20 45 4e 44 20 4f 46 20 49 4e 4e  )) ;; END OF INN
59d0: 45 52 20 43 4f 4e 44 0a 09 20 20 20 20 20 0a 09  ER COND..     ..
59e0: 20 20 20 20 20 3b 3b 20 63 61 73 65 20 77 68 65       ;; case whe
59f0: 72 65 20 61 6e 20 69 74 65 6d 73 20 63 61 6d 65  re an items came
5a00: 20 69 6e 20 61 73 20 61 20 6c 69 73 74 20 62 65   in as a list be
5a10: 65 6e 20 70 72 6f 63 65 73 73 65 64 0a 09 20 20  en processed..  
5a20: 20 20 20 28 28 61 6e 64 20 28 6c 69 73 74 3f 20     ((and (list? 
5a30: 69 74 65 6d 73 29 20 20 20 20 20 3b 3b 20 74 68  items)     ;; th
5a40: 75 73 20 77 65 20 6b 6e 6f 77 20 6f 75 72 20 69  us we know our i
5a50: 74 65 6d 73 20 61 72 65 20 61 6c 72 65 61 64 79  tems are already
5a60: 20 63 61 6c 63 75 6c 61 74 65 64 0a 09 09 20 20   calculated...  
5a70: 20 28 6e 6f 74 20 20 20 69 74 65 6d 64 61 74 29   (not   itemdat)
5a80: 29 20 3b 3b 20 61 6e 64 20 6e 6f 74 20 79 65 74  ) ;; and not yet
5a90: 20 65 78 70 61 6e 64 65 64 20 69 6e 74 6f 20 74   expanded into t
5aa0: 68 65 20 6c 69 73 74 20 6f 66 20 74 68 69 6e 67  he list of thing
5ab0: 73 20 74 6f 20 62 65 20 64 6f 6e 65 0a 09 20 20  s to be done..  
5ac0: 20 20 20 20 28 69 66 20 28 61 6e 64 20 28 64 65      (if (and (de
5ad0: 62 75 67 3a 64 65 62 75 67 2d 6d 6f 64 65 20 31  bug:debug-mode 1
5ae0: 29 20 3b 3b 20 28 3e 3d 20 2a 76 65 72 62 6f 73  ) ;; (>= *verbos
5af0: 69 74 79 2a 20 31 29 0a 09 09 20 20 20 20 20 20  ity* 1)...      
5b00: 20 28 3e 20 28 6c 65 6e 67 74 68 20 69 74 65 6d   (> (length item
5b10: 73 29 20 30 29 0a 09 09 20 20 20 20 20 20 20 28  s) 0)...       (
5b20: 3e 20 28 6c 65 6e 67 74 68 20 28 63 61 72 20 69  > (length (car i
5b30: 74 65 6d 73 29 29 20 30 29 29 0a 09 09 20 20 28  tems)) 0))...  (
5b40: 70 70 20 69 74 65 6d 73 29 29 0a 09 20 20 20 20  pp items))..    
5b50: 20 20 28 66 6f 72 2d 65 61 63 68 0a 09 20 20 20    (for-each..   
5b60: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6d 79 2d      (lambda (my-
5b70: 69 74 65 6d 64 61 74 29 0a 09 09 20 28 6c 65 74  itemdat)... (let
5b80: 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d 72 65 63  * ((new-test-rec
5b90: 6f 72 64 20 28 6c 65 74 20 28 28 6e 65 77 72 65  ord (let ((newre
5ba0: 63 20 28 6d 61 6b 65 2d 74 65 73 74 73 3a 74 65  c (make-tests:te
5bb0: 73 74 71 75 65 75 65 29 29 29 0a 09 09 09 09 09  stqueue)))......
5bc0: 20 20 20 28 76 65 63 74 6f 72 2d 63 6f 70 79 21     (vector-copy!
5bd0: 20 74 65 73 74 2d 72 65 63 6f 72 64 20 6e 65 77   test-record new
5be0: 72 65 63 29 0a 09 09 09 09 09 20 20 20 6e 65 77  rec)......   new
5bf0: 72 65 63 29 29 0a 09 09 09 28 6d 79 2d 69 74 65  rec))....(my-ite
5c00: 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 73  m-path (item-lis
5c10: 74 2d 3e 70 61 74 68 20 6d 79 2d 69 74 65 6d 64  t->path my-itemd
5c20: 61 74 29 29 29 0a 09 09 20 20 20 28 69 66 20 28  at)))...   (if (
5c30: 74 65 73 74 73 3a 6d 61 74 63 68 20 74 65 73 74  tests:match test
5c40: 2d 70 61 74 74 73 20 68 65 64 20 6d 79 2d 69 74  -patts hed my-it
5c50: 65 6d 2d 70 61 74 68 29 20 3b 3b 20 28 70 61 74  em-path) ;; (pat
5c60: 74 2d 6c 69 73 74 2d 6d 61 74 63 68 20 6d 79 2d  t-list-match my-
5c70: 69 74 65 6d 2d 70 61 74 68 20 69 74 65 6d 2d 70  item-path item-p
5c80: 61 74 74 73 29 20 20 20 20 20 20 20 20 20 20 20  atts)           
5c90: 3b 3b 20 79 65 73 2c 20 77 65 20 77 61 6e 74 20  ;; yes, we want 
5ca0: 74 6f 20 70 72 6f 63 65 73 73 20 74 68 69 73 20  to process this 
5cb0: 69 74 65 6d 2c 20 4e 4f 54 45 3a 20 53 68 6f 75  item, NOTE: Shou
5cc0: 6c 64 20 6e 6f 74 20 6e 65 65 64 20 74 68 69 73  ld not need this
5cd0: 20 63 68 65 63 6b 20 68 65 72 65 21 0a 09 09 20   check here!... 
5ce0: 20 20 20 20 20 20 28 6c 65 74 20 28 28 6e 65 77        (let ((new
5cf0: 74 65 73 74 6e 61 6d 65 20 28 72 75 6e 73 3a 6d  testname (runs:m
5d00: 61 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61  ake-full-test-na
5d10: 6d 65 20 68 65 64 20 6d 79 2d 69 74 65 6d 2d 70  me hed my-item-p
5d20: 61 74 68 29 29 29 20 20 20 20 3b 3b 20 74 65 73  ath)))    ;; tes
5d30: 74 20 6e 61 6d 65 73 20 61 72 65 20 75 6e 69 71  t names are uniq
5d40: 75 65 20 6f 6e 20 74 65 73 74 6e 61 6d 65 2f 69  ue on testname/i
5d50: 74 65 6d 2d 70 61 74 68 0a 09 09 09 20 28 74 65  tem-path.... (te
5d60: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65  sts:testqueue-se
5d70: 74 2d 69 74 65 6d 73 21 20 20 20 20 20 6e 65 77  t-items!     new
5d80: 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 23 66 29  -test-record #f)
5d90: 0a 09 09 09 20 28 74 65 73 74 73 3a 74 65 73 74  .... (tests:test
5da0: 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 64 61  queue-set-itemda
5db0: 74 21 20 20 20 6e 65 77 2d 74 65 73 74 2d 72 65  t!   new-test-re
5dc0: 63 6f 72 64 20 6d 79 2d 69 74 65 6d 64 61 74 29  cord my-itemdat)
5dd0: 0a 09 09 09 20 28 74 65 73 74 73 3a 74 65 73 74  .... (tests:test
5de0: 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 5f 70  queue-set-item_p
5df0: 61 74 68 21 20 6e 65 77 2d 74 65 73 74 2d 72 65  ath! new-test-re
5e00: 63 6f 72 64 20 6d 79 2d 69 74 65 6d 2d 70 61 74  cord my-item-pat
5e10: 68 29 0a 09 09 09 20 28 68 61 73 68 2d 74 61 62  h).... (hash-tab
5e20: 6c 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 63  le-set! test-rec
5e30: 6f 72 64 73 20 6e 65 77 74 65 73 74 6e 61 6d 65  ords newtestname
5e40: 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64   new-test-record
5e50: 29 0a 09 09 09 20 28 73 65 74 21 20 74 61 6c 20  ).... (set! tal 
5e60: 28 63 6f 6e 73 20 6e 65 77 74 65 73 74 6e 61 6d  (cons newtestnam
5e70: 65 20 74 61 6c 29 29 29 29 29 29 20 3b 3b 20 73  e tal)))))) ;; s
5e80: 69 6e 63 65 20 74 68 65 73 65 20 61 72 65 20 69  ince these are i
5e90: 74 65 6d 69 7a 65 64 20 63 72 65 61 74 65 20 6e  temized create n
5ea0: 65 77 20 74 65 73 74 20 6e 61 6d 65 73 20 74 65  ew test names te
5eb0: 73 74 6e 61 6d 65 2f 69 74 65 6d 70 61 74 68 0a  stname/itempath.
5ec0: 09 20 20 20 20 20 20 20 69 74 65 6d 73 29 0a 09  .       items)..
5ed0: 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28        (if (not (
5ee0: 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 20 20  null? tal))...  
5ef0: 28 62 65 67 69 6e 0a 09 09 20 20 20 20 28 64 65  (begin...    (de
5f00: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34  bug:print-info 4
5f10: 20 22 45 6e 64 20 6f 66 20 69 74 65 6d 73 20 6c   "End of items l
5f20: 69 73 74 2c 20 6c 6f 6f 70 69 6e 67 20 77 69 74  ist, looping wit
5f30: 68 20 6e 65 78 74 20 61 66 74 65 72 20 73 68 6f  h next after sho
5f40: 72 74 20 64 65 6c 61 79 22 29 0a 20 20 20 20 20  rt delay").     
5f50: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b                 ;
5f60: 3b 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21  ; (thread-sleep!
5f70: 20 28 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c   (+ 0.01 *global
5f80: 2d 64 65 6c 74 61 2a 29 29 0a 09 09 20 20 20 20  -delta*))...    
5f90: 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28  (loop (car tal)(
5fa0: 63 64 72 20 74 61 6c 29 20 72 65 72 75 6e 73 29  cdr tal) reruns)
5fb0: 29 29 29 0a 0a 09 20 20 20 20 20 3b 3b 20 69 66  )))...     ;; if
5fc0: 20 69 74 65 6d 73 20 69 73 20 61 20 70 72 6f 63   items is a proc
5fd0: 20 74 68 65 6e 20 6e 65 65 64 20 74 6f 20 72 75   then need to ru
5fe0: 6e 20 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d  n items:get-item
5ff0: 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 2c 20 67  s-from-config, g
6000: 65 74 20 74 68 65 20 6c 69 73 74 20 61 6e 64 20  et the list and 
6010: 6c 6f 6f 70 20 0a 09 20 20 20 20 20 3b 3b 20 20  loop ..     ;;  
6020: 20 20 2d 20 62 75 74 20 6f 6e 6c 79 20 64 6f 20    - but only do 
6030: 74 68 61 74 20 69 66 20 72 65 73 6f 75 72 63 65  that if resource
6040: 73 20 65 78 69 73 74 20 74 6f 20 6b 69 63 6b 20  s exist to kick 
6050: 6f 66 66 20 74 68 65 20 6a 6f 62 0a 09 20 20 20  off the job..   
6060: 20 20 28 28 6f 72 20 28 70 72 6f 63 65 64 75 72    ((or (procedur
6070: 65 3f 20 69 74 65 6d 73 29 28 65 71 3f 20 69 74  e? items)(eq? it
6080: 65 6d 73 20 27 68 61 76 65 2d 70 72 6f 63 65 64  ems 'have-proced
6090: 75 72 65 29 29 0a 09 20 20 20 20 20 20 28 6c 65  ure))..      (le
60a0: 74 20 28 28 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65  t ((can-run-more
60b0: 20 20 20 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75      (runs:can-ru
60c0: 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 74 65 73  n-more-tests tes
60d0: 74 2d 72 65 63 6f 72 64 29 29 29 0a 09 09 28 69  t-record)))...(i
60e0: 66 20 28 61 6e 64 20 28 6c 69 73 74 3f 20 63 61  f (and (list? ca
60f0: 6e 2d 72 75 6e 2d 6d 6f 72 65 29 0a 09 09 09 20  n-run-more).... 
6100: 28 63 61 72 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72  (car can-run-mor
6110: 65 29 29 0a 09 09 20 20 20 20 28 6c 65 74 2a 20  e))...    (let* 
6120: 28 28 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65  ((prereqs-not-me
6130: 74 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73  t (open-run-clos
6140: 65 20 64 62 3a 67 65 74 2d 70 72 65 72 65 71 73  e db:get-prereqs
6150: 2d 6e 6f 74 2d 6d 65 74 20 23 66 20 72 75 6e 2d  -not-met #f run-
6160: 69 64 20 77 61 69 74 6f 6e 73 20 69 74 65 6d 2d  id waitons item-
6170: 70 61 74 68 20 6d 6f 64 65 3a 20 74 65 73 74 6d  path mode: testm
6180: 6f 64 65 29 29 0a 09 09 09 20 20 20 28 66 61 69  ode))....   (fai
6190: 6c 73 20 20 20 20 20 20 20 20 20 20 20 28 72 75  ls           (ru
61a0: 6e 73 3a 63 61 6c 63 2d 66 61 69 6c 73 20 70 72  ns:calc-fails pr
61b0: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a  ereqs-not-met)).
61c0: 09 09 09 20 20 20 28 6e 6f 6e 2d 63 6f 6d 70 6c  ...   (non-compl
61d0: 65 74 65 64 20 20 20 28 72 75 6e 73 3a 63 61 6c  eted   (runs:cal
61e0: 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 74 65 64 20  c-not-completed 
61f0: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29  prereqs-not-met)
6200: 29 29 0a 09 09 20 20 20 20 20 20 28 64 65 62 75  ))...      (debu
6210: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 38 20 22  g:print-info 8 "
6220: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 3a 20 22 20  can-run-more: " 
6230: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 0a 09 09 09  can-run-more....
6240: 09 20 20 20 22 5c 6e 20 74 65 73 74 6e 61 6d 65  .   "\n testname
6250: 3a 20 20 20 20 20 20 20 20 22 20 68 65 64 0a 09  :        " hed..
6260: 09 09 09 20 20 20 22 5c 6e 20 70 72 65 72 65 71  ...   "\n prereq
6270: 73 2d 6e 6f 74 2d 6d 65 74 3a 20 22 20 28 72 75  s-not-met: " (ru
6280: 6e 73 3a 70 72 65 74 74 79 2d 73 74 72 69 6e 67  ns:pretty-string
6290: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74   prereqs-not-met
62a0: 29 0a 09 09 09 09 20 20 20 22 5c 6e 20 6e 6f 6e  ).....   "\n non
62b0: 2d 63 6f 6d 70 6c 65 74 65 64 3a 20 20 20 22 20  -completed:   " 
62c0: 28 72 75 6e 73 3a 70 72 65 74 74 79 2d 73 74 72  (runs:pretty-str
62d0: 69 6e 67 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65  ing non-complete
62e0: 64 29 20 0a 09 09 09 09 20 20 20 22 5c 6e 20 66  d) .....   "\n f
62f0: 61 69 6c 73 3a 20 20 20 20 20 20 20 20 20 20 20  ails:           
6300: 22 20 28 72 75 6e 73 3a 70 72 65 74 74 79 2d 73  " (runs:pretty-s
6310: 74 72 69 6e 67 20 66 61 69 6c 73 29 0a 09 09 09  tring fails)....
6320: 09 20 20 20 22 5c 6e 20 74 65 73 74 6d 6f 64 65  .   "\n testmode
6330: 3a 20 20 20 20 20 20 20 20 22 20 74 65 73 74 6d  :        " testm
6340: 6f 64 65 0a 09 09 09 09 20 20 20 22 5c 6e 20 6e  ode.....   "\n n
6350: 75 6d 2d 72 65 74 72 69 65 73 3a 20 20 20 20 20  um-retries:     
6360: 22 20 6e 75 6d 2d 72 65 74 72 69 65 73 0a 09 09  " num-retries...
6370: 09 09 20 20 20 22 5c 6e 20 28 65 71 3f 20 74 65  ..   "\n (eq? te
6380: 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c  stmode 'toplevel
6390: 29 3a 20 22 20 28 65 71 3f 20 74 65 73 74 6d 6f  ): " (eq? testmo
63a0: 64 65 20 27 74 6f 70 6c 65 76 65 6c 29 0a 09 09  de 'toplevel)...
63b0: 09 09 20 20 20 22 5c 6e 20 28 6e 75 6c 6c 3f 20  ..   "\n (null? 
63c0: 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 3a 20  non-completed): 
63d0: 20 20 20 22 20 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d     " (null? non-
63e0: 63 6f 6d 70 6c 65 74 65 64 29 0a 09 09 09 09 20  completed)..... 
63f0: 20 20 22 5c 6e 20 72 65 72 75 6e 73 3a 20 20 20    "\n reruns:   
6400: 20 20 20 20 20 20 20 22 20 72 65 72 75 6e 73 0a         " reruns.
6410: 09 09 09 09 20 20 20 22 5c 6e 20 69 74 65 6d 73  ....   "\n items
6420: 3a 20 20 20 20 20 20 20 20 20 20 20 22 20 69 74  :           " it
6430: 65 6d 73 0a 09 09 09 09 20 20 20 22 5c 6e 20 63  ems.....   "\n c
6440: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 3a 20 20 20 20  an-run-more:    
6450: 22 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 29 0a  " can-run-more).
6460: 09 09 20 20 20 20 20 20 3b 3b 20 28 74 68 72 65  ..      ;; (thre
6470: 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 30 2e 30  ad-sleep! (+ 0.0
6480: 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a  1 *global-delta*
6490: 29 29 0a 09 09 20 20 20 20 20 20 28 63 6f 6e 64  ))...      (cond
64a0: 20 3b 3b 20 49 4e 4e 45 52 20 43 4f 4e 44 20 23   ;; INNER COND #
64b0: 32 0a 09 09 20 20 20 20 20 20 20 28 28 6f 72 20  2...       ((or 
64c0: 28 6e 75 6c 6c 3f 20 70 72 65 72 65 71 73 2d 6e  (null? prereqs-n
64d0: 6f 74 2d 6d 65 74 29 20 3b 3b 20 61 6c 6c 20 70  ot-met) ;; all p
64e0: 72 65 72 65 71 73 20 6d 65 74 2c 20 66 69 72 65  rereqs met, fire
64f0: 20 6f 66 66 20 74 68 65 20 74 65 73 74 0a 09 09   off the test...
6500: 09 20 20 20 20 3b 3b 20 6f 72 2c 20 69 66 20 69  .    ;; or, if i
6510: 74 20 69 73 20 61 20 27 74 6f 70 6c 65 76 65 6c  t is a 'toplevel
6520: 20 74 65 73 74 20 61 6e 64 20 61 6c 6c 20 70 72   test and all pr
6530: 65 72 65 71 73 20 6e 6f 74 20 6d 65 74 20 61 72  ereqs not met ar
6540: 65 20 43 4f 4d 50 4c 45 54 45 44 20 74 68 65 6e  e COMPLETED then
6550: 20 6c 61 75 6e 63 68 0a 09 09 09 20 20 20 20 28   launch....    (
6560: 61 6e 64 20 28 65 71 3f 20 74 65 73 74 6d 6f 64  and (eq? testmod
6570: 65 20 27 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09  e 'toplevel)....
6580: 09 20 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d  . (null? non-com
6590: 70 6c 65 74 65 64 29 29 29 0a 09 09 09 28 6c 65  pleted)))....(le
65a0: 74 20 28 28 74 65 73 74 2d 6e 61 6d 65 20 28 74  t ((test-name (t
65b0: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67  ests:testqueue-g
65c0: 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74  et-testname test
65d0: 2d 72 65 63 6f 72 64 29 29 29 0a 09 09 09 20 20  -record)))....  
65e0: 28 73 65 74 65 6e 76 20 22 4d 54 5f 54 45 53 54  (setenv "MT_TEST
65f0: 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65  _NAME" test-name
6600: 29 20 3b 3b 20 0a 09 09 09 20 20 28 73 65 74 65  ) ;; ....  (sete
6610: 6e 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20  nv "MT_RUNNAME" 
6620: 20 20 72 75 6e 6e 61 6d 65 29 0a 09 09 09 20 20    runname)....  
6630: 28 73 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e  (set-megatest-en
6640: 76 2d 76 61 72 73 20 72 75 6e 2d 69 64 29 20 3b  v-vars run-id) ;
6650: 3b 20 74 68 65 73 65 20 6d 61 79 20 62 65 20 6e  ; these may be n
6660: 65 65 64 65 64 20 62 79 20 74 68 65 20 6c 61 75  eeded by the lau
6670: 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 73 0a 09  nching process..
6680: 09 09 20 20 28 6c 65 74 20 28 28 69 74 65 6d 73  ..  (let ((items
6690: 2d 6c 69 73 74 20 28 69 74 65 6d 73 3a 67 65 74  -list (items:get
66a0: 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66  -items-from-conf
66b0: 69 67 20 74 63 6f 6e 66 69 67 29 29 29 0a 09 09  ig tconfig)))...
66c0: 09 20 20 20 20 28 69 66 20 28 6c 69 73 74 3f 20  .    (if (list? 
66d0: 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09 09 09 09  items-list).....
66e0: 28 62 65 67 69 6e 0a 09 09 09 09 20 20 28 74 65  (begin.....  (te
66f0: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65  sts:testqueue-se
6700: 74 2d 69 74 65 6d 73 21 20 74 65 73 74 2d 72 65  t-items! test-re
6710: 63 6f 72 64 20 69 74 65 6d 73 2d 6c 69 73 74 29  cord items-list)
6720: 0a 09 09 09 09 20 20 3b 3b 20 28 74 68 72 65 61  .....  ;; (threa
6730: 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c  d-sleep! *global
6740: 2d 64 65 6c 74 61 2a 29 0a 09 09 09 09 20 20 28  -delta*).....  (
6750: 6c 6f 6f 70 20 68 65 64 20 74 61 6c 20 72 65 72  loop hed tal rer
6760: 75 6e 73 29 29 0a 09 09 09 09 28 62 65 67 69 6e  uns)).....(begin
6770: 0a 09 09 09 09 20 20 28 64 65 62 75 67 3a 70 72  .....  (debug:pr
6780: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 54 68  int 0 "ERROR: Th
6790: 65 20 70 72 6f 63 20 66 72 6f 6d 20 72 65 61 64  e proc from read
67a0: 69 6e 67 20 74 68 65 20 73 65 74 75 70 20 64 69  ing the setup di
67b0: 64 20 6e 6f 74 20 79 69 65 6c 64 20 61 20 6c 69  d not yield a li
67c0: 73 74 20 2d 20 70 6c 65 61 73 65 20 72 65 70 6f  st - please repo
67d0: 72 74 20 74 68 69 73 22 29 0a 09 09 09 09 20 20  rt this").....  
67e0: 28 65 78 69 74 20 31 29 29 29 29 29 29 0a 09 09  (exit 1))))))...
67f0: 20 20 20 20 20 20 20 28 28 6e 75 6c 6c 3f 20 66         ((null? f
6800: 61 69 6c 73 29 0a 09 09 09 28 64 65 62 75 67 3a  ails)....(debug:
6810: 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 66 61  print-info 4 "fa
6820: 69 6c 73 20 69 73 20 6e 75 6c 6c 2c 20 6d 6f 76  ils is null, mov
6830: 69 6e 67 20 6f 6e 20 69 6e 20 74 68 65 20 71 75  ing on in the qu
6840: 65 75 65 20 62 75 74 20 6b 65 65 70 69 6e 67 20  eue but keeping 
6850: 22 20 68 65 64 20 22 20 66 6f 72 20 6e 6f 77 22  " hed " for now"
6860: 29 0a 09 09 09 3b 3b 20 6f 6e 6c 79 20 69 6e 63  )....;; only inc
6870: 72 65 6d 65 6e 74 20 6e 75 6d 2d 72 65 74 72 69  rement num-retri
6880: 65 73 20 77 68 65 6e 20 74 68 65 72 65 20 61 72  es when there ar
6890: 65 20 6e 6f 20 74 65 73 74 73 20 72 75 6e 69 6e  e no tests runin
68a0: 67 0a 09 09 09 28 69 66 20 28 65 71 3f 20 30 20  g....(if (eq? 0 
68b0: 28 6c 69 73 74 2d 72 65 66 20 63 61 6e 2d 72 75  (list-ref can-ru
68c0: 6e 2d 6d 6f 72 65 20 31 29 29 0a 09 09 09 20 20  n-more 1))....  
68d0: 20 20 28 62 65 67 69 6e 0a 09 09 09 20 20 20 20    (begin....    
68e0: 20 20 28 69 66 20 28 3e 20 6e 75 6d 2d 72 65 74    (if (> num-ret
68f0: 72 69 65 73 20 31 30 30 29 20 3b 3b 20 66 69 72  ries 100) ;; fir
6900: 73 74 20 31 30 30 20 72 65 74 72 69 65 73 20 61  st 100 retries a
6910: 72 65 20 6c 6f 77 20 74 69 6d 65 20 63 6f 73 74  re low time cost
6920: 0a 09 09 09 09 20 20 28 74 68 72 65 61 64 2d 73  .....  (thread-s
6930: 6c 65 65 70 21 20 28 2b 20 32 20 2a 67 6c 6f 62  leep! (+ 2 *glob
6940: 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09 09 09  al-delta*)).....
6950: 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21    (thread-sleep!
6960: 20 28 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c   (+ 0.01 *global
6970: 2d 64 65 6c 74 61 2a 29 29 29 0a 09 09 09 20 20  -delta*)))....  
6980: 20 20 20 20 28 73 65 74 21 20 6e 75 6d 2d 72 65      (set! num-re
6990: 74 72 69 65 73 20 28 2b 20 6e 75 6d 2d 72 65 74  tries (+ num-ret
69a0: 72 69 65 73 20 31 29 29 29 29 0a 09 09 09 28 69  ries 1))))....(i
69b0: 66 20 28 3e 20 6e 75 6d 2d 72 65 74 72 69 65 73  f (> num-retries
69c0: 20 20 6d 61 78 2d 72 65 74 72 69 65 73 29 0a 09    max-retries)..
69d0: 09 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28  ..    (if (not (
69e0: 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 09 09  null? tal)).....
69f0: 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28  (loop (car tal)(
6a00: 63 64 72 20 74 61 6c 29 20 72 65 72 75 6e 73 29  cdr tal) reruns)
6a10: 29 0a 09 09 09 20 20 20 20 28 6c 6f 6f 70 20 28  )....    (loop (
6a20: 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20  car newtal)(cdr 
6a30: 6e 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29 29  newtal) reruns))
6a40: 29 20 3b 3b 20 61 6e 20 69 73 73 75 65 20 77 69  ) ;; an issue wi
6a50: 74 68 20 70 72 65 72 65 71 73 20 6e 6f 74 20 79  th prereqs not y
6a60: 65 74 20 6d 65 74 3f 0a 09 09 20 20 20 20 20 20  et met?...      
6a70: 20 28 28 61 6e 64 20 28 6e 6f 74 20 28 6e 75 6c   ((and (not (nul
6a80: 6c 3f 20 66 61 69 6c 73 29 29 28 65 71 3f 20 74  l? fails))(eq? t
6a90: 65 73 74 6d 6f 64 65 20 27 6e 6f 72 6d 61 6c 29  estmode 'normal)
6aa0: 29 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e  )....(debug:prin
6ab0: 74 2d 69 6e 66 6f 20 31 20 22 74 65 73 74 20 22  t-info 1 "test "
6ac0: 20 20 68 65 64 20 22 20 28 6d 6f 64 65 3d 22 20    hed " (mode=" 
6ad0: 74 65 73 74 6d 6f 64 65 20 22 29 20 68 61 73 20  testmode ") has 
6ae0: 66 61 69 6c 65 64 20 70 72 65 72 65 71 75 69 73  failed prerequis
6af0: 69 74 65 28 73 29 3b 20 22 0a 09 09 09 09 20 20  ite(s); ".....  
6b00: 20 20 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72     (string-inter
6b10: 73 70 65 72 73 65 20 28 6d 61 70 20 28 6c 61 6d  sperse (map (lam
6b20: 62 64 61 20 28 74 29 28 63 6f 6e 63 20 28 64 62  bda (t)(conc (db
6b30: 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61  :test-get-testna
6b40: 6d 65 20 74 29 20 22 3a 22 20 28 64 62 3a 74 65  me t) ":" (db:te
6b50: 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74 29 22  st-get-state t)"
6b60: 2f 22 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73  /"(db:test-get-s
6b70: 74 61 74 75 73 20 74 29 29 29 20 66 61 69 6c 73  tatus t))) fails
6b80: 29 20 22 2c 20 22 29 0a 09 09 09 09 20 20 20 20  ) ", ").....    
6b90: 20 22 2c 20 72 65 6d 6f 76 69 6e 67 20 69 74 20   ", removing it 
6ba0: 66 72 6f 6d 20 74 6f 2d 64 6f 20 6c 69 73 74 22  from to-do list"
6bb0: 29 0a 09 09 09 28 69 66 20 28 6e 6f 74 20 28 6e  )....(if (not (n
6bc0: 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 09 20 20  ull? tal))....  
6bd0: 20 20 28 62 65 67 69 6e 0a 20 20 20 20 20 20 20    (begin.       
6be0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
6bf0: 20 20 20 20 20 20 20 3b 3b 20 28 74 68 72 65 61         ;; (threa
6c00: 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c  d-sleep! *global
6c10: 2d 64 65 6c 74 61 2a 29 0a 09 09 09 20 20 20 20  -delta*)....    
6c20: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c    (loop (car tal
6c30: 29 28 63 64 72 20 74 61 6c 29 28 63 6f 6e 73 20  )(cdr tal)(cons 
6c40: 68 65 64 20 72 65 72 75 6e 73 29 29 29 29 29 0a  hed reruns))))).
6c50: 09 09 20 20 20 20 20 20 20 28 65 6c 73 65 0a 09  ..       (else..
6c60: 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 38  ..(debug:print 8
6c70: 20 22 45 52 52 4f 52 3a 20 4e 6f 20 68 61 6e 64   "ERROR: No hand
6c80: 6c 65 72 20 66 6f 72 20 74 68 69 73 20 63 6f 6e  ler for this con
6c90: 64 69 74 69 6f 6e 2e 22 29 0a 09 09 09 28 74 68  dition.")....(th
6ca0: 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 31  read-sleep! (+ 1
6cb0: 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29   *global-delta*)
6cc0: 29 0a 09 09 09 28 6c 6f 6f 70 20 28 63 61 72 20  )....(loop (car 
6cd0: 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74  newtal)(cdr newt
6ce0: 61 6c 29 20 72 65 72 75 6e 73 29 29 29 29 20 3b  al) reruns)))) ;
6cf0: 3b 20 45 4e 44 20 4f 46 20 49 46 20 43 41 4e 20  ; END OF IF CAN 
6d00: 52 55 4e 20 4d 4f 52 45 0a 0a 09 09 20 20 20 20  RUN MORE....    
6d10: 3b 3b 20 69 66 20 63 61 6e 27 74 20 72 75 6e 20  ;; if can't run 
6d20: 6d 6f 72 65 20 6a 75 73 74 20 6c 6f 6f 70 20 77  more just loop w
6d30: 69 74 68 20 6e 65 78 74 20 70 6f 73 73 69 62 6c  ith next possibl
6d40: 65 20 74 65 73 74 0a 09 09 20 20 20 20 28 62 65  e test...    (be
6d50: 67 69 6e 0a 09 09 20 20 20 20 20 20 28 64 65 62  gin...      (deb
6d60: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20  ug:print-info 4 
6d70: 22 70 72 6f 63 65 73 73 69 6e 67 20 74 68 65 20  "processing the 
6d80: 63 61 73 65 20 77 69 74 68 20 61 20 6c 61 6d 62  case with a lamb
6d90: 64 61 20 66 6f 72 20 69 74 65 6d 73 20 6f 72 20  da for items or 
6da0: 27 68 61 76 65 2d 70 72 6f 63 65 64 75 72 65 2e  'have-procedure.
6db0: 20 4d 6f 76 69 6e 67 20 74 68 72 6f 75 67 68 20   Moving through 
6dc0: 74 68 65 20 71 75 65 75 65 20 77 69 74 68 6f 75  the queue withou
6dd0: 74 20 64 72 6f 70 70 69 6e 67 20 22 20 68 65 64  t dropping " hed
6de0: 29 0a 09 09 20 20 20 20 20 20 3b 3b 20 28 74 68  )...      ;; (th
6df0: 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 32  read-sleep! (+ 2
6e00: 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29   *global-delta*)
6e10: 29 0a 09 09 20 20 20 20 20 20 28 6c 6f 6f 70 20  )...      (loop 
6e20: 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72  (car newtal)(cdr
6e30: 20 6e 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29   newtal) reruns)
6e40: 29 29 29 29 20 3b 3b 20 45 4e 44 20 4f 46 20 28  )))) ;; END OF (
6e50: 6f 72 20 28 70 72 6f 63 65 64 75 72 65 3f 20 69  or (procedure? i
6e60: 74 65 6d 73 29 28 65 71 3f 20 69 74 65 6d 73 20  tems)(eq? items 
6e70: 27 68 61 76 65 2d 70 72 6f 63 65 64 75 72 65 29  'have-procedure)
6e80: 29 0a 09 20 20 20 20 20 0a 09 20 20 20 20 20 3b  )..     ..     ;
6e90: 3b 20 74 68 69 73 20 63 61 73 65 20 73 68 6f 75  ; this case shou
6ea0: 6c 64 20 6e 6f 74 20 68 61 70 70 65 6e 2c 20 61  ld not happen, a
6eb0: 64 64 65 64 20 74 6f 20 68 65 6c 70 20 63 61 74  dded to help cat
6ec0: 63 68 20 61 6e 79 20 62 75 67 73 0a 09 20 20 20  ch any bugs..   
6ed0: 20 20 28 28 61 6e 64 20 28 6c 69 73 74 3f 20 69    ((and (list? i
6ee0: 74 65 6d 73 29 20 69 74 65 6d 64 61 74 29 0a 09  tems) itemdat)..
6ef0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
6f00: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 53 68 6f  nt 0 "ERROR: Sho
6f10: 75 6c 64 20 6e 6f 74 20 68 61 76 65 20 61 20 6c  uld not have a l
6f20: 69 73 74 20 6f 66 20 69 74 65 6d 73 20 69 6e 20  ist of items in 
6f30: 61 20 74 65 73 74 20 61 6e 64 20 74 68 65 20 69  a test and the i
6f40: 74 65 6d 73 70 61 74 68 20 73 65 74 20 2d 20 70  temspath set - p
6f50: 6c 65 61 73 65 20 72 65 70 6f 72 74 20 74 68 69  lease report thi
6f60: 73 22 29 0a 09 20 20 20 20 20 20 28 65 78 69 74  s")..      (exit
6f70: 20 31 29 29 0a 09 20 20 20 20 20 28 28 6e 6f 74   1))..     ((not
6f80: 20 28 6e 75 6c 6c 3f 20 72 65 72 75 6e 73 29 29   (null? reruns))
6f90: 0a 09 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28  ..      (let* ((
6fa0: 6e 65 77 6c 73 74 20 28 74 65 73 74 73 3a 66 69  newlst (tests:fi
6fb0: 6c 74 65 72 2d 6e 6f 6e 2d 72 75 6e 6e 61 62 6c  lter-non-runnabl
6fc0: 65 20 72 75 6e 2d 69 64 20 74 61 6c 20 74 65 73  e run-id tal tes
6fd0: 74 2d 72 65 63 6f 72 64 73 29 29 20 3b 3b 20 69  t-records)) ;; i
6fe0: 2e 65 2e 20 6e 6f 74 20 46 41 49 4c 2c 20 57 41  .e. not FAIL, WA
6ff0: 49 56 45 44 2c 20 49 4e 43 4f 4d 50 4c 45 54 45  IVED, INCOMPLETE
7000: 2c 20 50 41 53 53 2c 20 4b 49 4c 4c 45 44 2c 0a  , PASS, KILLED,.
7010: 09 09 20 20 20 20 20 28 6a 75 6e 6b 65 64 20 28  ..     (junked (
7020: 6c 73 65 74 2d 64 69 66 66 65 72 65 6e 63 65 20  lset-difference 
7030: 65 71 75 61 6c 3f 20 74 61 6c 20 6e 65 77 6c 73  equal? tal newls
7040: 74 29 29 29 0a 09 09 28 64 65 62 75 67 3a 70 72  t)))...(debug:pr
7050: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 66 75 6c 6c  int-info 4 "full
7060: 20 64 72 6f 70 20 74 68 72 6f 75 67 68 2c 20 69   drop through, i
7070: 66 20 72 65 72 75 6e 73 20 69 73 20 6c 65 73 73  f reruns is less
7080: 20 74 68 61 6e 20 31 30 30 20 77 65 20 77 69 6c   than 100 we wil
7090: 6c 20 66 6f 72 63 65 20 72 65 74 72 79 20 74 68  l force retry th
70a0: 65 6d 2c 20 72 65 72 75 6e 73 3d 22 20 72 65 72  em, reruns=" rer
70b0: 75 6e 73 20 22 2c 20 74 61 6c 3d 22 20 74 61 6c  uns ", tal=" tal
70c0: 29 0a 09 09 28 69 66 20 28 3c 20 6e 75 6d 2d 72  )...(if (< num-r
70d0: 65 74 72 69 65 73 20 6d 61 78 2d 72 65 74 72 69  etries max-retri
70e0: 65 73 29 0a 09 09 20 20 20 20 28 73 65 74 21 20  es)...    (set! 
70f0: 6e 65 77 6c 73 74 20 28 61 70 70 65 6e 64 20 72  newlst (append r
7100: 65 72 75 6e 73 20 6e 65 77 6c 73 74 29 29 29 0a  eruns newlst))).
7110: 09 09 28 73 65 74 21 20 6e 75 6d 2d 72 65 74 72  ..(set! num-retr
7120: 69 65 73 20 28 2b 20 6e 75 6d 2d 72 65 74 72 69  ies (+ num-retri
7130: 65 73 20 31 29 29 0a 09 09 3b 3b 20 28 74 68 72  es 1))...;; (thr
7140: 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 31 20  ead-sleep! (+ 1 
7150: 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29  *global-delta*))
7160: 0a 09 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c  ...(if (not (nul
7170: 6c 3f 20 6e 65 77 6c 73 74 29 29 0a 09 09 20 20  l? newlst))...  
7180: 20 20 3b 3b 20 73 69 6e 63 65 20 72 65 72 75 6e    ;; since rerun
7190: 73 20 68 61 76 65 20 62 65 65 6e 20 74 61 63 6b  s have been tack
71a0: 65 64 20 6f 6e 20 74 6f 20 6e 65 77 6c 73 74 20  ed on to newlst 
71b0: 63 72 65 61 74 65 20 6e 65 77 20 72 65 72 75 6e  create new rerun
71c0: 73 20 66 72 6f 6d 20 6a 75 6e 6b 65 64 0a 09 09  s from junked...
71d0: 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e      (loop (car n
71e0: 65 77 6c 73 74 29 28 63 64 72 20 6e 65 77 6c 73  ewlst)(cdr newls
71f0: 74 29 28 64 65 6c 65 74 65 2d 64 75 70 6c 69 63  t)(delete-duplic
7200: 61 74 65 73 20 6a 75 6e 6b 65 64 29 29 29 29 29  ates junked)))))
7210: 0a 09 20 20 20 20 20 28 28 6e 6f 74 20 28 6e 75  ..     ((not (nu
7220: 6c 6c 3f 20 74 61 6c 29 29 0a 09 20 20 20 20 20  ll? tal))..     
7230: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
7240: 66 6f 20 34 20 22 49 27 6d 20 70 72 65 74 74 79  fo 4 "I'm pretty
7250: 20 73 75 72 65 20 49 20 73 68 6f 75 6c 64 6e 27   sure I shouldn'
7260: 74 20 67 65 74 20 68 65 72 65 2e 22 29 29 0a 09  t get here."))..
7270: 20 20 20 20 20 28 65 6c 73 65 0a 09 20 20 20 20       (else..    
7280: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69    (debug:print-i
7290: 6e 66 6f 20 34 20 22 45 78 69 74 69 6e 67 20 6c  nfo 4 "Exiting l
72a0: 6f 6f 70 20 77 69 74 68 2e 2e 2e 5c 6e 20 20 68  oop with...\n  h
72b0: 65 64 3d 22 20 68 65 64 20 22 5c 6e 20 20 74 61  ed=" hed "\n  ta
72c0: 6c 3d 22 20 74 61 6c 20 22 5c 6e 20 20 72 65 72  l=" tal "\n  rer
72d0: 75 6e 73 3d 22 20 72 65 72 75 6e 73 29 29 0a 09  uns=" reruns))..
72e0: 20 20 20 20 20 29 29 29 29 20 3b 3b 20 4c 45 54       )))) ;; LET
72f0: 2a 20 28 28 74 65 73 74 2d 72 65 63 6f 72 64 0a  * ((test-record.
7300: 0a 20 20 20 20 3b 3b 20 77 65 20 67 65 74 20 68  .    ;; we get h
7310: 65 72 65 20 6f 6e 20 22 64 72 6f 70 20 74 68 72  ere on "drop thr
7320: 6f 75 67 68 22 20 2d 20 6c 6f 6f 70 20 66 6f 72  ough" - loop for
7330: 20 6e 65 78 74 20 74 65 73 74 20 69 6e 20 71 75   next test in qu
7340: 65 75 65 0a 20 20 20 20 3b 3b 20 46 49 58 4d 45  eue.    ;; FIXME
7350: 21 21 21 21 20 54 48 49 53 20 53 48 4f 55 4c 44  !!!! THIS SHOULD
7360: 20 4e 4f 54 20 52 45 51 55 49 52 45 20 41 4e 20   NOT REQUIRE AN 
7370: 45 58 49 54 21 21 21 21 21 21 21 0a 20 20 20 20  EXIT!!!!!!!.    
7380: 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  .    (debug:prin
7390: 74 2d 69 6e 66 6f 20 31 20 22 41 6c 6c 20 74 65  t-info 1 "All te
73a0: 73 74 73 20 6c 61 75 6e 63 68 65 64 22 29 0a 20  sts launched"). 
73b0: 20 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70     (thread-sleep
73c0: 21 20 30 2e 35 29 0a 20 20 20 20 3b 3b 20 46 49  ! 0.5).    ;; FI
73d0: 58 4d 45 21 20 54 68 69 73 20 68 61 72 73 68 20  XME! This harsh 
73e0: 65 78 69 74 20 73 68 6f 75 6c 64 20 6e 6f 74 20  exit should not 
73f0: 62 65 20 6e 65 63 65 73 73 61 72 79 2e 2e 2e 2e  be necessary....
7400: 0a 20 20 20 20 3b 3b 20 28 69 66 20 28 6e 6f 74  .    ;; (if (not
7410: 20 2a 72 75 6e 72 65 6d 6f 74 65 2a 29 28 65 78   *runremote*)(ex
7420: 69 74 29 29 20 3b 3b 20 0a 20 20 20 20 23 66 29  it)) ;; .    #f)
7430: 29 20 3b 3b 20 72 65 74 75 72 6e 20 61 20 23 66  ) ;; return a #f
7440: 20 61 73 20 61 20 68 69 6e 74 20 74 68 61 74 20   as a hint that 
7450: 77 65 20 61 72 65 20 64 6f 6e 65 0a 20 20 3b 3b  we are done.  ;;
7460: 20 48 65 72 65 20 77 65 20 6e 65 65 64 20 74 6f   Here we need to
7470: 20 63 68 65 63 6b 20 74 68 61 74 20 61 6c 6c 20   check that all 
7480: 74 68 65 20 74 65 73 74 73 20 72 65 6d 61 69 6e  the tests remain
7490: 69 6e 67 20 74 6f 20 62 65 20 72 75 6e 20 61 72  ing to be run ar
74a0: 65 20 65 6c 69 67 69 62 6c 65 20 74 6f 20 72 75  e eligible to ru
74b0: 6e 0a 20 20 3b 3b 20 61 6e 64 20 61 72 65 20 6e  n.  ;; and are n
74c0: 6f 74 20 62 6c 6f 63 6b 65 64 20 62 79 20 66 61  ot blocked by fa
74d0: 69 6c 65 64 0a 20 20 0a 0a 3b 3b 20 70 61 72 65  iled.  ..;; pare
74e0: 6e 74 2d 74 65 73 74 20 69 73 20 74 68 65 72 65  nt-test is there
74f0: 20 61 73 20 61 20 70 6c 61 63 65 68 6f 6c 64 65   as a placeholde
7500: 72 20 66 6f 72 20 77 68 65 6e 20 70 61 72 65 6e  r for when paren
7510: 74 2d 74 65 73 74 73 20 63 61 6e 20 62 65 20 72  t-tests can be r
7520: 75 6e 20 61 73 20 61 20 73 65 74 75 70 20 73 74  un as a setup st
7530: 65 70 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 3a  ep.(define (run:
7540: 74 65 73 74 20 72 75 6e 2d 69 64 20 72 75 6e 6e  test run-id runn
7550: 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20 74 65  ame keyvallst te
7560: 73 74 2d 72 65 63 6f 72 64 20 66 6c 61 67 73 20  st-record flags 
7570: 70 61 72 65 6e 74 2d 74 65 73 74 29 0a 20 20 3b  parent-test).  ;
7580: 3b 20 41 6c 6c 20 74 68 65 73 65 20 76 61 72 73  ; All these vars
7590: 20 6d 69 67 68 74 20 62 65 20 72 65 66 65 72 65   might be refere
75a0: 6e 63 65 64 20 62 79 20 74 68 65 20 74 65 73 74  nced by the test
75b0: 63 6f 6e 66 69 67 20 66 69 6c 65 20 72 65 61 64  config file read
75c0: 65 72 0a 20 20 28 6c 65 74 2a 20 28 28 74 65 73  er.  (let* ((tes
75d0: 74 2d 6e 61 6d 65 20 20 20 20 28 74 65 73 74 73  t-name    (tests
75e0: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74  :testqueue-get-t
75f0: 65 73 74 6e 61 6d 65 20 20 20 74 65 73 74 2d 72  estname   test-r
7600: 65 63 6f 72 64 29 29 0a 09 20 28 74 65 73 74 2d  ecord)).. (test-
7610: 77 61 69 74 6f 6e 73 20 28 74 65 73 74 73 3a 74  waitons (tests:t
7620: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 77 61 69  estqueue-get-wai
7630: 74 6f 6e 73 20 20 20 20 74 65 73 74 2d 72 65 63  tons    test-rec
7640: 6f 72 64 29 29 0a 09 20 28 74 65 73 74 2d 63 6f  ord)).. (test-co
7650: 6e 66 20 20 20 20 28 74 65 73 74 73 3a 74 65 73  nf    (tests:tes
7660: 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 63  tqueue-get-testc
7670: 6f 6e 66 69 67 20 74 65 73 74 2d 72 65 63 6f 72  onfig test-recor
7680: 64 29 29 0a 09 20 28 69 74 65 6d 64 61 74 20 20  d)).. (itemdat  
7690: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71      (tests:testq
76a0: 75 65 75 65 2d 67 65 74 2d 69 74 65 6d 64 61 74  ueue-get-itemdat
76b0: 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29      test-record)
76c0: 29 0a 09 20 28 74 65 73 74 2d 70 61 74 68 20 20  ).. (test-path  
76d0: 20 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68    (conc *toppath
76e0: 2a 20 22 2f 74 65 73 74 73 2f 22 20 74 65 73 74  * "/tests/" test
76f0: 2d 6e 61 6d 65 29 29 20 3b 3b 20 63 6f 75 6c 64  -name)) ;; could
7700: 20 75 73 65 20 74 65 73 74 73 3a 67 65 74 2d 74   use tests:get-t
7710: 65 73 74 63 6f 6e 66 69 67 20 68 65 72 65 20 2e  estconfig here .
7720: 2e 2e 0a 09 20 28 66 6f 72 63 65 20 20 20 20 20  .... (force     
7730: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72     (hash-table-r
7740: 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73  ef/default flags
7750: 20 22 2d 66 6f 72 63 65 22 20 23 66 29 29 0a 09   "-force" #f))..
7760: 20 28 72 65 72 75 6e 20 20 20 20 20 20 20 20 28   (rerun        (
7770: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64  hash-table-ref/d
7780: 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 72  efault flags "-r
7790: 65 72 75 6e 22 20 23 66 29 29 0a 09 20 28 6b 65  erun" #f)).. (ke
77a0: 65 70 67 6f 69 6e 67 20 20 20 20 28 68 61 73 68  epgoing    (hash
77b0: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75  -table-ref/defau
77c0: 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 65 70 67  lt flags "-keepg
77d0: 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 28 69 74  oing" #f)).. (it
77e0: 65 6d 2d 70 61 74 68 20 20 20 20 20 22 22 29 0a  em-path     "").
77f0: 09 20 28 64 62 20 20 20 20 20 20 20 20 20 20 20  . (db           
7800: 23 66 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a  #f)).    (debug:
7810: 70 72 69 6e 74 20 34 0a 09 09 20 22 74 65 73 74  print 4... "test
7820: 2d 63 6f 6e 66 69 67 3a 20 22 20 28 68 61 73 68  -config: " (hash
7830: 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65  -table->alist te
7840: 73 74 2d 63 6f 6e 66 29 0a 09 09 20 22 5c 6e 20  st-conf)... "\n 
7850: 20 20 69 74 65 6d 64 61 74 3a 20 22 20 69 74 65    itemdat: " ite
7860: 6d 64 61 74 0a 09 09 20 29 0a 20 20 20 20 3b 3b  mdat... ).    ;;
7870: 20 73 65 74 74 69 6e 67 20 69 74 65 6d 64 61 74   setting itemdat
7880: 20 74 6f 20 61 20 6c 69 73 74 20 69 66 20 69 74   to a list if it
7890: 20 69 73 20 23 66 0a 20 20 20 20 28 69 66 20 28   is #f.    (if (
78a0: 6e 6f 74 20 69 74 65 6d 64 61 74 29 28 73 65 74  not itemdat)(set
78b0: 21 20 69 74 65 6d 64 61 74 20 27 28 29 29 29 0a  ! itemdat '())).
78c0: 20 20 20 20 28 73 65 74 21 20 69 74 65 6d 2d 70      (set! item-p
78d0: 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e  ath (item-list->
78e0: 70 61 74 68 20 69 74 65 6d 64 61 74 29 29 0a 20  path itemdat)). 
78f0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
7900: 32 20 22 41 74 74 65 6d 70 74 69 6e 67 20 74 6f  2 "Attempting to
7910: 20 6c 61 75 6e 63 68 20 74 65 73 74 20 22 20 74   launch test " t
7920: 65 73 74 2d 6e 61 6d 65 20 28 69 66 20 28 65 71  est-name (if (eq
7930: 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22  ual? item-path "
7940: 2f 22 29 20 22 2f 22 20 69 74 65 6d 2d 70 61 74  /") "/" item-pat
7950: 68 29 29 0a 20 20 20 20 28 73 65 74 65 6e 76 20  h)).    (setenv 
7960: 22 4d 54 5f 54 45 53 54 5f 4e 41 4d 45 22 20 74  "MT_TEST_NAME" t
7970: 65 73 74 2d 6e 61 6d 65 29 20 3b 3b 20 0a 20 20  est-name) ;; .  
7980: 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55    (setenv "MT_RU
7990: 4e 4e 41 4d 45 22 20 20 20 72 75 6e 6e 61 6d 65  NNAME"   runname
79a0: 29 0a 20 20 20 20 28 73 65 74 2d 6d 65 67 61 74  ).    (set-megat
79b0: 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 72 75 6e  est-env-vars run
79c0: 2d 69 64 29 20 3b 3b 20 74 68 65 73 65 20 6d 61  -id) ;; these ma
79d0: 79 20 62 65 20 6e 65 65 64 65 64 20 62 79 20 74  y be needed by t
79e0: 68 65 20 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f  he launching pro
79f0: 63 65 73 73 0a 20 20 20 20 28 63 68 61 6e 67 65  cess.    (change
7a00: 2d 64 69 72 65 63 74 6f 72 79 20 2a 74 6f 70 70  -directory *topp
7a10: 61 74 68 2a 29 0a 0a 20 20 20 20 3b 3b 20 48 65  ath*)..    ;; He
7a20: 72 65 20 69 73 20 77 68 65 72 65 20 74 68 65 20  re is where the 
7a30: 74 65 73 74 5f 6d 65 74 61 20 74 61 62 6c 65 20  test_meta table 
7a40: 69 73 20 62 65 73 74 20 75 70 64 61 74 65 64 0a  is best updated.
7a50: 20 20 20 20 3b 3b 20 59 65 73 2c 20 61 6e 6f 74      ;; Yes, anot
7a60: 68 65 72 20 75 73 65 20 6f 66 20 61 20 67 6c 6f  her use of a glo
7a70: 62 61 6c 20 66 6f 72 20 63 61 63 68 69 6e 67 2e  bal for caching.
7a80: 20 4e 65 65 64 20 61 20 62 65 74 74 65 72 20 77   Need a better w
7a90: 61 79 3f 0a 20 20 20 20 28 69 66 20 28 6e 6f 74  ay?.    (if (not
7aa0: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66   (hash-table-ref
7ab0: 2f 64 65 66 61 75 6c 74 20 2a 74 65 73 74 2d 6d  /default *test-m
7ac0: 65 74 61 2d 75 70 64 61 74 65 64 2a 20 74 65 73  eta-updated* tes
7ad0: 74 2d 6e 61 6d 65 20 23 66 29 29 0a 20 20 20 20  t-name #f)).    
7ae0: 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 28      (begin..   (
7af0: 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20  hash-table-set! 
7b00: 2a 74 65 73 74 2d 6d 65 74 61 2d 75 70 64 61 74  *test-meta-updat
7b10: 65 64 2a 20 74 65 73 74 2d 6e 61 6d 65 20 23 74  ed* test-name #t
7b20: 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 6f 70  ).           (op
7b30: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e  en-run-close run
7b40: 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65  s:update-test_me
7b50: 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20  ta db test-name 
7b60: 74 65 73 74 2d 63 6f 6e 66 29 29 29 0a 20 20 20  test-conf))).   
7b70: 20 0a 20 20 20 20 3b 3b 20 28 6c 61 6d 62 64 61   .    ;; (lambda
7b80: 20 28 69 74 65 6d 64 61 74 29 20 3b 3b 3b 20 28   (itemdat) ;;; (
7b90: 28 72 69 70 65 6e 65 73 73 20 22 6f 76 65 72 72  (ripeness "overr
7ba0: 69 70 65 22 29 20 28 74 65 6d 70 65 72 61 74 75  ipe") (temperatu
7bb0: 72 65 20 22 63 6f 6f 6c 22 29 20 28 73 65 61 73  re "cool") (seas
7bc0: 6f 6e 20 22 73 75 6d 6d 65 72 22 29 29 0a 20 20  on "summer")).  
7bd0: 20 20 28 6c 65 74 2a 20 28 28 6e 65 77 2d 74 65    (let* ((new-te
7be0: 73 74 2d 70 61 74 68 20 28 73 74 72 69 6e 67 2d  st-path (string-
7bf0: 69 6e 74 65 72 73 70 65 72 73 65 20 28 63 6f 6e  intersperse (con
7c00: 73 20 74 65 73 74 2d 70 61 74 68 20 28 6d 61 70  s test-path (map
7c10: 20 63 61 64 72 20 69 74 65 6d 64 61 74 29 29 20   cadr itemdat)) 
7c20: 22 2f 22 29 29 0a 09 20 20 20 28 6e 65 77 2d 74  "/"))..   (new-t
7c30: 65 73 74 2d 6e 61 6d 65 20 28 69 66 20 28 65 71  est-name (if (eq
7c40: 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22  ual? item-path "
7c50: 22 29 20 74 65 73 74 2d 6e 61 6d 65 20 28 63 6f  ") test-name (co
7c60: 6e 63 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22  nc test-name "/"
7c70: 20 69 74 65 6d 2d 70 61 74 68 29 29 29 20 3b 3b   item-path))) ;;
7c80: 20 6a 75 73 74 20 6e 65 65 64 20 69 74 20 74 6f   just need it to
7c90: 20 62 65 20 75 6e 69 71 75 65 0a 09 20 20 20 28   be unique..   (
7ca0: 74 65 73 74 2d 69 64 20 20 20 20 20 20 20 28 63  test-id       (c
7cb0: 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64 62  db:remote-run db
7cc0: 3a 67 65 74 2d 74 65 73 74 2d 69 64 20 23 66 20  :get-test-id #f 
7cd0: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d   run-id test-nam
7ce0: 65 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 20  e item-path)).. 
7cf0: 20 20 28 74 65 73 74 64 61 74 20 20 20 20 20 20    (testdat      
7d00: 20 28 63 64 62 3a 67 65 74 2d 74 65 73 74 2d 69   (cdb:get-test-i
7d10: 6e 66 6f 2d 62 79 2d 69 64 20 2a 72 75 6e 72 65  nfo-by-id *runre
7d20: 6d 6f 74 65 2a 20 74 65 73 74 2d 69 64 29 29 29  mote* test-id)))
7d30: 0a 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20  .      (if (not 
7d40: 74 65 73 74 64 61 74 29 0a 09 20 20 28 62 65 67  testdat)..  (beg
7d50: 69 6e 0a 09 20 20 20 20 3b 3b 20 65 6e 73 75 72  in..    ;; ensur
7d60: 65 20 74 68 61 74 20 74 68 65 20 70 61 74 68 20  e that the path 
7d70: 65 78 69 73 74 73 20 62 65 66 6f 72 65 20 72 65  exists before re
7d80: 67 69 73 74 65 72 69 6e 67 20 74 68 65 20 74 65  gistering the te
7d90: 73 74 0a 09 20 20 20 20 3b 3b 20 4e 4f 50 45 3a  st..    ;; NOPE:
7da0: 20 43 61 6e 6e 6f 74 21 20 44 6f 6e 27 74 20 6b   Cannot! Don't k
7db0: 6e 6f 77 20 79 65 74 20 77 68 69 63 68 20 64 69  now yet which di
7dc0: 73 6b 20 61 72 65 61 20 77 69 6c 6c 20 62 65 20  sk area will be 
7dd0: 61 73 73 69 67 6e 65 64 2e 2e 2e 2e 0a 09 20 20  assigned......  
7de0: 20 20 3b 3b 20 28 73 79 73 74 65 6d 20 28 63 6f    ;; (system (co
7df0: 6e 63 20 22 6d 6b 64 69 72 20 2d 70 20 22 20 6e  nc "mkdir -p " n
7e00: 65 77 2d 74 65 73 74 2d 70 61 74 68 29 29 0a 09  ew-test-path))..
7e10: 20 20 20 20 3b 3b 0a 09 20 20 20 20 3b 3b 20 28      ;;..    ;; (
7e20: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 74  open-run-close t
7e30: 65 73 74 73 3a 72 65 67 69 73 74 65 72 2d 74 65  ests:register-te
7e40: 73 74 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73  st db run-id tes
7e50: 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68  t-name item-path
7e60: 29 0a 09 20 20 20 20 3b 3b 0a 09 20 20 20 20 3b  )..    ;;..    ;
7e70: 3b 20 4e 42 2f 2f 20 66 6f 72 20 74 68 65 20 61  ; NB// for the a
7e80: 62 6f 76 65 20 6c 69 6e 65 2e 20 49 20 77 61 6e  bove line. I wan
7e90: 74 20 74 68 65 20 74 65 73 74 20 74 6f 20 62 65  t the test to be
7ea0: 20 72 65 67 69 73 74 65 72 65 64 20 6c 6f 6e 67   registered long
7eb0: 20 62 65 66 6f 72 65 20 74 68 69 73 20 72 6f 75   before this rou
7ec0: 74 69 6e 65 20 67 65 74 73 20 63 61 6c 6c 65 64  tine gets called
7ed0: 21 0a 09 20 20 20 20 3b 3b 0a 09 20 20 20 20 28  !..    ;;..    (
7ee0: 73 65 74 21 20 74 65 73 74 2d 69 64 20 28 6f 70  set! test-id (op
7ef0: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a  en-run-close db:
7f00: 67 65 74 2d 74 65 73 74 2d 69 64 20 64 62 20 72  get-test-id db r
7f10: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20  un-id test-name 
7f20: 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 20 20 20  item-path))..   
7f30: 20 28 69 66 20 28 6e 6f 74 20 74 65 73 74 2d 69   (if (not test-i
7f40: 64 29 0a 09 09 28 62 65 67 69 6e 0a 09 09 20 20  d)...(begin...  
7f50: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22  (debug:print 2 "
7f60: 57 41 52 4e 3a 20 54 65 73 74 20 6e 6f 74 20 70  WARN: Test not p
7f70: 72 65 2d 63 72 65 61 74 65 64 3f 20 74 65 73 74  re-created? test
7f80: 2d 6e 61 6d 65 3d 22 20 74 65 73 74 2d 6e 61 6d  -name=" test-nam
7f90: 65 20 22 2c 20 69 74 65 6d 2d 70 61 74 68 3d 22  e ", item-path="
7fa0: 20 69 74 65 6d 2d 70 61 74 68 20 22 2c 20 72 75   item-path ", ru
7fb0: 6e 2d 69 64 3d 22 20 72 75 6e 2d 69 64 29 0a 09  n-id=" run-id)..
7fc0: 09 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f  .  (open-run-clo
7fd0: 73 65 20 64 62 3a 74 65 73 74 73 2d 72 65 67 69  se db:tests-regi
7fe0: 73 74 65 72 2d 74 65 73 74 20 23 66 20 72 75 6e  ster-test #f run
7ff0: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74  -id test-name it
8000: 65 6d 2d 70 61 74 68 29 0a 09 09 20 20 28 73 65  em-path)...  (se
8010: 74 21 20 74 65 73 74 2d 69 64 20 28 6f 70 65 6e  t! test-id (open
8020: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65  -run-close db:ge
8030: 74 2d 74 65 73 74 2d 69 64 20 64 62 20 72 75 6e  t-test-id db run
8040: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74  -id test-name it
8050: 65 6d 2d 70 61 74 68 29 29 29 29 0a 09 20 20 20  em-path))))..   
8060: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
8070: 66 6f 20 34 20 22 74 65 73 74 2d 69 64 3d 22 20  fo 4 "test-id=" 
8080: 74 65 73 74 2d 69 64 20 22 2c 20 72 75 6e 2d 69  test-id ", run-i
8090: 64 3d 22 20 72 75 6e 2d 69 64 20 22 2c 20 74 65  d=" run-id ", te
80a0: 73 74 2d 6e 61 6d 65 3d 22 20 74 65 73 74 2d 6e  st-name=" test-n
80b0: 61 6d 65 20 22 2c 20 69 74 65 6d 2d 70 61 74 68  ame ", item-path
80c0: 3d 5c 22 22 20 69 74 65 6d 2d 70 61 74 68 20 22  =\"" item-path "
80d0: 5c 22 22 29 0a 09 20 20 20 20 28 73 65 74 21 20  \"")..    (set! 
80e0: 74 65 73 74 64 61 74 20 28 63 64 62 3a 67 65 74  testdat (cdb:get
80f0: 2d 74 65 73 74 2d 69 6e 66 6f 2d 62 79 2d 69 64  -test-info-by-id
8100: 20 2a 72 75 6e 72 65 6d 6f 74 65 2a 20 74 65 73   *runremote* tes
8110: 74 2d 69 64 29 29 29 29 0a 20 20 20 20 20 20 28  t-id)))).      (
8120: 73 65 74 21 20 74 65 73 74 2d 69 64 20 28 64 62  set! test-id (db
8130: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73  :test-get-id tes
8140: 74 64 61 74 29 29 0a 20 20 20 20 20 20 28 63 68  tdat)).      (ch
8150: 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 79 20 74  ange-directory t
8160: 65 73 74 2d 70 61 74 68 29 0a 20 20 20 20 20 20  est-path).      
8170: 28 63 61 73 65 20 28 69 66 20 66 6f 72 63 65 20  (case (if force 
8180: 3b 3b 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  ;; (args:get-arg
8190: 20 22 2d 66 6f 72 63 65 22 29 0a 09 09 27 4e 4f   "-force")...'NO
81a0: 54 5f 53 54 41 52 54 45 44 0a 09 09 28 69 66 20  T_STARTED...(if 
81b0: 74 65 73 74 64 61 74 0a 09 09 20 20 20 20 28 73  testdat...    (s
81c0: 74 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c 20 28 74  tring->symbol (t
81d0: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65  est:get-state te
81e0: 73 74 64 61 74 29 29 0a 09 09 20 20 20 20 27 66  stdat))...    'f
81f0: 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 72 74 29  ailed-to-insert)
8200: 29 0a 09 28 28 66 61 69 6c 65 64 2d 74 6f 2d 69  )..((failed-to-i
8210: 6e 73 65 72 74 29 0a 09 20 28 64 65 62 75 67 3a  nsert).. (debug:
8220: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
8230: 46 61 69 6c 65 64 20 74 6f 20 69 6e 73 65 72 74  Failed to insert
8240: 20 74 68 65 20 72 65 63 6f 72 64 20 69 6e 74 6f   the record into
8250: 20 74 68 65 20 64 62 22 29 29 0a 09 28 28 4e 4f   the db"))..((NO
8260: 54 5f 53 54 41 52 54 45 44 20 43 4f 4d 50 4c 45  T_STARTED COMPLE
8270: 54 45 44 20 44 45 4c 45 54 45 44 29 0a 09 20 28  TED DELETED).. (
8280: 6c 65 74 20 28 28 72 75 6e 66 6c 61 67 20 23 66  let ((runflag #f
8290: 29 29 0a 09 20 20 20 28 63 6f 6e 64 0a 09 20 20  ))..   (cond..  
82a0: 20 20 3b 3b 20 2d 66 6f 72 63 65 2c 20 72 75 6e    ;; -force, run
82b0: 20 6e 6f 20 6d 61 74 74 65 72 20 77 68 61 74 0a   no matter what.
82c0: 09 20 20 20 20 28 66 6f 72 63 65 20 28 73 65 74  .    (force (set
82d0: 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09  ! runflag #t))..
82e0: 20 20 20 20 3b 3b 20 4e 4f 54 5f 53 54 41 52 54      ;; NOT_START
82f0: 45 44 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65  ED, run no matte
8300: 72 20 77 68 61 74 0a 09 20 20 20 20 28 28 6d 65  r what..    ((me
8310: 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73  mber (test:get-s
8320: 74 61 74 65 20 74 65 73 74 64 61 74 29 20 27 28  tate testdat) '(
8330: 22 44 45 4c 45 54 45 44 22 20 22 4e 4f 54 5f 53  "DELETED" "NOT_S
8340: 54 41 52 54 45 44 22 29 29 28 73 65 74 21 20 72  TARTED"))(set! r
8350: 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20  unflag #t))..   
8360: 20 3b 3b 20 6e 6f 74 20 2d 72 65 72 75 6e 20 61   ;; not -rerun a
8370: 6e 64 20 50 41 53 53 2c 20 57 41 52 4e 20 6f 72  nd PASS, WARN or
8380: 20 43 48 45 43 4b 2c 20 64 6f 20 6e 6f 20 72 75   CHECK, do no ru
8390: 6e 0a 09 20 20 20 20 28 28 61 6e 64 20 28 6f 72  n..    ((and (or
83a0: 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09 20   (not rerun)... 
83b0: 20 20 20 20 20 6b 65 65 70 67 6f 69 6e 67 29 0a       keepgoing).
83c0: 09 09 20 20 3b 3b 20 52 65 71 75 69 72 65 20 74  ..  ;; Require t
83d0: 6f 20 66 6f 72 63 65 20 72 65 2d 72 75 6e 20 66  o force re-run f
83e0: 6f 72 20 43 4f 4d 50 4c 45 54 45 44 20 6f 72 20  or COMPLETED or 
83f0: 2a 61 6e 79 74 68 69 6e 67 2a 20 2b 20 50 41 53  *anything* + PAS
8400: 53 2c 57 41 52 4e 20 6f 72 20 43 48 45 43 4b 0a  S,WARN or CHECK.
8410: 09 09 20 20 28 6f 72 20 28 6d 65 6d 62 65 72 20  ..  (or (member 
8420: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73  (test:get-status
8430: 20 74 65 73 74 64 61 74 29 20 27 28 22 50 41 53   testdat) '("PAS
8440: 53 22 20 22 57 41 52 4e 22 20 22 43 48 45 43 4b  S" "WARN" "CHECK
8450: 22 20 22 53 4b 49 50 22 29 29 0a 09 09 20 20 20  " "SKIP"))...   
8460: 20 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74     (member (test
8470: 3a 67 65 74 2d 73 74 61 74 65 20 20 74 65 73 74  :get-state  test
8480: 64 61 74 29 20 27 28 22 43 4f 4d 50 4c 45 54 45  dat) '("COMPLETE
8490: 44 22 29 29 29 29 20 0a 09 20 20 20 20 20 28 64  D")))) ..     (d
84a0: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
84b0: 32 20 22 72 75 6e 6e 69 6e 67 20 74 65 73 74 20  2 "running test 
84c0: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20  " test-name "/" 
84d0: 69 74 65 6d 2d 70 61 74 68 20 22 20 73 75 70 70  item-path " supp
84e0: 72 65 73 73 65 64 20 61 73 20 69 74 20 69 73 20  ressed as it is 
84f0: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  " (test:get-stat
8500: 65 20 74 65 73 74 64 61 74 29 20 22 20 61 6e 64  e testdat) " and
8510: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61   " (test:get-sta
8520: 74 75 73 20 74 65 73 74 64 61 74 29 29 0a 09 20  tus testdat)).. 
8530: 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61      (set! runfla
8540: 67 20 23 66 29 29 0a 09 20 20 20 20 3b 3b 20 2d  g #f))..    ;; -
8550: 72 65 72 75 6e 20 61 6e 64 20 73 74 61 74 75 73  rerun and status
8560: 20 69 73 20 6f 6e 65 20 6f 66 20 74 68 65 20 73   is one of the s
8570: 70 65 63 69 66 65 64 2c 20 72 75 6e 20 69 74 0a  pecifed, run it.
8580: 09 20 20 20 20 28 28 61 6e 64 20 72 65 72 75 6e  .    ((and rerun
8590: 0a 09 09 20 20 28 6c 65 74 2a 20 28 28 72 65 72  ...  (let* ((rer
85a0: 75 6e 6c 73 74 20 20 20 28 73 74 72 69 6e 67 2d  unlst   (string-
85b0: 73 70 6c 69 74 20 72 65 72 75 6e 20 22 2c 22 29  split rerun ",")
85c0: 29 0a 09 09 09 20 28 6d 75 73 74 2d 72 65 72 75  ).... (must-reru
85d0: 6e 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a  n (member (test:
85e0: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64  get-status testd
85f0: 61 74 29 20 72 65 72 75 6e 6c 73 74 29 29 29 0a  at) rerunlst))).
8600: 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ..    (debug:pri
8610: 6e 74 2d 69 6e 66 6f 20 33 20 22 2d 72 65 72 75  nt-info 3 "-reru
8620: 6e 20 6c 69 73 74 3a 20 22 20 72 65 72 75 6e 20  n list: " rerun 
8630: 22 2c 20 74 65 73 74 2d 73 74 61 74 75 73 3a 20  ", test-status: 
8640: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  " (test:get-stat
8650: 75 73 20 74 65 73 74 64 61 74 29 22 2c 20 6d 75  us testdat)", mu
8660: 73 74 2d 72 65 72 75 6e 3a 20 22 20 6d 75 73 74  st-rerun: " must
8670: 2d 72 65 72 75 6e 29 0a 09 09 20 20 20 20 6d 75  -rerun)...    mu
8680: 73 74 2d 72 65 72 75 6e 29 29 0a 09 20 20 20 20  st-rerun))..    
8690: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
86a0: 66 6f 20 32 20 22 52 65 72 75 6e 20 66 6f 72 63  fo 2 "Rerun forc
86b0: 65 64 20 66 6f 72 20 74 65 73 74 20 22 20 74 65  ed for test " te
86c0: 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d  st-name "/" item
86d0: 2d 70 61 74 68 29 0a 09 20 20 20 20 20 28 73 65  -path)..     (se
86e0: 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a  t! runflag #t)).
86f0: 09 20 20 20 20 3b 3b 20 2d 6b 65 65 70 67 6f 69  .    ;; -keepgoi
8700: 6e 67 2c 20 64 6f 20 6e 6f 74 20 72 65 72 75 6e  ng, do not rerun
8710: 20 46 41 49 4c 0a 09 20 20 20 20 28 28 61 6e 64   FAIL..    ((and
8720: 20 6b 65 65 70 67 6f 69 6e 67 0a 09 09 20 20 28   keepgoing...  (
8730: 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74  member (test:get
8740: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29  -status testdat)
8750: 20 27 28 22 46 41 49 4c 22 29 29 29 0a 09 20 20   '("FAIL")))..  
8760: 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67     (set! runflag
8770: 20 23 66 29 29 0a 09 20 20 20 20 28 28 61 6e 64   #f))..    ((and
8780: 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09 20   (not rerun)... 
8790: 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67   (member (test:g
87a0: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61  et-status testda
87b0: 74 29 20 27 28 22 46 41 49 4c 22 20 22 6e 2f 61  t) '("FAIL" "n/a
87c0: 22 29 29 29 0a 09 20 20 20 20 20 28 73 65 74 21  ")))..     (set!
87d0: 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20   runflag #t)).. 
87e0: 20 20 20 28 65 6c 73 65 20 28 73 65 74 21 20 72     (else (set! r
87f0: 75 6e 66 6c 61 67 20 23 66 29 29 29 0a 09 20 20  unflag #f)))..  
8800: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 36 20   (debug:print 6 
8810: 22 52 55 4e 4e 49 4e 47 20 3d 3e 20 72 75 6e 66  "RUNNING => runf
8820: 6c 61 67 3a 20 22 20 72 75 6e 66 6c 61 67 20 22  lag: " runflag "
8830: 20 53 54 41 54 45 3a 20 22 20 28 74 65 73 74 3a   STATE: " (test:
8840: 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61  get-state testda
8850: 74 29 20 22 20 53 54 41 54 55 53 3a 20 22 20 28  t) " STATUS: " (
8860: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20  test:get-status 
8870: 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 28 69  testdat))..   (i
8880: 66 20 28 6e 6f 74 20 72 75 6e 66 6c 61 67 29 0a  f (not runflag).
8890: 09 20 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74  .       (if (not
88a0: 20 70 61 72 65 6e 74 2d 74 65 73 74 29 0a 09 09   parent-test)...
88b0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
88c0: 31 20 22 4e 4f 54 45 3a 20 4e 6f 74 20 73 74 61  1 "NOTE: Not sta
88d0: 72 74 69 6e 67 20 74 65 73 74 20 22 20 6e 65 77  rting test " new
88e0: 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 73 20  -test-name " as 
88f0: 69 74 20 69 73 20 73 74 61 74 65 20 5c 22 22 20  it is state \"" 
8900: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20  (test:get-state 
8910: 74 65 73 74 64 61 74 29 20 0a 09 09 09 09 22 5c  testdat) ....."\
8920: 22 20 61 6e 64 20 73 74 61 74 75 73 20 5c 22 22  " and status \""
8930: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75   (test:get-statu
8940: 73 20 74 65 73 74 64 61 74 29 20 22 5c 22 2c 20  s testdat) "\", 
8950: 75 73 65 20 2d 72 65 72 75 6e 20 5c 22 22 20 28  use -rerun \"" (
8960: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20  test:get-status 
8970: 74 65 73 74 64 61 74 29 0a 20 20 20 20 20 20 20  testdat).       
8980: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
8990: 20 20 20 20 20 20 20 20 20 22 5c 22 20 6f 72 20           "\" or 
89a0: 2d 66 6f 72 63 65 20 74 6f 20 6f 76 65 72 72 69  -force to overri
89b0: 64 65 22 29 29 0a 09 20 20 20 20 20 20 20 3b 3b  de"))..       ;;
89c0: 20 4e 4f 54 45 3a 20 4e 6f 20 6c 6f 6e 67 65 72   NOTE: No longer
89d0: 20 62 65 20 63 68 65 63 6b 69 6e 67 20 70 72 65   be checking pre
89e0: 72 65 71 75 69 73 69 74 65 73 20 68 65 72 65 21  requisites here!
89f0: 20 57 69 6c 6c 20 6e 65 76 65 72 20 67 65 74 20   Will never get 
8a00: 68 65 72 65 20 75 6e 6c 65 73 73 20 70 72 65 72  here unless prer
8a10: 65 71 73 20 61 72 65 0a 09 20 20 20 20 20 20 20  eqs are..       
8a20: 3b 3b 20 20 20 20 20 20 20 61 6c 72 65 61 64 79  ;;       already
8a30: 20 6d 65 74 2e 0a 09 20 20 20 20 20 20 20 28 69   met...       (i
8a40: 66 20 28 6e 6f 74 20 28 6c 61 75 6e 63 68 2d 74  f (not (launch-t
8a50: 65 73 74 20 23 66 20 72 75 6e 2d 69 64 20 72 75  est #f run-id ru
8a60: 6e 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 20  nname test-conf 
8a70: 6b 65 79 76 61 6c 6c 73 74 20 74 65 73 74 2d 6e  keyvallst test-n
8a80: 61 6d 65 20 74 65 73 74 2d 70 61 74 68 20 69 74  ame test-path it
8a90: 65 6d 64 61 74 20 66 6c 61 67 73 29 29 0a 09 09  emdat flags))...
8aa0: 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20     (begin...    
8ab0: 20 28 70 72 69 6e 74 20 22 45 52 52 4f 52 3a 20   (print "ERROR: 
8ac0: 46 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68  Failed to launch
8ad0: 20 74 68 65 20 74 65 73 74 2e 20 45 78 69 74 69   the test. Exiti
8ae0: 6e 67 20 61 73 20 73 6f 6f 6e 20 61 73 20 70 6f  ng as soon as po
8af0: 73 73 69 62 6c 65 22 29 0a 09 09 20 20 20 20 20  ssible")...     
8b00: 28 73 65 74 21 20 2a 67 6c 6f 62 61 6c 65 78 69  (set! *globalexi
8b10: 74 73 74 61 74 75 73 2a 20 31 29 20 3b 3b 20 0a  tstatus* 1) ;; .
8b20: 09 09 20 20 20 20 20 28 70 72 6f 63 65 73 73 2d  ..     (process-
8b30: 73 69 67 6e 61 6c 20 28 63 75 72 72 65 6e 74 2d  signal (current-
8b40: 70 72 6f 63 65 73 73 2d 69 64 29 20 73 69 67 6e  process-id) sign
8b50: 61 6c 2f 6b 69 6c 6c 29 29 29 29 29 29 0a 09 28  al/kill))))))..(
8b60: 28 4b 49 4c 4c 45 44 29 20 0a 09 20 28 64 65 62  (KILLED) .. (deb
8b70: 75 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 45  ug:print 1 "NOTE
8b80: 3a 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d  : " new-test-nam
8b90: 65 20 22 20 69 73 20 61 6c 72 65 61 64 79 20 72  e " is already r
8ba0: 75 6e 6e 69 6e 67 20 6f 72 20 77 61 73 20 65 78  unning or was ex
8bb0: 70 6c 69 63 74 6c 79 20 6b 69 6c 6c 65 64 2c 20  plictly killed, 
8bc0: 75 73 65 20 2d 66 6f 72 63 65 20 74 6f 20 6c 61  use -force to la
8bd0: 75 6e 63 68 20 69 74 2e 22 29 29 0a 09 28 28 4c  unch it."))..((L
8be0: 41 55 4e 43 48 45 44 20 52 45 4d 4f 54 45 48 4f  AUNCHED REMOTEHO
8bf0: 53 54 53 54 41 52 54 20 52 55 4e 4e 49 4e 47 29  STSTART RUNNING)
8c00: 20 20 0a 09 20 28 69 66 20 28 3e 20 28 2d 20 28    .. (if (> (- (
8c10: 63 75 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73 29  current-seconds)
8c20: 28 2b 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  (+ (db:test-get-
8c30: 65 76 65 6e 74 5f 74 69 6d 65 20 74 65 73 74 64  event_time testd
8c40: 61 74 29 0a 09 09 09 09 20 20 20 20 20 20 20 28  at).....       (
8c50: 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 5f  db:test-get-run_
8c60: 64 75 72 61 74 69 6f 6e 20 74 65 73 74 64 61 74  duration testdat
8c70: 29 29 29 0a 09 09 36 30 30 29 20 3b 3b 20 69 2e  )))...600) ;; i.
8c80: 65 2e 20 6e 6f 20 75 70 64 61 74 65 20 66 6f 72  e. no update for
8c90: 20 6d 6f 72 65 20 74 68 61 6e 20 36 30 30 20 73   more than 600 s
8ca0: 65 63 6f 6e 64 73 0a 09 20 20 20 20 20 28 62 65  econds..     (be
8cb0: 67 69 6e 0a 09 20 20 20 20 20 20 20 28 64 65 62  gin..       (deb
8cc0: 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e  ug:print 0 "WARN
8cd0: 49 4e 47 3a 20 54 65 73 74 20 22 20 74 65 73 74  ING: Test " test
8ce0: 2d 6e 61 6d 65 20 22 20 61 70 70 65 61 72 73 20  -name " appears 
8cf0: 74 6f 20 62 65 20 64 65 61 64 2e 20 46 6f 72 63  to be dead. Forc
8d00: 69 6e 67 20 69 74 20 74 6f 20 73 74 61 74 65 20  ing it to state 
8d10: 49 4e 43 4f 4d 50 4c 45 54 45 20 61 6e 64 20 73  INCOMPLETE and s
8d20: 74 61 74 75 73 20 53 54 55 43 4b 2f 44 45 41 44  tatus STUCK/DEAD
8d30: 22 29 0a 09 20 20 20 20 20 20 20 28 74 65 73 74  ")..       (test
8d40: 73 3a 74 65 73 74 2d 73 65 74 2d 73 74 61 74 75  s:test-set-statu
8d50: 73 21 20 74 65 73 74 2d 69 64 20 22 49 4e 43 4f  s! test-id "INCO
8d60: 4d 50 4c 45 54 45 22 20 22 53 54 55 43 4b 2f 44  MPLETE" "STUCK/D
8d70: 45 41 44 22 20 22 54 65 73 74 20 69 73 20 73 74  EAD" "Test is st
8d80: 75 63 6b 20 6f 72 20 64 65 61 64 22 20 23 66 29  uck or dead" #f)
8d90: 29 0a 09 20 20 20 20 20 28 64 65 62 75 67 3a 70  )..     (debug:p
8da0: 72 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 22 20  rint 2 "NOTE: " 
8db0: 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61  test-name " is a
8dc0: 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e 67 22 29  lready running")
8dd0: 29 29 0a 09 28 65 6c 73 65 20 20 20 20 20 20 20  ))..(else       
8de0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
8df0: 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f  ERROR: Failed to
8e00: 20 6c 61 75 6e 63 68 20 74 65 73 74 20 22 20 6e   launch test " n
8e10: 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 2e 20  ew-test-name ". 
8e20: 55 6e 72 65 63 6f 67 6e 69 73 65 64 20 73 74 61  Unrecognised sta
8e30: 74 65 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73  te " (test:get-s
8e40: 74 61 74 65 20 74 65 73 74 64 61 74 29 29 29 29  tate testdat))))
8e50: 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d  )))..;;=========
8e60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8e70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8e80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8e90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b  =============.;;
8ea0: 20 45 4e 44 20 4f 46 20 4e 45 57 20 53 54 55 46   END OF NEW STUF
8eb0: 46 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  F.;;============
8ec0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8ed0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8ee0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8ef0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66  ==========..(def
8f00: 69 6e 65 20 28 67 65 74 2d 64 69 72 2d 75 70 2d  ine (get-dir-up-
8f10: 6e 20 64 69 72 20 2e 20 70 61 72 61 6d 73 29 20  n dir . params) 
8f20: 0a 20 20 28 6c 65 74 20 28 28 64 70 61 72 74 73  .  (let ((dparts
8f30: 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20    (string-split 
8f40: 64 69 72 20 22 2f 22 29 29 0a 09 28 63 6f 75 6e  dir "/"))..(coun
8f50: 74 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 70  t   (if (null? p
8f60: 61 72 61 6d 73 29 20 31 20 28 63 61 72 20 70 61  arams) 1 (car pa
8f70: 72 61 6d 73 29 29 29 29 0a 20 20 20 20 28 63 6f  rams)))).    (co
8f80: 6e 63 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69  nc "/" (string-i
8f90: 6e 74 65 72 73 70 65 72 73 65 20 0a 09 20 20 20  ntersperse ..   
8fa0: 20 20 20 20 28 74 61 6b 65 20 64 70 61 72 74 73      (take dparts
8fb0: 20 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72   (- (length dpar
8fc0: 74 73 29 20 63 6f 75 6e 74 29 29 0a 09 20 20 20  ts) count))..   
8fd0: 20 20 20 20 22 2f 22 29 29 29 29 0a 3b 3b 20 52      "/")))).;; R
8fe0: 65 6d 6f 76 65 20 72 75 6e 73 0a 3b 3b 20 66 69  emove runs.;; fi
8ff0: 65 6c 64 73 20 61 72 65 20 70 61 73 73 69 6e 67  elds are passing
9000: 20 69 6e 20 74 68 72 6f 75 67 68 20 0a 3b 3b 20   in through .;; 
9010: 61 63 74 69 6f 6e 3a 0a 3b 3b 20 20 20 20 27 72  action:.;;    'r
9020: 65 6d 6f 76 65 2d 72 75 6e 73 0a 3b 3b 20 20 20  emove-runs.;;   
9030: 20 27 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74   'set-state-stat
9040: 75 73 0a 3b 3b 0a 3b 3b 20 4e 42 2f 2f 20 73 68  us.;;.;; NB// sh
9050: 6f 75 6c 64 20 70 61 73 73 20 69 6e 20 6b 65 79  ould pass in key
9060: 73 3f 0a 3b 3b 0a 28 64 65 66 69 6e 65 20 28 72  s?.;;.(define (r
9070: 75 6e 73 3a 6f 70 65 72 61 74 65 2d 6f 6e 20 61  uns:operate-on a
9080: 63 74 69 6f 6e 20 72 75 6e 6e 61 6d 65 70 61 74  ction runnamepat
9090: 74 20 74 65 73 74 70 61 74 74 20 23 21 6b 65 79  t testpatt #!key
90a0: 20 28 73 74 61 74 65 20 23 66 29 28 73 74 61 74   (state #f)(stat
90b0: 75 73 20 23 66 29 28 6e 65 77 2d 73 74 61 74 65  us #f)(new-state
90c0: 2d 73 74 61 74 75 73 20 23 66 29 29 0a 20 20 28  -status #f)).  (
90d0: 63 6f 6d 6d 6f 6e 3a 63 6c 65 61 72 2d 63 61 63  common:clear-cac
90e0: 68 65 73 29 20 3b 3b 20 63 6c 65 61 72 20 61 6c  hes) ;; clear al
90f0: 6c 20 63 61 63 68 65 73 0a 20 20 28 6c 65 74 2a  l caches.  (let*
9100: 20 28 28 64 62 20 20 20 20 20 20 20 20 20 20 20   ((db           
9110: 23 66 29 0a 09 20 28 6b 65 79 73 20 20 20 20 20  #f).. (keys     
9120: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c      (open-run-cl
9130: 6f 73 65 20 64 62 3a 67 65 74 2d 6b 65 79 73 20  ose db:get-keys 
9140: 64 62 29 29 0a 09 20 28 72 75 6e 64 61 74 20 20  db)).. (rundat  
9150: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
9160: 6c 6f 73 65 20 72 75 6e 73 3a 67 65 74 2d 72 75  lose runs:get-ru
9170: 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20 6b 65  ns-by-patt db ke
9180: 79 73 20 72 75 6e 6e 61 6d 65 70 61 74 74 29 29  ys runnamepatt))
9190: 0a 09 20 28 68 65 61 64 65 72 20 20 20 20 20 20  .. (header      
91a0: 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e   (vector-ref run
91b0: 64 61 74 20 30 29 29 0a 09 20 28 72 75 6e 73 20  dat 0)).. (runs 
91c0: 20 20 20 20 20 20 20 20 28 76 65 63 74 6f 72 2d          (vector-
91d0: 72 65 66 20 72 75 6e 64 61 74 20 31 29 29 0a 09  ref rundat 1))..
91e0: 20 28 73 74 61 74 65 73 20 20 20 20 20 20 20 28   (states       (
91f0: 69 66 20 73 74 61 74 65 20 20 28 73 74 72 69 6e  if state  (strin
9200: 67 2d 73 70 6c 69 74 20 73 74 61 74 65 20 20 22  g-split state  "
9210: 2c 22 29 20 27 28 29 29 29 0a 09 20 28 73 74 61  ,") '())).. (sta
9220: 74 75 73 65 73 20 20 20 20 20 28 69 66 20 73 74  tuses     (if st
9230: 61 74 75 73 20 28 73 74 72 69 6e 67 2d 73 70 6c  atus (string-spl
9240: 69 74 20 73 74 61 74 75 73 20 22 2c 22 29 20 27  it status ",") '
9250: 28 29 29 29 0a 09 20 28 73 74 61 74 65 2d 73 74  ())).. (state-st
9260: 61 74 75 73 20 28 69 66 20 28 73 74 72 69 6e 67  atus (if (string
9270: 3f 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74  ? new-state-stat
9280: 75 73 29 20 28 73 74 72 69 6e 67 2d 73 70 6c 69  us) (string-spli
9290: 74 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74  t new-state-stat
92a0: 75 73 20 22 2c 22 29 20 27 28 23 66 20 23 66 29  us ",") '(#f #f)
92b0: 29 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70  ))).    (debug:p
92c0: 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 72 75 6e  rint-info 4 "run
92d0: 73 3a 6f 70 65 72 61 74 65 2d 6f 6e 20 3d 3e 20  s:operate-on => 
92e0: 48 65 61 64 65 72 3a 20 22 20 68 65 61 64 65 72  Header: " header
92f0: 20 22 20 61 63 74 69 6f 6e 3a 20 22 20 61 63 74   " action: " act
9300: 69 6f 6e 20 22 20 6e 65 77 2d 73 74 61 74 65 2d  ion " new-state-
9310: 73 74 61 74 75 73 3a 20 22 20 6e 65 77 2d 73 74  status: " new-st
9320: 61 74 65 2d 73 74 61 74 75 73 29 0a 20 20 20 20  ate-status).    
9330: 28 69 66 20 28 3e 20 32 20 28 6c 65 6e 67 74 68  (if (> 2 (length
9340: 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 29 0a   state-status)).
9350: 09 28 62 65 67 69 6e 0a 09 20 20 28 64 65 62 75  .(begin..  (debu
9360: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52  g:print 0 "ERROR
9370: 3a 20 74 68 65 20 70 61 72 61 6d 65 74 65 72 20  : the parameter 
9380: 74 6f 20 2d 73 65 74 2d 73 74 61 74 65 2d 73 74  to -set-state-st
9390: 61 74 75 73 20 69 73 20 61 20 63 6f 6d 6d 61 20  atus is a comma 
93a0: 64 65 6c 69 6d 69 74 65 64 20 73 74 72 69 6e 67  delimited string
93b0: 2e 20 45 2e 67 2e 20 43 4f 4d 50 4c 45 54 45 44  . E.g. COMPLETED
93c0: 2c 46 41 49 4c 22 29 0a 09 20 20 28 65 78 69 74  ,FAIL")..  (exit
93d0: 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63  ))).    (for-eac
93e0: 68 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28  h.     (lambda (
93f0: 72 75 6e 29 0a 20 20 20 20 20 20 20 28 6c 65 74  run).       (let
9400: 20 28 28 72 75 6e 6b 65 79 20 28 73 74 72 69 6e   ((runkey (strin
9410: 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d  g-intersperse (m
9420: 61 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 0a 09  ap (lambda (k)..
9430: 09 09 09 09 09 28 64 62 3a 67 65 74 2d 76 61 6c  .....(db:get-val
9440: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e  ue-by-header run
9450: 20 68 65 61 64 65 72 20 28 76 65 63 74 6f 72 2d   header (vector-
9460: 72 65 66 20 6b 20 30 29 29 29 20 6b 65 79 73 29  ref k 0))) keys)
9470: 20 22 2f 22 29 29 0a 09 20 20 20 20 20 28 64 69   "/"))..     (di
9480: 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 28 6d 61  rs-to-remove (ma
9490: 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29  ke-hash-table)))
94a0: 0a 09 20 28 6c 65 74 2a 20 28 28 72 75 6e 2d 69  .. (let* ((run-i
94b0: 64 20 20 20 20 28 64 62 3a 67 65 74 2d 76 61 6c  d    (db:get-val
94c0: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e  ue-by-header run
94d0: 20 68 65 61 64 65 72 20 22 69 64 22 29 29 0a 09   header "id"))..
94e0: 09 28 72 75 6e 2d 73 74 61 74 65 20 28 64 62 3a  .(run-state (db:
94f0: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61  get-value-by-hea
9500: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22  der run header "
9510: 73 74 61 74 65 22 29 29 0a 09 09 28 74 65 73 74  state"))...(test
9520: 73 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28  s     (if (not (
9530: 65 71 75 61 6c 3f 20 72 75 6e 2d 73 74 61 74 65  equal? run-state
9540: 20 22 6c 6f 63 6b 65 64 22 29 29 0a 09 09 09 20   "locked")).... 
9550: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d        (open-run-
9560: 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73  close db:get-tes
9570: 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 72 75  ts-for-run db ru
9580: 6e 2d 69 64 0a 09 09 09 09 09 09 20 20 20 20 20  n-id.......     
9590: 20 74 65 73 74 70 61 74 74 20 73 74 61 74 65 73   testpatt states
95a0: 20 73 74 61 74 75 73 65 73 0a 09 09 09 09 09 09   statuses.......
95b0: 20 20 20 20 20 20 6e 6f 74 2d 69 6e 3a 20 20 23        not-in:  #
95c0: 66 0a 09 09 09 09 09 09 20 20 20 20 20 20 73 6f  f.......      so
95d0: 72 74 2d 62 79 3a 20 28 63 61 73 65 20 61 63 74  rt-by: (case act
95e0: 69 6f 6e 0a 09 09 09 09 09 09 09 09 20 28 28 72  ion......... ((r
95f0: 65 6d 6f 76 65 2d 72 75 6e 73 29 20 27 72 75 6e  emove-runs) 'run
9600: 64 69 72 29 0a 09 09 09 09 09 09 09 09 20 28 65  dir)......... (e
9610: 6c 73 65 20 20 20 20 20 20 20 20 20 20 27 65 76  lse          'ev
9620: 65 6e 74 5f 74 69 6d 65 29 29 29 0a 09 09 09 20  ent_time))).... 
9630: 20 20 20 20 20 20 27 28 29 29 29 0a 09 09 28 6c        '()))...(l
9640: 61 73 74 74 70 61 74 68 20 22 2f 64 6f 65 73 2f  asttpath "/does/
9650: 6e 6f 74 2f 65 78 69 73 74 2f 49 2f 68 6f 70 65  not/exist/I/hope
9660: 22 29 29 0a 09 20 20 20 28 64 65 62 75 67 3a 70  "))..   (debug:p
9670: 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 72 75 6e  rint-info 4 "run
9680: 73 3a 6f 70 65 72 61 74 65 2d 6f 6e 20 72 75 6e  s:operate-on run
9690: 3d 22 20 72 75 6e 20 22 2c 20 68 65 61 64 65 72  =" run ", header
96a0: 3d 22 20 68 65 61 64 65 72 29 0a 09 20 20 20 28  =" header)..   (
96b0: 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74  if (not (null? t
96c0: 65 73 74 73 29 29 0a 09 20 20 20 20 20 20 20 28  ests))..       (
96d0: 62 65 67 69 6e 0a 09 09 20 28 63 61 73 65 20 61  begin... (case a
96e0: 63 74 69 6f 6e 0a 09 09 20 20 20 28 28 72 65 6d  ction...   ((rem
96f0: 6f 76 65 2d 72 75 6e 73 29 0a 09 09 20 20 20 20  ove-runs)...    
9700: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22  (debug:print 1 "
9710: 52 65 6d 6f 76 69 6e 67 20 74 65 73 74 73 20 66  Removing tests f
9720: 6f 72 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79  or run: " runkey
9730: 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c   " " (db:get-val
9740: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e  ue-by-header run
9750: 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65   header "runname
9760: 22 29 29 29 0a 09 09 20 20 20 28 28 73 65 74 2d  ")))...   ((set-
9770: 73 74 61 74 65 2d 73 74 61 74 75 73 29 0a 09 09  state-status)...
9780: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
9790: 20 31 20 22 4d 6f 64 69 66 79 69 6e 67 20 73 74   1 "Modifying st
97a0: 61 74 65 20 61 6e 64 20 73 74 61 75 73 20 66 6f  ate and staus fo
97b0: 72 20 74 65 73 74 73 20 66 6f 72 20 72 75 6e 3a  r tests for run:
97c0: 20 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64   " runkey " " (d
97d0: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68  b:get-value-by-h
97e0: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72  eader run header
97f0: 20 22 72 75 6e 6e 61 6d 65 22 29 29 29 0a 09 09   "runname")))...
9800: 20 20 20 28 28 70 72 69 6e 74 2d 72 75 6e 29 0a     ((print-run).
9810: 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ..    (debug:pri
9820: 6e 74 20 31 20 22 50 72 69 6e 74 69 6e 67 20 69  nt 1 "Printing i
9830: 6e 66 6f 20 66 6f 72 20 72 75 6e 20 22 20 72 75  nfo for run " ru
9840: 6e 6b 65 79 20 22 2c 20 72 75 6e 3d 22 20 72 75  nkey ", run=" ru
9850: 6e 20 22 2c 20 74 65 73 74 73 3d 22 20 74 65 73  n ", tests=" tes
9860: 74 73 20 22 2c 20 68 65 61 64 65 72 3d 22 20 68  ts ", header=" h
9870: 65 61 64 65 72 29 0a 09 09 20 20 20 20 61 63 74  eader)...    act
9880: 69 6f 6e 29 0a 09 09 20 20 20 28 65 6c 73 65 0a  ion)...   (else.
9890: 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ..    (debug:pri
98a0: 6e 74 2d 69 6e 66 6f 20 30 20 22 61 63 74 69 6f  nt-info 0 "actio
98b0: 6e 20 6e 6f 74 20 72 65 63 6f 67 6e 69 73 65 64  n not recognised
98c0: 20 22 20 61 63 74 69 6f 6e 29 29 29 0a 09 09 20   " action)))... 
98d0: 28 66 6f 72 2d 65 61 63 68 0a 09 09 20 20 28 6c  (for-each...  (l
98e0: 61 6d 62 64 61 20 28 74 65 73 74 29 0a 09 09 20  ambda (test)... 
98f0: 20 20 20 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d     (let* ((item-
9900: 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65  path (db:test-ge
9910: 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74  t-item-path test
9920: 29 29 0a 09 09 09 20 20 20 28 74 65 73 74 2d 6e  ))....   (test-n
9930: 61 6d 65 20 28 64 62 3a 74 65 73 74 2d 67 65 74  ame (db:test-get
9940: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29 29  -testname test))
9950: 0a 09 09 09 20 20 20 28 72 75 6e 2d 64 69 72 20  ....   (run-dir 
9960: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72    (db:test-get-r
9970: 75 6e 64 69 72 20 74 65 73 74 29 29 20 20 20 20  undir test))    
9980: 3b 3b 20 72 75 6e 20 64 69 72 20 69 73 20 66 72  ;; run dir is fr
9990: 6f 6d 20 74 68 65 20 6c 69 6e 6b 20 74 72 65 65  om the link tree
99a0: 0a 09 09 09 20 20 20 28 72 65 61 6c 2d 64 69 72  ....   (real-dir
99b0: 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73    (if (file-exis
99c0: 74 73 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09 09  ts? run-dir)....
99d0: 09 09 20 20 28 72 65 73 6f 6c 76 65 2d 70 61 74  ..  (resolve-pat
99e0: 68 6e 61 6d 65 20 72 75 6e 2d 64 69 72 29 0a 09  hname run-dir)..
99f0: 09 09 09 09 20 20 23 66 29 29 0a 09 09 09 20 20  ....  #f))....  
9a00: 20 28 74 65 73 74 2d 69 64 20 20 20 28 64 62 3a   (test-id   (db:
9a10: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74  test-get-id test
9a20: 29 29 29 0a 09 09 20 20 20 20 20 20 3b 3b 20 20  )))...      ;;  
9a30: 20 28 74 64 62 20 20 20 20 20 20 20 28 64 62 3a   (tdb       (db:
9a40: 6f 70 65 6e 2d 74 65 73 74 2d 64 62 20 72 75 6e  open-test-db run
9a50: 2d 64 69 72 29 29 29 0a 09 09 20 20 20 20 20 20  -dir)))...      
9a60: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
9a70: 6f 20 34 20 22 74 65 73 74 3d 22 20 74 65 73 74  o 4 "test=" test
9a80: 29 20 3b 3b 20 20 20 22 20 28 64 62 3a 74 65 73  ) ;;   " (db:tes
9a90: 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74  t-get-testname t
9aa0: 65 73 74 29 20 22 20 69 64 3a 20 22 20 28 64 62  est) " id: " (db
9ab0: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73  :test-get-id tes
9ac0: 74 29 20 22 20 22 20 69 74 65 6d 2d 70 61 74 68  t) " " item-path
9ad0: 20 22 20 61 63 74 69 6f 6e 3a 20 22 20 61 63 74   " action: " act
9ae0: 69 6f 6e 29 0a 09 09 20 20 20 20 20 20 28 63 61  ion)...      (ca
9af0: 73 65 20 61 63 74 69 6f 6e 0a 09 09 09 28 28 72  se action....((r
9b00: 65 6d 6f 76 65 2d 72 75 6e 73 29 20 3b 3b 20 74  emove-runs) ;; t
9b10: 68 65 20 74 64 62 20 69 73 20 66 6f 72 20 66 75  he tdb is for fu
9b20: 74 75 72 65 20 70 6f 73 73 69 62 6c 65 2e 20 0a  ture possible. .
9b30: 09 09 09 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c  ... (open-run-cl
9b40: 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 2d 74 65  ose db:delete-te
9b50: 73 74 2d 72 65 63 6f 72 64 73 20 64 62 20 23 66  st-records db #f
9b60: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64   (db:test-get-id
9b70: 20 74 65 73 74 29 29 0a 09 09 09 20 28 64 65 62   test)).... (deb
9b80: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20  ug:print-info 1 
9b90: 22 41 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 72  "Attempting to r
9ba0: 65 6d 6f 76 65 20 22 20 28 69 66 20 72 65 61 6c  emove " (if real
9bb0: 2d 64 69 72 20 28 63 6f 6e 63 20 22 20 64 69 72  -dir (conc " dir
9bc0: 20 22 20 72 65 61 6c 2d 64 69 72 20 22 20 61 6e   " real-dir " an
9bd0: 64 20 22 29 20 22 22 29 20 22 20 6c 69 6e 6b 20  d ") "") " link 
9be0: 22 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 20 28  " run-dir).... (
9bf0: 69 66 20 28 61 6e 64 20 72 65 61 6c 2d 64 69 72  if (and real-dir
9c00: 20 0a 09 09 09 09 20 20 28 3e 20 28 73 74 72 69   .....  (> (stri
9c10: 6e 67 2d 6c 65 6e 67 74 68 20 72 65 61 6c 2d 64  ng-length real-d
9c20: 69 72 29 20 35 29 0a 09 09 09 09 20 20 28 66 69  ir) 5).....  (fi
9c30: 6c 65 2d 65 78 69 73 74 73 3f 20 72 65 61 6c 2d  le-exists? real-
9c40: 64 69 72 29 29 20 3b 3b 20 62 61 64 20 68 65 75  dir)) ;; bad heu
9c50: 72 69 73 74 69 63 20 62 75 74 20 73 68 6f 75 6c  ristic but shoul
9c60: 64 20 70 72 65 76 65 6e 74 20 2f 74 6d 70 20 2f  d prevent /tmp /
9c70: 68 6f 6d 65 20 65 74 63 2e 0a 09 09 09 20 20 20  home etc.....   
9c80: 20 20 28 62 65 67 69 6e 20 3b 3b 20 6c 65 74 2a    (begin ;; let*
9c90: 20 28 28 72 65 61 6c 70 61 74 68 20 28 72 65 73   ((realpath (res
9ca0: 6f 6c 76 65 2d 70 61 74 68 6e 61 6d 65 20 72 75  olve-pathname ru
9cb0: 6e 2d 64 69 72 29 29 29 0a 09 09 09 20 20 20 20  n-dir)))....    
9cc0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d     (debug:print-
9cd0: 69 6e 66 6f 20 31 20 22 52 65 63 75 72 73 69 76  info 1 "Recursiv
9ce0: 65 6c 79 20 72 65 6d 6f 76 69 6e 67 20 22 20 72  ely removing " r
9cf0: 65 61 6c 2d 64 69 72 29 0a 09 09 09 20 20 20 20  eal-dir)....    
9d00: 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69     (if (file-exi
9d10: 73 74 73 3f 20 72 65 61 6c 2d 64 69 72 29 0a 09  sts? real-dir)..
9d20: 09 09 09 20 20 20 28 69 66 20 28 3e 20 28 73 79  ...   (if (> (sy
9d30: 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 20 2d  stem (conc "rm -
9d40: 72 66 20 22 20 72 65 61 6c 2d 64 69 72 29 29 20  rf " real-dir)) 
9d50: 30 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 64  0).....       (d
9d60: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
9d70: 52 4f 52 3a 20 54 68 65 72 65 20 77 61 73 20 61  ROR: There was a
9d80: 20 70 72 6f 62 6c 65 6d 20 72 65 6d 6f 76 69 6e   problem removin
9d90: 67 20 22 20 72 65 61 6c 2d 64 69 72 20 22 20 77  g " real-dir " w
9da0: 69 74 68 20 72 6d 20 2d 66 22 29 29 0a 09 09 09  ith rm -f"))....
9db0: 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74  .   (debug:print
9dc0: 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 74 65 73   0 "WARNING: tes
9dd0: 74 20 64 69 72 20 22 20 72 65 61 6c 2d 64 69 72  t dir " real-dir
9de0: 20 22 20 61 70 70 65 61 72 73 20 74 6f 20 6e 6f   " appears to no
9df0: 74 20 65 78 69 73 74 20 6f 72 20 69 73 20 6e 6f  t exist or is no
9e00: 74 20 72 65 61 64 61 62 6c 65 22 29 29 29 0a 09  t readable")))..
9e10: 09 09 20 20 20 20 20 28 69 66 20 72 65 61 6c 2d  ..     (if real-
9e20: 64 69 72 20 0a 09 09 09 09 20 28 64 65 62 75 67  dir ..... (debug
9e30: 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e  :print 0 "WARNIN
9e40: 47 3a 20 64 69 72 65 63 74 6f 72 79 20 22 20 72  G: directory " r
9e50: 65 61 6c 2d 64 69 72 20 22 20 64 6f 65 73 20 6e  eal-dir " does n
9e60: 6f 74 20 65 78 69 73 74 22 29 0a 09 09 09 09 20  ot exist")..... 
9e70: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
9e80: 57 41 52 4e 49 4e 47 3a 20 6e 6f 20 72 65 61 6c  WARNING: no real
9e90: 20 64 69 72 65 63 74 6f 72 79 20 63 6f 72 72 6f   directory corro
9ea0: 73 70 6f 6e 64 69 6e 67 20 74 6f 20 6c 69 6e 6b  sponding to link
9eb0: 20 22 20 72 75 6e 2d 64 69 72 20 22 2c 20 6e 6f   " run-dir ", no
9ec0: 74 68 69 6e 67 20 64 6f 6e 65 22 29 29 29 0a 09  thing done")))..
9ed0: 09 09 20 28 69 66 20 28 73 79 6d 62 6f 6c 69 63  .. (if (symbolic
9ee0: 2d 6c 69 6e 6b 3f 20 72 75 6e 2d 64 69 72 29 0a  -link? run-dir).
9ef0: 09 09 09 20 20 20 20 20 28 62 65 67 69 6e 0a 09  ...     (begin..
9f00: 09 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a  ..       (debug:
9f10: 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 52 65  print-info 1 "Re
9f20: 6d 6f 76 69 6e 67 20 73 79 6d 6c 69 6e 6b 20 22  moving symlink "
9f30: 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 20 20 20   run-dir)....   
9f40: 20 20 20 20 28 68 61 6e 64 6c 65 2d 65 78 63 65      (handle-exce
9f50: 70 74 69 6f 6e 73 0a 09 09 09 09 65 78 6e 0a 09  ptions.....exn..
9f60: 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20  ...(debug:print 
9f70: 30 20 22 45 52 52 4f 52 3a 20 20 46 61 69 6c 65  0 "ERROR:  Faile
9f80: 64 20 74 6f 20 72 65 6d 6f 76 65 20 73 79 6d 6c  d to remove syml
9f90: 69 6e 6b 20 22 20 72 75 6e 2d 64 69 72 20 28 28  ink " run-dir ((
9fa0: 63 6f 6e 64 69 74 69 6f 6e 2d 70 72 6f 70 65 72  condition-proper
9fb0: 74 79 2d 61 63 63 65 73 73 6f 72 20 27 65 78 6e  ty-accessor 'exn
9fc0: 20 27 6d 65 73 73 61 67 65 29 20 65 78 6e 29 20   'message) exn) 
9fd0: 22 2c 20 61 74 74 65 6d 70 74 69 6e 67 20 74 6f  ", attempting to
9fe0: 20 63 6f 6e 74 69 6e 75 65 22 29 0a 09 09 09 09   continue").....
9ff0: 28 64 65 6c 65 74 65 2d 66 69 6c 65 20 72 75 6e  (delete-file run
a000: 2d 64 69 72 29 29 29 0a 09 09 09 20 20 20 20 20  -dir)))....     
a010: 28 69 66 20 28 64 69 72 65 63 74 6f 72 79 3f 20  (if (directory? 
a020: 72 75 6e 2d 64 69 72 29 0a 09 09 09 09 20 28 69  run-dir)..... (i
a030: 66 20 28 3e 20 28 64 69 72 65 63 74 6f 72 79 2d  f (> (directory-
a040: 66 6f 6c 64 20 28 6c 61 6d 62 64 61 20 28 66 20  fold (lambda (f 
a050: 78 29 28 2b 20 31 20 78 29 29 20 30 20 72 75 6e  x)(+ 1 x)) 0 run
a060: 2d 64 69 72 29 20 30 29 0a 09 09 09 09 20 20 20  -dir) 0).....   
a070: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
a080: 20 22 57 41 52 4e 49 4e 47 3a 20 72 65 66 75 73   "WARNING: refus
a090: 69 6e 67 20 74 6f 20 72 65 6d 6f 76 65 20 22 20  ing to remove " 
a0a0: 72 75 6e 2d 64 69 72 20 22 20 61 73 20 69 74 20  run-dir " as it 
a0b0: 69 73 20 6e 6f 74 20 65 6d 70 74 79 22 29 0a 09  is not empty")..
a0c0: 09 09 09 20 20 20 20 20 20 28 68 61 6e 64 6c 65  ...      (handle
a0d0: 2d 65 78 63 65 70 74 69 6f 6e 73 0a 09 09 09 09  -exceptions.....
a0e0: 20 20 20 20 20 20 20 65 78 6e 0a 09 09 09 09 20         exn..... 
a0f0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
a100: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 20 46 61  nt 0 "ERROR:  Fa
a110: 69 6c 65 64 20 74 6f 20 72 65 6d 6f 76 65 20 64  iled to remove d
a120: 69 72 65 63 74 6f 72 79 20 22 20 72 75 6e 2d 64  irectory " run-d
a130: 69 72 20 28 28 63 6f 6e 64 69 74 69 6f 6e 2d 70  ir ((condition-p
a140: 72 6f 70 65 72 74 79 2d 61 63 63 65 73 73 6f 72  roperty-accessor
a150: 20 27 65 78 6e 20 27 6d 65 73 73 61 67 65 29 20   'exn 'message) 
a160: 65 78 6e 29 20 22 2c 20 61 74 74 65 6d 70 74 69  exn) ", attempti
a170: 6e 67 20 74 6f 20 63 6f 6e 74 69 6e 75 65 22 29  ng to continue")
a180: 0a 09 09 09 09 20 20 20 20 20 20 20 28 64 65 6c  .....       (del
a190: 65 74 65 2d 64 69 72 65 63 74 6f 72 79 20 72 75  ete-directory ru
a1a0: 6e 2d 64 69 72 29 29 29 0a 09 09 09 09 20 28 69  n-dir)))..... (i
a1b0: 66 20 72 75 6e 2d 64 69 72 0a 09 09 09 09 20 20  f run-dir.....  
a1c0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
a1d0: 30 20 22 57 41 52 4e 49 4e 47 3a 20 6e 6f 74 20  0 "WARNING: not 
a1e0: 72 65 6d 6f 76 69 6e 67 20 22 20 72 75 6e 2d 64  removing " run-d
a1f0: 69 72 20 22 20 61 73 20 69 74 20 65 69 74 68 65  ir " as it eithe
a200: 72 20 64 6f 65 73 6e 27 74 20 65 78 69 73 74 20  r doesn't exist 
a210: 6f 72 20 69 73 20 6e 6f 74 20 61 20 73 79 6d 6c  or is not a syml
a220: 69 6e 6b 22 29 0a 09 09 09 09 20 20 20 20 20 28  ink").....     (
a230: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 4e  debug:print 0 "N
a240: 4f 54 45 3a 20 74 68 65 20 72 75 6e 20 64 69 72  OTE: the run dir
a250: 20 66 6f 72 20 74 68 69 73 20 74 65 73 74 20 69   for this test i
a260: 73 20 75 6e 64 65 66 69 6e 65 64 2e 20 54 65 73  s undefined. Tes
a270: 74 20 6d 61 79 20 68 61 76 65 20 61 6c 72 65 61  t may have alrea
a280: 64 79 20 62 65 65 6e 20 64 65 6c 65 74 65 64 2e  dy been deleted.
a290: 22 29 29 0a 09 09 09 09 20 29 29 29 0a 09 09 09  "))..... )))....
a2a0: 28 28 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74  ((set-state-stat
a2b0: 75 73 29 0a 09 09 09 20 28 64 65 62 75 67 3a 70  us).... (debug:p
a2c0: 72 69 6e 74 2d 69 6e 66 6f 20 32 20 22 6e 65 77  rint-info 2 "new
a2d0: 20 73 74 61 74 65 20 22 20 28 63 61 72 20 73 74   state " (car st
a2e0: 61 74 65 2d 73 74 61 74 75 73 29 20 22 2c 20 6e  ate-status) ", n
a2f0: 65 77 20 73 74 61 74 75 73 20 22 20 28 63 61 64  ew status " (cad
a300: 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 29  r state-status))
a310: 0a 09 09 09 20 28 6f 70 65 6e 2d 72 75 6e 2d 63  .... (open-run-c
a320: 6c 6f 73 65 20 64 62 3a 74 65 73 74 2d 73 65 74  lose db:test-set
a330: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 2d 62 79  -state-status-by
a340: 2d 69 64 20 64 62 20 28 64 62 3a 74 65 73 74 2d  -id db (db:test-
a350: 67 65 74 2d 69 64 20 74 65 73 74 29 20 28 63 61  get-id test) (ca
a360: 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 28  r state-status)(
a370: 63 61 64 72 20 73 74 61 74 65 2d 73 74 61 74 75  cadr state-statu
a380: 73 29 20 23 66 29 29 29 29 29 0a 09 09 20 20 28  s) #f)))))...  (
a390: 73 6f 72 74 20 74 65 73 74 73 20 28 6c 61 6d 62  sort tests (lamb
a3a0: 64 61 20 28 61 20 62 29 28 6c 65 74 20 28 28 64  da (a b)(let ((d
a3b0: 69 72 61 20 28 64 62 3a 74 65 73 74 2d 67 65 74  ira (db:test-get
a3c0: 2d 72 75 6e 64 69 72 20 61 29 29 0a 09 09 09 09  -rundir a)).....
a3d0: 09 09 20 28 64 69 72 62 20 28 64 62 3a 74 65 73  .. (dirb (db:tes
a3e0: 74 2d 67 65 74 2d 72 75 6e 64 69 72 20 62 29 29  t-get-rundir b))
a3f0: 29 0a 09 09 09 09 09 20 20 20 20 20 28 69 66 20  )......     (if 
a400: 28 61 6e 64 20 28 73 74 72 69 6e 67 3f 20 64 69  (and (string? di
a410: 72 61 29 28 73 74 72 69 6e 67 3f 20 64 69 72 62  ra)(string? dirb
a420: 29 29 0a 09 09 09 09 09 09 20 28 3e 20 28 73 74  ))....... (> (st
a430: 72 69 6e 67 2d 6c 65 6e 67 74 68 20 64 69 72 61  ring-length dira
a440: 29 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20  )(string-length 
a450: 64 69 72 62 29 29 0a 09 09 09 09 09 09 20 23 66  dirb))....... #f
a460: 29 29 29 29 29 29 29 0a 09 20 20 20 3b 3b 20 72  )))))))..   ;; r
a470: 65 6d 6f 76 65 20 74 68 65 20 72 75 6e 20 69 66  emove the run if
a480: 20 7a 65 72 6f 20 74 65 73 74 73 20 72 65 6d 61   zero tests rema
a490: 69 6e 0a 09 20 20 20 28 69 66 20 28 65 71 3f 20  in..   (if (eq? 
a4a0: 61 63 74 69 6f 6e 20 27 72 65 6d 6f 76 65 2d 72  action 'remove-r
a4b0: 75 6e 73 29 0a 09 20 20 20 20 20 20 20 28 6c 65  uns)..       (le
a4c0: 74 20 28 28 72 65 6d 74 65 73 74 73 20 28 6f 70  t ((remtests (op
a4d0: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a  en-run-close db:
a4e0: 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75  get-tests-for-ru
a4f0: 6e 20 64 62 20 28 64 62 3a 67 65 74 2d 76 61 6c  n db (db:get-val
a500: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e  ue-by-header run
a510: 20 68 65 61 64 65 72 20 22 69 64 22 29 20 23 66   header "id") #f
a520: 20 27 28 22 44 45 4c 45 54 45 44 22 29 20 27 28   '("DELETED") '(
a530: 22 6e 2f 61 22 29 20 6e 6f 74 2d 69 6e 3a 20 23  "n/a") not-in: #
a540: 74 29 29 29 0a 09 09 20 28 69 66 20 28 6e 75 6c  t)))... (if (nul
a550: 6c 3f 20 72 65 6d 74 65 73 74 73 29 20 3b 3b 20  l? remtests) ;; 
a560: 6e 6f 20 6d 6f 72 65 20 74 65 73 74 73 20 72 65  no more tests re
a570: 6d 61 69 6e 69 6e 67 0a 09 09 20 20 20 20 20 28  maining...     (
a580: 6c 65 74 2a 20 28 28 64 70 61 72 74 73 20 20 28  let* ((dparts  (
a590: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 6c 61 73  string-split las
a5a0: 74 74 70 61 74 68 20 22 2f 22 29 29 0a 09 09 09  ttpath "/"))....
a5b0: 20 20 20 20 28 72 75 6e 70 61 74 68 20 28 63 6f      (runpath (co
a5c0: 6e 63 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69  nc "/" (string-i
a5d0: 6e 74 65 72 73 70 65 72 73 65 20 0a 09 09 09 09  ntersperse .....
a5e0: 09 09 28 74 61 6b 65 20 64 70 61 72 74 73 20 28  ..(take dparts (
a5f0: 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73  - (length dparts
a600: 29 20 31 29 29 0a 09 09 09 09 09 09 22 2f 22 29  ) 1))......."/")
a610: 29 29 29 0a 09 09 20 20 20 20 20 20 20 28 64 65  )))...       (de
a620: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d  bug:print 1 "Rem
a630: 6f 76 69 6e 67 20 72 75 6e 3a 20 22 20 72 75 6e  oving run: " run
a640: 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d  key " " (db:get-
a650: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20  value-by-header 
a660: 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e  run header "runn
a670: 61 6d 65 22 29 20 22 20 61 6e 64 20 72 65 6c 61  ame") " and rela
a680: 74 65 64 20 72 65 63 6f 72 64 22 29 0a 09 09 20  ted record")... 
a690: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d        (open-run-
a6a0: 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 2d  close db:delete-
a6b0: 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 29 0a 09  run db run-id)..
a6c0: 09 20 20 20 20 20 20 20 3b 3b 20 54 68 69 73 20  .       ;; This 
a6d0: 69 73 20 61 20 70 72 65 74 74 79 20 67 6f 6f 64  is a pretty good
a6e0: 20 70 6c 61 63 65 20 74 6f 20 70 75 72 67 65 20   place to purge 
a6f0: 6f 6c 64 20 44 45 4c 45 54 45 44 20 74 65 73 74  old DELETED test
a700: 73 0a 09 09 20 20 20 20 20 20 20 28 6f 70 65 6e  s...       (open
a710: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65  -run-close db:de
a720: 6c 65 74 65 2d 74 65 73 74 73 2d 66 6f 72 2d 72  lete-tests-for-r
a730: 75 6e 20 64 62 20 72 75 6e 2d 69 64 29 0a 09 09  un db run-id)...
a740: 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e         (open-run
a750: 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65  -close db:delete
a760: 2d 6f 6c 64 2d 64 65 6c 65 74 65 64 2d 74 65 73  -old-deleted-tes
a770: 74 2d 72 65 63 6f 72 64 73 20 64 62 29 0a 09 09  t-records db)...
a780: 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e         (open-run
a790: 2d 63 6c 6f 73 65 20 64 62 3a 73 65 74 2d 76 61  -close db:set-va
a7a0: 72 20 64 62 20 22 44 45 4c 45 54 45 44 5f 54 45  r db "DELETED_TE
a7b0: 53 54 53 22 20 28 63 75 72 72 65 6e 74 2d 73 65  STS" (current-se
a7c0: 63 6f 6e 64 73 29 29 0a 09 09 20 20 20 20 20 20  conds))...      
a7d0: 20 3b 3b 20 6e 65 65 64 20 74 6f 20 66 69 67 75   ;; need to figu
a7e0: 72 65 20 6f 75 74 20 74 68 65 20 70 61 74 68 20  re out the path 
a7f0: 74 6f 20 74 68 65 20 72 75 6e 20 64 69 72 20 61  to the run dir a
a800: 6e 64 20 72 65 6d 6f 76 65 20 69 74 20 69 66 20  nd remove it if 
a810: 65 6d 70 74 79 0a 09 09 20 20 20 20 20 20 20 3b  empty...       ;
a820: 3b 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20  ;    (if (null? 
a830: 28 67 6c 6f 62 20 28 63 6f 6e 63 20 72 75 6e 70  (glob (conc runp
a840: 61 74 68 20 22 2f 2a 22 29 29 29 0a 09 09 20 20  ath "/*")))...  
a850: 20 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20 28       ;;        (
a860: 62 65 67 69 6e 0a 09 09 20 20 20 20 20 20 20 3b  begin...       ;
a870: 3b 20 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ; . (debug:print
a880: 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e   1 "Removing run
a890: 20 64 69 72 20 22 20 72 75 6e 70 61 74 68 29 0a   dir " runpath).
a8a0: 09 09 20 20 20 20 20 20 20 3b 3b 20 09 20 28 73  ..       ;; . (s
a8b0: 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 64  ystem (conc "rmd
a8c0: 69 72 20 2d 70 20 22 20 72 75 6e 70 61 74 68 29  ir -p " runpath)
a8d0: 29 29 29 0a 09 09 20 20 20 20 20 20 20 29 29 29  )))...       )))
a8e0: 29 29 0a 09 20 29 29 0a 20 20 20 20 20 72 75 6e  )).. )).     run
a8f0: 73 29 29 0a 20 20 23 74 29 0a 0a 3b 3b 3d 3d 3d  s)).  #t)..;;===
a900: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a910: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a920: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a930: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a940: 3d 3d 3d 0a 3b 3b 20 52 6f 75 74 69 6e 65 73 20  ===.;; Routines 
a950: 66 6f 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67  for manipulating
a960: 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d   runs.;;========
a970: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a980: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a990: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a9a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a  ==============..
a9b0: 3b 3b 20 53 69 6e 63 65 20 6d 61 6e 79 20 63 61  ;; Since many ca
a9c0: 6c 6c 73 20 74 6f 20 61 20 72 75 6e 20 72 65 71  lls to a run req
a9d0: 75 69 72 65 20 70 72 65 74 74 79 20 6d 75 63 68  uire pretty much
a9e0: 20 74 68 65 20 73 61 6d 65 20 73 65 74 75 70 20   the same setup 
a9f0: 0a 3b 3b 20 74 68 69 73 20 77 72 61 70 70 65 72  .;; this wrapper
aa00: 20 69 73 20 75 73 65 64 20 74 6f 20 72 65 64 75   is used to redu
aa10: 63 65 20 74 68 65 20 72 65 70 6c 69 63 61 74 69  ce the replicati
aa20: 6f 6e 20 6f 66 20 63 6f 64 65 0a 28 64 65 66 69  on of code.(defi
aa30: 6e 65 20 28 67 65 6e 65 72 61 6c 2d 72 75 6e 2d  ne (general-run-
aa40: 63 61 6c 6c 20 73 77 69 74 63 68 6e 61 6d 65 20  call switchname 
aa50: 61 63 74 69 6f 6e 2d 64 65 73 63 20 70 72 6f 63  action-desc proc
aa60: 29 0a 20 20 28 6c 65 74 20 28 28 72 75 6e 6e 61  ).  (let ((runna
aa70: 6d 65 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  me (args:get-arg
aa80: 20 22 3a 72 75 6e 6e 61 6d 65 22 29 29 0a 09 28   ":runname"))..(
aa90: 74 61 72 67 65 74 20 20 28 69 66 20 28 61 72 67  target  (if (arg
aaa0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67  s:get-arg "-targ
aab0: 65 74 22 29 0a 09 09 20 20 20 20 20 28 61 72 67  et")...     (arg
aac0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67  s:get-arg "-targ
aad0: 65 74 22 29 0a 09 09 20 20 20 20 20 28 61 72 67  et")...     (arg
aae0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74  s:get-arg "-reqt
aaf0: 61 72 67 22 29 29 29 0a 09 28 74 68 31 20 20 20  arg")))..(th1   
ab00: 20 20 23 66 29 29 0a 20 20 20 20 28 63 6f 6e 64    #f)).    (cond
ab10: 0a 20 20 20 20 20 28 28 6e 6f 74 20 74 61 72 67  .     ((not targ
ab20: 65 74 29 0a 20 20 20 20 20 20 28 64 65 62 75 67  et).      (debug
ab30: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a  :print 0 "ERROR:
ab40: 20 4d 69 73 73 69 6e 67 20 72 65 71 75 69 72 65   Missing require
ab50: 64 20 70 61 72 61 6d 65 74 65 72 20 66 6f 72 20  d parameter for 
ab60: 22 20 73 77 69 74 63 68 6e 61 6d 65 20 22 2c 20  " switchname ", 
ab70: 79 6f 75 20 6d 75 73 74 20 73 70 65 63 69 66 79  you must specify
ab80: 20 74 68 65 20 74 61 72 67 65 74 20 77 69 74 68   the target with
ab90: 20 2d 74 61 72 67 65 74 22 29 0a 20 20 20 20 20   -target").     
aba0: 20 28 65 78 69 74 20 33 29 29 0a 20 20 20 20 20   (exit 3)).     
abb0: 28 28 6e 6f 74 20 72 75 6e 6e 61 6d 65 29 0a 20  ((not runname). 
abc0: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
abd0: 74 20 30 20 22 45 52 52 4f 52 3a 20 4d 69 73 73  t 0 "ERROR: Miss
abe0: 69 6e 67 20 72 65 71 75 69 72 65 64 20 70 61 72  ing required par
abf0: 61 6d 65 74 65 72 20 66 6f 72 20 22 20 73 77 69  ameter for " swi
ac00: 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d  tchname ", you m
ac10: 75 73 74 20 73 70 65 63 69 66 79 20 74 68 65 20  ust specify the 
ac20: 72 75 6e 20 6e 61 6d 65 20 77 69 74 68 20 3a 72  run name with :r
ac30: 75 6e 6e 61 6d 65 20 72 75 6e 6e 61 6d 65 22 29  unname runname")
ac40: 0a 20 20 20 20 20 20 28 65 78 69 74 20 33 29 29  .      (exit 3))
ac50: 0a 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20  .     (else.    
ac60: 20 20 28 6c 65 74 20 28 28 64 62 20 20 20 23 66    (let ((db   #f
ac70: 29 0a 09 20 20 20 20 28 6b 65 79 73 20 23 66 29  )..    (keys #f)
ac80: 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 73 65 74  )..(if (not (set
ac90: 75 70 2d 66 6f 72 2d 72 75 6e 29 29 0a 09 20 20  up-for-run))..  
aca0: 20 20 28 62 65 67 69 6e 20 0a 09 20 20 20 20 20    (begin ..     
acb0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
acc0: 22 46 61 69 6c 65 64 20 74 6f 20 73 65 74 75 70  "Failed to setup
acd0: 2c 20 65 78 69 74 69 6e 67 22 29 0a 09 20 20 20  , exiting")..   
ace0: 20 20 20 28 65 78 69 74 20 31 29 29 29 0a 09 28     (exit 1)))..(
acf0: 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  if (args:get-arg
ad00: 20 22 2d 73 65 72 76 65 72 22 29 0a 09 20 20 20   "-server")..   
ad10: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
ad20: 20 73 65 72 76 65 72 3a 73 74 61 72 74 20 64 62   server:start db
ad30: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
ad40: 2d 73 65 72 76 65 72 22 29 29 29 0a 20 09 20 20  -server"))). .  
ad50: 20 20 3b 3b 20 28 69 66 20 28 6e 6f 74 20 28 6f    ;; (if (not (o
ad60: 72 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20  r (args:get-arg 
ad70: 22 2d 72 75 6e 61 6c 6c 22 29 20 20 20 20 20 3b  "-runall")     ;
ad80: 3b 20 72 75 6e 61 6c 6c 20 61 6e 64 20 72 75 6e  ; runall and run
ad90: 74 65 73 74 73 20 61 72 65 20 61 6c 6c 6f 77 65  tests are allowe
ada0: 64 20 74 6f 20 62 65 20 73 65 72 76 65 72 73 0a  d to be servers.
adb0: 20 09 20 20 20 20 3b 3b 20 20 20 20 20 09 20 28   .    ;;     . (
adc0: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72  args:get-arg "-r
add0: 75 6e 74 65 73 74 73 22 29 29 29 0a 09 20 20 20  untests")))..   
ade0: 20 3b 3b 20 20 20 20 20 28 63 6c 69 65 6e 74 3a   ;;     (client:
adf0: 73 65 74 75 70 29 20 3b 3b 20 54 68 69 73 20 69  setup) ;; This i
ae00: 73 20 61 20 64 75 70 6c 69 63 61 74 65 20 73 74  s a duplicate st
ae10: 61 72 74 75 70 21 21 21 3f 3f 3f 20 42 55 47 3f  artup!!!??? BUG?
ae20: 0a 09 20 20 20 20 3b 3b 20 20 20 20 20 29 29 0a  ..    ;;     )).
ae30: 09 28 73 65 74 21 20 6b 65 79 73 20 28 6f 70 65  .(set! keys (ope
ae40: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67  n-run-close db:g
ae50: 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 3b 3b  et-keys db))..;;
ae60: 20 68 61 76 65 20 65 6e 6f 75 67 68 20 74 6f 20   have enough to 
ae70: 70 72 6f 63 65 73 73 20 2d 74 61 72 67 65 74 20  process -target 
ae80: 6f 72 20 2d 72 65 71 74 61 72 67 20 68 65 72 65  or -reqtarg here
ae90: 0a 09 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d  ..(if (args:get-
aea0: 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 0a  arg "-reqtarg").
aeb0: 09 20 20 20 20 28 6c 65 74 2a 20 28 28 72 75 6e  .    (let* ((run
aec0: 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 20 2a  configf (conc  *
aed0: 74 6f 70 70 61 74 68 2a 20 22 2f 72 75 6e 63 6f  toppath* "/runco
aee0: 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22 29 29 20  nfigs.config")) 
aef0: 3b 3b 20 44 4f 20 4e 4f 54 20 45 56 41 4c 55 41  ;; DO NOT EVALUA
af00: 54 45 20 41 4c 4c 20 0a 09 09 20 20 20 28 72 75  TE ALL ...   (ru
af10: 6e 63 6f 6e 66 69 67 20 20 28 72 65 61 64 2d 63  nconfig  (read-c
af20: 6f 6e 66 69 67 20 72 75 6e 63 6f 6e 66 69 67 66  onfig runconfigf
af30: 20 23 66 20 23 74 20 65 6e 76 69 72 6f 6e 2d 70   #f #t environ-p
af40: 61 74 74 3a 20 23 66 29 29 29 20 0a 09 20 20 20  att: #f))) ..   
af50: 20 20 20 28 69 66 20 28 68 61 73 68 2d 74 61 62     (if (hash-tab
af60: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 72  le-ref/default r
af70: 75 6e 63 6f 6e 66 69 67 20 28 61 72 67 73 3a 67  unconfig (args:g
af80: 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67  et-arg "-reqtarg
af90: 22 29 20 23 66 29 0a 09 09 20 20 28 6b 65 79 73  ") #f)...  (keys
afa0: 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 72 67 73  :target-set-args
afb0: 20 6b 65 79 73 20 28 61 72 67 73 3a 67 65 74 2d   keys (args:get-
afc0: 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 20  arg "-reqtarg") 
afd0: 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 0a 09  args:arg-hash)..
afe0: 09 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20  .  (begin...    
aff0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
b000: 45 52 52 4f 52 3a 20 5b 22 20 28 61 72 67 73 3a  ERROR: [" (args:
b010: 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72  get-arg "-reqtar
b020: 67 22 29 20 22 5d 20 6e 6f 74 20 66 6f 75 6e 64  g") "] not found
b030: 20 69 6e 20 22 20 72 75 6e 63 6f 6e 66 69 67 66   in " runconfigf
b040: 29 0a 09 09 20 20 20 20 28 69 66 20 64 62 20 28  )...    (if db (
b050: 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65  sqlite3:finalize
b060: 21 20 64 62 29 29 0a 09 09 20 20 20 20 28 65 78  ! db))...    (ex
b070: 69 74 20 31 29 29 29 29 0a 09 20 20 20 20 28 69  it 1))))..    (i
b080: 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20  f (args:get-arg 
b090: 22 2d 74 61 72 67 65 74 22 29 0a 09 09 28 6b 65  "-target")...(ke
b0a0: 79 73 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 72  ys:target-set-ar
b0b0: 67 73 20 6b 65 79 73 20 28 61 72 67 73 3a 67 65  gs keys (args:ge
b0c0: 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 20  t-arg "-target" 
b0d0: 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 20 61  args:arg-hash) a
b0e0: 72 67 73 3a 61 72 67 2d 68 61 73 68 29 29 29 0a  rgs:arg-hash))).
b0f0: 09 28 69 66 20 28 6e 6f 74 20 28 63 61 72 20 2a  .(if (not (car *
b100: 63 6f 6e 66 69 67 69 6e 66 6f 2a 29 29 0a 09 20  configinfo*)).. 
b110: 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20     (begin..     
b120: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
b130: 22 45 52 52 4f 52 3a 20 41 74 74 65 6d 70 74 65  "ERROR: Attempte
b140: 64 20 74 6f 20 22 20 61 63 74 69 6f 6e 2d 64 65  d to " action-de
b150: 73 63 20 22 20 62 75 74 20 72 75 6e 20 61 72 65  sc " but run are
b160: 61 20 63 6f 6e 66 69 67 20 66 69 6c 65 20 6e 6f  a config file no
b170: 74 20 66 6f 75 6e 64 22 29 0a 09 20 20 20 20 20  t found")..     
b180: 20 28 65 78 69 74 20 31 29 29 0a 09 20 20 20 20   (exit 1))..    
b190: 3b 3b 20 45 78 74 72 61 63 74 20 6f 75 74 20 73  ;; Extract out s
b1a0: 74 75 66 66 20 6e 65 65 64 65 64 20 69 6e 20 6d  tuff needed in m
b1b0: 6f 73 74 20 6f 72 20 6d 61 6e 79 20 63 61 6c 6c  ost or many call
b1c0: 73 0a 09 20 20 20 20 3b 3b 20 68 65 72 65 20 74  s..    ;; here t
b1d0: 68 65 6e 20 63 61 6c 6c 20 70 72 6f 63 0a 09 20  hen call proc.. 
b1e0: 20 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 6e 61     (let* ((keyna
b1f0: 6d 65 73 20 20 20 28 6d 61 70 20 6b 65 79 3a 67  mes   (map key:g
b200: 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79  et-fieldname key
b210: 73 29 29 0a 09 09 20 20 20 28 6b 65 79 76 61 6c  s))...   (keyval
b220: 6c 73 74 20 20 28 6b 65 79 73 2d 3e 76 61 6c 6c  lst  (keys->vall
b230: 69 73 74 20 6b 65 79 73 20 23 74 29 29 29 0a 09  ist keys #t)))..
b240: 20 20 20 20 20 20 28 70 72 6f 63 20 74 61 72 67        (proc targ
b250: 65 74 20 72 75 6e 6e 61 6d 65 20 6b 65 79 73 20  et runname keys 
b260: 6b 65 79 6e 61 6d 65 73 20 6b 65 79 76 61 6c 6c  keynames keyvall
b270: 73 74 29 29 29 0a 09 28 69 66 20 74 68 31 20 28  st)))..(if th1 (
b280: 74 68 72 65 61 64 2d 6a 6f 69 6e 21 20 74 68 31  thread-join! th1
b290: 29 29 0a 09 28 69 66 20 64 62 20 28 73 71 6c 69  ))..(if db (sqli
b2a0: 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62  te3:finalize! db
b2b0: 29 29 0a 09 28 73 65 74 21 20 2a 64 69 64 73 6f  ))..(set! *didso
b2c0: 6d 65 74 68 69 6e 67 2a 20 23 74 29 29 29 29 29  mething* #t)))))
b2d0: 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  )..;;===========
b2e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b2f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b300: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b310: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4c  ===========.;; L
b320: 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 72 75 6e 73 0a  ock/unlock runs.
b330: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;;==============
b340: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b350: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b360: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b370: 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e  ========..(defin
b380: 65 20 28 72 75 6e 73 3a 68 61 6e 64 6c 65 2d 6c  e (runs:handle-l
b390: 6f 63 6b 69 6e 67 20 74 61 72 67 65 74 20 6b 65  ocking target ke
b3a0: 79 73 20 72 75 6e 6e 61 6d 65 20 6c 6f 63 6b 20  ys runname lock 
b3b0: 75 6e 6c 6f 63 6b 20 75 73 65 72 29 0a 20 20 28  unlock user).  (
b3c0: 6c 65 74 2a 20 28 28 64 62 20 20 20 20 20 20 20  let* ((db       
b3d0: 23 66 29 0a 09 20 28 72 75 6e 64 61 74 20 20 20  #f).. (rundat   
b3e0: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
b3f0: 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79  runs:get-runs-by
b400: 2d 70 61 74 74 20 64 62 20 6b 65 79 73 20 72 75  -patt db keys ru
b410: 6e 6e 61 6d 65 29 29 0a 09 20 28 68 65 61 64 65  nname)).. (heade
b420: 72 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20  r   (vector-ref 
b430: 72 75 6e 64 61 74 20 30 29 29 0a 09 20 28 72 75  rundat 0)).. (ru
b440: 6e 73 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72  ns     (vector-r
b450: 65 66 20 72 75 6e 64 61 74 20 31 29 29 29 0a 20  ef rundat 1))). 
b460: 20 20 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61     (for-each (la
b470: 6d 62 64 61 20 28 72 75 6e 29 0a 09 09 28 6c 65  mbda (run)...(le
b480: 74 20 28 28 72 75 6e 2d 69 64 20 28 64 62 3a 67  t ((run-id (db:g
b490: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64  et-value-by-head
b4a0: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 69  er run header "i
b4b0: 64 22 29 29 29 0a 09 09 20 20 28 69 66 20 28 6f  d")))...  (if (o
b4c0: 72 20 6c 6f 63 6b 0a 09 09 09 20 20 28 61 6e 64  r lock....  (and
b4d0: 20 75 6e 6c 6f 63 6b 0a 09 09 09 20 20 20 20 20   unlock....     
b4e0: 20 20 28 62 65 67 69 6e 0a 09 09 09 09 20 28 70    (begin..... (p
b4f0: 72 69 6e 74 20 22 44 6f 20 79 6f 75 20 72 65 61  rint "Do you rea
b500: 6c 6c 79 20 77 69 73 68 20 74 6f 20 75 6e 6c 6f  lly wish to unlo
b510: 63 6b 20 72 75 6e 20 22 20 72 75 6e 2d 69 64 20  ck run " run-id 
b520: 22 3f 5c 6e 20 20 20 79 2f 6e 3a 20 22 29 0a 09  "?\n   y/n: ")..
b530: 09 09 09 20 28 65 71 75 61 6c 3f 20 22 79 22 20  ... (equal? "y" 
b540: 28 72 65 61 64 2d 6c 69 6e 65 29 29 29 29 29 0a  (read-line))))).
b550: 09 09 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75  ..      (open-ru
b560: 6e 2d 63 6c 6f 73 65 20 64 62 3a 6c 6f 63 6b 2f  n-close db:lock/
b570: 75 6e 6c 6f 63 6b 2d 72 75 6e 20 64 62 20 72 75  unlock-run db ru
b580: 6e 2d 69 64 20 6c 6f 63 6b 20 75 6e 6c 6f 63 6b  n-id lock unlock
b590: 20 75 73 65 72 29 0a 09 09 20 20 20 20 20 20 28   user)...      (
b5a0: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
b5b0: 20 30 20 22 53 6b 69 70 70 69 6e 67 20 6c 6f 63   0 "Skipping loc
b5c0: 6b 2f 75 6e 6c 6f 63 6b 20 6f 6e 20 22 20 72 75  k/unlock on " ru
b5d0: 6e 2d 69 64 29 29 29 29 0a 09 20 20 20 20 20 20  n-id))))..      
b5e0: 72 75 6e 73 29 29 29 0a 3b 3b 3d 3d 3d 3d 3d 3d  runs))).;;======
b5f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b600: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b610: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b620: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b630: 0a 3b 3b 20 52 6f 6c 6c 75 70 20 72 75 6e 73 0a  .;; Rollup runs.
b640: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;;==============
b650: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b660: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b670: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b680: 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 55 70 64  ========..;; Upd
b690: 61 74 65 20 74 68 65 20 74 65 73 74 5f 6d 65 74  ate the test_met
b6a0: 61 20 74 61 62 6c 65 20 66 6f 72 20 74 68 69 73  a table for this
b6b0: 20 74 65 73 74 0a 28 64 65 66 69 6e 65 20 28 72   test.(define (r
b6c0: 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f  uns:update-test_
b6d0: 6d 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d  meta db test-nam
b6e0: 65 20 74 65 73 74 2d 63 6f 6e 66 29 0a 20 20 28  e test-conf).  (
b6f0: 6c 65 74 20 28 28 63 75 72 72 72 65 63 6f 72 64  let ((currrecord
b700: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
b710: 20 64 62 3a 74 65 73 74 6d 65 74 61 2d 67 65 74   db:testmeta-get
b720: 2d 72 65 63 6f 72 64 20 64 62 20 74 65 73 74 2d  -record db test-
b730: 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 69 66 20  name))).    (if 
b740: 28 6e 6f 74 20 63 75 72 72 72 65 63 6f 72 64 29  (not currrecord)
b750: 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 73 65 74  ..(begin..  (set
b760: 21 20 63 75 72 72 72 65 63 6f 72 64 20 28 6d 61  ! currrecord (ma
b770: 6b 65 2d 76 65 63 74 6f 72 20 31 30 20 23 66 29  ke-vector 10 #f)
b780: 29 0a 09 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63  )..  (open-run-c
b790: 6c 6f 73 65 20 64 62 3a 74 65 73 74 6d 65 74 61  lose db:testmeta
b7a0: 2d 61 64 64 2d 72 65 63 6f 72 64 20 64 62 20 74  -add-record db t
b7b0: 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20  est-name))).    
b7c0: 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20  (for-each .     
b7d0: 28 6c 61 6d 62 64 61 20 28 6b 65 79 29 0a 20 20  (lambda (key).  
b7e0: 20 20 20 20 20 28 6c 65 74 2a 20 28 28 69 64 78       (let* ((idx
b7f0: 20 28 63 61 64 72 20 6b 65 79 29 29 0a 09 20 20   (cadr key))..  
b800: 20 20 20 20 28 66 6c 64 20 28 63 61 72 20 20 6b      (fld (car  k
b810: 65 79 29 29 0a 09 20 20 20 20 20 20 28 76 61 6c  ey))..      (val
b820: 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20   (config-lookup 
b830: 74 65 73 74 2d 63 6f 6e 66 20 22 74 65 73 74 5f  test-conf "test_
b840: 6d 65 74 61 22 20 66 6c 64 29 29 29 0a 09 20 3b  meta" fld))).. ;
b850: 3b 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 35  ; (debug:print 5
b860: 20 22 69 64 78 3a 20 22 20 69 64 78 20 22 20 66   "idx: " idx " f
b870: 6c 64 3a 20 22 20 66 6c 64 20 22 20 76 61 6c 3a  ld: " fld " val:
b880: 20 22 20 76 61 6c 29 0a 09 20 28 69 66 20 28 61   " val).. (if (a
b890: 6e 64 20 76 61 6c 20 28 6e 6f 74 20 28 65 71 75  nd val (not (equ
b8a0: 61 6c 3f 20 28 76 65 63 74 6f 72 2d 72 65 66 20  al? (vector-ref 
b8b0: 63 75 72 72 72 65 63 6f 72 64 20 69 64 78 29 20  currrecord idx) 
b8c0: 76 61 6c 29 29 29 0a 09 20 20 20 20 20 28 62 65  val)))..     (be
b8d0: 67 69 6e 0a 09 20 20 20 20 20 20 20 28 70 72 69  gin..       (pri
b8e0: 6e 74 20 22 55 70 64 61 74 69 6e 67 20 22 20 74  nt "Updating " t
b8f0: 65 73 74 2d 6e 61 6d 65 20 22 20 22 20 66 6c 64  est-name " " fld
b900: 20 22 20 74 6f 20 22 20 76 61 6c 29 0a 09 20 20   " to " val)..  
b910: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
b920: 6c 6f 73 65 20 64 62 3a 74 65 73 74 6d 65 74 61  lose db:testmeta
b930: 2d 75 70 64 61 74 65 2d 66 69 65 6c 64 20 64 62  -update-field db
b940: 20 74 65 73 74 2d 6e 61 6d 65 20 66 6c 64 20 76   test-name fld v
b950: 61 6c 29 29 29 29 29 0a 20 20 20 20 20 27 28 28  al))))).     '((
b960: 22 61 75 74 68 6f 72 22 20 32 29 28 22 6f 77 6e  "author" 2)("own
b970: 65 72 22 20 33 29 28 22 64 65 73 63 72 69 70 74  er" 3)("descript
b980: 69 6f 6e 22 20 34 29 28 22 72 65 76 69 65 77 65  ion" 4)("reviewe
b990: 64 22 20 35 29 28 22 74 61 67 73 22 20 39 29 29  d" 5)("tags" 9))
b9a0: 29 29 29 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74  )))..;; Update t
b9b0: 65 73 74 5f 6d 65 74 61 20 66 6f 72 20 61 6c 6c  est_meta for all
b9c0: 20 74 65 73 74 73 0a 28 64 65 66 69 6e 65 20 28   tests.(define (
b9d0: 72 75 6e 73 3a 75 70 64 61 74 65 2d 61 6c 6c 2d  runs:update-all-
b9e0: 74 65 73 74 5f 6d 65 74 61 20 64 62 29 0a 20 20  test_meta db).  
b9f0: 28 6c 65 74 20 28 28 74 65 73 74 2d 6e 61 6d 65  (let ((test-name
ba00: 73 20 28 74 65 73 74 73 3a 67 65 74 2d 76 61 6c  s (tests:get-val
ba10: 69 64 2d 74 65 73 74 73 29 29 29 0a 20 20 20 20  id-tests))).    
ba20: 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20  (for-each .     
ba30: 28 6c 61 6d 62 64 61 20 28 74 65 73 74 2d 6e 61  (lambda (test-na
ba40: 6d 65 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a  me).       (let*
ba50: 20 28 28 74 65 73 74 2d 70 61 74 68 20 20 20 20   ((test-path    
ba60: 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20  (conc *toppath* 
ba70: 22 2f 74 65 73 74 73 2f 22 20 74 65 73 74 2d 6e  "/tests/" test-n
ba80: 61 6d 65 29 29 0a 09 20 20 20 20 20 20 28 74 65  ame))..      (te
ba90: 73 74 2d 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63  st-configf (conc
baa0: 20 74 65 73 74 2d 70 61 74 68 20 22 2f 74 65 73   test-path "/tes
bab0: 74 63 6f 6e 66 69 67 22 29 29 0a 09 20 20 20 20  tconfig"))..    
bac0: 20 20 28 74 65 73 74 65 78 69 73 74 73 20 20 20    (testexists   
bad0: 28 61 6e 64 20 28 66 69 6c 65 2d 65 78 69 73 74  (and (file-exist
bae0: 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29  s? test-configf)
baf0: 28 66 69 6c 65 2d 72 65 61 64 2d 61 63 63 65 73  (file-read-acces
bb00: 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29  s? test-configf)
bb10: 29 29 0a 09 20 20 20 20 20 20 3b 3b 20 72 65 61  ))..      ;; rea
bb20: 64 20 63 6f 6e 66 69 67 73 20 77 69 74 68 20 74  d configs with t
bb30: 72 69 63 6b 73 20 74 75 72 6e 65 64 20 6f 66 66  ricks turned off
bb40: 20 28 69 2e 65 2e 20 6e 6f 20 73 79 73 74 65 6d   (i.e. no system
bb50: 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d 63  )..      (test-c
bb60: 6f 6e 66 20 20 20 20 28 69 66 20 74 65 73 74 65  onf    (if teste
bb70: 78 69 73 74 73 20 28 72 65 61 64 2d 63 6f 6e 66  xists (read-conf
bb80: 69 67 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 20  ig test-configf 
bb90: 23 66 20 23 66 29 28 6d 61 6b 65 2d 68 61 73 68  #f #f)(make-hash
bba0: 2d 74 61 62 6c 65 29 29 29 29 0a 09 20 3b 3b 20  -table)))).. ;; 
bbb0: 75 73 65 20 74 68 65 20 6f 70 65 6e 2d 72 75 6e  use the open-run
bbc0: 2d 63 6c 6f 73 65 20 69 6e 73 74 65 61 64 20 6f  -close instead o
bbd0: 66 20 70 61 73 73 69 6e 67 20 69 6e 20 64 62 0a  f passing in db.
bbe0: 09 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74  . (runs:update-t
bbf0: 65 73 74 5f 6d 65 74 61 20 23 66 20 74 65 73 74  est_meta #f test
bc00: 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29  -name test-conf)
bc10: 29 29 0a 20 20 20 20 20 74 65 73 74 2d 6e 61 6d  )).     test-nam
bc20: 65 73 29 29 29 0a 0a 3b 3b 20 54 68 69 73 20 63  es)))..;; This c
bc30: 6f 75 6c 64 20 70 72 6f 62 61 62 6c 79 20 62 65  ould probably be
bc40: 20 72 65 66 61 63 74 6f 72 65 64 20 69 6e 74 6f   refactored into
bc50: 20 6f 6e 65 20 63 6f 6d 70 6c 65 78 20 71 75 65   one complex que
bc60: 72 79 20 2e 2e 2e 0a 28 64 65 66 69 6e 65 20 28  ry ....(define (
bc70: 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 20  runs:rollup-run 
bc80: 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72  keys keyvallst r
bc90: 75 6e 6e 61 6d 65 20 75 73 65 72 29 20 3b 3b 20  unname user) ;; 
bca0: 77 61 73 20 74 61 72 67 65 74 2c 20 6e 6f 77 20  was target, now 
bcb0: 6b 65 79 76 61 6c 6c 73 74 0a 20 20 28 64 65 62  keyvallst.  (deb
bcc0: 75 67 3a 70 72 69 6e 74 20 34 20 22 72 75 6e 73  ug:print 4 "runs
bcd0: 3a 72 6f 6c 6c 75 70 2d 72 75 6e 2c 20 6b 65 79  :rollup-run, key
bce0: 73 3a 20 22 20 6b 65 79 73 20 22 20 6b 65 79 76  s: " keys " keyv
bcf0: 61 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c  allst: " keyvall
bd00: 73 74 20 22 20 3a 72 75 6e 6e 61 6d 65 20 22 20  st " :runname " 
bd10: 72 75 6e 6e 61 6d 65 20 22 20 75 73 65 72 3a 20  runname " user: 
bd20: 22 20 75 73 65 72 29 0a 20 20 28 6c 65 74 2a 20  " user).  (let* 
bd30: 28 28 64 62 20 20 20 20 20 20 20 20 20 20 20 20  ((db            
bd40: 20 20 23 66 29 20 3b 3b 20 28 6b 65 79 76 61 6c    #f) ;; (keyval
bd50: 6c 6c 73 74 20 20 20 20 20 20 28 6b 65 79 73 3a  llst      (keys:
bd60: 74 61 72 67 65 74 2d 3e 6b 65 79 76 61 6c 20 6b  target->keyval k
bd70: 65 79 73 20 74 61 72 67 65 74 29 29 0a 09 20 28  eys target)).. (
bd80: 6e 65 77 2d 72 75 6e 2d 69 64 20 20 20 20 20 20  new-run-id      
bd90: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
bda0: 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75  runs:register-ru
bdb0: 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 61 6c  n db keys keyval
bdc0: 6c 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e 65 77  lst runname "new
bdd0: 22 20 22 6e 2f 61 22 20 75 73 65 72 29 29 0a 09  " "n/a" user))..
bde0: 20 28 70 72 65 76 2d 74 65 73 74 73 20 20 20 20   (prev-tests    
bdf0: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73    (open-run-clos
be00: 65 20 74 65 73 74 3a 67 65 74 2d 6d 61 74 63 68  e test:get-match
be10: 69 6e 67 2d 70 72 65 76 69 6f 75 73 2d 74 65 73  ing-previous-tes
be20: 74 2d 72 75 6e 2d 72 65 63 6f 72 64 73 20 64 62  t-run-records db
be30: 20 6e 65 77 2d 72 75 6e 2d 69 64 20 22 25 22 20   new-run-id "%" 
be40: 22 25 22 29 29 0a 09 20 28 63 75 72 72 2d 74 65  "%")).. (curr-te
be50: 73 74 73 20 20 20 20 20 20 28 6f 70 65 6e 2d 72  sts      (open-r
be60: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d  un-close db:get-
be70: 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62  tests-for-run db
be80: 20 6e 65 77 2d 72 75 6e 2d 69 64 20 22 25 2f 25   new-run-id "%/%
be90: 22 20 27 28 29 20 27 28 29 29 29 0a 09 20 28 63  " '() '())).. (c
bea0: 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 28  urr-tests-hash (
beb0: 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29  make-hash-table)
bec0: 29 29 0a 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e  )).    (open-run
bed0: 2d 63 6c 6f 73 65 20 64 62 3a 75 70 64 61 74 65  -close db:update
bee0: 2d 72 75 6e 2d 65 76 65 6e 74 5f 74 69 6d 65 20  -run-event_time 
bef0: 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 29 0a 20  db new-run-id). 
bf00: 20 20 20 3b 3b 20 69 6e 64 65 78 20 74 68 65 20     ;; index the 
bf10: 61 6c 72 65 61 64 79 20 73 61 76 65 64 20 74 65  already saved te
bf20: 73 74 73 20 62 79 20 74 65 73 74 6e 61 6d 65 20  sts by testname 
bf30: 61 6e 64 20 69 74 65 6d 64 61 74 20 69 6e 20 63  and itemdat in c
bf40: 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 0a 20  urr-tests-hash. 
bf50: 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 20     (for-each.   
bf60: 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 64    (lambda (testd
bf70: 61 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a  at).       (let*
bf80: 20 28 28 74 65 73 74 6e 61 6d 65 20 20 28 64 62   ((testname  (db
bf90: 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61  :test-get-testna
bfa0: 6d 65 20 74 65 73 74 64 61 74 29 29 0a 09 20 20  me testdat))..  
bfb0: 20 20 20 20 28 69 74 65 6d 2d 70 61 74 68 20 28      (item-path (
bfc0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d  db:test-get-item
bfd0: 2d 70 61 74 68 20 74 65 73 74 64 61 74 29 29 0a  -path testdat)).
bfe0: 09 20 20 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d  .      (full-nam
bff0: 65 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65  e (conc testname
c000: 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29   "/" item-path))
c010: 29 0a 09 20 28 68 61 73 68 2d 74 61 62 6c 65 2d  ).. (hash-table-
c020: 73 65 74 21 20 63 75 72 72 2d 74 65 73 74 73 2d  set! curr-tests-
c030: 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 74  hash full-name t
c040: 65 73 74 64 61 74 29 29 29 0a 20 20 20 20 20 63  estdat))).     c
c050: 75 72 72 2d 74 65 73 74 73 29 0a 20 20 20 20 3b  urr-tests).    ;
c060: 3b 20 4e 4f 50 45 3a 20 4e 6f 6e 2d 6f 70 74 69  ; NOPE: Non-opti
c070: 6d 61 6c 20 61 70 70 72 6f 61 63 68 2e 20 54 72  mal approach. Tr
c080: 79 20 74 68 69 73 20 69 6e 73 74 65 61 64 2e 0a  y this instead..
c090: 20 20 20 20 3b 3b 20 20 20 31 2e 20 74 65 73 74      ;;   1. test
c0a0: 73 20 61 72 65 20 72 65 63 65 69 76 65 64 20 69  s are received i
c0b0: 6e 20 61 20 6c 69 73 74 2c 20 6d 6f 73 74 20 72  n a list, most r
c0c0: 65 63 65 6e 74 20 66 69 72 73 74 0a 20 20 20 20  ecent first.    
c0d0: 3b 3b 20 20 20 32 2e 20 72 65 70 6c 61 63 65 20  ;;   2. replace 
c0e0: 74 68 65 20 72 6f 6c 6c 75 70 20 74 65 73 74 20  the rollup test 
c0f0: 77 69 74 68 20 74 68 65 20 6e 65 77 20 2a 61 6c  with the new *al
c100: 77 61 79 73 2a 0a 20 20 20 20 28 66 6f 72 2d 65  ways*.    (for-e
c110: 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64  ach .     (lambd
c120: 61 20 28 74 65 73 74 64 61 74 29 0a 20 20 20 20  a (testdat).    
c130: 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 6e     (let* ((testn
c140: 61 6d 65 20 20 28 64 62 3a 74 65 73 74 2d 67 65  ame  (db:test-ge
c150: 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 64  t-testname testd
c160: 61 74 29 29 0a 09 20 20 20 20 20 20 28 69 74 65  at))..      (ite
c170: 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d  m-path (db:test-
c180: 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65  get-item-path te
c190: 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28  stdat))..      (
c1a0: 66 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20  full-name (conc 
c1b0: 74 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65  testname "/" ite
c1c0: 6d 2d 70 61 74 68 29 29 0a 09 20 20 20 20 20 20  m-path))..      
c1d0: 28 70 72 65 76 2d 74 65 73 74 2d 64 61 74 20 28  (prev-test-dat (
c1e0: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64  hash-table-ref/d
c1f0: 65 66 61 75 6c 74 20 63 75 72 72 2d 74 65 73 74  efault curr-test
c200: 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65  s-hash full-name
c210: 20 23 66 29 29 0a 09 20 20 20 20 20 20 28 74 65   #f))..      (te
c220: 73 74 2d 73 74 65 70 73 20 20 20 20 20 20 28 6f  st-steps      (o
c230: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62  pen-run-close db
c240: 3a 67 65 74 2d 73 74 65 70 73 2d 66 6f 72 2d 74  :get-steps-for-t
c250: 65 73 74 20 64 62 20 28 64 62 3a 74 65 73 74 2d  est db (db:test-
c260: 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 29  get-id testdat))
c270: 29 0a 09 20 20 20 20 20 20 28 6e 65 77 2d 74 65  )..      (new-te
c280: 73 74 2d 72 65 63 6f 72 64 20 23 66 29 29 0a 09  st-record #f))..
c290: 20 3b 3b 20 72 65 70 6c 61 63 65 20 74 68 65 73   ;; replace thes
c2a0: 65 20 77 69 74 68 20 69 6e 73 65 72 74 20 2e 2e  e with insert ..
c2b0: 2e 20 73 65 6c 65 63 74 0a 09 20 28 61 70 70 6c  . select.. (appl
c2c0: 79 20 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74  y sqlite3:execut
c2d0: 65 20 0a 09 09 64 62 20 0a 09 09 28 63 6f 6e 63  e ...db ...(conc
c2e0: 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c   "INSERT OR REPL
c2f0: 41 43 45 20 49 4e 54 4f 20 74 65 73 74 73 20 28  ACE INTO tests (
c300: 72 75 6e 5f 69 64 2c 74 65 73 74 6e 61 6d 65 2c  run_id,testname,
c310: 73 74 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65  state,status,eve
c320: 6e 74 5f 74 69 6d 65 2c 68 6f 73 74 2c 63 70 75  nt_time,host,cpu
c330: 6c 6f 61 64 2c 64 69 73 6b 66 72 65 65 2c 75 6e  load,diskfree,un
c340: 61 6d 65 2c 72 75 6e 64 69 72 2c 69 74 65 6d 5f  ame,rundir,item_
c350: 70 61 74 68 2c 72 75 6e 5f 64 75 72 61 74 69 6f  path,run_duratio
c360: 6e 2c 66 69 6e 61 6c 5f 6c 6f 67 66 2c 63 6f 6d  n,final_logf,com
c370: 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 20 20 20  ment) "...      
c380: 22 56 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f  "VALUES (?,?,?,?
c390: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f  ,?,?,?,?,?,?,?,?
c3a0: 2c 3f 2c 3f 29 3b 22 29 0a 09 09 6e 65 77 2d 72  ,?,?);")...new-r
c3b0: 75 6e 2d 69 64 20 28 63 64 64 72 20 28 76 65 63  un-id (cddr (vec
c3c0: 74 6f 72 2d 3e 6c 69 73 74 20 74 65 73 74 64 61  tor->list testda
c3d0: 74 29 29 29 0a 09 20 28 73 65 74 21 20 6e 65 77  t))).. (set! new
c3e0: 2d 74 65 73 74 64 61 74 20 28 63 61 72 20 28 6f  -testdat (car (o
c3f0: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62  pen-run-close db
c400: 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72  :get-tests-for-r
c410: 75 6e 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64  un db new-run-id
c420: 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20   (conc testname 
c430: 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 20 27  "/" item-path) '
c440: 28 29 20 27 28 29 29 29 29 0a 09 20 28 68 61 73  () '()))).. (has
c450: 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72  h-table-set! cur
c460: 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c  r-tests-hash ful
c470: 6c 2d 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74 64  l-name new-testd
c480: 61 74 29 20 3b 3b 20 74 68 69 73 20 63 6f 75 6c  at) ;; this coul
c490: 64 20 62 65 20 63 6f 6e 66 75 73 69 6e 67 2c 20  d be confusing, 
c4a0: 77 68 69 63 68 20 72 65 63 6f 72 64 20 73 68 6f  which record sho
c4b0: 75 6c 64 20 67 6f 20 69 6e 74 6f 20 74 68 65 20  uld go into the 
c4c0: 6c 6f 6f 6b 75 70 20 74 61 62 6c 65 3f 0a 09 20  lookup table?.. 
c4d0: 3b 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65  ;; Now duplicate
c4e0: 20 74 68 65 20 74 65 73 74 20 73 74 65 70 73 0a   the test steps.
c4f0: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34  . (debug:print 4
c500: 20 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64   "Copying record
c510: 73 20 69 6e 20 74 65 73 74 5f 73 74 65 70 73 20  s in test_steps 
c520: 66 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28  from test_id=" (
c530: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74  db:test-get-id t
c540: 65 73 74 64 61 74 29 20 22 20 74 6f 20 22 20 28  estdat) " to " (
c550: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e  db:test-get-id n
c560: 65 77 2d 74 65 73 74 64 61 74 29 29 0a 09 20 28  ew-testdat)).. (
c570: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 0a  open-run-close .
c580: 09 20 20 28 6c 61 6d 62 64 61 20 28 29 0a 09 20  .  (lambda ().. 
c590: 20 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63     (sqlite3:exec
c5a0: 75 74 65 20 0a 09 20 20 20 20 20 64 62 20 0a 09  ute ..     db ..
c5b0: 20 20 20 20 20 28 63 6f 6e 63 20 22 49 4e 53 45       (conc "INSE
c5c0: 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e  RT OR REPLACE IN
c5d0: 54 4f 20 74 65 73 74 5f 73 74 65 70 73 20 28 74  TO test_steps (t
c5e0: 65 73 74 5f 69 64 2c 73 74 65 70 6e 61 6d 65 2c  est_id,stepname,
c5f0: 73 74 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65  state,status,eve
c600: 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 29  nt_time,comment)
c610: 20 22 0a 09 09 20 20 20 22 53 45 4c 45 43 54 20   "...   "SELECT 
c620: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  " (db:test-get-i
c630: 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20 22  d new-testdat) "
c640: 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 74 65 2c  ,stepname,state,
c650: 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d  status,event_tim
c660: 65 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 74  e,comment FROM t
c670: 65 73 74 5f 73 74 65 70 73 20 57 48 45 52 45 20  est_steps WHERE 
c680: 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20  test_id=?;")..  
c690: 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d     (db:test-get-
c6a0: 69 64 20 74 65 73 74 64 61 74 29 29 0a 09 20 20  id testdat))..  
c6b0: 20 20 3b 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61    ;; Now duplica
c6c0: 74 65 20 74 68 65 20 74 65 73 74 20 64 61 74 61  te the test data
c6d0: 0a 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ..    (debug:pri
c6e0: 6e 74 20 34 20 22 43 6f 70 79 69 6e 67 20 72 65  nt 4 "Copying re
c6f0: 63 6f 72 64 73 20 69 6e 20 74 65 73 74 5f 64 61  cords in test_da
c700: 74 61 20 66 72 6f 6d 20 74 65 73 74 5f 69 64 3d  ta from test_id=
c710: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  " (db:test-get-i
c720: 64 20 74 65 73 74 64 61 74 29 20 22 20 74 6f 20  d testdat) " to 
c730: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  " (db:test-get-i
c740: 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 29 0a  d new-testdat)).
c750: 09 20 20 20 20 28 73 71 6c 69 74 65 33 3a 65 78  .    (sqlite3:ex
c760: 65 63 75 74 65 20 0a 09 20 20 20 20 20 64 62 20  ecute ..     db 
c770: 0a 09 20 20 20 20 20 28 63 6f 6e 63 20 22 49 4e  ..     (conc "IN
c780: 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20  SERT OR REPLACE 
c790: 49 4e 54 4f 20 74 65 73 74 5f 64 61 74 61 20 28  INTO test_data (
c7a0: 74 65 73 74 5f 69 64 2c 63 61 74 65 67 6f 72 79  test_id,category
c7b0: 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c  ,variable,value,
c7c0: 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69  expected,tol,uni
c7d0: 74 73 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09  ts,comment) "...
c7e0: 20 20 20 22 53 45 4c 45 43 54 20 22 20 28 64 62     "SELECT " (db
c7f0: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77  :test-get-id new
c800: 2d 74 65 73 74 64 61 74 29 20 22 2c 63 61 74 65  -testdat) ",cate
c810: 67 6f 72 79 2c 76 61 72 69 61 62 6c 65 2c 76 61  gory,variable,va
c820: 6c 75 65 2c 65 78 70 65 63 74 65 64 2c 74 6f 6c  lue,expected,tol
c830: 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65 6e 74 20 46  ,units,comment F
c840: 52 4f 4d 20 74 65 73 74 5f 64 61 74 61 20 57 48  ROM test_data WH
c850: 45 52 45 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29  ERE test_id=?;")
c860: 0a 09 20 20 20 20 20 28 64 62 3a 74 65 73 74 2d  ..     (db:test-
c870: 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 29  get-id testdat))
c880: 29 29 0a 09 20 29 29 0a 20 20 20 20 20 70 72 65  )).. )).     pre
c890: 76 2d 74 65 73 74 73 29 29 29 0a 09 20 0a 20 20  v-tests))).. .  
c8a0: 20 20 20 0a                                         .