Megatest

Hex Artifact Content
Login

Artifact 310fe61f1fb974316d259ad258f58590f5888904:


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 3b 3b 20 41  h ")")))))..;; A
0970: 77 66 75 6c 2e 20 50 6c 65 61 73 65 20 46 49 58  wful. Please FIX
0980: 4d 45 0a 28 64 65 66 69 6e 65 20 2a 65 6e 76 2d  ME.(define *env-
0990: 76 61 72 73 2d 62 79 2d 72 75 6e 2d 69 64 2a 20  vars-by-run-id* 
09a0: 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65  (make-hash-table
09b0: 29 29 0a 28 64 65 66 69 6e 65 20 2a 63 75 72 72  )).(define *curr
09c0: 65 6e 74 2d 72 75 6e 2d 6e 61 6d 65 2a 20 20 20  ent-run-name*   
09d0: 23 66 29 0a 0a 28 64 65 66 69 6e 65 20 28 73 65  #f)..(define (se
09e0: 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76  t-megatest-env-v
09f0: 61 72 73 20 64 62 20 72 75 6e 2d 69 64 29 0a 20  ars db run-id). 
0a00: 20 28 6c 65 74 20 28 28 6b 65 79 73 20 28 64 62   (let ((keys (db
0a10: 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09  :get-keys db))..
0a20: 28 76 61 6c 73 20 28 68 61 73 68 2d 74 61 62 6c  (vals (hash-tabl
0a30: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 2a 65  e-ref/default *e
0a40: 6e 76 2d 76 61 72 73 2d 62 79 2d 72 75 6e 2d 69  nv-vars-by-run-i
0a50: 64 2a 20 72 75 6e 2d 69 64 20 23 66 29 29 29 0a  d* run-id #f))).
0a60: 20 20 20 20 3b 3b 20 67 65 74 20 74 68 65 20 69      ;; get the i
0a70: 6e 66 6f 20 66 72 6f 6d 20 74 68 65 20 64 62 20  nfo from the db 
0a80: 61 6e 64 20 70 75 74 20 69 74 20 69 6e 20 74 68  and put it in th
0a90: 65 20 63 61 63 68 65 0a 20 20 20 20 28 69 66 20  e cache.    (if 
0aa0: 28 6e 6f 74 20 76 61 6c 73 29 0a 09 28 6c 65 74  (not vals)..(let
0ab0: 20 28 28 68 74 20 28 6d 61 6b 65 2d 68 61 73 68   ((ht (make-hash
0ac0: 2d 74 61 62 6c 65 29 29 29 0a 09 20 20 28 68 61  -table)))..  (ha
0ad0: 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 2a 65  sh-table-set! *e
0ae0: 6e 76 2d 76 61 72 73 2d 62 79 2d 72 75 6e 2d 69  nv-vars-by-run-i
0af0: 64 2a 20 72 75 6e 2d 69 64 20 68 74 29 0a 09 20  d* run-id ht).. 
0b00: 20 28 73 65 74 21 20 76 61 6c 73 20 68 74 29 0a   (set! vals ht).
0b10: 09 20 20 28 66 6f 72 2d 65 61 63 68 0a 09 20 20  .  (for-each..  
0b20: 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 29 0a 09   (lambda (key)..
0b30: 20 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66 6f       (sqlite3:fo
0b40: 72 2d 65 61 63 68 2d 72 6f 77 0a 09 20 20 20 20  r-each-row..    
0b50: 20 20 28 6c 61 6d 62 64 61 20 28 76 61 6c 29 0a    (lambda (val).
0b60: 09 09 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65  ..(hash-table-se
0b70: 74 21 20 76 61 6c 73 20 6b 65 79 20 76 61 6c 29  t! vals key val)
0b80: 29 0a 09 20 20 20 20 20 20 64 62 20 0a 09 20 20  )..      db ..  
0b90: 20 20 20 20 28 63 6f 6e 63 20 22 53 45 4c 45 43      (conc "SELEC
0ba0: 54 20 22 20 28 6b 65 79 3a 67 65 74 2d 66 69 65  T " (key:get-fie
0bb0: 6c 64 6e 61 6d 65 20 6b 65 79 29 20 22 20 46 52  ldname key) " FR
0bc0: 4f 4d 20 72 75 6e 73 20 57 48 45 52 45 20 69 64  OM runs WHERE id
0bd0: 3d 3f 3b 22 29 0a 09 20 20 20 20 20 20 72 75 6e  =?;")..      run
0be0: 2d 69 64 29 29 0a 09 20 20 20 6b 65 79 73 29 29  -id))..   keys))
0bf0: 29 0a 20 20 20 20 3b 3b 20 66 72 6f 6d 20 74 68  ).    ;; from th
0c00: 65 20 63 61 63 68 65 64 20 64 61 74 61 20 73 65  e cached data se
0c10: 74 20 74 68 65 20 76 61 72 73 0a 20 20 20 20 28  t the vars.    (
0c20: 68 61 73 68 2d 74 61 62 6c 65 2d 66 6f 72 2d 65  hash-table-for-e
0c30: 61 63 68 0a 20 20 20 20 20 76 61 6c 73 0a 20 20  ach.     vals.  
0c40: 20 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 20     (lambda (key 
0c50: 76 61 6c 29 0a 20 20 20 20 20 20 20 28 64 65 62  val).       (deb
0c60: 75 67 3a 70 72 69 6e 74 20 32 20 22 73 65 74 65  ug:print 2 "sete
0c70: 6e 76 20 22 20 28 6b 65 79 3a 67 65 74 2d 66 69  nv " (key:get-fi
0c80: 65 6c 64 6e 61 6d 65 20 6b 65 79 29 20 22 20 22  eldname key) " "
0c90: 20 76 61 6c 29 0a 20 20 20 20 20 20 20 28 73 65   val).       (se
0ca0: 74 65 6e 76 20 28 6b 65 79 3a 67 65 74 2d 66 69  tenv (key:get-fi
0cb0: 65 6c 64 6e 61 6d 65 20 6b 65 79 29 20 76 61 6c  eldname key) val
0cc0: 29 29 29 0a 20 20 20 20 28 61 6c 69 73 74 2d 3e  ))).    (alist->
0cd0: 65 6e 76 2d 76 61 72 73 20 28 68 61 73 68 2d 74  env-vars (hash-t
0ce0: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74  able-ref/default
0cf0: 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 65 6e   *configdat* "en
0d00: 76 2d 6f 76 65 72 72 69 64 65 22 20 27 28 29 29  v-override" '())
0d10: 29 0a 20 20 20 20 3b 3b 20 4c 65 74 73 20 75 73  ).    ;; Lets us
0d20: 65 20 74 68 69 73 20 61 73 20 61 6e 20 6f 70 70  e this as an opp
0d30: 6f 72 74 75 6e 69 74 79 20 74 6f 20 70 75 74 20  ortunity to put 
0d40: 4d 54 5f 52 55 4e 4e 41 4d 45 20 69 6e 20 74 68  MT_RUNNAME in th
0d50: 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 20 20  e environment.  
0d60: 20 20 28 69 66 20 28 6e 6f 74 20 2a 63 75 72 72    (if (not *curr
0d70: 65 6e 74 2d 72 75 6e 2d 6e 61 6d 65 2a 29 0a 09  ent-run-name*)..
0d80: 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63  (sqlite3:for-eac
0d90: 68 2d 72 6f 77 0a 09 20 28 6c 61 6d 62 64 61 20  h-row.. (lambda 
0da0: 28 72 75 6e 6e 61 6d 65 29 0a 09 20 20 20 28 73  (runname)..   (s
0db0: 65 74 21 20 2a 63 75 72 72 65 6e 74 2d 72 75 6e  et! *current-run
0dc0: 2d 6e 61 6d 65 2a 20 72 75 6e 6e 61 6d 65 29 29  -name* runname))
0dd0: 0a 0a 09 20 64 62 0a 09 20 22 53 45 4c 45 43 54  ... db.. "SELECT
0de0: 20 72 75 6e 6e 61 6d 65 20 46 52 4f 4d 20 72 75   runname FROM ru
0df0: 6e 73 20 57 48 45 52 45 20 69 64 3d 3f 3b 22 0a  ns WHERE id=?;".
0e00: 09 20 72 75 6e 2d 69 64 29 29 0a 20 20 20 20 28  . run-id)).    (
0e10: 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e 4e 41  setenv "MT_RUNNA
0e20: 4d 45 22 20 2a 63 75 72 72 65 6e 74 2d 72 75 6e  ME" *current-run
0e30: 2d 6e 61 6d 65 2a 29 0a 20 20 20 20 28 73 65 74  -name*).    (set
0e40: 65 6e 76 20 22 4d 54 5f 52 55 4e 5f 41 52 45 41  env "MT_RUN_AREA
0e50: 5f 48 4f 4d 45 22 20 2a 74 6f 70 70 61 74 68 2a  _HOME" *toppath*
0e60: 29 0a 20 20 20 20 29 29 0a 0a 28 64 65 66 69 6e  ).    ))..(defin
0e70: 65 20 28 73 65 74 2d 69 74 65 6d 2d 65 6e 76 2d  e (set-item-env-
0e80: 76 61 72 73 20 69 74 65 6d 64 61 74 29 0a 20 20  vars itemdat).  
0e90: 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 64  (for-each (lambd
0ea0: 61 20 28 69 74 65 6d 29 0a 09 20 20 20 20 20 20  a (item)..      
0eb0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22  (debug:print 2 "
0ec0: 73 65 74 65 6e 76 20 22 20 28 63 61 72 20 69 74  setenv " (car it
0ed0: 65 6d 29 20 22 20 22 20 28 63 61 64 72 20 69 74  em) " " (cadr it
0ee0: 65 6d 29 29 0a 09 20 20 20 20 20 20 28 73 65 74  em))..      (set
0ef0: 65 6e 76 20 28 63 61 72 20 69 74 65 6d 29 20 28  env (car item) (
0f00: 63 61 64 72 20 69 74 65 6d 29 29 29 0a 09 20 20  cadr item)))..  
0f10: 20 20 69 74 65 6d 64 61 74 29 29 0a 0a 28 64 65    itemdat))..(de
0f20: 66 69 6e 65 20 2a 6c 61 73 74 2d 6e 75 6d 2d 72  fine *last-num-r
0f30: 75 6e 6e 69 6e 67 2d 74 65 73 74 73 2a 20 30 29  unning-tests* 0)
0f40: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 63  .(define (runs:c
0f50: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74  an-run-more-test
0f60: 73 20 64 62 20 74 65 73 74 2d 72 65 63 6f 72 64  s db test-record
0f70: 29 0a 20 20 28 6c 65 74 2a 20 28 28 74 63 6f 6e  ).  (let* ((tcon
0f80: 66 69 67 20 20 20 20 20 20 20 20 20 20 20 20 20  fig             
0f90: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71      (tests:testq
0fa0: 75 65 75 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e  ueue-get-testcon
0fb0: 66 69 67 20 74 65 73 74 2d 72 65 63 6f 72 64 29  fig test-record)
0fc0: 29 0a 09 20 28 6a 6f 62 67 72 6f 75 70 20 20 20  ).. (jobgroup   
0fd0: 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f               (co
0fe0: 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 63 6f 6e  nfig-lookup tcon
0ff0: 66 69 67 20 22 72 65 71 75 69 72 65 6d 65 6e 74  fig "requirement
1000: 73 22 20 22 6a 6f 62 67 72 6f 75 70 22 29 29 0a  s" "jobgroup")).
1010: 09 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 20  . (num-running  
1020: 20 20 20 20 20 20 20 20 20 20 20 28 64 62 3a 67             (db:g
1030: 65 74 2d 63 6f 75 6e 74 2d 74 65 73 74 73 2d 72  et-count-tests-r
1040: 75 6e 6e 69 6e 67 20 64 62 29 29 0a 09 20 28 6e  unning db)).. (n
1050: 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f  um-running-in-jo
1060: 62 67 72 6f 75 70 20 28 64 62 3a 67 65 74 2d 63  bgroup (db:get-c
1070: 6f 75 6e 74 2d 74 65 73 74 73 2d 72 75 6e 6e 69  ount-tests-runni
1080: 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 64  ng-in-jobgroup d
1090: 62 20 6a 6f 62 67 72 6f 75 70 29 29 0a 09 20 28  b jobgroup)).. (
10a0: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a  max-concurrent-j
10b0: 6f 62 73 20 20 20 20 20 28 6c 65 74 20 28 28 6d  obs     (let ((m
10c0: 63 6a 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75  cj (config-looku
10d0: 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 73  p *configdat* "s
10e0: 65 74 75 70 22 20 20 20 20 20 22 6d 61 78 5f 63  etup"     "max_c
10f0: 6f 6e 63 75 72 72 65 6e 74 5f 6a 6f 62 73 22 29  oncurrent_jobs")
1100: 29 29 0a 09 09 09 09 20 20 20 20 28 69 66 20 28  )).....    (if (
1110: 61 6e 64 20 6d 63 6a 20 28 73 74 72 69 6e 67 2d  and mcj (string-
1120: 3e 6e 75 6d 62 65 72 20 6d 63 6a 29 29 0a 09 09  >number mcj))...
1130: 09 09 09 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62  ...(string->numb
1140: 65 72 20 6d 63 6a 29 0a 09 09 09 09 09 23 66 29  er mcj)......#f)
1150: 29 29 0a 09 20 28 6a 6f 62 2d 67 72 6f 75 70 2d  )).. (job-group-
1160: 6c 69 6d 69 74 20 20 20 20 20 20 20 20 20 28 63  limit         (c
1170: 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f  onfig-lookup *co
1180: 6e 66 69 67 64 61 74 2a 20 22 6a 6f 62 67 72 6f  nfigdat* "jobgro
1190: 75 70 73 22 20 6a 6f 62 67 72 6f 75 70 29 29 29  ups" jobgroup)))
11a0: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 65  .    (if (not (e
11b0: 71 3f 20 2a 6c 61 73 74 2d 6e 75 6d 2d 72 75 6e  q? *last-num-run
11c0: 6e 69 6e 67 2d 74 65 73 74 73 2a 20 6e 75 6d 2d  ning-tests* num-
11d0: 72 75 6e 6e 69 6e 67 29 29 0a 09 28 62 65 67 69  running))..(begi
11e0: 6e 0a 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e  n..  (debug:prin
11f0: 74 20 32 20 22 6d 61 78 2d 63 6f 6e 63 75 72 72  t 2 "max-concurr
1200: 65 6e 74 2d 6a 6f 62 73 3a 20 22 20 6d 61 78 2d  ent-jobs: " max-
1210: 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20  concurrent-jobs 
1220: 22 2c 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 3a 20  ", num-running: 
1230: 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 0a 09  " num-running)..
1240: 20 20 28 73 65 74 21 20 2a 6c 61 73 74 2d 6e 75    (set! *last-nu
1250: 6d 2d 72 75 6e 6e 69 6e 67 2d 74 65 73 74 73 2a  m-running-tests*
1260: 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 29 29 0a   num-running))).
1270: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 65 71      (if (not (eq
1280: 3f 20 30 20 2a 67 6c 6f 62 61 6c 65 78 69 74 73  ? 0 *globalexits
1290: 74 61 74 75 73 2a 29 29 0a 09 28 6c 69 73 74 20  tatus*))..(list 
12a0: 23 66 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 6e  #f num-running n
12b0: 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f  um-running-in-jo
12c0: 62 67 72 6f 75 70 20 6d 61 78 2d 63 6f 6e 63 75  bgroup max-concu
12d0: 72 72 65 6e 74 2d 6a 6f 62 73 20 6a 6f 62 2d 67  rrent-jobs job-g
12e0: 72 6f 75 70 2d 6c 69 6d 69 74 29 0a 09 28 6c 65  roup-limit)..(le
12f0: 74 20 28 28 63 61 6e 2d 6e 6f 74 2d 72 75 6e 2d  t ((can-not-run-
1300: 6d 6f 72 65 20 28 63 6f 6e 64 0a 09 09 09 09 20  more (cond..... 
1310: 3b 3b 20 69 66 20 6d 61 78 2d 63 6f 6e 63 75 72  ;; if max-concur
1320: 72 65 6e 74 2d 6a 6f 62 73 20 69 73 20 73 65 74  rent-jobs is set
1330: 20 61 6e 64 20 74 68 65 20 6e 75 6d 62 65 72 20   and the number 
1340: 72 75 6e 6e 69 6e 67 20 69 73 20 67 72 65 61 74  running is great
1350: 65 72 20 0a 09 09 09 09 20 3b 3b 20 74 68 61 6e  er ..... ;; than
1360: 20 69 74 20 74 68 61 6e 20 63 61 6e 6e 6f 74 20   it than cannot 
1370: 72 75 6e 20 6d 6f 72 65 20 6a 6f 62 73 0a 09 09  run more jobs...
1380: 09 09 20 28 28 61 6e 64 20 6d 61 78 2d 63 6f 6e  .. ((and max-con
1390: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 28 3e 3d  current-jobs (>=
13a0: 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 6d 61 78   num-running max
13b0: 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73  -concurrent-jobs
13c0: 29 29 0a 09 09 09 09 20 20 28 64 65 62 75 67 3a  )).....  (debug:
13d0: 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47  print 0 "WARNING
13e0: 3a 20 4d 61 78 20 72 75 6e 6e 69 6e 67 20 6a 6f  : Max running jo
13f0: 62 73 20 65 78 63 65 65 64 65 64 2c 20 63 75 72  bs exceeded, cur
1400: 72 65 6e 74 20 6e 75 6d 62 65 72 20 72 75 6e 6e  rent number runn
1410: 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e 69  ing: " num-runni
1420: 6e 67 20 0a 09 09 09 09 09 20 20 20 20 20 20 20  ng ......       
1430: 22 2c 20 6d 61 78 5f 63 6f 6e 63 75 72 72 65 6e  ", max_concurren
1440: 74 5f 6a 6f 62 73 3a 20 22 20 6d 61 78 2d 63 6f  t_jobs: " max-co
1450: 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 29 0a 09  ncurrent-jobs)..
1460: 09 09 09 20 20 23 74 29 0a 09 09 09 09 20 3b 3b  ...  #t)..... ;;
1470: 20 69 66 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69   if job-group-li
1480: 6d 69 74 20 69 73 20 73 65 74 20 61 6e 64 20 6e  mit is set and n
1490: 75 6d 62 65 72 20 6f 66 20 6a 6f 62 73 20 69 6e  umber of jobs in
14a0: 20 74 68 65 20 67 72 6f 75 70 20 69 73 20 67 72   the group is gr
14b0: 65 61 74 65 72 0a 09 09 09 09 20 3b 3b 20 74 68  eater..... ;; th
14c0: 61 6e 20 74 68 65 20 6c 69 6d 69 74 20 74 68 65  an the limit the
14d0: 6e 20 63 61 6e 6e 6f 74 20 72 75 6e 20 6d 6f 72  n cannot run mor
14e0: 65 20 6a 6f 62 73 20 6f 66 20 74 68 69 73 20 6b  e jobs of this k
14f0: 69 6e 64 0a 09 09 09 09 20 28 28 61 6e 64 20 6a  ind..... ((and j
1500: 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 0a 09  ob-group-limit..
1510: 09 09 09 20 20 20 20 20 20 20 28 3e 3d 20 6e 75  ...       (>= nu
1520: 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62  m-running-in-job
1530: 67 72 6f 75 70 20 6a 6f 62 2d 67 72 6f 75 70 2d  group job-group-
1540: 6c 69 6d 69 74 29 29 0a 09 09 09 09 20 20 28 64  limit)).....  (d
1550: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 57 41  ebug:print 1 "WA
1560: 52 4e 49 4e 47 3a 20 6e 75 6d 62 65 72 20 6f 66  RNING: number of
1570: 20 6a 6f 62 73 20 22 20 6e 75 6d 2d 72 75 6e 6e   jobs " num-runn
1580: 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20  ing-in-jobgroup 
1590: 0a 09 09 09 09 09 20 20 20 20 20 20 20 22 20 69  ......       " i
15a0: 6e 20 22 20 6a 6f 62 67 72 6f 75 70 20 22 20 65  n " jobgroup " e
15b0: 78 63 65 65 64 65 64 2c 20 77 69 6c 6c 20 6e 6f  xceeded, will no
15c0: 74 20 72 75 6e 20 22 20 28 74 65 73 74 73 3a 74  t run " (tests:t
15d0: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73  estqueue-get-tes
15e0: 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72  tname test-recor
15f0: 64 29 29 0a 09 09 09 09 20 20 23 74 29 0a 09 09  d)).....  #t)...
1600: 09 09 20 28 65 6c 73 65 20 23 66 29 29 29 29 0a  .. (else #f)))).
1610: 09 20 20 28 6c 69 73 74 20 28 6e 6f 74 20 63 61  .  (list (not ca
1620: 6e 2d 6e 6f 74 2d 72 75 6e 2d 6d 6f 72 65 29 20  n-not-run-more) 
1630: 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 6e 75 6d 2d  num-running num-
1640: 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72  running-in-jobgr
1650: 6f 75 70 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65  oup max-concurre
1660: 6e 74 2d 6a 6f 62 73 20 6a 6f 62 2d 67 72 6f 75  nt-jobs job-grou
1670: 70 2d 6c 69 6d 69 74 29 29 29 29 29 0a 0a 3b 3b  p-limit)))))..;;
1680: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1690: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
16a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
16b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
16c0: 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4e 65 77 20 6d 65  ======.;; New me
16d0: 74 68 6f 64 6f 6c 6f 67 79 2e 20 54 68 65 73 65  thodology. These
16e0: 20 72 6f 75 74 69 6e 65 73 20 77 69 6c 6c 20 72   routines will r
16f0: 65 70 6c 61 63 65 20 74 68 65 20 61 62 6f 76 65  eplace the above
1700: 20 69 6e 20 74 69 6d 65 2e 20 46 6f 72 0a 3b 3b   in time. For.;;
1710: 20 6e 6f 77 20 74 68 65 20 63 6f 64 65 20 69 73   now the code is
1720: 20 64 75 70 6c 69 63 61 74 65 64 2e 20 54 68 69   duplicated. Thi
1730: 73 20 73 74 75 66 66 20 69 73 20 69 6e 69 74 69  s stuff is initi
1740: 61 6c 6c 79 20 75 73 65 64 20 69 6e 20 74 68 65  ally used in the
1750: 20 6d 6f 6e 69 74 6f 72 0a 3b 3b 20 62 61 73 65   monitor.;; base
1760: 64 20 63 6f 64 65 2e 0a 3b 3b 3d 3d 3d 3d 3d 3d  d code..;;======
1770: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1780: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1790: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
17a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
17b0: 0a 0a 3b 3b 20 72 65 67 69 73 74 65 72 20 61 20  ..;; register a 
17c0: 74 65 73 74 20 72 75 6e 20 77 69 74 68 20 74 68  test run with th
17d0: 65 20 64 62 0a 28 64 65 66 69 6e 65 20 28 72 75  e db.(define (ru
17e0: 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75 6e 20  ns:register-run 
17f0: 64 62 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73  db keys keyvalls
1800: 74 20 72 75 6e 6e 61 6d 65 20 73 74 61 74 65 20  t runname state 
1810: 73 74 61 74 75 73 20 75 73 65 72 29 0a 20 20 28  status user).  (
1820: 64 65 62 75 67 3a 70 72 69 6e 74 20 33 20 22 72  debug:print 3 "r
1830: 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75 6e  uns:register-run
1840: 2c 20 6b 65 79 73 3a 20 22 20 6b 65 79 73 20 22  , keys: " keys "
1850: 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65   keyvallst: " ke
1860: 79 76 61 6c 6c 73 74 20 22 20 72 75 6e 6e 61 6d  yvallst " runnam
1870: 65 3a 20 22 20 72 75 6e 6e 61 6d 65 20 22 20 73  e: " runname " s
1880: 74 61 74 65 3a 20 22 20 73 74 61 74 65 20 22 20  tate: " state " 
1890: 73 74 61 74 75 73 3a 20 22 20 73 74 61 74 75 73  status: " status
18a0: 20 22 20 75 73 65 72 3a 20 22 20 75 73 65 72 29   " user: " user)
18b0: 0a 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73 74  .  (let* ((keyst
18c0: 72 20 20 20 20 28 6b 65 79 73 2d 3e 6b 65 79 73  r    (keys->keys
18d0: 74 72 20 6b 65 79 73 29 29 0a 09 20 28 63 6f 6d  tr keys)).. (com
18e0: 6d 61 20 20 20 20 20 28 69 66 20 28 3e 20 28 6c  ma     (if (> (l
18f0: 65 6e 67 74 68 20 6b 65 79 73 29 20 30 29 20 22  ength keys) 0) "
1900: 2c 22 20 22 22 29 29 0a 09 20 28 61 6e 64 73 74  ," "")).. (andst
1910: 72 20 20 20 20 28 69 66 20 28 3e 20 28 6c 65 6e  r    (if (> (len
1920: 67 74 68 20 6b 65 79 73 29 20 30 29 20 22 20 41  gth keys) 0) " A
1930: 4e 44 20 22 20 22 22 29 29 0a 09 20 28 76 61 6c  ND " "")).. (val
1940: 73 6c 6f 74 73 20 20 28 6b 65 79 73 2d 3e 76 61  slots  (keys->va
1950: 6c 73 6c 6f 74 73 20 6b 65 79 73 29 29 20 3b 3b  lslots keys)) ;;
1960: 20 3f 2c 3f 2c 3f 20 2e 2e 2e 0a 09 20 28 6b 65   ?,?,? ..... (ke
1970: 79 76 61 6c 73 20 20 20 28 6d 61 70 20 63 61 64  yvals   (map cad
1980: 72 20 6b 65 79 76 61 6c 6c 73 74 29 29 0a 09 20  r keyvallst)).. 
1990: 28 61 6c 6c 76 61 6c 73 20 20 20 28 61 70 70 65  (allvals   (appe
19a0: 6e 64 20 28 6c 69 73 74 20 72 75 6e 6e 61 6d 65  nd (list runname
19b0: 20 73 74 61 74 65 20 73 74 61 74 75 73 20 75 73   state status us
19c0: 65 72 29 20 6b 65 79 76 61 6c 73 29 29 0a 09 20  er) keyvals)).. 
19d0: 28 71 72 79 76 61 6c 73 20 20 20 28 61 70 70 65  (qryvals   (appe
19e0: 6e 64 20 28 6c 69 73 74 20 72 75 6e 6e 61 6d 65  nd (list runname
19f0: 29 20 6b 65 79 76 61 6c 73 29 29 0a 09 20 28 6b  ) keyvals)).. (k
1a00: 65 79 3d 3f 73 74 72 20 20 28 73 74 72 69 6e 67  ey=?str  (string
1a10: 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61  -intersperse (ma
1a20: 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 28 63 6f  p (lambda (k)(co
1a30: 6e 63 20 28 6b 65 79 3a 67 65 74 2d 66 69 65 6c  nc (key:get-fiel
1a40: 64 6e 61 6d 65 20 6b 29 20 22 3d 3f 22 29 29 20  dname k) "=?")) 
1a50: 6b 65 79 73 29 20 22 20 41 4e 44 20 22 29 29 29  keys) " AND ")))
1a60: 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  .    (debug:prin
1a70: 74 20 33 20 22 6b 65 79 73 3a 20 22 20 6b 65 79  t 3 "keys: " key
1a80: 73 20 22 20 61 6c 6c 76 61 6c 73 3a 20 22 20 61  s " allvals: " a
1a90: 6c 6c 76 61 6c 73 20 22 20 6b 65 79 76 61 6c 73  llvals " keyvals
1aa0: 3a 20 22 20 6b 65 79 76 61 6c 73 29 0a 20 20 20  : " keyvals).   
1ab0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20   (debug:print 2 
1ac0: 22 4e 4f 54 45 3a 20 75 73 69 6e 67 20 74 61 72  "NOTE: using tar
1ad0: 67 65 74 20 22 20 28 73 74 72 69 6e 67 2d 69 6e  get " (string-in
1ae0: 74 65 72 73 70 65 72 73 65 20 6b 65 79 76 61 6c  tersperse keyval
1af0: 73 20 22 2f 22 29 20 22 20 66 6f 72 20 74 68 69  s "/") " for thi
1b00: 73 20 72 75 6e 22 29 0a 20 20 20 20 28 69 66 20  s run").    (if 
1b10: 28 61 6e 64 20 72 75 6e 6e 61 6d 65 20 28 6e 75  (and runname (nu
1b20: 6c 6c 3f 20 28 66 69 6c 74 65 72 20 28 6c 61 6d  ll? (filter (lam
1b30: 62 64 61 20 28 78 29 28 6e 6f 74 20 78 29 29 20  bda (x)(not x)) 
1b40: 6b 65 79 76 61 6c 73 29 29 29 20 3b 3b 20 74 68  keyvals))) ;; th
1b50: 65 72 65 20 6d 75 73 74 20 62 65 20 61 20 62 65  ere must be a be
1b60: 74 74 65 72 20 77 61 79 20 74 6f 20 22 61 70 70  tter way to "app
1b70: 6c 79 20 61 6e 64 22 0a 09 28 6c 65 74 20 28 28  ly and"..(let ((
1b80: 72 65 73 20 23 66 29 29 0a 09 20 20 28 61 70 70  res #f))..  (app
1b90: 6c 79 20 73 71 6c 69 74 65 33 3a 65 78 65 63 75  ly sqlite3:execu
1ba0: 74 65 20 64 62 20 28 63 6f 6e 63 20 22 49 4e 53  te db (conc "INS
1bb0: 45 52 54 20 4f 52 20 49 47 4e 4f 52 45 20 49 4e  ERT OR IGNORE IN
1bc0: 54 4f 20 72 75 6e 73 20 28 72 75 6e 6e 61 6d 65  TO runs (runname
1bd0: 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c 6f 77  ,state,status,ow
1be0: 6e 65 72 2c 65 76 65 6e 74 5f 74 69 6d 65 22 20  ner,event_time" 
1bf0: 63 6f 6d 6d 61 20 6b 65 79 73 74 72 20 22 29 20  comma keystr ") 
1c00: 56 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c  VALUES (?,?,?,?,
1c10: 73 74 72 66 74 69 6d 65 28 27 25 73 27 2c 27 6e  strftime('%s','n
1c20: 6f 77 27 29 22 20 63 6f 6d 6d 61 20 76 61 6c 73  ow')" comma vals
1c30: 6c 6f 74 73 20 22 29 3b 22 29 0a 09 09 20 61 6c  lots ");")... al
1c40: 6c 76 61 6c 73 29 0a 09 20 20 28 61 70 70 6c 79  lvals)..  (apply
1c50: 20 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63   sqlite3:for-eac
1c60: 68 2d 72 6f 77 20 0a 09 20 20 20 28 6c 61 6d 62  h-row ..   (lamb
1c70: 64 61 20 28 69 64 29 0a 09 20 20 20 20 20 28 73  da (id)..     (s
1c80: 65 74 21 20 72 65 73 20 69 64 29 29 0a 09 20 20  et! res id))..  
1c90: 20 64 62 0a 09 20 20 20 28 6c 65 74 20 28 28 71   db..   (let ((q
1ca0: 72 79 20 28 63 6f 6e 63 20 22 53 45 4c 45 43 54  ry (conc "SELECT
1cb0: 20 69 64 20 46 52 4f 4d 20 72 75 6e 73 20 57 48   id FROM runs WH
1cc0: 45 52 45 20 28 72 75 6e 6e 61 6d 65 3d 3f 20 22  ERE (runname=? "
1cd0: 20 61 6e 64 73 74 72 20 6b 65 79 3d 3f 73 74 72   andstr key=?str
1ce0: 20 22 29 3b 22 29 29 29 0a 09 20 20 20 20 20 3b   ");")))..     ;
1cf0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22  (debug:print 4 "
1d00: 71 72 79 3a 20 22 20 71 72 79 29 20 0a 09 20 20  qry: " qry) ..  
1d10: 20 20 20 71 72 79 29 0a 09 20 20 20 71 72 79 76     qry)..   qryv
1d20: 61 6c 73 29 0a 09 20 20 28 73 71 6c 69 74 65 33  als)..  (sqlite3
1d30: 3a 65 78 65 63 75 74 65 20 64 62 20 22 55 50 44  :execute db "UPD
1d40: 41 54 45 20 72 75 6e 73 20 53 45 54 20 73 74 61  ATE runs SET sta
1d50: 74 65 3d 3f 2c 73 74 61 74 75 73 3d 3f 20 57 48  te=?,status=? WH
1d60: 45 52 45 20 69 64 3d 3f 3b 22 20 73 74 61 74 65  ERE id=?;" state
1d70: 20 73 74 61 74 75 73 20 72 65 73 29 0a 09 20 20   status res)..  
1d80: 72 65 73 29 20 0a 09 28 62 65 67 69 6e 0a 09 20  res) ..(begin.. 
1d90: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
1da0: 22 45 52 52 4f 52 3a 20 43 61 6c 6c 65 64 20 77  "ERROR: Called w
1db0: 69 74 68 6f 75 74 20 61 6c 6c 20 6e 65 63 65 73  ithout all neces
1dc0: 73 61 72 79 20 6b 65 79 73 22 29 0a 09 20 20 23  sary keys")..  #
1dd0: 66 29 29 29 29 0a 0a 3b 3b 20 54 68 69 73 20 69  f))))..;; This i
1de0: 73 20 61 20 64 75 70 6c 69 63 61 74 65 20 6f 66  s a duplicate of
1df0: 20 72 75 6e 2d 74 65 73 74 73 20 28 77 68 69 63   run-tests (whic
1e00: 68 20 68 61 73 20 62 65 65 6e 20 64 65 70 72 65  h has been depre
1e10: 63 61 74 65 64 29 2e 20 55 73 65 20 74 68 69 73  cated). Use this
1e20: 20 6f 6e 65 20 69 6e 73 74 65 61 64 20 6f 66 20   one instead of 
1e30: 72 75 6e 20 74 65 73 74 73 2e 0a 3b 3b 20 6b 65  run tests..;; ke
1e40: 79 76 61 6c 73 0a 28 64 65 66 69 6e 65 20 28 72  yvals.(define (r
1e50: 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 20 74 61  uns:run-tests ta
1e60: 72 67 65 74 20 72 75 6e 6e 61 6d 65 20 74 65 73  rget runname tes
1e70: 74 2d 70 61 74 74 73 20 75 73 65 72 20 66 6c 61  t-patts user fla
1e80: 67 73 29 0a 20 20 28 6c 65 74 2a 20 28 28 64 62  gs).  (let* ((db
1e90: 20 20 20 20 20 20 20 20 20 20 23 66 29 0a 09 20            #f).. 
1ea0: 28 6b 65 79 73 20 20 20 20 20 20 20 20 28 6f 70  (keys        (op
1eb0: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a  en-run-close db:
1ec0: 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 20  get-keys db)).. 
1ed0: 28 6b 65 79 76 61 6c 6c 73 74 20 20 20 28 6b 65  (keyvallst   (ke
1ee0: 79 73 3a 74 61 72 67 65 74 2d 3e 6b 65 79 76 61  ys:target->keyva
1ef0: 6c 20 6b 65 79 73 20 74 61 72 67 65 74 29 29 0a  l keys target)).
1f00: 09 20 28 72 75 6e 2d 69 64 20 20 20 20 20 20 28  . (run-id      (
1f10: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72  open-run-close r
1f20: 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75 6e  uns:register-run
1f30: 20 64 62 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c   db keys keyvall
1f40: 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e 65 77 22  st runname "new"
1f50: 20 22 6e 2f 61 22 20 75 73 65 72 29 29 20 20 3b   "n/a" user))  ;
1f60: 3b 20 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a  ;  test-name))).
1f70: 09 20 28 64 65 66 65 72 72 65 64 20 20 20 20 27  . (deferred    '
1f80: 28 29 29 20 3b 3b 20 64 65 6c 61 79 20 72 75 6e  ()) ;; delay run
1f90: 6e 69 6e 67 20 74 68 65 73 65 20 73 69 6e 63 65  ning these since
1fa0: 20 74 68 65 79 20 68 61 76 65 20 61 20 77 61 69   they have a wai
1fb0: 74 6f 6e 20 63 6c 61 75 73 65 0a 09 20 3b 3b 20  ton clause.. ;; 
1fc0: 6b 65 65 70 67 6f 69 6e 67 20 69 73 20 74 68 65  keepgoing is the
1fd0: 20 64 65 66 61 63 74 6f 20 6d 6f 64 61 6c 69 74   defacto modalit
1fe0: 79 20 6e 6f 77 2c 20 77 69 6c 6c 20 61 64 64 20  y now, will add 
1ff0: 68 69 74 2d 6e 2d 72 75 6e 20 61 20 62 69 74 20  hit-n-run a bit 
2000: 6c 61 74 65 72 0a 09 20 3b 3b 20 28 6b 65 65 70  later.. ;; (keep
2010: 67 6f 69 6e 67 20 20 20 28 68 61 73 68 2d 74 61  going   (hash-ta
2020: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20  ble-ref/default 
2030: 66 6c 61 67 73 20 22 2d 6b 65 65 70 67 6f 69 6e  flags "-keepgoin
2040: 67 22 20 23 66 29 29 0a 09 20 28 74 65 73 74 2d  g" #f)).. (test-
2050: 6e 61 6d 65 73 20 20 27 28 29 29 0a 09 20 28 72  names  '()).. (r
2060: 75 6e 63 6f 6e 66 69 67 66 20 20 20 28 63 6f 6e  unconfigf   (con
2070: 63 20 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72  c  *toppath* "/r
2080: 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67  unconfigs.config
2090: 22 29 29 0a 09 20 28 72 65 71 75 69 72 65 64 2d  ")).. (required-
20a0: 74 65 73 74 73 20 27 28 29 29 0a 09 20 28 74 65  tests '()).. (te
20b0: 73 74 2d 72 65 63 6f 72 64 73 20 28 6d 61 6b 65  st-records (make
20c0: 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 0a  -hash-table)))..
20d0: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c      (open-run-cl
20e0: 6f 73 65 20 73 65 74 2d 6d 65 67 61 74 65 73 74  ose set-megatest
20f0: 2d 65 6e 76 2d 76 61 72 73 20 64 62 20 72 75 6e  -env-vars db run
2100: 2d 69 64 29 20 3b 3b 20 74 68 65 73 65 20 6d 61  -id) ;; these ma
2110: 79 20 62 65 20 6e 65 65 64 65 64 20 62 79 20 74  y be needed by t
2120: 68 65 20 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f  he launching pro
2130: 63 65 73 73 0a 0a 20 20 20 20 28 69 66 20 28 66  cess..    (if (f
2140: 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 75 6e 63  ile-exists? runc
2150: 6f 6e 66 69 67 66 29 0a 09 28 6f 70 65 6e 2d 72  onfigf)..(open-r
2160: 75 6e 2d 63 6c 6f 73 65 20 73 65 74 75 70 2d 65  un-close setup-e
2170: 6e 76 2d 64 65 66 61 75 6c 74 73 20 64 62 20 72  nv-defaults db r
2180: 75 6e 63 6f 6e 66 69 67 66 20 72 75 6e 2d 69 64  unconfigf run-id
2190: 20 2a 61 6c 72 65 61 64 79 2d 73 65 65 6e 2d 72   *already-seen-r
21a0: 75 6e 63 6f 6e 66 69 67 2d 69 6e 66 6f 2a 20 22  unconfig-info* "
21b0: 70 72 65 2d 6c 61 75 6e 63 68 2d 65 6e 76 2d 76  pre-launch-env-v
21c0: 61 72 73 22 29 0a 09 28 64 65 62 75 67 3a 70 72  ars")..(debug:pr
21d0: 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20  int 0 "WARNING: 
21e0: 59 6f 75 20 64 6f 20 6e 6f 74 20 68 61 76 65 20  You do not have 
21f0: 61 20 72 75 6e 20 63 6f 6e 66 69 67 20 66 69 6c  a run config fil
2200: 65 3a 20 22 20 72 75 6e 63 6f 6e 66 69 67 66 29  e: " runconfigf)
2210: 29 0a 20 20 20 20 0a 20 20 20 20 3b 3b 20 6c 6f  ).    .    ;; lo
2220: 6f 6b 20 75 70 20 61 6c 6c 20 74 65 73 74 73 20  ok up all tests 
2230: 6d 61 74 63 68 69 6e 67 20 74 68 65 20 63 6f 6d  matching the com
2240: 6d 61 20 73 65 70 61 72 61 74 65 64 20 6c 69 73  ma separated lis
2250: 74 20 6f 66 20 67 6c 6f 62 73 20 69 6e 0a 20 20  t of globs in.  
2260: 20 20 3b 3b 20 74 65 73 74 2d 70 61 74 74 73 20    ;; test-patts 
2270: 28 75 73 69 6e 67 20 25 20 61 73 20 77 69 6c 64  (using % as wild
2280: 63 61 72 64 29 0a 0a 20 20 20 20 28 73 65 74 21  card)..    (set!
2290: 20 74 65 73 74 2d 6e 61 6d 65 73 20 28 74 65 73   test-names (tes
22a0: 74 73 3a 67 65 74 2d 76 61 6c 69 64 2d 74 65 73  ts:get-valid-tes
22b0: 74 73 20 2a 74 6f 70 70 61 74 68 2a 20 74 65 73  ts *toppath* tes
22c0: 74 2d 70 61 74 74 73 20 74 65 73 74 2d 6e 61 6d  t-patts test-nam
22d0: 65 73 3a 20 74 65 73 74 2d 6e 61 6d 65 73 29 29  es: test-names))
22e0: 0a 20 20 20 20 28 73 65 74 21 20 74 65 73 74 2d  .    (set! test-
22f0: 6e 61 6d 65 73 20 28 64 65 6c 65 74 65 2d 64 75  names (delete-du
2300: 70 6c 69 63 61 74 65 73 20 74 65 73 74 2d 6e 61  plicates test-na
2310: 6d 65 73 29 29 0a 0a 20 20 20 20 28 64 65 62 75  mes))..    (debu
2320: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 30 20 22  g:print-info 0 "
2330: 74 65 73 74 20 6e 61 6d 65 73 20 22 20 74 65 73  test names " tes
2340: 74 2d 6e 61 6d 65 73 29 0a 0a 20 20 20 20 3b 3b  t-names)..    ;;
2350: 20 6f 6e 20 74 68 65 20 66 69 72 73 74 20 70 61   on the first pa
2360: 73 73 20 6f 72 20 63 61 6c 6c 20 74 6f 20 72 75  ss or call to ru
2370: 6e 2d 74 65 73 74 73 20 73 65 74 20 46 41 49 4c  n-tests set FAIL
2380: 53 20 74 6f 20 4e 4f 54 5f 53 54 41 52 54 45 44  S to NOT_STARTED
2390: 20 69 66 0a 20 20 20 20 3b 3b 20 2d 6b 65 65 70   if.    ;; -keep
23a0: 67 6f 69 6e 67 20 69 73 20 73 70 65 63 69 66 69  going is specifi
23b0: 65 64 0a 20 20 20 20 28 69 66 20 28 65 71 3f 20  ed.    (if (eq? 
23c0: 2a 70 61 73 73 6e 75 6d 2a 20 30 29 0a 09 28 62  *passnum* 0)..(b
23d0: 65 67 69 6e 0a 09 20 20 3b 3b 20 68 61 76 65 20  egin..  ;; have 
23e0: 74 6f 20 64 65 6c 65 74 65 20 74 65 73 74 20 72  to delete test r
23f0: 65 63 6f 72 64 73 20 77 68 65 72 65 20 4e 4f 54  ecords where NOT
2400: 5f 53 54 41 52 54 45 44 20 73 69 6e 63 65 20 74  _STARTED since t
2410: 68 65 79 20 63 61 6e 20 63 61 75 73 65 20 2d 6b  hey can cause -k
2420: 65 65 70 67 6f 69 6e 67 20 74 6f 20 0a 09 20 20  eepgoing to ..  
2430: 3b 3b 20 67 65 74 20 73 74 75 63 6b 20 64 75 65  ;; get stuck due
2440: 20 74 6f 20 62 65 63 6f 6d 69 6e 67 20 69 6e 61   to becoming ina
2450: 63 63 65 73 73 69 62 6c 65 20 66 72 6f 6d 20 61  ccessible from a
2460: 20 66 61 69 6c 65 64 20 74 65 73 74 2e 20 49 2e   failed test. I.
2470: 65 2e 20 69 66 20 74 65 73 74 20 42 20 64 65 70  e. if test B dep
2480: 65 6e 64 73 20 0a 09 20 20 3b 3b 20 6f 6e 20 74  ends ..  ;; on t
2490: 65 73 74 20 41 20 62 75 74 20 74 65 73 74 20 42  est A but test B
24a0: 20 72 65 61 63 68 65 64 20 74 68 65 20 70 6f 69   reached the poi
24b0: 6e 74 20 6f 6e 20 62 65 69 6e 67 20 72 65 67 69  nt on being regi
24c0: 73 74 65 72 65 64 20 61 73 20 4e 4f 54 5f 53 54  stered as NOT_ST
24d0: 41 52 54 45 44 20 61 6e 64 20 74 65 73 74 0a 09  ARTED and test..
24e0: 20 20 3b 3b 20 41 20 66 61 69 6c 65 64 20 66 6f    ;; A failed fo
24f0: 72 20 73 6f 6d 65 20 72 65 61 73 6f 6e 20 74 68  r some reason th
2500: 65 6e 20 6f 6e 20 72 65 2d 72 75 6e 20 75 73 69  en on re-run usi
2510: 6e 67 20 2d 6b 65 65 70 67 6f 69 6e 67 20 74 68  ng -keepgoing th
2520: 65 20 72 75 6e 20 63 61 6e 20 6e 65 76 65 72 20  e run can never 
2530: 63 6f 6d 70 6c 65 74 65 2e 0a 09 20 20 28 6f 70  complete...  (op
2540: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a  en-run-close db:
2550: 64 65 6c 65 74 65 2d 74 65 73 74 73 2d 69 6e 2d  delete-tests-in-
2560: 73 74 61 74 65 20 64 62 20 72 75 6e 2d 69 64 20  state db run-id 
2570: 22 4e 4f 54 5f 53 54 41 52 54 45 44 22 29 0a 09  "NOT_STARTED")..
2580: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73    (open-run-clos
2590: 65 20 64 62 3a 73 65 74 2d 74 65 73 74 73 2d 73  e db:set-tests-s
25a0: 74 61 74 65 2d 73 74 61 74 75 73 20 64 62 20 72  tate-status db r
25b0: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 73  un-id test-names
25c0: 20 23 66 20 22 46 41 49 4c 22 20 22 4e 4f 54 5f   #f "FAIL" "NOT_
25d0: 53 54 41 52 54 45 44 22 20 22 46 41 49 4c 22 29  STARTED" "FAIL")
25e0: 29 29 0a 0a 20 20 20 20 3b 3b 20 66 72 6f 6d 20  ))..    ;; from 
25f0: 68 65 72 65 20 6f 6e 20 6f 75 74 20 74 68 65 20  here on out the 
2600: 64 62 20 77 69 6c 6c 20 62 65 20 6f 70 65 6e 65  db will be opene
2610: 64 20 61 6e 64 20 63 6c 6f 73 65 64 20 6f 6e 20  d and closed on 
2620: 65 76 65 72 79 20 63 61 6c 6c 20 72 75 6e 73 3a  every call runs:
2630: 72 75 6e 2d 74 65 73 74 73 2d 71 75 65 75 65 0a  run-tests-queue.
2640: 20 20 20 20 3b 3b 20 28 73 71 6c 69 74 65 33 3a      ;; (sqlite3:
2650: 66 69 6e 61 6c 69 7a 65 21 20 64 62 29 20 0a 20  finalize! db) . 
2660: 20 20 20 3b 3b 20 6e 6f 77 20 61 64 64 20 6e 6f     ;; now add no
2670: 6e 2d 64 69 72 65 63 74 6c 79 20 72 65 66 65 72  n-directly refer
2680: 65 6e 63 65 64 20 64 65 70 65 6e 64 65 6e 63 69  enced dependenci
2690: 65 73 20 28 69 2e 65 2e 20 77 61 69 74 6f 6e 29  es (i.e. waiton)
26a0: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e  .    (if (not (n
26b0: 75 6c 6c 3f 20 74 65 73 74 2d 6e 61 6d 65 73 29  ull? test-names)
26c0: 29 0a 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68  )..(let loop ((h
26d0: 65 64 20 28 63 61 72 20 74 65 73 74 2d 6e 61 6d  ed (car test-nam
26e0: 65 73 29 29 0a 09 09 20 20 20 28 74 61 6c 20 28  es))...   (tal (
26f0: 63 64 72 20 74 65 73 74 2d 6e 61 6d 65 73 29 29  cdr test-names))
2700: 29 20 20 20 20 20 20 20 20 20 3b 3b 20 27 72 65  )         ;; 're
2710: 74 75 72 6e 2d 70 72 6f 63 73 20 74 65 6c 6c 73  turn-procs tells
2720: 20 74 68 65 20 63 6f 6e 66 69 67 20 72 65 61 64   the config read
2730: 65 72 20 74 6f 20 70 72 65 70 20 72 75 6e 6e 69  er to prep runni
2740: 6e 67 20 73 79 73 74 65 6d 20 62 75 74 20 72 65  ng system but re
2750: 74 75 72 6e 20 61 20 70 72 6f 63 0a 09 20 20 28  turn a proc..  (
2760: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
2770: 20 34 20 22 68 65 64 3d 22 20 68 65 64 20 22 20   4 "hed=" hed " 
2780: 61 74 20 74 6f 70 20 6f 66 20 6c 6f 6f 70 22 29  at top of loop")
2790: 0a 09 20 20 28 6c 65 74 2a 20 28 28 63 6f 6e 66  ..  (let* ((conf
27a0: 69 67 20 20 28 74 65 73 74 73 3a 67 65 74 2d 74  ig  (tests:get-t
27b0: 65 73 74 63 6f 6e 66 69 67 20 68 65 64 20 27 72  estconfig hed 'r
27c0: 65 74 75 72 6e 2d 70 72 6f 63 73 29 29 0a 09 09  eturn-procs))...
27d0: 20 28 77 61 69 74 6f 6e 73 20 28 69 66 20 63 6f   (waitons (if co
27e0: 6e 66 69 67 20 28 73 74 72 69 6e 67 2d 73 70 6c  nfig (string-spl
27f0: 69 74 20 28 6c 65 74 20 28 28 77 20 28 63 6f 6e  it (let ((w (con
2800: 66 69 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69  fig-lookup confi
2810: 67 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22  g "requirements"
2820: 20 22 77 61 69 74 6f 6e 22 29 29 29 0a 09 09 09   "waiton")))....
2830: 09 09 09 20 20 20 20 20 28 69 66 20 77 20 77 20  ...     (if w w 
2840: 22 22 29 29 29 0a 09 09 09 20 20 20 20 20 20 28  "")))....      (
2850: 62 65 67 69 6e 0a 09 09 09 09 28 64 65 62 75 67  begin.....(debug
2860: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a  :print 0 "ERROR:
2870: 20 6e 6f 6e 2d 65 78 69 73 74 65 6e 74 20 72 65   non-existent re
2880: 71 75 69 72 65 64 20 74 65 73 74 20 5c 22 22 20  quired test \"" 
2890: 68 65 64 20 22 5c 22 22 29 0a 20 20 20 20 20 20  hed "\"").      
28a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
28b0: 20 20 20 20 20 20 20 20 20 20 28 69 66 20 64 62            (if db
28c0: 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69   (sqlite3:finali
28d0: 7a 65 21 20 64 62 29 29 0a 09 09 09 09 28 65 78  ze! db)).....(ex
28e0: 69 74 20 31 29 29 29 29 29 0a 09 20 20 20 20 3b  it 1)))))..    ;
28f0: 3b 20 63 68 65 63 6b 20 66 6f 72 20 68 65 64 20  ; check for hed 
2900: 69 6e 20 77 61 69 74 6f 6e 73 20 3d 3e 20 74 68  in waitons => th
2910: 69 73 20 77 6f 75 6c 64 20 62 65 20 63 69 72 63  is would be circ
2920: 75 6c 61 72 2c 20 72 65 6d 6f 76 65 20 69 74 20  ular, remove it 
2930: 61 6e 64 20 69 73 73 75 65 20 61 6e 0a 09 20 20  and issue an..  
2940: 20 20 3b 3b 20 65 72 72 6f 72 0a 09 20 20 20 20    ;; error..    
2950: 28 69 66 20 28 6d 65 6d 62 65 72 20 68 65 64 20  (if (member hed 
2960: 77 61 69 74 6f 6e 73 29 0a 09 09 28 62 65 67 69  waitons)...(begi
2970: 6e 0a 09 09 20 20 28 64 65 62 75 67 3a 70 72 69  n...  (debug:pri
2980: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 74 65 73  nt 0 "ERROR: tes
2990: 74 20 22 20 68 65 64 20 22 20 68 61 73 20 6c 69  t " hed " has li
29a0: 73 74 65 64 20 69 74 73 65 6c 66 20 61 73 20 61  sted itself as a
29b0: 20 77 61 69 74 6f 6e 2c 20 70 6c 65 61 73 65 20   waiton, please 
29c0: 63 6f 72 72 65 63 74 20 74 68 69 73 21 22 29 0a  correct this!").
29d0: 09 09 20 20 28 73 65 74 21 20 77 61 69 74 6f 6e  ..  (set! waiton
29e0: 73 20 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64  s (filter (lambd
29f0: 61 20 28 78 29 28 6e 6f 74 20 28 65 71 75 61 6c  a (x)(not (equal
2a00: 3f 20 78 20 68 65 64 29 29 29 20 77 61 69 74 6f  ? x hed))) waito
2a10: 6e 73 29 29 29 29 0a 09 20 20 20 20 0a 09 20 20  ns))))..    ..  
2a20: 20 20 3b 3b 20 28 69 74 65 6d 73 20 20 20 28 69    ;; (items   (i
2a30: 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66  tems:get-items-f
2a40: 72 6f 6d 2d 63 6f 6e 66 69 67 20 63 6f 6e 66 69  rom-config confi
2a50: 67 29 29 29 0a 09 20 20 20 20 28 69 66 20 28 6e  g)))..    (if (n
2a60: 6f 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72  ot (hash-table-r
2a70: 65 66 2f 64 65 66 61 75 6c 74 20 74 65 73 74 2d  ef/default test-
2a80: 72 65 63 6f 72 64 73 20 68 65 64 20 23 66 29 29  records hed #f))
2a90: 0a 09 09 28 68 61 73 68 2d 74 61 62 6c 65 2d 73  ...(hash-table-s
2aa0: 65 74 21 20 74 65 73 74 2d 72 65 63 6f 72 64 73  et! test-records
2ab0: 0a 09 09 09 09 20 68 65 64 20 28 76 65 63 74 6f  ..... hed (vecto
2ac0: 72 20 68 65 64 20 20 20 20 20 3b 3b 20 30 0a 09  r hed     ;; 0..
2ad0: 09 09 09 09 20 20 20 20 20 63 6f 6e 66 69 67 20  ....     config 
2ae0: 20 3b 3b 20 31 0a 09 09 09 09 09 20 20 20 20 20   ;; 1......     
2af0: 77 61 69 74 6f 6e 73 20 3b 3b 20 32 0a 09 09 09  waitons ;; 2....
2b00: 09 09 20 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c  ..     (config-l
2b10: 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 20 22 72 65  ookup config "re
2b20: 71 75 69 72 65 6d 65 6e 74 73 22 20 22 70 72 69  quirements" "pri
2b30: 6f 72 69 74 79 22 29 20 20 20 20 20 3b 3b 20 70  ority")     ;; p
2b40: 72 69 6f 72 69 74 79 20 33 0a 09 09 09 09 09 20  riority 3...... 
2b50: 20 20 20 20 28 6c 65 74 20 28 28 69 74 65 6d 73      (let ((items
2b60: 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c        (hash-tabl
2b70: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63 6f  e-ref/default co
2b80: 6e 66 69 67 20 22 69 74 65 6d 73 22 20 23 66 29  nfig "items" #f)
2b90: 29 20 3b 3b 20 69 74 65 6d 73 20 34 0a 09 09 09  ) ;; items 4....
2ba0: 09 09 09 20 20 20 28 69 74 65 6d 73 74 61 62 6c  ...   (itemstabl
2bb0: 65 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65  e (hash-table-re
2bc0: 66 2f 64 65 66 61 75 6c 74 20 63 6f 6e 66 69 67  f/default config
2bd0: 20 22 69 74 65 6d 73 74 61 62 6c 65 22 20 23 66   "itemstable" #f
2be0: 29 29 29 20 0a 09 09 09 09 09 20 20 20 20 20 20  ))) ......      
2bf0: 20 3b 3b 20 69 66 20 65 69 74 68 65 72 20 69 74   ;; if either it
2c00: 65 6d 73 20 6f 72 20 69 74 65 6d 73 20 74 61 62  ems or items tab
2c10: 6c 65 20 69 73 20 61 20 70 72 6f 63 20 72 65 74  le is a proc ret
2c20: 75 72 6e 20 69 74 20 73 6f 20 74 65 73 74 20 72  urn it so test r
2c30: 75 6e 6e 69 6e 67 0a 09 09 09 09 09 20 20 20 20  unning......    
2c40: 20 20 20 3b 3b 20 70 72 6f 63 65 73 73 20 63 61     ;; process ca
2c50: 6e 20 6b 6e 6f 77 20 74 6f 20 63 61 6c 6c 20 69  n know to call i
2c60: 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66  tems:get-items-f
2c70: 72 6f 6d 2d 63 6f 6e 66 69 67 0a 09 09 09 09 09  rom-config......
2c80: 20 20 20 20 20 20 20 3b 3b 20 69 66 20 65 69 74         ;; if eit
2c90: 68 65 72 20 69 73 20 61 20 6c 69 73 74 20 61 6e  her is a list an
2ca0: 64 20 6e 6f 6e 65 20 69 73 20 61 20 70 72 6f 63  d none is a proc
2cb0: 20 67 6f 20 61 68 65 61 64 20 61 6e 64 20 63 61   go ahead and ca
2cc0: 6c 6c 20 67 65 74 2d 69 74 65 6d 73 0a 09 09 09  ll get-items....
2cd0: 09 09 20 20 20 20 20 20 20 3b 3b 20 6f 74 68 65  ..       ;; othe
2ce0: 72 77 69 73 65 20 72 65 74 75 72 6e 20 23 66 20  rwise return #f 
2cf0: 2d 20 74 68 69 73 20 69 73 20 6e 6f 74 20 61 6e  - this is not an
2d00: 20 69 74 65 72 61 74 65 64 20 74 65 73 74 0a 09   iterated test..
2d10: 09 09 09 09 20 20 20 20 20 20 20 28 63 6f 6e 64  ....       (cond
2d20: 0a 09 09 09 09 09 09 28 28 70 72 6f 63 65 64 75  .......((procedu
2d30: 72 65 3f 20 69 74 65 6d 73 29 20 20 20 20 20 20  re? items)      
2d40: 0a 09 09 09 09 09 09 20 28 64 65 62 75 67 3a 70  ....... (debug:p
2d50: 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 69 74 65  rint-info 4 "ite
2d60: 6d 73 20 69 73 20 61 20 70 72 6f 63 65 64 75 72  ms is a procedur
2d70: 65 2c 20 77 69 6c 6c 20 63 61 6c 63 20 6c 61 74  e, will calc lat
2d80: 65 72 22 29 0a 09 09 09 09 09 09 20 69 74 65 6d  er")....... item
2d90: 73 29 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b  s)            ;;
2da0: 20 63 61 6c 63 20 6c 61 74 65 72 0a 09 09 09 09   calc later.....
2db0: 09 09 28 28 70 72 6f 63 65 64 75 72 65 3f 20 69  ..((procedure? i
2dc0: 74 65 6d 73 74 61 62 6c 65 29 0a 09 09 09 09 09  temstable)......
2dd0: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69  . (debug:print-i
2de0: 6e 66 6f 20 34 20 22 69 74 65 6d 73 74 61 62 6c  nfo 4 "itemstabl
2df0: 65 20 69 73 20 61 20 70 72 6f 63 65 64 75 72 65  e is a procedure
2e00: 2c 20 77 69 6c 6c 20 63 61 6c 63 20 6c 61 74 65  , will calc late
2e10: 72 22 29 0a 09 09 09 09 09 09 20 69 74 65 6d 73  r")....... items
2e20: 74 61 62 6c 65 29 20 20 20 20 20 20 20 3b 3b 20  table)       ;; 
2e30: 63 61 6c 63 20 6c 61 74 65 72 0a 09 09 09 09 09  calc later......
2e40: 09 28 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64  .((filter (lambd
2e50: 61 20 28 78 29 0a 09 09 09 09 09 09 09 20 20 20  a (x)........   
2e60: 28 6c 65 74 20 28 28 76 61 6c 20 28 63 61 72 20  (let ((val (car 
2e70: 78 29 29 29 0a 09 09 09 09 09 09 09 20 20 20 20  x)))........    
2e80: 20 28 69 66 20 28 70 72 6f 63 65 64 75 72 65 3f   (if (procedure?
2e90: 20 76 61 6c 29 20 76 61 6c 20 23 66 29 29 29 0a   val) val #f))).
2ea0: 09 09 09 09 09 09 09 20 28 61 70 70 65 6e 64 20  ....... (append 
2eb0: 28 69 66 20 28 6c 69 73 74 3f 20 69 74 65 6d 73  (if (list? items
2ec0: 29 20 69 74 65 6d 73 20 27 28 29 29 0a 09 09 09  ) items '())....
2ed0: 09 09 09 09 09 20 28 69 66 20 28 6c 69 73 74 3f  ..... (if (list?
2ee0: 20 69 74 65 6d 73 74 61 62 6c 65 29 20 69 74 65   itemstable) ite
2ef0: 6d 73 74 61 62 6c 65 20 27 28 29 29 29 29 0a 09  mstable '())))..
2f00: 09 09 09 09 09 20 27 68 61 76 65 2d 70 72 6f 63  ..... 'have-proc
2f10: 65 64 75 72 65 29 0a 09 09 09 09 09 09 28 28 6f  edure).......((o
2f20: 72 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 28  r (list? items)(
2f30: 6c 69 73 74 3f 20 69 74 65 6d 73 74 61 62 6c 65  list? itemstable
2f40: 29 29 20 3b 3b 20 63 61 6c 63 20 6e 6f 77 0a 09  )) ;; calc now..
2f50: 09 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 69  ..... (debug:pri
2f60: 6e 74 2d 69 6e 66 6f 20 34 20 22 69 74 65 6d 73  nt-info 4 "items
2f70: 20 61 6e 64 20 69 74 65 6d 73 74 61 62 6c 65 20   and itemstable 
2f80: 61 72 65 20 6c 69 73 74 73 2c 20 63 61 6c 63 20  are lists, calc 
2f90: 6e 6f 77 5c 6e 22 0a 09 09 09 09 09 09 09 20 20  now\n"........  
2fa0: 20 20 20 20 22 20 20 20 20 69 74 65 6d 73 3a 20      "    items: 
2fb0: 22 20 69 74 65 6d 73 20 22 20 69 74 65 6d 73 74  " items " itemst
2fc0: 61 62 6c 65 3a 20 22 20 69 74 65 6d 73 74 61 62  able: " itemstab
2fd0: 6c 65 29 0a 09 09 09 09 09 09 20 28 69 74 65 6d  le)....... (item
2fe0: 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d  s:get-items-from
2ff0: 2d 63 6f 6e 66 69 67 20 63 6f 6e 66 69 67 29 29  -config config))
3000: 0a 09 09 09 09 09 09 28 65 6c 73 65 20 23 66 29  .......(else #f)
3010: 29 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20  ))              
3020: 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20               ;; 
3030: 6e 6f 74 20 69 74 65 72 61 74 65 64 0a 09 09 09  not iterated....
3040: 09 09 20 20 20 20 20 23 66 20 20 20 20 20 20 3b  ..     #f      ;
3050: 3b 20 69 74 65 6d 73 64 61 74 20 35 0a 09 09 09  ; itemsdat 5....
3060: 09 09 20 20 20 20 20 23 66 20 20 20 20 20 20 3b  ..     #f      ;
3070: 3b 20 73 70 61 72 65 20 2d 20 75 73 65 64 20 66  ; spare - used f
3080: 6f 72 20 69 74 65 6d 2d 70 61 74 68 0a 09 09 09  or item-path....
3090: 09 09 20 20 20 20 20 29 29 29 0a 09 20 20 20 20  ..     )))..    
30a0: 28 66 6f 72 2d 65 61 63 68 20 0a 09 20 20 20 20  (for-each ..    
30b0: 20 28 6c 61 6d 62 64 61 20 28 77 61 69 74 6f 6e   (lambda (waiton
30c0: 29 0a 09 20 20 20 20 20 20 20 28 69 66 20 28 61  )..       (if (a
30d0: 6e 64 20 77 61 69 74 6f 6e 20 28 6e 6f 74 20 28  nd waiton (not (
30e0: 6d 65 6d 62 65 72 20 77 61 69 74 6f 6e 20 74 65  member waiton te
30f0: 73 74 2d 6e 61 6d 65 73 29 29 29 0a 09 09 20 20  st-names)))...  
3100: 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20 28   (begin...     (
3110: 73 65 74 21 20 72 65 71 75 69 72 65 64 2d 74 65  set! required-te
3120: 73 74 73 20 28 63 6f 6e 73 20 77 61 69 74 6f 6e  sts (cons waiton
3130: 20 72 65 71 75 69 72 65 64 2d 74 65 73 74 73 29   required-tests)
3140: 29 0a 09 09 20 20 20 20 20 28 73 65 74 21 20 74  )...     (set! t
3150: 65 73 74 2d 6e 61 6d 65 73 20 28 63 6f 6e 73 20  est-names (cons 
3160: 77 61 69 74 6f 6e 20 74 65 73 74 2d 6e 61 6d 65  waiton test-name
3170: 73 29 29 29 29 29 20 3b 3b 20 77 61 73 20 61 6e  s))))) ;; was an
3180: 20 61 70 70 65 6e 64 2c 20 6e 6f 77 20 61 20 63   append, now a c
3190: 6f 6e 73 0a 09 20 20 20 20 20 77 61 69 74 6f 6e  ons..     waiton
31a0: 73 29 0a 09 20 20 20 20 28 6c 65 74 20 28 28 72  s)..    (let ((r
31b0: 65 6d 74 65 73 74 73 20 28 64 65 6c 65 74 65 2d  emtests (delete-
31c0: 64 75 70 6c 69 63 61 74 65 73 20 28 61 70 70 65  duplicates (appe
31d0: 6e 64 20 77 61 69 74 6f 6e 73 20 74 61 6c 29 29  nd waitons tal))
31e0: 29 29 0a 09 20 20 20 20 20 20 28 69 66 20 28 6e  ))..      (if (n
31f0: 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73  ot (null? remtes
3200: 74 73 29 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28  ts))...  (loop (
3210: 63 61 72 20 72 65 6d 74 65 73 74 73 29 28 63 64  car remtests)(cd
3220: 72 20 72 65 6d 74 65 73 74 73 29 29 29 29 29 29  r remtests))))))
3230: 29 0a 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20  )..    (if (not 
3240: 28 6e 75 6c 6c 3f 20 72 65 71 75 69 72 65 64 2d  (null? required-
3250: 74 65 73 74 73 29 29 0a 09 28 64 65 62 75 67 3a  tests))..(debug:
3260: 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 41 64  print-info 1 "Ad
3270: 64 69 6e 67 20 22 20 72 65 71 75 69 72 65 64 2d  ding " required-
3280: 74 65 73 74 73 20 22 20 74 6f 20 74 68 65 20 72  tests " to the r
3290: 75 6e 20 71 75 65 75 65 22 29 29 0a 20 20 20 20  un queue")).    
32a0: 3b 3b 20 4e 4f 54 45 3a 20 74 68 65 73 65 20 61  ;; NOTE: these a
32b0: 72 65 20 61 6c 6c 20 70 61 72 65 6e 74 20 74 65  re all parent te
32c0: 73 74 73 2c 20 69 74 65 6d 73 20 61 72 65 20 6e  sts, items are n
32d0: 6f 74 20 65 78 70 61 6e 64 65 64 20 79 65 74 2e  ot expanded yet.
32e0: 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  .    (debug:prin
32f0: 74 2d 69 6e 66 6f 20 34 20 22 74 65 73 74 2d 72  t-info 4 "test-r
3300: 65 63 6f 72 64 73 3d 22 20 28 68 61 73 68 2d 74  ecords=" (hash-t
3310: 61 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65 73 74  able->alist test
3320: 2d 72 65 63 6f 72 64 73 29 29 0a 20 20 20 20 28  -records)).    (
3330: 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d 71  runs:run-tests-q
3340: 75 65 75 65 20 72 75 6e 2d 69 64 20 72 75 6e 6e  ueue run-id runn
3350: 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 73  ame test-records
3360: 20 6b 65 79 76 61 6c 6c 73 74 20 66 6c 61 67 73   keyvallst flags
3370: 20 74 65 73 74 2d 70 61 74 74 73 29 0a 20 20 20   test-patts).   
3380: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
3390: 66 6f 20 34 20 22 41 6c 6c 20 64 6f 6e 65 20 62  fo 4 "All done b
33a0: 79 20 68 65 72 65 22 29 29 29 0a 0a 28 64 65 66  y here")))..(def
33b0: 69 6e 65 20 28 72 75 6e 73 3a 63 61 6c 63 2d 66  ine (runs:calc-f
33c0: 61 69 6c 73 20 70 72 65 72 65 71 73 2d 6e 6f 74  ails prereqs-not
33d0: 2d 6d 65 74 29 0a 20 20 28 66 69 6c 74 65 72 20  -met).  (filter 
33e0: 28 6c 61 6d 62 64 61 20 28 74 65 73 74 29 0a 09  (lambda (test)..
33f0: 20 20 20 20 28 61 6e 64 20 28 76 65 63 74 6f 72      (and (vector
3400: 3f 20 74 65 73 74 29 20 3b 3b 20 6e 6f 74 20 28  ? test) ;; not (
3410: 73 74 72 69 6e 67 3f 20 74 65 73 74 29 29 0a 09  string? test))..
3420: 09 20 28 65 71 75 61 6c 3f 20 28 64 62 3a 74 65  . (equal? (db:te
3430: 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74 65 73  st-get-state tes
3440: 74 29 20 22 43 4f 4d 50 4c 45 54 45 44 22 29 0a  t) "COMPLETED").
3450: 09 09 20 28 6e 6f 74 20 28 6d 65 6d 62 65 72 20  .. (not (member 
3460: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61  (db:test-get-sta
3470: 74 75 73 20 74 65 73 74 29 0a 09 09 09 20 20 20  tus test)....   
3480: 20 20 20 27 28 22 50 41 53 53 22 20 22 57 41 52     '("PASS" "WAR
3490: 4e 22 20 22 43 48 45 43 4b 22 20 22 57 41 49 56  N" "CHECK" "WAIV
34a0: 45 44 22 29 29 29 29 29 0a 09 20 20 70 72 65 72  ED")))))..  prer
34b0: 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 0a 28  eqs-not-met))..(
34c0: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 63 61 6c  define (runs:cal
34d0: 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 74 65 64 20  c-not-completed 
34e0: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29  prereqs-not-met)
34f0: 0a 20 20 28 66 69 6c 74 65 72 0a 20 20 20 28 6c  .  (filter.   (l
3500: 61 6d 62 64 61 20 28 74 29 0a 20 20 20 20 20 28  ambda (t).     (
3510: 6f 72 20 28 6e 6f 74 20 28 76 65 63 74 6f 72 3f  or (not (vector?
3520: 20 74 29 29 0a 09 20 28 6e 6f 74 20 28 65 71 75   t)).. (not (equ
3530: 61 6c 3f 20 22 43 4f 4d 50 4c 45 54 45 44 22 20  al? "COMPLETED" 
3540: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61  (db:test-get-sta
3550: 74 65 20 74 29 29 29 29 29 0a 20 20 20 70 72 65  te t))))).   pre
3560: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 0a  reqs-not-met))..
3570: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 70 72  (define (runs:pr
3580: 65 74 74 79 2d 73 74 72 69 6e 67 20 6c 73 74 29  etty-string lst)
3590: 0a 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20  .  (map (lambda 
35a0: 28 74 29 0a 09 20 28 69 66 20 28 6e 6f 74 20 28  (t).. (if (not (
35b0: 76 65 63 74 6f 72 3f 20 74 29 29 0a 09 20 20 20  vector? t))..   
35c0: 20 20 28 63 6f 6e 63 20 74 29 0a 09 20 20 20 20    (conc t)..    
35d0: 20 28 63 6f 6e 63 20 28 64 62 3a 74 65 73 74 2d   (conc (db:test-
35e0: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 29 20  get-testname t) 
35f0: 22 3a 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74  ":" (db:test-get
3600: 2d 73 74 61 74 65 20 74 29 20 22 2f 22 20 28 64  -state t) "/" (d
3610: 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75  b:test-get-statu
3620: 73 20 74 29 29 29 29 0a 20 20 20 20 20 20 20 6c  s t)))).       l
3630: 73 74 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72  st))..(define (r
3640: 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65  uns:make-full-te
3650: 73 74 2d 6e 61 6d 65 20 74 65 73 74 6e 61 6d 65  st-name testname
3660: 20 69 74 65 6d 70 61 74 68 29 0a 20 20 28 69 66   itempath).  (if
3670: 20 28 65 71 75 61 6c 3f 20 69 74 65 6d 70 61 74   (equal? itempat
3680: 68 20 22 22 29 20 74 65 73 74 6e 61 6d 65 20 28  h "") testname (
3690: 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f  conc testname "/
36a0: 22 20 69 74 65 6d 70 61 74 68 29 29 29 0a 0a 3b  " itempath)))..;
36b0: 3b 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 69  ; test-records i
36c0: 73 20 61 20 68 61 73 68 20 74 61 62 6c 65 20 74  s a hash table t
36d0: 65 73 74 6e 61 6d 65 3a 69 74 65 6d 5f 70 61 74  estname:item_pat
36e0: 68 20 3d 3e 20 76 65 63 74 6f 72 20 3c 20 74 65  h => vector < te
36f0: 73 74 6e 61 6d 65 20 74 65 73 74 63 6f 6e 66 69  stname testconfi
3700: 67 20 77 61 69 74 6f 6e 73 20 70 72 69 6f 72 69  g waitons priori
3710: 74 79 20 69 74 65 6d 73 2d 69 6e 66 6f 20 2e 2e  ty items-info ..
3720: 2e 20 3e 0a 28 64 65 66 69 6e 65 20 28 72 75 6e  . >.(define (run
3730: 73 3a 72 75 6e 2d 74 65 73 74 73 2d 71 75 65 75  s:run-tests-queu
3740: 65 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65  e run-id runname
3750: 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 6b 65   test-records ke
3760: 79 76 61 6c 6c 73 74 20 66 6c 61 67 73 20 74 65  yvallst flags te
3770: 73 74 2d 70 61 74 74 73 29 0a 20 20 20 20 3b 3b  st-patts).    ;;
3780: 20 41 74 20 74 68 69 73 20 70 6f 69 6e 74 20 74   At this point t
3790: 68 65 20 6c 69 73 74 20 6f 66 20 70 61 72 65 6e  he list of paren
37a0: 74 20 74 65 73 74 73 20 69 73 20 65 78 70 61 6e  t tests is expan
37b0: 64 65 64 20 0a 20 20 20 20 3b 3b 20 4e 42 2f 2f  ded .    ;; NB//
37c0: 20 53 68 6f 75 6c 64 20 65 78 70 61 6e 64 20 69   Should expand i
37d0: 74 65 6d 73 20 68 65 72 65 20 61 6e 64 20 74 68  tems here and th
37e0: 65 6e 20 69 6e 73 65 72 74 20 69 6e 74 6f 20 74  en insert into t
37f0: 68 65 20 72 75 6e 20 71 75 65 75 65 2e 0a 20 20  he run queue..  
3800: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 35 20 22  (debug:print 5 "
3810: 74 65 73 74 2d 72 65 63 6f 72 64 73 3a 20 22 20  test-records: " 
3820: 74 65 73 74 2d 72 65 63 6f 72 64 73 20 22 2c 20  test-records ", 
3830: 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65 79  keyvallst: " key
3840: 76 61 6c 6c 73 74 20 22 20 66 6c 61 67 73 3a 20  vallst " flags: 
3850: 22 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61  " (hash-table->a
3860: 6c 69 73 74 20 66 6c 61 67 73 29 29 0a 20 20 28  list flags)).  (
3870: 6c 65 74 20 28 28 73 6f 72 74 65 64 2d 74 65 73  let ((sorted-tes
3880: 74 2d 6e 61 6d 65 73 20 28 74 65 73 74 73 3a 73  t-names (tests:s
3890: 6f 72 74 2d 62 79 2d 70 72 69 6f 72 69 74 79 2d  ort-by-priority-
38a0: 61 6e 64 2d 77 61 69 74 6f 6e 20 74 65 73 74 2d  and-waiton test-
38b0: 72 65 63 6f 72 64 73 29 29 0a 09 28 74 65 73 74  records))..(test
38c0: 2d 72 65 67 69 73 74 65 72 79 20 20 20 20 28 6d  -registery    (m
38d0: 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29  ake-hash-table))
38e0: 0a 09 28 6e 75 6d 2d 72 65 74 72 69 65 73 20 20  ..(num-retries  
38f0: 20 20 20 20 20 20 30 29 0a 09 28 6d 61 78 2d 72        0)..(max-r
3900: 65 74 72 69 65 73 20 20 20 20 20 20 20 28 63 6f  etries       (co
3910: 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e  nfig-lookup *con
3920: 66 69 67 64 61 74 2a 20 22 73 65 74 75 70 22 20  figdat* "setup" 
3930: 22 6d 61 78 72 65 74 72 69 65 73 22 29 29 29 0a  "maxretries"))).
3940: 20 20 20 20 28 73 65 74 21 20 6d 61 78 2d 72 65      (set! max-re
3950: 74 72 69 65 73 20 28 69 66 20 28 61 6e 64 20 6d  tries (if (and m
3960: 61 78 2d 72 65 74 72 69 65 73 20 28 73 74 72 69  ax-retries (stri
3970: 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 61 78 2d 72  ng->number max-r
3980: 65 74 72 69 65 73 29 29 28 73 74 72 69 6e 67 2d  etries))(string-
3990: 3e 6e 75 6d 62 65 72 20 6d 61 78 2d 72 65 74 72  >number max-retr
39a0: 69 65 73 29 20 31 30 30 29 29 0a 20 20 20 20 28  ies) 100)).    (
39b0: 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 73  if (not (null? s
39c0: 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73  orted-test-names
39d0: 29 29 0a 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28  ))..(let loop ((
39e0: 68 65 64 20 20 20 20 20 20 20 20 20 28 63 61 72  hed         (car
39f0: 20 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d   sorted-test-nam
3a00: 65 73 29 29 0a 09 09 20 20 20 28 74 61 6c 20 20  es))...   (tal  
3a10: 20 20 20 20 20 20 20 28 63 64 72 20 73 6f 72 74         (cdr sort
3a20: 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a  ed-test-names)).
3a30: 09 09 20 20 20 28 72 65 72 75 6e 73 20 20 20 20  ..   (reruns    
3a40: 20 20 27 28 29 29 29 0a 09 20 20 28 69 66 20 28    '()))..  (if (
3a50: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 72 75 6e  not (null? rerun
3a60: 73 29 29 28 64 65 62 75 67 3a 70 72 69 6e 74 2d  s))(debug:print-
3a70: 69 6e 66 6f 20 34 20 22 72 65 72 75 6e 73 3d 22  info 4 "reruns="
3a80: 20 72 65 72 75 6e 73 29 29 0a 09 20 20 3b 3b 20   reruns))..  ;; 
3a90: 28 70 72 69 6e 74 20 22 54 6f 70 20 6f 66 20 6c  (print "Top of l
3aa0: 6f 6f 70 2c 20 68 65 64 3d 22 20 68 65 64 20 22  oop, hed=" hed "
3ab0: 2c 20 74 61 6c 3d 22 20 74 61 6c 20 22 20 2c 72  , tal=" tal " ,r
3ac0: 65 72 75 6e 73 3d 22 20 72 65 72 75 6e 73 29 0a  eruns=" reruns).
3ad0: 09 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d  .  (let* ((test-
3ae0: 72 65 63 6f 72 64 20 28 68 61 73 68 2d 74 61 62  record (hash-tab
3af0: 6c 65 2d 72 65 66 20 74 65 73 74 2d 72 65 63 6f  le-ref test-reco
3b00: 72 64 73 20 68 65 64 29 29 0a 09 09 20 28 74 65  rds hed))... (te
3b10: 73 74 2d 6e 61 6d 65 20 20 20 28 74 65 73 74 73  st-name   (tests
3b20: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74  :testqueue-get-t
3b30: 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63  estname test-rec
3b40: 6f 72 64 29 29 0a 09 09 20 28 74 63 6f 6e 66 69  ord))... (tconfi
3b50: 67 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73  g     (tests:tes
3b60: 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 63  tqueue-get-testc
3b70: 6f 6e 66 69 67 20 74 65 73 74 2d 72 65 63 6f 72  onfig test-recor
3b80: 64 29 29 0a 09 09 20 28 74 65 73 74 6d 6f 64 65  d))... (testmode
3b90: 20 20 20 20 28 6c 65 74 20 28 28 6d 20 28 63 6f      (let ((m (co
3ba0: 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 63 6f 6e  nfig-lookup tcon
3bb0: 66 69 67 20 22 72 65 71 75 69 72 65 6d 65 6e 74  fig "requirement
3bc0: 73 22 20 22 6d 6f 64 65 22 29 29 29 0a 09 09 09  s" "mode")))....
3bd0: 09 28 69 66 20 6d 20 28 73 74 72 69 6e 67 2d 3e  .(if m (string->
3be0: 73 79 6d 62 6f 6c 20 6d 29 20 27 6e 6f 72 6d 61  symbol m) 'norma
3bf0: 6c 29 29 29 0a 09 09 20 28 77 61 69 74 6f 6e 73  l)))... (waitons
3c00: 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74       (tests:test
3c10: 71 75 65 75 65 2d 67 65 74 2d 77 61 69 74 6f 6e  queue-get-waiton
3c20: 73 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64  s    test-record
3c30: 29 29 0a 09 09 20 28 70 72 69 6f 72 69 74 79 20  ))... (priority 
3c40: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75     (tests:testqu
3c50: 65 75 65 2d 67 65 74 2d 70 72 69 6f 72 69 74 79  eue-get-priority
3c60: 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29     test-record))
3c70: 0a 09 09 20 28 69 74 65 6d 64 61 74 20 20 20 20  ... (itemdat    
3c80: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75   (tests:testqueu
3c90: 65 2d 67 65 74 2d 69 74 65 6d 64 61 74 20 20 20  e-get-itemdat   
3ca0: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 20 3b   test-record)) ;
3cb0: 3b 20 69 74 65 6d 64 61 74 20 63 61 6e 20 62 65  ; itemdat can be
3cc0: 20 61 20 73 74 72 69 6e 67 2c 20 6c 69 73 74 20   a string, list 
3cd0: 6f 72 20 23 66 0a 09 09 20 28 69 74 65 6d 73 20  or #f... (items 
3ce0: 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73        (tests:tes
3cf0: 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d 73  tqueue-get-items
3d00: 20 20 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72        test-recor
3d10: 64 29 29 0a 09 09 20 28 69 74 65 6d 2d 70 61 74  d))... (item-pat
3d20: 68 20 20 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e  h   (item-list->
3d30: 70 61 74 68 20 69 74 65 6d 64 61 74 29 29 0a 09  path itemdat))..
3d40: 09 20 28 6e 65 77 74 61 6c 20 20 20 20 20 20 28  . (newtal      (
3d50: 61 70 70 65 6e 64 20 74 61 6c 20 28 6c 69 73 74  append tal (list
3d60: 20 68 65 64 29 29 29 29 0a 09 20 20 20 20 0a 09   hed))))..    ..
3d70: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
3d80: 20 36 0a 09 09 09 20 22 74 65 73 74 2d 6e 61 6d   6.... "test-nam
3d90: 65 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 0a 09  e: " test-name..
3da0: 09 09 20 22 5c 6e 20 20 68 65 64 3a 20 20 20 20  .. "\n  hed:    
3db0: 20 20 20 20 20 22 20 68 65 64 0a 09 09 09 20 22       " hed.... "
3dc0: 5c 6e 20 20 69 74 65 6d 64 61 74 3a 20 20 20 20  \n  itemdat:    
3dd0: 20 22 20 69 74 65 6d 64 61 74 0a 09 09 09 20 22   " itemdat.... "
3de0: 5c 6e 20 20 69 74 65 6d 73 3a 20 20 20 20 20 20  \n  items:      
3df0: 20 22 20 69 74 65 6d 73 0a 09 09 09 20 22 5c 6e   " items.... "\n
3e00: 20 20 69 74 65 6d 2d 70 61 74 68 3a 20 20 20 22    item-path:   "
3e10: 20 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 20 22   item-path.... "
3e20: 5c 6e 20 20 77 61 69 74 6f 6e 73 3a 20 20 20 20  \n  waitons:    
3e30: 20 22 20 77 61 69 74 6f 6e 73 0a 09 09 09 20 22   " waitons.... "
3e40: 5c 6e 20 20 6e 75 6d 2d 72 65 74 72 69 65 73 3a  \n  num-retries:
3e50: 20 22 20 6e 75 6d 2d 72 65 74 72 69 65 73 0a 09   " num-retries..
3e60: 09 09 20 22 5c 6e 20 20 74 61 6c 3a 20 20 20 20  .. "\n  tal:    
3e70: 20 20 20 20 20 22 20 74 61 6c 0a 09 09 09 20 22       " tal.... "
3e80: 5c 6e 20 20 72 65 72 75 6e 73 3a 20 20 20 20 20  \n  reruns:     
3e90: 20 22 20 72 65 72 75 6e 73 29 0a 0a 09 20 20 20   " reruns)...   
3ea0: 20 3b 3b 20 63 68 65 63 6b 20 66 6f 72 20 68 65   ;; check for he
3eb0: 64 20 69 6e 20 77 61 69 74 6f 6e 73 20 3d 3e 20  d in waitons => 
3ec0: 74 68 69 73 20 77 6f 75 6c 64 20 62 65 20 63 69  this would be ci
3ed0: 72 63 75 6c 61 72 2c 20 72 65 6d 6f 76 65 20 69  rcular, remove i
3ee0: 74 20 61 6e 64 20 69 73 73 75 65 20 61 6e 0a 09  t and issue an..
3ef0: 20 20 20 20 3b 3b 20 65 72 72 6f 72 0a 09 20 20      ;; error..  
3f00: 20 20 28 69 66 20 28 6d 65 6d 62 65 72 20 74 65    (if (member te
3f10: 73 74 2d 6e 61 6d 65 20 77 61 69 74 6f 6e 73 29  st-name waitons)
3f20: 0a 09 09 28 62 65 67 69 6e 0a 09 09 20 20 28 64  ...(begin...  (d
3f30: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
3f40: 52 4f 52 3a 20 74 65 73 74 20 22 20 74 65 73 74  ROR: test " test
3f50: 2d 6e 61 6d 65 20 22 20 68 61 73 20 6c 69 73 74  -name " has list
3f60: 65 64 20 69 74 73 65 6c 66 20 61 73 20 61 20 77  ed itself as a w
3f70: 61 69 74 6f 6e 2c 20 70 6c 65 61 73 65 20 63 6f  aiton, please co
3f80: 72 72 65 63 74 20 74 68 69 73 21 22 29 0a 09 09  rrect this!")...
3f90: 20 20 28 73 65 74 21 20 77 61 69 74 6f 6e 20 28    (set! waiton (
3fa0: 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28  filter (lambda (
3fb0: 78 29 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 78  x)(not (equal? x
3fc0: 20 68 65 64 29 29 29 20 77 61 69 74 6f 6e 73 29   hed))) waitons)
3fd0: 29 29 29 0a 0a 09 20 20 20 20 28 63 6f 6e 64 20  )))...    (cond 
3fe0: 3b 3b 20 4f 55 54 45 52 20 43 4f 4e 44 0a 09 20  ;; OUTER COND.. 
3ff0: 20 20 20 20 28 28 6e 6f 74 20 69 74 65 6d 73 29      ((not items)
4000: 20 3b 3b 20 77 68 65 6e 20 66 61 6c 73 65 20 74   ;; when false t
4010: 68 65 20 74 65 73 74 20 69 73 20 6f 6b 20 74 6f  he test is ok to
4020: 20 62 65 20 68 61 6e 64 65 64 20 6f 66 66 20 74   be handed off t
4030: 6f 20 6c 61 75 6e 63 68 20 28 62 75 74 20 6e 6f  o launch (but no
4040: 74 20 62 65 66 6f 72 65 29 0a 09 20 20 20 20 20  t before)..     
4050: 20 28 6c 65 74 2a 20 28 28 72 75 6e 2d 6c 69 6d   (let* ((run-lim
4060: 69 74 73 2d 69 6e 66 6f 20 20 20 20 20 20 20 20  its-info        
4070: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
4080: 20 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f   runs:can-run-mo
4090: 72 65 2d 74 65 73 74 73 20 23 66 20 74 65 73 74  re-tests #f test
40a0: 2d 72 65 63 6f 72 64 29 29 20 3b 3b 20 6c 6f 6f  -record)) ;; loo
40b0: 6b 20 61 74 20 74 68 65 20 74 65 73 74 20 6a 6f  k at the test jo
40c0: 62 67 72 6f 75 70 20 61 6e 64 20 74 6f 74 20 6a  bgroup and tot j
40d0: 6f 62 73 20 72 75 6e 6e 69 6e 67 0a 09 09 20 20  obs running...  
40e0: 20 20 20 28 68 61 76 65 2d 72 65 73 6f 75 72 63     (have-resourc
40f0: 65 73 20 20 20 20 20 20 20 20 20 20 28 63 61 72  es          (car
4100: 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f   run-limits-info
4110: 29 29 0a 09 09 20 20 20 20 20 28 6e 75 6d 2d 72  ))...     (num-r
4120: 75 6e 6e 69 6e 67 20 20 20 20 20 20 20 20 20 20  unning          
4130: 20 20 20 28 6c 69 73 74 2d 72 65 66 20 72 75 6e     (list-ref run
4140: 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 31 29 29  -limits-info 1))
4150: 0a 09 09 20 20 20 20 20 28 6e 75 6d 2d 72 75 6e  ...     (num-run
4160: 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70  ning-in-jobgroup
4170: 20 28 6c 69 73 74 2d 72 65 66 20 72 75 6e 2d 6c   (list-ref run-l
4180: 69 6d 69 74 73 2d 69 6e 66 6f 20 32 29 29 0a 09  imits-info 2))..
4190: 09 20 20 20 20 20 28 6d 61 78 2d 63 6f 6e 63 75  .     (max-concu
41a0: 72 72 65 6e 74 2d 6a 6f 62 73 20 20 20 20 20 28  rrent-jobs     (
41b0: 6c 69 73 74 2d 72 65 66 20 72 75 6e 2d 6c 69 6d  list-ref run-lim
41c0: 69 74 73 2d 69 6e 66 6f 20 33 29 29 0a 09 09 20  its-info 3))... 
41d0: 20 20 20 20 28 6a 6f 62 2d 67 72 6f 75 70 2d 6c      (job-group-l
41e0: 69 6d 69 74 20 20 20 20 20 20 20 20 20 28 6c 69  imit         (li
41f0: 73 74 2d 72 65 66 20 72 75 6e 2d 6c 69 6d 69 74  st-ref run-limit
4200: 73 2d 69 6e 66 6f 20 34 29 29 0a 09 09 20 20 20  s-info 4))...   
4210: 20 20 28 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d    (prereqs-not-m
4220: 65 74 20 20 20 20 20 20 20 20 20 28 6f 70 65 6e  et         (open
4230: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65  -run-close db:ge
4240: 74 2d 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65  t-prereqs-not-me
4250: 74 20 23 66 20 72 75 6e 2d 69 64 20 77 61 69 74  t #f run-id wait
4260: 6f 6e 73 20 69 74 65 6d 2d 70 61 74 68 20 6d 6f  ons item-path mo
4270: 64 65 3a 20 74 65 73 74 6d 6f 64 65 29 29 0a 09  de: testmode))..
4280: 09 20 20 20 20 20 28 66 61 69 6c 73 20 20 20 20  .     (fails    
4290: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28                 (
42a0: 72 75 6e 73 3a 63 61 6c 63 2d 66 61 69 6c 73 20  runs:calc-fails 
42b0: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29  prereqs-not-met)
42c0: 29 0a 09 09 20 20 20 20 20 28 6e 6f 6e 2d 63 6f  )...     (non-co
42d0: 6d 70 6c 65 74 65 64 20 20 20 20 20 20 20 20 20  mpleted         
42e0: 20 20 28 72 75 6e 73 3a 63 61 6c 63 2d 6e 6f 74    (runs:calc-not
42f0: 2d 63 6f 6d 70 6c 65 74 65 64 20 70 72 65 72 65  -completed prere
4300: 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a 09 09  qs-not-met)))...
4310: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
4320: 6f 20 38 20 22 68 61 76 65 2d 72 65 73 6f 75 72  o 8 "have-resour
4330: 63 65 73 3a 20 22 20 68 61 76 65 2d 72 65 73 6f  ces: " have-reso
4340: 75 72 63 65 73 20 22 20 70 72 65 72 65 71 73 2d  urces " prereqs-
4350: 6e 6f 74 2d 6d 65 74 3a 20 22 20 0a 09 09 09 20  not-met: " .... 
4360: 20 20 20 20 28 73 74 72 69 6e 67 2d 69 6e 74 65      (string-inte
4370: 72 73 70 65 72 73 65 20 0a 09 09 09 20 20 20 20  rsperse ....    
4380: 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28    (map (lambda (
4390: 74 29 0a 09 09 09 09 20 20 20 20 20 28 69 66 20  t).....     (if 
43a0: 28 76 65 63 74 6f 72 3f 20 74 29 0a 09 09 09 09  (vector? t).....
43b0: 09 20 28 63 6f 6e 63 20 28 64 62 3a 74 65 73 74  . (conc (db:test
43c0: 2d 67 65 74 2d 73 74 61 74 65 20 74 29 20 22 2f  -get-state t) "/
43d0: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73  " (db:test-get-s
43e0: 74 61 74 75 73 20 74 29 29 0a 09 09 09 09 09 20  tatus t))...... 
43f0: 28 63 6f 6e 63 20 22 20 57 41 52 4e 49 4e 47 3a  (conc " WARNING:
4400: 20 74 20 69 73 20 6e 6f 74 20 61 20 76 65 63 74   t is not a vect
4410: 6f 72 3d 22 20 74 20 29 29 29 0a 09 09 09 09 20  or=" t )))..... 
4420: 20 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65    prereqs-not-me
4430: 74 29 20 22 2c 20 22 29 20 22 20 66 61 69 6c 73  t) ", ") " fails
4440: 3a 20 22 20 66 61 69 6c 73 29 0a 09 09 28 64 65  : " fails)...(de
4450: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34  bug:print-info 4
4460: 20 22 68 65 64 3d 22 20 68 65 64 20 22 5c 6e 20   "hed=" hed "\n 
4470: 20 74 65 73 74 2d 72 65 63 6f 72 64 3d 22 20 74   test-record=" t
4480: 65 73 74 2d 72 65 63 6f 72 64 20 22 5c 6e 20 20  est-record "\n  
4490: 74 65 73 74 2d 6e 61 6d 65 3a 20 22 20 74 65 73  test-name: " tes
44a0: 74 2d 6e 61 6d 65 20 22 5c 6e 20 20 69 74 65 6d  t-name "\n  item
44b0: 2d 70 61 74 68 3a 20 22 20 69 74 65 6d 2d 70 61  -path: " item-pa
44c0: 74 68 20 22 5c 6e 20 20 74 65 73 74 2d 70 61 74  th "\n  test-pat
44d0: 74 73 3a 20 22 20 74 65 73 74 2d 70 61 74 74 73  ts: " test-patts
44e0: 29 0a 0a 09 09 3b 3b 20 44 6f 6e 27 74 20 6b 6e  )....;; Don't kn
44f0: 6f 77 20 61 74 20 74 68 69 73 20 74 69 6d 65 20  ow at this time 
4500: 69 66 20 74 68 65 20 74 65 73 74 20 68 61 76 65  if the test have
4510: 20 62 65 65 6e 20 6c 61 75 6e 63 68 65 64 20 61   been launched a
4520: 74 20 73 6f 6d 65 20 74 69 6d 65 20 69 6e 20 74  t some time in t
4530: 68 65 20 70 61 73 74 0a 09 09 3b 3b 20 69 2e 65  he past...;; i.e
4540: 2e 20 69 73 20 74 68 69 73 20 61 20 72 65 2d 6c  . is this a re-l
4550: 61 75 6e 63 68 3f 0a 09 09 28 64 65 62 75 67 3a  aunch?...(debug:
4560: 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 72 75  print-info 4 "ru
4570: 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 3d 20  n-limits-info = 
4580: 22 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66  " run-limits-inf
4590: 6f 29 0a 09 09 28 63 6f 6e 64 20 3b 3b 20 49 4e  o)...(cond ;; IN
45a0: 4e 45 52 20 43 4f 4e 44 20 23 31 20 66 6f 72 20  NER COND #1 for 
45b0: 61 20 6c 61 75 6e 63 68 61 62 6c 65 20 74 65 73  a launchable tes
45c0: 74 0a 09 09 20 3b 3b 20 43 68 65 63 6b 20 69 74  t... ;; Check it
45d0: 65 6d 20 70 61 74 68 20 61 67 61 69 6e 73 74 20  em path against 
45e0: 69 74 65 6d 2d 70 61 74 74 73 0a 09 09 20 28 28  item-patts... ((
45f0: 6e 6f 74 20 28 74 65 73 74 73 3a 6d 61 74 63 68  not (tests:match
4600: 20 74 65 73 74 2d 70 61 74 74 73 20 28 74 65 73   test-patts (tes
4610: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
4620: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72  -testname test-r
4630: 65 63 6f 72 64 29 20 69 74 65 6d 2d 70 61 74 68  ecord) item-path
4640: 29 29 20 3b 3b 20 54 68 69 73 20 74 65 73 74 2f  )) ;; This test/
4650: 69 74 65 6d 70 61 74 68 20 69 73 20 6e 6f 74 20  itempath is not 
4660: 74 6f 20 62 65 20 72 75 6e 0a 09 09 20 20 3b 3b  to be run...  ;;
4670: 20 65 6c 73 65 20 74 68 65 20 72 75 6e 20 69 73   else the run is
4680: 20 73 74 75 63 6b 2c 20 74 65 6d 70 6f 72 61 72   stuck, temporar
4690: 69 6c 79 20 6f 72 20 70 65 72 6d 61 6e 65 6e 74  ily or permanent
46a0: 6c 79 0a 09 09 20 20 3b 3b 20 62 75 74 20 73 68  ly...  ;; but sh
46b0: 6f 75 6c 64 20 63 68 65 63 6b 20 69 66 20 69 74  ould check if it
46c0: 20 69 73 20 64 75 65 20 74 6f 20 6c 61 63 6b 20   is due to lack 
46d0: 6f 66 20 72 65 73 6f 75 72 63 65 73 20 76 73 2e  of resources vs.
46e0: 20 70 72 65 72 65 71 75 69 73 69 74 65 73 0a 09   prerequisites..
46f0: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d  .  (debug:print-
4700: 69 6e 66 6f 20 31 20 22 53 6b 69 70 70 69 6e 67  info 1 "Skipping
4710: 20 22 20 28 74 65 73 74 73 3a 74 65 73 74 71 75   " (tests:testqu
4720: 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65  eue-get-testname
4730: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 20 22 20   test-record) " 
4740: 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20 61 73  " item-path " as
4750: 20 69 74 20 64 6f 65 73 6e 27 74 20 6d 61 74 63   it doesn't matc
4760: 68 20 22 20 74 65 73 74 2d 70 61 74 74 73 29 0a  h " test-patts).
4770: 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65  ..  (thread-slee
4780: 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61  p! *global-delta
4790: 2a 29 0a 09 09 20 20 28 69 66 20 28 6e 6f 74 20  *)...  (if (not 
47a0: 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 20  (null? tal))... 
47b0: 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20       (loop (car 
47c0: 74 61 6c 29 28 63 64 72 20 74 61 6c 29 20 72 65  tal)(cdr tal) re
47d0: 72 75 6e 73 29 29 29 0a 09 09 20 28 28 61 6e 64  runs)))... ((and
47e0: 20 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 62 6c   (not (hash-tabl
47f0: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 74 65  e-ref/default te
4800: 73 74 2d 72 65 67 69 73 74 65 72 79 20 28 72 75  st-registery (ru
4810: 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 73  ns:make-full-tes
4820: 74 2d 6e 61 6d 65 20 74 65 73 74 2d 6e 61 6d 65  t-name test-name
4830: 20 69 74 65 6d 2d 70 61 74 68 29 20 23 66 29 29   item-path) #f))
4840: 0a 09 09 20 20 20 20 20 20 20 28 61 6e 64 20 6d  ...       (and m
4850: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f  ax-concurrent-jo
4860: 62 73 20 28 3e 20 28 2d 20 6d 61 78 2d 63 6f 6e  bs (> (- max-con
4870: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 6e 75 6d  current-jobs num
4880: 2d 72 75 6e 6e 69 6e 67 29 20 35 29 29 29 0a 09  -running) 5)))..
4890: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d  .  (debug:print-
48a0: 69 6e 66 6f 20 34 20 22 50 72 65 2d 72 65 67 69  info 4 "Pre-regi
48b0: 73 74 65 72 69 6e 67 20 74 65 73 74 20 22 20 74  stering test " t
48c0: 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65  est-name "/" ite
48d0: 6d 2d 70 61 74 68 20 22 20 74 6f 20 63 72 65 61  m-path " to crea
48e0: 74 65 20 70 6c 61 63 65 68 6f 6c 64 65 72 22 20  te placeholder" 
48f0: 29 0a 09 09 20 20 28 6f 70 65 6e 2d 72 75 6e 2d  )...  (open-run-
4900: 63 6c 6f 73 65 20 64 62 3a 74 65 73 74 73 2d 72  close db:tests-r
4910: 65 67 69 73 74 65 72 2d 74 65 73 74 20 23 66 20  egister-test #f 
4920: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65  run-id test-name
4930: 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 09 20 20   item-path)...  
4940: 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21  (hash-table-set!
4950: 20 74 65 73 74 2d 72 65 67 69 73 74 65 72 79 20   test-registery 
4960: 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d  (runs:make-full-
4970: 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 6e  test-name test-n
4980: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 20 23  ame item-path) #
4990: 74 29 0a 09 09 20 20 28 74 68 72 65 61 64 2d 73  t)...  (thread-s
49a0: 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65  leep! *global-de
49b0: 6c 74 61 2a 29 0a 09 09 20 20 28 6c 6f 6f 70 20  lta*)...  (loop 
49c0: 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72  (car newtal)(cdr
49d0: 20 6e 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29   newtal) reruns)
49e0: 29 0a 09 09 20 28 28 6e 6f 74 20 68 61 76 65 2d  )... ((not have-
49f0: 72 65 73 6f 75 72 63 65 73 29 20 3b 3b 20 73 69  resources) ;; si
4a00: 6d 70 6c 79 20 74 72 79 20 61 67 61 69 6e 20 61  mply try again a
4a10: 66 74 65 72 20 77 61 69 74 69 6e 67 20 61 20 73  fter waiting a s
4a20: 65 63 6f 6e 64 0a 09 09 20 20 28 64 65 62 75 67  econd...  (debug
4a30: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 6e  :print-info 1 "n
4a40: 6f 20 72 65 73 6f 75 72 63 65 73 20 74 6f 20 72  o resources to r
4a50: 75 6e 20 6e 65 77 20 74 65 73 74 73 2c 20 77 61  un new tests, wa
4a60: 69 74 69 6e 67 20 2e 2e 2e 22 29 0a 09 09 20 20  iting ...")...  
4a70: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28  (thread-sleep! (
4a80: 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d 64  + 0.01 *global-d
4a90: 65 6c 74 61 2a 29 29 0a 09 09 20 20 3b 3b 20 63  elta*))...  ;; c
4aa0: 6f 75 6c 64 20 68 61 76 65 20 64 6f 6e 65 20 68  ould have done h
4ab0: 65 64 20 74 61 6c 20 68 65 72 65 20 62 75 74 20  ed tal here but 
4ac0: 64 6f 69 6e 67 20 63 61 72 2f 63 64 72 20 6f 66  doing car/cdr of
4ad0: 20 6e 65 77 74 61 6c 20 74 6f 20 72 6f 74 61 74   newtal to rotat
4ae0: 65 20 74 65 73 74 73 0a 09 09 20 20 28 6c 6f 6f  e tests...  (loo
4af0: 70 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63  p (car newtal)(c
4b00: 64 72 20 6e 65 77 74 61 6c 29 20 72 65 72 75 6e  dr newtal) rerun
4b10: 73 29 29 0a 09 09 20 28 28 61 6e 64 20 68 61 76  s))... ((and hav
4b20: 65 2d 72 65 73 6f 75 72 63 65 73 0a 09 09 20 20  e-resources...  
4b30: 20 20 20 20 20 28 6f 72 20 28 6e 75 6c 6c 3f 20       (or (null? 
4b40: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29  prereqs-not-met)
4b50: 0a 09 09 09 20 20 20 28 61 6e 64 20 28 65 71 3f  ....   (and (eq?
4b60: 20 74 65 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65   testmode 'tople
4b70: 76 65 6c 29 0a 09 09 09 09 28 6e 75 6c 6c 3f 20  vel).....(null? 
4b80: 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 29 29  non-completed)))
4b90: 29 0a 09 09 20 20 28 72 75 6e 3a 74 65 73 74 20  )...  (run:test 
4ba0: 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 6b  run-id runname k
4bb0: 65 79 76 61 6c 6c 73 74 20 74 65 73 74 2d 72 65  eyvallst test-re
4bc0: 63 6f 72 64 20 66 6c 61 67 73 20 23 66 29 0a 09  cord flags #f)..
4bd0: 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70  .  (thread-sleep
4be0: 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a  ! *global-delta*
4bf0: 29 0a 09 09 20 20 28 69 66 20 28 6e 6f 74 20 28  )...  (if (not (
4c00: 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 20 20  null? tal))...  
4c10: 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74      (loop (car t
4c20: 61 6c 29 28 63 64 72 20 74 61 6c 29 20 72 65 72  al)(cdr tal) rer
4c30: 75 6e 73 29 29 29 0a 09 09 20 28 65 6c 73 65 20  uns)))... (else 
4c40: 3b 3b 20 6d 75 73 74 20 62 65 20 77 65 20 68 61  ;; must be we ha
4c50: 76 65 20 75 6e 6d 65 74 20 70 72 65 72 65 71 75  ve unmet prerequ
4c60: 69 73 69 74 65 73 0a 09 09 20 20 20 20 28 64 65  isites...    (de
4c70: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 46 41 49  bug:print 4 "FAI
4c80: 4c 53 3a 20 22 20 66 61 69 6c 73 29 0a 09 09 20  LS: " fails)... 
4c90: 20 20 20 3b 3b 20 49 66 20 6f 6e 65 20 6f 72 20     ;; If one or 
4ca0: 6d 6f 72 65 20 6f 66 20 74 68 65 20 70 72 65 72  more of the prer
4cb0: 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 61 72 65 20  eqs-not-met are 
4cc0: 46 41 49 4c 20 74 68 65 6e 20 77 65 20 63 61 6e  FAIL then we can
4cd0: 20 69 73 73 75 65 0a 09 09 20 20 20 20 3b 3b 20   issue...    ;; 
4ce0: 61 20 6d 65 73 73 61 67 65 20 61 6e 64 20 64 72  a message and dr
4cf0: 6f 70 20 68 65 64 20 66 72 6f 6d 20 74 68 65 20  op hed from the 
4d00: 69 74 65 6d 73 20 74 6f 20 62 65 20 70 72 6f 63  items to be proc
4d10: 65 73 73 65 64 2e 0a 09 09 20 20 20 20 28 69 66  essed....    (if
4d20: 20 28 6e 75 6c 6c 3f 20 66 61 69 6c 73 29 0a 09   (null? fails)..
4d30: 09 09 28 62 65 67 69 6e 0a 09 09 09 20 20 3b 3b  ..(begin....  ;;
4d40: 20 63 6f 75 6c 64 6e 27 74 20 72 75 6e 2c 20 74   couldn't run, t
4d50: 61 6b 65 20 61 20 62 72 65 61 74 68 65 72 0a 09  ake a breather..
4d60: 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ..  (debug:print
4d70: 2d 69 6e 66 6f 20 34 20 22 53 68 6f 75 6c 64 6e  -info 4 "Shouldn
4d80: 27 74 20 72 65 61 6c 6c 79 20 67 65 74 20 68 65  't really get he
4d90: 72 65 2c 20 72 61 63 65 20 63 6f 6e 64 69 74 69  re, race conditi
4da0: 6f 6e 3f 20 55 6e 61 62 6c 65 20 74 6f 20 6c 61  on? Unable to la
4db0: 75 6e 63 68 20 6d 6f 72 65 20 74 65 73 74 73 20  unch more tests 
4dc0: 61 74 20 74 68 69 73 20 6d 6f 6d 65 6e 74 2c 20  at this moment, 
4dd0: 6b 69 6c 6c 69 6e 67 20 74 69 6d 65 20 2e 2e 2e  killing time ...
4de0: 22 29 0a 09 09 09 20 20 28 74 68 72 65 61 64 2d  ")....  (thread-
4df0: 73 6c 65 65 70 21 20 28 2b 20 30 2e 30 31 20 2a  sleep! (+ 0.01 *
4e00: 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 20  global-delta*)) 
4e10: 3b 3b 20 6c 6f 6e 67 20 73 6c 65 65 70 20 68 65  ;; long sleep he
4e20: 72 65 20 2d 20 6e 6f 20 72 65 73 6f 75 72 63 65  re - no resource
4e30: 73 2c 20 6d 61 79 20 61 73 20 77 65 6c 6c 20 62  s, may as well b
4e40: 65 20 70 61 74 69 65 6e 74 0a 09 09 09 20 20 3b  e patient....  ;
4e50: 3b 20 77 65 20 6d 61 64 65 20 6e 65 77 20 74 61  ; we made new ta
4e60: 6c 20 62 79 20 73 74 69 63 6b 69 6e 67 20 68 65  l by sticking he
4e70: 64 20 61 74 20 74 68 65 20 62 61 63 6b 20 6f 66  d at the back of
4e80: 20 74 68 65 20 6c 69 73 74 0a 09 09 09 20 20 28   the list....  (
4e90: 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61 6c  loop (car newtal
4ea0: 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20 72 65  )(cdr newtal) re
4eb0: 72 75 6e 73 29 29 0a 09 09 09 3b 3b 20 74 68 65  runs))....;; the
4ec0: 20 77 61 69 74 6f 6e 20 69 73 20 46 41 49 4c 20   waiton is FAIL 
4ed0: 73 6f 20 6e 6f 20 70 6f 69 6e 74 20 69 6e 20 74  so no point in t
4ee0: 72 79 69 6e 67 20 74 6f 20 72 75 6e 20 68 65 64  rying to run hed
4ef0: 20 65 76 65 72 20 61 67 61 69 6e 0a 09 09 09 28   ever again....(
4f00: 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74  if (not (null? t
4f10: 61 6c 29 29 0a 09 09 09 20 20 20 20 28 69 66 20  al))....    (if 
4f20: 28 76 65 63 74 6f 72 3f 20 68 65 64 29 0a 09 09  (vector? hed)...
4f30: 09 09 28 62 65 67 69 6e 20 28 64 65 62 75 67 3a  ..(begin (debug:
4f40: 70 72 69 6e 74 20 31 20 22 57 41 52 4e 3a 20 44  print 1 "WARN: D
4f50: 72 6f 70 70 69 6e 67 20 74 65 73 74 20 22 20 28  ropping test " (
4f60: 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74  db:test-get-test
4f70: 6e 61 6d 65 20 68 65 64 29 20 22 2f 22 20 28 64  name hed) "/" (d
4f80: 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d  b:test-get-item-
4f90: 70 61 74 68 20 68 65 64 29 0a 09 09 09 09 09 09  path hed).......
4fa0: 20 20 20 20 22 20 66 72 6f 6d 20 74 68 65 20 6c      " from the l
4fb0: 61 75 6e 63 68 20 6c 69 73 74 20 61 73 20 69 74  aunch list as it
4fc0: 20 68 61 73 20 70 72 65 72 65 71 75 69 73 74 65   has prerequiste
4fd0: 73 20 74 68 61 74 20 61 72 65 20 46 41 49 4c 22  s that are FAIL"
4fe0: 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 74 68  ).....       (th
4ff0: 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f  read-sleep! *glo
5000: 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 09 09  bal-delta*).....
5010: 20 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61         (loop (ca
5020: 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 20  r tal)(cdr tal) 
5030: 28 63 6f 6e 73 20 68 65 64 20 72 65 72 75 6e 73  (cons hed reruns
5040: 29 29 29 0a 09 09 09 09 28 62 65 67 69 6e 0a 09  ))).....(begin..
5050: 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e  ...  (debug:prin
5060: 74 20 31 20 22 57 41 52 4e 3a 20 54 65 73 74 20  t 1 "WARN: Test 
5070: 6e 6f 74 20 70 72 6f 63 65 73 73 65 64 20 63 6f  not processed co
5080: 72 72 65 63 74 6c 79 2e 20 43 6f 75 6c 64 20 62  rrectly. Could b
5090: 65 20 61 20 72 61 63 65 20 63 6f 6e 64 69 74 69  e a race conditi
50a0: 6f 6e 20 69 6e 20 79 6f 75 72 20 74 65 73 74 20  on in your test 
50b0: 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 3f 20  implementation? 
50c0: 22 20 68 65 64 29 20 3b 3b 20 20 22 20 61 73 20  " hed) ;;  " as 
50d0: 69 74 20 68 61 73 20 70 72 65 72 65 71 75 69 73  it has prerequis
50e0: 74 65 73 20 74 68 61 74 20 61 72 65 20 46 41 49  tes that are FAI
50f0: 4c 2e 20 28 4e 4f 54 45 3a 20 68 65 64 20 69 73  L. (NOTE: hed is
5100: 20 6e 6f 74 20 61 20 76 65 63 74 6f 72 29 22 29   not a vector)")
5110: 0a 09 09 09 09 20 20 28 74 68 72 65 61 64 2d 73  .....  (thread-s
5120: 6c 65 65 70 21 20 28 2b 20 30 2e 30 31 20 2a 67  leep! (+ 0.01 *g
5130: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09  lobal-delta*))..
5140: 09 09 09 20 20 28 6c 6f 6f 70 20 68 65 64 20 74  ...  (loop hed t
5150: 61 6c 20 72 65 72 75 6e 73 29 29 29 29 29 29 29  al reruns)))))))
5160: 29 29 20 3b 3b 20 45 4e 44 20 4f 46 20 49 4e 4e  )) ;; END OF INN
5170: 45 52 20 43 4f 4e 44 0a 09 20 20 20 20 20 0a 09  ER COND..     ..
5180: 20 20 20 20 20 3b 3b 20 63 61 73 65 20 77 68 65       ;; case whe
5190: 72 65 20 61 6e 20 69 74 65 6d 73 20 63 61 6d 65  re an items came
51a0: 20 69 6e 20 61 73 20 61 20 6c 69 73 74 20 62 65   in as a list be
51b0: 65 6e 20 70 72 6f 63 65 73 73 65 64 0a 09 20 20  en processed..  
51c0: 20 20 20 28 28 61 6e 64 20 28 6c 69 73 74 3f 20     ((and (list? 
51d0: 69 74 65 6d 73 29 20 20 20 20 20 3b 3b 20 74 68  items)     ;; th
51e0: 75 73 20 77 65 20 6b 6e 6f 77 20 6f 75 72 20 69  us we know our i
51f0: 74 65 6d 73 20 61 72 65 20 61 6c 72 65 61 64 79  tems are already
5200: 20 63 61 6c 63 75 6c 61 74 65 64 0a 09 09 20 20   calculated...  
5210: 20 28 6e 6f 74 20 20 20 69 74 65 6d 64 61 74 29   (not   itemdat)
5220: 29 20 3b 3b 20 61 6e 64 20 6e 6f 74 20 79 65 74  ) ;; and not yet
5230: 20 65 78 70 61 6e 64 65 64 20 69 6e 74 6f 20 74   expanded into t
5240: 68 65 20 6c 69 73 74 20 6f 66 20 74 68 69 6e 67  he list of thing
5250: 73 20 74 6f 20 62 65 20 64 6f 6e 65 0a 09 20 20  s to be done..  
5260: 20 20 20 20 28 69 66 20 28 61 6e 64 20 28 64 65      (if (and (de
5270: 62 75 67 3a 64 65 62 75 67 2d 6d 6f 64 65 20 31  bug:debug-mode 1
5280: 29 20 3b 3b 20 28 3e 3d 20 2a 76 65 72 62 6f 73  ) ;; (>= *verbos
5290: 69 74 79 2a 20 31 29 0a 09 09 20 20 20 20 20 20  ity* 1)...      
52a0: 20 28 3e 20 28 6c 65 6e 67 74 68 20 69 74 65 6d   (> (length item
52b0: 73 29 20 30 29 0a 09 09 20 20 20 20 20 20 20 28  s) 0)...       (
52c0: 3e 20 28 6c 65 6e 67 74 68 20 28 63 61 72 20 69  > (length (car i
52d0: 74 65 6d 73 29 29 20 30 29 29 0a 09 09 20 20 28  tems)) 0))...  (
52e0: 70 70 20 69 74 65 6d 73 29 29 0a 09 20 20 20 20  pp items))..    
52f0: 20 20 28 66 6f 72 2d 65 61 63 68 0a 09 20 20 20    (for-each..   
5300: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6d 79 2d      (lambda (my-
5310: 69 74 65 6d 64 61 74 29 0a 09 09 20 28 6c 65 74  itemdat)... (let
5320: 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d 72 65 63  * ((new-test-rec
5330: 6f 72 64 20 28 6c 65 74 20 28 28 6e 65 77 72 65  ord (let ((newre
5340: 63 20 28 6d 61 6b 65 2d 74 65 73 74 73 3a 74 65  c (make-tests:te
5350: 73 74 71 75 65 75 65 29 29 29 0a 09 09 09 09 09  stqueue)))......
5360: 20 20 20 28 76 65 63 74 6f 72 2d 63 6f 70 79 21     (vector-copy!
5370: 20 74 65 73 74 2d 72 65 63 6f 72 64 20 6e 65 77   test-record new
5380: 72 65 63 29 0a 09 09 09 09 09 20 20 20 6e 65 77  rec)......   new
5390: 72 65 63 29 29 0a 09 09 09 28 6d 79 2d 69 74 65  rec))....(my-ite
53a0: 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 73  m-path (item-lis
53b0: 74 2d 3e 70 61 74 68 20 6d 79 2d 69 74 65 6d 64  t->path my-itemd
53c0: 61 74 29 29 29 0a 09 09 20 20 20 28 69 66 20 28  at)))...   (if (
53d0: 74 65 73 74 73 3a 6d 61 74 63 68 20 74 65 73 74  tests:match test
53e0: 2d 70 61 74 74 73 20 68 65 64 20 6d 79 2d 69 74  -patts hed my-it
53f0: 65 6d 2d 70 61 74 68 29 20 3b 3b 20 28 70 61 74  em-path) ;; (pat
5400: 74 2d 6c 69 73 74 2d 6d 61 74 63 68 20 6d 79 2d  t-list-match my-
5410: 69 74 65 6d 2d 70 61 74 68 20 69 74 65 6d 2d 70  item-path item-p
5420: 61 74 74 73 29 20 20 20 20 20 20 20 20 20 20 20  atts)           
5430: 3b 3b 20 79 65 73 2c 20 77 65 20 77 61 6e 74 20  ;; yes, we want 
5440: 74 6f 20 70 72 6f 63 65 73 73 20 74 68 69 73 20  to process this 
5450: 69 74 65 6d 2c 20 4e 4f 54 45 3a 20 53 68 6f 75  item, NOTE: Shou
5460: 6c 64 20 6e 6f 74 20 6e 65 65 64 20 74 68 69 73  ld not need this
5470: 20 63 68 65 63 6b 20 68 65 72 65 21 0a 09 09 20   check here!... 
5480: 20 20 20 20 20 20 28 6c 65 74 20 28 28 6e 65 77        (let ((new
5490: 74 65 73 74 6e 61 6d 65 20 28 72 75 6e 73 3a 6d  testname (runs:m
54a0: 61 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61  ake-full-test-na
54b0: 6d 65 20 68 65 64 20 6d 79 2d 69 74 65 6d 2d 70  me hed my-item-p
54c0: 61 74 68 29 29 29 20 20 20 20 3b 3b 20 74 65 73  ath)))    ;; tes
54d0: 74 20 6e 61 6d 65 73 20 61 72 65 20 75 6e 69 71  t names are uniq
54e0: 75 65 20 6f 6e 20 74 65 73 74 6e 61 6d 65 2f 69  ue on testname/i
54f0: 74 65 6d 2d 70 61 74 68 0a 09 09 09 20 28 74 65  tem-path.... (te
5500: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65  sts:testqueue-se
5510: 74 2d 69 74 65 6d 73 21 20 20 20 20 20 6e 65 77  t-items!     new
5520: 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 23 66 29  -test-record #f)
5530: 0a 09 09 09 20 28 74 65 73 74 73 3a 74 65 73 74  .... (tests:test
5540: 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 64 61  queue-set-itemda
5550: 74 21 20 20 20 6e 65 77 2d 74 65 73 74 2d 72 65  t!   new-test-re
5560: 63 6f 72 64 20 6d 79 2d 69 74 65 6d 64 61 74 29  cord my-itemdat)
5570: 0a 09 09 09 20 28 74 65 73 74 73 3a 74 65 73 74  .... (tests:test
5580: 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 5f 70  queue-set-item_p
5590: 61 74 68 21 20 6e 65 77 2d 74 65 73 74 2d 72 65  ath! new-test-re
55a0: 63 6f 72 64 20 6d 79 2d 69 74 65 6d 2d 70 61 74  cord my-item-pat
55b0: 68 29 0a 09 09 09 20 28 68 61 73 68 2d 74 61 62  h).... (hash-tab
55c0: 6c 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 63  le-set! test-rec
55d0: 6f 72 64 73 20 6e 65 77 74 65 73 74 6e 61 6d 65  ords newtestname
55e0: 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64   new-test-record
55f0: 29 0a 09 09 09 20 28 73 65 74 21 20 74 61 6c 20  ).... (set! tal 
5600: 28 63 6f 6e 73 20 6e 65 77 74 65 73 74 6e 61 6d  (cons newtestnam
5610: 65 20 74 61 6c 29 29 29 29 29 29 20 3b 3b 20 73  e tal)))))) ;; s
5620: 69 6e 63 65 20 74 68 65 73 65 20 61 72 65 20 69  ince these are i
5630: 74 65 6d 69 7a 65 64 20 63 72 65 61 74 65 20 6e  temized create n
5640: 65 77 20 74 65 73 74 20 6e 61 6d 65 73 20 74 65  ew test names te
5650: 73 74 6e 61 6d 65 2f 69 74 65 6d 70 61 74 68 0a  stname/itempath.
5660: 09 20 20 20 20 20 20 20 69 74 65 6d 73 29 0a 09  .       items)..
5670: 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28        (if (not (
5680: 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 20 20  null? tal))...  
5690: 28 62 65 67 69 6e 0a 09 09 20 20 20 20 28 64 65  (begin...    (de
56a0: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34  bug:print-info 4
56b0: 20 22 45 6e 64 20 6f 66 20 69 74 65 6d 73 20 6c   "End of items l
56c0: 69 73 74 2c 20 6c 6f 6f 70 69 6e 67 20 77 69 74  ist, looping wit
56d0: 68 20 6e 65 78 74 20 61 66 74 65 72 20 73 68 6f  h next after sho
56e0: 72 74 20 64 65 6c 61 79 22 29 0a 09 09 20 20 20  rt delay")...   
56f0: 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20   (thread-sleep! 
5700: 28 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d  (+ 0.01 *global-
5710: 64 65 6c 74 61 2a 29 29 0a 09 09 20 20 20 20 28  delta*))...    (
5720: 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63  loop (car tal)(c
5730: 64 72 20 74 61 6c 29 20 72 65 72 75 6e 73 29 29  dr tal) reruns))
5740: 29 29 0a 0a 09 20 20 20 20 20 3b 3b 20 69 66 20  ))...     ;; if 
5750: 69 74 65 6d 73 20 69 73 20 61 20 70 72 6f 63 20  items is a proc 
5760: 74 68 65 6e 20 6e 65 65 64 20 74 6f 20 72 75 6e  then need to run
5770: 20 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73   items:get-items
5780: 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 2c 20 67 65  -from-config, ge
5790: 74 20 74 68 65 20 6c 69 73 74 20 61 6e 64 20 6c  t the list and l
57a0: 6f 6f 70 20 0a 09 20 20 20 20 20 3b 3b 20 20 20  oop ..     ;;   
57b0: 20 2d 20 62 75 74 20 6f 6e 6c 79 20 64 6f 20 74   - but only do t
57c0: 68 61 74 20 69 66 20 72 65 73 6f 75 72 63 65 73  hat if resources
57d0: 20 65 78 69 73 74 20 74 6f 20 6b 69 63 6b 20 6f   exist to kick o
57e0: 66 66 20 74 68 65 20 6a 6f 62 0a 09 20 20 20 20  ff the job..    
57f0: 20 28 28 6f 72 20 28 70 72 6f 63 65 64 75 72 65   ((or (procedure
5800: 3f 20 69 74 65 6d 73 29 28 65 71 3f 20 69 74 65  ? items)(eq? ite
5810: 6d 73 20 27 68 61 76 65 2d 70 72 6f 63 65 64 75  ms 'have-procedu
5820: 72 65 29 29 0a 09 20 20 20 20 20 20 28 6c 65 74  re))..      (let
5830: 20 28 28 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 20   ((can-run-more 
5840: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f     (open-run-clo
5850: 73 65 20 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d  se runs:can-run-
5860: 6d 6f 72 65 2d 74 65 73 74 73 20 23 66 20 74 65  more-tests #f te
5870: 73 74 2d 72 65 63 6f 72 64 29 29 29 0a 09 09 28  st-record)))...(
5880: 69 66 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 0a  if can-run-more.
5890: 09 09 20 20 20 20 28 6c 65 74 2a 20 28 28 70 72  ..    (let* ((pr
58a0: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 28 6f  ereqs-not-met (o
58b0: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62  pen-run-close db
58c0: 3a 67 65 74 2d 70 72 65 72 65 71 73 2d 6e 6f 74  :get-prereqs-not
58d0: 2d 6d 65 74 20 23 66 20 72 75 6e 2d 69 64 20 77  -met #f run-id w
58e0: 61 69 74 6f 6e 73 20 69 74 65 6d 2d 70 61 74 68  aitons item-path
58f0: 20 6d 6f 64 65 3a 20 74 65 73 74 6d 6f 64 65 29   mode: testmode)
5900: 29 0a 09 09 09 20 20 20 28 66 61 69 6c 73 20 20  )....   (fails  
5910: 20 20 20 20 20 20 20 20 20 28 72 75 6e 73 3a 63           (runs:c
5920: 61 6c 63 2d 66 61 69 6c 73 20 70 72 65 72 65 71  alc-fails prereq
5930: 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 09 09 09 20  s-not-met)).... 
5940: 20 20 28 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64    (non-completed
5950: 20 20 20 28 72 75 6e 73 3a 63 61 6c 63 2d 6e 6f     (runs:calc-no
5960: 74 2d 63 6f 6d 70 6c 65 74 65 64 20 70 72 65 72  t-completed prer
5970: 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a 09  eqs-not-met)))..
5980: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72  .      (debug:pr
5990: 69 6e 74 2d 69 6e 66 6f 20 38 20 22 63 61 6e 2d  int-info 8 "can-
59a0: 72 75 6e 2d 6d 6f 72 65 3a 20 22 20 63 61 6e 2d  run-more: " can-
59b0: 72 75 6e 2d 6d 6f 72 65 0a 09 09 09 09 20 20 20  run-more.....   
59c0: 22 5c 6e 20 74 65 73 74 6e 61 6d 65 3a 20 20 20  "\n testname:   
59d0: 20 20 20 20 20 22 20 68 65 64 0a 09 09 09 09 20       " hed..... 
59e0: 20 20 22 5c 6e 20 70 72 65 72 65 71 73 2d 6e 6f    "\n prereqs-no
59f0: 74 2d 6d 65 74 3a 20 22 20 28 72 75 6e 73 3a 70  t-met: " (runs:p
5a00: 72 65 74 74 79 2d 73 74 72 69 6e 67 20 70 72 65  retty-string pre
5a10: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09  reqs-not-met)...
5a20: 09 09 20 20 20 22 5c 6e 20 6e 6f 6e 2d 63 6f 6d  ..   "\n non-com
5a30: 70 6c 65 74 65 64 3a 20 20 20 22 20 28 72 75 6e  pleted:   " (run
5a40: 73 3a 70 72 65 74 74 79 2d 73 74 72 69 6e 67 20  s:pretty-string 
5a50: 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 20 0a  non-completed) .
5a60: 09 09 09 09 20 20 20 22 5c 6e 20 66 61 69 6c 73  ....   "\n fails
5a70: 3a 20 20 20 20 20 20 20 20 20 20 20 22 20 28 72  :           " (r
5a80: 75 6e 73 3a 70 72 65 74 74 79 2d 73 74 72 69 6e  uns:pretty-strin
5a90: 67 20 66 61 69 6c 73 29 0a 09 09 09 09 20 20 20  g fails).....   
5aa0: 22 5c 6e 20 74 65 73 74 6d 6f 64 65 3a 20 20 20  "\n testmode:   
5ab0: 20 20 20 20 20 22 20 74 65 73 74 6d 6f 64 65 0a       " testmode.
5ac0: 09 09 09 09 20 20 20 22 5c 6e 20 6e 75 6d 2d 72  ....   "\n num-r
5ad0: 65 74 72 69 65 73 3a 20 20 20 20 20 22 20 6e 75  etries:     " nu
5ae0: 6d 2d 72 65 74 72 69 65 73 0a 09 09 09 09 20 20  m-retries.....  
5af0: 20 22 5c 6e 20 28 65 71 3f 20 74 65 73 74 6d 6f   "\n (eq? testmo
5b00: 64 65 20 27 74 6f 70 6c 65 76 65 6c 29 3a 20 22  de 'toplevel): "
5b10: 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27   (eq? testmode '
5b20: 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09 20 20  toplevel).....  
5b30: 20 22 5c 6e 20 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d   "\n (null? non-
5b40: 63 6f 6d 70 6c 65 74 65 64 29 3a 20 20 20 20 22  completed):    "
5b50: 20 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70   (null? non-comp
5b60: 6c 65 74 65 64 29 0a 09 09 09 09 20 20 20 22 5c  leted).....   "\
5b70: 6e 20 72 65 72 75 6e 73 3a 20 20 20 20 20 20 20  n reruns:       
5b80: 20 20 20 22 20 72 65 72 75 6e 73 0a 09 09 09 09     " reruns.....
5b90: 20 20 20 22 5c 6e 20 69 74 65 6d 73 3a 20 20 20     "\n items:   
5ba0: 20 20 20 20 20 20 20 20 22 20 69 74 65 6d 73 0a          " items.
5bb0: 09 09 09 09 20 20 20 22 5c 6e 20 63 61 6e 2d 72  ....   "\n can-r
5bc0: 75 6e 2d 6d 6f 72 65 3a 20 20 20 20 22 20 63 61  un-more:    " ca
5bd0: 6e 2d 72 75 6e 2d 6d 6f 72 65 29 0a 09 09 20 20  n-run-more)...  
5be0: 20 20 20 20 3b 3b 20 28 74 68 72 65 61 64 2d 73      ;; (thread-s
5bf0: 6c 65 65 70 21 20 28 2b 20 30 2e 30 31 20 2a 67  leep! (+ 0.01 *g
5c00: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09  lobal-delta*))..
5c10: 09 20 20 20 20 20 20 28 63 6f 6e 64 20 3b 3b 20  .      (cond ;; 
5c20: 49 4e 4e 45 52 20 43 4f 4e 44 20 23 32 0a 09 09  INNER COND #2...
5c30: 20 20 20 20 20 20 20 28 28 6f 72 20 28 6e 75 6c         ((or (nul
5c40: 6c 3f 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d  l? prereqs-not-m
5c50: 65 74 29 20 3b 3b 20 61 6c 6c 20 70 72 65 72 65  et) ;; all prere
5c60: 71 73 20 6d 65 74 2c 20 66 69 72 65 20 6f 66 66  qs met, fire off
5c70: 20 74 68 65 20 74 65 73 74 0a 09 09 09 20 20 20   the test....   
5c80: 20 3b 3b 20 6f 72 2c 20 69 66 20 69 74 20 69 73   ;; or, if it is
5c90: 20 61 20 27 74 6f 70 6c 65 76 65 6c 20 74 65 73   a 'toplevel tes
5ca0: 74 20 61 6e 64 20 61 6c 6c 20 70 72 65 72 65 71  t and all prereq
5cb0: 73 20 6e 6f 74 20 6d 65 74 20 61 72 65 20 43 4f  s not met are CO
5cc0: 4d 50 4c 45 54 45 44 20 74 68 65 6e 20 6c 61 75  MPLETED then lau
5cd0: 6e 63 68 0a 09 09 09 20 20 20 20 28 61 6e 64 20  nch....    (and 
5ce0: 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 74  (eq? testmode 't
5cf0: 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09 20 28 6e  oplevel)..... (n
5d00: 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74  ull? non-complet
5d10: 65 64 29 29 29 0a 09 09 09 28 6c 65 74 20 28 28  ed)))....(let ((
5d20: 74 65 73 74 2d 6e 61 6d 65 20 28 74 65 73 74 73  test-name (tests
5d30: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74  :testqueue-get-t
5d40: 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63  estname test-rec
5d50: 6f 72 64 29 29 29 0a 09 09 09 20 20 28 73 65 74  ord)))....  (set
5d60: 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d  env "MT_TEST_NAM
5d70: 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b  E" test-name) ;;
5d80: 20 0a 09 09 09 20 20 28 73 65 74 65 6e 76 20 22   ....  (setenv "
5d90: 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20 72 75  MT_RUNNAME"   ru
5da0: 6e 6e 61 6d 65 29 0a 09 09 09 20 20 28 6f 70 65  nname)....  (ope
5db0: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 73 65 74 2d  n-run-close set-
5dc0: 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72  megatest-env-var
5dd0: 73 20 23 66 20 72 75 6e 2d 69 64 29 20 3b 3b 20  s #f run-id) ;; 
5de0: 74 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65  these may be nee
5df0: 64 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63  ded by the launc
5e00: 68 69 6e 67 20 70 72 6f 63 65 73 73 0a 09 09 09  hing process....
5e10: 20 20 28 6c 65 74 20 28 28 69 74 65 6d 73 2d 6c    (let ((items-l
5e20: 69 73 74 20 28 69 74 65 6d 73 3a 67 65 74 2d 69  ist (items:get-i
5e30: 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67  tems-from-config
5e40: 20 74 63 6f 6e 66 69 67 29 29 29 0a 09 09 09 20   tconfig))).... 
5e50: 20 20 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74     (if (list? it
5e60: 65 6d 73 2d 6c 69 73 74 29 0a 09 09 09 09 28 62  ems-list).....(b
5e70: 65 67 69 6e 0a 09 09 09 09 20 20 28 74 65 73 74  egin.....  (test
5e80: 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d  s:testqueue-set-
5e90: 69 74 65 6d 73 21 20 74 65 73 74 2d 72 65 63 6f  items! test-reco
5ea0: 72 64 20 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09  rd items-list)..
5eb0: 09 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65  ...  (thread-sle
5ec0: 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74  ep! *global-delt
5ed0: 61 2a 29 0a 09 09 09 09 20 20 28 6c 6f 6f 70 20  a*).....  (loop 
5ee0: 68 65 64 20 74 61 6c 20 72 65 72 75 6e 73 29 29  hed tal reruns))
5ef0: 0a 09 09 09 09 28 62 65 67 69 6e 0a 09 09 09 09  .....(begin.....
5f00: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
5f10: 20 22 45 52 52 4f 52 3a 20 54 68 65 20 70 72 6f   "ERROR: The pro
5f20: 63 20 66 72 6f 6d 20 72 65 61 64 69 6e 67 20 74  c from reading t
5f30: 68 65 20 73 65 74 75 70 20 64 69 64 20 6e 6f 74  he setup did not
5f40: 20 79 69 65 6c 64 20 61 20 6c 69 73 74 20 2d 20   yield a list - 
5f50: 70 6c 65 61 73 65 20 72 65 70 6f 72 74 20 74 68  please report th
5f60: 69 73 22 29 0a 09 09 09 09 20 20 28 65 78 69 74  is").....  (exit
5f70: 20 31 29 29 29 29 29 29 0a 09 09 20 20 20 20 20   1))))))...     
5f80: 20 20 28 28 6e 75 6c 6c 3f 20 66 61 69 6c 73 29    ((null? fails)
5f90: 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74  ....(debug:print
5fa0: 2d 69 6e 66 6f 20 34 20 22 66 61 69 6c 73 20 69  -info 4 "fails i
5fb0: 73 20 6e 75 6c 6c 2c 20 6d 6f 76 69 6e 67 20 6f  s null, moving o
5fc0: 6e 20 69 6e 20 74 68 65 20 71 75 65 75 65 20 62  n in the queue b
5fd0: 75 74 20 6b 65 65 70 69 6e 67 20 22 20 68 65 64  ut keeping " hed
5fe0: 20 22 20 66 6f 72 20 6e 6f 77 22 29 0a 09 09 09   " for now")....
5ff0: 3b 3b 20 6f 6e 6c 79 20 69 6e 63 72 65 6d 65 6e  ;; only incremen
6000: 74 20 6e 75 6d 2d 72 65 74 72 69 65 73 20 77 68  t num-retries wh
6010: 65 6e 20 74 68 65 72 65 20 61 72 65 20 6e 6f 20  en there are no 
6020: 74 65 73 74 73 20 72 75 6e 69 6e 67 0a 09 09 09  tests runing....
6030: 28 69 66 20 28 65 71 3f 20 30 20 28 6c 69 73 74  (if (eq? 0 (list
6040: 2d 72 65 66 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72  -ref can-run-mor
6050: 65 20 31 29 29 0a 09 09 09 20 20 20 20 28 62 65  e 1))....    (be
6060: 67 69 6e 0a 09 09 09 20 20 20 20 20 20 28 69 66  gin....      (if
6070: 20 28 3e 20 6e 75 6d 2d 72 65 74 72 69 65 73 20   (> num-retries 
6080: 31 30 30 29 20 3b 3b 20 66 69 72 73 74 20 31 30  100) ;; first 10
6090: 30 20 72 65 74 72 69 65 73 20 61 72 65 20 6c 6f  0 retries are lo
60a0: 77 20 74 69 6d 65 20 63 6f 73 74 0a 09 09 09 09  w time cost.....
60b0: 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21    (thread-sleep!
60c0: 20 28 2b 20 32 20 2a 67 6c 6f 62 61 6c 2d 64 65   (+ 2 *global-de
60d0: 6c 74 61 2a 29 29 0a 09 09 09 09 20 20 28 74 68  lta*)).....  (th
60e0: 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 30  read-sleep! (+ 0
60f0: 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74  .01 *global-delt
6100: 61 2a 29 29 29 0a 09 09 09 20 20 20 20 20 20 28  a*)))....      (
6110: 73 65 74 21 20 6e 75 6d 2d 72 65 74 72 69 65 73  set! num-retries
6120: 20 28 2b 20 6e 75 6d 2d 72 65 74 72 69 65 73 20   (+ num-retries 
6130: 31 29 29 29 29 0a 09 09 09 28 69 66 20 28 3e 20  1))))....(if (> 
6140: 6e 75 6d 2d 72 65 74 72 69 65 73 20 20 6d 61 78  num-retries  max
6150: 2d 72 65 74 72 69 65 73 29 0a 09 09 09 20 20 20  -retries)....   
6160: 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f   (if (not (null?
6170: 20 74 61 6c 29 29 0a 09 09 09 09 28 6c 6f 6f 70   tal)).....(loop
6180: 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74   (car tal)(cdr t
6190: 61 6c 29 20 72 65 72 75 6e 73 29 29 0a 09 09 09  al) reruns))....
61a0: 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e      (loop (car n
61b0: 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61  ewtal)(cdr newta
61c0: 6c 29 20 72 65 72 75 6e 73 29 29 29 20 3b 3b 20  l) reruns))) ;; 
61d0: 61 6e 20 69 73 73 75 65 20 77 69 74 68 20 70 72  an issue with pr
61e0: 65 72 65 71 73 20 6e 6f 74 20 79 65 74 20 6d 65  ereqs not yet me
61f0: 74 3f 0a 09 09 20 20 20 20 20 20 20 28 28 61 6e  t?...       ((an
6200: 64 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 66 61  d (not (null? fa
6210: 69 6c 73 29 29 28 65 71 3f 20 74 65 73 74 6d 6f  ils))(eq? testmo
6220: 64 65 20 27 6e 6f 72 6d 61 6c 29 29 0a 09 09 09  de 'normal))....
6230: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
6240: 6f 20 31 20 22 74 65 73 74 20 22 20 20 68 65 64  o 1 "test "  hed
6250: 20 22 20 28 6d 6f 64 65 3d 22 20 74 65 73 74 6d   " (mode=" testm
6260: 6f 64 65 20 22 29 20 68 61 73 20 66 61 69 6c 65  ode ") has faile
6270: 64 20 70 72 65 72 65 71 75 69 73 69 74 65 28 73  d prerequisite(s
6280: 29 3b 20 22 0a 09 09 09 09 20 20 20 20 20 28 73  ); ".....     (s
6290: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73  tring-interspers
62a0: 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28  e (map (lambda (
62b0: 74 29 28 63 6f 6e 63 20 28 64 62 3a 74 65 73 74  t)(conc (db:test
62c0: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 29  -get-testname t)
62d0: 20 22 3a 22 20 28 64 62 3a 74 65 73 74 2d 67 65   ":" (db:test-ge
62e0: 74 2d 73 74 61 74 65 20 74 29 22 2f 22 28 64 62  t-state t)"/"(db
62f0: 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73  :test-get-status
6300: 20 74 29 29 29 20 66 61 69 6c 73 29 20 22 2c 20   t))) fails) ", 
6310: 22 29 0a 09 09 09 09 20 20 20 20 20 22 2c 20 72  ").....     ", r
6320: 65 6d 6f 76 69 6e 67 20 69 74 20 66 72 6f 6d 20  emoving it from 
6330: 74 6f 2d 64 6f 20 6c 69 73 74 22 29 0a 09 09 09  to-do list")....
6340: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20  (if (not (null? 
6350: 74 61 6c 29 29 0a 09 09 09 20 20 20 20 28 62 65  tal))....    (be
6360: 67 69 6e 0a 09 09 09 20 20 20 20 20 20 28 74 68  gin....      (th
6370: 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f  read-sleep! *glo
6380: 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 09 20  bal-delta*).... 
6390: 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20       (loop (car 
63a0: 74 61 6c 29 28 63 64 72 20 74 61 6c 29 28 63 6f  tal)(cdr tal)(co
63b0: 6e 73 20 68 65 64 20 72 65 72 75 6e 73 29 29 29  ns hed reruns)))
63c0: 29 29 0a 09 09 20 20 20 20 20 20 20 28 65 6c 73  ))...       (els
63d0: 65 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e  e....(debug:prin
63e0: 74 20 38 20 22 45 52 52 4f 52 3a 20 4e 6f 20 68  t 8 "ERROR: No h
63f0: 61 6e 64 6c 65 72 20 66 6f 72 20 74 68 69 73 20  andler for this 
6400: 63 6f 6e 64 69 74 69 6f 6e 2e 22 29 0a 09 09 09  condition.")....
6410: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28  (thread-sleep! (
6420: 2b 20 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74  + 1 *global-delt
6430: 61 2a 29 29 0a 09 09 09 28 6c 6f 6f 70 20 28 63  a*))....(loop (c
6440: 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e  ar newtal)(cdr n
6450: 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29 29 29  ewtal) reruns)))
6460: 29 20 3b 3b 20 45 4e 44 20 4f 46 20 49 46 20 43  ) ;; END OF IF C
6470: 41 4e 20 52 55 4e 20 4d 4f 52 45 0a 0a 09 09 20  AN RUN MORE.... 
6480: 20 20 20 3b 3b 20 69 66 20 63 61 6e 27 74 20 72     ;; if can't r
6490: 75 6e 20 6d 6f 72 65 20 6a 75 73 74 20 6c 6f 6f  un more just loo
64a0: 70 20 77 69 74 68 20 6e 65 78 74 20 70 6f 73 73  p with next poss
64b0: 69 62 6c 65 20 74 65 73 74 0a 09 09 20 20 20 20  ible test...    
64c0: 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20 20 28  (begin...      (
64d0: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
64e0: 20 34 20 22 70 72 6f 63 65 73 73 69 6e 67 20 74   4 "processing t
64f0: 68 65 20 63 61 73 65 20 77 69 74 68 20 61 20 6c  he case with a l
6500: 61 6d 62 64 61 20 66 6f 72 20 69 74 65 6d 73 20  ambda for items 
6510: 6f 72 20 27 68 61 76 65 2d 70 72 6f 63 65 64 75  or 'have-procedu
6520: 72 65 2e 20 4d 6f 76 69 6e 67 20 74 68 72 6f 75  re. Moving throu
6530: 67 68 20 74 68 65 20 71 75 65 75 65 20 77 69 74  gh the queue wit
6540: 68 6f 75 74 20 64 72 6f 70 70 69 6e 67 20 22 20  hout dropping " 
6550: 68 65 64 29 0a 09 09 20 20 20 20 20 20 28 74 68  hed)...      (th
6560: 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 31  read-sleep! (+ 1
6570: 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29   *global-delta*)
6580: 29 0a 09 09 20 20 20 20 20 20 28 6c 6f 6f 70 20  )...      (loop 
6590: 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72  (car newtal)(cdr
65a0: 20 6e 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29   newtal) reruns)
65b0: 29 29 29 29 20 3b 3b 20 45 4e 44 20 4f 46 20 28  )))) ;; END OF (
65c0: 6f 72 20 28 70 72 6f 63 65 64 75 72 65 3f 20 69  or (procedure? i
65d0: 74 65 6d 73 29 28 65 71 3f 20 69 74 65 6d 73 20  tems)(eq? items 
65e0: 27 68 61 76 65 2d 70 72 6f 63 65 64 75 72 65 29  'have-procedure)
65f0: 29 0a 09 20 20 20 20 20 0a 09 20 20 20 20 20 3b  )..     ..     ;
6600: 3b 20 74 68 69 73 20 63 61 73 65 20 73 68 6f 75  ; this case shou
6610: 6c 64 20 6e 6f 74 20 68 61 70 70 65 6e 2c 20 61  ld not happen, a
6620: 64 64 65 64 20 74 6f 20 68 65 6c 70 20 63 61 74  dded to help cat
6630: 63 68 20 61 6e 79 20 62 75 67 73 0a 09 20 20 20  ch any bugs..   
6640: 20 20 28 28 61 6e 64 20 28 6c 69 73 74 3f 20 69    ((and (list? i
6650: 74 65 6d 73 29 20 69 74 65 6d 64 61 74 29 0a 09  tems) itemdat)..
6660: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
6670: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 53 68 6f  nt 0 "ERROR: Sho
6680: 75 6c 64 20 6e 6f 74 20 68 61 76 65 20 61 20 6c  uld not have a l
6690: 69 73 74 20 6f 66 20 69 74 65 6d 73 20 69 6e 20  ist of items in 
66a0: 61 20 74 65 73 74 20 61 6e 64 20 74 68 65 20 69  a test and the i
66b0: 74 65 6d 73 70 61 74 68 20 73 65 74 20 2d 20 70  temspath set - p
66c0: 6c 65 61 73 65 20 72 65 70 6f 72 74 20 74 68 69  lease report thi
66d0: 73 22 29 0a 09 20 20 20 20 20 20 28 65 78 69 74  s")..      (exit
66e0: 20 31 29 29 0a 09 20 20 20 20 20 28 28 6e 6f 74   1))..     ((not
66f0: 20 28 6e 75 6c 6c 3f 20 72 65 72 75 6e 73 29 29   (null? reruns))
6700: 0a 09 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28  ..      (let* ((
6710: 6e 65 77 6c 73 74 20 28 6f 70 65 6e 2d 72 75 6e  newlst (open-run
6720: 2d 63 6c 6f 73 65 20 74 65 73 74 73 3a 66 69 6c  -close tests:fil
6730: 74 65 72 2d 6e 6f 6e 2d 72 75 6e 6e 61 62 6c 65  ter-non-runnable
6740: 20 23 66 20 72 75 6e 2d 69 64 20 74 61 6c 20 74   #f run-id tal t
6750: 65 73 74 2d 72 65 63 6f 72 64 73 29 29 20 3b 3b  est-records)) ;;
6760: 20 69 2e 65 2e 20 6e 6f 74 20 46 41 49 4c 2c 20   i.e. not FAIL, 
6770: 57 41 49 56 45 44 2c 20 49 4e 43 4f 4d 50 4c 45  WAIVED, INCOMPLE
6780: 54 45 2c 20 50 41 53 53 2c 20 4b 49 4c 4c 45 44  TE, PASS, KILLED
6790: 2c 0a 09 09 20 20 20 20 20 28 6a 75 6e 6b 65 64  ,...     (junked
67a0: 20 28 6c 73 65 74 2d 64 69 66 66 65 72 65 6e 63   (lset-differenc
67b0: 65 20 65 71 75 61 6c 3f 20 74 61 6c 20 6e 65 77  e equal? tal new
67c0: 6c 73 74 29 29 29 0a 09 09 28 64 65 62 75 67 3a  lst)))...(debug:
67d0: 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 66 75  print-info 4 "fu
67e0: 6c 6c 20 64 72 6f 70 20 74 68 72 6f 75 67 68 2c  ll drop through,
67f0: 20 69 66 20 72 65 72 75 6e 73 20 69 73 20 6c 65   if reruns is le
6800: 73 73 20 74 68 61 6e 20 31 30 30 20 77 65 20 77  ss than 100 we w
6810: 69 6c 6c 20 66 6f 72 63 65 20 72 65 74 72 79 20  ill force retry 
6820: 74 68 65 6d 2c 20 72 65 72 75 6e 73 3d 22 20 72  them, reruns=" r
6830: 65 72 75 6e 73 20 22 2c 20 74 61 6c 3d 22 20 74  eruns ", tal=" t
6840: 61 6c 29 0a 09 09 28 69 66 20 28 3c 20 6e 75 6d  al)...(if (< num
6850: 2d 72 65 74 72 69 65 73 20 6d 61 78 2d 72 65 74  -retries max-ret
6860: 72 69 65 73 29 0a 09 09 20 20 20 20 28 73 65 74  ries)...    (set
6870: 21 20 6e 65 77 6c 73 74 20 28 61 70 70 65 6e 64  ! newlst (append
6880: 20 72 65 72 75 6e 73 20 6e 65 77 6c 73 74 29 29   reruns newlst))
6890: 29 0a 09 09 28 73 65 74 21 20 6e 75 6d 2d 72 65  )...(set! num-re
68a0: 74 72 69 65 73 20 28 2b 20 6e 75 6d 2d 72 65 74  tries (+ num-ret
68b0: 72 69 65 73 20 31 29 29 0a 09 09 28 74 68 72 65  ries 1))...(thre
68c0: 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 31 20 2a  ad-sleep! (+ 1 *
68d0: 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a  global-delta*)).
68e0: 09 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c  ..(if (not (null
68f0: 3f 20 6e 65 77 6c 73 74 29 29 0a 09 09 20 20 20  ? newlst))...   
6900: 20 3b 3b 20 73 69 6e 63 65 20 72 65 72 75 6e 73   ;; since reruns
6910: 20 68 61 76 65 20 62 65 65 6e 20 74 61 63 6b 65   have been tacke
6920: 64 20 6f 6e 20 74 6f 20 6e 65 77 6c 73 74 20 63  d on to newlst c
6930: 72 65 61 74 65 20 6e 65 77 20 72 65 72 75 6e 73  reate new reruns
6940: 20 66 72 6f 6d 20 6a 75 6e 6b 65 64 0a 09 09 20   from junked... 
6950: 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65     (loop (car ne
6960: 77 6c 73 74 29 28 63 64 72 20 6e 65 77 6c 73 74  wlst)(cdr newlst
6970: 29 28 64 65 6c 65 74 65 2d 64 75 70 6c 69 63 61  )(delete-duplica
6980: 74 65 73 20 6a 75 6e 6b 65 64 29 29 29 29 29 0a  tes junked))))).
6990: 09 20 20 20 20 20 28 28 6e 6f 74 20 28 6e 75 6c  .     ((not (nul
69a0: 6c 3f 20 74 61 6c 29 29 0a 09 20 20 20 20 20 20  l? tal))..      
69b0: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
69c0: 6f 20 34 20 22 49 27 6d 20 70 72 65 74 74 79 20  o 4 "I'm pretty 
69d0: 73 75 72 65 20 49 20 73 68 6f 75 6c 64 6e 27 74  sure I shouldn't
69e0: 20 67 65 74 20 68 65 72 65 2e 22 29 29 0a 09 20   get here.")).. 
69f0: 20 20 20 20 28 65 6c 73 65 0a 09 20 20 20 20 20      (else..     
6a00: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
6a10: 66 6f 20 34 20 22 45 78 69 74 69 6e 67 20 6c 6f  fo 4 "Exiting lo
6a20: 6f 70 20 77 69 74 68 2e 2e 2e 5c 6e 20 20 68 65  op with...\n  he
6a30: 64 3d 22 20 68 65 64 20 22 5c 6e 20 20 74 61 6c  d=" hed "\n  tal
6a40: 3d 22 20 74 61 6c 20 22 5c 6e 20 20 72 65 72 75  =" tal "\n  reru
6a50: 6e 73 3d 22 20 72 65 72 75 6e 73 29 29 0a 09 20  ns=" reruns)).. 
6a60: 20 20 20 20 29 29 29 29 20 3b 3b 20 4c 45 54 2a      )))) ;; LET*
6a70: 20 28 28 74 65 73 74 2d 72 65 63 6f 72 64 0a 0a   ((test-record..
6a80: 20 20 20 20 3b 3b 20 77 65 20 67 65 74 20 68 65      ;; we get he
6a90: 72 65 20 6f 6e 20 22 64 72 6f 70 20 74 68 72 6f  re on "drop thro
6aa0: 75 67 68 22 20 2d 20 6c 6f 6f 70 20 66 6f 72 20  ugh" - loop for 
6ab0: 6e 65 78 74 20 74 65 73 74 20 69 6e 20 71 75 65  next test in que
6ac0: 75 65 0a 20 20 20 20 3b 3b 20 46 49 58 4d 45 21  ue.    ;; FIXME!
6ad0: 21 21 21 20 54 48 49 53 20 53 48 4f 55 4c 44 20  !!! THIS SHOULD 
6ae0: 4e 4f 54 20 52 45 51 55 49 52 45 20 41 4e 20 45  NOT REQUIRE AN E
6af0: 58 49 54 21 21 21 21 21 21 21 0a 20 20 20 20 0a  XIT!!!!!!!.    .
6b00: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
6b10: 2d 69 6e 66 6f 20 31 20 22 41 6c 6c 20 74 65 73  -info 1 "All tes
6b20: 74 73 20 6c 61 75 6e 63 68 65 64 22 29 0a 20 20  ts launched").  
6b30: 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21    (thread-sleep!
6b40: 20 30 2e 35 29 0a 20 20 20 20 3b 3b 20 46 49 58   0.5).    ;; FIX
6b50: 4d 45 21 20 54 68 69 73 20 68 61 72 73 68 20 65  ME! This harsh e
6b60: 78 69 74 20 73 68 6f 75 6c 64 20 6e 6f 74 20 62  xit should not b
6b70: 65 20 6e 65 63 65 73 73 61 72 79 2e 2e 2e 2e 0a  e necessary.....
6b80: 20 20 20 20 3b 3b 20 28 69 66 20 28 6e 6f 74 20      ;; (if (not 
6b90: 2a 72 75 6e 72 65 6d 6f 74 65 2a 29 28 65 78 69  *runremote*)(exi
6ba0: 74 29 29 20 3b 3b 20 0a 20 20 20 20 23 66 29 29  t)) ;; .    #f))
6bb0: 20 3b 3b 20 72 65 74 75 72 6e 20 61 20 23 66 20   ;; return a #f 
6bc0: 61 73 20 61 20 68 69 6e 74 20 74 68 61 74 20 77  as a hint that w
6bd0: 65 20 61 72 65 20 64 6f 6e 65 0a 20 20 3b 3b 20  e are done.  ;; 
6be0: 48 65 72 65 20 77 65 20 6e 65 65 64 20 74 6f 20  Here we need to 
6bf0: 63 68 65 63 6b 20 74 68 61 74 20 61 6c 6c 20 74  check that all t
6c00: 68 65 20 74 65 73 74 73 20 72 65 6d 61 69 6e 69  he tests remaini
6c10: 6e 67 20 74 6f 20 62 65 20 72 75 6e 20 61 72 65  ng to be run are
6c20: 20 65 6c 69 67 69 62 6c 65 20 74 6f 20 72 75 6e   eligible to run
6c30: 0a 20 20 3b 3b 20 61 6e 64 20 61 72 65 20 6e 6f  .  ;; and are no
6c40: 74 20 62 6c 6f 63 6b 65 64 20 62 79 20 66 61 69  t blocked by fai
6c50: 6c 65 64 0a 20 20 0a 0a 3b 3b 20 70 61 72 65 6e  led.  ..;; paren
6c60: 74 2d 74 65 73 74 20 69 73 20 74 68 65 72 65 20  t-test is there 
6c70: 61 73 20 61 20 70 6c 61 63 65 68 6f 6c 64 65 72  as a placeholder
6c80: 20 66 6f 72 20 77 68 65 6e 20 70 61 72 65 6e 74   for when parent
6c90: 2d 74 65 73 74 73 20 63 61 6e 20 62 65 20 72 75  -tests can be ru
6ca0: 6e 20 61 73 20 61 20 73 65 74 75 70 20 73 74 65  n as a setup ste
6cb0: 70 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 3a 74  p.(define (run:t
6cc0: 65 73 74 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61  est run-id runna
6cd0: 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 73  me keyvallst tes
6ce0: 74 2d 72 65 63 6f 72 64 20 66 6c 61 67 73 20 70  t-record flags p
6cf0: 61 72 65 6e 74 2d 74 65 73 74 29 0a 20 20 3b 3b  arent-test).  ;;
6d00: 20 41 6c 6c 20 74 68 65 73 65 20 76 61 72 73 20   All these vars 
6d10: 6d 69 67 68 74 20 62 65 20 72 65 66 65 72 65 6e  might be referen
6d20: 63 65 64 20 62 79 20 74 68 65 20 74 65 73 74 63  ced by the testc
6d30: 6f 6e 66 69 67 20 66 69 6c 65 20 72 65 61 64 65  onfig file reade
6d40: 72 0a 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74  r.  (let* ((test
6d50: 2d 6e 61 6d 65 20 20 20 20 28 74 65 73 74 73 3a  -name    (tests:
6d60: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65  testqueue-get-te
6d70: 73 74 6e 61 6d 65 20 20 20 74 65 73 74 2d 72 65  stname   test-re
6d80: 63 6f 72 64 29 29 0a 09 20 28 74 65 73 74 2d 77  cord)).. (test-w
6d90: 61 69 74 6f 6e 73 20 28 74 65 73 74 73 3a 74 65  aitons (tests:te
6da0: 73 74 71 75 65 75 65 2d 67 65 74 2d 77 61 69 74  stqueue-get-wait
6db0: 6f 6e 73 20 20 20 20 74 65 73 74 2d 72 65 63 6f  ons    test-reco
6dc0: 72 64 29 29 0a 09 20 28 74 65 73 74 2d 63 6f 6e  rd)).. (test-con
6dd0: 66 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74  f    (tests:test
6de0: 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 63 6f  queue-get-testco
6df0: 6e 66 69 67 20 74 65 73 74 2d 72 65 63 6f 72 64  nfig test-record
6e00: 29 29 0a 09 20 28 69 74 65 6d 64 61 74 20 20 20  )).. (itemdat   
6e10: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75     (tests:testqu
6e20: 65 75 65 2d 67 65 74 2d 69 74 65 6d 64 61 74 20  eue-get-itemdat 
6e30: 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29     test-record))
6e40: 0a 09 20 28 74 65 73 74 2d 70 61 74 68 20 20 20  .. (test-path   
6e50: 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a   (conc *toppath*
6e60: 20 22 2f 74 65 73 74 73 2f 22 20 74 65 73 74 2d   "/tests/" test-
6e70: 6e 61 6d 65 29 29 20 3b 3b 20 63 6f 75 6c 64 20  name)) ;; could 
6e80: 75 73 65 20 74 65 73 74 73 3a 67 65 74 2d 74 65  use tests:get-te
6e90: 73 74 63 6f 6e 66 69 67 20 68 65 72 65 20 2e 2e  stconfig here ..
6ea0: 2e 0a 09 20 28 66 6f 72 63 65 20 20 20 20 20 20  ... (force      
6eb0: 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65    (hash-table-re
6ec0: 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20  f/default flags 
6ed0: 22 2d 66 6f 72 63 65 22 20 23 66 29 29 0a 09 20  "-force" #f)).. 
6ee0: 28 72 65 72 75 6e 20 20 20 20 20 20 20 20 28 68  (rerun        (h
6ef0: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65  ash-table-ref/de
6f00: 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 72 65  fault flags "-re
6f10: 72 75 6e 22 20 23 66 29 29 0a 09 20 28 6b 65 65  run" #f)).. (kee
6f20: 70 67 6f 69 6e 67 20 20 20 20 28 68 61 73 68 2d  pgoing    (hash-
6f30: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c  table-ref/defaul
6f40: 74 20 66 6c 61 67 73 20 22 2d 6b 65 65 70 67 6f  t flags "-keepgo
6f50: 69 6e 67 22 20 23 66 29 29 0a 09 20 28 69 74 65  ing" #f)).. (ite
6f60: 6d 2d 70 61 74 68 20 20 20 20 20 22 22 29 0a 09  m-path     "")..
6f70: 20 28 64 62 20 20 20 20 20 20 20 20 20 20 20 23   (db           #
6f80: 66 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70  f)).    (debug:p
6f90: 72 69 6e 74 20 34 0a 09 09 20 22 74 65 73 74 2d  rint 4... "test-
6fa0: 63 6f 6e 66 69 67 3a 20 22 20 28 68 61 73 68 2d  config: " (hash-
6fb0: 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65 73  table->alist tes
6fc0: 74 2d 63 6f 6e 66 29 0a 09 09 20 22 5c 6e 20 20  t-conf)... "\n  
6fd0: 20 69 74 65 6d 64 61 74 3a 20 22 20 69 74 65 6d   itemdat: " item
6fe0: 64 61 74 0a 09 09 20 29 0a 20 20 20 20 3b 3b 20  dat... ).    ;; 
6ff0: 73 65 74 74 69 6e 67 20 69 74 65 6d 64 61 74 20  setting itemdat 
7000: 74 6f 20 61 20 6c 69 73 74 20 69 66 20 69 74 20  to a list if it 
7010: 69 73 20 23 66 0a 20 20 20 20 28 69 66 20 28 6e  is #f.    (if (n
7020: 6f 74 20 69 74 65 6d 64 61 74 29 28 73 65 74 21  ot itemdat)(set!
7030: 20 69 74 65 6d 64 61 74 20 27 28 29 29 29 0a 20   itemdat '())). 
7040: 20 20 20 28 73 65 74 21 20 69 74 65 6d 2d 70 61     (set! item-pa
7050: 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70  th (item-list->p
7060: 61 74 68 20 69 74 65 6d 64 61 74 29 29 0a 20 20  ath itemdat)).  
7070: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32    (debug:print 2
7080: 20 22 41 74 74 65 6d 70 74 69 6e 67 20 74 6f 20   "Attempting to 
7090: 6c 61 75 6e 63 68 20 74 65 73 74 20 22 20 74 65  launch test " te
70a0: 73 74 2d 6e 61 6d 65 20 28 69 66 20 28 65 71 75  st-name (if (equ
70b0: 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 2f  al? item-path "/
70c0: 22 29 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68  ") "/" item-path
70d0: 29 29 0a 20 20 20 20 28 73 65 74 65 6e 76 20 22  )).    (setenv "
70e0: 4d 54 5f 54 45 53 54 5f 4e 41 4d 45 22 20 74 65  MT_TEST_NAME" te
70f0: 73 74 2d 6e 61 6d 65 29 20 3b 3b 20 0a 20 20 20  st-name) ;; .   
7100: 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e   (setenv "MT_RUN
7110: 4e 41 4d 45 22 20 20 20 72 75 6e 6e 61 6d 65 29  NAME"   runname)
7120: 0a 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63  .    (open-run-c
7130: 6c 6f 73 65 20 73 65 74 2d 6d 65 67 61 74 65 73  lose set-megates
7140: 74 2d 65 6e 76 2d 76 61 72 73 20 64 62 20 72 75  t-env-vars db ru
7150: 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73 65 20 6d  n-id) ;; these m
7160: 61 79 20 62 65 20 6e 65 65 64 65 64 20 62 79 20  ay be needed by 
7170: 74 68 65 20 6c 61 75 6e 63 68 69 6e 67 20 70 72  the launching pr
7180: 6f 63 65 73 73 0a 20 20 20 20 28 63 68 61 6e 67  ocess.    (chang
7190: 65 2d 64 69 72 65 63 74 6f 72 79 20 2a 74 6f 70  e-directory *top
71a0: 70 61 74 68 2a 29 0a 0a 20 20 20 20 3b 3b 20 48  path*)..    ;; H
71b0: 65 72 65 20 69 73 20 77 68 65 72 65 20 74 68 65  ere is where the
71c0: 20 74 65 73 74 5f 6d 65 74 61 20 74 61 62 6c 65   test_meta table
71d0: 20 69 73 20 62 65 73 74 20 75 70 64 61 74 65 64   is best updated
71e0: 0a 20 20 20 20 3b 3b 20 59 65 73 2c 20 61 6e 6f  .    ;; Yes, ano
71f0: 74 68 65 72 20 75 73 65 20 6f 66 20 61 20 67 6c  ther use of a gl
7200: 6f 62 61 6c 20 66 6f 72 20 63 61 63 68 69 6e 67  obal for caching
7210: 2e 20 4e 65 65 64 20 61 20 62 65 74 74 65 72 20  . Need a better 
7220: 77 61 79 3f 0a 20 20 20 20 28 69 66 20 28 6e 6f  way?.    (if (no
7230: 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65  t (hash-table-re
7240: 66 2f 64 65 66 61 75 6c 74 20 2a 74 65 73 74 2d  f/default *test-
7250: 6d 65 74 61 2d 75 70 64 61 74 65 64 2a 20 74 65  meta-updated* te
7260: 73 74 2d 6e 61 6d 65 20 23 66 29 29 0a 20 20 20  st-name #f)).   
7270: 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20       (begin..   
7280: 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21  (hash-table-set!
7290: 20 2a 74 65 73 74 2d 6d 65 74 61 2d 75 70 64 61   *test-meta-upda
72a0: 74 65 64 2a 20 74 65 73 74 2d 6e 61 6d 65 20 23  ted* test-name #
72b0: 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 6f  t).           (o
72c0: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75  pen-run-close ru
72d0: 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d  ns:update-test_m
72e0: 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65  eta db test-name
72f0: 20 74 65 73 74 2d 63 6f 6e 66 29 29 29 0a 20 20   test-conf))).  
7300: 20 20 0a 20 20 20 20 3b 3b 20 28 6c 61 6d 62 64    .    ;; (lambd
7310: 61 20 28 69 74 65 6d 64 61 74 29 20 3b 3b 3b 20  a (itemdat) ;;; 
7320: 28 28 72 69 70 65 6e 65 73 73 20 22 6f 76 65 72  ((ripeness "over
7330: 72 69 70 65 22 29 20 28 74 65 6d 70 65 72 61 74  ripe") (temperat
7340: 75 72 65 20 22 63 6f 6f 6c 22 29 20 28 73 65 61  ure "cool") (sea
7350: 73 6f 6e 20 22 73 75 6d 6d 65 72 22 29 29 0a 20  son "summer")). 
7360: 20 20 20 28 6c 65 74 2a 20 28 28 6e 65 77 2d 74     (let* ((new-t
7370: 65 73 74 2d 70 61 74 68 20 28 73 74 72 69 6e 67  est-path (string
7380: 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 63 6f  -intersperse (co
7390: 6e 73 20 74 65 73 74 2d 70 61 74 68 20 28 6d 61  ns test-path (ma
73a0: 70 20 63 61 64 72 20 69 74 65 6d 64 61 74 29 29  p cadr itemdat))
73b0: 20 22 2f 22 29 29 0a 09 20 20 20 28 6e 65 77 2d   "/"))..   (new-
73c0: 74 65 73 74 2d 6e 61 6d 65 20 28 69 66 20 28 65  test-name (if (e
73d0: 71 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20  qual? item-path 
73e0: 22 22 29 20 74 65 73 74 2d 6e 61 6d 65 20 28 63  "") test-name (c
73f0: 6f 6e 63 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f  onc test-name "/
7400: 22 20 69 74 65 6d 2d 70 61 74 68 29 29 29 20 3b  " item-path))) ;
7410: 3b 20 6a 75 73 74 20 6e 65 65 64 20 69 74 20 74  ; just need it t
7420: 6f 20 62 65 20 75 6e 69 71 75 65 0a 09 20 20 20  o be unique..   
7430: 28 74 65 73 74 2d 69 64 20 20 20 20 20 20 20 28  (test-id       (
7440: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64  open-run-close d
7450: 62 3a 67 65 74 2d 74 65 73 74 2d 69 64 20 64 62  b:get-test-id db
7460: 20 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61    run-id test-na
7470: 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 09  me item-path))..
7480: 20 20 20 28 74 65 73 74 64 61 74 20 20 20 20 20     (testdat     
7490: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73    (open-run-clos
74a0: 65 20 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e  e db:get-test-in
74b0: 66 6f 2d 62 79 2d 69 64 20 64 62 20 74 65 73 74  fo-by-id db test
74c0: 2d 69 64 29 29 29 0a 20 20 20 20 20 20 28 69 66  -id))).      (if
74d0: 20 28 6e 6f 74 20 74 65 73 74 64 61 74 29 0a 09   (not testdat)..
74e0: 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 3b 3b    (begin..    ;;
74f0: 20 65 6e 73 75 72 65 20 74 68 61 74 20 74 68 65   ensure that the
7500: 20 70 61 74 68 20 65 78 69 73 74 73 20 62 65 66   path exists bef
7510: 6f 72 65 20 72 65 67 69 73 74 65 72 69 6e 67 20  ore registering 
7520: 74 68 65 20 74 65 73 74 0a 09 20 20 20 20 3b 3b  the test..    ;;
7530: 20 4e 4f 50 45 3a 20 43 61 6e 6e 6f 74 21 20 44   NOPE: Cannot! D
7540: 6f 6e 27 74 20 6b 6e 6f 77 20 79 65 74 20 77 68  on't know yet wh
7550: 69 63 68 20 64 69 73 6b 20 61 72 65 61 20 77 69  ich disk area wi
7560: 6c 6c 20 62 65 20 61 73 73 69 67 6e 65 64 2e 2e  ll be assigned..
7570: 2e 2e 0a 09 20 20 20 20 3b 3b 20 28 73 79 73 74  ....    ;; (syst
7580: 65 6d 20 28 63 6f 6e 63 20 22 6d 6b 64 69 72 20  em (conc "mkdir 
7590: 2d 70 20 22 20 6e 65 77 2d 74 65 73 74 2d 70 61  -p " new-test-pa
75a0: 74 68 29 29 0a 09 20 20 20 20 3b 3b 0a 09 20 20  th))..    ;;..  
75b0: 20 20 3b 3b 20 28 6f 70 65 6e 2d 72 75 6e 2d 63    ;; (open-run-c
75c0: 6c 6f 73 65 20 74 65 73 74 73 3a 72 65 67 69 73  lose tests:regis
75d0: 74 65 72 2d 74 65 73 74 20 64 62 20 72 75 6e 2d  ter-test db run-
75e0: 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65  id test-name ite
75f0: 6d 2d 70 61 74 68 29 0a 09 20 20 20 20 3b 3b 0a  m-path)..    ;;.
7600: 09 20 20 20 20 3b 3b 20 4e 42 2f 2f 20 66 6f 72  .    ;; NB// for
7610: 20 74 68 65 20 61 62 6f 76 65 20 6c 69 6e 65 2e   the above line.
7620: 20 49 20 77 61 6e 74 20 74 68 65 20 74 65 73 74   I want the test
7630: 20 74 6f 20 62 65 20 72 65 67 69 73 74 65 72 65   to be registere
7640: 64 20 6c 6f 6e 67 20 62 65 66 6f 72 65 20 74 68  d long before th
7650: 69 73 20 72 6f 75 74 69 6e 65 20 67 65 74 73 20  is routine gets 
7660: 63 61 6c 6c 65 64 21 0a 09 20 20 20 20 3b 3b 0a  called!..    ;;.
7670: 09 20 20 20 20 28 73 65 74 21 20 74 65 73 74 2d  .    (set! test-
7680: 69 64 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f  id (open-run-clo
7690: 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 2d 69  se db:get-test-i
76a0: 64 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74  d db run-id test
76b0: 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29  -name item-path)
76c0: 29 0a 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20  )..    (if (not 
76d0: 74 65 73 74 2d 69 64 29 0a 09 09 28 62 65 67 69  test-id)...(begi
76e0: 6e 0a 09 09 20 20 28 64 65 62 75 67 3a 70 72 69  n...  (debug:pri
76f0: 6e 74 20 32 20 22 57 41 52 4e 3a 20 54 65 73 74  nt 2 "WARN: Test
7700: 20 6e 6f 74 20 70 72 65 2d 63 72 65 61 74 65 64   not pre-created
7710: 3f 20 74 65 73 74 2d 6e 61 6d 65 3d 22 20 74 65  ? test-name=" te
7720: 73 74 2d 6e 61 6d 65 20 22 2c 20 69 74 65 6d 2d  st-name ", item-
7730: 70 61 74 68 3d 22 20 69 74 65 6d 2d 70 61 74 68  path=" item-path
7740: 20 22 2c 20 72 75 6e 2d 69 64 3d 22 20 72 75 6e   ", run-id=" run
7750: 2d 69 64 29 0a 09 09 20 20 28 6f 70 65 6e 2d 72  -id)...  (open-r
7760: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 74 65 73 74  un-close db:test
7770: 73 2d 72 65 67 69 73 74 65 72 2d 74 65 73 74 20  s-register-test 
7780: 23 66 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e  #f run-id test-n
7790: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 09  ame item-path)..
77a0: 09 20 20 28 73 65 74 21 20 74 65 73 74 2d 69 64  .  (set! test-id
77b0: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
77c0: 20 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 64 20   db:get-test-id 
77d0: 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e  db run-id test-n
77e0: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29 29  ame item-path)))
77f0: 29 0a 09 20 20 20 20 28 64 65 62 75 67 3a 70 72  )..    (debug:pr
7800: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 74 65 73 74  int-info 4 "test
7810: 2d 69 64 3d 22 20 74 65 73 74 2d 69 64 20 22 2c  -id=" test-id ",
7820: 20 72 75 6e 2d 69 64 3d 22 20 72 75 6e 2d 69 64   run-id=" run-id
7830: 20 22 2c 20 74 65 73 74 2d 6e 61 6d 65 3d 22 20   ", test-name=" 
7840: 74 65 73 74 2d 6e 61 6d 65 20 22 2c 20 69 74 65  test-name ", ite
7850: 6d 2d 70 61 74 68 3d 5c 22 22 20 69 74 65 6d 2d  m-path=\"" item-
7860: 70 61 74 68 20 22 5c 22 22 29 0a 09 20 20 20 20  path "\"")..    
7870: 28 73 65 74 21 20 74 65 73 74 64 61 74 20 28 6f  (set! testdat (o
7880: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62  pen-run-close db
7890: 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 2d 62  :get-test-info-b
78a0: 79 2d 69 64 20 64 62 20 74 65 73 74 2d 69 64 29  y-id db test-id)
78b0: 29 29 29 0a 20 20 20 20 20 20 28 73 65 74 21 20  ))).      (set! 
78c0: 74 65 73 74 2d 69 64 20 28 64 62 3a 74 65 73 74  test-id (db:test
78d0: 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29  -get-id testdat)
78e0: 29 0a 20 20 20 20 20 20 28 63 68 61 6e 67 65 2d  ).      (change-
78f0: 64 69 72 65 63 74 6f 72 79 20 74 65 73 74 2d 70  directory test-p
7900: 61 74 68 29 0a 20 20 20 20 20 20 28 63 61 73 65  ath).      (case
7910: 20 28 69 66 20 66 6f 72 63 65 20 3b 3b 20 28 61   (if force ;; (a
7920: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 66 6f  rgs:get-arg "-fo
7930: 72 63 65 22 29 0a 09 09 27 4e 4f 54 5f 53 54 41  rce")...'NOT_STA
7940: 52 54 45 44 0a 09 09 28 69 66 20 74 65 73 74 64  RTED...(if testd
7950: 61 74 0a 09 09 20 20 20 20 28 73 74 72 69 6e 67  at...    (string
7960: 2d 3e 73 79 6d 62 6f 6c 20 28 74 65 73 74 3a 67  ->symbol (test:g
7970: 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74  et-state testdat
7980: 29 29 0a 09 09 20 20 20 20 27 66 61 69 6c 65 64  ))...    'failed
7990: 2d 74 6f 2d 69 6e 73 65 72 74 29 29 0a 09 28 28  -to-insert))..((
79a0: 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 72 74  failed-to-insert
79b0: 29 0a 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ).. (debug:print
79c0: 20 30 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65   0 "ERROR: Faile
79d0: 64 20 74 6f 20 69 6e 73 65 72 74 20 74 68 65 20  d to insert the 
79e0: 72 65 63 6f 72 64 20 69 6e 74 6f 20 74 68 65 20  record into the 
79f0: 64 62 22 29 29 0a 09 28 28 4e 4f 54 5f 53 54 41  db"))..((NOT_STA
7a00: 52 54 45 44 20 43 4f 4d 50 4c 45 54 45 44 20 44  RTED COMPLETED D
7a10: 45 4c 45 54 45 44 29 0a 09 20 28 6c 65 74 20 28  ELETED).. (let (
7a20: 28 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20  (runflag #f)).. 
7a30: 20 20 28 63 6f 6e 64 0a 09 20 20 20 20 3b 3b 20    (cond..    ;; 
7a40: 2d 66 6f 72 63 65 2c 20 72 75 6e 20 6e 6f 20 6d  -force, run no m
7a50: 61 74 74 65 72 20 77 68 61 74 0a 09 20 20 20 20  atter what..    
7a60: 28 66 6f 72 63 65 20 28 73 65 74 21 20 72 75 6e  (force (set! run
7a70: 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b  flag #t))..    ;
7a80: 3b 20 4e 4f 54 5f 53 54 41 52 54 45 44 2c 20 72  ; NOT_STARTED, r
7a90: 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77 68 61  un no matter wha
7aa0: 74 0a 09 20 20 20 20 28 28 6d 65 6d 62 65 72 20  t..    ((member 
7ab0: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20  (test:get-state 
7ac0: 74 65 73 74 64 61 74 29 20 27 28 22 44 45 4c 45  testdat) '("DELE
7ad0: 54 45 44 22 20 22 4e 4f 54 5f 53 54 41 52 54 45  TED" "NOT_STARTE
7ae0: 44 22 29 29 28 73 65 74 21 20 72 75 6e 66 6c 61  D"))(set! runfla
7af0: 67 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 6e  g #t))..    ;; n
7b00: 6f 74 20 2d 72 65 72 75 6e 20 61 6e 64 20 50 41  ot -rerun and PA
7b10: 53 53 2c 20 57 41 52 4e 20 6f 72 20 43 48 45 43  SS, WARN or CHEC
7b20: 4b 2c 20 64 6f 20 6e 6f 20 72 75 6e 0a 09 20 20  K, do no run..  
7b30: 20 20 28 28 61 6e 64 20 28 6f 72 20 28 6e 6f 74    ((and (or (not
7b40: 20 72 65 72 75 6e 29 0a 09 09 20 20 20 20 20 20   rerun)...      
7b50: 6b 65 65 70 67 6f 69 6e 67 29 0a 09 09 20 20 3b  keepgoing)...  ;
7b60: 3b 20 52 65 71 75 69 72 65 20 74 6f 20 66 6f 72  ; Require to for
7b70: 63 65 20 72 65 2d 72 75 6e 20 66 6f 72 20 43 4f  ce re-run for CO
7b80: 4d 50 4c 45 54 45 44 20 6f 72 20 2a 61 6e 79 74  MPLETED or *anyt
7b90: 68 69 6e 67 2a 20 2b 20 50 41 53 53 2c 57 41 52  hing* + PASS,WAR
7ba0: 4e 20 6f 72 20 43 48 45 43 4b 0a 09 09 20 20 28  N or CHECK...  (
7bb0: 6f 72 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74  or (member (test
7bc0: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74  :get-status test
7bd0: 64 61 74 29 20 27 28 22 50 41 53 53 22 20 22 57  dat) '("PASS" "W
7be0: 41 52 4e 22 20 22 43 48 45 43 4b 22 29 29 0a 09  ARN" "CHECK"))..
7bf0: 09 20 20 20 20 20 20 28 6d 65 6d 62 65 72 20 28  .      (member (
7c00: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 20  test:get-state  
7c10: 74 65 73 74 64 61 74 29 20 27 28 22 43 4f 4d 50  testdat) '("COMP
7c20: 4c 45 54 45 44 22 29 29 29 29 20 0a 09 20 20 20  LETED")))) ..   
7c30: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69    (debug:print-i
7c40: 6e 66 6f 20 32 20 22 72 75 6e 6e 69 6e 67 20 74  nfo 2 "running t
7c50: 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20  est " test-name 
7c60: 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20  "/" item-path " 
7c70: 73 75 70 70 72 65 73 73 65 64 20 61 73 20 69 74  suppressed as it
7c80: 20 69 73 20 22 20 28 74 65 73 74 3a 67 65 74 2d   is " (test:get-
7c90: 73 74 61 74 65 20 74 65 73 74 64 61 74 29 20 22  state testdat) "
7ca0: 20 61 6e 64 20 22 20 28 74 65 73 74 3a 67 65 74   and " (test:get
7cb0: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29  -status testdat)
7cc0: 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 75  )..     (set! ru
7cd0: 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20 20  nflag #f))..    
7ce0: 3b 3b 20 2d 72 65 72 75 6e 20 61 6e 64 20 73 74  ;; -rerun and st
7cf0: 61 74 75 73 20 69 73 20 6f 6e 65 20 6f 66 20 74  atus is one of t
7d00: 68 65 20 73 70 65 63 69 66 65 64 2c 20 72 75 6e  he specifed, run
7d10: 20 69 74 0a 09 20 20 20 20 28 28 61 6e 64 20 72   it..    ((and r
7d20: 65 72 75 6e 0a 09 09 20 20 28 6c 65 74 2a 20 28  erun...  (let* (
7d30: 28 72 65 72 75 6e 6c 73 74 20 20 20 28 73 74 72  (rerunlst   (str
7d40: 69 6e 67 2d 73 70 6c 69 74 20 72 65 72 75 6e 20  ing-split rerun 
7d50: 22 2c 22 29 29 0a 09 09 09 20 28 6d 75 73 74 2d  ",")).... (must-
7d60: 72 65 72 75 6e 20 28 6d 65 6d 62 65 72 20 28 74  rerun (member (t
7d70: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74  est:get-status t
7d80: 65 73 74 64 61 74 29 20 72 65 72 75 6e 6c 73 74  estdat) rerunlst
7d90: 29 29 29 0a 09 09 20 20 20 20 28 64 65 62 75 67  )))...    (debug
7da0: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 33 20 22 2d  :print-info 3 "-
7db0: 72 65 72 75 6e 20 6c 69 73 74 3a 20 22 20 72 65  rerun list: " re
7dc0: 72 75 6e 20 22 2c 20 74 65 73 74 2d 73 74 61 74  run ", test-stat
7dd0: 75 73 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d  us: " (test:get-
7de0: 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 22  status testdat)"
7df0: 2c 20 6d 75 73 74 2d 72 65 72 75 6e 3a 20 22 20  , must-rerun: " 
7e00: 6d 75 73 74 2d 72 65 72 75 6e 29 0a 09 09 20 20  must-rerun)...  
7e10: 20 20 6d 75 73 74 2d 72 65 72 75 6e 29 29 0a 09    must-rerun))..
7e20: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
7e30: 74 2d 69 6e 66 6f 20 32 20 22 52 65 72 75 6e 20  t-info 2 "Rerun 
7e40: 66 6f 72 63 65 64 20 66 6f 72 20 74 65 73 74 20  forced for test 
7e50: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20  " test-name "/" 
7e60: 69 74 65 6d 2d 70 61 74 68 29 0a 09 20 20 20 20  item-path)..    
7e70: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23   (set! runflag #
7e80: 74 29 29 0a 09 20 20 20 20 3b 3b 20 2d 6b 65 65  t))..    ;; -kee
7e90: 70 67 6f 69 6e 67 2c 20 64 6f 20 6e 6f 74 20 72  pgoing, do not r
7ea0: 65 72 75 6e 20 46 41 49 4c 0a 09 20 20 20 20 28  erun FAIL..    (
7eb0: 28 61 6e 64 20 6b 65 65 70 67 6f 69 6e 67 0a 09  (and keepgoing..
7ec0: 09 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74  .  (member (test
7ed0: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74  :get-status test
7ee0: 64 61 74 29 20 27 28 22 46 41 49 4c 22 29 29 29  dat) '("FAIL")))
7ef0: 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 75 6e  ..     (set! run
7f00: 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20 20 28  flag #f))..    (
7f10: 28 61 6e 64 20 28 6e 6f 74 20 72 65 72 75 6e 29  (and (not rerun)
7f20: 0a 09 09 20 20 28 6d 65 6d 62 65 72 20 28 74 65  ...  (member (te
7f30: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65  st:get-status te
7f40: 73 74 64 61 74 29 20 27 28 22 46 41 49 4c 22 20  stdat) '("FAIL" 
7f50: 22 6e 2f 61 22 29 29 29 0a 09 20 20 20 20 20 28  "n/a")))..     (
7f60: 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29  set! runflag #t)
7f70: 29 0a 09 20 20 20 20 28 65 6c 73 65 20 28 73 65  )..    (else (se
7f80: 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 29  t! runflag #f)))
7f90: 0a 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  ..   (debug:prin
7fa0: 74 20 36 20 22 52 55 4e 4e 49 4e 47 20 3d 3e 20  t 6 "RUNNING => 
7fb0: 72 75 6e 66 6c 61 67 3a 20 22 20 72 75 6e 66 6c  runflag: " runfl
7fc0: 61 67 20 22 20 53 54 41 54 45 3a 20 22 20 28 74  ag " STATE: " (t
7fd0: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65  est:get-state te
7fe0: 73 74 64 61 74 29 20 22 20 53 54 41 54 55 53 3a  stdat) " STATUS:
7ff0: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61   " (test:get-sta
8000: 74 75 73 20 74 65 73 74 64 61 74 29 29 0a 09 20  tus testdat)).. 
8010: 20 20 28 69 66 20 28 6e 6f 74 20 72 75 6e 66 6c    (if (not runfl
8020: 61 67 29 0a 09 20 20 20 20 20 20 20 28 69 66 20  ag)..       (if 
8030: 28 6e 6f 74 20 70 61 72 65 6e 74 2d 74 65 73 74  (not parent-test
8040: 29 0a 09 09 20 20 20 28 64 65 62 75 67 3a 70 72  )...   (debug:pr
8050: 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 4e 6f 74  int 1 "NOTE: Not
8060: 20 73 74 61 72 74 69 6e 67 20 74 65 73 74 20 22   starting test "
8070: 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22   new-test-name "
8080: 20 61 73 20 69 74 20 69 73 20 73 74 61 74 65 20   as it is state 
8090: 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74  \"" (test:get-st
80a0: 61 74 65 20 74 65 73 74 64 61 74 29 20 0a 09 09  ate testdat) ...
80b0: 09 09 22 5c 22 20 61 6e 64 20 73 74 61 74 75 73  .."\" and status
80c0: 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73   \"" (test:get-s
80d0: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20 22  tatus testdat) "
80e0: 5c 22 2c 20 75 73 65 20 2d 72 65 72 75 6e 20 5c  \", use -rerun \
80f0: 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61  "" (test:get-sta
8100: 74 75 73 20 74 65 73 74 64 61 74 29 0a 20 20 20  tus testdat).   
8110: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
8120: 20 20 20 20 20 20 20 20 20 20 20 20 20 22 5c 22               "\"
8130: 20 6f 72 20 2d 66 6f 72 63 65 20 74 6f 20 6f 76   or -force to ov
8140: 65 72 72 69 64 65 22 29 29 0a 09 20 20 20 20 20  erride"))..     
8150: 20 20 3b 3b 20 4e 4f 54 45 3a 20 4e 6f 20 6c 6f    ;; NOTE: No lo
8160: 6e 67 65 72 20 62 65 20 63 68 65 63 6b 69 6e 67  nger be checking
8170: 20 70 72 65 72 65 71 75 69 73 69 74 65 73 20 68   prerequisites h
8180: 65 72 65 21 20 57 69 6c 6c 20 6e 65 76 65 72 20  ere! Will never 
8190: 67 65 74 20 68 65 72 65 20 75 6e 6c 65 73 73 20  get here unless 
81a0: 70 72 65 72 65 71 73 20 61 72 65 0a 09 20 20 20  prereqs are..   
81b0: 20 20 20 20 3b 3b 20 20 20 20 20 20 20 61 6c 72      ;;       alr
81c0: 65 61 64 79 20 6d 65 74 2e 0a 09 20 20 20 20 20  eady met...     
81d0: 20 20 28 69 66 20 28 6e 6f 74 20 28 6c 61 75 6e    (if (not (laun
81e0: 63 68 2d 74 65 73 74 20 23 66 20 72 75 6e 2d 69  ch-test #f run-i
81f0: 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d 63  d runname test-c
8200: 6f 6e 66 20 6b 65 79 76 61 6c 6c 73 74 20 74 65  onf keyvallst te
8210: 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 70 61 74  st-name test-pat
8220: 68 20 69 74 65 6d 64 61 74 20 66 6c 61 67 73 29  h itemdat flags)
8230: 29 0a 09 09 20 20 20 28 62 65 67 69 6e 0a 09 09  )...   (begin...
8240: 20 20 20 20 20 28 70 72 69 6e 74 20 22 45 52 52       (print "ERR
8250: 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c 61  OR: Failed to la
8260: 75 6e 63 68 20 74 68 65 20 74 65 73 74 2e 20 45  unch the test. E
8270: 78 69 74 69 6e 67 20 61 73 20 73 6f 6f 6e 20 61  xiting as soon a
8280: 73 20 70 6f 73 73 69 62 6c 65 22 29 0a 09 09 20  s possible")... 
8290: 20 20 20 20 28 73 65 74 21 20 2a 67 6c 6f 62 61      (set! *globa
82a0: 6c 65 78 69 74 73 74 61 74 75 73 2a 20 31 29 20  lexitstatus* 1) 
82b0: 3b 3b 20 0a 09 09 20 20 20 20 20 28 70 72 6f 63  ;; ...     (proc
82c0: 65 73 73 2d 73 69 67 6e 61 6c 20 28 63 75 72 72  ess-signal (curr
82d0: 65 6e 74 2d 70 72 6f 63 65 73 73 2d 69 64 29 20  ent-process-id) 
82e0: 73 69 67 6e 61 6c 2f 6b 69 6c 6c 29 29 29 29 29  signal/kill)))))
82f0: 29 0a 09 28 28 4b 49 4c 4c 45 44 29 20 0a 09 20  )..((KILLED) .. 
8300: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22  (debug:print 1 "
8310: 4e 4f 54 45 3a 20 22 20 6e 65 77 2d 74 65 73 74  NOTE: " new-test
8320: 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72 65 61  -name " is alrea
8330: 64 79 20 72 75 6e 6e 69 6e 67 20 6f 72 20 77 61  dy running or wa
8340: 73 20 65 78 70 6c 69 63 74 6c 79 20 6b 69 6c 6c  s explictly kill
8350: 65 64 2c 20 75 73 65 20 2d 66 6f 72 63 65 20 74  ed, use -force t
8360: 6f 20 6c 61 75 6e 63 68 20 69 74 2e 22 29 29 0a  o launch it.")).
8370: 09 28 28 4c 41 55 4e 43 48 45 44 20 52 45 4d 4f  .((LAUNCHED REMO
8380: 54 45 48 4f 53 54 53 54 41 52 54 20 52 55 4e 4e  TEHOSTSTART RUNN
8390: 49 4e 47 29 20 20 0a 09 20 28 69 66 20 28 3e 20  ING)  .. (if (> 
83a0: 28 2d 20 28 63 75 72 72 65 6e 74 2d 73 65 63 6f  (- (current-seco
83b0: 6e 64 73 29 28 2b 20 28 64 62 3a 74 65 73 74 2d  nds)(+ (db:test-
83c0: 67 65 74 2d 65 76 65 6e 74 5f 74 69 6d 65 20 74  get-event_time t
83d0: 65 73 74 64 61 74 29 0a 09 09 09 09 20 20 20 20  estdat).....    
83e0: 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d     (db:test-get-
83f0: 72 75 6e 5f 64 75 72 61 74 69 6f 6e 20 74 65 73  run_duration tes
8400: 74 64 61 74 29 29 29 0a 09 09 36 30 30 29 20 3b  tdat)))...600) ;
8410: 3b 20 69 2e 65 2e 20 6e 6f 20 75 70 64 61 74 65  ; i.e. no update
8420: 20 66 6f 72 20 6d 6f 72 65 20 74 68 61 6e 20 36   for more than 6
8430: 30 30 20 73 65 63 6f 6e 64 73 0a 09 20 20 20 20  00 seconds..    
8440: 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 20   (begin..       
8450: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
8460: 57 41 52 4e 49 4e 47 3a 20 54 65 73 74 20 22 20  WARNING: Test " 
8470: 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 70 70 65  test-name " appe
8480: 61 72 73 20 74 6f 20 62 65 20 64 65 61 64 2e 20  ars to be dead. 
8490: 46 6f 72 63 69 6e 67 20 69 74 20 74 6f 20 73 74  Forcing it to st
84a0: 61 74 65 20 49 4e 43 4f 4d 50 4c 45 54 45 20 61  ate INCOMPLETE a
84b0: 6e 64 20 73 74 61 74 75 73 20 53 54 55 43 4b 2f  nd status STUCK/
84c0: 44 45 41 44 22 29 0a 09 20 20 20 20 20 20 20 28  DEAD")..       (
84d0: 74 65 73 74 73 3a 74 65 73 74 2d 73 65 74 2d 73  tests:test-set-s
84e0: 74 61 74 75 73 21 20 74 65 73 74 2d 69 64 20 22  tatus! test-id "
84f0: 49 4e 43 4f 4d 50 4c 45 54 45 22 20 22 53 54 55  INCOMPLETE" "STU
8500: 43 4b 2f 44 45 41 44 22 20 22 54 65 73 74 20 69  CK/DEAD" "Test i
8510: 73 20 73 74 75 63 6b 20 6f 72 20 64 65 61 64 22  s stuck or dead"
8520: 20 23 66 29 29 0a 09 20 20 20 20 20 28 64 65 62   #f))..     (deb
8530: 75 67 3a 70 72 69 6e 74 20 32 20 22 4e 4f 54 45  ug:print 2 "NOTE
8540: 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20  : " test-name " 
8550: 69 73 20 61 6c 72 65 61 64 79 20 72 75 6e 6e 69  is already runni
8560: 6e 67 22 29 29 29 0a 09 28 65 6c 73 65 20 20 20  ng")))..(else   
8570: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
8580: 20 30 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65   0 "ERROR: Faile
8590: 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 65 73 74  d to launch test
85a0: 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65   " new-test-name
85b0: 20 22 2e 20 55 6e 72 65 63 6f 67 6e 69 73 65 64   ". Unrecognised
85c0: 20 73 74 61 74 65 20 22 20 28 74 65 73 74 3a 67   state " (test:g
85d0: 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74  et-state testdat
85e0: 29 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d  )))))))..;;=====
85f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8600: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8610: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8620: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8630: 3d 0a 3b 3b 20 45 4e 44 20 4f 46 20 4e 45 57 20  =.;; END OF NEW 
8640: 53 54 55 46 46 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d  STUFF.;;========
8650: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8660: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8670: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8680: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a  ==============..
8690: 28 64 65 66 69 6e 65 20 28 67 65 74 2d 64 69 72  (define (get-dir
86a0: 2d 75 70 2d 6e 20 64 69 72 20 2e 20 70 61 72 61  -up-n dir . para
86b0: 6d 73 29 20 0a 20 20 28 6c 65 74 20 28 28 64 70  ms) .  (let ((dp
86c0: 61 72 74 73 20 20 28 73 74 72 69 6e 67 2d 73 70  arts  (string-sp
86d0: 6c 69 74 20 64 69 72 20 22 2f 22 29 29 0a 09 28  lit dir "/"))..(
86e0: 63 6f 75 6e 74 20 20 20 28 69 66 20 28 6e 75 6c  count   (if (nul
86f0: 6c 3f 20 70 61 72 61 6d 73 29 20 31 20 28 63 61  l? params) 1 (ca
8700: 72 20 70 61 72 61 6d 73 29 29 29 29 0a 20 20 20  r params)))).   
8710: 20 28 63 6f 6e 63 20 22 2f 22 20 28 73 74 72 69   (conc "/" (stri
8720: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 0a  ng-intersperse .
8730: 09 20 20 20 20 20 20 20 28 74 61 6b 65 20 64 70  .       (take dp
8740: 61 72 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 20  arts (- (length 
8750: 64 70 61 72 74 73 29 20 63 6f 75 6e 74 29 29 0a  dparts) count)).
8760: 09 20 20 20 20 20 20 20 22 2f 22 29 29 29 29 0a  .       "/")))).
8770: 3b 3b 20 52 65 6d 6f 76 65 20 72 75 6e 73 0a 3b  ;; Remove runs.;
8780: 3b 20 66 69 65 6c 64 73 20 61 72 65 20 70 61 73  ; fields are pas
8790: 73 69 6e 67 20 69 6e 20 74 68 72 6f 75 67 68 20  sing in through 
87a0: 0a 3b 3b 20 61 63 74 69 6f 6e 3a 0a 3b 3b 20 20  .;; action:.;;  
87b0: 20 20 27 72 65 6d 6f 76 65 2d 72 75 6e 73 0a 3b    'remove-runs.;
87c0: 3b 20 20 20 20 27 73 65 74 2d 73 74 61 74 65 2d  ;    'set-state-
87d0: 73 74 61 74 75 73 0a 3b 3b 0a 3b 3b 20 4e 42 2f  status.;;.;; NB/
87e0: 2f 20 73 68 6f 75 6c 64 20 70 61 73 73 20 69 6e  / should pass in
87f0: 20 6b 65 79 73 3f 0a 3b 3b 0a 28 64 65 66 69 6e   keys?.;;.(defin
8800: 65 20 28 72 75 6e 73 3a 6f 70 65 72 61 74 65 2d  e (runs:operate-
8810: 6f 6e 20 61 63 74 69 6f 6e 20 72 75 6e 6e 61 6d  on action runnam
8820: 65 70 61 74 74 20 74 65 73 74 70 61 74 74 20 23  epatt testpatt #
8830: 21 6b 65 79 20 28 73 74 61 74 65 20 23 66 29 28  !key (state #f)(
8840: 73 74 61 74 75 73 20 23 66 29 28 6e 65 77 2d 73  status #f)(new-s
8850: 74 61 74 65 2d 73 74 61 74 75 73 20 23 66 29 29  tate-status #f))
8860: 0a 20 20 28 6c 65 74 2a 20 28 28 64 62 20 20 20  .  (let* ((db   
8870: 20 20 20 20 20 20 20 20 23 66 29 0a 09 20 28 6b          #f).. (k
8880: 65 79 73 20 20 20 20 20 20 20 20 20 28 6f 70 65  eys         (ope
8890: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67  n-run-close db:g
88a0: 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 20 28  et-keys db)).. (
88b0: 72 75 6e 64 61 74 20 20 20 20 20 20 20 28 6f 70  rundat       (op
88c0: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e  en-run-close run
88d0: 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61  s:get-runs-by-pa
88e0: 74 74 20 64 62 20 6b 65 79 73 20 72 75 6e 6e 61  tt db keys runna
88f0: 6d 65 70 61 74 74 29 29 0a 09 20 28 68 65 61 64  mepatt)).. (head
8900: 65 72 20 20 20 20 20 20 20 28 76 65 63 74 6f 72  er       (vector
8910: 2d 72 65 66 20 72 75 6e 64 61 74 20 30 29 29 0a  -ref rundat 0)).
8920: 09 20 28 72 75 6e 73 20 20 20 20 20 20 20 20 20  . (runs         
8930: 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64  (vector-ref rund
8940: 61 74 20 31 29 29 0a 09 20 28 73 74 61 74 65 73  at 1)).. (states
8950: 20 20 20 20 20 20 20 28 69 66 20 73 74 61 74 65         (if state
8960: 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20    (string-split 
8970: 73 74 61 74 65 20 20 22 2c 22 29 20 27 28 29 29  state  ",") '())
8980: 29 0a 09 20 28 73 74 61 74 75 73 65 73 20 20 20  ).. (statuses   
8990: 20 20 28 69 66 20 73 74 61 74 75 73 20 28 73 74    (if status (st
89a0: 72 69 6e 67 2d 73 70 6c 69 74 20 73 74 61 74 75  ring-split statu
89b0: 73 20 22 2c 22 29 20 27 28 29 29 29 0a 09 20 28  s ",") '())).. (
89c0: 73 74 61 74 65 2d 73 74 61 74 75 73 20 28 69 66  state-status (if
89d0: 20 28 73 74 72 69 6e 67 3f 20 6e 65 77 2d 73 74   (string? new-st
89e0: 61 74 65 2d 73 74 61 74 75 73 29 20 28 73 74 72  ate-status) (str
89f0: 69 6e 67 2d 73 70 6c 69 74 20 6e 65 77 2d 73 74  ing-split new-st
8a00: 61 74 65 2d 73 74 61 74 75 73 20 22 2c 22 29 20  ate-status ",") 
8a10: 27 28 23 66 20 23 66 29 29 29 29 0a 20 20 20 20  '(#f #f)))).    
8a20: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
8a30: 6f 20 34 20 22 72 75 6e 73 3a 6f 70 65 72 61 74  o 4 "runs:operat
8a40: 65 2d 6f 6e 20 3d 3e 20 48 65 61 64 65 72 3a 20  e-on => Header: 
8a50: 22 20 68 65 61 64 65 72 20 22 20 61 63 74 69 6f  " header " actio
8a60: 6e 3a 20 22 20 61 63 74 69 6f 6e 20 22 20 6e 65  n: " action " ne
8a70: 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73 3a 20  w-state-status: 
8a80: 22 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74  " new-state-stat
8a90: 75 73 29 0a 20 20 20 20 28 69 66 20 28 3e 20 32  us).    (if (> 2
8aa0: 20 28 6c 65 6e 67 74 68 20 73 74 61 74 65 2d 73   (length state-s
8ab0: 74 61 74 75 73 29 29 0a 09 28 62 65 67 69 6e 0a  tatus))..(begin.
8ac0: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  .  (debug:print 
8ad0: 30 20 22 45 52 52 4f 52 3a 20 74 68 65 20 70 61  0 "ERROR: the pa
8ae0: 72 61 6d 65 74 65 72 20 74 6f 20 2d 73 65 74 2d  rameter to -set-
8af0: 73 74 61 74 65 2d 73 74 61 74 75 73 20 69 73 20  state-status is 
8b00: 61 20 63 6f 6d 6d 61 20 64 65 6c 69 6d 69 74 65  a comma delimite
8b10: 64 20 73 74 72 69 6e 67 2e 20 45 2e 67 2e 20 43  d string. E.g. C
8b20: 4f 4d 50 4c 45 54 45 44 2c 46 41 49 4c 22 29 0a  OMPLETED,FAIL").
8b30: 09 20 20 28 65 78 69 74 29 29 29 0a 20 20 20 20  .  (exit))).    
8b40: 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 28  (for-each.     (
8b50: 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a 20 20 20  lambda (run).   
8b60: 20 20 20 20 28 6c 65 74 20 28 28 72 75 6e 6b 65      (let ((runke
8b70: 79 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73  y (string-inters
8b80: 70 65 72 73 65 20 28 6d 61 70 20 28 6c 61 6d 62  perse (map (lamb
8b90: 64 61 20 28 6b 29 0a 09 09 09 09 09 09 28 64 62  da (k).......(db
8ba0: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65  :get-value-by-he
8bb0: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20  ader run header 
8bc0: 28 76 65 63 74 6f 72 2d 72 65 66 20 6b 20 30 29  (vector-ref k 0)
8bd0: 29 29 20 6b 65 79 73 29 20 22 2f 22 29 29 0a 09  )) keys) "/"))..
8be0: 20 20 20 20 20 28 64 69 72 73 2d 74 6f 2d 72 65       (dirs-to-re
8bf0: 6d 6f 76 65 20 28 6d 61 6b 65 2d 68 61 73 68 2d  move (make-hash-
8c00: 74 61 62 6c 65 29 29 29 0a 09 20 28 6c 65 74 2a  table))).. (let*
8c10: 20 28 28 72 75 6e 2d 69 64 20 20 20 20 28 64 62   ((run-id    (db
8c20: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65  :get-value-by-he
8c30: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20  ader run header 
8c40: 22 69 64 22 29 29 0a 09 09 28 72 75 6e 2d 73 74  "id"))...(run-st
8c50: 61 74 65 20 28 64 62 3a 67 65 74 2d 76 61 6c 75  ate (db:get-valu
8c60: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20  e-by-header run 
8c70: 68 65 61 64 65 72 20 22 73 74 61 74 65 22 29 29  header "state"))
8c80: 0a 09 09 28 74 65 73 74 73 20 20 20 20 20 28 69  ...(tests     (i
8c90: 66 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 72  f (not (equal? r
8ca0: 75 6e 2d 73 74 61 74 65 20 22 6c 6f 63 6b 65 64  un-state "locked
8cb0: 22 29 29 0a 09 09 09 20 20 20 20 20 20 20 28 6f  "))....       (o
8cc0: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62  pen-run-close db
8cd0: 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72  :get-tests-for-r
8ce0: 75 6e 20 64 62 20 72 75 6e 2d 69 64 0a 09 09 09  un db run-id....
8cf0: 09 09 09 20 20 20 20 20 20 74 65 73 74 70 61 74  ...      testpat
8d00: 74 20 73 74 61 74 65 73 20 73 74 61 74 75 73 65  t states statuse
8d10: 73 0a 09 09 09 09 09 09 20 20 20 20 20 20 6e 6f  s.......      no
8d20: 74 2d 69 6e 3a 20 20 23 66 0a 09 09 09 09 09 09  t-in:  #f.......
8d30: 20 20 20 20 20 20 73 6f 72 74 2d 62 79 3a 20 28        sort-by: (
8d40: 63 61 73 65 20 61 63 74 69 6f 6e 0a 09 09 09 09  case action.....
8d50: 09 09 09 09 20 28 28 72 65 6d 6f 76 65 2d 72 75  .... ((remove-ru
8d60: 6e 73 29 20 27 72 75 6e 64 69 72 29 0a 09 09 09  ns) 'rundir)....
8d70: 09 09 09 09 09 20 28 65 6c 73 65 20 20 20 20 20  ..... (else     
8d80: 20 20 20 20 20 27 65 76 65 6e 74 5f 74 69 6d 65       'event_time
8d90: 29 29 29 0a 09 09 09 20 20 20 20 20 20 20 27 28  )))....       '(
8da0: 29 29 29 0a 09 09 28 6c 61 73 74 74 70 61 74 68  )))...(lasttpath
8db0: 20 22 2f 64 6f 65 73 2f 6e 6f 74 2f 65 78 69 73   "/does/not/exis
8dc0: 74 2f 49 2f 68 6f 70 65 22 29 29 0a 09 20 20 20  t/I/hope"))..   
8dd0: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
8de0: 6f 20 34 20 22 72 75 6e 73 3a 6f 70 65 72 61 74  o 4 "runs:operat
8df0: 65 2d 6f 6e 20 72 75 6e 3d 22 20 72 75 6e 20 22  e-on run=" run "
8e00: 2c 20 68 65 61 64 65 72 3d 22 20 68 65 61 64 65  , header=" heade
8e10: 72 29 0a 09 20 20 20 28 69 66 20 28 6e 6f 74 20  r)..   (if (not 
8e20: 28 6e 75 6c 6c 3f 20 74 65 73 74 73 29 29 0a 09  (null? tests))..
8e30: 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09         (begin...
8e40: 20 28 63 61 73 65 20 61 63 74 69 6f 6e 0a 09 09   (case action...
8e50: 20 20 20 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73     ((remove-runs
8e60: 29 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70  )...    (debug:p
8e70: 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67  rint 1 "Removing
8e80: 20 74 65 73 74 73 20 66 6f 72 20 72 75 6e 3a 20   tests for run: 
8e90: 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62  " runkey " " (db
8ea0: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65  :get-value-by-he
8eb0: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20  ader run header 
8ec0: 22 72 75 6e 6e 61 6d 65 22 29 29 29 0a 09 09 20  "runname")))... 
8ed0: 20 20 28 28 73 65 74 2d 73 74 61 74 65 2d 73 74    ((set-state-st
8ee0: 61 74 75 73 29 0a 09 09 20 20 20 20 28 64 65 62  atus)...    (deb
8ef0: 75 67 3a 70 72 69 6e 74 20 31 20 22 4d 6f 64 69  ug:print 1 "Modi
8f00: 66 79 69 6e 67 20 73 74 61 74 65 20 61 6e 64 20  fying state and 
8f10: 73 74 61 75 73 20 66 6f 72 20 74 65 73 74 73 20  staus for tests 
8f20: 66 6f 72 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65  for run: " runke
8f30: 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61  y " " (db:get-va
8f40: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75  lue-by-header ru
8f50: 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d  n header "runnam
8f60: 65 22 29 29 29 0a 09 09 20 20 20 28 28 70 72 69  e")))...   ((pri
8f70: 6e 74 2d 72 75 6e 29 0a 09 09 20 20 20 20 28 64  nt-run)...    (d
8f80: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 50 72  ebug:print 1 "Pr
8f90: 69 6e 74 69 6e 67 20 69 6e 66 6f 20 66 6f 72 20  inting info for 
8fa0: 72 75 6e 20 22 20 72 75 6e 6b 65 79 20 22 2c 20  run " runkey ", 
8fb0: 72 75 6e 3d 22 20 72 75 6e 20 22 2c 20 74 65 73  run=" run ", tes
8fc0: 74 73 3d 22 20 74 65 73 74 73 20 22 2c 20 68 65  ts=" tests ", he
8fd0: 61 64 65 72 3d 22 20 68 65 61 64 65 72 29 0a 09  ader=" header)..
8fe0: 09 20 20 20 20 61 63 74 69 6f 6e 29 0a 09 09 20  .    action)... 
8ff0: 20 20 28 65 6c 73 65 0a 09 09 20 20 20 20 28 64    (else...    (d
9000: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
9010: 30 20 22 61 63 74 69 6f 6e 20 6e 6f 74 20 72 65  0 "action not re
9020: 63 6f 67 6e 69 73 65 64 20 22 20 61 63 74 69 6f  cognised " actio
9030: 6e 29 29 29 0a 09 09 20 28 66 6f 72 2d 65 61 63  n)))... (for-eac
9040: 68 0a 09 09 20 20 28 6c 61 6d 62 64 61 20 28 74  h...  (lambda (t
9050: 65 73 74 29 0a 09 09 20 20 20 20 28 6c 65 74 2a  est)...    (let*
9060: 20 28 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62   ((item-path (db
9070: 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70  :test-get-item-p
9080: 61 74 68 20 74 65 73 74 29 29 0a 09 09 09 20 20  ath test))....  
9090: 20 28 74 65 73 74 2d 6e 61 6d 65 20 28 64 62 3a   (test-name (db:
90a0: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d  test-get-testnam
90b0: 65 20 74 65 73 74 29 29 0a 09 09 09 20 20 20 28  e test))....   (
90c0: 72 75 6e 2d 64 69 72 20 20 20 28 64 62 3a 74 65  run-dir   (db:te
90d0: 73 74 2d 67 65 74 2d 72 75 6e 64 69 72 20 74 65  st-get-rundir te
90e0: 73 74 29 29 20 20 20 20 3b 3b 20 72 75 6e 20 64  st))    ;; run d
90f0: 69 72 20 69 73 20 66 72 6f 6d 20 74 68 65 20 6c  ir is from the l
9100: 69 6e 6b 20 74 72 65 65 0a 09 09 09 20 20 20 28  ink tree....   (
9110: 72 65 61 6c 2d 64 69 72 20 20 28 69 66 20 28 66  real-dir  (if (f
9120: 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 75 6e 2d  ile-exists? run-
9130: 64 69 72 29 0a 09 09 09 09 09 20 20 28 72 65 73  dir)......  (res
9140: 6f 6c 76 65 2d 70 61 74 68 6e 61 6d 65 20 72 75  olve-pathname ru
9150: 6e 2d 64 69 72 29 0a 09 09 09 09 09 20 20 23 66  n-dir)......  #f
9160: 29 29 0a 09 09 09 20 20 20 28 74 65 73 74 2d 69  ))....   (test-i
9170: 64 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74  d   (db:test-get
9180: 2d 69 64 20 74 65 73 74 29 29 29 0a 09 09 20 20  -id test)))...  
9190: 20 20 20 20 3b 3b 20 20 20 28 74 64 62 20 20 20      ;;   (tdb   
91a0: 20 20 20 20 28 64 62 3a 6f 70 65 6e 2d 74 65 73      (db:open-tes
91b0: 74 2d 64 62 20 72 75 6e 2d 64 69 72 29 29 29 0a  t-db run-dir))).
91c0: 09 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70  ..      (debug:p
91d0: 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 74 65 73  rint-info 4 "tes
91e0: 74 3d 22 20 74 65 73 74 29 20 3b 3b 20 20 20 22  t=" test) ;;   "
91f0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65   (db:test-get-te
9200: 73 74 6e 61 6d 65 20 74 65 73 74 29 20 22 20 69  stname test) " i
9210: 64 3a 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65  d: " (db:test-ge
9220: 74 2d 69 64 20 74 65 73 74 29 20 22 20 22 20 69  t-id test) " " i
9230: 74 65 6d 2d 70 61 74 68 20 22 20 61 63 74 69 6f  tem-path " actio
9240: 6e 3a 20 22 20 61 63 74 69 6f 6e 29 0a 09 09 20  n: " action)... 
9250: 20 20 20 20 20 28 63 61 73 65 20 61 63 74 69 6f       (case actio
9260: 6e 0a 09 09 09 28 28 72 65 6d 6f 76 65 2d 72 75  n....((remove-ru
9270: 6e 73 29 20 3b 3b 20 74 68 65 20 74 64 62 20 69  ns) ;; the tdb i
9280: 73 20 66 6f 72 20 66 75 74 75 72 65 20 70 6f 73  s for future pos
9290: 73 69 62 6c 65 2e 20 0a 09 09 09 20 28 6f 70 65  sible. .... (ope
92a0: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64  n-run-close db:d
92b0: 65 6c 65 74 65 2d 74 65 73 74 2d 72 65 63 6f 72  elete-test-recor
92c0: 64 73 20 64 62 20 23 66 20 28 64 62 3a 74 65 73  ds db #f (db:tes
92d0: 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29 29 0a  t-get-id test)).
92e0: 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ... (debug:print
92f0: 2d 69 6e 66 6f 20 31 20 22 41 74 74 65 6d 70 74  -info 1 "Attempt
9300: 69 6e 67 20 74 6f 20 72 65 6d 6f 76 65 20 64 69  ing to remove di
9310: 72 20 22 20 72 65 61 6c 2d 64 69 72 20 22 20 61  r " real-dir " a
9320: 6e 64 20 6c 69 6e 6b 20 22 20 72 75 6e 2d 64 69  nd link " run-di
9330: 72 29 0a 09 09 09 20 28 69 66 20 28 61 6e 64 20  r).... (if (and 
9340: 72 65 61 6c 2d 64 69 72 20 0a 09 09 09 09 20 20  real-dir .....  
9350: 28 3e 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74  (> (string-lengt
9360: 68 20 72 65 61 6c 2d 64 69 72 29 20 35 29 0a 09  h real-dir) 5)..
9370: 09 09 09 20 20 28 66 69 6c 65 2d 65 78 69 73 74  ...  (file-exist
9380: 73 3f 20 72 65 61 6c 2d 64 69 72 29 29 20 3b 3b  s? real-dir)) ;;
9390: 20 62 61 64 20 68 65 75 72 69 73 74 69 63 20 62   bad heuristic b
93a0: 75 74 20 73 68 6f 75 6c 64 20 70 72 65 76 65 6e  ut should preven
93b0: 74 20 2f 74 6d 70 20 2f 68 6f 6d 65 20 65 74 63  t /tmp /home etc
93c0: 2e 0a 09 09 09 20 20 20 20 20 28 62 65 67 69 6e  .....     (begin
93d0: 20 3b 3b 20 6c 65 74 2a 20 28 28 72 65 61 6c 70   ;; let* ((realp
93e0: 61 74 68 20 28 72 65 73 6f 6c 76 65 2d 70 61 74  ath (resolve-pat
93f0: 68 6e 61 6d 65 20 72 75 6e 2d 64 69 72 29 29 29  hname run-dir)))
9400: 0a 09 09 09 20 20 20 20 20 20 20 28 64 65 62 75  ....       (debu
9410: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22  g:print-info 1 "
9420: 52 65 63 75 72 73 69 76 65 6c 79 20 72 65 6d 6f  Recursively remo
9430: 76 69 6e 67 20 22 20 72 65 61 6c 2d 64 69 72 29  ving " real-dir)
9440: 0a 09 09 09 20 20 20 20 20 20 20 28 69 66 20 28  ....       (if (
9450: 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 65 61  file-exists? rea
9460: 6c 2d 64 69 72 29 0a 09 09 09 09 20 20 20 28 69  l-dir).....   (i
9470: 66 20 28 3e 20 28 73 79 73 74 65 6d 20 28 63 6f  f (> (system (co
9480: 6e 63 20 22 72 6d 20 2d 72 66 20 22 20 72 65 61  nc "rm -rf " rea
9490: 6c 2d 64 69 72 29 29 20 30 29 0a 09 09 09 09 20  l-dir)) 0)..... 
94a0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
94b0: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 54 68 65  nt 0 "ERROR: The
94c0: 72 65 20 77 61 73 20 61 20 70 72 6f 62 6c 65 6d  re was a problem
94d0: 20 72 65 6d 6f 76 69 6e 67 20 22 20 72 65 61 6c   removing " real
94e0: 2d 64 69 72 20 22 20 77 69 74 68 20 72 6d 20 2d  -dir " with rm -
94f0: 66 22 29 29 0a 09 09 09 09 20 20 20 28 64 65 62  f")).....   (deb
9500: 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e  ug:print 0 "WARN
9510: 49 4e 47 3a 20 74 65 73 74 20 72 75 6e 20 64 69  ING: test run di
9520: 72 20 22 20 72 65 61 6c 2d 64 69 72 20 22 20 61  r " real-dir " a
9530: 70 70 65 61 72 73 20 74 6f 20 6e 6f 74 20 65 78  ppears to not ex
9540: 69 73 74 22 29 29 29 0a 09 09 09 20 20 20 20 20  ist")))....     
9550: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
9560: 57 41 52 4e 49 4e 47 3a 20 64 69 72 65 63 74 6f  WARNING: directo
9570: 72 79 20 22 20 72 65 61 6c 2d 64 69 72 20 22 20  ry " real-dir " 
9580: 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 74 22 29  does not exist")
9590: 29 0a 09 09 09 20 28 69 66 20 28 73 79 6d 62 6f  ).... (if (symbo
95a0: 6c 69 63 2d 6c 69 6e 6b 3f 20 72 75 6e 2d 64 69  lic-link? run-di
95b0: 72 29 0a 09 09 09 20 20 20 20 20 28 62 65 67 69  r)....     (begi
95c0: 6e 0a 09 09 09 20 20 20 20 20 20 20 28 64 65 62  n....       (deb
95d0: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20  ug:print-info 1 
95e0: 22 52 65 6d 6f 76 69 6e 67 20 73 79 6d 6c 69 6e  "Removing symlin
95f0: 6b 20 22 20 72 75 6e 2d 64 69 72 29 0a 09 09 09  k " run-dir)....
9600: 20 20 20 20 20 20 20 28 64 65 6c 65 74 65 2d 66         (delete-f
9610: 69 6c 65 20 72 75 6e 2d 64 69 72 29 29 0a 09 09  ile run-dir))...
9620: 09 20 20 20 20 20 28 69 66 20 28 64 69 72 65 63  .     (if (direc
9630: 74 6f 72 79 3f 20 72 75 6e 2d 64 69 72 29 0a 09  tory? run-dir)..
9640: 09 09 09 20 28 69 66 20 28 3e 20 28 64 69 72 65  ... (if (> (dire
9650: 63 74 6f 72 79 2d 66 6f 6c 64 20 28 6c 61 6d 62  ctory-fold (lamb
9660: 64 61 20 28 66 20 78 29 28 2b 20 31 20 78 29 29  da (f x)(+ 1 x))
9670: 20 30 20 72 75 6e 2d 64 69 72 29 20 30 29 0a 09   0 run-dir) 0)..
9680: 09 09 09 20 20 20 20 20 28 64 65 62 75 67 3a 70  ...     (debug:p
9690: 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a  rint 0 "WARNING:
96a0: 20 72 65 66 75 73 69 6e 67 20 74 6f 20 72 65 6d   refusing to rem
96b0: 6f 76 65 20 22 20 72 75 6e 2d 64 69 72 20 22 20  ove " run-dir " 
96c0: 61 73 20 69 74 20 69 73 20 6e 6f 74 20 65 6d 70  as it is not emp
96d0: 74 79 22 29 0a 09 09 09 09 20 20 20 20 20 28 64  ty").....     (d
96e0: 65 6c 65 74 65 2d 64 69 72 65 63 74 6f 72 79 20  elete-directory 
96f0: 72 75 6e 2d 64 69 72 29 29 20 3b 3b 20 69 74 20  run-dir)) ;; it 
9700: 73 68 6f 75 6c 64 20 62 65 20 65 6d 70 74 79 20  should be empty 
9710: 62 79 20 68 65 72 65 20 42 55 47 20 42 55 47 2c  by here BUG BUG,
9720: 20 61 64 64 20 65 72 72 6f 72 20 63 61 74 63 68   add error catch
9730: 0a 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 69  ..... (debug:pri
9740: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 72 65 66  nt 0 "ERROR: ref
9750: 75 73 69 6e 67 20 74 6f 20 72 65 6d 6f 76 65 20  using to remove 
9760: 22 20 72 75 6e 2d 64 69 72 20 22 20 61 73 20 69  " run-dir " as i
9770: 74 20 65 69 74 68 65 72 20 64 6f 65 73 6e 27 74  t either doesn't
9780: 20 65 78 69 73 74 20 6f 72 20 69 73 20 6e 6f 74   exist or is not
9790: 20 61 20 73 79 6d 6c 69 6e 6b 20 6f 72 20 64 69   a symlink or di
97a0: 72 65 63 74 6f 72 79 22 29 0a 09 09 09 09 20 29  rectory")..... )
97b0: 29 29 0a 09 09 09 28 28 73 65 74 2d 73 74 61 74  ))....((set-stat
97c0: 65 2d 73 74 61 74 75 73 29 0a 09 09 09 20 28 64  e-status).... (d
97d0: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
97e0: 32 20 22 6e 65 77 20 73 74 61 74 65 20 22 20 28  2 "new state " (
97f0: 63 61 72 20 73 74 61 74 65 2d 73 74 61 74 75 73  car state-status
9800: 29 20 22 2c 20 6e 65 77 20 73 74 61 74 75 73 20  ) ", new status 
9810: 22 20 28 63 61 64 72 20 73 74 61 74 65 2d 73 74  " (cadr state-st
9820: 61 74 75 73 29 29 0a 09 09 09 20 28 6f 70 65 6e  atus)).... (open
9830: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 74 65  -run-close db:te
9840: 73 74 2d 73 65 74 2d 73 74 61 74 65 2d 73 74 61  st-set-state-sta
9850: 74 75 73 2d 62 79 2d 69 64 20 64 62 20 28 64 62  tus-by-id db (db
9860: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73  :test-get-id tes
9870: 74 29 20 28 63 61 72 20 73 74 61 74 65 2d 73 74  t) (car state-st
9880: 61 74 75 73 29 28 63 61 64 72 20 73 74 61 74 65  atus)(cadr state
9890: 2d 73 74 61 74 75 73 29 20 23 66 29 29 29 29 29  -status) #f)))))
98a0: 0a 09 09 20 20 28 73 6f 72 74 20 74 65 73 74 73  ...  (sort tests
98b0: 20 28 6c 61 6d 62 64 61 20 28 61 20 62 29 28 6c   (lambda (a b)(l
98c0: 65 74 20 28 28 64 69 72 61 20 28 64 62 3a 74 65  et ((dira (db:te
98d0: 73 74 2d 67 65 74 2d 72 75 6e 64 69 72 20 61 29  st-get-rundir a)
98e0: 29 0a 09 09 09 09 09 09 20 28 64 69 72 62 20 28  )....... (dirb (
98f0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 64  db:test-get-rund
9900: 69 72 20 62 29 29 29 0a 09 09 09 09 09 20 20 20  ir b)))......   
9910: 20 20 28 69 66 20 28 61 6e 64 20 28 73 74 72 69    (if (and (stri
9920: 6e 67 3f 20 64 69 72 61 29 28 73 74 72 69 6e 67  ng? dira)(string
9930: 3f 20 64 69 72 62 29 29 0a 09 09 09 09 09 09 20  ? dirb))....... 
9940: 28 3e 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74  (> (string-lengt
9950: 68 20 64 69 72 61 29 28 73 74 72 69 6e 67 2d 6c  h dira)(string-l
9960: 65 6e 67 74 68 20 64 69 72 62 29 29 0a 09 09 09  ength dirb))....
9970: 09 09 09 20 23 66 29 29 29 29 29 29 29 0a 09 20  ... #f))))))).. 
9980: 20 20 3b 3b 20 72 65 6d 6f 76 65 20 74 68 65 20    ;; remove the 
9990: 72 75 6e 20 69 66 20 7a 65 72 6f 20 74 65 73 74  run if zero test
99a0: 73 20 72 65 6d 61 69 6e 0a 09 20 20 20 28 69 66  s remain..   (if
99b0: 20 28 65 71 3f 20 61 63 74 69 6f 6e 20 27 72 65   (eq? action 're
99c0: 6d 6f 76 65 2d 72 75 6e 73 29 0a 09 20 20 20 20  move-runs)..    
99d0: 20 20 20 28 6c 65 74 20 28 28 72 65 6d 74 65 73     (let ((remtes
99e0: 74 73 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f  ts (open-run-clo
99f0: 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 73 2d  se db:get-tests-
9a00: 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 62 3a 67  for-run db (db:g
9a10: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64  et-value-by-head
9a20: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 69  er run header "i
9a30: 64 22 29 20 23 66 20 27 28 22 44 45 4c 45 54 45  d") #f '("DELETE
9a40: 44 22 29 20 27 28 22 6e 2f 61 22 29 20 6e 6f 74  D") '("n/a") not
9a50: 2d 69 6e 3a 20 23 74 29 29 29 0a 09 09 20 28 69  -in: #t)))... (i
9a60: 66 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74  f (null? remtest
9a70: 73 29 20 3b 3b 20 6e 6f 20 6d 6f 72 65 20 74 65  s) ;; no more te
9a80: 73 74 73 20 72 65 6d 61 69 6e 69 6e 67 0a 09 09  sts remaining...
9a90: 20 20 20 20 20 28 6c 65 74 2a 20 28 28 64 70 61       (let* ((dpa
9aa0: 72 74 73 20 20 28 73 74 72 69 6e 67 2d 73 70 6c  rts  (string-spl
9ab0: 69 74 20 6c 61 73 74 74 70 61 74 68 20 22 2f 22  it lasttpath "/"
9ac0: 29 29 0a 09 09 09 20 20 20 20 28 72 75 6e 70 61  ))....    (runpa
9ad0: 74 68 20 28 63 6f 6e 63 20 22 2f 22 20 28 73 74  th (conc "/" (st
9ae0: 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65  ring-intersperse
9af0: 20 0a 09 09 09 09 09 09 28 74 61 6b 65 20 64 70   .......(take dp
9b00: 61 72 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 20  arts (- (length 
9b10: 64 70 61 72 74 73 29 20 31 29 29 0a 09 09 09 09  dparts) 1)).....
9b20: 09 09 22 2f 22 29 29 29 29 0a 09 09 20 20 20 20  .."/"))))...    
9b30: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
9b40: 31 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 3a  1 "Removing run:
9b50: 20 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64   " runkey " " (d
9b60: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68  b:get-value-by-h
9b70: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72  eader run header
9b80: 20 22 72 75 6e 6e 61 6d 65 22 29 20 22 20 61 6e   "runname") " an
9b90: 64 20 72 65 6c 61 74 65 64 20 72 65 63 6f 72 64  d related record
9ba0: 22 29 0a 09 09 20 20 20 20 20 20 20 28 6f 70 65  ")...       (ope
9bb0: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64  n-run-close db:d
9bc0: 65 6c 65 74 65 2d 72 75 6e 20 64 62 20 72 75 6e  elete-run db run
9bd0: 2d 69 64 29 0a 09 09 20 20 20 20 20 20 20 3b 3b  -id)...       ;;
9be0: 20 54 68 69 73 20 69 73 20 61 20 70 72 65 74 74   This is a prett
9bf0: 79 20 67 6f 6f 64 20 70 6c 61 63 65 20 74 6f 20  y good place to 
9c00: 70 75 72 67 65 20 6f 6c 64 20 44 45 4c 45 54 45  purge old DELETE
9c10: 44 20 74 65 73 74 73 0a 09 09 20 20 20 20 20 20  D tests...      
9c20: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
9c30: 20 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 73   db:delete-tests
9c40: 2d 66 6f 72 2d 72 75 6e 20 64 62 20 72 75 6e 2d  -for-run db run-
9c50: 69 64 29 0a 09 09 20 20 20 20 20 20 20 28 6f 70  id)...       (op
9c60: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a  en-run-close db:
9c70: 64 65 6c 65 74 65 2d 6f 6c 64 2d 64 65 6c 65 74  delete-old-delet
9c80: 65 64 2d 74 65 73 74 2d 72 65 63 6f 72 64 73 20  ed-test-records 
9c90: 64 62 29 0a 09 09 20 20 20 20 20 20 20 28 6f 70  db)...       (op
9ca0: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a  en-run-close db:
9cb0: 73 65 74 2d 76 61 72 20 64 62 20 22 44 45 4c 45  set-var db "DELE
9cc0: 54 45 44 5f 54 45 53 54 53 22 20 28 63 75 72 72  TED_TESTS" (curr
9cd0: 65 6e 74 2d 73 65 63 6f 6e 64 73 29 29 0a 09 09  ent-seconds))...
9ce0: 20 20 20 20 20 20 20 3b 3b 20 6e 65 65 64 20 74         ;; need t
9cf0: 6f 20 66 69 67 75 72 65 20 6f 75 74 20 74 68 65  o figure out the
9d00: 20 70 61 74 68 20 74 6f 20 74 68 65 20 72 75 6e   path to the run
9d10: 20 64 69 72 20 61 6e 64 20 72 65 6d 6f 76 65 20   dir and remove 
9d20: 69 74 20 69 66 20 65 6d 70 74 79 0a 09 09 20 20  it if empty...  
9d30: 20 20 20 20 20 3b 3b 20 20 20 20 28 69 66 20 28       ;;    (if (
9d40: 6e 75 6c 6c 3f 20 28 67 6c 6f 62 20 28 63 6f 6e  null? (glob (con
9d50: 63 20 72 75 6e 70 61 74 68 20 22 2f 2a 22 29 29  c runpath "/*"))
9d60: 29 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 20 20  )...       ;;   
9d70: 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20       (begin...  
9d80: 20 20 20 20 20 3b 3b 20 09 20 28 64 65 62 75 67       ;; . (debug
9d90: 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69  :print 1 "Removi
9da0: 6e 67 20 72 75 6e 20 64 69 72 20 22 20 72 75 6e  ng run dir " run
9db0: 70 61 74 68 29 0a 09 09 20 20 20 20 20 20 20 3b  path)...       ;
9dc0: 3b 20 09 20 28 73 79 73 74 65 6d 20 28 63 6f 6e  ; . (system (con
9dd0: 63 20 22 72 6d 64 69 72 20 2d 70 20 22 20 72 75  c "rmdir -p " ru
9de0: 6e 70 61 74 68 29 29 29 29 0a 09 09 20 20 20 20  npath))))...    
9df0: 20 20 20 29 29 29 29 29 0a 09 20 29 29 0a 20 20     ))))).. )).  
9e00: 20 20 20 72 75 6e 73 29 29 0a 20 20 23 74 29 0a     runs)).  #t).
9e10: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  .;;=============
9e20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9e30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9e40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9e50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 75  =========.;; Rou
9e60: 74 69 6e 65 73 20 66 6f 72 20 6d 61 6e 69 70 75  tines for manipu
9e70: 6c 61 74 69 6e 67 20 72 75 6e 73 0a 3b 3b 3d 3d  lating runs.;;==
9e80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9e90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9ea0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9eb0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9ec0: 3d 3d 3d 3d 0a 0a 3b 3b 20 53 69 6e 63 65 20 6d  ====..;; Since m
9ed0: 61 6e 79 20 63 61 6c 6c 73 20 74 6f 20 61 20 72  any calls to a r
9ee0: 75 6e 20 72 65 71 75 69 72 65 20 70 72 65 74 74  un require prett
9ef0: 79 20 6d 75 63 68 20 74 68 65 20 73 61 6d 65 20  y much the same 
9f00: 73 65 74 75 70 20 0a 3b 3b 20 74 68 69 73 20 77  setup .;; this w
9f10: 72 61 70 70 65 72 20 69 73 20 75 73 65 64 20 74  rapper is used t
9f20: 6f 20 72 65 64 75 63 65 20 74 68 65 20 72 65 70  o reduce the rep
9f30: 6c 69 63 61 74 69 6f 6e 20 6f 66 20 63 6f 64 65  lication of code
9f40: 0a 28 64 65 66 69 6e 65 20 28 67 65 6e 65 72 61  .(define (genera
9f50: 6c 2d 72 75 6e 2d 63 61 6c 6c 20 73 77 69 74 63  l-run-call switc
9f60: 68 6e 61 6d 65 20 61 63 74 69 6f 6e 2d 64 65 73  hname action-des
9f70: 63 20 70 72 6f 63 29 0a 20 20 28 6c 65 74 20 28  c proc).  (let (
9f80: 28 72 75 6e 6e 61 6d 65 20 28 61 72 67 73 3a 67  (runname (args:g
9f90: 65 74 2d 61 72 67 20 22 3a 72 75 6e 6e 61 6d 65  et-arg ":runname
9fa0: 22 29 29 0a 09 28 74 61 72 67 65 74 20 20 28 69  "))..(target  (i
9fb0: 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20  f (args:get-arg 
9fc0: 22 2d 74 61 72 67 65 74 22 29 0a 09 09 20 20 20  "-target")...   
9fd0: 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20    (args:get-arg 
9fe0: 22 2d 74 61 72 67 65 74 22 29 0a 09 09 20 20 20  "-target")...   
9ff0: 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20    (args:get-arg 
a000: 22 2d 72 65 71 74 61 72 67 22 29 29 29 0a 09 28  "-reqtarg")))..(
a010: 74 68 31 20 20 20 20 20 23 66 29 29 0a 20 20 20  th1     #f)).   
a020: 20 28 63 6f 6e 64 0a 20 20 20 20 20 28 28 6e 6f   (cond.     ((no
a030: 74 20 74 61 72 67 65 74 29 0a 20 20 20 20 20 20  t target).      
a040: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
a050: 45 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67 20 72  ERROR: Missing r
a060: 65 71 75 69 72 65 64 20 70 61 72 61 6d 65 74 65  equired paramete
a070: 72 20 66 6f 72 20 22 20 73 77 69 74 63 68 6e 61  r for " switchna
a080: 6d 65 20 22 2c 20 79 6f 75 20 6d 75 73 74 20 73  me ", you must s
a090: 70 65 63 69 66 79 20 74 68 65 20 74 61 72 67 65  pecify the targe
a0a0: 74 20 77 69 74 68 20 2d 74 61 72 67 65 74 22 29  t with -target")
a0b0: 0a 20 20 20 20 20 20 28 65 78 69 74 20 33 29 29  .      (exit 3))
a0c0: 0a 20 20 20 20 20 28 28 6e 6f 74 20 72 75 6e 6e  .     ((not runn
a0d0: 61 6d 65 29 0a 20 20 20 20 20 20 28 64 65 62 75  ame).      (debu
a0e0: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52  g:print 0 "ERROR
a0f0: 3a 20 4d 69 73 73 69 6e 67 20 72 65 71 75 69 72  : Missing requir
a100: 65 64 20 70 61 72 61 6d 65 74 65 72 20 66 6f 72  ed parameter for
a110: 20 22 20 73 77 69 74 63 68 6e 61 6d 65 20 22 2c   " switchname ",
a120: 20 79 6f 75 20 6d 75 73 74 20 73 70 65 63 69 66   you must specif
a130: 79 20 74 68 65 20 72 75 6e 20 6e 61 6d 65 20 77  y the run name w
a140: 69 74 68 20 3a 72 75 6e 6e 61 6d 65 20 72 75 6e  ith :runname run
a150: 6e 61 6d 65 22 29 0a 20 20 20 20 20 20 28 65 78  name").      (ex
a160: 69 74 20 33 29 29 0a 20 20 20 20 20 28 65 6c 73  it 3)).     (els
a170: 65 0a 20 20 20 20 20 20 28 6c 65 74 20 28 28 64  e.      (let ((d
a180: 62 20 20 20 23 66 29 0a 09 20 20 20 20 28 6b 65  b   #f)..    (ke
a190: 79 73 20 23 66 29 29 0a 09 28 69 66 20 28 6e 6f  ys #f))..(if (no
a1a0: 74 20 28 73 65 74 75 70 2d 66 6f 72 2d 72 75 6e  t (setup-for-run
a1b0: 29 29 0a 09 20 20 20 20 28 62 65 67 69 6e 20 0a  ))..    (begin .
a1c0: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72  .      (debug:pr
a1d0: 69 6e 74 20 30 20 22 46 61 69 6c 65 64 20 74 6f  int 0 "Failed to
a1e0: 20 73 65 74 75 70 2c 20 65 78 69 74 69 6e 67 22   setup, exiting"
a1f0: 29 0a 09 20 20 20 20 20 20 28 65 78 69 74 20 31  )..      (exit 1
a200: 29 29 29 0a 09 28 69 66 20 28 61 72 67 73 3a 67  )))..(if (args:g
a210: 65 74 2d 61 72 67 20 22 2d 73 65 72 76 65 72 22  et-arg "-server"
a220: 29 0a 09 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e  )..    (open-run
a230: 2d 63 6c 6f 73 65 20 73 65 72 76 65 72 3a 73 74  -close server:st
a240: 61 72 74 20 64 62 20 28 61 72 67 73 3a 67 65 74  art db (args:get
a250: 2d 61 72 67 20 22 2d 73 65 72 76 65 72 22 29 29  -arg "-server"))
a260: 0a 20 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20  . .    (if (not 
a270: 28 6f 72 20 28 61 72 67 73 3a 67 65 74 2d 61 72  (or (args:get-ar
a280: 67 20 22 2d 72 75 6e 61 6c 6c 22 29 20 20 20 20  g "-runall")    
a290: 20 3b 3b 20 72 75 6e 61 6c 6c 20 61 6e 64 20 72   ;; runall and r
a2a0: 75 6e 74 65 73 74 73 20 61 72 65 20 61 6c 6c 6f  untests are allo
a2b0: 77 65 64 20 74 6f 20 62 65 20 73 65 72 76 65 72  wed to be server
a2c0: 73 0a 20 09 09 09 20 28 61 72 67 73 3a 67 65 74  s. ... (args:get
a2d0: 2d 61 72 67 20 22 2d 72 75 6e 74 65 73 74 73 22  -arg "-runtests"
a2e0: 29 29 29 0a 09 09 28 73 65 72 76 65 72 3a 63 6c  )))...(server:cl
a2f0: 69 65 6e 74 2d 73 65 74 75 70 29 29 29 0a 09 28  ient-setup)))..(
a300: 73 65 74 21 20 6b 65 79 73 20 28 6f 70 65 6e 2d  set! keys (open-
a310: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
a320: 2d 6b 65 79 73 20 64 62 29 29 0a 09 3b 3b 20 68  -keys db))..;; h
a330: 61 76 65 20 65 6e 6f 75 67 68 20 74 6f 20 70 72  ave enough to pr
a340: 6f 63 65 73 73 20 2d 74 61 72 67 65 74 20 6f 72  ocess -target or
a350: 20 2d 72 65 71 74 61 72 67 20 68 65 72 65 0a 09   -reqtarg here..
a360: 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72  (if (args:get-ar
a370: 67 20 22 2d 72 65 71 74 61 72 67 22 29 0a 09 20  g "-reqtarg").. 
a380: 20 20 20 28 6c 65 74 2a 20 28 28 72 75 6e 63 6f     (let* ((runco
a390: 6e 66 69 67 66 20 28 63 6f 6e 63 20 20 2a 74 6f  nfigf (conc  *to
a3a0: 70 70 61 74 68 2a 20 22 2f 72 75 6e 63 6f 6e 66  ppath* "/runconf
a3b0: 69 67 73 2e 63 6f 6e 66 69 67 22 29 29 20 3b 3b  igs.config")) ;;
a3c0: 20 44 4f 20 4e 4f 54 20 45 56 41 4c 55 41 54 45   DO NOT EVALUATE
a3d0: 20 41 4c 4c 20 0a 09 09 20 20 20 28 72 75 6e 63   ALL ...   (runc
a3e0: 6f 6e 66 69 67 20 20 28 72 65 61 64 2d 63 6f 6e  onfig  (read-con
a3f0: 66 69 67 20 72 75 6e 63 6f 6e 66 69 67 66 20 23  fig runconfigf #
a400: 66 20 23 66 20 65 6e 76 69 72 6f 6e 2d 70 61 74  f #f environ-pat
a410: 74 3a 20 23 66 29 29 29 20 0a 09 20 20 20 20 20  t: #f))) ..     
a420: 20 28 69 66 20 28 68 61 73 68 2d 74 61 62 6c 65   (if (hash-table
a430: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 72 75 6e  -ref/default run
a440: 63 6f 6e 66 69 67 20 28 61 72 67 73 3a 67 65 74  config (args:get
a450: 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29  -arg "-reqtarg")
a460: 20 23 66 29 0a 09 09 20 20 28 6b 65 79 73 3a 74   #f)...  (keys:t
a470: 61 72 67 65 74 2d 73 65 74 2d 61 72 67 73 20 6b  arget-set-args k
a480: 65 79 73 20 28 61 72 67 73 3a 67 65 74 2d 61 72  eys (args:get-ar
a490: 67 20 22 2d 72 65 71 74 61 72 67 22 29 20 61 72  g "-reqtarg") ar
a4a0: 67 73 3a 61 72 67 2d 68 61 73 68 29 0a 09 09 20  gs:arg-hash)... 
a4b0: 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 28 64   (begin...    (d
a4c0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
a4d0: 52 4f 52 3a 20 5b 22 20 28 61 72 67 73 3a 67 65  ROR: [" (args:ge
a4e0: 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22  t-arg "-reqtarg"
a4f0: 29 20 22 5d 20 6e 6f 74 20 66 6f 75 6e 64 20 69  ) "] not found i
a500: 6e 20 22 20 72 75 6e 63 6f 6e 66 69 67 66 29 0a  n " runconfigf).
a510: 09 09 20 20 20 20 28 69 66 20 64 62 20 28 73 71  ..    (if db (sq
a520: 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20  lite3:finalize! 
a530: 64 62 29 29 0a 09 09 20 20 20 20 28 65 78 69 74  db))...    (exit
a540: 20 31 29 29 29 29 0a 09 20 20 20 20 28 69 66 20   1))))..    (if 
a550: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
a560: 74 61 72 67 65 74 22 29 0a 09 09 28 6b 65 79 73  target")...(keys
a570: 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 72 67 73  :target-set-args
a580: 20 6b 65 79 73 20 28 61 72 67 73 3a 67 65 74 2d   keys (args:get-
a590: 61 72 67 20 22 2d 74 61 72 67 65 74 22 20 61 72  arg "-target" ar
a5a0: 67 73 3a 61 72 67 2d 68 61 73 68 29 20 61 72 67  gs:arg-hash) arg
a5b0: 73 3a 61 72 67 2d 68 61 73 68 29 29 29 0a 09 28  s:arg-hash)))..(
a5c0: 69 66 20 28 6e 6f 74 20 28 63 61 72 20 2a 63 6f  if (not (car *co
a5d0: 6e 66 69 67 69 6e 66 6f 2a 29 29 0a 09 20 20 20  nfiginfo*))..   
a5e0: 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 28   (begin..      (
a5f0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45  debug:print 0 "E
a600: 52 52 4f 52 3a 20 41 74 74 65 6d 70 74 65 64 20  RROR: Attempted 
a610: 74 6f 20 22 20 61 63 74 69 6f 6e 2d 64 65 73 63  to " action-desc
a620: 20 22 20 62 75 74 20 72 75 6e 20 61 72 65 61 20   " but run area 
a630: 63 6f 6e 66 69 67 20 66 69 6c 65 20 6e 6f 74 20  config file not 
a640: 66 6f 75 6e 64 22 29 0a 09 20 20 20 20 20 20 28  found")..      (
a650: 65 78 69 74 20 31 29 29 0a 09 20 20 20 20 3b 3b  exit 1))..    ;;
a660: 20 45 78 74 72 61 63 74 20 6f 75 74 20 73 74 75   Extract out stu
a670: 66 66 20 6e 65 65 64 65 64 20 69 6e 20 6d 6f 73  ff needed in mos
a680: 74 20 6f 72 20 6d 61 6e 79 20 63 61 6c 6c 73 0a  t or many calls.
a690: 09 20 20 20 20 3b 3b 20 68 65 72 65 20 74 68 65  .    ;; here the
a6a0: 6e 20 63 61 6c 6c 20 70 72 6f 63 0a 09 20 20 20  n call proc..   
a6b0: 20 28 6c 65 74 2a 20 28 28 6b 65 79 6e 61 6d 65   (let* ((keyname
a6c0: 73 20 20 20 28 6d 61 70 20 6b 65 79 3a 67 65 74  s   (map key:get
a6d0: 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79 73 29  -fieldname keys)
a6e0: 29 0a 09 09 20 20 20 28 6b 65 79 76 61 6c 6c 73  )...   (keyvalls
a6f0: 74 20 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69 73  t  (keys->vallis
a700: 74 20 6b 65 79 73 20 23 74 29 29 29 0a 09 20 20  t keys #t)))..  
a710: 20 20 20 20 28 70 72 6f 63 20 74 61 72 67 65 74      (proc target
a720: 20 72 75 6e 6e 61 6d 65 20 6b 65 79 73 20 6b 65   runname keys ke
a730: 79 6e 61 6d 65 73 20 6b 65 79 76 61 6c 6c 73 74  ynames keyvallst
a740: 29 29 29 0a 09 28 69 66 20 74 68 31 20 28 74 68  )))..(if th1 (th
a750: 72 65 61 64 2d 6a 6f 69 6e 21 20 74 68 31 29 29  read-join! th1))
a760: 0a 09 28 69 66 20 64 62 20 28 73 71 6c 69 74 65  ..(if db (sqlite
a770: 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 29 29  3:finalize! db))
a780: 0a 09 28 73 65 74 21 20 2a 64 69 64 73 6f 6d 65  ..(set! *didsome
a790: 74 68 69 6e 67 2a 20 23 74 29 29 29 29 29 29 0a  thing* #t)))))).
a7a0: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  .;;=============
a7b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a7c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a7d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a7e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4c 6f 63  =========.;; Loc
a7f0: 6b 2f 75 6e 6c 6f 63 6b 20 72 75 6e 73 0a 3b 3b  k/unlock runs.;;
a800: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a810: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a820: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a830: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a840: 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65 20  ======..(define 
a850: 28 72 75 6e 73 3a 68 61 6e 64 6c 65 2d 6c 6f 63  (runs:handle-loc
a860: 6b 69 6e 67 20 74 61 72 67 65 74 20 6b 65 79 73  king target keys
a870: 20 72 75 6e 6e 61 6d 65 20 6c 6f 63 6b 20 75 6e   runname lock un
a880: 6c 6f 63 6b 20 75 73 65 72 29 0a 20 20 28 6c 65  lock user).  (le
a890: 74 2a 20 28 28 64 62 20 20 20 20 20 20 20 23 66  t* ((db       #f
a8a0: 29 0a 09 20 28 72 75 6e 64 61 74 20 20 20 28 6f  ).. (rundat   (o
a8b0: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75  pen-run-close ru
a8c0: 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70  ns:get-runs-by-p
a8d0: 61 74 74 20 64 62 20 6b 65 79 73 20 72 75 6e 6e  att db keys runn
a8e0: 61 6d 65 29 29 0a 09 20 28 68 65 61 64 65 72 20  ame)).. (header 
a8f0: 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75    (vector-ref ru
a900: 6e 64 61 74 20 30 29 29 0a 09 20 28 72 75 6e 73  ndat 0)).. (runs
a910: 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66       (vector-ref
a920: 20 72 75 6e 64 61 74 20 31 29 29 29 0a 20 20 20   rundat 1))).   
a930: 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62   (for-each (lamb
a940: 64 61 20 28 72 75 6e 29 0a 09 09 28 6c 65 74 20  da (run)...(let 
a950: 28 28 72 75 6e 2d 69 64 20 28 64 62 3a 67 65 74  ((run-id (db:get
a960: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72  -value-by-header
a970: 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 22   run header "id"
a980: 29 29 29 0a 09 09 20 20 28 69 66 20 28 6f 72 20  )))...  (if (or 
a990: 6c 6f 63 6b 0a 09 09 09 20 20 28 61 6e 64 20 75  lock....  (and u
a9a0: 6e 6c 6f 63 6b 0a 09 09 09 20 20 20 20 20 20 20  nlock....       
a9b0: 28 62 65 67 69 6e 0a 09 09 09 09 20 28 70 72 69  (begin..... (pri
a9c0: 6e 74 20 22 44 6f 20 79 6f 75 20 72 65 61 6c 6c  nt "Do you reall
a9d0: 79 20 77 69 73 68 20 74 6f 20 75 6e 6c 6f 63 6b  y wish to unlock
a9e0: 20 72 75 6e 20 22 20 72 75 6e 2d 69 64 20 22 3f   run " run-id "?
a9f0: 5c 6e 20 20 20 79 2f 6e 3a 20 22 29 0a 09 09 09  \n   y/n: ")....
aa00: 09 20 28 65 71 75 61 6c 3f 20 22 79 22 20 28 72  . (equal? "y" (r
aa10: 65 61 64 2d 6c 69 6e 65 29 29 29 29 29 0a 09 09  ead-line)))))...
aa20: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d        (open-run-
aa30: 63 6c 6f 73 65 20 64 62 3a 6c 6f 63 6b 2f 75 6e  close db:lock/un
aa40: 6c 6f 63 6b 2d 72 75 6e 20 64 62 20 72 75 6e 2d  lock-run db run-
aa50: 69 64 20 6c 6f 63 6b 20 75 6e 6c 6f 63 6b 20 75  id lock unlock u
aa60: 73 65 72 29 0a 09 09 20 20 20 20 20 20 28 64 65  ser)...      (de
aa70: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 30  bug:print-info 0
aa80: 20 22 53 6b 69 70 70 69 6e 67 20 6c 6f 63 6b 2f   "Skipping lock/
aa90: 75 6e 6c 6f 63 6b 20 6f 6e 20 22 20 72 75 6e 2d  unlock on " run-
aaa0: 69 64 29 29 29 29 0a 09 20 20 20 20 20 20 72 75  id))))..      ru
aab0: 6e 73 29 29 29 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d  ns))).;;========
aac0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
aad0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
aae0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
aaf0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b  ==============.;
ab00: 3b 20 52 6f 6c 6c 75 70 20 72 75 6e 73 0a 3b 3b  ; Rollup runs.;;
ab10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
ab20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
ab30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
ab40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
ab50: 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 55 70 64 61 74  ======..;; Updat
ab60: 65 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61 20  e the test_meta 
ab70: 74 61 62 6c 65 20 66 6f 72 20 74 68 69 73 20 74  table for this t
ab80: 65 73 74 0a 28 64 65 66 69 6e 65 20 28 72 75 6e  est.(define (run
ab90: 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65  s:update-test_me
aba0: 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20  ta db test-name 
abb0: 74 65 73 74 2d 63 6f 6e 66 29 0a 20 20 28 6c 65  test-conf).  (le
abc0: 74 20 28 28 63 75 72 72 72 65 63 6f 72 64 20 28  t ((currrecord (
abd0: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64  open-run-close d
abe0: 62 3a 74 65 73 74 6d 65 74 61 2d 67 65 74 2d 72  b:testmeta-get-r
abf0: 65 63 6f 72 64 20 64 62 20 74 65 73 74 2d 6e 61  ecord db test-na
ac00: 6d 65 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e  me))).    (if (n
ac10: 6f 74 20 63 75 72 72 72 65 63 6f 72 64 29 0a 09  ot currrecord)..
ac20: 28 62 65 67 69 6e 0a 09 20 20 28 73 65 74 21 20  (begin..  (set! 
ac30: 63 75 72 72 72 65 63 6f 72 64 20 28 6d 61 6b 65  currrecord (make
ac40: 2d 76 65 63 74 6f 72 20 31 30 20 23 66 29 29 0a  -vector 10 #f)).
ac50: 09 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f  .  (open-run-clo
ac60: 73 65 20 64 62 3a 74 65 73 74 6d 65 74 61 2d 61  se db:testmeta-a
ac70: 64 64 2d 72 65 63 6f 72 64 20 64 62 20 74 65 73  dd-record db tes
ac80: 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 66  t-name))).    (f
ac90: 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c  or-each .     (l
aca0: 61 6d 62 64 61 20 28 6b 65 79 29 0a 20 20 20 20  ambda (key).    
acb0: 20 20 20 28 6c 65 74 2a 20 28 28 69 64 78 20 28     (let* ((idx (
acc0: 63 61 64 72 20 6b 65 79 29 29 0a 09 20 20 20 20  cadr key))..    
acd0: 20 20 28 66 6c 64 20 28 63 61 72 20 20 6b 65 79    (fld (car  key
ace0: 29 29 0a 09 20 20 20 20 20 20 28 76 61 6c 20 28  ))..      (val (
acf0: 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 65  config-lookup te
ad00: 73 74 2d 63 6f 6e 66 20 22 74 65 73 74 5f 6d 65  st-conf "test_me
ad10: 74 61 22 20 66 6c 64 29 29 29 0a 09 20 3b 3b 20  ta" fld))).. ;; 
ad20: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 35 20 22  (debug:print 5 "
ad30: 69 64 78 3a 20 22 20 69 64 78 20 22 20 66 6c 64  idx: " idx " fld
ad40: 3a 20 22 20 66 6c 64 20 22 20 76 61 6c 3a 20 22  : " fld " val: "
ad50: 20 76 61 6c 29 0a 09 20 28 69 66 20 28 61 6e 64   val).. (if (and
ad60: 20 76 61 6c 20 28 6e 6f 74 20 28 65 71 75 61 6c   val (not (equal
ad70: 3f 20 28 76 65 63 74 6f 72 2d 72 65 66 20 63 75  ? (vector-ref cu
ad80: 72 72 72 65 63 6f 72 64 20 69 64 78 29 20 76 61  rrrecord idx) va
ad90: 6c 29 29 29 0a 09 20 20 20 20 20 28 62 65 67 69  l)))..     (begi
ada0: 6e 0a 09 20 20 20 20 20 20 20 28 70 72 69 6e 74  n..       (print
adb0: 20 22 55 70 64 61 74 69 6e 67 20 22 20 74 65 73   "Updating " tes
adc0: 74 2d 6e 61 6d 65 20 22 20 22 20 66 6c 64 20 22  t-name " " fld "
add0: 20 74 6f 20 22 20 76 61 6c 29 0a 09 20 20 20 20   to " val)..    
ade0: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f     (open-run-clo
adf0: 73 65 20 64 62 3a 74 65 73 74 6d 65 74 61 2d 75  se db:testmeta-u
ae00: 70 64 61 74 65 2d 66 69 65 6c 64 20 64 62 20 74  pdate-field db t
ae10: 65 73 74 2d 6e 61 6d 65 20 66 6c 64 20 76 61 6c  est-name fld val
ae20: 29 29 29 29 29 0a 20 20 20 20 20 27 28 28 22 61  ))))).     '(("a
ae30: 75 74 68 6f 72 22 20 32 29 28 22 6f 77 6e 65 72  uthor" 2)("owner
ae40: 22 20 33 29 28 22 64 65 73 63 72 69 70 74 69 6f  " 3)("descriptio
ae50: 6e 22 20 34 29 28 22 72 65 76 69 65 77 65 64 22  n" 4)("reviewed"
ae60: 20 35 29 28 22 74 61 67 73 22 20 39 29 29 29 29   5)("tags" 9))))
ae70: 29 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74 65 73  )..;; Update tes
ae80: 74 5f 6d 65 74 61 20 66 6f 72 20 61 6c 6c 20 74  t_meta for all t
ae90: 65 73 74 73 0a 28 64 65 66 69 6e 65 20 28 72 75  ests.(define (ru
aea0: 6e 73 3a 75 70 64 61 74 65 2d 61 6c 6c 2d 74 65  ns:update-all-te
aeb0: 73 74 5f 6d 65 74 61 20 64 62 29 0a 20 20 28 6c  st_meta db).  (l
aec0: 65 74 20 28 28 74 65 73 74 2d 6e 61 6d 65 73 20  et ((test-names 
aed0: 28 67 65 74 2d 61 6c 6c 2d 6c 65 67 61 6c 2d 74  (get-all-legal-t
aee0: 65 73 74 73 29 29 29 0a 20 20 20 20 28 66 6f 72  ests))).    (for
aef0: 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d  -each .     (lam
af00: 62 64 61 20 28 74 65 73 74 2d 6e 61 6d 65 29 0a  bda (test-name).
af10: 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74         (let* ((t
af20: 65 73 74 2d 70 61 74 68 20 20 20 20 28 63 6f 6e  est-path    (con
af30: 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65  c *toppath* "/te
af40: 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29  sts/" test-name)
af50: 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d 63  )..      (test-c
af60: 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 74 65 73  onfigf (conc tes
af70: 74 2d 70 61 74 68 20 22 2f 74 65 73 74 63 6f 6e  t-path "/testcon
af80: 66 69 67 22 29 29 0a 09 20 20 20 20 20 20 28 74  fig"))..      (t
af90: 65 73 74 65 78 69 73 74 73 20 20 20 28 61 6e 64  estexists   (and
afa0: 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 74   (file-exists? t
afb0: 65 73 74 2d 63 6f 6e 66 69 67 66 29 28 66 69 6c  est-configf)(fil
afc0: 65 2d 72 65 61 64 2d 61 63 63 65 73 73 3f 20 74  e-read-access? t
afd0: 65 73 74 2d 63 6f 6e 66 69 67 66 29 29 29 0a 09  est-configf)))..
afe0: 20 20 20 20 20 20 3b 3b 20 72 65 61 64 20 63 6f        ;; read co
aff0: 6e 66 69 67 73 20 77 69 74 68 20 74 72 69 63 6b  nfigs with trick
b000: 73 20 74 75 72 6e 65 64 20 6f 66 66 20 28 69 2e  s turned off (i.
b010: 65 2e 20 6e 6f 20 73 79 73 74 65 6d 29 0a 09 20  e. no system).. 
b020: 20 20 20 20 20 28 74 65 73 74 2d 63 6f 6e 66 20       (test-conf 
b030: 20 20 20 28 69 66 20 74 65 73 74 65 78 69 73 74     (if testexist
b040: 73 20 28 72 65 61 64 2d 63 6f 6e 66 69 67 20 74  s (read-config t
b050: 65 73 74 2d 63 6f 6e 66 69 67 66 20 23 66 20 23  est-configf #f #
b060: 66 29 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62  f)(make-hash-tab
b070: 6c 65 29 29 29 29 0a 09 20 3b 3b 20 75 73 65 20  le)))).. ;; use 
b080: 74 68 65 20 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f  the open-run-clo
b090: 73 65 20 69 6e 73 74 65 61 64 20 6f 66 20 70 61  se instead of pa
b0a0: 73 73 69 6e 67 20 69 6e 20 64 62 0a 09 20 28 72  ssing in db.. (r
b0b0: 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f  uns:update-test_
b0c0: 6d 65 74 61 20 23 66 20 74 65 73 74 2d 6e 61 6d  meta #f test-nam
b0d0: 65 20 74 65 73 74 2d 63 6f 6e 66 29 29 29 0a 20  e test-conf))). 
b0e0: 20 20 20 20 74 65 73 74 2d 6e 61 6d 65 73 29 29      test-names))
b0f0: 29 0a 0a 3b 3b 20 54 68 69 73 20 63 6f 75 6c 64  )..;; This could
b100: 20 70 72 6f 62 61 62 6c 79 20 62 65 20 72 65 66   probably be ref
b110: 61 63 74 6f 72 65 64 20 69 6e 74 6f 20 6f 6e 65  actored into one
b120: 20 63 6f 6d 70 6c 65 78 20 71 75 65 72 79 20 2e   complex query .
b130: 2e 2e 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73  ...(define (runs
b140: 3a 72 6f 6c 6c 75 70 2d 72 75 6e 20 6b 65 79 73  :rollup-run keys
b150: 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61   keyvallst runna
b160: 6d 65 20 75 73 65 72 29 20 3b 3b 20 77 61 73 20  me user) ;; was 
b170: 74 61 72 67 65 74 2c 20 6e 6f 77 20 6b 65 79 76  target, now keyv
b180: 61 6c 6c 73 74 0a 20 20 28 64 65 62 75 67 3a 70  allst.  (debug:p
b190: 72 69 6e 74 20 34 20 22 72 75 6e 73 3a 72 6f 6c  rint 4 "runs:rol
b1a0: 6c 75 70 2d 72 75 6e 2c 20 6b 65 79 73 3a 20 22  lup-run, keys: "
b1b0: 20 6b 65 79 73 20 22 20 6b 65 79 76 61 6c 6c 73   keys " keyvalls
b1c0: 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 20 22  t: " keyvallst "
b1d0: 20 3a 72 75 6e 6e 61 6d 65 20 22 20 72 75 6e 6e   :runname " runn
b1e0: 61 6d 65 20 22 20 75 73 65 72 3a 20 22 20 75 73  ame " user: " us
b1f0: 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 28 64 62  er).  (let* ((db
b200: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 66                #f
b210: 29 20 3b 3b 20 28 6b 65 79 76 61 6c 6c 6c 73 74  ) ;; (keyvalllst
b220: 20 20 20 20 20 20 28 6b 65 79 73 3a 74 61 72 67        (keys:targ
b230: 65 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 79 73 20  et->keyval keys 
b240: 74 61 72 67 65 74 29 29 0a 09 20 28 6e 65 77 2d  target)).. (new-
b250: 72 75 6e 2d 69 64 20 20 20 20 20 20 28 6f 70 65  run-id      (ope
b260: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73  n-run-close runs
b270: 3a 72 65 67 69 73 74 65 72 2d 72 75 6e 20 64 62  :register-run db
b280: 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20   keys keyvallst 
b290: 72 75 6e 6e 61 6d 65 20 22 6e 65 77 22 20 22 6e  runname "new" "n
b2a0: 2f 61 22 20 75 73 65 72 29 29 0a 09 20 28 70 72  /a" user)).. (pr
b2b0: 65 76 2d 74 65 73 74 73 20 20 20 20 20 20 28 6f  ev-tests      (o
b2c0: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 74 65  pen-run-close te
b2d0: 73 74 3a 67 65 74 2d 6d 61 74 63 68 69 6e 67 2d  st:get-matching-
b2e0: 70 72 65 76 69 6f 75 73 2d 74 65 73 74 2d 72 75  previous-test-ru
b2f0: 6e 2d 72 65 63 6f 72 64 73 20 64 62 20 6e 65 77  n-records db new
b300: 2d 72 75 6e 2d 69 64 20 22 25 22 20 22 25 22 29  -run-id "%" "%")
b310: 29 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73 20  ).. (curr-tests 
b320: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
b330: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74  lose db:get-test
b340: 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77  s-for-run db new
b350: 2d 72 75 6e 2d 69 64 20 22 25 2f 25 22 20 27 28  -run-id "%/%" '(
b360: 29 20 27 28 29 29 29 0a 09 20 28 63 75 72 72 2d  ) '())).. (curr-
b370: 74 65 73 74 73 2d 68 61 73 68 20 28 6d 61 6b 65  tests-hash (make
b380: 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 20  -hash-table))). 
b390: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f     (open-run-clo
b3a0: 73 65 20 64 62 3a 75 70 64 61 74 65 2d 72 75 6e  se db:update-run
b3b0: 2d 65 76 65 6e 74 5f 74 69 6d 65 20 64 62 20 6e  -event_time db n
b3c0: 65 77 2d 72 75 6e 2d 69 64 29 0a 20 20 20 20 3b  ew-run-id).    ;
b3d0: 3b 20 69 6e 64 65 78 20 74 68 65 20 61 6c 72 65  ; index the alre
b3e0: 61 64 79 20 73 61 76 65 64 20 74 65 73 74 73 20  ady saved tests 
b3f0: 62 79 20 74 65 73 74 6e 61 6d 65 20 61 6e 64 20  by testname and 
b400: 69 74 65 6d 64 61 74 20 69 6e 20 63 75 72 72 2d  itemdat in curr-
b410: 74 65 73 74 73 2d 68 61 73 68 0a 20 20 20 20 28  tests-hash.    (
b420: 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 28 6c  for-each.     (l
b430: 61 6d 62 64 61 20 28 74 65 73 74 64 61 74 29 0a  ambda (testdat).
b440: 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74         (let* ((t
b450: 65 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 65 73  estname  (db:tes
b460: 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74  t-get-testname t
b470: 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20  estdat))..      
b480: 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74  (item-path (db:t
b490: 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74  est-get-item-pat
b4a0: 68 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20  h testdat))..   
b4b0: 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 63     (full-name (c
b4c0: 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22  onc testname "/"
b4d0: 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 09 20   item-path))).. 
b4e0: 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21  (hash-table-set!
b4f0: 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68   curr-tests-hash
b500: 20 66 75 6c 6c 2d 6e 61 6d 65 20 74 65 73 74 64   full-name testd
b510: 61 74 29 29 29 0a 20 20 20 20 20 63 75 72 72 2d  at))).     curr-
b520: 74 65 73 74 73 29 0a 20 20 20 20 3b 3b 20 4e 4f  tests).    ;; NO
b530: 50 45 3a 20 4e 6f 6e 2d 6f 70 74 69 6d 61 6c 20  PE: Non-optimal 
b540: 61 70 70 72 6f 61 63 68 2e 20 54 72 79 20 74 68  approach. Try th
b550: 69 73 20 69 6e 73 74 65 61 64 2e 0a 20 20 20 20  is instead..    
b560: 3b 3b 20 20 20 31 2e 20 74 65 73 74 73 20 61 72  ;;   1. tests ar
b570: 65 20 72 65 63 65 69 76 65 64 20 69 6e 20 61 20  e received in a 
b580: 6c 69 73 74 2c 20 6d 6f 73 74 20 72 65 63 65 6e  list, most recen
b590: 74 20 66 69 72 73 74 0a 20 20 20 20 3b 3b 20 20  t first.    ;;  
b5a0: 20 32 2e 20 72 65 70 6c 61 63 65 20 74 68 65 20   2. replace the 
b5b0: 72 6f 6c 6c 75 70 20 74 65 73 74 20 77 69 74 68  rollup test with
b5c0: 20 74 68 65 20 6e 65 77 20 2a 61 6c 77 61 79 73   the new *always
b5d0: 2a 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20  *.    (for-each 
b5e0: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74  .     (lambda (t
b5f0: 65 73 74 64 61 74 29 0a 20 20 20 20 20 20 20 28  estdat).       (
b600: 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 20  let* ((testname 
b610: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65   (db:test-get-te
b620: 73 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29  stname testdat))
b630: 0a 09 20 20 20 20 20 20 28 69 74 65 6d 2d 70 61  ..      (item-pa
b640: 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  th (db:test-get-
b650: 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 64 61  item-path testda
b660: 74 29 29 0a 09 20 20 20 20 20 20 28 66 75 6c 6c  t))..      (full
b670: 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74  -name (conc test
b680: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61  name "/" item-pa
b690: 74 68 29 29 0a 09 20 20 20 20 20 20 28 70 72 65  th))..      (pre
b6a0: 76 2d 74 65 73 74 2d 64 61 74 20 28 68 61 73 68  v-test-dat (hash
b6b0: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75  -table-ref/defau
b6c0: 6c 74 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61  lt curr-tests-ha
b6d0: 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 23 66 29  sh full-name #f)
b6e0: 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d 73  )..      (test-s
b6f0: 74 65 70 73 20 20 20 20 20 20 28 6f 70 65 6e 2d  teps      (open-
b700: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
b710: 2d 73 74 65 70 73 2d 66 6f 72 2d 74 65 73 74 20  -steps-for-test 
b720: 64 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  db (db:test-get-
b730: 69 64 20 74 65 73 74 64 61 74 29 29 29 0a 09 20  id testdat))).. 
b740: 20 20 20 20 20 28 6e 65 77 2d 74 65 73 74 2d 72       (new-test-r
b750: 65 63 6f 72 64 20 23 66 29 29 0a 09 20 3b 3b 20  ecord #f)).. ;; 
b760: 72 65 70 6c 61 63 65 20 74 68 65 73 65 20 77 69  replace these wi
b770: 74 68 20 69 6e 73 65 72 74 20 2e 2e 2e 20 73 65  th insert ... se
b780: 6c 65 63 74 0a 09 20 28 61 70 70 6c 79 20 73 71  lect.. (apply sq
b790: 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09  lite3:execute ..
b7a0: 09 64 62 20 0a 09 09 28 63 6f 6e 63 20 22 49 4e  .db ...(conc "IN
b7b0: 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20  SERT OR REPLACE 
b7c0: 49 4e 54 4f 20 74 65 73 74 73 20 28 72 75 6e 5f  INTO tests (run_
b7d0: 69 64 2c 74 65 73 74 6e 61 6d 65 2c 73 74 61 74  id,testname,stat
b7e0: 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74  e,status,event_t
b7f0: 69 6d 65 2c 68 6f 73 74 2c 63 70 75 6c 6f 61 64  ime,host,cpuload
b800: 2c 64 69 73 6b 66 72 65 65 2c 75 6e 61 6d 65 2c  ,diskfree,uname,
b810: 72 75 6e 64 69 72 2c 69 74 65 6d 5f 70 61 74 68  rundir,item_path
b820: 2c 72 75 6e 5f 64 75 72 61 74 69 6f 6e 2c 66 69  ,run_duration,fi
b830: 6e 61 6c 5f 6c 6f 67 66 2c 63 6f 6d 6d 65 6e 74  nal_logf,comment
b840: 29 20 22 0a 09 09 20 20 20 20 20 20 22 56 41 4c  ) "...      "VAL
b850: 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f  UES (?,?,?,?,?,?
b860: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f  ,?,?,?,?,?,?,?,?
b870: 29 3b 22 29 0a 09 09 6e 65 77 2d 72 75 6e 2d 69  );")...new-run-i
b880: 64 20 28 63 64 64 72 20 28 76 65 63 74 6f 72 2d  d (cddr (vector-
b890: 3e 6c 69 73 74 20 74 65 73 74 64 61 74 29 29 29  >list testdat)))
b8a0: 0a 09 20 28 73 65 74 21 20 6e 65 77 2d 74 65 73  .. (set! new-tes
b8b0: 74 64 61 74 20 28 63 61 72 20 28 6f 70 65 6e 2d  tdat (car (open-
b8c0: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
b8d0: 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64  -tests-for-run d
b8e0: 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 28 63 6f  b new-run-id (co
b8f0: 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22 20  nc testname "/" 
b900: 69 74 65 6d 2d 70 61 74 68 29 20 27 28 29 20 27  item-path) '() '
b910: 28 29 29 29 29 0a 09 20 28 68 61 73 68 2d 74 61  ()))).. (hash-ta
b920: 62 6c 65 2d 73 65 74 21 20 63 75 72 72 2d 74 65  ble-set! curr-te
b930: 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61  sts-hash full-na
b940: 6d 65 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20  me new-testdat) 
b950: 3b 3b 20 74 68 69 73 20 63 6f 75 6c 64 20 62 65  ;; this could be
b960: 20 63 6f 6e 66 75 73 69 6e 67 2c 20 77 68 69 63   confusing, whic
b970: 68 20 72 65 63 6f 72 64 20 73 68 6f 75 6c 64 20  h record should 
b980: 67 6f 20 69 6e 74 6f 20 74 68 65 20 6c 6f 6f 6b  go into the look
b990: 75 70 20 74 61 62 6c 65 3f 0a 09 20 3b 3b 20 4e  up table?.. ;; N
b9a0: 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74 68 65  ow duplicate the
b9b0: 20 74 65 73 74 20 73 74 65 70 73 0a 09 20 28 64   test steps.. (d
b9c0: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 43 6f  ebug:print 4 "Co
b9d0: 70 79 69 6e 67 20 72 65 63 6f 72 64 73 20 69 6e  pying records in
b9e0: 20 74 65 73 74 5f 73 74 65 70 73 20 66 72 6f 6d   test_steps from
b9f0: 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62 3a 74   test_id=" (db:t
ba00: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64  est-get-id testd
ba10: 61 74 29 20 22 20 74 6f 20 22 20 28 64 62 3a 74  at) " to " (db:t
ba20: 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74  est-get-id new-t
ba30: 65 73 74 64 61 74 29 29 0a 09 20 28 6f 70 65 6e  estdat)).. (open
ba40: 2d 72 75 6e 2d 63 6c 6f 73 65 20 0a 09 20 20 28  -run-close ..  (
ba50: 6c 61 6d 62 64 61 20 28 29 0a 09 20 20 20 20 28  lambda ()..    (
ba60: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20  sqlite3:execute 
ba70: 0a 09 20 20 20 20 20 64 62 20 0a 09 20 20 20 20  ..     db ..    
ba80: 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f   (conc "INSERT O
ba90: 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74  R REPLACE INTO t
baa0: 65 73 74 5f 73 74 65 70 73 20 28 74 65 73 74 5f  est_steps (test_
bab0: 69 64 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 74  id,stepname,stat
bac0: 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74  e,status,event_t
bad0: 69 6d 65 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09  ime,comment) "..
bae0: 09 20 20 20 22 53 45 4c 45 43 54 20 22 20 28 64  .   "SELECT " (d
baf0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65  b:test-get-id ne
bb00: 77 2d 74 65 73 74 64 61 74 29 20 22 2c 73 74 65  w-testdat) ",ste
bb10: 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74  pname,state,stat
bb20: 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f  us,event_time,co
bb30: 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f  mment FROM test_
bb40: 73 74 65 70 73 20 57 48 45 52 45 20 74 65 73 74  steps WHERE test
bb50: 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 20 20 20 28  _id=?;")..     (
bb60: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74  db:test-get-id t
bb70: 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 3b 3b  estdat))..    ;;
bb80: 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74   Now duplicate t
bb90: 68 65 20 74 65 73 74 20 64 61 74 61 0a 09 20 20  he test data..  
bba0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34    (debug:print 4
bbb0: 20 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64   "Copying record
bbc0: 73 20 69 6e 20 74 65 73 74 5f 64 61 74 61 20 66  s in test_data f
bbd0: 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64  rom test_id=" (d
bbe0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65  b:test-get-id te
bbf0: 73 74 64 61 74 29 20 22 20 74 6f 20 22 20 28 64  stdat) " to " (d
bc00: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65  b:test-get-id ne
bc10: 77 2d 74 65 73 74 64 61 74 29 29 0a 09 20 20 20  w-testdat))..   
bc20: 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74   (sqlite3:execut
bc30: 65 20 0a 09 20 20 20 20 20 64 62 20 0a 09 20 20  e ..     db ..  
bc40: 20 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54     (conc "INSERT
bc50: 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f   OR REPLACE INTO
bc60: 20 74 65 73 74 5f 64 61 74 61 20 28 74 65 73 74   test_data (test
bc70: 5f 69 64 2c 63 61 74 65 67 6f 72 79 2c 76 61 72  _id,category,var
bc80: 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65  iable,value,expe
bc90: 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63  cted,tol,units,c
bca0: 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 22  omment) "...   "
bcb0: 53 45 4c 45 43 54 20 22 20 28 64 62 3a 74 65 73  SELECT " (db:tes
bcc0: 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73  t-get-id new-tes
bcd0: 74 64 61 74 29 20 22 2c 63 61 74 65 67 6f 72 79  tdat) ",category
bce0: 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c  ,variable,value,
bcf0: 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69  expected,tol,uni
bd00: 74 73 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20  ts,comment FROM 
bd10: 74 65 73 74 5f 64 61 74 61 20 57 48 45 52 45 20  test_data WHERE 
bd20: 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20  test_id=?;")..  
bd30: 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d     (db:test-get-
bd40: 69 64 20 74 65 73 74 64 61 74 29 29 29 29 0a 09  id testdat))))..
bd50: 20 29 29 0a 20 20 20 20 20 70 72 65 76 2d 74 65   )).     prev-te
bd60: 73 74 73 29 29 29 0a 09 20 0a 20 20 20 20 20 0a  sts))).. .     .