Megatest

Hex Artifact Content
Login

Artifact 1aa6b158e42adee44ed1cad19ae48421032c8af7:


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 64 65 66 65 72 72 65 64 20 20 20 20  .. (deferred    
2450: 27 28 29 29 20 3b 3b 20 64 65 6c 61 79 20 72 75  '()) ;; delay ru
2460: 6e 6e 69 6e 67 20 74 68 65 73 65 20 73 69 6e 63  nning these sinc
2470: 65 20 74 68 65 79 20 68 61 76 65 20 61 20 77 61  e they have a wa
2480: 69 74 6f 6e 20 63 6c 61 75 73 65 0a 09 20 3b 3b  iton clause.. ;;
2490: 20 6b 65 65 70 67 6f 69 6e 67 20 69 73 20 74 68   keepgoing is th
24a0: 65 20 64 65 66 61 63 74 6f 20 6d 6f 64 61 6c 69  e defacto modali
24b0: 74 79 20 6e 6f 77 2c 20 77 69 6c 6c 20 61 64 64  ty now, will add
24c0: 20 68 69 74 2d 6e 2d 72 75 6e 20 61 20 62 69 74   hit-n-run a bit
24d0: 20 6c 61 74 65 72 0a 09 20 3b 3b 20 28 6b 65 65   later.. ;; (kee
24e0: 70 67 6f 69 6e 67 20 20 20 28 68 61 73 68 2d 74  pgoing   (hash-t
24f0: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74  able-ref/default
2500: 20 66 6c 61 67 73 20 22 2d 6b 65 65 70 67 6f 69   flags "-keepgoi
2510: 6e 67 22 20 23 66 29 29 0a 09 20 28 72 75 6e 63  ng" #f)).. (runc
2520: 6f 6e 66 69 67 66 20 20 20 28 63 6f 6e 63 20 20  onfigf   (conc  
2530: 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72 75 6e 63  *toppath* "/runc
2540: 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22 29 29  onfigs.config"))
2550: 0a 09 20 28 72 65 71 75 69 72 65 64 2d 74 65 73  .. (required-tes
2560: 74 73 20 27 28 29 29 0a 09 20 28 74 65 73 74 2d  ts '()).. (test-
2570: 72 65 63 6f 72 64 73 20 28 6d 61 6b 65 2d 68 61  records (make-ha
2580: 73 68 2d 74 61 62 6c 65 29 29 29 0a 0a 20 20 20  sh-table)))..   
2590: 20 28 73 65 74 2d 6d 65 67 61 74 65 73 74 2d 65   (set-megatest-e
25a0: 6e 76 2d 76 61 72 73 20 72 75 6e 2d 69 64 29 20  nv-vars run-id) 
25b0: 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62 65 20  ;; these may be 
25c0: 6e 65 65 64 65 64 20 62 79 20 74 68 65 20 6c 61  needed by the la
25d0: 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 73 0a  unching process.
25e0: 0a 20 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65  .    (if (file-e
25f0: 78 69 73 74 73 3f 20 72 75 6e 63 6f 6e 66 69 67  xists? runconfig
2600: 66 29 0a 09 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c  f)..(open-run-cl
2610: 6f 73 65 20 73 65 74 75 70 2d 65 6e 76 2d 64 65  ose setup-env-de
2620: 66 61 75 6c 74 73 20 64 62 20 72 75 6e 63 6f 6e  faults db runcon
2630: 66 69 67 66 20 72 75 6e 2d 69 64 20 2a 61 6c 72  figf run-id *alr
2640: 65 61 64 79 2d 73 65 65 6e 2d 72 75 6e 63 6f 6e  eady-seen-runcon
2650: 66 69 67 2d 69 6e 66 6f 2a 20 22 70 72 65 2d 6c  fig-info* "pre-l
2660: 61 75 6e 63 68 2d 65 6e 76 2d 76 61 72 73 22 29  aunch-env-vars")
2670: 0a 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30  ..(debug:print 0
2680: 20 22 57 41 52 4e 49 4e 47 3a 20 59 6f 75 20 64   "WARNING: You d
2690: 6f 20 6e 6f 74 20 68 61 76 65 20 61 20 72 75 6e  o not have a run
26a0: 20 63 6f 6e 66 69 67 20 66 69 6c 65 3a 20 22 20   config file: " 
26b0: 72 75 6e 63 6f 6e 66 69 67 66 29 29 0a 20 20 20  runconfigf)).   
26c0: 20 0a 20 20 20 20 3b 3b 20 6c 6f 6f 6b 20 75 70   .    ;; look up
26d0: 20 61 6c 6c 20 74 65 73 74 73 20 6d 61 74 63 68   all tests match
26e0: 69 6e 67 20 74 68 65 20 63 6f 6d 6d 61 20 73 65  ing the comma se
26f0: 70 61 72 61 74 65 64 20 6c 69 73 74 20 6f 66 20  parated list of 
2700: 67 6c 6f 62 73 20 69 6e 0a 20 20 20 20 3b 3b 20  globs in.    ;; 
2710: 74 65 73 74 2d 70 61 74 74 73 20 28 75 73 69 6e  test-patts (usin
2720: 67 20 25 20 61 73 20 77 69 6c 64 63 61 72 64 29  g % as wildcard)
2730: 0a 0a 20 20 20 20 28 73 65 74 21 20 74 65 73 74  ..    (set! test
2740: 2d 6e 61 6d 65 73 20 28 74 65 73 74 73 3a 67 65  -names (tests:ge
2750: 74 2d 76 61 6c 69 64 2d 74 65 73 74 73 20 2a 74  t-valid-tests *t
2760: 6f 70 70 61 74 68 2a 20 74 65 73 74 2d 6e 61 6d  oppath* test-nam
2770: 65 73 29 29 0a 20 20 20 20 28 73 65 74 21 20 74  es)).    (set! t
2780: 65 73 74 2d 6e 61 6d 65 73 20 28 64 65 6c 65 74  est-names (delet
2790: 65 2d 64 75 70 6c 69 63 61 74 65 73 20 74 65 73  e-duplicates tes
27a0: 74 2d 6e 61 6d 65 73 29 29 0a 0a 20 20 20 20 28  t-names))..    (
27b0: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
27c0: 20 30 20 22 74 65 73 74 20 6e 61 6d 65 73 20 22   0 "test names "
27d0: 20 74 65 73 74 2d 6e 61 6d 65 73 29 0a 0a 20 20   test-names)..  
27e0: 20 20 3b 3b 20 6f 6e 20 74 68 65 20 66 69 72 73    ;; on the firs
27f0: 74 20 70 61 73 73 20 6f 72 20 63 61 6c 6c 20 74  t pass or call t
2800: 6f 20 72 75 6e 2d 74 65 73 74 73 20 73 65 74 20  o run-tests set 
2810: 46 41 49 4c 53 20 74 6f 20 4e 4f 54 5f 53 54 41  FAILS to NOT_STA
2820: 52 54 45 44 20 69 66 0a 20 20 20 20 3b 3b 20 2d  RTED if.    ;; -
2830: 6b 65 65 70 67 6f 69 6e 67 20 69 73 20 73 70 65  keepgoing is spe
2840: 63 69 66 69 65 64 0a 20 20 20 20 28 69 66 20 28  cified.    (if (
2850: 65 71 3f 20 2a 70 61 73 73 6e 75 6d 2a 20 30 29  eq? *passnum* 0)
2860: 0a 09 28 62 65 67 69 6e 0a 09 20 20 3b 3b 20 68  ..(begin..  ;; h
2870: 61 76 65 20 74 6f 20 64 65 6c 65 74 65 20 74 65  ave to delete te
2880: 73 74 20 72 65 63 6f 72 64 73 20 77 68 65 72 65  st records where
2890: 20 4e 4f 54 5f 53 54 41 52 54 45 44 20 73 69 6e   NOT_STARTED sin
28a0: 63 65 20 74 68 65 79 20 63 61 6e 20 63 61 75 73  ce they can caus
28b0: 65 20 2d 6b 65 65 70 67 6f 69 6e 67 20 74 6f 20  e -keepgoing to 
28c0: 0a 09 20 20 3b 3b 20 67 65 74 20 73 74 75 63 6b  ..  ;; get stuck
28d0: 20 64 75 65 20 74 6f 20 62 65 63 6f 6d 69 6e 67   due to becoming
28e0: 20 69 6e 61 63 63 65 73 73 69 62 6c 65 20 66 72   inaccessible fr
28f0: 6f 6d 20 61 20 66 61 69 6c 65 64 20 74 65 73 74  om a failed test
2900: 2e 20 49 2e 65 2e 20 69 66 20 74 65 73 74 20 42  . I.e. if test B
2910: 20 64 65 70 65 6e 64 73 20 0a 09 20 20 3b 3b 20   depends ..  ;; 
2920: 6f 6e 20 74 65 73 74 20 41 20 62 75 74 20 74 65  on test A but te
2930: 73 74 20 42 20 72 65 61 63 68 65 64 20 74 68 65  st B reached the
2940: 20 70 6f 69 6e 74 20 6f 6e 20 62 65 69 6e 67 20   point on being 
2950: 72 65 67 69 73 74 65 72 65 64 20 61 73 20 4e 4f  registered as NO
2960: 54 5f 53 54 41 52 54 45 44 20 61 6e 64 20 74 65  T_STARTED and te
2970: 73 74 0a 09 20 20 3b 3b 20 41 20 66 61 69 6c 65  st..  ;; A faile
2980: 64 20 66 6f 72 20 73 6f 6d 65 20 72 65 61 73 6f  d for some reaso
2990: 6e 20 74 68 65 6e 20 6f 6e 20 72 65 2d 72 75 6e  n then on re-run
29a0: 20 75 73 69 6e 67 20 2d 6b 65 65 70 67 6f 69 6e   using -keepgoin
29b0: 67 20 74 68 65 20 72 75 6e 20 63 61 6e 20 6e 65  g the run can ne
29c0: 76 65 72 20 63 6f 6d 70 6c 65 74 65 2e 0a 09 20  ver complete... 
29d0: 20 28 63 64 62 3a 64 65 6c 65 74 65 2d 74 65 73   (cdb:delete-tes
29e0: 74 73 2d 69 6e 2d 73 74 61 74 65 20 2a 72 75 6e  ts-in-state *run
29f0: 72 65 6d 6f 74 65 2a 20 72 75 6e 2d 69 64 20 22  remote* run-id "
2a00: 4e 4f 54 5f 53 54 41 52 54 45 44 22 29 0a 09 20  NOT_STARTED").. 
2a10: 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e   (cdb:remote-run
2a20: 20 64 62 3a 73 65 74 2d 74 65 73 74 73 2d 73 74   db:set-tests-st
2a30: 61 74 65 2d 73 74 61 74 75 73 20 23 66 20 72 75  ate-status #f ru
2a40: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 73 20  n-id test-names 
2a50: 23 66 20 22 46 41 49 4c 22 20 22 4e 4f 54 5f 53  #f "FAIL" "NOT_S
2a60: 54 41 52 54 45 44 22 20 22 46 41 49 4c 22 29 29  TARTED" "FAIL"))
2a70: 29 0a 0a 20 20 20 20 3b 3b 20 66 72 6f 6d 20 68  )..    ;; from h
2a80: 65 72 65 20 6f 6e 20 6f 75 74 20 74 68 65 20 64  ere on out the d
2a90: 62 20 77 69 6c 6c 20 62 65 20 6f 70 65 6e 65 64  b will be opened
2aa0: 20 61 6e 64 20 63 6c 6f 73 65 64 20 6f 6e 20 65   and closed on e
2ab0: 76 65 72 79 20 63 61 6c 6c 20 72 75 6e 73 3a 72  very call runs:r
2ac0: 75 6e 2d 74 65 73 74 73 2d 71 75 65 75 65 0a 20  un-tests-queue. 
2ad0: 20 20 20 3b 3b 20 28 73 71 6c 69 74 65 33 3a 66     ;; (sqlite3:f
2ae0: 69 6e 61 6c 69 7a 65 21 20 64 62 29 20 0a 20 20  inalize! db) .  
2af0: 20 20 3b 3b 20 6e 6f 77 20 61 64 64 20 6e 6f 6e    ;; now add non
2b00: 2d 64 69 72 65 63 74 6c 79 20 72 65 66 65 72 65  -directly refere
2b10: 6e 63 65 64 20 64 65 70 65 6e 64 65 6e 63 69 65  nced dependencie
2b20: 73 20 28 69 2e 65 2e 20 77 61 69 74 6f 6e 29 0a  s (i.e. waiton).
2b30: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75      (if (not (nu
2b40: 6c 6c 3f 20 74 65 73 74 2d 6e 61 6d 65 73 29 29  ll? test-names))
2b50: 0a 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68 65  ..(let loop ((he
2b60: 64 20 28 63 61 72 20 74 65 73 74 2d 6e 61 6d 65  d (car test-name
2b70: 73 29 29 0a 09 09 20 20 20 28 74 61 6c 20 28 63  s))...   (tal (c
2b80: 64 72 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 29  dr test-names)))
2b90: 20 20 20 20 20 20 20 20 20 3b 3b 20 27 72 65 74           ;; 'ret
2ba0: 75 72 6e 2d 70 72 6f 63 73 20 74 65 6c 6c 73 20  urn-procs tells 
2bb0: 74 68 65 20 63 6f 6e 66 69 67 20 72 65 61 64 65  the config reade
2bc0: 72 20 74 6f 20 70 72 65 70 20 72 75 6e 6e 69 6e  r to prep runnin
2bd0: 67 20 73 79 73 74 65 6d 20 62 75 74 20 72 65 74  g system but ret
2be0: 75 72 6e 20 61 20 70 72 6f 63 0a 09 20 20 28 64  urn a proc..  (d
2bf0: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
2c00: 34 20 22 68 65 64 3d 22 20 68 65 64 20 22 20 61  4 "hed=" hed " a
2c10: 74 20 74 6f 70 20 6f 66 20 6c 6f 6f 70 22 29 0a  t top of loop").
2c20: 09 20 20 28 6c 65 74 2a 20 28 28 63 6f 6e 66 69  .  (let* ((confi
2c30: 67 20 20 28 74 65 73 74 73 3a 67 65 74 2d 74 65  g  (tests:get-te
2c40: 73 74 63 6f 6e 66 69 67 20 68 65 64 20 27 72 65  stconfig hed 're
2c50: 74 75 72 6e 2d 70 72 6f 63 73 29 29 0a 09 09 20  turn-procs))... 
2c60: 28 77 61 69 74 6f 6e 73 20 28 69 66 20 63 6f 6e  (waitons (if con
2c70: 66 69 67 20 28 73 74 72 69 6e 67 2d 73 70 6c 69  fig (string-spli
2c80: 74 20 28 6c 65 74 20 28 28 77 20 28 63 6f 6e 66  t (let ((w (conf
2c90: 69 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 67  ig-lookup config
2ca0: 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20   "requirements" 
2cb0: 22 77 61 69 74 6f 6e 22 29 29 29 0a 09 09 09 09  "waiton"))).....
2cc0: 09 09 20 20 20 20 20 28 69 66 20 77 20 77 20 22  ..     (if w w "
2cd0: 22 29 29 29 0a 09 09 09 20 20 20 20 20 20 28 62  ")))....      (b
2ce0: 65 67 69 6e 0a 09 09 09 09 28 64 65 62 75 67 3a  egin.....(debug:
2cf0: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
2d00: 6e 6f 6e 2d 65 78 69 73 74 65 6e 74 20 72 65 71  non-existent req
2d10: 75 69 72 65 64 20 74 65 73 74 20 5c 22 22 20 68  uired test \"" h
2d20: 65 64 20 22 5c 22 22 29 0a 20 20 20 20 20 20 20  ed "\"").       
2d30: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
2d40: 20 20 20 20 20 20 20 20 20 28 69 66 20 64 62 20           (if db 
2d50: 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a  (sqlite3:finaliz
2d60: 65 21 20 64 62 29 29 0a 09 09 09 09 28 65 78 69  e! db)).....(exi
2d70: 74 20 31 29 29 29 29 29 0a 09 20 20 20 20 3b 3b  t 1)))))..    ;;
2d80: 20 63 68 65 63 6b 20 66 6f 72 20 68 65 64 20 69   check for hed i
2d90: 6e 20 77 61 69 74 6f 6e 73 20 3d 3e 20 74 68 69  n waitons => thi
2da0: 73 20 77 6f 75 6c 64 20 62 65 20 63 69 72 63 75  s would be circu
2db0: 6c 61 72 2c 20 72 65 6d 6f 76 65 20 69 74 20 61  lar, remove it a
2dc0: 6e 64 20 69 73 73 75 65 20 61 6e 0a 09 20 20 20  nd issue an..   
2dd0: 20 3b 3b 20 65 72 72 6f 72 0a 09 20 20 20 20 28   ;; error..    (
2de0: 69 66 20 28 6d 65 6d 62 65 72 20 68 65 64 20 77  if (member hed w
2df0: 61 69 74 6f 6e 73 29 0a 09 09 28 62 65 67 69 6e  aitons)...(begin
2e00: 0a 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e  ...  (debug:prin
2e10: 74 20 30 20 22 45 52 52 4f 52 3a 20 74 65 73 74  t 0 "ERROR: test
2e20: 20 22 20 68 65 64 20 22 20 68 61 73 20 6c 69 73   " hed " has lis
2e30: 74 65 64 20 69 74 73 65 6c 66 20 61 73 20 61 20  ted itself as a 
2e40: 77 61 69 74 6f 6e 2c 20 70 6c 65 61 73 65 20 63  waiton, please c
2e50: 6f 72 72 65 63 74 20 74 68 69 73 21 22 29 0a 09  orrect this!")..
2e60: 09 20 20 28 73 65 74 21 20 77 61 69 74 6f 6e 73  .  (set! waitons
2e70: 20 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61   (filter (lambda
2e80: 20 28 78 29 28 6e 6f 74 20 28 65 71 75 61 6c 3f   (x)(not (equal?
2e90: 20 78 20 68 65 64 29 29 29 20 77 61 69 74 6f 6e   x hed))) waiton
2ea0: 73 29 29 29 29 0a 09 20 20 20 20 0a 09 20 20 20  s))))..    ..   
2eb0: 20 3b 3b 20 28 69 74 65 6d 73 20 20 20 28 69 74   ;; (items   (it
2ec0: 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72  ems:get-items-fr
2ed0: 6f 6d 2d 63 6f 6e 66 69 67 20 63 6f 6e 66 69 67  om-config config
2ee0: 29 29 29 0a 09 20 20 20 20 28 69 66 20 28 6e 6f  )))..    (if (no
2ef0: 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65  t (hash-table-re
2f00: 66 2f 64 65 66 61 75 6c 74 20 74 65 73 74 2d 72  f/default test-r
2f10: 65 63 6f 72 64 73 20 68 65 64 20 23 66 29 29 0a  ecords hed #f)).
2f20: 09 09 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65  ..(hash-table-se
2f30: 74 21 20 74 65 73 74 2d 72 65 63 6f 72 64 73 0a  t! test-records.
2f40: 09 09 09 09 20 68 65 64 20 28 76 65 63 74 6f 72  .... hed (vector
2f50: 20 68 65 64 20 20 20 20 20 3b 3b 20 30 0a 09 09   hed     ;; 0...
2f60: 09 09 09 20 20 20 20 20 63 6f 6e 66 69 67 20 20  ...     config  
2f70: 3b 3b 20 31 0a 09 09 09 09 09 20 20 20 20 20 77  ;; 1......     w
2f80: 61 69 74 6f 6e 73 20 3b 3b 20 32 0a 09 09 09 09  aitons ;; 2.....
2f90: 09 20 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f  .     (config-lo
2fa0: 6f 6b 75 70 20 63 6f 6e 66 69 67 20 22 72 65 71  okup config "req
2fb0: 75 69 72 65 6d 65 6e 74 73 22 20 22 70 72 69 6f  uirements" "prio
2fc0: 72 69 74 79 22 29 20 20 20 20 20 3b 3b 20 70 72  rity")     ;; pr
2fd0: 69 6f 72 69 74 79 20 33 0a 09 09 09 09 09 20 20  iority 3......  
2fe0: 20 20 20 28 6c 65 74 20 28 28 69 74 65 6d 73 20     (let ((items 
2ff0: 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65       (hash-table
3000: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63 6f 6e  -ref/default con
3010: 66 69 67 20 22 69 74 65 6d 73 22 20 23 66 29 29  fig "items" #f))
3020: 20 3b 3b 20 69 74 65 6d 73 20 34 0a 09 09 09 09   ;; items 4.....
3030: 09 09 20 20 20 28 69 74 65 6d 73 74 61 62 6c 65  ..   (itemstable
3040: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66   (hash-table-ref
3050: 2f 64 65 66 61 75 6c 74 20 63 6f 6e 66 69 67 20  /default config 
3060: 22 69 74 65 6d 73 74 61 62 6c 65 22 20 23 66 29  "itemstable" #f)
3070: 29 29 20 0a 09 09 09 09 09 20 20 20 20 20 20 20  )) ......       
3080: 3b 3b 20 69 66 20 65 69 74 68 65 72 20 69 74 65  ;; if either ite
3090: 6d 73 20 6f 72 20 69 74 65 6d 73 20 74 61 62 6c  ms or items tabl
30a0: 65 20 69 73 20 61 20 70 72 6f 63 20 72 65 74 75  e is a proc retu
30b0: 72 6e 20 69 74 20 73 6f 20 74 65 73 74 20 72 75  rn it so test ru
30c0: 6e 6e 69 6e 67 0a 09 09 09 09 09 20 20 20 20 20  nning......     
30d0: 20 20 3b 3b 20 70 72 6f 63 65 73 73 20 63 61 6e    ;; process can
30e0: 20 6b 6e 6f 77 20 74 6f 20 63 61 6c 6c 20 69 74   know to call it
30f0: 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72  ems:get-items-fr
3100: 6f 6d 2d 63 6f 6e 66 69 67 0a 09 09 09 09 09 20  om-config...... 
3110: 20 20 20 20 20 20 3b 3b 20 69 66 20 65 69 74 68        ;; if eith
3120: 65 72 20 69 73 20 61 20 6c 69 73 74 20 61 6e 64  er is a list and
3130: 20 6e 6f 6e 65 20 69 73 20 61 20 70 72 6f 63 20   none is a proc 
3140: 67 6f 20 61 68 65 61 64 20 61 6e 64 20 63 61 6c  go ahead and cal
3150: 6c 20 67 65 74 2d 69 74 65 6d 73 0a 09 09 09 09  l get-items.....
3160: 09 20 20 20 20 20 20 20 3b 3b 20 6f 74 68 65 72  .       ;; other
3170: 77 69 73 65 20 72 65 74 75 72 6e 20 23 66 20 2d  wise return #f -
3180: 20 74 68 69 73 20 69 73 20 6e 6f 74 20 61 6e 20   this is not an 
3190: 69 74 65 72 61 74 65 64 20 74 65 73 74 0a 09 09  iterated test...
31a0: 09 09 09 20 20 20 20 20 20 20 28 63 6f 6e 64 0a  ...       (cond.
31b0: 09 09 09 09 09 09 28 28 70 72 6f 63 65 64 75 72  ......((procedur
31c0: 65 3f 20 69 74 65 6d 73 29 20 20 20 20 20 20 0a  e? items)      .
31d0: 09 09 09 09 09 09 20 28 64 65 62 75 67 3a 70 72  ...... (debug:pr
31e0: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 69 74 65 6d  int-info 4 "item
31f0: 73 20 69 73 20 61 20 70 72 6f 63 65 64 75 72 65  s is a procedure
3200: 2c 20 77 69 6c 6c 20 63 61 6c 63 20 6c 61 74 65  , will calc late
3210: 72 22 29 0a 09 09 09 09 09 09 20 69 74 65 6d 73  r")....... items
3220: 29 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20  )            ;; 
3230: 63 61 6c 63 20 6c 61 74 65 72 0a 09 09 09 09 09  calc later......
3240: 09 28 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74  .((procedure? it
3250: 65 6d 73 74 61 62 6c 65 29 0a 09 09 09 09 09 09  emstable).......
3260: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
3270: 66 6f 20 34 20 22 69 74 65 6d 73 74 61 62 6c 65  fo 4 "itemstable
3280: 20 69 73 20 61 20 70 72 6f 63 65 64 75 72 65 2c   is a procedure,
3290: 20 77 69 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72   will calc later
32a0: 22 29 0a 09 09 09 09 09 09 20 69 74 65 6d 73 74  ")....... itemst
32b0: 61 62 6c 65 29 20 20 20 20 20 20 20 3b 3b 20 63  able)       ;; c
32c0: 61 6c 63 20 6c 61 74 65 72 0a 09 09 09 09 09 09  alc later.......
32d0: 28 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61  ((filter (lambda
32e0: 20 28 78 29 0a 09 09 09 09 09 09 09 20 20 20 28   (x)........   (
32f0: 6c 65 74 20 28 28 76 61 6c 20 28 63 61 72 20 78  let ((val (car x
3300: 29 29 29 0a 09 09 09 09 09 09 09 20 20 20 20 20  )))........     
3310: 28 69 66 20 28 70 72 6f 63 65 64 75 72 65 3f 20  (if (procedure? 
3320: 76 61 6c 29 20 76 61 6c 20 23 66 29 29 29 0a 09  val) val #f)))..
3330: 09 09 09 09 09 09 20 28 61 70 70 65 6e 64 20 28  ...... (append (
3340: 69 66 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29  if (list? items)
3350: 20 69 74 65 6d 73 20 27 28 29 29 0a 09 09 09 09   items '()).....
3360: 09 09 09 09 20 28 69 66 20 28 6c 69 73 74 3f 20  .... (if (list? 
3370: 69 74 65 6d 73 74 61 62 6c 65 29 20 69 74 65 6d  itemstable) item
3380: 73 74 61 62 6c 65 20 27 28 29 29 29 29 0a 09 09  stable '())))...
3390: 09 09 09 09 20 27 68 61 76 65 2d 70 72 6f 63 65  .... 'have-proce
33a0: 64 75 72 65 29 0a 09 09 09 09 09 09 28 28 6f 72  dure).......((or
33b0: 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 28 6c   (list? items)(l
33c0: 69 73 74 3f 20 69 74 65 6d 73 74 61 62 6c 65 29  ist? itemstable)
33d0: 29 20 3b 3b 20 63 61 6c 63 20 6e 6f 77 0a 09 09  ) ;; calc now...
33e0: 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e  .... (debug:prin
33f0: 74 2d 69 6e 66 6f 20 34 20 22 69 74 65 6d 73 20  t-info 4 "items 
3400: 61 6e 64 20 69 74 65 6d 73 74 61 62 6c 65 20 61  and itemstable a
3410: 72 65 20 6c 69 73 74 73 2c 20 63 61 6c 63 20 6e  re lists, calc n
3420: 6f 77 5c 6e 22 0a 09 09 09 09 09 09 09 20 20 20  ow\n"........   
3430: 20 20 20 22 20 20 20 20 69 74 65 6d 73 3a 20 22     "    items: "
3440: 20 69 74 65 6d 73 20 22 20 69 74 65 6d 73 74 61   items " itemsta
3450: 62 6c 65 3a 20 22 20 69 74 65 6d 73 74 61 62 6c  ble: " itemstabl
3460: 65 29 0a 09 09 09 09 09 09 20 28 69 74 65 6d 73  e)....... (items
3470: 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d  :get-items-from-
3480: 63 6f 6e 66 69 67 20 63 6f 6e 66 69 67 29 29 0a  config config)).
3490: 09 09 09 09 09 09 28 65 6c 73 65 20 23 66 29 29  ......(else #f))
34a0: 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  )               
34b0: 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 6e              ;; n
34c0: 6f 74 20 69 74 65 72 61 74 65 64 0a 09 09 09 09  ot iterated.....
34d0: 09 20 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b  .     #f      ;;
34e0: 20 69 74 65 6d 73 64 61 74 20 35 0a 09 09 09 09   itemsdat 5.....
34f0: 09 20 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b  .     #f      ;;
3500: 20 73 70 61 72 65 20 2d 20 75 73 65 64 20 66 6f   spare - used fo
3510: 72 20 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 09  r item-path.....
3520: 09 20 20 20 20 20 29 29 29 0a 09 20 20 20 20 28  .     )))..    (
3530: 66 6f 72 2d 65 61 63 68 20 0a 09 20 20 20 20 20  for-each ..     
3540: 28 6c 61 6d 62 64 61 20 28 77 61 69 74 6f 6e 29  (lambda (waiton)
3550: 0a 09 20 20 20 20 20 20 20 28 69 66 20 28 61 6e  ..       (if (an
3560: 64 20 77 61 69 74 6f 6e 20 28 6e 6f 74 20 28 6d  d waiton (not (m
3570: 65 6d 62 65 72 20 77 61 69 74 6f 6e 20 74 65 73  ember waiton tes
3580: 74 2d 6e 61 6d 65 73 29 29 29 0a 09 09 20 20 20  t-names)))...   
3590: 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20 28 73  (begin...     (s
35a0: 65 74 21 20 72 65 71 75 69 72 65 64 2d 74 65 73  et! required-tes
35b0: 74 73 20 28 63 6f 6e 73 20 77 61 69 74 6f 6e 20  ts (cons waiton 
35c0: 72 65 71 75 69 72 65 64 2d 74 65 73 74 73 29 29  required-tests))
35d0: 0a 09 09 20 20 20 20 20 28 73 65 74 21 20 74 65  ...     (set! te
35e0: 73 74 2d 6e 61 6d 65 73 20 28 63 6f 6e 73 20 77  st-names (cons w
35f0: 61 69 74 6f 6e 20 74 65 73 74 2d 6e 61 6d 65 73  aiton test-names
3600: 29 29 29 29 29 20 3b 3b 20 77 61 73 20 61 6e 20  ))))) ;; was an 
3610: 61 70 70 65 6e 64 2c 20 6e 6f 77 20 61 20 63 6f  append, now a co
3620: 6e 73 0a 09 20 20 20 20 20 77 61 69 74 6f 6e 73  ns..     waitons
3630: 29 0a 09 20 20 20 20 28 6c 65 74 20 28 28 72 65  )..    (let ((re
3640: 6d 74 65 73 74 73 20 28 64 65 6c 65 74 65 2d 64  mtests (delete-d
3650: 75 70 6c 69 63 61 74 65 73 20 28 61 70 70 65 6e  uplicates (appen
3660: 64 20 77 61 69 74 6f 6e 73 20 74 61 6c 29 29 29  d waitons tal)))
3670: 29 0a 09 20 20 20 20 20 20 28 69 66 20 28 6e 6f  )..      (if (no
3680: 74 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74  t (null? remtest
3690: 73 29 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63  s))...  (loop (c
36a0: 61 72 20 72 65 6d 74 65 73 74 73 29 28 63 64 72  ar remtests)(cdr
36b0: 20 72 65 6d 74 65 73 74 73 29 29 29 29 29 29 29   remtests)))))))
36c0: 0a 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28  ..    (if (not (
36d0: 6e 75 6c 6c 3f 20 72 65 71 75 69 72 65 64 2d 74  null? required-t
36e0: 65 73 74 73 29 29 0a 09 28 64 65 62 75 67 3a 70  ests))..(debug:p
36f0: 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 41 64 64  rint-info 1 "Add
3700: 69 6e 67 20 22 20 72 65 71 75 69 72 65 64 2d 74  ing " required-t
3710: 65 73 74 73 20 22 20 74 6f 20 74 68 65 20 72 75  ests " to the ru
3720: 6e 20 71 75 65 75 65 22 29 29 0a 20 20 20 20 3b  n queue")).    ;
3730: 3b 20 4e 4f 54 45 3a 20 74 68 65 73 65 20 61 72  ; NOTE: these ar
3740: 65 20 61 6c 6c 20 70 61 72 65 6e 74 20 74 65 73  e all parent tes
3750: 74 73 2c 20 69 74 65 6d 73 20 61 72 65 20 6e 6f  ts, items are no
3760: 74 20 65 78 70 61 6e 64 65 64 20 79 65 74 2e 0a  t expanded yet..
3770: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
3780: 2d 69 6e 66 6f 20 34 20 22 74 65 73 74 2d 72 65  -info 4 "test-re
3790: 63 6f 72 64 73 3d 22 20 28 68 61 73 68 2d 74 61  cords=" (hash-ta
37a0: 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65 73 74 2d  ble->alist test-
37b0: 72 65 63 6f 72 64 73 29 29 0a 20 20 20 20 28 72  records)).    (r
37c0: 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d 71 75  uns:run-tests-qu
37d0: 65 75 65 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61  eue run-id runna
37e0: 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20  me test-records 
37f0: 6b 65 79 76 61 6c 6c 73 74 20 66 6c 61 67 73 20  keyvallst flags 
3800: 74 65 73 74 2d 70 61 74 74 73 29 0a 20 20 20 20  test-patts).    
3810: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
3820: 6f 20 34 20 22 41 6c 6c 20 64 6f 6e 65 20 62 79  o 4 "All done by
3830: 20 68 65 72 65 22 29 29 29 0a 0a 28 64 65 66 69   here")))..(defi
3840: 6e 65 20 28 72 75 6e 73 3a 63 61 6c 63 2d 66 61  ne (runs:calc-fa
3850: 69 6c 73 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d  ils prereqs-not-
3860: 6d 65 74 29 0a 20 20 28 66 69 6c 74 65 72 20 28  met).  (filter (
3870: 6c 61 6d 62 64 61 20 28 74 65 73 74 29 0a 09 20  lambda (test).. 
3880: 20 20 20 28 61 6e 64 20 28 76 65 63 74 6f 72 3f     (and (vector?
3890: 20 74 65 73 74 29 20 3b 3b 20 6e 6f 74 20 28 73   test) ;; not (s
38a0: 74 72 69 6e 67 3f 20 74 65 73 74 29 29 0a 09 09  tring? test))...
38b0: 20 28 65 71 75 61 6c 3f 20 28 64 62 3a 74 65 73   (equal? (db:tes
38c0: 74 2d 67 65 74 2d 73 74 61 74 65 20 74 65 73 74  t-get-state test
38d0: 29 20 22 43 4f 4d 50 4c 45 54 45 44 22 29 0a 09  ) "COMPLETED")..
38e0: 09 20 28 6e 6f 74 20 28 6d 65 6d 62 65 72 20 28  . (not (member (
38f0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74  db:test-get-stat
3900: 75 73 20 74 65 73 74 29 0a 09 09 09 20 20 20 20  us test)....    
3910: 20 20 27 28 22 50 41 53 53 22 20 22 57 41 52 4e    '("PASS" "WARN
3920: 22 20 22 43 48 45 43 4b 22 20 22 57 41 49 56 45  " "CHECK" "WAIVE
3930: 44 22 29 29 29 29 29 0a 09 20 20 70 72 65 72 65  D")))))..  prere
3940: 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 0a 28 64  qs-not-met))..(d
3950: 65 66 69 6e 65 20 28 72 75 6e 73 3a 63 61 6c 63  efine (runs:calc
3960: 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 74 65 64 20 70  -not-completed p
3970: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a  rereqs-not-met).
3980: 20 20 28 66 69 6c 74 65 72 0a 20 20 20 28 6c 61    (filter.   (la
3990: 6d 62 64 61 20 28 74 29 0a 20 20 20 20 20 28 6f  mbda (t).     (o
39a0: 72 20 28 6e 6f 74 20 28 76 65 63 74 6f 72 3f 20  r (not (vector? 
39b0: 74 29 29 0a 09 20 28 6e 6f 74 20 28 65 71 75 61  t)).. (not (equa
39c0: 6c 3f 20 22 43 4f 4d 50 4c 45 54 45 44 22 20 28  l? "COMPLETED" (
39d0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74  db:test-get-stat
39e0: 65 20 74 29 29 29 29 29 0a 20 20 20 70 72 65 72  e t))))).   prer
39f0: 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 0a 28  eqs-not-met))..(
3a00: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 70 72 65  define (runs:pre
3a10: 74 74 79 2d 73 74 72 69 6e 67 20 6c 73 74 29 0a  tty-string lst).
3a20: 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28    (map (lambda (
3a30: 74 29 0a 09 20 28 69 66 20 28 6e 6f 74 20 28 76  t).. (if (not (v
3a40: 65 63 74 6f 72 3f 20 74 29 29 0a 09 20 20 20 20  ector? t))..    
3a50: 20 28 63 6f 6e 63 20 74 29 0a 09 20 20 20 20 20   (conc t)..     
3a60: 28 63 6f 6e 63 20 28 64 62 3a 74 65 73 74 2d 67  (conc (db:test-g
3a70: 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 29 20 22  et-testname t) "
3a80: 3a 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  :" (db:test-get-
3a90: 73 74 61 74 65 20 74 29 20 22 2f 22 20 28 64 62  state t) "/" (db
3aa0: 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73  :test-get-status
3ab0: 20 74 29 29 29 29 0a 20 20 20 20 20 20 20 6c 73   t)))).       ls
3ac0: 74 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75  t))..(define (ru
3ad0: 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 73  ns:make-full-tes
3ae0: 74 2d 6e 61 6d 65 20 74 65 73 74 6e 61 6d 65 20  t-name testname 
3af0: 69 74 65 6d 70 61 74 68 29 0a 20 20 28 69 66 20  itempath).  (if 
3b00: 28 65 71 75 61 6c 3f 20 69 74 65 6d 70 61 74 68  (equal? itempath
3b10: 20 22 22 29 20 74 65 73 74 6e 61 6d 65 20 28 63   "") testname (c
3b20: 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22  onc testname "/"
3b30: 20 69 74 65 6d 70 61 74 68 29 29 29 0a 0a 3b 3b   itempath)))..;;
3b40: 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 69 73   test-records is
3b50: 20 61 20 68 61 73 68 20 74 61 62 6c 65 20 74 65   a hash table te
3b60: 73 74 6e 61 6d 65 3a 69 74 65 6d 5f 70 61 74 68  stname:item_path
3b70: 20 3d 3e 20 76 65 63 74 6f 72 20 3c 20 74 65 73   => vector < tes
3b80: 74 6e 61 6d 65 20 74 65 73 74 63 6f 6e 66 69 67  tname testconfig
3b90: 20 77 61 69 74 6f 6e 73 20 70 72 69 6f 72 69 74   waitons priorit
3ba0: 79 20 69 74 65 6d 73 2d 69 6e 66 6f 20 2e 2e 2e  y items-info ...
3bb0: 20 3e 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73   >.(define (runs
3bc0: 3a 72 75 6e 2d 74 65 73 74 73 2d 71 75 65 75 65  :run-tests-queue
3bd0: 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20   run-id runname 
3be0: 74 65 73 74 2d 72 65 63 6f 72 64 73 20 6b 65 79  test-records key
3bf0: 76 61 6c 6c 73 74 20 66 6c 61 67 73 20 74 65 73  vallst flags tes
3c00: 74 2d 70 61 74 74 73 29 0a 20 20 20 20 3b 3b 20  t-patts).    ;; 
3c10: 41 74 20 74 68 69 73 20 70 6f 69 6e 74 20 74 68  At this point th
3c20: 65 20 6c 69 73 74 20 6f 66 20 70 61 72 65 6e 74  e list of parent
3c30: 20 74 65 73 74 73 20 69 73 20 65 78 70 61 6e 64   tests is expand
3c40: 65 64 20 0a 20 20 20 20 3b 3b 20 4e 42 2f 2f 20  ed .    ;; NB// 
3c50: 53 68 6f 75 6c 64 20 65 78 70 61 6e 64 20 69 74  Should expand it
3c60: 65 6d 73 20 68 65 72 65 20 61 6e 64 20 74 68 65  ems here and the
3c70: 6e 20 69 6e 73 65 72 74 20 69 6e 74 6f 20 74 68  n insert into th
3c80: 65 20 72 75 6e 20 71 75 65 75 65 2e 0a 20 20 28  e run queue..  (
3c90: 64 65 62 75 67 3a 70 72 69 6e 74 20 35 20 22 74  debug:print 5 "t
3ca0: 65 73 74 2d 72 65 63 6f 72 64 73 3a 20 22 20 74  est-records: " t
3cb0: 65 73 74 2d 72 65 63 6f 72 64 73 20 22 2c 20 6b  est-records ", k
3cc0: 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65 79 76  eyvallst: " keyv
3cd0: 61 6c 6c 73 74 20 22 20 66 6c 61 67 73 3a 20 22  allst " flags: "
3ce0: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61 6c   (hash-table->al
3cf0: 69 73 74 20 66 6c 61 67 73 29 29 0a 20 20 28 6c  ist flags)).  (l
3d00: 65 74 20 28 28 73 6f 72 74 65 64 2d 74 65 73 74  et ((sorted-test
3d10: 2d 6e 61 6d 65 73 20 28 74 65 73 74 73 3a 73 6f  -names (tests:so
3d20: 72 74 2d 62 79 2d 70 72 69 6f 72 69 74 79 2d 61  rt-by-priority-a
3d30: 6e 64 2d 77 61 69 74 6f 6e 20 74 65 73 74 2d 72  nd-waiton test-r
3d40: 65 63 6f 72 64 73 29 29 0a 09 28 74 65 73 74 2d  ecords))..(test-
3d50: 72 65 67 69 73 74 65 72 79 20 20 20 20 28 6d 61  registery    (ma
3d60: 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 0a  ke-hash-table)).
3d70: 09 28 6e 75 6d 2d 72 65 74 72 69 65 73 20 20 20  .(num-retries   
3d80: 20 20 20 20 20 30 29 0a 09 28 6d 61 78 2d 72 65       0)..(max-re
3d90: 74 72 69 65 73 20 20 20 20 20 20 20 28 63 6f 6e  tries       (con
3da0: 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66  fig-lookup *conf
3db0: 69 67 64 61 74 2a 20 22 73 65 74 75 70 22 20 22  igdat* "setup" "
3dc0: 6d 61 78 72 65 74 72 69 65 73 22 29 29 29 0a 20  maxretries"))). 
3dd0: 20 20 20 28 73 65 74 21 20 6d 61 78 2d 72 65 74     (set! max-ret
3de0: 72 69 65 73 20 28 69 66 20 28 61 6e 64 20 6d 61  ries (if (and ma
3df0: 78 2d 72 65 74 72 69 65 73 20 28 73 74 72 69 6e  x-retries (strin
3e00: 67 2d 3e 6e 75 6d 62 65 72 20 6d 61 78 2d 72 65  g->number max-re
3e10: 74 72 69 65 73 29 29 28 73 74 72 69 6e 67 2d 3e  tries))(string->
3e20: 6e 75 6d 62 65 72 20 6d 61 78 2d 72 65 74 72 69  number max-retri
3e30: 65 73 29 20 31 30 30 29 29 0a 20 20 20 20 28 69  es) 100)).    (i
3e40: 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 73 6f  f (not (null? so
3e50: 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29  rted-test-names)
3e60: 29 0a 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68  )..(let loop ((h
3e70: 65 64 20 20 20 20 20 20 20 20 20 28 63 61 72 20  ed         (car 
3e80: 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65  sorted-test-name
3e90: 73 29 29 0a 09 09 20 20 20 28 74 61 6c 20 20 20  s))...   (tal   
3ea0: 20 20 20 20 20 20 28 63 64 72 20 73 6f 72 74 65        (cdr sorte
3eb0: 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09  d-test-names))..
3ec0: 09 20 20 20 28 72 65 72 75 6e 73 20 20 20 20 20  .   (reruns     
3ed0: 20 27 28 29 29 29 0a 09 20 20 28 69 66 20 28 6e   '()))..  (if (n
3ee0: 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 72 75 6e 73  ot (null? reruns
3ef0: 29 29 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69  ))(debug:print-i
3f00: 6e 66 6f 20 34 20 22 72 65 72 75 6e 73 3d 22 20  nfo 4 "reruns=" 
3f10: 72 65 72 75 6e 73 29 29 0a 09 20 20 3b 3b 20 28  reruns))..  ;; (
3f20: 70 72 69 6e 74 20 22 54 6f 70 20 6f 66 20 6c 6f  print "Top of lo
3f30: 6f 70 2c 20 68 65 64 3d 22 20 68 65 64 20 22 2c  op, hed=" hed ",
3f40: 20 74 61 6c 3d 22 20 74 61 6c 20 22 20 2c 72 65   tal=" tal " ,re
3f50: 72 75 6e 73 3d 22 20 72 65 72 75 6e 73 29 0a 09  runs=" reruns)..
3f60: 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 72    (let* ((test-r
3f70: 65 63 6f 72 64 20 28 68 61 73 68 2d 74 61 62 6c  ecord (hash-tabl
3f80: 65 2d 72 65 66 20 74 65 73 74 2d 72 65 63 6f 72  e-ref test-recor
3f90: 64 73 20 68 65 64 29 29 0a 09 09 20 28 74 65 73  ds hed))... (tes
3fa0: 74 2d 6e 61 6d 65 20 20 20 28 74 65 73 74 73 3a  t-name   (tests:
3fb0: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65  testqueue-get-te
3fc0: 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f  stname test-reco
3fd0: 72 64 29 29 0a 09 09 20 28 74 63 6f 6e 66 69 67  rd))... (tconfig
3fe0: 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74       (tests:test
3ff0: 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 63 6f  queue-get-testco
4000: 6e 66 69 67 20 74 65 73 74 2d 72 65 63 6f 72 64  nfig test-record
4010: 29 29 0a 09 09 20 28 74 65 73 74 6d 6f 64 65 20  ))... (testmode 
4020: 20 20 20 28 6c 65 74 20 28 28 6d 20 28 63 6f 6e     (let ((m (con
4030: 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 63 6f 6e 66  fig-lookup tconf
4040: 69 67 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73  ig "requirements
4050: 22 20 22 6d 6f 64 65 22 29 29 29 0a 09 09 09 09  " "mode"))).....
4060: 28 69 66 20 6d 20 28 73 74 72 69 6e 67 2d 3e 73  (if m (string->s
4070: 79 6d 62 6f 6c 20 6d 29 20 27 6e 6f 72 6d 61 6c  ymbol m) 'normal
4080: 29 29 29 0a 09 09 20 28 77 61 69 74 6f 6e 73 20  )))... (waitons 
4090: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71      (tests:testq
40a0: 75 65 75 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73  ueue-get-waitons
40b0: 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29      test-record)
40c0: 29 0a 09 09 20 28 70 72 69 6f 72 69 74 79 20 20  )... (priority  
40d0: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65    (tests:testque
40e0: 75 65 2d 67 65 74 2d 70 72 69 6f 72 69 74 79 20  ue-get-priority 
40f0: 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a    test-record)).
4100: 09 09 20 28 69 74 65 6d 64 61 74 20 20 20 20 20  .. (itemdat     
4110: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65  (tests:testqueue
4120: 2d 67 65 74 2d 69 74 65 6d 64 61 74 20 20 20 20  -get-itemdat    
4130: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 20 3b 3b  test-record)) ;;
4140: 20 69 74 65 6d 64 61 74 20 63 61 6e 20 62 65 20   itemdat can be 
4150: 61 20 73 74 72 69 6e 67 2c 20 6c 69 73 74 20 6f  a string, list o
4160: 72 20 23 66 0a 09 09 20 28 69 74 65 6d 73 20 20  r #f... (items  
4170: 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74       (tests:test
4180: 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d 73 20  queue-get-items 
4190: 20 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64       test-record
41a0: 29 29 0a 09 09 20 28 69 74 65 6d 2d 70 61 74 68  ))... (item-path
41b0: 20 20 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70     (item-list->p
41c0: 61 74 68 20 69 74 65 6d 64 61 74 29 29 0a 09 09  ath itemdat))...
41d0: 20 28 6e 65 77 74 61 6c 20 20 20 20 20 20 28 61   (newtal      (a
41e0: 70 70 65 6e 64 20 74 61 6c 20 28 6c 69 73 74 20  ppend tal (list 
41f0: 68 65 64 29 29 29 29 0a 09 20 20 20 20 0a 09 20  hed))))..    .. 
4200: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
4210: 36 0a 09 09 09 20 22 74 65 73 74 2d 6e 61 6d 65  6.... "test-name
4220: 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 0a 09 09  : " test-name...
4230: 09 20 22 5c 6e 20 20 68 65 64 3a 20 20 20 20 20  . "\n  hed:     
4240: 20 20 20 20 22 20 68 65 64 0a 09 09 09 20 22 5c      " hed.... "\
4250: 6e 20 20 69 74 65 6d 64 61 74 3a 20 20 20 20 20  n  itemdat:     
4260: 22 20 69 74 65 6d 64 61 74 0a 09 09 09 20 22 5c  " itemdat.... "\
4270: 6e 20 20 69 74 65 6d 73 3a 20 20 20 20 20 20 20  n  items:       
4280: 22 20 69 74 65 6d 73 0a 09 09 09 20 22 5c 6e 20  " items.... "\n 
4290: 20 69 74 65 6d 2d 70 61 74 68 3a 20 20 20 22 20   item-path:   " 
42a0: 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 20 22 5c  item-path.... "\
42b0: 6e 20 20 77 61 69 74 6f 6e 73 3a 20 20 20 20 20  n  waitons:     
42c0: 22 20 77 61 69 74 6f 6e 73 0a 09 09 09 20 22 5c  " waitons.... "\
42d0: 6e 20 20 6e 75 6d 2d 72 65 74 72 69 65 73 3a 20  n  num-retries: 
42e0: 22 20 6e 75 6d 2d 72 65 74 72 69 65 73 0a 09 09  " num-retries...
42f0: 09 20 22 5c 6e 20 20 74 61 6c 3a 20 20 20 20 20  . "\n  tal:     
4300: 20 20 20 20 22 20 74 61 6c 0a 09 09 09 20 22 5c      " tal.... "\
4310: 6e 20 20 72 65 72 75 6e 73 3a 20 20 20 20 20 20  n  reruns:      
4320: 22 20 72 65 72 75 6e 73 29 0a 0a 09 20 20 20 20  " reruns)...    
4330: 3b 3b 20 63 68 65 63 6b 20 66 6f 72 20 68 65 64  ;; check for hed
4340: 20 69 6e 20 77 61 69 74 6f 6e 73 20 3d 3e 20 74   in waitons => t
4350: 68 69 73 20 77 6f 75 6c 64 20 62 65 20 63 69 72  his would be cir
4360: 63 75 6c 61 72 2c 20 72 65 6d 6f 76 65 20 69 74  cular, remove it
4370: 20 61 6e 64 20 69 73 73 75 65 20 61 6e 0a 09 20   and issue an.. 
4380: 20 20 20 3b 3b 20 65 72 72 6f 72 0a 09 20 20 20     ;; error..   
4390: 20 28 69 66 20 28 6d 65 6d 62 65 72 20 74 65 73   (if (member tes
43a0: 74 2d 6e 61 6d 65 20 77 61 69 74 6f 6e 73 29 0a  t-name waitons).
43b0: 09 09 28 62 65 67 69 6e 0a 09 09 20 20 28 64 65  ..(begin...  (de
43c0: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52  bug:print 0 "ERR
43d0: 4f 52 3a 20 74 65 73 74 20 22 20 74 65 73 74 2d  OR: test " test-
43e0: 6e 61 6d 65 20 22 20 68 61 73 20 6c 69 73 74 65  name " has liste
43f0: 64 20 69 74 73 65 6c 66 20 61 73 20 61 20 77 61  d itself as a wa
4400: 69 74 6f 6e 2c 20 70 6c 65 61 73 65 20 63 6f 72  iton, please cor
4410: 72 65 63 74 20 74 68 69 73 21 22 29 0a 09 09 20  rect this!")... 
4420: 20 28 73 65 74 21 20 77 61 69 74 6f 6e 20 28 66   (set! waiton (f
4430: 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78  ilter (lambda (x
4440: 29 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 78 20  )(not (equal? x 
4450: 68 65 64 29 29 29 20 77 61 69 74 6f 6e 73 29 29  hed))) waitons))
4460: 29 29 0a 0a 09 20 20 20 20 28 63 6f 6e 64 20 3b  ))...    (cond ;
4470: 3b 20 4f 55 54 45 52 20 43 4f 4e 44 0a 09 20 20  ; OUTER COND..  
4480: 20 20 20 28 28 6e 6f 74 20 69 74 65 6d 73 29 20     ((not items) 
4490: 3b 3b 20 77 68 65 6e 20 66 61 6c 73 65 20 74 68  ;; when false th
44a0: 65 20 74 65 73 74 20 69 73 20 6f 6b 20 74 6f 20  e test is ok to 
44b0: 62 65 20 68 61 6e 64 65 64 20 6f 66 66 20 74 6f  be handed off to
44c0: 20 6c 61 75 6e 63 68 20 28 62 75 74 20 6e 6f 74   launch (but not
44d0: 20 62 65 66 6f 72 65 29 0a 09 20 20 20 20 20 20   before)..      
44e0: 28 6c 65 74 2a 20 28 28 72 75 6e 2d 6c 69 6d 69  (let* ((run-limi
44f0: 74 73 2d 69 6e 66 6f 20 20 20 20 20 20 20 20 20  ts-info         
4500: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
4510: 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72  runs:can-run-mor
4520: 65 2d 74 65 73 74 73 20 74 65 73 74 2d 72 65 63  e-tests test-rec
4530: 6f 72 64 29 29 20 3b 3b 20 6c 6f 6f 6b 20 61 74  ord)) ;; look at
4540: 20 74 68 65 20 74 65 73 74 20 6a 6f 62 67 72 6f   the test jobgro
4550: 75 70 20 61 6e 64 20 74 6f 74 20 6a 6f 62 73 20  up and tot jobs 
4560: 72 75 6e 6e 69 6e 67 0a 09 09 20 20 20 20 20 28  running...     (
4570: 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 20 20  have-resources  
4580: 20 20 20 20 20 20 20 20 28 63 61 72 20 72 75 6e          (car run
4590: 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 29 29 0a 09  -limits-info))..
45a0: 09 20 20 20 20 20 28 6e 75 6d 2d 72 75 6e 6e 69  .     (num-runni
45b0: 6e 67 20 20 20 20 20 20 20 20 20 20 20 20 20 28  ng             (
45c0: 6c 69 73 74 2d 72 65 66 20 72 75 6e 2d 6c 69 6d  list-ref run-lim
45d0: 69 74 73 2d 69 6e 66 6f 20 31 29 29 0a 09 09 20  its-info 1))... 
45e0: 20 20 20 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67      (num-running
45f0: 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 28 6c 69  -in-jobgroup (li
4600: 73 74 2d 72 65 66 20 72 75 6e 2d 6c 69 6d 69 74  st-ref run-limit
4610: 73 2d 69 6e 66 6f 20 32 29 29 0a 09 09 20 20 20  s-info 2))...   
4620: 20 20 28 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e    (max-concurren
4630: 74 2d 6a 6f 62 73 20 20 20 20 20 28 6c 69 73 74  t-jobs     (list
4640: 2d 72 65 66 20 72 75 6e 2d 6c 69 6d 69 74 73 2d  -ref run-limits-
4650: 69 6e 66 6f 20 33 29 29 0a 09 09 20 20 20 20 20  info 3))...     
4660: 28 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74  (job-group-limit
4670: 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 2d 72           (list-r
4680: 65 66 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e  ef run-limits-in
4690: 66 6f 20 34 29 29 0a 09 09 20 20 20 20 20 28 70  fo 4))...     (p
46a0: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 20  rereqs-not-met  
46b0: 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e         (open-run
46c0: 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 70 72  -close db:get-pr
46d0: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 23 66  ereqs-not-met #f
46e0: 20 72 75 6e 2d 69 64 20 77 61 69 74 6f 6e 73 20   run-id waitons 
46f0: 69 74 65 6d 2d 70 61 74 68 20 6d 6f 64 65 3a 20  item-path mode: 
4700: 74 65 73 74 6d 6f 64 65 29 29 0a 09 09 20 20 20  testmode))...   
4710: 20 20 28 66 61 69 6c 73 20 20 20 20 20 20 20 20    (fails        
4720: 20 20 20 20 20 20 20 20 20 20 20 28 72 75 6e 73             (runs
4730: 3a 63 61 6c 63 2d 66 61 69 6c 73 20 70 72 65 72  :calc-fails prer
4740: 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 09 09  eqs-not-met))...
4750: 20 20 20 20 20 28 6e 6f 6e 2d 63 6f 6d 70 6c 65       (non-comple
4760: 74 65 64 20 20 20 20 20 20 20 20 20 20 20 28 72  ted           (r
4770: 75 6e 73 3a 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d  uns:calc-not-com
4780: 70 6c 65 74 65 64 20 70 72 65 72 65 71 73 2d 6e  pleted prereqs-n
4790: 6f 74 2d 6d 65 74 29 29 29 0a 09 09 28 64 65 62  ot-met)))...(deb
47a0: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 38 20  ug:print-info 8 
47b0: 22 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 3a  "have-resources:
47c0: 20 22 20 68 61 76 65 2d 72 65 73 6f 75 72 63 65   " have-resource
47d0: 73 20 22 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d  s " prereqs-not-
47e0: 6d 65 74 3a 20 22 20 0a 09 09 09 20 20 20 20 20  met: " ....     
47f0: 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65  (string-interspe
4800: 72 73 65 20 0a 09 09 09 20 20 20 20 20 20 28 6d  rse ....      (m
4810: 61 70 20 28 6c 61 6d 62 64 61 20 28 74 29 0a 09  ap (lambda (t)..
4820: 09 09 09 20 20 20 20 20 28 69 66 20 28 76 65 63  ...     (if (vec
4830: 74 6f 72 3f 20 74 29 0a 09 09 09 09 09 20 28 63  tor? t)...... (c
4840: 6f 6e 63 20 28 64 62 3a 74 65 73 74 2d 67 65 74  onc (db:test-get
4850: 2d 73 74 61 74 65 20 74 29 20 22 2f 22 20 28 64  -state t) "/" (d
4860: 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75  b:test-get-statu
4870: 73 20 74 29 29 0a 09 09 09 09 09 20 28 63 6f 6e  s t))...... (con
4880: 63 20 22 20 57 41 52 4e 49 4e 47 3a 20 74 20 69  c " WARNING: t i
4890: 73 20 6e 6f 74 20 61 20 76 65 63 74 6f 72 3d 22  s not a vector="
48a0: 20 74 20 29 29 29 0a 09 09 09 09 20 20 20 70 72   t ))).....   pr
48b0: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 20 22  ereqs-not-met) "
48c0: 2c 20 22 29 20 22 20 66 61 69 6c 73 3a 20 22 20  , ") " fails: " 
48d0: 66 61 69 6c 73 29 0a 09 09 28 64 65 62 75 67 3a  fails)...(debug:
48e0: 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 68 65  print-info 4 "he
48f0: 64 3d 22 20 68 65 64 20 22 5c 6e 20 20 74 65 73  d=" hed "\n  tes
4900: 74 2d 72 65 63 6f 72 64 3d 22 20 74 65 73 74 2d  t-record=" test-
4910: 72 65 63 6f 72 64 20 22 5c 6e 20 20 74 65 73 74  record "\n  test
4920: 2d 6e 61 6d 65 3a 20 22 20 74 65 73 74 2d 6e 61  -name: " test-na
4930: 6d 65 20 22 5c 6e 20 20 69 74 65 6d 2d 70 61 74  me "\n  item-pat
4940: 68 3a 20 22 20 69 74 65 6d 2d 70 61 74 68 20 22  h: " item-path "
4950: 5c 6e 20 20 74 65 73 74 2d 70 61 74 74 73 3a 20  \n  test-patts: 
4960: 22 20 74 65 73 74 2d 70 61 74 74 73 29 0a 0a 09  " test-patts)...
4970: 09 3b 3b 20 44 6f 6e 27 74 20 6b 6e 6f 77 20 61  .;; Don't know a
4980: 74 20 74 68 69 73 20 74 69 6d 65 20 69 66 20 74  t this time if t
4990: 68 65 20 74 65 73 74 20 68 61 76 65 20 62 65 65  he test have bee
49a0: 6e 20 6c 61 75 6e 63 68 65 64 20 61 74 20 73 6f  n launched at so
49b0: 6d 65 20 74 69 6d 65 20 69 6e 20 74 68 65 20 70  me time in the p
49c0: 61 73 74 0a 09 09 3b 3b 20 69 2e 65 2e 20 69 73  ast...;; i.e. is
49d0: 20 74 68 69 73 20 61 20 72 65 2d 6c 61 75 6e 63   this a re-launc
49e0: 68 3f 0a 09 09 28 64 65 62 75 67 3a 70 72 69 6e  h?...(debug:prin
49f0: 74 2d 69 6e 66 6f 20 34 20 22 72 75 6e 2d 6c 69  t-info 4 "run-li
4a00: 6d 69 74 73 2d 69 6e 66 6f 20 3d 20 22 20 72 75  mits-info = " ru
4a10: 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 29 0a 09  n-limits-info)..
4a20: 09 28 63 6f 6e 64 20 3b 3b 20 49 4e 4e 45 52 20  .(cond ;; INNER 
4a30: 43 4f 4e 44 20 23 31 20 66 6f 72 20 61 20 6c 61  COND #1 for a la
4a40: 75 6e 63 68 61 62 6c 65 20 74 65 73 74 0a 09 09  unchable test...
4a50: 20 3b 3b 20 43 68 65 63 6b 20 69 74 65 6d 20 70   ;; Check item p
4a60: 61 74 68 20 61 67 61 69 6e 73 74 20 69 74 65 6d  ath against item
4a70: 2d 70 61 74 74 73 0a 09 09 20 28 28 6e 6f 74 20  -patts... ((not 
4a80: 28 74 65 73 74 73 3a 6d 61 74 63 68 20 74 65 73  (tests:match tes
4a90: 74 2d 70 61 74 74 73 20 28 74 65 73 74 73 3a 74  t-patts (tests:t
4aa0: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73  estqueue-get-tes
4ab0: 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72  tname test-recor
4ac0: 64 29 20 69 74 65 6d 2d 70 61 74 68 29 29 20 3b  d) item-path)) ;
4ad0: 3b 20 54 68 69 73 20 74 65 73 74 2f 69 74 65 6d  ; This test/item
4ae0: 70 61 74 68 20 69 73 20 6e 6f 74 20 74 6f 20 62  path is not to b
4af0: 65 20 72 75 6e 0a 09 09 20 20 3b 3b 20 65 6c 73  e run...  ;; els
4b00: 65 20 74 68 65 20 72 75 6e 20 69 73 20 73 74 75  e the run is stu
4b10: 63 6b 2c 20 74 65 6d 70 6f 72 61 72 69 6c 79 20  ck, temporarily 
4b20: 6f 72 20 70 65 72 6d 61 6e 65 6e 74 6c 79 0a 09  or permanently..
4b30: 09 20 20 3b 3b 20 62 75 74 20 73 68 6f 75 6c 64  .  ;; but should
4b40: 20 63 68 65 63 6b 20 69 66 20 69 74 20 69 73 20   check if it is 
4b50: 64 75 65 20 74 6f 20 6c 61 63 6b 20 6f 66 20 72  due to lack of r
4b60: 65 73 6f 75 72 63 65 73 20 76 73 2e 20 70 72 65  esources vs. pre
4b70: 72 65 71 75 69 73 69 74 65 73 0a 09 09 20 20 28  requisites...  (
4b80: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
4b90: 20 31 20 22 53 6b 69 70 70 69 6e 67 20 22 20 28   1 "Skipping " (
4ba0: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
4bb0: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73  get-testname tes
4bc0: 74 2d 72 65 63 6f 72 64 29 20 22 20 22 20 69 74  t-record) " " it
4bd0: 65 6d 2d 70 61 74 68 20 22 20 61 73 20 69 74 20  em-path " as it 
4be0: 64 6f 65 73 6e 27 74 20 6d 61 74 63 68 20 22 20  doesn't match " 
4bf0: 74 65 73 74 2d 70 61 74 74 73 29 0a 09 09 20 20  test-patts)...  
4c00: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a  (thread-sleep! *
4c10: 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09  global-delta*)..
4c20: 09 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c  .  (if (not (nul
4c30: 6c 3f 20 74 61 6c 29 29 0a 09 09 20 20 20 20 20  l? tal))...     
4c40: 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29   (loop (car tal)
4c50: 28 63 64 72 20 74 61 6c 29 20 72 65 72 75 6e 73  (cdr tal) reruns
4c60: 29 29 29 0a 09 09 20 28 20 3b 3b 20 28 61 6e 64  )))... ( ;; (and
4c70: 0a 09 09 20 20 28 6e 6f 74 20 28 68 61 73 68 2d  ...  (not (hash-
4c80: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c  table-ref/defaul
4c90: 74 20 74 65 73 74 2d 72 65 67 69 73 74 65 72 79  t test-registery
4ca0: 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c   (runs:make-full
4cb0: 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d  -test-name test-
4cc0: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 20  name item-path) 
4cd0: 23 66 29 29 0a 09 09 20 20 20 20 20 20 3b 3b 20  #f))...      ;; 
4ce0: 28 61 6e 64 20 6d 61 78 2d 63 6f 6e 63 75 72 72  (and max-concurr
4cf0: 65 6e 74 2d 6a 6f 62 73 20 28 3e 20 28 2d 20 6d  ent-jobs (> (- m
4d00: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f  ax-concurrent-jo
4d10: 62 73 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 20  bs num-running) 
4d20: 35 29 29 29 0a 09 09 20 20 28 64 65 62 75 67 3a  5)))...  (debug:
4d30: 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 50 72  print-info 4 "Pr
4d40: 65 2d 72 65 67 69 73 74 65 72 69 6e 67 20 74 65  e-registering te
4d50: 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22  st " test-name "
4d60: 2f 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20 74  /" item-path " t
4d70: 6f 20 63 72 65 61 74 65 20 70 6c 61 63 65 68 6f  o create placeho
4d80: 6c 64 65 72 22 20 29 0a 09 09 20 20 28 6f 70 65  lder" )...  (ope
4d90: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 74  n-run-close db:t
4da0: 65 73 74 73 2d 72 65 67 69 73 74 65 72 2d 74 65  ests-register-te
4db0: 73 74 20 23 66 20 72 75 6e 2d 69 64 20 74 65 73  st #f run-id tes
4dc0: 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68  t-name item-path
4dd0: 29 0a 09 09 20 20 28 68 61 73 68 2d 74 61 62 6c  )...  (hash-tabl
4de0: 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 67 69  e-set! test-regi
4df0: 73 74 65 72 79 20 28 72 75 6e 73 3a 6d 61 6b 65  stery (runs:make
4e00: 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 20  -full-test-name 
4e10: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70  test-name item-p
4e20: 61 74 68 29 20 23 74 29 0a 09 09 20 20 28 74 68  ath) #t)...  (th
4e30: 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f  read-sleep! *glo
4e40: 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 28 72 75 6e  bal-delta*).(run
4e50: 73 3a 73 68 72 69 6e 6b 2d 63 61 6e 2d 72 75 6e  s:shrink-can-run
4e60: 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c 61  -more-tests-dela
4e70: 79 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61  y)...  (loop (ca
4e80: 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65  r newtal)(cdr ne
4e90: 77 74 61 6c 29 20 72 65 72 75 6e 73 29 29 0a 09  wtal) reruns))..
4ea0: 09 20 28 28 6e 6f 74 20 68 61 76 65 2d 72 65 73  . ((not have-res
4eb0: 6f 75 72 63 65 73 29 20 3b 3b 20 73 69 6d 70 6c  ources) ;; simpl
4ec0: 79 20 74 72 79 20 61 67 61 69 6e 20 61 66 74 65  y try again afte
4ed0: 72 20 77 61 69 74 69 6e 67 20 61 20 73 65 63 6f  r waiting a seco
4ee0: 6e 64 0a 09 09 20 20 28 64 65 62 75 67 3a 70 72  nd...  (debug:pr
4ef0: 69 6e 74 2d 69 6e 66 6f 20 31 20 22 6e 6f 20 72  int-info 1 "no r
4f00: 65 73 6f 75 72 63 65 73 20 74 6f 20 72 75 6e 20  esources to run 
4f10: 6e 65 77 20 74 65 73 74 73 2c 20 77 61 69 74 69  new tests, waiti
4f20: 6e 67 20 2e 2e 2e 22 29 0a 09 09 20 20 28 74 68  ng ...")...  (th
4f30: 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 32  read-sleep! (+ 2
4f40: 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29   *global-delta*)
4f50: 29 0a 09 09 20 20 3b 3b 20 63 6f 75 6c 64 20 68  )...  ;; could h
4f60: 61 76 65 20 64 6f 6e 65 20 68 65 64 20 74 61 6c  ave done hed tal
4f70: 20 68 65 72 65 20 62 75 74 20 64 6f 69 6e 67 20   here but doing 
4f80: 63 61 72 2f 63 64 72 20 6f 66 20 6e 65 77 74 61  car/cdr of newta
4f90: 6c 20 74 6f 20 72 6f 74 61 74 65 20 74 65 73 74  l to rotate test
4fa0: 73 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72  s...  (loop (car
4fb0: 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77   newtal)(cdr new
4fc0: 74 61 6c 29 20 72 65 72 75 6e 73 29 29 0a 09 09  tal) reruns))...
4fd0: 20 28 28 61 6e 64 20 68 61 76 65 2d 72 65 73 6f   ((and have-reso
4fe0: 75 72 63 65 73 0a 09 09 20 20 20 20 20 20 20 28  urces...       (
4ff0: 6f 72 20 28 6e 75 6c 6c 3f 20 70 72 65 72 65 71  or (null? prereq
5000: 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09 09 20 20  s-not-met)....  
5010: 20 28 61 6e 64 20 28 65 71 3f 20 74 65 73 74 6d   (and (eq? testm
5020: 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c 29 0a 09  ode 'toplevel)..
5030: 09 09 09 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f  ...(null? non-co
5040: 6d 70 6c 65 74 65 64 29 29 29 29 0a 09 09 20 20  mpleted))))...  
5050: 28 72 75 6e 3a 74 65 73 74 20 72 75 6e 2d 69 64  (run:test run-id
5060: 20 72 75 6e 6e 61 6d 65 20 6b 65 79 76 61 6c 6c   runname keyvall
5070: 73 74 20 74 65 73 74 2d 72 65 63 6f 72 64 20 66  st test-record f
5080: 6c 61 67 73 20 23 66 29 0a 28 72 75 6e 73 3a 73  lags #f).(runs:s
5090: 68 72 69 6e 6b 2d 63 61 6e 2d 72 75 6e 2d 6d 6f  hrink-can-run-mo
50a0: 72 65 2d 74 65 73 74 73 2d 64 65 6c 61 79 29 0a  re-tests-delay).
50b0: 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65  ..  (thread-slee
50c0: 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61  p! *global-delta
50d0: 2a 29 0a 09 09 20 20 28 69 66 20 28 6e 6f 74 20  *)...  (if (not 
50e0: 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 20  (null? tal))... 
50f0: 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20       (loop (car 
5100: 74 61 6c 29 28 63 64 72 20 74 61 6c 29 20 72 65  tal)(cdr tal) re
5110: 72 75 6e 73 29 29 29 0a 09 09 20 28 65 6c 73 65  runs)))... (else
5120: 20 3b 3b 20 6d 75 73 74 20 62 65 20 77 65 20 68   ;; must be we h
5130: 61 76 65 20 75 6e 6d 65 74 20 70 72 65 72 65 71  ave unmet prereq
5140: 75 69 73 69 74 65 73 0a 09 09 20 20 20 20 28 64  uisites...    (d
5150: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 46 41  ebug:print 4 "FA
5160: 49 4c 53 3a 20 22 20 66 61 69 6c 73 29 0a 09 09  ILS: " fails)...
5170: 20 20 20 20 3b 3b 20 49 66 20 6f 6e 65 20 6f 72      ;; If one or
5180: 20 6d 6f 72 65 20 6f 66 20 74 68 65 20 70 72 65   more of the pre
5190: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 61 72 65  reqs-not-met are
51a0: 20 46 41 49 4c 20 74 68 65 6e 20 77 65 20 63 61   FAIL then we ca
51b0: 6e 20 69 73 73 75 65 0a 09 09 20 20 20 20 3b 3b  n issue...    ;;
51c0: 20 61 20 6d 65 73 73 61 67 65 20 61 6e 64 20 64   a message and d
51d0: 72 6f 70 20 68 65 64 20 66 72 6f 6d 20 74 68 65  rop hed from the
51e0: 20 69 74 65 6d 73 20 74 6f 20 62 65 20 70 72 6f   items to be pro
51f0: 63 65 73 73 65 64 2e 0a 09 09 20 20 20 20 28 69  cessed....    (i
5200: 66 20 28 6e 75 6c 6c 3f 20 66 61 69 6c 73 29 0a  f (null? fails).
5210: 09 09 09 28 62 65 67 69 6e 0a 09 09 09 20 20 3b  ...(begin....  ;
5220: 3b 20 63 6f 75 6c 64 6e 27 74 20 72 75 6e 2c 20  ; couldn't run, 
5230: 74 61 6b 65 20 61 20 62 72 65 61 74 68 65 72 0a  take a breather.
5240: 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e  ...  (debug:prin
5250: 74 2d 69 6e 66 6f 20 34 20 22 53 68 6f 75 6c 64  t-info 4 "Should
5260: 6e 27 74 20 72 65 61 6c 6c 79 20 67 65 74 20 68  n't really get h
5270: 65 72 65 2c 20 72 61 63 65 20 63 6f 6e 64 69 74  ere, race condit
5280: 69 6f 6e 3f 20 55 6e 61 62 6c 65 20 74 6f 20 6c  ion? Unable to l
5290: 61 75 6e 63 68 20 6d 6f 72 65 20 74 65 73 74 73  aunch more tests
52a0: 20 61 74 20 74 68 69 73 20 6d 6f 6d 65 6e 74 2c   at this moment,
52b0: 20 6b 69 6c 6c 69 6e 67 20 74 69 6d 65 20 2e 2e   killing time ..
52c0: 2e 22 29 0a 09 09 09 20 20 28 74 68 72 65 61 64  .")....  (thread
52d0: 2d 73 6c 65 65 70 21 20 28 2b 20 30 2e 30 31 20  -sleep! (+ 0.01 
52e0: 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29  *global-delta*))
52f0: 20 3b 3b 20 6c 6f 6e 67 20 73 6c 65 65 70 20 68   ;; long sleep h
5300: 65 72 65 20 2d 20 6e 6f 20 72 65 73 6f 75 72 63  ere - no resourc
5310: 65 73 2c 20 6d 61 79 20 61 73 20 77 65 6c 6c 20  es, may as well 
5320: 62 65 20 70 61 74 69 65 6e 74 0a 09 09 09 20 20  be patient....  
5330: 3b 3b 20 77 65 20 6d 61 64 65 20 6e 65 77 20 74  ;; we made new t
5340: 61 6c 20 62 79 20 73 74 69 63 6b 69 6e 67 20 68  al by sticking h
5350: 65 64 20 61 74 20 74 68 65 20 62 61 63 6b 20 6f  ed at the back o
5360: 66 20 74 68 65 20 6c 69 73 74 0a 09 09 09 20 20  f the list....  
5370: 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61  (loop (car newta
5380: 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20 72  l)(cdr newtal) r
5390: 65 72 75 6e 73 29 29 0a 09 09 09 3b 3b 20 74 68  eruns))....;; th
53a0: 65 20 77 61 69 74 6f 6e 20 69 73 20 46 41 49 4c  e waiton is FAIL
53b0: 20 73 6f 20 6e 6f 20 70 6f 69 6e 74 20 69 6e 20   so no point in 
53c0: 74 72 79 69 6e 67 20 74 6f 20 72 75 6e 20 68 65  trying to run he
53d0: 64 20 65 76 65 72 20 61 67 61 69 6e 0a 09 09 09  d ever again....
53e0: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20  (if (not (null? 
53f0: 74 61 6c 29 29 0a 09 09 09 20 20 20 20 28 69 66  tal))....    (if
5400: 20 28 76 65 63 74 6f 72 3f 20 68 65 64 29 0a 09   (vector? hed)..
5410: 09 09 09 28 62 65 67 69 6e 20 28 64 65 62 75 67  ...(begin (debug
5420: 3a 70 72 69 6e 74 20 31 20 22 57 41 52 4e 3a 20  :print 1 "WARN: 
5430: 44 72 6f 70 70 69 6e 67 20 74 65 73 74 20 22 20  Dropping test " 
5440: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73  (db:test-get-tes
5450: 74 6e 61 6d 65 20 68 65 64 29 20 22 2f 22 20 28  tname hed) "/" (
5460: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d  db:test-get-item
5470: 2d 70 61 74 68 20 68 65 64 29 0a 09 09 09 09 09  -path hed)......
5480: 09 20 20 20 20 22 20 66 72 6f 6d 20 74 68 65 20  .    " from the 
5490: 6c 61 75 6e 63 68 20 6c 69 73 74 20 61 73 20 69  launch list as i
54a0: 74 20 68 61 73 20 70 72 65 72 65 71 75 69 73 74  t has prerequist
54b0: 65 73 20 74 68 61 74 20 61 72 65 20 46 41 49 4c  es that are FAIL
54c0: 22 29 0a 28 72 75 6e 73 3a 73 68 72 69 6e 6b 2d  ").(runs:shrink-
54d0: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73  can-run-more-tes
54e0: 74 73 2d 64 65 6c 61 79 29 0a 09 09 09 09 20 20  ts-delay).....  
54f0: 20 20 20 20 20 28 74 68 72 65 61 64 2d 73 6c 65       (thread-sle
5500: 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74  ep! *global-delt
5510: 61 2a 29 0a 09 09 09 09 20 20 20 20 20 20 20 28  a*).....       (
5520: 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63  loop (car tal)(c
5530: 64 72 20 74 61 6c 29 20 28 63 6f 6e 73 20 68 65  dr tal) (cons he
5540: 64 20 72 65 72 75 6e 73 29 29 29 0a 09 09 09 09  d reruns))).....
5550: 28 62 65 67 69 6e 0a 09 09 09 09 20 20 28 64 65  (begin.....  (de
5560: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 57 41 52  bug:print 1 "WAR
5570: 4e 3a 20 54 65 73 74 20 6e 6f 74 20 70 72 6f 63  N: Test not proc
5580: 65 73 73 65 64 20 63 6f 72 72 65 63 74 6c 79 2e  essed correctly.
5590: 20 43 6f 75 6c 64 20 62 65 20 61 20 72 61 63 65   Could be a race
55a0: 20 63 6f 6e 64 69 74 69 6f 6e 20 69 6e 20 79 6f   condition in yo
55b0: 75 72 20 74 65 73 74 20 69 6d 70 6c 65 6d 65 6e  ur test implemen
55c0: 74 61 74 69 6f 6e 3f 20 22 20 68 65 64 29 20 3b  tation? " hed) ;
55d0: 3b 20 20 22 20 61 73 20 69 74 20 68 61 73 20 70  ;  " as it has p
55e0: 72 65 72 65 71 75 69 73 74 65 73 20 74 68 61 74  rerequistes that
55f0: 20 61 72 65 20 46 41 49 4c 2e 20 28 4e 4f 54 45   are FAIL. (NOTE
5600: 3a 20 68 65 64 20 69 73 20 6e 6f 74 20 61 20 76  : hed is not a v
5610: 65 63 74 6f 72 29 22 29 0a 28 72 75 6e 73 3a 73  ector)").(runs:s
5620: 68 72 69 6e 6b 2d 63 61 6e 2d 72 75 6e 2d 6d 6f  hrink-can-run-mo
5630: 72 65 2d 74 65 73 74 73 2d 64 65 6c 61 79 29 0a  re-tests-delay).
5640: 09 09 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c  ....  (thread-sl
5650: 65 65 70 21 20 28 2b 20 30 2e 30 31 20 2a 67 6c  eep! (+ 0.01 *gl
5660: 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09  obal-delta*))...
5670: 09 09 20 20 28 6c 6f 6f 70 20 68 65 64 20 74 61  ..  (loop hed ta
5680: 6c 20 72 65 72 75 6e 73 29 29 29 29 29 29 29 29  l reruns))))))))
5690: 29 20 3b 3b 20 45 4e 44 20 4f 46 20 49 4e 4e 45  ) ;; END OF INNE
56a0: 52 20 43 4f 4e 44 0a 09 20 20 20 20 20 0a 09 20  R COND..     .. 
56b0: 20 20 20 20 3b 3b 20 63 61 73 65 20 77 68 65 72      ;; case wher
56c0: 65 20 61 6e 20 69 74 65 6d 73 20 63 61 6d 65 20  e an items came 
56d0: 69 6e 20 61 73 20 61 20 6c 69 73 74 20 62 65 65  in as a list bee
56e0: 6e 20 70 72 6f 63 65 73 73 65 64 0a 09 20 20 20  n processed..   
56f0: 20 20 28 28 61 6e 64 20 28 6c 69 73 74 3f 20 69    ((and (list? i
5700: 74 65 6d 73 29 20 20 20 20 20 3b 3b 20 74 68 75  tems)     ;; thu
5710: 73 20 77 65 20 6b 6e 6f 77 20 6f 75 72 20 69 74  s we know our it
5720: 65 6d 73 20 61 72 65 20 61 6c 72 65 61 64 79 20  ems are already 
5730: 63 61 6c 63 75 6c 61 74 65 64 0a 09 09 20 20 20  calculated...   
5740: 28 6e 6f 74 20 20 20 69 74 65 6d 64 61 74 29 29  (not   itemdat))
5750: 20 3b 3b 20 61 6e 64 20 6e 6f 74 20 79 65 74 20   ;; and not yet 
5760: 65 78 70 61 6e 64 65 64 20 69 6e 74 6f 20 74 68  expanded into th
5770: 65 20 6c 69 73 74 20 6f 66 20 74 68 69 6e 67 73  e list of things
5780: 20 74 6f 20 62 65 20 64 6f 6e 65 0a 09 20 20 20   to be done..   
5790: 20 20 20 28 69 66 20 28 61 6e 64 20 28 64 65 62     (if (and (deb
57a0: 75 67 3a 64 65 62 75 67 2d 6d 6f 64 65 20 31 29  ug:debug-mode 1)
57b0: 20 3b 3b 20 28 3e 3d 20 2a 76 65 72 62 6f 73 69   ;; (>= *verbosi
57c0: 74 79 2a 20 31 29 0a 09 09 20 20 20 20 20 20 20  ty* 1)...       
57d0: 28 3e 20 28 6c 65 6e 67 74 68 20 69 74 65 6d 73  (> (length items
57e0: 29 20 30 29 0a 09 09 20 20 20 20 20 20 20 28 3e  ) 0)...       (>
57f0: 20 28 6c 65 6e 67 74 68 20 28 63 61 72 20 69 74   (length (car it
5800: 65 6d 73 29 29 20 30 29 29 0a 09 09 20 20 28 70  ems)) 0))...  (p
5810: 70 20 69 74 65 6d 73 29 29 0a 09 20 20 20 20 20  p items))..     
5820: 20 28 66 6f 72 2d 65 61 63 68 0a 09 20 20 20 20   (for-each..    
5830: 20 20 20 28 6c 61 6d 62 64 61 20 28 6d 79 2d 69     (lambda (my-i
5840: 74 65 6d 64 61 74 29 0a 09 09 20 28 6c 65 74 2a  temdat)... (let*
5850: 20 28 28 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f   ((new-test-reco
5860: 72 64 20 28 6c 65 74 20 28 28 6e 65 77 72 65 63  rd (let ((newrec
5870: 20 28 6d 61 6b 65 2d 74 65 73 74 73 3a 74 65 73   (make-tests:tes
5880: 74 71 75 65 75 65 29 29 29 0a 09 09 09 09 09 20  tqueue)))...... 
5890: 20 20 28 76 65 63 74 6f 72 2d 63 6f 70 79 21 20    (vector-copy! 
58a0: 74 65 73 74 2d 72 65 63 6f 72 64 20 6e 65 77 72  test-record newr
58b0: 65 63 29 0a 09 09 09 09 09 20 20 20 6e 65 77 72  ec)......   newr
58c0: 65 63 29 29 0a 09 09 09 28 6d 79 2d 69 74 65 6d  ec))....(my-item
58d0: 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74  -path (item-list
58e0: 2d 3e 70 61 74 68 20 6d 79 2d 69 74 65 6d 64 61  ->path my-itemda
58f0: 74 29 29 29 0a 09 09 20 20 20 28 69 66 20 28 74  t)))...   (if (t
5900: 65 73 74 73 3a 6d 61 74 63 68 20 74 65 73 74 2d  ests:match test-
5910: 70 61 74 74 73 20 68 65 64 20 6d 79 2d 69 74 65  patts hed my-ite
5920: 6d 2d 70 61 74 68 29 20 3b 3b 20 28 70 61 74 74  m-path) ;; (patt
5930: 2d 6c 69 73 74 2d 6d 61 74 63 68 20 6d 79 2d 69  -list-match my-i
5940: 74 65 6d 2d 70 61 74 68 20 69 74 65 6d 2d 70 61  tem-path item-pa
5950: 74 74 73 29 20 20 20 20 20 20 20 20 20 20 20 3b  tts)           ;
5960: 3b 20 79 65 73 2c 20 77 65 20 77 61 6e 74 20 74  ; yes, we want t
5970: 6f 20 70 72 6f 63 65 73 73 20 74 68 69 73 20 69  o process this i
5980: 74 65 6d 2c 20 4e 4f 54 45 3a 20 53 68 6f 75 6c  tem, NOTE: Shoul
5990: 64 20 6e 6f 74 20 6e 65 65 64 20 74 68 69 73 20  d not need this 
59a0: 63 68 65 63 6b 20 68 65 72 65 21 0a 09 09 20 20  check here!...  
59b0: 20 20 20 20 20 28 6c 65 74 20 28 28 6e 65 77 74       (let ((newt
59c0: 65 73 74 6e 61 6d 65 20 28 72 75 6e 73 3a 6d 61  estname (runs:ma
59d0: 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d  ke-full-test-nam
59e0: 65 20 68 65 64 20 6d 79 2d 69 74 65 6d 2d 70 61  e hed my-item-pa
59f0: 74 68 29 29 29 20 20 20 20 3b 3b 20 74 65 73 74  th)))    ;; test
5a00: 20 6e 61 6d 65 73 20 61 72 65 20 75 6e 69 71 75   names are uniqu
5a10: 65 20 6f 6e 20 74 65 73 74 6e 61 6d 65 2f 69 74  e on testname/it
5a20: 65 6d 2d 70 61 74 68 0a 09 09 09 20 28 74 65 73  em-path.... (tes
5a30: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74  ts:testqueue-set
5a40: 2d 69 74 65 6d 73 21 20 20 20 20 20 6e 65 77 2d  -items!     new-
5a50: 74 65 73 74 2d 72 65 63 6f 72 64 20 23 66 29 0a  test-record #f).
5a60: 09 09 09 20 28 74 65 73 74 73 3a 74 65 73 74 71  ... (tests:testq
5a70: 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 64 61 74  ueue-set-itemdat
5a80: 21 20 20 20 6e 65 77 2d 74 65 73 74 2d 72 65 63  !   new-test-rec
5a90: 6f 72 64 20 6d 79 2d 69 74 65 6d 64 61 74 29 0a  ord my-itemdat).
5aa0: 09 09 09 20 28 74 65 73 74 73 3a 74 65 73 74 71  ... (tests:testq
5ab0: 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 5f 70 61  ueue-set-item_pa
5ac0: 74 68 21 20 6e 65 77 2d 74 65 73 74 2d 72 65 63  th! new-test-rec
5ad0: 6f 72 64 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68  ord my-item-path
5ae0: 29 0a 09 09 09 20 28 68 61 73 68 2d 74 61 62 6c  ).... (hash-tabl
5af0: 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 63 6f  e-set! test-reco
5b00: 72 64 73 20 6e 65 77 74 65 73 74 6e 61 6d 65 20  rds newtestname 
5b10: 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 29  new-test-record)
5b20: 0a 09 09 09 20 28 73 65 74 21 20 74 61 6c 20 28  .... (set! tal (
5b30: 63 6f 6e 73 20 6e 65 77 74 65 73 74 6e 61 6d 65  cons newtestname
5b40: 20 74 61 6c 29 29 29 29 29 29 20 3b 3b 20 73 69   tal)))))) ;; si
5b50: 6e 63 65 20 74 68 65 73 65 20 61 72 65 20 69 74  nce these are it
5b60: 65 6d 69 7a 65 64 20 63 72 65 61 74 65 20 6e 65  emized create ne
5b70: 77 20 74 65 73 74 20 6e 61 6d 65 73 20 74 65 73  w test names tes
5b80: 74 6e 61 6d 65 2f 69 74 65 6d 70 61 74 68 0a 09  tname/itempath..
5b90: 20 20 20 20 20 20 20 69 74 65 6d 73 29 0a 09 20         items).. 
5ba0: 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e       (if (not (n
5bb0: 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 20 20 28  ull? tal))...  (
5bc0: 62 65 67 69 6e 0a 09 09 20 20 20 20 28 64 65 62  begin...    (deb
5bd0: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20  ug:print-info 4 
5be0: 22 45 6e 64 20 6f 66 20 69 74 65 6d 73 20 6c 69  "End of items li
5bf0: 73 74 2c 20 6c 6f 6f 70 69 6e 67 20 77 69 74 68  st, looping with
5c00: 20 6e 65 78 74 20 61 66 74 65 72 20 73 68 6f 72   next after shor
5c10: 74 20 64 65 6c 61 79 22 29 0a 09 09 20 20 20 20  t delay")...    
5c20: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28  (thread-sleep! (
5c30: 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d 64  + 0.01 *global-d
5c40: 65 6c 74 61 2a 29 29 0a 09 09 20 20 20 20 28 6c  elta*))...    (l
5c50: 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63 64  oop (car tal)(cd
5c60: 72 20 74 61 6c 29 20 72 65 72 75 6e 73 29 29 29  r tal) reruns)))
5c70: 29 0a 0a 09 20 20 20 20 20 3b 3b 20 69 66 20 69  )...     ;; if i
5c80: 74 65 6d 73 20 69 73 20 61 20 70 72 6f 63 20 74  tems is a proc t
5c90: 68 65 6e 20 6e 65 65 64 20 74 6f 20 72 75 6e 20  hen need to run 
5ca0: 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d  items:get-items-
5cb0: 66 72 6f 6d 2d 63 6f 6e 66 69 67 2c 20 67 65 74  from-config, get
5cc0: 20 74 68 65 20 6c 69 73 74 20 61 6e 64 20 6c 6f   the list and lo
5cd0: 6f 70 20 0a 09 20 20 20 20 20 3b 3b 20 20 20 20  op ..     ;;    
5ce0: 2d 20 62 75 74 20 6f 6e 6c 79 20 64 6f 20 74 68  - but only do th
5cf0: 61 74 20 69 66 20 72 65 73 6f 75 72 63 65 73 20  at if resources 
5d00: 65 78 69 73 74 20 74 6f 20 6b 69 63 6b 20 6f 66  exist to kick of
5d10: 66 20 74 68 65 20 6a 6f 62 0a 09 20 20 20 20 20  f the job..     
5d20: 28 28 6f 72 20 28 70 72 6f 63 65 64 75 72 65 3f  ((or (procedure?
5d30: 20 69 74 65 6d 73 29 28 65 71 3f 20 69 74 65 6d   items)(eq? item
5d40: 73 20 27 68 61 76 65 2d 70 72 6f 63 65 64 75 72  s 'have-procedur
5d50: 65 29 29 0a 09 20 20 20 20 20 20 28 6c 65 74 20  e))..      (let 
5d60: 28 28 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 20 20  ((can-run-more  
5d70: 20 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d    (runs:can-run-
5d80: 6d 6f 72 65 2d 74 65 73 74 73 20 74 65 73 74 2d  more-tests test-
5d90: 72 65 63 6f 72 64 29 29 29 0a 09 09 28 69 66 20  record)))...(if 
5da0: 28 61 6e 64 20 28 6c 69 73 74 3f 20 63 61 6e 2d  (and (list? can-
5db0: 72 75 6e 2d 6d 6f 72 65 29 0a 09 09 09 20 28 63  run-more).... (c
5dc0: 61 72 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 29  ar can-run-more)
5dd0: 29 0a 09 09 20 20 20 20 28 6c 65 74 2a 20 28 28  )...    (let* ((
5de0: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20  prereqs-not-met 
5df0: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
5e00: 64 62 3a 67 65 74 2d 70 72 65 72 65 71 73 2d 6e  db:get-prereqs-n
5e10: 6f 74 2d 6d 65 74 20 23 66 20 72 75 6e 2d 69 64  ot-met #f run-id
5e20: 20 77 61 69 74 6f 6e 73 20 69 74 65 6d 2d 70 61   waitons item-pa
5e30: 74 68 20 6d 6f 64 65 3a 20 74 65 73 74 6d 6f 64  th mode: testmod
5e40: 65 29 29 0a 09 09 09 20 20 20 28 66 61 69 6c 73  e))....   (fails
5e50: 20 20 20 20 20 20 20 20 20 20 20 28 72 75 6e 73             (runs
5e60: 3a 63 61 6c 63 2d 66 61 69 6c 73 20 70 72 65 72  :calc-fails prer
5e70: 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 09 09  eqs-not-met))...
5e80: 09 20 20 20 28 6e 6f 6e 2d 63 6f 6d 70 6c 65 74  .   (non-complet
5e90: 65 64 20 20 20 28 72 75 6e 73 3a 63 61 6c 63 2d  ed   (runs:calc-
5ea0: 6e 6f 74 2d 63 6f 6d 70 6c 65 74 65 64 20 70 72  not-completed pr
5eb0: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 29  ereqs-not-met)))
5ec0: 0a 09 09 20 20 20 20 20 20 28 64 65 62 75 67 3a  ...      (debug:
5ed0: 70 72 69 6e 74 2d 69 6e 66 6f 20 38 20 22 63 61  print-info 8 "ca
5ee0: 6e 2d 72 75 6e 2d 6d 6f 72 65 3a 20 22 20 63 61  n-run-more: " ca
5ef0: 6e 2d 72 75 6e 2d 6d 6f 72 65 0a 09 09 09 09 20  n-run-more..... 
5f00: 20 20 22 5c 6e 20 74 65 73 74 6e 61 6d 65 3a 20    "\n testname: 
5f10: 20 20 20 20 20 20 20 22 20 68 65 64 0a 09 09 09         " hed....
5f20: 09 20 20 20 22 5c 6e 20 70 72 65 72 65 71 73 2d  .   "\n prereqs-
5f30: 6e 6f 74 2d 6d 65 74 3a 20 22 20 28 72 75 6e 73  not-met: " (runs
5f40: 3a 70 72 65 74 74 79 2d 73 74 72 69 6e 67 20 70  :pretty-string p
5f50: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a  rereqs-not-met).
5f60: 09 09 09 09 20 20 20 22 5c 6e 20 6e 6f 6e 2d 63  ....   "\n non-c
5f70: 6f 6d 70 6c 65 74 65 64 3a 20 20 20 22 20 28 72  ompleted:   " (r
5f80: 75 6e 73 3a 70 72 65 74 74 79 2d 73 74 72 69 6e  uns:pretty-strin
5f90: 67 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29  g non-completed)
5fa0: 20 0a 09 09 09 09 20 20 20 22 5c 6e 20 66 61 69   .....   "\n fai
5fb0: 6c 73 3a 20 20 20 20 20 20 20 20 20 20 20 22 20  ls:           " 
5fc0: 28 72 75 6e 73 3a 70 72 65 74 74 79 2d 73 74 72  (runs:pretty-str
5fd0: 69 6e 67 20 66 61 69 6c 73 29 0a 09 09 09 09 20  ing fails)..... 
5fe0: 20 20 22 5c 6e 20 74 65 73 74 6d 6f 64 65 3a 20    "\n testmode: 
5ff0: 20 20 20 20 20 20 20 22 20 74 65 73 74 6d 6f 64         " testmod
6000: 65 0a 09 09 09 09 20 20 20 22 5c 6e 20 6e 75 6d  e.....   "\n num
6010: 2d 72 65 74 72 69 65 73 3a 20 20 20 20 20 22 20  -retries:     " 
6020: 6e 75 6d 2d 72 65 74 72 69 65 73 0a 09 09 09 09  num-retries.....
6030: 20 20 20 22 5c 6e 20 28 65 71 3f 20 74 65 73 74     "\n (eq? test
6040: 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c 29 3a  mode 'toplevel):
6050: 20 22 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 65   " (eq? testmode
6060: 20 27 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09   'toplevel).....
6070: 20 20 20 22 5c 6e 20 28 6e 75 6c 6c 3f 20 6e 6f     "\n (null? no
6080: 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 3a 20 20 20  n-completed):   
6090: 20 22 20 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f   " (null? non-co
60a0: 6d 70 6c 65 74 65 64 29 0a 09 09 09 09 20 20 20  mpleted).....   
60b0: 22 5c 6e 20 72 65 72 75 6e 73 3a 20 20 20 20 20  "\n reruns:     
60c0: 20 20 20 20 20 22 20 72 65 72 75 6e 73 0a 09 09       " reruns...
60d0: 09 09 20 20 20 22 5c 6e 20 69 74 65 6d 73 3a 20  ..   "\n items: 
60e0: 20 20 20 20 20 20 20 20 20 20 22 20 69 74 65 6d            " item
60f0: 73 0a 09 09 09 09 20 20 20 22 5c 6e 20 63 61 6e  s.....   "\n can
6100: 2d 72 75 6e 2d 6d 6f 72 65 3a 20 20 20 20 22 20  -run-more:    " 
6110: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 29 0a 09 09  can-run-more)...
6120: 20 20 20 20 20 20 3b 3b 20 28 74 68 72 65 61 64        ;; (thread
6130: 2d 73 6c 65 65 70 21 20 28 2b 20 30 2e 30 31 20  -sleep! (+ 0.01 
6140: 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29  *global-delta*))
6150: 0a 09 09 20 20 20 20 20 20 28 63 6f 6e 64 20 3b  ...      (cond ;
6160: 3b 20 49 4e 4e 45 52 20 43 4f 4e 44 20 23 32 0a  ; INNER COND #2.
6170: 09 09 20 20 20 20 20 20 20 28 28 6f 72 20 28 6e  ..       ((or (n
6180: 75 6c 6c 3f 20 70 72 65 72 65 71 73 2d 6e 6f 74  ull? prereqs-not
6190: 2d 6d 65 74 29 20 3b 3b 20 61 6c 6c 20 70 72 65  -met) ;; all pre
61a0: 72 65 71 73 20 6d 65 74 2c 20 66 69 72 65 20 6f  reqs met, fire o
61b0: 66 66 20 74 68 65 20 74 65 73 74 0a 09 09 09 20  ff the test.... 
61c0: 20 20 20 3b 3b 20 6f 72 2c 20 69 66 20 69 74 20     ;; or, if it 
61d0: 69 73 20 61 20 27 74 6f 70 6c 65 76 65 6c 20 74  is a 'toplevel t
61e0: 65 73 74 20 61 6e 64 20 61 6c 6c 20 70 72 65 72  est and all prer
61f0: 65 71 73 20 6e 6f 74 20 6d 65 74 20 61 72 65 20  eqs not met are 
6200: 43 4f 4d 50 4c 45 54 45 44 20 74 68 65 6e 20 6c  COMPLETED then l
6210: 61 75 6e 63 68 0a 09 09 09 20 20 20 20 28 61 6e  aunch....    (an
6220: 64 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20  d (eq? testmode 
6230: 27 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09 20  'toplevel)..... 
6240: 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c  (null? non-compl
6250: 65 74 65 64 29 29 29 0a 09 09 09 28 6c 65 74 20  eted)))....(let 
6260: 28 28 74 65 73 74 2d 6e 61 6d 65 20 28 74 65 73  ((test-name (tes
6270: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
6280: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72  -testname test-r
6290: 65 63 6f 72 64 29 29 29 0a 09 09 09 20 20 28 73  ecord)))....  (s
62a0: 65 74 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e  etenv "MT_TEST_N
62b0: 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 20  AME" test-name) 
62c0: 3b 3b 20 0a 09 09 09 20 20 28 73 65 74 65 6e 76  ;; ....  (setenv
62d0: 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20   "MT_RUNNAME"   
62e0: 72 75 6e 6e 61 6d 65 29 0a 09 09 09 20 20 28 73  runname)....  (s
62f0: 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d  et-megatest-env-
6300: 76 61 72 73 20 72 75 6e 2d 69 64 29 20 3b 3b 20  vars run-id) ;; 
6310: 74 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65  these may be nee
6320: 64 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63  ded by the launc
6330: 68 69 6e 67 20 70 72 6f 63 65 73 73 0a 09 09 09  hing process....
6340: 20 20 28 6c 65 74 20 28 28 69 74 65 6d 73 2d 6c    (let ((items-l
6350: 69 73 74 20 28 69 74 65 6d 73 3a 67 65 74 2d 69  ist (items:get-i
6360: 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67  tems-from-config
6370: 20 74 63 6f 6e 66 69 67 29 29 29 0a 09 09 09 20   tconfig))).... 
6380: 20 20 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74     (if (list? it
6390: 65 6d 73 2d 6c 69 73 74 29 0a 09 09 09 09 28 62  ems-list).....(b
63a0: 65 67 69 6e 0a 09 09 09 09 20 20 28 74 65 73 74  egin.....  (test
63b0: 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d  s:testqueue-set-
63c0: 69 74 65 6d 73 21 20 74 65 73 74 2d 72 65 63 6f  items! test-reco
63d0: 72 64 20 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09  rd items-list)..
63e0: 09 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65  ...  (thread-sle
63f0: 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74  ep! *global-delt
6400: 61 2a 29 0a 09 09 09 09 20 20 28 6c 6f 6f 70 20  a*).....  (loop 
6410: 68 65 64 20 74 61 6c 20 72 65 72 75 6e 73 29 29  hed tal reruns))
6420: 0a 09 09 09 09 28 62 65 67 69 6e 0a 09 09 09 09  .....(begin.....
6430: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
6440: 20 22 45 52 52 4f 52 3a 20 54 68 65 20 70 72 6f   "ERROR: The pro
6450: 63 20 66 72 6f 6d 20 72 65 61 64 69 6e 67 20 74  c from reading t
6460: 68 65 20 73 65 74 75 70 20 64 69 64 20 6e 6f 74  he setup did not
6470: 20 79 69 65 6c 64 20 61 20 6c 69 73 74 20 2d 20   yield a list - 
6480: 70 6c 65 61 73 65 20 72 65 70 6f 72 74 20 74 68  please report th
6490: 69 73 22 29 0a 09 09 09 09 20 20 28 65 78 69 74  is").....  (exit
64a0: 20 31 29 29 29 29 29 29 0a 09 09 20 20 20 20 20   1))))))...     
64b0: 20 20 28 28 6e 75 6c 6c 3f 20 66 61 69 6c 73 29    ((null? fails)
64c0: 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74  ....(debug:print
64d0: 2d 69 6e 66 6f 20 34 20 22 66 61 69 6c 73 20 69  -info 4 "fails i
64e0: 73 20 6e 75 6c 6c 2c 20 6d 6f 76 69 6e 67 20 6f  s null, moving o
64f0: 6e 20 69 6e 20 74 68 65 20 71 75 65 75 65 20 62  n in the queue b
6500: 75 74 20 6b 65 65 70 69 6e 67 20 22 20 68 65 64  ut keeping " hed
6510: 20 22 20 66 6f 72 20 6e 6f 77 22 29 0a 09 09 09   " for now")....
6520: 3b 3b 20 6f 6e 6c 79 20 69 6e 63 72 65 6d 65 6e  ;; only incremen
6530: 74 20 6e 75 6d 2d 72 65 74 72 69 65 73 20 77 68  t num-retries wh
6540: 65 6e 20 74 68 65 72 65 20 61 72 65 20 6e 6f 20  en there are no 
6550: 74 65 73 74 73 20 72 75 6e 69 6e 67 0a 09 09 09  tests runing....
6560: 28 69 66 20 28 65 71 3f 20 30 20 28 6c 69 73 74  (if (eq? 0 (list
6570: 2d 72 65 66 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72  -ref can-run-mor
6580: 65 20 31 29 29 0a 09 09 09 20 20 20 20 28 62 65  e 1))....    (be
6590: 67 69 6e 0a 09 09 09 20 20 20 20 20 20 28 69 66  gin....      (if
65a0: 20 28 3e 20 6e 75 6d 2d 72 65 74 72 69 65 73 20   (> num-retries 
65b0: 31 30 30 29 20 3b 3b 20 66 69 72 73 74 20 31 30  100) ;; first 10
65c0: 30 20 72 65 74 72 69 65 73 20 61 72 65 20 6c 6f  0 retries are lo
65d0: 77 20 74 69 6d 65 20 63 6f 73 74 0a 09 09 09 09  w time cost.....
65e0: 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21    (thread-sleep!
65f0: 20 28 2b 20 32 20 2a 67 6c 6f 62 61 6c 2d 64 65   (+ 2 *global-de
6600: 6c 74 61 2a 29 29 0a 09 09 09 09 20 20 28 74 68  lta*)).....  (th
6610: 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 30  read-sleep! (+ 0
6620: 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74  .01 *global-delt
6630: 61 2a 29 29 29 0a 09 09 09 20 20 20 20 20 20 28  a*)))....      (
6640: 73 65 74 21 20 6e 75 6d 2d 72 65 74 72 69 65 73  set! num-retries
6650: 20 28 2b 20 6e 75 6d 2d 72 65 74 72 69 65 73 20   (+ num-retries 
6660: 31 29 29 29 29 0a 09 09 09 28 69 66 20 28 3e 20  1))))....(if (> 
6670: 6e 75 6d 2d 72 65 74 72 69 65 73 20 20 6d 61 78  num-retries  max
6680: 2d 72 65 74 72 69 65 73 29 0a 09 09 09 20 20 20  -retries)....   
6690: 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f   (if (not (null?
66a0: 20 74 61 6c 29 29 0a 09 09 09 09 28 6c 6f 6f 70   tal)).....(loop
66b0: 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74   (car tal)(cdr t
66c0: 61 6c 29 20 72 65 72 75 6e 73 29 29 0a 09 09 09  al) reruns))....
66d0: 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e      (loop (car n
66e0: 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61  ewtal)(cdr newta
66f0: 6c 29 20 72 65 72 75 6e 73 29 29 29 20 3b 3b 20  l) reruns))) ;; 
6700: 61 6e 20 69 73 73 75 65 20 77 69 74 68 20 70 72  an issue with pr
6710: 65 72 65 71 73 20 6e 6f 74 20 79 65 74 20 6d 65  ereqs not yet me
6720: 74 3f 0a 09 09 20 20 20 20 20 20 20 28 28 61 6e  t?...       ((an
6730: 64 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 66 61  d (not (null? fa
6740: 69 6c 73 29 29 28 65 71 3f 20 74 65 73 74 6d 6f  ils))(eq? testmo
6750: 64 65 20 27 6e 6f 72 6d 61 6c 29 29 0a 09 09 09  de 'normal))....
6760: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
6770: 6f 20 31 20 22 74 65 73 74 20 22 20 20 68 65 64  o 1 "test "  hed
6780: 20 22 20 28 6d 6f 64 65 3d 22 20 74 65 73 74 6d   " (mode=" testm
6790: 6f 64 65 20 22 29 20 68 61 73 20 66 61 69 6c 65  ode ") has faile
67a0: 64 20 70 72 65 72 65 71 75 69 73 69 74 65 28 73  d prerequisite(s
67b0: 29 3b 20 22 0a 09 09 09 09 20 20 20 20 20 28 73  ); ".....     (s
67c0: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73  tring-interspers
67d0: 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28  e (map (lambda (
67e0: 74 29 28 63 6f 6e 63 20 28 64 62 3a 74 65 73 74  t)(conc (db:test
67f0: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 29  -get-testname t)
6800: 20 22 3a 22 20 28 64 62 3a 74 65 73 74 2d 67 65   ":" (db:test-ge
6810: 74 2d 73 74 61 74 65 20 74 29 22 2f 22 28 64 62  t-state t)"/"(db
6820: 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73  :test-get-status
6830: 20 74 29 29 29 20 66 61 69 6c 73 29 20 22 2c 20   t))) fails) ", 
6840: 22 29 0a 09 09 09 09 20 20 20 20 20 22 2c 20 72  ").....     ", r
6850: 65 6d 6f 76 69 6e 67 20 69 74 20 66 72 6f 6d 20  emoving it from 
6860: 74 6f 2d 64 6f 20 6c 69 73 74 22 29 0a 09 09 09  to-do list")....
6870: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20  (if (not (null? 
6880: 74 61 6c 29 29 0a 09 09 09 20 20 20 20 28 62 65  tal))....    (be
6890: 67 69 6e 0a 09 09 09 20 20 20 20 20 20 28 74 68  gin....      (th
68a0: 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f  read-sleep! *glo
68b0: 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 09 20  bal-delta*).... 
68c0: 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20       (loop (car 
68d0: 74 61 6c 29 28 63 64 72 20 74 61 6c 29 28 63 6f  tal)(cdr tal)(co
68e0: 6e 73 20 68 65 64 20 72 65 72 75 6e 73 29 29 29  ns hed reruns)))
68f0: 29 29 0a 09 09 20 20 20 20 20 20 20 28 65 6c 73  ))...       (els
6900: 65 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e  e....(debug:prin
6910: 74 20 38 20 22 45 52 52 4f 52 3a 20 4e 6f 20 68  t 8 "ERROR: No h
6920: 61 6e 64 6c 65 72 20 66 6f 72 20 74 68 69 73 20  andler for this 
6930: 63 6f 6e 64 69 74 69 6f 6e 2e 22 29 0a 09 09 09  condition.")....
6940: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28  (thread-sleep! (
6950: 2b 20 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74  + 1 *global-delt
6960: 61 2a 29 29 0a 09 09 09 28 6c 6f 6f 70 20 28 63  a*))....(loop (c
6970: 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e  ar newtal)(cdr n
6980: 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29 29 29  ewtal) reruns)))
6990: 29 20 3b 3b 20 45 4e 44 20 4f 46 20 49 46 20 43  ) ;; END OF IF C
69a0: 41 4e 20 52 55 4e 20 4d 4f 52 45 0a 0a 09 09 20  AN RUN MORE.... 
69b0: 20 20 20 3b 3b 20 69 66 20 63 61 6e 27 74 20 72     ;; if can't r
69c0: 75 6e 20 6d 6f 72 65 20 6a 75 73 74 20 6c 6f 6f  un more just loo
69d0: 70 20 77 69 74 68 20 6e 65 78 74 20 70 6f 73 73  p with next poss
69e0: 69 62 6c 65 20 74 65 73 74 0a 09 09 20 20 20 20  ible test...    
69f0: 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20 20 28  (begin...      (
6a00: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
6a10: 20 34 20 22 70 72 6f 63 65 73 73 69 6e 67 20 74   4 "processing t
6a20: 68 65 20 63 61 73 65 20 77 69 74 68 20 61 20 6c  he case with a l
6a30: 61 6d 62 64 61 20 66 6f 72 20 69 74 65 6d 73 20  ambda for items 
6a40: 6f 72 20 27 68 61 76 65 2d 70 72 6f 63 65 64 75  or 'have-procedu
6a50: 72 65 2e 20 4d 6f 76 69 6e 67 20 74 68 72 6f 75  re. Moving throu
6a60: 67 68 20 74 68 65 20 71 75 65 75 65 20 77 69 74  gh the queue wit
6a70: 68 6f 75 74 20 64 72 6f 70 70 69 6e 67 20 22 20  hout dropping " 
6a80: 68 65 64 29 0a 09 09 20 20 20 20 20 20 28 74 68  hed)...      (th
6a90: 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 32  read-sleep! (+ 2
6aa0: 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29   *global-delta*)
6ab0: 29 0a 09 09 20 20 20 20 20 20 28 6c 6f 6f 70 20  )...      (loop 
6ac0: 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72  (car newtal)(cdr
6ad0: 20 6e 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29   newtal) reruns)
6ae0: 29 29 29 29 20 3b 3b 20 45 4e 44 20 4f 46 20 28  )))) ;; END OF (
6af0: 6f 72 20 28 70 72 6f 63 65 64 75 72 65 3f 20 69  or (procedure? i
6b00: 74 65 6d 73 29 28 65 71 3f 20 69 74 65 6d 73 20  tems)(eq? items 
6b10: 27 68 61 76 65 2d 70 72 6f 63 65 64 75 72 65 29  'have-procedure)
6b20: 29 0a 09 20 20 20 20 20 0a 09 20 20 20 20 20 3b  )..     ..     ;
6b30: 3b 20 74 68 69 73 20 63 61 73 65 20 73 68 6f 75  ; this case shou
6b40: 6c 64 20 6e 6f 74 20 68 61 70 70 65 6e 2c 20 61  ld not happen, a
6b50: 64 64 65 64 20 74 6f 20 68 65 6c 70 20 63 61 74  dded to help cat
6b60: 63 68 20 61 6e 79 20 62 75 67 73 0a 09 20 20 20  ch any bugs..   
6b70: 20 20 28 28 61 6e 64 20 28 6c 69 73 74 3f 20 69    ((and (list? i
6b80: 74 65 6d 73 29 20 69 74 65 6d 64 61 74 29 0a 09  tems) itemdat)..
6b90: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
6ba0: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 53 68 6f  nt 0 "ERROR: Sho
6bb0: 75 6c 64 20 6e 6f 74 20 68 61 76 65 20 61 20 6c  uld not have a l
6bc0: 69 73 74 20 6f 66 20 69 74 65 6d 73 20 69 6e 20  ist of items in 
6bd0: 61 20 74 65 73 74 20 61 6e 64 20 74 68 65 20 69  a test and the i
6be0: 74 65 6d 73 70 61 74 68 20 73 65 74 20 2d 20 70  temspath set - p
6bf0: 6c 65 61 73 65 20 72 65 70 6f 72 74 20 74 68 69  lease report thi
6c00: 73 22 29 0a 09 20 20 20 20 20 20 28 65 78 69 74  s")..      (exit
6c10: 20 31 29 29 0a 09 20 20 20 20 20 28 28 6e 6f 74   1))..     ((not
6c20: 20 28 6e 75 6c 6c 3f 20 72 65 72 75 6e 73 29 29   (null? reruns))
6c30: 0a 09 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28  ..      (let* ((
6c40: 6e 65 77 6c 73 74 20 28 74 65 73 74 73 3a 66 69  newlst (tests:fi
6c50: 6c 74 65 72 2d 6e 6f 6e 2d 72 75 6e 6e 61 62 6c  lter-non-runnabl
6c60: 65 20 72 75 6e 2d 69 64 20 74 61 6c 20 74 65 73  e run-id tal tes
6c70: 74 2d 72 65 63 6f 72 64 73 29 29 20 3b 3b 20 69  t-records)) ;; i
6c80: 2e 65 2e 20 6e 6f 74 20 46 41 49 4c 2c 20 57 41  .e. not FAIL, WA
6c90: 49 56 45 44 2c 20 49 4e 43 4f 4d 50 4c 45 54 45  IVED, INCOMPLETE
6ca0: 2c 20 50 41 53 53 2c 20 4b 49 4c 4c 45 44 2c 0a  , PASS, KILLED,.
6cb0: 09 09 20 20 20 20 20 28 6a 75 6e 6b 65 64 20 28  ..     (junked (
6cc0: 6c 73 65 74 2d 64 69 66 66 65 72 65 6e 63 65 20  lset-difference 
6cd0: 65 71 75 61 6c 3f 20 74 61 6c 20 6e 65 77 6c 73  equal? tal newls
6ce0: 74 29 29 29 0a 09 09 28 64 65 62 75 67 3a 70 72  t)))...(debug:pr
6cf0: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 66 75 6c 6c  int-info 4 "full
6d00: 20 64 72 6f 70 20 74 68 72 6f 75 67 68 2c 20 69   drop through, i
6d10: 66 20 72 65 72 75 6e 73 20 69 73 20 6c 65 73 73  f reruns is less
6d20: 20 74 68 61 6e 20 31 30 30 20 77 65 20 77 69 6c   than 100 we wil
6d30: 6c 20 66 6f 72 63 65 20 72 65 74 72 79 20 74 68  l force retry th
6d40: 65 6d 2c 20 72 65 72 75 6e 73 3d 22 20 72 65 72  em, reruns=" rer
6d50: 75 6e 73 20 22 2c 20 74 61 6c 3d 22 20 74 61 6c  uns ", tal=" tal
6d60: 29 0a 09 09 28 69 66 20 28 3c 20 6e 75 6d 2d 72  )...(if (< num-r
6d70: 65 74 72 69 65 73 20 6d 61 78 2d 72 65 74 72 69  etries max-retri
6d80: 65 73 29 0a 09 09 20 20 20 20 28 73 65 74 21 20  es)...    (set! 
6d90: 6e 65 77 6c 73 74 20 28 61 70 70 65 6e 64 20 72  newlst (append r
6da0: 65 72 75 6e 73 20 6e 65 77 6c 73 74 29 29 29 0a  eruns newlst))).
6db0: 09 09 28 73 65 74 21 20 6e 75 6d 2d 72 65 74 72  ..(set! num-retr
6dc0: 69 65 73 20 28 2b 20 6e 75 6d 2d 72 65 74 72 69  ies (+ num-retri
6dd0: 65 73 20 31 29 29 0a 09 09 28 74 68 72 65 61 64  es 1))...(thread
6de0: 2d 73 6c 65 65 70 21 20 28 2b 20 31 20 2a 67 6c  -sleep! (+ 1 *gl
6df0: 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09  obal-delta*))...
6e00: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20  (if (not (null? 
6e10: 6e 65 77 6c 73 74 29 29 0a 09 09 20 20 20 20 3b  newlst))...    ;
6e20: 3b 20 73 69 6e 63 65 20 72 65 72 75 6e 73 20 68  ; since reruns h
6e30: 61 76 65 20 62 65 65 6e 20 74 61 63 6b 65 64 20  ave been tacked 
6e40: 6f 6e 20 74 6f 20 6e 65 77 6c 73 74 20 63 72 65  on to newlst cre
6e50: 61 74 65 20 6e 65 77 20 72 65 72 75 6e 73 20 66  ate new reruns f
6e60: 72 6f 6d 20 6a 75 6e 6b 65 64 0a 09 09 20 20 20  rom junked...   
6e70: 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 6c   (loop (car newl
6e80: 73 74 29 28 63 64 72 20 6e 65 77 6c 73 74 29 28  st)(cdr newlst)(
6e90: 64 65 6c 65 74 65 2d 64 75 70 6c 69 63 61 74 65  delete-duplicate
6ea0: 73 20 6a 75 6e 6b 65 64 29 29 29 29 29 0a 09 20  s junked))))).. 
6eb0: 20 20 20 20 28 28 6e 6f 74 20 28 6e 75 6c 6c 3f      ((not (null?
6ec0: 20 74 61 6c 29 29 0a 09 20 20 20 20 20 20 28 64   tal))..      (d
6ed0: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
6ee0: 34 20 22 49 27 6d 20 70 72 65 74 74 79 20 73 75  4 "I'm pretty su
6ef0: 72 65 20 49 20 73 68 6f 75 6c 64 6e 27 74 20 67  re I shouldn't g
6f00: 65 74 20 68 65 72 65 2e 22 29 29 0a 09 20 20 20  et here."))..   
6f10: 20 20 28 65 6c 73 65 0a 09 20 20 20 20 20 20 28    (else..      (
6f20: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
6f30: 20 34 20 22 45 78 69 74 69 6e 67 20 6c 6f 6f 70   4 "Exiting loop
6f40: 20 77 69 74 68 2e 2e 2e 5c 6e 20 20 68 65 64 3d   with...\n  hed=
6f50: 22 20 68 65 64 20 22 5c 6e 20 20 74 61 6c 3d 22  " hed "\n  tal="
6f60: 20 74 61 6c 20 22 5c 6e 20 20 72 65 72 75 6e 73   tal "\n  reruns
6f70: 3d 22 20 72 65 72 75 6e 73 29 29 0a 09 20 20 20  =" reruns))..   
6f80: 20 20 29 29 29 29 20 3b 3b 20 4c 45 54 2a 20 28    )))) ;; LET* (
6f90: 28 74 65 73 74 2d 72 65 63 6f 72 64 0a 0a 20 20  (test-record..  
6fa0: 20 20 3b 3b 20 77 65 20 67 65 74 20 68 65 72 65    ;; we get here
6fb0: 20 6f 6e 20 22 64 72 6f 70 20 74 68 72 6f 75 67   on "drop throug
6fc0: 68 22 20 2d 20 6c 6f 6f 70 20 66 6f 72 20 6e 65  h" - loop for ne
6fd0: 78 74 20 74 65 73 74 20 69 6e 20 71 75 65 75 65  xt test in queue
6fe0: 0a 20 20 20 20 3b 3b 20 46 49 58 4d 45 21 21 21  .    ;; FIXME!!!
6ff0: 21 20 54 48 49 53 20 53 48 4f 55 4c 44 20 4e 4f  ! THIS SHOULD NO
7000: 54 20 52 45 51 55 49 52 45 20 41 4e 20 45 58 49  T REQUIRE AN EXI
7010: 54 21 21 21 21 21 21 21 0a 20 20 20 20 0a 20 20  T!!!!!!!.    .  
7020: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69    (debug:print-i
7030: 6e 66 6f 20 31 20 22 41 6c 6c 20 74 65 73 74 73  nfo 1 "All tests
7040: 20 6c 61 75 6e 63 68 65 64 22 29 0a 20 20 20 20   launched").    
7050: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 30  (thread-sleep! 0
7060: 2e 35 29 0a 20 20 20 20 3b 3b 20 46 49 58 4d 45  .5).    ;; FIXME
7070: 21 20 54 68 69 73 20 68 61 72 73 68 20 65 78 69  ! This harsh exi
7080: 74 20 73 68 6f 75 6c 64 20 6e 6f 74 20 62 65 20  t should not be 
7090: 6e 65 63 65 73 73 61 72 79 2e 2e 2e 2e 0a 20 20  necessary.....  
70a0: 20 20 3b 3b 20 28 69 66 20 28 6e 6f 74 20 2a 72    ;; (if (not *r
70b0: 75 6e 72 65 6d 6f 74 65 2a 29 28 65 78 69 74 29  unremote*)(exit)
70c0: 29 20 3b 3b 20 0a 20 20 20 20 23 66 29 29 20 3b  ) ;; .    #f)) ;
70d0: 3b 20 72 65 74 75 72 6e 20 61 20 23 66 20 61 73  ; return a #f as
70e0: 20 61 20 68 69 6e 74 20 74 68 61 74 20 77 65 20   a hint that we 
70f0: 61 72 65 20 64 6f 6e 65 0a 20 20 3b 3b 20 48 65  are done.  ;; He
7100: 72 65 20 77 65 20 6e 65 65 64 20 74 6f 20 63 68  re we need to ch
7110: 65 63 6b 20 74 68 61 74 20 61 6c 6c 20 74 68 65  eck that all the
7120: 20 74 65 73 74 73 20 72 65 6d 61 69 6e 69 6e 67   tests remaining
7130: 20 74 6f 20 62 65 20 72 75 6e 20 61 72 65 20 65   to be run are e
7140: 6c 69 67 69 62 6c 65 20 74 6f 20 72 75 6e 0a 20  ligible to run. 
7150: 20 3b 3b 20 61 6e 64 20 61 72 65 20 6e 6f 74 20   ;; and are not 
7160: 62 6c 6f 63 6b 65 64 20 62 79 20 66 61 69 6c 65  blocked by faile
7170: 64 0a 20 20 0a 0a 3b 3b 20 70 61 72 65 6e 74 2d  d.  ..;; parent-
7180: 74 65 73 74 20 69 73 20 74 68 65 72 65 20 61 73  test is there as
7190: 20 61 20 70 6c 61 63 65 68 6f 6c 64 65 72 20 66   a placeholder f
71a0: 6f 72 20 77 68 65 6e 20 70 61 72 65 6e 74 2d 74  or when parent-t
71b0: 65 73 74 73 20 63 61 6e 20 62 65 20 72 75 6e 20  ests can be run 
71c0: 61 73 20 61 20 73 65 74 75 70 20 73 74 65 70 0a  as a setup step.
71d0: 28 64 65 66 69 6e 65 20 28 72 75 6e 3a 74 65 73  (define (run:tes
71e0: 74 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65  t run-id runname
71f0: 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 73 74 2d   keyvallst test-
7200: 72 65 63 6f 72 64 20 66 6c 61 67 73 20 70 61 72  record flags par
7210: 65 6e 74 2d 74 65 73 74 29 0a 20 20 3b 3b 20 41  ent-test).  ;; A
7220: 6c 6c 20 74 68 65 73 65 20 76 61 72 73 20 6d 69  ll these vars mi
7230: 67 68 74 20 62 65 20 72 65 66 65 72 65 6e 63 65  ght be reference
7240: 64 20 62 79 20 74 68 65 20 74 65 73 74 63 6f 6e  d by the testcon
7250: 66 69 67 20 66 69 6c 65 20 72 65 61 64 65 72 0a  fig file reader.
7260: 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 6e    (let* ((test-n
7270: 61 6d 65 20 20 20 20 28 74 65 73 74 73 3a 74 65  ame    (tests:te
7280: 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74  stqueue-get-test
7290: 6e 61 6d 65 20 20 20 74 65 73 74 2d 72 65 63 6f  name   test-reco
72a0: 72 64 29 29 0a 09 20 28 74 65 73 74 2d 77 61 69  rd)).. (test-wai
72b0: 74 6f 6e 73 20 28 74 65 73 74 73 3a 74 65 73 74  tons (tests:test
72c0: 71 75 65 75 65 2d 67 65 74 2d 77 61 69 74 6f 6e  queue-get-waiton
72d0: 73 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64  s    test-record
72e0: 29 29 0a 09 20 28 74 65 73 74 2d 63 6f 6e 66 20  )).. (test-conf 
72f0: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75     (tests:testqu
7300: 65 75 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66  eue-get-testconf
7310: 69 67 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29  ig test-record))
7320: 0a 09 20 28 69 74 65 6d 64 61 74 20 20 20 20 20  .. (itemdat     
7330: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75   (tests:testqueu
7340: 65 2d 67 65 74 2d 69 74 65 6d 64 61 74 20 20 20  e-get-itemdat   
7350: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09   test-record))..
7360: 20 28 74 65 73 74 2d 70 61 74 68 20 20 20 20 28   (test-path    (
7370: 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 22  conc *toppath* "
7380: 2f 74 65 73 74 73 2f 22 20 74 65 73 74 2d 6e 61  /tests/" test-na
7390: 6d 65 29 29 20 3b 3b 20 63 6f 75 6c 64 20 75 73  me)) ;; could us
73a0: 65 20 74 65 73 74 73 3a 67 65 74 2d 74 65 73 74  e tests:get-test
73b0: 63 6f 6e 66 69 67 20 68 65 72 65 20 2e 2e 2e 0a  config here ....
73c0: 09 20 28 66 6f 72 63 65 20 20 20 20 20 20 20 20  . (force        
73d0: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f  (hash-table-ref/
73e0: 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d  default flags "-
73f0: 66 6f 72 63 65 22 20 23 66 29 29 0a 09 20 28 72  force" #f)).. (r
7400: 65 72 75 6e 20 20 20 20 20 20 20 20 28 68 61 73  erun        (has
7410: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61  h-table-ref/defa
7420: 75 6c 74 20 66 6c 61 67 73 20 22 2d 72 65 72 75  ult flags "-reru
7430: 6e 22 20 23 66 29 29 0a 09 20 28 6b 65 65 70 67  n" #f)).. (keepg
7440: 6f 69 6e 67 20 20 20 20 28 68 61 73 68 2d 74 61  oing    (hash-ta
7450: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20  ble-ref/default 
7460: 66 6c 61 67 73 20 22 2d 6b 65 65 70 67 6f 69 6e  flags "-keepgoin
7470: 67 22 20 23 66 29 29 0a 09 20 28 69 74 65 6d 2d  g" #f)).. (item-
7480: 70 61 74 68 20 20 20 20 20 22 22 29 0a 09 20 28  path     "").. (
7490: 64 62 20 20 20 20 20 20 20 20 20 20 20 23 66 29  db           #f)
74a0: 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ).    (debug:pri
74b0: 6e 74 20 34 0a 09 09 20 22 74 65 73 74 2d 63 6f  nt 4... "test-co
74c0: 6e 66 69 67 3a 20 22 20 28 68 61 73 68 2d 74 61  nfig: " (hash-ta
74d0: 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65 73 74 2d  ble->alist test-
74e0: 63 6f 6e 66 29 0a 09 09 20 22 5c 6e 20 20 20 69  conf)... "\n   i
74f0: 74 65 6d 64 61 74 3a 20 22 20 69 74 65 6d 64 61  temdat: " itemda
7500: 74 0a 09 09 20 29 0a 20 20 20 20 3b 3b 20 73 65  t... ).    ;; se
7510: 74 74 69 6e 67 20 69 74 65 6d 64 61 74 20 74 6f  tting itemdat to
7520: 20 61 20 6c 69 73 74 20 69 66 20 69 74 20 69 73   a list if it is
7530: 20 23 66 0a 20 20 20 20 28 69 66 20 28 6e 6f 74   #f.    (if (not
7540: 20 69 74 65 6d 64 61 74 29 28 73 65 74 21 20 69   itemdat)(set! i
7550: 74 65 6d 64 61 74 20 27 28 29 29 29 0a 20 20 20  temdat '())).   
7560: 20 28 73 65 74 21 20 69 74 65 6d 2d 70 61 74 68   (set! item-path
7570: 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74   (item-list->pat
7580: 68 20 69 74 65 6d 64 61 74 29 29 0a 20 20 20 20  h itemdat)).    
7590: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22  (debug:print 2 "
75a0: 41 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 6c 61  Attempting to la
75b0: 75 6e 63 68 20 74 65 73 74 20 22 20 74 65 73 74  unch test " test
75c0: 2d 6e 61 6d 65 20 28 69 66 20 28 65 71 75 61 6c  -name (if (equal
75d0: 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 2f 22 29  ? item-path "/")
75e0: 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29   "/" item-path))
75f0: 0a 20 20 20 20 28 73 65 74 65 6e 76 20 22 4d 54  .    (setenv "MT
7600: 5f 54 45 53 54 5f 4e 41 4d 45 22 20 74 65 73 74  _TEST_NAME" test
7610: 2d 6e 61 6d 65 29 20 3b 3b 20 0a 20 20 20 20 28  -name) ;; .    (
7620: 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e 4e 41  setenv "MT_RUNNA
7630: 4d 45 22 20 20 20 72 75 6e 6e 61 6d 65 29 0a 20  ME"   runname). 
7640: 20 20 20 28 73 65 74 2d 6d 65 67 61 74 65 73 74     (set-megatest
7650: 2d 65 6e 76 2d 76 61 72 73 20 72 75 6e 2d 69 64  -env-vars run-id
7660: 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62  ) ;; these may b
7670: 65 20 6e 65 65 64 65 64 20 62 79 20 74 68 65 20  e needed by the 
7680: 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73  launching proces
7690: 73 0a 20 20 20 20 28 63 68 61 6e 67 65 2d 64 69  s.    (change-di
76a0: 72 65 63 74 6f 72 79 20 2a 74 6f 70 70 61 74 68  rectory *toppath
76b0: 2a 29 0a 0a 20 20 20 20 3b 3b 20 48 65 72 65 20  *)..    ;; Here 
76c0: 69 73 20 77 68 65 72 65 20 74 68 65 20 74 65 73  is where the tes
76d0: 74 5f 6d 65 74 61 20 74 61 62 6c 65 20 69 73 20  t_meta table is 
76e0: 62 65 73 74 20 75 70 64 61 74 65 64 0a 20 20 20  best updated.   
76f0: 20 3b 3b 20 59 65 73 2c 20 61 6e 6f 74 68 65 72   ;; Yes, another
7700: 20 75 73 65 20 6f 66 20 61 20 67 6c 6f 62 61 6c   use of a global
7710: 20 66 6f 72 20 63 61 63 68 69 6e 67 2e 20 4e 65   for caching. Ne
7720: 65 64 20 61 20 62 65 74 74 65 72 20 77 61 79 3f  ed a better way?
7730: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 68  .    (if (not (h
7740: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65  ash-table-ref/de
7750: 66 61 75 6c 74 20 2a 74 65 73 74 2d 6d 65 74 61  fault *test-meta
7760: 2d 75 70 64 61 74 65 64 2a 20 74 65 73 74 2d 6e  -updated* test-n
7770: 61 6d 65 20 23 66 29 29 0a 20 20 20 20 20 20 20  ame #f)).       
7780: 20 28 62 65 67 69 6e 0a 09 20 20 20 28 68 61 73   (begin..   (has
7790: 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 2a 74 65  h-table-set! *te
77a0: 73 74 2d 6d 65 74 61 2d 75 70 64 61 74 65 64 2a  st-meta-updated*
77b0: 20 74 65 73 74 2d 6e 61 6d 65 20 23 74 29 0a 20   test-name #t). 
77c0: 20 20 20 20 20 20 20 20 20 20 28 6f 70 65 6e 2d            (open-
77d0: 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 3a 75  run-close runs:u
77e0: 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 20  pdate-test_meta 
77f0: 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73  db test-name tes
7800: 74 2d 63 6f 6e 66 29 29 29 0a 20 20 20 20 0a 20  t-conf))).    . 
7810: 20 20 20 3b 3b 20 28 6c 61 6d 62 64 61 20 28 69     ;; (lambda (i
7820: 74 65 6d 64 61 74 29 20 3b 3b 3b 20 28 28 72 69  temdat) ;;; ((ri
7830: 70 65 6e 65 73 73 20 22 6f 76 65 72 72 69 70 65  peness "overripe
7840: 22 29 20 28 74 65 6d 70 65 72 61 74 75 72 65 20  ") (temperature 
7850: 22 63 6f 6f 6c 22 29 20 28 73 65 61 73 6f 6e 20  "cool") (season 
7860: 22 73 75 6d 6d 65 72 22 29 29 0a 20 20 20 20 28  "summer")).    (
7870: 6c 65 74 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d  let* ((new-test-
7880: 70 61 74 68 20 28 73 74 72 69 6e 67 2d 69 6e 74  path (string-int
7890: 65 72 73 70 65 72 73 65 20 28 63 6f 6e 73 20 74  ersperse (cons t
78a0: 65 73 74 2d 70 61 74 68 20 28 6d 61 70 20 63 61  est-path (map ca
78b0: 64 72 20 69 74 65 6d 64 61 74 29 29 20 22 2f 22  dr itemdat)) "/"
78c0: 29 29 0a 09 20 20 20 28 6e 65 77 2d 74 65 73 74  ))..   (new-test
78d0: 2d 6e 61 6d 65 20 28 69 66 20 28 65 71 75 61 6c  -name (if (equal
78e0: 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 20  ? item-path "") 
78f0: 74 65 73 74 2d 6e 61 6d 65 20 28 63 6f 6e 63 20  test-name (conc 
7900: 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74  test-name "/" it
7910: 65 6d 2d 70 61 74 68 29 29 29 20 3b 3b 20 6a 75  em-path))) ;; ju
7920: 73 74 20 6e 65 65 64 20 69 74 20 74 6f 20 62 65  st need it to be
7930: 20 75 6e 69 71 75 65 0a 09 20 20 20 28 74 65 73   unique..   (tes
7940: 74 2d 69 64 20 20 20 20 20 20 20 28 63 64 62 3a  t-id       (cdb:
7950: 72 65 6d 6f 74 65 2d 72 75 6e 20 64 62 3a 67 65  remote-run db:ge
7960: 74 2d 74 65 73 74 2d 69 64 20 23 66 20 20 72 75  t-test-id #f  ru
7970: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69  n-id test-name i
7980: 74 65 6d 2d 70 61 74 68 29 29 0a 09 20 20 20 28  tem-path))..   (
7990: 74 65 73 74 64 61 74 20 20 20 20 20 20 20 28 63  testdat       (c
79a0: 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f  db:get-test-info
79b0: 2d 62 79 2d 69 64 20 2a 72 75 6e 72 65 6d 6f 74  -by-id *runremot
79c0: 65 2a 20 74 65 73 74 2d 69 64 29 29 29 0a 20 20  e* test-id))).  
79d0: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 74 65 73      (if (not tes
79e0: 74 64 61 74 29 0a 09 20 20 28 62 65 67 69 6e 0a  tdat)..  (begin.
79f0: 09 20 20 20 20 3b 3b 20 65 6e 73 75 72 65 20 74  .    ;; ensure t
7a00: 68 61 74 20 74 68 65 20 70 61 74 68 20 65 78 69  hat the path exi
7a10: 73 74 73 20 62 65 66 6f 72 65 20 72 65 67 69 73  sts before regis
7a20: 74 65 72 69 6e 67 20 74 68 65 20 74 65 73 74 0a  tering the test.
7a30: 09 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 43 61  .    ;; NOPE: Ca
7a40: 6e 6e 6f 74 21 20 44 6f 6e 27 74 20 6b 6e 6f 77  nnot! Don't know
7a50: 20 79 65 74 20 77 68 69 63 68 20 64 69 73 6b 20   yet which disk 
7a60: 61 72 65 61 20 77 69 6c 6c 20 62 65 20 61 73 73  area will be ass
7a70: 69 67 6e 65 64 2e 2e 2e 2e 0a 09 20 20 20 20 3b  igned......    ;
7a80: 3b 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20  ; (system (conc 
7a90: 22 6d 6b 64 69 72 20 2d 70 20 22 20 6e 65 77 2d  "mkdir -p " new-
7aa0: 74 65 73 74 2d 70 61 74 68 29 29 0a 09 20 20 20  test-path))..   
7ab0: 20 3b 3b 0a 09 20 20 20 20 3b 3b 20 28 6f 70 65   ;;..    ;; (ope
7ac0: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 74 65 73 74  n-run-close test
7ad0: 73 3a 72 65 67 69 73 74 65 72 2d 74 65 73 74 20  s:register-test 
7ae0: 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e  db run-id test-n
7af0: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 09  ame item-path)..
7b00: 20 20 20 20 3b 3b 0a 09 20 20 20 20 3b 3b 20 4e      ;;..    ;; N
7b10: 42 2f 2f 20 66 6f 72 20 74 68 65 20 61 62 6f 76  B// for the abov
7b20: 65 20 6c 69 6e 65 2e 20 49 20 77 61 6e 74 20 74  e line. I want t
7b30: 68 65 20 74 65 73 74 20 74 6f 20 62 65 20 72 65  he test to be re
7b40: 67 69 73 74 65 72 65 64 20 6c 6f 6e 67 20 62 65  gistered long be
7b50: 66 6f 72 65 20 74 68 69 73 20 72 6f 75 74 69 6e  fore this routin
7b60: 65 20 67 65 74 73 20 63 61 6c 6c 65 64 21 0a 09  e gets called!..
7b70: 20 20 20 20 3b 3b 0a 09 20 20 20 20 28 73 65 74      ;;..    (set
7b80: 21 20 74 65 73 74 2d 69 64 20 28 6f 70 65 6e 2d  ! test-id (open-
7b90: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
7ba0: 2d 74 65 73 74 2d 69 64 20 64 62 20 72 75 6e 2d  -test-id db run-
7bb0: 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65  id test-name ite
7bc0: 6d 2d 70 61 74 68 29 29 0a 09 20 20 20 20 28 69  m-path))..    (i
7bd0: 66 20 28 6e 6f 74 20 74 65 73 74 2d 69 64 29 0a  f (not test-id).
7be0: 09 09 28 62 65 67 69 6e 0a 09 09 20 20 28 64 65  ..(begin...  (de
7bf0: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 57 41 52  bug:print 2 "WAR
7c00: 4e 3a 20 54 65 73 74 20 6e 6f 74 20 70 72 65 2d  N: Test not pre-
7c10: 63 72 65 61 74 65 64 3f 20 74 65 73 74 2d 6e 61  created? test-na
7c20: 6d 65 3d 22 20 74 65 73 74 2d 6e 61 6d 65 20 22  me=" test-name "
7c30: 2c 20 69 74 65 6d 2d 70 61 74 68 3d 22 20 69 74  , item-path=" it
7c40: 65 6d 2d 70 61 74 68 20 22 2c 20 72 75 6e 2d 69  em-path ", run-i
7c50: 64 3d 22 20 72 75 6e 2d 69 64 29 0a 09 09 20 20  d=" run-id)...  
7c60: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
7c70: 64 62 3a 74 65 73 74 73 2d 72 65 67 69 73 74 65  db:tests-registe
7c80: 72 2d 74 65 73 74 20 23 66 20 72 75 6e 2d 69 64  r-test #f run-id
7c90: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d   test-name item-
7ca0: 70 61 74 68 29 0a 09 09 20 20 28 73 65 74 21 20  path)...  (set! 
7cb0: 74 65 73 74 2d 69 64 20 28 6f 70 65 6e 2d 72 75  test-id (open-ru
7cc0: 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74  n-close db:get-t
7cd0: 65 73 74 2d 69 64 20 64 62 20 72 75 6e 2d 69 64  est-id db run-id
7ce0: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d   test-name item-
7cf0: 70 61 74 68 29 29 29 29 0a 09 20 20 20 20 28 64  path))))..    (d
7d00: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
7d10: 34 20 22 74 65 73 74 2d 69 64 3d 22 20 74 65 73  4 "test-id=" tes
7d20: 74 2d 69 64 20 22 2c 20 72 75 6e 2d 69 64 3d 22  t-id ", run-id="
7d30: 20 72 75 6e 2d 69 64 20 22 2c 20 74 65 73 74 2d   run-id ", test-
7d40: 6e 61 6d 65 3d 22 20 74 65 73 74 2d 6e 61 6d 65  name=" test-name
7d50: 20 22 2c 20 69 74 65 6d 2d 70 61 74 68 3d 5c 22   ", item-path=\"
7d60: 22 20 69 74 65 6d 2d 70 61 74 68 20 22 5c 22 22  " item-path "\""
7d70: 29 0a 09 20 20 20 20 28 73 65 74 21 20 74 65 73  )..    (set! tes
7d80: 74 64 61 74 20 28 63 64 62 3a 67 65 74 2d 74 65  tdat (cdb:get-te
7d90: 73 74 2d 69 6e 66 6f 2d 62 79 2d 69 64 20 2a 72  st-info-by-id *r
7da0: 75 6e 72 65 6d 6f 74 65 2a 20 74 65 73 74 2d 69  unremote* test-i
7db0: 64 29 29 29 29 0a 20 20 20 20 20 20 28 73 65 74  d)))).      (set
7dc0: 21 20 74 65 73 74 2d 69 64 20 28 64 62 3a 74 65  ! test-id (db:te
7dd0: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61  st-get-id testda
7de0: 74 29 29 0a 20 20 20 20 20 20 28 63 68 61 6e 67  t)).      (chang
7df0: 65 2d 64 69 72 65 63 74 6f 72 79 20 74 65 73 74  e-directory test
7e00: 2d 70 61 74 68 29 0a 20 20 20 20 20 20 28 63 61  -path).      (ca
7e10: 73 65 20 28 69 66 20 66 6f 72 63 65 20 3b 3b 20  se (if force ;; 
7e20: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
7e30: 66 6f 72 63 65 22 29 0a 09 09 27 4e 4f 54 5f 53  force")...'NOT_S
7e40: 54 41 52 54 45 44 0a 09 09 28 69 66 20 74 65 73  TARTED...(if tes
7e50: 74 64 61 74 0a 09 09 20 20 20 20 28 73 74 72 69  tdat...    (stri
7e60: 6e 67 2d 3e 73 79 6d 62 6f 6c 20 28 74 65 73 74  ng->symbol (test
7e70: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64  :get-state testd
7e80: 61 74 29 29 0a 09 09 20 20 20 20 27 66 61 69 6c  at))...    'fail
7e90: 65 64 2d 74 6f 2d 69 6e 73 65 72 74 29 29 0a 09  ed-to-insert))..
7ea0: 28 28 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65  ((failed-to-inse
7eb0: 72 74 29 0a 09 20 28 64 65 62 75 67 3a 70 72 69  rt).. (debug:pri
7ec0: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 46 61 69  nt 0 "ERROR: Fai
7ed0: 6c 65 64 20 74 6f 20 69 6e 73 65 72 74 20 74 68  led to insert th
7ee0: 65 20 72 65 63 6f 72 64 20 69 6e 74 6f 20 74 68  e record into th
7ef0: 65 20 64 62 22 29 29 0a 09 28 28 4e 4f 54 5f 53  e db"))..((NOT_S
7f00: 54 41 52 54 45 44 20 43 4f 4d 50 4c 45 54 45 44  TARTED COMPLETED
7f10: 20 44 45 4c 45 54 45 44 29 0a 09 20 28 6c 65 74   DELETED).. (let
7f20: 20 28 28 72 75 6e 66 6c 61 67 20 23 66 29 29 0a   ((runflag #f)).
7f30: 09 20 20 20 28 63 6f 6e 64 0a 09 20 20 20 20 3b  .   (cond..    ;
7f40: 3b 20 2d 66 6f 72 63 65 2c 20 72 75 6e 20 6e 6f  ; -force, run no
7f50: 20 6d 61 74 74 65 72 20 77 68 61 74 0a 09 20 20   matter what..  
7f60: 20 20 28 66 6f 72 63 65 20 28 73 65 74 21 20 72    (force (set! r
7f70: 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20  unflag #t))..   
7f80: 20 3b 3b 20 4e 4f 54 5f 53 54 41 52 54 45 44 2c   ;; NOT_STARTED,
7f90: 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77   run no matter w
7fa0: 68 61 74 0a 09 20 20 20 20 28 28 6d 65 6d 62 65  hat..    ((membe
7fb0: 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  r (test:get-stat
7fc0: 65 20 74 65 73 74 64 61 74 29 20 27 28 22 44 45  e testdat) '("DE
7fd0: 4c 45 54 45 44 22 20 22 4e 4f 54 5f 53 54 41 52  LETED" "NOT_STAR
7fe0: 54 45 44 22 29 29 28 73 65 74 21 20 72 75 6e 66  TED"))(set! runf
7ff0: 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b 3b  lag #t))..    ;;
8000: 20 6e 6f 74 20 2d 72 65 72 75 6e 20 61 6e 64 20   not -rerun and 
8010: 50 41 53 53 2c 20 57 41 52 4e 20 6f 72 20 43 48  PASS, WARN or CH
8020: 45 43 4b 2c 20 64 6f 20 6e 6f 20 72 75 6e 0a 09  ECK, do no run..
8030: 20 20 20 20 28 28 61 6e 64 20 28 6f 72 20 28 6e      ((and (or (n
8040: 6f 74 20 72 65 72 75 6e 29 0a 09 09 20 20 20 20  ot rerun)...    
8050: 20 20 6b 65 65 70 67 6f 69 6e 67 29 0a 09 09 20    keepgoing)... 
8060: 20 3b 3b 20 52 65 71 75 69 72 65 20 74 6f 20 66   ;; Require to f
8070: 6f 72 63 65 20 72 65 2d 72 75 6e 20 66 6f 72 20  orce re-run for 
8080: 43 4f 4d 50 4c 45 54 45 44 20 6f 72 20 2a 61 6e  COMPLETED or *an
8090: 79 74 68 69 6e 67 2a 20 2b 20 50 41 53 53 2c 57  ything* + PASS,W
80a0: 41 52 4e 20 6f 72 20 43 48 45 43 4b 0a 09 09 20  ARN or CHECK... 
80b0: 20 28 6f 72 20 28 6d 65 6d 62 65 72 20 28 74 65   (or (member (te
80c0: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65  st:get-status te
80d0: 73 74 64 61 74 29 20 27 28 22 50 41 53 53 22 20  stdat) '("PASS" 
80e0: 22 57 41 52 4e 22 20 22 43 48 45 43 4b 22 29 29  "WARN" "CHECK"))
80f0: 0a 09 09 20 20 20 20 20 20 28 6d 65 6d 62 65 72  ...      (member
8100: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65   (test:get-state
8110: 20 20 74 65 73 74 64 61 74 29 20 27 28 22 43 4f    testdat) '("CO
8120: 4d 50 4c 45 54 45 44 22 29 29 29 29 20 0a 09 20  MPLETED")))) .. 
8130: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
8140: 2d 69 6e 66 6f 20 32 20 22 72 75 6e 6e 69 6e 67  -info 2 "running
8150: 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d   test " test-nam
8160: 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 20  e "/" item-path 
8170: 22 20 73 75 70 70 72 65 73 73 65 64 20 61 73 20  " suppressed as 
8180: 69 74 20 69 73 20 22 20 28 74 65 73 74 3a 67 65  it is " (test:ge
8190: 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29  t-state testdat)
81a0: 20 22 20 61 6e 64 20 22 20 28 74 65 73 74 3a 67   " and " (test:g
81b0: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61  et-status testda
81c0: 74 29 29 0a 09 20 20 20 20 20 28 73 65 74 21 20  t))..     (set! 
81d0: 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 20  runflag #f))..  
81e0: 20 20 3b 3b 20 2d 72 65 72 75 6e 20 61 6e 64 20    ;; -rerun and 
81f0: 73 74 61 74 75 73 20 69 73 20 6f 6e 65 20 6f 66  status is one of
8200: 20 74 68 65 20 73 70 65 63 69 66 65 64 2c 20 72   the specifed, r
8210: 75 6e 20 69 74 0a 09 20 20 20 20 28 28 61 6e 64  un it..    ((and
8220: 20 72 65 72 75 6e 0a 09 09 20 20 28 6c 65 74 2a   rerun...  (let*
8230: 20 28 28 72 65 72 75 6e 6c 73 74 20 20 20 28 73   ((rerunlst   (s
8240: 74 72 69 6e 67 2d 73 70 6c 69 74 20 72 65 72 75  tring-split reru
8250: 6e 20 22 2c 22 29 29 0a 09 09 09 20 28 6d 75 73  n ",")).... (mus
8260: 74 2d 72 65 72 75 6e 20 28 6d 65 6d 62 65 72 20  t-rerun (member 
8270: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73  (test:get-status
8280: 20 74 65 73 74 64 61 74 29 20 72 65 72 75 6e 6c   testdat) rerunl
8290: 73 74 29 29 29 0a 09 09 20 20 20 20 28 64 65 62  st)))...    (deb
82a0: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 33 20  ug:print-info 3 
82b0: 22 2d 72 65 72 75 6e 20 6c 69 73 74 3a 20 22 20  "-rerun list: " 
82c0: 72 65 72 75 6e 20 22 2c 20 74 65 73 74 2d 73 74  rerun ", test-st
82d0: 61 74 75 73 3a 20 22 20 28 74 65 73 74 3a 67 65  atus: " (test:ge
82e0: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74  t-status testdat
82f0: 29 22 2c 20 6d 75 73 74 2d 72 65 72 75 6e 3a 20  )", must-rerun: 
8300: 22 20 6d 75 73 74 2d 72 65 72 75 6e 29 0a 09 09  " must-rerun)...
8310: 20 20 20 20 6d 75 73 74 2d 72 65 72 75 6e 29 29      must-rerun))
8320: 0a 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72  ..     (debug:pr
8330: 69 6e 74 2d 69 6e 66 6f 20 32 20 22 52 65 72 75  int-info 2 "Reru
8340: 6e 20 66 6f 72 63 65 64 20 66 6f 72 20 74 65 73  n forced for tes
8350: 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f  t " test-name "/
8360: 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 20 20  " item-path)..  
8370: 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67     (set! runflag
8380: 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 2d 6b   #t))..    ;; -k
8390: 65 65 70 67 6f 69 6e 67 2c 20 64 6f 20 6e 6f 74  eepgoing, do not
83a0: 20 72 65 72 75 6e 20 46 41 49 4c 0a 09 20 20 20   rerun FAIL..   
83b0: 20 28 28 61 6e 64 20 6b 65 65 70 67 6f 69 6e 67   ((and keepgoing
83c0: 0a 09 09 20 20 28 6d 65 6d 62 65 72 20 28 74 65  ...  (member (te
83d0: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65  st:get-status te
83e0: 73 74 64 61 74 29 20 27 28 22 46 41 49 4c 22 29  stdat) '("FAIL")
83f0: 29 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72  ))..     (set! r
8400: 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20  unflag #f))..   
8410: 20 28 28 61 6e 64 20 28 6e 6f 74 20 72 65 72 75   ((and (not reru
8420: 6e 29 0a 09 09 20 20 28 6d 65 6d 62 65 72 20 28  n)...  (member (
8430: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20  test:get-status 
8440: 74 65 73 74 64 61 74 29 20 27 28 22 46 41 49 4c  testdat) '("FAIL
8450: 22 20 22 6e 2f 61 22 29 29 29 0a 09 20 20 20 20  " "n/a")))..    
8460: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23   (set! runflag #
8470: 74 29 29 0a 09 20 20 20 20 28 65 6c 73 65 20 28  t))..    (else (
8480: 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29  set! runflag #f)
8490: 29 29 0a 09 20 20 20 28 64 65 62 75 67 3a 70 72  ))..   (debug:pr
84a0: 69 6e 74 20 36 20 22 52 55 4e 4e 49 4e 47 20 3d  int 6 "RUNNING =
84b0: 3e 20 72 75 6e 66 6c 61 67 3a 20 22 20 72 75 6e  > runflag: " run
84c0: 66 6c 61 67 20 22 20 53 54 41 54 45 3a 20 22 20  flag " STATE: " 
84d0: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20  (test:get-state 
84e0: 74 65 73 74 64 61 74 29 20 22 20 53 54 41 54 55  testdat) " STATU
84f0: 53 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73  S: " (test:get-s
8500: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 29 0a  tatus testdat)).
8510: 09 20 20 20 28 69 66 20 28 6e 6f 74 20 72 75 6e  .   (if (not run
8520: 66 6c 61 67 29 0a 09 20 20 20 20 20 20 20 28 69  flag)..       (i
8530: 66 20 28 6e 6f 74 20 70 61 72 65 6e 74 2d 74 65  f (not parent-te
8540: 73 74 29 0a 09 09 20 20 20 28 64 65 62 75 67 3a  st)...   (debug:
8550: 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 4e  print 1 "NOTE: N
8560: 6f 74 20 73 74 61 72 74 69 6e 67 20 74 65 73 74  ot starting test
8570: 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65   " new-test-name
8580: 20 22 20 61 73 20 69 74 20 69 73 20 73 74 61 74   " as it is stat
8590: 65 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d  e \"" (test:get-
85a0: 73 74 61 74 65 20 74 65 73 74 64 61 74 29 20 0a  state testdat) .
85b0: 09 09 09 09 22 5c 22 20 61 6e 64 20 73 74 61 74  ...."\" and stat
85c0: 75 73 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74  us \"" (test:get
85d0: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29  -status testdat)
85e0: 20 22 5c 22 2c 20 75 73 65 20 2d 72 65 72 75 6e   "\", use -rerun
85f0: 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73   \"" (test:get-s
8600: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 0a 20  tatus testdat). 
8610: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
8620: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22                 "
8630: 5c 22 20 6f 72 20 2d 66 6f 72 63 65 20 74 6f 20  \" or -force to 
8640: 6f 76 65 72 72 69 64 65 22 29 29 0a 09 20 20 20  override"))..   
8650: 20 20 20 20 3b 3b 20 4e 4f 54 45 3a 20 4e 6f 20      ;; NOTE: No 
8660: 6c 6f 6e 67 65 72 20 62 65 20 63 68 65 63 6b 69  longer be checki
8670: 6e 67 20 70 72 65 72 65 71 75 69 73 69 74 65 73  ng prerequisites
8680: 20 68 65 72 65 21 20 57 69 6c 6c 20 6e 65 76 65   here! Will neve
8690: 72 20 67 65 74 20 68 65 72 65 20 75 6e 6c 65 73  r get here unles
86a0: 73 20 70 72 65 72 65 71 73 20 61 72 65 0a 09 20  s prereqs are.. 
86b0: 20 20 20 20 20 20 3b 3b 20 20 20 20 20 20 20 61        ;;       a
86c0: 6c 72 65 61 64 79 20 6d 65 74 2e 0a 09 20 20 20  lready met...   
86d0: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6c 61      (if (not (la
86e0: 75 6e 63 68 2d 74 65 73 74 20 23 66 20 72 75 6e  unch-test #f run
86f0: 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74  -id runname test
8700: 2d 63 6f 6e 66 20 6b 65 79 76 61 6c 6c 73 74 20  -conf keyvallst 
8710: 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 70  test-name test-p
8720: 61 74 68 20 69 74 65 6d 64 61 74 20 66 6c 61 67  ath itemdat flag
8730: 73 29 29 0a 09 09 20 20 20 28 62 65 67 69 6e 0a  s))...   (begin.
8740: 09 09 20 20 20 20 20 28 70 72 69 6e 74 20 22 45  ..     (print "E
8750: 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20  RROR: Failed to 
8760: 6c 61 75 6e 63 68 20 74 68 65 20 74 65 73 74 2e  launch the test.
8770: 20 45 78 69 74 69 6e 67 20 61 73 20 73 6f 6f 6e   Exiting as soon
8780: 20 61 73 20 70 6f 73 73 69 62 6c 65 22 29 0a 09   as possible")..
8790: 09 20 20 20 20 20 28 73 65 74 21 20 2a 67 6c 6f  .     (set! *glo
87a0: 62 61 6c 65 78 69 74 73 74 61 74 75 73 2a 20 31  balexitstatus* 1
87b0: 29 20 3b 3b 20 0a 09 09 20 20 20 20 20 28 70 72  ) ;; ...     (pr
87c0: 6f 63 65 73 73 2d 73 69 67 6e 61 6c 20 28 63 75  ocess-signal (cu
87d0: 72 72 65 6e 74 2d 70 72 6f 63 65 73 73 2d 69 64  rrent-process-id
87e0: 29 20 73 69 67 6e 61 6c 2f 6b 69 6c 6c 29 29 29  ) signal/kill)))
87f0: 29 29 29 0a 09 28 28 4b 49 4c 4c 45 44 29 20 0a  )))..((KILLED) .
8800: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31  . (debug:print 1
8810: 20 22 4e 4f 54 45 3a 20 22 20 6e 65 77 2d 74 65   "NOTE: " new-te
8820: 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72  st-name " is alr
8830: 65 61 64 79 20 72 75 6e 6e 69 6e 67 20 6f 72 20  eady running or 
8840: 77 61 73 20 65 78 70 6c 69 63 74 6c 79 20 6b 69  was explictly ki
8850: 6c 6c 65 64 2c 20 75 73 65 20 2d 66 6f 72 63 65  lled, use -force
8860: 20 74 6f 20 6c 61 75 6e 63 68 20 69 74 2e 22 29   to launch it.")
8870: 29 0a 09 28 28 4c 41 55 4e 43 48 45 44 20 52 45  )..((LAUNCHED RE
8880: 4d 4f 54 45 48 4f 53 54 53 54 41 52 54 20 52 55  MOTEHOSTSTART RU
8890: 4e 4e 49 4e 47 29 20 20 0a 09 20 28 69 66 20 28  NNING)  .. (if (
88a0: 3e 20 28 2d 20 28 63 75 72 72 65 6e 74 2d 73 65  > (- (current-se
88b0: 63 6f 6e 64 73 29 28 2b 20 28 64 62 3a 74 65 73  conds)(+ (db:tes
88c0: 74 2d 67 65 74 2d 65 76 65 6e 74 5f 74 69 6d 65  t-get-event_time
88d0: 20 74 65 73 74 64 61 74 29 0a 09 09 09 09 20 20   testdat).....  
88e0: 20 20 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65       (db:test-ge
88f0: 74 2d 72 75 6e 5f 64 75 72 61 74 69 6f 6e 20 74  t-run_duration t
8900: 65 73 74 64 61 74 29 29 29 0a 09 09 36 30 30 29  estdat)))...600)
8910: 20 3b 3b 20 69 2e 65 2e 20 6e 6f 20 75 70 64 61   ;; i.e. no upda
8920: 74 65 20 66 6f 72 20 6d 6f 72 65 20 74 68 61 6e  te for more than
8930: 20 36 30 30 20 73 65 63 6f 6e 64 73 0a 09 20 20   600 seconds..  
8940: 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20     (begin..     
8950: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
8960: 20 22 57 41 52 4e 49 4e 47 3a 20 54 65 73 74 20   "WARNING: Test 
8970: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 70  " test-name " ap
8980: 70 65 61 72 73 20 74 6f 20 62 65 20 64 65 61 64  pears to be dead
8990: 2e 20 46 6f 72 63 69 6e 67 20 69 74 20 74 6f 20  . Forcing it to 
89a0: 73 74 61 74 65 20 49 4e 43 4f 4d 50 4c 45 54 45  state INCOMPLETE
89b0: 20 61 6e 64 20 73 74 61 74 75 73 20 53 54 55 43   and status STUC
89c0: 4b 2f 44 45 41 44 22 29 0a 09 20 20 20 20 20 20  K/DEAD")..      
89d0: 20 28 74 65 73 74 73 3a 74 65 73 74 2d 73 65 74   (tests:test-set
89e0: 2d 73 74 61 74 75 73 21 20 74 65 73 74 2d 69 64  -status! test-id
89f0: 20 22 49 4e 43 4f 4d 50 4c 45 54 45 22 20 22 53   "INCOMPLETE" "S
8a00: 54 55 43 4b 2f 44 45 41 44 22 20 22 54 65 73 74  TUCK/DEAD" "Test
8a10: 20 69 73 20 73 74 75 63 6b 20 6f 72 20 64 65 61   is stuck or dea
8a20: 64 22 20 23 66 29 29 0a 09 20 20 20 20 20 28 64  d" #f))..     (d
8a30: 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 4e 4f  ebug:print 2 "NO
8a40: 54 45 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 20  TE: " test-name 
8a50: 22 20 69 73 20 61 6c 72 65 61 64 79 20 72 75 6e  " is already run
8a60: 6e 69 6e 67 22 29 29 29 0a 09 28 65 6c 73 65 20  ning")))..(else 
8a70: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
8a80: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 46 61 69  nt 0 "ERROR: Fai
8a90: 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 65  led to launch te
8aa0: 73 74 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61  st " new-test-na
8ab0: 6d 65 20 22 2e 20 55 6e 72 65 63 6f 67 6e 69 73  me ". Unrecognis
8ac0: 65 64 20 73 74 61 74 65 20 22 20 28 74 65 73 74  ed state " (test
8ad0: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64  :get-state testd
8ae0: 61 74 29 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d  at)))))))..;;===
8af0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8b00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8b10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8b20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8b30: 3d 3d 3d 0a 3b 3b 20 45 4e 44 20 4f 46 20 4e 45  ===.;; END OF NE
8b40: 57 20 53 54 55 46 46 0a 3b 3b 3d 3d 3d 3d 3d 3d  W STUFF.;;======
8b50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8b60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8b70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8b80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8b90: 0a 0a 28 64 65 66 69 6e 65 20 28 67 65 74 2d 64  ..(define (get-d
8ba0: 69 72 2d 75 70 2d 6e 20 64 69 72 20 2e 20 70 61  ir-up-n dir . pa
8bb0: 72 61 6d 73 29 20 0a 20 20 28 6c 65 74 20 28 28  rams) .  (let ((
8bc0: 64 70 61 72 74 73 20 20 28 73 74 72 69 6e 67 2d  dparts  (string-
8bd0: 73 70 6c 69 74 20 64 69 72 20 22 2f 22 29 29 0a  split dir "/")).
8be0: 09 28 63 6f 75 6e 74 20 20 20 28 69 66 20 28 6e  .(count   (if (n
8bf0: 75 6c 6c 3f 20 70 61 72 61 6d 73 29 20 31 20 28  ull? params) 1 (
8c00: 63 61 72 20 70 61 72 61 6d 73 29 29 29 29 0a 20  car params)))). 
8c10: 20 20 20 28 63 6f 6e 63 20 22 2f 22 20 28 73 74     (conc "/" (st
8c20: 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65  ring-intersperse
8c30: 20 0a 09 20 20 20 20 20 20 20 28 74 61 6b 65 20   ..       (take 
8c40: 64 70 61 72 74 73 20 28 2d 20 28 6c 65 6e 67 74  dparts (- (lengt
8c50: 68 20 64 70 61 72 74 73 29 20 63 6f 75 6e 74 29  h dparts) count)
8c60: 29 0a 09 20 20 20 20 20 20 20 22 2f 22 29 29 29  )..       "/")))
8c70: 29 0a 3b 3b 20 52 65 6d 6f 76 65 20 72 75 6e 73  ).;; Remove runs
8c80: 0a 3b 3b 20 66 69 65 6c 64 73 20 61 72 65 20 70  .;; fields are p
8c90: 61 73 73 69 6e 67 20 69 6e 20 74 68 72 6f 75 67  assing in throug
8ca0: 68 20 0a 3b 3b 20 61 63 74 69 6f 6e 3a 0a 3b 3b  h .;; action:.;;
8cb0: 20 20 20 20 27 72 65 6d 6f 76 65 2d 72 75 6e 73      'remove-runs
8cc0: 0a 3b 3b 20 20 20 20 27 73 65 74 2d 73 74 61 74  .;;    'set-stat
8cd0: 65 2d 73 74 61 74 75 73 0a 3b 3b 0a 3b 3b 20 4e  e-status.;;.;; N
8ce0: 42 2f 2f 20 73 68 6f 75 6c 64 20 70 61 73 73 20  B// should pass 
8cf0: 69 6e 20 6b 65 79 73 3f 0a 3b 3b 0a 28 64 65 66  in keys?.;;.(def
8d00: 69 6e 65 20 28 72 75 6e 73 3a 6f 70 65 72 61 74  ine (runs:operat
8d10: 65 2d 6f 6e 20 61 63 74 69 6f 6e 20 72 75 6e 6e  e-on action runn
8d20: 61 6d 65 70 61 74 74 20 74 65 73 74 70 61 74 74  amepatt testpatt
8d30: 20 23 21 6b 65 79 20 28 73 74 61 74 65 20 23 66   #!key (state #f
8d40: 29 28 73 74 61 74 75 73 20 23 66 29 28 6e 65 77  )(status #f)(new
8d50: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 20 23 66  -state-status #f
8d60: 29 29 0a 20 20 28 63 6f 6d 6d 6f 6e 3a 63 6c 65  )).  (common:cle
8d70: 61 72 2d 63 61 63 68 65 73 29 20 3b 3b 20 63 6c  ar-caches) ;; cl
8d80: 65 61 72 20 61 6c 6c 20 63 61 63 68 65 73 0a 20  ear all caches. 
8d90: 20 28 6c 65 74 2a 20 28 28 64 62 20 20 20 20 20   (let* ((db     
8da0: 20 20 20 20 20 20 23 66 29 0a 09 20 28 6b 65 79        #f).. (key
8db0: 73 20 20 20 20 20 20 20 20 20 28 6f 70 65 6e 2d  s         (open-
8dc0: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
8dd0: 2d 6b 65 79 73 20 64 62 29 29 0a 09 20 28 72 75  -keys db)).. (ru
8de0: 6e 64 61 74 20 20 20 20 20 20 20 28 6f 70 65 6e  ndat       (open
8df0: 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 3a  -run-close runs:
8e00: 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74 74  get-runs-by-patt
8e10: 20 64 62 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65   db keys runname
8e20: 70 61 74 74 29 29 0a 09 20 28 68 65 61 64 65 72  patt)).. (header
8e30: 20 20 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72         (vector-r
8e40: 65 66 20 72 75 6e 64 61 74 20 30 29 29 0a 09 20  ef rundat 0)).. 
8e50: 28 72 75 6e 73 20 20 20 20 20 20 20 20 20 28 76  (runs         (v
8e60: 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74  ector-ref rundat
8e70: 20 31 29 29 0a 09 20 28 73 74 61 74 65 73 20 20   1)).. (states  
8e80: 20 20 20 20 20 28 69 66 20 73 74 61 74 65 20 20       (if state  
8e90: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 73 74  (string-split st
8ea0: 61 74 65 20 20 22 2c 22 29 20 27 28 29 29 29 0a  ate  ",") '())).
8eb0: 09 20 28 73 74 61 74 75 73 65 73 20 20 20 20 20  . (statuses     
8ec0: 28 69 66 20 73 74 61 74 75 73 20 28 73 74 72 69  (if status (stri
8ed0: 6e 67 2d 73 70 6c 69 74 20 73 74 61 74 75 73 20  ng-split status 
8ee0: 22 2c 22 29 20 27 28 29 29 29 0a 09 20 28 73 74  ",") '())).. (st
8ef0: 61 74 65 2d 73 74 61 74 75 73 20 28 69 66 20 28  ate-status (if (
8f00: 73 74 72 69 6e 67 3f 20 6e 65 77 2d 73 74 61 74  string? new-stat
8f10: 65 2d 73 74 61 74 75 73 29 20 28 73 74 72 69 6e  e-status) (strin
8f20: 67 2d 73 70 6c 69 74 20 6e 65 77 2d 73 74 61 74  g-split new-stat
8f30: 65 2d 73 74 61 74 75 73 20 22 2c 22 29 20 27 28  e-status ",") '(
8f40: 23 66 20 23 66 29 29 29 29 0a 20 20 20 20 28 64  #f #f)))).    (d
8f50: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
8f60: 34 20 22 72 75 6e 73 3a 6f 70 65 72 61 74 65 2d  4 "runs:operate-
8f70: 6f 6e 20 3d 3e 20 48 65 61 64 65 72 3a 20 22 20  on => Header: " 
8f80: 68 65 61 64 65 72 20 22 20 61 63 74 69 6f 6e 3a  header " action:
8f90: 20 22 20 61 63 74 69 6f 6e 20 22 20 6e 65 77 2d   " action " new-
8fa0: 73 74 61 74 65 2d 73 74 61 74 75 73 3a 20 22 20  state-status: " 
8fb0: 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73  new-state-status
8fc0: 29 0a 20 20 20 20 28 69 66 20 28 3e 20 32 20 28  ).    (if (> 2 (
8fd0: 6c 65 6e 67 74 68 20 73 74 61 74 65 2d 73 74 61  length state-sta
8fe0: 74 75 73 29 29 0a 09 28 62 65 67 69 6e 0a 09 20  tus))..(begin.. 
8ff0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
9000: 22 45 52 52 4f 52 3a 20 74 68 65 20 70 61 72 61  "ERROR: the para
9010: 6d 65 74 65 72 20 74 6f 20 2d 73 65 74 2d 73 74  meter to -set-st
9020: 61 74 65 2d 73 74 61 74 75 73 20 69 73 20 61 20  ate-status is a 
9030: 63 6f 6d 6d 61 20 64 65 6c 69 6d 69 74 65 64 20  comma delimited 
9040: 73 74 72 69 6e 67 2e 20 45 2e 67 2e 20 43 4f 4d  string. E.g. COM
9050: 50 4c 45 54 45 44 2c 46 41 49 4c 22 29 0a 09 20  PLETED,FAIL").. 
9060: 20 28 65 78 69 74 29 29 29 0a 20 20 20 20 28 66   (exit))).    (f
9070: 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 28 6c 61  or-each.     (la
9080: 6d 62 64 61 20 28 72 75 6e 29 0a 20 20 20 20 20  mbda (run).     
9090: 20 20 28 6c 65 74 20 28 28 72 75 6e 6b 65 79 20    (let ((runkey 
90a0: 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65  (string-interspe
90b0: 72 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61  rse (map (lambda
90c0: 20 28 6b 29 0a 09 09 09 09 09 09 28 64 62 3a 67   (k).......(db:g
90d0: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64  et-value-by-head
90e0: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 28 76  er run header (v
90f0: 65 63 74 6f 72 2d 72 65 66 20 6b 20 30 29 29 29  ector-ref k 0)))
9100: 20 6b 65 79 73 29 20 22 2f 22 29 29 0a 09 20 20   keys) "/"))..  
9110: 20 20 20 28 64 69 72 73 2d 74 6f 2d 72 65 6d 6f     (dirs-to-remo
9120: 76 65 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61  ve (make-hash-ta
9130: 62 6c 65 29 29 29 0a 09 20 28 6c 65 74 2a 20 28  ble))).. (let* (
9140: 28 72 75 6e 2d 69 64 20 20 20 20 28 64 62 3a 67  (run-id    (db:g
9150: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64  et-value-by-head
9160: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 69  er run header "i
9170: 64 22 29 29 0a 09 09 28 72 75 6e 2d 73 74 61 74  d"))...(run-stat
9180: 65 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d  e (db:get-value-
9190: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65  by-header run he
91a0: 61 64 65 72 20 22 73 74 61 74 65 22 29 29 0a 09  ader "state"))..
91b0: 09 28 74 65 73 74 73 20 20 20 20 20 28 69 66 20  .(tests     (if 
91c0: 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 72 75 6e  (not (equal? run
91d0: 2d 73 74 61 74 65 20 22 6c 6f 63 6b 65 64 22 29  -state "locked")
91e0: 29 0a 09 09 09 20 20 20 20 20 20 20 28 6f 70 65  )....       (ope
91f0: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67  n-run-close db:g
9200: 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e  et-tests-for-run
9210: 20 64 62 20 72 75 6e 2d 69 64 0a 09 09 09 09 09   db run-id......
9220: 09 20 20 20 20 20 20 74 65 73 74 70 61 74 74 20  .      testpatt 
9230: 73 74 61 74 65 73 20 73 74 61 74 75 73 65 73 0a  states statuses.
9240: 09 09 09 09 09 09 20 20 20 20 20 20 6e 6f 74 2d  ......      not-
9250: 69 6e 3a 20 20 23 66 0a 09 09 09 09 09 09 20 20  in:  #f.......  
9260: 20 20 20 20 73 6f 72 74 2d 62 79 3a 20 28 63 61      sort-by: (ca
9270: 73 65 20 61 63 74 69 6f 6e 0a 09 09 09 09 09 09  se action.......
9280: 09 09 20 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73  .. ((remove-runs
9290: 29 20 27 72 75 6e 64 69 72 29 0a 09 09 09 09 09  ) 'rundir)......
92a0: 09 09 09 20 28 65 6c 73 65 20 20 20 20 20 20 20  ... (else       
92b0: 20 20 20 27 65 76 65 6e 74 5f 74 69 6d 65 29 29     'event_time))
92c0: 29 0a 09 09 09 20 20 20 20 20 20 20 27 28 29 29  )....       '())
92d0: 29 0a 09 09 28 6c 61 73 74 74 70 61 74 68 20 22  )...(lasttpath "
92e0: 2f 64 6f 65 73 2f 6e 6f 74 2f 65 78 69 73 74 2f  /does/not/exist/
92f0: 49 2f 68 6f 70 65 22 29 29 0a 09 20 20 20 28 64  I/hope"))..   (d
9300: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
9310: 34 20 22 72 75 6e 73 3a 6f 70 65 72 61 74 65 2d  4 "runs:operate-
9320: 6f 6e 20 72 75 6e 3d 22 20 72 75 6e 20 22 2c 20  on run=" run ", 
9330: 68 65 61 64 65 72 3d 22 20 68 65 61 64 65 72 29  header=" header)
9340: 0a 09 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e  ..   (if (not (n
9350: 75 6c 6c 3f 20 74 65 73 74 73 29 29 0a 09 20 20  ull? tests))..  
9360: 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 28       (begin... (
9370: 63 61 73 65 20 61 63 74 69 6f 6e 0a 09 09 20 20  case action...  
9380: 20 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29 0a   ((remove-runs).
9390: 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ..    (debug:pri
93a0: 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 74  nt 1 "Removing t
93b0: 65 73 74 73 20 66 6f 72 20 72 75 6e 3a 20 22 20  ests for run: " 
93c0: 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67  runkey " " (db:g
93d0: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64  et-value-by-head
93e0: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 72  er run header "r
93f0: 75 6e 6e 61 6d 65 22 29 29 29 0a 09 09 20 20 20  unname")))...   
9400: 28 28 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74  ((set-state-stat
9410: 75 73 29 0a 09 09 20 20 20 20 28 64 65 62 75 67  us)...    (debug
9420: 3a 70 72 69 6e 74 20 31 20 22 4d 6f 64 69 66 79  :print 1 "Modify
9430: 69 6e 67 20 73 74 61 74 65 20 61 6e 64 20 73 74  ing state and st
9440: 61 75 73 20 66 6f 72 20 74 65 73 74 73 20 66 6f  aus for tests fo
9450: 72 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20  r run: " runkey 
9460: 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75  " " (db:get-valu
9470: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20  e-by-header run 
9480: 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22  header "runname"
9490: 29 29 29 0a 09 09 20 20 20 28 28 70 72 69 6e 74  )))...   ((print
94a0: 2d 72 75 6e 29 0a 09 09 20 20 20 20 28 64 65 62  -run)...    (deb
94b0: 75 67 3a 70 72 69 6e 74 20 31 20 22 50 72 69 6e  ug:print 1 "Prin
94c0: 74 69 6e 67 20 69 6e 66 6f 20 66 6f 72 20 72 75  ting info for ru
94d0: 6e 20 22 20 72 75 6e 6b 65 79 20 22 2c 20 72 75  n " runkey ", ru
94e0: 6e 3d 22 20 72 75 6e 20 22 2c 20 74 65 73 74 73  n=" run ", tests
94f0: 3d 22 20 74 65 73 74 73 20 22 2c 20 68 65 61 64  =" tests ", head
9500: 65 72 3d 22 20 68 65 61 64 65 72 29 0a 09 09 20  er=" header)... 
9510: 20 20 20 61 63 74 69 6f 6e 29 0a 09 09 20 20 20     action)...   
9520: 28 65 6c 73 65 0a 09 09 20 20 20 20 28 64 65 62  (else...    (deb
9530: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 30 20  ug:print-info 0 
9540: 22 61 63 74 69 6f 6e 20 6e 6f 74 20 72 65 63 6f  "action not reco
9550: 67 6e 69 73 65 64 20 22 20 61 63 74 69 6f 6e 29  gnised " action)
9560: 29 29 0a 09 09 20 28 66 6f 72 2d 65 61 63 68 0a  ))... (for-each.
9570: 09 09 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73  ..  (lambda (tes
9580: 74 29 0a 09 09 20 20 20 20 28 6c 65 74 2a 20 28  t)...    (let* (
9590: 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74  (item-path (db:t
95a0: 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74  est-get-item-pat
95b0: 68 20 74 65 73 74 29 29 0a 09 09 09 20 20 20 28  h test))....   (
95c0: 74 65 73 74 2d 6e 61 6d 65 20 28 64 62 3a 74 65  test-name (db:te
95d0: 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20  st-get-testname 
95e0: 74 65 73 74 29 29 0a 09 09 09 20 20 20 28 72 75  test))....   (ru
95f0: 6e 2d 64 69 72 20 20 20 28 64 62 3a 74 65 73 74  n-dir   (db:test
9600: 2d 67 65 74 2d 72 75 6e 64 69 72 20 74 65 73 74  -get-rundir test
9610: 29 29 20 20 20 20 3b 3b 20 72 75 6e 20 64 69 72  ))    ;; run dir
9620: 20 69 73 20 66 72 6f 6d 20 74 68 65 20 6c 69 6e   is from the lin
9630: 6b 20 74 72 65 65 0a 09 09 09 20 20 20 28 72 65  k tree....   (re
9640: 61 6c 2d 64 69 72 20 20 28 69 66 20 28 66 69 6c  al-dir  (if (fil
9650: 65 2d 65 78 69 73 74 73 3f 20 72 75 6e 2d 64 69  e-exists? run-di
9660: 72 29 0a 09 09 09 09 09 20 20 28 72 65 73 6f 6c  r)......  (resol
9670: 76 65 2d 70 61 74 68 6e 61 6d 65 20 72 75 6e 2d  ve-pathname run-
9680: 64 69 72 29 0a 09 09 09 09 09 20 20 23 66 29 29  dir)......  #f))
9690: 0a 09 09 09 20 20 20 28 74 65 73 74 2d 69 64 20  ....   (test-id 
96a0: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69    (db:test-get-i
96b0: 64 20 74 65 73 74 29 29 29 0a 09 09 20 20 20 20  d test)))...    
96c0: 20 20 3b 3b 20 20 20 28 74 64 62 20 20 20 20 20    ;;   (tdb     
96d0: 20 20 28 64 62 3a 6f 70 65 6e 2d 74 65 73 74 2d    (db:open-test-
96e0: 64 62 20 72 75 6e 2d 64 69 72 29 29 29 0a 09 09  db run-dir)))...
96f0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
9700: 6e 74 2d 69 6e 66 6f 20 34 20 22 74 65 73 74 3d  nt-info 4 "test=
9710: 22 20 74 65 73 74 29 20 3b 3b 20 20 20 22 20 28  " test) ;;   " (
9720: 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74  db:test-get-test
9730: 6e 61 6d 65 20 74 65 73 74 29 20 22 20 69 64 3a  name test) " id:
9740: 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d   " (db:test-get-
9750: 69 64 20 74 65 73 74 29 20 22 20 22 20 69 74 65  id test) " " ite
9760: 6d 2d 70 61 74 68 20 22 20 61 63 74 69 6f 6e 3a  m-path " action:
9770: 20 22 20 61 63 74 69 6f 6e 29 0a 09 09 20 20 20   " action)...   
9780: 20 20 20 28 63 61 73 65 20 61 63 74 69 6f 6e 0a     (case action.
9790: 09 09 09 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73  ...((remove-runs
97a0: 29 20 3b 3b 20 74 68 65 20 74 64 62 20 69 73 20  ) ;; the tdb is 
97b0: 66 6f 72 20 66 75 74 75 72 65 20 70 6f 73 73 69  for future possi
97c0: 62 6c 65 2e 20 0a 09 09 09 20 28 6f 70 65 6e 2d  ble. .... (open-
97d0: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c  run-close db:del
97e0: 65 74 65 2d 74 65 73 74 2d 72 65 63 6f 72 64 73  ete-test-records
97f0: 20 64 62 20 23 66 20 28 64 62 3a 74 65 73 74 2d   db #f (db:test-
9800: 67 65 74 2d 69 64 20 74 65 73 74 29 29 0a 09 09  get-id test))...
9810: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69  . (debug:print-i
9820: 6e 66 6f 20 31 20 22 41 74 74 65 6d 70 74 69 6e  nfo 1 "Attemptin
9830: 67 20 74 6f 20 72 65 6d 6f 76 65 20 22 20 28 69  g to remove " (i
9840: 66 20 72 65 61 6c 2d 64 69 72 20 28 63 6f 6e 63  f real-dir (conc
9850: 20 22 20 64 69 72 20 22 20 72 65 61 6c 2d 64 69   " dir " real-di
9860: 72 20 22 20 61 6e 64 20 22 29 20 22 22 29 20 22  r " and ") "") "
9870: 20 6c 69 6e 6b 20 22 20 72 75 6e 2d 64 69 72 29   link " run-dir)
9880: 0a 09 09 09 20 28 69 66 20 28 61 6e 64 20 72 65  .... (if (and re
9890: 61 6c 2d 64 69 72 20 0a 09 09 09 09 20 20 28 3e  al-dir .....  (>
98a0: 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20   (string-length 
98b0: 72 65 61 6c 2d 64 69 72 29 20 35 29 0a 09 09 09  real-dir) 5)....
98c0: 09 20 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f  .  (file-exists?
98d0: 20 72 65 61 6c 2d 64 69 72 29 29 20 3b 3b 20 62   real-dir)) ;; b
98e0: 61 64 20 68 65 75 72 69 73 74 69 63 20 62 75 74  ad heuristic but
98f0: 20 73 68 6f 75 6c 64 20 70 72 65 76 65 6e 74 20   should prevent 
9900: 2f 74 6d 70 20 2f 68 6f 6d 65 20 65 74 63 2e 0a  /tmp /home etc..
9910: 09 09 09 20 20 20 20 20 28 62 65 67 69 6e 20 3b  ...     (begin ;
9920: 3b 20 6c 65 74 2a 20 28 28 72 65 61 6c 70 61 74  ; let* ((realpat
9930: 68 20 28 72 65 73 6f 6c 76 65 2d 70 61 74 68 6e  h (resolve-pathn
9940: 61 6d 65 20 72 75 6e 2d 64 69 72 29 29 29 0a 09  ame run-dir)))..
9950: 09 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a  ..       (debug:
9960: 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 52 65  print-info 1 "Re
9970: 63 75 72 73 69 76 65 6c 79 20 72 65 6d 6f 76 69  cursively removi
9980: 6e 67 20 22 20 72 65 61 6c 2d 64 69 72 29 0a 09  ng " real-dir)..
9990: 09 09 20 20 20 20 20 20 20 28 69 66 20 28 66 69  ..       (if (fi
99a0: 6c 65 2d 65 78 69 73 74 73 3f 20 72 65 61 6c 2d  le-exists? real-
99b0: 64 69 72 29 0a 09 09 09 09 20 20 20 28 69 66 20  dir).....   (if 
99c0: 28 3e 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63  (> (system (conc
99d0: 20 22 72 6d 20 2d 72 66 20 22 20 72 65 61 6c 2d   "rm -rf " real-
99e0: 64 69 72 29 29 20 30 29 0a 09 09 09 09 20 20 20  dir)) 0).....   
99f0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
9a00: 20 30 20 22 45 52 52 4f 52 3a 20 54 68 65 72 65   0 "ERROR: There
9a10: 20 77 61 73 20 61 20 70 72 6f 62 6c 65 6d 20 72   was a problem r
9a20: 65 6d 6f 76 69 6e 67 20 22 20 72 65 61 6c 2d 64  emoving " real-d
9a30: 69 72 20 22 20 77 69 74 68 20 72 6d 20 2d 66 22  ir " with rm -f"
9a40: 29 29 0a 09 09 09 09 20 20 20 28 64 65 62 75 67  )).....   (debug
9a50: 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e  :print 0 "WARNIN
9a60: 47 3a 20 74 65 73 74 20 64 69 72 20 22 20 72 65  G: test dir " re
9a70: 61 6c 2d 64 69 72 20 22 20 61 70 70 65 61 72 73  al-dir " appears
9a80: 20 74 6f 20 6e 6f 74 20 65 78 69 73 74 20 6f 72   to not exist or
9a90: 20 69 73 20 6e 6f 74 20 72 65 61 64 61 62 6c 65   is not readable
9aa0: 22 29 29 29 0a 09 09 09 20 20 20 20 20 28 69 66  ")))....     (if
9ab0: 20 72 65 61 6c 2d 64 69 72 20 0a 09 09 09 09 20   real-dir ..... 
9ac0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
9ad0: 57 41 52 4e 49 4e 47 3a 20 64 69 72 65 63 74 6f  WARNING: directo
9ae0: 72 79 20 22 20 72 65 61 6c 2d 64 69 72 20 22 20  ry " real-dir " 
9af0: 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 74 22 29  does not exist")
9b00: 0a 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 69  ..... (debug:pri
9b10: 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 6e  nt 0 "WARNING: n
9b20: 6f 20 72 65 61 6c 20 64 69 72 65 63 74 6f 72 79  o real directory
9b30: 20 63 6f 72 72 6f 73 70 6f 6e 64 69 6e 67 20 74   corrosponding t
9b40: 6f 20 6c 69 6e 6b 20 22 20 72 75 6e 2d 64 69 72  o link " run-dir
9b50: 20 22 2c 20 6e 6f 74 68 69 6e 67 20 64 6f 6e 65   ", nothing done
9b60: 22 29 29 29 0a 09 09 09 20 28 69 66 20 28 73 79  "))).... (if (sy
9b70: 6d 62 6f 6c 69 63 2d 6c 69 6e 6b 3f 20 72 75 6e  mbolic-link? run
9b80: 2d 64 69 72 29 0a 09 09 09 20 20 20 20 20 28 62  -dir)....     (b
9b90: 65 67 69 6e 0a 09 09 09 20 20 20 20 20 20 20 28  egin....       (
9ba0: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
9bb0: 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 73 79 6d   1 "Removing sym
9bc0: 6c 69 6e 6b 20 22 20 72 75 6e 2d 64 69 72 29 0a  link " run-dir).
9bd0: 09 09 09 20 20 20 20 20 20 20 28 64 65 6c 65 74  ...       (delet
9be0: 65 2d 66 69 6c 65 20 72 75 6e 2d 64 69 72 29 29  e-file run-dir))
9bf0: 0a 09 09 09 20 20 20 20 20 28 69 66 20 28 64 69  ....     (if (di
9c00: 72 65 63 74 6f 72 79 3f 20 72 75 6e 2d 64 69 72  rectory? run-dir
9c10: 29 0a 09 09 09 09 20 28 69 66 20 28 3e 20 28 64  )..... (if (> (d
9c20: 69 72 65 63 74 6f 72 79 2d 66 6f 6c 64 20 28 6c  irectory-fold (l
9c30: 61 6d 62 64 61 20 28 66 20 78 29 28 2b 20 31 20  ambda (f x)(+ 1 
9c40: 78 29 29 20 30 20 72 75 6e 2d 64 69 72 29 20 30  x)) 0 run-dir) 0
9c50: 29 0a 09 09 09 09 20 20 20 20 20 28 64 65 62 75  ).....     (debu
9c60: 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49  g:print 0 "WARNI
9c70: 4e 47 3a 20 72 65 66 75 73 69 6e 67 20 74 6f 20  NG: refusing to 
9c80: 72 65 6d 6f 76 65 20 22 20 72 75 6e 2d 64 69 72  remove " run-dir
9c90: 20 22 20 61 73 20 69 74 20 69 73 20 6e 6f 74 20   " as it is not 
9ca0: 65 6d 70 74 79 22 29 0a 09 09 09 09 20 20 20 20  empty").....    
9cb0: 20 28 64 65 6c 65 74 65 2d 64 69 72 65 63 74 6f   (delete-directo
9cc0: 72 79 20 72 75 6e 2d 64 69 72 29 29 20 3b 3b 20  ry run-dir)) ;; 
9cd0: 69 74 20 73 68 6f 75 6c 64 20 62 65 20 65 6d 70  it should be emp
9ce0: 74 79 20 62 79 20 68 65 72 65 20 42 55 47 20 42  ty by here BUG B
9cf0: 55 47 2c 20 61 64 64 20 65 72 72 6f 72 20 63 61  UG, add error ca
9d00: 74 63 68 0a 09 09 09 09 20 28 69 66 20 72 75 6e  tch..... (if run
9d10: 2d 64 69 72 0a 09 09 09 09 20 20 20 20 20 28 64  -dir.....     (d
9d20: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41  ebug:print 0 "WA
9d30: 52 4e 49 4e 47 3a 20 6e 6f 74 20 72 65 6d 6f 76  RNING: not remov
9d40: 69 6e 67 20 22 20 72 75 6e 2d 64 69 72 20 22 20  ing " run-dir " 
9d50: 61 73 20 69 74 20 65 69 74 68 65 72 20 64 6f 65  as it either doe
9d60: 73 6e 27 74 20 65 78 69 73 74 20 6f 72 20 69 73  sn't exist or is
9d70: 20 6e 6f 74 20 61 20 73 79 6d 6c 69 6e 6b 22 29   not a symlink")
9d80: 0a 09 09 09 09 20 20 20 20 20 28 64 65 62 75 67  .....     (debug
9d90: 3a 70 72 69 6e 74 20 30 20 22 4e 4f 54 45 3a 20  :print 0 "NOTE: 
9da0: 74 68 65 20 72 75 6e 20 64 69 72 20 66 6f 72 20  the run dir for 
9db0: 74 68 69 73 20 74 65 73 74 20 69 73 20 75 6e 64  this test is und
9dc0: 65 66 69 6e 65 64 2e 20 54 65 73 74 20 6d 61 79  efined. Test may
9dd0: 20 68 61 76 65 20 61 6c 72 65 61 64 79 20 62 65   have already be
9de0: 65 6e 20 64 65 6c 65 74 65 64 2e 22 29 29 0a 09  en deleted."))..
9df0: 09 09 09 20 29 29 29 0a 09 09 09 28 28 73 65 74  ... )))....((set
9e00: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 29 0a 09  -state-status)..
9e10: 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d  .. (debug:print-
9e20: 69 6e 66 6f 20 32 20 22 6e 65 77 20 73 74 61 74  info 2 "new stat
9e30: 65 20 22 20 28 63 61 72 20 73 74 61 74 65 2d 73  e " (car state-s
9e40: 74 61 74 75 73 29 20 22 2c 20 6e 65 77 20 73 74  tatus) ", new st
9e50: 61 74 75 73 20 22 20 28 63 61 64 72 20 73 74 61  atus " (cadr sta
9e60: 74 65 2d 73 74 61 74 75 73 29 29 0a 09 09 09 20  te-status)).... 
9e70: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
9e80: 64 62 3a 74 65 73 74 2d 73 65 74 2d 73 74 61 74  db:test-set-stat
9e90: 65 2d 73 74 61 74 75 73 2d 62 79 2d 69 64 20 64  e-status-by-id d
9ea0: 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  b (db:test-get-i
9eb0: 64 20 74 65 73 74 29 20 28 63 61 72 20 73 74 61  d test) (car sta
9ec0: 74 65 2d 73 74 61 74 75 73 29 28 63 61 64 72 20  te-status)(cadr 
9ed0: 73 74 61 74 65 2d 73 74 61 74 75 73 29 20 23 66  state-status) #f
9ee0: 29 29 29 29 29 0a 09 09 20 20 28 73 6f 72 74 20  )))))...  (sort 
9ef0: 74 65 73 74 73 20 28 6c 61 6d 62 64 61 20 28 61  tests (lambda (a
9f00: 20 62 29 28 6c 65 74 20 28 28 64 69 72 61 20 28   b)(let ((dira (
9f10: 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 64  db:test-get-rund
9f20: 69 72 20 61 29 29 0a 09 09 09 09 09 09 20 28 64  ir a))....... (d
9f30: 69 72 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74  irb (db:test-get
9f40: 2d 72 75 6e 64 69 72 20 62 29 29 29 0a 09 09 09  -rundir b)))....
9f50: 09 09 20 20 20 20 20 28 69 66 20 28 61 6e 64 20  ..     (if (and 
9f60: 28 73 74 72 69 6e 67 3f 20 64 69 72 61 29 28 73  (string? dira)(s
9f70: 74 72 69 6e 67 3f 20 64 69 72 62 29 29 0a 09 09  tring? dirb))...
9f80: 09 09 09 09 20 28 3e 20 28 73 74 72 69 6e 67 2d  .... (> (string-
9f90: 6c 65 6e 67 74 68 20 64 69 72 61 29 28 73 74 72  length dira)(str
9fa0: 69 6e 67 2d 6c 65 6e 67 74 68 20 64 69 72 62 29  ing-length dirb)
9fb0: 29 0a 09 09 09 09 09 09 20 23 66 29 29 29 29 29  )....... #f)))))
9fc0: 29 29 0a 09 20 20 20 3b 3b 20 72 65 6d 6f 76 65  ))..   ;; remove
9fd0: 20 74 68 65 20 72 75 6e 20 69 66 20 7a 65 72 6f   the run if zero
9fe0: 20 74 65 73 74 73 20 72 65 6d 61 69 6e 0a 09 20   tests remain.. 
9ff0: 20 20 28 69 66 20 28 65 71 3f 20 61 63 74 69 6f    (if (eq? actio
a000: 6e 20 27 72 65 6d 6f 76 65 2d 72 75 6e 73 29 0a  n 'remove-runs).
a010: 09 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 72  .       (let ((r
a020: 65 6d 74 65 73 74 73 20 28 6f 70 65 6e 2d 72 75  emtests (open-ru
a030: 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74  n-close db:get-t
a040: 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20  ests-for-run db 
a050: 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79  (db:get-value-by
a060: 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64  -header run head
a070: 65 72 20 22 69 64 22 29 20 23 66 20 27 28 22 44  er "id") #f '("D
a080: 45 4c 45 54 45 44 22 29 20 27 28 22 6e 2f 61 22  ELETED") '("n/a"
a090: 29 20 6e 6f 74 2d 69 6e 3a 20 23 74 29 29 29 0a  ) not-in: #t))).
a0a0: 09 09 20 28 69 66 20 28 6e 75 6c 6c 3f 20 72 65  .. (if (null? re
a0b0: 6d 74 65 73 74 73 29 20 3b 3b 20 6e 6f 20 6d 6f  mtests) ;; no mo
a0c0: 72 65 20 74 65 73 74 73 20 72 65 6d 61 69 6e 69  re tests remaini
a0d0: 6e 67 0a 09 09 20 20 20 20 20 28 6c 65 74 2a 20  ng...     (let* 
a0e0: 28 28 64 70 61 72 74 73 20 20 28 73 74 72 69 6e  ((dparts  (strin
a0f0: 67 2d 73 70 6c 69 74 20 6c 61 73 74 74 70 61 74  g-split lasttpat
a100: 68 20 22 2f 22 29 29 0a 09 09 09 20 20 20 20 28  h "/"))....    (
a110: 72 75 6e 70 61 74 68 20 28 63 6f 6e 63 20 22 2f  runpath (conc "/
a120: 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73  " (string-inters
a130: 70 65 72 73 65 20 0a 09 09 09 09 09 09 28 74 61  perse .......(ta
a140: 6b 65 20 64 70 61 72 74 73 20 28 2d 20 28 6c 65  ke dparts (- (le
a150: 6e 67 74 68 20 64 70 61 72 74 73 29 20 31 29 29  ngth dparts) 1))
a160: 0a 09 09 09 09 09 09 22 2f 22 29 29 29 29 0a 09  ......."/"))))..
a170: 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70  .       (debug:p
a180: 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67  rint 1 "Removing
a190: 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22   run: " runkey "
a1a0: 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65   " (db:get-value
a1b0: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68  -by-header run h
a1c0: 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29  eader "runname")
a1d0: 20 22 20 61 6e 64 20 72 65 6c 61 74 65 64 20 72   " and related r
a1e0: 65 63 6f 72 64 22 29 0a 09 09 20 20 20 20 20 20  ecord")...      
a1f0: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
a200: 20 64 62 3a 64 65 6c 65 74 65 2d 72 75 6e 20 64   db:delete-run d
a210: 62 20 72 75 6e 2d 69 64 29 0a 09 09 20 20 20 20  b run-id)...    
a220: 20 20 20 3b 3b 20 54 68 69 73 20 69 73 20 61 20     ;; This is a 
a230: 70 72 65 74 74 79 20 67 6f 6f 64 20 70 6c 61 63  pretty good plac
a240: 65 20 74 6f 20 70 75 72 67 65 20 6f 6c 64 20 44  e to purge old D
a250: 45 4c 45 54 45 44 20 74 65 73 74 73 0a 09 09 20  ELETED tests... 
a260: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d        (open-run-
a270: 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 2d  close db:delete-
a280: 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62  tests-for-run db
a290: 20 72 75 6e 2d 69 64 29 0a 09 09 20 20 20 20 20   run-id)...     
a2a0: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73    (open-run-clos
a2b0: 65 20 64 62 3a 64 65 6c 65 74 65 2d 6f 6c 64 2d  e db:delete-old-
a2c0: 64 65 6c 65 74 65 64 2d 74 65 73 74 2d 72 65 63  deleted-test-rec
a2d0: 6f 72 64 73 20 64 62 29 0a 09 09 20 20 20 20 20  ords db)...     
a2e0: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73    (open-run-clos
a2f0: 65 20 64 62 3a 73 65 74 2d 76 61 72 20 64 62 20  e db:set-var db 
a300: 22 44 45 4c 45 54 45 44 5f 54 45 53 54 53 22 20  "DELETED_TESTS" 
a310: 28 63 75 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73  (current-seconds
a320: 29 29 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 6e  ))...       ;; n
a330: 65 65 64 20 74 6f 20 66 69 67 75 72 65 20 6f 75  eed to figure ou
a340: 74 20 74 68 65 20 70 61 74 68 20 74 6f 20 74 68  t the path to th
a350: 65 20 72 75 6e 20 64 69 72 20 61 6e 64 20 72 65  e run dir and re
a360: 6d 6f 76 65 20 69 74 20 69 66 20 65 6d 70 74 79  move it if empty
a370: 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 20 20 20  ...       ;;    
a380: 28 69 66 20 28 6e 75 6c 6c 3f 20 28 67 6c 6f 62  (if (null? (glob
a390: 20 28 63 6f 6e 63 20 72 75 6e 70 61 74 68 20 22   (conc runpath "
a3a0: 2f 2a 22 29 29 29 0a 09 09 20 20 20 20 20 20 20  /*")))...       
a3b0: 3b 3b 20 20 20 20 20 20 20 20 28 62 65 67 69 6e  ;;        (begin
a3c0: 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 09 20 28  ...       ;; . (
a3d0: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52  debug:print 1 "R
a3e0: 65 6d 6f 76 69 6e 67 20 72 75 6e 20 64 69 72 20  emoving run dir 
a3f0: 22 20 72 75 6e 70 61 74 68 29 0a 09 09 20 20 20  " runpath)...   
a400: 20 20 20 20 3b 3b 20 09 20 28 73 79 73 74 65 6d      ;; . (system
a410: 20 28 63 6f 6e 63 20 22 72 6d 64 69 72 20 2d 70   (conc "rmdir -p
a420: 20 22 20 72 75 6e 70 61 74 68 29 29 29 29 0a 09   " runpath))))..
a430: 09 20 20 20 20 20 20 20 29 29 29 29 29 0a 09 20  .       ))))).. 
a440: 29 29 0a 20 20 20 20 20 72 75 6e 73 29 29 0a 20  )).     runs)). 
a450: 20 23 74 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d   #t)..;;========
a460: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a470: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a480: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a490: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b  ==============.;
a4a0: 3b 20 52 6f 75 74 69 6e 65 73 20 66 6f 72 20 6d  ; Routines for m
a4b0: 61 6e 69 70 75 6c 61 74 69 6e 67 20 72 75 6e 73  anipulating runs
a4c0: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  .;;=============
a4d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a4e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a4f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a500: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 53 69  =========..;; Si
a510: 6e 63 65 20 6d 61 6e 79 20 63 61 6c 6c 73 20 74  nce many calls t
a520: 6f 20 61 20 72 75 6e 20 72 65 71 75 69 72 65 20  o a run require 
a530: 70 72 65 74 74 79 20 6d 75 63 68 20 74 68 65 20  pretty much the 
a540: 73 61 6d 65 20 73 65 74 75 70 20 0a 3b 3b 20 74  same setup .;; t
a550: 68 69 73 20 77 72 61 70 70 65 72 20 69 73 20 75  his wrapper is u
a560: 73 65 64 20 74 6f 20 72 65 64 75 63 65 20 74 68  sed to reduce th
a570: 65 20 72 65 70 6c 69 63 61 74 69 6f 6e 20 6f 66  e replication of
a580: 20 63 6f 64 65 0a 28 64 65 66 69 6e 65 20 28 67   code.(define (g
a590: 65 6e 65 72 61 6c 2d 72 75 6e 2d 63 61 6c 6c 20  eneral-run-call 
a5a0: 73 77 69 74 63 68 6e 61 6d 65 20 61 63 74 69 6f  switchname actio
a5b0: 6e 2d 64 65 73 63 20 70 72 6f 63 29 0a 20 20 28  n-desc proc).  (
a5c0: 6c 65 74 20 28 28 72 75 6e 6e 61 6d 65 20 28 61  let ((runname (a
a5d0: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 3a 72 75  rgs:get-arg ":ru
a5e0: 6e 6e 61 6d 65 22 29 29 0a 09 28 74 61 72 67 65  nname"))..(targe
a5f0: 74 20 20 28 69 66 20 28 61 72 67 73 3a 67 65 74  t  (if (args:get
a600: 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 29 0a  -arg "-target").
a610: 09 09 20 20 20 20 20 28 61 72 67 73 3a 67 65 74  ..     (args:get
a620: 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 29 0a  -arg "-target").
a630: 09 09 20 20 20 20 20 28 61 72 67 73 3a 67 65 74  ..     (args:get
a640: 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29  -arg "-reqtarg")
a650: 29 29 0a 09 28 74 68 31 20 20 20 20 20 23 66 29  ))..(th1     #f)
a660: 29 0a 20 20 20 20 28 63 6f 6e 64 0a 20 20 20 20  ).    (cond.    
a670: 20 28 28 6e 6f 74 20 74 61 72 67 65 74 29 0a 20   ((not target). 
a680: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
a690: 74 20 30 20 22 45 52 52 4f 52 3a 20 4d 69 73 73  t 0 "ERROR: Miss
a6a0: 69 6e 67 20 72 65 71 75 69 72 65 64 20 70 61 72  ing required par
a6b0: 61 6d 65 74 65 72 20 66 6f 72 20 22 20 73 77 69  ameter for " swi
a6c0: 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d  tchname ", you m
a6d0: 75 73 74 20 73 70 65 63 69 66 79 20 74 68 65 20  ust specify the 
a6e0: 74 61 72 67 65 74 20 77 69 74 68 20 2d 74 61 72  target with -tar
a6f0: 67 65 74 22 29 0a 20 20 20 20 20 20 28 65 78 69  get").      (exi
a700: 74 20 33 29 29 0a 20 20 20 20 20 28 28 6e 6f 74  t 3)).     ((not
a710: 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20 20 20   runname).      
a720: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
a730: 45 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67 20 72  ERROR: Missing r
a740: 65 71 75 69 72 65 64 20 70 61 72 61 6d 65 74 65  equired paramete
a750: 72 20 66 6f 72 20 22 20 73 77 69 74 63 68 6e 61  r for " switchna
a760: 6d 65 20 22 2c 20 79 6f 75 20 6d 75 73 74 20 73  me ", you must s
a770: 70 65 63 69 66 79 20 74 68 65 20 72 75 6e 20 6e  pecify the run n
a780: 61 6d 65 20 77 69 74 68 20 3a 72 75 6e 6e 61 6d  ame with :runnam
a790: 65 20 72 75 6e 6e 61 6d 65 22 29 0a 20 20 20 20  e runname").    
a7a0: 20 20 28 65 78 69 74 20 33 29 29 0a 20 20 20 20    (exit 3)).    
a7b0: 20 28 65 6c 73 65 0a 20 20 20 20 20 20 28 6c 65   (else.      (le
a7c0: 74 20 28 28 64 62 20 20 20 23 66 29 0a 09 20 20  t ((db   #f)..  
a7d0: 20 20 28 6b 65 79 73 20 23 66 29 29 0a 09 28 69    (keys #f))..(i
a7e0: 66 20 28 6e 6f 74 20 28 73 65 74 75 70 2d 66 6f  f (not (setup-fo
a7f0: 72 2d 72 75 6e 29 29 0a 09 20 20 20 20 28 62 65  r-run))..    (be
a800: 67 69 6e 20 0a 09 20 20 20 20 20 20 28 64 65 62  gin ..      (deb
a810: 75 67 3a 70 72 69 6e 74 20 30 20 22 46 61 69 6c  ug:print 0 "Fail
a820: 65 64 20 74 6f 20 73 65 74 75 70 2c 20 65 78 69  ed to setup, exi
a830: 74 69 6e 67 22 29 0a 09 20 20 20 20 20 20 28 65  ting")..      (e
a840: 78 69 74 20 31 29 29 29 0a 09 28 69 66 20 28 61  xit 1)))..(if (a
a850: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 73 65  rgs:get-arg "-se
a860: 72 76 65 72 22 29 0a 09 20 20 20 20 28 6f 70 65  rver")..    (ope
a870: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 73 65 72 76  n-run-close serv
a880: 65 72 3a 73 74 61 72 74 20 64 62 20 28 61 72 67  er:start db (arg
a890: 73 3a 67 65 74 2d 61 72 67 20 22 2d 73 65 72 76  s:get-arg "-serv
a8a0: 65 72 22 29 29 0a 20 09 20 20 20 20 28 69 66 20  er")). .    (if 
a8b0: 28 6e 6f 74 20 28 6f 72 20 28 61 72 67 73 3a 67  (not (or (args:g
a8c0: 65 74 2d 61 72 67 20 22 2d 72 75 6e 61 6c 6c 22  et-arg "-runall"
a8d0: 29 20 20 20 20 20 3b 3b 20 72 75 6e 61 6c 6c 20  )     ;; runall 
a8e0: 61 6e 64 20 72 75 6e 74 65 73 74 73 20 61 72 65  and runtests are
a8f0: 20 61 6c 6c 6f 77 65 64 20 74 6f 20 62 65 20 73   allowed to be s
a900: 65 72 76 65 72 73 0a 20 09 09 09 20 28 61 72 67  ervers. ... (arg
a910: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 75 6e 74  s:get-arg "-runt
a920: 65 73 74 73 22 29 29 29 0a 09 09 28 73 65 72 76  ests")))...(serv
a930: 65 72 3a 63 6c 69 65 6e 74 2d 73 65 74 75 70 29  er:client-setup)
a940: 20 3b 3b 20 54 68 69 73 20 69 73 20 61 20 64 75   ;; This is a du
a950: 70 6c 69 63 61 74 65 20 73 74 61 72 74 75 70 21  plicate startup!
a960: 21 21 3f 3f 3f 20 42 55 47 3f 0a 09 09 29 29 0a  !!??? BUG?...)).
a970: 09 28 73 65 74 21 20 6b 65 79 73 20 28 6f 70 65  .(set! keys (ope
a980: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67  n-run-close db:g
a990: 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 3b 3b  et-keys db))..;;
a9a0: 20 68 61 76 65 20 65 6e 6f 75 67 68 20 74 6f 20   have enough to 
a9b0: 70 72 6f 63 65 73 73 20 2d 74 61 72 67 65 74 20  process -target 
a9c0: 6f 72 20 2d 72 65 71 74 61 72 67 20 68 65 72 65  or -reqtarg here
a9d0: 0a 09 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d  ..(if (args:get-
a9e0: 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 0a  arg "-reqtarg").
a9f0: 09 20 20 20 20 28 6c 65 74 2a 20 28 28 72 75 6e  .    (let* ((run
aa00: 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 20 2a  configf (conc  *
aa10: 74 6f 70 70 61 74 68 2a 20 22 2f 72 75 6e 63 6f  toppath* "/runco
aa20: 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22 29 29 20  nfigs.config")) 
aa30: 3b 3b 20 44 4f 20 4e 4f 54 20 45 56 41 4c 55 41  ;; DO NOT EVALUA
aa40: 54 45 20 41 4c 4c 20 0a 09 09 20 20 20 28 72 75  TE ALL ...   (ru
aa50: 6e 63 6f 6e 66 69 67 20 20 28 72 65 61 64 2d 63  nconfig  (read-c
aa60: 6f 6e 66 69 67 20 72 75 6e 63 6f 6e 66 69 67 66  onfig runconfigf
aa70: 20 23 66 20 23 66 20 65 6e 76 69 72 6f 6e 2d 70   #f #f environ-p
aa80: 61 74 74 3a 20 23 66 29 29 29 20 0a 09 20 20 20  att: #f))) ..   
aa90: 20 20 20 28 69 66 20 28 68 61 73 68 2d 74 61 62     (if (hash-tab
aaa0: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 72  le-ref/default r
aab0: 75 6e 63 6f 6e 66 69 67 20 28 61 72 67 73 3a 67  unconfig (args:g
aac0: 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67  et-arg "-reqtarg
aad0: 22 29 20 23 66 29 0a 09 09 20 20 28 6b 65 79 73  ") #f)...  (keys
aae0: 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 72 67 73  :target-set-args
aaf0: 20 6b 65 79 73 20 28 61 72 67 73 3a 67 65 74 2d   keys (args:get-
ab00: 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 20  arg "-reqtarg") 
ab10: 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 0a 09  args:arg-hash)..
ab20: 09 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20  .  (begin...    
ab30: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
ab40: 45 52 52 4f 52 3a 20 5b 22 20 28 61 72 67 73 3a  ERROR: [" (args:
ab50: 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72  get-arg "-reqtar
ab60: 67 22 29 20 22 5d 20 6e 6f 74 20 66 6f 75 6e 64  g") "] not found
ab70: 20 69 6e 20 22 20 72 75 6e 63 6f 6e 66 69 67 66   in " runconfigf
ab80: 29 0a 09 09 20 20 20 20 28 69 66 20 64 62 20 28  )...    (if db (
ab90: 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65  sqlite3:finalize
aba0: 21 20 64 62 29 29 0a 09 09 20 20 20 20 28 65 78  ! db))...    (ex
abb0: 69 74 20 31 29 29 29 29 0a 09 20 20 20 20 28 69  it 1))))..    (i
abc0: 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20  f (args:get-arg 
abd0: 22 2d 74 61 72 67 65 74 22 29 0a 09 09 28 6b 65  "-target")...(ke
abe0: 79 73 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 72  ys:target-set-ar
abf0: 67 73 20 6b 65 79 73 20 28 61 72 67 73 3a 67 65  gs keys (args:ge
ac00: 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 20  t-arg "-target" 
ac10: 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 20 61  args:arg-hash) a
ac20: 72 67 73 3a 61 72 67 2d 68 61 73 68 29 29 29 0a  rgs:arg-hash))).
ac30: 09 28 69 66 20 28 6e 6f 74 20 28 63 61 72 20 2a  .(if (not (car *
ac40: 63 6f 6e 66 69 67 69 6e 66 6f 2a 29 29 0a 09 20  configinfo*)).. 
ac50: 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20     (begin..     
ac60: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
ac70: 22 45 52 52 4f 52 3a 20 41 74 74 65 6d 70 74 65  "ERROR: Attempte
ac80: 64 20 74 6f 20 22 20 61 63 74 69 6f 6e 2d 64 65  d to " action-de
ac90: 73 63 20 22 20 62 75 74 20 72 75 6e 20 61 72 65  sc " but run are
aca0: 61 20 63 6f 6e 66 69 67 20 66 69 6c 65 20 6e 6f  a config file no
acb0: 74 20 66 6f 75 6e 64 22 29 0a 09 20 20 20 20 20  t found")..     
acc0: 20 28 65 78 69 74 20 31 29 29 0a 09 20 20 20 20   (exit 1))..    
acd0: 3b 3b 20 45 78 74 72 61 63 74 20 6f 75 74 20 73  ;; Extract out s
ace0: 74 75 66 66 20 6e 65 65 64 65 64 20 69 6e 20 6d  tuff needed in m
acf0: 6f 73 74 20 6f 72 20 6d 61 6e 79 20 63 61 6c 6c  ost or many call
ad00: 73 0a 09 20 20 20 20 3b 3b 20 68 65 72 65 20 74  s..    ;; here t
ad10: 68 65 6e 20 63 61 6c 6c 20 70 72 6f 63 0a 09 20  hen call proc.. 
ad20: 20 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 6e 61     (let* ((keyna
ad30: 6d 65 73 20 20 20 28 6d 61 70 20 6b 65 79 3a 67  mes   (map key:g
ad40: 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79  et-fieldname key
ad50: 73 29 29 0a 09 09 20 20 20 28 6b 65 79 76 61 6c  s))...   (keyval
ad60: 6c 73 74 20 20 28 6b 65 79 73 2d 3e 76 61 6c 6c  lst  (keys->vall
ad70: 69 73 74 20 6b 65 79 73 20 23 74 29 29 29 0a 09  ist keys #t)))..
ad80: 20 20 20 20 20 20 28 70 72 6f 63 20 74 61 72 67        (proc targ
ad90: 65 74 20 72 75 6e 6e 61 6d 65 20 6b 65 79 73 20  et runname keys 
ada0: 6b 65 79 6e 61 6d 65 73 20 6b 65 79 76 61 6c 6c  keynames keyvall
adb0: 73 74 29 29 29 0a 09 28 69 66 20 74 68 31 20 28  st)))..(if th1 (
adc0: 74 68 72 65 61 64 2d 6a 6f 69 6e 21 20 74 68 31  thread-join! th1
add0: 29 29 0a 09 28 69 66 20 64 62 20 28 73 71 6c 69  ))..(if db (sqli
ade0: 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62  te3:finalize! db
adf0: 29 29 0a 09 28 73 65 74 21 20 2a 64 69 64 73 6f  ))..(set! *didso
ae00: 6d 65 74 68 69 6e 67 2a 20 23 74 29 29 29 29 29  mething* #t)))))
ae10: 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  )..;;===========
ae20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
ae30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
ae40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
ae50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4c  ===========.;; L
ae60: 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 72 75 6e 73 0a  ock/unlock runs.
ae70: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;;==============
ae80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
ae90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
aea0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
aeb0: 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e  ========..(defin
aec0: 65 20 28 72 75 6e 73 3a 68 61 6e 64 6c 65 2d 6c  e (runs:handle-l
aed0: 6f 63 6b 69 6e 67 20 74 61 72 67 65 74 20 6b 65  ocking target ke
aee0: 79 73 20 72 75 6e 6e 61 6d 65 20 6c 6f 63 6b 20  ys runname lock 
aef0: 75 6e 6c 6f 63 6b 20 75 73 65 72 29 0a 20 20 28  unlock user).  (
af00: 6c 65 74 2a 20 28 28 64 62 20 20 20 20 20 20 20  let* ((db       
af10: 23 66 29 0a 09 20 28 72 75 6e 64 61 74 20 20 20  #f).. (rundat   
af20: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
af30: 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79  runs:get-runs-by
af40: 2d 70 61 74 74 20 64 62 20 6b 65 79 73 20 72 75  -patt db keys ru
af50: 6e 6e 61 6d 65 29 29 0a 09 20 28 68 65 61 64 65  nname)).. (heade
af60: 72 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20  r   (vector-ref 
af70: 72 75 6e 64 61 74 20 30 29 29 0a 09 20 28 72 75  rundat 0)).. (ru
af80: 6e 73 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72  ns     (vector-r
af90: 65 66 20 72 75 6e 64 61 74 20 31 29 29 29 0a 20  ef rundat 1))). 
afa0: 20 20 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61     (for-each (la
afb0: 6d 62 64 61 20 28 72 75 6e 29 0a 09 09 28 6c 65  mbda (run)...(le
afc0: 74 20 28 28 72 75 6e 2d 69 64 20 28 64 62 3a 67  t ((run-id (db:g
afd0: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64  et-value-by-head
afe0: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 69  er run header "i
aff0: 64 22 29 29 29 0a 09 09 20 20 28 69 66 20 28 6f  d")))...  (if (o
b000: 72 20 6c 6f 63 6b 0a 09 09 09 20 20 28 61 6e 64  r lock....  (and
b010: 20 75 6e 6c 6f 63 6b 0a 09 09 09 20 20 20 20 20   unlock....     
b020: 20 20 28 62 65 67 69 6e 0a 09 09 09 09 20 28 70    (begin..... (p
b030: 72 69 6e 74 20 22 44 6f 20 79 6f 75 20 72 65 61  rint "Do you rea
b040: 6c 6c 79 20 77 69 73 68 20 74 6f 20 75 6e 6c 6f  lly wish to unlo
b050: 63 6b 20 72 75 6e 20 22 20 72 75 6e 2d 69 64 20  ck run " run-id 
b060: 22 3f 5c 6e 20 20 20 79 2f 6e 3a 20 22 29 0a 09  "?\n   y/n: ")..
b070: 09 09 09 20 28 65 71 75 61 6c 3f 20 22 79 22 20  ... (equal? "y" 
b080: 28 72 65 61 64 2d 6c 69 6e 65 29 29 29 29 29 0a  (read-line))))).
b090: 09 09 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75  ..      (open-ru
b0a0: 6e 2d 63 6c 6f 73 65 20 64 62 3a 6c 6f 63 6b 2f  n-close db:lock/
b0b0: 75 6e 6c 6f 63 6b 2d 72 75 6e 20 64 62 20 72 75  unlock-run db ru
b0c0: 6e 2d 69 64 20 6c 6f 63 6b 20 75 6e 6c 6f 63 6b  n-id lock unlock
b0d0: 20 75 73 65 72 29 0a 09 09 20 20 20 20 20 20 28   user)...      (
b0e0: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
b0f0: 20 30 20 22 53 6b 69 70 70 69 6e 67 20 6c 6f 63   0 "Skipping loc
b100: 6b 2f 75 6e 6c 6f 63 6b 20 6f 6e 20 22 20 72 75  k/unlock on " ru
b110: 6e 2d 69 64 29 29 29 29 0a 09 20 20 20 20 20 20  n-id))))..      
b120: 72 75 6e 73 29 29 29 0a 3b 3b 3d 3d 3d 3d 3d 3d  runs))).;;======
b130: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b140: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b150: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b160: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b170: 0a 3b 3b 20 52 6f 6c 6c 75 70 20 72 75 6e 73 0a  .;; Rollup runs.
b180: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;;==============
b190: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b1a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b1b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
b1c0: 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 55 70 64  ========..;; Upd
b1d0: 61 74 65 20 74 68 65 20 74 65 73 74 5f 6d 65 74  ate the test_met
b1e0: 61 20 74 61 62 6c 65 20 66 6f 72 20 74 68 69 73  a table for this
b1f0: 20 74 65 73 74 0a 28 64 65 66 69 6e 65 20 28 72   test.(define (r
b200: 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f  uns:update-test_
b210: 6d 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d  meta db test-nam
b220: 65 20 74 65 73 74 2d 63 6f 6e 66 29 0a 20 20 28  e test-conf).  (
b230: 6c 65 74 20 28 28 63 75 72 72 72 65 63 6f 72 64  let ((currrecord
b240: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
b250: 20 64 62 3a 74 65 73 74 6d 65 74 61 2d 67 65 74   db:testmeta-get
b260: 2d 72 65 63 6f 72 64 20 64 62 20 74 65 73 74 2d  -record db test-
b270: 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 69 66 20  name))).    (if 
b280: 28 6e 6f 74 20 63 75 72 72 72 65 63 6f 72 64 29  (not currrecord)
b290: 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 73 65 74  ..(begin..  (set
b2a0: 21 20 63 75 72 72 72 65 63 6f 72 64 20 28 6d 61  ! currrecord (ma
b2b0: 6b 65 2d 76 65 63 74 6f 72 20 31 30 20 23 66 29  ke-vector 10 #f)
b2c0: 29 0a 09 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63  )..  (open-run-c
b2d0: 6c 6f 73 65 20 64 62 3a 74 65 73 74 6d 65 74 61  lose db:testmeta
b2e0: 2d 61 64 64 2d 72 65 63 6f 72 64 20 64 62 20 74  -add-record db t
b2f0: 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20  est-name))).    
b300: 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20  (for-each .     
b310: 28 6c 61 6d 62 64 61 20 28 6b 65 79 29 0a 20 20  (lambda (key).  
b320: 20 20 20 20 20 28 6c 65 74 2a 20 28 28 69 64 78       (let* ((idx
b330: 20 28 63 61 64 72 20 6b 65 79 29 29 0a 09 20 20   (cadr key))..  
b340: 20 20 20 20 28 66 6c 64 20 28 63 61 72 20 20 6b      (fld (car  k
b350: 65 79 29 29 0a 09 20 20 20 20 20 20 28 76 61 6c  ey))..      (val
b360: 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20   (config-lookup 
b370: 74 65 73 74 2d 63 6f 6e 66 20 22 74 65 73 74 5f  test-conf "test_
b380: 6d 65 74 61 22 20 66 6c 64 29 29 29 0a 09 20 3b  meta" fld))).. ;
b390: 3b 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 35  ; (debug:print 5
b3a0: 20 22 69 64 78 3a 20 22 20 69 64 78 20 22 20 66   "idx: " idx " f
b3b0: 6c 64 3a 20 22 20 66 6c 64 20 22 20 76 61 6c 3a  ld: " fld " val:
b3c0: 20 22 20 76 61 6c 29 0a 09 20 28 69 66 20 28 61   " val).. (if (a
b3d0: 6e 64 20 76 61 6c 20 28 6e 6f 74 20 28 65 71 75  nd val (not (equ
b3e0: 61 6c 3f 20 28 76 65 63 74 6f 72 2d 72 65 66 20  al? (vector-ref 
b3f0: 63 75 72 72 72 65 63 6f 72 64 20 69 64 78 29 20  currrecord idx) 
b400: 76 61 6c 29 29 29 0a 09 20 20 20 20 20 28 62 65  val)))..     (be
b410: 67 69 6e 0a 09 20 20 20 20 20 20 20 28 70 72 69  gin..       (pri
b420: 6e 74 20 22 55 70 64 61 74 69 6e 67 20 22 20 74  nt "Updating " t
b430: 65 73 74 2d 6e 61 6d 65 20 22 20 22 20 66 6c 64  est-name " " fld
b440: 20 22 20 74 6f 20 22 20 76 61 6c 29 0a 09 20 20   " to " val)..  
b450: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
b460: 6c 6f 73 65 20 64 62 3a 74 65 73 74 6d 65 74 61  lose db:testmeta
b470: 2d 75 70 64 61 74 65 2d 66 69 65 6c 64 20 64 62  -update-field db
b480: 20 74 65 73 74 2d 6e 61 6d 65 20 66 6c 64 20 76   test-name fld v
b490: 61 6c 29 29 29 29 29 0a 20 20 20 20 20 27 28 28  al))))).     '((
b4a0: 22 61 75 74 68 6f 72 22 20 32 29 28 22 6f 77 6e  "author" 2)("own
b4b0: 65 72 22 20 33 29 28 22 64 65 73 63 72 69 70 74  er" 3)("descript
b4c0: 69 6f 6e 22 20 34 29 28 22 72 65 76 69 65 77 65  ion" 4)("reviewe
b4d0: 64 22 20 35 29 28 22 74 61 67 73 22 20 39 29 29  d" 5)("tags" 9))
b4e0: 29 29 29 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74  )))..;; Update t
b4f0: 65 73 74 5f 6d 65 74 61 20 66 6f 72 20 61 6c 6c  est_meta for all
b500: 20 74 65 73 74 73 0a 28 64 65 66 69 6e 65 20 28   tests.(define (
b510: 72 75 6e 73 3a 75 70 64 61 74 65 2d 61 6c 6c 2d  runs:update-all-
b520: 74 65 73 74 5f 6d 65 74 61 20 64 62 29 0a 20 20  test_meta db).  
b530: 28 6c 65 74 20 28 28 74 65 73 74 2d 6e 61 6d 65  (let ((test-name
b540: 73 20 28 67 65 74 2d 61 6c 6c 2d 6c 65 67 61 6c  s (get-all-legal
b550: 2d 74 65 73 74 73 29 29 29 0a 20 20 20 20 28 66  -tests))).    (f
b560: 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c  or-each .     (l
b570: 61 6d 62 64 61 20 28 74 65 73 74 2d 6e 61 6d 65  ambda (test-name
b580: 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28  ).       (let* (
b590: 28 74 65 73 74 2d 70 61 74 68 20 20 20 20 28 63  (test-path    (c
b5a0: 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f  onc *toppath* "/
b5b0: 74 65 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d  tests/" test-nam
b5c0: 65 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 74  e))..      (test
b5d0: 2d 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 74  -configf (conc t
b5e0: 65 73 74 2d 70 61 74 68 20 22 2f 74 65 73 74 63  est-path "/testc
b5f0: 6f 6e 66 69 67 22 29 29 0a 09 20 20 20 20 20 20  onfig"))..      
b600: 28 74 65 73 74 65 78 69 73 74 73 20 20 20 28 61  (testexists   (a
b610: 6e 64 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f  nd (file-exists?
b620: 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 28 66   test-configf)(f
b630: 69 6c 65 2d 72 65 61 64 2d 61 63 63 65 73 73 3f  ile-read-access?
b640: 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 29 29   test-configf)))
b650: 0a 09 20 20 20 20 20 20 3b 3b 20 72 65 61 64 20  ..      ;; read 
b660: 63 6f 6e 66 69 67 73 20 77 69 74 68 20 74 72 69  configs with tri
b670: 63 6b 73 20 74 75 72 6e 65 64 20 6f 66 66 20 28  cks turned off (
b680: 69 2e 65 2e 20 6e 6f 20 73 79 73 74 65 6d 29 0a  i.e. no system).
b690: 09 20 20 20 20 20 20 28 74 65 73 74 2d 63 6f 6e  .      (test-con
b6a0: 66 20 20 20 20 28 69 66 20 74 65 73 74 65 78 69  f    (if testexi
b6b0: 73 74 73 20 28 72 65 61 64 2d 63 6f 6e 66 69 67  sts (read-config
b6c0: 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 23 66   test-configf #f
b6d0: 20 23 66 29 28 6d 61 6b 65 2d 68 61 73 68 2d 74   #f)(make-hash-t
b6e0: 61 62 6c 65 29 29 29 29 0a 09 20 3b 3b 20 75 73  able)))).. ;; us
b6f0: 65 20 74 68 65 20 6f 70 65 6e 2d 72 75 6e 2d 63  e the open-run-c
b700: 6c 6f 73 65 20 69 6e 73 74 65 61 64 20 6f 66 20  lose instead of 
b710: 70 61 73 73 69 6e 67 20 69 6e 20 64 62 0a 09 20  passing in db.. 
b720: 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73  (runs:update-tes
b730: 74 5f 6d 65 74 61 20 23 66 20 74 65 73 74 2d 6e  t_meta #f test-n
b740: 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 29 29  ame test-conf)))
b750: 0a 20 20 20 20 20 74 65 73 74 2d 6e 61 6d 65 73  .     test-names
b760: 29 29 29 0a 0a 3b 3b 20 54 68 69 73 20 63 6f 75  )))..;; This cou
b770: 6c 64 20 70 72 6f 62 61 62 6c 79 20 62 65 20 72  ld probably be r
b780: 65 66 61 63 74 6f 72 65 64 20 69 6e 74 6f 20 6f  efactored into o
b790: 6e 65 20 63 6f 6d 70 6c 65 78 20 71 75 65 72 79  ne complex query
b7a0: 20 2e 2e 2e 0a 28 64 65 66 69 6e 65 20 28 72 75   ....(define (ru
b7b0: 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 20 6b 65  ns:rollup-run ke
b7c0: 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e  ys keyvallst run
b7d0: 6e 61 6d 65 20 75 73 65 72 29 20 3b 3b 20 77 61  name user) ;; wa
b7e0: 73 20 74 61 72 67 65 74 2c 20 6e 6f 77 20 6b 65  s target, now ke
b7f0: 79 76 61 6c 6c 73 74 0a 20 20 28 64 65 62 75 67  yvallst.  (debug
b800: 3a 70 72 69 6e 74 20 34 20 22 72 75 6e 73 3a 72  :print 4 "runs:r
b810: 6f 6c 6c 75 70 2d 72 75 6e 2c 20 6b 65 79 73 3a  ollup-run, keys:
b820: 20 22 20 6b 65 79 73 20 22 20 6b 65 79 76 61 6c   " keys " keyval
b830: 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74  lst: " keyvallst
b840: 20 22 20 3a 72 75 6e 6e 61 6d 65 20 22 20 72 75   " :runname " ru
b850: 6e 6e 61 6d 65 20 22 20 75 73 65 72 3a 20 22 20  nname " user: " 
b860: 75 73 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 28  user).  (let* ((
b870: 64 62 20 20 20 20 20 20 20 20 20 20 20 20 20 20  db              
b880: 23 66 29 20 3b 3b 20 28 6b 65 79 76 61 6c 6c 6c  #f) ;; (keyvalll
b890: 73 74 20 20 20 20 20 20 28 6b 65 79 73 3a 74 61  st      (keys:ta
b8a0: 72 67 65 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 79  rget->keyval key
b8b0: 73 20 74 61 72 67 65 74 29 29 0a 09 20 28 6e 65  s target)).. (ne
b8c0: 77 2d 72 75 6e 2d 69 64 20 20 20 20 20 20 28 6f  w-run-id      (o
b8d0: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75  pen-run-close ru
b8e0: 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75 6e 20  ns:register-run 
b8f0: 64 62 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73  db keys keyvalls
b900: 74 20 72 75 6e 6e 61 6d 65 20 22 6e 65 77 22 20  t runname "new" 
b910: 22 6e 2f 61 22 20 75 73 65 72 29 29 0a 09 20 28  "n/a" user)).. (
b920: 70 72 65 76 2d 74 65 73 74 73 20 20 20 20 20 20  prev-tests      
b930: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
b940: 74 65 73 74 3a 67 65 74 2d 6d 61 74 63 68 69 6e  test:get-matchin
b950: 67 2d 70 72 65 76 69 6f 75 73 2d 74 65 73 74 2d  g-previous-test-
b960: 72 75 6e 2d 72 65 63 6f 72 64 73 20 64 62 20 6e  run-records db n
b970: 65 77 2d 72 75 6e 2d 69 64 20 22 25 22 20 22 25  ew-run-id "%" "%
b980: 22 29 29 0a 09 20 28 63 75 72 72 2d 74 65 73 74  ")).. (curr-test
b990: 73 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e  s      (open-run
b9a0: 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65  -close db:get-te
b9b0: 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e  sts-for-run db n
b9c0: 65 77 2d 72 75 6e 2d 69 64 20 22 25 2f 25 22 20  ew-run-id "%/%" 
b9d0: 27 28 29 20 27 28 29 29 29 0a 09 20 28 63 75 72  '() '())).. (cur
b9e0: 72 2d 74 65 73 74 73 2d 68 61 73 68 20 28 6d 61  r-tests-hash (ma
b9f0: 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29  ke-hash-table)))
ba00: 0a 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63  .    (open-run-c
ba10: 6c 6f 73 65 20 64 62 3a 75 70 64 61 74 65 2d 72  lose db:update-r
ba20: 75 6e 2d 65 76 65 6e 74 5f 74 69 6d 65 20 64 62  un-event_time db
ba30: 20 6e 65 77 2d 72 75 6e 2d 69 64 29 0a 20 20 20   new-run-id).   
ba40: 20 3b 3b 20 69 6e 64 65 78 20 74 68 65 20 61 6c   ;; index the al
ba50: 72 65 61 64 79 20 73 61 76 65 64 20 74 65 73 74  ready saved test
ba60: 73 20 62 79 20 74 65 73 74 6e 61 6d 65 20 61 6e  s by testname an
ba70: 64 20 69 74 65 6d 64 61 74 20 69 6e 20 63 75 72  d itemdat in cur
ba80: 72 2d 74 65 73 74 73 2d 68 61 73 68 0a 20 20 20  r-tests-hash.   
ba90: 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20   (for-each.     
baa0: 28 6c 61 6d 62 64 61 20 28 74 65 73 74 64 61 74  (lambda (testdat
bab0: 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28  ).       (let* (
bac0: 28 74 65 73 74 6e 61 6d 65 20 20 28 64 62 3a 74  (testname  (db:t
bad0: 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65  est-get-testname
bae0: 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20   testdat))..    
baf0: 20 20 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62    (item-path (db
bb00: 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70  :test-get-item-p
bb10: 61 74 68 20 74 65 73 74 64 61 74 29 29 0a 09 20  ath testdat)).. 
bb20: 20 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20       (full-name 
bb30: 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22  (conc testname "
bb40: 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a  /" item-path))).
bb50: 09 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65  . (hash-table-se
bb60: 74 21 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61  t! curr-tests-ha
bb70: 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 74 65 73  sh full-name tes
bb80: 74 64 61 74 29 29 29 0a 20 20 20 20 20 63 75 72  tdat))).     cur
bb90: 72 2d 74 65 73 74 73 29 0a 20 20 20 20 3b 3b 20  r-tests).    ;; 
bba0: 4e 4f 50 45 3a 20 4e 6f 6e 2d 6f 70 74 69 6d 61  NOPE: Non-optima
bbb0: 6c 20 61 70 70 72 6f 61 63 68 2e 20 54 72 79 20  l approach. Try 
bbc0: 74 68 69 73 20 69 6e 73 74 65 61 64 2e 0a 20 20  this instead..  
bbd0: 20 20 3b 3b 20 20 20 31 2e 20 74 65 73 74 73 20    ;;   1. tests 
bbe0: 61 72 65 20 72 65 63 65 69 76 65 64 20 69 6e 20  are received in 
bbf0: 61 20 6c 69 73 74 2c 20 6d 6f 73 74 20 72 65 63  a list, most rec
bc00: 65 6e 74 20 66 69 72 73 74 0a 20 20 20 20 3b 3b  ent first.    ;;
bc10: 20 20 20 32 2e 20 72 65 70 6c 61 63 65 20 74 68     2. replace th
bc20: 65 20 72 6f 6c 6c 75 70 20 74 65 73 74 20 77 69  e rollup test wi
bc30: 74 68 20 74 68 65 20 6e 65 77 20 2a 61 6c 77 61  th the new *alwa
bc40: 79 73 2a 0a 20 20 20 20 28 66 6f 72 2d 65 61 63  ys*.    (for-eac
bc50: 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20  h .     (lambda 
bc60: 28 74 65 73 74 64 61 74 29 0a 20 20 20 20 20 20  (testdat).      
bc70: 20 28 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 6d   (let* ((testnam
bc80: 65 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  e  (db:test-get-
bc90: 74 65 73 74 6e 61 6d 65 20 74 65 73 74 64 61 74  testname testdat
bca0: 29 29 0a 09 20 20 20 20 20 20 28 69 74 65 6d 2d  ))..      (item-
bcb0: 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65  path (db:test-ge
bcc0: 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74  t-item-path test
bcd0: 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 66 75  dat))..      (fu
bce0: 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65  ll-name (conc te
bcf0: 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d  stname "/" item-
bd00: 70 61 74 68 29 29 0a 09 20 20 20 20 20 20 28 70  path))..      (p
bd10: 72 65 76 2d 74 65 73 74 2d 64 61 74 20 28 68 61  rev-test-dat (ha
bd20: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66  sh-table-ref/def
bd30: 61 75 6c 74 20 63 75 72 72 2d 74 65 73 74 73 2d  ault curr-tests-
bd40: 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 23  hash full-name #
bd50: 66 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 74  f))..      (test
bd60: 2d 73 74 65 70 73 20 20 20 20 20 20 28 6f 70 65  -steps      (ope
bd70: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67  n-run-close db:g
bd80: 65 74 2d 73 74 65 70 73 2d 66 6f 72 2d 74 65 73  et-steps-for-tes
bd90: 74 20 64 62 20 28 64 62 3a 74 65 73 74 2d 67 65  t db (db:test-ge
bda0: 74 2d 69 64 20 74 65 73 74 64 61 74 29 29 29 0a  t-id testdat))).
bdb0: 09 20 20 20 20 20 20 28 6e 65 77 2d 74 65 73 74  .      (new-test
bdc0: 2d 72 65 63 6f 72 64 20 23 66 29 29 0a 09 20 3b  -record #f)).. ;
bdd0: 3b 20 72 65 70 6c 61 63 65 20 74 68 65 73 65 20  ; replace these 
bde0: 77 69 74 68 20 69 6e 73 65 72 74 20 2e 2e 2e 20  with insert ... 
bdf0: 73 65 6c 65 63 74 0a 09 20 28 61 70 70 6c 79 20  select.. (apply 
be00: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20  sqlite3:execute 
be10: 0a 09 09 64 62 20 0a 09 09 28 63 6f 6e 63 20 22  ...db ...(conc "
be20: 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43  INSERT OR REPLAC
be30: 45 20 49 4e 54 4f 20 74 65 73 74 73 20 28 72 75  E INTO tests (ru
be40: 6e 5f 69 64 2c 74 65 73 74 6e 61 6d 65 2c 73 74  n_id,testname,st
be50: 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74  ate,status,event
be60: 5f 74 69 6d 65 2c 68 6f 73 74 2c 63 70 75 6c 6f  _time,host,cpulo
be70: 61 64 2c 64 69 73 6b 66 72 65 65 2c 75 6e 61 6d  ad,diskfree,unam
be80: 65 2c 72 75 6e 64 69 72 2c 69 74 65 6d 5f 70 61  e,rundir,item_pa
be90: 74 68 2c 72 75 6e 5f 64 75 72 61 74 69 6f 6e 2c  th,run_duration,
bea0: 66 69 6e 61 6c 5f 6c 6f 67 66 2c 63 6f 6d 6d 65  final_logf,comme
beb0: 6e 74 29 20 22 0a 09 09 20 20 20 20 20 20 22 56  nt) "...      "V
bec0: 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c 3f  ALUES (?,?,?,?,?
bed0: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f  ,?,?,?,?,?,?,?,?
bee0: 2c 3f 29 3b 22 29 0a 09 09 6e 65 77 2d 72 75 6e  ,?);")...new-run
bef0: 2d 69 64 20 28 63 64 64 72 20 28 76 65 63 74 6f  -id (cddr (vecto
bf00: 72 2d 3e 6c 69 73 74 20 74 65 73 74 64 61 74 29  r->list testdat)
bf10: 29 29 0a 09 20 28 73 65 74 21 20 6e 65 77 2d 74  )).. (set! new-t
bf20: 65 73 74 64 61 74 20 28 63 61 72 20 28 6f 70 65  estdat (car (ope
bf30: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67  n-run-close db:g
bf40: 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e  et-tests-for-run
bf50: 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 28   db new-run-id (
bf60: 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f  conc testname "/
bf70: 22 20 69 74 65 6d 2d 70 61 74 68 29 20 27 28 29  " item-path) '()
bf80: 20 27 28 29 29 29 29 0a 09 20 28 68 61 73 68 2d   '()))).. (hash-
bf90: 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72 72 2d  table-set! curr-
bfa0: 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d  tests-hash full-
bfb0: 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74 64 61 74  name new-testdat
bfc0: 29 20 3b 3b 20 74 68 69 73 20 63 6f 75 6c 64 20  ) ;; this could 
bfd0: 62 65 20 63 6f 6e 66 75 73 69 6e 67 2c 20 77 68  be confusing, wh
bfe0: 69 63 68 20 72 65 63 6f 72 64 20 73 68 6f 75 6c  ich record shoul
bff0: 64 20 67 6f 20 69 6e 74 6f 20 74 68 65 20 6c 6f  d go into the lo
c000: 6f 6b 75 70 20 74 61 62 6c 65 3f 0a 09 20 3b 3b  okup table?.. ;;
c010: 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74   Now duplicate t
c020: 68 65 20 74 65 73 74 20 73 74 65 70 73 0a 09 20  he test steps.. 
c030: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22  (debug:print 4 "
c040: 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 73 20  Copying records 
c050: 69 6e 20 74 65 73 74 5f 73 74 65 70 73 20 66 72  in test_steps fr
c060: 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62  om test_id=" (db
c070: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73  :test-get-id tes
c080: 74 64 61 74 29 20 22 20 74 6f 20 22 20 28 64 62  tdat) " to " (db
c090: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77  :test-get-id new
c0a0: 2d 74 65 73 74 64 61 74 29 29 0a 09 20 28 6f 70  -testdat)).. (op
c0b0: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 0a 09 20  en-run-close .. 
c0c0: 20 28 6c 61 6d 62 64 61 20 28 29 0a 09 20 20 20   (lambda ()..   
c0d0: 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74   (sqlite3:execut
c0e0: 65 20 0a 09 20 20 20 20 20 64 62 20 0a 09 20 20  e ..     db ..  
c0f0: 20 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54     (conc "INSERT
c100: 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f   OR REPLACE INTO
c110: 20 74 65 73 74 5f 73 74 65 70 73 20 28 74 65 73   test_steps (tes
c120: 74 5f 69 64 2c 73 74 65 70 6e 61 6d 65 2c 73 74  t_id,stepname,st
c130: 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74  ate,status,event
c140: 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 29 20 22  _time,comment) "
c150: 0a 09 09 20 20 20 22 53 45 4c 45 43 54 20 22 20  ...   "SELECT " 
c160: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20  (db:test-get-id 
c170: 6e 65 77 2d 74 65 73 74 64 61 74 29 20 22 2c 73  new-testdat) ",s
c180: 74 65 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74  tepname,state,st
c190: 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c  atus,event_time,
c1a0: 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73  comment FROM tes
c1b0: 74 5f 73 74 65 70 73 20 57 48 45 52 45 20 74 65  t_steps WHERE te
c1c0: 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 20 20  st_id=?;")..    
c1d0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64   (db:test-get-id
c1e0: 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20   testdat))..    
c1f0: 3b 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65  ;; Now duplicate
c200: 20 74 68 65 20 74 65 73 74 20 64 61 74 61 0a 09   the test data..
c210: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
c220: 20 34 20 22 43 6f 70 79 69 6e 67 20 72 65 63 6f   4 "Copying reco
c230: 72 64 73 20 69 6e 20 74 65 73 74 5f 64 61 74 61  rds in test_data
c240: 20 66 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20   from test_id=" 
c250: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20  (db:test-get-id 
c260: 74 65 73 74 64 61 74 29 20 22 20 74 6f 20 22 20  testdat) " to " 
c270: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20  (db:test-get-id 
c280: 6e 65 77 2d 74 65 73 74 64 61 74 29 29 0a 09 20  new-testdat)).. 
c290: 20 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63     (sqlite3:exec
c2a0: 75 74 65 20 0a 09 20 20 20 20 20 64 62 20 0a 09  ute ..     db ..
c2b0: 20 20 20 20 20 28 63 6f 6e 63 20 22 49 4e 53 45       (conc "INSE
c2c0: 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e  RT OR REPLACE IN
c2d0: 54 4f 20 74 65 73 74 5f 64 61 74 61 20 28 74 65  TO test_data (te
c2e0: 73 74 5f 69 64 2c 63 61 74 65 67 6f 72 79 2c 76  st_id,category,v
c2f0: 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78  ariable,value,ex
c300: 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73  pected,tol,units
c310: 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20  ,comment) "...  
c320: 20 22 53 45 4c 45 43 54 20 22 20 28 64 62 3a 74   "SELECT " (db:t
c330: 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74  est-get-id new-t
c340: 65 73 74 64 61 74 29 20 22 2c 63 61 74 65 67 6f  estdat) ",catego
c350: 72 79 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75  ry,variable,valu
c360: 65 2c 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75  e,expected,tol,u
c370: 6e 69 74 73 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f  nits,comment FRO
c380: 4d 20 74 65 73 74 5f 64 61 74 61 20 57 48 45 52  M test_data WHER
c390: 45 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09  E test_id=?;")..
c3a0: 20 20 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65       (db:test-ge
c3b0: 74 2d 69 64 20 74 65 73 74 64 61 74 29 29 29 29  t-id testdat))))
c3c0: 0a 09 20 29 29 0a 20 20 20 20 20 70 72 65 76 2d  .. )).     prev-
c3d0: 74 65 73 74 73 29 29 29 0a 09 20 0a 20 20 20 20  tests))).. .    
c3e0: 20 0a                                             .