Megatest

Hex Artifact Content
Login

Artifact f326c575c1ad5a41d131258e80f9e95da4d03394:


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 32 29 29  tests-delay* 2))
14a0: 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 73 65 74  ..(begin..  (set
14b0: 21 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d  ! *runs:can-run-
14c0: 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c 61 79  more-tests-delay
14d0: 2a 20 28 2b 20 2a 72 75 6e 73 3a 63 61 6e 2d 72  * (+ *runs:can-r
14e0: 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65  un-more-tests-de
14f0: 6c 61 79 2a 20 30 2e 30 31 29 29 0a 09 20 20 28  lay* 0.01))..  (
1500: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
1510: 20 31 34 20 22 63 61 6e 2d 72 75 6e 2d 6d 6f 72   14 "can-run-mor
1520: 65 2d 74 65 73 74 73 2d 64 65 6c 61 79 3a 20 22  e-tests-delay: "
1530: 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d   *runs:can-run-m
1540: 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c 61 79 2a  ore-tests-delay*
1550: 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74  ))).    (if (not
1560: 20 28 65 71 3f 20 2a 6c 61 73 74 2d 6e 75 6d 2d   (eq? *last-num-
1570: 72 75 6e 6e 69 6e 67 2d 74 65 73 74 73 2a 20 6e  running-tests* n
1580: 75 6d 2d 72 75 6e 6e 69 6e 67 29 29 0a 09 28 62  um-running))..(b
1590: 65 67 69 6e 0a 09 20 20 28 64 65 62 75 67 3a 70  egin..  (debug:p
15a0: 72 69 6e 74 20 32 20 22 6d 61 78 2d 63 6f 6e 63  rint 2 "max-conc
15b0: 75 72 72 65 6e 74 2d 6a 6f 62 73 3a 20 22 20 6d  urrent-jobs: " m
15c0: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f  ax-concurrent-jo
15d0: 62 73 20 22 2c 20 6e 75 6d 2d 72 75 6e 6e 69 6e  bs ", num-runnin
15e0: 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67  g: " num-running
15f0: 29 0a 09 20 20 28 73 65 74 21 20 2a 6c 61 73 74  )..  (set! *last
1600: 2d 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 74 65 73  -num-running-tes
1610: 74 73 2a 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29  ts* num-running)
1620: 29 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20  )).    (if (not 
1630: 28 65 71 3f 20 30 20 2a 67 6c 6f 62 61 6c 65 78  (eq? 0 *globalex
1640: 69 74 73 74 61 74 75 73 2a 29 29 0a 09 28 6c 69  itstatus*))..(li
1650: 73 74 20 23 66 20 6e 75 6d 2d 72 75 6e 6e 69 6e  st #f num-runnin
1660: 67 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e  g num-running-in
1670: 2d 6a 6f 62 67 72 6f 75 70 20 6d 61 78 2d 63 6f  -jobgroup max-co
1680: 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 6a 6f  ncurrent-jobs jo
1690: 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 29 0a 09  b-group-limit)..
16a0: 28 6c 65 74 20 28 28 63 61 6e 2d 6e 6f 74 2d 72  (let ((can-not-r
16b0: 75 6e 2d 6d 6f 72 65 20 28 63 6f 6e 64 0a 09 09  un-more (cond...
16c0: 09 09 20 3b 3b 20 69 66 20 6d 61 78 2d 63 6f 6e  .. ;; if max-con
16d0: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 69 73 20  current-jobs is 
16e0: 73 65 74 20 61 6e 64 20 74 68 65 20 6e 75 6d 62  set and the numb
16f0: 65 72 20 72 75 6e 6e 69 6e 67 20 69 73 20 67 72  er running is gr
1700: 65 61 74 65 72 20 0a 09 09 09 09 20 3b 3b 20 74  eater ..... ;; t
1710: 68 61 6e 20 69 74 20 74 68 61 6e 20 63 61 6e 6e  han it than cann
1720: 6f 74 20 72 75 6e 20 6d 6f 72 65 20 6a 6f 62 73  ot run more jobs
1730: 0a 09 09 09 09 20 28 28 61 6e 64 20 6d 61 78 2d  ..... ((and max-
1740: 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20  concurrent-jobs 
1750: 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20  (>= num-running 
1760: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a  max-concurrent-j
1770: 6f 62 73 29 29 0a 09 09 09 09 20 20 28 64 65 62  obs)).....  (deb
1780: 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e  ug:print 0 "WARN
1790: 49 4e 47 3a 20 4d 61 78 20 72 75 6e 6e 69 6e 67  ING: Max running
17a0: 20 6a 6f 62 73 20 65 78 63 65 65 64 65 64 2c 20   jobs exceeded, 
17b0: 63 75 72 72 65 6e 74 20 6e 75 6d 62 65 72 20 72  current number r
17c0: 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75  unning: " num-ru
17d0: 6e 6e 69 6e 67 20 0a 09 09 09 09 09 20 20 20 20  nning ......    
17e0: 20 20 20 22 2c 20 6d 61 78 5f 63 6f 6e 63 75 72     ", max_concur
17f0: 72 65 6e 74 5f 6a 6f 62 73 3a 20 22 20 6d 61 78  rent_jobs: " max
1800: 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73  -concurrent-jobs
1810: 29 0a 09 09 09 09 20 20 23 74 29 0a 09 09 09 09  ).....  #t).....
1820: 20 3b 3b 20 69 66 20 6a 6f 62 2d 67 72 6f 75 70   ;; if job-group
1830: 2d 6c 69 6d 69 74 20 69 73 20 73 65 74 20 61 6e  -limit is set an
1840: 64 20 6e 75 6d 62 65 72 20 6f 66 20 6a 6f 62 73  d number of jobs
1850: 20 69 6e 20 74 68 65 20 67 72 6f 75 70 20 69 73   in the group is
1860: 20 67 72 65 61 74 65 72 0a 09 09 09 09 20 3b 3b   greater..... ;;
1870: 20 74 68 61 6e 20 74 68 65 20 6c 69 6d 69 74 20   than the limit 
1880: 74 68 65 6e 20 63 61 6e 6e 6f 74 20 72 75 6e 20  then cannot run 
1890: 6d 6f 72 65 20 6a 6f 62 73 20 6f 66 20 74 68 69  more jobs of thi
18a0: 73 20 6b 69 6e 64 0a 09 09 09 09 20 28 28 61 6e  s kind..... ((an
18b0: 64 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69  d job-group-limi
18c0: 74 0a 09 09 09 09 20 20 20 20 20 20 20 28 3e 3d  t.....       (>=
18d0: 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d   num-running-in-
18e0: 6a 6f 62 67 72 6f 75 70 20 6a 6f 62 2d 67 72 6f  jobgroup job-gro
18f0: 75 70 2d 6c 69 6d 69 74 29 29 0a 09 09 09 09 20  up-limit))..... 
1900: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20   (debug:print 1 
1910: 22 57 41 52 4e 49 4e 47 3a 20 6e 75 6d 62 65 72  "WARNING: number
1920: 20 6f 66 20 6a 6f 62 73 20 22 20 6e 75 6d 2d 72   of jobs " num-r
1930: 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f  unning-in-jobgro
1940: 75 70 20 0a 09 09 09 09 09 20 20 20 20 20 20 20  up ......       
1950: 22 20 69 6e 20 22 20 6a 6f 62 67 72 6f 75 70 20  " in " jobgroup 
1960: 22 20 65 78 63 65 65 64 65 64 2c 20 77 69 6c 6c  " exceeded, will
1970: 20 6e 6f 74 20 72 75 6e 20 22 20 28 74 65 73 74   not run " (test
1980: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d  s:testqueue-get-
1990: 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65  testname test-re
19a0: 63 6f 72 64 29 29 0a 09 09 09 09 20 20 23 74 29  cord)).....  #t)
19b0: 0a 09 09 09 09 20 28 65 6c 73 65 20 23 66 29 29  ..... (else #f))
19c0: 29 29 0a 09 20 20 28 6c 69 73 74 20 28 6e 6f 74  ))..  (list (not
19d0: 20 63 61 6e 2d 6e 6f 74 2d 72 75 6e 2d 6d 6f 72   can-not-run-mor
19e0: 65 29 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 6e  e) num-running n
19f0: 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f  um-running-in-jo
1a00: 62 67 72 6f 75 70 20 6d 61 78 2d 63 6f 6e 63 75  bgroup max-concu
1a10: 72 72 65 6e 74 2d 6a 6f 62 73 20 6a 6f 62 2d 67  rrent-jobs job-g
1a20: 72 6f 75 70 2d 6c 69 6d 69 74 29 29 29 29 29 0a  roup-limit))))).
1a30: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  .;;=============
1a40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1a50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1a60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1a70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4e 65 77  =========.;; New
1a80: 20 6d 65 74 68 6f 64 6f 6c 6f 67 79 2e 20 54 68   methodology. Th
1a90: 65 73 65 20 72 6f 75 74 69 6e 65 73 20 77 69 6c  ese routines wil
1aa0: 6c 20 72 65 70 6c 61 63 65 20 74 68 65 20 61 62  l replace the ab
1ab0: 6f 76 65 20 69 6e 20 74 69 6d 65 2e 20 46 6f 72  ove in time. For
1ac0: 0a 3b 3b 20 6e 6f 77 20 74 68 65 20 63 6f 64 65  .;; now the code
1ad0: 20 69 73 20 64 75 70 6c 69 63 61 74 65 64 2e 20   is duplicated. 
1ae0: 54 68 69 73 20 73 74 75 66 66 20 69 73 20 69 6e  This stuff is in
1af0: 69 74 69 61 6c 6c 79 20 75 73 65 64 20 69 6e 20  itially used in 
1b00: 74 68 65 20 6d 6f 6e 69 74 6f 72 0a 3b 3b 20 62  the monitor.;; b
1b10: 61 73 65 64 20 63 6f 64 65 2e 0a 3b 3b 3d 3d 3d  ased code..;;===
1b20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1b30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1b40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1b50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1b60: 3d 3d 3d 0a 0a 3b 3b 20 72 65 67 69 73 74 65 72  ===..;; register
1b70: 20 61 20 74 65 73 74 20 72 75 6e 20 77 69 74 68   a test run with
1b80: 20 74 68 65 20 64 62 0a 28 64 65 66 69 6e 65 20   the db.(define 
1b90: 28 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72  (runs:register-r
1ba0: 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 61  un db keys keyva
1bb0: 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 73 74 61  llst runname sta
1bc0: 74 65 20 73 74 61 74 75 73 20 75 73 65 72 29 0a  te status user).
1bd0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 33    (debug:print 3
1be0: 20 22 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d   "runs:register-
1bf0: 72 75 6e 2c 20 6b 65 79 73 3a 20 22 20 6b 65 79  run, keys: " key
1c00: 73 20 22 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22  s " keyvallst: "
1c10: 20 6b 65 79 76 61 6c 6c 73 74 20 22 20 72 75 6e   keyvallst " run
1c20: 6e 61 6d 65 3a 20 22 20 72 75 6e 6e 61 6d 65 20  name: " runname 
1c30: 22 20 73 74 61 74 65 3a 20 22 20 73 74 61 74 65  " state: " state
1c40: 20 22 20 73 74 61 74 75 73 3a 20 22 20 73 74 61   " status: " sta
1c50: 74 75 73 20 22 20 75 73 65 72 3a 20 22 20 75 73  tus " user: " us
1c60: 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 28 6b 65  er).  (let* ((ke
1c70: 79 73 74 72 20 20 20 20 28 6b 65 79 73 2d 3e 6b  ystr    (keys->k
1c80: 65 79 73 74 72 20 6b 65 79 73 29 29 0a 09 20 28  eystr keys)).. (
1c90: 63 6f 6d 6d 61 20 20 20 20 20 28 69 66 20 28 3e  comma     (if (>
1ca0: 20 28 6c 65 6e 67 74 68 20 6b 65 79 73 29 20 30   (length keys) 0
1cb0: 29 20 22 2c 22 20 22 22 29 29 0a 09 20 28 61 6e  ) "," "")).. (an
1cc0: 64 73 74 72 20 20 20 20 28 69 66 20 28 3e 20 28  dstr    (if (> (
1cd0: 6c 65 6e 67 74 68 20 6b 65 79 73 29 20 30 29 20  length keys) 0) 
1ce0: 22 20 41 4e 44 20 22 20 22 22 29 29 0a 09 20 28  " AND " "")).. (
1cf0: 76 61 6c 73 6c 6f 74 73 20 20 28 6b 65 79 73 2d  valslots  (keys-
1d00: 3e 76 61 6c 73 6c 6f 74 73 20 6b 65 79 73 29 29  >valslots keys))
1d10: 20 3b 3b 20 3f 2c 3f 2c 3f 20 2e 2e 2e 0a 09 20   ;; ?,?,? ..... 
1d20: 28 6b 65 79 76 61 6c 73 20 20 20 28 6d 61 70 20  (keyvals   (map 
1d30: 63 61 64 72 20 6b 65 79 76 61 6c 6c 73 74 29 29  cadr keyvallst))
1d40: 0a 09 20 28 61 6c 6c 76 61 6c 73 20 20 20 28 61  .. (allvals   (a
1d50: 70 70 65 6e 64 20 28 6c 69 73 74 20 72 75 6e 6e  ppend (list runn
1d60: 61 6d 65 20 73 74 61 74 65 20 73 74 61 74 75 73  ame state status
1d70: 20 75 73 65 72 29 20 6b 65 79 76 61 6c 73 29 29   user) keyvals))
1d80: 0a 09 20 28 71 72 79 76 61 6c 73 20 20 20 28 61  .. (qryvals   (a
1d90: 70 70 65 6e 64 20 28 6c 69 73 74 20 72 75 6e 6e  ppend (list runn
1da0: 61 6d 65 29 20 6b 65 79 76 61 6c 73 29 29 0a 09  ame) keyvals))..
1db0: 20 28 6b 65 79 3d 3f 73 74 72 20 20 28 73 74 72   (key=?str  (str
1dc0: 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20  ing-intersperse 
1dd0: 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 6b 29  (map (lambda (k)
1de0: 28 63 6f 6e 63 20 28 6b 65 79 3a 67 65 74 2d 66  (conc (key:get-f
1df0: 69 65 6c 64 6e 61 6d 65 20 6b 29 20 22 3d 3f 22  ieldname k) "=?"
1e00: 29 29 20 6b 65 79 73 29 20 22 20 41 4e 44 20 22  )) keys) " AND "
1e10: 29 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70  ))).    (debug:p
1e20: 72 69 6e 74 20 33 20 22 6b 65 79 73 3a 20 22 20  rint 3 "keys: " 
1e30: 6b 65 79 73 20 22 20 61 6c 6c 76 61 6c 73 3a 20  keys " allvals: 
1e40: 22 20 61 6c 6c 76 61 6c 73 20 22 20 6b 65 79 76  " allvals " keyv
1e50: 61 6c 73 3a 20 22 20 6b 65 79 76 61 6c 73 29 0a  als: " keyvals).
1e60: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
1e70: 20 32 20 22 4e 4f 54 45 3a 20 75 73 69 6e 67 20   2 "NOTE: using 
1e80: 74 61 72 67 65 74 20 22 20 28 73 74 72 69 6e 67  target " (string
1e90: 2d 69 6e 74 65 72 73 70 65 72 73 65 20 6b 65 79  -intersperse key
1ea0: 76 61 6c 73 20 22 2f 22 29 20 22 20 66 6f 72 20  vals "/") " for 
1eb0: 74 68 69 73 20 72 75 6e 22 29 0a 20 20 20 20 28  this run").    (
1ec0: 69 66 20 28 61 6e 64 20 72 75 6e 6e 61 6d 65 20  if (and runname 
1ed0: 28 6e 75 6c 6c 3f 20 28 66 69 6c 74 65 72 20 28  (null? (filter (
1ee0: 6c 61 6d 62 64 61 20 28 78 29 28 6e 6f 74 20 78  lambda (x)(not x
1ef0: 29 29 20 6b 65 79 76 61 6c 73 29 29 29 20 3b 3b  )) keyvals))) ;;
1f00: 20 74 68 65 72 65 20 6d 75 73 74 20 62 65 20 61   there must be a
1f10: 20 62 65 74 74 65 72 20 77 61 79 20 74 6f 20 22   better way to "
1f20: 61 70 70 6c 79 20 61 6e 64 22 0a 09 28 6c 65 74  apply and"..(let
1f30: 20 28 28 72 65 73 20 23 66 29 29 0a 09 20 20 28   ((res #f))..  (
1f40: 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a 65 78  apply sqlite3:ex
1f50: 65 63 75 74 65 20 64 62 20 28 63 6f 6e 63 20 22  ecute db (conc "
1f60: 49 4e 53 45 52 54 20 4f 52 20 49 47 4e 4f 52 45  INSERT OR IGNORE
1f70: 20 49 4e 54 4f 20 72 75 6e 73 20 28 72 75 6e 6e   INTO runs (runn
1f80: 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73  ame,state,status
1f90: 2c 6f 77 6e 65 72 2c 65 76 65 6e 74 5f 74 69 6d  ,owner,event_tim
1fa0: 65 22 20 63 6f 6d 6d 61 20 6b 65 79 73 74 72 20  e" comma keystr 
1fb0: 22 29 20 56 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f  ") VALUES (?,?,?
1fc0: 2c 3f 2c 73 74 72 66 74 69 6d 65 28 27 25 73 27  ,?,strftime('%s'
1fd0: 2c 27 6e 6f 77 27 29 22 20 63 6f 6d 6d 61 20 76  ,'now')" comma v
1fe0: 61 6c 73 6c 6f 74 73 20 22 29 3b 22 29 0a 09 09  alslots ");")...
1ff0: 20 61 6c 6c 76 61 6c 73 29 0a 09 20 20 28 61 70   allvals)..  (ap
2000: 70 6c 79 20 73 71 6c 69 74 65 33 3a 66 6f 72 2d  ply sqlite3:for-
2010: 65 61 63 68 2d 72 6f 77 20 0a 09 20 20 20 28 6c  each-row ..   (l
2020: 61 6d 62 64 61 20 28 69 64 29 0a 09 20 20 20 20  ambda (id)..    
2030: 20 28 73 65 74 21 20 72 65 73 20 69 64 29 29 0a   (set! res id)).
2040: 09 20 20 20 64 62 0a 09 20 20 20 28 6c 65 74 20  .   db..   (let 
2050: 28 28 71 72 79 20 28 63 6f 6e 63 20 22 53 45 4c  ((qry (conc "SEL
2060: 45 43 54 20 69 64 20 46 52 4f 4d 20 72 75 6e 73  ECT id FROM runs
2070: 20 57 48 45 52 45 20 28 72 75 6e 6e 61 6d 65 3d   WHERE (runname=
2080: 3f 20 22 20 61 6e 64 73 74 72 20 6b 65 79 3d 3f  ? " andstr key=?
2090: 73 74 72 20 22 29 3b 22 29 29 29 0a 09 20 20 20  str ");")))..   
20a0: 20 20 3b 28 64 65 62 75 67 3a 70 72 69 6e 74 20    ;(debug:print 
20b0: 34 20 22 71 72 79 3a 20 22 20 71 72 79 29 20 0a  4 "qry: " qry) .
20c0: 09 20 20 20 20 20 71 72 79 29 0a 09 20 20 20 71  .     qry)..   q
20d0: 72 79 76 61 6c 73 29 0a 09 20 20 28 73 71 6c 69  ryvals)..  (sqli
20e0: 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 20 22  te3:execute db "
20f0: 55 50 44 41 54 45 20 72 75 6e 73 20 53 45 54 20  UPDATE runs SET 
2100: 73 74 61 74 65 3d 3f 2c 73 74 61 74 75 73 3d 3f  state=?,status=?
2110: 20 57 48 45 52 45 20 69 64 3d 3f 3b 22 20 73 74   WHERE id=?;" st
2120: 61 74 65 20 73 74 61 74 75 73 20 72 65 73 29 0a  ate status res).
2130: 09 20 20 72 65 73 29 20 0a 09 28 62 65 67 69 6e  .  res) ..(begin
2140: 0a 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ..  (debug:print
2150: 20 30 20 22 45 52 52 4f 52 3a 20 43 61 6c 6c 65   0 "ERROR: Calle
2160: 64 20 77 69 74 68 6f 75 74 20 61 6c 6c 20 6e 65  d without all ne
2170: 63 65 73 73 61 72 79 20 6b 65 79 73 22 29 0a 09  cessary keys")..
2180: 20 20 23 66 29 29 29 29 0a 0a 3b 3b 20 54 68 69    #f))))..;; Thi
2190: 73 20 69 73 20 61 20 64 75 70 6c 69 63 61 74 65  s is a duplicate
21a0: 20 6f 66 20 72 75 6e 2d 74 65 73 74 73 20 28 77   of run-tests (w
21b0: 68 69 63 68 20 68 61 73 20 62 65 65 6e 20 64 65  hich has been de
21c0: 70 72 65 63 61 74 65 64 29 2e 20 55 73 65 20 74  precated). Use t
21d0: 68 69 73 20 6f 6e 65 20 69 6e 73 74 65 61 64 20  his one instead 
21e0: 6f 66 20 72 75 6e 20 74 65 73 74 73 2e 0a 3b 3b  of run tests..;;
21f0: 20 6b 65 79 76 61 6c 73 2e 0a 3b 3b 0a 3b 3b 20   keyvals..;;.;; 
2200: 20 74 65 73 74 2d 6e 61 6d 65 73 3a 20 43 6f 6d   test-names: Com
2210: 6d 61 20 73 65 70 61 72 61 74 65 64 20 70 61 74  ma separated pat
2220: 74 65 72 6e 73 20 73 61 6d 65 20 61 73 20 74 65  terns same as te
2230: 73 74 2d 70 61 74 74 73 20 62 75 74 20 75 73 65  st-patts but use
2240: 64 20 69 6e 20 73 65 6c 65 63 74 69 6f 6e 20 0a  d in selection .
2250: 3b 3b 20 20 20 20 20 20 20 20 20 20 20 20 20 20  ;;              
2260: 6f 66 20 74 65 73 74 73 20 74 6f 20 72 75 6e 2e  of tests to run.
2270: 20 54 68 65 20 69 74 65 6d 20 70 6f 72 74 69 6f   The item portio
2280: 6e 73 20 61 72 65 20 6e 6f 74 20 72 65 73 70 65  ns are not respe
2290: 63 74 65 64 2e 0a 3b 3b 20 20 20 20 20 20 20 20  cted..;;        
22a0: 20 20 20 20 20 20 46 49 58 4d 45 3a 20 65 72 72        FIXME: err
22b0: 6f 72 20 6f 75 74 20 69 66 20 2f 70 61 74 74 20  or out if /patt 
22c0: 73 70 65 63 69 66 69 65 64 0a 3b 3b 20 20 20 20  specified.;;    
22d0: 20 20 20 20 20 20 20 20 0a 28 64 65 66 69 6e 65          .(define
22e0: 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73   (runs:run-tests
22f0: 20 74 61 72 67 65 74 20 72 75 6e 6e 61 6d 65 20   target runname 
2300: 74 65 73 74 2d 6e 61 6d 65 73 20 74 65 73 74 2d  test-names test-
2310: 70 61 74 74 73 20 75 73 65 72 20 66 6c 61 67 73  patts user flags
2320: 29 0a 20 20 28 63 6f 6d 6d 6f 6e 3a 63 6c 65 61  ).  (common:clea
2330: 72 2d 63 61 63 68 65 73 29 20 3b 3b 20 63 6c 65  r-caches) ;; cle
2340: 61 72 20 61 6c 6c 20 63 61 63 68 65 73 0a 20 20  ar all caches.  
2350: 28 6c 65 74 2a 20 28 28 64 62 20 20 20 20 20 20  (let* ((db      
2360: 20 20 20 20 23 66 29 0a 09 20 28 6b 65 79 73 20      #f).. (keys 
2370: 20 20 20 20 20 20 20 28 63 64 62 3a 72 65 6d 6f         (cdb:remo
2380: 74 65 2d 72 75 6e 20 64 62 3a 67 65 74 2d 6b 65  te-run db:get-ke
2390: 79 73 20 23 66 29 29 0a 09 20 28 6b 65 79 76 61  ys #f)).. (keyva
23a0: 6c 6c 73 74 20 20 20 28 6b 65 79 73 3a 74 61 72  llst   (keys:tar
23b0: 67 65 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 79 73  get->keyval keys
23c0: 20 74 61 72 67 65 74 29 29 0a 09 20 28 72 75 6e   target)).. (run
23d0: 2d 69 64 20 20 20 20 20 20 28 63 64 62 3a 72 65  -id      (cdb:re
23e0: 6d 6f 74 65 2d 72 75 6e 20 72 75 6e 73 3a 72 65  mote-run runs:re
23f0: 67 69 73 74 65 72 2d 72 75 6e 20 23 66 20 6b 65  gister-run #f ke
2400: 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e  ys keyvallst run
2410: 6e 61 6d 65 20 22 6e 65 77 22 20 22 6e 2f 61 22  name "new" "n/a"
2420: 20 75 73 65 72 29 29 20 20 3b 3b 20 20 74 65 73   user))  ;;  tes
2430: 74 2d 6e 61 6d 65 29 29 29 0a 09 20 28 6b 65 79  t-name))).. (key
2440: 76 61 6c 73 20 20 20 20 20 28 69 66 20 72 75 6e  vals     (if run
2450: 2d 69 64 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d  -id (cdb:remote-
2460: 72 75 6e 20 64 62 3a 67 65 74 2d 6b 65 79 2d 76  run db:get-key-v
2470: 61 6c 73 20 23 66 20 72 75 6e 2d 69 64 29 20 23  als #f run-id) #
2480: 66 29 29 0a 09 20 28 64 65 66 65 72 72 65 64 20  f)).. (deferred 
2490: 20 20 20 27 28 29 29 20 3b 3b 20 64 65 6c 61 79     '()) ;; delay
24a0: 20 72 75 6e 6e 69 6e 67 20 74 68 65 73 65 20 73   running these s
24b0: 69 6e 63 65 20 74 68 65 79 20 68 61 76 65 20 61  ince they have a
24c0: 20 77 61 69 74 6f 6e 20 63 6c 61 75 73 65 0a 09   waiton clause..
24d0: 20 3b 3b 20 6b 65 65 70 67 6f 69 6e 67 20 69 73   ;; keepgoing is
24e0: 20 74 68 65 20 64 65 66 61 63 74 6f 20 6d 6f 64   the defacto mod
24f0: 61 6c 69 74 79 20 6e 6f 77 2c 20 77 69 6c 6c 20  ality now, will 
2500: 61 64 64 20 68 69 74 2d 6e 2d 72 75 6e 20 61 20  add hit-n-run a 
2510: 62 69 74 20 6c 61 74 65 72 0a 09 20 3b 3b 20 28  bit later.. ;; (
2520: 6b 65 65 70 67 6f 69 6e 67 20 20 20 28 68 61 73  keepgoing   (has
2530: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61  h-table-ref/defa
2540: 75 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 65 70  ult flags "-keep
2550: 67 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 28 72  going" #f)).. (r
2560: 75 6e 63 6f 6e 66 69 67 66 20 20 20 28 63 6f 6e  unconfigf   (con
2570: 63 20 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72  c  *toppath* "/r
2580: 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67  unconfigs.config
2590: 22 29 29 0a 09 20 28 72 65 71 75 69 72 65 64 2d  ")).. (required-
25a0: 74 65 73 74 73 20 27 28 29 29 0a 09 20 28 74 65  tests '()).. (te
25b0: 73 74 2d 72 65 63 6f 72 64 73 20 28 6d 61 6b 65  st-records (make
25c0: 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 0a  -hash-table)))..
25d0: 20 20 20 20 28 73 65 74 2d 6d 65 67 61 74 65 73      (set-megates
25e0: 74 2d 65 6e 76 2d 76 61 72 73 20 72 75 6e 2d 69  t-env-vars run-i
25f0: 64 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20  d) ;; these may 
2600: 62 65 20 6e 65 65 64 65 64 20 62 79 20 74 68 65  be needed by the
2610: 20 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65   launching proce
2620: 73 73 0a 0a 20 20 20 20 28 69 66 20 28 66 69 6c  ss..    (if (fil
2630: 65 2d 65 78 69 73 74 73 3f 20 72 75 6e 63 6f 6e  e-exists? runcon
2640: 66 69 67 66 29 0a 09 28 73 65 74 75 70 2d 65 6e  figf)..(setup-en
2650: 76 2d 64 65 66 61 75 6c 74 73 20 72 75 6e 63 6f  v-defaults runco
2660: 6e 66 69 67 66 20 72 75 6e 2d 69 64 20 2a 61 6c  nfigf run-id *al
2670: 72 65 61 64 79 2d 73 65 65 6e 2d 72 75 6e 63 6f  ready-seen-runco
2680: 6e 66 69 67 2d 69 6e 66 6f 2a 20 6b 65 79 73 20  nfig-info* keys 
2690: 6b 65 79 76 61 6c 73 20 22 70 72 65 2d 6c 61 75  keyvals "pre-lau
26a0: 6e 63 68 2d 65 6e 76 2d 76 61 72 73 22 29 0a 09  nch-env-vars")..
26b0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
26c0: 57 41 52 4e 49 4e 47 3a 20 59 6f 75 20 64 6f 20  WARNING: You do 
26d0: 6e 6f 74 20 68 61 76 65 20 61 20 72 75 6e 20 63  not have a run c
26e0: 6f 6e 66 69 67 20 66 69 6c 65 3a 20 22 20 72 75  onfig file: " ru
26f0: 6e 63 6f 6e 66 69 67 66 29 29 0a 20 20 20 20 0a  nconfigf)).    .
2700: 20 20 20 20 3b 3b 20 6c 6f 6f 6b 20 75 70 20 61      ;; look up a
2710: 6c 6c 20 74 65 73 74 73 20 6d 61 74 63 68 69 6e  ll tests matchin
2720: 67 20 74 68 65 20 63 6f 6d 6d 61 20 73 65 70 61  g the comma sepa
2730: 72 61 74 65 64 20 6c 69 73 74 20 6f 66 20 67 6c  rated list of gl
2740: 6f 62 73 20 69 6e 0a 20 20 20 20 3b 3b 20 74 65  obs in.    ;; te
2750: 73 74 2d 70 61 74 74 73 20 28 75 73 69 6e 67 20  st-patts (using 
2760: 25 20 61 73 20 77 69 6c 64 63 61 72 64 29 0a 0a  % as wildcard)..
2770: 20 20 20 20 28 73 65 74 21 20 74 65 73 74 2d 6e      (set! test-n
2780: 61 6d 65 73 20 28 74 65 73 74 73 3a 67 65 74 2d  ames (tests:get-
2790: 76 61 6c 69 64 2d 74 65 73 74 73 20 2a 74 6f 70  valid-tests *top
27a0: 70 61 74 68 2a 20 74 65 73 74 2d 6e 61 6d 65 73  path* test-names
27b0: 29 29 0a 20 20 20 20 28 73 65 74 21 20 74 65 73  )).    (set! tes
27c0: 74 2d 6e 61 6d 65 73 20 28 64 65 6c 65 74 65 2d  t-names (delete-
27d0: 64 75 70 6c 69 63 61 74 65 73 20 74 65 73 74 2d  duplicates test-
27e0: 6e 61 6d 65 73 29 29 0a 0a 20 20 20 20 28 64 65  names))..    (de
27f0: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 30  bug:print-info 0
2800: 20 22 74 65 73 74 20 6e 61 6d 65 73 20 22 20 74   "test names " t
2810: 65 73 74 2d 6e 61 6d 65 73 29 0a 0a 20 20 20 20  est-names)..    
2820: 3b 3b 20 6f 6e 20 74 68 65 20 66 69 72 73 74 20  ;; on the first 
2830: 70 61 73 73 20 6f 72 20 63 61 6c 6c 20 74 6f 20  pass or call to 
2840: 72 75 6e 2d 74 65 73 74 73 20 73 65 74 20 46 41  run-tests set FA
2850: 49 4c 53 20 74 6f 20 4e 4f 54 5f 53 54 41 52 54  ILS to NOT_START
2860: 45 44 20 69 66 0a 20 20 20 20 3b 3b 20 2d 6b 65  ED if.    ;; -ke
2870: 65 70 67 6f 69 6e 67 20 69 73 20 73 70 65 63 69  epgoing is speci
2880: 66 69 65 64 0a 20 20 20 20 28 69 66 20 28 65 71  fied.    (if (eq
2890: 3f 20 2a 70 61 73 73 6e 75 6d 2a 20 30 29 0a 09  ? *passnum* 0)..
28a0: 28 62 65 67 69 6e 0a 09 20 20 3b 3b 20 68 61 76  (begin..  ;; hav
28b0: 65 20 74 6f 20 64 65 6c 65 74 65 20 74 65 73 74  e to delete test
28c0: 20 72 65 63 6f 72 64 73 20 77 68 65 72 65 20 4e   records where N
28d0: 4f 54 5f 53 54 41 52 54 45 44 20 73 69 6e 63 65  OT_STARTED since
28e0: 20 74 68 65 79 20 63 61 6e 20 63 61 75 73 65 20   they can cause 
28f0: 2d 6b 65 65 70 67 6f 69 6e 67 20 74 6f 20 0a 09  -keepgoing to ..
2900: 20 20 3b 3b 20 67 65 74 20 73 74 75 63 6b 20 64    ;; get stuck d
2910: 75 65 20 74 6f 20 62 65 63 6f 6d 69 6e 67 20 69  ue to becoming i
2920: 6e 61 63 63 65 73 73 69 62 6c 65 20 66 72 6f 6d  naccessible from
2930: 20 61 20 66 61 69 6c 65 64 20 74 65 73 74 2e 20   a failed test. 
2940: 49 2e 65 2e 20 69 66 20 74 65 73 74 20 42 20 64  I.e. if test B d
2950: 65 70 65 6e 64 73 20 0a 09 20 20 3b 3b 20 6f 6e  epends ..  ;; on
2960: 20 74 65 73 74 20 41 20 62 75 74 20 74 65 73 74   test A but test
2970: 20 42 20 72 65 61 63 68 65 64 20 74 68 65 20 70   B reached the p
2980: 6f 69 6e 74 20 6f 6e 20 62 65 69 6e 67 20 72 65  oint on being re
2990: 67 69 73 74 65 72 65 64 20 61 73 20 4e 4f 54 5f  gistered as NOT_
29a0: 53 54 41 52 54 45 44 20 61 6e 64 20 74 65 73 74  STARTED and test
29b0: 0a 09 20 20 3b 3b 20 41 20 66 61 69 6c 65 64 20  ..  ;; A failed 
29c0: 66 6f 72 20 73 6f 6d 65 20 72 65 61 73 6f 6e 20  for some reason 
29d0: 74 68 65 6e 20 6f 6e 20 72 65 2d 72 75 6e 20 75  then on re-run u
29e0: 73 69 6e 67 20 2d 6b 65 65 70 67 6f 69 6e 67 20  sing -keepgoing 
29f0: 74 68 65 20 72 75 6e 20 63 61 6e 20 6e 65 76 65  the run can neve
2a00: 72 20 63 6f 6d 70 6c 65 74 65 2e 0a 09 20 20 28  r complete...  (
2a10: 63 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 73  cdb:delete-tests
2a20: 2d 69 6e 2d 73 74 61 74 65 20 2a 72 75 6e 72 65  -in-state *runre
2a30: 6d 6f 74 65 2a 20 72 75 6e 2d 69 64 20 22 4e 4f  mote* run-id "NO
2a40: 54 5f 53 54 41 52 54 45 44 22 29 0a 09 20 20 28  T_STARTED")..  (
2a50: 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64  cdb:remote-run d
2a60: 62 3a 73 65 74 2d 74 65 73 74 73 2d 73 74 61 74  b:set-tests-stat
2a70: 65 2d 73 74 61 74 75 73 20 23 66 20 72 75 6e 2d  e-status #f run-
2a80: 69 64 20 74 65 73 74 2d 6e 61 6d 65 73 20 23 66  id test-names #f
2a90: 20 22 46 41 49 4c 22 20 22 4e 4f 54 5f 53 54 41   "FAIL" "NOT_STA
2aa0: 52 54 45 44 22 20 22 46 41 49 4c 22 29 29 29 0a  RTED" "FAIL"))).
2ab0: 0a 20 20 20 20 3b 3b 20 66 72 6f 6d 20 68 65 72  .    ;; from her
2ac0: 65 20 6f 6e 20 6f 75 74 20 74 68 65 20 64 62 20  e on out the db 
2ad0: 77 69 6c 6c 20 62 65 20 6f 70 65 6e 65 64 20 61  will be opened a
2ae0: 6e 64 20 63 6c 6f 73 65 64 20 6f 6e 20 65 76 65  nd closed on eve
2af0: 72 79 20 63 61 6c 6c 20 72 75 6e 73 3a 72 75 6e  ry call runs:run
2b00: 2d 74 65 73 74 73 2d 71 75 65 75 65 0a 20 20 20  -tests-queue.   
2b10: 20 3b 3b 20 28 73 71 6c 69 74 65 33 3a 66 69 6e   ;; (sqlite3:fin
2b20: 61 6c 69 7a 65 21 20 64 62 29 20 0a 20 20 20 20  alize! db) .    
2b30: 3b 3b 20 6e 6f 77 20 61 64 64 20 6e 6f 6e 2d 64  ;; now add non-d
2b40: 69 72 65 63 74 6c 79 20 72 65 66 65 72 65 6e 63  irectly referenc
2b50: 65 64 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20  ed dependencies 
2b60: 28 69 2e 65 2e 20 77 61 69 74 6f 6e 29 0a 20 20  (i.e. waiton).  
2b70: 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c    (if (not (null
2b80: 3f 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09  ? test-names))..
2b90: 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68 65 64 20  (let loop ((hed 
2ba0: 28 63 61 72 20 74 65 73 74 2d 6e 61 6d 65 73 29  (car test-names)
2bb0: 29 0a 09 09 20 20 20 28 74 61 6c 20 28 63 64 72  )...   (tal (cdr
2bc0: 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 20 20   test-names)))  
2bd0: 20 20 20 20 20 20 20 3b 3b 20 27 72 65 74 75 72         ;; 'retur
2be0: 6e 2d 70 72 6f 63 73 20 74 65 6c 6c 73 20 74 68  n-procs tells th
2bf0: 65 20 63 6f 6e 66 69 67 20 72 65 61 64 65 72 20  e config reader 
2c00: 74 6f 20 70 72 65 70 20 72 75 6e 6e 69 6e 67 20  to prep running 
2c10: 73 79 73 74 65 6d 20 62 75 74 20 72 65 74 75 72  system but retur
2c20: 6e 20 61 20 70 72 6f 63 0a 09 20 20 28 64 65 62  n a proc..  (deb
2c30: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20  ug:print-info 4 
2c40: 22 68 65 64 3d 22 20 68 65 64 20 22 20 61 74 20  "hed=" hed " at 
2c50: 74 6f 70 20 6f 66 20 6c 6f 6f 70 22 29 0a 09 20  top of loop").. 
2c60: 20 28 6c 65 74 2a 20 28 28 63 6f 6e 66 69 67 20   (let* ((config 
2c70: 20 28 74 65 73 74 73 3a 67 65 74 2d 74 65 73 74   (tests:get-test
2c80: 63 6f 6e 66 69 67 20 68 65 64 20 27 72 65 74 75  config hed 'retu
2c90: 72 6e 2d 70 72 6f 63 73 29 29 0a 09 09 20 28 77  rn-procs))... (w
2ca0: 61 69 74 6f 6e 73 20 28 6c 65 74 20 28 28 69 6e  aitons (let ((in
2cb0: 73 74 72 20 28 69 66 20 63 6f 6e 66 69 67 20 0a  str (if config .
2cc0: 09 09 09 09 09 20 20 20 28 63 6f 6e 66 69 67 2d  .....   (config-
2cd0: 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 20 22 72  lookup config "r
2ce0: 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 77 61  equirements" "wa
2cf0: 69 74 6f 6e 22 29 0a 09 09 09 09 09 20 20 20 28  iton")......   (
2d00: 62 65 67 69 6e 20 3b 3b 20 4e 6f 20 63 6f 6e 66  begin ;; No conf
2d10: 69 67 20 6d 65 61 6e 73 20 74 68 69 73 20 69 73  ig means this is
2d20: 20 61 20 6e 6f 6e 2d 65 78 69 73 74 61 6e 74 20   a non-existant 
2d30: 74 65 73 74 0a 09 09 09 09 09 20 20 20 20 20 28  test......     (
2d40: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45  debug:print 0 "E
2d50: 52 52 4f 52 3a 20 6e 6f 6e 2d 65 78 69 73 74 65  RROR: non-existe
2d60: 6e 74 20 72 65 71 75 69 72 65 64 20 74 65 73 74  nt required test
2d70: 20 5c 22 22 20 68 65 64 20 22 5c 22 22 29 0a 09   \"" hed "\"")..
2d80: 09 09 09 09 20 20 20 20 20 28 69 66 20 64 62 20  ....     (if db 
2d90: 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a  (sqlite3:finaliz
2da0: 65 21 20 64 62 29 29 0a 09 09 09 09 09 20 20 20  e! db))......   
2db0: 20 20 28 65 78 69 74 20 31 29 29 29 29 29 0a 09    (exit 1)))))..
2dc0: 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ..    (debug:pri
2dd0: 6e 74 2d 69 6e 66 6f 20 38 20 22 77 61 69 74 6f  nt-info 8 "waito
2de0: 6e 73 20 73 74 72 69 6e 67 20 69 73 20 22 20 69  ns string is " i
2df0: 6e 73 74 72 29 0a 09 09 09 20 20 20 20 28 73 74  nstr)....    (st
2e00: 72 69 6e 67 2d 73 70 6c 69 74 20 28 63 6f 6e 64  ring-split (cond
2e10: 0a 09 09 09 09 09 20 20 20 28 28 70 72 6f 63 65  ......   ((proce
2e20: 64 75 72 65 3f 20 69 6e 73 74 72 29 0a 09 09 09  dure? instr)....
2e30: 09 09 20 20 20 20 28 6c 65 74 20 28 28 72 65 73  ..    (let ((res
2e40: 20 28 69 6e 73 74 72 29 29 29 0a 09 09 09 09 09   (instr)))......
2e50: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
2e60: 6e 74 2d 69 6e 66 6f 20 38 20 22 77 61 69 74 6f  nt-info 8 "waito
2e70: 6e 20 70 72 6f 63 65 64 75 72 65 20 72 65 73 75  n procedure resu
2e80: 6c 74 73 20 69 6e 20 73 74 72 69 6e 67 20 22 20  lts in string " 
2e90: 72 65 73 20 22 20 66 6f 72 20 74 65 73 74 20 22  res " for test "
2ea0: 20 68 65 64 29 0a 09 09 09 09 09 20 20 20 20 20   hed)......     
2eb0: 20 72 65 73 29 29 0a 09 09 09 09 09 20 20 20 28   res))......   (
2ec0: 28 73 74 72 69 6e 67 3f 20 69 6e 73 74 72 29 20  (string? instr) 
2ed0: 20 20 20 20 69 6e 73 74 72 29 0a 09 09 09 09 09      instr)......
2ee0: 20 20 20 28 65 6c 73 65 20 0a 09 09 09 09 09 20     (else ...... 
2ef0: 20 20 20 3b 3b 20 4e 4f 54 45 3a 20 54 68 69 73     ;; NOTE: This
2f00: 20 69 73 20 61 63 74 75 61 6c 6c 79 20 74 68 65   is actually the
2f10: 20 63 61 73 65 20 6f 66 20 2a 6e 6f 2a 20 77 61   case of *no* wa
2f20: 69 74 6f 6e 73 21 20 3b 3b 20 28 64 65 62 75 67  itons! ;; (debug
2f30: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a  :print 0 "ERROR:
2f40: 20 73 6f 6d 65 74 68 69 6e 67 20 77 65 6e 74 20   something went 
2f50: 77 72 6f 6e 67 20 69 6e 20 70 72 6f 63 65 73 73  wrong in process
2f60: 69 6e 67 20 77 61 69 74 6f 6e 73 20 66 6f 72 20  ing waitons for 
2f70: 74 65 73 74 20 22 20 68 65 64 29 0a 09 09 09 09  test " hed).....
2f80: 09 20 20 20 20 22 22 29 29 29 29 29 29 0a 09 20  .    "")))))).. 
2f90: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d     (debug:print-
2fa0: 69 6e 66 6f 20 38 20 22 77 61 69 74 6f 6e 73 3a  info 8 "waitons:
2fb0: 20 22 20 77 61 69 74 6f 6e 73 29 0a 09 20 20 20   " waitons)..   
2fc0: 20 3b 3b 20 63 68 65 63 6b 20 66 6f 72 20 68 65   ;; check for he
2fd0: 64 20 69 6e 20 77 61 69 74 6f 6e 73 20 3d 3e 20  d in waitons => 
2fe0: 74 68 69 73 20 77 6f 75 6c 64 20 62 65 20 63 69  this would be ci
2ff0: 72 63 75 6c 61 72 2c 20 72 65 6d 6f 76 65 20 69  rcular, remove i
3000: 74 20 61 6e 64 20 69 73 73 75 65 20 61 6e 0a 09  t and issue an..
3010: 20 20 20 20 3b 3b 20 65 72 72 6f 72 0a 09 20 20      ;; error..  
3020: 20 20 28 69 66 20 28 6d 65 6d 62 65 72 20 68 65    (if (member he
3030: 64 20 77 61 69 74 6f 6e 73 29 0a 09 09 28 62 65  d waitons)...(be
3040: 67 69 6e 0a 09 09 20 20 28 64 65 62 75 67 3a 70  gin...  (debug:p
3050: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 74  rint 0 "ERROR: t
3060: 65 73 74 20 22 20 68 65 64 20 22 20 68 61 73 20  est " hed " has 
3070: 6c 69 73 74 65 64 20 69 74 73 65 6c 66 20 61 73  listed itself as
3080: 20 61 20 77 61 69 74 6f 6e 2c 20 70 6c 65 61 73   a waiton, pleas
3090: 65 20 63 6f 72 72 65 63 74 20 74 68 69 73 21 22  e correct this!"
30a0: 29 0a 09 09 20 20 28 73 65 74 21 20 77 61 69 74  )...  (set! wait
30b0: 6f 6e 73 20 28 66 69 6c 74 65 72 20 28 6c 61 6d  ons (filter (lam
30c0: 62 64 61 20 28 78 29 28 6e 6f 74 20 28 65 71 75  bda (x)(not (equ
30d0: 61 6c 3f 20 78 20 68 65 64 29 29 29 20 77 61 69  al? x hed))) wai
30e0: 74 6f 6e 73 29 29 29 29 0a 09 20 20 20 20 0a 09  tons))))..    ..
30f0: 20 20 20 20 3b 3b 20 28 69 74 65 6d 73 20 20 20      ;; (items   
3100: 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73  (items:get-items
3110: 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 63 6f 6e  -from-config con
3120: 66 69 67 29 29 29 0a 09 20 20 20 20 28 69 66 20  fig)))..    (if 
3130: 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 62 6c 65  (not (hash-table
3140: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 74 65 73  -ref/default tes
3150: 74 2d 72 65 63 6f 72 64 73 20 68 65 64 20 23 66  t-records hed #f
3160: 29 29 0a 09 09 28 68 61 73 68 2d 74 61 62 6c 65  ))...(hash-table
3170: 2d 73 65 74 21 20 74 65 73 74 2d 72 65 63 6f 72  -set! test-recor
3180: 64 73 0a 09 09 09 09 20 68 65 64 20 28 76 65 63  ds..... hed (vec
3190: 74 6f 72 20 68 65 64 20 20 20 20 20 3b 3b 20 30  tor hed     ;; 0
31a0: 0a 09 09 09 09 09 20 20 20 20 20 63 6f 6e 66 69  ......     confi
31b0: 67 20 20 3b 3b 20 31 0a 09 09 09 09 09 20 20 20  g  ;; 1......   
31c0: 20 20 77 61 69 74 6f 6e 73 20 3b 3b 20 32 0a 09    waitons ;; 2..
31d0: 09 09 09 09 20 20 20 20 20 28 63 6f 6e 66 69 67  ....     (config
31e0: 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 20 22  -lookup config "
31f0: 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 70  requirements" "p
3200: 72 69 6f 72 69 74 79 22 29 20 20 20 20 20 3b 3b  riority")     ;;
3210: 20 70 72 69 6f 72 69 74 79 20 33 0a 09 09 09 09   priority 3.....
3220: 09 20 20 20 20 20 28 6c 65 74 20 28 28 69 74 65  .     (let ((ite
3230: 6d 73 20 20 20 20 20 20 28 68 61 73 68 2d 74 61  ms      (hash-ta
3240: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20  ble-ref/default 
3250: 63 6f 6e 66 69 67 20 22 69 74 65 6d 73 22 20 23  config "items" #
3260: 66 29 29 20 3b 3b 20 69 74 65 6d 73 20 34 0a 09  f)) ;; items 4..
3270: 09 09 09 09 09 20 20 20 28 69 74 65 6d 73 74 61  .....   (itemsta
3280: 62 6c 65 20 28 68 61 73 68 2d 74 61 62 6c 65 2d  ble (hash-table-
3290: 72 65 66 2f 64 65 66 61 75 6c 74 20 63 6f 6e 66  ref/default conf
32a0: 69 67 20 22 69 74 65 6d 73 74 61 62 6c 65 22 20  ig "itemstable" 
32b0: 23 66 29 29 29 20 0a 09 09 09 09 09 20 20 20 20  #f))) ......    
32c0: 20 20 20 3b 3b 20 69 66 20 65 69 74 68 65 72 20     ;; if either 
32d0: 69 74 65 6d 73 20 6f 72 20 69 74 65 6d 73 20 74  items or items t
32e0: 61 62 6c 65 20 69 73 20 61 20 70 72 6f 63 20 72  able is a proc r
32f0: 65 74 75 72 6e 20 69 74 20 73 6f 20 74 65 73 74  eturn it so test
3300: 20 72 75 6e 6e 69 6e 67 0a 09 09 09 09 09 20 20   running......  
3310: 20 20 20 20 20 3b 3b 20 70 72 6f 63 65 73 73 20       ;; process 
3320: 63 61 6e 20 6b 6e 6f 77 20 74 6f 20 63 61 6c 6c  can know to call
3330: 20 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73   items:get-items
3340: 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 0a 09 09 09  -from-config....
3350: 09 09 20 20 20 20 20 20 20 3b 3b 20 69 66 20 65  ..       ;; if e
3360: 69 74 68 65 72 20 69 73 20 61 20 6c 69 73 74 20  ither is a list 
3370: 61 6e 64 20 6e 6f 6e 65 20 69 73 20 61 20 70 72  and none is a pr
3380: 6f 63 20 67 6f 20 61 68 65 61 64 20 61 6e 64 20  oc go ahead and 
3390: 63 61 6c 6c 20 67 65 74 2d 69 74 65 6d 73 0a 09  call get-items..
33a0: 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20 6f 74  ....       ;; ot
33b0: 68 65 72 77 69 73 65 20 72 65 74 75 72 6e 20 23  herwise return #
33c0: 66 20 2d 20 74 68 69 73 20 69 73 20 6e 6f 74 20  f - this is not 
33d0: 61 6e 20 69 74 65 72 61 74 65 64 20 74 65 73 74  an iterated test
33e0: 0a 09 09 09 09 09 20 20 20 20 20 20 20 28 63 6f  ......       (co
33f0: 6e 64 0a 09 09 09 09 09 09 28 28 70 72 6f 63 65  nd.......((proce
3400: 64 75 72 65 3f 20 69 74 65 6d 73 29 20 20 20 20  dure? items)    
3410: 20 20 0a 09 09 09 09 09 09 20 28 64 65 62 75 67    ....... (debug
3420: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 69  :print-info 4 "i
3430: 74 65 6d 73 20 69 73 20 61 20 70 72 6f 63 65 64  tems is a proced
3440: 75 72 65 2c 20 77 69 6c 6c 20 63 61 6c 63 20 6c  ure, will calc l
3450: 61 74 65 72 22 29 0a 09 09 09 09 09 09 20 69 74  ater")....... it
3460: 65 6d 73 29 20 20 20 20 20 20 20 20 20 20 20 20  ems)            
3470: 3b 3b 20 63 61 6c 63 20 6c 61 74 65 72 0a 09 09  ;; calc later...
3480: 09 09 09 09 28 28 70 72 6f 63 65 64 75 72 65 3f  ....((procedure?
3490: 20 69 74 65 6d 73 74 61 62 6c 65 29 0a 09 09 09   itemstable)....
34a0: 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ... (debug:print
34b0: 2d 69 6e 66 6f 20 34 20 22 69 74 65 6d 73 74 61  -info 4 "itemsta
34c0: 62 6c 65 20 69 73 20 61 20 70 72 6f 63 65 64 75  ble is a procedu
34d0: 72 65 2c 20 77 69 6c 6c 20 63 61 6c 63 20 6c 61  re, will calc la
34e0: 74 65 72 22 29 0a 09 09 09 09 09 09 20 69 74 65  ter")....... ite
34f0: 6d 73 74 61 62 6c 65 29 20 20 20 20 20 20 20 3b  mstable)       ;
3500: 3b 20 63 61 6c 63 20 6c 61 74 65 72 0a 09 09 09  ; calc later....
3510: 09 09 09 28 28 66 69 6c 74 65 72 20 28 6c 61 6d  ...((filter (lam
3520: 62 64 61 20 28 78 29 0a 09 09 09 09 09 09 09 20  bda (x)........ 
3530: 20 20 28 6c 65 74 20 28 28 76 61 6c 20 28 63 61    (let ((val (ca
3540: 72 20 78 29 29 29 0a 09 09 09 09 09 09 09 20 20  r x)))........  
3550: 20 20 20 28 69 66 20 28 70 72 6f 63 65 64 75 72     (if (procedur
3560: 65 3f 20 76 61 6c 29 20 76 61 6c 20 23 66 29 29  e? val) val #f))
3570: 29 0a 09 09 09 09 09 09 09 20 28 61 70 70 65 6e  )........ (appen
3580: 64 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74 65  d (if (list? ite
3590: 6d 73 29 20 69 74 65 6d 73 20 27 28 29 29 0a 09  ms) items '())..
35a0: 09 09 09 09 09 09 09 20 28 69 66 20 28 6c 69 73  ....... (if (lis
35b0: 74 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 20 69  t? itemstable) i
35c0: 74 65 6d 73 74 61 62 6c 65 20 27 28 29 29 29 29  temstable '())))
35d0: 0a 09 09 09 09 09 09 20 27 68 61 76 65 2d 70 72  ....... 'have-pr
35e0: 6f 63 65 64 75 72 65 29 0a 09 09 09 09 09 09 28  ocedure).......(
35f0: 28 6f 72 20 28 6c 69 73 74 3f 20 69 74 65 6d 73  (or (list? items
3600: 29 28 6c 69 73 74 3f 20 69 74 65 6d 73 74 61 62  )(list? itemstab
3610: 6c 65 29 29 20 3b 3b 20 63 61 6c 63 20 6e 6f 77  le)) ;; calc now
3620: 0a 09 09 09 09 09 09 20 28 64 65 62 75 67 3a 70  ....... (debug:p
3630: 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 69 74 65  rint-info 4 "ite
3640: 6d 73 20 61 6e 64 20 69 74 65 6d 73 74 61 62 6c  ms and itemstabl
3650: 65 20 61 72 65 20 6c 69 73 74 73 2c 20 63 61 6c  e are lists, cal
3660: 63 20 6e 6f 77 5c 6e 22 0a 09 09 09 09 09 09 09  c now\n"........
3670: 20 20 20 20 20 20 22 20 20 20 20 69 74 65 6d 73        "    items
3680: 3a 20 22 20 69 74 65 6d 73 20 22 20 69 74 65 6d  : " items " item
3690: 73 74 61 62 6c 65 3a 20 22 20 69 74 65 6d 73 74  stable: " itemst
36a0: 61 62 6c 65 29 0a 09 09 09 09 09 09 20 28 69 74  able)....... (it
36b0: 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72  ems:get-items-fr
36c0: 6f 6d 2d 63 6f 6e 66 69 67 20 63 6f 6e 66 69 67  om-config config
36d0: 29 29 0a 09 09 09 09 09 09 28 65 6c 73 65 20 23  )).......(else #
36e0: 66 29 29 29 20 20 20 20 20 20 20 20 20 20 20 20  f)))            
36f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b                 ;
3700: 3b 20 6e 6f 74 20 69 74 65 72 61 74 65 64 0a 09  ; not iterated..
3710: 09 09 09 09 20 20 20 20 20 23 66 20 20 20 20 20  ....     #f     
3720: 20 3b 3b 20 69 74 65 6d 73 64 61 74 20 35 0a 09   ;; itemsdat 5..
3730: 09 09 09 09 20 20 20 20 20 23 66 20 20 20 20 20  ....     #f     
3740: 20 3b 3b 20 73 70 61 72 65 20 2d 20 75 73 65 64   ;; spare - used
3750: 20 66 6f 72 20 69 74 65 6d 2d 70 61 74 68 0a 09   for item-path..
3760: 09 09 09 09 20 20 20 20 20 29 29 29 0a 09 20 20  ....     )))..  
3770: 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 09 20 20    (for-each ..  
3780: 20 20 20 28 6c 61 6d 62 64 61 20 28 77 61 69 74     (lambda (wait
3790: 6f 6e 29 0a 09 20 20 20 20 20 20 20 28 69 66 20  on)..       (if 
37a0: 28 61 6e 64 20 77 61 69 74 6f 6e 20 28 6e 6f 74  (and waiton (not
37b0: 20 28 6d 65 6d 62 65 72 20 77 61 69 74 6f 6e 20   (member waiton 
37c0: 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a 09 09  test-names)))...
37d0: 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20     (begin...    
37e0: 20 28 73 65 74 21 20 72 65 71 75 69 72 65 64 2d   (set! required-
37f0: 74 65 73 74 73 20 28 63 6f 6e 73 20 77 61 69 74  tests (cons wait
3800: 6f 6e 20 72 65 71 75 69 72 65 64 2d 74 65 73 74  on required-test
3810: 73 29 29 0a 09 09 20 20 20 20 20 28 73 65 74 21  s))...     (set!
3820: 20 74 65 73 74 2d 6e 61 6d 65 73 20 28 63 6f 6e   test-names (con
3830: 73 20 77 61 69 74 6f 6e 20 74 65 73 74 2d 6e 61  s waiton test-na
3840: 6d 65 73 29 29 29 29 29 20 3b 3b 20 77 61 73 20  mes))))) ;; was 
3850: 61 6e 20 61 70 70 65 6e 64 2c 20 6e 6f 77 20 61  an append, now a
3860: 20 63 6f 6e 73 0a 09 20 20 20 20 20 77 61 69 74   cons..     wait
3870: 6f 6e 73 29 0a 09 20 20 20 20 28 6c 65 74 20 28  ons)..    (let (
3880: 28 72 65 6d 74 65 73 74 73 20 28 64 65 6c 65 74  (remtests (delet
3890: 65 2d 64 75 70 6c 69 63 61 74 65 73 20 28 61 70  e-duplicates (ap
38a0: 70 65 6e 64 20 77 61 69 74 6f 6e 73 20 74 61 6c  pend waitons tal
38b0: 29 29 29 29 0a 09 20 20 20 20 20 20 28 69 66 20  ))))..      (if 
38c0: 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 6d 74  (not (null? remt
38d0: 65 73 74 73 29 29 0a 09 09 20 20 28 6c 6f 6f 70  ests))...  (loop
38e0: 20 28 63 61 72 20 72 65 6d 74 65 73 74 73 29 28   (car remtests)(
38f0: 63 64 72 20 72 65 6d 74 65 73 74 73 29 29 29 29  cdr remtests))))
3900: 29 29 29 0a 0a 20 20 20 20 28 69 66 20 28 6e 6f  )))..    (if (no
3910: 74 20 28 6e 75 6c 6c 3f 20 72 65 71 75 69 72 65  t (null? require
3920: 64 2d 74 65 73 74 73 29 29 0a 09 28 64 65 62 75  d-tests))..(debu
3930: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22  g:print-info 1 "
3940: 41 64 64 69 6e 67 20 22 20 72 65 71 75 69 72 65  Adding " require
3950: 64 2d 74 65 73 74 73 20 22 20 74 6f 20 74 68 65  d-tests " to the
3960: 20 72 75 6e 20 71 75 65 75 65 22 29 29 0a 20 20   run queue")).  
3970: 20 20 3b 3b 20 4e 4f 54 45 3a 20 74 68 65 73 65    ;; NOTE: these
3980: 20 61 72 65 20 61 6c 6c 20 70 61 72 65 6e 74 20   are all parent 
3990: 74 65 73 74 73 2c 20 69 74 65 6d 73 20 61 72 65  tests, items are
39a0: 20 6e 6f 74 20 65 78 70 61 6e 64 65 64 20 79 65   not expanded ye
39b0: 74 2e 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72  t..    (debug:pr
39c0: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 74 65 73 74  int-info 4 "test
39d0: 2d 72 65 63 6f 72 64 73 3d 22 20 28 68 61 73 68  -records=" (hash
39e0: 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65  -table->alist te
39f0: 73 74 2d 72 65 63 6f 72 64 73 29 29 0a 20 20 20  st-records)).   
3a00: 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73   (runs:run-tests
3a10: 2d 71 75 65 75 65 20 72 75 6e 2d 69 64 20 72 75  -queue run-id ru
3a20: 6e 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72  nname test-recor
3a30: 64 73 20 6b 65 79 76 61 6c 6c 73 74 20 66 6c 61  ds keyvallst fla
3a40: 67 73 20 74 65 73 74 2d 70 61 74 74 73 29 0a 20  gs test-patts). 
3a50: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d     (debug:print-
3a60: 69 6e 66 6f 20 34 20 22 41 6c 6c 20 64 6f 6e 65  info 4 "All done
3a70: 20 62 79 20 68 65 72 65 22 29 29 29 0a 0a 28 64   by here")))..(d
3a80: 65 66 69 6e 65 20 28 72 75 6e 73 3a 63 61 6c 63  efine (runs:calc
3a90: 2d 66 61 69 6c 73 20 70 72 65 72 65 71 73 2d 6e  -fails prereqs-n
3aa0: 6f 74 2d 6d 65 74 29 0a 20 20 28 66 69 6c 74 65  ot-met).  (filte
3ab0: 72 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 29  r (lambda (test)
3ac0: 0a 09 20 20 20 20 28 61 6e 64 20 28 76 65 63 74  ..    (and (vect
3ad0: 6f 72 3f 20 74 65 73 74 29 20 3b 3b 20 6e 6f 74  or? test) ;; not
3ae0: 20 28 73 74 72 69 6e 67 3f 20 74 65 73 74 29 29   (string? test))
3af0: 0a 09 09 20 28 65 71 75 61 6c 3f 20 28 64 62 3a  ... (equal? (db:
3b00: 74 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74  test-get-state t
3b10: 65 73 74 29 20 22 43 4f 4d 50 4c 45 54 45 44 22  est) "COMPLETED"
3b20: 29 0a 09 09 20 28 6e 6f 74 20 28 6d 65 6d 62 65  )... (not (membe
3b30: 72 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73  r (db:test-get-s
3b40: 74 61 74 75 73 20 74 65 73 74 29 0a 09 09 09 20  tatus test).... 
3b50: 20 20 20 20 20 27 28 22 50 41 53 53 22 20 22 57       '("PASS" "W
3b60: 41 52 4e 22 20 22 43 48 45 43 4b 22 20 22 57 41  ARN" "CHECK" "WA
3b70: 49 56 45 44 22 20 22 53 4b 49 50 22 29 29 29 29  IVED" "SKIP"))))
3b80: 29 0a 09 20 20 70 72 65 72 65 71 73 2d 6e 6f 74  )..  prereqs-not
3b90: 2d 6d 65 74 29 29 0a 0a 28 64 65 66 69 6e 65 20  -met))..(define 
3ba0: 28 72 75 6e 73 3a 63 61 6c 63 2d 6e 6f 74 2d 63  (runs:calc-not-c
3bb0: 6f 6d 70 6c 65 74 65 64 20 70 72 65 72 65 71 73  ompleted prereqs
3bc0: 2d 6e 6f 74 2d 6d 65 74 29 0a 20 20 28 66 69 6c  -not-met).  (fil
3bd0: 74 65 72 0a 20 20 20 28 6c 61 6d 62 64 61 20 28  ter.   (lambda (
3be0: 74 29 0a 20 20 20 20 20 28 6f 72 20 28 6e 6f 74  t).     (or (not
3bf0: 20 28 76 65 63 74 6f 72 3f 20 74 29 29 0a 09 20   (vector? t)).. 
3c00: 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 22 43 4f  (not (equal? "CO
3c10: 4d 50 4c 45 54 45 44 22 20 28 64 62 3a 74 65 73  MPLETED" (db:tes
3c20: 74 2d 67 65 74 2d 73 74 61 74 65 20 74 29 29 29  t-get-state t)))
3c30: 29 29 0a 20 20 20 70 72 65 72 65 71 73 2d 6e 6f  )).   prereqs-no
3c40: 74 2d 6d 65 74 29 29 0a 0a 28 64 65 66 69 6e 65  t-met))..(define
3c50: 20 28 72 75 6e 73 3a 70 72 65 74 74 79 2d 73 74   (runs:pretty-st
3c60: 72 69 6e 67 20 6c 73 74 29 0a 20 20 28 6d 61 70  ring lst).  (map
3c70: 20 28 6c 61 6d 62 64 61 20 28 74 29 0a 09 20 28   (lambda (t).. (
3c80: 69 66 20 28 6e 6f 74 20 28 76 65 63 74 6f 72 3f  if (not (vector?
3c90: 20 74 29 29 0a 09 20 20 20 20 20 28 63 6f 6e 63   t))..     (conc
3ca0: 20 74 29 0a 09 20 20 20 20 20 28 63 6f 6e 63 20   t)..     (conc 
3cb0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73  (db:test-get-tes
3cc0: 74 6e 61 6d 65 20 74 29 20 22 3a 22 20 28 64 62  tname t) ":" (db
3cd0: 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20  :test-get-state 
3ce0: 74 29 20 22 2f 22 20 28 64 62 3a 74 65 73 74 2d  t) "/" (db:test-
3cf0: 67 65 74 2d 73 74 61 74 75 73 20 74 29 29 29 29  get-status t))))
3d00: 0a 20 20 20 20 20 20 20 6c 73 74 29 29 0a 0a 28  .       lst))..(
3d10: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 6d 61 6b  define (runs:mak
3d20: 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65  e-full-test-name
3d30: 20 74 65 73 74 6e 61 6d 65 20 69 74 65 6d 70 61   testname itempa
3d40: 74 68 29 0a 20 20 28 69 66 20 28 65 71 75 61 6c  th).  (if (equal
3d50: 3f 20 69 74 65 6d 70 61 74 68 20 22 22 29 20 74  ? itempath "") t
3d60: 65 73 74 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65  estname (conc te
3d70: 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 70  stname "/" itemp
3d80: 61 74 68 29 29 29 0a 0a 3b 3b 20 74 65 73 74 2d  ath)))..;; test-
3d90: 72 65 63 6f 72 64 73 20 69 73 20 61 20 68 61 73  records is a has
3da0: 68 20 74 61 62 6c 65 20 74 65 73 74 6e 61 6d 65  h table testname
3db0: 3a 69 74 65 6d 5f 70 61 74 68 20 3d 3e 20 76 65  :item_path => ve
3dc0: 63 74 6f 72 20 3c 20 74 65 73 74 6e 61 6d 65 20  ctor < testname 
3dd0: 74 65 73 74 63 6f 6e 66 69 67 20 77 61 69 74 6f  testconfig waito
3de0: 6e 73 20 70 72 69 6f 72 69 74 79 20 69 74 65 6d  ns priority item
3df0: 73 2d 69 6e 66 6f 20 2e 2e 2e 20 3e 0a 28 64 65  s-info ... >.(de
3e00: 66 69 6e 65 20 28 72 75 6e 73 3a 72 75 6e 2d 74  fine (runs:run-t
3e10: 65 73 74 73 2d 71 75 65 75 65 20 72 75 6e 2d 69  ests-queue run-i
3e20: 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d 72  d runname test-r
3e30: 65 63 6f 72 64 73 20 6b 65 79 76 61 6c 6c 73 74  ecords keyvallst
3e40: 20 66 6c 61 67 73 20 74 65 73 74 2d 70 61 74 74   flags test-patt
3e50: 73 29 0a 20 20 20 20 3b 3b 20 41 74 20 74 68 69  s).    ;; At thi
3e60: 73 20 70 6f 69 6e 74 20 74 68 65 20 6c 69 73 74  s point the list
3e70: 20 6f 66 20 70 61 72 65 6e 74 20 74 65 73 74 73   of parent tests
3e80: 20 69 73 20 65 78 70 61 6e 64 65 64 20 0a 20 20   is expanded .  
3e90: 20 20 3b 3b 20 4e 42 2f 2f 20 53 68 6f 75 6c 64    ;; NB// Should
3ea0: 20 65 78 70 61 6e 64 20 69 74 65 6d 73 20 68 65   expand items he
3eb0: 72 65 20 61 6e 64 20 74 68 65 6e 20 69 6e 73 65  re and then inse
3ec0: 72 74 20 69 6e 74 6f 20 74 68 65 20 72 75 6e 20  rt into the run 
3ed0: 71 75 65 75 65 2e 0a 20 20 28 64 65 62 75 67 3a  queue..  (debug:
3ee0: 70 72 69 6e 74 20 35 20 22 74 65 73 74 2d 72 65  print 5 "test-re
3ef0: 63 6f 72 64 73 3a 20 22 20 74 65 73 74 2d 72 65  cords: " test-re
3f00: 63 6f 72 64 73 20 22 2c 20 6b 65 79 76 61 6c 6c  cords ", keyvall
3f10: 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 20  st: " keyvallst 
3f20: 22 20 66 6c 61 67 73 3a 20 22 20 28 68 61 73 68  " flags: " (hash
3f30: 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 66 6c  -table->alist fl
3f40: 61 67 73 29 29 0a 20 20 28 6c 65 74 20 28 28 73  ags)).  (let ((s
3f50: 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73  orted-test-names
3f60: 20 28 74 65 73 74 73 3a 73 6f 72 74 2d 62 79 2d   (tests:sort-by-
3f70: 70 72 69 6f 72 69 74 79 2d 61 6e 64 2d 77 61 69  priority-and-wai
3f80: 74 6f 6e 20 74 65 73 74 2d 72 65 63 6f 72 64 73  ton test-records
3f90: 29 29 0a 09 28 74 65 73 74 2d 72 65 67 69 73 74  ))..(test-regist
3fa0: 65 72 79 20 20 20 20 28 6d 61 6b 65 2d 68 61 73  ery    (make-has
3fb0: 68 2d 74 61 62 6c 65 29 29 0a 09 28 6e 75 6d 2d  h-table))..(num-
3fc0: 72 65 74 72 69 65 73 20 20 20 20 20 20 20 20 30  retries        0
3fd0: 29 0a 09 28 6d 61 78 2d 72 65 74 72 69 65 73 20  )..(max-retries 
3fe0: 20 20 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f        (config-lo
3ff0: 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a  okup *configdat*
4000: 20 22 73 65 74 75 70 22 20 22 6d 61 78 72 65 74   "setup" "maxret
4010: 72 69 65 73 22 29 29 29 0a 20 20 20 20 28 73 65  ries"))).    (se
4020: 74 21 20 6d 61 78 2d 72 65 74 72 69 65 73 20 28  t! max-retries (
4030: 69 66 20 28 61 6e 64 20 6d 61 78 2d 72 65 74 72  if (and max-retr
4040: 69 65 73 20 28 73 74 72 69 6e 67 2d 3e 6e 75 6d  ies (string->num
4050: 62 65 72 20 6d 61 78 2d 72 65 74 72 69 65 73 29  ber max-retries)
4060: 29 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72  )(string->number
4070: 20 6d 61 78 2d 72 65 74 72 69 65 73 29 20 31 30   max-retries) 10
4080: 30 29 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74  0)).    (if (not
4090: 20 28 6e 75 6c 6c 3f 20 73 6f 72 74 65 64 2d 74   (null? sorted-t
40a0: 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 28 6c 65  est-names))..(le
40b0: 74 20 6c 6f 6f 70 20 28 28 68 65 64 20 20 20 20  t loop ((hed    
40c0: 20 20 20 20 20 28 63 61 72 20 73 6f 72 74 65 64       (car sorted
40d0: 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 09  -test-names))...
40e0: 20 20 20 28 74 61 6c 20 20 20 20 20 20 20 20 20     (tal         
40f0: 28 63 64 72 20 73 6f 72 74 65 64 2d 74 65 73 74  (cdr sorted-test
4100: 2d 6e 61 6d 65 73 29 29 0a 09 09 20 20 20 28 72  -names))...   (r
4110: 65 72 75 6e 73 20 20 20 20 20 20 27 28 29 29 29  eruns      '()))
4120: 0a 09 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75  ..  (if (not (nu
4130: 6c 6c 3f 20 72 65 72 75 6e 73 29 29 28 64 65 62  ll? reruns))(deb
4140: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20  ug:print-info 4 
4150: 22 72 65 72 75 6e 73 3d 22 20 72 65 72 75 6e 73  "reruns=" reruns
4160: 29 29 0a 09 20 20 3b 3b 20 28 70 72 69 6e 74 20  ))..  ;; (print 
4170: 22 54 6f 70 20 6f 66 20 6c 6f 6f 70 2c 20 68 65  "Top of loop, he
4180: 64 3d 22 20 68 65 64 20 22 2c 20 74 61 6c 3d 22  d=" hed ", tal="
4190: 20 74 61 6c 20 22 20 2c 72 65 72 75 6e 73 3d 22   tal " ,reruns="
41a0: 20 72 65 72 75 6e 73 29 0a 09 20 20 28 6c 65 74   reruns)..  (let
41b0: 2a 20 28 28 74 65 73 74 2d 72 65 63 6f 72 64 20  * ((test-record 
41c0: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 20  (hash-table-ref 
41d0: 74 65 73 74 2d 72 65 63 6f 72 64 73 20 68 65 64  test-records hed
41e0: 29 29 0a 09 09 20 28 74 65 73 74 2d 6e 61 6d 65  ))... (test-name
41f0: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75     (tests:testqu
4200: 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65  eue-get-testname
4210: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09   test-record))..
4220: 09 20 28 74 63 6f 6e 66 69 67 20 20 20 20 20 28  . (tconfig     (
4230: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
4240: 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 74  get-testconfig t
4250: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 20  est-record))... 
4260: 28 74 65 73 74 6d 6f 64 65 20 20 20 20 28 6c 65  (testmode    (le
4270: 74 20 28 28 6d 20 28 63 6f 6e 66 69 67 2d 6c 6f  t ((m (config-lo
4280: 6f 6b 75 70 20 74 63 6f 6e 66 69 67 20 22 72 65  okup tconfig "re
4290: 71 75 69 72 65 6d 65 6e 74 73 22 20 22 6d 6f 64  quirements" "mod
42a0: 65 22 29 29 29 0a 09 09 09 09 28 69 66 20 6d 20  e"))).....(if m 
42b0: 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c 20  (string->symbol 
42c0: 6d 29 20 27 6e 6f 72 6d 61 6c 29 29 29 0a 09 09  m) 'normal)))...
42d0: 20 28 77 61 69 74 6f 6e 73 20 20 20 20 20 28 74   (waitons     (t
42e0: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67  ests:testqueue-g
42f0: 65 74 2d 77 61 69 74 6f 6e 73 20 20 20 20 74 65  et-waitons    te
4300: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 28  st-record))... (
4310: 70 72 69 6f 72 69 74 79 20 20 20 20 28 74 65 73  priority    (tes
4320: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
4330: 2d 70 72 69 6f 72 69 74 79 20 20 20 74 65 73 74  -priority   test
4340: 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 28 69 74  -record))... (it
4350: 65 6d 64 61 74 20 20 20 20 20 28 74 65 73 74 73  emdat     (tests
4360: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 69  :testqueue-get-i
4370: 74 65 6d 64 61 74 20 20 20 20 74 65 73 74 2d 72  temdat    test-r
4380: 65 63 6f 72 64 29 29 20 3b 3b 20 69 74 65 6d 64  ecord)) ;; itemd
4390: 61 74 20 63 61 6e 20 62 65 20 61 20 73 74 72 69  at can be a stri
43a0: 6e 67 2c 20 6c 69 73 74 20 6f 72 20 23 66 0a 09  ng, list or #f..
43b0: 09 20 28 69 74 65 6d 73 20 20 20 20 20 20 20 28  . (items       (
43c0: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
43d0: 67 65 74 2d 69 74 65 6d 73 20 20 20 20 20 20 74  get-items      t
43e0: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 20  est-record))... 
43f0: 28 69 74 65 6d 2d 70 61 74 68 20 20 20 28 69 74  (item-path   (it
4400: 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 74  em-list->path it
4410: 65 6d 64 61 74 29 29 0a 09 09 20 28 6e 65 77 74  emdat))... (newt
4420: 61 6c 20 20 20 20 20 20 28 61 70 70 65 6e 64 20  al      (append 
4430: 74 61 6c 20 28 6c 69 73 74 20 68 65 64 29 29 29  tal (list hed)))
4440: 29 0a 09 20 20 20 20 0a 09 20 20 20 20 28 64 65  )..    ..    (de
4450: 62 75 67 3a 70 72 69 6e 74 20 36 0a 09 09 09 20  bug:print 6.... 
4460: 22 74 65 73 74 2d 6e 61 6d 65 3a 20 22 20 74 65  "test-name: " te
4470: 73 74 2d 6e 61 6d 65 0a 09 09 09 20 22 5c 6e 20  st-name.... "\n 
4480: 20 68 65 64 3a 20 20 20 20 20 20 20 20 20 22 20   hed:         " 
4490: 68 65 64 0a 09 09 09 20 22 5c 6e 20 20 69 74 65  hed.... "\n  ite
44a0: 6d 64 61 74 3a 20 20 20 20 20 22 20 69 74 65 6d  mdat:     " item
44b0: 64 61 74 0a 09 09 09 20 22 5c 6e 20 20 69 74 65  dat.... "\n  ite
44c0: 6d 73 3a 20 20 20 20 20 20 20 22 20 69 74 65 6d  ms:       " item
44d0: 73 0a 09 09 09 20 22 5c 6e 20 20 69 74 65 6d 2d  s.... "\n  item-
44e0: 70 61 74 68 3a 20 20 20 22 20 69 74 65 6d 2d 70  path:   " item-p
44f0: 61 74 68 0a 09 09 09 20 22 5c 6e 20 20 77 61 69  ath.... "\n  wai
4500: 74 6f 6e 73 3a 20 20 20 20 20 22 20 77 61 69 74  tons:     " wait
4510: 6f 6e 73 0a 09 09 09 20 22 5c 6e 20 20 6e 75 6d  ons.... "\n  num
4520: 2d 72 65 74 72 69 65 73 3a 20 22 20 6e 75 6d 2d  -retries: " num-
4530: 72 65 74 72 69 65 73 0a 09 09 09 20 22 5c 6e 20  retries.... "\n 
4540: 20 74 61 6c 3a 20 20 20 20 20 20 20 20 20 22 20   tal:         " 
4550: 74 61 6c 0a 09 09 09 20 22 5c 6e 20 20 72 65 72  tal.... "\n  rer
4560: 75 6e 73 3a 20 20 20 20 20 20 22 20 72 65 72 75  uns:      " reru
4570: 6e 73 29 0a 0a 09 20 20 20 20 3b 3b 20 63 68 65  ns)...    ;; che
4580: 63 6b 20 66 6f 72 20 68 65 64 20 69 6e 20 77 61  ck for hed in wa
4590: 69 74 6f 6e 73 20 3d 3e 20 74 68 69 73 20 77 6f  itons => this wo
45a0: 75 6c 64 20 62 65 20 63 69 72 63 75 6c 61 72 2c  uld be circular,
45b0: 20 72 65 6d 6f 76 65 20 69 74 20 61 6e 64 20 69   remove it and i
45c0: 73 73 75 65 20 61 6e 0a 09 20 20 20 20 3b 3b 20  ssue an..    ;; 
45d0: 65 72 72 6f 72 0a 09 20 20 20 20 28 69 66 20 28  error..    (if (
45e0: 6d 65 6d 62 65 72 20 74 65 73 74 2d 6e 61 6d 65  member test-name
45f0: 20 77 61 69 74 6f 6e 73 29 0a 09 09 28 62 65 67   waitons)...(beg
4600: 69 6e 0a 09 09 20 20 28 64 65 62 75 67 3a 70 72  in...  (debug:pr
4610: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 74 65  int 0 "ERROR: te
4620: 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22  st " test-name "
4630: 20 68 61 73 20 6c 69 73 74 65 64 20 69 74 73 65   has listed itse
4640: 6c 66 20 61 73 20 61 20 77 61 69 74 6f 6e 2c 20  lf as a waiton, 
4650: 70 6c 65 61 73 65 20 63 6f 72 72 65 63 74 20 74  please correct t
4660: 68 69 73 21 22 29 0a 09 09 20 20 28 73 65 74 21  his!")...  (set!
4670: 20 77 61 69 74 6f 6e 20 28 66 69 6c 74 65 72 20   waiton (filter 
4680: 28 6c 61 6d 62 64 61 20 28 78 29 28 6e 6f 74 20  (lambda (x)(not 
4690: 28 65 71 75 61 6c 3f 20 78 20 68 65 64 29 29 29  (equal? x hed)))
46a0: 20 77 61 69 74 6f 6e 73 29 29 29 29 0a 0a 09 20   waitons))))... 
46b0: 20 20 20 28 63 6f 6e 64 20 3b 3b 20 4f 55 54 45     (cond ;; OUTE
46c0: 52 20 43 4f 4e 44 0a 09 20 20 20 20 20 28 28 6e  R COND..     ((n
46d0: 6f 74 20 69 74 65 6d 73 29 20 3b 3b 20 77 68 65  ot items) ;; whe
46e0: 6e 20 66 61 6c 73 65 20 74 68 65 20 74 65 73 74  n false the test
46f0: 20 69 73 20 6f 6b 20 74 6f 20 62 65 20 68 61 6e   is ok to be han
4700: 64 65 64 20 6f 66 66 20 74 6f 20 6c 61 75 6e 63  ded off to launc
4710: 68 20 28 62 75 74 20 6e 6f 74 20 62 65 66 6f 72  h (but not befor
4720: 65 29 0a 09 20 20 20 20 20 20 28 6c 65 74 2a 20  e)..      (let* 
4730: 28 28 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66  ((run-limits-inf
4740: 6f 20 20 20 20 20 20 20 20 20 28 6f 70 65 6e 2d  o         (open-
4750: 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 3a 63  run-close runs:c
4760: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74  an-run-more-test
4770: 73 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 20  s test-record)) 
4780: 3b 3b 20 6c 6f 6f 6b 20 61 74 20 74 68 65 20 74  ;; look at the t
4790: 65 73 74 20 6a 6f 62 67 72 6f 75 70 20 61 6e 64  est jobgroup and
47a0: 20 74 6f 74 20 6a 6f 62 73 20 72 75 6e 6e 69 6e   tot jobs runnin
47b0: 67 0a 09 09 20 20 20 20 20 28 68 61 76 65 2d 72  g...     (have-r
47c0: 65 73 6f 75 72 63 65 73 20 20 20 20 20 20 20 20  esources        
47d0: 20 20 28 63 61 72 20 72 75 6e 2d 6c 69 6d 69 74    (car run-limit
47e0: 73 2d 69 6e 66 6f 29 29 0a 09 09 20 20 20 20 20  s-info))...     
47f0: 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 20 20 20  (num-running    
4800: 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 2d 72           (list-r
4810: 65 66 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e  ef run-limits-in
4820: 66 6f 20 31 29 29 0a 09 09 20 20 20 20 20 28 6e  fo 1))...     (n
4830: 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f  um-running-in-jo
4840: 62 67 72 6f 75 70 20 28 6c 69 73 74 2d 72 65 66  bgroup (list-ref
4850: 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f   run-limits-info
4860: 20 32 29 29 0a 09 09 20 20 20 20 20 28 6d 61 78   2))...     (max
4870: 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73  -concurrent-jobs
4880: 20 20 20 20 20 28 6c 69 73 74 2d 72 65 66 20 72       (list-ref r
4890: 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 33  un-limits-info 3
48a0: 29 29 0a 09 09 20 20 20 20 20 28 6a 6f 62 2d 67  ))...     (job-g
48b0: 72 6f 75 70 2d 6c 69 6d 69 74 20 20 20 20 20 20  roup-limit      
48c0: 20 20 20 28 6c 69 73 74 2d 72 65 66 20 72 75 6e     (list-ref run
48d0: 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 34 29 29  -limits-info 4))
48e0: 0a 09 09 20 20 20 20 20 28 70 72 65 72 65 71 73  ...     (prereqs
48f0: 2d 6e 6f 74 2d 6d 65 74 20 20 20 20 20 20 20 20  -not-met        
4900: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
4910: 20 64 62 3a 67 65 74 2d 70 72 65 72 65 71 73 2d   db:get-prereqs-
4920: 6e 6f 74 2d 6d 65 74 20 23 66 20 72 75 6e 2d 69  not-met #f run-i
4930: 64 20 77 61 69 74 6f 6e 73 20 69 74 65 6d 2d 70  d waitons item-p
4940: 61 74 68 20 6d 6f 64 65 3a 20 74 65 73 74 6d 6f  ath mode: testmo
4950: 64 65 29 29 0a 09 09 20 20 20 20 20 28 66 61 69  de))...     (fai
4960: 6c 73 20 20 20 20 20 20 20 20 20 20 20 20 20 20  ls              
4970: 20 20 20 20 20 28 72 75 6e 73 3a 63 61 6c 63 2d       (runs:calc-
4980: 66 61 69 6c 73 20 70 72 65 72 65 71 73 2d 6e 6f  fails prereqs-no
4990: 74 2d 6d 65 74 29 29 0a 09 09 20 20 20 20 20 28  t-met))...     (
49a0: 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 20 20 20  non-completed   
49b0: 20 20 20 20 20 20 20 20 28 72 75 6e 73 3a 63 61          (runs:ca
49c0: 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 74 65 64  lc-not-completed
49d0: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74   prereqs-not-met
49e0: 29 29 29 0a 09 09 28 64 65 62 75 67 3a 70 72 69  )))...(debug:pri
49f0: 6e 74 2d 69 6e 66 6f 20 38 20 22 68 61 76 65 2d  nt-info 8 "have-
4a00: 72 65 73 6f 75 72 63 65 73 3a 20 22 20 68 61 76  resources: " hav
4a10: 65 2d 72 65 73 6f 75 72 63 65 73 20 22 20 70 72  e-resources " pr
4a20: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 3a 20 22  ereqs-not-met: "
4a30: 20 0a 09 09 09 20 20 20 20 20 28 73 74 72 69 6e   ....     (strin
4a40: 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09  g-intersperse ..
4a50: 09 09 20 20 20 20 20 20 28 6d 61 70 20 28 6c 61  ..      (map (la
4a60: 6d 62 64 61 20 28 74 29 0a 09 09 09 09 20 20 20  mbda (t).....   
4a70: 20 20 28 69 66 20 28 76 65 63 74 6f 72 3f 20 74    (if (vector? t
4a80: 29 0a 09 09 09 09 09 20 28 63 6f 6e 63 20 28 64  )...... (conc (d
4a90: 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 65  b:test-get-state
4aa0: 20 74 29 20 22 2f 22 20 28 64 62 3a 74 65 73 74   t) "/" (db:test
4ab0: 2d 67 65 74 2d 73 74 61 74 75 73 20 74 29 29 0a  -get-status t)).
4ac0: 09 09 09 09 09 20 28 63 6f 6e 63 20 22 20 57 41  ..... (conc " WA
4ad0: 52 4e 49 4e 47 3a 20 74 20 69 73 20 6e 6f 74 20  RNING: t is not 
4ae0: 61 20 76 65 63 74 6f 72 3d 22 20 74 20 29 29 29  a vector=" t )))
4af0: 0a 09 09 09 09 20 20 20 70 72 65 72 65 71 73 2d  .....   prereqs-
4b00: 6e 6f 74 2d 6d 65 74 29 20 22 2c 20 22 29 20 22  not-met) ", ") "
4b10: 20 66 61 69 6c 73 3a 20 22 20 66 61 69 6c 73 29   fails: " fails)
4b20: 0a 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 2d  ...(debug:print-
4b30: 69 6e 66 6f 20 34 20 22 68 65 64 3d 22 20 68 65  info 4 "hed=" he
4b40: 64 20 22 5c 6e 20 20 74 65 73 74 2d 72 65 63 6f  d "\n  test-reco
4b50: 72 64 3d 22 20 74 65 73 74 2d 72 65 63 6f 72 64  rd=" test-record
4b60: 20 22 5c 6e 20 20 74 65 73 74 2d 6e 61 6d 65 3a   "\n  test-name:
4b70: 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 5c 6e   " test-name "\n
4b80: 20 20 69 74 65 6d 2d 70 61 74 68 3a 20 22 20 69    item-path: " i
4b90: 74 65 6d 2d 70 61 74 68 20 22 5c 6e 20 20 74 65  tem-path "\n  te
4ba0: 73 74 2d 70 61 74 74 73 3a 20 22 20 74 65 73 74  st-patts: " test
4bb0: 2d 70 61 74 74 73 29 0a 0a 09 09 3b 3b 20 44 6f  -patts)....;; Do
4bc0: 6e 27 74 20 6b 6e 6f 77 20 61 74 20 74 68 69 73  n't know at this
4bd0: 20 74 69 6d 65 20 69 66 20 74 68 65 20 74 65 73   time if the tes
4be0: 74 20 68 61 76 65 20 62 65 65 6e 20 6c 61 75 6e  t have been laun
4bf0: 63 68 65 64 20 61 74 20 73 6f 6d 65 20 74 69 6d  ched at some tim
4c00: 65 20 69 6e 20 74 68 65 20 70 61 73 74 0a 09 09  e in the past...
4c10: 3b 3b 20 69 2e 65 2e 20 69 73 20 74 68 69 73 20  ;; i.e. is this 
4c20: 61 20 72 65 2d 6c 61 75 6e 63 68 3f 0a 09 09 28  a re-launch?...(
4c30: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
4c40: 20 34 20 22 72 75 6e 2d 6c 69 6d 69 74 73 2d 69   4 "run-limits-i
4c50: 6e 66 6f 20 3d 20 22 20 72 75 6e 2d 6c 69 6d 69  nfo = " run-limi
4c60: 74 73 2d 69 6e 66 6f 29 0a 09 09 28 63 6f 6e 64  ts-info)...(cond
4c70: 20 3b 3b 20 49 4e 4e 45 52 20 43 4f 4e 44 20 23   ;; INNER COND #
4c80: 31 20 66 6f 72 20 61 20 6c 61 75 6e 63 68 61 62  1 for a launchab
4c90: 6c 65 20 74 65 73 74 0a 09 09 20 3b 3b 20 43 68  le test... ;; Ch
4ca0: 65 63 6b 20 69 74 65 6d 20 70 61 74 68 20 61 67  eck item path ag
4cb0: 61 69 6e 73 74 20 69 74 65 6d 2d 70 61 74 74 73  ainst item-patts
4cc0: 0a 09 09 20 28 28 6e 6f 74 20 28 74 65 73 74 73  ... ((not (tests
4cd0: 3a 6d 61 74 63 68 20 74 65 73 74 2d 70 61 74 74  :match test-patt
4ce0: 73 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65  s (tests:testque
4cf0: 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20  ue-get-testname 
4d00: 74 65 73 74 2d 72 65 63 6f 72 64 29 20 69 74 65  test-record) ite
4d10: 6d 2d 70 61 74 68 29 29 20 3b 3b 20 54 68 69 73  m-path)) ;; This
4d20: 20 74 65 73 74 2f 69 74 65 6d 70 61 74 68 20 69   test/itempath i
4d30: 73 20 6e 6f 74 20 74 6f 20 62 65 20 72 75 6e 0a  s not to be run.
4d40: 09 09 20 20 3b 3b 20 65 6c 73 65 20 74 68 65 20  ..  ;; else the 
4d50: 72 75 6e 20 69 73 20 73 74 75 63 6b 2c 20 74 65  run is stuck, te
4d60: 6d 70 6f 72 61 72 69 6c 79 20 6f 72 20 70 65 72  mporarily or per
4d70: 6d 61 6e 65 6e 74 6c 79 0a 09 09 20 20 3b 3b 20  manently...  ;; 
4d80: 62 75 74 20 73 68 6f 75 6c 64 20 63 68 65 63 6b  but should check
4d90: 20 69 66 20 69 74 20 69 73 20 64 75 65 20 74 6f   if it is due to
4da0: 20 6c 61 63 6b 20 6f 66 20 72 65 73 6f 75 72 63   lack of resourc
4db0: 65 73 20 76 73 2e 20 70 72 65 72 65 71 75 69 73  es vs. prerequis
4dc0: 69 74 65 73 0a 09 09 20 20 28 64 65 62 75 67 3a  ites...  (debug:
4dd0: 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 53 6b  print-info 1 "Sk
4de0: 69 70 70 69 6e 67 20 22 20 28 74 65 73 74 73 3a  ipping " (tests:
4df0: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65  testqueue-get-te
4e00: 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f  stname test-reco
4e10: 72 64 29 20 22 20 22 20 69 74 65 6d 2d 70 61 74  rd) " " item-pat
4e20: 68 20 22 20 61 73 20 69 74 20 64 6f 65 73 6e 27  h " as it doesn'
4e30: 74 20 6d 61 74 63 68 20 22 20 74 65 73 74 2d 70  t match " test-p
4e40: 61 74 74 73 29 0a 09 09 20 20 3b 3b 20 28 74 68  atts)...  ;; (th
4e50: 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f  read-sleep! *glo
4e60: 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 20 20  bal-delta*)...  
4e70: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20  (if (not (null? 
4e80: 74 61 6c 29 29 0a 09 09 20 20 20 20 20 20 28 6c  tal))...      (l
4e90: 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63 64  oop (car tal)(cd
4ea0: 72 20 74 61 6c 29 20 72 65 72 75 6e 73 29 29 29  r tal) reruns)))
4eb0: 0a 09 09 20 28 20 3b 3b 20 28 61 6e 64 0a 09 09  ... ( ;; (and...
4ec0: 20 20 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 62    (not (hash-tab
4ed0: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 74  le-ref/default t
4ee0: 65 73 74 2d 72 65 67 69 73 74 65 72 79 20 28 72  est-registery (r
4ef0: 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65  uns:make-full-te
4f00: 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 6e 61 6d  st-name test-nam
4f10: 65 20 69 74 65 6d 2d 70 61 74 68 29 20 23 66 29  e item-path) #f)
4f20: 29 0a 09 09 20 20 20 20 20 20 3b 3b 20 28 61 6e  )...      ;; (an
4f30: 64 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74  d max-concurrent
4f40: 2d 6a 6f 62 73 20 28 3e 20 28 2d 20 6d 61 78 2d  -jobs (> (- max-
4f50: 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20  concurrent-jobs 
4f60: 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 20 35 29 29  num-running) 5))
4f70: 29 0a 09 09 20 20 28 64 65 62 75 67 3a 70 72 69  )...  (debug:pri
4f80: 6e 74 2d 69 6e 66 6f 20 34 20 22 50 72 65 2d 72  nt-info 4 "Pre-r
4f90: 65 67 69 73 74 65 72 69 6e 67 20 74 65 73 74 20  egistering test 
4fa0: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20  " test-name "/" 
4fb0: 69 74 65 6d 2d 70 61 74 68 20 22 20 74 6f 20 63  item-path " to c
4fc0: 72 65 61 74 65 20 70 6c 61 63 65 68 6f 6c 64 65  reate placeholde
4fd0: 72 22 20 29 0a 09 09 20 20 28 6f 70 65 6e 2d 72  r" )...  (open-r
4fe0: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 74 65 73 74  un-close db:test
4ff0: 73 2d 72 65 67 69 73 74 65 72 2d 74 65 73 74 20  s-register-test 
5000: 23 66 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e  #f run-id test-n
5010: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 09  ame item-path)..
5020: 09 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73  .  (hash-table-s
5030: 65 74 21 20 74 65 73 74 2d 72 65 67 69 73 74 65  et! test-registe
5040: 72 79 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75  ry (runs:make-fu
5050: 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 73  ll-test-name tes
5060: 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68  t-name item-path
5070: 29 20 23 74 29 0a 09 09 20 20 3b 3b 20 28 74 68  ) #t)...  ;; (th
5080: 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f  read-sleep! *glo
5090: 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 28 72 75 6e  bal-delta*).(run
50a0: 73 3a 73 68 72 69 6e 6b 2d 63 61 6e 2d 72 75 6e  s:shrink-can-run
50b0: 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c 61  -more-tests-dela
50c0: 79 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61  y)...  (loop (ca
50d0: 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65  r newtal)(cdr ne
50e0: 77 74 61 6c 29 20 72 65 72 75 6e 73 29 29 0a 09  wtal) reruns))..
50f0: 09 20 28 28 6e 6f 74 20 68 61 76 65 2d 72 65 73  . ((not have-res
5100: 6f 75 72 63 65 73 29 20 3b 3b 20 73 69 6d 70 6c  ources) ;; simpl
5110: 79 20 74 72 79 20 61 67 61 69 6e 20 61 66 74 65  y try again afte
5120: 72 20 77 61 69 74 69 6e 67 20 61 20 73 65 63 6f  r waiting a seco
5130: 6e 64 0a 09 09 20 20 28 64 65 62 75 67 3a 70 72  nd...  (debug:pr
5140: 69 6e 74 2d 69 6e 66 6f 20 31 20 22 6e 6f 20 72  int-info 1 "no r
5150: 65 73 6f 75 72 63 65 73 20 74 6f 20 72 75 6e 20  esources to run 
5160: 6e 65 77 20 74 65 73 74 73 2c 20 77 61 69 74 69  new tests, waiti
5170: 6e 67 20 2e 2e 2e 22 29 0a 09 09 20 20 3b 3b 20  ng ...")...  ;; 
5180: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28  (thread-sleep! (
5190: 2b 20 32 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74  + 2 *global-delt
51a0: 61 2a 29 29 0a 09 09 20 20 3b 3b 20 63 6f 75 6c  a*))...  ;; coul
51b0: 64 20 68 61 76 65 20 64 6f 6e 65 20 68 65 64 20  d have done hed 
51c0: 74 61 6c 20 68 65 72 65 20 62 75 74 20 64 6f 69  tal here but doi
51d0: 6e 67 20 63 61 72 2f 63 64 72 20 6f 66 20 6e 65  ng car/cdr of ne
51e0: 77 74 61 6c 20 74 6f 20 72 6f 74 61 74 65 20 74  wtal to rotate t
51f0: 65 73 74 73 0a 09 09 20 20 28 6c 6f 6f 70 20 28  ests...  (loop (
5200: 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20  car newtal)(cdr 
5210: 6e 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29 29  newtal) reruns))
5220: 0a 09 09 20 28 28 61 6e 64 20 68 61 76 65 2d 72  ... ((and have-r
5230: 65 73 6f 75 72 63 65 73 0a 09 09 20 20 20 20 20  esources...     
5240: 20 20 28 6f 72 20 28 6e 75 6c 6c 3f 20 70 72 65    (or (null? pre
5250: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09  reqs-not-met)...
5260: 09 20 20 20 28 61 6e 64 20 28 65 71 3f 20 74 65  .   (and (eq? te
5270: 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c  stmode 'toplevel
5280: 29 0a 09 09 09 09 28 6e 75 6c 6c 3f 20 6e 6f 6e  ).....(null? non
5290: 2d 63 6f 6d 70 6c 65 74 65 64 29 29 29 29 0a 09  -completed))))..
52a0: 09 20 20 28 72 75 6e 3a 74 65 73 74 20 72 75 6e  .  (run:test run
52b0: 2d 69 64 20 72 75 6e 6e 61 6d 65 20 6b 65 79 76  -id runname keyv
52c0: 61 6c 6c 73 74 20 74 65 73 74 2d 72 65 63 6f 72  allst test-recor
52d0: 64 20 66 6c 61 67 73 20 23 66 29 0a 28 72 75 6e  d flags #f).(run
52e0: 73 3a 73 68 72 69 6e 6b 2d 63 61 6e 2d 72 75 6e  s:shrink-can-run
52f0: 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c 61  -more-tests-dela
5300: 79 29 0a 09 09 20 20 3b 3b 20 28 74 68 72 65 61  y)...  ;; (threa
5310: 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c  d-sleep! *global
5320: 2d 64 65 6c 74 61 2a 29 0a 09 09 20 20 28 69 66  -delta*)...  (if
5330: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c   (not (null? tal
5340: 29 29 0a 09 09 20 20 20 20 20 20 28 6c 6f 6f 70  ))...      (loop
5350: 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74   (car tal)(cdr t
5360: 61 6c 29 20 72 65 72 75 6e 73 29 29 29 0a 09 09  al) reruns)))...
5370: 20 28 65 6c 73 65 20 3b 3b 20 6d 75 73 74 20 62   (else ;; must b
5380: 65 20 77 65 20 68 61 76 65 20 75 6e 6d 65 74 20  e we have unmet 
5390: 70 72 65 72 65 71 75 69 73 69 74 65 73 0a 09 09  prerequisites...
53a0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
53b0: 20 34 20 22 46 41 49 4c 53 3a 20 22 20 66 61 69   4 "FAILS: " fai
53c0: 6c 73 29 0a 09 09 20 20 20 20 3b 3b 20 49 66 20  ls)...    ;; If 
53d0: 6f 6e 65 20 6f 72 20 6d 6f 72 65 20 6f 66 20 74  one or more of t
53e0: 68 65 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d  he prereqs-not-m
53f0: 65 74 20 61 72 65 20 46 41 49 4c 20 74 68 65 6e  et are FAIL then
5400: 20 77 65 20 63 61 6e 20 69 73 73 75 65 0a 09 09   we can issue...
5410: 20 20 20 20 3b 3b 20 61 20 6d 65 73 73 61 67 65      ;; a message
5420: 20 61 6e 64 20 64 72 6f 70 20 68 65 64 20 66 72   and drop hed fr
5430: 6f 6d 20 74 68 65 20 69 74 65 6d 73 20 74 6f 20  om the items to 
5440: 62 65 20 70 72 6f 63 65 73 73 65 64 2e 0a 09 09  be processed....
5450: 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 66      (if (null? f
5460: 61 69 6c 73 29 0a 09 09 09 28 62 65 67 69 6e 0a  ails)....(begin.
5470: 09 09 09 20 20 3b 3b 20 63 6f 75 6c 64 6e 27 74  ...  ;; couldn't
5480: 20 72 75 6e 2c 20 74 61 6b 65 20 61 20 62 72 65   run, take a bre
5490: 61 74 68 65 72 0a 09 09 09 20 20 28 64 65 62 75  ather....  (debu
54a0: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22  g:print-info 4 "
54b0: 53 68 6f 75 6c 64 6e 27 74 20 72 65 61 6c 6c 79  Shouldn't really
54c0: 20 67 65 74 20 68 65 72 65 2c 20 72 61 63 65 20   get here, race 
54d0: 63 6f 6e 64 69 74 69 6f 6e 3f 20 55 6e 61 62 6c  condition? Unabl
54e0: 65 20 74 6f 20 6c 61 75 6e 63 68 20 6d 6f 72 65  e to launch more
54f0: 20 74 65 73 74 73 20 61 74 20 74 68 69 73 20 6d   tests at this m
5500: 6f 6d 65 6e 74 2c 20 6b 69 6c 6c 69 6e 67 20 74  oment, killing t
5510: 69 6d 65 20 2e 2e 2e 22 29 0a 09 09 09 20 20 3b  ime ...")....  ;
5520: 3b 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21  ; (thread-sleep!
5530: 20 28 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c   (+ 0.01 *global
5540: 2d 64 65 6c 74 61 2a 29 29 20 3b 3b 20 6c 6f 6e  -delta*)) ;; lon
5550: 67 20 73 6c 65 65 70 20 68 65 72 65 20 2d 20 6e  g sleep here - n
5560: 6f 20 72 65 73 6f 75 72 63 65 73 2c 20 6d 61 79  o resources, may
5570: 20 61 73 20 77 65 6c 6c 20 62 65 20 70 61 74 69   as well be pati
5580: 65 6e 74 0a 09 09 09 20 20 3b 3b 20 77 65 20 6d  ent....  ;; we m
5590: 61 64 65 20 6e 65 77 20 74 61 6c 20 62 79 20 73  ade new tal by s
55a0: 74 69 63 6b 69 6e 67 20 68 65 64 20 61 74 20 74  ticking hed at t
55b0: 68 65 20 62 61 63 6b 20 6f 66 20 74 68 65 20 6c  he back of the l
55c0: 69 73 74 0a 09 09 09 20 20 28 6c 6f 6f 70 20 28  ist....  (loop (
55d0: 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20  car newtal)(cdr 
55e0: 6e 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29 29  newtal) reruns))
55f0: 0a 09 09 09 3b 3b 20 74 68 65 20 77 61 69 74 6f  ....;; the waito
5600: 6e 20 69 73 20 46 41 49 4c 20 73 6f 20 6e 6f 20  n is FAIL so no 
5610: 70 6f 69 6e 74 20 69 6e 20 74 72 79 69 6e 67 20  point in trying 
5620: 74 6f 20 72 75 6e 20 68 65 64 20 65 76 65 72 20  to run hed ever 
5630: 61 67 61 69 6e 0a 09 09 09 28 69 66 20 28 6e 6f  again....(if (no
5640: 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09  t (null? tal))..
5650: 09 09 20 20 20 20 28 69 66 20 28 76 65 63 74 6f  ..    (if (vecto
5660: 72 3f 20 68 65 64 29 0a 09 09 09 09 28 62 65 67  r? hed).....(beg
5670: 69 6e 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  in (debug:print 
5680: 31 20 22 57 41 52 4e 3a 20 44 72 6f 70 70 69 6e  1 "WARN: Droppin
5690: 67 20 74 65 73 74 20 22 20 28 64 62 3a 74 65 73  g test " (db:tes
56a0: 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 68  t-get-testname h
56b0: 65 64 29 20 22 2f 22 20 28 64 62 3a 74 65 73 74  ed) "/" (db:test
56c0: 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 68  -get-item-path h
56d0: 65 64 29 0a 09 09 09 09 09 09 20 20 20 20 22 20  ed).......    " 
56e0: 66 72 6f 6d 20 74 68 65 20 6c 61 75 6e 63 68 20  from the launch 
56f0: 6c 69 73 74 20 61 73 20 69 74 20 68 61 73 20 70  list as it has p
5700: 72 65 72 65 71 75 69 73 74 65 73 20 74 68 61 74  rerequistes that
5710: 20 61 72 65 20 46 41 49 4c 22 29 0a 28 72 75 6e   are FAIL").(run
5720: 73 3a 73 68 72 69 6e 6b 2d 63 61 6e 2d 72 75 6e  s:shrink-can-run
5730: 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c 61  -more-tests-dela
5740: 79 29 0a 09 09 09 09 20 20 20 20 20 20 20 3b 3b  y).....       ;;
5750: 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20   (thread-sleep! 
5760: 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a  *global-delta*).
5770: 09 09 09 09 20 20 20 20 20 20 20 28 6c 6f 6f 70  ....       (loop
5780: 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74   (car tal)(cdr t
5790: 61 6c 29 20 28 63 6f 6e 73 20 68 65 64 20 72 65  al) (cons hed re
57a0: 72 75 6e 73 29 29 29 0a 09 09 09 09 28 62 65 67  runs))).....(beg
57b0: 69 6e 0a 09 09 09 09 20 20 28 64 65 62 75 67 3a  in.....  (debug:
57c0: 70 72 69 6e 74 20 31 20 22 57 41 52 4e 3a 20 54  print 1 "WARN: T
57d0: 65 73 74 20 6e 6f 74 20 70 72 6f 63 65 73 73 65  est not processe
57e0: 64 20 63 6f 72 72 65 63 74 6c 79 2e 20 43 6f 75  d correctly. Cou
57f0: 6c 64 20 62 65 20 61 20 72 61 63 65 20 63 6f 6e  ld be a race con
5800: 64 69 74 69 6f 6e 20 69 6e 20 79 6f 75 72 20 74  dition in your t
5810: 65 73 74 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69  est implementati
5820: 6f 6e 3f 20 22 20 68 65 64 29 20 3b 3b 20 20 22  on? " hed) ;;  "
5830: 20 61 73 20 69 74 20 68 61 73 20 70 72 65 72 65   as it has prere
5840: 71 75 69 73 74 65 73 20 74 68 61 74 20 61 72 65  quistes that are
5850: 20 46 41 49 4c 2e 20 28 4e 4f 54 45 3a 20 68 65   FAIL. (NOTE: he
5860: 64 20 69 73 20 6e 6f 74 20 61 20 76 65 63 74 6f  d is not a vecto
5870: 72 29 22 29 0a 28 72 75 6e 73 3a 73 68 72 69 6e  r)").(runs:shrin
5880: 6b 2d 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74  k-can-run-more-t
5890: 65 73 74 73 2d 64 65 6c 61 79 29 0a 09 09 09 09  ests-delay).....
58a0: 20 20 3b 3b 20 28 74 68 72 65 61 64 2d 73 6c 65    ;; (thread-sle
58b0: 65 70 21 20 28 2b 20 30 2e 30 31 20 2a 67 6c 6f  ep! (+ 0.01 *glo
58c0: 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09 09  bal-delta*))....
58d0: 09 20 20 28 6c 6f 6f 70 20 68 65 64 20 74 61 6c  .  (loop hed tal
58e0: 20 72 65 72 75 6e 73 29 29 29 29 29 29 29 29 29   reruns)))))))))
58f0: 20 3b 3b 20 45 4e 44 20 4f 46 20 49 4e 4e 45 52   ;; END OF INNER
5900: 20 43 4f 4e 44 0a 09 20 20 20 20 20 0a 09 20 20   COND..     ..  
5910: 20 20 20 3b 3b 20 63 61 73 65 20 77 68 65 72 65     ;; case where
5920: 20 61 6e 20 69 74 65 6d 73 20 63 61 6d 65 20 69   an items came i
5930: 6e 20 61 73 20 61 20 6c 69 73 74 20 62 65 65 6e  n as a list been
5940: 20 70 72 6f 63 65 73 73 65 64 0a 09 20 20 20 20   processed..    
5950: 20 28 28 61 6e 64 20 28 6c 69 73 74 3f 20 69 74   ((and (list? it
5960: 65 6d 73 29 20 20 20 20 20 3b 3b 20 74 68 75 73  ems)     ;; thus
5970: 20 77 65 20 6b 6e 6f 77 20 6f 75 72 20 69 74 65   we know our ite
5980: 6d 73 20 61 72 65 20 61 6c 72 65 61 64 79 20 63  ms are already c
5990: 61 6c 63 75 6c 61 74 65 64 0a 09 09 20 20 20 28  alculated...   (
59a0: 6e 6f 74 20 20 20 69 74 65 6d 64 61 74 29 29 20  not   itemdat)) 
59b0: 3b 3b 20 61 6e 64 20 6e 6f 74 20 79 65 74 20 65  ;; and not yet e
59c0: 78 70 61 6e 64 65 64 20 69 6e 74 6f 20 74 68 65  xpanded into the
59d0: 20 6c 69 73 74 20 6f 66 20 74 68 69 6e 67 73 20   list of things 
59e0: 74 6f 20 62 65 20 64 6f 6e 65 0a 09 20 20 20 20  to be done..    
59f0: 20 20 28 69 66 20 28 61 6e 64 20 28 64 65 62 75    (if (and (debu
5a00: 67 3a 64 65 62 75 67 2d 6d 6f 64 65 20 31 29 20  g:debug-mode 1) 
5a10: 3b 3b 20 28 3e 3d 20 2a 76 65 72 62 6f 73 69 74  ;; (>= *verbosit
5a20: 79 2a 20 31 29 0a 09 09 20 20 20 20 20 20 20 28  y* 1)...       (
5a30: 3e 20 28 6c 65 6e 67 74 68 20 69 74 65 6d 73 29  > (length items)
5a40: 20 30 29 0a 09 09 20 20 20 20 20 20 20 28 3e 20   0)...       (> 
5a50: 28 6c 65 6e 67 74 68 20 28 63 61 72 20 69 74 65  (length (car ite
5a60: 6d 73 29 29 20 30 29 29 0a 09 09 20 20 28 70 70  ms)) 0))...  (pp
5a70: 20 69 74 65 6d 73 29 29 0a 09 20 20 20 20 20 20   items))..      
5a80: 28 66 6f 72 2d 65 61 63 68 0a 09 20 20 20 20 20  (for-each..     
5a90: 20 20 28 6c 61 6d 62 64 61 20 28 6d 79 2d 69 74    (lambda (my-it
5aa0: 65 6d 64 61 74 29 0a 09 09 20 28 6c 65 74 2a 20  emdat)... (let* 
5ab0: 28 28 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72  ((new-test-recor
5ac0: 64 20 28 6c 65 74 20 28 28 6e 65 77 72 65 63 20  d (let ((newrec 
5ad0: 28 6d 61 6b 65 2d 74 65 73 74 73 3a 74 65 73 74  (make-tests:test
5ae0: 71 75 65 75 65 29 29 29 0a 09 09 09 09 09 20 20  queue)))......  
5af0: 20 28 76 65 63 74 6f 72 2d 63 6f 70 79 21 20 74   (vector-copy! t
5b00: 65 73 74 2d 72 65 63 6f 72 64 20 6e 65 77 72 65  est-record newre
5b10: 63 29 0a 09 09 09 09 09 20 20 20 6e 65 77 72 65  c)......   newre
5b20: 63 29 29 0a 09 09 09 28 6d 79 2d 69 74 65 6d 2d  c))....(my-item-
5b30: 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d  path (item-list-
5b40: 3e 70 61 74 68 20 6d 79 2d 69 74 65 6d 64 61 74  >path my-itemdat
5b50: 29 29 29 0a 09 09 20 20 20 28 69 66 20 28 74 65  )))...   (if (te
5b60: 73 74 73 3a 6d 61 74 63 68 20 74 65 73 74 2d 70  sts:match test-p
5b70: 61 74 74 73 20 68 65 64 20 6d 79 2d 69 74 65 6d  atts hed my-item
5b80: 2d 70 61 74 68 29 20 3b 3b 20 28 70 61 74 74 2d  -path) ;; (patt-
5b90: 6c 69 73 74 2d 6d 61 74 63 68 20 6d 79 2d 69 74  list-match my-it
5ba0: 65 6d 2d 70 61 74 68 20 69 74 65 6d 2d 70 61 74  em-path item-pat
5bb0: 74 73 29 20 20 20 20 20 20 20 20 20 20 20 3b 3b  ts)           ;;
5bc0: 20 79 65 73 2c 20 77 65 20 77 61 6e 74 20 74 6f   yes, we want to
5bd0: 20 70 72 6f 63 65 73 73 20 74 68 69 73 20 69 74   process this it
5be0: 65 6d 2c 20 4e 4f 54 45 3a 20 53 68 6f 75 6c 64  em, NOTE: Should
5bf0: 20 6e 6f 74 20 6e 65 65 64 20 74 68 69 73 20 63   not need this c
5c00: 68 65 63 6b 20 68 65 72 65 21 0a 09 09 20 20 20  heck here!...   
5c10: 20 20 20 20 28 6c 65 74 20 28 28 6e 65 77 74 65      (let ((newte
5c20: 73 74 6e 61 6d 65 20 28 72 75 6e 73 3a 6d 61 6b  stname (runs:mak
5c30: 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65  e-full-test-name
5c40: 20 68 65 64 20 6d 79 2d 69 74 65 6d 2d 70 61 74   hed my-item-pat
5c50: 68 29 29 29 20 20 20 20 3b 3b 20 74 65 73 74 20  h)))    ;; test 
5c60: 6e 61 6d 65 73 20 61 72 65 20 75 6e 69 71 75 65  names are unique
5c70: 20 6f 6e 20 74 65 73 74 6e 61 6d 65 2f 69 74 65   on testname/ite
5c80: 6d 2d 70 61 74 68 0a 09 09 09 20 28 74 65 73 74  m-path.... (test
5c90: 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d  s:testqueue-set-
5ca0: 69 74 65 6d 73 21 20 20 20 20 20 6e 65 77 2d 74  items!     new-t
5cb0: 65 73 74 2d 72 65 63 6f 72 64 20 23 66 29 0a 09  est-record #f)..
5cc0: 09 09 20 28 74 65 73 74 73 3a 74 65 73 74 71 75  .. (tests:testqu
5cd0: 65 75 65 2d 73 65 74 2d 69 74 65 6d 64 61 74 21  eue-set-itemdat!
5ce0: 20 20 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f     new-test-reco
5cf0: 72 64 20 6d 79 2d 69 74 65 6d 64 61 74 29 0a 09  rd my-itemdat)..
5d00: 09 09 20 28 74 65 73 74 73 3a 74 65 73 74 71 75  .. (tests:testqu
5d10: 65 75 65 2d 73 65 74 2d 69 74 65 6d 5f 70 61 74  eue-set-item_pat
5d20: 68 21 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f  h! new-test-reco
5d30: 72 64 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68 29  rd my-item-path)
5d40: 0a 09 09 09 20 28 68 61 73 68 2d 74 61 62 6c 65  .... (hash-table
5d50: 2d 73 65 74 21 20 74 65 73 74 2d 72 65 63 6f 72  -set! test-recor
5d60: 64 73 20 6e 65 77 74 65 73 74 6e 61 6d 65 20 6e  ds newtestname n
5d70: 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 29 0a  ew-test-record).
5d80: 09 09 09 20 28 73 65 74 21 20 74 61 6c 20 28 63  ... (set! tal (c
5d90: 6f 6e 73 20 6e 65 77 74 65 73 74 6e 61 6d 65 20  ons newtestname 
5da0: 74 61 6c 29 29 29 29 29 29 20 3b 3b 20 73 69 6e  tal)))))) ;; sin
5db0: 63 65 20 74 68 65 73 65 20 61 72 65 20 69 74 65  ce these are ite
5dc0: 6d 69 7a 65 64 20 63 72 65 61 74 65 20 6e 65 77  mized create new
5dd0: 20 74 65 73 74 20 6e 61 6d 65 73 20 74 65 73 74   test names test
5de0: 6e 61 6d 65 2f 69 74 65 6d 70 61 74 68 0a 09 20  name/itempath.. 
5df0: 20 20 20 20 20 20 69 74 65 6d 73 29 0a 09 20 20        items)..  
5e00: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75      (if (not (nu
5e10: 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 20 20 28 62  ll? tal))...  (b
5e20: 65 67 69 6e 0a 09 09 20 20 20 20 28 64 65 62 75  egin...    (debu
5e30: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22  g:print-info 4 "
5e40: 45 6e 64 20 6f 66 20 69 74 65 6d 73 20 6c 69 73  End of items lis
5e50: 74 2c 20 6c 6f 6f 70 69 6e 67 20 77 69 74 68 20  t, looping with 
5e60: 6e 65 78 74 20 61 66 74 65 72 20 73 68 6f 72 74  next after short
5e70: 20 64 65 6c 61 79 22 29 0a 20 20 20 20 20 20 20   delay").       
5e80: 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20               ;; 
5e90: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28  (thread-sleep! (
5ea0: 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d 64  + 0.01 *global-d
5eb0: 65 6c 74 61 2a 29 29 0a 09 09 20 20 20 20 28 6c  elta*))...    (l
5ec0: 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63 64  oop (car tal)(cd
5ed0: 72 20 74 61 6c 29 20 72 65 72 75 6e 73 29 29 29  r tal) reruns)))
5ee0: 29 0a 0a 09 20 20 20 20 20 3b 3b 20 69 66 20 69  )...     ;; if i
5ef0: 74 65 6d 73 20 69 73 20 61 20 70 72 6f 63 20 74  tems is a proc t
5f00: 68 65 6e 20 6e 65 65 64 20 74 6f 20 72 75 6e 20  hen need to run 
5f10: 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d  items:get-items-
5f20: 66 72 6f 6d 2d 63 6f 6e 66 69 67 2c 20 67 65 74  from-config, get
5f30: 20 74 68 65 20 6c 69 73 74 20 61 6e 64 20 6c 6f   the list and lo
5f40: 6f 70 20 0a 09 20 20 20 20 20 3b 3b 20 20 20 20  op ..     ;;    
5f50: 2d 20 62 75 74 20 6f 6e 6c 79 20 64 6f 20 74 68  - but only do th
5f60: 61 74 20 69 66 20 72 65 73 6f 75 72 63 65 73 20  at if resources 
5f70: 65 78 69 73 74 20 74 6f 20 6b 69 63 6b 20 6f 66  exist to kick of
5f80: 66 20 74 68 65 20 6a 6f 62 0a 09 20 20 20 20 20  f the job..     
5f90: 28 28 6f 72 20 28 70 72 6f 63 65 64 75 72 65 3f  ((or (procedure?
5fa0: 20 69 74 65 6d 73 29 28 65 71 3f 20 69 74 65 6d   items)(eq? item
5fb0: 73 20 27 68 61 76 65 2d 70 72 6f 63 65 64 75 72  s 'have-procedur
5fc0: 65 29 29 0a 09 20 20 20 20 20 20 28 6c 65 74 20  e))..      (let 
5fd0: 28 28 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 20 20  ((can-run-more  
5fe0: 20 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d    (runs:can-run-
5ff0: 6d 6f 72 65 2d 74 65 73 74 73 20 74 65 73 74 2d  more-tests test-
6000: 72 65 63 6f 72 64 29 29 29 0a 09 09 28 69 66 20  record)))...(if 
6010: 28 61 6e 64 20 28 6c 69 73 74 3f 20 63 61 6e 2d  (and (list? can-
6020: 72 75 6e 2d 6d 6f 72 65 29 0a 09 09 09 20 28 63  run-more).... (c
6030: 61 72 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 29  ar can-run-more)
6040: 29 0a 09 09 20 20 20 20 28 6c 65 74 2a 20 28 28  )...    (let* ((
6050: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20  prereqs-not-met 
6060: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
6070: 64 62 3a 67 65 74 2d 70 72 65 72 65 71 73 2d 6e  db:get-prereqs-n
6080: 6f 74 2d 6d 65 74 20 23 66 20 72 75 6e 2d 69 64  ot-met #f run-id
6090: 20 77 61 69 74 6f 6e 73 20 69 74 65 6d 2d 70 61   waitons item-pa
60a0: 74 68 20 6d 6f 64 65 3a 20 74 65 73 74 6d 6f 64  th mode: testmod
60b0: 65 29 29 0a 09 09 09 20 20 20 28 66 61 69 6c 73  e))....   (fails
60c0: 20 20 20 20 20 20 20 20 20 20 20 28 72 75 6e 73             (runs
60d0: 3a 63 61 6c 63 2d 66 61 69 6c 73 20 70 72 65 72  :calc-fails prer
60e0: 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 09 09  eqs-not-met))...
60f0: 09 20 20 20 28 6e 6f 6e 2d 63 6f 6d 70 6c 65 74  .   (non-complet
6100: 65 64 20 20 20 28 72 75 6e 73 3a 63 61 6c 63 2d  ed   (runs:calc-
6110: 6e 6f 74 2d 63 6f 6d 70 6c 65 74 65 64 20 70 72  not-completed pr
6120: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 29  ereqs-not-met)))
6130: 0a 09 09 20 20 20 20 20 20 28 64 65 62 75 67 3a  ...      (debug:
6140: 70 72 69 6e 74 2d 69 6e 66 6f 20 38 20 22 63 61  print-info 8 "ca
6150: 6e 2d 72 75 6e 2d 6d 6f 72 65 3a 20 22 20 63 61  n-run-more: " ca
6160: 6e 2d 72 75 6e 2d 6d 6f 72 65 0a 09 09 09 09 20  n-run-more..... 
6170: 20 20 22 5c 6e 20 74 65 73 74 6e 61 6d 65 3a 20    "\n testname: 
6180: 20 20 20 20 20 20 20 22 20 68 65 64 0a 09 09 09         " hed....
6190: 09 20 20 20 22 5c 6e 20 70 72 65 72 65 71 73 2d  .   "\n prereqs-
61a0: 6e 6f 74 2d 6d 65 74 3a 20 22 20 28 72 75 6e 73  not-met: " (runs
61b0: 3a 70 72 65 74 74 79 2d 73 74 72 69 6e 67 20 70  :pretty-string p
61c0: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a  rereqs-not-met).
61d0: 09 09 09 09 20 20 20 22 5c 6e 20 6e 6f 6e 2d 63  ....   "\n non-c
61e0: 6f 6d 70 6c 65 74 65 64 3a 20 20 20 22 20 28 72  ompleted:   " (r
61f0: 75 6e 73 3a 70 72 65 74 74 79 2d 73 74 72 69 6e  uns:pretty-strin
6200: 67 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29  g non-completed)
6210: 20 0a 09 09 09 09 20 20 20 22 5c 6e 20 66 61 69   .....   "\n fai
6220: 6c 73 3a 20 20 20 20 20 20 20 20 20 20 20 22 20  ls:           " 
6230: 28 72 75 6e 73 3a 70 72 65 74 74 79 2d 73 74 72  (runs:pretty-str
6240: 69 6e 67 20 66 61 69 6c 73 29 0a 09 09 09 09 20  ing fails)..... 
6250: 20 20 22 5c 6e 20 74 65 73 74 6d 6f 64 65 3a 20    "\n testmode: 
6260: 20 20 20 20 20 20 20 22 20 74 65 73 74 6d 6f 64         " testmod
6270: 65 0a 09 09 09 09 20 20 20 22 5c 6e 20 6e 75 6d  e.....   "\n num
6280: 2d 72 65 74 72 69 65 73 3a 20 20 20 20 20 22 20  -retries:     " 
6290: 6e 75 6d 2d 72 65 74 72 69 65 73 0a 09 09 09 09  num-retries.....
62a0: 20 20 20 22 5c 6e 20 28 65 71 3f 20 74 65 73 74     "\n (eq? test
62b0: 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c 29 3a  mode 'toplevel):
62c0: 20 22 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 65   " (eq? testmode
62d0: 20 27 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09   'toplevel).....
62e0: 20 20 20 22 5c 6e 20 28 6e 75 6c 6c 3f 20 6e 6f     "\n (null? no
62f0: 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 3a 20 20 20  n-completed):   
6300: 20 22 20 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f   " (null? non-co
6310: 6d 70 6c 65 74 65 64 29 0a 09 09 09 09 20 20 20  mpleted).....   
6320: 22 5c 6e 20 72 65 72 75 6e 73 3a 20 20 20 20 20  "\n reruns:     
6330: 20 20 20 20 20 22 20 72 65 72 75 6e 73 0a 09 09       " reruns...
6340: 09 09 20 20 20 22 5c 6e 20 69 74 65 6d 73 3a 20  ..   "\n items: 
6350: 20 20 20 20 20 20 20 20 20 20 22 20 69 74 65 6d            " item
6360: 73 0a 09 09 09 09 20 20 20 22 5c 6e 20 63 61 6e  s.....   "\n can
6370: 2d 72 75 6e 2d 6d 6f 72 65 3a 20 20 20 20 22 20  -run-more:    " 
6380: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 29 0a 09 09  can-run-more)...
6390: 20 20 20 20 20 20 3b 3b 20 28 74 68 72 65 61 64        ;; (thread
63a0: 2d 73 6c 65 65 70 21 20 28 2b 20 30 2e 30 31 20  -sleep! (+ 0.01 
63b0: 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29  *global-delta*))
63c0: 0a 09 09 20 20 20 20 20 20 28 63 6f 6e 64 20 3b  ...      (cond ;
63d0: 3b 20 49 4e 4e 45 52 20 43 4f 4e 44 20 23 32 0a  ; INNER COND #2.
63e0: 09 09 20 20 20 20 20 20 20 28 28 6f 72 20 28 6e  ..       ((or (n
63f0: 75 6c 6c 3f 20 70 72 65 72 65 71 73 2d 6e 6f 74  ull? prereqs-not
6400: 2d 6d 65 74 29 20 3b 3b 20 61 6c 6c 20 70 72 65  -met) ;; all pre
6410: 72 65 71 73 20 6d 65 74 2c 20 66 69 72 65 20 6f  reqs met, fire o
6420: 66 66 20 74 68 65 20 74 65 73 74 0a 09 09 09 20  ff the test.... 
6430: 20 20 20 3b 3b 20 6f 72 2c 20 69 66 20 69 74 20     ;; or, if it 
6440: 69 73 20 61 20 27 74 6f 70 6c 65 76 65 6c 20 74  is a 'toplevel t
6450: 65 73 74 20 61 6e 64 20 61 6c 6c 20 70 72 65 72  est and all prer
6460: 65 71 73 20 6e 6f 74 20 6d 65 74 20 61 72 65 20  eqs not met are 
6470: 43 4f 4d 50 4c 45 54 45 44 20 74 68 65 6e 20 6c  COMPLETED then l
6480: 61 75 6e 63 68 0a 09 09 09 20 20 20 20 28 61 6e  aunch....    (an
6490: 64 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20  d (eq? testmode 
64a0: 27 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09 20  'toplevel)..... 
64b0: 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c  (null? non-compl
64c0: 65 74 65 64 29 29 29 0a 09 09 09 28 6c 65 74 20  eted)))....(let 
64d0: 28 28 74 65 73 74 2d 6e 61 6d 65 20 28 74 65 73  ((test-name (tes
64e0: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
64f0: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72  -testname test-r
6500: 65 63 6f 72 64 29 29 29 0a 09 09 09 20 20 28 73  ecord)))....  (s
6510: 65 74 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e  etenv "MT_TEST_N
6520: 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 20  AME" test-name) 
6530: 3b 3b 20 0a 09 09 09 20 20 28 73 65 74 65 6e 76  ;; ....  (setenv
6540: 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20   "MT_RUNNAME"   
6550: 72 75 6e 6e 61 6d 65 29 0a 09 09 09 20 20 28 73  runname)....  (s
6560: 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d  et-megatest-env-
6570: 76 61 72 73 20 72 75 6e 2d 69 64 29 20 3b 3b 20  vars run-id) ;; 
6580: 74 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65  these may be nee
6590: 64 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63  ded by the launc
65a0: 68 69 6e 67 20 70 72 6f 63 65 73 73 0a 09 09 09  hing process....
65b0: 20 20 28 6c 65 74 20 28 28 69 74 65 6d 73 2d 6c    (let ((items-l
65c0: 69 73 74 20 28 69 74 65 6d 73 3a 67 65 74 2d 69  ist (items:get-i
65d0: 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67  tems-from-config
65e0: 20 74 63 6f 6e 66 69 67 29 29 29 0a 09 09 09 20   tconfig))).... 
65f0: 20 20 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74     (if (list? it
6600: 65 6d 73 2d 6c 69 73 74 29 0a 09 09 09 09 28 62  ems-list).....(b
6610: 65 67 69 6e 0a 09 09 09 09 20 20 28 74 65 73 74  egin.....  (test
6620: 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d  s:testqueue-set-
6630: 69 74 65 6d 73 21 20 74 65 73 74 2d 72 65 63 6f  items! test-reco
6640: 72 64 20 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09  rd items-list)..
6650: 09 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65  ...  (thread-sle
6660: 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74  ep! *global-delt
6670: 61 2a 29 0a 09 09 09 09 20 20 28 6c 6f 6f 70 20  a*).....  (loop 
6680: 68 65 64 20 74 61 6c 20 72 65 72 75 6e 73 29 29  hed tal reruns))
6690: 0a 09 09 09 09 28 62 65 67 69 6e 0a 09 09 09 09  .....(begin.....
66a0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
66b0: 20 22 45 52 52 4f 52 3a 20 54 68 65 20 70 72 6f   "ERROR: The pro
66c0: 63 20 66 72 6f 6d 20 72 65 61 64 69 6e 67 20 74  c from reading t
66d0: 68 65 20 73 65 74 75 70 20 64 69 64 20 6e 6f 74  he setup did not
66e0: 20 79 69 65 6c 64 20 61 20 6c 69 73 74 20 2d 20   yield a list - 
66f0: 70 6c 65 61 73 65 20 72 65 70 6f 72 74 20 74 68  please report th
6700: 69 73 22 29 0a 09 09 09 09 20 20 28 65 78 69 74  is").....  (exit
6710: 20 31 29 29 29 29 29 29 0a 09 09 20 20 20 20 20   1))))))...     
6720: 20 20 28 28 6e 75 6c 6c 3f 20 66 61 69 6c 73 29    ((null? fails)
6730: 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74  ....(debug:print
6740: 2d 69 6e 66 6f 20 34 20 22 66 61 69 6c 73 20 69  -info 4 "fails i
6750: 73 20 6e 75 6c 6c 2c 20 6d 6f 76 69 6e 67 20 6f  s null, moving o
6760: 6e 20 69 6e 20 74 68 65 20 71 75 65 75 65 20 62  n in the queue b
6770: 75 74 20 6b 65 65 70 69 6e 67 20 22 20 68 65 64  ut keeping " hed
6780: 20 22 20 66 6f 72 20 6e 6f 77 22 29 0a 09 09 09   " for now")....
6790: 3b 3b 20 6f 6e 6c 79 20 69 6e 63 72 65 6d 65 6e  ;; only incremen
67a0: 74 20 6e 75 6d 2d 72 65 74 72 69 65 73 20 77 68  t num-retries wh
67b0: 65 6e 20 74 68 65 72 65 20 61 72 65 20 6e 6f 20  en there are no 
67c0: 74 65 73 74 73 20 72 75 6e 69 6e 67 0a 09 09 09  tests runing....
67d0: 28 69 66 20 28 65 71 3f 20 30 20 28 6c 69 73 74  (if (eq? 0 (list
67e0: 2d 72 65 66 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72  -ref can-run-mor
67f0: 65 20 31 29 29 0a 09 09 09 20 20 20 20 28 62 65  e 1))....    (be
6800: 67 69 6e 0a 09 09 09 20 20 20 20 20 20 28 69 66  gin....      (if
6810: 20 28 3e 20 6e 75 6d 2d 72 65 74 72 69 65 73 20   (> num-retries 
6820: 31 30 30 29 20 3b 3b 20 66 69 72 73 74 20 31 30  100) ;; first 10
6830: 30 20 72 65 74 72 69 65 73 20 61 72 65 20 6c 6f  0 retries are lo
6840: 77 20 74 69 6d 65 20 63 6f 73 74 0a 09 09 09 09  w time cost.....
6850: 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21    (thread-sleep!
6860: 20 28 2b 20 32 20 2a 67 6c 6f 62 61 6c 2d 64 65   (+ 2 *global-de
6870: 6c 74 61 2a 29 29 0a 09 09 09 09 20 20 28 74 68  lta*)).....  (th
6880: 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 30  read-sleep! (+ 0
6890: 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74  .01 *global-delt
68a0: 61 2a 29 29 29 0a 09 09 09 20 20 20 20 20 20 28  a*)))....      (
68b0: 73 65 74 21 20 6e 75 6d 2d 72 65 74 72 69 65 73  set! num-retries
68c0: 20 28 2b 20 6e 75 6d 2d 72 65 74 72 69 65 73 20   (+ num-retries 
68d0: 31 29 29 29 29 0a 09 09 09 28 69 66 20 28 3e 20  1))))....(if (> 
68e0: 6e 75 6d 2d 72 65 74 72 69 65 73 20 20 6d 61 78  num-retries  max
68f0: 2d 72 65 74 72 69 65 73 29 0a 09 09 09 20 20 20  -retries)....   
6900: 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f   (if (not (null?
6910: 20 74 61 6c 29 29 0a 09 09 09 09 28 6c 6f 6f 70   tal)).....(loop
6920: 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74   (car tal)(cdr t
6930: 61 6c 29 20 72 65 72 75 6e 73 29 29 0a 09 09 09  al) reruns))....
6940: 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e      (loop (car n
6950: 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61  ewtal)(cdr newta
6960: 6c 29 20 72 65 72 75 6e 73 29 29 29 20 3b 3b 20  l) reruns))) ;; 
6970: 61 6e 20 69 73 73 75 65 20 77 69 74 68 20 70 72  an issue with pr
6980: 65 72 65 71 73 20 6e 6f 74 20 79 65 74 20 6d 65  ereqs not yet me
6990: 74 3f 0a 09 09 20 20 20 20 20 20 20 28 28 61 6e  t?...       ((an
69a0: 64 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 66 61  d (not (null? fa
69b0: 69 6c 73 29 29 28 65 71 3f 20 74 65 73 74 6d 6f  ils))(eq? testmo
69c0: 64 65 20 27 6e 6f 72 6d 61 6c 29 29 0a 09 09 09  de 'normal))....
69d0: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
69e0: 6f 20 31 20 22 74 65 73 74 20 22 20 20 68 65 64  o 1 "test "  hed
69f0: 20 22 20 28 6d 6f 64 65 3d 22 20 74 65 73 74 6d   " (mode=" testm
6a00: 6f 64 65 20 22 29 20 68 61 73 20 66 61 69 6c 65  ode ") has faile
6a10: 64 20 70 72 65 72 65 71 75 69 73 69 74 65 28 73  d prerequisite(s
6a20: 29 3b 20 22 0a 09 09 09 09 20 20 20 20 20 28 73  ); ".....     (s
6a30: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73  tring-interspers
6a40: 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28  e (map (lambda (
6a50: 74 29 28 63 6f 6e 63 20 28 64 62 3a 74 65 73 74  t)(conc (db:test
6a60: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 29  -get-testname t)
6a70: 20 22 3a 22 20 28 64 62 3a 74 65 73 74 2d 67 65   ":" (db:test-ge
6a80: 74 2d 73 74 61 74 65 20 74 29 22 2f 22 28 64 62  t-state t)"/"(db
6a90: 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73  :test-get-status
6aa0: 20 74 29 29 29 20 66 61 69 6c 73 29 20 22 2c 20   t))) fails) ", 
6ab0: 22 29 0a 09 09 09 09 20 20 20 20 20 22 2c 20 72  ").....     ", r
6ac0: 65 6d 6f 76 69 6e 67 20 69 74 20 66 72 6f 6d 20  emoving it from 
6ad0: 74 6f 2d 64 6f 20 6c 69 73 74 22 29 0a 09 09 09  to-do list")....
6ae0: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20  (if (not (null? 
6af0: 74 61 6c 29 29 0a 09 09 09 20 20 20 20 28 62 65  tal))....    (be
6b00: 67 69 6e 0a 09 09 09 20 20 20 20 20 20 28 74 68  gin....      (th
6b10: 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f  read-sleep! *glo
6b20: 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 09 20  bal-delta*).... 
6b30: 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20       (loop (car 
6b40: 74 61 6c 29 28 63 64 72 20 74 61 6c 29 28 63 6f  tal)(cdr tal)(co
6b50: 6e 73 20 68 65 64 20 72 65 72 75 6e 73 29 29 29  ns hed reruns)))
6b60: 29 29 0a 09 09 20 20 20 20 20 20 20 28 65 6c 73  ))...       (els
6b70: 65 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e  e....(debug:prin
6b80: 74 20 38 20 22 45 52 52 4f 52 3a 20 4e 6f 20 68  t 8 "ERROR: No h
6b90: 61 6e 64 6c 65 72 20 66 6f 72 20 74 68 69 73 20  andler for this 
6ba0: 63 6f 6e 64 69 74 69 6f 6e 2e 22 29 0a 09 09 09  condition.")....
6bb0: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28  (thread-sleep! (
6bc0: 2b 20 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74  + 1 *global-delt
6bd0: 61 2a 29 29 0a 09 09 09 28 6c 6f 6f 70 20 28 63  a*))....(loop (c
6be0: 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e  ar newtal)(cdr n
6bf0: 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29 29 29  ewtal) reruns)))
6c00: 29 20 3b 3b 20 45 4e 44 20 4f 46 20 49 46 20 43  ) ;; END OF IF C
6c10: 41 4e 20 52 55 4e 20 4d 4f 52 45 0a 0a 09 09 20  AN RUN MORE.... 
6c20: 20 20 20 3b 3b 20 69 66 20 63 61 6e 27 74 20 72     ;; if can't r
6c30: 75 6e 20 6d 6f 72 65 20 6a 75 73 74 20 6c 6f 6f  un more just loo
6c40: 70 20 77 69 74 68 20 6e 65 78 74 20 70 6f 73 73  p with next poss
6c50: 69 62 6c 65 20 74 65 73 74 0a 09 09 20 20 20 20  ible test...    
6c60: 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20 20 28  (begin...      (
6c70: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
6c80: 20 34 20 22 70 72 6f 63 65 73 73 69 6e 67 20 74   4 "processing t
6c90: 68 65 20 63 61 73 65 20 77 69 74 68 20 61 20 6c  he case with a l
6ca0: 61 6d 62 64 61 20 66 6f 72 20 69 74 65 6d 73 20  ambda for items 
6cb0: 6f 72 20 27 68 61 76 65 2d 70 72 6f 63 65 64 75  or 'have-procedu
6cc0: 72 65 2e 20 4d 6f 76 69 6e 67 20 74 68 72 6f 75  re. Moving throu
6cd0: 67 68 20 74 68 65 20 71 75 65 75 65 20 77 69 74  gh the queue wit
6ce0: 68 6f 75 74 20 64 72 6f 70 70 69 6e 67 20 22 20  hout dropping " 
6cf0: 68 65 64 29 0a 09 09 20 20 20 20 20 20 28 74 68  hed)...      (th
6d00: 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 32  read-sleep! (+ 2
6d10: 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29   *global-delta*)
6d20: 29 0a 09 09 20 20 20 20 20 20 28 6c 6f 6f 70 20  )...      (loop 
6d30: 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72  (car newtal)(cdr
6d40: 20 6e 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29   newtal) reruns)
6d50: 29 29 29 29 20 3b 3b 20 45 4e 44 20 4f 46 20 28  )))) ;; END OF (
6d60: 6f 72 20 28 70 72 6f 63 65 64 75 72 65 3f 20 69  or (procedure? i
6d70: 74 65 6d 73 29 28 65 71 3f 20 69 74 65 6d 73 20  tems)(eq? items 
6d80: 27 68 61 76 65 2d 70 72 6f 63 65 64 75 72 65 29  'have-procedure)
6d90: 29 0a 09 20 20 20 20 20 0a 09 20 20 20 20 20 3b  )..     ..     ;
6da0: 3b 20 74 68 69 73 20 63 61 73 65 20 73 68 6f 75  ; this case shou
6db0: 6c 64 20 6e 6f 74 20 68 61 70 70 65 6e 2c 20 61  ld not happen, a
6dc0: 64 64 65 64 20 74 6f 20 68 65 6c 70 20 63 61 74  dded to help cat
6dd0: 63 68 20 61 6e 79 20 62 75 67 73 0a 09 20 20 20  ch any bugs..   
6de0: 20 20 28 28 61 6e 64 20 28 6c 69 73 74 3f 20 69    ((and (list? i
6df0: 74 65 6d 73 29 20 69 74 65 6d 64 61 74 29 0a 09  tems) itemdat)..
6e00: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
6e10: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 53 68 6f  nt 0 "ERROR: Sho
6e20: 75 6c 64 20 6e 6f 74 20 68 61 76 65 20 61 20 6c  uld not have a l
6e30: 69 73 74 20 6f 66 20 69 74 65 6d 73 20 69 6e 20  ist of items in 
6e40: 61 20 74 65 73 74 20 61 6e 64 20 74 68 65 20 69  a test and the i
6e50: 74 65 6d 73 70 61 74 68 20 73 65 74 20 2d 20 70  temspath set - p
6e60: 6c 65 61 73 65 20 72 65 70 6f 72 74 20 74 68 69  lease report thi
6e70: 73 22 29 0a 09 20 20 20 20 20 20 28 65 78 69 74  s")..      (exit
6e80: 20 31 29 29 0a 09 20 20 20 20 20 28 28 6e 6f 74   1))..     ((not
6e90: 20 28 6e 75 6c 6c 3f 20 72 65 72 75 6e 73 29 29   (null? reruns))
6ea0: 0a 09 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28  ..      (let* ((
6eb0: 6e 65 77 6c 73 74 20 28 74 65 73 74 73 3a 66 69  newlst (tests:fi
6ec0: 6c 74 65 72 2d 6e 6f 6e 2d 72 75 6e 6e 61 62 6c  lter-non-runnabl
6ed0: 65 20 72 75 6e 2d 69 64 20 74 61 6c 20 74 65 73  e run-id tal tes
6ee0: 74 2d 72 65 63 6f 72 64 73 29 29 20 3b 3b 20 69  t-records)) ;; i
6ef0: 2e 65 2e 20 6e 6f 74 20 46 41 49 4c 2c 20 57 41  .e. not FAIL, WA
6f00: 49 56 45 44 2c 20 49 4e 43 4f 4d 50 4c 45 54 45  IVED, INCOMPLETE
6f10: 2c 20 50 41 53 53 2c 20 4b 49 4c 4c 45 44 2c 0a  , PASS, KILLED,.
6f20: 09 09 20 20 20 20 20 28 6a 75 6e 6b 65 64 20 28  ..     (junked (
6f30: 6c 73 65 74 2d 64 69 66 66 65 72 65 6e 63 65 20  lset-difference 
6f40: 65 71 75 61 6c 3f 20 74 61 6c 20 6e 65 77 6c 73  equal? tal newls
6f50: 74 29 29 29 0a 09 09 28 64 65 62 75 67 3a 70 72  t)))...(debug:pr
6f60: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 66 75 6c 6c  int-info 4 "full
6f70: 20 64 72 6f 70 20 74 68 72 6f 75 67 68 2c 20 69   drop through, i
6f80: 66 20 72 65 72 75 6e 73 20 69 73 20 6c 65 73 73  f reruns is less
6f90: 20 74 68 61 6e 20 31 30 30 20 77 65 20 77 69 6c   than 100 we wil
6fa0: 6c 20 66 6f 72 63 65 20 72 65 74 72 79 20 74 68  l force retry th
6fb0: 65 6d 2c 20 72 65 72 75 6e 73 3d 22 20 72 65 72  em, reruns=" rer
6fc0: 75 6e 73 20 22 2c 20 74 61 6c 3d 22 20 74 61 6c  uns ", tal=" tal
6fd0: 29 0a 09 09 28 69 66 20 28 3c 20 6e 75 6d 2d 72  )...(if (< num-r
6fe0: 65 74 72 69 65 73 20 6d 61 78 2d 72 65 74 72 69  etries max-retri
6ff0: 65 73 29 0a 09 09 20 20 20 20 28 73 65 74 21 20  es)...    (set! 
7000: 6e 65 77 6c 73 74 20 28 61 70 70 65 6e 64 20 72  newlst (append r
7010: 65 72 75 6e 73 20 6e 65 77 6c 73 74 29 29 29 0a  eruns newlst))).
7020: 09 09 28 73 65 74 21 20 6e 75 6d 2d 72 65 74 72  ..(set! num-retr
7030: 69 65 73 20 28 2b 20 6e 75 6d 2d 72 65 74 72 69  ies (+ num-retri
7040: 65 73 20 31 29 29 0a 09 09 28 74 68 72 65 61 64  es 1))...(thread
7050: 2d 73 6c 65 65 70 21 20 28 2b 20 31 20 2a 67 6c  -sleep! (+ 1 *gl
7060: 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09  obal-delta*))...
7070: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20  (if (not (null? 
7080: 6e 65 77 6c 73 74 29 29 0a 09 09 20 20 20 20 3b  newlst))...    ;
7090: 3b 20 73 69 6e 63 65 20 72 65 72 75 6e 73 20 68  ; since reruns h
70a0: 61 76 65 20 62 65 65 6e 20 74 61 63 6b 65 64 20  ave been tacked 
70b0: 6f 6e 20 74 6f 20 6e 65 77 6c 73 74 20 63 72 65  on to newlst cre
70c0: 61 74 65 20 6e 65 77 20 72 65 72 75 6e 73 20 66  ate new reruns f
70d0: 72 6f 6d 20 6a 75 6e 6b 65 64 0a 09 09 20 20 20  rom junked...   
70e0: 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 6c   (loop (car newl
70f0: 73 74 29 28 63 64 72 20 6e 65 77 6c 73 74 29 28  st)(cdr newlst)(
7100: 64 65 6c 65 74 65 2d 64 75 70 6c 69 63 61 74 65  delete-duplicate
7110: 73 20 6a 75 6e 6b 65 64 29 29 29 29 29 0a 09 20  s junked))))).. 
7120: 20 20 20 20 28 28 6e 6f 74 20 28 6e 75 6c 6c 3f      ((not (null?
7130: 20 74 61 6c 29 29 0a 09 20 20 20 20 20 20 28 64   tal))..      (d
7140: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
7150: 34 20 22 49 27 6d 20 70 72 65 74 74 79 20 73 75  4 "I'm pretty su
7160: 72 65 20 49 20 73 68 6f 75 6c 64 6e 27 74 20 67  re I shouldn't g
7170: 65 74 20 68 65 72 65 2e 22 29 29 0a 09 20 20 20  et here."))..   
7180: 20 20 28 65 6c 73 65 0a 09 20 20 20 20 20 20 28    (else..      (
7190: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
71a0: 20 34 20 22 45 78 69 74 69 6e 67 20 6c 6f 6f 70   4 "Exiting loop
71b0: 20 77 69 74 68 2e 2e 2e 5c 6e 20 20 68 65 64 3d   with...\n  hed=
71c0: 22 20 68 65 64 20 22 5c 6e 20 20 74 61 6c 3d 22  " hed "\n  tal="
71d0: 20 74 61 6c 20 22 5c 6e 20 20 72 65 72 75 6e 73   tal "\n  reruns
71e0: 3d 22 20 72 65 72 75 6e 73 29 29 0a 09 20 20 20  =" reruns))..   
71f0: 20 20 29 29 29 29 20 3b 3b 20 4c 45 54 2a 20 28    )))) ;; LET* (
7200: 28 74 65 73 74 2d 72 65 63 6f 72 64 0a 0a 20 20  (test-record..  
7210: 20 20 3b 3b 20 77 65 20 67 65 74 20 68 65 72 65    ;; we get here
7220: 20 6f 6e 20 22 64 72 6f 70 20 74 68 72 6f 75 67   on "drop throug
7230: 68 22 20 2d 20 6c 6f 6f 70 20 66 6f 72 20 6e 65  h" - loop for ne
7240: 78 74 20 74 65 73 74 20 69 6e 20 71 75 65 75 65  xt test in queue
7250: 0a 20 20 20 20 3b 3b 20 46 49 58 4d 45 21 21 21  .    ;; FIXME!!!
7260: 21 20 54 48 49 53 20 53 48 4f 55 4c 44 20 4e 4f  ! THIS SHOULD NO
7270: 54 20 52 45 51 55 49 52 45 20 41 4e 20 45 58 49  T REQUIRE AN EXI
7280: 54 21 21 21 21 21 21 21 0a 20 20 20 20 0a 20 20  T!!!!!!!.    .  
7290: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69    (debug:print-i
72a0: 6e 66 6f 20 31 20 22 41 6c 6c 20 74 65 73 74 73  nfo 1 "All tests
72b0: 20 6c 61 75 6e 63 68 65 64 22 29 0a 20 20 20 20   launched").    
72c0: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 30  (thread-sleep! 0
72d0: 2e 35 29 0a 20 20 20 20 3b 3b 20 46 49 58 4d 45  .5).    ;; FIXME
72e0: 21 20 54 68 69 73 20 68 61 72 73 68 20 65 78 69  ! This harsh exi
72f0: 74 20 73 68 6f 75 6c 64 20 6e 6f 74 20 62 65 20  t should not be 
7300: 6e 65 63 65 73 73 61 72 79 2e 2e 2e 2e 0a 20 20  necessary.....  
7310: 20 20 3b 3b 20 28 69 66 20 28 6e 6f 74 20 2a 72    ;; (if (not *r
7320: 75 6e 72 65 6d 6f 74 65 2a 29 28 65 78 69 74 29  unremote*)(exit)
7330: 29 20 3b 3b 20 0a 20 20 20 20 23 66 29 29 20 3b  ) ;; .    #f)) ;
7340: 3b 20 72 65 74 75 72 6e 20 61 20 23 66 20 61 73  ; return a #f as
7350: 20 61 20 68 69 6e 74 20 74 68 61 74 20 77 65 20   a hint that we 
7360: 61 72 65 20 64 6f 6e 65 0a 20 20 3b 3b 20 48 65  are done.  ;; He
7370: 72 65 20 77 65 20 6e 65 65 64 20 74 6f 20 63 68  re we need to ch
7380: 65 63 6b 20 74 68 61 74 20 61 6c 6c 20 74 68 65  eck that all the
7390: 20 74 65 73 74 73 20 72 65 6d 61 69 6e 69 6e 67   tests remaining
73a0: 20 74 6f 20 62 65 20 72 75 6e 20 61 72 65 20 65   to be run are e
73b0: 6c 69 67 69 62 6c 65 20 74 6f 20 72 75 6e 0a 20  ligible to run. 
73c0: 20 3b 3b 20 61 6e 64 20 61 72 65 20 6e 6f 74 20   ;; and are not 
73d0: 62 6c 6f 63 6b 65 64 20 62 79 20 66 61 69 6c 65  blocked by faile
73e0: 64 0a 20 20 0a 0a 3b 3b 20 70 61 72 65 6e 74 2d  d.  ..;; parent-
73f0: 74 65 73 74 20 69 73 20 74 68 65 72 65 20 61 73  test is there as
7400: 20 61 20 70 6c 61 63 65 68 6f 6c 64 65 72 20 66   a placeholder f
7410: 6f 72 20 77 68 65 6e 20 70 61 72 65 6e 74 2d 74  or when parent-t
7420: 65 73 74 73 20 63 61 6e 20 62 65 20 72 75 6e 20  ests can be run 
7430: 61 73 20 61 20 73 65 74 75 70 20 73 74 65 70 0a  as a setup step.
7440: 28 64 65 66 69 6e 65 20 28 72 75 6e 3a 74 65 73  (define (run:tes
7450: 74 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65  t run-id runname
7460: 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 73 74 2d   keyvallst test-
7470: 72 65 63 6f 72 64 20 66 6c 61 67 73 20 70 61 72  record flags par
7480: 65 6e 74 2d 74 65 73 74 29 0a 20 20 3b 3b 20 41  ent-test).  ;; A
7490: 6c 6c 20 74 68 65 73 65 20 76 61 72 73 20 6d 69  ll these vars mi
74a0: 67 68 74 20 62 65 20 72 65 66 65 72 65 6e 63 65  ght be reference
74b0: 64 20 62 79 20 74 68 65 20 74 65 73 74 63 6f 6e  d by the testcon
74c0: 66 69 67 20 66 69 6c 65 20 72 65 61 64 65 72 0a  fig file reader.
74d0: 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 6e    (let* ((test-n
74e0: 61 6d 65 20 20 20 20 28 74 65 73 74 73 3a 74 65  ame    (tests:te
74f0: 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74  stqueue-get-test
7500: 6e 61 6d 65 20 20 20 74 65 73 74 2d 72 65 63 6f  name   test-reco
7510: 72 64 29 29 0a 09 20 28 74 65 73 74 2d 77 61 69  rd)).. (test-wai
7520: 74 6f 6e 73 20 28 74 65 73 74 73 3a 74 65 73 74  tons (tests:test
7530: 71 75 65 75 65 2d 67 65 74 2d 77 61 69 74 6f 6e  queue-get-waiton
7540: 73 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64  s    test-record
7550: 29 29 0a 09 20 28 74 65 73 74 2d 63 6f 6e 66 20  )).. (test-conf 
7560: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75     (tests:testqu
7570: 65 75 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66  eue-get-testconf
7580: 69 67 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29  ig test-record))
7590: 0a 09 20 28 69 74 65 6d 64 61 74 20 20 20 20 20  .. (itemdat     
75a0: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75   (tests:testqueu
75b0: 65 2d 67 65 74 2d 69 74 65 6d 64 61 74 20 20 20  e-get-itemdat   
75c0: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09   test-record))..
75d0: 20 28 74 65 73 74 2d 70 61 74 68 20 20 20 20 28   (test-path    (
75e0: 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 22  conc *toppath* "
75f0: 2f 74 65 73 74 73 2f 22 20 74 65 73 74 2d 6e 61  /tests/" test-na
7600: 6d 65 29 29 20 3b 3b 20 63 6f 75 6c 64 20 75 73  me)) ;; could us
7610: 65 20 74 65 73 74 73 3a 67 65 74 2d 74 65 73 74  e tests:get-test
7620: 63 6f 6e 66 69 67 20 68 65 72 65 20 2e 2e 2e 0a  config here ....
7630: 09 20 28 66 6f 72 63 65 20 20 20 20 20 20 20 20  . (force        
7640: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f  (hash-table-ref/
7650: 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d  default flags "-
7660: 66 6f 72 63 65 22 20 23 66 29 29 0a 09 20 28 72  force" #f)).. (r
7670: 65 72 75 6e 20 20 20 20 20 20 20 20 28 68 61 73  erun        (has
7680: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61  h-table-ref/defa
7690: 75 6c 74 20 66 6c 61 67 73 20 22 2d 72 65 72 75  ult flags "-reru
76a0: 6e 22 20 23 66 29 29 0a 09 20 28 6b 65 65 70 67  n" #f)).. (keepg
76b0: 6f 69 6e 67 20 20 20 20 28 68 61 73 68 2d 74 61  oing    (hash-ta
76c0: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20  ble-ref/default 
76d0: 66 6c 61 67 73 20 22 2d 6b 65 65 70 67 6f 69 6e  flags "-keepgoin
76e0: 67 22 20 23 66 29 29 0a 09 20 28 69 74 65 6d 2d  g" #f)).. (item-
76f0: 70 61 74 68 20 20 20 20 20 22 22 29 0a 09 20 28  path     "").. (
7700: 64 62 20 20 20 20 20 20 20 20 20 20 20 23 66 29  db           #f)
7710: 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ).    (debug:pri
7720: 6e 74 20 34 0a 09 09 20 22 74 65 73 74 2d 63 6f  nt 4... "test-co
7730: 6e 66 69 67 3a 20 22 20 28 68 61 73 68 2d 74 61  nfig: " (hash-ta
7740: 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65 73 74 2d  ble->alist test-
7750: 63 6f 6e 66 29 0a 09 09 20 22 5c 6e 20 20 20 69  conf)... "\n   i
7760: 74 65 6d 64 61 74 3a 20 22 20 69 74 65 6d 64 61  temdat: " itemda
7770: 74 0a 09 09 20 29 0a 20 20 20 20 3b 3b 20 73 65  t... ).    ;; se
7780: 74 74 69 6e 67 20 69 74 65 6d 64 61 74 20 74 6f  tting itemdat to
7790: 20 61 20 6c 69 73 74 20 69 66 20 69 74 20 69 73   a list if it is
77a0: 20 23 66 0a 20 20 20 20 28 69 66 20 28 6e 6f 74   #f.    (if (not
77b0: 20 69 74 65 6d 64 61 74 29 28 73 65 74 21 20 69   itemdat)(set! i
77c0: 74 65 6d 64 61 74 20 27 28 29 29 29 0a 20 20 20  temdat '())).   
77d0: 20 28 73 65 74 21 20 69 74 65 6d 2d 70 61 74 68   (set! item-path
77e0: 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74   (item-list->pat
77f0: 68 20 69 74 65 6d 64 61 74 29 29 0a 20 20 20 20  h itemdat)).    
7800: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22  (debug:print 2 "
7810: 41 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 6c 61  Attempting to la
7820: 75 6e 63 68 20 74 65 73 74 20 22 20 74 65 73 74  unch test " test
7830: 2d 6e 61 6d 65 20 28 69 66 20 28 65 71 75 61 6c  -name (if (equal
7840: 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 2f 22 29  ? item-path "/")
7850: 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29   "/" item-path))
7860: 0a 20 20 20 20 28 73 65 74 65 6e 76 20 22 4d 54  .    (setenv "MT
7870: 5f 54 45 53 54 5f 4e 41 4d 45 22 20 74 65 73 74  _TEST_NAME" test
7880: 2d 6e 61 6d 65 29 20 3b 3b 20 0a 20 20 20 20 28  -name) ;; .    (
7890: 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e 4e 41  setenv "MT_RUNNA
78a0: 4d 45 22 20 20 20 72 75 6e 6e 61 6d 65 29 0a 20  ME"   runname). 
78b0: 20 20 20 28 73 65 74 2d 6d 65 67 61 74 65 73 74     (set-megatest
78c0: 2d 65 6e 76 2d 76 61 72 73 20 72 75 6e 2d 69 64  -env-vars run-id
78d0: 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62  ) ;; these may b
78e0: 65 20 6e 65 65 64 65 64 20 62 79 20 74 68 65 20  e needed by the 
78f0: 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73  launching proces
7900: 73 0a 20 20 20 20 28 63 68 61 6e 67 65 2d 64 69  s.    (change-di
7910: 72 65 63 74 6f 72 79 20 2a 74 6f 70 70 61 74 68  rectory *toppath
7920: 2a 29 0a 0a 20 20 20 20 3b 3b 20 48 65 72 65 20  *)..    ;; Here 
7930: 69 73 20 77 68 65 72 65 20 74 68 65 20 74 65 73  is where the tes
7940: 74 5f 6d 65 74 61 20 74 61 62 6c 65 20 69 73 20  t_meta table is 
7950: 62 65 73 74 20 75 70 64 61 74 65 64 0a 20 20 20  best updated.   
7960: 20 3b 3b 20 59 65 73 2c 20 61 6e 6f 74 68 65 72   ;; Yes, another
7970: 20 75 73 65 20 6f 66 20 61 20 67 6c 6f 62 61 6c   use of a global
7980: 20 66 6f 72 20 63 61 63 68 69 6e 67 2e 20 4e 65   for caching. Ne
7990: 65 64 20 61 20 62 65 74 74 65 72 20 77 61 79 3f  ed a better way?
79a0: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 68  .    (if (not (h
79b0: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65  ash-table-ref/de
79c0: 66 61 75 6c 74 20 2a 74 65 73 74 2d 6d 65 74 61  fault *test-meta
79d0: 2d 75 70 64 61 74 65 64 2a 20 74 65 73 74 2d 6e  -updated* test-n
79e0: 61 6d 65 20 23 66 29 29 0a 20 20 20 20 20 20 20  ame #f)).       
79f0: 20 28 62 65 67 69 6e 0a 09 20 20 20 28 68 61 73   (begin..   (has
7a00: 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 2a 74 65  h-table-set! *te
7a10: 73 74 2d 6d 65 74 61 2d 75 70 64 61 74 65 64 2a  st-meta-updated*
7a20: 20 74 65 73 74 2d 6e 61 6d 65 20 23 74 29 0a 20   test-name #t). 
7a30: 20 20 20 20 20 20 20 20 20 20 28 6f 70 65 6e 2d            (open-
7a40: 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 3a 75  run-close runs:u
7a50: 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 20  pdate-test_meta 
7a60: 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73  db test-name tes
7a70: 74 2d 63 6f 6e 66 29 29 29 0a 20 20 20 20 0a 20  t-conf))).    . 
7a80: 20 20 20 3b 3b 20 28 6c 61 6d 62 64 61 20 28 69     ;; (lambda (i
7a90: 74 65 6d 64 61 74 29 20 3b 3b 3b 20 28 28 72 69  temdat) ;;; ((ri
7aa0: 70 65 6e 65 73 73 20 22 6f 76 65 72 72 69 70 65  peness "overripe
7ab0: 22 29 20 28 74 65 6d 70 65 72 61 74 75 72 65 20  ") (temperature 
7ac0: 22 63 6f 6f 6c 22 29 20 28 73 65 61 73 6f 6e 20  "cool") (season 
7ad0: 22 73 75 6d 6d 65 72 22 29 29 0a 20 20 20 20 28  "summer")).    (
7ae0: 6c 65 74 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d  let* ((new-test-
7af0: 70 61 74 68 20 28 73 74 72 69 6e 67 2d 69 6e 74  path (string-int
7b00: 65 72 73 70 65 72 73 65 20 28 63 6f 6e 73 20 74  ersperse (cons t
7b10: 65 73 74 2d 70 61 74 68 20 28 6d 61 70 20 63 61  est-path (map ca
7b20: 64 72 20 69 74 65 6d 64 61 74 29 29 20 22 2f 22  dr itemdat)) "/"
7b30: 29 29 0a 09 20 20 20 28 6e 65 77 2d 74 65 73 74  ))..   (new-test
7b40: 2d 6e 61 6d 65 20 28 69 66 20 28 65 71 75 61 6c  -name (if (equal
7b50: 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 20  ? item-path "") 
7b60: 74 65 73 74 2d 6e 61 6d 65 20 28 63 6f 6e 63 20  test-name (conc 
7b70: 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74  test-name "/" it
7b80: 65 6d 2d 70 61 74 68 29 29 29 20 3b 3b 20 6a 75  em-path))) ;; ju
7b90: 73 74 20 6e 65 65 64 20 69 74 20 74 6f 20 62 65  st need it to be
7ba0: 20 75 6e 69 71 75 65 0a 09 20 20 20 28 74 65 73   unique..   (tes
7bb0: 74 2d 69 64 20 20 20 20 20 20 20 28 63 64 62 3a  t-id       (cdb:
7bc0: 72 65 6d 6f 74 65 2d 72 75 6e 20 64 62 3a 67 65  remote-run db:ge
7bd0: 74 2d 74 65 73 74 2d 69 64 20 23 66 20 20 72 75  t-test-id #f  ru
7be0: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69  n-id test-name i
7bf0: 74 65 6d 2d 70 61 74 68 29 29 0a 09 20 20 20 28  tem-path))..   (
7c00: 74 65 73 74 64 61 74 20 20 20 20 20 20 20 28 63  testdat       (c
7c10: 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f  db:get-test-info
7c20: 2d 62 79 2d 69 64 20 2a 72 75 6e 72 65 6d 6f 74  -by-id *runremot
7c30: 65 2a 20 74 65 73 74 2d 69 64 29 29 29 0a 20 20  e* test-id))).  
7c40: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 74 65 73      (if (not tes
7c50: 74 64 61 74 29 0a 09 20 20 28 62 65 67 69 6e 0a  tdat)..  (begin.
7c60: 09 20 20 20 20 3b 3b 20 65 6e 73 75 72 65 20 74  .    ;; ensure t
7c70: 68 61 74 20 74 68 65 20 70 61 74 68 20 65 78 69  hat the path exi
7c80: 73 74 73 20 62 65 66 6f 72 65 20 72 65 67 69 73  sts before regis
7c90: 74 65 72 69 6e 67 20 74 68 65 20 74 65 73 74 0a  tering the test.
7ca0: 09 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 43 61  .    ;; NOPE: Ca
7cb0: 6e 6e 6f 74 21 20 44 6f 6e 27 74 20 6b 6e 6f 77  nnot! Don't know
7cc0: 20 79 65 74 20 77 68 69 63 68 20 64 69 73 6b 20   yet which disk 
7cd0: 61 72 65 61 20 77 69 6c 6c 20 62 65 20 61 73 73  area will be ass
7ce0: 69 67 6e 65 64 2e 2e 2e 2e 0a 09 20 20 20 20 3b  igned......    ;
7cf0: 3b 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20  ; (system (conc 
7d00: 22 6d 6b 64 69 72 20 2d 70 20 22 20 6e 65 77 2d  "mkdir -p " new-
7d10: 74 65 73 74 2d 70 61 74 68 29 29 0a 09 20 20 20  test-path))..   
7d20: 20 3b 3b 0a 09 20 20 20 20 3b 3b 20 28 6f 70 65   ;;..    ;; (ope
7d30: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 74 65 73 74  n-run-close test
7d40: 73 3a 72 65 67 69 73 74 65 72 2d 74 65 73 74 20  s:register-test 
7d50: 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e  db run-id test-n
7d60: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 09  ame item-path)..
7d70: 20 20 20 20 3b 3b 0a 09 20 20 20 20 3b 3b 20 4e      ;;..    ;; N
7d80: 42 2f 2f 20 66 6f 72 20 74 68 65 20 61 62 6f 76  B// for the abov
7d90: 65 20 6c 69 6e 65 2e 20 49 20 77 61 6e 74 20 74  e line. I want t
7da0: 68 65 20 74 65 73 74 20 74 6f 20 62 65 20 72 65  he test to be re
7db0: 67 69 73 74 65 72 65 64 20 6c 6f 6e 67 20 62 65  gistered long be
7dc0: 66 6f 72 65 20 74 68 69 73 20 72 6f 75 74 69 6e  fore this routin
7dd0: 65 20 67 65 74 73 20 63 61 6c 6c 65 64 21 0a 09  e gets called!..
7de0: 20 20 20 20 3b 3b 0a 09 20 20 20 20 28 73 65 74      ;;..    (set
7df0: 21 20 74 65 73 74 2d 69 64 20 28 6f 70 65 6e 2d  ! test-id (open-
7e00: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
7e10: 2d 74 65 73 74 2d 69 64 20 64 62 20 72 75 6e 2d  -test-id db run-
7e20: 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65  id test-name ite
7e30: 6d 2d 70 61 74 68 29 29 0a 09 20 20 20 20 28 69  m-path))..    (i
7e40: 66 20 28 6e 6f 74 20 74 65 73 74 2d 69 64 29 0a  f (not test-id).
7e50: 09 09 28 62 65 67 69 6e 0a 09 09 20 20 28 64 65  ..(begin...  (de
7e60: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 57 41 52  bug:print 2 "WAR
7e70: 4e 3a 20 54 65 73 74 20 6e 6f 74 20 70 72 65 2d  N: Test not pre-
7e80: 63 72 65 61 74 65 64 3f 20 74 65 73 74 2d 6e 61  created? test-na
7e90: 6d 65 3d 22 20 74 65 73 74 2d 6e 61 6d 65 20 22  me=" test-name "
7ea0: 2c 20 69 74 65 6d 2d 70 61 74 68 3d 22 20 69 74  , item-path=" it
7eb0: 65 6d 2d 70 61 74 68 20 22 2c 20 72 75 6e 2d 69  em-path ", run-i
7ec0: 64 3d 22 20 72 75 6e 2d 69 64 29 0a 09 09 20 20  d=" run-id)...  
7ed0: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
7ee0: 64 62 3a 74 65 73 74 73 2d 72 65 67 69 73 74 65  db:tests-registe
7ef0: 72 2d 74 65 73 74 20 23 66 20 72 75 6e 2d 69 64  r-test #f run-id
7f00: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d   test-name item-
7f10: 70 61 74 68 29 0a 09 09 20 20 28 73 65 74 21 20  path)...  (set! 
7f20: 74 65 73 74 2d 69 64 20 28 6f 70 65 6e 2d 72 75  test-id (open-ru
7f30: 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74  n-close db:get-t
7f40: 65 73 74 2d 69 64 20 64 62 20 72 75 6e 2d 69 64  est-id db run-id
7f50: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d   test-name item-
7f60: 70 61 74 68 29 29 29 29 0a 09 20 20 20 20 28 64  path))))..    (d
7f70: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
7f80: 34 20 22 74 65 73 74 2d 69 64 3d 22 20 74 65 73  4 "test-id=" tes
7f90: 74 2d 69 64 20 22 2c 20 72 75 6e 2d 69 64 3d 22  t-id ", run-id="
7fa0: 20 72 75 6e 2d 69 64 20 22 2c 20 74 65 73 74 2d   run-id ", test-
7fb0: 6e 61 6d 65 3d 22 20 74 65 73 74 2d 6e 61 6d 65  name=" test-name
7fc0: 20 22 2c 20 69 74 65 6d 2d 70 61 74 68 3d 5c 22   ", item-path=\"
7fd0: 22 20 69 74 65 6d 2d 70 61 74 68 20 22 5c 22 22  " item-path "\""
7fe0: 29 0a 09 20 20 20 20 28 73 65 74 21 20 74 65 73  )..    (set! tes
7ff0: 74 64 61 74 20 28 63 64 62 3a 67 65 74 2d 74 65  tdat (cdb:get-te
8000: 73 74 2d 69 6e 66 6f 2d 62 79 2d 69 64 20 2a 72  st-info-by-id *r
8010: 75 6e 72 65 6d 6f 74 65 2a 20 74 65 73 74 2d 69  unremote* test-i
8020: 64 29 29 29 29 0a 20 20 20 20 20 20 28 73 65 74  d)))).      (set
8030: 21 20 74 65 73 74 2d 69 64 20 28 64 62 3a 74 65  ! test-id (db:te
8040: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61  st-get-id testda
8050: 74 29 29 0a 20 20 20 20 20 20 28 63 68 61 6e 67  t)).      (chang
8060: 65 2d 64 69 72 65 63 74 6f 72 79 20 74 65 73 74  e-directory test
8070: 2d 70 61 74 68 29 0a 20 20 20 20 20 20 28 63 61  -path).      (ca
8080: 73 65 20 28 69 66 20 66 6f 72 63 65 20 3b 3b 20  se (if force ;; 
8090: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
80a0: 66 6f 72 63 65 22 29 0a 09 09 27 4e 4f 54 5f 53  force")...'NOT_S
80b0: 54 41 52 54 45 44 0a 09 09 28 69 66 20 74 65 73  TARTED...(if tes
80c0: 74 64 61 74 0a 09 09 20 20 20 20 28 73 74 72 69  tdat...    (stri
80d0: 6e 67 2d 3e 73 79 6d 62 6f 6c 20 28 74 65 73 74  ng->symbol (test
80e0: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64  :get-state testd
80f0: 61 74 29 29 0a 09 09 20 20 20 20 27 66 61 69 6c  at))...    'fail
8100: 65 64 2d 74 6f 2d 69 6e 73 65 72 74 29 29 0a 09  ed-to-insert))..
8110: 28 28 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65  ((failed-to-inse
8120: 72 74 29 0a 09 20 28 64 65 62 75 67 3a 70 72 69  rt).. (debug:pri
8130: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 46 61 69  nt 0 "ERROR: Fai
8140: 6c 65 64 20 74 6f 20 69 6e 73 65 72 74 20 74 68  led to insert th
8150: 65 20 72 65 63 6f 72 64 20 69 6e 74 6f 20 74 68  e record into th
8160: 65 20 64 62 22 29 29 0a 09 28 28 4e 4f 54 5f 53  e db"))..((NOT_S
8170: 54 41 52 54 45 44 20 43 4f 4d 50 4c 45 54 45 44  TARTED COMPLETED
8180: 20 44 45 4c 45 54 45 44 29 0a 09 20 28 6c 65 74   DELETED).. (let
8190: 20 28 28 72 75 6e 66 6c 61 67 20 23 66 29 29 0a   ((runflag #f)).
81a0: 09 20 20 20 28 63 6f 6e 64 0a 09 20 20 20 20 3b  .   (cond..    ;
81b0: 3b 20 2d 66 6f 72 63 65 2c 20 72 75 6e 20 6e 6f  ; -force, run no
81c0: 20 6d 61 74 74 65 72 20 77 68 61 74 0a 09 20 20   matter what..  
81d0: 20 20 28 66 6f 72 63 65 20 28 73 65 74 21 20 72    (force (set! r
81e0: 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20  unflag #t))..   
81f0: 20 3b 3b 20 4e 4f 54 5f 53 54 41 52 54 45 44 2c   ;; NOT_STARTED,
8200: 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77   run no matter w
8210: 68 61 74 0a 09 20 20 20 20 28 28 6d 65 6d 62 65  hat..    ((membe
8220: 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  r (test:get-stat
8230: 65 20 74 65 73 74 64 61 74 29 20 27 28 22 44 45  e testdat) '("DE
8240: 4c 45 54 45 44 22 20 22 4e 4f 54 5f 53 54 41 52  LETED" "NOT_STAR
8250: 54 45 44 22 29 29 28 73 65 74 21 20 72 75 6e 66  TED"))(set! runf
8260: 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b 3b  lag #t))..    ;;
8270: 20 6e 6f 74 20 2d 72 65 72 75 6e 20 61 6e 64 20   not -rerun and 
8280: 50 41 53 53 2c 20 57 41 52 4e 20 6f 72 20 43 48  PASS, WARN or CH
8290: 45 43 4b 2c 20 64 6f 20 6e 6f 20 72 75 6e 0a 09  ECK, do no run..
82a0: 20 20 20 20 28 28 61 6e 64 20 28 6f 72 20 28 6e      ((and (or (n
82b0: 6f 74 20 72 65 72 75 6e 29 0a 09 09 20 20 20 20  ot rerun)...    
82c0: 20 20 6b 65 65 70 67 6f 69 6e 67 29 0a 09 09 20    keepgoing)... 
82d0: 20 3b 3b 20 52 65 71 75 69 72 65 20 74 6f 20 66   ;; Require to f
82e0: 6f 72 63 65 20 72 65 2d 72 75 6e 20 66 6f 72 20  orce re-run for 
82f0: 43 4f 4d 50 4c 45 54 45 44 20 6f 72 20 2a 61 6e  COMPLETED or *an
8300: 79 74 68 69 6e 67 2a 20 2b 20 50 41 53 53 2c 57  ything* + PASS,W
8310: 41 52 4e 20 6f 72 20 43 48 45 43 4b 0a 09 09 20  ARN or CHECK... 
8320: 20 28 6f 72 20 28 6d 65 6d 62 65 72 20 28 74 65   (or (member (te
8330: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65  st:get-status te
8340: 73 74 64 61 74 29 20 27 28 22 50 41 53 53 22 20  stdat) '("PASS" 
8350: 22 57 41 52 4e 22 20 22 43 48 45 43 4b 22 20 22  "WARN" "CHECK" "
8360: 53 4b 49 50 22 29 29 0a 09 09 20 20 20 20 20 20  SKIP"))...      
8370: 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65  (member (test:ge
8380: 74 2d 73 74 61 74 65 20 20 74 65 73 74 64 61 74  t-state  testdat
8390: 29 20 27 28 22 43 4f 4d 50 4c 45 54 45 44 22 29  ) '("COMPLETED")
83a0: 29 29 29 20 0a 09 20 20 20 20 20 28 64 65 62 75  ))) ..     (debu
83b0: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 32 20 22  g:print-info 2 "
83c0: 72 75 6e 6e 69 6e 67 20 74 65 73 74 20 22 20 74  running test " t
83d0: 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65  est-name "/" ite
83e0: 6d 2d 70 61 74 68 20 22 20 73 75 70 70 72 65 73  m-path " suppres
83f0: 73 65 64 20 61 73 20 69 74 20 69 73 20 22 20 28  sed as it is " (
8400: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74  test:get-state t
8410: 65 73 74 64 61 74 29 20 22 20 61 6e 64 20 22 20  estdat) " and " 
8420: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73  (test:get-status
8430: 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20   testdat))..    
8440: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23   (set! runflag #
8450: 66 29 29 0a 09 20 20 20 20 3b 3b 20 2d 72 65 72  f))..    ;; -rer
8460: 75 6e 20 61 6e 64 20 73 74 61 74 75 73 20 69 73  un and status is
8470: 20 6f 6e 65 20 6f 66 20 74 68 65 20 73 70 65 63   one of the spec
8480: 69 66 65 64 2c 20 72 75 6e 20 69 74 0a 09 20 20  ifed, run it..  
8490: 20 20 28 28 61 6e 64 20 72 65 72 75 6e 0a 09 09    ((and rerun...
84a0: 20 20 28 6c 65 74 2a 20 28 28 72 65 72 75 6e 6c    (let* ((rerunl
84b0: 73 74 20 20 20 28 73 74 72 69 6e 67 2d 73 70 6c  st   (string-spl
84c0: 69 74 20 72 65 72 75 6e 20 22 2c 22 29 29 0a 09  it rerun ","))..
84d0: 09 09 20 28 6d 75 73 74 2d 72 65 72 75 6e 20 28  .. (must-rerun (
84e0: 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74  member (test:get
84f0: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29  -status testdat)
8500: 20 72 65 72 75 6e 6c 73 74 29 29 29 0a 09 09 20   rerunlst)))... 
8510: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d     (debug:print-
8520: 69 6e 66 6f 20 33 20 22 2d 72 65 72 75 6e 20 6c  info 3 "-rerun l
8530: 69 73 74 3a 20 22 20 72 65 72 75 6e 20 22 2c 20  ist: " rerun ", 
8540: 74 65 73 74 2d 73 74 61 74 75 73 3a 20 22 20 28  test-status: " (
8550: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20  test:get-status 
8560: 74 65 73 74 64 61 74 29 22 2c 20 6d 75 73 74 2d  testdat)", must-
8570: 72 65 72 75 6e 3a 20 22 20 6d 75 73 74 2d 72 65  rerun: " must-re
8580: 72 75 6e 29 0a 09 09 20 20 20 20 6d 75 73 74 2d  run)...    must-
8590: 72 65 72 75 6e 29 29 0a 09 20 20 20 20 20 28 64  rerun))..     (d
85a0: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
85b0: 32 20 22 52 65 72 75 6e 20 66 6f 72 63 65 64 20  2 "Rerun forced 
85c0: 66 6f 72 20 74 65 73 74 20 22 20 74 65 73 74 2d  for test " test-
85d0: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61  name "/" item-pa
85e0: 74 68 29 0a 09 20 20 20 20 20 28 73 65 74 21 20  th)..     (set! 
85f0: 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20  runflag #t))..  
8600: 20 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 2c    ;; -keepgoing,
8610: 20 64 6f 20 6e 6f 74 20 72 65 72 75 6e 20 46 41   do not rerun FA
8620: 49 4c 0a 09 20 20 20 20 28 28 61 6e 64 20 6b 65  IL..    ((and ke
8630: 65 70 67 6f 69 6e 67 0a 09 09 20 20 28 6d 65 6d  epgoing...  (mem
8640: 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74  ber (test:get-st
8650: 61 74 75 73 20 74 65 73 74 64 61 74 29 20 27 28  atus testdat) '(
8660: 22 46 41 49 4c 22 29 29 29 0a 09 20 20 20 20 20  "FAIL")))..     
8670: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66  (set! runflag #f
8680: 29 29 0a 09 20 20 20 20 28 28 61 6e 64 20 28 6e  ))..    ((and (n
8690: 6f 74 20 72 65 72 75 6e 29 0a 09 09 20 20 28 6d  ot rerun)...  (m
86a0: 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d  ember (test:get-
86b0: 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20  status testdat) 
86c0: 27 28 22 46 41 49 4c 22 20 22 6e 2f 61 22 29 29  '("FAIL" "n/a"))
86d0: 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 75  )..     (set! ru
86e0: 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20  nflag #t))..    
86f0: 28 65 6c 73 65 20 28 73 65 74 21 20 72 75 6e 66  (else (set! runf
8700: 6c 61 67 20 23 66 29 29 29 0a 09 20 20 20 28 64  lag #f)))..   (d
8710: 65 62 75 67 3a 70 72 69 6e 74 20 36 20 22 52 55  ebug:print 6 "RU
8720: 4e 4e 49 4e 47 20 3d 3e 20 72 75 6e 66 6c 61 67  NNING => runflag
8730: 3a 20 22 20 72 75 6e 66 6c 61 67 20 22 20 53 54  : " runflag " ST
8740: 41 54 45 3a 20 22 20 28 74 65 73 74 3a 67 65 74  ATE: " (test:get
8750: 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 20  -state testdat) 
8760: 22 20 53 54 41 54 55 53 3a 20 22 20 28 74 65 73  " STATUS: " (tes
8770: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73  t:get-status tes
8780: 74 64 61 74 29 29 0a 09 20 20 20 28 69 66 20 28  tdat))..   (if (
8790: 6e 6f 74 20 72 75 6e 66 6c 61 67 29 0a 09 20 20  not runflag)..  
87a0: 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 70 61       (if (not pa
87b0: 72 65 6e 74 2d 74 65 73 74 29 0a 09 09 20 20 20  rent-test)...   
87c0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22  (debug:print 1 "
87d0: 4e 4f 54 45 3a 20 4e 6f 74 20 73 74 61 72 74 69  NOTE: Not starti
87e0: 6e 67 20 74 65 73 74 20 22 20 6e 65 77 2d 74 65  ng test " new-te
87f0: 73 74 2d 6e 61 6d 65 20 22 20 61 73 20 69 74 20  st-name " as it 
8800: 69 73 20 73 74 61 74 65 20 5c 22 22 20 28 74 65  is state \"" (te
8810: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73  st:get-state tes
8820: 74 64 61 74 29 20 0a 09 09 09 09 22 5c 22 20 61  tdat) ....."\" a
8830: 6e 64 20 73 74 61 74 75 73 20 5c 22 22 20 28 74  nd status \"" (t
8840: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74  est:get-status t
8850: 65 73 74 64 61 74 29 20 22 5c 22 2c 20 75 73 65  estdat) "\", use
8860: 20 2d 72 65 72 75 6e 20 5c 22 22 20 28 74 65 73   -rerun \"" (tes
8870: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73  t:get-status tes
8880: 74 64 61 74 29 0a 20 20 20 20 20 20 20 20 20 20  tdat).          
8890: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
88a0: 20 20 20 20 20 20 22 5c 22 20 6f 72 20 2d 66 6f        "\" or -fo
88b0: 72 63 65 20 74 6f 20 6f 76 65 72 72 69 64 65 22  rce to override"
88c0: 29 29 0a 09 20 20 20 20 20 20 20 3b 3b 20 4e 4f  ))..       ;; NO
88d0: 54 45 3a 20 4e 6f 20 6c 6f 6e 67 65 72 20 62 65  TE: No longer be
88e0: 20 63 68 65 63 6b 69 6e 67 20 70 72 65 72 65 71   checking prereq
88f0: 75 69 73 69 74 65 73 20 68 65 72 65 21 20 57 69  uisites here! Wi
8900: 6c 6c 20 6e 65 76 65 72 20 67 65 74 20 68 65 72  ll never get her
8910: 65 20 75 6e 6c 65 73 73 20 70 72 65 72 65 71 73  e unless prereqs
8920: 20 61 72 65 0a 09 20 20 20 20 20 20 20 3b 3b 20   are..       ;; 
8930: 20 20 20 20 20 20 61 6c 72 65 61 64 79 20 6d 65        already me
8940: 74 2e 0a 09 20 20 20 20 20 20 20 28 69 66 20 28  t...       (if (
8950: 6e 6f 74 20 28 6c 61 75 6e 63 68 2d 74 65 73 74  not (launch-test
8960: 20 23 66 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61   #f run-id runna
8970: 6d 65 20 74 65 73 74 2d 63 6f 6e 66 20 6b 65 79  me test-conf key
8980: 76 61 6c 6c 73 74 20 74 65 73 74 2d 6e 61 6d 65  vallst test-name
8990: 20 74 65 73 74 2d 70 61 74 68 20 69 74 65 6d 64   test-path itemd
89a0: 61 74 20 66 6c 61 67 73 29 29 0a 09 09 20 20 20  at flags))...   
89b0: 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20 28 70  (begin...     (p
89c0: 72 69 6e 74 20 22 45 52 52 4f 52 3a 20 46 61 69  rint "ERROR: Fai
89d0: 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 68  led to launch th
89e0: 65 20 74 65 73 74 2e 20 45 78 69 74 69 6e 67 20  e test. Exiting 
89f0: 61 73 20 73 6f 6f 6e 20 61 73 20 70 6f 73 73 69  as soon as possi
8a00: 62 6c 65 22 29 0a 09 09 20 20 20 20 20 28 73 65  ble")...     (se
8a10: 74 21 20 2a 67 6c 6f 62 61 6c 65 78 69 74 73 74  t! *globalexitst
8a20: 61 74 75 73 2a 20 31 29 20 3b 3b 20 0a 09 09 20  atus* 1) ;; ... 
8a30: 20 20 20 20 28 70 72 6f 63 65 73 73 2d 73 69 67      (process-sig
8a40: 6e 61 6c 20 28 63 75 72 72 65 6e 74 2d 70 72 6f  nal (current-pro
8a50: 63 65 73 73 2d 69 64 29 20 73 69 67 6e 61 6c 2f  cess-id) signal/
8a60: 6b 69 6c 6c 29 29 29 29 29 29 0a 09 28 28 4b 49  kill))))))..((KI
8a70: 4c 4c 45 44 29 20 0a 09 20 28 64 65 62 75 67 3a  LLED) .. (debug:
8a80: 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 22  print 1 "NOTE: "
8a90: 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22   new-test-name "
8aa0: 20 69 73 20 61 6c 72 65 61 64 79 20 72 75 6e 6e   is already runn
8ab0: 69 6e 67 20 6f 72 20 77 61 73 20 65 78 70 6c 69  ing or was expli
8ac0: 63 74 6c 79 20 6b 69 6c 6c 65 64 2c 20 75 73 65  ctly killed, use
8ad0: 20 2d 66 6f 72 63 65 20 74 6f 20 6c 61 75 6e 63   -force to launc
8ae0: 68 20 69 74 2e 22 29 29 0a 09 28 28 4c 41 55 4e  h it."))..((LAUN
8af0: 43 48 45 44 20 52 45 4d 4f 54 45 48 4f 53 54 53  CHED REMOTEHOSTS
8b00: 54 41 52 54 20 52 55 4e 4e 49 4e 47 29 20 20 0a  TART RUNNING)  .
8b10: 09 20 28 69 66 20 28 3e 20 28 2d 20 28 63 75 72  . (if (> (- (cur
8b20: 72 65 6e 74 2d 73 65 63 6f 6e 64 73 29 28 2b 20  rent-seconds)(+ 
8b30: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 65 76 65  (db:test-get-eve
8b40: 6e 74 5f 74 69 6d 65 20 74 65 73 74 64 61 74 29  nt_time testdat)
8b50: 0a 09 09 09 09 20 20 20 20 20 20 20 28 64 62 3a  .....       (db:
8b60: 74 65 73 74 2d 67 65 74 2d 72 75 6e 5f 64 75 72  test-get-run_dur
8b70: 61 74 69 6f 6e 20 74 65 73 74 64 61 74 29 29 29  ation testdat)))
8b80: 0a 09 09 36 30 30 29 20 3b 3b 20 69 2e 65 2e 20  ...600) ;; i.e. 
8b90: 6e 6f 20 75 70 64 61 74 65 20 66 6f 72 20 6d 6f  no update for mo
8ba0: 72 65 20 74 68 61 6e 20 36 30 30 20 73 65 63 6f  re than 600 seco
8bb0: 6e 64 73 0a 09 20 20 20 20 20 28 62 65 67 69 6e  nds..     (begin
8bc0: 0a 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a  ..       (debug:
8bd0: 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47  print 0 "WARNING
8be0: 3a 20 54 65 73 74 20 22 20 74 65 73 74 2d 6e 61  : Test " test-na
8bf0: 6d 65 20 22 20 61 70 70 65 61 72 73 20 74 6f 20  me " appears to 
8c00: 62 65 20 64 65 61 64 2e 20 46 6f 72 63 69 6e 67  be dead. Forcing
8c10: 20 69 74 20 74 6f 20 73 74 61 74 65 20 49 4e 43   it to state INC
8c20: 4f 4d 50 4c 45 54 45 20 61 6e 64 20 73 74 61 74  OMPLETE and stat
8c30: 75 73 20 53 54 55 43 4b 2f 44 45 41 44 22 29 0a  us STUCK/DEAD").
8c40: 09 20 20 20 20 20 20 20 28 74 65 73 74 73 3a 74  .       (tests:t
8c50: 65 73 74 2d 73 65 74 2d 73 74 61 74 75 73 21 20  est-set-status! 
8c60: 74 65 73 74 2d 69 64 20 22 49 4e 43 4f 4d 50 4c  test-id "INCOMPL
8c70: 45 54 45 22 20 22 53 54 55 43 4b 2f 44 45 41 44  ETE" "STUCK/DEAD
8c80: 22 20 22 54 65 73 74 20 69 73 20 73 74 75 63 6b  " "Test is stuck
8c90: 20 6f 72 20 64 65 61 64 22 20 23 66 29 29 0a 09   or dead" #f))..
8ca0: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
8cb0: 74 20 32 20 22 4e 4f 54 45 3a 20 22 20 74 65 73  t 2 "NOTE: " tes
8cc0: 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72 65  t-name " is alre
8cd0: 61 64 79 20 72 75 6e 6e 69 6e 67 22 29 29 29 0a  ady running"))).
8ce0: 09 28 65 6c 73 65 20 20 20 20 20 20 20 28 64 65  .(else       (de
8cf0: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52  bug:print 0 "ERR
8d00: 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c 61  OR: Failed to la
8d10: 75 6e 63 68 20 74 65 73 74 20 22 20 6e 65 77 2d  unch test " new-
8d20: 74 65 73 74 2d 6e 61 6d 65 20 22 2e 20 55 6e 72  test-name ". Unr
8d30: 65 63 6f 67 6e 69 73 65 64 20 73 74 61 74 65 20  ecognised state 
8d40: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  " (test:get-stat
8d50: 65 20 74 65 73 74 64 61 74 29 29 29 29 29 29 29  e testdat)))))))
8d60: 0a 0a 3b 3b 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 3d 3d 3d 3d 3d  ================
8d90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8da0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 45 4e  ==========.;; EN
8db0: 44 20 4f 46 20 4e 45 57 20 53 54 55 46 46 0a 3b  D OF NEW STUFF.;
8dc0: 3b 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 3d 3d 3d 3d 3d 3d 3d 3d  ================
8df0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8e00: 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65  =======..(define
8e10: 20 28 67 65 74 2d 64 69 72 2d 75 70 2d 6e 20 64   (get-dir-up-n d
8e20: 69 72 20 2e 20 70 61 72 61 6d 73 29 20 0a 20 20  ir . params) .  
8e30: 28 6c 65 74 20 28 28 64 70 61 72 74 73 20 20 28  (let ((dparts  (
8e40: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 64 69 72  string-split dir
8e50: 20 22 2f 22 29 29 0a 09 28 63 6f 75 6e 74 20 20   "/"))..(count  
8e60: 20 28 69 66 20 28 6e 75 6c 6c 3f 20 70 61 72 61   (if (null? para
8e70: 6d 73 29 20 31 20 28 63 61 72 20 70 61 72 61 6d  ms) 1 (car param
8e80: 73 29 29 29 29 0a 20 20 20 20 28 63 6f 6e 63 20  s)))).    (conc 
8e90: 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 65  "/" (string-inte
8ea0: 72 73 70 65 72 73 65 20 0a 09 20 20 20 20 20 20  rsperse ..      
8eb0: 20 28 74 61 6b 65 20 64 70 61 72 74 73 20 28 2d   (take dparts (-
8ec0: 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73 29   (length dparts)
8ed0: 20 63 6f 75 6e 74 29 29 0a 09 20 20 20 20 20 20   count))..      
8ee0: 20 22 2f 22 29 29 29 29 0a 3b 3b 20 52 65 6d 6f   "/")))).;; Remo
8ef0: 76 65 20 72 75 6e 73 0a 3b 3b 20 66 69 65 6c 64  ve runs.;; field
8f00: 73 20 61 72 65 20 70 61 73 73 69 6e 67 20 69 6e  s are passing in
8f10: 20 74 68 72 6f 75 67 68 20 0a 3b 3b 20 61 63 74   through .;; act
8f20: 69 6f 6e 3a 0a 3b 3b 20 20 20 20 27 72 65 6d 6f  ion:.;;    'remo
8f30: 76 65 2d 72 75 6e 73 0a 3b 3b 20 20 20 20 27 73  ve-runs.;;    's
8f40: 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73 0a  et-state-status.
8f50: 3b 3b 0a 3b 3b 20 4e 42 2f 2f 20 73 68 6f 75 6c  ;;.;; NB// shoul
8f60: 64 20 70 61 73 73 20 69 6e 20 6b 65 79 73 3f 0a  d pass in keys?.
8f70: 3b 3b 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73  ;;.(define (runs
8f80: 3a 6f 70 65 72 61 74 65 2d 6f 6e 20 61 63 74 69  :operate-on acti
8f90: 6f 6e 20 72 75 6e 6e 61 6d 65 70 61 74 74 20 74  on runnamepatt t
8fa0: 65 73 74 70 61 74 74 20 23 21 6b 65 79 20 28 73  estpatt #!key (s
8fb0: 74 61 74 65 20 23 66 29 28 73 74 61 74 75 73 20  tate #f)(status 
8fc0: 23 66 29 28 6e 65 77 2d 73 74 61 74 65 2d 73 74  #f)(new-state-st
8fd0: 61 74 75 73 20 23 66 29 29 0a 20 20 28 63 6f 6d  atus #f)).  (com
8fe0: 6d 6f 6e 3a 63 6c 65 61 72 2d 63 61 63 68 65 73  mon:clear-caches
8ff0: 29 20 3b 3b 20 63 6c 65 61 72 20 61 6c 6c 20 63  ) ;; clear all c
9000: 61 63 68 65 73 0a 20 20 28 6c 65 74 2a 20 28 28  aches.  (let* ((
9010: 64 62 20 20 20 20 20 20 20 20 20 20 20 23 66 29  db           #f)
9020: 0a 09 20 28 6b 65 79 73 20 20 20 20 20 20 20 20  .. (keys        
9030: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
9040: 20 64 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 29   db:get-keys db)
9050: 29 0a 09 20 28 72 75 6e 64 61 74 20 20 20 20 20  ).. (rundat     
9060: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73    (open-run-clos
9070: 65 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d  e runs:get-runs-
9080: 62 79 2d 70 61 74 74 20 64 62 20 6b 65 79 73 20  by-patt db keys 
9090: 72 75 6e 6e 61 6d 65 70 61 74 74 29 29 0a 09 20  runnamepatt)).. 
90a0: 28 68 65 61 64 65 72 20 20 20 20 20 20 20 28 76  (header       (v
90b0: 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74  ector-ref rundat
90c0: 20 30 29 29 0a 09 20 28 72 75 6e 73 20 20 20 20   0)).. (runs    
90d0: 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66       (vector-ref
90e0: 20 72 75 6e 64 61 74 20 31 29 29 0a 09 20 28 73   rundat 1)).. (s
90f0: 74 61 74 65 73 20 20 20 20 20 20 20 28 69 66 20  tates       (if 
9100: 73 74 61 74 65 20 20 28 73 74 72 69 6e 67 2d 73  state  (string-s
9110: 70 6c 69 74 20 73 74 61 74 65 20 20 22 2c 22 29  plit state  ",")
9120: 20 27 28 29 29 29 0a 09 20 28 73 74 61 74 75 73   '())).. (status
9130: 65 73 20 20 20 20 20 28 69 66 20 73 74 61 74 75  es     (if statu
9140: 73 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20  s (string-split 
9150: 73 74 61 74 75 73 20 22 2c 22 29 20 27 28 29 29  status ",") '())
9160: 29 0a 09 20 28 73 74 61 74 65 2d 73 74 61 74 75  ).. (state-statu
9170: 73 20 28 69 66 20 28 73 74 72 69 6e 67 3f 20 6e  s (if (string? n
9180: 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73 29  ew-state-status)
9190: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 6e   (string-split n
91a0: 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73 20  ew-state-status 
91b0: 22 2c 22 29 20 27 28 23 66 20 23 66 29 29 29 29  ",") '(#f #f))))
91c0: 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  .    (debug:prin
91d0: 74 2d 69 6e 66 6f 20 34 20 22 72 75 6e 73 3a 6f  t-info 4 "runs:o
91e0: 70 65 72 61 74 65 2d 6f 6e 20 3d 3e 20 48 65 61  perate-on => Hea
91f0: 64 65 72 3a 20 22 20 68 65 61 64 65 72 20 22 20  der: " header " 
9200: 61 63 74 69 6f 6e 3a 20 22 20 61 63 74 69 6f 6e  action: " action
9210: 20 22 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61   " new-state-sta
9220: 74 75 73 3a 20 22 20 6e 65 77 2d 73 74 61 74 65  tus: " new-state
9230: 2d 73 74 61 74 75 73 29 0a 20 20 20 20 28 69 66  -status).    (if
9240: 20 28 3e 20 32 20 28 6c 65 6e 67 74 68 20 73 74   (> 2 (length st
9250: 61 74 65 2d 73 74 61 74 75 73 29 29 0a 09 28 62  ate-status))..(b
9260: 65 67 69 6e 0a 09 20 20 28 64 65 62 75 67 3a 70  egin..  (debug:p
9270: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 74  rint 0 "ERROR: t
9280: 68 65 20 70 61 72 61 6d 65 74 65 72 20 74 6f 20  he parameter to 
9290: 2d 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75  -set-state-statu
92a0: 73 20 69 73 20 61 20 63 6f 6d 6d 61 20 64 65 6c  s is a comma del
92b0: 69 6d 69 74 65 64 20 73 74 72 69 6e 67 2e 20 45  imited string. E
92c0: 2e 67 2e 20 43 4f 4d 50 4c 45 54 45 44 2c 46 41  .g. COMPLETED,FA
92d0: 49 4c 22 29 0a 09 20 20 28 65 78 69 74 29 29 29  IL")..  (exit)))
92e0: 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 20  .    (for-each. 
92f0: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 72 75 6e      (lambda (run
9300: 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28  ).       (let ((
9310: 72 75 6e 6b 65 79 20 28 73 74 72 69 6e 67 2d 69  runkey (string-i
9320: 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61 70 20  ntersperse (map 
9330: 28 6c 61 6d 62 64 61 20 28 6b 29 0a 09 09 09 09  (lambda (k).....
9340: 09 09 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d  ..(db:get-value-
9350: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65  by-header run he
9360: 61 64 65 72 20 28 76 65 63 74 6f 72 2d 72 65 66  ader (vector-ref
9370: 20 6b 20 30 29 29 29 20 6b 65 79 73 29 20 22 2f   k 0))) keys) "/
9380: 22 29 29 0a 09 20 20 20 20 20 28 64 69 72 73 2d  "))..     (dirs-
9390: 74 6f 2d 72 65 6d 6f 76 65 20 28 6d 61 6b 65 2d  to-remove (make-
93a0: 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 09 20  hash-table))).. 
93b0: 28 6c 65 74 2a 20 28 28 72 75 6e 2d 69 64 20 20  (let* ((run-id  
93c0: 20 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d    (db:get-value-
93d0: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65  by-header run he
93e0: 61 64 65 72 20 22 69 64 22 29 29 0a 09 09 28 72  ader "id"))...(r
93f0: 75 6e 2d 73 74 61 74 65 20 28 64 62 3a 67 65 74  un-state (db:get
9400: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72  -value-by-header
9410: 20 72 75 6e 20 68 65 61 64 65 72 20 22 73 74 61   run header "sta
9420: 74 65 22 29 29 0a 09 09 28 74 65 73 74 73 20 20  te"))...(tests  
9430: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 65 71 75     (if (not (equ
9440: 61 6c 3f 20 72 75 6e 2d 73 74 61 74 65 20 22 6c  al? run-state "l
9450: 6f 63 6b 65 64 22 29 29 0a 09 09 09 20 20 20 20  ocked"))....    
9460: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f     (open-run-clo
9470: 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 73 2d  se db:get-tests-
9480: 66 6f 72 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69  for-run db run-i
9490: 64 0a 09 09 09 09 09 09 20 20 20 20 20 20 74 65  d.......      te
94a0: 73 74 70 61 74 74 20 73 74 61 74 65 73 20 73 74  stpatt states st
94b0: 61 74 75 73 65 73 0a 09 09 09 09 09 09 20 20 20  atuses.......   
94c0: 20 20 20 6e 6f 74 2d 69 6e 3a 20 20 23 66 0a 09     not-in:  #f..
94d0: 09 09 09 09 09 20 20 20 20 20 20 73 6f 72 74 2d  .....      sort-
94e0: 62 79 3a 20 28 63 61 73 65 20 61 63 74 69 6f 6e  by: (case action
94f0: 0a 09 09 09 09 09 09 09 09 20 28 28 72 65 6d 6f  ......... ((remo
9500: 76 65 2d 72 75 6e 73 29 20 27 72 75 6e 64 69 72  ve-runs) 'rundir
9510: 29 0a 09 09 09 09 09 09 09 09 20 28 65 6c 73 65  )......... (else
9520: 20 20 20 20 20 20 20 20 20 20 27 65 76 65 6e 74            'event
9530: 5f 74 69 6d 65 29 29 29 0a 09 09 09 20 20 20 20  _time)))....    
9540: 20 20 20 27 28 29 29 29 0a 09 09 28 6c 61 73 74     '()))...(last
9550: 74 70 61 74 68 20 22 2f 64 6f 65 73 2f 6e 6f 74  tpath "/does/not
9560: 2f 65 78 69 73 74 2f 49 2f 68 6f 70 65 22 29 29  /exist/I/hope"))
9570: 0a 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  ..   (debug:prin
9580: 74 2d 69 6e 66 6f 20 34 20 22 72 75 6e 73 3a 6f  t-info 4 "runs:o
9590: 70 65 72 61 74 65 2d 6f 6e 20 72 75 6e 3d 22 20  perate-on run=" 
95a0: 72 75 6e 20 22 2c 20 68 65 61 64 65 72 3d 22 20  run ", header=" 
95b0: 68 65 61 64 65 72 29 0a 09 20 20 20 28 69 66 20  header)..   (if 
95c0: 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 73 74  (not (null? test
95d0: 73 29 29 0a 09 20 20 20 20 20 20 20 28 62 65 67  s))..       (beg
95e0: 69 6e 0a 09 09 20 28 63 61 73 65 20 61 63 74 69  in... (case acti
95f0: 6f 6e 0a 09 09 20 20 20 28 28 72 65 6d 6f 76 65  on...   ((remove
9600: 2d 72 75 6e 73 29 0a 09 09 20 20 20 20 28 64 65  -runs)...    (de
9610: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d  bug:print 1 "Rem
9620: 6f 76 69 6e 67 20 74 65 73 74 73 20 66 6f 72 20  oving tests for 
9630: 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20  run: " runkey " 
9640: 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d  " (db:get-value-
9650: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65  by-header run he
9660: 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 29  ader "runname"))
9670: 29 0a 09 09 20 20 20 28 28 73 65 74 2d 73 74 61  )...   ((set-sta
9680: 74 65 2d 73 74 61 74 75 73 29 0a 09 09 20 20 20  te-status)...   
9690: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20   (debug:print 1 
96a0: 22 4d 6f 64 69 66 79 69 6e 67 20 73 74 61 74 65  "Modifying state
96b0: 20 61 6e 64 20 73 74 61 75 73 20 66 6f 72 20 74   and staus for t
96c0: 65 73 74 73 20 66 6f 72 20 72 75 6e 3a 20 22 20  ests for run: " 
96d0: 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67  runkey " " (db:g
96e0: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64  et-value-by-head
96f0: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 72  er run header "r
9700: 75 6e 6e 61 6d 65 22 29 29 29 0a 09 09 20 20 20  unname")))...   
9710: 28 28 70 72 69 6e 74 2d 72 75 6e 29 0a 09 09 20  ((print-run)... 
9720: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
9730: 31 20 22 50 72 69 6e 74 69 6e 67 20 69 6e 66 6f  1 "Printing info
9740: 20 66 6f 72 20 72 75 6e 20 22 20 72 75 6e 6b 65   for run " runke
9750: 79 20 22 2c 20 72 75 6e 3d 22 20 72 75 6e 20 22  y ", run=" run "
9760: 2c 20 74 65 73 74 73 3d 22 20 74 65 73 74 73 20  , tests=" tests 
9770: 22 2c 20 68 65 61 64 65 72 3d 22 20 68 65 61 64  ", header=" head
9780: 65 72 29 0a 09 09 20 20 20 20 61 63 74 69 6f 6e  er)...    action
9790: 29 0a 09 09 20 20 20 28 65 6c 73 65 0a 09 09 20  )...   (else... 
97a0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d     (debug:print-
97b0: 69 6e 66 6f 20 30 20 22 61 63 74 69 6f 6e 20 6e  info 0 "action n
97c0: 6f 74 20 72 65 63 6f 67 6e 69 73 65 64 20 22 20  ot recognised " 
97d0: 61 63 74 69 6f 6e 29 29 29 0a 09 09 20 28 66 6f  action)))... (fo
97e0: 72 2d 65 61 63 68 0a 09 09 20 20 28 6c 61 6d 62  r-each...  (lamb
97f0: 64 61 20 28 74 65 73 74 29 0a 09 09 20 20 20 20  da (test)...    
9800: 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d 70 61 74  (let* ((item-pat
9810: 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  h (db:test-get-i
9820: 74 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29 0a  tem-path test)).
9830: 09 09 09 20 20 20 28 74 65 73 74 2d 6e 61 6d 65  ...   (test-name
9840: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65   (db:test-get-te
9850: 73 74 6e 61 6d 65 20 74 65 73 74 29 29 0a 09 09  stname test))...
9860: 09 20 20 20 28 72 75 6e 2d 64 69 72 20 20 20 28  .   (run-dir   (
9870: 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 64  db:test-get-rund
9880: 69 72 20 74 65 73 74 29 29 20 20 20 20 3b 3b 20  ir test))    ;; 
9890: 72 75 6e 20 64 69 72 20 69 73 20 66 72 6f 6d 20  run dir is from 
98a0: 74 68 65 20 6c 69 6e 6b 20 74 72 65 65 0a 09 09  the link tree...
98b0: 09 20 20 20 28 72 65 61 6c 2d 64 69 72 20 20 28  .   (real-dir  (
98c0: 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f  if (file-exists?
98d0: 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 09 09 20   run-dir)...... 
98e0: 20 28 72 65 73 6f 6c 76 65 2d 70 61 74 68 6e 61   (resolve-pathna
98f0: 6d 65 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 09  me run-dir).....
9900: 09 20 20 23 66 29 29 0a 09 09 09 20 20 20 28 74  .  #f))....   (t
9910: 65 73 74 2d 69 64 20 20 20 28 64 62 3a 74 65 73  est-id   (db:tes
9920: 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29 29 29  t-get-id test)))
9930: 0a 09 09 20 20 20 20 20 20 3b 3b 20 20 20 28 74  ...      ;;   (t
9940: 64 62 20 20 20 20 20 20 20 28 64 62 3a 6f 70 65  db       (db:ope
9950: 6e 2d 74 65 73 74 2d 64 62 20 72 75 6e 2d 64 69  n-test-db run-di
9960: 72 29 29 29 0a 09 09 20 20 20 20 20 20 28 64 65  r)))...      (de
9970: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34  bug:print-info 4
9980: 20 22 74 65 73 74 3d 22 20 74 65 73 74 29 20 3b   "test=" test) ;
9990: 3b 20 20 20 22 20 28 64 62 3a 74 65 73 74 2d 67  ;   " (db:test-g
99a0: 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74  et-testname test
99b0: 29 20 22 20 69 64 3a 20 22 20 28 64 62 3a 74 65  ) " id: " (db:te
99c0: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29 20  st-get-id test) 
99d0: 22 20 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20  " " item-path " 
99e0: 61 63 74 69 6f 6e 3a 20 22 20 61 63 74 69 6f 6e  action: " action
99f0: 29 0a 09 09 20 20 20 20 20 20 28 63 61 73 65 20  )...      (case 
9a00: 61 63 74 69 6f 6e 0a 09 09 09 28 28 72 65 6d 6f  action....((remo
9a10: 76 65 2d 72 75 6e 73 29 20 3b 3b 20 74 68 65 20  ve-runs) ;; the 
9a20: 74 64 62 20 69 73 20 66 6f 72 20 66 75 74 75 72  tdb is for futur
9a30: 65 20 70 6f 73 73 69 62 6c 65 2e 20 0a 09 09 09  e possible. ....
9a40: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
9a50: 20 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 2d   db:delete-test-
9a60: 72 65 63 6f 72 64 73 20 64 62 20 23 66 20 28 64  records db #f (d
9a70: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65  b:test-get-id te
9a80: 73 74 29 29 0a 09 09 09 20 28 64 65 62 75 67 3a  st)).... (debug:
9a90: 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 41 74  print-info 1 "At
9aa0: 74 65 6d 70 74 69 6e 67 20 74 6f 20 72 65 6d 6f  tempting to remo
9ab0: 76 65 20 22 20 28 69 66 20 72 65 61 6c 2d 64 69  ve " (if real-di
9ac0: 72 20 28 63 6f 6e 63 20 22 20 64 69 72 20 22 20  r (conc " dir " 
9ad0: 72 65 61 6c 2d 64 69 72 20 22 20 61 6e 64 20 22  real-dir " and "
9ae0: 29 20 22 22 29 20 22 20 6c 69 6e 6b 20 22 20 72  ) "") " link " r
9af0: 75 6e 2d 64 69 72 29 0a 09 09 09 20 28 69 66 20  un-dir).... (if 
9b00: 28 61 6e 64 20 72 65 61 6c 2d 64 69 72 20 0a 09  (and real-dir ..
9b10: 09 09 09 20 20 28 3e 20 28 73 74 72 69 6e 67 2d  ...  (> (string-
9b20: 6c 65 6e 67 74 68 20 72 65 61 6c 2d 64 69 72 29  length real-dir)
9b30: 20 35 29 0a 09 09 09 09 20 20 28 66 69 6c 65 2d   5).....  (file-
9b40: 65 78 69 73 74 73 3f 20 72 65 61 6c 2d 64 69 72  exists? real-dir
9b50: 29 29 20 3b 3b 20 62 61 64 20 68 65 75 72 69 73  )) ;; bad heuris
9b60: 74 69 63 20 62 75 74 20 73 68 6f 75 6c 64 20 70  tic but should p
9b70: 72 65 76 65 6e 74 20 2f 74 6d 70 20 2f 68 6f 6d  revent /tmp /hom
9b80: 65 20 65 74 63 2e 0a 09 09 09 20 20 20 20 20 28  e etc.....     (
9b90: 62 65 67 69 6e 20 3b 3b 20 6c 65 74 2a 20 28 28  begin ;; let* ((
9ba0: 72 65 61 6c 70 61 74 68 20 28 72 65 73 6f 6c 76  realpath (resolv
9bb0: 65 2d 70 61 74 68 6e 61 6d 65 20 72 75 6e 2d 64  e-pathname run-d
9bc0: 69 72 29 29 29 0a 09 09 09 20 20 20 20 20 20 20  ir)))....       
9bd0: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
9be0: 6f 20 31 20 22 52 65 63 75 72 73 69 76 65 6c 79  o 1 "Recursively
9bf0: 20 72 65 6d 6f 76 69 6e 67 20 22 20 72 65 61 6c   removing " real
9c00: 2d 64 69 72 29 0a 09 09 09 20 20 20 20 20 20 20  -dir)....       
9c10: 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73  (if (file-exists
9c20: 3f 20 72 65 61 6c 2d 64 69 72 29 0a 09 09 09 09  ? real-dir).....
9c30: 20 20 20 28 69 66 20 28 3e 20 28 73 79 73 74 65     (if (> (syste
9c40: 6d 20 28 63 6f 6e 63 20 22 72 6d 20 2d 72 66 20  m (conc "rm -rf 
9c50: 22 20 72 65 61 6c 2d 64 69 72 29 29 20 30 29 0a  " real-dir)) 0).
9c60: 09 09 09 09 20 20 20 20 20 20 20 28 64 65 62 75  ....       (debu
9c70: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52  g:print 0 "ERROR
9c80: 3a 20 54 68 65 72 65 20 77 61 73 20 61 20 70 72  : There was a pr
9c90: 6f 62 6c 65 6d 20 72 65 6d 6f 76 69 6e 67 20 22  oblem removing "
9ca0: 20 72 65 61 6c 2d 64 69 72 20 22 20 77 69 74 68   real-dir " with
9cb0: 20 72 6d 20 2d 66 22 29 29 0a 09 09 09 09 20 20   rm -f")).....  
9cc0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
9cd0: 22 57 41 52 4e 49 4e 47 3a 20 74 65 73 74 20 64  "WARNING: test d
9ce0: 69 72 20 22 20 72 65 61 6c 2d 64 69 72 20 22 20  ir " real-dir " 
9cf0: 61 70 70 65 61 72 73 20 74 6f 20 6e 6f 74 20 65  appears to not e
9d00: 78 69 73 74 20 6f 72 20 69 73 20 6e 6f 74 20 72  xist or is not r
9d10: 65 61 64 61 62 6c 65 22 29 29 29 0a 09 09 09 20  eadable"))).... 
9d20: 20 20 20 20 28 69 66 20 72 65 61 6c 2d 64 69 72      (if real-dir
9d30: 20 0a 09 09 09 09 20 28 64 65 62 75 67 3a 70 72   ..... (debug:pr
9d40: 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20  int 0 "WARNING: 
9d50: 64 69 72 65 63 74 6f 72 79 20 22 20 72 65 61 6c  directory " real
9d60: 2d 64 69 72 20 22 20 64 6f 65 73 20 6e 6f 74 20  -dir " does not 
9d70: 65 78 69 73 74 22 29 0a 09 09 09 09 20 28 64 65  exist")..... (de
9d80: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52  bug:print 0 "WAR
9d90: 4e 49 4e 47 3a 20 6e 6f 20 72 65 61 6c 20 64 69  NING: no real di
9da0: 72 65 63 74 6f 72 79 20 63 6f 72 72 6f 73 70 6f  rectory corrospo
9db0: 6e 64 69 6e 67 20 74 6f 20 6c 69 6e 6b 20 22 20  nding to link " 
9dc0: 72 75 6e 2d 64 69 72 20 22 2c 20 6e 6f 74 68 69  run-dir ", nothi
9dd0: 6e 67 20 64 6f 6e 65 22 29 29 29 0a 09 09 09 20  ng done"))).... 
9de0: 28 69 66 20 28 73 79 6d 62 6f 6c 69 63 2d 6c 69  (if (symbolic-li
9df0: 6e 6b 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09 09  nk? run-dir)....
9e00: 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09 20       (begin.... 
9e10: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
9e20: 6e 74 2d 69 6e 66 6f 20 31 20 22 52 65 6d 6f 76  nt-info 1 "Remov
9e30: 69 6e 67 20 73 79 6d 6c 69 6e 6b 20 22 20 72 75  ing symlink " ru
9e40: 6e 2d 64 69 72 29 0a 09 09 09 20 20 20 20 20 20  n-dir)....      
9e50: 20 28 68 61 6e 64 6c 65 2d 65 78 63 65 70 74 69   (handle-excepti
9e60: 6f 6e 73 0a 09 09 09 09 65 78 6e 0a 09 09 09 09  ons.....exn.....
9e70: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
9e80: 45 52 52 4f 52 3a 20 20 46 61 69 6c 65 64 20 74  ERROR:  Failed t
9e90: 6f 20 72 65 6d 6f 76 65 20 73 79 6d 6c 69 6e 6b  o remove symlink
9ea0: 20 22 20 72 75 6e 2d 64 69 72 20 28 28 63 6f 6e   " run-dir ((con
9eb0: 64 69 74 69 6f 6e 2d 70 72 6f 70 65 72 74 79 2d  dition-property-
9ec0: 61 63 63 65 73 73 6f 72 20 27 65 78 6e 20 27 6d  accessor 'exn 'm
9ed0: 65 73 73 61 67 65 29 20 65 78 6e 29 20 22 2c 20  essage) exn) ", 
9ee0: 61 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 63 6f  attempting to co
9ef0: 6e 74 69 6e 75 65 22 29 0a 09 09 09 09 28 64 65  ntinue").....(de
9f00: 6c 65 74 65 2d 66 69 6c 65 20 72 75 6e 2d 64 69  lete-file run-di
9f10: 72 29 29 29 0a 09 09 09 20 20 20 20 20 28 69 66  r)))....     (if
9f20: 20 28 64 69 72 65 63 74 6f 72 79 3f 20 72 75 6e   (directory? run
9f30: 2d 64 69 72 29 0a 09 09 09 09 20 28 69 66 20 28  -dir)..... (if (
9f40: 3e 20 28 64 69 72 65 63 74 6f 72 79 2d 66 6f 6c  > (directory-fol
9f50: 64 20 28 6c 61 6d 62 64 61 20 28 66 20 78 29 28  d (lambda (f x)(
9f60: 2b 20 31 20 78 29 29 20 30 20 72 75 6e 2d 64 69  + 1 x)) 0 run-di
9f70: 72 29 20 30 29 0a 09 09 09 09 20 20 20 20 20 28  r) 0).....     (
9f80: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57  debug:print 0 "W
9f90: 41 52 4e 49 4e 47 3a 20 72 65 66 75 73 69 6e 67  ARNING: refusing
9fa0: 20 74 6f 20 72 65 6d 6f 76 65 20 22 20 72 75 6e   to remove " run
9fb0: 2d 64 69 72 20 22 20 61 73 20 69 74 20 69 73 20  -dir " as it is 
9fc0: 6e 6f 74 20 65 6d 70 74 79 22 29 0a 09 09 09 09  not empty").....
9fd0: 20 20 20 20 20 20 28 68 61 6e 64 6c 65 2d 65 78        (handle-ex
9fe0: 63 65 70 74 69 6f 6e 73 0a 09 09 09 09 20 20 20  ceptions.....   
9ff0: 20 20 20 20 65 78 6e 0a 09 09 09 09 20 20 20 20      exn.....    
a000: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
a010: 30 20 22 45 52 52 4f 52 3a 20 20 46 61 69 6c 65  0 "ERROR:  Faile
a020: 64 20 74 6f 20 72 65 6d 6f 76 65 20 64 69 72 65  d to remove dire
a030: 63 74 6f 72 79 20 22 20 72 75 6e 2d 64 69 72 20  ctory " run-dir 
a040: 28 28 63 6f 6e 64 69 74 69 6f 6e 2d 70 72 6f 70  ((condition-prop
a050: 65 72 74 79 2d 61 63 63 65 73 73 6f 72 20 27 65  erty-accessor 'e
a060: 78 6e 20 27 6d 65 73 73 61 67 65 29 20 65 78 6e  xn 'message) exn
a070: 29 20 22 2c 20 61 74 74 65 6d 70 74 69 6e 67 20  ) ", attempting 
a080: 74 6f 20 63 6f 6e 74 69 6e 75 65 22 29 0a 09 09  to continue")...
a090: 09 09 20 20 20 20 20 20 20 28 64 65 6c 65 74 65  ..       (delete
a0a0: 2d 64 69 72 65 63 74 6f 72 79 20 72 75 6e 2d 64  -directory run-d
a0b0: 69 72 29 29 29 0a 09 09 09 09 20 28 69 66 20 72  ir)))..... (if r
a0c0: 75 6e 2d 64 69 72 0a 09 09 09 09 20 20 20 20 20  un-dir.....     
a0d0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
a0e0: 57 41 52 4e 49 4e 47 3a 20 6e 6f 74 20 72 65 6d  WARNING: not rem
a0f0: 6f 76 69 6e 67 20 22 20 72 75 6e 2d 64 69 72 20  oving " run-dir 
a100: 22 20 61 73 20 69 74 20 65 69 74 68 65 72 20 64  " as it either d
a110: 6f 65 73 6e 27 74 20 65 78 69 73 74 20 6f 72 20  oesn't exist or 
a120: 69 73 20 6e 6f 74 20 61 20 73 79 6d 6c 69 6e 6b  is not a symlink
a130: 22 29 0a 09 09 09 09 20 20 20 20 20 28 64 65 62  ").....     (deb
a140: 75 67 3a 70 72 69 6e 74 20 30 20 22 4e 4f 54 45  ug:print 0 "NOTE
a150: 3a 20 74 68 65 20 72 75 6e 20 64 69 72 20 66 6f  : the run dir fo
a160: 72 20 74 68 69 73 20 74 65 73 74 20 69 73 20 75  r this test is u
a170: 6e 64 65 66 69 6e 65 64 2e 20 54 65 73 74 20 6d  ndefined. Test m
a180: 61 79 20 68 61 76 65 20 61 6c 72 65 61 64 79 20  ay have already 
a190: 62 65 65 6e 20 64 65 6c 65 74 65 64 2e 22 29 29  been deleted."))
a1a0: 0a 09 09 09 09 20 29 29 29 0a 09 09 09 28 28 73  ..... )))....((s
a1b0: 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73 29  et-state-status)
a1c0: 0a 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e  .... (debug:prin
a1d0: 74 2d 69 6e 66 6f 20 32 20 22 6e 65 77 20 73 74  t-info 2 "new st
a1e0: 61 74 65 20 22 20 28 63 61 72 20 73 74 61 74 65  ate " (car state
a1f0: 2d 73 74 61 74 75 73 29 20 22 2c 20 6e 65 77 20  -status) ", new 
a200: 73 74 61 74 75 73 20 22 20 28 63 61 64 72 20 73  status " (cadr s
a210: 74 61 74 65 2d 73 74 61 74 75 73 29 29 0a 09 09  tate-status))...
a220: 09 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73  . (open-run-clos
a230: 65 20 64 62 3a 74 65 73 74 2d 73 65 74 2d 73 74  e db:test-set-st
a240: 61 74 65 2d 73 74 61 74 75 73 2d 62 79 2d 69 64  ate-status-by-id
a250: 20 64 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74   db (db:test-get
a260: 2d 69 64 20 74 65 73 74 29 20 28 63 61 72 20 73  -id test) (car s
a270: 74 61 74 65 2d 73 74 61 74 75 73 29 28 63 61 64  tate-status)(cad
a280: 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 20  r state-status) 
a290: 23 66 29 29 29 29 29 0a 09 09 20 20 28 73 6f 72  #f)))))...  (sor
a2a0: 74 20 74 65 73 74 73 20 28 6c 61 6d 62 64 61 20  t tests (lambda 
a2b0: 28 61 20 62 29 28 6c 65 74 20 28 28 64 69 72 61  (a b)(let ((dira
a2c0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75   (db:test-get-ru
a2d0: 6e 64 69 72 20 61 29 29 0a 09 09 09 09 09 09 20  ndir a))....... 
a2e0: 28 64 69 72 62 20 28 64 62 3a 74 65 73 74 2d 67  (dirb (db:test-g
a2f0: 65 74 2d 72 75 6e 64 69 72 20 62 29 29 29 0a 09  et-rundir b)))..
a300: 09 09 09 09 20 20 20 20 20 28 69 66 20 28 61 6e  ....     (if (an
a310: 64 20 28 73 74 72 69 6e 67 3f 20 64 69 72 61 29  d (string? dira)
a320: 28 73 74 72 69 6e 67 3f 20 64 69 72 62 29 29 0a  (string? dirb)).
a330: 09 09 09 09 09 09 20 28 3e 20 28 73 74 72 69 6e  ...... (> (strin
a340: 67 2d 6c 65 6e 67 74 68 20 64 69 72 61 29 28 73  g-length dira)(s
a350: 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 64 69 72  tring-length dir
a360: 62 29 29 0a 09 09 09 09 09 09 20 23 66 29 29 29  b))....... #f)))
a370: 29 29 29 29 0a 09 20 20 20 3b 3b 20 72 65 6d 6f  ))))..   ;; remo
a380: 76 65 20 74 68 65 20 72 75 6e 20 69 66 20 7a 65  ve the run if ze
a390: 72 6f 20 74 65 73 74 73 20 72 65 6d 61 69 6e 0a  ro tests remain.
a3a0: 09 20 20 20 28 69 66 20 28 65 71 3f 20 61 63 74  .   (if (eq? act
a3b0: 69 6f 6e 20 27 72 65 6d 6f 76 65 2d 72 75 6e 73  ion 'remove-runs
a3c0: 29 0a 09 20 20 20 20 20 20 20 28 6c 65 74 20 28  )..       (let (
a3d0: 28 72 65 6d 74 65 73 74 73 20 28 6f 70 65 6e 2d  (remtests (open-
a3e0: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
a3f0: 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64  -tests-for-run d
a400: 62 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d  b (db:get-value-
a410: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65  by-header run he
a420: 61 64 65 72 20 22 69 64 22 29 20 23 66 20 27 28  ader "id") #f '(
a430: 22 44 45 4c 45 54 45 44 22 29 20 27 28 22 6e 2f  "DELETED") '("n/
a440: 61 22 29 20 6e 6f 74 2d 69 6e 3a 20 23 74 29 29  a") not-in: #t))
a450: 29 0a 09 09 20 28 69 66 20 28 6e 75 6c 6c 3f 20  )... (if (null? 
a460: 72 65 6d 74 65 73 74 73 29 20 3b 3b 20 6e 6f 20  remtests) ;; no 
a470: 6d 6f 72 65 20 74 65 73 74 73 20 72 65 6d 61 69  more tests remai
a480: 6e 69 6e 67 0a 09 09 20 20 20 20 20 28 6c 65 74  ning...     (let
a490: 2a 20 28 28 64 70 61 72 74 73 20 20 28 73 74 72  * ((dparts  (str
a4a0: 69 6e 67 2d 73 70 6c 69 74 20 6c 61 73 74 74 70  ing-split lasttp
a4b0: 61 74 68 20 22 2f 22 29 29 0a 09 09 09 20 20 20  ath "/"))....   
a4c0: 20 28 72 75 6e 70 61 74 68 20 28 63 6f 6e 63 20   (runpath (conc 
a4d0: 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 65  "/" (string-inte
a4e0: 72 73 70 65 72 73 65 20 0a 09 09 09 09 09 09 28  rsperse .......(
a4f0: 74 61 6b 65 20 64 70 61 72 74 73 20 28 2d 20 28  take dparts (- (
a500: 6c 65 6e 67 74 68 20 64 70 61 72 74 73 29 20 31  length dparts) 1
a510: 29 29 0a 09 09 09 09 09 09 22 2f 22 29 29 29 29  ))......."/"))))
a520: 0a 09 09 20 20 20 20 20 20 20 28 64 65 62 75 67  ...       (debug
a530: 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69  :print 1 "Removi
a540: 6e 67 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79  ng run: " runkey
a550: 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c   " " (db:get-val
a560: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e  ue-by-header run
a570: 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65   header "runname
a580: 22 29 20 22 20 61 6e 64 20 72 65 6c 61 74 65 64  ") " and related
a590: 20 72 65 63 6f 72 64 22 29 0a 09 09 20 20 20 20   record")...    
a5a0: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f     (open-run-clo
a5b0: 73 65 20 64 62 3a 64 65 6c 65 74 65 2d 72 75 6e  se db:delete-run
a5c0: 20 64 62 20 72 75 6e 2d 69 64 29 0a 09 09 20 20   db run-id)...  
a5d0: 20 20 20 20 20 3b 3b 20 54 68 69 73 20 69 73 20       ;; This is 
a5e0: 61 20 70 72 65 74 74 79 20 67 6f 6f 64 20 70 6c  a pretty good pl
a5f0: 61 63 65 20 74 6f 20 70 75 72 67 65 20 6f 6c 64  ace to purge old
a600: 20 44 45 4c 45 54 45 44 20 74 65 73 74 73 0a 09   DELETED tests..
a610: 09 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75  .       (open-ru
a620: 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74  n-close db:delet
a630: 65 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20  e-tests-for-run 
a640: 64 62 20 72 75 6e 2d 69 64 29 0a 09 09 20 20 20  db run-id)...   
a650: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c      (open-run-cl
a660: 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 2d 6f 6c  ose db:delete-ol
a670: 64 2d 64 65 6c 65 74 65 64 2d 74 65 73 74 2d 72  d-deleted-test-r
a680: 65 63 6f 72 64 73 20 64 62 29 0a 09 09 20 20 20  ecords db)...   
a690: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c      (open-run-cl
a6a0: 6f 73 65 20 64 62 3a 73 65 74 2d 76 61 72 20 64  ose db:set-var d
a6b0: 62 20 22 44 45 4c 45 54 45 44 5f 54 45 53 54 53  b "DELETED_TESTS
a6c0: 22 20 28 63 75 72 72 65 6e 74 2d 73 65 63 6f 6e  " (current-secon
a6d0: 64 73 29 29 0a 09 09 20 20 20 20 20 20 20 3b 3b  ds))...       ;;
a6e0: 20 6e 65 65 64 20 74 6f 20 66 69 67 75 72 65 20   need to figure 
a6f0: 6f 75 74 20 74 68 65 20 70 61 74 68 20 74 6f 20  out the path to 
a700: 74 68 65 20 72 75 6e 20 64 69 72 20 61 6e 64 20  the run dir and 
a710: 72 65 6d 6f 76 65 20 69 74 20 69 66 20 65 6d 70  remove it if emp
a720: 74 79 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 20  ty...       ;;  
a730: 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 28 67 6c    (if (null? (gl
a740: 6f 62 20 28 63 6f 6e 63 20 72 75 6e 70 61 74 68  ob (conc runpath
a750: 20 22 2f 2a 22 29 29 29 0a 09 09 20 20 20 20 20   "/*")))...     
a760: 20 20 3b 3b 20 20 20 20 20 20 20 20 28 62 65 67    ;;        (beg
a770: 69 6e 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 09  in...       ;; .
a780: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20   (debug:print 1 
a790: 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 20 64 69  "Removing run di
a7a0: 72 20 22 20 72 75 6e 70 61 74 68 29 0a 09 09 20  r " runpath)... 
a7b0: 20 20 20 20 20 20 3b 3b 20 09 20 28 73 79 73 74        ;; . (syst
a7c0: 65 6d 20 28 63 6f 6e 63 20 22 72 6d 64 69 72 20  em (conc "rmdir 
a7d0: 2d 70 20 22 20 72 75 6e 70 61 74 68 29 29 29 29  -p " runpath))))
a7e0: 0a 09 09 20 20 20 20 20 20 20 29 29 29 29 29 0a  ...       ))))).
a7f0: 09 20 29 29 0a 20 20 20 20 20 72 75 6e 73 29 29  . )).     runs))
a800: 0a 20 20 23 74 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d  .  #t)..;;======
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 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a840: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a850: 0a 3b 3b 20 52 6f 75 74 69 6e 65 73 20 66 6f 72  .;; Routines for
a860: 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 72 75   manipulating ru
a870: 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ns.;;===========
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 3d 3d 3d 3d  ================
a8a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a8b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20  ===========..;; 
a8c0: 53 69 6e 63 65 20 6d 61 6e 79 20 63 61 6c 6c 73  Since many calls
a8d0: 20 74 6f 20 61 20 72 75 6e 20 72 65 71 75 69 72   to a run requir
a8e0: 65 20 70 72 65 74 74 79 20 6d 75 63 68 20 74 68  e pretty much th
a8f0: 65 20 73 61 6d 65 20 73 65 74 75 70 20 0a 3b 3b  e same setup .;;
a900: 20 74 68 69 73 20 77 72 61 70 70 65 72 20 69 73   this wrapper is
a910: 20 75 73 65 64 20 74 6f 20 72 65 64 75 63 65 20   used to reduce 
a920: 74 68 65 20 72 65 70 6c 69 63 61 74 69 6f 6e 20  the replication 
a930: 6f 66 20 63 6f 64 65 0a 28 64 65 66 69 6e 65 20  of code.(define 
a940: 28 67 65 6e 65 72 61 6c 2d 72 75 6e 2d 63 61 6c  (general-run-cal
a950: 6c 20 73 77 69 74 63 68 6e 61 6d 65 20 61 63 74  l switchname act
a960: 69 6f 6e 2d 64 65 73 63 20 70 72 6f 63 29 0a 20  ion-desc proc). 
a970: 20 28 6c 65 74 20 28 28 72 75 6e 6e 61 6d 65 20   (let ((runname 
a980: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 3a  (args:get-arg ":
a990: 72 75 6e 6e 61 6d 65 22 29 29 0a 09 28 74 61 72  runname"))..(tar
a9a0: 67 65 74 20 20 28 69 66 20 28 61 72 67 73 3a 67  get  (if (args:g
a9b0: 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22  et-arg "-target"
a9c0: 29 0a 09 09 20 20 20 20 20 28 61 72 67 73 3a 67  )...     (args:g
a9d0: 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22  et-arg "-target"
a9e0: 29 0a 09 09 20 20 20 20 20 28 61 72 67 73 3a 67  )...     (args:g
a9f0: 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67  et-arg "-reqtarg
aa00: 22 29 29 29 0a 09 28 74 68 31 20 20 20 20 20 23  ")))..(th1     #
aa10: 66 29 29 0a 20 20 20 20 28 63 6f 6e 64 0a 20 20  f)).    (cond.  
aa20: 20 20 20 28 28 6e 6f 74 20 74 61 72 67 65 74 29     ((not target)
aa30: 0a 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72  .      (debug:pr
aa40: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 4d 69  int 0 "ERROR: Mi
aa50: 73 73 69 6e 67 20 72 65 71 75 69 72 65 64 20 70  ssing required p
aa60: 61 72 61 6d 65 74 65 72 20 66 6f 72 20 22 20 73  arameter for " s
aa70: 77 69 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75  witchname ", you
aa80: 20 6d 75 73 74 20 73 70 65 63 69 66 79 20 74 68   must specify th
aa90: 65 20 74 61 72 67 65 74 20 77 69 74 68 20 2d 74  e target with -t
aaa0: 61 72 67 65 74 22 29 0a 20 20 20 20 20 20 28 65  arget").      (e
aab0: 78 69 74 20 33 29 29 0a 20 20 20 20 20 28 28 6e  xit 3)).     ((n
aac0: 6f 74 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20  ot runname).    
aad0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
aae0: 20 22 45 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67   "ERROR: Missing
aaf0: 20 72 65 71 75 69 72 65 64 20 70 61 72 61 6d 65   required parame
ab00: 74 65 72 20 66 6f 72 20 22 20 73 77 69 74 63 68  ter for " switch
ab10: 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d 75 73 74  name ", you must
ab20: 20 73 70 65 63 69 66 79 20 74 68 65 20 72 75 6e   specify the run
ab30: 20 6e 61 6d 65 20 77 69 74 68 20 3a 72 75 6e 6e   name with :runn
ab40: 61 6d 65 20 72 75 6e 6e 61 6d 65 22 29 0a 20 20  ame runname").  
ab50: 20 20 20 20 28 65 78 69 74 20 33 29 29 0a 20 20      (exit 3)).  
ab60: 20 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20 28     (else.      (
ab70: 6c 65 74 20 28 28 64 62 20 20 20 23 66 29 0a 09  let ((db   #f)..
ab80: 20 20 20 20 28 6b 65 79 73 20 23 66 29 29 0a 09      (keys #f))..
ab90: 28 69 66 20 28 6e 6f 74 20 28 73 65 74 75 70 2d  (if (not (setup-
aba0: 66 6f 72 2d 72 75 6e 29 29 0a 09 20 20 20 20 28  for-run))..    (
abb0: 62 65 67 69 6e 20 0a 09 20 20 20 20 20 20 28 64  begin ..      (d
abc0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 46 61  ebug:print 0 "Fa
abd0: 69 6c 65 64 20 74 6f 20 73 65 74 75 70 2c 20 65  iled to setup, e
abe0: 78 69 74 69 6e 67 22 29 0a 09 20 20 20 20 20 20  xiting")..      
abf0: 28 65 78 69 74 20 31 29 29 29 0a 09 28 69 66 20  (exit 1)))..(if 
ac00: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
ac10: 73 65 72 76 65 72 22 29 0a 09 20 20 20 20 28 6f  server")..    (o
ac20: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 73 65  pen-run-close se
ac30: 72 76 65 72 3a 73 74 61 72 74 20 64 62 20 28 61  rver:start db (a
ac40: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 73 65  rgs:get-arg "-se
ac50: 72 76 65 72 22 29 29 29 0a 20 09 20 20 20 20 3b  rver"))). .    ;
ac60: 3b 20 28 69 66 20 28 6e 6f 74 20 28 6f 72 20 28  ; (if (not (or (
ac70: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72  args:get-arg "-r
ac80: 75 6e 61 6c 6c 22 29 20 20 20 20 20 3b 3b 20 72  unall")     ;; r
ac90: 75 6e 61 6c 6c 20 61 6e 64 20 72 75 6e 74 65 73  unall and runtes
aca0: 74 73 20 61 72 65 20 61 6c 6c 6f 77 65 64 20 74  ts are allowed t
acb0: 6f 20 62 65 20 73 65 72 76 65 72 73 0a 20 09 20  o be servers. . 
acc0: 20 20 20 3b 3b 20 20 20 20 20 09 20 28 61 72 67     ;;     . (arg
acd0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 75 6e 74  s:get-arg "-runt
ace0: 65 73 74 73 22 29 29 29 0a 09 20 20 20 20 3b 3b  ests")))..    ;;
acf0: 20 20 20 20 20 28 63 6c 69 65 6e 74 3a 73 65 74       (client:set
ad00: 75 70 29 20 3b 3b 20 54 68 69 73 20 69 73 20 61  up) ;; This is a
ad10: 20 64 75 70 6c 69 63 61 74 65 20 73 74 61 72 74   duplicate start
ad20: 75 70 21 21 21 3f 3f 3f 20 42 55 47 3f 0a 09 20  up!!!??? BUG?.. 
ad30: 20 20 20 3b 3b 20 20 20 20 20 29 29 0a 09 28 73     ;;     ))..(s
ad40: 65 74 21 20 6b 65 79 73 20 28 6f 70 65 6e 2d 72  et! keys (open-r
ad50: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d  un-close db:get-
ad60: 6b 65 79 73 20 64 62 29 29 0a 09 3b 3b 20 68 61  keys db))..;; ha
ad70: 76 65 20 65 6e 6f 75 67 68 20 74 6f 20 70 72 6f  ve enough to pro
ad80: 63 65 73 73 20 2d 74 61 72 67 65 74 20 6f 72 20  cess -target or 
ad90: 2d 72 65 71 74 61 72 67 20 68 65 72 65 0a 09 28  -reqtarg here..(
ada0: 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  if (args:get-arg
adb0: 20 22 2d 72 65 71 74 61 72 67 22 29 0a 09 20 20   "-reqtarg")..  
adc0: 20 20 28 6c 65 74 2a 20 28 28 72 75 6e 63 6f 6e    (let* ((runcon
add0: 66 69 67 66 20 28 63 6f 6e 63 20 20 2a 74 6f 70  figf (conc  *top
ade0: 70 61 74 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 69  path* "/runconfi
adf0: 67 73 2e 63 6f 6e 66 69 67 22 29 29 20 3b 3b 20  gs.config")) ;; 
ae00: 44 4f 20 4e 4f 54 20 45 56 41 4c 55 41 54 45 20  DO NOT EVALUATE 
ae10: 41 4c 4c 20 0a 09 09 20 20 20 28 72 75 6e 63 6f  ALL ...   (runco
ae20: 6e 66 69 67 20 20 28 72 65 61 64 2d 63 6f 6e 66  nfig  (read-conf
ae30: 69 67 20 72 75 6e 63 6f 6e 66 69 67 66 20 23 66  ig runconfigf #f
ae40: 20 23 74 20 65 6e 76 69 72 6f 6e 2d 70 61 74 74   #t environ-patt
ae50: 3a 20 23 66 29 29 29 20 0a 09 20 20 20 20 20 20  : #f))) ..      
ae60: 28 69 66 20 28 68 61 73 68 2d 74 61 62 6c 65 2d  (if (hash-table-
ae70: 72 65 66 2f 64 65 66 61 75 6c 74 20 72 75 6e 63  ref/default runc
ae80: 6f 6e 66 69 67 20 28 61 72 67 73 3a 67 65 74 2d  onfig (args:get-
ae90: 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 20  arg "-reqtarg") 
aea0: 23 66 29 0a 09 09 20 20 28 6b 65 79 73 3a 74 61  #f)...  (keys:ta
aeb0: 72 67 65 74 2d 73 65 74 2d 61 72 67 73 20 6b 65  rget-set-args ke
aec0: 79 73 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  ys (args:get-arg
aed0: 20 22 2d 72 65 71 74 61 72 67 22 29 20 61 72 67   "-reqtarg") arg
aee0: 73 3a 61 72 67 2d 68 61 73 68 29 0a 09 09 20 20  s:arg-hash)...  
aef0: 28 62 65 67 69 6e 0a 09 09 20 20 20 20 28 64 65  (begin...    (de
af00: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52  bug:print 0 "ERR
af10: 4f 52 3a 20 5b 22 20 28 61 72 67 73 3a 67 65 74  OR: [" (args:get
af20: 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29  -arg "-reqtarg")
af30: 20 22 5d 20 6e 6f 74 20 66 6f 75 6e 64 20 69 6e   "] not found in
af40: 20 22 20 72 75 6e 63 6f 6e 66 69 67 66 29 0a 09   " runconfigf)..
af50: 09 20 20 20 20 28 69 66 20 64 62 20 28 73 71 6c  .    (if db (sql
af60: 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64  ite3:finalize! d
af70: 62 29 29 0a 09 09 20 20 20 20 28 65 78 69 74 20  b))...    (exit 
af80: 31 29 29 29 29 0a 09 20 20 20 20 28 69 66 20 28  1))))..    (if (
af90: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74  args:get-arg "-t
afa0: 61 72 67 65 74 22 29 0a 09 09 28 6b 65 79 73 3a  arget")...(keys:
afb0: 74 61 72 67 65 74 2d 73 65 74 2d 61 72 67 73 20  target-set-args 
afc0: 6b 65 79 73 20 28 61 72 67 73 3a 67 65 74 2d 61  keys (args:get-a
afd0: 72 67 20 22 2d 74 61 72 67 65 74 22 20 61 72 67  rg "-target" arg
afe0: 73 3a 61 72 67 2d 68 61 73 68 29 20 61 72 67 73  s:arg-hash) args
aff0: 3a 61 72 67 2d 68 61 73 68 29 29 29 0a 09 28 69  :arg-hash)))..(i
b000: 66 20 28 6e 6f 74 20 28 63 61 72 20 2a 63 6f 6e  f (not (car *con
b010: 66 69 67 69 6e 66 6f 2a 29 29 0a 09 20 20 20 20  figinfo*))..    
b020: 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 28 64  (begin..      (d
b030: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
b040: 52 4f 52 3a 20 41 74 74 65 6d 70 74 65 64 20 74  ROR: Attempted t
b050: 6f 20 22 20 61 63 74 69 6f 6e 2d 64 65 73 63 20  o " action-desc 
b060: 22 20 62 75 74 20 72 75 6e 20 61 72 65 61 20 63  " but run area c
b070: 6f 6e 66 69 67 20 66 69 6c 65 20 6e 6f 74 20 66  onfig file not f
b080: 6f 75 6e 64 22 29 0a 09 20 20 20 20 20 20 28 65  ound")..      (e
b090: 78 69 74 20 31 29 29 0a 09 20 20 20 20 3b 3b 20  xit 1))..    ;; 
b0a0: 45 78 74 72 61 63 74 20 6f 75 74 20 73 74 75 66  Extract out stuf
b0b0: 66 20 6e 65 65 64 65 64 20 69 6e 20 6d 6f 73 74  f needed in most
b0c0: 20 6f 72 20 6d 61 6e 79 20 63 61 6c 6c 73 0a 09   or many calls..
b0d0: 20 20 20 20 3b 3b 20 68 65 72 65 20 74 68 65 6e      ;; here then
b0e0: 20 63 61 6c 6c 20 70 72 6f 63 0a 09 20 20 20 20   call proc..    
b0f0: 28 6c 65 74 2a 20 28 28 6b 65 79 6e 61 6d 65 73  (let* ((keynames
b100: 20 20 20 28 6d 61 70 20 6b 65 79 3a 67 65 74 2d     (map key:get-
b110: 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79 73 29 29  fieldname keys))
b120: 0a 09 09 20 20 20 28 6b 65 79 76 61 6c 6c 73 74  ...   (keyvallst
b130: 20 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69 73 74    (keys->vallist
b140: 20 6b 65 79 73 20 23 74 29 29 29 0a 09 20 20 20   keys #t)))..   
b150: 20 20 20 28 70 72 6f 63 20 74 61 72 67 65 74 20     (proc target 
b160: 72 75 6e 6e 61 6d 65 20 6b 65 79 73 20 6b 65 79  runname keys key
b170: 6e 61 6d 65 73 20 6b 65 79 76 61 6c 6c 73 74 29  names keyvallst)
b180: 29 29 0a 09 28 69 66 20 74 68 31 20 28 74 68 72  ))..(if th1 (thr
b190: 65 61 64 2d 6a 6f 69 6e 21 20 74 68 31 29 29 0a  ead-join! th1)).
b1a0: 09 28 69 66 20 64 62 20 28 73 71 6c 69 74 65 33  .(if db (sqlite3
b1b0: 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 29 29 0a  :finalize! db)).
b1c0: 09 28 73 65 74 21 20 2a 64 69 64 73 6f 6d 65 74  .(set! *didsomet
b1d0: 68 69 6e 67 2a 20 23 74 29 29 29 29 29 29 0a 0a  hing* #t))))))..
b1e0: 3b 3b 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 3d 3d 3d 3d 3d 3d 3d  ================
b210: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b220: 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4c 6f 63 6b  ========.;; Lock
b230: 2f 75 6e 6c 6f 63 6b 20 72 75 6e 73 0a 3b 3b 3d  /unlock runs.;;=
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 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b270: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b280: 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65 20 28  =====..(define (
b290: 72 75 6e 73 3a 68 61 6e 64 6c 65 2d 6c 6f 63 6b  runs:handle-lock
b2a0: 69 6e 67 20 74 61 72 67 65 74 20 6b 65 79 73 20  ing target keys 
b2b0: 72 75 6e 6e 61 6d 65 20 6c 6f 63 6b 20 75 6e 6c  runname lock unl
b2c0: 6f 63 6b 20 75 73 65 72 29 0a 20 20 28 6c 65 74  ock user).  (let
b2d0: 2a 20 28 28 64 62 20 20 20 20 20 20 20 23 66 29  * ((db       #f)
b2e0: 0a 09 20 28 72 75 6e 64 61 74 20 20 20 28 6f 70  .. (rundat   (op
b2f0: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e  en-run-close run
b300: 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61  s:get-runs-by-pa
b310: 74 74 20 64 62 20 6b 65 79 73 20 72 75 6e 6e 61  tt db keys runna
b320: 6d 65 29 29 0a 09 20 28 68 65 61 64 65 72 20 20  me)).. (header  
b330: 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e   (vector-ref run
b340: 64 61 74 20 30 29 29 0a 09 20 28 72 75 6e 73 20  dat 0)).. (runs 
b350: 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20      (vector-ref 
b360: 72 75 6e 64 61 74 20 31 29 29 29 0a 20 20 20 20  rundat 1))).    
b370: 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 64  (for-each (lambd
b380: 61 20 28 72 75 6e 29 0a 09 09 28 6c 65 74 20 28  a (run)...(let (
b390: 28 72 75 6e 2d 69 64 20 28 64 62 3a 67 65 74 2d  (run-id (db:get-
b3a0: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20  value-by-header 
b3b0: 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 22 29  run header "id")
b3c0: 29 29 0a 09 09 20 20 28 69 66 20 28 6f 72 20 6c  ))...  (if (or l
b3d0: 6f 63 6b 0a 09 09 09 20 20 28 61 6e 64 20 75 6e  ock....  (and un
b3e0: 6c 6f 63 6b 0a 09 09 09 20 20 20 20 20 20 20 28  lock....       (
b3f0: 62 65 67 69 6e 0a 09 09 09 09 20 28 70 72 69 6e  begin..... (prin
b400: 74 20 22 44 6f 20 79 6f 75 20 72 65 61 6c 6c 79  t "Do you really
b410: 20 77 69 73 68 20 74 6f 20 75 6e 6c 6f 63 6b 20   wish to unlock 
b420: 72 75 6e 20 22 20 72 75 6e 2d 69 64 20 22 3f 5c  run " run-id "?\
b430: 6e 20 20 20 79 2f 6e 3a 20 22 29 0a 09 09 09 09  n   y/n: ").....
b440: 20 28 65 71 75 61 6c 3f 20 22 79 22 20 28 72 65   (equal? "y" (re
b450: 61 64 2d 6c 69 6e 65 29 29 29 29 29 0a 09 09 20  ad-line)))))... 
b460: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
b470: 6c 6f 73 65 20 64 62 3a 6c 6f 63 6b 2f 75 6e 6c  lose db:lock/unl
b480: 6f 63 6b 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69  ock-run db run-i
b490: 64 20 6c 6f 63 6b 20 75 6e 6c 6f 63 6b 20 75 73  d lock unlock us
b4a0: 65 72 29 0a 09 09 20 20 20 20 20 20 28 64 65 62  er)...      (deb
b4b0: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 30 20  ug:print-info 0 
b4c0: 22 53 6b 69 70 70 69 6e 67 20 6c 6f 63 6b 2f 75  "Skipping lock/u
b4d0: 6e 6c 6f 63 6b 20 6f 6e 20 22 20 72 75 6e 2d 69  nlock on " run-i
b4e0: 64 29 29 29 29 0a 09 20 20 20 20 20 20 72 75 6e  d))))..      run
b4f0: 73 29 29 29 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d  s))).;;=========
b500: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b510: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b520: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b530: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b  =============.;;
b540: 20 52 6f 6c 6c 75 70 20 72 75 6e 73 0a 3b 3b 3d   Rollup runs.;;=
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 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b580: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b590: 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 55 70 64 61 74 65  =====..;; Update
b5a0: 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61 20 74   the test_meta t
b5b0: 61 62 6c 65 20 66 6f 72 20 74 68 69 73 20 74 65  able for this te
b5c0: 73 74 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73  st.(define (runs
b5d0: 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74  :update-test_met
b5e0: 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 74  a db test-name t
b5f0: 65 73 74 2d 63 6f 6e 66 29 0a 20 20 28 6c 65 74  est-conf).  (let
b600: 20 28 28 63 75 72 72 72 65 63 6f 72 64 20 28 6f   ((currrecord (o
b610: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62  pen-run-close db
b620: 3a 74 65 73 74 6d 65 74 61 2d 67 65 74 2d 72 65  :testmeta-get-re
b630: 63 6f 72 64 20 64 62 20 74 65 73 74 2d 6e 61 6d  cord db test-nam
b640: 65 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e 6f  e))).    (if (no
b650: 74 20 63 75 72 72 72 65 63 6f 72 64 29 0a 09 28  t currrecord)..(
b660: 62 65 67 69 6e 0a 09 20 20 28 73 65 74 21 20 63  begin..  (set! c
b670: 75 72 72 72 65 63 6f 72 64 20 28 6d 61 6b 65 2d  urrrecord (make-
b680: 76 65 63 74 6f 72 20 31 30 20 23 66 29 29 0a 09  vector 10 #f))..
b690: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73    (open-run-clos
b6a0: 65 20 64 62 3a 74 65 73 74 6d 65 74 61 2d 61 64  e db:testmeta-ad
b6b0: 64 2d 72 65 63 6f 72 64 20 64 62 20 74 65 73 74  d-record db test
b6c0: 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 66 6f  -name))).    (fo
b6d0: 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c 61  r-each .     (la
b6e0: 6d 62 64 61 20 28 6b 65 79 29 0a 20 20 20 20 20  mbda (key).     
b6f0: 20 20 28 6c 65 74 2a 20 28 28 69 64 78 20 28 63    (let* ((idx (c
b700: 61 64 72 20 6b 65 79 29 29 0a 09 20 20 20 20 20  adr key))..     
b710: 20 28 66 6c 64 20 28 63 61 72 20 20 6b 65 79 29   (fld (car  key)
b720: 29 0a 09 20 20 20 20 20 20 28 76 61 6c 20 28 63  )..      (val (c
b730: 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 65 73  onfig-lookup tes
b740: 74 2d 63 6f 6e 66 20 22 74 65 73 74 5f 6d 65 74  t-conf "test_met
b750: 61 22 20 66 6c 64 29 29 29 0a 09 20 3b 3b 20 28  a" fld))).. ;; (
b760: 64 65 62 75 67 3a 70 72 69 6e 74 20 35 20 22 69  debug:print 5 "i
b770: 64 78 3a 20 22 20 69 64 78 20 22 20 66 6c 64 3a  dx: " idx " fld:
b780: 20 22 20 66 6c 64 20 22 20 76 61 6c 3a 20 22 20   " fld " val: " 
b790: 76 61 6c 29 0a 09 20 28 69 66 20 28 61 6e 64 20  val).. (if (and 
b7a0: 76 61 6c 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f  val (not (equal?
b7b0: 20 28 76 65 63 74 6f 72 2d 72 65 66 20 63 75 72   (vector-ref cur
b7c0: 72 72 65 63 6f 72 64 20 69 64 78 29 20 76 61 6c  rrecord idx) val
b7d0: 29 29 29 0a 09 20 20 20 20 20 28 62 65 67 69 6e  )))..     (begin
b7e0: 0a 09 20 20 20 20 20 20 20 28 70 72 69 6e 74 20  ..       (print 
b7f0: 22 55 70 64 61 74 69 6e 67 20 22 20 74 65 73 74  "Updating " test
b800: 2d 6e 61 6d 65 20 22 20 22 20 66 6c 64 20 22 20  -name " " fld " 
b810: 74 6f 20 22 20 76 61 6c 29 0a 09 20 20 20 20 20  to " val)..     
b820: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73    (open-run-clos
b830: 65 20 64 62 3a 74 65 73 74 6d 65 74 61 2d 75 70  e db:testmeta-up
b840: 64 61 74 65 2d 66 69 65 6c 64 20 64 62 20 74 65  date-field db te
b850: 73 74 2d 6e 61 6d 65 20 66 6c 64 20 76 61 6c 29  st-name fld val)
b860: 29 29 29 29 0a 20 20 20 20 20 27 28 28 22 61 75  )))).     '(("au
b870: 74 68 6f 72 22 20 32 29 28 22 6f 77 6e 65 72 22  thor" 2)("owner"
b880: 20 33 29 28 22 64 65 73 63 72 69 70 74 69 6f 6e   3)("description
b890: 22 20 34 29 28 22 72 65 76 69 65 77 65 64 22 20  " 4)("reviewed" 
b8a0: 35 29 28 22 74 61 67 73 22 20 39 29 29 29 29 29  5)("tags" 9)))))
b8b0: 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74 65 73 74  ..;; Update test
b8c0: 5f 6d 65 74 61 20 66 6f 72 20 61 6c 6c 20 74 65  _meta for all te
b8d0: 73 74 73 0a 28 64 65 66 69 6e 65 20 28 72 75 6e  sts.(define (run
b8e0: 73 3a 75 70 64 61 74 65 2d 61 6c 6c 2d 74 65 73  s:update-all-tes
b8f0: 74 5f 6d 65 74 61 20 64 62 29 0a 20 20 28 6c 65  t_meta db).  (le
b900: 74 20 28 28 74 65 73 74 2d 6e 61 6d 65 73 20 28  t ((test-names (
b910: 67 65 74 2d 61 6c 6c 2d 6c 65 67 61 6c 2d 74 65  get-all-legal-te
b920: 73 74 73 29 29 29 0a 20 20 20 20 28 66 6f 72 2d  sts))).    (for-
b930: 65 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62  each .     (lamb
b940: 64 61 20 28 74 65 73 74 2d 6e 61 6d 65 29 0a 20  da (test-name). 
b950: 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74 65        (let* ((te
b960: 73 74 2d 70 61 74 68 20 20 20 20 28 63 6f 6e 63  st-path    (conc
b970: 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73   *toppath* "/tes
b980: 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29 29  ts/" test-name))
b990: 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d 63 6f  ..      (test-co
b9a0: 6e 66 69 67 66 20 28 63 6f 6e 63 20 74 65 73 74  nfigf (conc test
b9b0: 2d 70 61 74 68 20 22 2f 74 65 73 74 63 6f 6e 66  -path "/testconf
b9c0: 69 67 22 29 29 0a 09 20 20 20 20 20 20 28 74 65  ig"))..      (te
b9d0: 73 74 65 78 69 73 74 73 20 20 20 28 61 6e 64 20  stexists   (and 
b9e0: 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 74 65  (file-exists? te
b9f0: 73 74 2d 63 6f 6e 66 69 67 66 29 28 66 69 6c 65  st-configf)(file
ba00: 2d 72 65 61 64 2d 61 63 63 65 73 73 3f 20 74 65  -read-access? te
ba10: 73 74 2d 63 6f 6e 66 69 67 66 29 29 29 0a 09 20  st-configf))).. 
ba20: 20 20 20 20 20 3b 3b 20 72 65 61 64 20 63 6f 6e       ;; read con
ba30: 66 69 67 73 20 77 69 74 68 20 74 72 69 63 6b 73  figs with tricks
ba40: 20 74 75 72 6e 65 64 20 6f 66 66 20 28 69 2e 65   turned off (i.e
ba50: 2e 20 6e 6f 20 73 79 73 74 65 6d 29 0a 09 20 20  . no system)..  
ba60: 20 20 20 20 28 74 65 73 74 2d 63 6f 6e 66 20 20      (test-conf  
ba70: 20 20 28 69 66 20 74 65 73 74 65 78 69 73 74 73    (if testexists
ba80: 20 28 72 65 61 64 2d 63 6f 6e 66 69 67 20 74 65   (read-config te
ba90: 73 74 2d 63 6f 6e 66 69 67 66 20 23 66 20 23 66  st-configf #f #f
baa0: 29 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c  )(make-hash-tabl
bab0: 65 29 29 29 29 0a 09 20 3b 3b 20 75 73 65 20 74  e)))).. ;; use t
bac0: 68 65 20 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73  he open-run-clos
bad0: 65 20 69 6e 73 74 65 61 64 20 6f 66 20 70 61 73  e instead of pas
bae0: 73 69 6e 67 20 69 6e 20 64 62 0a 09 20 28 72 75  sing in db.. (ru
baf0: 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d  ns:update-test_m
bb00: 65 74 61 20 23 66 20 74 65 73 74 2d 6e 61 6d 65  eta #f test-name
bb10: 20 74 65 73 74 2d 63 6f 6e 66 29 29 29 0a 20 20   test-conf))).  
bb20: 20 20 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 29     test-names)))
bb30: 0a 0a 3b 3b 20 54 68 69 73 20 63 6f 75 6c 64 20  ..;; This could 
bb40: 70 72 6f 62 61 62 6c 79 20 62 65 20 72 65 66 61  probably be refa
bb50: 63 74 6f 72 65 64 20 69 6e 74 6f 20 6f 6e 65 20  ctored into one 
bb60: 63 6f 6d 70 6c 65 78 20 71 75 65 72 79 20 2e 2e  complex query ..
bb70: 2e 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a  ..(define (runs:
bb80: 72 6f 6c 6c 75 70 2d 72 75 6e 20 6b 65 79 73 20  rollup-run keys 
bb90: 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d  keyvallst runnam
bba0: 65 20 75 73 65 72 29 20 3b 3b 20 77 61 73 20 74  e user) ;; was t
bbb0: 61 72 67 65 74 2c 20 6e 6f 77 20 6b 65 79 76 61  arget, now keyva
bbc0: 6c 6c 73 74 0a 20 20 28 64 65 62 75 67 3a 70 72  llst.  (debug:pr
bbd0: 69 6e 74 20 34 20 22 72 75 6e 73 3a 72 6f 6c 6c  int 4 "runs:roll
bbe0: 75 70 2d 72 75 6e 2c 20 6b 65 79 73 3a 20 22 20  up-run, keys: " 
bbf0: 6b 65 79 73 20 22 20 6b 65 79 76 61 6c 6c 73 74  keys " keyvallst
bc00: 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 20 22 20  : " keyvallst " 
bc10: 3a 72 75 6e 6e 61 6d 65 20 22 20 72 75 6e 6e 61  :runname " runna
bc20: 6d 65 20 22 20 75 73 65 72 3a 20 22 20 75 73 65  me " user: " use
bc30: 72 29 0a 20 20 28 6c 65 74 2a 20 28 28 64 62 20  r).  (let* ((db 
bc40: 20 20 20 20 20 20 20 20 20 20 20 20 20 23 66 29               #f)
bc50: 20 3b 3b 20 28 6b 65 79 76 61 6c 6c 6c 73 74 20   ;; (keyvalllst 
bc60: 20 20 20 20 20 28 6b 65 79 73 3a 74 61 72 67 65       (keys:targe
bc70: 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 79 73 20 74  t->keyval keys t
bc80: 61 72 67 65 74 29 29 0a 09 20 28 6e 65 77 2d 72  arget)).. (new-r
bc90: 75 6e 2d 69 64 20 20 20 20 20 20 28 6f 70 65 6e  un-id      (open
bca0: 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 3a  -run-close runs:
bcb0: 72 65 67 69 73 74 65 72 2d 72 75 6e 20 64 62 20  register-run db 
bcc0: 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72  keys keyvallst r
bcd0: 75 6e 6e 61 6d 65 20 22 6e 65 77 22 20 22 6e 2f  unname "new" "n/
bce0: 61 22 20 75 73 65 72 29 29 0a 09 20 28 70 72 65  a" user)).. (pre
bcf0: 76 2d 74 65 73 74 73 20 20 20 20 20 20 28 6f 70  v-tests      (op
bd00: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 74 65 73  en-run-close tes
bd10: 74 3a 67 65 74 2d 6d 61 74 63 68 69 6e 67 2d 70  t:get-matching-p
bd20: 72 65 76 69 6f 75 73 2d 74 65 73 74 2d 72 75 6e  revious-test-run
bd30: 2d 72 65 63 6f 72 64 73 20 64 62 20 6e 65 77 2d  -records db new-
bd40: 72 75 6e 2d 69 64 20 22 25 22 20 22 25 22 29 29  run-id "%" "%"))
bd50: 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73 20 20  .. (curr-tests  
bd60: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c      (open-run-cl
bd70: 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 73  ose db:get-tests
bd80: 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77 2d  -for-run db new-
bd90: 72 75 6e 2d 69 64 20 22 25 2f 25 22 20 27 28 29  run-id "%/%" '()
bda0: 20 27 28 29 29 29 0a 09 20 28 63 75 72 72 2d 74   '())).. (curr-t
bdb0: 65 73 74 73 2d 68 61 73 68 20 28 6d 61 6b 65 2d  ests-hash (make-
bdc0: 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 20 20  hash-table))).  
bdd0: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73    (open-run-clos
bde0: 65 20 64 62 3a 75 70 64 61 74 65 2d 72 75 6e 2d  e db:update-run-
bdf0: 65 76 65 6e 74 5f 74 69 6d 65 20 64 62 20 6e 65  event_time db ne
be00: 77 2d 72 75 6e 2d 69 64 29 0a 20 20 20 20 3b 3b  w-run-id).    ;;
be10: 20 69 6e 64 65 78 20 74 68 65 20 61 6c 72 65 61   index the alrea
be20: 64 79 20 73 61 76 65 64 20 74 65 73 74 73 20 62  dy saved tests b
be30: 79 20 74 65 73 74 6e 61 6d 65 20 61 6e 64 20 69  y testname and i
be40: 74 65 6d 64 61 74 20 69 6e 20 63 75 72 72 2d 74  temdat in curr-t
be50: 65 73 74 73 2d 68 61 73 68 0a 20 20 20 20 28 66  ests-hash.    (f
be60: 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 28 6c 61  or-each.     (la
be70: 6d 62 64 61 20 28 74 65 73 74 64 61 74 29 0a 20  mbda (testdat). 
be80: 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74 65        (let* ((te
be90: 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 65 73 74  stname  (db:test
bea0: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65  -get-testname te
beb0: 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28  stdat))..      (
bec0: 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74 65  item-path (db:te
bed0: 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68  st-get-item-path
bee0: 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20   testdat))..    
bef0: 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f    (full-name (co
bf00: 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22 20  nc testname "/" 
bf10: 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 09 20 28  item-path))).. (
bf20: 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20  hash-table-set! 
bf30: 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20  curr-tests-hash 
bf40: 66 75 6c 6c 2d 6e 61 6d 65 20 74 65 73 74 64 61  full-name testda
bf50: 74 29 29 29 0a 20 20 20 20 20 63 75 72 72 2d 74  t))).     curr-t
bf60: 65 73 74 73 29 0a 20 20 20 20 3b 3b 20 4e 4f 50  ests).    ;; NOP
bf70: 45 3a 20 4e 6f 6e 2d 6f 70 74 69 6d 61 6c 20 61  E: Non-optimal a
bf80: 70 70 72 6f 61 63 68 2e 20 54 72 79 20 74 68 69  pproach. Try thi
bf90: 73 20 69 6e 73 74 65 61 64 2e 0a 20 20 20 20 3b  s instead..    ;
bfa0: 3b 20 20 20 31 2e 20 74 65 73 74 73 20 61 72 65  ;   1. tests are
bfb0: 20 72 65 63 65 69 76 65 64 20 69 6e 20 61 20 6c   received in a l
bfc0: 69 73 74 2c 20 6d 6f 73 74 20 72 65 63 65 6e 74  ist, most recent
bfd0: 20 66 69 72 73 74 0a 20 20 20 20 3b 3b 20 20 20   first.    ;;   
bfe0: 32 2e 20 72 65 70 6c 61 63 65 20 74 68 65 20 72  2. replace the r
bff0: 6f 6c 6c 75 70 20 74 65 73 74 20 77 69 74 68 20  ollup test with 
c000: 74 68 65 20 6e 65 77 20 2a 61 6c 77 61 79 73 2a  the new *always*
c010: 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a  .    (for-each .
c020: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74 65       (lambda (te
c030: 73 74 64 61 74 29 0a 20 20 20 20 20 20 20 28 6c  stdat).       (l
c040: 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 20 20  et* ((testname  
c050: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73  (db:test-get-tes
c060: 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29 0a  tname testdat)).
c070: 09 20 20 20 20 20 20 28 69 74 65 6d 2d 70 61 74  .      (item-pat
c080: 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  h (db:test-get-i
c090: 74 65 6d 2d 70 61 74 68 20 74 65 73 74 64 61 74  tem-path testdat
c0a0: 29 29 0a 09 20 20 20 20 20 20 28 66 75 6c 6c 2d  ))..      (full-
c0b0: 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 6e  name (conc testn
c0c0: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74  ame "/" item-pat
c0d0: 68 29 29 0a 09 20 20 20 20 20 20 28 70 72 65 76  h))..      (prev
c0e0: 2d 74 65 73 74 2d 64 61 74 20 28 68 61 73 68 2d  -test-dat (hash-
c0f0: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c  table-ref/defaul
c100: 74 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73  t curr-tests-has
c110: 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 23 66 29 29  h full-name #f))
c120: 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d 73 74  ..      (test-st
c130: 65 70 73 20 20 20 20 20 20 28 6f 70 65 6e 2d 72  eps      (open-r
c140: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d  un-close db:get-
c150: 73 74 65 70 73 2d 66 6f 72 2d 74 65 73 74 20 64  steps-for-test d
c160: 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  b (db:test-get-i
c170: 64 20 74 65 73 74 64 61 74 29 29 29 0a 09 20 20  d testdat)))..  
c180: 20 20 20 20 28 6e 65 77 2d 74 65 73 74 2d 72 65      (new-test-re
c190: 63 6f 72 64 20 23 66 29 29 0a 09 20 3b 3b 20 72  cord #f)).. ;; r
c1a0: 65 70 6c 61 63 65 20 74 68 65 73 65 20 77 69 74  eplace these wit
c1b0: 68 20 69 6e 73 65 72 74 20 2e 2e 2e 20 73 65 6c  h insert ... sel
c1c0: 65 63 74 0a 09 20 28 61 70 70 6c 79 20 73 71 6c  ect.. (apply sql
c1d0: 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09 09  ite3:execute ...
c1e0: 64 62 20 0a 09 09 28 63 6f 6e 63 20 22 49 4e 53  db ...(conc "INS
c1f0: 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49  ERT OR REPLACE I
c200: 4e 54 4f 20 74 65 73 74 73 20 28 72 75 6e 5f 69  NTO tests (run_i
c210: 64 2c 74 65 73 74 6e 61 6d 65 2c 73 74 61 74 65  d,testname,state
c220: 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69  ,status,event_ti
c230: 6d 65 2c 68 6f 73 74 2c 63 70 75 6c 6f 61 64 2c  me,host,cpuload,
c240: 64 69 73 6b 66 72 65 65 2c 75 6e 61 6d 65 2c 72  diskfree,uname,r
c250: 75 6e 64 69 72 2c 69 74 65 6d 5f 70 61 74 68 2c  undir,item_path,
c260: 72 75 6e 5f 64 75 72 61 74 69 6f 6e 2c 66 69 6e  run_duration,fin
c270: 61 6c 5f 6c 6f 67 66 2c 63 6f 6d 6d 65 6e 74 29  al_logf,comment)
c280: 20 22 0a 09 09 20 20 20 20 20 20 22 56 41 4c 55   "...      "VALU
c290: 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c  ES (?,?,?,?,?,?,
c2a0: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 29  ?,?,?,?,?,?,?,?)
c2b0: 3b 22 29 0a 09 09 6e 65 77 2d 72 75 6e 2d 69 64  ;")...new-run-id
c2c0: 20 28 63 64 64 72 20 28 76 65 63 74 6f 72 2d 3e   (cddr (vector->
c2d0: 6c 69 73 74 20 74 65 73 74 64 61 74 29 29 29 0a  list testdat))).
c2e0: 09 20 28 73 65 74 21 20 6e 65 77 2d 74 65 73 74  . (set! new-test
c2f0: 64 61 74 20 28 63 61 72 20 28 6f 70 65 6e 2d 72  dat (car (open-r
c300: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d  un-close db:get-
c310: 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62  tests-for-run db
c320: 20 6e 65 77 2d 72 75 6e 2d 69 64 20 28 63 6f 6e   new-run-id (con
c330: 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22 20 69  c testname "/" i
c340: 74 65 6d 2d 70 61 74 68 29 20 27 28 29 20 27 28  tem-path) '() '(
c350: 29 29 29 29 0a 09 20 28 68 61 73 68 2d 74 61 62  )))).. (hash-tab
c360: 6c 65 2d 73 65 74 21 20 63 75 72 72 2d 74 65 73  le-set! curr-tes
c370: 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d  ts-hash full-nam
c380: 65 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20 3b  e new-testdat) ;
c390: 3b 20 74 68 69 73 20 63 6f 75 6c 64 20 62 65 20  ; this could be 
c3a0: 63 6f 6e 66 75 73 69 6e 67 2c 20 77 68 69 63 68  confusing, which
c3b0: 20 72 65 63 6f 72 64 20 73 68 6f 75 6c 64 20 67   record should g
c3c0: 6f 20 69 6e 74 6f 20 74 68 65 20 6c 6f 6f 6b 75  o into the looku
c3d0: 70 20 74 61 62 6c 65 3f 0a 09 20 3b 3b 20 4e 6f  p table?.. ;; No
c3e0: 77 20 64 75 70 6c 69 63 61 74 65 20 74 68 65 20  w duplicate the 
c3f0: 74 65 73 74 20 73 74 65 70 73 0a 09 20 28 64 65  test steps.. (de
c400: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 43 6f 70  bug:print 4 "Cop
c410: 79 69 6e 67 20 72 65 63 6f 72 64 73 20 69 6e 20  ying records in 
c420: 74 65 73 74 5f 73 74 65 70 73 20 66 72 6f 6d 20  test_steps from 
c430: 74 65 73 74 5f 69 64 3d 22 20 28 64 62 3a 74 65  test_id=" (db:te
c440: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61  st-get-id testda
c450: 74 29 20 22 20 74 6f 20 22 20 28 64 62 3a 74 65  t) " to " (db:te
c460: 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65  st-get-id new-te
c470: 73 74 64 61 74 29 29 0a 09 20 28 6f 70 65 6e 2d  stdat)).. (open-
c480: 72 75 6e 2d 63 6c 6f 73 65 20 0a 09 20 20 28 6c  run-close ..  (l
c490: 61 6d 62 64 61 20 28 29 0a 09 20 20 20 20 28 73  ambda ()..    (s
c4a0: 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a  qlite3:execute .
c4b0: 09 20 20 20 20 20 64 62 20 0a 09 20 20 20 20 20  .     db ..     
c4c0: 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52  (conc "INSERT OR
c4d0: 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65   REPLACE INTO te
c4e0: 73 74 5f 73 74 65 70 73 20 28 74 65 73 74 5f 69  st_steps (test_i
c4f0: 64 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 74 65  d,stepname,state
c500: 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69  ,status,event_ti
c510: 6d 65 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09  me,comment) "...
c520: 20 20 20 22 53 45 4c 45 43 54 20 22 20 28 64 62     "SELECT " (db
c530: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77  :test-get-id new
c540: 2d 74 65 73 74 64 61 74 29 20 22 2c 73 74 65 70  -testdat) ",step
c550: 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75  name,state,statu
c560: 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d  s,event_time,com
c570: 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f 73  ment FROM test_s
c580: 74 65 70 73 20 57 48 45 52 45 20 74 65 73 74 5f  teps WHERE test_
c590: 69 64 3d 3f 3b 22 29 0a 09 20 20 20 20 20 28 64  id=?;")..     (d
c5a0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65  b:test-get-id te
c5b0: 73 74 64 61 74 29 29 0a 09 20 20 20 20 3b 3b 20  stdat))..    ;; 
c5c0: 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74 68  Now duplicate th
c5d0: 65 20 74 65 73 74 20 64 61 74 61 0a 09 20 20 20  e test data..   
c5e0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20   (debug:print 4 
c5f0: 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 73  "Copying records
c600: 20 69 6e 20 74 65 73 74 5f 64 61 74 61 20 66 72   in test_data fr
c610: 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62  om test_id=" (db
c620: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73  :test-get-id tes
c630: 74 64 61 74 29 20 22 20 74 6f 20 22 20 28 64 62  tdat) " to " (db
c640: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77  :test-get-id new
c650: 2d 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20  -testdat))..    
c660: 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65  (sqlite3:execute
c670: 20 0a 09 20 20 20 20 20 64 62 20 0a 09 20 20 20   ..     db ..   
c680: 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20    (conc "INSERT 
c690: 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20  OR REPLACE INTO 
c6a0: 74 65 73 74 5f 64 61 74 61 20 28 74 65 73 74 5f  test_data (test_
c6b0: 69 64 2c 63 61 74 65 67 6f 72 79 2c 76 61 72 69  id,category,vari
c6c0: 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65 63  able,value,expec
c6d0: 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f  ted,tol,units,co
c6e0: 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 22 53  mment) "...   "S
c6f0: 45 4c 45 43 54 20 22 20 28 64 62 3a 74 65 73 74  ELECT " (db:test
c700: 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74  -get-id new-test
c710: 64 61 74 29 20 22 2c 63 61 74 65 67 6f 72 79 2c  dat) ",category,
c720: 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65  variable,value,e
c730: 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74  xpected,tol,unit
c740: 73 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 74  s,comment FROM t
c750: 65 73 74 5f 64 61 74 61 20 57 48 45 52 45 20 74  est_data WHERE t
c760: 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 20  est_id=?;")..   
c770: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69    (db:test-get-i
c780: 64 20 74 65 73 74 64 61 74 29 29 29 29 0a 09 20  d testdat)))).. 
c790: 29 29 0a 20 20 20 20 20 70 72 65 76 2d 74 65 73  )).     prev-tes
c7a0: 74 73 29 29 29 0a 09 20 0a 20 20 20 20 20 0a     ts))).. .     .