Megatest

Hex Artifact Content
Login

Artifact 0b70ae9c19e1bb6bab789e2a2abc0bb08998e1a2:


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