Megatest

Hex Artifact Content
Login

Artifact 0af4fb8fbd20c8ce3a08fc0bcfaa90ffa6bbde0f:


0000: 0a 3b 3b 20 43 6f 70 79 72 69 67 68 74 20 32 30  .;; Copyright 20
0010: 30 36 2d 32 30 31 32 2c 20 4d 61 74 74 68 65 77  06-2012, Matthew
0020: 20 57 65 6c 6c 61 6e 64 2e 0a 3b 3b 20 0a 3b 3b   Welland..;; .;;
0030: 20 20 54 68 69 73 20 70 72 6f 67 72 61 6d 20 69    This program i
0040: 73 20 6d 61 64 65 20 61 76 61 69 6c 61 62 6c 65  s made available
0050: 20 75 6e 64 65 72 20 74 68 65 20 47 4e 55 20 47   under the GNU G
0060: 50 4c 20 76 65 72 73 69 6f 6e 20 32 2e 30 20 6f  PL version 2.0 o
0070: 72 0a 3b 3b 20 20 67 72 65 61 74 65 72 2e 20 53  r.;;  greater. S
0080: 65 65 20 74 68 65 20 61 63 63 6f 6d 70 61 6e 79  ee the accompany
0090: 69 6e 67 20 66 69 6c 65 20 43 4f 50 59 49 4e 47  ing file COPYING
00a0: 20 66 6f 72 20 64 65 74 61 69 6c 73 2e 0a 3b 3b   for details..;;
00b0: 20 0a 3b 3b 20 20 54 68 69 73 20 70 72 6f 67 72   .;;  This progr
00c0: 61 6d 20 69 73 20 64 69 73 74 72 69 62 75 74 65  am is distribute
00d0: 64 20 57 49 54 48 4f 55 54 20 41 4e 59 20 57 41  d WITHOUT ANY WA
00e0: 52 52 41 4e 54 59 3b 20 77 69 74 68 6f 75 74 20  RRANTY; without 
00f0: 65 76 65 6e 20 74 68 65 0a 3b 3b 20 20 69 6d 70  even the.;;  imp
0100: 6c 69 65 64 20 77 61 72 72 61 6e 74 79 20 6f 66  lied warranty of
0110: 20 4d 45 52 43 48 41 4e 54 41 42 49 4c 49 54 59   MERCHANTABILITY
0120: 20 6f 72 20 46 49 54 4e 45 53 53 20 46 4f 52 20   or FITNESS FOR 
0130: 41 20 50 41 52 54 49 43 55 4c 41 52 0a 3b 3b 20  A PARTICULAR.;; 
0140: 20 50 55 52 50 4f 53 45 2e 0a 0a 3b 3b 20 20 73   PURPOSE...;;  s
0150: 74 72 66 74 69 6d 65 28 27 25 6d 2f 25 64 2f 25  trftime('%m/%d/%
0160: 59 20 25 48 3a 25 4d 3a 25 53 27 2c 27 6e 6f 77  Y %H:%M:%S','now
0170: 27 2c 27 6c 6f 63 61 6c 74 69 6d 65 27 29 0a 0a  ','localtime')..
0180: 28 75 73 65 20 73 71 6c 69 74 65 33 20 73 72 66  (use sqlite3 srf
0190: 69 2d 31 20 70 6f 73 69 78 20 72 65 67 65 78 20  i-1 posix regex 
01a0: 72 65 67 65 78 2d 63 61 73 65 20 73 72 66 69 2d  regex-case srfi-
01b0: 36 39 20 64 6f 74 2d 6c 6f 63 6b 69 6e 67 20 28  69 dot-locking (
01c0: 73 72 66 69 20 31 38 29 20 70 6f 73 69 78 2d 65  srfi 18) posix-e
01d0: 78 74 72 61 73 20 64 69 72 65 63 74 6f 72 79 2d  xtras directory-
01e0: 75 74 69 6c 73 29 0a 28 69 6d 70 6f 72 74 20 28  utils).(import (
01f0: 70 72 65 66 69 78 20 73 71 6c 69 74 65 33 20 73  prefix sqlite3 s
0200: 71 6c 69 74 65 33 3a 29 29 0a 0a 28 64 65 63 6c  qlite3:))..(decl
0210: 61 72 65 20 28 75 6e 69 74 20 72 75 6e 73 29 29  are (unit runs))
0220: 0a 28 64 65 63 6c 61 72 65 20 28 75 73 65 73 20  .(declare (uses 
0230: 64 62 29 29 0a 28 64 65 63 6c 61 72 65 20 28 75  db)).(declare (u
0240: 73 65 73 20 63 6f 6d 6d 6f 6e 29 29 0a 28 64 65  ses common)).(de
0250: 63 6c 61 72 65 20 28 75 73 65 73 20 69 74 65 6d  clare (uses item
0260: 73 29 29 0a 28 64 65 63 6c 61 72 65 20 28 75 73  s)).(declare (us
0270: 65 73 20 72 75 6e 63 6f 6e 66 69 67 29 29 0a 28  es runconfig)).(
0280: 64 65 63 6c 61 72 65 20 28 75 73 65 73 20 74 65  declare (uses te
0290: 73 74 73 29 29 0a 28 64 65 63 6c 61 72 65 20 28  sts)).(declare (
02a0: 75 73 65 73 20 73 65 72 76 65 72 29 29 0a 0a 28  uses server))..(
02b0: 69 6e 63 6c 75 64 65 20 22 63 6f 6d 6d 6f 6e 5f  include "common_
02c0: 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 0a 28 69  records.scm").(i
02d0: 6e 63 6c 75 64 65 20 22 6b 65 79 5f 72 65 63 6f  nclude "key_reco
02e0: 72 64 73 2e 73 63 6d 22 29 0a 28 69 6e 63 6c 75  rds.scm").(inclu
02f0: 64 65 20 22 64 62 5f 72 65 63 6f 72 64 73 2e 73  de "db_records.s
0300: 63 6d 22 29 0a 28 69 6e 63 6c 75 64 65 20 22 72  cm").(include "r
0310: 75 6e 5f 72 65 63 6f 72 64 73 2e 73 63 6d 22 29  un_records.scm")
0320: 0a 28 69 6e 63 6c 75 64 65 20 22 74 65 73 74 5f  .(include "test_
0330: 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 0a 0a 3b  records.scm")..;
0340: 3b 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d  ; runs:get-runs-
0350: 62 79 2d 70 61 74 74 0a 3b 3b 20 67 65 74 20 72  by-patt.;; get r
0360: 75 6e 73 20 62 79 20 6c 69 73 74 20 6f 66 20 63  uns by list of c
0370: 72 69 74 65 72 69 61 0a 3b 3b 20 72 65 67 69 73  riteria.;; regis
0380: 74 65 72 20 61 20 74 65 73 74 20 72 75 6e 20 77  ter a test run w
0390: 69 74 68 20 74 68 65 20 64 62 0a 3b 3b 0a 3b 3b  ith the db.;;.;;
03a0: 20 55 73 65 3a 20 28 64 62 2d 67 65 74 2d 76 61   Use: (db-get-va
03b0: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 28 64  lue-by-header (d
03c0: 62 3a 67 65 74 2d 68 65 61 64 65 72 20 72 75 6e  b:get-header run
03d0: 69 6e 66 6f 29 28 64 62 3a 67 65 74 2d 72 6f 77  info)(db:get-row
03e0: 20 72 75 6e 69 6e 66 6f 29 29 0a 3b 3b 20 20 74   runinfo)).;;  t
03f0: 6f 20 65 78 74 72 61 63 74 20 69 6e 66 6f 20 66  o extract info f
0400: 72 6f 6d 20 74 68 65 20 73 74 72 75 63 74 75 72  rom the structur
0410: 65 20 72 65 74 75 72 6e 65 64 0a 3b 3b 0a 28 64  e returned.;;.(d
0420: 65 66 69 6e 65 20 28 72 75 6e 73 3a 67 65 74 2d  efine (runs:get-
0430: 72 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20  runs-by-patt db 
0440: 6b 65 79 73 20 72 75 6e 6e 61 6d 65 70 61 74 74  keys runnamepatt
0450: 29 20 3b 3b 20 74 65 73 74 2d 6e 61 6d 65 29 0a  ) ;; test-name).
0460: 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 76 61 6c    (let* ((keyval
0470: 6c 73 74 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69  lst (keys->valli
0480: 73 74 20 6b 65 79 73 29 29 0a 09 20 28 74 6d 70  st keys)).. (tmp
0490: 20 20 20 20 20 20 28 72 75 6e 73 3a 67 65 74 2d        (runs:get-
04a0: 73 74 64 2d 72 75 6e 2d 66 69 65 6c 64 73 20 6b  std-run-fields k
04b0: 65 79 73 20 27 28 22 69 64 22 20 22 72 75 6e 6e  eys '("id" "runn
04c0: 61 6d 65 22 20 22 73 74 61 74 65 22 20 22 73 74  ame" "state" "st
04d0: 61 74 75 73 22 20 22 6f 77 6e 65 72 22 20 22 65  atus" "owner" "e
04e0: 76 65 6e 74 5f 74 69 6d 65 22 29 29 29 0a 09 20  vent_time"))).. 
04f0: 28 6b 65 79 73 74 72 20 20 20 28 63 61 72 20 74  (keystr   (car t
0500: 6d 70 29 29 0a 09 20 28 68 65 61 64 65 72 20 20  mp)).. (header  
0510: 20 28 63 61 64 72 20 74 6d 70 29 29 0a 09 20 28   (cadr tmp)).. (
0520: 72 65 73 20 20 20 20 20 27 28 29 29 0a 09 20 28  res     '()).. (
0530: 6b 65 79 2d 70 61 74 74 20 22 22 29 0a 09 20 28  key-patt "").. (
0540: 72 75 6e 77 69 6c 64 74 79 70 65 20 28 69 66 20  runwildtype (if 
0550: 28 73 75 62 73 74 72 69 6e 67 2d 69 6e 64 65 78  (substring-index
0560: 20 22 25 22 20 72 75 6e 6e 61 6d 65 70 61 74 74   "%" runnamepatt
0570: 29 20 22 6c 69 6b 65 22 20 22 67 6c 6f 62 22 29  ) "like" "glob")
0580: 29 0a 09 20 28 71 72 79 2d 73 74 72 20 20 23 66  ).. (qry-str  #f
0590: 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68  )).    (for-each
05a0: 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 76 61 6c   (lambda (keyval
05b0: 29 0a 09 09 28 6c 65 74 2a 20 28 28 6b 65 79 20  )...(let* ((key 
05c0: 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 6b     (vector-ref k
05d0: 65 79 76 61 6c 20 30 29 29 0a 09 09 20 20 20 20  eyval 0))...    
05e0: 20 20 20 28 66 75 6c 6b 65 79 20 28 63 6f 6e 63     (fulkey (conc
05f0: 20 22 3a 22 20 6b 65 79 29 29 0a 09 09 20 20 20   ":" key))...   
0600: 20 20 20 20 28 70 61 74 74 20 20 20 28 61 72 67      (patt   (arg
0610: 73 3a 67 65 74 2d 61 72 67 20 66 75 6c 6b 65 79  s:get-arg fulkey
0620: 29 29 0a 09 09 20 20 20 20 20 20 20 28 77 69 6c  ))...       (wil
0630: 64 74 79 70 65 20 28 69 66 20 28 73 75 62 73 74  dtype (if (subst
0640: 72 69 6e 67 2d 69 6e 64 65 78 20 22 25 22 20 70  ring-index "%" p
0650: 61 74 74 29 20 22 6c 69 6b 65 22 20 22 67 6c 6f  att) "like" "glo
0660: 62 22 29 29 29 0a 09 09 20 20 28 69 66 20 70 61  b")))...  (if pa
0670: 74 74 0a 09 09 20 20 20 20 20 20 28 73 65 74 21  tt...      (set!
0680: 20 6b 65 79 2d 70 61 74 74 20 28 63 6f 6e 63 20   key-patt (conc 
0690: 6b 65 79 2d 70 61 74 74 20 22 20 41 4e 44 20 22  key-patt " AND "
06a0: 20 6b 65 79 20 22 20 22 20 77 69 6c 64 74 79 70   key " " wildtyp
06b0: 65 20 22 20 27 22 20 70 61 74 74 20 22 27 22 29  e " '" patt "'")
06c0: 29 0a 09 09 20 20 20 20 20 20 28 62 65 67 69 6e  )...      (begin
06d0: 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74  ....(debug:print
06e0: 20 30 20 22 45 52 52 4f 52 3a 20 73 65 61 72 63   0 "ERROR: searc
06f0: 68 69 6e 67 20 66 6f 72 20 72 75 6e 73 20 77 69  hing for runs wi
0700: 74 68 20 6e 6f 20 70 61 74 74 65 72 6e 20 73 65  th no pattern se
0710: 74 20 66 6f 72 20 22 20 66 75 6c 6b 65 79 29 0a  t for " fulkey).
0720: 09 09 09 28 65 78 69 74 20 36 29 29 29 29 29 0a  ...(exit 6))))).
0730: 09 20 20 20 20 20 20 6b 65 79 73 29 0a 20 20 20  .      keys).   
0740: 20 28 73 65 74 21 20 71 72 79 2d 73 74 72 20 28   (set! qry-str (
0750: 63 6f 6e 63 20 22 53 45 4c 45 43 54 20 22 20 6b  conc "SELECT " k
0760: 65 79 73 74 72 20 22 20 46 52 4f 4d 20 72 75 6e  eystr " FROM run
0770: 73 20 57 48 45 52 45 20 72 75 6e 6e 61 6d 65 20  s WHERE runname 
0780: 22 20 72 75 6e 77 69 6c 64 74 79 70 65 20 22 20  " runwildtype " 
0790: 3f 20 22 20 6b 65 79 2d 70 61 74 74 20 22 3b 22  ? " key-patt ";"
07a0: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72  )).    (debug:pr
07b0: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 72 75 6e 73  int-info 4 "runs
07c0: 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74  :get-runs-by-pat
07d0: 74 20 71 72 79 3d 22 20 71 72 79 2d 73 74 72 20  t qry=" qry-str 
07e0: 22 20 22 20 72 75 6e 6e 61 6d 65 70 61 74 74 29  " " runnamepatt)
07f0: 0a 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66 6f  .    (sqlite3:fo
0800: 72 2d 65 61 63 68 2d 72 6f 77 20 0a 20 20 20 20  r-each-row .    
0810: 20 28 6c 61 6d 62 64 61 20 28 61 20 2e 20 72 29   (lambda (a . r)
0820: 0a 20 20 20 20 20 20 20 28 73 65 74 21 20 72 65  .       (set! re
0830: 73 20 28 63 6f 6e 73 20 28 6c 69 73 74 2d 3e 76  s (cons (list->v
0840: 65 63 74 6f 72 20 28 63 6f 6e 73 20 61 20 72 29  ector (cons a r)
0850: 29 20 72 65 73 29 29 29 0a 20 20 20 20 20 64 62  ) res))).     db
0860: 20 0a 20 20 20 20 20 71 72 79 2d 73 74 72 0a 20   .     qry-str. 
0870: 20 20 20 20 72 75 6e 6e 61 6d 65 70 61 74 74 29      runnamepatt)
0880: 0a 20 20 20 20 28 76 65 63 74 6f 72 20 68 65 61  .    (vector hea
0890: 64 65 72 20 72 65 73 29 29 29 0a 0a 28 64 65 66  der res)))..(def
08a0: 69 6e 65 20 28 72 75 6e 73 3a 74 65 73 74 2d 67  ine (runs:test-g
08b0: 65 74 2d 66 75 6c 6c 2d 70 61 74 68 20 74 65 73  et-full-path tes
08c0: 74 29 0a 20 20 28 6c 65 74 2a 20 28 28 74 65 73  t).  (let* ((tes
08d0: 74 6e 61 6d 65 20 28 64 62 3a 74 65 73 74 2d 67  tname (db:test-g
08e0: 65 74 2d 74 65 73 74 6e 61 6d 65 20 20 20 74 65  et-testname   te
08f0: 73 74 29 29 0a 09 20 28 69 74 65 6d 70 61 74 68  st)).. (itempath
0900: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74   (db:test-get-it
0910: 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29 29 0a  em-path test))).
0920: 20 20 20 20 28 63 6f 6e 63 20 74 65 73 74 6e 61      (conc testna
0930: 6d 65 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69  me (if (equal? i
0940: 74 65 6d 70 61 74 68 20 22 22 29 20 22 22 20 28  tempath "") "" (
0950: 63 6f 6e 63 20 22 28 22 20 69 74 65 6d 70 61 74  conc "(" itempat
0960: 68 20 22 29 22 29 29 29 29 29 0a 0a 28 64 65 66  h ")")))))..(def
0970: 69 6e 65 20 28 64 62 3a 67 65 74 2d 72 75 6e 2d  ine (db:get-run-
0980: 6b 65 79 2d 76 61 6c 20 64 62 20 72 75 6e 2d 69  key-val db run-i
0990: 64 20 6b 65 79 29 0a 20 20 28 6c 65 74 20 28 28  d key).  (let ((
09a0: 72 65 73 20 23 66 29 29 0a 20 20 20 20 28 73 71  res #f)).    (sq
09b0: 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72  lite3:for-each-r
09c0: 6f 77 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20  ow.     (lambda 
09d0: 28 76 61 6c 29 0a 20 20 20 20 20 20 20 28 73 65  (val).       (se
09e0: 74 21 20 72 65 73 20 76 61 6c 29 29 0a 20 20 20  t! res val)).   
09f0: 20 20 64 62 20 0a 20 20 20 20 20 28 63 6f 6e 63    db .     (conc
0a00: 20 22 53 45 4c 45 43 54 20 22 20 28 6b 65 79 3a   "SELECT " (key:
0a10: 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65  get-fieldname ke
0a20: 79 29 20 22 20 46 52 4f 4d 20 72 75 6e 73 20 57  y) " FROM runs W
0a30: 48 45 52 45 20 69 64 3d 3f 3b 22 29 0a 20 20 20  HERE id=?;").   
0a40: 20 20 72 75 6e 2d 69 64 29 0a 20 20 20 20 72 65    run-id).    re
0a50: 73 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 64 62  s))..(define (db
0a60: 3a 67 65 74 2d 72 75 6e 2d 6e 61 6d 65 2d 66 72  :get-run-name-fr
0a70: 6f 6d 2d 69 64 20 64 62 20 72 75 6e 2d 69 64 29  om-id db run-id)
0a80: 0a 20 20 28 6c 65 74 20 28 28 72 65 73 20 23 66  .  (let ((res #f
0a90: 29 29 0a 20 20 20 20 28 73 71 6c 69 74 65 33 3a  )).    (sqlite3:
0aa0: 66 6f 72 2d 65 61 63 68 2d 72 6f 77 0a 20 20 20  for-each-row.   
0ab0: 20 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 6e 61    (lambda (runna
0ac0: 6d 65 29 0a 20 20 20 20 20 20 20 28 73 65 74 21  me).       (set!
0ad0: 20 72 65 73 20 72 75 6e 6e 61 6d 65 29 29 0a 20   res runname)). 
0ae0: 20 20 20 20 64 62 0a 20 20 20 20 20 22 53 45 4c      db.     "SEL
0af0: 45 43 54 20 72 75 6e 6e 61 6d 65 20 46 52 4f 4d  ECT runname FROM
0b00: 20 72 75 6e 73 20 57 48 45 52 45 20 69 64 3d 3f   runs WHERE id=?
0b10: 3b 22 0a 20 20 20 20 20 72 75 6e 2d 69 64 29 0a  ;".     run-id).
0b20: 20 20 20 20 72 65 73 29 29 0a 0a 28 64 65 66 69      res))..(defi
0b30: 6e 65 20 28 73 65 74 2d 6d 65 67 61 74 65 73 74  ne (set-megatest
0b40: 2d 65 6e 76 2d 76 61 72 73 20 72 75 6e 2d 69 64  -env-vars run-id
0b50: 29 0a 20 20 28 6c 65 74 20 28 28 6b 65 79 73 20  ).  (let ((keys 
0b60: 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20  (cdb:remote-run 
0b70: 64 62 3a 67 65 74 2d 6b 65 79 73 20 23 66 29 29  db:get-keys #f))
0b80: 0a 09 28 76 61 6c 73 20 28 68 61 73 68 2d 74 61  ..(vals (hash-ta
0b90: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20  ble-ref/default 
0ba0: 2a 65 6e 76 2d 76 61 72 73 2d 62 79 2d 72 75 6e  *env-vars-by-run
0bb0: 2d 69 64 2a 20 72 75 6e 2d 69 64 20 23 66 29 29  -id* run-id #f))
0bc0: 29 0a 20 20 20 20 3b 3b 20 67 65 74 20 74 68 65  ).    ;; get the
0bd0: 20 69 6e 66 6f 20 66 72 6f 6d 20 74 68 65 20 64   info from the d
0be0: 62 20 61 6e 64 20 70 75 74 20 69 74 20 69 6e 20  b and put it in 
0bf0: 74 68 65 20 63 61 63 68 65 0a 20 20 20 20 28 69  the cache.    (i
0c00: 66 20 28 6e 6f 74 20 76 61 6c 73 29 0a 09 28 6c  f (not vals)..(l
0c10: 65 74 20 28 28 68 74 20 28 6d 61 6b 65 2d 68 61  et ((ht (make-ha
0c20: 73 68 2d 74 61 62 6c 65 29 29 29 0a 09 20 20 28  sh-table)))..  (
0c30: 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20  hash-table-set! 
0c40: 2a 65 6e 76 2d 76 61 72 73 2d 62 79 2d 72 75 6e  *env-vars-by-run
0c50: 2d 69 64 2a 20 72 75 6e 2d 69 64 20 68 74 29 0a  -id* run-id ht).
0c60: 09 20 20 28 73 65 74 21 20 76 61 6c 73 20 68 74  .  (set! vals ht
0c70: 29 0a 09 20 20 28 66 6f 72 2d 65 61 63 68 0a 09  )..  (for-each..
0c80: 20 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 29     (lambda (key)
0c90: 0a 09 20 20 20 20 20 28 68 61 73 68 2d 74 61 62  ..     (hash-tab
0ca0: 6c 65 2d 73 65 74 21 20 76 61 6c 73 20 6b 65 79  le-set! vals key
0cb0: 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e   (cdb:remote-run
0cc0: 20 64 62 3a 67 65 74 2d 72 75 6e 2d 6b 65 79 2d   db:get-run-key-
0cd0: 76 61 6c 20 23 66 20 72 75 6e 2d 69 64 20 6b 65  val #f run-id ke
0ce0: 79 29 29 29 0a 09 20 20 20 6b 65 79 73 29 29 29  y)))..   keys)))
0cf0: 0a 20 20 20 20 3b 3b 20 66 72 6f 6d 20 74 68 65  .    ;; from the
0d00: 20 63 61 63 68 65 64 20 64 61 74 61 20 73 65 74   cached data set
0d10: 20 74 68 65 20 76 61 72 73 0a 20 20 20 20 28 68   the vars.    (h
0d20: 61 73 68 2d 74 61 62 6c 65 2d 66 6f 72 2d 65 61  ash-table-for-ea
0d30: 63 68 0a 20 20 20 20 20 76 61 6c 73 0a 20 20 20  ch.     vals.   
0d40: 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 20 76    (lambda (key v
0d50: 61 6c 29 0a 20 20 20 20 20 20 20 28 64 65 62 75  al).       (debu
0d60: 67 3a 70 72 69 6e 74 20 32 20 22 73 65 74 65 6e  g:print 2 "seten
0d70: 76 20 22 20 28 6b 65 79 3a 67 65 74 2d 66 69 65  v " (key:get-fie
0d80: 6c 64 6e 61 6d 65 20 6b 65 79 29 20 22 20 22 20  ldname key) " " 
0d90: 76 61 6c 29 0a 20 20 20 20 20 20 20 28 73 65 74  val).       (set
0da0: 65 6e 76 20 28 6b 65 79 3a 67 65 74 2d 66 69 65  env (key:get-fie
0db0: 6c 64 6e 61 6d 65 20 6b 65 79 29 20 76 61 6c 29  ldname key) val)
0dc0: 29 29 0a 20 20 20 20 28 61 6c 69 73 74 2d 3e 65  )).    (alist->e
0dd0: 6e 76 2d 76 61 72 73 20 28 68 61 73 68 2d 74 61  nv-vars (hash-ta
0de0: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20  ble-ref/default 
0df0: 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 65 6e 76  *configdat* "env
0e00: 2d 6f 76 65 72 72 69 64 65 22 20 27 28 29 29 29  -override" '()))
0e10: 0a 20 20 20 20 3b 3b 20 4c 65 74 73 20 75 73 65  .    ;; Lets use
0e20: 20 74 68 69 73 20 61 73 20 61 6e 20 6f 70 70 6f   this as an oppo
0e30: 72 74 75 6e 69 74 79 20 74 6f 20 70 75 74 20 4d  rtunity to put M
0e40: 54 5f 52 55 4e 4e 41 4d 45 20 69 6e 20 74 68 65  T_RUNNAME in the
0e50: 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 20 20 20   environment.   
0e60: 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e   (setenv "MT_RUN
0e70: 4e 41 4d 45 22 20 28 63 64 62 3a 72 65 6d 6f 74  NAME" (cdb:remot
0e80: 65 2d 72 75 6e 20 64 62 3a 67 65 74 2d 72 75 6e  e-run db:get-run
0e90: 2d 6e 61 6d 65 2d 66 72 6f 6d 2d 69 64 20 23 66  -name-from-id #f
0ea0: 20 72 75 6e 2d 69 64 29 29 0a 20 20 20 20 28 73   run-id)).    (s
0eb0: 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e 5f 41 52  etenv "MT_RUN_AR
0ec0: 45 41 5f 48 4f 4d 45 22 20 2a 74 6f 70 70 61 74  EA_HOME" *toppat
0ed0: 68 2a 29 0a 20 20 20 20 29 29 0a 0a 28 64 65 66  h*).    ))..(def
0ee0: 69 6e 65 20 28 73 65 74 2d 69 74 65 6d 2d 65 6e  ine (set-item-en
0ef0: 76 2d 76 61 72 73 20 69 74 65 6d 64 61 74 29 0a  v-vars itemdat).
0f00: 20 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d    (for-each (lam
0f10: 62 64 61 20 28 69 74 65 6d 29 0a 09 20 20 20 20  bda (item)..    
0f20: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32    (debug:print 2
0f30: 20 22 73 65 74 65 6e 76 20 22 20 28 63 61 72 20   "setenv " (car 
0f40: 69 74 65 6d 29 20 22 20 22 20 28 63 61 64 72 20  item) " " (cadr 
0f50: 69 74 65 6d 29 29 0a 09 20 20 20 20 20 20 28 73  item))..      (s
0f60: 65 74 65 6e 76 20 28 63 61 72 20 69 74 65 6d 29  etenv (car item)
0f70: 20 28 63 61 64 72 20 69 74 65 6d 29 29 29 0a 09   (cadr item)))..
0f80: 20 20 20 20 69 74 65 6d 64 61 74 29 29 0a 0a 28      itemdat))..(
0f90: 64 65 66 69 6e 65 20 2a 6c 61 73 74 2d 6e 75 6d  define *last-num
0fa0: 2d 72 75 6e 6e 69 6e 67 2d 74 65 73 74 73 2a 20  -running-tests* 
0fb0: 30 29 0a 28 64 65 66 69 6e 65 20 2a 72 75 6e 73  0).(define *runs
0fc0: 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65  :can-run-more-te
0fd0: 73 74 73 2d 64 65 6c 61 79 2a 20 30 29 0a 28 64  sts-delay* 0).(d
0fe0: 65 66 69 6e 65 20 28 72 75 6e 73 3a 73 68 72 69  efine (runs:shri
0ff0: 6e 6b 2d 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d  nk-can-run-more-
1000: 74 65 73 74 73 2d 64 65 6c 61 79 29 0a 20 20 28  tests-delay).  (
1010: 73 65 74 21 20 2a 72 75 6e 73 3a 63 61 6e 2d 72  set! *runs:can-r
1020: 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65  un-more-tests-de
1030: 6c 61 79 2a 20 30 29 29 20 3b 3b 20 28 2f 20 2a  lay* 0)) ;; (/ *
1040: 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72  runs:can-run-mor
1050: 65 2d 74 65 73 74 73 2d 64 65 6c 61 79 2a 20 32  e-tests-delay* 2
1060: 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75  )))..(define (ru
1070: 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d  ns:can-run-more-
1080: 74 65 73 74 73 20 74 65 73 74 2d 72 65 63 6f 72  tests test-recor
1090: 64 29 0a 20 20 28 74 68 72 65 61 64 2d 73 6c 65  d).  (thread-sle
10a0: 65 70 21 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75  ep! *runs:can-ru
10b0: 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c  n-more-tests-del
10c0: 61 79 2a 29 0a 20 20 28 6c 65 74 2a 20 28 28 74  ay*).  (let* ((t
10d0: 63 6f 6e 66 69 67 20 20 20 20 20 20 20 20 20 20  config          
10e0: 20 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 65         (tests:te
10f0: 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74  stqueue-get-test
1100: 63 6f 6e 66 69 67 20 74 65 73 74 2d 72 65 63 6f  config test-reco
1110: 72 64 29 29 0a 09 20 28 6a 6f 62 67 72 6f 75 70  rd)).. (jobgroup
1120: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1130: 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74  (config-lookup t
1140: 63 6f 6e 66 69 67 20 22 72 65 71 75 69 72 65 6d  config "requirem
1150: 65 6e 74 73 22 20 22 6a 6f 62 67 72 6f 75 70 22  ents" "jobgroup"
1160: 29 29 0a 09 20 3b 3b 20 48 65 75 72 69 73 74 69  )).. ;; Heuristi
1170: 63 20 66 69 78 2e 20 54 68 65 73 65 20 61 72 65  c fix. These are
1180: 20 67 65 74 74 69 6e 67 20 63 61 6c 6c 65 64 20   getting called 
1190: 74 6f 6f 20 72 61 70 69 64 6c 79 20 77 68 65 6e  too rapidly when
11a0: 20 6a 6f 62 73 20 61 72 65 20 72 75 6e 6e 69 6e   jobs are runnin
11b0: 67 20 6f 72 20 73 74 75 63 6b 0a 09 20 3b 3b 20  g or stuck.. ;; 
11c0: 73 6f 20 77 65 20 61 72 65 20 67 6f 69 6e 67 20  so we are going 
11d0: 74 6f 20 69 6e 63 72 65 6d 65 6e 74 20 61 20 67  to increment a g
11e0: 6c 6f 62 61 6c 20 64 65 6c 61 79 20 62 79 20 30  lobal delay by 0
11f0: 2e 31 20 73 65 63 6f 6e 64 73 20 75 70 20 74 6f  .1 seconds up to
1200: 20 31 30 20 73 65 63 6f 6e 64 73 0a 09 20 3b 3b   10 seconds.. ;;
1210: 20 65 76 65 72 79 20 74 69 6d 65 20 72 75 6e 73   every time runs
1220: 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65  :can-run-more-te
1230: 73 74 73 20 69 73 20 63 61 6c 6c 65 64 2e 0a 09  sts is called...
1240: 20 3b 3b 20 77 68 65 6e 20 61 20 74 65 73 74 20   ;; when a test 
1250: 69 73 20 6c 61 75 6e 63 68 65 64 20 6f 72 20 6f  is launched or o
1260: 74 68 65 72 20 61 63 74 69 76 69 74 79 20 6f 63  ther activity oc
1270: 63 75 72 73 20 64 69 76 69 64 65 20 74 68 65 20  curs divide the 
1280: 64 65 6c 61 79 20 62 79 20 32 0a 09 20 28 6e 75  delay by 2.. (nu
1290: 6d 2d 72 75 6e 6e 69 6e 67 20 20 20 20 20 20 20  m-running       
12a0: 20 20 20 20 20 20 28 63 64 62 3a 72 65 6d 6f 74        (cdb:remot
12b0: 65 2d 72 75 6e 20 64 62 3a 67 65 74 2d 63 6f 75  e-run db:get-cou
12c0: 6e 74 2d 74 65 73 74 73 2d 72 75 6e 6e 69 6e 67  nt-tests-running
12d0: 20 23 66 29 29 0a 09 20 28 6e 75 6d 2d 72 75 6e   #f)).. (num-run
12e0: 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70  ning-in-jobgroup
12f0: 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e   (cdb:remote-run
1300: 20 64 62 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 65   db:get-count-te
1310: 73 74 73 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a  sts-running-in-j
1320: 6f 62 67 72 6f 75 70 20 23 66 20 6a 6f 62 67 72  obgroup #f jobgr
1330: 6f 75 70 29 29 0a 09 20 28 6d 61 78 2d 63 6f 6e  oup)).. (max-con
1340: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 20 20 20  current-jobs    
1350: 20 28 6c 65 74 20 28 28 6d 63 6a 20 28 63 6f 6e   (let ((mcj (con
1360: 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66  fig-lookup *conf
1370: 69 67 64 61 74 2a 20 22 73 65 74 75 70 22 20 20  igdat* "setup"  
1380: 20 20 20 22 6d 61 78 5f 63 6f 6e 63 75 72 72 65     "max_concurre
1390: 6e 74 5f 6a 6f 62 73 22 29 29 29 0a 09 09 09 09  nt_jobs"))).....
13a0: 20 20 20 20 28 69 66 20 28 61 6e 64 20 6d 63 6a      (if (and mcj
13b0: 20 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72   (string->number
13c0: 20 6d 63 6a 29 29 0a 09 09 09 09 09 28 73 74 72   mcj))......(str
13d0: 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 63 6a 29  ing->number mcj)
13e0: 0a 09 09 09 09 09 31 29 29 29 0a 09 20 28 6a 6f  ......1))).. (jo
13f0: 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 20 20 20  b-group-limit   
1400: 20 20 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f        (config-lo
1410: 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a  okup *configdat*
1420: 20 22 6a 6f 62 67 72 6f 75 70 73 22 20 6a 6f 62   "jobgroups" job
1430: 67 72 6f 75 70 29 29 29 0a 20 20 20 20 28 69 66  group))).    (if
1440: 20 28 61 6e 64 20 28 3e 20 28 2b 20 6e 75 6d 2d   (and (> (+ num-
1450: 72 75 6e 6e 69 6e 67 20 6e 75 6d 2d 72 75 6e 6e  running num-runn
1460: 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 29  ing-in-jobgroup)
1470: 20 30 29 0a 09 20 20 20 20 20 28 3c 20 2a 72 75   0)..     (< *ru
1480: 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d  ns:can-run-more-
1490: 74 65 73 74 73 2d 64 65 6c 61 79 2a 20 31 30 29  tests-delay* 10)
14a0: 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 73 65  )..(begin..  (se
14b0: 74 21 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75 6e  t! *runs:can-run
14c0: 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c 61  -more-tests-dela
14d0: 79 2a 20 28 2b 20 2a 72 75 6e 73 3a 63 61 6e 2d  y* (+ *runs:can-
14e0: 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64  run-more-tests-d
14f0: 65 6c 61 79 2a 20 31 29 29 20 3b 3b 20 30 2e 31  elay* 1)) ;; 0.1
1500: 29 29 0a 09 20 20 28 64 65 62 75 67 3a 70 72 69  ))..  (debug:pri
1510: 6e 74 2d 69 6e 66 6f 20 31 34 20 22 63 61 6e 2d  nt-info 14 "can-
1520: 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64  run-more-tests-d
1530: 65 6c 61 79 3a 20 22 20 2a 72 75 6e 73 3a 63 61  elay: " *runs:ca
1540: 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73  n-run-more-tests
1550: 2d 64 65 6c 61 79 2a 29 29 29 0a 20 20 20 20 28  -delay*))).    (
1560: 69 66 20 28 6e 6f 74 20 28 65 71 3f 20 2a 6c 61  if (not (eq? *la
1570: 73 74 2d 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 74  st-num-running-t
1580: 65 73 74 73 2a 20 6e 75 6d 2d 72 75 6e 6e 69 6e  ests* num-runnin
1590: 67 29 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 28  g))..(begin..  (
15a0: 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 6d  debug:print 2 "m
15b0: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f  ax-concurrent-jo
15c0: 62 73 3a 20 22 20 6d 61 78 2d 63 6f 6e 63 75 72  bs: " max-concur
15d0: 72 65 6e 74 2d 6a 6f 62 73 20 22 2c 20 6e 75 6d  rent-jobs ", num
15e0: 2d 72 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d  -running: " num-
15f0: 72 75 6e 6e 69 6e 67 29 0a 09 20 20 28 73 65 74  running)..  (set
1600: 21 20 2a 6c 61 73 74 2d 6e 75 6d 2d 72 75 6e 6e  ! *last-num-runn
1610: 69 6e 67 2d 74 65 73 74 73 2a 20 6e 75 6d 2d 72  ing-tests* num-r
1620: 75 6e 6e 69 6e 67 29 29 29 0a 20 20 20 20 28 69  unning))).    (i
1630: 66 20 28 6e 6f 74 20 28 65 71 3f 20 30 20 2a 67  f (not (eq? 0 *g
1640: 6c 6f 62 61 6c 65 78 69 74 73 74 61 74 75 73 2a  lobalexitstatus*
1650: 29 29 0a 09 28 6c 69 73 74 20 23 66 20 6e 75 6d  ))..(list #f num
1660: 2d 72 75 6e 6e 69 6e 67 20 6e 75 6d 2d 72 75 6e  -running num-run
1670: 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70  ning-in-jobgroup
1680: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d   max-concurrent-
1690: 6a 6f 62 73 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c  jobs job-group-l
16a0: 69 6d 69 74 29 0a 09 28 6c 65 74 20 28 28 63 61  imit)..(let ((ca
16b0: 6e 2d 6e 6f 74 2d 72 75 6e 2d 6d 6f 72 65 20 28  n-not-run-more (
16c0: 63 6f 6e 64 0a 09 09 09 09 20 3b 3b 20 69 66 20  cond..... ;; if 
16d0: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a  max-concurrent-j
16e0: 6f 62 73 20 69 73 20 73 65 74 20 61 6e 64 20 74  obs is set and t
16f0: 68 65 20 6e 75 6d 62 65 72 20 72 75 6e 6e 69 6e  he number runnin
1700: 67 20 69 73 20 67 72 65 61 74 65 72 20 0a 09 09  g is greater ...
1710: 09 09 20 3b 3b 20 74 68 61 6e 20 69 74 20 74 68  .. ;; than it th
1720: 61 6e 20 63 61 6e 6e 6f 74 20 72 75 6e 20 6d 6f  an cannot run mo
1730: 72 65 20 6a 6f 62 73 0a 09 09 09 09 20 28 28 61  re jobs..... ((a
1740: 6e 64 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e  nd max-concurren
1750: 74 2d 6a 6f 62 73 20 28 3e 3d 20 6e 75 6d 2d 72  t-jobs (>= num-r
1760: 75 6e 6e 69 6e 67 20 6d 61 78 2d 63 6f 6e 63 75  unning max-concu
1770: 72 72 65 6e 74 2d 6a 6f 62 73 29 29 0a 09 09 09  rrent-jobs))....
1780: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  .  (debug:print 
1790: 30 20 22 57 41 52 4e 49 4e 47 3a 20 4d 61 78 20  0 "WARNING: Max 
17a0: 72 75 6e 6e 69 6e 67 20 6a 6f 62 73 20 65 78 63  running jobs exc
17b0: 65 65 64 65 64 2c 20 63 75 72 72 65 6e 74 20 6e  eeded, current n
17c0: 75 6d 62 65 72 20 72 75 6e 6e 69 6e 67 3a 20 22  umber running: "
17d0: 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 0a 09 09   num-running ...
17e0: 09 09 09 20 20 20 20 20 20 20 22 2c 20 6d 61 78  ...       ", max
17f0: 5f 63 6f 6e 63 75 72 72 65 6e 74 5f 6a 6f 62 73  _concurrent_jobs
1800: 3a 20 22 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65  : " max-concurre
1810: 6e 74 2d 6a 6f 62 73 29 0a 09 09 09 09 20 20 23  nt-jobs).....  #
1820: 74 29 0a 09 09 09 09 20 3b 3b 20 69 66 20 6a 6f  t)..... ;; if jo
1830: 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 20 69 73  b-group-limit is
1840: 20 73 65 74 20 61 6e 64 20 6e 75 6d 62 65 72 20   set and number 
1850: 6f 66 20 6a 6f 62 73 20 69 6e 20 74 68 65 20 67  of jobs in the g
1860: 72 6f 75 70 20 69 73 20 67 72 65 61 74 65 72 0a  roup is greater.
1870: 09 09 09 09 20 3b 3b 20 74 68 61 6e 20 74 68 65  .... ;; than the
1880: 20 6c 69 6d 69 74 20 74 68 65 6e 20 63 61 6e 6e   limit then cann
1890: 6f 74 20 72 75 6e 20 6d 6f 72 65 20 6a 6f 62 73  ot run more jobs
18a0: 20 6f 66 20 74 68 69 73 20 6b 69 6e 64 0a 09 09   of this kind...
18b0: 09 09 20 28 28 61 6e 64 20 6a 6f 62 2d 67 72 6f  .. ((and job-gro
18c0: 75 70 2d 6c 69 6d 69 74 0a 09 09 09 09 20 20 20  up-limit.....   
18d0: 20 20 20 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e      (>= num-runn
18e0: 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20  ing-in-jobgroup 
18f0: 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 29  job-group-limit)
1900: 29 0a 09 09 09 09 20 20 28 64 65 62 75 67 3a 70  ).....  (debug:p
1910: 72 69 6e 74 20 31 20 22 57 41 52 4e 49 4e 47 3a  rint 1 "WARNING:
1920: 20 6e 75 6d 62 65 72 20 6f 66 20 6a 6f 62 73 20   number of jobs 
1930: 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e  " num-running-in
1940: 2d 6a 6f 62 67 72 6f 75 70 20 0a 09 09 09 09 09  -jobgroup ......
1950: 20 20 20 20 20 20 20 22 20 69 6e 20 22 20 6a 6f         " in " jo
1960: 62 67 72 6f 75 70 20 22 20 65 78 63 65 65 64 65  bgroup " exceede
1970: 64 2c 20 77 69 6c 6c 20 6e 6f 74 20 72 75 6e 20  d, will not run 
1980: 22 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65  " (tests:testque
1990: 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20  ue-get-testname 
19a0: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09  test-record))...
19b0: 09 09 20 20 23 74 29 0a 09 09 09 09 20 28 65 6c  ..  #t)..... (el
19c0: 73 65 20 23 66 29 29 29 29 0a 09 20 20 28 6c 69  se #f))))..  (li
19d0: 73 74 20 28 6e 6f 74 20 63 61 6e 2d 6e 6f 74 2d  st (not can-not-
19e0: 72 75 6e 2d 6d 6f 72 65 29 20 6e 75 6d 2d 72 75  run-more) num-ru
19f0: 6e 6e 69 6e 67 20 6e 75 6d 2d 72 75 6e 6e 69 6e  nning num-runnin
1a00: 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 6d 61  g-in-jobgroup ma
1a10: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62  x-concurrent-job
1a20: 73 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69  s job-group-limi
1a30: 74 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d  t)))))..;;======
1a40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1a50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1a60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1a70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1a80: 0a 3b 3b 20 4e 65 77 20 6d 65 74 68 6f 64 6f 6c  .;; New methodol
1a90: 6f 67 79 2e 20 54 68 65 73 65 20 72 6f 75 74 69  ogy. These routi
1aa0: 6e 65 73 20 77 69 6c 6c 20 72 65 70 6c 61 63 65  nes will replace
1ab0: 20 74 68 65 20 61 62 6f 76 65 20 69 6e 20 74 69   the above in ti
1ac0: 6d 65 2e 20 46 6f 72 0a 3b 3b 20 6e 6f 77 20 74  me. For.;; now t
1ad0: 68 65 20 63 6f 64 65 20 69 73 20 64 75 70 6c 69  he code is dupli
1ae0: 63 61 74 65 64 2e 20 54 68 69 73 20 73 74 75 66  cated. This stuf
1af0: 66 20 69 73 20 69 6e 69 74 69 61 6c 6c 79 20 75  f is initially u
1b00: 73 65 64 20 69 6e 20 74 68 65 20 6d 6f 6e 69 74  sed in the monit
1b10: 6f 72 0a 3b 3b 20 62 61 73 65 64 20 63 6f 64 65  or.;; based code
1b20: 2e 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ..;;============
1b30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1b40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1b50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1b60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 72  ==========..;; r
1b70: 65 67 69 73 74 65 72 20 61 20 74 65 73 74 20 72  egister a test r
1b80: 75 6e 20 77 69 74 68 20 74 68 65 20 64 62 0a 28  un with the db.(
1b90: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 65 67  define (runs:reg
1ba0: 69 73 74 65 72 2d 72 75 6e 20 64 62 20 6b 65 79  ister-run db key
1bb0: 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e  s keyvallst runn
1bc0: 61 6d 65 20 73 74 61 74 65 20 73 74 61 74 75 73  ame state status
1bd0: 20 75 73 65 72 29 0a 20 20 28 64 65 62 75 67 3a   user).  (debug:
1be0: 70 72 69 6e 74 20 33 20 22 72 75 6e 73 3a 72 65  print 3 "runs:re
1bf0: 67 69 73 74 65 72 2d 72 75 6e 2c 20 6b 65 79 73  gister-run, keys
1c00: 3a 20 22 20 6b 65 79 73 20 22 20 6b 65 79 76 61  : " keys " keyva
1c10: 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73  llst: " keyvalls
1c20: 74 20 22 20 72 75 6e 6e 61 6d 65 3a 20 22 20 72  t " runname: " r
1c30: 75 6e 6e 61 6d 65 20 22 20 73 74 61 74 65 3a 20  unname " state: 
1c40: 22 20 73 74 61 74 65 20 22 20 73 74 61 74 75 73  " state " status
1c50: 3a 20 22 20 73 74 61 74 75 73 20 22 20 75 73 65  : " status " use
1c60: 72 3a 20 22 20 75 73 65 72 29 0a 20 20 28 6c 65  r: " user).  (le
1c70: 74 2a 20 28 28 6b 65 79 73 74 72 20 20 20 20 28  t* ((keystr    (
1c80: 6b 65 79 73 2d 3e 6b 65 79 73 74 72 20 6b 65 79  keys->keystr key
1c90: 73 29 29 0a 09 20 28 63 6f 6d 6d 61 20 20 20 20  s)).. (comma    
1ca0: 20 28 69 66 20 28 3e 20 28 6c 65 6e 67 74 68 20   (if (> (length 
1cb0: 6b 65 79 73 29 20 30 29 20 22 2c 22 20 22 22 29  keys) 0) "," "")
1cc0: 29 0a 09 20 28 61 6e 64 73 74 72 20 20 20 20 28  ).. (andstr    (
1cd0: 69 66 20 28 3e 20 28 6c 65 6e 67 74 68 20 6b 65  if (> (length ke
1ce0: 79 73 29 20 30 29 20 22 20 41 4e 44 20 22 20 22  ys) 0) " AND " "
1cf0: 22 29 29 0a 09 20 28 76 61 6c 73 6c 6f 74 73 20  ")).. (valslots 
1d00: 20 28 6b 65 79 73 2d 3e 76 61 6c 73 6c 6f 74 73   (keys->valslots
1d10: 20 6b 65 79 73 29 29 20 3b 3b 20 3f 2c 3f 2c 3f   keys)) ;; ?,?,?
1d20: 20 2e 2e 2e 0a 09 20 28 6b 65 79 76 61 6c 73 20   ..... (keyvals 
1d30: 20 20 28 6d 61 70 20 63 61 64 72 20 6b 65 79 76    (map cadr keyv
1d40: 61 6c 6c 73 74 29 29 0a 09 20 28 61 6c 6c 76 61  allst)).. (allva
1d50: 6c 73 20 20 20 28 61 70 70 65 6e 64 20 28 6c 69  ls   (append (li
1d60: 73 74 20 72 75 6e 6e 61 6d 65 20 73 74 61 74 65  st runname state
1d70: 20 73 74 61 74 75 73 20 75 73 65 72 29 20 6b 65   status user) ke
1d80: 79 76 61 6c 73 29 29 0a 09 20 28 71 72 79 76 61  yvals)).. (qryva
1d90: 6c 73 20 20 20 28 61 70 70 65 6e 64 20 28 6c 69  ls   (append (li
1da0: 73 74 20 72 75 6e 6e 61 6d 65 29 20 6b 65 79 76  st runname) keyv
1db0: 61 6c 73 29 29 0a 09 20 28 6b 65 79 3d 3f 73 74  als)).. (key=?st
1dc0: 72 20 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72  r  (string-inter
1dd0: 73 70 65 72 73 65 20 28 6d 61 70 20 28 6c 61 6d  sperse (map (lam
1de0: 62 64 61 20 28 6b 29 28 63 6f 6e 63 20 28 6b 65  bda (k)(conc (ke
1df0: 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20  y:get-fieldname 
1e00: 6b 29 20 22 3d 3f 22 29 29 20 6b 65 79 73 29 20  k) "=?")) keys) 
1e10: 22 20 41 4e 44 20 22 29 29 29 0a 20 20 20 20 28  " AND "))).    (
1e20: 64 65 62 75 67 3a 70 72 69 6e 74 20 33 20 22 6b  debug:print 3 "k
1e30: 65 79 73 3a 20 22 20 6b 65 79 73 20 22 20 61 6c  eys: " keys " al
1e40: 6c 76 61 6c 73 3a 20 22 20 61 6c 6c 76 61 6c 73  lvals: " allvals
1e50: 20 22 20 6b 65 79 76 61 6c 73 3a 20 22 20 6b 65   " keyvals: " ke
1e60: 79 76 61 6c 73 29 0a 20 20 20 20 28 64 65 62 75  yvals).    (debu
1e70: 67 3a 70 72 69 6e 74 20 32 20 22 4e 4f 54 45 3a  g:print 2 "NOTE:
1e80: 20 75 73 69 6e 67 20 74 61 72 67 65 74 20 22 20   using target " 
1e90: 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65  (string-interspe
1ea0: 72 73 65 20 6b 65 79 76 61 6c 73 20 22 2f 22 29  rse keyvals "/")
1eb0: 20 22 20 66 6f 72 20 74 68 69 73 20 72 75 6e 22   " for this run"
1ec0: 29 0a 20 20 20 20 28 69 66 20 28 61 6e 64 20 72  ).    (if (and r
1ed0: 75 6e 6e 61 6d 65 20 28 6e 75 6c 6c 3f 20 28 66  unname (null? (f
1ee0: 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78  ilter (lambda (x
1ef0: 29 28 6e 6f 74 20 78 29 29 20 6b 65 79 76 61 6c  )(not x)) keyval
1f00: 73 29 29 29 20 3b 3b 20 74 68 65 72 65 20 6d 75  s))) ;; there mu
1f10: 73 74 20 62 65 20 61 20 62 65 74 74 65 72 20 77  st be a better w
1f20: 61 79 20 74 6f 20 22 61 70 70 6c 79 20 61 6e 64  ay to "apply and
1f30: 22 0a 09 28 6c 65 74 20 28 28 72 65 73 20 23 66  "..(let ((res #f
1f40: 29 29 0a 09 20 20 28 61 70 70 6c 79 20 73 71 6c  ))..  (apply sql
1f50: 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 20  ite3:execute db 
1f60: 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52  (conc "INSERT OR
1f70: 20 49 47 4e 4f 52 45 20 49 4e 54 4f 20 72 75 6e   IGNORE INTO run
1f80: 73 20 28 72 75 6e 6e 61 6d 65 2c 73 74 61 74 65  s (runname,state
1f90: 2c 73 74 61 74 75 73 2c 6f 77 6e 65 72 2c 65 76  ,status,owner,ev
1fa0: 65 6e 74 5f 74 69 6d 65 22 20 63 6f 6d 6d 61 20  ent_time" comma 
1fb0: 6b 65 79 73 74 72 20 22 29 20 56 41 4c 55 45 53  keystr ") VALUES
1fc0: 20 28 3f 2c 3f 2c 3f 2c 3f 2c 73 74 72 66 74 69   (?,?,?,?,strfti
1fd0: 6d 65 28 27 25 73 27 2c 27 6e 6f 77 27 29 22 20  me('%s','now')" 
1fe0: 63 6f 6d 6d 61 20 76 61 6c 73 6c 6f 74 73 20 22  comma valslots "
1ff0: 29 3b 22 29 0a 09 09 20 61 6c 6c 76 61 6c 73 29  );")... allvals)
2000: 0a 09 20 20 28 61 70 70 6c 79 20 73 71 6c 69 74  ..  (apply sqlit
2010: 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 20  e3:for-each-row 
2020: 0a 09 20 20 20 28 6c 61 6d 62 64 61 20 28 69 64  ..   (lambda (id
2030: 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 65  )..     (set! re
2040: 73 20 69 64 29 29 0a 09 20 20 20 64 62 0a 09 20  s id))..   db.. 
2050: 20 20 28 6c 65 74 20 28 28 71 72 79 20 28 63 6f    (let ((qry (co
2060: 6e 63 20 22 53 45 4c 45 43 54 20 69 64 20 46 52  nc "SELECT id FR
2070: 4f 4d 20 72 75 6e 73 20 57 48 45 52 45 20 28 72  OM runs WHERE (r
2080: 75 6e 6e 61 6d 65 3d 3f 20 22 20 61 6e 64 73 74  unname=? " andst
2090: 72 20 6b 65 79 3d 3f 73 74 72 20 22 29 3b 22 29  r key=?str ");")
20a0: 29 29 0a 09 20 20 20 20 20 3b 28 64 65 62 75 67  ))..     ;(debug
20b0: 3a 70 72 69 6e 74 20 34 20 22 71 72 79 3a 20 22  :print 4 "qry: "
20c0: 20 71 72 79 29 20 0a 09 20 20 20 20 20 71 72 79   qry) ..     qry
20d0: 29 0a 09 20 20 20 71 72 79 76 61 6c 73 29 0a 09  )..   qryvals)..
20e0: 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75    (sqlite3:execu
20f0: 74 65 20 64 62 20 22 55 50 44 41 54 45 20 72 75  te db "UPDATE ru
2100: 6e 73 20 53 45 54 20 73 74 61 74 65 3d 3f 2c 73  ns SET state=?,s
2110: 74 61 74 75 73 3d 3f 20 57 48 45 52 45 20 69 64  tatus=? WHERE id
2120: 3d 3f 3b 22 20 73 74 61 74 65 20 73 74 61 74 75  =?;" state statu
2130: 73 20 72 65 73 29 0a 09 20 20 72 65 73 29 20 0a  s res)..  res) .
2140: 09 28 62 65 67 69 6e 0a 09 20 20 28 64 65 62 75  .(begin..  (debu
2150: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52  g:print 0 "ERROR
2160: 3a 20 43 61 6c 6c 65 64 20 77 69 74 68 6f 75 74  : Called without
2170: 20 61 6c 6c 20 6e 65 63 65 73 73 61 72 79 20 6b   all necessary k
2180: 65 79 73 22 29 0a 09 20 20 23 66 29 29 29 29 0a  eys")..  #f)))).
2190: 0a 3b 3b 20 54 68 69 73 20 69 73 20 61 20 64 75  .;; This is a du
21a0: 70 6c 69 63 61 74 65 20 6f 66 20 72 75 6e 2d 74  plicate of run-t
21b0: 65 73 74 73 20 28 77 68 69 63 68 20 68 61 73 20  ests (which has 
21c0: 62 65 65 6e 20 64 65 70 72 65 63 61 74 65 64 29  been deprecated)
21d0: 2e 20 55 73 65 20 74 68 69 73 20 6f 6e 65 20 69  . Use this one i
21e0: 6e 73 74 65 61 64 20 6f 66 20 72 75 6e 20 74 65  nstead of run te
21f0: 73 74 73 2e 0a 3b 3b 20 6b 65 79 76 61 6c 73 2e  sts..;; keyvals.
2200: 0a 3b 3b 0a 3b 3b 20 20 74 65 73 74 2d 6e 61 6d  .;;.;;  test-nam
2210: 65 73 3a 20 43 6f 6d 6d 61 20 73 65 70 61 72 61  es: Comma separa
2220: 74 65 64 20 70 61 74 74 65 72 6e 73 20 73 61 6d  ted patterns sam
2230: 65 20 61 73 20 74 65 73 74 2d 70 61 74 74 73 20  e as test-patts 
2240: 62 75 74 20 75 73 65 64 20 69 6e 20 73 65 6c 65  but used in sele
2250: 63 74 69 6f 6e 20 0a 3b 3b 20 20 20 20 20 20 20  ction .;;       
2260: 20 20 20 20 20 20 20 6f 66 20 74 65 73 74 73 20         of tests 
2270: 74 6f 20 72 75 6e 2e 20 54 68 65 20 69 74 65 6d  to run. The item
2280: 20 70 6f 72 74 69 6f 6e 73 20 61 72 65 20 6e 6f   portions are no
2290: 74 20 72 65 73 70 65 63 74 65 64 2e 0a 3b 3b 20  t respected..;; 
22a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 46 49 58               FIX
22b0: 4d 45 3a 20 65 72 72 6f 72 20 6f 75 74 20 69 66  ME: error out if
22c0: 20 2f 70 61 74 74 20 73 70 65 63 69 66 69 65 64   /patt specified
22d0: 0a 3b 3b 20 20 20 20 20 20 20 20 20 20 20 20 0a  .;;            .
22e0: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 75  (define (runs:ru
22f0: 6e 2d 74 65 73 74 73 20 74 61 72 67 65 74 20 72  n-tests target r
2300: 75 6e 6e 61 6d 65 20 74 65 73 74 2d 6e 61 6d 65  unname test-name
2310: 73 20 74 65 73 74 2d 70 61 74 74 73 20 75 73 65  s test-patts use
2320: 72 20 66 6c 61 67 73 29 0a 20 20 28 63 6f 6d 6d  r flags).  (comm
2330: 6f 6e 3a 63 6c 65 61 72 2d 63 61 63 68 65 73 29  on:clear-caches)
2340: 20 3b 3b 20 63 6c 65 61 72 20 61 6c 6c 20 63 61   ;; clear all ca
2350: 63 68 65 73 0a 20 20 28 6c 65 74 2a 20 28 28 64  ches.  (let* ((d
2360: 62 20 20 20 20 20 20 20 20 20 20 23 66 29 0a 09  b          #f)..
2370: 20 28 6b 65 79 73 20 20 20 20 20 20 20 20 28 63   (keys        (c
2380: 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64 62  db:remote-run db
2390: 3a 67 65 74 2d 6b 65 79 73 20 23 66 29 29 0a 09  :get-keys #f))..
23a0: 20 28 6b 65 79 76 61 6c 6c 73 74 20 20 20 28 6b   (keyvallst   (k
23b0: 65 79 73 3a 74 61 72 67 65 74 2d 3e 6b 65 79 76  eys:target->keyv
23c0: 61 6c 20 6b 65 79 73 20 74 61 72 67 65 74 29 29  al keys target))
23d0: 0a 09 20 28 72 75 6e 2d 69 64 20 20 20 20 20 20  .. (run-id      
23e0: 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20  (cdb:remote-run 
23f0: 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75  runs:register-ru
2400: 6e 20 23 66 20 6b 65 79 73 20 6b 65 79 76 61 6c  n #f keys keyval
2410: 6c 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e 65 77  lst runname "new
2420: 22 20 22 6e 2f 61 22 20 75 73 65 72 29 29 20 20  " "n/a" user))  
2430: 3b 3b 20 20 74 65 73 74 2d 6e 61 6d 65 29 29 29  ;;  test-name)))
2440: 0a 09 20 28 6b 65 79 76 61 6c 73 20 20 20 20 20  .. (keyvals     
2450: 28 69 66 20 72 75 6e 2d 69 64 20 28 63 64 62 3a  (if run-id (cdb:
2460: 72 65 6d 6f 74 65 2d 72 75 6e 20 64 62 3a 67 65  remote-run db:ge
2470: 74 2d 6b 65 79 2d 76 61 6c 73 20 23 66 20 72 75  t-key-vals #f ru
2480: 6e 2d 69 64 29 20 23 66 29 29 0a 09 20 28 64 65  n-id) #f)).. (de
2490: 66 65 72 72 65 64 20 20 20 20 27 28 29 29 20 3b  ferred    '()) ;
24a0: 3b 20 64 65 6c 61 79 20 72 75 6e 6e 69 6e 67 20  ; delay running 
24b0: 74 68 65 73 65 20 73 69 6e 63 65 20 74 68 65 79  these since they
24c0: 20 68 61 76 65 20 61 20 77 61 69 74 6f 6e 20 63   have a waiton c
24d0: 6c 61 75 73 65 0a 09 20 3b 3b 20 6b 65 65 70 67  lause.. ;; keepg
24e0: 6f 69 6e 67 20 69 73 20 74 68 65 20 64 65 66 61  oing is the defa
24f0: 63 74 6f 20 6d 6f 64 61 6c 69 74 79 20 6e 6f 77  cto modality now
2500: 2c 20 77 69 6c 6c 20 61 64 64 20 68 69 74 2d 6e  , will add hit-n
2510: 2d 72 75 6e 20 61 20 62 69 74 20 6c 61 74 65 72  -run a bit later
2520: 0a 09 20 3b 3b 20 28 6b 65 65 70 67 6f 69 6e 67  .. ;; (keepgoing
2530: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72     (hash-table-r
2540: 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73  ef/default flags
2550: 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 20 23 66   "-keepgoing" #f
2560: 29 29 0a 09 20 28 72 75 6e 63 6f 6e 66 69 67 66  )).. (runconfigf
2570: 20 20 20 28 63 6f 6e 63 20 20 2a 74 6f 70 70 61     (conc  *toppa
2580: 74 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 69 67 73  th* "/runconfigs
2590: 2e 63 6f 6e 66 69 67 22 29 29 0a 09 20 28 72 65  .config")).. (re
25a0: 71 75 69 72 65 64 2d 74 65 73 74 73 20 27 28 29  quired-tests '()
25b0: 29 0a 09 20 28 74 65 73 74 2d 72 65 63 6f 72 64  ).. (test-record
25c0: 73 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62  s (make-hash-tab
25d0: 6c 65 29 29 29 0a 0a 20 20 20 20 28 73 65 74 2d  le)))..    (set-
25e0: 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72  megatest-env-var
25f0: 73 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65  s run-id) ;; the
2600: 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64  se may be needed
2610: 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e   by the launchin
2620: 67 20 70 72 6f 63 65 73 73 0a 0a 20 20 20 20 28  g process..    (
2630: 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f  if (file-exists?
2640: 20 72 75 6e 63 6f 6e 66 69 67 66 29 0a 09 28 73   runconfigf)..(s
2650: 65 74 75 70 2d 65 6e 76 2d 64 65 66 61 75 6c 74  etup-env-default
2660: 73 20 72 75 6e 63 6f 6e 66 69 67 66 20 72 75 6e  s runconfigf run
2670: 2d 69 64 20 2a 61 6c 72 65 61 64 79 2d 73 65 65  -id *already-see
2680: 6e 2d 72 75 6e 63 6f 6e 66 69 67 2d 69 6e 66 6f  n-runconfig-info
2690: 2a 20 6b 65 79 73 20 6b 65 79 76 61 6c 73 20 22  * keys keyvals "
26a0: 70 72 65 2d 6c 61 75 6e 63 68 2d 65 6e 76 2d 76  pre-launch-env-v
26b0: 61 72 73 22 29 0a 09 28 64 65 62 75 67 3a 70 72  ars")..(debug:pr
26c0: 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20  int 0 "WARNING: 
26d0: 59 6f 75 20 64 6f 20 6e 6f 74 20 68 61 76 65 20  You do not have 
26e0: 61 20 72 75 6e 20 63 6f 6e 66 69 67 20 66 69 6c  a run config fil
26f0: 65 3a 20 22 20 72 75 6e 63 6f 6e 66 69 67 66 29  e: " runconfigf)
2700: 29 0a 20 20 20 20 0a 20 20 20 20 3b 3b 20 6c 6f  ).    .    ;; lo
2710: 6f 6b 20 75 70 20 61 6c 6c 20 74 65 73 74 73 20  ok up all tests 
2720: 6d 61 74 63 68 69 6e 67 20 74 68 65 20 63 6f 6d  matching the com
2730: 6d 61 20 73 65 70 61 72 61 74 65 64 20 6c 69 73  ma separated lis
2740: 74 20 6f 66 20 67 6c 6f 62 73 20 69 6e 0a 20 20  t of globs in.  
2750: 20 20 3b 3b 20 74 65 73 74 2d 70 61 74 74 73 20    ;; test-patts 
2760: 28 75 73 69 6e 67 20 25 20 61 73 20 77 69 6c 64  (using % as wild
2770: 63 61 72 64 29 0a 0a 20 20 20 20 28 73 65 74 21  card)..    (set!
2780: 20 74 65 73 74 2d 6e 61 6d 65 73 20 28 74 65 73   test-names (tes
2790: 74 73 3a 67 65 74 2d 76 61 6c 69 64 2d 74 65 73  ts:get-valid-tes
27a0: 74 73 20 2a 74 6f 70 70 61 74 68 2a 20 74 65 73  ts *toppath* tes
27b0: 74 2d 6e 61 6d 65 73 29 29 0a 20 20 20 20 28 73  t-names)).    (s
27c0: 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 28  et! test-names (
27d0: 64 65 6c 65 74 65 2d 64 75 70 6c 69 63 61 74 65  delete-duplicate
27e0: 73 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 0a  s test-names))..
27f0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
2800: 2d 69 6e 66 6f 20 30 20 22 74 65 73 74 20 6e 61  -info 0 "test na
2810: 6d 65 73 20 22 20 74 65 73 74 2d 6e 61 6d 65 73  mes " test-names
2820: 29 0a 0a 20 20 20 20 3b 3b 20 6f 6e 20 74 68 65  )..    ;; on the
2830: 20 66 69 72 73 74 20 70 61 73 73 20 6f 72 20 63   first pass or c
2840: 61 6c 6c 20 74 6f 20 72 75 6e 2d 74 65 73 74 73  all to run-tests
2850: 20 73 65 74 20 46 41 49 4c 53 20 74 6f 20 4e 4f   set FAILS to NO
2860: 54 5f 53 54 41 52 54 45 44 20 69 66 0a 20 20 20  T_STARTED if.   
2870: 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 20 69   ;; -keepgoing i
2880: 73 20 73 70 65 63 69 66 69 65 64 0a 20 20 20 20  s specified.    
2890: 28 69 66 20 28 65 71 3f 20 2a 70 61 73 73 6e 75  (if (eq? *passnu
28a0: 6d 2a 20 30 29 0a 09 28 62 65 67 69 6e 0a 09 20  m* 0)..(begin.. 
28b0: 20 3b 3b 20 68 61 76 65 20 74 6f 20 64 65 6c 65   ;; have to dele
28c0: 74 65 20 74 65 73 74 20 72 65 63 6f 72 64 73 20  te test records 
28d0: 77 68 65 72 65 20 4e 4f 54 5f 53 54 41 52 54 45  where NOT_STARTE
28e0: 44 20 73 69 6e 63 65 20 74 68 65 79 20 63 61 6e  D since they can
28f0: 20 63 61 75 73 65 20 2d 6b 65 65 70 67 6f 69 6e   cause -keepgoin
2900: 67 20 74 6f 20 0a 09 20 20 3b 3b 20 67 65 74 20  g to ..  ;; get 
2910: 73 74 75 63 6b 20 64 75 65 20 74 6f 20 62 65 63  stuck due to bec
2920: 6f 6d 69 6e 67 20 69 6e 61 63 63 65 73 73 69 62  oming inaccessib
2930: 6c 65 20 66 72 6f 6d 20 61 20 66 61 69 6c 65 64  le from a failed
2940: 20 74 65 73 74 2e 20 49 2e 65 2e 20 69 66 20 74   test. I.e. if t
2950: 65 73 74 20 42 20 64 65 70 65 6e 64 73 20 0a 09  est B depends ..
2960: 20 20 3b 3b 20 6f 6e 20 74 65 73 74 20 41 20 62    ;; on test A b
2970: 75 74 20 74 65 73 74 20 42 20 72 65 61 63 68 65  ut test B reache
2980: 64 20 74 68 65 20 70 6f 69 6e 74 20 6f 6e 20 62  d the point on b
2990: 65 69 6e 67 20 72 65 67 69 73 74 65 72 65 64 20  eing registered 
29a0: 61 73 20 4e 4f 54 5f 53 54 41 52 54 45 44 20 61  as NOT_STARTED a
29b0: 6e 64 20 74 65 73 74 0a 09 20 20 3b 3b 20 41 20  nd test..  ;; A 
29c0: 66 61 69 6c 65 64 20 66 6f 72 20 73 6f 6d 65 20  failed for some 
29d0: 72 65 61 73 6f 6e 20 74 68 65 6e 20 6f 6e 20 72  reason then on r
29e0: 65 2d 72 75 6e 20 75 73 69 6e 67 20 2d 6b 65 65  e-run using -kee
29f0: 70 67 6f 69 6e 67 20 74 68 65 20 72 75 6e 20 63  pgoing the run c
2a00: 61 6e 20 6e 65 76 65 72 20 63 6f 6d 70 6c 65 74  an never complet
2a10: 65 2e 0a 09 20 20 28 63 64 62 3a 64 65 6c 65 74  e...  (cdb:delet
2a20: 65 2d 74 65 73 74 73 2d 69 6e 2d 73 74 61 74 65  e-tests-in-state
2a30: 20 2a 72 75 6e 72 65 6d 6f 74 65 2a 20 72 75 6e   *runremote* run
2a40: 2d 69 64 20 22 4e 4f 54 5f 53 54 41 52 54 45 44  -id "NOT_STARTED
2a50: 22 29 0a 09 20 20 28 63 64 62 3a 72 65 6d 6f 74  ")..  (cdb:remot
2a60: 65 2d 72 75 6e 20 64 62 3a 73 65 74 2d 74 65 73  e-run db:set-tes
2a70: 74 73 2d 73 74 61 74 65 2d 73 74 61 74 75 73 20  ts-state-status 
2a80: 23 66 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e  #f run-id test-n
2a90: 61 6d 65 73 20 23 66 20 22 46 41 49 4c 22 20 22  ames #f "FAIL" "
2aa0: 4e 4f 54 5f 53 54 41 52 54 45 44 22 20 22 46 41  NOT_STARTED" "FA
2ab0: 49 4c 22 29 29 29 0a 0a 20 20 20 20 3b 3b 20 66  IL")))..    ;; f
2ac0: 72 6f 6d 20 68 65 72 65 20 6f 6e 20 6f 75 74 20  rom here on out 
2ad0: 74 68 65 20 64 62 20 77 69 6c 6c 20 62 65 20 6f  the db will be o
2ae0: 70 65 6e 65 64 20 61 6e 64 20 63 6c 6f 73 65 64  pened and closed
2af0: 20 6f 6e 20 65 76 65 72 79 20 63 61 6c 6c 20 72   on every call r
2b00: 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d 71 75  uns:run-tests-qu
2b10: 65 75 65 0a 20 20 20 20 3b 3b 20 28 73 71 6c 69  eue.    ;; (sqli
2b20: 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62  te3:finalize! db
2b30: 29 20 0a 20 20 20 20 3b 3b 20 6e 6f 77 20 61 64  ) .    ;; now ad
2b40: 64 20 6e 6f 6e 2d 64 69 72 65 63 74 6c 79 20 72  d non-directly r
2b50: 65 66 65 72 65 6e 63 65 64 20 64 65 70 65 6e 64  eferenced depend
2b60: 65 6e 63 69 65 73 20 28 69 2e 65 2e 20 77 61 69  encies (i.e. wai
2b70: 74 6f 6e 29 0a 20 20 20 20 28 69 66 20 28 6e 6f  ton).    (if (no
2b80: 74 20 28 6e 75 6c 6c 3f 20 74 65 73 74 2d 6e 61  t (null? test-na
2b90: 6d 65 73 29 29 0a 09 28 6c 65 74 20 6c 6f 6f 70  mes))..(let loop
2ba0: 20 28 28 68 65 64 20 28 63 61 72 20 74 65 73 74   ((hed (car test
2bb0: 2d 6e 61 6d 65 73 29 29 0a 09 09 20 20 20 28 74  -names))...   (t
2bc0: 61 6c 20 28 63 64 72 20 74 65 73 74 2d 6e 61 6d  al (cdr test-nam
2bd0: 65 73 29 29 29 20 20 20 20 20 20 20 20 20 3b 3b  es)))         ;;
2be0: 20 27 72 65 74 75 72 6e 2d 70 72 6f 63 73 20 74   'return-procs t
2bf0: 65 6c 6c 73 20 74 68 65 20 63 6f 6e 66 69 67 20  ells the config 
2c00: 72 65 61 64 65 72 20 74 6f 20 70 72 65 70 20 72  reader to prep r
2c10: 75 6e 6e 69 6e 67 20 73 79 73 74 65 6d 20 62 75  unning system bu
2c20: 74 20 72 65 74 75 72 6e 20 61 20 70 72 6f 63 0a  t return a proc.
2c30: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d  .  (debug:print-
2c40: 69 6e 66 6f 20 34 20 22 68 65 64 3d 22 20 68 65  info 4 "hed=" he
2c50: 64 20 22 20 61 74 20 74 6f 70 20 6f 66 20 6c 6f  d " at top of lo
2c60: 6f 70 22 29 0a 09 20 20 28 6c 65 74 2a 20 28 28  op")..  (let* ((
2c70: 63 6f 6e 66 69 67 20 20 28 74 65 73 74 73 3a 67  config  (tests:g
2c80: 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 68 65  et-testconfig he
2c90: 64 20 27 72 65 74 75 72 6e 2d 70 72 6f 63 73 29  d 'return-procs)
2ca0: 29 0a 09 09 20 28 77 61 69 74 6f 6e 73 20 28 6c  )... (waitons (l
2cb0: 65 74 20 28 28 69 6e 73 74 72 20 28 69 66 20 63  et ((instr (if c
2cc0: 6f 6e 66 69 67 20 0a 09 09 09 09 09 20 20 20 28  onfig ......   (
2cd0: 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 63 6f  config-lookup co
2ce0: 6e 66 69 67 20 22 72 65 71 75 69 72 65 6d 65 6e  nfig "requiremen
2cf0: 74 73 22 20 22 77 61 69 74 6f 6e 22 29 0a 09 09  ts" "waiton")...
2d00: 09 09 09 20 20 20 28 62 65 67 69 6e 20 3b 3b 20  ...   (begin ;; 
2d10: 4e 6f 20 63 6f 6e 66 69 67 20 6d 65 61 6e 73 20  No config means 
2d20: 74 68 69 73 20 69 73 20 61 20 6e 6f 6e 2d 65 78  this is a non-ex
2d30: 69 73 74 61 6e 74 20 74 65 73 74 0a 09 09 09 09  istant test.....
2d40: 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  .     (debug:pri
2d50: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 6e 6f 6e  nt 0 "ERROR: non
2d60: 2d 65 78 69 73 74 65 6e 74 20 72 65 71 75 69 72  -existent requir
2d70: 65 64 20 74 65 73 74 20 5c 22 22 20 68 65 64 20  ed test \"" hed 
2d80: 22 5c 22 22 29 0a 09 09 09 09 09 20 20 20 20 20  "\"")......     
2d90: 28 69 66 20 64 62 20 28 73 71 6c 69 74 65 33 3a  (if db (sqlite3:
2da0: 66 69 6e 61 6c 69 7a 65 21 20 64 62 29 29 0a 09  finalize! db))..
2db0: 09 09 09 09 20 20 20 20 20 28 65 78 69 74 20 31  ....     (exit 1
2dc0: 29 29 29 29 29 0a 09 09 09 20 20 20 20 28 64 65  )))))....    (de
2dd0: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 38  bug:print-info 8
2de0: 20 22 77 61 69 74 6f 6e 73 20 73 74 72 69 6e 67   "waitons string
2df0: 20 69 73 20 22 20 69 6e 73 74 72 29 0a 09 09 09   is " instr)....
2e00: 20 20 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69      (string-spli
2e10: 74 20 28 63 6f 6e 64 0a 09 09 09 09 09 20 20 20  t (cond......   
2e20: 28 28 70 72 6f 63 65 64 75 72 65 3f 20 69 6e 73  ((procedure? ins
2e30: 74 72 29 0a 09 09 09 09 09 20 20 20 20 28 6c 65  tr)......    (le
2e40: 74 20 28 28 72 65 73 20 28 69 6e 73 74 72 29 29  t ((res (instr))
2e50: 29 0a 09 09 09 09 09 20 20 20 20 20 20 28 64 65  )......      (de
2e60: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 38  bug:print-info 8
2e70: 20 22 77 61 69 74 6f 6e 20 70 72 6f 63 65 64 75   "waiton procedu
2e80: 72 65 20 72 65 73 75 6c 74 73 20 69 6e 20 73 74  re results in st
2e90: 72 69 6e 67 20 22 20 72 65 73 20 22 20 66 6f 72  ring " res " for
2ea0: 20 74 65 73 74 20 22 20 68 65 64 29 0a 09 09 09   test " hed)....
2eb0: 09 09 20 20 20 20 20 20 72 65 73 29 29 0a 09 09  ..      res))...
2ec0: 09 09 09 20 20 20 28 28 73 74 72 69 6e 67 3f 20  ...   ((string? 
2ed0: 69 6e 73 74 72 29 20 20 20 20 20 69 6e 73 74 72  instr)     instr
2ee0: 29 0a 09 09 09 09 09 20 20 20 28 65 6c 73 65 20  )......   (else 
2ef0: 0a 09 09 09 09 09 20 20 20 20 3b 3b 20 4e 4f 54  ......    ;; NOT
2f00: 45 3a 20 54 68 69 73 20 69 73 20 61 63 74 75 61  E: This is actua
2f10: 6c 6c 79 20 74 68 65 20 63 61 73 65 20 6f 66 20  lly the case of 
2f20: 2a 6e 6f 2a 20 77 61 69 74 6f 6e 73 21 20 3b 3b  *no* waitons! ;;
2f30: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
2f40: 22 45 52 52 4f 52 3a 20 73 6f 6d 65 74 68 69 6e  "ERROR: somethin
2f50: 67 20 77 65 6e 74 20 77 72 6f 6e 67 20 69 6e 20  g went wrong in 
2f60: 70 72 6f 63 65 73 73 69 6e 67 20 77 61 69 74 6f  processing waito
2f70: 6e 73 20 66 6f 72 20 74 65 73 74 20 22 20 68 65  ns for test " he
2f80: 64 29 0a 09 09 09 09 09 20 20 20 20 22 22 29 29  d)......    ""))
2f90: 29 29 29 29 0a 09 20 20 20 20 28 64 65 62 75 67  ))))..    (debug
2fa0: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 38 20 22 77  :print-info 8 "w
2fb0: 61 69 74 6f 6e 73 3a 20 22 20 77 61 69 74 6f 6e  aitons: " waiton
2fc0: 73 29 0a 09 20 20 20 20 3b 3b 20 63 68 65 63 6b  s)..    ;; check
2fd0: 20 66 6f 72 20 68 65 64 20 69 6e 20 77 61 69 74   for hed in wait
2fe0: 6f 6e 73 20 3d 3e 20 74 68 69 73 20 77 6f 75 6c  ons => this woul
2ff0: 64 20 62 65 20 63 69 72 63 75 6c 61 72 2c 20 72  d be circular, r
3000: 65 6d 6f 76 65 20 69 74 20 61 6e 64 20 69 73 73  emove it and iss
3010: 75 65 20 61 6e 0a 09 20 20 20 20 3b 3b 20 65 72  ue an..    ;; er
3020: 72 6f 72 0a 09 20 20 20 20 28 69 66 20 28 6d 65  ror..    (if (me
3030: 6d 62 65 72 20 68 65 64 20 77 61 69 74 6f 6e 73  mber hed waitons
3040: 29 0a 09 09 28 62 65 67 69 6e 0a 09 09 20 20 28  )...(begin...  (
3050: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45  debug:print 0 "E
3060: 52 52 4f 52 3a 20 74 65 73 74 20 22 20 68 65 64  RROR: test " hed
3070: 20 22 20 68 61 73 20 6c 69 73 74 65 64 20 69 74   " has listed it
3080: 73 65 6c 66 20 61 73 20 61 20 77 61 69 74 6f 6e  self as a waiton
3090: 2c 20 70 6c 65 61 73 65 20 63 6f 72 72 65 63 74  , please correct
30a0: 20 74 68 69 73 21 22 29 0a 09 09 20 20 28 73 65   this!")...  (se
30b0: 74 21 20 77 61 69 74 6f 6e 73 20 28 66 69 6c 74  t! waitons (filt
30c0: 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29 28 6e  er (lambda (x)(n
30d0: 6f 74 20 28 65 71 75 61 6c 3f 20 78 20 68 65 64  ot (equal? x hed
30e0: 29 29 29 20 77 61 69 74 6f 6e 73 29 29 29 29 0a  ))) waitons)))).
30f0: 09 20 20 20 20 0a 09 20 20 20 20 3b 3b 20 28 69  .    ..    ;; (i
3100: 74 65 6d 73 20 20 20 28 69 74 65 6d 73 3a 67 65  tems   (items:ge
3110: 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e  t-items-from-con
3120: 66 69 67 20 63 6f 6e 66 69 67 29 29 29 0a 09 20  fig config))).. 
3130: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 68 61 73     (if (not (has
3140: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61  h-table-ref/defa
3150: 75 6c 74 20 74 65 73 74 2d 72 65 63 6f 72 64 73  ult test-records
3160: 20 68 65 64 20 23 66 29 29 0a 09 09 28 68 61 73   hed #f))...(has
3170: 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 65 73  h-table-set! tes
3180: 74 2d 72 65 63 6f 72 64 73 0a 09 09 09 09 20 68  t-records..... h
3190: 65 64 20 28 76 65 63 74 6f 72 20 68 65 64 20 20  ed (vector hed  
31a0: 20 20 20 3b 3b 20 30 0a 09 09 09 09 09 20 20 20     ;; 0......   
31b0: 20 20 63 6f 6e 66 69 67 20 20 3b 3b 20 31 0a 09    config  ;; 1..
31c0: 09 09 09 09 20 20 20 20 20 77 61 69 74 6f 6e 73  ....     waitons
31d0: 20 3b 3b 20 32 0a 09 09 09 09 09 20 20 20 20 20   ;; 2......     
31e0: 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 63  (config-lookup c
31f0: 6f 6e 66 69 67 20 22 72 65 71 75 69 72 65 6d 65  onfig "requireme
3200: 6e 74 73 22 20 22 70 72 69 6f 72 69 74 79 22 29  nts" "priority")
3210: 20 20 20 20 20 3b 3b 20 70 72 69 6f 72 69 74 79       ;; priority
3220: 20 33 0a 09 09 09 09 09 20 20 20 20 20 28 6c 65   3......     (le
3230: 74 20 28 28 69 74 65 6d 73 20 20 20 20 20 20 28  t ((items      (
3240: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64  hash-table-ref/d
3250: 65 66 61 75 6c 74 20 63 6f 6e 66 69 67 20 22 69  efault config "i
3260: 74 65 6d 73 22 20 23 66 29 29 20 3b 3b 20 69 74  tems" #f)) ;; it
3270: 65 6d 73 20 34 0a 09 09 09 09 09 09 20 20 20 28  ems 4.......   (
3280: 69 74 65 6d 73 74 61 62 6c 65 20 28 68 61 73 68  itemstable (hash
3290: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75  -table-ref/defau
32a0: 6c 74 20 63 6f 6e 66 69 67 20 22 69 74 65 6d 73  lt config "items
32b0: 74 61 62 6c 65 22 20 23 66 29 29 29 20 0a 09 09  table" #f))) ...
32c0: 09 09 09 20 20 20 20 20 20 20 3b 3b 20 69 66 20  ...       ;; if 
32d0: 65 69 74 68 65 72 20 69 74 65 6d 73 20 6f 72 20  either items or 
32e0: 69 74 65 6d 73 20 74 61 62 6c 65 20 69 73 20 61  items table is a
32f0: 20 70 72 6f 63 20 72 65 74 75 72 6e 20 69 74 20   proc return it 
3300: 73 6f 20 74 65 73 74 20 72 75 6e 6e 69 6e 67 0a  so test running.
3310: 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20 70  .....       ;; p
3320: 72 6f 63 65 73 73 20 63 61 6e 20 6b 6e 6f 77 20  rocess can know 
3330: 74 6f 20 63 61 6c 6c 20 69 74 65 6d 73 3a 67 65  to call items:ge
3340: 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e  t-items-from-con
3350: 66 69 67 0a 09 09 09 09 09 20 20 20 20 20 20 20  fig......       
3360: 3b 3b 20 69 66 20 65 69 74 68 65 72 20 69 73 20  ;; if either is 
3370: 61 20 6c 69 73 74 20 61 6e 64 20 6e 6f 6e 65 20  a list and none 
3380: 69 73 20 61 20 70 72 6f 63 20 67 6f 20 61 68 65  is a proc go ahe
3390: 61 64 20 61 6e 64 20 63 61 6c 6c 20 67 65 74 2d  ad and call get-
33a0: 69 74 65 6d 73 0a 09 09 09 09 09 20 20 20 20 20  items......     
33b0: 20 20 3b 3b 20 6f 74 68 65 72 77 69 73 65 20 72    ;; otherwise r
33c0: 65 74 75 72 6e 20 23 66 20 2d 20 74 68 69 73 20  eturn #f - this 
33d0: 69 73 20 6e 6f 74 20 61 6e 20 69 74 65 72 61 74  is not an iterat
33e0: 65 64 20 74 65 73 74 0a 09 09 09 09 09 20 20 20  ed test......   
33f0: 20 20 20 20 28 63 6f 6e 64 0a 09 09 09 09 09 09      (cond.......
3400: 28 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65  ((procedure? ite
3410: 6d 73 29 20 20 20 20 20 20 0a 09 09 09 09 09 09  ms)      .......
3420: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
3430: 66 6f 20 34 20 22 69 74 65 6d 73 20 69 73 20 61  fo 4 "items is a
3440: 20 70 72 6f 63 65 64 75 72 65 2c 20 77 69 6c 6c   procedure, will
3450: 20 63 61 6c 63 20 6c 61 74 65 72 22 29 0a 09 09   calc later")...
3460: 09 09 09 09 20 69 74 65 6d 73 29 20 20 20 20 20  .... items)     
3470: 20 20 20 20 20 20 20 3b 3b 20 63 61 6c 63 20 6c         ;; calc l
3480: 61 74 65 72 0a 09 09 09 09 09 09 28 28 70 72 6f  ater.......((pro
3490: 63 65 64 75 72 65 3f 20 69 74 65 6d 73 74 61 62  cedure? itemstab
34a0: 6c 65 29 0a 09 09 09 09 09 09 20 28 64 65 62 75  le)....... (debu
34b0: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22  g:print-info 4 "
34c0: 69 74 65 6d 73 74 61 62 6c 65 20 69 73 20 61 20  itemstable is a 
34d0: 70 72 6f 63 65 64 75 72 65 2c 20 77 69 6c 6c 20  procedure, will 
34e0: 63 61 6c 63 20 6c 61 74 65 72 22 29 0a 09 09 09  calc later")....
34f0: 09 09 09 20 69 74 65 6d 73 74 61 62 6c 65 29 20  ... itemstable) 
3500: 20 20 20 20 20 20 3b 3b 20 63 61 6c 63 20 6c 61        ;; calc la
3510: 74 65 72 0a 09 09 09 09 09 09 28 28 66 69 6c 74  ter.......((filt
3520: 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29 0a 09  er (lambda (x)..
3530: 09 09 09 09 09 09 20 20 20 28 6c 65 74 20 28 28  ......   (let ((
3540: 76 61 6c 20 28 63 61 72 20 78 29 29 29 0a 09 09  val (car x)))...
3550: 09 09 09 09 09 20 20 20 20 20 28 69 66 20 28 70  .....     (if (p
3560: 72 6f 63 65 64 75 72 65 3f 20 76 61 6c 29 20 76  rocedure? val) v
3570: 61 6c 20 23 66 29 29 29 0a 09 09 09 09 09 09 09  al #f)))........
3580: 20 28 61 70 70 65 6e 64 20 28 69 66 20 28 6c 69   (append (if (li
3590: 73 74 3f 20 69 74 65 6d 73 29 20 69 74 65 6d 73  st? items) items
35a0: 20 27 28 29 29 0a 09 09 09 09 09 09 09 09 20 28   '())......... (
35b0: 69 66 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 74  if (list? itemst
35c0: 61 62 6c 65 29 20 69 74 65 6d 73 74 61 62 6c 65  able) itemstable
35d0: 20 27 28 29 29 29 29 0a 09 09 09 09 09 09 20 27   '())))....... '
35e0: 68 61 76 65 2d 70 72 6f 63 65 64 75 72 65 29 0a  have-procedure).
35f0: 09 09 09 09 09 09 28 28 6f 72 20 28 6c 69 73 74  ......((or (list
3600: 3f 20 69 74 65 6d 73 29 28 6c 69 73 74 3f 20 69  ? items)(list? i
3610: 74 65 6d 73 74 61 62 6c 65 29 29 20 3b 3b 20 63  temstable)) ;; c
3620: 61 6c 63 20 6e 6f 77 0a 09 09 09 09 09 09 20 28  alc now....... (
3630: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
3640: 20 34 20 22 69 74 65 6d 73 20 61 6e 64 20 69 74   4 "items and it
3650: 65 6d 73 74 61 62 6c 65 20 61 72 65 20 6c 69 73  emstable are lis
3660: 74 73 2c 20 63 61 6c 63 20 6e 6f 77 5c 6e 22 0a  ts, calc now\n".
3670: 09 09 09 09 09 09 09 20 20 20 20 20 20 22 20 20  .......      "  
3680: 20 20 69 74 65 6d 73 3a 20 22 20 69 74 65 6d 73    items: " items
3690: 20 22 20 69 74 65 6d 73 74 61 62 6c 65 3a 20 22   " itemstable: "
36a0: 20 69 74 65 6d 73 74 61 62 6c 65 29 0a 09 09 09   itemstable)....
36b0: 09 09 09 20 28 69 74 65 6d 73 3a 67 65 74 2d 69  ... (items:get-i
36c0: 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67  tems-from-config
36d0: 20 63 6f 6e 66 69 67 29 29 0a 09 09 09 09 09 09   config)).......
36e0: 28 65 6c 73 65 20 23 66 29 29 29 20 20 20 20 20  (else #f)))     
36f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
3700: 20 20 20 20 20 20 3b 3b 20 6e 6f 74 20 69 74 65        ;; not ite
3710: 72 61 74 65 64 0a 09 09 09 09 09 20 20 20 20 20  rated......     
3720: 23 66 20 20 20 20 20 20 3b 3b 20 69 74 65 6d 73  #f      ;; items
3730: 64 61 74 20 35 0a 09 09 09 09 09 20 20 20 20 20  dat 5......     
3740: 23 66 20 20 20 20 20 20 3b 3b 20 73 70 61 72 65  #f      ;; spare
3750: 20 2d 20 75 73 65 64 20 66 6f 72 20 69 74 65 6d   - used for item
3760: 2d 70 61 74 68 0a 09 09 09 09 09 20 20 20 20 20  -path......     
3770: 29 29 29 0a 09 20 20 20 20 28 66 6f 72 2d 65 61  )))..    (for-ea
3780: 63 68 20 0a 09 20 20 20 20 20 28 6c 61 6d 62 64  ch ..     (lambd
3790: 61 20 28 77 61 69 74 6f 6e 29 0a 09 20 20 20 20  a (waiton)..    
37a0: 20 20 20 28 69 66 20 28 61 6e 64 20 77 61 69 74     (if (and wait
37b0: 6f 6e 20 28 6e 6f 74 20 28 6d 65 6d 62 65 72 20  on (not (member 
37c0: 77 61 69 74 6f 6e 20 74 65 73 74 2d 6e 61 6d 65  waiton test-name
37d0: 73 29 29 29 0a 09 09 20 20 20 28 62 65 67 69 6e  s)))...   (begin
37e0: 0a 09 09 20 20 20 20 20 28 73 65 74 21 20 72 65  ...     (set! re
37f0: 71 75 69 72 65 64 2d 74 65 73 74 73 20 28 63 6f  quired-tests (co
3800: 6e 73 20 77 61 69 74 6f 6e 20 72 65 71 75 69 72  ns waiton requir
3810: 65 64 2d 74 65 73 74 73 29 29 0a 09 09 20 20 20  ed-tests))...   
3820: 20 20 28 73 65 74 21 20 74 65 73 74 2d 6e 61 6d    (set! test-nam
3830: 65 73 20 28 63 6f 6e 73 20 77 61 69 74 6f 6e 20  es (cons waiton 
3840: 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 29 29 20  test-names))))) 
3850: 3b 3b 20 77 61 73 20 61 6e 20 61 70 70 65 6e 64  ;; was an append
3860: 2c 20 6e 6f 77 20 61 20 63 6f 6e 73 0a 09 20 20  , now a cons..  
3870: 20 20 20 77 61 69 74 6f 6e 73 29 0a 09 20 20 20     waitons)..   
3880: 20 28 6c 65 74 20 28 28 72 65 6d 74 65 73 74 73   (let ((remtests
3890: 20 28 64 65 6c 65 74 65 2d 64 75 70 6c 69 63 61   (delete-duplica
38a0: 74 65 73 20 28 61 70 70 65 6e 64 20 77 61 69 74  tes (append wait
38b0: 6f 6e 73 20 74 61 6c 29 29 29 29 0a 09 20 20 20  ons tal))))..   
38c0: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c     (if (not (nul
38d0: 6c 3f 20 72 65 6d 74 65 73 74 73 29 29 0a 09 09  l? remtests))...
38e0: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 72 65 6d    (loop (car rem
38f0: 74 65 73 74 73 29 28 63 64 72 20 72 65 6d 74 65  tests)(cdr remte
3900: 73 74 73 29 29 29 29 29 29 29 0a 0a 20 20 20 20  sts)))))))..    
3910: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20  (if (not (null? 
3920: 72 65 71 75 69 72 65 64 2d 74 65 73 74 73 29 29  required-tests))
3930: 0a 09 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69  ..(debug:print-i
3940: 6e 66 6f 20 31 20 22 41 64 64 69 6e 67 20 22 20  nfo 1 "Adding " 
3950: 72 65 71 75 69 72 65 64 2d 74 65 73 74 73 20 22  required-tests "
3960: 20 74 6f 20 74 68 65 20 72 75 6e 20 71 75 65 75   to the run queu
3970: 65 22 29 29 0a 20 20 20 20 3b 3b 20 4e 4f 54 45  e")).    ;; NOTE
3980: 3a 20 74 68 65 73 65 20 61 72 65 20 61 6c 6c 20  : these are all 
3990: 70 61 72 65 6e 74 20 74 65 73 74 73 2c 20 69 74  parent tests, it
39a0: 65 6d 73 20 61 72 65 20 6e 6f 74 20 65 78 70 61  ems are not expa
39b0: 6e 64 65 64 20 79 65 74 2e 0a 20 20 20 20 28 64  nded yet..    (d
39c0: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
39d0: 34 20 22 74 65 73 74 2d 72 65 63 6f 72 64 73 3d  4 "test-records=
39e0: 22 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61  " (hash-table->a
39f0: 6c 69 73 74 20 74 65 73 74 2d 72 65 63 6f 72 64  list test-record
3a00: 73 29 29 0a 20 20 20 20 28 72 75 6e 73 3a 72 75  s)).    (runs:ru
3a10: 6e 2d 74 65 73 74 73 2d 71 75 65 75 65 20 72 75  n-tests-queue ru
3a20: 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73  n-id runname tes
3a30: 74 2d 72 65 63 6f 72 64 73 20 6b 65 79 76 61 6c  t-records keyval
3a40: 6c 73 74 20 66 6c 61 67 73 20 74 65 73 74 2d 70  lst flags test-p
3a50: 61 74 74 73 29 0a 20 20 20 20 28 64 65 62 75 67  atts).    (debug
3a60: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 41  :print-info 4 "A
3a70: 6c 6c 20 64 6f 6e 65 20 62 79 20 68 65 72 65 22  ll done by here"
3a80: 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75  )))..(define (ru
3a90: 6e 73 3a 63 61 6c 63 2d 66 61 69 6c 73 20 70 72  ns:calc-fails pr
3aa0: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 20  ereqs-not-met). 
3ab0: 20 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61   (filter (lambda
3ac0: 20 28 74 65 73 74 29 0a 09 20 20 20 20 28 61 6e   (test)..    (an
3ad0: 64 20 28 76 65 63 74 6f 72 3f 20 74 65 73 74 29  d (vector? test)
3ae0: 20 3b 3b 20 6e 6f 74 20 28 73 74 72 69 6e 67 3f   ;; not (string?
3af0: 20 74 65 73 74 29 29 0a 09 09 20 28 65 71 75 61   test))... (equa
3b00: 6c 3f 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  l? (db:test-get-
3b10: 73 74 61 74 65 20 74 65 73 74 29 20 22 43 4f 4d  state test) "COM
3b20: 50 4c 45 54 45 44 22 29 0a 09 09 20 28 6e 6f 74  PLETED")... (not
3b30: 20 28 6d 65 6d 62 65 72 20 28 64 62 3a 74 65 73   (member (db:tes
3b40: 74 2d 67 65 74 2d 73 74 61 74 75 73 20 74 65 73  t-get-status tes
3b50: 74 29 0a 09 09 09 20 20 20 20 20 20 27 28 22 50  t)....      '("P
3b60: 41 53 53 22 20 22 57 41 52 4e 22 20 22 43 48 45  ASS" "WARN" "CHE
3b70: 43 4b 22 20 22 57 41 49 56 45 44 22 20 22 53 4b  CK" "WAIVED" "SK
3b80: 49 50 22 29 29 29 29 29 0a 09 20 20 70 72 65 72  IP")))))..  prer
3b90: 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 0a 28  eqs-not-met))..(
3ba0: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 63 61 6c  define (runs:cal
3bb0: 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 74 65 64 20  c-not-completed 
3bc0: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29  prereqs-not-met)
3bd0: 0a 20 20 28 66 69 6c 74 65 72 0a 20 20 20 28 6c  .  (filter.   (l
3be0: 61 6d 62 64 61 20 28 74 29 0a 20 20 20 20 20 28  ambda (t).     (
3bf0: 6f 72 20 28 6e 6f 74 20 28 76 65 63 74 6f 72 3f  or (not (vector?
3c00: 20 74 29 29 0a 09 20 28 6e 6f 74 20 28 65 71 75   t)).. (not (equ
3c10: 61 6c 3f 20 22 43 4f 4d 50 4c 45 54 45 44 22 20  al? "COMPLETED" 
3c20: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61  (db:test-get-sta
3c30: 74 65 20 74 29 29 29 29 29 0a 20 20 20 70 72 65  te t))))).   pre
3c40: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 0a  reqs-not-met))..
3c50: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 70 72  (define (runs:pr
3c60: 65 74 74 79 2d 73 74 72 69 6e 67 20 6c 73 74 29  etty-string lst)
3c70: 0a 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20  .  (map (lambda 
3c80: 28 74 29 0a 09 20 28 69 66 20 28 6e 6f 74 20 28  (t).. (if (not (
3c90: 76 65 63 74 6f 72 3f 20 74 29 29 0a 09 20 20 20  vector? t))..   
3ca0: 20 20 28 63 6f 6e 63 20 74 29 0a 09 20 20 20 20    (conc t)..    
3cb0: 20 28 63 6f 6e 63 20 28 64 62 3a 74 65 73 74 2d   (conc (db:test-
3cc0: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 29 20  get-testname t) 
3cd0: 22 3a 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74  ":" (db:test-get
3ce0: 2d 73 74 61 74 65 20 74 29 20 22 2f 22 20 28 64  -state t) "/" (d
3cf0: 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75  b:test-get-statu
3d00: 73 20 74 29 29 29 29 0a 20 20 20 20 20 20 20 6c  s t)))).       l
3d10: 73 74 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72  st))..(define (r
3d20: 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65  uns:make-full-te
3d30: 73 74 2d 6e 61 6d 65 20 74 65 73 74 6e 61 6d 65  st-name testname
3d40: 20 69 74 65 6d 70 61 74 68 29 0a 20 20 28 69 66   itempath).  (if
3d50: 20 28 65 71 75 61 6c 3f 20 69 74 65 6d 70 61 74   (equal? itempat
3d60: 68 20 22 22 29 20 74 65 73 74 6e 61 6d 65 20 28  h "") testname (
3d70: 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f  conc testname "/
3d80: 22 20 69 74 65 6d 70 61 74 68 29 29 29 0a 0a 3b  " itempath)))..;
3d90: 3b 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 69  ; test-records i
3da0: 73 20 61 20 68 61 73 68 20 74 61 62 6c 65 20 74  s a hash table t
3db0: 65 73 74 6e 61 6d 65 3a 69 74 65 6d 5f 70 61 74  estname:item_pat
3dc0: 68 20 3d 3e 20 76 65 63 74 6f 72 20 3c 20 74 65  h => vector < te
3dd0: 73 74 6e 61 6d 65 20 74 65 73 74 63 6f 6e 66 69  stname testconfi
3de0: 67 20 77 61 69 74 6f 6e 73 20 70 72 69 6f 72 69  g waitons priori
3df0: 74 79 20 69 74 65 6d 73 2d 69 6e 66 6f 20 2e 2e  ty items-info ..
3e00: 2e 20 3e 0a 28 64 65 66 69 6e 65 20 28 72 75 6e  . >.(define (run
3e10: 73 3a 72 75 6e 2d 74 65 73 74 73 2d 71 75 65 75  s:run-tests-queu
3e20: 65 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65  e run-id runname
3e30: 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 6b 65   test-records ke
3e40: 79 76 61 6c 6c 73 74 20 66 6c 61 67 73 20 74 65  yvallst flags te
3e50: 73 74 2d 70 61 74 74 73 29 0a 20 20 20 20 3b 3b  st-patts).    ;;
3e60: 20 41 74 20 74 68 69 73 20 70 6f 69 6e 74 20 74   At this point t
3e70: 68 65 20 6c 69 73 74 20 6f 66 20 70 61 72 65 6e  he list of paren
3e80: 74 20 74 65 73 74 73 20 69 73 20 65 78 70 61 6e  t tests is expan
3e90: 64 65 64 20 0a 20 20 20 20 3b 3b 20 4e 42 2f 2f  ded .    ;; NB//
3ea0: 20 53 68 6f 75 6c 64 20 65 78 70 61 6e 64 20 69   Should expand i
3eb0: 74 65 6d 73 20 68 65 72 65 20 61 6e 64 20 74 68  tems here and th
3ec0: 65 6e 20 69 6e 73 65 72 74 20 69 6e 74 6f 20 74  en insert into t
3ed0: 68 65 20 72 75 6e 20 71 75 65 75 65 2e 0a 20 20  he run queue..  
3ee0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 35 20 22  (debug:print 5 "
3ef0: 74 65 73 74 2d 72 65 63 6f 72 64 73 3a 20 22 20  test-records: " 
3f00: 74 65 73 74 2d 72 65 63 6f 72 64 73 20 22 2c 20  test-records ", 
3f10: 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65 79  keyvallst: " key
3f20: 76 61 6c 6c 73 74 20 22 20 66 6c 61 67 73 3a 20  vallst " flags: 
3f30: 22 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61  " (hash-table->a
3f40: 6c 69 73 74 20 66 6c 61 67 73 29 29 0a 20 20 28  list flags)).  (
3f50: 6c 65 74 20 28 28 73 6f 72 74 65 64 2d 74 65 73  let ((sorted-tes
3f60: 74 2d 6e 61 6d 65 73 20 28 74 65 73 74 73 3a 73  t-names (tests:s
3f70: 6f 72 74 2d 62 79 2d 70 72 69 6f 72 69 74 79 2d  ort-by-priority-
3f80: 61 6e 64 2d 77 61 69 74 6f 6e 20 74 65 73 74 2d  and-waiton test-
3f90: 72 65 63 6f 72 64 73 29 29 0a 09 28 74 65 73 74  records))..(test
3fa0: 2d 72 65 67 69 73 74 65 72 79 20 20 20 20 28 6d  -registery    (m
3fb0: 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29  ake-hash-table))
3fc0: 0a 09 28 6e 75 6d 2d 72 65 74 72 69 65 73 20 20  ..(num-retries  
3fd0: 20 20 20 20 20 20 30 29 0a 09 28 6d 61 78 2d 72        0)..(max-r
3fe0: 65 74 72 69 65 73 20 20 20 20 20 20 20 28 63 6f  etries       (co
3ff0: 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e  nfig-lookup *con
4000: 66 69 67 64 61 74 2a 20 22 73 65 74 75 70 22 20  figdat* "setup" 
4010: 22 6d 61 78 72 65 74 72 69 65 73 22 29 29 29 0a  "maxretries"))).
4020: 20 20 20 20 28 73 65 74 21 20 6d 61 78 2d 72 65      (set! max-re
4030: 74 72 69 65 73 20 28 69 66 20 28 61 6e 64 20 6d  tries (if (and m
4040: 61 78 2d 72 65 74 72 69 65 73 20 28 73 74 72 69  ax-retries (stri
4050: 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 61 78 2d 72  ng->number max-r
4060: 65 74 72 69 65 73 29 29 28 73 74 72 69 6e 67 2d  etries))(string-
4070: 3e 6e 75 6d 62 65 72 20 6d 61 78 2d 72 65 74 72  >number max-retr
4080: 69 65 73 29 20 31 30 30 29 29 0a 20 20 20 20 28  ies) 100)).    (
4090: 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 73  if (not (null? s
40a0: 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73  orted-test-names
40b0: 29 29 0a 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28  ))..(let loop ((
40c0: 68 65 64 20 20 20 20 20 20 20 20 20 28 63 61 72  hed         (car
40d0: 20 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d   sorted-test-nam
40e0: 65 73 29 29 0a 09 09 20 20 20 28 74 61 6c 20 20  es))...   (tal  
40f0: 20 20 20 20 20 20 20 28 63 64 72 20 73 6f 72 74         (cdr sort
4100: 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a  ed-test-names)).
4110: 09 09 20 20 20 28 72 65 72 75 6e 73 20 20 20 20  ..   (reruns    
4120: 20 20 27 28 29 29 29 0a 09 20 20 28 69 66 20 28    '()))..  (if (
4130: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 72 75 6e  not (null? rerun
4140: 73 29 29 28 64 65 62 75 67 3a 70 72 69 6e 74 2d  s))(debug:print-
4150: 69 6e 66 6f 20 34 20 22 72 65 72 75 6e 73 3d 22  info 4 "reruns="
4160: 20 72 65 72 75 6e 73 29 29 0a 09 20 20 3b 3b 20   reruns))..  ;; 
4170: 28 70 72 69 6e 74 20 22 54 6f 70 20 6f 66 20 6c  (print "Top of l
4180: 6f 6f 70 2c 20 68 65 64 3d 22 20 68 65 64 20 22  oop, hed=" hed "
4190: 2c 20 74 61 6c 3d 22 20 74 61 6c 20 22 20 2c 72  , tal=" tal " ,r
41a0: 65 72 75 6e 73 3d 22 20 72 65 72 75 6e 73 29 0a  eruns=" reruns).
41b0: 09 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d  .  (let* ((test-
41c0: 72 65 63 6f 72 64 20 28 68 61 73 68 2d 74 61 62  record (hash-tab
41d0: 6c 65 2d 72 65 66 20 74 65 73 74 2d 72 65 63 6f  le-ref test-reco
41e0: 72 64 73 20 68 65 64 29 29 0a 09 09 20 28 74 65  rds hed))... (te
41f0: 73 74 2d 6e 61 6d 65 20 20 20 28 74 65 73 74 73  st-name   (tests
4200: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74  :testqueue-get-t
4210: 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63  estname test-rec
4220: 6f 72 64 29 29 0a 09 09 20 28 74 63 6f 6e 66 69  ord))... (tconfi
4230: 67 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73  g     (tests:tes
4240: 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 63  tqueue-get-testc
4250: 6f 6e 66 69 67 20 74 65 73 74 2d 72 65 63 6f 72  onfig test-recor
4260: 64 29 29 0a 09 09 20 28 74 65 73 74 6d 6f 64 65  d))... (testmode
4270: 20 20 20 20 28 6c 65 74 20 28 28 6d 20 28 63 6f      (let ((m (co
4280: 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 63 6f 6e  nfig-lookup tcon
4290: 66 69 67 20 22 72 65 71 75 69 72 65 6d 65 6e 74  fig "requirement
42a0: 73 22 20 22 6d 6f 64 65 22 29 29 29 0a 09 09 09  s" "mode")))....
42b0: 09 28 69 66 20 6d 20 28 73 74 72 69 6e 67 2d 3e  .(if m (string->
42c0: 73 79 6d 62 6f 6c 20 6d 29 20 27 6e 6f 72 6d 61  symbol m) 'norma
42d0: 6c 29 29 29 0a 09 09 20 28 77 61 69 74 6f 6e 73  l)))... (waitons
42e0: 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74       (tests:test
42f0: 71 75 65 75 65 2d 67 65 74 2d 77 61 69 74 6f 6e  queue-get-waiton
4300: 73 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64  s    test-record
4310: 29 29 0a 09 09 20 28 70 72 69 6f 72 69 74 79 20  ))... (priority 
4320: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75     (tests:testqu
4330: 65 75 65 2d 67 65 74 2d 70 72 69 6f 72 69 74 79  eue-get-priority
4340: 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29     test-record))
4350: 0a 09 09 20 28 69 74 65 6d 64 61 74 20 20 20 20  ... (itemdat    
4360: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75   (tests:testqueu
4370: 65 2d 67 65 74 2d 69 74 65 6d 64 61 74 20 20 20  e-get-itemdat   
4380: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 20 3b   test-record)) ;
4390: 3b 20 69 74 65 6d 64 61 74 20 63 61 6e 20 62 65  ; itemdat can be
43a0: 20 61 20 73 74 72 69 6e 67 2c 20 6c 69 73 74 20   a string, list 
43b0: 6f 72 20 23 66 0a 09 09 20 28 69 74 65 6d 73 20  or #f... (items 
43c0: 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73        (tests:tes
43d0: 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d 73  tqueue-get-items
43e0: 20 20 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72        test-recor
43f0: 64 29 29 0a 09 09 20 28 69 74 65 6d 2d 70 61 74  d))... (item-pat
4400: 68 20 20 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e  h   (item-list->
4410: 70 61 74 68 20 69 74 65 6d 64 61 74 29 29 0a 09  path itemdat))..
4420: 09 20 28 6e 65 77 74 61 6c 20 20 20 20 20 20 28  . (newtal      (
4430: 61 70 70 65 6e 64 20 74 61 6c 20 28 6c 69 73 74  append tal (list
4440: 20 68 65 64 29 29 29 29 0a 09 20 20 20 20 0a 09   hed))))..    ..
4450: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
4460: 20 36 0a 09 09 09 20 22 74 65 73 74 2d 6e 61 6d   6.... "test-nam
4470: 65 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 0a 09  e: " test-name..
4480: 09 09 20 22 5c 6e 20 20 68 65 64 3a 20 20 20 20  .. "\n  hed:    
4490: 20 20 20 20 20 22 20 68 65 64 0a 09 09 09 20 22       " hed.... "
44a0: 5c 6e 20 20 69 74 65 6d 64 61 74 3a 20 20 20 20  \n  itemdat:    
44b0: 20 22 20 69 74 65 6d 64 61 74 0a 09 09 09 20 22   " itemdat.... "
44c0: 5c 6e 20 20 69 74 65 6d 73 3a 20 20 20 20 20 20  \n  items:      
44d0: 20 22 20 69 74 65 6d 73 0a 09 09 09 20 22 5c 6e   " items.... "\n
44e0: 20 20 69 74 65 6d 2d 70 61 74 68 3a 20 20 20 22    item-path:   "
44f0: 20 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 20 22   item-path.... "
4500: 5c 6e 20 20 77 61 69 74 6f 6e 73 3a 20 20 20 20  \n  waitons:    
4510: 20 22 20 77 61 69 74 6f 6e 73 0a 09 09 09 20 22   " waitons.... "
4520: 5c 6e 20 20 6e 75 6d 2d 72 65 74 72 69 65 73 3a  \n  num-retries:
4530: 20 22 20 6e 75 6d 2d 72 65 74 72 69 65 73 0a 09   " num-retries..
4540: 09 09 20 22 5c 6e 20 20 74 61 6c 3a 20 20 20 20  .. "\n  tal:    
4550: 20 20 20 20 20 22 20 74 61 6c 0a 09 09 09 20 22       " tal.... "
4560: 5c 6e 20 20 72 65 72 75 6e 73 3a 20 20 20 20 20  \n  reruns:     
4570: 20 22 20 72 65 72 75 6e 73 29 0a 0a 09 20 20 20   " reruns)...   
4580: 20 3b 3b 20 63 68 65 63 6b 20 66 6f 72 20 68 65   ;; check for he
4590: 64 20 69 6e 20 77 61 69 74 6f 6e 73 20 3d 3e 20  d in waitons => 
45a0: 74 68 69 73 20 77 6f 75 6c 64 20 62 65 20 63 69  this would be ci
45b0: 72 63 75 6c 61 72 2c 20 72 65 6d 6f 76 65 20 69  rcular, remove i
45c0: 74 20 61 6e 64 20 69 73 73 75 65 20 61 6e 0a 09  t and issue an..
45d0: 20 20 20 20 3b 3b 20 65 72 72 6f 72 0a 09 20 20      ;; error..  
45e0: 20 20 28 69 66 20 28 6d 65 6d 62 65 72 20 74 65    (if (member te
45f0: 73 74 2d 6e 61 6d 65 20 77 61 69 74 6f 6e 73 29  st-name waitons)
4600: 0a 09 09 28 62 65 67 69 6e 0a 09 09 20 20 28 64  ...(begin...  (d
4610: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
4620: 52 4f 52 3a 20 74 65 73 74 20 22 20 74 65 73 74  ROR: test " test
4630: 2d 6e 61 6d 65 20 22 20 68 61 73 20 6c 69 73 74  -name " has list
4640: 65 64 20 69 74 73 65 6c 66 20 61 73 20 61 20 77  ed itself as a w
4650: 61 69 74 6f 6e 2c 20 70 6c 65 61 73 65 20 63 6f  aiton, please co
4660: 72 72 65 63 74 20 74 68 69 73 21 22 29 0a 09 09  rrect this!")...
4670: 20 20 28 73 65 74 21 20 77 61 69 74 6f 6e 20 28    (set! waiton (
4680: 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28  filter (lambda (
4690: 78 29 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 78  x)(not (equal? x
46a0: 20 68 65 64 29 29 29 20 77 61 69 74 6f 6e 73 29   hed))) waitons)
46b0: 29 29 29 0a 0a 09 20 20 20 20 28 63 6f 6e 64 20  )))...    (cond 
46c0: 3b 3b 20 4f 55 54 45 52 20 43 4f 4e 44 0a 09 20  ;; OUTER COND.. 
46d0: 20 20 20 20 28 28 6e 6f 74 20 69 74 65 6d 73 29      ((not items)
46e0: 20 3b 3b 20 77 68 65 6e 20 66 61 6c 73 65 20 74   ;; when false t
46f0: 68 65 20 74 65 73 74 20 69 73 20 6f 6b 20 74 6f  he test is ok to
4700: 20 62 65 20 68 61 6e 64 65 64 20 6f 66 66 20 74   be handed off t
4710: 6f 20 6c 61 75 6e 63 68 20 28 62 75 74 20 6e 6f  o launch (but no
4720: 74 20 62 65 66 6f 72 65 29 0a 09 20 20 20 20 20  t before)..     
4730: 20 28 6c 65 74 2a 20 28 28 72 75 6e 2d 6c 69 6d   (let* ((run-lim
4740: 69 74 73 2d 69 6e 66 6f 20 20 20 20 20 20 20 20  its-info        
4750: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
4760: 20 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f   runs:can-run-mo
4770: 72 65 2d 74 65 73 74 73 20 74 65 73 74 2d 72 65  re-tests test-re
4780: 63 6f 72 64 29 29 20 3b 3b 20 6c 6f 6f 6b 20 61  cord)) ;; look a
4790: 74 20 74 68 65 20 74 65 73 74 20 6a 6f 62 67 72  t the test jobgr
47a0: 6f 75 70 20 61 6e 64 20 74 6f 74 20 6a 6f 62 73  oup and tot jobs
47b0: 20 72 75 6e 6e 69 6e 67 0a 09 09 20 20 20 20 20   running...     
47c0: 28 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 20  (have-resources 
47d0: 20 20 20 20 20 20 20 20 20 28 63 61 72 20 72 75           (car ru
47e0: 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 29 29 0a  n-limits-info)).
47f0: 09 09 20 20 20 20 20 28 6e 75 6d 2d 72 75 6e 6e  ..     (num-runn
4800: 69 6e 67 20 20 20 20 20 20 20 20 20 20 20 20 20  ing             
4810: 28 6c 69 73 74 2d 72 65 66 20 72 75 6e 2d 6c 69  (list-ref run-li
4820: 6d 69 74 73 2d 69 6e 66 6f 20 31 29 29 0a 09 09  mits-info 1))...
4830: 20 20 20 20 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e       (num-runnin
4840: 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 28 6c  g-in-jobgroup (l
4850: 69 73 74 2d 72 65 66 20 72 75 6e 2d 6c 69 6d 69  ist-ref run-limi
4860: 74 73 2d 69 6e 66 6f 20 32 29 29 0a 09 09 20 20  ts-info 2))...  
4870: 20 20 20 28 6d 61 78 2d 63 6f 6e 63 75 72 72 65     (max-concurre
4880: 6e 74 2d 6a 6f 62 73 20 20 20 20 20 28 6c 69 73  nt-jobs     (lis
4890: 74 2d 72 65 66 20 72 75 6e 2d 6c 69 6d 69 74 73  t-ref run-limits
48a0: 2d 69 6e 66 6f 20 33 29 29 0a 09 09 20 20 20 20  -info 3))...    
48b0: 20 28 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69   (job-group-limi
48c0: 74 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 2d  t         (list-
48d0: 72 65 66 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69  ref run-limits-i
48e0: 6e 66 6f 20 34 29 29 0a 09 09 20 20 20 20 20 28  nfo 4))...     (
48f0: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20  prereqs-not-met 
4900: 20 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75          (open-ru
4910: 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 70  n-close db:get-p
4920: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 23  rereqs-not-met #
4930: 66 20 72 75 6e 2d 69 64 20 77 61 69 74 6f 6e 73  f run-id waitons
4940: 20 69 74 65 6d 2d 70 61 74 68 20 6d 6f 64 65 3a   item-path mode:
4950: 20 74 65 73 74 6d 6f 64 65 29 29 0a 09 09 20 20   testmode))...  
4960: 20 20 20 28 66 61 69 6c 73 20 20 20 20 20 20 20     (fails       
4970: 20 20 20 20 20 20 20 20 20 20 20 20 28 72 75 6e              (run
4980: 73 3a 63 61 6c 63 2d 66 61 69 6c 73 20 70 72 65  s:calc-fails pre
4990: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 09  reqs-not-met))..
49a0: 09 20 20 20 20 20 28 6e 6f 6e 2d 63 6f 6d 70 6c  .     (non-compl
49b0: 65 74 65 64 20 20 20 20 20 20 20 20 20 20 20 28  eted           (
49c0: 72 75 6e 73 3a 63 61 6c 63 2d 6e 6f 74 2d 63 6f  runs:calc-not-co
49d0: 6d 70 6c 65 74 65 64 20 70 72 65 72 65 71 73 2d  mpleted prereqs-
49e0: 6e 6f 74 2d 6d 65 74 29 29 29 0a 09 09 28 64 65  not-met)))...(de
49f0: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 38  bug:print-info 8
4a00: 20 22 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73   "have-resources
4a10: 3a 20 22 20 68 61 76 65 2d 72 65 73 6f 75 72 63  : " have-resourc
4a20: 65 73 20 22 20 70 72 65 72 65 71 73 2d 6e 6f 74  es " prereqs-not
4a30: 2d 6d 65 74 3a 20 22 20 0a 09 09 09 20 20 20 20  -met: " ....    
4a40: 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70   (string-intersp
4a50: 65 72 73 65 20 0a 09 09 09 20 20 20 20 20 20 28  erse ....      (
4a60: 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 74 29 0a  map (lambda (t).
4a70: 09 09 09 09 20 20 20 20 20 28 69 66 20 28 76 65  ....     (if (ve
4a80: 63 74 6f 72 3f 20 74 29 0a 09 09 09 09 09 20 28  ctor? t)...... (
4a90: 63 6f 6e 63 20 28 64 62 3a 74 65 73 74 2d 67 65  conc (db:test-ge
4aa0: 74 2d 73 74 61 74 65 20 74 29 20 22 2f 22 20 28  t-state t) "/" (
4ab0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74  db:test-get-stat
4ac0: 75 73 20 74 29 29 0a 09 09 09 09 09 20 28 63 6f  us t))...... (co
4ad0: 6e 63 20 22 20 57 41 52 4e 49 4e 47 3a 20 74 20  nc " WARNING: t 
4ae0: 69 73 20 6e 6f 74 20 61 20 76 65 63 74 6f 72 3d  is not a vector=
4af0: 22 20 74 20 29 29 29 0a 09 09 09 09 20 20 20 70  " t ))).....   p
4b00: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 20  rereqs-not-met) 
4b10: 22 2c 20 22 29 20 22 20 66 61 69 6c 73 3a 20 22  ", ") " fails: "
4b20: 20 66 61 69 6c 73 29 0a 09 09 28 64 65 62 75 67   fails)...(debug
4b30: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 68  :print-info 4 "h
4b40: 65 64 3d 22 20 68 65 64 20 22 5c 6e 20 20 74 65  ed=" hed "\n  te
4b50: 73 74 2d 72 65 63 6f 72 64 3d 22 20 74 65 73 74  st-record=" test
4b60: 2d 72 65 63 6f 72 64 20 22 5c 6e 20 20 74 65 73  -record "\n  tes
4b70: 74 2d 6e 61 6d 65 3a 20 22 20 74 65 73 74 2d 6e  t-name: " test-n
4b80: 61 6d 65 20 22 5c 6e 20 20 69 74 65 6d 2d 70 61  ame "\n  item-pa
4b90: 74 68 3a 20 22 20 69 74 65 6d 2d 70 61 74 68 20  th: " item-path 
4ba0: 22 5c 6e 20 20 74 65 73 74 2d 70 61 74 74 73 3a  "\n  test-patts:
4bb0: 20 22 20 74 65 73 74 2d 70 61 74 74 73 29 0a 0a   " test-patts)..
4bc0: 09 09 3b 3b 20 44 6f 6e 27 74 20 6b 6e 6f 77 20  ..;; Don't know 
4bd0: 61 74 20 74 68 69 73 20 74 69 6d 65 20 69 66 20  at this time if 
4be0: 74 68 65 20 74 65 73 74 20 68 61 76 65 20 62 65  the test have be
4bf0: 65 6e 20 6c 61 75 6e 63 68 65 64 20 61 74 20 73  en launched at s
4c00: 6f 6d 65 20 74 69 6d 65 20 69 6e 20 74 68 65 20  ome time in the 
4c10: 70 61 73 74 0a 09 09 3b 3b 20 69 2e 65 2e 20 69  past...;; i.e. i
4c20: 73 20 74 68 69 73 20 61 20 72 65 2d 6c 61 75 6e  s this a re-laun
4c30: 63 68 3f 0a 09 09 28 64 65 62 75 67 3a 70 72 69  ch?...(debug:pri
4c40: 6e 74 2d 69 6e 66 6f 20 34 20 22 72 75 6e 2d 6c  nt-info 4 "run-l
4c50: 69 6d 69 74 73 2d 69 6e 66 6f 20 3d 20 22 20 72  imits-info = " r
4c60: 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 29 0a  un-limits-info).
4c70: 09 09 28 63 6f 6e 64 20 3b 3b 20 49 4e 4e 45 52  ..(cond ;; INNER
4c80: 20 43 4f 4e 44 20 23 31 20 66 6f 72 20 61 20 6c   COND #1 for a l
4c90: 61 75 6e 63 68 61 62 6c 65 20 74 65 73 74 0a 09  aunchable test..
4ca0: 09 20 3b 3b 20 43 68 65 63 6b 20 69 74 65 6d 20  . ;; Check item 
4cb0: 70 61 74 68 20 61 67 61 69 6e 73 74 20 69 74 65  path against ite
4cc0: 6d 2d 70 61 74 74 73 0a 09 09 20 28 28 6e 6f 74  m-patts... ((not
4cd0: 20 28 74 65 73 74 73 3a 6d 61 74 63 68 20 74 65   (tests:match te
4ce0: 73 74 2d 70 61 74 74 73 20 28 74 65 73 74 73 3a  st-patts (tests:
4cf0: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65  testqueue-get-te
4d00: 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f  stname test-reco
4d10: 72 64 29 20 69 74 65 6d 2d 70 61 74 68 29 29 20  rd) item-path)) 
4d20: 3b 3b 20 54 68 69 73 20 74 65 73 74 2f 69 74 65  ;; This test/ite
4d30: 6d 70 61 74 68 20 69 73 20 6e 6f 74 20 74 6f 20  mpath is not to 
4d40: 62 65 20 72 75 6e 0a 09 09 20 20 3b 3b 20 65 6c  be run...  ;; el
4d50: 73 65 20 74 68 65 20 72 75 6e 20 69 73 20 73 74  se the run is st
4d60: 75 63 6b 2c 20 74 65 6d 70 6f 72 61 72 69 6c 79  uck, temporarily
4d70: 20 6f 72 20 70 65 72 6d 61 6e 65 6e 74 6c 79 0a   or permanently.
4d80: 09 09 20 20 3b 3b 20 62 75 74 20 73 68 6f 75 6c  ..  ;; but shoul
4d90: 64 20 63 68 65 63 6b 20 69 66 20 69 74 20 69 73  d check if it is
4da0: 20 64 75 65 20 74 6f 20 6c 61 63 6b 20 6f 66 20   due to lack of 
4db0: 72 65 73 6f 75 72 63 65 73 20 76 73 2e 20 70 72  resources vs. pr
4dc0: 65 72 65 71 75 69 73 69 74 65 73 0a 09 09 20 20  erequisites...  
4dd0: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
4de0: 6f 20 31 20 22 53 6b 69 70 70 69 6e 67 20 22 20  o 1 "Skipping " 
4df0: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65  (tests:testqueue
4e00: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65  -get-testname te
4e10: 73 74 2d 72 65 63 6f 72 64 29 20 22 20 22 20 69  st-record) " " i
4e20: 74 65 6d 2d 70 61 74 68 20 22 20 61 73 20 69 74  tem-path " as it
4e30: 20 64 6f 65 73 6e 27 74 20 6d 61 74 63 68 20 22   doesn't match "
4e40: 20 74 65 73 74 2d 70 61 74 74 73 29 0a 09 09 20   test-patts)... 
4e50: 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20   (thread-sleep! 
4e60: 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a  *global-delta*).
4e70: 09 09 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75  ..  (if (not (nu
4e80: 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 20 20 20 20  ll? tal))...    
4e90: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c    (loop (car tal
4ea0: 29 28 63 64 72 20 74 61 6c 29 20 72 65 72 75 6e  )(cdr tal) rerun
4eb0: 73 29 29 29 0a 09 09 20 28 20 3b 3b 20 28 61 6e  s)))... ( ;; (an
4ec0: 64 0a 09 09 20 20 28 6e 6f 74 20 28 68 61 73 68  d...  (not (hash
4ed0: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75  -table-ref/defau
4ee0: 6c 74 20 74 65 73 74 2d 72 65 67 69 73 74 65 72  lt test-register
4ef0: 79 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c  y (runs:make-ful
4f00: 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74  l-test-name test
4f10: 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29  -name item-path)
4f20: 20 23 66 29 29 0a 09 09 20 20 20 20 20 20 3b 3b   #f))...      ;;
4f30: 20 28 61 6e 64 20 6d 61 78 2d 63 6f 6e 63 75 72   (and max-concur
4f40: 72 65 6e 74 2d 6a 6f 62 73 20 28 3e 20 28 2d 20  rent-jobs (> (- 
4f50: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a  max-concurrent-j
4f60: 6f 62 73 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29  obs num-running)
4f70: 20 35 29 29 29 0a 09 09 20 20 28 64 65 62 75 67   5)))...  (debug
4f80: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 50  :print-info 4 "P
4f90: 72 65 2d 72 65 67 69 73 74 65 72 69 6e 67 20 74  re-registering t
4fa0: 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20  est " test-name 
4fb0: 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20  "/" item-path " 
4fc0: 74 6f 20 63 72 65 61 74 65 20 70 6c 61 63 65 68  to create placeh
4fd0: 6f 6c 64 65 72 22 20 29 0a 09 09 20 20 28 6f 70  older" )...  (op
4fe0: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a  en-run-close db:
4ff0: 74 65 73 74 73 2d 72 65 67 69 73 74 65 72 2d 74  tests-register-t
5000: 65 73 74 20 23 66 20 72 75 6e 2d 69 64 20 74 65  est #f run-id te
5010: 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74  st-name item-pat
5020: 68 29 0a 09 09 20 20 28 68 61 73 68 2d 74 61 62  h)...  (hash-tab
5030: 6c 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 67  le-set! test-reg
5040: 69 73 74 65 72 79 20 28 72 75 6e 73 3a 6d 61 6b  istery (runs:mak
5050: 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65  e-full-test-name
5060: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d   test-name item-
5070: 70 61 74 68 29 20 23 74 29 0a 09 09 20 20 28 74  path) #t)...  (t
5080: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c  hread-sleep! *gl
5090: 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 28 72 75  obal-delta*).(ru
50a0: 6e 73 3a 73 68 72 69 6e 6b 2d 63 61 6e 2d 72 75  ns:shrink-can-ru
50b0: 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c  n-more-tests-del
50c0: 61 79 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63  ay)...  (loop (c
50d0: 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e  ar newtal)(cdr n
50e0: 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29 29 0a  ewtal) reruns)).
50f0: 09 09 20 28 28 6e 6f 74 20 68 61 76 65 2d 72 65  .. ((not have-re
5100: 73 6f 75 72 63 65 73 29 20 3b 3b 20 73 69 6d 70  sources) ;; simp
5110: 6c 79 20 74 72 79 20 61 67 61 69 6e 20 61 66 74  ly try again aft
5120: 65 72 20 77 61 69 74 69 6e 67 20 61 20 73 65 63  er waiting a sec
5130: 6f 6e 64 0a 09 09 20 20 28 64 65 62 75 67 3a 70  ond...  (debug:p
5140: 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 6e 6f 20  rint-info 1 "no 
5150: 72 65 73 6f 75 72 63 65 73 20 74 6f 20 72 75 6e  resources to run
5160: 20 6e 65 77 20 74 65 73 74 73 2c 20 77 61 69 74   new tests, wait
5170: 69 6e 67 20 2e 2e 2e 22 29 0a 09 09 20 20 28 74  ing ...")...  (t
5180: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20  hread-sleep! (+ 
5190: 32 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a  2 *global-delta*
51a0: 29 29 0a 09 09 20 20 3b 3b 20 63 6f 75 6c 64 20  ))...  ;; could 
51b0: 68 61 76 65 20 64 6f 6e 65 20 68 65 64 20 74 61  have done hed ta
51c0: 6c 20 68 65 72 65 20 62 75 74 20 64 6f 69 6e 67  l here but doing
51d0: 20 63 61 72 2f 63 64 72 20 6f 66 20 6e 65 77 74   car/cdr of newt
51e0: 61 6c 20 74 6f 20 72 6f 74 61 74 65 20 74 65 73  al to rotate tes
51f0: 74 73 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61  ts...  (loop (ca
5200: 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65  r newtal)(cdr ne
5210: 77 74 61 6c 29 20 72 65 72 75 6e 73 29 29 0a 09  wtal) reruns))..
5220: 09 20 28 28 61 6e 64 20 68 61 76 65 2d 72 65 73  . ((and have-res
5230: 6f 75 72 63 65 73 0a 09 09 20 20 20 20 20 20 20  ources...       
5240: 28 6f 72 20 28 6e 75 6c 6c 3f 20 70 72 65 72 65  (or (null? prere
5250: 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09 09 20  qs-not-met).... 
5260: 20 20 28 61 6e 64 20 28 65 71 3f 20 74 65 73 74    (and (eq? test
5270: 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c 29 0a  mode 'toplevel).
5280: 09 09 09 09 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63  ....(null? non-c
5290: 6f 6d 70 6c 65 74 65 64 29 29 29 29 0a 09 09 20  ompleted))))... 
52a0: 20 28 72 75 6e 3a 74 65 73 74 20 72 75 6e 2d 69   (run:test run-i
52b0: 64 20 72 75 6e 6e 61 6d 65 20 6b 65 79 76 61 6c  d runname keyval
52c0: 6c 73 74 20 74 65 73 74 2d 72 65 63 6f 72 64 20  lst test-record 
52d0: 66 6c 61 67 73 20 23 66 29 0a 28 72 75 6e 73 3a  flags #f).(runs:
52e0: 73 68 72 69 6e 6b 2d 63 61 6e 2d 72 75 6e 2d 6d  shrink-can-run-m
52f0: 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c 61 79 29  ore-tests-delay)
5300: 0a 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65  ...  (thread-sle
5310: 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74  ep! *global-delt
5320: 61 2a 29 0a 09 09 20 20 28 69 66 20 28 6e 6f 74  a*)...  (if (not
5330: 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09   (null? tal))...
5340: 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72        (loop (car
5350: 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 20 72   tal)(cdr tal) r
5360: 65 72 75 6e 73 29 29 29 0a 09 09 20 28 65 6c 73  eruns)))... (els
5370: 65 20 3b 3b 20 6d 75 73 74 20 62 65 20 77 65 20  e ;; must be we 
5380: 68 61 76 65 20 75 6e 6d 65 74 20 70 72 65 72 65  have unmet prere
5390: 71 75 69 73 69 74 65 73 0a 09 09 20 20 20 20 28  quisites...    (
53a0: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 46  debug:print 4 "F
53b0: 41 49 4c 53 3a 20 22 20 66 61 69 6c 73 29 0a 09  AILS: " fails)..
53c0: 09 20 20 20 20 3b 3b 20 49 66 20 6f 6e 65 20 6f  .    ;; If one o
53d0: 72 20 6d 6f 72 65 20 6f 66 20 74 68 65 20 70 72  r more of the pr
53e0: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 61 72  ereqs-not-met ar
53f0: 65 20 46 41 49 4c 20 74 68 65 6e 20 77 65 20 63  e FAIL then we c
5400: 61 6e 20 69 73 73 75 65 0a 09 09 20 20 20 20 3b  an issue...    ;
5410: 3b 20 61 20 6d 65 73 73 61 67 65 20 61 6e 64 20  ; a message and 
5420: 64 72 6f 70 20 68 65 64 20 66 72 6f 6d 20 74 68  drop hed from th
5430: 65 20 69 74 65 6d 73 20 74 6f 20 62 65 20 70 72  e items to be pr
5440: 6f 63 65 73 73 65 64 2e 0a 09 09 20 20 20 20 28  ocessed....    (
5450: 69 66 20 28 6e 75 6c 6c 3f 20 66 61 69 6c 73 29  if (null? fails)
5460: 0a 09 09 09 28 62 65 67 69 6e 0a 09 09 09 20 20  ....(begin....  
5470: 3b 3b 20 63 6f 75 6c 64 6e 27 74 20 72 75 6e 2c  ;; couldn't run,
5480: 20 74 61 6b 65 20 61 20 62 72 65 61 74 68 65 72   take a breather
5490: 0a 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 69  ....  (debug:pri
54a0: 6e 74 2d 69 6e 66 6f 20 34 20 22 53 68 6f 75 6c  nt-info 4 "Shoul
54b0: 64 6e 27 74 20 72 65 61 6c 6c 79 20 67 65 74 20  dn't really get 
54c0: 68 65 72 65 2c 20 72 61 63 65 20 63 6f 6e 64 69  here, race condi
54d0: 74 69 6f 6e 3f 20 55 6e 61 62 6c 65 20 74 6f 20  tion? Unable to 
54e0: 6c 61 75 6e 63 68 20 6d 6f 72 65 20 74 65 73 74  launch more test
54f0: 73 20 61 74 20 74 68 69 73 20 6d 6f 6d 65 6e 74  s at this moment
5500: 2c 20 6b 69 6c 6c 69 6e 67 20 74 69 6d 65 20 2e  , killing time .
5510: 2e 2e 22 29 0a 09 09 09 20 20 28 74 68 72 65 61  ..")....  (threa
5520: 64 2d 73 6c 65 65 70 21 20 28 2b 20 30 2e 30 31  d-sleep! (+ 0.01
5530: 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29   *global-delta*)
5540: 29 20 3b 3b 20 6c 6f 6e 67 20 73 6c 65 65 70 20  ) ;; long sleep 
5550: 68 65 72 65 20 2d 20 6e 6f 20 72 65 73 6f 75 72  here - no resour
5560: 63 65 73 2c 20 6d 61 79 20 61 73 20 77 65 6c 6c  ces, may as well
5570: 20 62 65 20 70 61 74 69 65 6e 74 0a 09 09 09 20   be patient.... 
5580: 20 3b 3b 20 77 65 20 6d 61 64 65 20 6e 65 77 20   ;; we made new 
5590: 74 61 6c 20 62 79 20 73 74 69 63 6b 69 6e 67 20  tal by sticking 
55a0: 68 65 64 20 61 74 20 74 68 65 20 62 61 63 6b 20  hed at the back 
55b0: 6f 66 20 74 68 65 20 6c 69 73 74 0a 09 09 09 20  of the list.... 
55c0: 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74   (loop (car newt
55d0: 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20  al)(cdr newtal) 
55e0: 72 65 72 75 6e 73 29 29 0a 09 09 09 3b 3b 20 74  reruns))....;; t
55f0: 68 65 20 77 61 69 74 6f 6e 20 69 73 20 46 41 49  he waiton is FAI
5600: 4c 20 73 6f 20 6e 6f 20 70 6f 69 6e 74 20 69 6e  L so no point in
5610: 20 74 72 79 69 6e 67 20 74 6f 20 72 75 6e 20 68   trying to run h
5620: 65 64 20 65 76 65 72 20 61 67 61 69 6e 0a 09 09  ed ever again...
5630: 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f  .(if (not (null?
5640: 20 74 61 6c 29 29 0a 09 09 09 20 20 20 20 28 69   tal))....    (i
5650: 66 20 28 76 65 63 74 6f 72 3f 20 68 65 64 29 0a  f (vector? hed).
5660: 09 09 09 09 28 62 65 67 69 6e 20 28 64 65 62 75  ....(begin (debu
5670: 67 3a 70 72 69 6e 74 20 31 20 22 57 41 52 4e 3a  g:print 1 "WARN:
5680: 20 44 72 6f 70 70 69 6e 67 20 74 65 73 74 20 22   Dropping test "
5690: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65   (db:test-get-te
56a0: 73 74 6e 61 6d 65 20 68 65 64 29 20 22 2f 22 20  stname hed) "/" 
56b0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65  (db:test-get-ite
56c0: 6d 2d 70 61 74 68 20 68 65 64 29 0a 09 09 09 09  m-path hed).....
56d0: 09 09 20 20 20 20 22 20 66 72 6f 6d 20 74 68 65  ..    " from the
56e0: 20 6c 61 75 6e 63 68 20 6c 69 73 74 20 61 73 20   launch list as 
56f0: 69 74 20 68 61 73 20 70 72 65 72 65 71 75 69 73  it has prerequis
5700: 74 65 73 20 74 68 61 74 20 61 72 65 20 46 41 49  tes that are FAI
5710: 4c 22 29 0a 28 72 75 6e 73 3a 73 68 72 69 6e 6b  L").(runs:shrink
5720: 2d 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65  -can-run-more-te
5730: 73 74 73 2d 64 65 6c 61 79 29 0a 09 09 09 09 20  sts-delay)..... 
5740: 20 20 20 20 20 20 28 74 68 72 65 61 64 2d 73 6c        (thread-sl
5750: 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c  eep! *global-del
5760: 74 61 2a 29 0a 09 09 09 09 20 20 20 20 20 20 20  ta*).....       
5770: 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28  (loop (car tal)(
5780: 63 64 72 20 74 61 6c 29 20 28 63 6f 6e 73 20 68  cdr tal) (cons h
5790: 65 64 20 72 65 72 75 6e 73 29 29 29 0a 09 09 09  ed reruns)))....
57a0: 09 28 62 65 67 69 6e 0a 09 09 09 09 20 20 28 64  .(begin.....  (d
57b0: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 57 41  ebug:print 1 "WA
57c0: 52 4e 3a 20 54 65 73 74 20 6e 6f 74 20 70 72 6f  RN: Test not pro
57d0: 63 65 73 73 65 64 20 63 6f 72 72 65 63 74 6c 79  cessed correctly
57e0: 2e 20 43 6f 75 6c 64 20 62 65 20 61 20 72 61 63  . Could be a rac
57f0: 65 20 63 6f 6e 64 69 74 69 6f 6e 20 69 6e 20 79  e condition in y
5800: 6f 75 72 20 74 65 73 74 20 69 6d 70 6c 65 6d 65  our test impleme
5810: 6e 74 61 74 69 6f 6e 3f 20 22 20 68 65 64 29 20  ntation? " hed) 
5820: 3b 3b 20 20 22 20 61 73 20 69 74 20 68 61 73 20  ;;  " as it has 
5830: 70 72 65 72 65 71 75 69 73 74 65 73 20 74 68 61  prerequistes tha
5840: 74 20 61 72 65 20 46 41 49 4c 2e 20 28 4e 4f 54  t are FAIL. (NOT
5850: 45 3a 20 68 65 64 20 69 73 20 6e 6f 74 20 61 20  E: hed is not a 
5860: 76 65 63 74 6f 72 29 22 29 0a 28 72 75 6e 73 3a  vector)").(runs:
5870: 73 68 72 69 6e 6b 2d 63 61 6e 2d 72 75 6e 2d 6d  shrink-can-run-m
5880: 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c 61 79 29  ore-tests-delay)
5890: 0a 09 09 09 09 20 20 28 74 68 72 65 61 64 2d 73  .....  (thread-s
58a0: 6c 65 65 70 21 20 28 2b 20 30 2e 30 31 20 2a 67  leep! (+ 0.01 *g
58b0: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09  lobal-delta*))..
58c0: 09 09 09 20 20 28 6c 6f 6f 70 20 68 65 64 20 74  ...  (loop hed t
58d0: 61 6c 20 72 65 72 75 6e 73 29 29 29 29 29 29 29  al reruns)))))))
58e0: 29 29 20 3b 3b 20 45 4e 44 20 4f 46 20 49 4e 4e  )) ;; END OF INN
58f0: 45 52 20 43 4f 4e 44 0a 09 20 20 20 20 20 0a 09  ER COND..     ..
5900: 20 20 20 20 20 3b 3b 20 63 61 73 65 20 77 68 65       ;; case whe
5910: 72 65 20 61 6e 20 69 74 65 6d 73 20 63 61 6d 65  re an items came
5920: 20 69 6e 20 61 73 20 61 20 6c 69 73 74 20 62 65   in as a list be
5930: 65 6e 20 70 72 6f 63 65 73 73 65 64 0a 09 20 20  en processed..  
5940: 20 20 20 28 28 61 6e 64 20 28 6c 69 73 74 3f 20     ((and (list? 
5950: 69 74 65 6d 73 29 20 20 20 20 20 3b 3b 20 74 68  items)     ;; th
5960: 75 73 20 77 65 20 6b 6e 6f 77 20 6f 75 72 20 69  us we know our i
5970: 74 65 6d 73 20 61 72 65 20 61 6c 72 65 61 64 79  tems are already
5980: 20 63 61 6c 63 75 6c 61 74 65 64 0a 09 09 20 20   calculated...  
5990: 20 28 6e 6f 74 20 20 20 69 74 65 6d 64 61 74 29   (not   itemdat)
59a0: 29 20 3b 3b 20 61 6e 64 20 6e 6f 74 20 79 65 74  ) ;; and not yet
59b0: 20 65 78 70 61 6e 64 65 64 20 69 6e 74 6f 20 74   expanded into t
59c0: 68 65 20 6c 69 73 74 20 6f 66 20 74 68 69 6e 67  he list of thing
59d0: 73 20 74 6f 20 62 65 20 64 6f 6e 65 0a 09 20 20  s to be done..  
59e0: 20 20 20 20 28 69 66 20 28 61 6e 64 20 28 64 65      (if (and (de
59f0: 62 75 67 3a 64 65 62 75 67 2d 6d 6f 64 65 20 31  bug:debug-mode 1
5a00: 29 20 3b 3b 20 28 3e 3d 20 2a 76 65 72 62 6f 73  ) ;; (>= *verbos
5a10: 69 74 79 2a 20 31 29 0a 09 09 20 20 20 20 20 20  ity* 1)...      
5a20: 20 28 3e 20 28 6c 65 6e 67 74 68 20 69 74 65 6d   (> (length item
5a30: 73 29 20 30 29 0a 09 09 20 20 20 20 20 20 20 28  s) 0)...       (
5a40: 3e 20 28 6c 65 6e 67 74 68 20 28 63 61 72 20 69  > (length (car i
5a50: 74 65 6d 73 29 29 20 30 29 29 0a 09 09 20 20 28  tems)) 0))...  (
5a60: 70 70 20 69 74 65 6d 73 29 29 0a 09 20 20 20 20  pp items))..    
5a70: 20 20 28 66 6f 72 2d 65 61 63 68 0a 09 20 20 20    (for-each..   
5a80: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6d 79 2d      (lambda (my-
5a90: 69 74 65 6d 64 61 74 29 0a 09 09 20 28 6c 65 74  itemdat)... (let
5aa0: 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d 72 65 63  * ((new-test-rec
5ab0: 6f 72 64 20 28 6c 65 74 20 28 28 6e 65 77 72 65  ord (let ((newre
5ac0: 63 20 28 6d 61 6b 65 2d 74 65 73 74 73 3a 74 65  c (make-tests:te
5ad0: 73 74 71 75 65 75 65 29 29 29 0a 09 09 09 09 09  stqueue)))......
5ae0: 20 20 20 28 76 65 63 74 6f 72 2d 63 6f 70 79 21     (vector-copy!
5af0: 20 74 65 73 74 2d 72 65 63 6f 72 64 20 6e 65 77   test-record new
5b00: 72 65 63 29 0a 09 09 09 09 09 20 20 20 6e 65 77  rec)......   new
5b10: 72 65 63 29 29 0a 09 09 09 28 6d 79 2d 69 74 65  rec))....(my-ite
5b20: 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 73  m-path (item-lis
5b30: 74 2d 3e 70 61 74 68 20 6d 79 2d 69 74 65 6d 64  t->path my-itemd
5b40: 61 74 29 29 29 0a 09 09 20 20 20 28 69 66 20 28  at)))...   (if (
5b50: 74 65 73 74 73 3a 6d 61 74 63 68 20 74 65 73 74  tests:match test
5b60: 2d 70 61 74 74 73 20 68 65 64 20 6d 79 2d 69 74  -patts hed my-it
5b70: 65 6d 2d 70 61 74 68 29 20 3b 3b 20 28 70 61 74  em-path) ;; (pat
5b80: 74 2d 6c 69 73 74 2d 6d 61 74 63 68 20 6d 79 2d  t-list-match my-
5b90: 69 74 65 6d 2d 70 61 74 68 20 69 74 65 6d 2d 70  item-path item-p
5ba0: 61 74 74 73 29 20 20 20 20 20 20 20 20 20 20 20  atts)           
5bb0: 3b 3b 20 79 65 73 2c 20 77 65 20 77 61 6e 74 20  ;; yes, we want 
5bc0: 74 6f 20 70 72 6f 63 65 73 73 20 74 68 69 73 20  to process this 
5bd0: 69 74 65 6d 2c 20 4e 4f 54 45 3a 20 53 68 6f 75  item, NOTE: Shou
5be0: 6c 64 20 6e 6f 74 20 6e 65 65 64 20 74 68 69 73  ld not need this
5bf0: 20 63 68 65 63 6b 20 68 65 72 65 21 0a 09 09 20   check here!... 
5c00: 20 20 20 20 20 20 28 6c 65 74 20 28 28 6e 65 77        (let ((new
5c10: 74 65 73 74 6e 61 6d 65 20 28 72 75 6e 73 3a 6d  testname (runs:m
5c20: 61 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61  ake-full-test-na
5c30: 6d 65 20 68 65 64 20 6d 79 2d 69 74 65 6d 2d 70  me hed my-item-p
5c40: 61 74 68 29 29 29 20 20 20 20 3b 3b 20 74 65 73  ath)))    ;; tes
5c50: 74 20 6e 61 6d 65 73 20 61 72 65 20 75 6e 69 71  t names are uniq
5c60: 75 65 20 6f 6e 20 74 65 73 74 6e 61 6d 65 2f 69  ue on testname/i
5c70: 74 65 6d 2d 70 61 74 68 0a 09 09 09 20 28 74 65  tem-path.... (te
5c80: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65  sts:testqueue-se
5c90: 74 2d 69 74 65 6d 73 21 20 20 20 20 20 6e 65 77  t-items!     new
5ca0: 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 23 66 29  -test-record #f)
5cb0: 0a 09 09 09 20 28 74 65 73 74 73 3a 74 65 73 74  .... (tests:test
5cc0: 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 64 61  queue-set-itemda
5cd0: 74 21 20 20 20 6e 65 77 2d 74 65 73 74 2d 72 65  t!   new-test-re
5ce0: 63 6f 72 64 20 6d 79 2d 69 74 65 6d 64 61 74 29  cord my-itemdat)
5cf0: 0a 09 09 09 20 28 74 65 73 74 73 3a 74 65 73 74  .... (tests:test
5d00: 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 5f 70  queue-set-item_p
5d10: 61 74 68 21 20 6e 65 77 2d 74 65 73 74 2d 72 65  ath! new-test-re
5d20: 63 6f 72 64 20 6d 79 2d 69 74 65 6d 2d 70 61 74  cord my-item-pat
5d30: 68 29 0a 09 09 09 20 28 68 61 73 68 2d 74 61 62  h).... (hash-tab
5d40: 6c 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 63  le-set! test-rec
5d50: 6f 72 64 73 20 6e 65 77 74 65 73 74 6e 61 6d 65  ords newtestname
5d60: 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64   new-test-record
5d70: 29 0a 09 09 09 20 28 73 65 74 21 20 74 61 6c 20  ).... (set! tal 
5d80: 28 63 6f 6e 73 20 6e 65 77 74 65 73 74 6e 61 6d  (cons newtestnam
5d90: 65 20 74 61 6c 29 29 29 29 29 29 20 3b 3b 20 73  e tal)))))) ;; s
5da0: 69 6e 63 65 20 74 68 65 73 65 20 61 72 65 20 69  ince these are i
5db0: 74 65 6d 69 7a 65 64 20 63 72 65 61 74 65 20 6e  temized create n
5dc0: 65 77 20 74 65 73 74 20 6e 61 6d 65 73 20 74 65  ew test names te
5dd0: 73 74 6e 61 6d 65 2f 69 74 65 6d 70 61 74 68 0a  stname/itempath.
5de0: 09 20 20 20 20 20 20 20 69 74 65 6d 73 29 0a 09  .       items)..
5df0: 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28        (if (not (
5e00: 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 20 20  null? tal))...  
5e10: 28 62 65 67 69 6e 0a 09 09 20 20 20 20 28 64 65  (begin...    (de
5e20: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34  bug:print-info 4
5e30: 20 22 45 6e 64 20 6f 66 20 69 74 65 6d 73 20 6c   "End of items l
5e40: 69 73 74 2c 20 6c 6f 6f 70 69 6e 67 20 77 69 74  ist, looping wit
5e50: 68 20 6e 65 78 74 20 61 66 74 65 72 20 73 68 6f  h next after sho
5e60: 72 74 20 64 65 6c 61 79 22 29 0a 09 09 20 20 20  rt delay")...   
5e70: 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20   (thread-sleep! 
5e80: 28 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d  (+ 0.01 *global-
5e90: 64 65 6c 74 61 2a 29 29 0a 09 09 20 20 20 20 28  delta*))...    (
5ea0: 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63  loop (car tal)(c
5eb0: 64 72 20 74 61 6c 29 20 72 65 72 75 6e 73 29 29  dr tal) reruns))
5ec0: 29 29 0a 0a 09 20 20 20 20 20 3b 3b 20 69 66 20  ))...     ;; if 
5ed0: 69 74 65 6d 73 20 69 73 20 61 20 70 72 6f 63 20  items is a proc 
5ee0: 74 68 65 6e 20 6e 65 65 64 20 74 6f 20 72 75 6e  then need to run
5ef0: 20 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73   items:get-items
5f00: 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 2c 20 67 65  -from-config, ge
5f10: 74 20 74 68 65 20 6c 69 73 74 20 61 6e 64 20 6c  t the list and l
5f20: 6f 6f 70 20 0a 09 20 20 20 20 20 3b 3b 20 20 20  oop ..     ;;   
5f30: 20 2d 20 62 75 74 20 6f 6e 6c 79 20 64 6f 20 74   - but only do t
5f40: 68 61 74 20 69 66 20 72 65 73 6f 75 72 63 65 73  hat if resources
5f50: 20 65 78 69 73 74 20 74 6f 20 6b 69 63 6b 20 6f   exist to kick o
5f60: 66 66 20 74 68 65 20 6a 6f 62 0a 09 20 20 20 20  ff the job..    
5f70: 20 28 28 6f 72 20 28 70 72 6f 63 65 64 75 72 65   ((or (procedure
5f80: 3f 20 69 74 65 6d 73 29 28 65 71 3f 20 69 74 65  ? items)(eq? ite
5f90: 6d 73 20 27 68 61 76 65 2d 70 72 6f 63 65 64 75  ms 'have-procedu
5fa0: 72 65 29 29 0a 09 20 20 20 20 20 20 28 6c 65 74  re))..      (let
5fb0: 20 28 28 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 20   ((can-run-more 
5fc0: 20 20 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e     (runs:can-run
5fd0: 2d 6d 6f 72 65 2d 74 65 73 74 73 20 74 65 73 74  -more-tests test
5fe0: 2d 72 65 63 6f 72 64 29 29 29 0a 09 09 28 69 66  -record)))...(if
5ff0: 20 28 61 6e 64 20 28 6c 69 73 74 3f 20 63 61 6e   (and (list? can
6000: 2d 72 75 6e 2d 6d 6f 72 65 29 0a 09 09 09 20 28  -run-more).... (
6010: 63 61 72 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65  car can-run-more
6020: 29 29 0a 09 09 20 20 20 20 28 6c 65 74 2a 20 28  ))...    (let* (
6030: 28 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74  (prereqs-not-met
6040: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
6050: 20 64 62 3a 67 65 74 2d 70 72 65 72 65 71 73 2d   db:get-prereqs-
6060: 6e 6f 74 2d 6d 65 74 20 23 66 20 72 75 6e 2d 69  not-met #f run-i
6070: 64 20 77 61 69 74 6f 6e 73 20 69 74 65 6d 2d 70  d waitons item-p
6080: 61 74 68 20 6d 6f 64 65 3a 20 74 65 73 74 6d 6f  ath mode: testmo
6090: 64 65 29 29 0a 09 09 09 20 20 20 28 66 61 69 6c  de))....   (fail
60a0: 73 20 20 20 20 20 20 20 20 20 20 20 28 72 75 6e  s           (run
60b0: 73 3a 63 61 6c 63 2d 66 61 69 6c 73 20 70 72 65  s:calc-fails pre
60c0: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 09  reqs-not-met))..
60d0: 09 09 20 20 20 28 6e 6f 6e 2d 63 6f 6d 70 6c 65  ..   (non-comple
60e0: 74 65 64 20 20 20 28 72 75 6e 73 3a 63 61 6c 63  ted   (runs:calc
60f0: 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 74 65 64 20 70  -not-completed p
6100: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29  rereqs-not-met))
6110: 29 0a 09 09 20 20 20 20 20 20 28 64 65 62 75 67  )...      (debug
6120: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 38 20 22 63  :print-info 8 "c
6130: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 3a 20 22 20 63  an-run-more: " c
6140: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 0a 09 09 09 09  an-run-more.....
6150: 20 20 20 22 5c 6e 20 74 65 73 74 6e 61 6d 65 3a     "\n testname:
6160: 20 20 20 20 20 20 20 20 22 20 68 65 64 0a 09 09          " hed...
6170: 09 09 20 20 20 22 5c 6e 20 70 72 65 72 65 71 73  ..   "\n prereqs
6180: 2d 6e 6f 74 2d 6d 65 74 3a 20 22 20 28 72 75 6e  -not-met: " (run
6190: 73 3a 70 72 65 74 74 79 2d 73 74 72 69 6e 67 20  s:pretty-string 
61a0: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29  prereqs-not-met)
61b0: 0a 09 09 09 09 20 20 20 22 5c 6e 20 6e 6f 6e 2d  .....   "\n non-
61c0: 63 6f 6d 70 6c 65 74 65 64 3a 20 20 20 22 20 28  completed:   " (
61d0: 72 75 6e 73 3a 70 72 65 74 74 79 2d 73 74 72 69  runs:pretty-stri
61e0: 6e 67 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64  ng non-completed
61f0: 29 20 0a 09 09 09 09 20 20 20 22 5c 6e 20 66 61  ) .....   "\n fa
6200: 69 6c 73 3a 20 20 20 20 20 20 20 20 20 20 20 22  ils:           "
6210: 20 28 72 75 6e 73 3a 70 72 65 74 74 79 2d 73 74   (runs:pretty-st
6220: 72 69 6e 67 20 66 61 69 6c 73 29 0a 09 09 09 09  ring fails).....
6230: 20 20 20 22 5c 6e 20 74 65 73 74 6d 6f 64 65 3a     "\n testmode:
6240: 20 20 20 20 20 20 20 20 22 20 74 65 73 74 6d 6f          " testmo
6250: 64 65 0a 09 09 09 09 20 20 20 22 5c 6e 20 6e 75  de.....   "\n nu
6260: 6d 2d 72 65 74 72 69 65 73 3a 20 20 20 20 20 22  m-retries:     "
6270: 20 6e 75 6d 2d 72 65 74 72 69 65 73 0a 09 09 09   num-retries....
6280: 09 20 20 20 22 5c 6e 20 28 65 71 3f 20 74 65 73  .   "\n (eq? tes
6290: 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c 29  tmode 'toplevel)
62a0: 3a 20 22 20 28 65 71 3f 20 74 65 73 74 6d 6f 64  : " (eq? testmod
62b0: 65 20 27 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09  e 'toplevel)....
62c0: 09 20 20 20 22 5c 6e 20 28 6e 75 6c 6c 3f 20 6e  .   "\n (null? n
62d0: 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 3a 20 20  on-completed):  
62e0: 20 20 22 20 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63    " (null? non-c
62f0: 6f 6d 70 6c 65 74 65 64 29 0a 09 09 09 09 20 20  ompleted).....  
6300: 20 22 5c 6e 20 72 65 72 75 6e 73 3a 20 20 20 20   "\n reruns:    
6310: 20 20 20 20 20 20 22 20 72 65 72 75 6e 73 0a 09        " reruns..
6320: 09 09 09 20 20 20 22 5c 6e 20 69 74 65 6d 73 3a  ...   "\n items:
6330: 20 20 20 20 20 20 20 20 20 20 20 22 20 69 74 65             " ite
6340: 6d 73 0a 09 09 09 09 20 20 20 22 5c 6e 20 63 61  ms.....   "\n ca
6350: 6e 2d 72 75 6e 2d 6d 6f 72 65 3a 20 20 20 20 22  n-run-more:    "
6360: 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 29 0a 09   can-run-more)..
6370: 09 20 20 20 20 20 20 3b 3b 20 28 74 68 72 65 61  .      ;; (threa
6380: 64 2d 73 6c 65 65 70 21 20 28 2b 20 30 2e 30 31  d-sleep! (+ 0.01
6390: 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29   *global-delta*)
63a0: 29 0a 09 09 20 20 20 20 20 20 28 63 6f 6e 64 20  )...      (cond 
63b0: 3b 3b 20 49 4e 4e 45 52 20 43 4f 4e 44 20 23 32  ;; INNER COND #2
63c0: 0a 09 09 20 20 20 20 20 20 20 28 28 6f 72 20 28  ...       ((or (
63d0: 6e 75 6c 6c 3f 20 70 72 65 72 65 71 73 2d 6e 6f  null? prereqs-no
63e0: 74 2d 6d 65 74 29 20 3b 3b 20 61 6c 6c 20 70 72  t-met) ;; all pr
63f0: 65 72 65 71 73 20 6d 65 74 2c 20 66 69 72 65 20  ereqs met, fire 
6400: 6f 66 66 20 74 68 65 20 74 65 73 74 0a 09 09 09  off the test....
6410: 20 20 20 20 3b 3b 20 6f 72 2c 20 69 66 20 69 74      ;; or, if it
6420: 20 69 73 20 61 20 27 74 6f 70 6c 65 76 65 6c 20   is a 'toplevel 
6430: 74 65 73 74 20 61 6e 64 20 61 6c 6c 20 70 72 65  test and all pre
6440: 72 65 71 73 20 6e 6f 74 20 6d 65 74 20 61 72 65  reqs not met are
6450: 20 43 4f 4d 50 4c 45 54 45 44 20 74 68 65 6e 20   COMPLETED then 
6460: 6c 61 75 6e 63 68 0a 09 09 09 20 20 20 20 28 61  launch....    (a
6470: 6e 64 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 65  nd (eq? testmode
6480: 20 27 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09   'toplevel).....
6490: 20 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70   (null? non-comp
64a0: 6c 65 74 65 64 29 29 29 0a 09 09 09 28 6c 65 74  leted)))....(let
64b0: 20 28 28 74 65 73 74 2d 6e 61 6d 65 20 28 74 65   ((test-name (te
64c0: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65  sts:testqueue-ge
64d0: 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d  t-testname test-
64e0: 72 65 63 6f 72 64 29 29 29 0a 09 09 09 20 20 28  record)))....  (
64f0: 73 65 74 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f  setenv "MT_TEST_
6500: 4e 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65 29  NAME" test-name)
6510: 20 3b 3b 20 0a 09 09 09 20 20 28 73 65 74 65 6e   ;; ....  (seten
6520: 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20  v "MT_RUNNAME"  
6530: 20 72 75 6e 6e 61 6d 65 29 0a 09 09 09 20 20 28   runname)....  (
6540: 73 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76  set-megatest-env
6550: 2d 76 61 72 73 20 72 75 6e 2d 69 64 29 20 3b 3b  -vars run-id) ;;
6560: 20 74 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65   these may be ne
6570: 65 64 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e  eded by the laun
6580: 63 68 69 6e 67 20 70 72 6f 63 65 73 73 0a 09 09  ching process...
6590: 09 20 20 28 6c 65 74 20 28 28 69 74 65 6d 73 2d  .  (let ((items-
65a0: 6c 69 73 74 20 28 69 74 65 6d 73 3a 67 65 74 2d  list (items:get-
65b0: 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69  items-from-confi
65c0: 67 20 74 63 6f 6e 66 69 67 29 29 29 0a 09 09 09  g tconfig)))....
65d0: 20 20 20 20 28 69 66 20 28 6c 69 73 74 3f 20 69      (if (list? i
65e0: 74 65 6d 73 2d 6c 69 73 74 29 0a 09 09 09 09 28  tems-list).....(
65f0: 62 65 67 69 6e 0a 09 09 09 09 20 20 28 74 65 73  begin.....  (tes
6600: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74  ts:testqueue-set
6610: 2d 69 74 65 6d 73 21 20 74 65 73 74 2d 72 65 63  -items! test-rec
6620: 6f 72 64 20 69 74 65 6d 73 2d 6c 69 73 74 29 0a  ord items-list).
6630: 09 09 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c  ....  (thread-sl
6640: 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c  eep! *global-del
6650: 74 61 2a 29 0a 09 09 09 09 20 20 28 6c 6f 6f 70  ta*).....  (loop
6660: 20 68 65 64 20 74 61 6c 20 72 65 72 75 6e 73 29   hed tal reruns)
6670: 29 0a 09 09 09 09 28 62 65 67 69 6e 0a 09 09 09  ).....(begin....
6680: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  .  (debug:print 
6690: 30 20 22 45 52 52 4f 52 3a 20 54 68 65 20 70 72  0 "ERROR: The pr
66a0: 6f 63 20 66 72 6f 6d 20 72 65 61 64 69 6e 67 20  oc from reading 
66b0: 74 68 65 20 73 65 74 75 70 20 64 69 64 20 6e 6f  the setup did no
66c0: 74 20 79 69 65 6c 64 20 61 20 6c 69 73 74 20 2d  t yield a list -
66d0: 20 70 6c 65 61 73 65 20 72 65 70 6f 72 74 20 74   please report t
66e0: 68 69 73 22 29 0a 09 09 09 09 20 20 28 65 78 69  his").....  (exi
66f0: 74 20 31 29 29 29 29 29 29 0a 09 09 20 20 20 20  t 1))))))...    
6700: 20 20 20 28 28 6e 75 6c 6c 3f 20 66 61 69 6c 73     ((null? fails
6710: 29 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e  )....(debug:prin
6720: 74 2d 69 6e 66 6f 20 34 20 22 66 61 69 6c 73 20  t-info 4 "fails 
6730: 69 73 20 6e 75 6c 6c 2c 20 6d 6f 76 69 6e 67 20  is null, moving 
6740: 6f 6e 20 69 6e 20 74 68 65 20 71 75 65 75 65 20  on in the queue 
6750: 62 75 74 20 6b 65 65 70 69 6e 67 20 22 20 68 65  but keeping " he
6760: 64 20 22 20 66 6f 72 20 6e 6f 77 22 29 0a 09 09  d " for now")...
6770: 09 3b 3b 20 6f 6e 6c 79 20 69 6e 63 72 65 6d 65  .;; only increme
6780: 6e 74 20 6e 75 6d 2d 72 65 74 72 69 65 73 20 77  nt num-retries w
6790: 68 65 6e 20 74 68 65 72 65 20 61 72 65 20 6e 6f  hen there are no
67a0: 20 74 65 73 74 73 20 72 75 6e 69 6e 67 0a 09 09   tests runing...
67b0: 09 28 69 66 20 28 65 71 3f 20 30 20 28 6c 69 73  .(if (eq? 0 (lis
67c0: 74 2d 72 65 66 20 63 61 6e 2d 72 75 6e 2d 6d 6f  t-ref can-run-mo
67d0: 72 65 20 31 29 29 0a 09 09 09 20 20 20 20 28 62  re 1))....    (b
67e0: 65 67 69 6e 0a 09 09 09 20 20 20 20 20 20 28 69  egin....      (i
67f0: 66 20 28 3e 20 6e 75 6d 2d 72 65 74 72 69 65 73  f (> num-retries
6800: 20 31 30 30 29 20 3b 3b 20 66 69 72 73 74 20 31   100) ;; first 1
6810: 30 30 20 72 65 74 72 69 65 73 20 61 72 65 20 6c  00 retries are l
6820: 6f 77 20 74 69 6d 65 20 63 6f 73 74 0a 09 09 09  ow time cost....
6830: 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70  .  (thread-sleep
6840: 21 20 28 2b 20 32 20 2a 67 6c 6f 62 61 6c 2d 64  ! (+ 2 *global-d
6850: 65 6c 74 61 2a 29 29 0a 09 09 09 09 20 20 28 74  elta*)).....  (t
6860: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20  hread-sleep! (+ 
6870: 30 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c  0.01 *global-del
6880: 74 61 2a 29 29 29 0a 09 09 09 20 20 20 20 20 20  ta*)))....      
6890: 28 73 65 74 21 20 6e 75 6d 2d 72 65 74 72 69 65  (set! num-retrie
68a0: 73 20 28 2b 20 6e 75 6d 2d 72 65 74 72 69 65 73  s (+ num-retries
68b0: 20 31 29 29 29 29 0a 09 09 09 28 69 66 20 28 3e   1))))....(if (>
68c0: 20 6e 75 6d 2d 72 65 74 72 69 65 73 20 20 6d 61   num-retries  ma
68d0: 78 2d 72 65 74 72 69 65 73 29 0a 09 09 09 20 20  x-retries)....  
68e0: 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c    (if (not (null
68f0: 3f 20 74 61 6c 29 29 0a 09 09 09 09 28 6c 6f 6f  ? tal)).....(loo
6900: 70 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20  p (car tal)(cdr 
6910: 74 61 6c 29 20 72 65 72 75 6e 73 29 29 0a 09 09  tal) reruns))...
6920: 09 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20  .    (loop (car 
6930: 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74  newtal)(cdr newt
6940: 61 6c 29 20 72 65 72 75 6e 73 29 29 29 20 3b 3b  al) reruns))) ;;
6950: 20 61 6e 20 69 73 73 75 65 20 77 69 74 68 20 70   an issue with p
6960: 72 65 72 65 71 73 20 6e 6f 74 20 79 65 74 20 6d  rereqs not yet m
6970: 65 74 3f 0a 09 09 20 20 20 20 20 20 20 28 28 61  et?...       ((a
6980: 6e 64 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 66  nd (not (null? f
6990: 61 69 6c 73 29 29 28 65 71 3f 20 74 65 73 74 6d  ails))(eq? testm
69a0: 6f 64 65 20 27 6e 6f 72 6d 61 6c 29 29 0a 09 09  ode 'normal))...
69b0: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e  .(debug:print-in
69c0: 66 6f 20 31 20 22 74 65 73 74 20 22 20 20 68 65  fo 1 "test "  he
69d0: 64 20 22 20 28 6d 6f 64 65 3d 22 20 74 65 73 74  d " (mode=" test
69e0: 6d 6f 64 65 20 22 29 20 68 61 73 20 66 61 69 6c  mode ") has fail
69f0: 65 64 20 70 72 65 72 65 71 75 69 73 69 74 65 28  ed prerequisite(
6a00: 73 29 3b 20 22 0a 09 09 09 09 20 20 20 20 20 28  s); ".....     (
6a10: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72  string-intersper
6a20: 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20  se (map (lambda 
6a30: 28 74 29 28 63 6f 6e 63 20 28 64 62 3a 74 65 73  (t)(conc (db:tes
6a40: 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74  t-get-testname t
6a50: 29 20 22 3a 22 20 28 64 62 3a 74 65 73 74 2d 67  ) ":" (db:test-g
6a60: 65 74 2d 73 74 61 74 65 20 74 29 22 2f 22 28 64  et-state t)"/"(d
6a70: 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75  b:test-get-statu
6a80: 73 20 74 29 29 29 20 66 61 69 6c 73 29 20 22 2c  s t))) fails) ",
6a90: 20 22 29 0a 09 09 09 09 20 20 20 20 20 22 2c 20   ").....     ", 
6aa0: 72 65 6d 6f 76 69 6e 67 20 69 74 20 66 72 6f 6d  removing it from
6ab0: 20 74 6f 2d 64 6f 20 6c 69 73 74 22 29 0a 09 09   to-do list")...
6ac0: 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f  .(if (not (null?
6ad0: 20 74 61 6c 29 29 0a 09 09 09 20 20 20 20 28 62   tal))....    (b
6ae0: 65 67 69 6e 0a 09 09 09 20 20 20 20 20 20 28 74  egin....      (t
6af0: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c  hread-sleep! *gl
6b00: 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 09  obal-delta*)....
6b10: 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72        (loop (car
6b20: 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 28 63   tal)(cdr tal)(c
6b30: 6f 6e 73 20 68 65 64 20 72 65 72 75 6e 73 29 29  ons hed reruns))
6b40: 29 29 29 0a 09 09 20 20 20 20 20 20 20 28 65 6c  )))...       (el
6b50: 73 65 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69  se....(debug:pri
6b60: 6e 74 20 38 20 22 45 52 52 4f 52 3a 20 4e 6f 20  nt 8 "ERROR: No 
6b70: 68 61 6e 64 6c 65 72 20 66 6f 72 20 74 68 69 73  handler for this
6b80: 20 63 6f 6e 64 69 74 69 6f 6e 2e 22 29 0a 09 09   condition.")...
6b90: 09 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20  .(thread-sleep! 
6ba0: 28 2b 20 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c  (+ 1 *global-del
6bb0: 74 61 2a 29 29 0a 09 09 09 28 6c 6f 6f 70 20 28  ta*))....(loop (
6bc0: 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20  car newtal)(cdr 
6bd0: 6e 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29 29  newtal) reruns))
6be0: 29 29 20 3b 3b 20 45 4e 44 20 4f 46 20 49 46 20  )) ;; END OF IF 
6bf0: 43 41 4e 20 52 55 4e 20 4d 4f 52 45 0a 0a 09 09  CAN RUN MORE....
6c00: 20 20 20 20 3b 3b 20 69 66 20 63 61 6e 27 74 20      ;; if can't 
6c10: 72 75 6e 20 6d 6f 72 65 20 6a 75 73 74 20 6c 6f  run more just lo
6c20: 6f 70 20 77 69 74 68 20 6e 65 78 74 20 70 6f 73  op with next pos
6c30: 73 69 62 6c 65 20 74 65 73 74 0a 09 09 20 20 20  sible test...   
6c40: 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20 20   (begin...      
6c50: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
6c60: 6f 20 34 20 22 70 72 6f 63 65 73 73 69 6e 67 20  o 4 "processing 
6c70: 74 68 65 20 63 61 73 65 20 77 69 74 68 20 61 20  the case with a 
6c80: 6c 61 6d 62 64 61 20 66 6f 72 20 69 74 65 6d 73  lambda for items
6c90: 20 6f 72 20 27 68 61 76 65 2d 70 72 6f 63 65 64   or 'have-proced
6ca0: 75 72 65 2e 20 4d 6f 76 69 6e 67 20 74 68 72 6f  ure. Moving thro
6cb0: 75 67 68 20 74 68 65 20 71 75 65 75 65 20 77 69  ugh the queue wi
6cc0: 74 68 6f 75 74 20 64 72 6f 70 70 69 6e 67 20 22  thout dropping "
6cd0: 20 68 65 64 29 0a 09 09 20 20 20 20 20 20 28 74   hed)...      (t
6ce0: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20  hread-sleep! (+ 
6cf0: 32 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a  2 *global-delta*
6d00: 29 29 0a 09 09 20 20 20 20 20 20 28 6c 6f 6f 70  ))...      (loop
6d10: 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64   (car newtal)(cd
6d20: 72 20 6e 65 77 74 61 6c 29 20 72 65 72 75 6e 73  r newtal) reruns
6d30: 29 29 29 29 29 20 3b 3b 20 45 4e 44 20 4f 46 20  ))))) ;; END OF 
6d40: 28 6f 72 20 28 70 72 6f 63 65 64 75 72 65 3f 20  (or (procedure? 
6d50: 69 74 65 6d 73 29 28 65 71 3f 20 69 74 65 6d 73  items)(eq? items
6d60: 20 27 68 61 76 65 2d 70 72 6f 63 65 64 75 72 65   'have-procedure
6d70: 29 29 0a 09 20 20 20 20 20 0a 09 20 20 20 20 20  ))..     ..     
6d80: 3b 3b 20 74 68 69 73 20 63 61 73 65 20 73 68 6f  ;; this case sho
6d90: 75 6c 64 20 6e 6f 74 20 68 61 70 70 65 6e 2c 20  uld not happen, 
6da0: 61 64 64 65 64 20 74 6f 20 68 65 6c 70 20 63 61  added to help ca
6db0: 74 63 68 20 61 6e 79 20 62 75 67 73 0a 09 20 20  tch any bugs..  
6dc0: 20 20 20 28 28 61 6e 64 20 28 6c 69 73 74 3f 20     ((and (list? 
6dd0: 69 74 65 6d 73 29 20 69 74 65 6d 64 61 74 29 0a  items) itemdat).
6de0: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72  .      (debug:pr
6df0: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 53 68  int 0 "ERROR: Sh
6e00: 6f 75 6c 64 20 6e 6f 74 20 68 61 76 65 20 61 20  ould not have a 
6e10: 6c 69 73 74 20 6f 66 20 69 74 65 6d 73 20 69 6e  list of items in
6e20: 20 61 20 74 65 73 74 20 61 6e 64 20 74 68 65 20   a test and the 
6e30: 69 74 65 6d 73 70 61 74 68 20 73 65 74 20 2d 20  itemspath set - 
6e40: 70 6c 65 61 73 65 20 72 65 70 6f 72 74 20 74 68  please report th
6e50: 69 73 22 29 0a 09 20 20 20 20 20 20 28 65 78 69  is")..      (exi
6e60: 74 20 31 29 29 0a 09 20 20 20 20 20 28 28 6e 6f  t 1))..     ((no
6e70: 74 20 28 6e 75 6c 6c 3f 20 72 65 72 75 6e 73 29  t (null? reruns)
6e80: 29 0a 09 20 20 20 20 20 20 28 6c 65 74 2a 20 28  )..      (let* (
6e90: 28 6e 65 77 6c 73 74 20 28 74 65 73 74 73 3a 66  (newlst (tests:f
6ea0: 69 6c 74 65 72 2d 6e 6f 6e 2d 72 75 6e 6e 61 62  ilter-non-runnab
6eb0: 6c 65 20 72 75 6e 2d 69 64 20 74 61 6c 20 74 65  le run-id tal te
6ec0: 73 74 2d 72 65 63 6f 72 64 73 29 29 20 3b 3b 20  st-records)) ;; 
6ed0: 69 2e 65 2e 20 6e 6f 74 20 46 41 49 4c 2c 20 57  i.e. not FAIL, W
6ee0: 41 49 56 45 44 2c 20 49 4e 43 4f 4d 50 4c 45 54  AIVED, INCOMPLET
6ef0: 45 2c 20 50 41 53 53 2c 20 4b 49 4c 4c 45 44 2c  E, PASS, KILLED,
6f00: 0a 09 09 20 20 20 20 20 28 6a 75 6e 6b 65 64 20  ...     (junked 
6f10: 28 6c 73 65 74 2d 64 69 66 66 65 72 65 6e 63 65  (lset-difference
6f20: 20 65 71 75 61 6c 3f 20 74 61 6c 20 6e 65 77 6c   equal? tal newl
6f30: 73 74 29 29 29 0a 09 09 28 64 65 62 75 67 3a 70  st)))...(debug:p
6f40: 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 66 75 6c  rint-info 4 "ful
6f50: 6c 20 64 72 6f 70 20 74 68 72 6f 75 67 68 2c 20  l drop through, 
6f60: 69 66 20 72 65 72 75 6e 73 20 69 73 20 6c 65 73  if reruns is les
6f70: 73 20 74 68 61 6e 20 31 30 30 20 77 65 20 77 69  s than 100 we wi
6f80: 6c 6c 20 66 6f 72 63 65 20 72 65 74 72 79 20 74  ll force retry t
6f90: 68 65 6d 2c 20 72 65 72 75 6e 73 3d 22 20 72 65  hem, reruns=" re
6fa0: 72 75 6e 73 20 22 2c 20 74 61 6c 3d 22 20 74 61  runs ", tal=" ta
6fb0: 6c 29 0a 09 09 28 69 66 20 28 3c 20 6e 75 6d 2d  l)...(if (< num-
6fc0: 72 65 74 72 69 65 73 20 6d 61 78 2d 72 65 74 72  retries max-retr
6fd0: 69 65 73 29 0a 09 09 20 20 20 20 28 73 65 74 21  ies)...    (set!
6fe0: 20 6e 65 77 6c 73 74 20 28 61 70 70 65 6e 64 20   newlst (append 
6ff0: 72 65 72 75 6e 73 20 6e 65 77 6c 73 74 29 29 29  reruns newlst)))
7000: 0a 09 09 28 73 65 74 21 20 6e 75 6d 2d 72 65 74  ...(set! num-ret
7010: 72 69 65 73 20 28 2b 20 6e 75 6d 2d 72 65 74 72  ries (+ num-retr
7020: 69 65 73 20 31 29 29 0a 09 09 28 74 68 72 65 61  ies 1))...(threa
7030: 64 2d 73 6c 65 65 70 21 20 28 2b 20 31 20 2a 67  d-sleep! (+ 1 *g
7040: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09  lobal-delta*))..
7050: 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f  .(if (not (null?
7060: 20 6e 65 77 6c 73 74 29 29 0a 09 09 20 20 20 20   newlst))...    
7070: 3b 3b 20 73 69 6e 63 65 20 72 65 72 75 6e 73 20  ;; since reruns 
7080: 68 61 76 65 20 62 65 65 6e 20 74 61 63 6b 65 64  have been tacked
7090: 20 6f 6e 20 74 6f 20 6e 65 77 6c 73 74 20 63 72   on to newlst cr
70a0: 65 61 74 65 20 6e 65 77 20 72 65 72 75 6e 73 20  eate new reruns 
70b0: 66 72 6f 6d 20 6a 75 6e 6b 65 64 0a 09 09 20 20  from junked...  
70c0: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77    (loop (car new
70d0: 6c 73 74 29 28 63 64 72 20 6e 65 77 6c 73 74 29  lst)(cdr newlst)
70e0: 28 64 65 6c 65 74 65 2d 64 75 70 6c 69 63 61 74  (delete-duplicat
70f0: 65 73 20 6a 75 6e 6b 65 64 29 29 29 29 29 0a 09  es junked)))))..
7100: 20 20 20 20 20 28 28 6e 6f 74 20 28 6e 75 6c 6c       ((not (null
7110: 3f 20 74 61 6c 29 29 0a 09 20 20 20 20 20 20 28  ? tal))..      (
7120: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
7130: 20 34 20 22 49 27 6d 20 70 72 65 74 74 79 20 73   4 "I'm pretty s
7140: 75 72 65 20 49 20 73 68 6f 75 6c 64 6e 27 74 20  ure I shouldn't 
7150: 67 65 74 20 68 65 72 65 2e 22 29 29 0a 09 20 20  get here."))..  
7160: 20 20 20 28 65 6c 73 65 0a 09 20 20 20 20 20 20     (else..      
7170: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
7180: 6f 20 34 20 22 45 78 69 74 69 6e 67 20 6c 6f 6f  o 4 "Exiting loo
7190: 70 20 77 69 74 68 2e 2e 2e 5c 6e 20 20 68 65 64  p with...\n  hed
71a0: 3d 22 20 68 65 64 20 22 5c 6e 20 20 74 61 6c 3d  =" hed "\n  tal=
71b0: 22 20 74 61 6c 20 22 5c 6e 20 20 72 65 72 75 6e  " tal "\n  rerun
71c0: 73 3d 22 20 72 65 72 75 6e 73 29 29 0a 09 20 20  s=" reruns))..  
71d0: 20 20 20 29 29 29 29 20 3b 3b 20 4c 45 54 2a 20     )))) ;; LET* 
71e0: 28 28 74 65 73 74 2d 72 65 63 6f 72 64 0a 0a 20  ((test-record.. 
71f0: 20 20 20 3b 3b 20 77 65 20 67 65 74 20 68 65 72     ;; we get her
7200: 65 20 6f 6e 20 22 64 72 6f 70 20 74 68 72 6f 75  e on "drop throu
7210: 67 68 22 20 2d 20 6c 6f 6f 70 20 66 6f 72 20 6e  gh" - loop for n
7220: 65 78 74 20 74 65 73 74 20 69 6e 20 71 75 65 75  ext test in queu
7230: 65 0a 20 20 20 20 3b 3b 20 46 49 58 4d 45 21 21  e.    ;; FIXME!!
7240: 21 21 20 54 48 49 53 20 53 48 4f 55 4c 44 20 4e  !! THIS SHOULD N
7250: 4f 54 20 52 45 51 55 49 52 45 20 41 4e 20 45 58  OT REQUIRE AN EX
7260: 49 54 21 21 21 21 21 21 21 0a 20 20 20 20 0a 20  IT!!!!!!!.    . 
7270: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d     (debug:print-
7280: 69 6e 66 6f 20 31 20 22 41 6c 6c 20 74 65 73 74  info 1 "All test
7290: 73 20 6c 61 75 6e 63 68 65 64 22 29 0a 20 20 20  s launched").   
72a0: 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20   (thread-sleep! 
72b0: 30 2e 35 29 0a 20 20 20 20 3b 3b 20 46 49 58 4d  0.5).    ;; FIXM
72c0: 45 21 20 54 68 69 73 20 68 61 72 73 68 20 65 78  E! This harsh ex
72d0: 69 74 20 73 68 6f 75 6c 64 20 6e 6f 74 20 62 65  it should not be
72e0: 20 6e 65 63 65 73 73 61 72 79 2e 2e 2e 2e 0a 20   necessary..... 
72f0: 20 20 20 3b 3b 20 28 69 66 20 28 6e 6f 74 20 2a     ;; (if (not *
7300: 72 75 6e 72 65 6d 6f 74 65 2a 29 28 65 78 69 74  runremote*)(exit
7310: 29 29 20 3b 3b 20 0a 20 20 20 20 23 66 29 29 20  )) ;; .    #f)) 
7320: 3b 3b 20 72 65 74 75 72 6e 20 61 20 23 66 20 61  ;; return a #f a
7330: 73 20 61 20 68 69 6e 74 20 74 68 61 74 20 77 65  s a hint that we
7340: 20 61 72 65 20 64 6f 6e 65 0a 20 20 3b 3b 20 48   are done.  ;; H
7350: 65 72 65 20 77 65 20 6e 65 65 64 20 74 6f 20 63  ere we need to c
7360: 68 65 63 6b 20 74 68 61 74 20 61 6c 6c 20 74 68  heck that all th
7370: 65 20 74 65 73 74 73 20 72 65 6d 61 69 6e 69 6e  e tests remainin
7380: 67 20 74 6f 20 62 65 20 72 75 6e 20 61 72 65 20  g to be run are 
7390: 65 6c 69 67 69 62 6c 65 20 74 6f 20 72 75 6e 0a  eligible to run.
73a0: 20 20 3b 3b 20 61 6e 64 20 61 72 65 20 6e 6f 74    ;; and are not
73b0: 20 62 6c 6f 63 6b 65 64 20 62 79 20 66 61 69 6c   blocked by fail
73c0: 65 64 0a 20 20 0a 0a 3b 3b 20 70 61 72 65 6e 74  ed.  ..;; parent
73d0: 2d 74 65 73 74 20 69 73 20 74 68 65 72 65 20 61  -test is there a
73e0: 73 20 61 20 70 6c 61 63 65 68 6f 6c 64 65 72 20  s a placeholder 
73f0: 66 6f 72 20 77 68 65 6e 20 70 61 72 65 6e 74 2d  for when parent-
7400: 74 65 73 74 73 20 63 61 6e 20 62 65 20 72 75 6e  tests can be run
7410: 20 61 73 20 61 20 73 65 74 75 70 20 73 74 65 70   as a setup step
7420: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 3a 74 65  .(define (run:te
7430: 73 74 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d  st run-id runnam
7440: 65 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 73 74  e keyvallst test
7450: 2d 72 65 63 6f 72 64 20 66 6c 61 67 73 20 70 61  -record flags pa
7460: 72 65 6e 74 2d 74 65 73 74 29 0a 20 20 3b 3b 20  rent-test).  ;; 
7470: 41 6c 6c 20 74 68 65 73 65 20 76 61 72 73 20 6d  All these vars m
7480: 69 67 68 74 20 62 65 20 72 65 66 65 72 65 6e 63  ight be referenc
7490: 65 64 20 62 79 20 74 68 65 20 74 65 73 74 63 6f  ed by the testco
74a0: 6e 66 69 67 20 66 69 6c 65 20 72 65 61 64 65 72  nfig file reader
74b0: 0a 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d  .  (let* ((test-
74c0: 6e 61 6d 65 20 20 20 20 28 74 65 73 74 73 3a 74  name    (tests:t
74d0: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73  estqueue-get-tes
74e0: 74 6e 61 6d 65 20 20 20 74 65 73 74 2d 72 65 63  tname   test-rec
74f0: 6f 72 64 29 29 0a 09 20 28 74 65 73 74 2d 77 61  ord)).. (test-wa
7500: 69 74 6f 6e 73 20 28 74 65 73 74 73 3a 74 65 73  itons (tests:tes
7510: 74 71 75 65 75 65 2d 67 65 74 2d 77 61 69 74 6f  tqueue-get-waito
7520: 6e 73 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72  ns    test-recor
7530: 64 29 29 0a 09 20 28 74 65 73 74 2d 63 6f 6e 66  d)).. (test-conf
7540: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71      (tests:testq
7550: 75 65 75 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e  ueue-get-testcon
7560: 66 69 67 20 74 65 73 74 2d 72 65 63 6f 72 64 29  fig test-record)
7570: 29 0a 09 20 28 69 74 65 6d 64 61 74 20 20 20 20  ).. (itemdat    
7580: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65    (tests:testque
7590: 75 65 2d 67 65 74 2d 69 74 65 6d 64 61 74 20 20  ue-get-itemdat  
75a0: 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a    test-record)).
75b0: 09 20 28 74 65 73 74 2d 70 61 74 68 20 20 20 20  . (test-path    
75c0: 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20  (conc *toppath* 
75d0: 22 2f 74 65 73 74 73 2f 22 20 74 65 73 74 2d 6e  "/tests/" test-n
75e0: 61 6d 65 29 29 20 3b 3b 20 63 6f 75 6c 64 20 75  ame)) ;; could u
75f0: 73 65 20 74 65 73 74 73 3a 67 65 74 2d 74 65 73  se tests:get-tes
7600: 74 63 6f 6e 66 69 67 20 68 65 72 65 20 2e 2e 2e  tconfig here ...
7610: 0a 09 20 28 66 6f 72 63 65 20 20 20 20 20 20 20  .. (force       
7620: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66   (hash-table-ref
7630: 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22  /default flags "
7640: 2d 66 6f 72 63 65 22 20 23 66 29 29 0a 09 20 28  -force" #f)).. (
7650: 72 65 72 75 6e 20 20 20 20 20 20 20 20 28 68 61  rerun        (ha
7660: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66  sh-table-ref/def
7670: 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 72 65 72  ault flags "-rer
7680: 75 6e 22 20 23 66 29 29 0a 09 20 28 6b 65 65 70  un" #f)).. (keep
7690: 67 6f 69 6e 67 20 20 20 20 28 68 61 73 68 2d 74  going    (hash-t
76a0: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74  able-ref/default
76b0: 20 66 6c 61 67 73 20 22 2d 6b 65 65 70 67 6f 69   flags "-keepgoi
76c0: 6e 67 22 20 23 66 29 29 0a 09 20 28 69 74 65 6d  ng" #f)).. (item
76d0: 2d 70 61 74 68 20 20 20 20 20 22 22 29 0a 09 20  -path     "").. 
76e0: 28 64 62 20 20 20 20 20 20 20 20 20 20 20 23 66  (db           #f
76f0: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72  )).    (debug:pr
7700: 69 6e 74 20 34 0a 09 09 20 22 74 65 73 74 2d 63  int 4... "test-c
7710: 6f 6e 66 69 67 3a 20 22 20 28 68 61 73 68 2d 74  onfig: " (hash-t
7720: 61 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65 73 74  able->alist test
7730: 2d 63 6f 6e 66 29 0a 09 09 20 22 5c 6e 20 20 20  -conf)... "\n   
7740: 69 74 65 6d 64 61 74 3a 20 22 20 69 74 65 6d 64  itemdat: " itemd
7750: 61 74 0a 09 09 20 29 0a 20 20 20 20 3b 3b 20 73  at... ).    ;; s
7760: 65 74 74 69 6e 67 20 69 74 65 6d 64 61 74 20 74  etting itemdat t
7770: 6f 20 61 20 6c 69 73 74 20 69 66 20 69 74 20 69  o a list if it i
7780: 73 20 23 66 0a 20 20 20 20 28 69 66 20 28 6e 6f  s #f.    (if (no
7790: 74 20 69 74 65 6d 64 61 74 29 28 73 65 74 21 20  t itemdat)(set! 
77a0: 69 74 65 6d 64 61 74 20 27 28 29 29 29 0a 20 20  itemdat '())).  
77b0: 20 20 28 73 65 74 21 20 69 74 65 6d 2d 70 61 74    (set! item-pat
77c0: 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61  h (item-list->pa
77d0: 74 68 20 69 74 65 6d 64 61 74 29 29 0a 20 20 20  th itemdat)).   
77e0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20   (debug:print 2 
77f0: 22 41 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 6c  "Attempting to l
7800: 61 75 6e 63 68 20 74 65 73 74 20 22 20 74 65 73  aunch test " tes
7810: 74 2d 6e 61 6d 65 20 28 69 66 20 28 65 71 75 61  t-name (if (equa
7820: 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 2f 22  l? item-path "/"
7830: 29 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29  ) "/" item-path)
7840: 29 0a 20 20 20 20 28 73 65 74 65 6e 76 20 22 4d  ).    (setenv "M
7850: 54 5f 54 45 53 54 5f 4e 41 4d 45 22 20 74 65 73  T_TEST_NAME" tes
7860: 74 2d 6e 61 6d 65 29 20 3b 3b 20 0a 20 20 20 20  t-name) ;; .    
7870: 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e 4e  (setenv "MT_RUNN
7880: 41 4d 45 22 20 20 20 72 75 6e 6e 61 6d 65 29 0a  AME"   runname).
7890: 20 20 20 20 28 73 65 74 2d 6d 65 67 61 74 65 73      (set-megates
78a0: 74 2d 65 6e 76 2d 76 61 72 73 20 72 75 6e 2d 69  t-env-vars run-i
78b0: 64 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20  d) ;; these may 
78c0: 62 65 20 6e 65 65 64 65 64 20 62 79 20 74 68 65  be needed by the
78d0: 20 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65   launching proce
78e0: 73 73 0a 20 20 20 20 28 63 68 61 6e 67 65 2d 64  ss.    (change-d
78f0: 69 72 65 63 74 6f 72 79 20 2a 74 6f 70 70 61 74  irectory *toppat
7900: 68 2a 29 0a 0a 20 20 20 20 3b 3b 20 48 65 72 65  h*)..    ;; Here
7910: 20 69 73 20 77 68 65 72 65 20 74 68 65 20 74 65   is where the te
7920: 73 74 5f 6d 65 74 61 20 74 61 62 6c 65 20 69 73  st_meta table is
7930: 20 62 65 73 74 20 75 70 64 61 74 65 64 0a 20 20   best updated.  
7940: 20 20 3b 3b 20 59 65 73 2c 20 61 6e 6f 74 68 65    ;; Yes, anothe
7950: 72 20 75 73 65 20 6f 66 20 61 20 67 6c 6f 62 61  r use of a globa
7960: 6c 20 66 6f 72 20 63 61 63 68 69 6e 67 2e 20 4e  l for caching. N
7970: 65 65 64 20 61 20 62 65 74 74 65 72 20 77 61 79  eed a better way
7980: 3f 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28  ?.    (if (not (
7990: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64  hash-table-ref/d
79a0: 65 66 61 75 6c 74 20 2a 74 65 73 74 2d 6d 65 74  efault *test-met
79b0: 61 2d 75 70 64 61 74 65 64 2a 20 74 65 73 74 2d  a-updated* test-
79c0: 6e 61 6d 65 20 23 66 29 29 0a 20 20 20 20 20 20  name #f)).      
79d0: 20 20 28 62 65 67 69 6e 0a 09 20 20 20 28 68 61    (begin..   (ha
79e0: 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 2a 74  sh-table-set! *t
79f0: 65 73 74 2d 6d 65 74 61 2d 75 70 64 61 74 65 64  est-meta-updated
7a00: 2a 20 74 65 73 74 2d 6e 61 6d 65 20 23 74 29 0a  * test-name #t).
7a10: 20 20 20 20 20 20 20 20 20 20 20 28 6f 70 65 6e             (open
7a20: 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 3a  -run-close runs:
7a30: 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 61  update-test_meta
7a40: 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 65   db test-name te
7a50: 73 74 2d 63 6f 6e 66 29 29 29 0a 20 20 20 20 0a  st-conf))).    .
7a60: 20 20 20 20 3b 3b 20 28 6c 61 6d 62 64 61 20 28      ;; (lambda (
7a70: 69 74 65 6d 64 61 74 29 20 3b 3b 3b 20 28 28 72  itemdat) ;;; ((r
7a80: 69 70 65 6e 65 73 73 20 22 6f 76 65 72 72 69 70  ipeness "overrip
7a90: 65 22 29 20 28 74 65 6d 70 65 72 61 74 75 72 65  e") (temperature
7aa0: 20 22 63 6f 6f 6c 22 29 20 28 73 65 61 73 6f 6e   "cool") (season
7ab0: 20 22 73 75 6d 6d 65 72 22 29 29 0a 20 20 20 20   "summer")).    
7ac0: 28 6c 65 74 2a 20 28 28 6e 65 77 2d 74 65 73 74  (let* ((new-test
7ad0: 2d 70 61 74 68 20 28 73 74 72 69 6e 67 2d 69 6e  -path (string-in
7ae0: 74 65 72 73 70 65 72 73 65 20 28 63 6f 6e 73 20  tersperse (cons 
7af0: 74 65 73 74 2d 70 61 74 68 20 28 6d 61 70 20 63  test-path (map c
7b00: 61 64 72 20 69 74 65 6d 64 61 74 29 29 20 22 2f  adr itemdat)) "/
7b10: 22 29 29 0a 09 20 20 20 28 6e 65 77 2d 74 65 73  "))..   (new-tes
7b20: 74 2d 6e 61 6d 65 20 28 69 66 20 28 65 71 75 61  t-name (if (equa
7b30: 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29  l? item-path "")
7b40: 20 74 65 73 74 2d 6e 61 6d 65 20 28 63 6f 6e 63   test-name (conc
7b50: 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69   test-name "/" i
7b60: 74 65 6d 2d 70 61 74 68 29 29 29 20 3b 3b 20 6a  tem-path))) ;; j
7b70: 75 73 74 20 6e 65 65 64 20 69 74 20 74 6f 20 62  ust need it to b
7b80: 65 20 75 6e 69 71 75 65 0a 09 20 20 20 28 74 65  e unique..   (te
7b90: 73 74 2d 69 64 20 20 20 20 20 20 20 28 63 64 62  st-id       (cdb
7ba0: 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64 62 3a 67  :remote-run db:g
7bb0: 65 74 2d 74 65 73 74 2d 69 64 20 23 66 20 20 72  et-test-id #f  r
7bc0: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20  un-id test-name 
7bd0: 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 20 20 20  item-path))..   
7be0: 28 74 65 73 74 64 61 74 20 20 20 20 20 20 20 28  (testdat       (
7bf0: 63 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66  cdb:get-test-inf
7c00: 6f 2d 62 79 2d 69 64 20 2a 72 75 6e 72 65 6d 6f  o-by-id *runremo
7c10: 74 65 2a 20 74 65 73 74 2d 69 64 29 29 29 0a 20  te* test-id))). 
7c20: 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 74 65       (if (not te
7c30: 73 74 64 61 74 29 0a 09 20 20 28 62 65 67 69 6e  stdat)..  (begin
7c40: 0a 09 20 20 20 20 3b 3b 20 65 6e 73 75 72 65 20  ..    ;; ensure 
7c50: 74 68 61 74 20 74 68 65 20 70 61 74 68 20 65 78  that the path ex
7c60: 69 73 74 73 20 62 65 66 6f 72 65 20 72 65 67 69  ists before regi
7c70: 73 74 65 72 69 6e 67 20 74 68 65 20 74 65 73 74  stering the test
7c80: 0a 09 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 43  ..    ;; NOPE: C
7c90: 61 6e 6e 6f 74 21 20 44 6f 6e 27 74 20 6b 6e 6f  annot! Don't kno
7ca0: 77 20 79 65 74 20 77 68 69 63 68 20 64 69 73 6b  w yet which disk
7cb0: 20 61 72 65 61 20 77 69 6c 6c 20 62 65 20 61 73   area will be as
7cc0: 73 69 67 6e 65 64 2e 2e 2e 2e 0a 09 20 20 20 20  signed......    
7cd0: 3b 3b 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63  ;; (system (conc
7ce0: 20 22 6d 6b 64 69 72 20 2d 70 20 22 20 6e 65 77   "mkdir -p " new
7cf0: 2d 74 65 73 74 2d 70 61 74 68 29 29 0a 09 20 20  -test-path))..  
7d00: 20 20 3b 3b 0a 09 20 20 20 20 3b 3b 20 28 6f 70    ;;..    ;; (op
7d10: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 74 65 73  en-run-close tes
7d20: 74 73 3a 72 65 67 69 73 74 65 72 2d 74 65 73 74  ts:register-test
7d30: 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d   db run-id test-
7d40: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a  name item-path).
7d50: 09 20 20 20 20 3b 3b 0a 09 20 20 20 20 3b 3b 20  .    ;;..    ;; 
7d60: 4e 42 2f 2f 20 66 6f 72 20 74 68 65 20 61 62 6f  NB// for the abo
7d70: 76 65 20 6c 69 6e 65 2e 20 49 20 77 61 6e 74 20  ve line. I want 
7d80: 74 68 65 20 74 65 73 74 20 74 6f 20 62 65 20 72  the test to be r
7d90: 65 67 69 73 74 65 72 65 64 20 6c 6f 6e 67 20 62  egistered long b
7da0: 65 66 6f 72 65 20 74 68 69 73 20 72 6f 75 74 69  efore this routi
7db0: 6e 65 20 67 65 74 73 20 63 61 6c 6c 65 64 21 0a  ne gets called!.
7dc0: 09 20 20 20 20 3b 3b 0a 09 20 20 20 20 28 73 65  .    ;;..    (se
7dd0: 74 21 20 74 65 73 74 2d 69 64 20 28 6f 70 65 6e  t! test-id (open
7de0: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65  -run-close db:ge
7df0: 74 2d 74 65 73 74 2d 69 64 20 64 62 20 72 75 6e  t-test-id db run
7e00: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74  -id test-name it
7e10: 65 6d 2d 70 61 74 68 29 29 0a 09 20 20 20 20 28  em-path))..    (
7e20: 69 66 20 28 6e 6f 74 20 74 65 73 74 2d 69 64 29  if (not test-id)
7e30: 0a 09 09 28 62 65 67 69 6e 0a 09 09 20 20 28 64  ...(begin...  (d
7e40: 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 57 41  ebug:print 2 "WA
7e50: 52 4e 3a 20 54 65 73 74 20 6e 6f 74 20 70 72 65  RN: Test not pre
7e60: 2d 63 72 65 61 74 65 64 3f 20 74 65 73 74 2d 6e  -created? test-n
7e70: 61 6d 65 3d 22 20 74 65 73 74 2d 6e 61 6d 65 20  ame=" test-name 
7e80: 22 2c 20 69 74 65 6d 2d 70 61 74 68 3d 22 20 69  ", item-path=" i
7e90: 74 65 6d 2d 70 61 74 68 20 22 2c 20 72 75 6e 2d  tem-path ", run-
7ea0: 69 64 3d 22 20 72 75 6e 2d 69 64 29 0a 09 09 20  id=" run-id)... 
7eb0: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
7ec0: 20 64 62 3a 74 65 73 74 73 2d 72 65 67 69 73 74   db:tests-regist
7ed0: 65 72 2d 74 65 73 74 20 23 66 20 72 75 6e 2d 69  er-test #f run-i
7ee0: 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d  d test-name item
7ef0: 2d 70 61 74 68 29 0a 09 09 20 20 28 73 65 74 21  -path)...  (set!
7f00: 20 74 65 73 74 2d 69 64 20 28 6f 70 65 6e 2d 72   test-id (open-r
7f10: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d  un-close db:get-
7f20: 74 65 73 74 2d 69 64 20 64 62 20 72 75 6e 2d 69  test-id db run-i
7f30: 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d  d test-name item
7f40: 2d 70 61 74 68 29 29 29 29 0a 09 20 20 20 20 28  -path))))..    (
7f50: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
7f60: 20 34 20 22 74 65 73 74 2d 69 64 3d 22 20 74 65   4 "test-id=" te
7f70: 73 74 2d 69 64 20 22 2c 20 72 75 6e 2d 69 64 3d  st-id ", run-id=
7f80: 22 20 72 75 6e 2d 69 64 20 22 2c 20 74 65 73 74  " run-id ", test
7f90: 2d 6e 61 6d 65 3d 22 20 74 65 73 74 2d 6e 61 6d  -name=" test-nam
7fa0: 65 20 22 2c 20 69 74 65 6d 2d 70 61 74 68 3d 5c  e ", item-path=\
7fb0: 22 22 20 69 74 65 6d 2d 70 61 74 68 20 22 5c 22  "" item-path "\"
7fc0: 22 29 0a 09 20 20 20 20 28 73 65 74 21 20 74 65  ")..    (set! te
7fd0: 73 74 64 61 74 20 28 63 64 62 3a 67 65 74 2d 74  stdat (cdb:get-t
7fe0: 65 73 74 2d 69 6e 66 6f 2d 62 79 2d 69 64 20 2a  est-info-by-id *
7ff0: 72 75 6e 72 65 6d 6f 74 65 2a 20 74 65 73 74 2d  runremote* test-
8000: 69 64 29 29 29 29 0a 20 20 20 20 20 20 28 73 65  id)))).      (se
8010: 74 21 20 74 65 73 74 2d 69 64 20 28 64 62 3a 74  t! test-id (db:t
8020: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64  est-get-id testd
8030: 61 74 29 29 0a 20 20 20 20 20 20 28 63 68 61 6e  at)).      (chan
8040: 67 65 2d 64 69 72 65 63 74 6f 72 79 20 74 65 73  ge-directory tes
8050: 74 2d 70 61 74 68 29 0a 20 20 20 20 20 20 28 63  t-path).      (c
8060: 61 73 65 20 28 69 66 20 66 6f 72 63 65 20 3b 3b  ase (if force ;;
8070: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
8080: 2d 66 6f 72 63 65 22 29 0a 09 09 27 4e 4f 54 5f  -force")...'NOT_
8090: 53 54 41 52 54 45 44 0a 09 09 28 69 66 20 74 65  STARTED...(if te
80a0: 73 74 64 61 74 0a 09 09 20 20 20 20 28 73 74 72  stdat...    (str
80b0: 69 6e 67 2d 3e 73 79 6d 62 6f 6c 20 28 74 65 73  ing->symbol (tes
80c0: 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74  t:get-state test
80d0: 64 61 74 29 29 0a 09 09 20 20 20 20 27 66 61 69  dat))...    'fai
80e0: 6c 65 64 2d 74 6f 2d 69 6e 73 65 72 74 29 29 0a  led-to-insert)).
80f0: 09 28 28 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73  .((failed-to-ins
8100: 65 72 74 29 0a 09 20 28 64 65 62 75 67 3a 70 72  ert).. (debug:pr
8110: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 46 61  int 0 "ERROR: Fa
8120: 69 6c 65 64 20 74 6f 20 69 6e 73 65 72 74 20 74  iled to insert t
8130: 68 65 20 72 65 63 6f 72 64 20 69 6e 74 6f 20 74  he record into t
8140: 68 65 20 64 62 22 29 29 0a 09 28 28 4e 4f 54 5f  he db"))..((NOT_
8150: 53 54 41 52 54 45 44 20 43 4f 4d 50 4c 45 54 45  STARTED COMPLETE
8160: 44 20 44 45 4c 45 54 45 44 29 0a 09 20 28 6c 65  D DELETED).. (le
8170: 74 20 28 28 72 75 6e 66 6c 61 67 20 23 66 29 29  t ((runflag #f))
8180: 0a 09 20 20 20 28 63 6f 6e 64 0a 09 20 20 20 20  ..   (cond..    
8190: 3b 3b 20 2d 66 6f 72 63 65 2c 20 72 75 6e 20 6e  ;; -force, run n
81a0: 6f 20 6d 61 74 74 65 72 20 77 68 61 74 0a 09 20  o matter what.. 
81b0: 20 20 20 28 66 6f 72 63 65 20 28 73 65 74 21 20     (force (set! 
81c0: 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20  runflag #t))..  
81d0: 20 20 3b 3b 20 4e 4f 54 5f 53 54 41 52 54 45 44    ;; NOT_STARTED
81e0: 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20  , run no matter 
81f0: 77 68 61 74 0a 09 20 20 20 20 28 28 6d 65 6d 62  what..    ((memb
8200: 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61  er (test:get-sta
8210: 74 65 20 74 65 73 74 64 61 74 29 20 27 28 22 44  te testdat) '("D
8220: 45 4c 45 54 45 44 22 20 22 4e 4f 54 5f 53 54 41  ELETED" "NOT_STA
8230: 52 54 45 44 22 29 29 28 73 65 74 21 20 72 75 6e  RTED"))(set! run
8240: 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b  flag #t))..    ;
8250: 3b 20 6e 6f 74 20 2d 72 65 72 75 6e 20 61 6e 64  ; not -rerun and
8260: 20 50 41 53 53 2c 20 57 41 52 4e 20 6f 72 20 43   PASS, WARN or C
8270: 48 45 43 4b 2c 20 64 6f 20 6e 6f 20 72 75 6e 0a  HECK, do no run.
8280: 09 20 20 20 20 28 28 61 6e 64 20 28 6f 72 20 28  .    ((and (or (
8290: 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09 20 20 20  not rerun)...   
82a0: 20 20 20 6b 65 65 70 67 6f 69 6e 67 29 0a 09 09     keepgoing)...
82b0: 20 20 3b 3b 20 52 65 71 75 69 72 65 20 74 6f 20    ;; Require to 
82c0: 66 6f 72 63 65 20 72 65 2d 72 75 6e 20 66 6f 72  force re-run for
82d0: 20 43 4f 4d 50 4c 45 54 45 44 20 6f 72 20 2a 61   COMPLETED or *a
82e0: 6e 79 74 68 69 6e 67 2a 20 2b 20 50 41 53 53 2c  nything* + PASS,
82f0: 57 41 52 4e 20 6f 72 20 43 48 45 43 4b 0a 09 09  WARN or CHECK...
8300: 20 20 28 6f 72 20 28 6d 65 6d 62 65 72 20 28 74    (or (member (t
8310: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74  est:get-status t
8320: 65 73 74 64 61 74 29 20 27 28 22 50 41 53 53 22  estdat) '("PASS"
8330: 20 22 57 41 52 4e 22 20 22 43 48 45 43 4b 22 20   "WARN" "CHECK" 
8340: 22 53 4b 49 50 22 29 29 0a 09 09 20 20 20 20 20  "SKIP"))...     
8350: 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67   (member (test:g
8360: 65 74 2d 73 74 61 74 65 20 20 74 65 73 74 64 61  et-state  testda
8370: 74 29 20 27 28 22 43 4f 4d 50 4c 45 54 45 44 22  t) '("COMPLETED"
8380: 29 29 29 29 20 0a 09 20 20 20 20 20 28 64 65 62  )))) ..     (deb
8390: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 32 20  ug:print-info 2 
83a0: 22 72 75 6e 6e 69 6e 67 20 74 65 73 74 20 22 20  "running test " 
83b0: 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74  test-name "/" it
83c0: 65 6d 2d 70 61 74 68 20 22 20 73 75 70 70 72 65  em-path " suppre
83d0: 73 73 65 64 20 61 73 20 69 74 20 69 73 20 22 20  ssed as it is " 
83e0: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20  (test:get-state 
83f0: 74 65 73 74 64 61 74 29 20 22 20 61 6e 64 20 22  testdat) " and "
8400: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75   (test:get-statu
8410: 73 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20  s testdat))..   
8420: 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20    (set! runflag 
8430: 23 66 29 29 0a 09 20 20 20 20 3b 3b 20 2d 72 65  #f))..    ;; -re
8440: 72 75 6e 20 61 6e 64 20 73 74 61 74 75 73 20 69  run and status i
8450: 73 20 6f 6e 65 20 6f 66 20 74 68 65 20 73 70 65  s one of the spe
8460: 63 69 66 65 64 2c 20 72 75 6e 20 69 74 0a 09 20  cifed, run it.. 
8470: 20 20 20 28 28 61 6e 64 20 72 65 72 75 6e 0a 09     ((and rerun..
8480: 09 20 20 28 6c 65 74 2a 20 28 28 72 65 72 75 6e  .  (let* ((rerun
8490: 6c 73 74 20 20 20 28 73 74 72 69 6e 67 2d 73 70  lst   (string-sp
84a0: 6c 69 74 20 72 65 72 75 6e 20 22 2c 22 29 29 0a  lit rerun ",")).
84b0: 09 09 09 20 28 6d 75 73 74 2d 72 65 72 75 6e 20  ... (must-rerun 
84c0: 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65  (member (test:ge
84d0: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74  t-status testdat
84e0: 29 20 72 65 72 75 6e 6c 73 74 29 29 29 0a 09 09  ) rerunlst)))...
84f0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
8500: 2d 69 6e 66 6f 20 33 20 22 2d 72 65 72 75 6e 20  -info 3 "-rerun 
8510: 6c 69 73 74 3a 20 22 20 72 65 72 75 6e 20 22 2c  list: " rerun ",
8520: 20 74 65 73 74 2d 73 74 61 74 75 73 3a 20 22 20   test-status: " 
8530: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73  (test:get-status
8540: 20 74 65 73 74 64 61 74 29 22 2c 20 6d 75 73 74   testdat)", must
8550: 2d 72 65 72 75 6e 3a 20 22 20 6d 75 73 74 2d 72  -rerun: " must-r
8560: 65 72 75 6e 29 0a 09 09 20 20 20 20 6d 75 73 74  erun)...    must
8570: 2d 72 65 72 75 6e 29 29 0a 09 20 20 20 20 20 28  -rerun))..     (
8580: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
8590: 20 32 20 22 52 65 72 75 6e 20 66 6f 72 63 65 64   2 "Rerun forced
85a0: 20 66 6f 72 20 74 65 73 74 20 22 20 74 65 73 74   for test " test
85b0: 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70  -name "/" item-p
85c0: 61 74 68 29 0a 09 20 20 20 20 20 28 73 65 74 21  ath)..     (set!
85d0: 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20   runflag #t)).. 
85e0: 20 20 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67     ;; -keepgoing
85f0: 2c 20 64 6f 20 6e 6f 74 20 72 65 72 75 6e 20 46  , do not rerun F
8600: 41 49 4c 0a 09 20 20 20 20 28 28 61 6e 64 20 6b  AIL..    ((and k
8610: 65 65 70 67 6f 69 6e 67 0a 09 09 20 20 28 6d 65  eepgoing...  (me
8620: 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73  mber (test:get-s
8630: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20 27  tatus testdat) '
8640: 28 22 46 41 49 4c 22 29 29 29 0a 09 20 20 20 20  ("FAIL")))..    
8650: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23   (set! runflag #
8660: 66 29 29 0a 09 20 20 20 20 28 28 61 6e 64 20 28  f))..    ((and (
8670: 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09 20 20 28  not rerun)...  (
8680: 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74  member (test:get
8690: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29  -status testdat)
86a0: 20 27 28 22 46 41 49 4c 22 20 22 6e 2f 61 22 29   '("FAIL" "n/a")
86b0: 29 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72  ))..     (set! r
86c0: 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20  unflag #t))..   
86d0: 20 28 65 6c 73 65 20 28 73 65 74 21 20 72 75 6e   (else (set! run
86e0: 66 6c 61 67 20 23 66 29 29 29 0a 09 20 20 20 28  flag #f)))..   (
86f0: 64 65 62 75 67 3a 70 72 69 6e 74 20 36 20 22 52  debug:print 6 "R
8700: 55 4e 4e 49 4e 47 20 3d 3e 20 72 75 6e 66 6c 61  UNNING => runfla
8710: 67 3a 20 22 20 72 75 6e 66 6c 61 67 20 22 20 53  g: " runflag " S
8720: 54 41 54 45 3a 20 22 20 28 74 65 73 74 3a 67 65  TATE: " (test:ge
8730: 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29  t-state testdat)
8740: 20 22 20 53 54 41 54 55 53 3a 20 22 20 28 74 65   " STATUS: " (te
8750: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65  st:get-status te
8760: 73 74 64 61 74 29 29 0a 09 20 20 20 28 69 66 20  stdat))..   (if 
8770: 28 6e 6f 74 20 72 75 6e 66 6c 61 67 29 0a 09 20  (not runflag).. 
8780: 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 70        (if (not p
8790: 61 72 65 6e 74 2d 74 65 73 74 29 0a 09 09 20 20  arent-test)...  
87a0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20   (debug:print 1 
87b0: 22 4e 4f 54 45 3a 20 4e 6f 74 20 73 74 61 72 74  "NOTE: Not start
87c0: 69 6e 67 20 74 65 73 74 20 22 20 6e 65 77 2d 74  ing test " new-t
87d0: 65 73 74 2d 6e 61 6d 65 20 22 20 61 73 20 69 74  est-name " as it
87e0: 20 69 73 20 73 74 61 74 65 20 5c 22 22 20 28 74   is state \"" (t
87f0: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65  est:get-state te
8800: 73 74 64 61 74 29 20 0a 09 09 09 09 22 5c 22 20  stdat) ....."\" 
8810: 61 6e 64 20 73 74 61 74 75 73 20 5c 22 22 20 28  and status \"" (
8820: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20  test:get-status 
8830: 74 65 73 74 64 61 74 29 20 22 5c 22 2c 20 75 73  testdat) "\", us
8840: 65 20 2d 72 65 72 75 6e 20 5c 22 22 20 28 74 65  e -rerun \"" (te
8850: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65  st:get-status te
8860: 73 74 64 61 74 29 0a 20 20 20 20 20 20 20 20 20  stdat).         
8870: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
8880: 20 20 20 20 20 20 20 22 5c 22 20 6f 72 20 2d 66         "\" or -f
8890: 6f 72 63 65 20 74 6f 20 6f 76 65 72 72 69 64 65  orce to override
88a0: 22 29 29 0a 09 20 20 20 20 20 20 20 3b 3b 20 4e  "))..       ;; N
88b0: 4f 54 45 3a 20 4e 6f 20 6c 6f 6e 67 65 72 20 62  OTE: No longer b
88c0: 65 20 63 68 65 63 6b 69 6e 67 20 70 72 65 72 65  e checking prere
88d0: 71 75 69 73 69 74 65 73 20 68 65 72 65 21 20 57  quisites here! W
88e0: 69 6c 6c 20 6e 65 76 65 72 20 67 65 74 20 68 65  ill never get he
88f0: 72 65 20 75 6e 6c 65 73 73 20 70 72 65 72 65 71  re unless prereq
8900: 73 20 61 72 65 0a 09 20 20 20 20 20 20 20 3b 3b  s are..       ;;
8910: 20 20 20 20 20 20 20 61 6c 72 65 61 64 79 20 6d         already m
8920: 65 74 2e 0a 09 20 20 20 20 20 20 20 28 69 66 20  et...       (if 
8930: 28 6e 6f 74 20 28 6c 61 75 6e 63 68 2d 74 65 73  (not (launch-tes
8940: 74 20 23 66 20 72 75 6e 2d 69 64 20 72 75 6e 6e  t #f run-id runn
8950: 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 20 6b 65  ame test-conf ke
8960: 79 76 61 6c 6c 73 74 20 74 65 73 74 2d 6e 61 6d  yvallst test-nam
8970: 65 20 74 65 73 74 2d 70 61 74 68 20 69 74 65 6d  e test-path item
8980: 64 61 74 20 66 6c 61 67 73 29 29 0a 09 09 20 20  dat flags))...  
8990: 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20 28   (begin...     (
89a0: 70 72 69 6e 74 20 22 45 52 52 4f 52 3a 20 46 61  print "ERROR: Fa
89b0: 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 74  iled to launch t
89c0: 68 65 20 74 65 73 74 2e 20 45 78 69 74 69 6e 67  he test. Exiting
89d0: 20 61 73 20 73 6f 6f 6e 20 61 73 20 70 6f 73 73   as soon as poss
89e0: 69 62 6c 65 22 29 0a 09 09 20 20 20 20 20 28 73  ible")...     (s
89f0: 65 74 21 20 2a 67 6c 6f 62 61 6c 65 78 69 74 73  et! *globalexits
8a00: 74 61 74 75 73 2a 20 31 29 20 3b 3b 20 0a 09 09  tatus* 1) ;; ...
8a10: 20 20 20 20 20 28 70 72 6f 63 65 73 73 2d 73 69       (process-si
8a20: 67 6e 61 6c 20 28 63 75 72 72 65 6e 74 2d 70 72  gnal (current-pr
8a30: 6f 63 65 73 73 2d 69 64 29 20 73 69 67 6e 61 6c  ocess-id) signal
8a40: 2f 6b 69 6c 6c 29 29 29 29 29 29 0a 09 28 28 4b  /kill))))))..((K
8a50: 49 4c 4c 45 44 29 20 0a 09 20 28 64 65 62 75 67  ILLED) .. (debug
8a60: 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20  :print 1 "NOTE: 
8a70: 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20  " new-test-name 
8a80: 22 20 69 73 20 61 6c 72 65 61 64 79 20 72 75 6e  " is already run
8a90: 6e 69 6e 67 20 6f 72 20 77 61 73 20 65 78 70 6c  ning or was expl
8aa0: 69 63 74 6c 79 20 6b 69 6c 6c 65 64 2c 20 75 73  ictly killed, us
8ab0: 65 20 2d 66 6f 72 63 65 20 74 6f 20 6c 61 75 6e  e -force to laun
8ac0: 63 68 20 69 74 2e 22 29 29 0a 09 28 28 4c 41 55  ch it."))..((LAU
8ad0: 4e 43 48 45 44 20 52 45 4d 4f 54 45 48 4f 53 54  NCHED REMOTEHOST
8ae0: 53 54 41 52 54 20 52 55 4e 4e 49 4e 47 29 20 20  START RUNNING)  
8af0: 0a 09 20 28 69 66 20 28 3e 20 28 2d 20 28 63 75  .. (if (> (- (cu
8b00: 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73 29 28 2b  rrent-seconds)(+
8b10: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 65 76   (db:test-get-ev
8b20: 65 6e 74 5f 74 69 6d 65 20 74 65 73 74 64 61 74  ent_time testdat
8b30: 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 64 62  ).....       (db
8b40: 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 5f 64 75  :test-get-run_du
8b50: 72 61 74 69 6f 6e 20 74 65 73 74 64 61 74 29 29  ration testdat))
8b60: 29 0a 09 09 36 30 30 29 20 3b 3b 20 69 2e 65 2e  )...600) ;; i.e.
8b70: 20 6e 6f 20 75 70 64 61 74 65 20 66 6f 72 20 6d   no update for m
8b80: 6f 72 65 20 74 68 61 6e 20 36 30 30 20 73 65 63  ore than 600 sec
8b90: 6f 6e 64 73 0a 09 20 20 20 20 20 28 62 65 67 69  onds..     (begi
8ba0: 6e 0a 09 20 20 20 20 20 20 20 28 64 65 62 75 67  n..       (debug
8bb0: 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e  :print 0 "WARNIN
8bc0: 47 3a 20 54 65 73 74 20 22 20 74 65 73 74 2d 6e  G: Test " test-n
8bd0: 61 6d 65 20 22 20 61 70 70 65 61 72 73 20 74 6f  ame " appears to
8be0: 20 62 65 20 64 65 61 64 2e 20 46 6f 72 63 69 6e   be dead. Forcin
8bf0: 67 20 69 74 20 74 6f 20 73 74 61 74 65 20 49 4e  g it to state IN
8c00: 43 4f 4d 50 4c 45 54 45 20 61 6e 64 20 73 74 61  COMPLETE and sta
8c10: 74 75 73 20 53 54 55 43 4b 2f 44 45 41 44 22 29  tus STUCK/DEAD")
8c20: 0a 09 20 20 20 20 20 20 20 28 74 65 73 74 73 3a  ..       (tests:
8c30: 74 65 73 74 2d 73 65 74 2d 73 74 61 74 75 73 21  test-set-status!
8c40: 20 74 65 73 74 2d 69 64 20 22 49 4e 43 4f 4d 50   test-id "INCOMP
8c50: 4c 45 54 45 22 20 22 53 54 55 43 4b 2f 44 45 41  LETE" "STUCK/DEA
8c60: 44 22 20 22 54 65 73 74 20 69 73 20 73 74 75 63  D" "Test is stuc
8c70: 6b 20 6f 72 20 64 65 61 64 22 20 23 66 29 29 0a  k or dead" #f)).
8c80: 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  .     (debug:pri
8c90: 6e 74 20 32 20 22 4e 4f 54 45 3a 20 22 20 74 65  nt 2 "NOTE: " te
8ca0: 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72  st-name " is alr
8cb0: 65 61 64 79 20 72 75 6e 6e 69 6e 67 22 29 29 29  eady running")))
8cc0: 0a 09 28 65 6c 73 65 20 20 20 20 20 20 20 28 64  ..(else       (d
8cd0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
8ce0: 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c  ROR: Failed to l
8cf0: 61 75 6e 63 68 20 74 65 73 74 20 22 20 6e 65 77  aunch test " new
8d00: 2d 74 65 73 74 2d 6e 61 6d 65 20 22 2e 20 55 6e  -test-name ". Un
8d10: 72 65 63 6f 67 6e 69 73 65 64 20 73 74 61 74 65  recognised state
8d20: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61   " (test:get-sta
8d30: 74 65 20 74 65 73 74 64 61 74 29 29 29 29 29 29  te testdat))))))
8d40: 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  )..;;===========
8d50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8d60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8d70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8d80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 45  ===========.;; E
8d90: 4e 44 20 4f 46 20 4e 45 57 20 53 54 55 46 46 0a  ND OF NEW STUFF.
8da0: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;;==============
8db0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8dc0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8dd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8de0: 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e  ========..(defin
8df0: 65 20 28 67 65 74 2d 64 69 72 2d 75 70 2d 6e 20  e (get-dir-up-n 
8e00: 64 69 72 20 2e 20 70 61 72 61 6d 73 29 20 0a 20  dir . params) . 
8e10: 20 28 6c 65 74 20 28 28 64 70 61 72 74 73 20 20   (let ((dparts  
8e20: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 64 69  (string-split di
8e30: 72 20 22 2f 22 29 29 0a 09 28 63 6f 75 6e 74 20  r "/"))..(count 
8e40: 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 70 61 72    (if (null? par
8e50: 61 6d 73 29 20 31 20 28 63 61 72 20 70 61 72 61  ams) 1 (car para
8e60: 6d 73 29 29 29 29 0a 20 20 20 20 28 63 6f 6e 63  ms)))).    (conc
8e70: 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74   "/" (string-int
8e80: 65 72 73 70 65 72 73 65 20 0a 09 20 20 20 20 20  ersperse ..     
8e90: 20 20 28 74 61 6b 65 20 64 70 61 72 74 73 20 28    (take dparts (
8ea0: 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73  - (length dparts
8eb0: 29 20 63 6f 75 6e 74 29 29 0a 09 20 20 20 20 20  ) count))..     
8ec0: 20 20 22 2f 22 29 29 29 29 0a 3b 3b 20 52 65 6d    "/")))).;; Rem
8ed0: 6f 76 65 20 72 75 6e 73 0a 3b 3b 20 66 69 65 6c  ove runs.;; fiel
8ee0: 64 73 20 61 72 65 20 70 61 73 73 69 6e 67 20 69  ds are passing i
8ef0: 6e 20 74 68 72 6f 75 67 68 20 0a 3b 3b 20 61 63  n through .;; ac
8f00: 74 69 6f 6e 3a 0a 3b 3b 20 20 20 20 27 72 65 6d  tion:.;;    'rem
8f10: 6f 76 65 2d 72 75 6e 73 0a 3b 3b 20 20 20 20 27  ove-runs.;;    '
8f20: 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73  set-state-status
8f30: 0a 3b 3b 0a 3b 3b 20 4e 42 2f 2f 20 73 68 6f 75  .;;.;; NB// shou
8f40: 6c 64 20 70 61 73 73 20 69 6e 20 6b 65 79 73 3f  ld pass in keys?
8f50: 0a 3b 3b 0a 28 64 65 66 69 6e 65 20 28 72 75 6e  .;;.(define (run
8f60: 73 3a 6f 70 65 72 61 74 65 2d 6f 6e 20 61 63 74  s:operate-on act
8f70: 69 6f 6e 20 72 75 6e 6e 61 6d 65 70 61 74 74 20  ion runnamepatt 
8f80: 74 65 73 74 70 61 74 74 20 23 21 6b 65 79 20 28  testpatt #!key (
8f90: 73 74 61 74 65 20 23 66 29 28 73 74 61 74 75 73  state #f)(status
8fa0: 20 23 66 29 28 6e 65 77 2d 73 74 61 74 65 2d 73   #f)(new-state-s
8fb0: 74 61 74 75 73 20 23 66 29 29 0a 20 20 28 63 6f  tatus #f)).  (co
8fc0: 6d 6d 6f 6e 3a 63 6c 65 61 72 2d 63 61 63 68 65  mmon:clear-cache
8fd0: 73 29 20 3b 3b 20 63 6c 65 61 72 20 61 6c 6c 20  s) ;; clear all 
8fe0: 63 61 63 68 65 73 0a 20 20 28 6c 65 74 2a 20 28  caches.  (let* (
8ff0: 28 64 62 20 20 20 20 20 20 20 20 20 20 20 23 66  (db           #f
9000: 29 0a 09 20 28 6b 65 79 73 20 20 20 20 20 20 20  ).. (keys       
9010: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73    (open-run-clos
9020: 65 20 64 62 3a 67 65 74 2d 6b 65 79 73 20 64 62  e db:get-keys db
9030: 29 29 0a 09 20 28 72 75 6e 64 61 74 20 20 20 20  )).. (rundat    
9040: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f     (open-run-clo
9050: 73 65 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73  se runs:get-runs
9060: 2d 62 79 2d 70 61 74 74 20 64 62 20 6b 65 79 73  -by-patt db keys
9070: 20 72 75 6e 6e 61 6d 65 70 61 74 74 29 29 0a 09   runnamepatt))..
9080: 20 28 68 65 61 64 65 72 20 20 20 20 20 20 20 28   (header       (
9090: 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61  vector-ref runda
90a0: 74 20 30 29 29 0a 09 20 28 72 75 6e 73 20 20 20  t 0)).. (runs   
90b0: 20 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65        (vector-re
90c0: 66 20 72 75 6e 64 61 74 20 31 29 29 0a 09 20 28  f rundat 1)).. (
90d0: 73 74 61 74 65 73 20 20 20 20 20 20 20 28 69 66  states       (if
90e0: 20 73 74 61 74 65 20 20 28 73 74 72 69 6e 67 2d   state  (string-
90f0: 73 70 6c 69 74 20 73 74 61 74 65 20 20 22 2c 22  split state  ","
9100: 29 20 27 28 29 29 29 0a 09 20 28 73 74 61 74 75  ) '())).. (statu
9110: 73 65 73 20 20 20 20 20 28 69 66 20 73 74 61 74  ses     (if stat
9120: 75 73 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74  us (string-split
9130: 20 73 74 61 74 75 73 20 22 2c 22 29 20 27 28 29   status ",") '()
9140: 29 29 0a 09 20 28 73 74 61 74 65 2d 73 74 61 74  )).. (state-stat
9150: 75 73 20 28 69 66 20 28 73 74 72 69 6e 67 3f 20  us (if (string? 
9160: 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73  new-state-status
9170: 29 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20  ) (string-split 
9180: 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73  new-state-status
9190: 20 22 2c 22 29 20 27 28 23 66 20 23 66 29 29 29   ",") '(#f #f)))
91a0: 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ).    (debug:pri
91b0: 6e 74 2d 69 6e 66 6f 20 34 20 22 72 75 6e 73 3a  nt-info 4 "runs:
91c0: 6f 70 65 72 61 74 65 2d 6f 6e 20 3d 3e 20 48 65  operate-on => He
91d0: 61 64 65 72 3a 20 22 20 68 65 61 64 65 72 20 22  ader: " header "
91e0: 20 61 63 74 69 6f 6e 3a 20 22 20 61 63 74 69 6f   action: " actio
91f0: 6e 20 22 20 6e 65 77 2d 73 74 61 74 65 2d 73 74  n " new-state-st
9200: 61 74 75 73 3a 20 22 20 6e 65 77 2d 73 74 61 74  atus: " new-stat
9210: 65 2d 73 74 61 74 75 73 29 0a 20 20 20 20 28 69  e-status).    (i
9220: 66 20 28 3e 20 32 20 28 6c 65 6e 67 74 68 20 73  f (> 2 (length s
9230: 74 61 74 65 2d 73 74 61 74 75 73 29 29 0a 09 28  tate-status))..(
9240: 62 65 67 69 6e 0a 09 20 20 28 64 65 62 75 67 3a  begin..  (debug:
9250: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
9260: 74 68 65 20 70 61 72 61 6d 65 74 65 72 20 74 6f  the parameter to
9270: 20 2d 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74   -set-state-stat
9280: 75 73 20 69 73 20 61 20 63 6f 6d 6d 61 20 64 65  us is a comma de
9290: 6c 69 6d 69 74 65 64 20 73 74 72 69 6e 67 2e 20  limited string. 
92a0: 45 2e 67 2e 20 43 4f 4d 50 4c 45 54 45 44 2c 46  E.g. COMPLETED,F
92b0: 41 49 4c 22 29 0a 09 20 20 28 65 78 69 74 29 29  AIL")..  (exit))
92c0: 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 0a  ).    (for-each.
92d0: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 72 75       (lambda (ru
92e0: 6e 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28  n).       (let (
92f0: 28 72 75 6e 6b 65 79 20 28 73 74 72 69 6e 67 2d  (runkey (string-
9300: 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61 70  intersperse (map
9310: 20 28 6c 61 6d 62 64 61 20 28 6b 29 0a 09 09 09   (lambda (k)....
9320: 09 09 09 28 64 62 3a 67 65 74 2d 76 61 6c 75 65  ...(db:get-value
9330: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68  -by-header run h
9340: 65 61 64 65 72 20 28 76 65 63 74 6f 72 2d 72 65  eader (vector-re
9350: 66 20 6b 20 30 29 29 29 20 6b 65 79 73 29 20 22  f k 0))) keys) "
9360: 2f 22 29 29 0a 09 20 20 20 20 20 28 64 69 72 73  /"))..     (dirs
9370: 2d 74 6f 2d 72 65 6d 6f 76 65 20 28 6d 61 6b 65  -to-remove (make
9380: 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 09  -hash-table)))..
9390: 20 28 6c 65 74 2a 20 28 28 72 75 6e 2d 69 64 20   (let* ((run-id 
93a0: 20 20 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65     (db:get-value
93b0: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68  -by-header run h
93c0: 65 61 64 65 72 20 22 69 64 22 29 29 0a 09 09 28  eader "id"))...(
93d0: 72 75 6e 2d 73 74 61 74 65 20 28 64 62 3a 67 65  run-state (db:ge
93e0: 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65  t-value-by-heade
93f0: 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 73 74  r run header "st
9400: 61 74 65 22 29 29 0a 09 09 28 74 65 73 74 73 20  ate"))...(tests 
9410: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 65 71      (if (not (eq
9420: 75 61 6c 3f 20 72 75 6e 2d 73 74 61 74 65 20 22  ual? run-state "
9430: 6c 6f 63 6b 65 64 22 29 29 0a 09 09 09 20 20 20  locked"))....   
9440: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c      (open-run-cl
9450: 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 73  ose db:get-tests
9460: 2d 66 6f 72 2d 72 75 6e 20 64 62 20 72 75 6e 2d  -for-run db run-
9470: 69 64 0a 09 09 09 09 09 09 20 20 20 20 20 20 74  id.......      t
9480: 65 73 74 70 61 74 74 20 73 74 61 74 65 73 20 73  estpatt states s
9490: 74 61 74 75 73 65 73 0a 09 09 09 09 09 09 20 20  tatuses.......  
94a0: 20 20 20 20 6e 6f 74 2d 69 6e 3a 20 20 23 66 0a      not-in:  #f.
94b0: 09 09 09 09 09 09 20 20 20 20 20 20 73 6f 72 74  ......      sort
94c0: 2d 62 79 3a 20 28 63 61 73 65 20 61 63 74 69 6f  -by: (case actio
94d0: 6e 0a 09 09 09 09 09 09 09 09 20 28 28 72 65 6d  n......... ((rem
94e0: 6f 76 65 2d 72 75 6e 73 29 20 27 72 75 6e 64 69  ove-runs) 'rundi
94f0: 72 29 0a 09 09 09 09 09 09 09 09 20 28 65 6c 73  r)......... (els
9500: 65 20 20 20 20 20 20 20 20 20 20 27 65 76 65 6e  e          'even
9510: 74 5f 74 69 6d 65 29 29 29 0a 09 09 09 20 20 20  t_time)))....   
9520: 20 20 20 20 27 28 29 29 29 0a 09 09 28 6c 61 73      '()))...(las
9530: 74 74 70 61 74 68 20 22 2f 64 6f 65 73 2f 6e 6f  ttpath "/does/no
9540: 74 2f 65 78 69 73 74 2f 49 2f 68 6f 70 65 22 29  t/exist/I/hope")
9550: 29 0a 09 20 20 20 28 64 65 62 75 67 3a 70 72 69  )..   (debug:pri
9560: 6e 74 2d 69 6e 66 6f 20 34 20 22 72 75 6e 73 3a  nt-info 4 "runs:
9570: 6f 70 65 72 61 74 65 2d 6f 6e 20 72 75 6e 3d 22  operate-on run="
9580: 20 72 75 6e 20 22 2c 20 68 65 61 64 65 72 3d 22   run ", header="
9590: 20 68 65 61 64 65 72 29 0a 09 20 20 20 28 69 66   header)..   (if
95a0: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 73   (not (null? tes
95b0: 74 73 29 29 0a 09 20 20 20 20 20 20 20 28 62 65  ts))..       (be
95c0: 67 69 6e 0a 09 09 20 28 63 61 73 65 20 61 63 74  gin... (case act
95d0: 69 6f 6e 0a 09 09 20 20 20 28 28 72 65 6d 6f 76  ion...   ((remov
95e0: 65 2d 72 75 6e 73 29 0a 09 09 20 20 20 20 28 64  e-runs)...    (d
95f0: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65  ebug:print 1 "Re
9600: 6d 6f 76 69 6e 67 20 74 65 73 74 73 20 66 6f 72  moving tests for
9610: 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22   run: " runkey "
9620: 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65   " (db:get-value
9630: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68  -by-header run h
9640: 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29  eader "runname")
9650: 29 29 0a 09 09 20 20 20 28 28 73 65 74 2d 73 74  ))...   ((set-st
9660: 61 74 65 2d 73 74 61 74 75 73 29 0a 09 09 20 20  ate-status)...  
9670: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31    (debug:print 1
9680: 20 22 4d 6f 64 69 66 79 69 6e 67 20 73 74 61 74   "Modifying stat
9690: 65 20 61 6e 64 20 73 74 61 75 73 20 66 6f 72 20  e and staus for 
96a0: 74 65 73 74 73 20 66 6f 72 20 72 75 6e 3a 20 22  tests for run: "
96b0: 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a   runkey " " (db:
96c0: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61  get-value-by-hea
96d0: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22  der run header "
96e0: 72 75 6e 6e 61 6d 65 22 29 29 29 0a 09 09 20 20  runname")))...  
96f0: 20 28 28 70 72 69 6e 74 2d 72 75 6e 29 0a 09 09   ((print-run)...
9700: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
9710: 20 31 20 22 50 72 69 6e 74 69 6e 67 20 69 6e 66   1 "Printing inf
9720: 6f 20 66 6f 72 20 72 75 6e 20 22 20 72 75 6e 6b  o for run " runk
9730: 65 79 20 22 2c 20 72 75 6e 3d 22 20 72 75 6e 20  ey ", run=" run 
9740: 22 2c 20 74 65 73 74 73 3d 22 20 74 65 73 74 73  ", tests=" tests
9750: 20 22 2c 20 68 65 61 64 65 72 3d 22 20 68 65 61   ", header=" hea
9760: 64 65 72 29 0a 09 09 20 20 20 20 61 63 74 69 6f  der)...    actio
9770: 6e 29 0a 09 09 20 20 20 28 65 6c 73 65 0a 09 09  n)...   (else...
9780: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
9790: 2d 69 6e 66 6f 20 30 20 22 61 63 74 69 6f 6e 20  -info 0 "action 
97a0: 6e 6f 74 20 72 65 63 6f 67 6e 69 73 65 64 20 22  not recognised "
97b0: 20 61 63 74 69 6f 6e 29 29 29 0a 09 09 20 28 66   action)))... (f
97c0: 6f 72 2d 65 61 63 68 0a 09 09 20 20 28 6c 61 6d  or-each...  (lam
97d0: 62 64 61 20 28 74 65 73 74 29 0a 09 09 20 20 20  bda (test)...   
97e0: 20 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d 70 61   (let* ((item-pa
97f0: 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  th (db:test-get-
9800: 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29  item-path test))
9810: 0a 09 09 09 20 20 20 28 74 65 73 74 2d 6e 61 6d  ....   (test-nam
9820: 65 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74  e (db:test-get-t
9830: 65 73 74 6e 61 6d 65 20 74 65 73 74 29 29 0a 09  estname test))..
9840: 09 09 20 20 20 28 72 75 6e 2d 64 69 72 20 20 20  ..   (run-dir   
9850: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e  (db:test-get-run
9860: 64 69 72 20 74 65 73 74 29 29 20 20 20 20 3b 3b  dir test))    ;;
9870: 20 72 75 6e 20 64 69 72 20 69 73 20 66 72 6f 6d   run dir is from
9880: 20 74 68 65 20 6c 69 6e 6b 20 74 72 65 65 0a 09   the link tree..
9890: 09 09 20 20 20 28 72 65 61 6c 2d 64 69 72 20 20  ..   (real-dir  
98a0: 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73  (if (file-exists
98b0: 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 09 09  ? run-dir)......
98c0: 20 20 28 72 65 73 6f 6c 76 65 2d 70 61 74 68 6e    (resolve-pathn
98d0: 61 6d 65 20 72 75 6e 2d 64 69 72 29 0a 09 09 09  ame run-dir)....
98e0: 09 09 20 20 23 66 29 29 0a 09 09 09 20 20 20 28  ..  #f))....   (
98f0: 74 65 73 74 2d 69 64 20 20 20 28 64 62 3a 74 65  test-id   (db:te
9900: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29 29  st-get-id test))
9910: 29 0a 09 09 20 20 20 20 20 20 3b 3b 20 20 20 28  )...      ;;   (
9920: 74 64 62 20 20 20 20 20 20 20 28 64 62 3a 6f 70  tdb       (db:op
9930: 65 6e 2d 74 65 73 74 2d 64 62 20 72 75 6e 2d 64  en-test-db run-d
9940: 69 72 29 29 29 0a 09 09 20 20 20 20 20 20 28 64  ir)))...      (d
9950: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
9960: 34 20 22 74 65 73 74 3d 22 20 74 65 73 74 29 20  4 "test=" test) 
9970: 3b 3b 20 20 20 22 20 28 64 62 3a 74 65 73 74 2d  ;;   " (db:test-
9980: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73  get-testname tes
9990: 74 29 20 22 20 69 64 3a 20 22 20 28 64 62 3a 74  t) " id: " (db:t
99a0: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29  est-get-id test)
99b0: 20 22 20 22 20 69 74 65 6d 2d 70 61 74 68 20 22   " " item-path "
99c0: 20 61 63 74 69 6f 6e 3a 20 22 20 61 63 74 69 6f   action: " actio
99d0: 6e 29 0a 09 09 20 20 20 20 20 20 28 63 61 73 65  n)...      (case
99e0: 20 61 63 74 69 6f 6e 0a 09 09 09 28 28 72 65 6d   action....((rem
99f0: 6f 76 65 2d 72 75 6e 73 29 20 3b 3b 20 74 68 65  ove-runs) ;; the
9a00: 20 74 64 62 20 69 73 20 66 6f 72 20 66 75 74 75   tdb is for futu
9a10: 72 65 20 70 6f 73 73 69 62 6c 65 2e 20 0a 09 09  re possible. ...
9a20: 09 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73  . (open-run-clos
9a30: 65 20 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74  e db:delete-test
9a40: 2d 72 65 63 6f 72 64 73 20 64 62 20 23 66 20 28  -records db #f (
9a50: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74  db:test-get-id t
9a60: 65 73 74 29 29 0a 09 09 09 20 28 64 65 62 75 67  est)).... (debug
9a70: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 41  :print-info 1 "A
9a80: 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 72 65 6d  ttempting to rem
9a90: 6f 76 65 20 22 20 28 69 66 20 72 65 61 6c 2d 64  ove " (if real-d
9aa0: 69 72 20 28 63 6f 6e 63 20 22 20 64 69 72 20 22  ir (conc " dir "
9ab0: 20 72 65 61 6c 2d 64 69 72 20 22 20 61 6e 64 20   real-dir " and 
9ac0: 22 29 20 22 22 29 20 22 20 6c 69 6e 6b 20 22 20  ") "") " link " 
9ad0: 72 75 6e 2d 64 69 72 29 0a 09 09 09 20 28 69 66  run-dir).... (if
9ae0: 20 28 61 6e 64 20 72 65 61 6c 2d 64 69 72 20 0a   (and real-dir .
9af0: 09 09 09 09 20 20 28 3e 20 28 73 74 72 69 6e 67  ....  (> (string
9b00: 2d 6c 65 6e 67 74 68 20 72 65 61 6c 2d 64 69 72  -length real-dir
9b10: 29 20 35 29 0a 09 09 09 09 20 20 28 66 69 6c 65  ) 5).....  (file
9b20: 2d 65 78 69 73 74 73 3f 20 72 65 61 6c 2d 64 69  -exists? real-di
9b30: 72 29 29 20 3b 3b 20 62 61 64 20 68 65 75 72 69  r)) ;; bad heuri
9b40: 73 74 69 63 20 62 75 74 20 73 68 6f 75 6c 64 20  stic but should 
9b50: 70 72 65 76 65 6e 74 20 2f 74 6d 70 20 2f 68 6f  prevent /tmp /ho
9b60: 6d 65 20 65 74 63 2e 0a 09 09 09 20 20 20 20 20  me etc.....     
9b70: 28 62 65 67 69 6e 20 3b 3b 20 6c 65 74 2a 20 28  (begin ;; let* (
9b80: 28 72 65 61 6c 70 61 74 68 20 28 72 65 73 6f 6c  (realpath (resol
9b90: 76 65 2d 70 61 74 68 6e 61 6d 65 20 72 75 6e 2d  ve-pathname run-
9ba0: 64 69 72 29 29 29 0a 09 09 09 20 20 20 20 20 20  dir)))....      
9bb0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
9bc0: 66 6f 20 31 20 22 52 65 63 75 72 73 69 76 65 6c  fo 1 "Recursivel
9bd0: 79 20 72 65 6d 6f 76 69 6e 67 20 22 20 72 65 61  y removing " rea
9be0: 6c 2d 64 69 72 29 0a 09 09 09 20 20 20 20 20 20  l-dir)....      
9bf0: 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74   (if (file-exist
9c00: 73 3f 20 72 65 61 6c 2d 64 69 72 29 0a 09 09 09  s? real-dir)....
9c10: 09 20 20 20 28 69 66 20 28 3e 20 28 73 79 73 74  .   (if (> (syst
9c20: 65 6d 20 28 63 6f 6e 63 20 22 72 6d 20 2d 72 66  em (conc "rm -rf
9c30: 20 22 20 72 65 61 6c 2d 64 69 72 29 29 20 30 29   " real-dir)) 0)
9c40: 0a 09 09 09 09 20 20 20 20 20 20 20 28 64 65 62  .....       (deb
9c50: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f  ug:print 0 "ERRO
9c60: 52 3a 20 54 68 65 72 65 20 77 61 73 20 61 20 70  R: There was a p
9c70: 72 6f 62 6c 65 6d 20 72 65 6d 6f 76 69 6e 67 20  roblem removing 
9c80: 22 20 72 65 61 6c 2d 64 69 72 20 22 20 77 69 74  " real-dir " wit
9c90: 68 20 72 6d 20 2d 66 22 29 29 0a 09 09 09 09 20  h rm -f"))..... 
9ca0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
9cb0: 20 22 57 41 52 4e 49 4e 47 3a 20 74 65 73 74 20   "WARNING: test 
9cc0: 64 69 72 20 22 20 72 65 61 6c 2d 64 69 72 20 22  dir " real-dir "
9cd0: 20 61 70 70 65 61 72 73 20 74 6f 20 6e 6f 74 20   appears to not 
9ce0: 65 78 69 73 74 20 6f 72 20 69 73 20 6e 6f 74 20  exist or is not 
9cf0: 72 65 61 64 61 62 6c 65 22 29 29 29 0a 09 09 09  readable")))....
9d00: 20 20 20 20 20 28 69 66 20 72 65 61 6c 2d 64 69       (if real-di
9d10: 72 20 0a 09 09 09 09 20 28 64 65 62 75 67 3a 70  r ..... (debug:p
9d20: 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a  rint 0 "WARNING:
9d30: 20 64 69 72 65 63 74 6f 72 79 20 22 20 72 65 61   directory " rea
9d40: 6c 2d 64 69 72 20 22 20 64 6f 65 73 20 6e 6f 74  l-dir " does not
9d50: 20 65 78 69 73 74 22 29 0a 09 09 09 09 20 28 64   exist")..... (d
9d60: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41  ebug:print 0 "WA
9d70: 52 4e 49 4e 47 3a 20 6e 6f 20 72 65 61 6c 20 64  RNING: no real d
9d80: 69 72 65 63 74 6f 72 79 20 63 6f 72 72 6f 73 70  irectory corrosp
9d90: 6f 6e 64 69 6e 67 20 74 6f 20 6c 69 6e 6b 20 22  onding to link "
9da0: 20 72 75 6e 2d 64 69 72 20 22 2c 20 6e 6f 74 68   run-dir ", noth
9db0: 69 6e 67 20 64 6f 6e 65 22 29 29 29 0a 09 09 09  ing done")))....
9dc0: 20 28 69 66 20 28 73 79 6d 62 6f 6c 69 63 2d 6c   (if (symbolic-l
9dd0: 69 6e 6b 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09  ink? run-dir)...
9de0: 09 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09  .     (begin....
9df0: 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72         (debug:pr
9e00: 69 6e 74 2d 69 6e 66 6f 20 31 20 22 52 65 6d 6f  int-info 1 "Remo
9e10: 76 69 6e 67 20 73 79 6d 6c 69 6e 6b 20 22 20 72  ving symlink " r
9e20: 75 6e 2d 64 69 72 29 0a 09 09 09 20 20 20 20 20  un-dir)....     
9e30: 20 20 28 68 61 6e 64 6c 65 2d 65 78 63 65 70 74    (handle-except
9e40: 69 6f 6e 73 0a 09 09 09 09 65 78 6e 0a 09 09 09  ions.....exn....
9e50: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20  .(debug:print 0 
9e60: 22 45 52 52 4f 52 3a 20 20 46 61 69 6c 65 64 20  "ERROR:  Failed 
9e70: 74 6f 20 72 65 6d 6f 76 65 20 73 79 6d 6c 69 6e  to remove symlin
9e80: 6b 20 22 20 72 75 6e 2d 64 69 72 20 28 28 63 6f  k " run-dir ((co
9e90: 6e 64 69 74 69 6f 6e 2d 70 72 6f 70 65 72 74 79  ndition-property
9ea0: 2d 61 63 63 65 73 73 6f 72 20 27 65 78 6e 20 27  -accessor 'exn '
9eb0: 6d 65 73 73 61 67 65 29 20 65 78 6e 29 20 22 2c  message) exn) ",
9ec0: 20 61 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 63   attempting to c
9ed0: 6f 6e 74 69 6e 75 65 22 29 0a 09 09 09 09 28 64  ontinue").....(d
9ee0: 65 6c 65 74 65 2d 66 69 6c 65 20 72 75 6e 2d 64  elete-file run-d
9ef0: 69 72 29 29 29 0a 09 09 09 20 20 20 20 20 28 69  ir)))....     (i
9f00: 66 20 28 64 69 72 65 63 74 6f 72 79 3f 20 72 75  f (directory? ru
9f10: 6e 2d 64 69 72 29 0a 09 09 09 09 20 28 69 66 20  n-dir)..... (if 
9f20: 28 3e 20 28 64 69 72 65 63 74 6f 72 79 2d 66 6f  (> (directory-fo
9f30: 6c 64 20 28 6c 61 6d 62 64 61 20 28 66 20 78 29  ld (lambda (f x)
9f40: 28 2b 20 31 20 78 29 29 20 30 20 72 75 6e 2d 64  (+ 1 x)) 0 run-d
9f50: 69 72 29 20 30 29 0a 09 09 09 09 20 20 20 20 20  ir) 0).....     
9f60: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
9f70: 57 41 52 4e 49 4e 47 3a 20 72 65 66 75 73 69 6e  WARNING: refusin
9f80: 67 20 74 6f 20 72 65 6d 6f 76 65 20 22 20 72 75  g to remove " ru
9f90: 6e 2d 64 69 72 20 22 20 61 73 20 69 74 20 69 73  n-dir " as it is
9fa0: 20 6e 6f 74 20 65 6d 70 74 79 22 29 0a 09 09 09   not empty")....
9fb0: 09 20 20 20 20 20 20 28 68 61 6e 64 6c 65 2d 65  .      (handle-e
9fc0: 78 63 65 70 74 69 6f 6e 73 0a 09 09 09 09 20 20  xceptions.....  
9fd0: 20 20 20 20 20 65 78 6e 0a 09 09 09 09 20 20 20       exn.....   
9fe0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
9ff0: 20 30 20 22 45 52 52 4f 52 3a 20 20 46 61 69 6c   0 "ERROR:  Fail
a000: 65 64 20 74 6f 20 72 65 6d 6f 76 65 20 64 69 72  ed to remove dir
a010: 65 63 74 6f 72 79 20 22 20 72 75 6e 2d 64 69 72  ectory " run-dir
a020: 20 28 28 63 6f 6e 64 69 74 69 6f 6e 2d 70 72 6f   ((condition-pro
a030: 70 65 72 74 79 2d 61 63 63 65 73 73 6f 72 20 27  perty-accessor '
a040: 65 78 6e 20 27 6d 65 73 73 61 67 65 29 20 65 78  exn 'message) ex
a050: 6e 29 20 22 2c 20 61 74 74 65 6d 70 74 69 6e 67  n) ", attempting
a060: 20 74 6f 20 63 6f 6e 74 69 6e 75 65 22 29 0a 09   to continue")..
a070: 09 09 09 20 20 20 20 20 20 20 28 64 65 6c 65 74  ...       (delet
a080: 65 2d 64 69 72 65 63 74 6f 72 79 20 72 75 6e 2d  e-directory run-
a090: 64 69 72 29 29 29 0a 09 09 09 09 20 28 69 66 20  dir)))..... (if 
a0a0: 72 75 6e 2d 64 69 72 0a 09 09 09 09 20 20 20 20  run-dir.....    
a0b0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
a0c0: 22 57 41 52 4e 49 4e 47 3a 20 6e 6f 74 20 72 65  "WARNING: not re
a0d0: 6d 6f 76 69 6e 67 20 22 20 72 75 6e 2d 64 69 72  moving " run-dir
a0e0: 20 22 20 61 73 20 69 74 20 65 69 74 68 65 72 20   " as it either 
a0f0: 64 6f 65 73 6e 27 74 20 65 78 69 73 74 20 6f 72  doesn't exist or
a100: 20 69 73 20 6e 6f 74 20 61 20 73 79 6d 6c 69 6e   is not a symlin
a110: 6b 22 29 0a 09 09 09 09 20 20 20 20 20 28 64 65  k").....     (de
a120: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 4e 4f 54  bug:print 0 "NOT
a130: 45 3a 20 74 68 65 20 72 75 6e 20 64 69 72 20 66  E: the run dir f
a140: 6f 72 20 74 68 69 73 20 74 65 73 74 20 69 73 20  or this test is 
a150: 75 6e 64 65 66 69 6e 65 64 2e 20 54 65 73 74 20  undefined. Test 
a160: 6d 61 79 20 68 61 76 65 20 61 6c 72 65 61 64 79  may have already
a170: 20 62 65 65 6e 20 64 65 6c 65 74 65 64 2e 22 29   been deleted.")
a180: 29 0a 09 09 09 09 20 29 29 29 0a 09 09 09 28 28  )..... )))....((
a190: 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73  set-state-status
a1a0: 29 0a 09 09 09 20 28 64 65 62 75 67 3a 70 72 69  ).... (debug:pri
a1b0: 6e 74 2d 69 6e 66 6f 20 32 20 22 6e 65 77 20 73  nt-info 2 "new s
a1c0: 74 61 74 65 20 22 20 28 63 61 72 20 73 74 61 74  tate " (car stat
a1d0: 65 2d 73 74 61 74 75 73 29 20 22 2c 20 6e 65 77  e-status) ", new
a1e0: 20 73 74 61 74 75 73 20 22 20 28 63 61 64 72 20   status " (cadr 
a1f0: 73 74 61 74 65 2d 73 74 61 74 75 73 29 29 0a 09  state-status))..
a200: 09 09 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f  .. (open-run-clo
a210: 73 65 20 64 62 3a 74 65 73 74 2d 73 65 74 2d 73  se db:test-set-s
a220: 74 61 74 65 2d 73 74 61 74 75 73 2d 62 79 2d 69  tate-status-by-i
a230: 64 20 64 62 20 28 64 62 3a 74 65 73 74 2d 67 65  d db (db:test-ge
a240: 74 2d 69 64 20 74 65 73 74 29 20 28 63 61 72 20  t-id test) (car 
a250: 73 74 61 74 65 2d 73 74 61 74 75 73 29 28 63 61  state-status)(ca
a260: 64 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 29  dr state-status)
a270: 20 23 66 29 29 29 29 29 0a 09 09 20 20 28 73 6f   #f)))))...  (so
a280: 72 74 20 74 65 73 74 73 20 28 6c 61 6d 62 64 61  rt tests (lambda
a290: 20 28 61 20 62 29 28 6c 65 74 20 28 28 64 69 72   (a b)(let ((dir
a2a0: 61 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72  a (db:test-get-r
a2b0: 75 6e 64 69 72 20 61 29 29 0a 09 09 09 09 09 09  undir a)).......
a2c0: 20 28 64 69 72 62 20 28 64 62 3a 74 65 73 74 2d   (dirb (db:test-
a2d0: 67 65 74 2d 72 75 6e 64 69 72 20 62 29 29 29 0a  get-rundir b))).
a2e0: 09 09 09 09 09 20 20 20 20 20 28 69 66 20 28 61  .....     (if (a
a2f0: 6e 64 20 28 73 74 72 69 6e 67 3f 20 64 69 72 61  nd (string? dira
a300: 29 28 73 74 72 69 6e 67 3f 20 64 69 72 62 29 29  )(string? dirb))
a310: 0a 09 09 09 09 09 09 20 28 3e 20 28 73 74 72 69  ....... (> (stri
a320: 6e 67 2d 6c 65 6e 67 74 68 20 64 69 72 61 29 28  ng-length dira)(
a330: 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 64 69  string-length di
a340: 72 62 29 29 0a 09 09 09 09 09 09 20 23 66 29 29  rb))....... #f))
a350: 29 29 29 29 29 0a 09 20 20 20 3b 3b 20 72 65 6d  )))))..   ;; rem
a360: 6f 76 65 20 74 68 65 20 72 75 6e 20 69 66 20 7a  ove the run if z
a370: 65 72 6f 20 74 65 73 74 73 20 72 65 6d 61 69 6e  ero tests remain
a380: 0a 09 20 20 20 28 69 66 20 28 65 71 3f 20 61 63  ..   (if (eq? ac
a390: 74 69 6f 6e 20 27 72 65 6d 6f 76 65 2d 72 75 6e  tion 'remove-run
a3a0: 73 29 0a 09 20 20 20 20 20 20 20 28 6c 65 74 20  s)..       (let 
a3b0: 28 28 72 65 6d 74 65 73 74 73 20 28 6f 70 65 6e  ((remtests (open
a3c0: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65  -run-close db:ge
a3d0: 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20  t-tests-for-run 
a3e0: 64 62 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65  db (db:get-value
a3f0: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68  -by-header run h
a400: 65 61 64 65 72 20 22 69 64 22 29 20 23 66 20 27  eader "id") #f '
a410: 28 22 44 45 4c 45 54 45 44 22 29 20 27 28 22 6e  ("DELETED") '("n
a420: 2f 61 22 29 20 6e 6f 74 2d 69 6e 3a 20 23 74 29  /a") not-in: #t)
a430: 29 29 0a 09 09 20 28 69 66 20 28 6e 75 6c 6c 3f  ))... (if (null?
a440: 20 72 65 6d 74 65 73 74 73 29 20 3b 3b 20 6e 6f   remtests) ;; no
a450: 20 6d 6f 72 65 20 74 65 73 74 73 20 72 65 6d 61   more tests rema
a460: 69 6e 69 6e 67 0a 09 09 20 20 20 20 20 28 6c 65  ining...     (le
a470: 74 2a 20 28 28 64 70 61 72 74 73 20 20 28 73 74  t* ((dparts  (st
a480: 72 69 6e 67 2d 73 70 6c 69 74 20 6c 61 73 74 74  ring-split lastt
a490: 70 61 74 68 20 22 2f 22 29 29 0a 09 09 09 20 20  path "/"))....  
a4a0: 20 20 28 72 75 6e 70 61 74 68 20 28 63 6f 6e 63    (runpath (conc
a4b0: 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74   "/" (string-int
a4c0: 65 72 73 70 65 72 73 65 20 0a 09 09 09 09 09 09  ersperse .......
a4d0: 28 74 61 6b 65 20 64 70 61 72 74 73 20 28 2d 20  (take dparts (- 
a4e0: 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73 29 20  (length dparts) 
a4f0: 31 29 29 0a 09 09 09 09 09 09 22 2f 22 29 29 29  1))......."/")))
a500: 29 0a 09 09 20 20 20 20 20 20 20 28 64 65 62 75  )...       (debu
a510: 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76  g:print 1 "Remov
a520: 69 6e 67 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65  ing run: " runke
a530: 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61  y " " (db:get-va
a540: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75  lue-by-header ru
a550: 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d  n header "runnam
a560: 65 22 29 20 22 20 61 6e 64 20 72 65 6c 61 74 65  e") " and relate
a570: 64 20 72 65 63 6f 72 64 22 29 0a 09 09 20 20 20  d record")...   
a580: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c      (open-run-cl
a590: 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 2d 72 75  ose db:delete-ru
a5a0: 6e 20 64 62 20 72 75 6e 2d 69 64 29 0a 09 09 20  n db run-id)... 
a5b0: 20 20 20 20 20 20 3b 3b 20 54 68 69 73 20 69 73        ;; This is
a5c0: 20 61 20 70 72 65 74 74 79 20 67 6f 6f 64 20 70   a pretty good p
a5d0: 6c 61 63 65 20 74 6f 20 70 75 72 67 65 20 6f 6c  lace to purge ol
a5e0: 64 20 44 45 4c 45 54 45 44 20 74 65 73 74 73 0a  d DELETED tests.
a5f0: 09 09 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72  ..       (open-r
a600: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65  un-close db:dele
a610: 74 65 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e  te-tests-for-run
a620: 20 64 62 20 72 75 6e 2d 69 64 29 0a 09 09 20 20   db run-id)...  
a630: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
a640: 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 2d 6f  lose db:delete-o
a650: 6c 64 2d 64 65 6c 65 74 65 64 2d 74 65 73 74 2d  ld-deleted-test-
a660: 72 65 63 6f 72 64 73 20 64 62 29 0a 09 09 20 20  records db)...  
a670: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
a680: 6c 6f 73 65 20 64 62 3a 73 65 74 2d 76 61 72 20  lose db:set-var 
a690: 64 62 20 22 44 45 4c 45 54 45 44 5f 54 45 53 54  db "DELETED_TEST
a6a0: 53 22 20 28 63 75 72 72 65 6e 74 2d 73 65 63 6f  S" (current-seco
a6b0: 6e 64 73 29 29 0a 09 09 20 20 20 20 20 20 20 3b  nds))...       ;
a6c0: 3b 20 6e 65 65 64 20 74 6f 20 66 69 67 75 72 65  ; need to figure
a6d0: 20 6f 75 74 20 74 68 65 20 70 61 74 68 20 74 6f   out the path to
a6e0: 20 74 68 65 20 72 75 6e 20 64 69 72 20 61 6e 64   the run dir and
a6f0: 20 72 65 6d 6f 76 65 20 69 74 20 69 66 20 65 6d   remove it if em
a700: 70 74 79 0a 09 09 20 20 20 20 20 20 20 3b 3b 20  pty...       ;; 
a710: 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 28 67     (if (null? (g
a720: 6c 6f 62 20 28 63 6f 6e 63 20 72 75 6e 70 61 74  lob (conc runpat
a730: 68 20 22 2f 2a 22 29 29 29 0a 09 09 20 20 20 20  h "/*")))...    
a740: 20 20 20 3b 3b 20 20 20 20 20 20 20 20 28 62 65     ;;        (be
a750: 67 69 6e 0a 09 09 20 20 20 20 20 20 20 3b 3b 20  gin...       ;; 
a760: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31  . (debug:print 1
a770: 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 20 64   "Removing run d
a780: 69 72 20 22 20 72 75 6e 70 61 74 68 29 0a 09 09  ir " runpath)...
a790: 20 20 20 20 20 20 20 3b 3b 20 09 20 28 73 79 73         ;; . (sys
a7a0: 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 64 69 72  tem (conc "rmdir
a7b0: 20 2d 70 20 22 20 72 75 6e 70 61 74 68 29 29 29   -p " runpath)))
a7c0: 29 0a 09 09 20 20 20 20 20 20 20 29 29 29 29 29  )...       )))))
a7d0: 0a 09 20 29 29 0a 20 20 20 20 20 72 75 6e 73 29  .. )).     runs)
a7e0: 29 0a 20 20 23 74 29 0a 0a 3b 3b 3d 3d 3d 3d 3d  ).  #t)..;;=====
a7f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a800: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a810: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a820: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a830: 3d 0a 3b 3b 20 52 6f 75 74 69 6e 65 73 20 66 6f  =.;; Routines fo
a840: 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 72  r manipulating r
a850: 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  uns.;;==========
a860: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a870: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a880: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a890: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b  ============..;;
a8a0: 20 53 69 6e 63 65 20 6d 61 6e 79 20 63 61 6c 6c   Since many call
a8b0: 73 20 74 6f 20 61 20 72 75 6e 20 72 65 71 75 69  s to a run requi
a8c0: 72 65 20 70 72 65 74 74 79 20 6d 75 63 68 20 74  re pretty much t
a8d0: 68 65 20 73 61 6d 65 20 73 65 74 75 70 20 0a 3b  he same setup .;
a8e0: 3b 20 74 68 69 73 20 77 72 61 70 70 65 72 20 69  ; this wrapper i
a8f0: 73 20 75 73 65 64 20 74 6f 20 72 65 64 75 63 65  s used to reduce
a900: 20 74 68 65 20 72 65 70 6c 69 63 61 74 69 6f 6e   the replication
a910: 20 6f 66 20 63 6f 64 65 0a 28 64 65 66 69 6e 65   of code.(define
a920: 20 28 67 65 6e 65 72 61 6c 2d 72 75 6e 2d 63 61   (general-run-ca
a930: 6c 6c 20 73 77 69 74 63 68 6e 61 6d 65 20 61 63  ll switchname ac
a940: 74 69 6f 6e 2d 64 65 73 63 20 70 72 6f 63 29 0a  tion-desc proc).
a950: 20 20 28 6c 65 74 20 28 28 72 75 6e 6e 61 6d 65    (let ((runname
a960: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
a970: 3a 72 75 6e 6e 61 6d 65 22 29 29 0a 09 28 74 61  :runname"))..(ta
a980: 72 67 65 74 20 20 28 69 66 20 28 61 72 67 73 3a  rget  (if (args:
a990: 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74  get-arg "-target
a9a0: 22 29 0a 09 09 20 20 20 20 20 28 61 72 67 73 3a  ")...     (args:
a9b0: 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74  get-arg "-target
a9c0: 22 29 0a 09 09 20 20 20 20 20 28 61 72 67 73 3a  ")...     (args:
a9d0: 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72  get-arg "-reqtar
a9e0: 67 22 29 29 29 0a 09 28 74 68 31 20 20 20 20 20  g")))..(th1     
a9f0: 23 66 29 29 0a 20 20 20 20 28 63 6f 6e 64 0a 20  #f)).    (cond. 
aa00: 20 20 20 20 28 28 6e 6f 74 20 74 61 72 67 65 74      ((not target
aa10: 29 0a 20 20 20 20 20 20 28 64 65 62 75 67 3a 70  ).      (debug:p
aa20: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 4d  rint 0 "ERROR: M
aa30: 69 73 73 69 6e 67 20 72 65 71 75 69 72 65 64 20  issing required 
aa40: 70 61 72 61 6d 65 74 65 72 20 66 6f 72 20 22 20  parameter for " 
aa50: 73 77 69 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f  switchname ", yo
aa60: 75 20 6d 75 73 74 20 73 70 65 63 69 66 79 20 74  u must specify t
aa70: 68 65 20 74 61 72 67 65 74 20 77 69 74 68 20 2d  he target with -
aa80: 74 61 72 67 65 74 22 29 0a 20 20 20 20 20 20 28  target").      (
aa90: 65 78 69 74 20 33 29 29 0a 20 20 20 20 20 28 28  exit 3)).     ((
aaa0: 6e 6f 74 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20  not runname).   
aab0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
aac0: 30 20 22 45 52 52 4f 52 3a 20 4d 69 73 73 69 6e  0 "ERROR: Missin
aad0: 67 20 72 65 71 75 69 72 65 64 20 70 61 72 61 6d  g required param
aae0: 65 74 65 72 20 66 6f 72 20 22 20 73 77 69 74 63  eter for " switc
aaf0: 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d 75 73  hname ", you mus
ab00: 74 20 73 70 65 63 69 66 79 20 74 68 65 20 72 75  t specify the ru
ab10: 6e 20 6e 61 6d 65 20 77 69 74 68 20 3a 72 75 6e  n name with :run
ab20: 6e 61 6d 65 20 72 75 6e 6e 61 6d 65 22 29 0a 20  name runname"). 
ab30: 20 20 20 20 20 28 65 78 69 74 20 33 29 29 0a 20       (exit 3)). 
ab40: 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20      (else.      
ab50: 28 6c 65 74 20 28 28 64 62 20 20 20 23 66 29 0a  (let ((db   #f).
ab60: 09 20 20 20 20 28 6b 65 79 73 20 23 66 29 29 0a  .    (keys #f)).
ab70: 09 28 69 66 20 28 6e 6f 74 20 28 73 65 74 75 70  .(if (not (setup
ab80: 2d 66 6f 72 2d 72 75 6e 29 29 0a 09 20 20 20 20  -for-run))..    
ab90: 28 62 65 67 69 6e 20 0a 09 20 20 20 20 20 20 28  (begin ..      (
aba0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 46  debug:print 0 "F
abb0: 61 69 6c 65 64 20 74 6f 20 73 65 74 75 70 2c 20  ailed to setup, 
abc0: 65 78 69 74 69 6e 67 22 29 0a 09 20 20 20 20 20  exiting")..     
abd0: 20 28 65 78 69 74 20 31 29 29 29 0a 09 28 69 66   (exit 1)))..(if
abe0: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
abf0: 2d 73 65 72 76 65 72 22 29 0a 09 20 20 20 20 28  -server")..    (
ac00: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 73  open-run-close s
ac10: 65 72 76 65 72 3a 73 74 61 72 74 20 64 62 20 28  erver:start db (
ac20: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 73  args:get-arg "-s
ac30: 65 72 76 65 72 22 29 29 29 0a 20 09 20 20 20 20  erver"))). .    
ac40: 3b 3b 20 28 69 66 20 28 6e 6f 74 20 28 6f 72 20  ;; (if (not (or 
ac50: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
ac60: 72 75 6e 61 6c 6c 22 29 20 20 20 20 20 3b 3b 20  runall")     ;; 
ac70: 72 75 6e 61 6c 6c 20 61 6e 64 20 72 75 6e 74 65  runall and runte
ac80: 73 74 73 20 61 72 65 20 61 6c 6c 6f 77 65 64 20  sts are allowed 
ac90: 74 6f 20 62 65 20 73 65 72 76 65 72 73 0a 20 09  to be servers. .
aca0: 20 20 20 20 3b 3b 20 20 20 20 20 09 20 28 61 72      ;;     . (ar
acb0: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 75 6e  gs:get-arg "-run
acc0: 74 65 73 74 73 22 29 29 29 0a 09 20 20 20 20 3b  tests")))..    ;
acd0: 3b 20 20 20 20 20 28 63 6c 69 65 6e 74 3a 73 65  ;     (client:se
ace0: 74 75 70 29 20 3b 3b 20 54 68 69 73 20 69 73 20  tup) ;; This is 
acf0: 61 20 64 75 70 6c 69 63 61 74 65 20 73 74 61 72  a duplicate star
ad00: 74 75 70 21 21 21 3f 3f 3f 20 42 55 47 3f 0a 09  tup!!!??? BUG?..
ad10: 20 20 20 20 3b 3b 20 20 20 20 20 29 29 0a 09 28      ;;     ))..(
ad20: 73 65 74 21 20 6b 65 79 73 20 28 6f 70 65 6e 2d  set! keys (open-
ad30: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
ad40: 2d 6b 65 79 73 20 64 62 29 29 0a 09 3b 3b 20 68  -keys db))..;; h
ad50: 61 76 65 20 65 6e 6f 75 67 68 20 74 6f 20 70 72  ave enough to pr
ad60: 6f 63 65 73 73 20 2d 74 61 72 67 65 74 20 6f 72  ocess -target or
ad70: 20 2d 72 65 71 74 61 72 67 20 68 65 72 65 0a 09   -reqtarg here..
ad80: 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72  (if (args:get-ar
ad90: 67 20 22 2d 72 65 71 74 61 72 67 22 29 0a 09 20  g "-reqtarg").. 
ada0: 20 20 20 28 6c 65 74 2a 20 28 28 72 75 6e 63 6f     (let* ((runco
adb0: 6e 66 69 67 66 20 28 63 6f 6e 63 20 20 2a 74 6f  nfigf (conc  *to
adc0: 70 70 61 74 68 2a 20 22 2f 72 75 6e 63 6f 6e 66  ppath* "/runconf
add0: 69 67 73 2e 63 6f 6e 66 69 67 22 29 29 20 3b 3b  igs.config")) ;;
ade0: 20 44 4f 20 4e 4f 54 20 45 56 41 4c 55 41 54 45   DO NOT EVALUATE
adf0: 20 41 4c 4c 20 0a 09 09 20 20 20 28 72 75 6e 63   ALL ...   (runc
ae00: 6f 6e 66 69 67 20 20 28 72 65 61 64 2d 63 6f 6e  onfig  (read-con
ae10: 66 69 67 20 72 75 6e 63 6f 6e 66 69 67 66 20 23  fig runconfigf #
ae20: 66 20 23 74 20 65 6e 76 69 72 6f 6e 2d 70 61 74  f #t environ-pat
ae30: 74 3a 20 23 66 29 29 29 20 0a 09 20 20 20 20 20  t: #f))) ..     
ae40: 20 28 69 66 20 28 68 61 73 68 2d 74 61 62 6c 65   (if (hash-table
ae50: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 72 75 6e  -ref/default run
ae60: 63 6f 6e 66 69 67 20 28 61 72 67 73 3a 67 65 74  config (args:get
ae70: 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29  -arg "-reqtarg")
ae80: 20 23 66 29 0a 09 09 20 20 28 6b 65 79 73 3a 74   #f)...  (keys:t
ae90: 61 72 67 65 74 2d 73 65 74 2d 61 72 67 73 20 6b  arget-set-args k
aea0: 65 79 73 20 28 61 72 67 73 3a 67 65 74 2d 61 72  eys (args:get-ar
aeb0: 67 20 22 2d 72 65 71 74 61 72 67 22 29 20 61 72  g "-reqtarg") ar
aec0: 67 73 3a 61 72 67 2d 68 61 73 68 29 0a 09 09 20  gs:arg-hash)... 
aed0: 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 28 64   (begin...    (d
aee0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
aef0: 52 4f 52 3a 20 5b 22 20 28 61 72 67 73 3a 67 65  ROR: [" (args:ge
af00: 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22  t-arg "-reqtarg"
af10: 29 20 22 5d 20 6e 6f 74 20 66 6f 75 6e 64 20 69  ) "] not found i
af20: 6e 20 22 20 72 75 6e 63 6f 6e 66 69 67 66 29 0a  n " runconfigf).
af30: 09 09 20 20 20 20 28 69 66 20 64 62 20 28 73 71  ..    (if db (sq
af40: 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20  lite3:finalize! 
af50: 64 62 29 29 0a 09 09 20 20 20 20 28 65 78 69 74  db))...    (exit
af60: 20 31 29 29 29 29 0a 09 20 20 20 20 28 69 66 20   1))))..    (if 
af70: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
af80: 74 61 72 67 65 74 22 29 0a 09 09 28 6b 65 79 73  target")...(keys
af90: 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 72 67 73  :target-set-args
afa0: 20 6b 65 79 73 20 28 61 72 67 73 3a 67 65 74 2d   keys (args:get-
afb0: 61 72 67 20 22 2d 74 61 72 67 65 74 22 20 61 72  arg "-target" ar
afc0: 67 73 3a 61 72 67 2d 68 61 73 68 29 20 61 72 67  gs:arg-hash) arg
afd0: 73 3a 61 72 67 2d 68 61 73 68 29 29 29 0a 09 28  s:arg-hash)))..(
afe0: 69 66 20 28 6e 6f 74 20 28 63 61 72 20 2a 63 6f  if (not (car *co
aff0: 6e 66 69 67 69 6e 66 6f 2a 29 29 0a 09 20 20 20  nfiginfo*))..   
b000: 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 28   (begin..      (
b010: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45  debug:print 0 "E
b020: 52 52 4f 52 3a 20 41 74 74 65 6d 70 74 65 64 20  RROR: Attempted 
b030: 74 6f 20 22 20 61 63 74 69 6f 6e 2d 64 65 73 63  to " action-desc
b040: 20 22 20 62 75 74 20 72 75 6e 20 61 72 65 61 20   " but run area 
b050: 63 6f 6e 66 69 67 20 66 69 6c 65 20 6e 6f 74 20  config file not 
b060: 66 6f 75 6e 64 22 29 0a 09 20 20 20 20 20 20 28  found")..      (
b070: 65 78 69 74 20 31 29 29 0a 09 20 20 20 20 3b 3b  exit 1))..    ;;
b080: 20 45 78 74 72 61 63 74 20 6f 75 74 20 73 74 75   Extract out stu
b090: 66 66 20 6e 65 65 64 65 64 20 69 6e 20 6d 6f 73  ff needed in mos
b0a0: 74 20 6f 72 20 6d 61 6e 79 20 63 61 6c 6c 73 0a  t or many calls.
b0b0: 09 20 20 20 20 3b 3b 20 68 65 72 65 20 74 68 65  .    ;; here the
b0c0: 6e 20 63 61 6c 6c 20 70 72 6f 63 0a 09 20 20 20  n call proc..   
b0d0: 20 28 6c 65 74 2a 20 28 28 6b 65 79 6e 61 6d 65   (let* ((keyname
b0e0: 73 20 20 20 28 6d 61 70 20 6b 65 79 3a 67 65 74  s   (map key:get
b0f0: 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79 73 29  -fieldname keys)
b100: 29 0a 09 09 20 20 20 28 6b 65 79 76 61 6c 6c 73  )...   (keyvalls
b110: 74 20 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69 73  t  (keys->vallis
b120: 74 20 6b 65 79 73 20 23 74 29 29 29 0a 09 20 20  t keys #t)))..  
b130: 20 20 20 20 28 70 72 6f 63 20 74 61 72 67 65 74      (proc target
b140: 20 72 75 6e 6e 61 6d 65 20 6b 65 79 73 20 6b 65   runname keys ke
b150: 79 6e 61 6d 65 73 20 6b 65 79 76 61 6c 6c 73 74  ynames keyvallst
b160: 29 29 29 0a 09 28 69 66 20 74 68 31 20 28 74 68  )))..(if th1 (th
b170: 72 65 61 64 2d 6a 6f 69 6e 21 20 74 68 31 29 29  read-join! th1))
b180: 0a 09 28 69 66 20 64 62 20 28 73 71 6c 69 74 65  ..(if db (sqlite
b190: 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 29 29  3:finalize! db))
b1a0: 0a 09 28 73 65 74 21 20 2a 64 69 64 73 6f 6d 65  ..(set! *didsome
b1b0: 74 68 69 6e 67 2a 20 23 74 29 29 29 29 29 29 0a  thing* #t)))))).
b1c0: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  .;;=============
b1d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b1e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b1f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b200: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4c 6f 63  =========.;; Loc
b210: 6b 2f 75 6e 6c 6f 63 6b 20 72 75 6e 73 0a 3b 3b  k/unlock runs.;;
b220: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b230: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b240: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b250: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b260: 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65 20  ======..(define 
b270: 28 72 75 6e 73 3a 68 61 6e 64 6c 65 2d 6c 6f 63  (runs:handle-loc
b280: 6b 69 6e 67 20 74 61 72 67 65 74 20 6b 65 79 73  king target keys
b290: 20 72 75 6e 6e 61 6d 65 20 6c 6f 63 6b 20 75 6e   runname lock un
b2a0: 6c 6f 63 6b 20 75 73 65 72 29 0a 20 20 28 6c 65  lock user).  (le
b2b0: 74 2a 20 28 28 64 62 20 20 20 20 20 20 20 23 66  t* ((db       #f
b2c0: 29 0a 09 20 28 72 75 6e 64 61 74 20 20 20 28 6f  ).. (rundat   (o
b2d0: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75  pen-run-close ru
b2e0: 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70  ns:get-runs-by-p
b2f0: 61 74 74 20 64 62 20 6b 65 79 73 20 72 75 6e 6e  att db keys runn
b300: 61 6d 65 29 29 0a 09 20 28 68 65 61 64 65 72 20  ame)).. (header 
b310: 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75    (vector-ref ru
b320: 6e 64 61 74 20 30 29 29 0a 09 20 28 72 75 6e 73  ndat 0)).. (runs
b330: 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66       (vector-ref
b340: 20 72 75 6e 64 61 74 20 31 29 29 29 0a 20 20 20   rundat 1))).   
b350: 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62   (for-each (lamb
b360: 64 61 20 28 72 75 6e 29 0a 09 09 28 6c 65 74 20  da (run)...(let 
b370: 28 28 72 75 6e 2d 69 64 20 28 64 62 3a 67 65 74  ((run-id (db:get
b380: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72  -value-by-header
b390: 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 22   run header "id"
b3a0: 29 29 29 0a 09 09 20 20 28 69 66 20 28 6f 72 20  )))...  (if (or 
b3b0: 6c 6f 63 6b 0a 09 09 09 20 20 28 61 6e 64 20 75  lock....  (and u
b3c0: 6e 6c 6f 63 6b 0a 09 09 09 20 20 20 20 20 20 20  nlock....       
b3d0: 28 62 65 67 69 6e 0a 09 09 09 09 20 28 70 72 69  (begin..... (pri
b3e0: 6e 74 20 22 44 6f 20 79 6f 75 20 72 65 61 6c 6c  nt "Do you reall
b3f0: 79 20 77 69 73 68 20 74 6f 20 75 6e 6c 6f 63 6b  y wish to unlock
b400: 20 72 75 6e 20 22 20 72 75 6e 2d 69 64 20 22 3f   run " run-id "?
b410: 5c 6e 20 20 20 79 2f 6e 3a 20 22 29 0a 09 09 09  \n   y/n: ")....
b420: 09 20 28 65 71 75 61 6c 3f 20 22 79 22 20 28 72  . (equal? "y" (r
b430: 65 61 64 2d 6c 69 6e 65 29 29 29 29 29 0a 09 09  ead-line)))))...
b440: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d        (open-run-
b450: 63 6c 6f 73 65 20 64 62 3a 6c 6f 63 6b 2f 75 6e  close db:lock/un
b460: 6c 6f 63 6b 2d 72 75 6e 20 64 62 20 72 75 6e 2d  lock-run db run-
b470: 69 64 20 6c 6f 63 6b 20 75 6e 6c 6f 63 6b 20 75  id lock unlock u
b480: 73 65 72 29 0a 09 09 20 20 20 20 20 20 28 64 65  ser)...      (de
b490: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 30  bug:print-info 0
b4a0: 20 22 53 6b 69 70 70 69 6e 67 20 6c 6f 63 6b 2f   "Skipping lock/
b4b0: 75 6e 6c 6f 63 6b 20 6f 6e 20 22 20 72 75 6e 2d  unlock on " run-
b4c0: 69 64 29 29 29 29 0a 09 20 20 20 20 20 20 72 75  id))))..      ru
b4d0: 6e 73 29 29 29 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d  ns))).;;========
b4e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b4f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b500: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b510: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b  ==============.;
b520: 3b 20 52 6f 6c 6c 75 70 20 72 75 6e 73 0a 3b 3b  ; Rollup runs.;;
b530: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b540: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b550: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b560: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b570: 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 55 70 64 61 74  ======..;; Updat
b580: 65 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61 20  e the test_meta 
b590: 74 61 62 6c 65 20 66 6f 72 20 74 68 69 73 20 74  table for this t
b5a0: 65 73 74 0a 28 64 65 66 69 6e 65 20 28 72 75 6e  est.(define (run
b5b0: 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65  s:update-test_me
b5c0: 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20  ta db test-name 
b5d0: 74 65 73 74 2d 63 6f 6e 66 29 0a 20 20 28 6c 65  test-conf).  (le
b5e0: 74 20 28 28 63 75 72 72 72 65 63 6f 72 64 20 28  t ((currrecord (
b5f0: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64  open-run-close d
b600: 62 3a 74 65 73 74 6d 65 74 61 2d 67 65 74 2d 72  b:testmeta-get-r
b610: 65 63 6f 72 64 20 64 62 20 74 65 73 74 2d 6e 61  ecord db test-na
b620: 6d 65 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e  me))).    (if (n
b630: 6f 74 20 63 75 72 72 72 65 63 6f 72 64 29 0a 09  ot currrecord)..
b640: 28 62 65 67 69 6e 0a 09 20 20 28 73 65 74 21 20  (begin..  (set! 
b650: 63 75 72 72 72 65 63 6f 72 64 20 28 6d 61 6b 65  currrecord (make
b660: 2d 76 65 63 74 6f 72 20 31 30 20 23 66 29 29 0a  -vector 10 #f)).
b670: 09 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f  .  (open-run-clo
b680: 73 65 20 64 62 3a 74 65 73 74 6d 65 74 61 2d 61  se db:testmeta-a
b690: 64 64 2d 72 65 63 6f 72 64 20 64 62 20 74 65 73  dd-record db tes
b6a0: 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 66  t-name))).    (f
b6b0: 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c  or-each .     (l
b6c0: 61 6d 62 64 61 20 28 6b 65 79 29 0a 20 20 20 20  ambda (key).    
b6d0: 20 20 20 28 6c 65 74 2a 20 28 28 69 64 78 20 28     (let* ((idx (
b6e0: 63 61 64 72 20 6b 65 79 29 29 0a 09 20 20 20 20  cadr key))..    
b6f0: 20 20 28 66 6c 64 20 28 63 61 72 20 20 6b 65 79    (fld (car  key
b700: 29 29 0a 09 20 20 20 20 20 20 28 76 61 6c 20 28  ))..      (val (
b710: 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 65  config-lookup te
b720: 73 74 2d 63 6f 6e 66 20 22 74 65 73 74 5f 6d 65  st-conf "test_me
b730: 74 61 22 20 66 6c 64 29 29 29 0a 09 20 3b 3b 20  ta" fld))).. ;; 
b740: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 35 20 22  (debug:print 5 "
b750: 69 64 78 3a 20 22 20 69 64 78 20 22 20 66 6c 64  idx: " idx " fld
b760: 3a 20 22 20 66 6c 64 20 22 20 76 61 6c 3a 20 22  : " fld " val: "
b770: 20 76 61 6c 29 0a 09 20 28 69 66 20 28 61 6e 64   val).. (if (and
b780: 20 76 61 6c 20 28 6e 6f 74 20 28 65 71 75 61 6c   val (not (equal
b790: 3f 20 28 76 65 63 74 6f 72 2d 72 65 66 20 63 75  ? (vector-ref cu
b7a0: 72 72 72 65 63 6f 72 64 20 69 64 78 29 20 76 61  rrrecord idx) va
b7b0: 6c 29 29 29 0a 09 20 20 20 20 20 28 62 65 67 69  l)))..     (begi
b7c0: 6e 0a 09 20 20 20 20 20 20 20 28 70 72 69 6e 74  n..       (print
b7d0: 20 22 55 70 64 61 74 69 6e 67 20 22 20 74 65 73   "Updating " tes
b7e0: 74 2d 6e 61 6d 65 20 22 20 22 20 66 6c 64 20 22  t-name " " fld "
b7f0: 20 74 6f 20 22 20 76 61 6c 29 0a 09 20 20 20 20   to " val)..    
b800: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f     (open-run-clo
b810: 73 65 20 64 62 3a 74 65 73 74 6d 65 74 61 2d 75  se db:testmeta-u
b820: 70 64 61 74 65 2d 66 69 65 6c 64 20 64 62 20 74  pdate-field db t
b830: 65 73 74 2d 6e 61 6d 65 20 66 6c 64 20 76 61 6c  est-name fld val
b840: 29 29 29 29 29 0a 20 20 20 20 20 27 28 28 22 61  ))))).     '(("a
b850: 75 74 68 6f 72 22 20 32 29 28 22 6f 77 6e 65 72  uthor" 2)("owner
b860: 22 20 33 29 28 22 64 65 73 63 72 69 70 74 69 6f  " 3)("descriptio
b870: 6e 22 20 34 29 28 22 72 65 76 69 65 77 65 64 22  n" 4)("reviewed"
b880: 20 35 29 28 22 74 61 67 73 22 20 39 29 29 29 29   5)("tags" 9))))
b890: 29 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74 65 73  )..;; Update tes
b8a0: 74 5f 6d 65 74 61 20 66 6f 72 20 61 6c 6c 20 74  t_meta for all t
b8b0: 65 73 74 73 0a 28 64 65 66 69 6e 65 20 28 72 75  ests.(define (ru
b8c0: 6e 73 3a 75 70 64 61 74 65 2d 61 6c 6c 2d 74 65  ns:update-all-te
b8d0: 73 74 5f 6d 65 74 61 20 64 62 29 0a 20 20 28 6c  st_meta db).  (l
b8e0: 65 74 20 28 28 74 65 73 74 2d 6e 61 6d 65 73 20  et ((test-names 
b8f0: 28 67 65 74 2d 61 6c 6c 2d 6c 65 67 61 6c 2d 74  (get-all-legal-t
b900: 65 73 74 73 29 29 29 0a 20 20 20 20 28 66 6f 72  ests))).    (for
b910: 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d  -each .     (lam
b920: 62 64 61 20 28 74 65 73 74 2d 6e 61 6d 65 29 0a  bda (test-name).
b930: 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74         (let* ((t
b940: 65 73 74 2d 70 61 74 68 20 20 20 20 28 63 6f 6e  est-path    (con
b950: 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65  c *toppath* "/te
b960: 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29  sts/" test-name)
b970: 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d 63  )..      (test-c
b980: 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 74 65 73  onfigf (conc tes
b990: 74 2d 70 61 74 68 20 22 2f 74 65 73 74 63 6f 6e  t-path "/testcon
b9a0: 66 69 67 22 29 29 0a 09 20 20 20 20 20 20 28 74  fig"))..      (t
b9b0: 65 73 74 65 78 69 73 74 73 20 20 20 28 61 6e 64  estexists   (and
b9c0: 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 74   (file-exists? t
b9d0: 65 73 74 2d 63 6f 6e 66 69 67 66 29 28 66 69 6c  est-configf)(fil
b9e0: 65 2d 72 65 61 64 2d 61 63 63 65 73 73 3f 20 74  e-read-access? t
b9f0: 65 73 74 2d 63 6f 6e 66 69 67 66 29 29 29 0a 09  est-configf)))..
ba00: 20 20 20 20 20 20 3b 3b 20 72 65 61 64 20 63 6f        ;; read co
ba10: 6e 66 69 67 73 20 77 69 74 68 20 74 72 69 63 6b  nfigs with trick
ba20: 73 20 74 75 72 6e 65 64 20 6f 66 66 20 28 69 2e  s turned off (i.
ba30: 65 2e 20 6e 6f 20 73 79 73 74 65 6d 29 0a 09 20  e. no system).. 
ba40: 20 20 20 20 20 28 74 65 73 74 2d 63 6f 6e 66 20       (test-conf 
ba50: 20 20 20 28 69 66 20 74 65 73 74 65 78 69 73 74     (if testexist
ba60: 73 20 28 72 65 61 64 2d 63 6f 6e 66 69 67 20 74  s (read-config t
ba70: 65 73 74 2d 63 6f 6e 66 69 67 66 20 23 66 20 23  est-configf #f #
ba80: 66 29 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62  f)(make-hash-tab
ba90: 6c 65 29 29 29 29 0a 09 20 3b 3b 20 75 73 65 20  le)))).. ;; use 
baa0: 74 68 65 20 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f  the open-run-clo
bab0: 73 65 20 69 6e 73 74 65 61 64 20 6f 66 20 70 61  se instead of pa
bac0: 73 73 69 6e 67 20 69 6e 20 64 62 0a 09 20 28 72  ssing in db.. (r
bad0: 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f  uns:update-test_
bae0: 6d 65 74 61 20 23 66 20 74 65 73 74 2d 6e 61 6d  meta #f test-nam
baf0: 65 20 74 65 73 74 2d 63 6f 6e 66 29 29 29 0a 20  e test-conf))). 
bb00: 20 20 20 20 74 65 73 74 2d 6e 61 6d 65 73 29 29      test-names))
bb10: 29 0a 0a 3b 3b 20 54 68 69 73 20 63 6f 75 6c 64  )..;; This could
bb20: 20 70 72 6f 62 61 62 6c 79 20 62 65 20 72 65 66   probably be ref
bb30: 61 63 74 6f 72 65 64 20 69 6e 74 6f 20 6f 6e 65  actored into one
bb40: 20 63 6f 6d 70 6c 65 78 20 71 75 65 72 79 20 2e   complex query .
bb50: 2e 2e 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73  ...(define (runs
bb60: 3a 72 6f 6c 6c 75 70 2d 72 75 6e 20 6b 65 79 73  :rollup-run keys
bb70: 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61   keyvallst runna
bb80: 6d 65 20 75 73 65 72 29 20 3b 3b 20 77 61 73 20  me user) ;; was 
bb90: 74 61 72 67 65 74 2c 20 6e 6f 77 20 6b 65 79 76  target, now keyv
bba0: 61 6c 6c 73 74 0a 20 20 28 64 65 62 75 67 3a 70  allst.  (debug:p
bbb0: 72 69 6e 74 20 34 20 22 72 75 6e 73 3a 72 6f 6c  rint 4 "runs:rol
bbc0: 6c 75 70 2d 72 75 6e 2c 20 6b 65 79 73 3a 20 22  lup-run, keys: "
bbd0: 20 6b 65 79 73 20 22 20 6b 65 79 76 61 6c 6c 73   keys " keyvalls
bbe0: 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 20 22  t: " keyvallst "
bbf0: 20 3a 72 75 6e 6e 61 6d 65 20 22 20 72 75 6e 6e   :runname " runn
bc00: 61 6d 65 20 22 20 75 73 65 72 3a 20 22 20 75 73  ame " user: " us
bc10: 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 28 64 62  er).  (let* ((db
bc20: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 66                #f
bc30: 29 20 3b 3b 20 28 6b 65 79 76 61 6c 6c 6c 73 74  ) ;; (keyvalllst
bc40: 20 20 20 20 20 20 28 6b 65 79 73 3a 74 61 72 67        (keys:targ
bc50: 65 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 79 73 20  et->keyval keys 
bc60: 74 61 72 67 65 74 29 29 0a 09 20 28 6e 65 77 2d  target)).. (new-
bc70: 72 75 6e 2d 69 64 20 20 20 20 20 20 28 6f 70 65  run-id      (ope
bc80: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73  n-run-close runs
bc90: 3a 72 65 67 69 73 74 65 72 2d 72 75 6e 20 64 62  :register-run db
bca0: 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20   keys keyvallst 
bcb0: 72 75 6e 6e 61 6d 65 20 22 6e 65 77 22 20 22 6e  runname "new" "n
bcc0: 2f 61 22 20 75 73 65 72 29 29 0a 09 20 28 70 72  /a" user)).. (pr
bcd0: 65 76 2d 74 65 73 74 73 20 20 20 20 20 20 28 6f  ev-tests      (o
bce0: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 74 65  pen-run-close te
bcf0: 73 74 3a 67 65 74 2d 6d 61 74 63 68 69 6e 67 2d  st:get-matching-
bd00: 70 72 65 76 69 6f 75 73 2d 74 65 73 74 2d 72 75  previous-test-ru
bd10: 6e 2d 72 65 63 6f 72 64 73 20 64 62 20 6e 65 77  n-records db new
bd20: 2d 72 75 6e 2d 69 64 20 22 25 22 20 22 25 22 29  -run-id "%" "%")
bd30: 29 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73 20  ).. (curr-tests 
bd40: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
bd50: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74  lose db:get-test
bd60: 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77  s-for-run db new
bd70: 2d 72 75 6e 2d 69 64 20 22 25 2f 25 22 20 27 28  -run-id "%/%" '(
bd80: 29 20 27 28 29 29 29 0a 09 20 28 63 75 72 72 2d  ) '())).. (curr-
bd90: 74 65 73 74 73 2d 68 61 73 68 20 28 6d 61 6b 65  tests-hash (make
bda0: 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 20  -hash-table))). 
bdb0: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f     (open-run-clo
bdc0: 73 65 20 64 62 3a 75 70 64 61 74 65 2d 72 75 6e  se db:update-run
bdd0: 2d 65 76 65 6e 74 5f 74 69 6d 65 20 64 62 20 6e  -event_time db n
bde0: 65 77 2d 72 75 6e 2d 69 64 29 0a 20 20 20 20 3b  ew-run-id).    ;
bdf0: 3b 20 69 6e 64 65 78 20 74 68 65 20 61 6c 72 65  ; index the alre
be00: 61 64 79 20 73 61 76 65 64 20 74 65 73 74 73 20  ady saved tests 
be10: 62 79 20 74 65 73 74 6e 61 6d 65 20 61 6e 64 20  by testname and 
be20: 69 74 65 6d 64 61 74 20 69 6e 20 63 75 72 72 2d  itemdat in curr-
be30: 74 65 73 74 73 2d 68 61 73 68 0a 20 20 20 20 28  tests-hash.    (
be40: 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 28 6c  for-each.     (l
be50: 61 6d 62 64 61 20 28 74 65 73 74 64 61 74 29 0a  ambda (testdat).
be60: 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74         (let* ((t
be70: 65 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 65 73  estname  (db:tes
be80: 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74  t-get-testname t
be90: 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20  estdat))..      
bea0: 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74  (item-path (db:t
beb0: 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74  est-get-item-pat
bec0: 68 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20  h testdat))..   
bed0: 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 63     (full-name (c
bee0: 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22  onc testname "/"
bef0: 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 09 20   item-path))).. 
bf00: 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21  (hash-table-set!
bf10: 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68   curr-tests-hash
bf20: 20 66 75 6c 6c 2d 6e 61 6d 65 20 74 65 73 74 64   full-name testd
bf30: 61 74 29 29 29 0a 20 20 20 20 20 63 75 72 72 2d  at))).     curr-
bf40: 74 65 73 74 73 29 0a 20 20 20 20 3b 3b 20 4e 4f  tests).    ;; NO
bf50: 50 45 3a 20 4e 6f 6e 2d 6f 70 74 69 6d 61 6c 20  PE: Non-optimal 
bf60: 61 70 70 72 6f 61 63 68 2e 20 54 72 79 20 74 68  approach. Try th
bf70: 69 73 20 69 6e 73 74 65 61 64 2e 0a 20 20 20 20  is instead..    
bf80: 3b 3b 20 20 20 31 2e 20 74 65 73 74 73 20 61 72  ;;   1. tests ar
bf90: 65 20 72 65 63 65 69 76 65 64 20 69 6e 20 61 20  e received in a 
bfa0: 6c 69 73 74 2c 20 6d 6f 73 74 20 72 65 63 65 6e  list, most recen
bfb0: 74 20 66 69 72 73 74 0a 20 20 20 20 3b 3b 20 20  t first.    ;;  
bfc0: 20 32 2e 20 72 65 70 6c 61 63 65 20 74 68 65 20   2. replace the 
bfd0: 72 6f 6c 6c 75 70 20 74 65 73 74 20 77 69 74 68  rollup test with
bfe0: 20 74 68 65 20 6e 65 77 20 2a 61 6c 77 61 79 73   the new *always
bff0: 2a 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20  *.    (for-each 
c000: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74  .     (lambda (t
c010: 65 73 74 64 61 74 29 0a 20 20 20 20 20 20 20 28  estdat).       (
c020: 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 20  let* ((testname 
c030: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65   (db:test-get-te
c040: 73 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29  stname testdat))
c050: 0a 09 20 20 20 20 20 20 28 69 74 65 6d 2d 70 61  ..      (item-pa
c060: 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  th (db:test-get-
c070: 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 64 61  item-path testda
c080: 74 29 29 0a 09 20 20 20 20 20 20 28 66 75 6c 6c  t))..      (full
c090: 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74  -name (conc test
c0a0: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61  name "/" item-pa
c0b0: 74 68 29 29 0a 09 20 20 20 20 20 20 28 70 72 65  th))..      (pre
c0c0: 76 2d 74 65 73 74 2d 64 61 74 20 28 68 61 73 68  v-test-dat (hash
c0d0: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75  -table-ref/defau
c0e0: 6c 74 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61  lt curr-tests-ha
c0f0: 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 23 66 29  sh full-name #f)
c100: 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d 73  )..      (test-s
c110: 74 65 70 73 20 20 20 20 20 20 28 6f 70 65 6e 2d  teps      (open-
c120: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
c130: 2d 73 74 65 70 73 2d 66 6f 72 2d 74 65 73 74 20  -steps-for-test 
c140: 64 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  db (db:test-get-
c150: 69 64 20 74 65 73 74 64 61 74 29 29 29 0a 09 20  id testdat))).. 
c160: 20 20 20 20 20 28 6e 65 77 2d 74 65 73 74 2d 72       (new-test-r
c170: 65 63 6f 72 64 20 23 66 29 29 0a 09 20 3b 3b 20  ecord #f)).. ;; 
c180: 72 65 70 6c 61 63 65 20 74 68 65 73 65 20 77 69  replace these wi
c190: 74 68 20 69 6e 73 65 72 74 20 2e 2e 2e 20 73 65  th insert ... se
c1a0: 6c 65 63 74 0a 09 20 28 61 70 70 6c 79 20 73 71  lect.. (apply sq
c1b0: 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09  lite3:execute ..
c1c0: 09 64 62 20 0a 09 09 28 63 6f 6e 63 20 22 49 4e  .db ...(conc "IN
c1d0: 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20  SERT OR REPLACE 
c1e0: 49 4e 54 4f 20 74 65 73 74 73 20 28 72 75 6e 5f  INTO tests (run_
c1f0: 69 64 2c 74 65 73 74 6e 61 6d 65 2c 73 74 61 74  id,testname,stat
c200: 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74  e,status,event_t
c210: 69 6d 65 2c 68 6f 73 74 2c 63 70 75 6c 6f 61 64  ime,host,cpuload
c220: 2c 64 69 73 6b 66 72 65 65 2c 75 6e 61 6d 65 2c  ,diskfree,uname,
c230: 72 75 6e 64 69 72 2c 69 74 65 6d 5f 70 61 74 68  rundir,item_path
c240: 2c 72 75 6e 5f 64 75 72 61 74 69 6f 6e 2c 66 69  ,run_duration,fi
c250: 6e 61 6c 5f 6c 6f 67 66 2c 63 6f 6d 6d 65 6e 74  nal_logf,comment
c260: 29 20 22 0a 09 09 20 20 20 20 20 20 22 56 41 4c  ) "...      "VAL
c270: 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f  UES (?,?,?,?,?,?
c280: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f  ,?,?,?,?,?,?,?,?
c290: 29 3b 22 29 0a 09 09 6e 65 77 2d 72 75 6e 2d 69  );")...new-run-i
c2a0: 64 20 28 63 64 64 72 20 28 76 65 63 74 6f 72 2d  d (cddr (vector-
c2b0: 3e 6c 69 73 74 20 74 65 73 74 64 61 74 29 29 29  >list testdat)))
c2c0: 0a 09 20 28 73 65 74 21 20 6e 65 77 2d 74 65 73  .. (set! new-tes
c2d0: 74 64 61 74 20 28 63 61 72 20 28 6f 70 65 6e 2d  tdat (car (open-
c2e0: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
c2f0: 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64  -tests-for-run d
c300: 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 28 63 6f  b new-run-id (co
c310: 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22 20  nc testname "/" 
c320: 69 74 65 6d 2d 70 61 74 68 29 20 27 28 29 20 27  item-path) '() '
c330: 28 29 29 29 29 0a 09 20 28 68 61 73 68 2d 74 61  ()))).. (hash-ta
c340: 62 6c 65 2d 73 65 74 21 20 63 75 72 72 2d 74 65  ble-set! curr-te
c350: 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61  sts-hash full-na
c360: 6d 65 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20  me new-testdat) 
c370: 3b 3b 20 74 68 69 73 20 63 6f 75 6c 64 20 62 65  ;; this could be
c380: 20 63 6f 6e 66 75 73 69 6e 67 2c 20 77 68 69 63   confusing, whic
c390: 68 20 72 65 63 6f 72 64 20 73 68 6f 75 6c 64 20  h record should 
c3a0: 67 6f 20 69 6e 74 6f 20 74 68 65 20 6c 6f 6f 6b  go into the look
c3b0: 75 70 20 74 61 62 6c 65 3f 0a 09 20 3b 3b 20 4e  up table?.. ;; N
c3c0: 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74 68 65  ow duplicate the
c3d0: 20 74 65 73 74 20 73 74 65 70 73 0a 09 20 28 64   test steps.. (d
c3e0: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 43 6f  ebug:print 4 "Co
c3f0: 70 79 69 6e 67 20 72 65 63 6f 72 64 73 20 69 6e  pying records in
c400: 20 74 65 73 74 5f 73 74 65 70 73 20 66 72 6f 6d   test_steps from
c410: 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62 3a 74   test_id=" (db:t
c420: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64  est-get-id testd
c430: 61 74 29 20 22 20 74 6f 20 22 20 28 64 62 3a 74  at) " to " (db:t
c440: 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74  est-get-id new-t
c450: 65 73 74 64 61 74 29 29 0a 09 20 28 6f 70 65 6e  estdat)).. (open
c460: 2d 72 75 6e 2d 63 6c 6f 73 65 20 0a 09 20 20 28  -run-close ..  (
c470: 6c 61 6d 62 64 61 20 28 29 0a 09 20 20 20 20 28  lambda ()..    (
c480: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20  sqlite3:execute 
c490: 0a 09 20 20 20 20 20 64 62 20 0a 09 20 20 20 20  ..     db ..    
c4a0: 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f   (conc "INSERT O
c4b0: 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74  R REPLACE INTO t
c4c0: 65 73 74 5f 73 74 65 70 73 20 28 74 65 73 74 5f  est_steps (test_
c4d0: 69 64 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 74  id,stepname,stat
c4e0: 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74  e,status,event_t
c4f0: 69 6d 65 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09  ime,comment) "..
c500: 09 20 20 20 22 53 45 4c 45 43 54 20 22 20 28 64  .   "SELECT " (d
c510: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65  b:test-get-id ne
c520: 77 2d 74 65 73 74 64 61 74 29 20 22 2c 73 74 65  w-testdat) ",ste
c530: 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74  pname,state,stat
c540: 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f  us,event_time,co
c550: 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f  mment FROM test_
c560: 73 74 65 70 73 20 57 48 45 52 45 20 74 65 73 74  steps WHERE test
c570: 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 20 20 20 28  _id=?;")..     (
c580: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74  db:test-get-id t
c590: 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 3b 3b  estdat))..    ;;
c5a0: 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74   Now duplicate t
c5b0: 68 65 20 74 65 73 74 20 64 61 74 61 0a 09 20 20  he test data..  
c5c0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34    (debug:print 4
c5d0: 20 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64   "Copying record
c5e0: 73 20 69 6e 20 74 65 73 74 5f 64 61 74 61 20 66  s in test_data f
c5f0: 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64  rom test_id=" (d
c600: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65  b:test-get-id te
c610: 73 74 64 61 74 29 20 22 20 74 6f 20 22 20 28 64  stdat) " to " (d
c620: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65  b:test-get-id ne
c630: 77 2d 74 65 73 74 64 61 74 29 29 0a 09 20 20 20  w-testdat))..   
c640: 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74   (sqlite3:execut
c650: 65 20 0a 09 20 20 20 20 20 64 62 20 0a 09 20 20  e ..     db ..  
c660: 20 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54     (conc "INSERT
c670: 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f   OR REPLACE INTO
c680: 20 74 65 73 74 5f 64 61 74 61 20 28 74 65 73 74   test_data (test
c690: 5f 69 64 2c 63 61 74 65 67 6f 72 79 2c 76 61 72  _id,category,var
c6a0: 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65  iable,value,expe
c6b0: 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63  cted,tol,units,c
c6c0: 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 22  omment) "...   "
c6d0: 53 45 4c 45 43 54 20 22 20 28 64 62 3a 74 65 73  SELECT " (db:tes
c6e0: 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73  t-get-id new-tes
c6f0: 74 64 61 74 29 20 22 2c 63 61 74 65 67 6f 72 79  tdat) ",category
c700: 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c  ,variable,value,
c710: 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69  expected,tol,uni
c720: 74 73 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20  ts,comment FROM 
c730: 74 65 73 74 5f 64 61 74 61 20 57 48 45 52 45 20  test_data WHERE 
c740: 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20  test_id=?;")..  
c750: 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d     (db:test-get-
c760: 69 64 20 74 65 73 74 64 61 74 29 29 29 29 0a 09  id testdat))))..
c770: 20 29 29 0a 20 20 20 20 20 70 72 65 76 2d 74 65   )).     prev-te
c780: 73 74 73 29 29 29 0a 09 20 0a 20 20 20 20 20 0a  sts))).. .     .