Megatest

Hex Artifact Content
Login

Artifact ac5e3e62fc18384f6b7ff20cdd10678151913ecc:


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 64 62  #f)..(define (db
09e0: 3a 67 65 74 2d 72 75 6e 2d 6b 65 79 2d 76 61 6c  :get-run-key-val
09f0: 20 64 62 20 72 75 6e 2d 69 64 20 6b 65 79 29 0a   db run-id key).
0a00: 20 20 28 6c 65 74 20 28 28 72 65 73 20 23 66 29    (let ((res #f)
0a10: 29 0a 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66  ).    (sqlite3:f
0a20: 6f 72 2d 65 61 63 68 2d 72 6f 77 0a 20 20 20 20  or-each-row.    
0a30: 20 28 6c 61 6d 62 64 61 20 28 76 61 6c 29 0a 20   (lambda (val). 
0a40: 20 20 20 20 20 20 28 73 65 74 21 20 72 65 73 20        (set! res 
0a50: 76 61 6c 29 29 0a 20 20 20 20 20 64 62 20 0a 20  val)).     db . 
0a60: 20 20 20 20 28 63 6f 6e 63 20 22 53 45 4c 45 43      (conc "SELEC
0a70: 54 20 22 20 28 6b 65 79 3a 67 65 74 2d 66 69 65  T " (key:get-fie
0a80: 6c 64 6e 61 6d 65 20 6b 65 79 29 20 22 20 46 52  ldname key) " FR
0a90: 4f 4d 20 72 75 6e 73 20 57 48 45 52 45 20 69 64  OM runs WHERE id
0aa0: 3d 3f 3b 22 29 0a 20 20 20 20 20 72 75 6e 2d 69  =?;").     run-i
0ab0: 64 29 0a 20 20 20 20 72 65 73 29 29 0a 0a 28 64  d).    res))..(d
0ac0: 65 66 69 6e 65 20 28 64 62 3a 67 65 74 2d 72 75  efine (db:get-ru
0ad0: 6e 2d 6e 61 6d 65 2d 66 72 6f 6d 2d 69 64 20 64  n-name-from-id d
0ae0: 62 20 72 75 6e 2d 69 64 29 0a 20 20 28 6c 65 74  b run-id).  (let
0af0: 20 28 28 72 65 73 20 23 66 29 29 0a 20 20 20 20   ((res #f)).    
0b00: 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63  (sqlite3:for-eac
0b10: 68 2d 72 6f 77 0a 20 20 20 20 20 28 6c 61 6d 62  h-row.     (lamb
0b20: 64 61 20 28 72 75 6e 6e 61 6d 65 29 0a 20 20 20  da (runname).   
0b30: 20 20 20 20 28 73 65 74 21 20 72 65 73 20 72 75      (set! res ru
0b40: 6e 6e 61 6d 65 29 29 0a 20 20 20 20 20 64 62 0a  nname)).     db.
0b50: 20 20 20 20 20 22 53 45 4c 45 43 54 20 72 75 6e       "SELECT run
0b60: 6e 61 6d 65 20 46 52 4f 4d 20 72 75 6e 73 20 57  name FROM runs W
0b70: 48 45 52 45 20 69 64 3d 3f 3b 22 0a 20 20 20 20  HERE id=?;".    
0b80: 20 72 75 6e 2d 69 64 29 0a 20 20 20 20 72 65 73   run-id).    res
0b90: 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 73 65 74  ))..(define (set
0ba0: 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61  -megatest-env-va
0bb0: 72 73 20 72 75 6e 2d 69 64 29 0a 20 20 28 6c 65  rs run-id).  (le
0bc0: 74 20 28 28 6b 65 79 73 20 28 63 64 62 3a 72 65  t ((keys (cdb:re
0bd0: 6d 6f 74 65 2d 72 75 6e 20 64 62 3a 67 65 74 2d  mote-run db:get-
0be0: 6b 65 79 73 20 23 66 29 29 0a 09 28 76 61 6c 73  keys #f))..(vals
0bf0: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66   (hash-table-ref
0c00: 2f 64 65 66 61 75 6c 74 20 2a 65 6e 76 2d 76 61  /default *env-va
0c10: 72 73 2d 62 79 2d 72 75 6e 2d 69 64 2a 20 72 75  rs-by-run-id* ru
0c20: 6e 2d 69 64 20 23 66 29 29 29 0a 20 20 20 20 3b  n-id #f))).    ;
0c30: 3b 20 67 65 74 20 74 68 65 20 69 6e 66 6f 20 66  ; get the info f
0c40: 72 6f 6d 20 74 68 65 20 64 62 20 61 6e 64 20 70  rom the db and p
0c50: 75 74 20 69 74 20 69 6e 20 74 68 65 20 63 61 63  ut it in the cac
0c60: 68 65 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20  he.    (if (not 
0c70: 76 61 6c 73 29 0a 09 28 6c 65 74 20 28 28 68 74  vals)..(let ((ht
0c80: 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c   (make-hash-tabl
0c90: 65 29 29 29 0a 09 20 20 28 68 61 73 68 2d 74 61  e)))..  (hash-ta
0ca0: 62 6c 65 2d 73 65 74 21 20 2a 65 6e 76 2d 76 61  ble-set! *env-va
0cb0: 72 73 2d 62 79 2d 72 75 6e 2d 69 64 2a 20 72 75  rs-by-run-id* ru
0cc0: 6e 2d 69 64 20 68 74 29 0a 09 20 20 28 73 65 74  n-id ht)..  (set
0cd0: 21 20 76 61 6c 73 20 68 74 29 0a 09 20 20 28 66  ! vals ht)..  (f
0ce0: 6f 72 2d 65 61 63 68 0a 09 20 20 20 28 6c 61 6d  or-each..   (lam
0cf0: 62 64 61 20 28 6b 65 79 29 0a 09 20 20 20 20 20  bda (key)..     
0d00: 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21  (hash-table-set!
0d10: 20 76 61 6c 73 20 6b 65 79 20 28 63 64 62 3a 72   vals key (cdb:r
0d20: 65 6d 6f 74 65 2d 72 75 6e 20 64 62 3a 67 65 74  emote-run db:get
0d30: 2d 72 75 6e 2d 6b 65 79 2d 76 61 6c 20 23 66 20  -run-key-val #f 
0d40: 72 75 6e 2d 69 64 20 6b 65 79 29 29 29 0a 09 20  run-id key))).. 
0d50: 20 20 6b 65 79 73 29 29 29 0a 20 20 20 20 3b 3b    keys))).    ;;
0d60: 20 66 72 6f 6d 20 74 68 65 20 63 61 63 68 65 64   from the cached
0d70: 20 64 61 74 61 20 73 65 74 20 74 68 65 20 76 61   data set the va
0d80: 72 73 0a 20 20 20 20 28 68 61 73 68 2d 74 61 62  rs.    (hash-tab
0d90: 6c 65 2d 66 6f 72 2d 65 61 63 68 0a 20 20 20 20  le-for-each.    
0da0: 20 76 61 6c 73 0a 20 20 20 20 20 28 6c 61 6d 62   vals.     (lamb
0db0: 64 61 20 28 6b 65 79 20 76 61 6c 29 0a 20 20 20  da (key val).   
0dc0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
0dd0: 20 32 20 22 73 65 74 65 6e 76 20 22 20 28 6b 65   2 "setenv " (ke
0de0: 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20  y:get-fieldname 
0df0: 6b 65 79 29 20 22 20 22 20 76 61 6c 29 0a 20 20  key) " " val).  
0e00: 20 20 20 20 20 28 73 65 74 65 6e 76 20 28 6b 65       (setenv (ke
0e10: 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20  y:get-fieldname 
0e20: 6b 65 79 29 20 76 61 6c 29 29 29 0a 20 20 20 20  key) val))).    
0e30: 28 61 6c 69 73 74 2d 3e 65 6e 76 2d 76 61 72 73  (alist->env-vars
0e40: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66   (hash-table-ref
0e50: 2f 64 65 66 61 75 6c 74 20 2a 63 6f 6e 66 69 67  /default *config
0e60: 64 61 74 2a 20 22 65 6e 76 2d 6f 76 65 72 72 69  dat* "env-overri
0e70: 64 65 22 20 27 28 29 29 29 0a 20 20 20 20 3b 3b  de" '())).    ;;
0e80: 20 4c 65 74 73 20 75 73 65 20 74 68 69 73 20 61   Lets use this a
0e90: 73 20 61 6e 20 6f 70 70 6f 72 74 75 6e 69 74 79  s an opportunity
0ea0: 20 74 6f 20 70 75 74 20 4d 54 5f 52 55 4e 4e 41   to put MT_RUNNA
0eb0: 4d 45 20 69 6e 20 74 68 65 20 65 6e 76 69 72 6f  ME in the enviro
0ec0: 6e 6d 65 6e 74 0a 20 20 20 20 28 73 65 74 65 6e  nment.    (seten
0ed0: 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 28  v "MT_RUNNAME" (
0ee0: 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64  cdb:remote-run d
0ef0: 62 3a 67 65 74 2d 72 75 6e 2d 6e 61 6d 65 2d 66  b:get-run-name-f
0f00: 72 6f 6d 2d 69 64 20 23 66 20 72 75 6e 2d 69 64  rom-id #f run-id
0f10: 29 29 0a 20 20 20 20 28 73 65 74 65 6e 76 20 22  )).    (setenv "
0f20: 4d 54 5f 52 55 4e 5f 41 52 45 41 5f 48 4f 4d 45  MT_RUN_AREA_HOME
0f30: 22 20 2a 74 6f 70 70 61 74 68 2a 29 0a 20 20 20  " *toppath*).   
0f40: 20 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 73 65   ))..(define (se
0f50: 74 2d 69 74 65 6d 2d 65 6e 76 2d 76 61 72 73 20  t-item-env-vars 
0f60: 69 74 65 6d 64 61 74 29 0a 20 20 28 66 6f 72 2d  itemdat).  (for-
0f70: 65 61 63 68 20 28 6c 61 6d 62 64 61 20 28 69 74  each (lambda (it
0f80: 65 6d 29 0a 09 20 20 20 20 20 20 28 64 65 62 75  em)..      (debu
0f90: 67 3a 70 72 69 6e 74 20 32 20 22 73 65 74 65 6e  g:print 2 "seten
0fa0: 76 20 22 20 28 63 61 72 20 69 74 65 6d 29 20 22  v " (car item) "
0fb0: 20 22 20 28 63 61 64 72 20 69 74 65 6d 29 29 0a   " (cadr item)).
0fc0: 09 20 20 20 20 20 20 28 73 65 74 65 6e 76 20 28  .      (setenv (
0fd0: 63 61 72 20 69 74 65 6d 29 20 28 63 61 64 72 20  car item) (cadr 
0fe0: 69 74 65 6d 29 29 29 0a 09 20 20 20 20 69 74 65  item)))..    ite
0ff0: 6d 64 61 74 29 29 0a 0a 28 64 65 66 69 6e 65 20  mdat))..(define 
1000: 2a 6c 61 73 74 2d 6e 75 6d 2d 72 75 6e 6e 69 6e  *last-num-runnin
1010: 67 2d 74 65 73 74 73 2a 20 30 29 0a 28 64 65 66  g-tests* 0).(def
1020: 69 6e 65 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75  ine (runs:can-ru
1030: 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 74 65 73  n-more-tests tes
1040: 74 2d 72 65 63 6f 72 64 29 0a 20 20 28 6c 65 74  t-record).  (let
1050: 2a 20 28 28 74 63 6f 6e 66 69 67 20 20 20 20 20  * ((tconfig     
1060: 20 20 20 20 20 20 20 20 20 20 20 20 28 74 65 73              (tes
1070: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
1080: 2d 74 65 73 74 63 6f 6e 66 69 67 20 74 65 73 74  -testconfig test
1090: 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 6a 6f 62  -record)).. (job
10a0: 67 72 6f 75 70 20 20 20 20 20 20 20 20 20 20 20  group           
10b0: 20 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f       (config-loo
10c0: 6b 75 70 20 74 63 6f 6e 66 69 67 20 22 72 65 71  kup tconfig "req
10d0: 75 69 72 65 6d 65 6e 74 73 22 20 22 6a 6f 62 67  uirements" "jobg
10e0: 72 6f 75 70 22 29 29 0a 09 20 28 6e 75 6d 2d 72  roup")).. (num-r
10f0: 75 6e 6e 69 6e 67 20 20 20 20 20 20 20 20 20 20  unning          
1100: 20 20 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72     (cdb:remote-r
1110: 75 6e 20 64 62 3a 67 65 74 2d 63 6f 75 6e 74 2d  un db:get-count-
1120: 74 65 73 74 73 2d 72 75 6e 6e 69 6e 67 20 23 66  tests-running #f
1130: 29 29 0a 09 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e  )).. (num-runnin
1140: 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 28 63  g-in-jobgroup (c
1150: 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64 62  db:remote-run db
1160: 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 65 73 74 73  :get-count-tests
1170: 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67  -running-in-jobg
1180: 72 6f 75 70 20 23 66 20 6a 6f 62 67 72 6f 75 70  roup #f jobgroup
1190: 29 29 0a 09 20 28 6d 61 78 2d 63 6f 6e 63 75 72  )).. (max-concur
11a0: 72 65 6e 74 2d 6a 6f 62 73 20 20 20 20 20 28 6c  rent-jobs     (l
11b0: 65 74 20 28 28 6d 63 6a 20 28 63 6f 6e 66 69 67  et ((mcj (config
11c0: 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64  -lookup *configd
11d0: 61 74 2a 20 22 73 65 74 75 70 22 20 20 20 20 20  at* "setup"     
11e0: 22 6d 61 78 5f 63 6f 6e 63 75 72 72 65 6e 74 5f  "max_concurrent_
11f0: 6a 6f 62 73 22 29 29 29 0a 09 09 09 09 20 20 20  jobs"))).....   
1200: 20 28 69 66 20 28 61 6e 64 20 6d 63 6a 20 28 73   (if (and mcj (s
1210: 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 63  tring->number mc
1220: 6a 29 29 0a 09 09 09 09 09 28 73 74 72 69 6e 67  j))......(string
1230: 2d 3e 6e 75 6d 62 65 72 20 6d 63 6a 29 0a 09 09  ->number mcj)...
1240: 09 09 09 31 29 29 29 0a 09 20 28 6a 6f 62 2d 67  ...1))).. (job-g
1250: 72 6f 75 70 2d 6c 69 6d 69 74 20 20 20 20 20 20  roup-limit      
1260: 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75     (config-looku
1270: 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 6a  p *configdat* "j
1280: 6f 62 67 72 6f 75 70 73 22 20 6a 6f 62 67 72 6f  obgroups" jobgro
1290: 75 70 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e  up))).    (if (n
12a0: 6f 74 20 28 65 71 3f 20 2a 6c 61 73 74 2d 6e 75  ot (eq? *last-nu
12b0: 6d 2d 72 75 6e 6e 69 6e 67 2d 74 65 73 74 73 2a  m-running-tests*
12c0: 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 29 0a 09   num-running))..
12d0: 28 62 65 67 69 6e 0a 09 20 20 28 64 65 62 75 67  (begin..  (debug
12e0: 3a 70 72 69 6e 74 20 32 20 22 6d 61 78 2d 63 6f  :print 2 "max-co
12f0: 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 3a 20 22  ncurrent-jobs: "
1300: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d   max-concurrent-
1310: 6a 6f 62 73 20 22 2c 20 6e 75 6d 2d 72 75 6e 6e  jobs ", num-runn
1320: 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e 69  ing: " num-runni
1330: 6e 67 29 0a 09 20 20 28 73 65 74 21 20 2a 6c 61  ng)..  (set! *la
1340: 73 74 2d 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 74  st-num-running-t
1350: 65 73 74 73 2a 20 6e 75 6d 2d 72 75 6e 6e 69 6e  ests* num-runnin
1360: 67 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e 6f  g))).    (if (no
1370: 74 20 28 65 71 3f 20 30 20 2a 67 6c 6f 62 61 6c  t (eq? 0 *global
1380: 65 78 69 74 73 74 61 74 75 73 2a 29 29 0a 09 28  exitstatus*))..(
1390: 6c 69 73 74 20 23 66 20 6e 75 6d 2d 72 75 6e 6e  list #f num-runn
13a0: 69 6e 67 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d  ing num-running-
13b0: 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 6d 61 78 2d  in-jobgroup max-
13c0: 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20  concurrent-jobs 
13d0: 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 29  job-group-limit)
13e0: 0a 09 28 6c 65 74 20 28 28 63 61 6e 2d 6e 6f 74  ..(let ((can-not
13f0: 2d 72 75 6e 2d 6d 6f 72 65 20 28 63 6f 6e 64 0a  -run-more (cond.
1400: 09 09 09 09 20 3b 3b 20 69 66 20 6d 61 78 2d 63  .... ;; if max-c
1410: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 69  oncurrent-jobs i
1420: 73 20 73 65 74 20 61 6e 64 20 74 68 65 20 6e 75  s set and the nu
1430: 6d 62 65 72 20 72 75 6e 6e 69 6e 67 20 69 73 20  mber running is 
1440: 67 72 65 61 74 65 72 20 0a 09 09 09 09 20 3b 3b  greater ..... ;;
1450: 20 74 68 61 6e 20 69 74 20 74 68 61 6e 20 63 61   than it than ca
1460: 6e 6e 6f 74 20 72 75 6e 20 6d 6f 72 65 20 6a 6f  nnot run more jo
1470: 62 73 0a 09 09 09 09 20 28 28 61 6e 64 20 6d 61  bs..... ((and ma
1480: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62  x-concurrent-job
1490: 73 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e  s (>= num-runnin
14a0: 67 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74  g max-concurrent
14b0: 2d 6a 6f 62 73 29 29 0a 09 09 09 09 20 20 28 64  -jobs)).....  (d
14c0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41  ebug:print 0 "WA
14d0: 52 4e 49 4e 47 3a 20 4d 61 78 20 72 75 6e 6e 69  RNING: Max runni
14e0: 6e 67 20 6a 6f 62 73 20 65 78 63 65 65 64 65 64  ng jobs exceeded
14f0: 2c 20 63 75 72 72 65 6e 74 20 6e 75 6d 62 65 72  , current number
1500: 20 72 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d   running: " num-
1510: 72 75 6e 6e 69 6e 67 20 0a 09 09 09 09 09 20 20  running ......  
1520: 20 20 20 20 20 22 2c 20 6d 61 78 5f 63 6f 6e 63       ", max_conc
1530: 75 72 72 65 6e 74 5f 6a 6f 62 73 3a 20 22 20 6d  urrent_jobs: " m
1540: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f  ax-concurrent-jo
1550: 62 73 29 0a 09 09 09 09 20 20 23 74 29 0a 09 09  bs).....  #t)...
1560: 09 09 20 3b 3b 20 69 66 20 6a 6f 62 2d 67 72 6f  .. ;; if job-gro
1570: 75 70 2d 6c 69 6d 69 74 20 69 73 20 73 65 74 20  up-limit is set 
1580: 61 6e 64 20 6e 75 6d 62 65 72 20 6f 66 20 6a 6f  and number of jo
1590: 62 73 20 69 6e 20 74 68 65 20 67 72 6f 75 70 20  bs in the group 
15a0: 69 73 20 67 72 65 61 74 65 72 0a 09 09 09 09 20  is greater..... 
15b0: 3b 3b 20 74 68 61 6e 20 74 68 65 20 6c 69 6d 69  ;; than the limi
15c0: 74 20 74 68 65 6e 20 63 61 6e 6e 6f 74 20 72 75  t then cannot ru
15d0: 6e 20 6d 6f 72 65 20 6a 6f 62 73 20 6f 66 20 74  n more jobs of t
15e0: 68 69 73 20 6b 69 6e 64 0a 09 09 09 09 20 28 28  his kind..... ((
15f0: 61 6e 64 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69  and job-group-li
1600: 6d 69 74 0a 09 09 09 09 20 20 20 20 20 20 20 28  mit.....       (
1610: 3e 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69  >= num-running-i
1620: 6e 2d 6a 6f 62 67 72 6f 75 70 20 6a 6f 62 2d 67  n-jobgroup job-g
1630: 72 6f 75 70 2d 6c 69 6d 69 74 29 29 0a 09 09 09  roup-limit))....
1640: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  .  (debug:print 
1650: 31 20 22 57 41 52 4e 49 4e 47 3a 20 6e 75 6d 62  1 "WARNING: numb
1660: 65 72 20 6f 66 20 6a 6f 62 73 20 22 20 6e 75 6d  er of jobs " num
1670: 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67  -running-in-jobg
1680: 72 6f 75 70 20 0a 09 09 09 09 09 20 20 20 20 20  roup ......     
1690: 20 20 22 20 69 6e 20 22 20 6a 6f 62 67 72 6f 75    " in " jobgrou
16a0: 70 20 22 20 65 78 63 65 65 64 65 64 2c 20 77 69  p " exceeded, wi
16b0: 6c 6c 20 6e 6f 74 20 72 75 6e 20 22 20 28 74 65  ll not run " (te
16c0: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65  sts:testqueue-ge
16d0: 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d  t-testname test-
16e0: 72 65 63 6f 72 64 29 29 0a 09 09 09 09 20 20 23  record)).....  #
16f0: 74 29 0a 09 09 09 09 20 28 65 6c 73 65 20 23 66  t)..... (else #f
1700: 29 29 29 29 0a 09 20 20 28 6c 69 73 74 20 28 6e  ))))..  (list (n
1710: 6f 74 20 63 61 6e 2d 6e 6f 74 2d 72 75 6e 2d 6d  ot can-not-run-m
1720: 6f 72 65 29 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67  ore) num-running
1730: 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d   num-running-in-
1740: 6a 6f 62 67 72 6f 75 70 20 6d 61 78 2d 63 6f 6e  jobgroup max-con
1750: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 6a 6f 62  current-jobs job
1760: 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 29 29 29 29  -group-limit))))
1770: 29 0a 0a 3b 3b 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: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4e  ===========.;; N
17c0: 65 77 20 6d 65 74 68 6f 64 6f 6c 6f 67 79 2e 20  ew methodology. 
17d0: 54 68 65 73 65 20 72 6f 75 74 69 6e 65 73 20 77  These routines w
17e0: 69 6c 6c 20 72 65 70 6c 61 63 65 20 74 68 65 20  ill replace the 
17f0: 61 62 6f 76 65 20 69 6e 20 74 69 6d 65 2e 20 46  above in time. F
1800: 6f 72 0a 3b 3b 20 6e 6f 77 20 74 68 65 20 63 6f  or.;; now the co
1810: 64 65 20 69 73 20 64 75 70 6c 69 63 61 74 65 64  de is duplicated
1820: 2e 20 54 68 69 73 20 73 74 75 66 66 20 69 73 20  . This stuff is 
1830: 69 6e 69 74 69 61 6c 6c 79 20 75 73 65 64 20 69  initially used i
1840: 6e 20 74 68 65 20 6d 6f 6e 69 74 6f 72 0a 3b 3b  n the monitor.;;
1850: 20 62 61 73 65 64 20 63 6f 64 65 2e 0a 3b 3b 3d   based code..;;=
1860: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1870: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1880: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1890: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
18a0: 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 72 65 67 69 73 74  =====..;; regist
18b0: 65 72 20 61 20 74 65 73 74 20 72 75 6e 20 77 69  er a test run wi
18c0: 74 68 20 74 68 65 20 64 62 0a 28 64 65 66 69 6e  th the db.(defin
18d0: 65 20 28 72 75 6e 73 3a 72 65 67 69 73 74 65 72  e (runs:register
18e0: 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79  -run db keys key
18f0: 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 73  vallst runname s
1900: 74 61 74 65 20 73 74 61 74 75 73 20 75 73 65 72  tate status user
1910: 29 0a 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ).  (debug:print
1920: 20 33 20 22 72 75 6e 73 3a 72 65 67 69 73 74 65   3 "runs:registe
1930: 72 2d 72 75 6e 2c 20 6b 65 79 73 3a 20 22 20 6b  r-run, keys: " k
1940: 65 79 73 20 22 20 6b 65 79 76 61 6c 6c 73 74 3a  eys " keyvallst:
1950: 20 22 20 6b 65 79 76 61 6c 6c 73 74 20 22 20 72   " keyvallst " r
1960: 75 6e 6e 61 6d 65 3a 20 22 20 72 75 6e 6e 61 6d  unname: " runnam
1970: 65 20 22 20 73 74 61 74 65 3a 20 22 20 73 74 61  e " state: " sta
1980: 74 65 20 22 20 73 74 61 74 75 73 3a 20 22 20 73  te " status: " s
1990: 74 61 74 75 73 20 22 20 75 73 65 72 3a 20 22 20  tatus " user: " 
19a0: 75 73 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 28  user).  (let* ((
19b0: 6b 65 79 73 74 72 20 20 20 20 28 6b 65 79 73 2d  keystr    (keys-
19c0: 3e 6b 65 79 73 74 72 20 6b 65 79 73 29 29 0a 09  >keystr keys))..
19d0: 20 28 63 6f 6d 6d 61 20 20 20 20 20 28 69 66 20   (comma     (if 
19e0: 28 3e 20 28 6c 65 6e 67 74 68 20 6b 65 79 73 29  (> (length keys)
19f0: 20 30 29 20 22 2c 22 20 22 22 29 29 0a 09 20 28   0) "," "")).. (
1a00: 61 6e 64 73 74 72 20 20 20 20 28 69 66 20 28 3e  andstr    (if (>
1a10: 20 28 6c 65 6e 67 74 68 20 6b 65 79 73 29 20 30   (length keys) 0
1a20: 29 20 22 20 41 4e 44 20 22 20 22 22 29 29 0a 09  ) " AND " ""))..
1a30: 20 28 76 61 6c 73 6c 6f 74 73 20 20 28 6b 65 79   (valslots  (key
1a40: 73 2d 3e 76 61 6c 73 6c 6f 74 73 20 6b 65 79 73  s->valslots keys
1a50: 29 29 20 3b 3b 20 3f 2c 3f 2c 3f 20 2e 2e 2e 0a  )) ;; ?,?,? ....
1a60: 09 20 28 6b 65 79 76 61 6c 73 20 20 20 28 6d 61  . (keyvals   (ma
1a70: 70 20 63 61 64 72 20 6b 65 79 76 61 6c 6c 73 74  p cadr keyvallst
1a80: 29 29 0a 09 20 28 61 6c 6c 76 61 6c 73 20 20 20  )).. (allvals   
1a90: 28 61 70 70 65 6e 64 20 28 6c 69 73 74 20 72 75  (append (list ru
1aa0: 6e 6e 61 6d 65 20 73 74 61 74 65 20 73 74 61 74  nname state stat
1ab0: 75 73 20 75 73 65 72 29 20 6b 65 79 76 61 6c 73  us user) keyvals
1ac0: 29 29 0a 09 20 28 71 72 79 76 61 6c 73 20 20 20  )).. (qryvals   
1ad0: 28 61 70 70 65 6e 64 20 28 6c 69 73 74 20 72 75  (append (list ru
1ae0: 6e 6e 61 6d 65 29 20 6b 65 79 76 61 6c 73 29 29  nname) keyvals))
1af0: 0a 09 20 28 6b 65 79 3d 3f 73 74 72 20 20 28 73  .. (key=?str  (s
1b00: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73  tring-interspers
1b10: 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28  e (map (lambda (
1b20: 6b 29 28 63 6f 6e 63 20 28 6b 65 79 3a 67 65 74  k)(conc (key:get
1b30: 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 29 20 22 3d  -fieldname k) "=
1b40: 3f 22 29 29 20 6b 65 79 73 29 20 22 20 41 4e 44  ?")) keys) " AND
1b50: 20 22 29 29 29 0a 20 20 20 20 28 64 65 62 75 67   "))).    (debug
1b60: 3a 70 72 69 6e 74 20 33 20 22 6b 65 79 73 3a 20  :print 3 "keys: 
1b70: 22 20 6b 65 79 73 20 22 20 61 6c 6c 76 61 6c 73  " keys " allvals
1b80: 3a 20 22 20 61 6c 6c 76 61 6c 73 20 22 20 6b 65  : " allvals " ke
1b90: 79 76 61 6c 73 3a 20 22 20 6b 65 79 76 61 6c 73  yvals: " keyvals
1ba0: 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ).    (debug:pri
1bb0: 6e 74 20 32 20 22 4e 4f 54 45 3a 20 75 73 69 6e  nt 2 "NOTE: usin
1bc0: 67 20 74 61 72 67 65 74 20 22 20 28 73 74 72 69  g target " (stri
1bd0: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 6b  ng-intersperse k
1be0: 65 79 76 61 6c 73 20 22 2f 22 29 20 22 20 66 6f  eyvals "/") " fo
1bf0: 72 20 74 68 69 73 20 72 75 6e 22 29 0a 20 20 20  r this run").   
1c00: 20 28 69 66 20 28 61 6e 64 20 72 75 6e 6e 61 6d   (if (and runnam
1c10: 65 20 28 6e 75 6c 6c 3f 20 28 66 69 6c 74 65 72  e (null? (filter
1c20: 20 28 6c 61 6d 62 64 61 20 28 78 29 28 6e 6f 74   (lambda (x)(not
1c30: 20 78 29 29 20 6b 65 79 76 61 6c 73 29 29 29 20   x)) keyvals))) 
1c40: 3b 3b 20 74 68 65 72 65 20 6d 75 73 74 20 62 65  ;; there must be
1c50: 20 61 20 62 65 74 74 65 72 20 77 61 79 20 74 6f   a better way to
1c60: 20 22 61 70 70 6c 79 20 61 6e 64 22 0a 09 28 6c   "apply and"..(l
1c70: 65 74 20 28 28 72 65 73 20 23 66 29 29 0a 09 20  et ((res #f)).. 
1c80: 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a   (apply sqlite3:
1c90: 65 78 65 63 75 74 65 20 64 62 20 28 63 6f 6e 63  execute db (conc
1ca0: 20 22 49 4e 53 45 52 54 20 4f 52 20 49 47 4e 4f   "INSERT OR IGNO
1cb0: 52 45 20 49 4e 54 4f 20 72 75 6e 73 20 28 72 75  RE INTO runs (ru
1cc0: 6e 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74  nname,state,stat
1cd0: 75 73 2c 6f 77 6e 65 72 2c 65 76 65 6e 74 5f 74  us,owner,event_t
1ce0: 69 6d 65 22 20 63 6f 6d 6d 61 20 6b 65 79 73 74  ime" comma keyst
1cf0: 72 20 22 29 20 56 41 4c 55 45 53 20 28 3f 2c 3f  r ") VALUES (?,?
1d00: 2c 3f 2c 3f 2c 73 74 72 66 74 69 6d 65 28 27 25  ,?,?,strftime('%
1d10: 73 27 2c 27 6e 6f 77 27 29 22 20 63 6f 6d 6d 61  s','now')" comma
1d20: 20 76 61 6c 73 6c 6f 74 73 20 22 29 3b 22 29 0a   valslots ");").
1d30: 09 09 20 61 6c 6c 76 61 6c 73 29 0a 09 20 20 28  .. allvals)..  (
1d40: 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a 66 6f  apply sqlite3:fo
1d50: 72 2d 65 61 63 68 2d 72 6f 77 20 0a 09 20 20 20  r-each-row ..   
1d60: 28 6c 61 6d 62 64 61 20 28 69 64 29 0a 09 20 20  (lambda (id)..  
1d70: 20 20 20 28 73 65 74 21 20 72 65 73 20 69 64 29     (set! res id)
1d80: 29 0a 09 20 20 20 64 62 0a 09 20 20 20 28 6c 65  )..   db..   (le
1d90: 74 20 28 28 71 72 79 20 28 63 6f 6e 63 20 22 53  t ((qry (conc "S
1da0: 45 4c 45 43 54 20 69 64 20 46 52 4f 4d 20 72 75  ELECT id FROM ru
1db0: 6e 73 20 57 48 45 52 45 20 28 72 75 6e 6e 61 6d  ns WHERE (runnam
1dc0: 65 3d 3f 20 22 20 61 6e 64 73 74 72 20 6b 65 79  e=? " andstr key
1dd0: 3d 3f 73 74 72 20 22 29 3b 22 29 29 29 0a 09 20  =?str ");"))).. 
1de0: 20 20 20 20 3b 28 64 65 62 75 67 3a 70 72 69 6e      ;(debug:prin
1df0: 74 20 34 20 22 71 72 79 3a 20 22 20 71 72 79 29  t 4 "qry: " qry)
1e00: 20 0a 09 20 20 20 20 20 71 72 79 29 0a 09 20 20   ..     qry)..  
1e10: 20 71 72 79 76 61 6c 73 29 0a 09 20 20 28 73 71   qryvals)..  (sq
1e20: 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 62  lite3:execute db
1e30: 20 22 55 50 44 41 54 45 20 72 75 6e 73 20 53 45   "UPDATE runs SE
1e40: 54 20 73 74 61 74 65 3d 3f 2c 73 74 61 74 75 73  T state=?,status
1e50: 3d 3f 20 57 48 45 52 45 20 69 64 3d 3f 3b 22 20  =? WHERE id=?;" 
1e60: 73 74 61 74 65 20 73 74 61 74 75 73 20 72 65 73  state status res
1e70: 29 0a 09 20 20 72 65 73 29 20 0a 09 28 62 65 67  )..  res) ..(beg
1e80: 69 6e 0a 09 20 20 28 64 65 62 75 67 3a 70 72 69  in..  (debug:pri
1e90: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 43 61 6c  nt 0 "ERROR: Cal
1ea0: 6c 65 64 20 77 69 74 68 6f 75 74 20 61 6c 6c 20  led without all 
1eb0: 6e 65 63 65 73 73 61 72 79 20 6b 65 79 73 22 29  necessary keys")
1ec0: 0a 09 20 20 23 66 29 29 29 29 0a 0a 3b 3b 20 54  ..  #f))))..;; T
1ed0: 68 69 73 20 69 73 20 61 20 64 75 70 6c 69 63 61  his is a duplica
1ee0: 74 65 20 6f 66 20 72 75 6e 2d 74 65 73 74 73 20  te of run-tests 
1ef0: 28 77 68 69 63 68 20 68 61 73 20 62 65 65 6e 20  (which has been 
1f00: 64 65 70 72 65 63 61 74 65 64 29 2e 20 55 73 65  deprecated). Use
1f10: 20 74 68 69 73 20 6f 6e 65 20 69 6e 73 74 65 61   this one instea
1f20: 64 20 6f 66 20 72 75 6e 20 74 65 73 74 73 2e 0a  d of run tests..
1f30: 3b 3b 20 6b 65 79 76 61 6c 73 2e 0a 3b 3b 0a 3b  ;; keyvals..;;.;
1f40: 3b 20 20 74 65 73 74 2d 6e 61 6d 65 73 3a 20 43  ;  test-names: C
1f50: 6f 6d 6d 61 20 73 65 70 61 72 61 74 65 64 20 70  omma separated p
1f60: 61 74 74 65 72 6e 73 20 73 61 6d 65 20 61 73 20  atterns same as 
1f70: 74 65 73 74 2d 70 61 74 74 73 20 62 75 74 20 75  test-patts but u
1f80: 73 65 64 20 69 6e 20 73 65 6c 65 63 74 69 6f 6e  sed in selection
1f90: 20 0a 3b 3b 20 20 20 20 20 20 20 20 20 20 20 20   .;;            
1fa0: 20 20 6f 66 20 74 65 73 74 73 20 74 6f 20 72 75    of tests to ru
1fb0: 6e 2e 20 54 68 65 20 69 74 65 6d 20 70 6f 72 74  n. The item port
1fc0: 69 6f 6e 73 20 61 72 65 20 6e 6f 74 20 72 65 73  ions are not res
1fd0: 70 65 63 74 65 64 2e 0a 3b 3b 20 20 20 20 20 20  pected..;;      
1fe0: 20 20 20 20 20 20 20 20 46 49 58 4d 45 3a 20 65          FIXME: e
1ff0: 72 72 6f 72 20 6f 75 74 20 69 66 20 2f 70 61 74  rror out if /pat
2000: 74 20 73 70 65 63 69 66 69 65 64 0a 3b 3b 20 20  t specified.;;  
2010: 20 20 20 20 20 20 20 20 20 20 0a 28 64 65 66 69            .(defi
2020: 6e 65 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73  ne (runs:run-tes
2030: 74 73 20 74 61 72 67 65 74 20 72 75 6e 6e 61 6d  ts target runnam
2040: 65 20 74 65 73 74 2d 6e 61 6d 65 73 20 74 65 73  e test-names tes
2050: 74 2d 70 61 74 74 73 20 75 73 65 72 20 66 6c 61  t-patts user fla
2060: 67 73 29 0a 20 20 28 6c 65 74 2a 20 28 28 64 62  gs).  (let* ((db
2070: 20 20 20 20 20 20 20 20 20 20 23 66 29 0a 09 20            #f).. 
2080: 28 6b 65 79 73 20 20 20 20 20 20 20 20 28 63 64  (keys        (cd
2090: 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64 62 3a  b:remote-run db:
20a0: 67 65 74 2d 6b 65 79 73 20 23 66 29 29 0a 09 20  get-keys #f)).. 
20b0: 28 6b 65 79 76 61 6c 6c 73 74 20 20 20 28 6b 65  (keyvallst   (ke
20c0: 79 73 3a 74 61 72 67 65 74 2d 3e 6b 65 79 76 61  ys:target->keyva
20d0: 6c 20 6b 65 79 73 20 74 61 72 67 65 74 29 29 0a  l keys target)).
20e0: 09 20 28 72 75 6e 2d 69 64 20 20 20 20 20 20 28  . (run-id      (
20f0: 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 72  cdb:remote-run r
2100: 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75 6e  uns:register-run
2110: 20 23 66 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c   #f keys keyvall
2120: 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e 65 77 22  st runname "new"
2130: 20 22 6e 2f 61 22 20 75 73 65 72 29 29 20 20 3b   "n/a" user))  ;
2140: 3b 20 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a  ;  test-name))).
2150: 09 20 28 64 65 66 65 72 72 65 64 20 20 20 20 27  . (deferred    '
2160: 28 29 29 20 3b 3b 20 64 65 6c 61 79 20 72 75 6e  ()) ;; delay run
2170: 6e 69 6e 67 20 74 68 65 73 65 20 73 69 6e 63 65  ning these since
2180: 20 74 68 65 79 20 68 61 76 65 20 61 20 77 61 69   they have a wai
2190: 74 6f 6e 20 63 6c 61 75 73 65 0a 09 20 3b 3b 20  ton clause.. ;; 
21a0: 6b 65 65 70 67 6f 69 6e 67 20 69 73 20 74 68 65  keepgoing is the
21b0: 20 64 65 66 61 63 74 6f 20 6d 6f 64 61 6c 69 74   defacto modalit
21c0: 79 20 6e 6f 77 2c 20 77 69 6c 6c 20 61 64 64 20  y now, will add 
21d0: 68 69 74 2d 6e 2d 72 75 6e 20 61 20 62 69 74 20  hit-n-run a bit 
21e0: 6c 61 74 65 72 0a 09 20 3b 3b 20 28 6b 65 65 70  later.. ;; (keep
21f0: 67 6f 69 6e 67 20 20 20 28 68 61 73 68 2d 74 61  going   (hash-ta
2200: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20  ble-ref/default 
2210: 66 6c 61 67 73 20 22 2d 6b 65 65 70 67 6f 69 6e  flags "-keepgoin
2220: 67 22 20 23 66 29 29 0a 09 20 28 72 75 6e 63 6f  g" #f)).. (runco
2230: 6e 66 69 67 66 20 20 20 28 63 6f 6e 63 20 20 2a  nfigf   (conc  *
2240: 74 6f 70 70 61 74 68 2a 20 22 2f 72 75 6e 63 6f  toppath* "/runco
2250: 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22 29 29 0a  nfigs.config")).
2260: 09 20 28 72 65 71 75 69 72 65 64 2d 74 65 73 74  . (required-test
2270: 73 20 27 28 29 29 0a 09 20 28 74 65 73 74 2d 72  s '()).. (test-r
2280: 65 63 6f 72 64 73 20 28 6d 61 6b 65 2d 68 61 73  ecords (make-has
2290: 68 2d 74 61 62 6c 65 29 29 29 0a 0a 20 20 20 20  h-table)))..    
22a0: 28 73 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e  (set-megatest-en
22b0: 76 2d 76 61 72 73 20 72 75 6e 2d 69 64 29 20 3b  v-vars run-id) ;
22c0: 3b 20 74 68 65 73 65 20 6d 61 79 20 62 65 20 6e  ; these may be n
22d0: 65 65 64 65 64 20 62 79 20 74 68 65 20 6c 61 75  eeded by the lau
22e0: 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 73 0a 0a  nching process..
22f0: 20 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78      (if (file-ex
2300: 69 73 74 73 3f 20 72 75 6e 63 6f 6e 66 69 67 66  ists? runconfigf
2310: 29 0a 09 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f  )..(open-run-clo
2320: 73 65 20 73 65 74 75 70 2d 65 6e 76 2d 64 65 66  se setup-env-def
2330: 61 75 6c 74 73 20 64 62 20 72 75 6e 63 6f 6e 66  aults db runconf
2340: 69 67 66 20 72 75 6e 2d 69 64 20 2a 61 6c 72 65  igf run-id *alre
2350: 61 64 79 2d 73 65 65 6e 2d 72 75 6e 63 6f 6e 66  ady-seen-runconf
2360: 69 67 2d 69 6e 66 6f 2a 20 22 70 72 65 2d 6c 61  ig-info* "pre-la
2370: 75 6e 63 68 2d 65 6e 76 2d 76 61 72 73 22 29 0a  unch-env-vars").
2380: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20  .(debug:print 0 
2390: 22 57 41 52 4e 49 4e 47 3a 20 59 6f 75 20 64 6f  "WARNING: You do
23a0: 20 6e 6f 74 20 68 61 76 65 20 61 20 72 75 6e 20   not have a run 
23b0: 63 6f 6e 66 69 67 20 66 69 6c 65 3a 20 22 20 72  config file: " r
23c0: 75 6e 63 6f 6e 66 69 67 66 29 29 0a 20 20 20 20  unconfigf)).    
23d0: 0a 20 20 20 20 3b 3b 20 6c 6f 6f 6b 20 75 70 20  .    ;; look up 
23e0: 61 6c 6c 20 74 65 73 74 73 20 6d 61 74 63 68 69  all tests matchi
23f0: 6e 67 20 74 68 65 20 63 6f 6d 6d 61 20 73 65 70  ng the comma sep
2400: 61 72 61 74 65 64 20 6c 69 73 74 20 6f 66 20 67  arated list of g
2410: 6c 6f 62 73 20 69 6e 0a 20 20 20 20 3b 3b 20 74  lobs in.    ;; t
2420: 65 73 74 2d 70 61 74 74 73 20 28 75 73 69 6e 67  est-patts (using
2430: 20 25 20 61 73 20 77 69 6c 64 63 61 72 64 29 0a   % as wildcard).
2440: 0a 20 20 20 20 28 73 65 74 21 20 74 65 73 74 2d  .    (set! test-
2450: 6e 61 6d 65 73 20 28 74 65 73 74 73 3a 67 65 74  names (tests:get
2460: 2d 76 61 6c 69 64 2d 74 65 73 74 73 20 2a 74 6f  -valid-tests *to
2470: 70 70 61 74 68 2a 20 74 65 73 74 2d 6e 61 6d 65  ppath* test-name
2480: 73 29 29 0a 20 20 20 20 28 73 65 74 21 20 74 65  s)).    (set! te
2490: 73 74 2d 6e 61 6d 65 73 20 28 64 65 6c 65 74 65  st-names (delete
24a0: 2d 64 75 70 6c 69 63 61 74 65 73 20 74 65 73 74  -duplicates test
24b0: 2d 6e 61 6d 65 73 29 29 0a 0a 20 20 20 20 28 64  -names))..    (d
24c0: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
24d0: 30 20 22 74 65 73 74 20 6e 61 6d 65 73 20 22 20  0 "test names " 
24e0: 74 65 73 74 2d 6e 61 6d 65 73 29 0a 0a 20 20 20  test-names)..   
24f0: 20 3b 3b 20 6f 6e 20 74 68 65 20 66 69 72 73 74   ;; on the first
2500: 20 70 61 73 73 20 6f 72 20 63 61 6c 6c 20 74 6f   pass or call to
2510: 20 72 75 6e 2d 74 65 73 74 73 20 73 65 74 20 46   run-tests set F
2520: 41 49 4c 53 20 74 6f 20 4e 4f 54 5f 53 54 41 52  AILS to NOT_STAR
2530: 54 45 44 20 69 66 0a 20 20 20 20 3b 3b 20 2d 6b  TED if.    ;; -k
2540: 65 65 70 67 6f 69 6e 67 20 69 73 20 73 70 65 63  eepgoing is spec
2550: 69 66 69 65 64 0a 20 20 20 20 28 69 66 20 28 65  ified.    (if (e
2560: 71 3f 20 2a 70 61 73 73 6e 75 6d 2a 20 30 29 0a  q? *passnum* 0).
2570: 09 28 62 65 67 69 6e 0a 09 20 20 3b 3b 20 68 61  .(begin..  ;; ha
2580: 76 65 20 74 6f 20 64 65 6c 65 74 65 20 74 65 73  ve to delete tes
2590: 74 20 72 65 63 6f 72 64 73 20 77 68 65 72 65 20  t records where 
25a0: 4e 4f 54 5f 53 54 41 52 54 45 44 20 73 69 6e 63  NOT_STARTED sinc
25b0: 65 20 74 68 65 79 20 63 61 6e 20 63 61 75 73 65  e they can cause
25c0: 20 2d 6b 65 65 70 67 6f 69 6e 67 20 74 6f 20 0a   -keepgoing to .
25d0: 09 20 20 3b 3b 20 67 65 74 20 73 74 75 63 6b 20  .  ;; get stuck 
25e0: 64 75 65 20 74 6f 20 62 65 63 6f 6d 69 6e 67 20  due to becoming 
25f0: 69 6e 61 63 63 65 73 73 69 62 6c 65 20 66 72 6f  inaccessible fro
2600: 6d 20 61 20 66 61 69 6c 65 64 20 74 65 73 74 2e  m a failed test.
2610: 20 49 2e 65 2e 20 69 66 20 74 65 73 74 20 42 20   I.e. if test B 
2620: 64 65 70 65 6e 64 73 20 0a 09 20 20 3b 3b 20 6f  depends ..  ;; o
2630: 6e 20 74 65 73 74 20 41 20 62 75 74 20 74 65 73  n test A but tes
2640: 74 20 42 20 72 65 61 63 68 65 64 20 74 68 65 20  t B reached the 
2650: 70 6f 69 6e 74 20 6f 6e 20 62 65 69 6e 67 20 72  point on being r
2660: 65 67 69 73 74 65 72 65 64 20 61 73 20 4e 4f 54  egistered as NOT
2670: 5f 53 54 41 52 54 45 44 20 61 6e 64 20 74 65 73  _STARTED and tes
2680: 74 0a 09 20 20 3b 3b 20 41 20 66 61 69 6c 65 64  t..  ;; A failed
2690: 20 66 6f 72 20 73 6f 6d 65 20 72 65 61 73 6f 6e   for some reason
26a0: 20 74 68 65 6e 20 6f 6e 20 72 65 2d 72 75 6e 20   then on re-run 
26b0: 75 73 69 6e 67 20 2d 6b 65 65 70 67 6f 69 6e 67  using -keepgoing
26c0: 20 74 68 65 20 72 75 6e 20 63 61 6e 20 6e 65 76   the run can nev
26d0: 65 72 20 63 6f 6d 70 6c 65 74 65 2e 0a 09 20 20  er complete...  
26e0: 28 63 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74  (cdb:delete-test
26f0: 73 2d 69 6e 2d 73 74 61 74 65 20 2a 72 75 6e 72  s-in-state *runr
2700: 65 6d 6f 74 65 2a 20 72 75 6e 2d 69 64 20 22 4e  emote* run-id "N
2710: 4f 54 5f 53 54 41 52 54 45 44 22 29 0a 09 20 20  OT_STARTED")..  
2720: 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20  (cdb:remote-run 
2730: 64 62 3a 73 65 74 2d 74 65 73 74 73 2d 73 74 61  db:set-tests-sta
2740: 74 65 2d 73 74 61 74 75 73 20 23 66 20 72 75 6e  te-status #f run
2750: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 73 20 23  -id test-names #
2760: 66 20 22 46 41 49 4c 22 20 22 4e 4f 54 5f 53 54  f "FAIL" "NOT_ST
2770: 41 52 54 45 44 22 20 22 46 41 49 4c 22 29 29 29  ARTED" "FAIL")))
2780: 0a 0a 20 20 20 20 3b 3b 20 66 72 6f 6d 20 68 65  ..    ;; from he
2790: 72 65 20 6f 6e 20 6f 75 74 20 74 68 65 20 64 62  re on out the db
27a0: 20 77 69 6c 6c 20 62 65 20 6f 70 65 6e 65 64 20   will be opened 
27b0: 61 6e 64 20 63 6c 6f 73 65 64 20 6f 6e 20 65 76  and closed on ev
27c0: 65 72 79 20 63 61 6c 6c 20 72 75 6e 73 3a 72 75  ery call runs:ru
27d0: 6e 2d 74 65 73 74 73 2d 71 75 65 75 65 0a 20 20  n-tests-queue.  
27e0: 20 20 3b 3b 20 28 73 71 6c 69 74 65 33 3a 66 69    ;; (sqlite3:fi
27f0: 6e 61 6c 69 7a 65 21 20 64 62 29 20 0a 20 20 20  nalize! db) .   
2800: 20 3b 3b 20 6e 6f 77 20 61 64 64 20 6e 6f 6e 2d   ;; now add non-
2810: 64 69 72 65 63 74 6c 79 20 72 65 66 65 72 65 6e  directly referen
2820: 63 65 64 20 64 65 70 65 6e 64 65 6e 63 69 65 73  ced dependencies
2830: 20 28 69 2e 65 2e 20 77 61 69 74 6f 6e 29 0a 20   (i.e. waiton). 
2840: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c     (if (not (nul
2850: 6c 3f 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a  l? test-names)).
2860: 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68 65 64  .(let loop ((hed
2870: 20 28 63 61 72 20 74 65 73 74 2d 6e 61 6d 65 73   (car test-names
2880: 29 29 0a 09 09 20 20 20 28 74 61 6c 20 28 63 64  ))...   (tal (cd
2890: 72 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 20  r test-names))) 
28a0: 20 20 20 20 20 20 20 20 3b 3b 20 27 72 65 74 75          ;; 'retu
28b0: 72 6e 2d 70 72 6f 63 73 20 74 65 6c 6c 73 20 74  rn-procs tells t
28c0: 68 65 20 63 6f 6e 66 69 67 20 72 65 61 64 65 72  he config reader
28d0: 20 74 6f 20 70 72 65 70 20 72 75 6e 6e 69 6e 67   to prep running
28e0: 20 73 79 73 74 65 6d 20 62 75 74 20 72 65 74 75   system but retu
28f0: 72 6e 20 61 20 70 72 6f 63 0a 09 20 20 28 64 65  rn a proc..  (de
2900: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34  bug:print-info 4
2910: 20 22 68 65 64 3d 22 20 68 65 64 20 22 20 61 74   "hed=" hed " at
2920: 20 74 6f 70 20 6f 66 20 6c 6f 6f 70 22 29 0a 09   top of loop")..
2930: 20 20 28 6c 65 74 2a 20 28 28 63 6f 6e 66 69 67    (let* ((config
2940: 20 20 28 74 65 73 74 73 3a 67 65 74 2d 74 65 73    (tests:get-tes
2950: 74 63 6f 6e 66 69 67 20 68 65 64 20 27 72 65 74  tconfig hed 'ret
2960: 75 72 6e 2d 70 72 6f 63 73 29 29 0a 09 09 20 28  urn-procs))... (
2970: 77 61 69 74 6f 6e 73 20 28 69 66 20 63 6f 6e 66  waitons (if conf
2980: 69 67 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74  ig (string-split
2990: 20 28 6c 65 74 20 28 28 77 20 28 63 6f 6e 66 69   (let ((w (confi
29a0: 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 20  g-lookup config 
29b0: 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22  "requirements" "
29c0: 77 61 69 74 6f 6e 22 29 29 29 0a 09 09 09 09 09  waiton")))......
29d0: 09 20 20 20 20 20 28 69 66 20 77 20 77 20 22 22  .     (if w w ""
29e0: 29 29 29 0a 09 09 09 20 20 20 20 20 20 28 62 65  )))....      (be
29f0: 67 69 6e 0a 09 09 09 09 28 64 65 62 75 67 3a 70  gin.....(debug:p
2a00: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 6e  rint 0 "ERROR: n
2a10: 6f 6e 2d 65 78 69 73 74 65 6e 74 20 72 65 71 75  on-existent requ
2a20: 69 72 65 64 20 74 65 73 74 20 5c 22 22 20 68 65  ired test \"" he
2a30: 64 20 22 5c 22 22 29 0a 20 20 20 20 20 20 20 20  d "\"").        
2a40: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
2a50: 20 20 20 20 20 20 20 20 28 69 66 20 64 62 20 28          (if db (
2a60: 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65  sqlite3:finalize
2a70: 21 20 64 62 29 29 0a 09 09 09 09 28 65 78 69 74  ! db)).....(exit
2a80: 20 31 29 29 29 29 29 0a 09 20 20 20 20 3b 3b 20   1)))))..    ;; 
2a90: 63 68 65 63 6b 20 66 6f 72 20 68 65 64 20 69 6e  check for hed in
2aa0: 20 77 61 69 74 6f 6e 73 20 3d 3e 20 74 68 69 73   waitons => this
2ab0: 20 77 6f 75 6c 64 20 62 65 20 63 69 72 63 75 6c   would be circul
2ac0: 61 72 2c 20 72 65 6d 6f 76 65 20 69 74 20 61 6e  ar, remove it an
2ad0: 64 20 69 73 73 75 65 20 61 6e 0a 09 20 20 20 20  d issue an..    
2ae0: 3b 3b 20 65 72 72 6f 72 0a 09 20 20 20 20 28 69  ;; error..    (i
2af0: 66 20 28 6d 65 6d 62 65 72 20 68 65 64 20 77 61  f (member hed wa
2b00: 69 74 6f 6e 73 29 0a 09 09 28 62 65 67 69 6e 0a  itons)...(begin.
2b10: 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ..  (debug:print
2b20: 20 30 20 22 45 52 52 4f 52 3a 20 74 65 73 74 20   0 "ERROR: test 
2b30: 22 20 68 65 64 20 22 20 68 61 73 20 6c 69 73 74  " hed " has list
2b40: 65 64 20 69 74 73 65 6c 66 20 61 73 20 61 20 77  ed itself as a w
2b50: 61 69 74 6f 6e 2c 20 70 6c 65 61 73 65 20 63 6f  aiton, please co
2b60: 72 72 65 63 74 20 74 68 69 73 21 22 29 0a 09 09  rrect this!")...
2b70: 20 20 28 73 65 74 21 20 77 61 69 74 6f 6e 73 20    (set! waitons 
2b80: 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20  (filter (lambda 
2b90: 28 78 29 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20  (x)(not (equal? 
2ba0: 78 20 68 65 64 29 29 29 20 77 61 69 74 6f 6e 73  x hed))) waitons
2bb0: 29 29 29 29 0a 09 20 20 20 20 0a 09 20 20 20 20  ))))..    ..    
2bc0: 3b 3b 20 28 69 74 65 6d 73 20 20 20 28 69 74 65  ;; (items   (ite
2bd0: 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f  ms:get-items-fro
2be0: 6d 2d 63 6f 6e 66 69 67 20 63 6f 6e 66 69 67 29  m-config config)
2bf0: 29 29 0a 09 20 20 20 20 28 69 66 20 28 6e 6f 74  ))..    (if (not
2c00: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66   (hash-table-ref
2c10: 2f 64 65 66 61 75 6c 74 20 74 65 73 74 2d 72 65  /default test-re
2c20: 63 6f 72 64 73 20 68 65 64 20 23 66 29 29 0a 09  cords hed #f))..
2c30: 09 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74  .(hash-table-set
2c40: 21 20 74 65 73 74 2d 72 65 63 6f 72 64 73 0a 09  ! test-records..
2c50: 09 09 09 20 68 65 64 20 28 76 65 63 74 6f 72 20  ... hed (vector 
2c60: 68 65 64 20 20 20 20 20 3b 3b 20 30 0a 09 09 09  hed     ;; 0....
2c70: 09 09 20 20 20 20 20 63 6f 6e 66 69 67 20 20 3b  ..     config  ;
2c80: 3b 20 31 0a 09 09 09 09 09 20 20 20 20 20 77 61  ; 1......     wa
2c90: 69 74 6f 6e 73 20 3b 3b 20 32 0a 09 09 09 09 09  itons ;; 2......
2ca0: 20 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f       (config-loo
2cb0: 6b 75 70 20 63 6f 6e 66 69 67 20 22 72 65 71 75  kup config "requ
2cc0: 69 72 65 6d 65 6e 74 73 22 20 22 70 72 69 6f 72  irements" "prior
2cd0: 69 74 79 22 29 20 20 20 20 20 3b 3b 20 70 72 69  ity")     ;; pri
2ce0: 6f 72 69 74 79 20 33 0a 09 09 09 09 09 20 20 20  ority 3......   
2cf0: 20 20 28 6c 65 74 20 28 28 69 74 65 6d 73 20 20    (let ((items  
2d00: 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d      (hash-table-
2d10: 72 65 66 2f 64 65 66 61 75 6c 74 20 63 6f 6e 66  ref/default conf
2d20: 69 67 20 22 69 74 65 6d 73 22 20 23 66 29 29 20  ig "items" #f)) 
2d30: 3b 3b 20 69 74 65 6d 73 20 34 0a 09 09 09 09 09  ;; items 4......
2d40: 09 20 20 20 28 69 74 65 6d 73 74 61 62 6c 65 20  .   (itemstable 
2d50: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f  (hash-table-ref/
2d60: 64 65 66 61 75 6c 74 20 63 6f 6e 66 69 67 20 22  default config "
2d70: 69 74 65 6d 73 74 61 62 6c 65 22 20 23 66 29 29  itemstable" #f))
2d80: 29 20 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b  ) ......       ;
2d90: 3b 20 69 66 20 65 69 74 68 65 72 20 69 74 65 6d  ; if either item
2da0: 73 20 6f 72 20 69 74 65 6d 73 20 74 61 62 6c 65  s or items table
2db0: 20 69 73 20 61 20 70 72 6f 63 20 72 65 74 75 72   is a proc retur
2dc0: 6e 20 69 74 20 73 6f 20 74 65 73 74 20 72 75 6e  n it so test run
2dd0: 6e 69 6e 67 0a 09 09 09 09 09 20 20 20 20 20 20  ning......      
2de0: 20 3b 3b 20 70 72 6f 63 65 73 73 20 63 61 6e 20   ;; process can 
2df0: 6b 6e 6f 77 20 74 6f 20 63 61 6c 6c 20 69 74 65  know to call ite
2e00: 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f  ms:get-items-fro
2e10: 6d 2d 63 6f 6e 66 69 67 0a 09 09 09 09 09 20 20  m-config......  
2e20: 20 20 20 20 20 3b 3b 20 69 66 20 65 69 74 68 65       ;; if eithe
2e30: 72 20 69 73 20 61 20 6c 69 73 74 20 61 6e 64 20  r is a list and 
2e40: 6e 6f 6e 65 20 69 73 20 61 20 70 72 6f 63 20 67  none is a proc g
2e50: 6f 20 61 68 65 61 64 20 61 6e 64 20 63 61 6c 6c  o ahead and call
2e60: 20 67 65 74 2d 69 74 65 6d 73 0a 09 09 09 09 09   get-items......
2e70: 20 20 20 20 20 20 20 3b 3b 20 6f 74 68 65 72 77         ;; otherw
2e80: 69 73 65 20 72 65 74 75 72 6e 20 23 66 20 2d 20  ise return #f - 
2e90: 74 68 69 73 20 69 73 20 6e 6f 74 20 61 6e 20 69  this is not an i
2ea0: 74 65 72 61 74 65 64 20 74 65 73 74 0a 09 09 09  terated test....
2eb0: 09 09 20 20 20 20 20 20 20 28 63 6f 6e 64 0a 09  ..       (cond..
2ec0: 09 09 09 09 09 28 28 70 72 6f 63 65 64 75 72 65  .....((procedure
2ed0: 3f 20 69 74 65 6d 73 29 20 20 20 20 20 20 0a 09  ? items)      ..
2ee0: 09 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 69  ..... (debug:pri
2ef0: 6e 74 2d 69 6e 66 6f 20 34 20 22 69 74 65 6d 73  nt-info 4 "items
2f00: 20 69 73 20 61 20 70 72 6f 63 65 64 75 72 65 2c   is a procedure,
2f10: 20 77 69 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72   will calc later
2f20: 22 29 0a 09 09 09 09 09 09 20 69 74 65 6d 73 29  ")....... items)
2f30: 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 63              ;; c
2f40: 61 6c 63 20 6c 61 74 65 72 0a 09 09 09 09 09 09  alc later.......
2f50: 28 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65  ((procedure? ite
2f60: 6d 73 74 61 62 6c 65 29 0a 09 09 09 09 09 09 20  mstable)....... 
2f70: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
2f80: 6f 20 34 20 22 69 74 65 6d 73 74 61 62 6c 65 20  o 4 "itemstable 
2f90: 69 73 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20  is a procedure, 
2fa0: 77 69 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72 22  will calc later"
2fb0: 29 0a 09 09 09 09 09 09 20 69 74 65 6d 73 74 61  )....... itemsta
2fc0: 62 6c 65 29 20 20 20 20 20 20 20 3b 3b 20 63 61  ble)       ;; ca
2fd0: 6c 63 20 6c 61 74 65 72 0a 09 09 09 09 09 09 28  lc later.......(
2fe0: 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20  (filter (lambda 
2ff0: 28 78 29 0a 09 09 09 09 09 09 09 20 20 20 28 6c  (x)........   (l
3000: 65 74 20 28 28 76 61 6c 20 28 63 61 72 20 78 29  et ((val (car x)
3010: 29 29 0a 09 09 09 09 09 09 09 20 20 20 20 20 28  ))........     (
3020: 69 66 20 28 70 72 6f 63 65 64 75 72 65 3f 20 76  if (procedure? v
3030: 61 6c 29 20 76 61 6c 20 23 66 29 29 29 0a 09 09  al) val #f)))...
3040: 09 09 09 09 09 20 28 61 70 70 65 6e 64 20 28 69  ..... (append (i
3050: 66 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20  f (list? items) 
3060: 69 74 65 6d 73 20 27 28 29 29 0a 09 09 09 09 09  items '())......
3070: 09 09 09 20 28 69 66 20 28 6c 69 73 74 3f 20 69  ... (if (list? i
3080: 74 65 6d 73 74 61 62 6c 65 29 20 69 74 65 6d 73  temstable) items
3090: 74 61 62 6c 65 20 27 28 29 29 29 29 0a 09 09 09  table '())))....
30a0: 09 09 09 20 27 68 61 76 65 2d 70 72 6f 63 65 64  ... 'have-proced
30b0: 75 72 65 29 0a 09 09 09 09 09 09 28 28 6f 72 20  ure).......((or 
30c0: 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 28 6c 69  (list? items)(li
30d0: 73 74 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 29  st? itemstable))
30e0: 20 3b 3b 20 63 61 6c 63 20 6e 6f 77 0a 09 09 09   ;; calc now....
30f0: 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ... (debug:print
3100: 2d 69 6e 66 6f 20 34 20 22 69 74 65 6d 73 20 61  -info 4 "items a
3110: 6e 64 20 69 74 65 6d 73 74 61 62 6c 65 20 61 72  nd itemstable ar
3120: 65 20 6c 69 73 74 73 2c 20 63 61 6c 63 20 6e 6f  e lists, calc no
3130: 77 5c 6e 22 0a 09 09 09 09 09 09 09 20 20 20 20  w\n"........    
3140: 20 20 22 20 20 20 20 69 74 65 6d 73 3a 20 22 20    "    items: " 
3150: 69 74 65 6d 73 20 22 20 69 74 65 6d 73 74 61 62  items " itemstab
3160: 6c 65 3a 20 22 20 69 74 65 6d 73 74 61 62 6c 65  le: " itemstable
3170: 29 0a 09 09 09 09 09 09 20 28 69 74 65 6d 73 3a  )....... (items:
3180: 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63  get-items-from-c
3190: 6f 6e 66 69 67 20 63 6f 6e 66 69 67 29 29 0a 09  onfig config))..
31a0: 09 09 09 09 09 28 65 6c 73 65 20 23 66 29 29 29  .....(else #f)))
31b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
31c0: 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 6e 6f             ;; no
31d0: 74 20 69 74 65 72 61 74 65 64 0a 09 09 09 09 09  t iterated......
31e0: 20 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b 20       #f      ;; 
31f0: 69 74 65 6d 73 64 61 74 20 35 0a 09 09 09 09 09  itemsdat 5......
3200: 20 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b 20       #f      ;; 
3210: 73 70 61 72 65 20 2d 20 75 73 65 64 20 66 6f 72  spare - used for
3220: 20 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 09 09   item-path......
3230: 20 20 20 20 20 29 29 29 0a 09 20 20 20 20 28 66       )))..    (f
3240: 6f 72 2d 65 61 63 68 20 0a 09 20 20 20 20 20 28  or-each ..     (
3250: 6c 61 6d 62 64 61 20 28 77 61 69 74 6f 6e 29 0a  lambda (waiton).
3260: 09 20 20 20 20 20 20 20 28 69 66 20 28 61 6e 64  .       (if (and
3270: 20 77 61 69 74 6f 6e 20 28 6e 6f 74 20 28 6d 65   waiton (not (me
3280: 6d 62 65 72 20 77 61 69 74 6f 6e 20 74 65 73 74  mber waiton test
3290: 2d 6e 61 6d 65 73 29 29 29 0a 09 09 20 20 20 28  -names)))...   (
32a0: 62 65 67 69 6e 0a 09 09 20 20 20 20 20 28 73 65  begin...     (se
32b0: 74 21 20 72 65 71 75 69 72 65 64 2d 74 65 73 74  t! required-test
32c0: 73 20 28 63 6f 6e 73 20 77 61 69 74 6f 6e 20 72  s (cons waiton r
32d0: 65 71 75 69 72 65 64 2d 74 65 73 74 73 29 29 0a  equired-tests)).
32e0: 09 09 20 20 20 20 20 28 73 65 74 21 20 74 65 73  ..     (set! tes
32f0: 74 2d 6e 61 6d 65 73 20 28 63 6f 6e 73 20 77 61  t-names (cons wa
3300: 69 74 6f 6e 20 74 65 73 74 2d 6e 61 6d 65 73 29  iton test-names)
3310: 29 29 29 29 20 3b 3b 20 77 61 73 20 61 6e 20 61  )))) ;; was an a
3320: 70 70 65 6e 64 2c 20 6e 6f 77 20 61 20 63 6f 6e  ppend, now a con
3330: 73 0a 09 20 20 20 20 20 77 61 69 74 6f 6e 73 29  s..     waitons)
3340: 0a 09 20 20 20 20 28 6c 65 74 20 28 28 72 65 6d  ..    (let ((rem
3350: 74 65 73 74 73 20 28 64 65 6c 65 74 65 2d 64 75  tests (delete-du
3360: 70 6c 69 63 61 74 65 73 20 28 61 70 70 65 6e 64  plicates (append
3370: 20 77 61 69 74 6f 6e 73 20 74 61 6c 29 29 29 29   waitons tal))))
3380: 0a 09 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74  ..      (if (not
3390: 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73   (null? remtests
33a0: 29 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61  ))...  (loop (ca
33b0: 72 20 72 65 6d 74 65 73 74 73 29 28 63 64 72 20  r remtests)(cdr 
33c0: 72 65 6d 74 65 73 74 73 29 29 29 29 29 29 29 0a  remtests))))))).
33d0: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e  .    (if (not (n
33e0: 75 6c 6c 3f 20 72 65 71 75 69 72 65 64 2d 74 65  ull? required-te
33f0: 73 74 73 29 29 0a 09 28 64 65 62 75 67 3a 70 72  sts))..(debug:pr
3400: 69 6e 74 2d 69 6e 66 6f 20 31 20 22 41 64 64 69  int-info 1 "Addi
3410: 6e 67 20 22 20 72 65 71 75 69 72 65 64 2d 74 65  ng " required-te
3420: 73 74 73 20 22 20 74 6f 20 74 68 65 20 72 75 6e  sts " to the run
3430: 20 71 75 65 75 65 22 29 29 0a 20 20 20 20 3b 3b   queue")).    ;;
3440: 20 4e 4f 54 45 3a 20 74 68 65 73 65 20 61 72 65   NOTE: these are
3450: 20 61 6c 6c 20 70 61 72 65 6e 74 20 74 65 73 74   all parent test
3460: 73 2c 20 69 74 65 6d 73 20 61 72 65 20 6e 6f 74  s, items are not
3470: 20 65 78 70 61 6e 64 65 64 20 79 65 74 2e 0a 20   expanded yet.. 
3480: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d     (debug:print-
3490: 69 6e 66 6f 20 34 20 22 74 65 73 74 2d 72 65 63  info 4 "test-rec
34a0: 6f 72 64 73 3d 22 20 28 68 61 73 68 2d 74 61 62  ords=" (hash-tab
34b0: 6c 65 2d 3e 61 6c 69 73 74 20 74 65 73 74 2d 72  le->alist test-r
34c0: 65 63 6f 72 64 73 29 29 0a 20 20 20 20 28 72 75  ecords)).    (ru
34d0: 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d 71 75 65  ns:run-tests-que
34e0: 75 65 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d  ue run-id runnam
34f0: 65 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 6b  e test-records k
3500: 65 79 76 61 6c 6c 73 74 20 66 6c 61 67 73 20 74  eyvallst flags t
3510: 65 73 74 2d 70 61 74 74 73 29 0a 20 20 20 20 28  est-patts).    (
3520: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
3530: 20 34 20 22 41 6c 6c 20 64 6f 6e 65 20 62 79 20   4 "All done by 
3540: 68 65 72 65 22 29 29 29 0a 0a 28 64 65 66 69 6e  here")))..(defin
3550: 65 20 28 72 75 6e 73 3a 63 61 6c 63 2d 66 61 69  e (runs:calc-fai
3560: 6c 73 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d  ls prereqs-not-m
3570: 65 74 29 0a 20 20 28 66 69 6c 74 65 72 20 28 6c  et).  (filter (l
3580: 61 6d 62 64 61 20 28 74 65 73 74 29 0a 09 20 20  ambda (test)..  
3590: 20 20 28 61 6e 64 20 28 76 65 63 74 6f 72 3f 20    (and (vector? 
35a0: 74 65 73 74 29 20 3b 3b 20 6e 6f 74 20 28 73 74  test) ;; not (st
35b0: 72 69 6e 67 3f 20 74 65 73 74 29 29 0a 09 09 20  ring? test))... 
35c0: 28 65 71 75 61 6c 3f 20 28 64 62 3a 74 65 73 74  (equal? (db:test
35d0: 2d 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 29  -get-state test)
35e0: 20 22 43 4f 4d 50 4c 45 54 45 44 22 29 0a 09 09   "COMPLETED")...
35f0: 20 28 6e 6f 74 20 28 6d 65 6d 62 65 72 20 28 64   (not (member (d
3600: 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75  b:test-get-statu
3610: 73 20 74 65 73 74 29 0a 09 09 09 20 20 20 20 20  s test)....     
3620: 20 27 28 22 50 41 53 53 22 20 22 57 41 52 4e 22   '("PASS" "WARN"
3630: 20 22 43 48 45 43 4b 22 20 22 57 41 49 56 45 44   "CHECK" "WAIVED
3640: 22 29 29 29 29 29 0a 09 20 20 70 72 65 72 65 71  ")))))..  prereq
3650: 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 0a 28 64 65  s-not-met))..(de
3660: 66 69 6e 65 20 28 72 75 6e 73 3a 63 61 6c 63 2d  fine (runs:calc-
3670: 6e 6f 74 2d 63 6f 6d 70 6c 65 74 65 64 20 70 72  not-completed pr
3680: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 20  ereqs-not-met). 
3690: 20 28 66 69 6c 74 65 72 0a 20 20 20 28 6c 61 6d   (filter.   (lam
36a0: 62 64 61 20 28 74 29 0a 20 20 20 20 20 28 6f 72  bda (t).     (or
36b0: 20 28 6e 6f 74 20 28 76 65 63 74 6f 72 3f 20 74   (not (vector? t
36c0: 29 29 0a 09 20 28 6e 6f 74 20 28 65 71 75 61 6c  )).. (not (equal
36d0: 3f 20 22 43 4f 4d 50 4c 45 54 45 44 22 20 28 64  ? "COMPLETED" (d
36e0: 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 65  b:test-get-state
36f0: 20 74 29 29 29 29 29 0a 20 20 20 70 72 65 72 65   t))))).   prere
3700: 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 0a 28 64  qs-not-met))..(d
3710: 65 66 69 6e 65 20 28 72 75 6e 73 3a 70 72 65 74  efine (runs:pret
3720: 74 79 2d 73 74 72 69 6e 67 20 6c 73 74 29 0a 20  ty-string lst). 
3730: 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 74   (map (lambda (t
3740: 29 0a 09 20 28 69 66 20 28 6e 6f 74 20 28 76 65  ).. (if (not (ve
3750: 63 74 6f 72 3f 20 74 29 29 0a 09 20 20 20 20 20  ctor? t))..     
3760: 28 63 6f 6e 63 20 74 29 0a 09 20 20 20 20 20 28  (conc t)..     (
3770: 63 6f 6e 63 20 28 64 62 3a 74 65 73 74 2d 67 65  conc (db:test-ge
3780: 74 2d 74 65 73 74 6e 61 6d 65 20 74 29 20 22 3a  t-testname t) ":
3790: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73  " (db:test-get-s
37a0: 74 61 74 65 20 74 29 20 22 2f 22 20 28 64 62 3a  tate t) "/" (db:
37b0: 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73 20  test-get-status 
37c0: 74 29 29 29 29 0a 20 20 20 20 20 20 20 6c 73 74  t)))).       lst
37d0: 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e  ))..(define (run
37e0: 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 73 74  s:make-full-test
37f0: 2d 6e 61 6d 65 20 74 65 73 74 6e 61 6d 65 20 69  -name testname i
3800: 74 65 6d 70 61 74 68 29 0a 20 20 28 69 66 20 28  tempath).  (if (
3810: 65 71 75 61 6c 3f 20 69 74 65 6d 70 61 74 68 20  equal? itempath 
3820: 22 22 29 20 74 65 73 74 6e 61 6d 65 20 28 63 6f  "") testname (co
3830: 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22 20  nc testname "/" 
3840: 69 74 65 6d 70 61 74 68 29 29 29 0a 0a 3b 3b 20  itempath)))..;; 
3850: 74 65 73 74 2d 72 65 63 6f 72 64 73 20 69 73 20  test-records is 
3860: 61 20 68 61 73 68 20 74 61 62 6c 65 20 74 65 73  a hash table tes
3870: 74 6e 61 6d 65 3a 69 74 65 6d 5f 70 61 74 68 20  tname:item_path 
3880: 3d 3e 20 76 65 63 74 6f 72 20 3c 20 74 65 73 74  => vector < test
3890: 6e 61 6d 65 20 74 65 73 74 63 6f 6e 66 69 67 20  name testconfig 
38a0: 77 61 69 74 6f 6e 73 20 70 72 69 6f 72 69 74 79  waitons priority
38b0: 20 69 74 65 6d 73 2d 69 6e 66 6f 20 2e 2e 2e 20   items-info ... 
38c0: 3e 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a  >.(define (runs:
38d0: 72 75 6e 2d 74 65 73 74 73 2d 71 75 65 75 65 20  run-tests-queue 
38e0: 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74  run-id runname t
38f0: 65 73 74 2d 72 65 63 6f 72 64 73 20 6b 65 79 76  est-records keyv
3900: 61 6c 6c 73 74 20 66 6c 61 67 73 20 74 65 73 74  allst flags test
3910: 2d 70 61 74 74 73 29 0a 20 20 20 20 3b 3b 20 41  -patts).    ;; A
3920: 74 20 74 68 69 73 20 70 6f 69 6e 74 20 74 68 65  t this point the
3930: 20 6c 69 73 74 20 6f 66 20 70 61 72 65 6e 74 20   list of parent 
3940: 74 65 73 74 73 20 69 73 20 65 78 70 61 6e 64 65  tests is expande
3950: 64 20 0a 20 20 20 20 3b 3b 20 4e 42 2f 2f 20 53  d .    ;; NB// S
3960: 68 6f 75 6c 64 20 65 78 70 61 6e 64 20 69 74 65  hould expand ite
3970: 6d 73 20 68 65 72 65 20 61 6e 64 20 74 68 65 6e  ms here and then
3980: 20 69 6e 73 65 72 74 20 69 6e 74 6f 20 74 68 65   insert into the
3990: 20 72 75 6e 20 71 75 65 75 65 2e 0a 20 20 28 64   run queue..  (d
39a0: 65 62 75 67 3a 70 72 69 6e 74 20 35 20 22 74 65  ebug:print 5 "te
39b0: 73 74 2d 72 65 63 6f 72 64 73 3a 20 22 20 74 65  st-records: " te
39c0: 73 74 2d 72 65 63 6f 72 64 73 20 22 2c 20 6b 65  st-records ", ke
39d0: 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61  yvallst: " keyva
39e0: 6c 6c 73 74 20 22 20 66 6c 61 67 73 3a 20 22 20  llst " flags: " 
39f0: 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61 6c 69  (hash-table->ali
3a00: 73 74 20 66 6c 61 67 73 29 29 0a 20 20 28 6c 65  st flags)).  (le
3a10: 74 20 28 28 73 6f 72 74 65 64 2d 74 65 73 74 2d  t ((sorted-test-
3a20: 6e 61 6d 65 73 20 28 74 65 73 74 73 3a 73 6f 72  names (tests:sor
3a30: 74 2d 62 79 2d 70 72 69 6f 72 69 74 79 2d 61 6e  t-by-priority-an
3a40: 64 2d 77 61 69 74 6f 6e 20 74 65 73 74 2d 72 65  d-waiton test-re
3a50: 63 6f 72 64 73 29 29 0a 09 28 74 65 73 74 2d 72  cords))..(test-r
3a60: 65 67 69 73 74 65 72 79 20 20 20 20 28 6d 61 6b  egistery    (mak
3a70: 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 0a 09  e-hash-table))..
3a80: 28 6e 75 6d 2d 72 65 74 72 69 65 73 20 20 20 20  (num-retries    
3a90: 20 20 20 20 30 29 0a 09 28 6d 61 78 2d 72 65 74      0)..(max-ret
3aa0: 72 69 65 73 20 20 20 20 20 20 20 28 63 6f 6e 66  ries       (conf
3ab0: 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69  ig-lookup *confi
3ac0: 67 64 61 74 2a 20 22 73 65 74 75 70 22 20 22 6d  gdat* "setup" "m
3ad0: 61 78 72 65 74 72 69 65 73 22 29 29 29 0a 20 20  axretries"))).  
3ae0: 20 20 28 73 65 74 21 20 6d 61 78 2d 72 65 74 72    (set! max-retr
3af0: 69 65 73 20 28 69 66 20 28 61 6e 64 20 6d 61 78  ies (if (and max
3b00: 2d 72 65 74 72 69 65 73 20 28 73 74 72 69 6e 67  -retries (string
3b10: 2d 3e 6e 75 6d 62 65 72 20 6d 61 78 2d 72 65 74  ->number max-ret
3b20: 72 69 65 73 29 29 28 73 74 72 69 6e 67 2d 3e 6e  ries))(string->n
3b30: 75 6d 62 65 72 20 6d 61 78 2d 72 65 74 72 69 65  umber max-retrie
3b40: 73 29 20 31 30 30 29 29 0a 20 20 20 20 28 69 66  s) 100)).    (if
3b50: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 73 6f 72   (not (null? sor
3b60: 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29  ted-test-names))
3b70: 0a 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68 65  ..(let loop ((he
3b80: 64 20 20 20 20 20 20 20 20 20 28 63 61 72 20 73  d         (car s
3b90: 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73  orted-test-names
3ba0: 29 29 0a 09 09 20 20 20 28 74 61 6c 20 20 20 20  ))...   (tal    
3bb0: 20 20 20 20 20 28 63 64 72 20 73 6f 72 74 65 64       (cdr sorted
3bc0: 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 09  -test-names))...
3bd0: 20 20 20 28 72 65 72 75 6e 73 20 20 20 20 20 20     (reruns      
3be0: 27 28 29 29 29 0a 09 20 20 28 69 66 20 28 6e 6f  '()))..  (if (no
3bf0: 74 20 28 6e 75 6c 6c 3f 20 72 65 72 75 6e 73 29  t (null? reruns)
3c00: 29 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e  )(debug:print-in
3c10: 66 6f 20 34 20 22 72 65 72 75 6e 73 3d 22 20 72  fo 4 "reruns=" r
3c20: 65 72 75 6e 73 29 29 0a 09 20 20 3b 3b 20 28 70  eruns))..  ;; (p
3c30: 72 69 6e 74 20 22 54 6f 70 20 6f 66 20 6c 6f 6f  rint "Top of loo
3c40: 70 2c 20 68 65 64 3d 22 20 68 65 64 20 22 2c 20  p, hed=" hed ", 
3c50: 74 61 6c 3d 22 20 74 61 6c 20 22 20 2c 72 65 72  tal=" tal " ,rer
3c60: 75 6e 73 3d 22 20 72 65 72 75 6e 73 29 0a 09 20  uns=" reruns).. 
3c70: 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 72 65   (let* ((test-re
3c80: 63 6f 72 64 20 28 68 61 73 68 2d 74 61 62 6c 65  cord (hash-table
3c90: 2d 72 65 66 20 74 65 73 74 2d 72 65 63 6f 72 64  -ref test-record
3ca0: 73 20 68 65 64 29 29 0a 09 09 20 28 74 65 73 74  s hed))... (test
3cb0: 2d 6e 61 6d 65 20 20 20 28 74 65 73 74 73 3a 74  -name   (tests:t
3cc0: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73  estqueue-get-tes
3cd0: 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72  tname test-recor
3ce0: 64 29 29 0a 09 09 20 28 74 63 6f 6e 66 69 67 20  d))... (tconfig 
3cf0: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71      (tests:testq
3d00: 75 65 75 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e  ueue-get-testcon
3d10: 66 69 67 20 74 65 73 74 2d 72 65 63 6f 72 64 29  fig test-record)
3d20: 29 0a 09 09 20 28 74 65 73 74 6d 6f 64 65 20 20  )... (testmode  
3d30: 20 20 28 6c 65 74 20 28 28 6d 20 28 63 6f 6e 66    (let ((m (conf
3d40: 69 67 2d 6c 6f 6f 6b 75 70 20 74 63 6f 6e 66 69  ig-lookup tconfi
3d50: 67 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22  g "requirements"
3d60: 20 22 6d 6f 64 65 22 29 29 29 0a 09 09 09 09 28   "mode"))).....(
3d70: 69 66 20 6d 20 28 73 74 72 69 6e 67 2d 3e 73 79  if m (string->sy
3d80: 6d 62 6f 6c 20 6d 29 20 27 6e 6f 72 6d 61 6c 29  mbol m) 'normal)
3d90: 29 29 0a 09 09 20 28 77 61 69 74 6f 6e 73 20 20  ))... (waitons  
3da0: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75     (tests:testqu
3db0: 65 75 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20  eue-get-waitons 
3dc0: 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29     test-record))
3dd0: 0a 09 09 20 28 70 72 69 6f 72 69 74 79 20 20 20  ... (priority   
3de0: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75   (tests:testqueu
3df0: 65 2d 67 65 74 2d 70 72 69 6f 72 69 74 79 20 20  e-get-priority  
3e00: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09   test-record))..
3e10: 09 20 28 69 74 65 6d 64 61 74 20 20 20 20 20 28  . (itemdat     (
3e20: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
3e30: 67 65 74 2d 69 74 65 6d 64 61 74 20 20 20 20 74  get-itemdat    t
3e40: 65 73 74 2d 72 65 63 6f 72 64 29 29 20 3b 3b 20  est-record)) ;; 
3e50: 69 74 65 6d 64 61 74 20 63 61 6e 20 62 65 20 61  itemdat can be a
3e60: 20 73 74 72 69 6e 67 2c 20 6c 69 73 74 20 6f 72   string, list or
3e70: 20 23 66 0a 09 09 20 28 69 74 65 6d 73 20 20 20   #f... (items   
3e80: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71      (tests:testq
3e90: 75 65 75 65 2d 67 65 74 2d 69 74 65 6d 73 20 20  ueue-get-items  
3ea0: 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29      test-record)
3eb0: 29 0a 09 09 20 28 69 74 65 6d 2d 70 61 74 68 20  )... (item-path 
3ec0: 20 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61    (item-list->pa
3ed0: 74 68 20 69 74 65 6d 64 61 74 29 29 0a 09 09 20  th itemdat))... 
3ee0: 28 6e 65 77 74 61 6c 20 20 20 20 20 20 28 61 70  (newtal      (ap
3ef0: 70 65 6e 64 20 74 61 6c 20 28 6c 69 73 74 20 68  pend tal (list h
3f00: 65 64 29 29 29 29 0a 09 20 20 20 20 0a 09 20 20  ed))))..    ..  
3f10: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 36    (debug:print 6
3f20: 0a 09 09 09 20 22 74 65 73 74 2d 6e 61 6d 65 3a  .... "test-name:
3f30: 20 22 20 74 65 73 74 2d 6e 61 6d 65 0a 09 09 09   " test-name....
3f40: 20 22 5c 6e 20 20 68 65 64 3a 20 20 20 20 20 20   "\n  hed:      
3f50: 20 20 20 22 20 68 65 64 0a 09 09 09 20 22 5c 6e     " hed.... "\n
3f60: 20 20 69 74 65 6d 64 61 74 3a 20 20 20 20 20 22    itemdat:     "
3f70: 20 69 74 65 6d 64 61 74 0a 09 09 09 20 22 5c 6e   itemdat.... "\n
3f80: 20 20 69 74 65 6d 73 3a 20 20 20 20 20 20 20 22    items:       "
3f90: 20 69 74 65 6d 73 0a 09 09 09 20 22 5c 6e 20 20   items.... "\n  
3fa0: 69 74 65 6d 2d 70 61 74 68 3a 20 20 20 22 20 69  item-path:   " i
3fb0: 74 65 6d 2d 70 61 74 68 0a 09 09 09 20 22 5c 6e  tem-path.... "\n
3fc0: 20 20 77 61 69 74 6f 6e 73 3a 20 20 20 20 20 22    waitons:     "
3fd0: 20 77 61 69 74 6f 6e 73 0a 09 09 09 20 22 5c 6e   waitons.... "\n
3fe0: 20 20 6e 75 6d 2d 72 65 74 72 69 65 73 3a 20 22    num-retries: "
3ff0: 20 6e 75 6d 2d 72 65 74 72 69 65 73 0a 09 09 09   num-retries....
4000: 20 22 5c 6e 20 20 74 61 6c 3a 20 20 20 20 20 20   "\n  tal:      
4010: 20 20 20 22 20 74 61 6c 0a 09 09 09 20 22 5c 6e     " tal.... "\n
4020: 20 20 72 65 72 75 6e 73 3a 20 20 20 20 20 20 22    reruns:      "
4030: 20 72 65 72 75 6e 73 29 0a 0a 09 20 20 20 20 3b   reruns)...    ;
4040: 3b 20 63 68 65 63 6b 20 66 6f 72 20 68 65 64 20  ; check for hed 
4050: 69 6e 20 77 61 69 74 6f 6e 73 20 3d 3e 20 74 68  in waitons => th
4060: 69 73 20 77 6f 75 6c 64 20 62 65 20 63 69 72 63  is would be circ
4070: 75 6c 61 72 2c 20 72 65 6d 6f 76 65 20 69 74 20  ular, remove it 
4080: 61 6e 64 20 69 73 73 75 65 20 61 6e 0a 09 20 20  and issue an..  
4090: 20 20 3b 3b 20 65 72 72 6f 72 0a 09 20 20 20 20    ;; error..    
40a0: 28 69 66 20 28 6d 65 6d 62 65 72 20 74 65 73 74  (if (member test
40b0: 2d 6e 61 6d 65 20 77 61 69 74 6f 6e 73 29 0a 09  -name waitons)..
40c0: 09 28 62 65 67 69 6e 0a 09 09 20 20 28 64 65 62  .(begin...  (deb
40d0: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f  ug:print 0 "ERRO
40e0: 52 3a 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e  R: test " test-n
40f0: 61 6d 65 20 22 20 68 61 73 20 6c 69 73 74 65 64  ame " has listed
4100: 20 69 74 73 65 6c 66 20 61 73 20 61 20 77 61 69   itself as a wai
4110: 74 6f 6e 2c 20 70 6c 65 61 73 65 20 63 6f 72 72  ton, please corr
4120: 65 63 74 20 74 68 69 73 21 22 29 0a 09 09 20 20  ect this!")...  
4130: 28 73 65 74 21 20 77 61 69 74 6f 6e 20 28 66 69  (set! waiton (fi
4140: 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29  lter (lambda (x)
4150: 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 78 20 68  (not (equal? x h
4160: 65 64 29 29 29 20 77 61 69 74 6f 6e 73 29 29 29  ed))) waitons)))
4170: 29 0a 0a 09 20 20 20 20 28 63 6f 6e 64 20 3b 3b  )...    (cond ;;
4180: 20 4f 55 54 45 52 20 43 4f 4e 44 0a 09 20 20 20   OUTER COND..   
4190: 20 20 28 28 6e 6f 74 20 69 74 65 6d 73 29 20 3b    ((not items) ;
41a0: 3b 20 77 68 65 6e 20 66 61 6c 73 65 20 74 68 65  ; when false the
41b0: 20 74 65 73 74 20 69 73 20 6f 6b 20 74 6f 20 62   test is ok to b
41c0: 65 20 68 61 6e 64 65 64 20 6f 66 66 20 74 6f 20  e handed off to 
41d0: 6c 61 75 6e 63 68 20 28 62 75 74 20 6e 6f 74 20  launch (but not 
41e0: 62 65 66 6f 72 65 29 0a 09 20 20 20 20 20 20 28  before)..      (
41f0: 6c 65 74 2a 20 28 28 72 75 6e 2d 6c 69 6d 69 74  let* ((run-limit
4200: 73 2d 69 6e 66 6f 20 20 20 20 20 20 20 20 20 28  s-info         (
4210: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72  open-run-close r
4220: 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65  uns:can-run-more
4230: 2d 74 65 73 74 73 20 74 65 73 74 2d 72 65 63 6f  -tests test-reco
4240: 72 64 29 29 20 3b 3b 20 6c 6f 6f 6b 20 61 74 20  rd)) ;; look at 
4250: 74 68 65 20 74 65 73 74 20 6a 6f 62 67 72 6f 75  the test jobgrou
4260: 70 20 61 6e 64 20 74 6f 74 20 6a 6f 62 73 20 72  p and tot jobs r
4270: 75 6e 6e 69 6e 67 0a 09 09 20 20 20 20 20 28 68  unning...     (h
4280: 61 76 65 2d 72 65 73 6f 75 72 63 65 73 20 20 20  ave-resources   
4290: 20 20 20 20 20 20 20 28 63 61 72 20 72 75 6e 2d         (car run-
42a0: 6c 69 6d 69 74 73 2d 69 6e 66 6f 29 29 0a 09 09  limits-info))...
42b0: 20 20 20 20 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e       (num-runnin
42c0: 67 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c  g             (l
42d0: 69 73 74 2d 72 65 66 20 72 75 6e 2d 6c 69 6d 69  ist-ref run-limi
42e0: 74 73 2d 69 6e 66 6f 20 31 29 29 0a 09 09 20 20  ts-info 1))...  
42f0: 20 20 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d     (num-running-
4300: 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 28 6c 69 73  in-jobgroup (lis
4310: 74 2d 72 65 66 20 72 75 6e 2d 6c 69 6d 69 74 73  t-ref run-limits
4320: 2d 69 6e 66 6f 20 32 29 29 0a 09 09 20 20 20 20  -info 2))...    
4330: 20 28 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74   (max-concurrent
4340: 2d 6a 6f 62 73 20 20 20 20 20 28 6c 69 73 74 2d  -jobs     (list-
4350: 72 65 66 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69  ref run-limits-i
4360: 6e 66 6f 20 33 29 29 0a 09 09 20 20 20 20 20 28  nfo 3))...     (
4370: 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 20  job-group-limit 
4380: 20 20 20 20 20 20 20 20 28 6c 69 73 74 2d 72 65          (list-re
4390: 66 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66  f run-limits-inf
43a0: 6f 20 34 29 29 0a 09 09 20 20 20 20 20 28 70 72  o 4))...     (pr
43b0: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 20 20  ereqs-not-met   
43c0: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d        (open-run-
43d0: 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 70 72 65  close db:get-pre
43e0: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 23 66 20  reqs-not-met #f 
43f0: 72 75 6e 2d 69 64 20 77 61 69 74 6f 6e 73 20 69  run-id waitons i
4400: 74 65 6d 2d 70 61 74 68 20 6d 6f 64 65 3a 20 74  tem-path mode: t
4410: 65 73 74 6d 6f 64 65 29 29 0a 09 09 20 20 20 20  estmode))...    
4420: 20 28 66 61 69 6c 73 20 20 20 20 20 20 20 20 20   (fails         
4430: 20 20 20 20 20 20 20 20 20 20 28 72 75 6e 73 3a            (runs:
4440: 63 61 6c 63 2d 66 61 69 6c 73 20 70 72 65 72 65  calc-fails prere
4450: 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 09 09 20  qs-not-met))... 
4460: 20 20 20 20 28 6e 6f 6e 2d 63 6f 6d 70 6c 65 74      (non-complet
4470: 65 64 20 20 20 20 20 20 20 20 20 20 20 28 72 75  ed           (ru
4480: 6e 73 3a 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70  ns:calc-not-comp
4490: 6c 65 74 65 64 20 70 72 65 72 65 71 73 2d 6e 6f  leted prereqs-no
44a0: 74 2d 6d 65 74 29 29 29 0a 09 09 28 64 65 62 75  t-met)))...(debu
44b0: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 38 20 22  g:print-info 8 "
44c0: 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 3a 20  have-resources: 
44d0: 22 20 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73  " have-resources
44e0: 20 22 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d   " prereqs-not-m
44f0: 65 74 3a 20 22 20 0a 09 09 09 20 20 20 20 20 28  et: " ....     (
4500: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72  string-intersper
4510: 73 65 20 0a 09 09 09 20 20 20 20 20 20 28 6d 61  se ....      (ma
4520: 70 20 28 6c 61 6d 62 64 61 20 28 74 29 0a 09 09  p (lambda (t)...
4530: 09 09 20 20 20 20 20 28 69 66 20 28 76 65 63 74  ..     (if (vect
4540: 6f 72 3f 20 74 29 0a 09 09 09 09 09 20 28 63 6f  or? t)...... (co
4550: 6e 63 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  nc (db:test-get-
4560: 73 74 61 74 65 20 74 29 20 22 2f 22 20 28 64 62  state t) "/" (db
4570: 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73  :test-get-status
4580: 20 74 29 29 0a 09 09 09 09 09 20 28 63 6f 6e 63   t))...... (conc
4590: 20 22 20 57 41 52 4e 49 4e 47 3a 20 74 20 69 73   " WARNING: t is
45a0: 20 6e 6f 74 20 61 20 76 65 63 74 6f 72 3d 22 20   not a vector=" 
45b0: 74 20 29 29 29 0a 09 09 09 09 20 20 20 70 72 65  t ))).....   pre
45c0: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 20 22 2c  reqs-not-met) ",
45d0: 20 22 29 20 22 20 66 61 69 6c 73 3a 20 22 20 66   ") " fails: " f
45e0: 61 69 6c 73 29 0a 09 09 28 64 65 62 75 67 3a 70  ails)...(debug:p
45f0: 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 68 65 64  rint-info 4 "hed
4600: 3d 22 20 68 65 64 20 22 5c 6e 20 20 74 65 73 74  =" hed "\n  test
4610: 2d 72 65 63 6f 72 64 3d 22 20 74 65 73 74 2d 72  -record=" test-r
4620: 65 63 6f 72 64 20 22 5c 6e 20 20 74 65 73 74 2d  ecord "\n  test-
4630: 6e 61 6d 65 3a 20 22 20 74 65 73 74 2d 6e 61 6d  name: " test-nam
4640: 65 20 22 5c 6e 20 20 69 74 65 6d 2d 70 61 74 68  e "\n  item-path
4650: 3a 20 22 20 69 74 65 6d 2d 70 61 74 68 20 22 5c  : " item-path "\
4660: 6e 20 20 74 65 73 74 2d 70 61 74 74 73 3a 20 22  n  test-patts: "
4670: 20 74 65 73 74 2d 70 61 74 74 73 29 0a 0a 09 09   test-patts)....
4680: 3b 3b 20 44 6f 6e 27 74 20 6b 6e 6f 77 20 61 74  ;; Don't know at
4690: 20 74 68 69 73 20 74 69 6d 65 20 69 66 20 74 68   this time if th
46a0: 65 20 74 65 73 74 20 68 61 76 65 20 62 65 65 6e  e test have been
46b0: 20 6c 61 75 6e 63 68 65 64 20 61 74 20 73 6f 6d   launched at som
46c0: 65 20 74 69 6d 65 20 69 6e 20 74 68 65 20 70 61  e time in the pa
46d0: 73 74 0a 09 09 3b 3b 20 69 2e 65 2e 20 69 73 20  st...;; i.e. is 
46e0: 74 68 69 73 20 61 20 72 65 2d 6c 61 75 6e 63 68  this a re-launch
46f0: 3f 0a 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74  ?...(debug:print
4700: 2d 69 6e 66 6f 20 34 20 22 72 75 6e 2d 6c 69 6d  -info 4 "run-lim
4710: 69 74 73 2d 69 6e 66 6f 20 3d 20 22 20 72 75 6e  its-info = " run
4720: 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 29 0a 09 09  -limits-info)...
4730: 28 63 6f 6e 64 20 3b 3b 20 49 4e 4e 45 52 20 43  (cond ;; INNER C
4740: 4f 4e 44 20 23 31 20 66 6f 72 20 61 20 6c 61 75  OND #1 for a lau
4750: 6e 63 68 61 62 6c 65 20 74 65 73 74 0a 09 09 20  nchable test... 
4760: 3b 3b 20 43 68 65 63 6b 20 69 74 65 6d 20 70 61  ;; Check item pa
4770: 74 68 20 61 67 61 69 6e 73 74 20 69 74 65 6d 2d  th against item-
4780: 70 61 74 74 73 0a 09 09 20 28 28 6e 6f 74 20 28  patts... ((not (
4790: 74 65 73 74 73 3a 6d 61 74 63 68 20 74 65 73 74  tests:match test
47a0: 2d 70 61 74 74 73 20 28 74 65 73 74 73 3a 74 65  -patts (tests:te
47b0: 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74  stqueue-get-test
47c0: 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64  name test-record
47d0: 29 20 69 74 65 6d 2d 70 61 74 68 29 29 20 3b 3b  ) item-path)) ;;
47e0: 20 54 68 69 73 20 74 65 73 74 2f 69 74 65 6d 70   This test/itemp
47f0: 61 74 68 20 69 73 20 6e 6f 74 20 74 6f 20 62 65  ath is not to be
4800: 20 72 75 6e 0a 09 09 20 20 3b 3b 20 65 6c 73 65   run...  ;; else
4810: 20 74 68 65 20 72 75 6e 20 69 73 20 73 74 75 63   the run is stuc
4820: 6b 2c 20 74 65 6d 70 6f 72 61 72 69 6c 79 20 6f  k, temporarily o
4830: 72 20 70 65 72 6d 61 6e 65 6e 74 6c 79 0a 09 09  r permanently...
4840: 20 20 3b 3b 20 62 75 74 20 73 68 6f 75 6c 64 20    ;; but should 
4850: 63 68 65 63 6b 20 69 66 20 69 74 20 69 73 20 64  check if it is d
4860: 75 65 20 74 6f 20 6c 61 63 6b 20 6f 66 20 72 65  ue to lack of re
4870: 73 6f 75 72 63 65 73 20 76 73 2e 20 70 72 65 72  sources vs. prer
4880: 65 71 75 69 73 69 74 65 73 0a 09 09 20 20 28 64  equisites...  (d
4890: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20  ebug:print-info 
48a0: 31 20 22 53 6b 69 70 70 69 6e 67 20 22 20 28 74  1 "Skipping " (t
48b0: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67  ests:testqueue-g
48c0: 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74  et-testname test
48d0: 2d 72 65 63 6f 72 64 29 20 22 20 22 20 69 74 65  -record) " " ite
48e0: 6d 2d 70 61 74 68 20 22 20 61 73 20 69 74 20 64  m-path " as it d
48f0: 6f 65 73 6e 27 74 20 6d 61 74 63 68 20 22 20 74  oesn't match " t
4900: 65 73 74 2d 70 61 74 74 73 29 0a 09 09 20 20 28  est-patts)...  (
4910: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67  thread-sleep! *g
4920: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09  lobal-delta*)...
4930: 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c    (if (not (null
4940: 3f 20 74 61 6c 29 29 0a 09 09 20 20 20 20 20 20  ? tal))...      
4950: 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28  (loop (car tal)(
4960: 63 64 72 20 74 61 6c 29 20 72 65 72 75 6e 73 29  cdr tal) reruns)
4970: 29 29 0a 09 09 20 28 20 3b 3b 20 28 61 6e 64 0a  ))... ( ;; (and.
4980: 09 09 20 20 28 6e 6f 74 20 28 68 61 73 68 2d 74  ..  (not (hash-t
4990: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74  able-ref/default
49a0: 20 74 65 73 74 2d 72 65 67 69 73 74 65 72 79 20   test-registery 
49b0: 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d  (runs:make-full-
49c0: 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 6e  test-name test-n
49d0: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 20 23  ame item-path) #
49e0: 66 29 29 0a 09 09 20 20 20 20 20 20 3b 3b 20 28  f))...      ;; (
49f0: 61 6e 64 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65  and max-concurre
4a00: 6e 74 2d 6a 6f 62 73 20 28 3e 20 28 2d 20 6d 61  nt-jobs (> (- ma
4a10: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62  x-concurrent-job
4a20: 73 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 20 35  s num-running) 5
4a30: 29 29 29 0a 09 09 20 20 28 64 65 62 75 67 3a 70  )))...  (debug:p
4a40: 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 50 72 65  rint-info 4 "Pre
4a50: 2d 72 65 67 69 73 74 65 72 69 6e 67 20 74 65 73  -registering tes
4a60: 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f  t " test-name "/
4a70: 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20 74 6f  " item-path " to
4a80: 20 63 72 65 61 74 65 20 70 6c 61 63 65 68 6f 6c   create placehol
4a90: 64 65 72 22 20 29 0a 09 09 20 20 28 6f 70 65 6e  der" )...  (open
4aa0: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 74 65  -run-close db:te
4ab0: 73 74 73 2d 72 65 67 69 73 74 65 72 2d 74 65 73  sts-register-tes
4ac0: 74 20 23 66 20 72 75 6e 2d 69 64 20 74 65 73 74  t #f run-id test
4ad0: 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29  -name item-path)
4ae0: 0a 09 09 20 20 28 68 61 73 68 2d 74 61 62 6c 65  ...  (hash-table
4af0: 2d 73 65 74 21 20 74 65 73 74 2d 72 65 67 69 73  -set! test-regis
4b00: 74 65 72 79 20 28 72 75 6e 73 3a 6d 61 6b 65 2d  tery (runs:make-
4b10: 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 74  full-test-name t
4b20: 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61  est-name item-pa
4b30: 74 68 29 20 23 74 29 0a 09 09 20 20 28 74 68 72  th) #t)...  (thr
4b40: 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62  ead-sleep! *glob
4b50: 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 20 20 28  al-delta*)...  (
4b60: 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61 6c  loop (car newtal
4b70: 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20 72 65  )(cdr newtal) re
4b80: 72 75 6e 73 29 29 0a 09 09 20 28 28 6e 6f 74 20  runs))... ((not 
4b90: 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 29 20  have-resources) 
4ba0: 3b 3b 20 73 69 6d 70 6c 79 20 74 72 79 20 61 67  ;; simply try ag
4bb0: 61 69 6e 20 61 66 74 65 72 20 77 61 69 74 69 6e  ain after waitin
4bc0: 67 20 61 20 73 65 63 6f 6e 64 0a 09 09 20 20 28  g a second...  (
4bd0: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
4be0: 20 31 20 22 6e 6f 20 72 65 73 6f 75 72 63 65 73   1 "no resources
4bf0: 20 74 6f 20 72 75 6e 20 6e 65 77 20 74 65 73 74   to run new test
4c00: 73 2c 20 77 61 69 74 69 6e 67 20 2e 2e 2e 22 29  s, waiting ...")
4c10: 0a 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65  ...  (thread-sle
4c20: 65 70 21 20 28 2b 20 32 20 2a 67 6c 6f 62 61 6c  ep! (+ 2 *global
4c30: 2d 64 65 6c 74 61 2a 29 29 0a 09 09 20 20 3b 3b  -delta*))...  ;;
4c40: 20 63 6f 75 6c 64 20 68 61 76 65 20 64 6f 6e 65   could have done
4c50: 20 68 65 64 20 74 61 6c 20 68 65 72 65 20 62 75   hed tal here bu
4c60: 74 20 64 6f 69 6e 67 20 63 61 72 2f 63 64 72 20  t doing car/cdr 
4c70: 6f 66 20 6e 65 77 74 61 6c 20 74 6f 20 72 6f 74  of newtal to rot
4c80: 61 74 65 20 74 65 73 74 73 0a 09 09 20 20 28 6c  ate tests...  (l
4c90: 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61 6c 29  oop (car newtal)
4ca0: 28 63 64 72 20 6e 65 77 74 61 6c 29 20 72 65 72  (cdr newtal) rer
4cb0: 75 6e 73 29 29 0a 09 09 20 28 28 61 6e 64 20 68  uns))... ((and h
4cc0: 61 76 65 2d 72 65 73 6f 75 72 63 65 73 0a 09 09  ave-resources...
4cd0: 20 20 20 20 20 20 20 28 6f 72 20 28 6e 75 6c 6c         (or (null
4ce0: 3f 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65  ? prereqs-not-me
4cf0: 74 29 0a 09 09 09 20 20 20 28 61 6e 64 20 28 65  t)....   (and (e
4d00: 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 74 6f 70  q? testmode 'top
4d10: 6c 65 76 65 6c 29 0a 09 09 09 09 28 6e 75 6c 6c  level).....(null
4d20: 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29  ? non-completed)
4d30: 29 29 29 0a 09 09 20 20 28 72 75 6e 3a 74 65 73  )))...  (run:tes
4d40: 74 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65  t run-id runname
4d50: 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 73 74 2d   keyvallst test-
4d60: 72 65 63 6f 72 64 20 66 6c 61 67 73 20 23 66 29  record flags #f)
4d70: 0a 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65  ...  (thread-sle
4d80: 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74  ep! *global-delt
4d90: 61 2a 29 0a 09 09 20 20 28 69 66 20 28 6e 6f 74  a*)...  (if (not
4da0: 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09   (null? tal))...
4db0: 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72        (loop (car
4dc0: 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 20 72   tal)(cdr tal) r
4dd0: 65 72 75 6e 73 29 29 29 0a 09 09 20 28 65 6c 73  eruns)))... (els
4de0: 65 20 3b 3b 20 6d 75 73 74 20 62 65 20 77 65 20  e ;; must be we 
4df0: 68 61 76 65 20 75 6e 6d 65 74 20 70 72 65 72 65  have unmet prere
4e00: 71 75 69 73 69 74 65 73 0a 09 09 20 20 20 20 28  quisites...    (
4e10: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 46  debug:print 4 "F
4e20: 41 49 4c 53 3a 20 22 20 66 61 69 6c 73 29 0a 09  AILS: " fails)..
4e30: 09 20 20 20 20 3b 3b 20 49 66 20 6f 6e 65 20 6f  .    ;; If one o
4e40: 72 20 6d 6f 72 65 20 6f 66 20 74 68 65 20 70 72  r more of the pr
4e50: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 61 72  ereqs-not-met ar
4e60: 65 20 46 41 49 4c 20 74 68 65 6e 20 77 65 20 63  e FAIL then we c
4e70: 61 6e 20 69 73 73 75 65 0a 09 09 20 20 20 20 3b  an issue...    ;
4e80: 3b 20 61 20 6d 65 73 73 61 67 65 20 61 6e 64 20  ; a message and 
4e90: 64 72 6f 70 20 68 65 64 20 66 72 6f 6d 20 74 68  drop hed from th
4ea0: 65 20 69 74 65 6d 73 20 74 6f 20 62 65 20 70 72  e items to be pr
4eb0: 6f 63 65 73 73 65 64 2e 0a 09 09 20 20 20 20 28  ocessed....    (
4ec0: 69 66 20 28 6e 75 6c 6c 3f 20 66 61 69 6c 73 29  if (null? fails)
4ed0: 0a 09 09 09 28 62 65 67 69 6e 0a 09 09 09 20 20  ....(begin....  
4ee0: 3b 3b 20 63 6f 75 6c 64 6e 27 74 20 72 75 6e 2c  ;; couldn't run,
4ef0: 20 74 61 6b 65 20 61 20 62 72 65 61 74 68 65 72   take a breather
4f00: 0a 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 69  ....  (debug:pri
4f10: 6e 74 2d 69 6e 66 6f 20 34 20 22 53 68 6f 75 6c  nt-info 4 "Shoul
4f20: 64 6e 27 74 20 72 65 61 6c 6c 79 20 67 65 74 20  dn't really get 
4f30: 68 65 72 65 2c 20 72 61 63 65 20 63 6f 6e 64 69  here, race condi
4f40: 74 69 6f 6e 3f 20 55 6e 61 62 6c 65 20 74 6f 20  tion? Unable to 
4f50: 6c 61 75 6e 63 68 20 6d 6f 72 65 20 74 65 73 74  launch more test
4f60: 73 20 61 74 20 74 68 69 73 20 6d 6f 6d 65 6e 74  s at this moment
4f70: 2c 20 6b 69 6c 6c 69 6e 67 20 74 69 6d 65 20 2e  , killing time .
4f80: 2e 2e 22 29 0a 09 09 09 20 20 28 74 68 72 65 61  ..")....  (threa
4f90: 64 2d 73 6c 65 65 70 21 20 28 2b 20 30 2e 30 31  d-sleep! (+ 0.01
4fa0: 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29   *global-delta*)
4fb0: 29 20 3b 3b 20 6c 6f 6e 67 20 73 6c 65 65 70 20  ) ;; long sleep 
4fc0: 68 65 72 65 20 2d 20 6e 6f 20 72 65 73 6f 75 72  here - no resour
4fd0: 63 65 73 2c 20 6d 61 79 20 61 73 20 77 65 6c 6c  ces, may as well
4fe0: 20 62 65 20 70 61 74 69 65 6e 74 0a 09 09 09 20   be patient.... 
4ff0: 20 3b 3b 20 77 65 20 6d 61 64 65 20 6e 65 77 20   ;; we made new 
5000: 74 61 6c 20 62 79 20 73 74 69 63 6b 69 6e 67 20  tal by sticking 
5010: 68 65 64 20 61 74 20 74 68 65 20 62 61 63 6b 20  hed at the back 
5020: 6f 66 20 74 68 65 20 6c 69 73 74 0a 09 09 09 20  of the list.... 
5030: 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74   (loop (car newt
5040: 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20  al)(cdr newtal) 
5050: 72 65 72 75 6e 73 29 29 0a 09 09 09 3b 3b 20 74  reruns))....;; t
5060: 68 65 20 77 61 69 74 6f 6e 20 69 73 20 46 41 49  he waiton is FAI
5070: 4c 20 73 6f 20 6e 6f 20 70 6f 69 6e 74 20 69 6e  L so no point in
5080: 20 74 72 79 69 6e 67 20 74 6f 20 72 75 6e 20 68   trying to run h
5090: 65 64 20 65 76 65 72 20 61 67 61 69 6e 0a 09 09  ed ever again...
50a0: 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f  .(if (not (null?
50b0: 20 74 61 6c 29 29 0a 09 09 09 20 20 20 20 28 69   tal))....    (i
50c0: 66 20 28 76 65 63 74 6f 72 3f 20 68 65 64 29 0a  f (vector? hed).
50d0: 09 09 09 09 28 62 65 67 69 6e 20 28 64 65 62 75  ....(begin (debu
50e0: 67 3a 70 72 69 6e 74 20 31 20 22 57 41 52 4e 3a  g:print 1 "WARN:
50f0: 20 44 72 6f 70 70 69 6e 67 20 74 65 73 74 20 22   Dropping test "
5100: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65   (db:test-get-te
5110: 73 74 6e 61 6d 65 20 68 65 64 29 20 22 2f 22 20  stname hed) "/" 
5120: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65  (db:test-get-ite
5130: 6d 2d 70 61 74 68 20 68 65 64 29 0a 09 09 09 09  m-path hed).....
5140: 09 09 20 20 20 20 22 20 66 72 6f 6d 20 74 68 65  ..    " from the
5150: 20 6c 61 75 6e 63 68 20 6c 69 73 74 20 61 73 20   launch list as 
5160: 69 74 20 68 61 73 20 70 72 65 72 65 71 75 69 73  it has prerequis
5170: 74 65 73 20 74 68 61 74 20 61 72 65 20 46 41 49  tes that are FAI
5180: 4c 22 29 0a 09 09 09 09 20 20 20 20 20 20 20 28  L").....       (
5190: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67  thread-sleep! *g
51a0: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09  lobal-delta*)...
51b0: 09 09 20 20 20 20 20 20 20 28 6c 6f 6f 70 20 28  ..       (loop (
51c0: 63 61 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c  car tal)(cdr tal
51d0: 29 20 28 63 6f 6e 73 20 68 65 64 20 72 65 72 75  ) (cons hed reru
51e0: 6e 73 29 29 29 0a 09 09 09 09 28 62 65 67 69 6e  ns))).....(begin
51f0: 0a 09 09 09 09 20 20 28 64 65 62 75 67 3a 70 72  .....  (debug:pr
5200: 69 6e 74 20 31 20 22 57 41 52 4e 3a 20 54 65 73  int 1 "WARN: Tes
5210: 74 20 6e 6f 74 20 70 72 6f 63 65 73 73 65 64 20  t not processed 
5220: 63 6f 72 72 65 63 74 6c 79 2e 20 43 6f 75 6c 64  correctly. Could
5230: 20 62 65 20 61 20 72 61 63 65 20 63 6f 6e 64 69   be a race condi
5240: 74 69 6f 6e 20 69 6e 20 79 6f 75 72 20 74 65 73  tion in your tes
5250: 74 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e  t implementation
5260: 3f 20 22 20 68 65 64 29 20 3b 3b 20 20 22 20 61  ? " hed) ;;  " a
5270: 73 20 69 74 20 68 61 73 20 70 72 65 72 65 71 75  s it has prerequ
5280: 69 73 74 65 73 20 74 68 61 74 20 61 72 65 20 46  istes that are F
5290: 41 49 4c 2e 20 28 4e 4f 54 45 3a 20 68 65 64 20  AIL. (NOTE: hed 
52a0: 69 73 20 6e 6f 74 20 61 20 76 65 63 74 6f 72 29  is not a vector)
52b0: 22 29 0a 09 09 09 09 20 20 28 74 68 72 65 61 64  ").....  (thread
52c0: 2d 73 6c 65 65 70 21 20 28 2b 20 30 2e 30 31 20  -sleep! (+ 0.01 
52d0: 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29  *global-delta*))
52e0: 0a 09 09 09 09 20 20 28 6c 6f 6f 70 20 68 65 64  .....  (loop hed
52f0: 20 74 61 6c 20 72 65 72 75 6e 73 29 29 29 29 29   tal reruns)))))
5300: 29 29 29 29 20 3b 3b 20 45 4e 44 20 4f 46 20 49  )))) ;; END OF I
5310: 4e 4e 45 52 20 43 4f 4e 44 0a 09 20 20 20 20 20  NNER COND..     
5320: 0a 09 20 20 20 20 20 3b 3b 20 63 61 73 65 20 77  ..     ;; case w
5330: 68 65 72 65 20 61 6e 20 69 74 65 6d 73 20 63 61  here an items ca
5340: 6d 65 20 69 6e 20 61 73 20 61 20 6c 69 73 74 20  me in as a list 
5350: 62 65 65 6e 20 70 72 6f 63 65 73 73 65 64 0a 09  been processed..
5360: 20 20 20 20 20 28 28 61 6e 64 20 28 6c 69 73 74       ((and (list
5370: 3f 20 69 74 65 6d 73 29 20 20 20 20 20 3b 3b 20  ? items)     ;; 
5380: 74 68 75 73 20 77 65 20 6b 6e 6f 77 20 6f 75 72  thus we know our
5390: 20 69 74 65 6d 73 20 61 72 65 20 61 6c 72 65 61   items are alrea
53a0: 64 79 20 63 61 6c 63 75 6c 61 74 65 64 0a 09 09  dy calculated...
53b0: 20 20 20 28 6e 6f 74 20 20 20 69 74 65 6d 64 61     (not   itemda
53c0: 74 29 29 20 3b 3b 20 61 6e 64 20 6e 6f 74 20 79  t)) ;; and not y
53d0: 65 74 20 65 78 70 61 6e 64 65 64 20 69 6e 74 6f  et expanded into
53e0: 20 74 68 65 20 6c 69 73 74 20 6f 66 20 74 68 69   the list of thi
53f0: 6e 67 73 20 74 6f 20 62 65 20 64 6f 6e 65 0a 09  ngs to be done..
5400: 20 20 20 20 20 20 28 69 66 20 28 61 6e 64 20 28        (if (and (
5410: 64 65 62 75 67 3a 64 65 62 75 67 2d 6d 6f 64 65  debug:debug-mode
5420: 20 31 29 20 3b 3b 20 28 3e 3d 20 2a 76 65 72 62   1) ;; (>= *verb
5430: 6f 73 69 74 79 2a 20 31 29 0a 09 09 20 20 20 20  osity* 1)...    
5440: 20 20 20 28 3e 20 28 6c 65 6e 67 74 68 20 69 74     (> (length it
5450: 65 6d 73 29 20 30 29 0a 09 09 20 20 20 20 20 20  ems) 0)...      
5460: 20 28 3e 20 28 6c 65 6e 67 74 68 20 28 63 61 72   (> (length (car
5470: 20 69 74 65 6d 73 29 29 20 30 29 29 0a 09 09 20   items)) 0))... 
5480: 20 28 70 70 20 69 74 65 6d 73 29 29 0a 09 20 20   (pp items))..  
5490: 20 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 09 20      (for-each.. 
54a0: 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6d        (lambda (m
54b0: 79 2d 69 74 65 6d 64 61 74 29 0a 09 09 20 28 6c  y-itemdat)... (l
54c0: 65 74 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d 72  et* ((new-test-r
54d0: 65 63 6f 72 64 20 28 6c 65 74 20 28 28 6e 65 77  ecord (let ((new
54e0: 72 65 63 20 28 6d 61 6b 65 2d 74 65 73 74 73 3a  rec (make-tests:
54f0: 74 65 73 74 71 75 65 75 65 29 29 29 0a 09 09 09  testqueue)))....
5500: 09 09 20 20 20 28 76 65 63 74 6f 72 2d 63 6f 70  ..   (vector-cop
5510: 79 21 20 74 65 73 74 2d 72 65 63 6f 72 64 20 6e  y! test-record n
5520: 65 77 72 65 63 29 0a 09 09 09 09 09 20 20 20 6e  ewrec)......   n
5530: 65 77 72 65 63 29 29 0a 09 09 09 28 6d 79 2d 69  ewrec))....(my-i
5540: 74 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c  tem-path (item-l
5550: 69 73 74 2d 3e 70 61 74 68 20 6d 79 2d 69 74 65  ist->path my-ite
5560: 6d 64 61 74 29 29 29 0a 09 09 20 20 20 28 69 66  mdat)))...   (if
5570: 20 28 74 65 73 74 73 3a 6d 61 74 63 68 20 74 65   (tests:match te
5580: 73 74 2d 70 61 74 74 73 20 68 65 64 20 6d 79 2d  st-patts hed my-
5590: 69 74 65 6d 2d 70 61 74 68 29 20 3b 3b 20 28 70  item-path) ;; (p
55a0: 61 74 74 2d 6c 69 73 74 2d 6d 61 74 63 68 20 6d  att-list-match m
55b0: 79 2d 69 74 65 6d 2d 70 61 74 68 20 69 74 65 6d  y-item-path item
55c0: 2d 70 61 74 74 73 29 20 20 20 20 20 20 20 20 20  -patts)         
55d0: 20 20 3b 3b 20 79 65 73 2c 20 77 65 20 77 61 6e    ;; yes, we wan
55e0: 74 20 74 6f 20 70 72 6f 63 65 73 73 20 74 68 69  t to process thi
55f0: 73 20 69 74 65 6d 2c 20 4e 4f 54 45 3a 20 53 68  s item, NOTE: Sh
5600: 6f 75 6c 64 20 6e 6f 74 20 6e 65 65 64 20 74 68  ould not need th
5610: 69 73 20 63 68 65 63 6b 20 68 65 72 65 21 0a 09  is check here!..
5620: 09 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 6e  .       (let ((n
5630: 65 77 74 65 73 74 6e 61 6d 65 20 28 72 75 6e 73  ewtestname (runs
5640: 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d  :make-full-test-
5650: 6e 61 6d 65 20 68 65 64 20 6d 79 2d 69 74 65 6d  name hed my-item
5660: 2d 70 61 74 68 29 29 29 20 20 20 20 3b 3b 20 74  -path)))    ;; t
5670: 65 73 74 20 6e 61 6d 65 73 20 61 72 65 20 75 6e  est names are un
5680: 69 71 75 65 20 6f 6e 20 74 65 73 74 6e 61 6d 65  ique on testname
5690: 2f 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 20 28  /item-path.... (
56a0: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
56b0: 73 65 74 2d 69 74 65 6d 73 21 20 20 20 20 20 6e  set-items!     n
56c0: 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 23  ew-test-record #
56d0: 66 29 0a 09 09 09 20 28 74 65 73 74 73 3a 74 65  f).... (tests:te
56e0: 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d  stqueue-set-item
56f0: 64 61 74 21 20 20 20 6e 65 77 2d 74 65 73 74 2d  dat!   new-test-
5700: 72 65 63 6f 72 64 20 6d 79 2d 69 74 65 6d 64 61  record my-itemda
5710: 74 29 0a 09 09 09 20 28 74 65 73 74 73 3a 74 65  t).... (tests:te
5720: 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d  stqueue-set-item
5730: 5f 70 61 74 68 21 20 6e 65 77 2d 74 65 73 74 2d  _path! new-test-
5740: 72 65 63 6f 72 64 20 6d 79 2d 69 74 65 6d 2d 70  record my-item-p
5750: 61 74 68 29 0a 09 09 09 20 28 68 61 73 68 2d 74  ath).... (hash-t
5760: 61 62 6c 65 2d 73 65 74 21 20 74 65 73 74 2d 72  able-set! test-r
5770: 65 63 6f 72 64 73 20 6e 65 77 74 65 73 74 6e 61  ecords newtestna
5780: 6d 65 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f  me new-test-reco
5790: 72 64 29 0a 09 09 09 20 28 73 65 74 21 20 74 61  rd).... (set! ta
57a0: 6c 20 28 63 6f 6e 73 20 6e 65 77 74 65 73 74 6e  l (cons newtestn
57b0: 61 6d 65 20 74 61 6c 29 29 29 29 29 29 20 3b 3b  ame tal)))))) ;;
57c0: 20 73 69 6e 63 65 20 74 68 65 73 65 20 61 72 65   since these are
57d0: 20 69 74 65 6d 69 7a 65 64 20 63 72 65 61 74 65   itemized create
57e0: 20 6e 65 77 20 74 65 73 74 20 6e 61 6d 65 73 20   new test names 
57f0: 74 65 73 74 6e 61 6d 65 2f 69 74 65 6d 70 61 74  testname/itempat
5800: 68 0a 09 20 20 20 20 20 20 20 69 74 65 6d 73 29  h..       items)
5810: 0a 09 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74  ..      (if (not
5820: 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09   (null? tal))...
5830: 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 28    (begin...    (
5840: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
5850: 20 34 20 22 45 6e 64 20 6f 66 20 69 74 65 6d 73   4 "End of items
5860: 20 6c 69 73 74 2c 20 6c 6f 6f 70 69 6e 67 20 77   list, looping w
5870: 69 74 68 20 6e 65 78 74 20 61 66 74 65 72 20 73  ith next after s
5880: 68 6f 72 74 20 64 65 6c 61 79 22 29 0a 09 09 20  hort delay")... 
5890: 20 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70     (thread-sleep
58a0: 21 20 28 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61  ! (+ 0.01 *globa
58b0: 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09 20 20 20  l-delta*))...   
58c0: 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29   (loop (car tal)
58d0: 28 63 64 72 20 74 61 6c 29 20 72 65 72 75 6e 73  (cdr tal) reruns
58e0: 29 29 29 29 0a 0a 09 20 20 20 20 20 3b 3b 20 69  ))))...     ;; i
58f0: 66 20 69 74 65 6d 73 20 69 73 20 61 20 70 72 6f  f items is a pro
5900: 63 20 74 68 65 6e 20 6e 65 65 64 20 74 6f 20 72  c then need to r
5910: 75 6e 20 69 74 65 6d 73 3a 67 65 74 2d 69 74 65  un items:get-ite
5920: 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 2c 20  ms-from-config, 
5930: 67 65 74 20 74 68 65 20 6c 69 73 74 20 61 6e 64  get the list and
5940: 20 6c 6f 6f 70 20 0a 09 20 20 20 20 20 3b 3b 20   loop ..     ;; 
5950: 20 20 20 2d 20 62 75 74 20 6f 6e 6c 79 20 64 6f     - but only do
5960: 20 74 68 61 74 20 69 66 20 72 65 73 6f 75 72 63   that if resourc
5970: 65 73 20 65 78 69 73 74 20 74 6f 20 6b 69 63 6b  es exist to kick
5980: 20 6f 66 66 20 74 68 65 20 6a 6f 62 0a 09 20 20   off the job..  
5990: 20 20 20 28 28 6f 72 20 28 70 72 6f 63 65 64 75     ((or (procedu
59a0: 72 65 3f 20 69 74 65 6d 73 29 28 65 71 3f 20 69  re? items)(eq? i
59b0: 74 65 6d 73 20 27 68 61 76 65 2d 70 72 6f 63 65  tems 'have-proce
59c0: 64 75 72 65 29 29 0a 09 20 20 20 20 20 20 28 6c  dure))..      (l
59d0: 65 74 20 28 28 63 61 6e 2d 72 75 6e 2d 6d 6f 72  et ((can-run-mor
59e0: 65 20 20 20 20 28 72 75 6e 73 3a 63 61 6e 2d 72  e    (runs:can-r
59f0: 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 74 65  un-more-tests te
5a00: 73 74 2d 72 65 63 6f 72 64 29 29 29 0a 09 09 28  st-record)))...(
5a10: 69 66 20 28 61 6e 64 20 28 6c 69 73 74 3f 20 63  if (and (list? c
5a20: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 29 0a 09 09 09  an-run-more)....
5a30: 20 28 63 61 72 20 63 61 6e 2d 72 75 6e 2d 6d 6f   (car can-run-mo
5a40: 72 65 29 29 0a 09 09 20 20 20 20 28 6c 65 74 2a  re))...    (let*
5a50: 20 28 28 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d   ((prereqs-not-m
5a60: 65 74 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f  et (open-run-clo
5a70: 73 65 20 64 62 3a 67 65 74 2d 70 72 65 72 65 71  se db:get-prereq
5a80: 73 2d 6e 6f 74 2d 6d 65 74 20 23 66 20 72 75 6e  s-not-met #f run
5a90: 2d 69 64 20 77 61 69 74 6f 6e 73 20 69 74 65 6d  -id waitons item
5aa0: 2d 70 61 74 68 20 6d 6f 64 65 3a 20 74 65 73 74  -path mode: test
5ab0: 6d 6f 64 65 29 29 0a 09 09 09 20 20 20 28 66 61  mode))....   (fa
5ac0: 69 6c 73 20 20 20 20 20 20 20 20 20 20 20 28 72  ils           (r
5ad0: 75 6e 73 3a 63 61 6c 63 2d 66 61 69 6c 73 20 70  uns:calc-fails p
5ae0: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29  rereqs-not-met))
5af0: 0a 09 09 09 20 20 20 28 6e 6f 6e 2d 63 6f 6d 70  ....   (non-comp
5b00: 6c 65 74 65 64 20 20 20 28 72 75 6e 73 3a 63 61  leted   (runs:ca
5b10: 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 74 65 64  lc-not-completed
5b20: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74   prereqs-not-met
5b30: 29 29 29 0a 09 09 20 20 20 20 20 20 28 64 65 62  )))...      (deb
5b40: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 38 20  ug:print-info 8 
5b50: 22 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 3a 20 22  "can-run-more: "
5b60: 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 0a 09 09   can-run-more...
5b70: 09 09 20 20 20 22 5c 6e 20 74 65 73 74 6e 61 6d  ..   "\n testnam
5b80: 65 3a 20 20 20 20 20 20 20 20 22 20 68 65 64 0a  e:        " hed.
5b90: 09 09 09 09 20 20 20 22 5c 6e 20 70 72 65 72 65  ....   "\n prere
5ba0: 71 73 2d 6e 6f 74 2d 6d 65 74 3a 20 22 20 28 72  qs-not-met: " (r
5bb0: 75 6e 73 3a 70 72 65 74 74 79 2d 73 74 72 69 6e  uns:pretty-strin
5bc0: 67 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65  g prereqs-not-me
5bd0: 74 29 0a 09 09 09 09 20 20 20 22 5c 6e 20 6e 6f  t).....   "\n no
5be0: 6e 2d 63 6f 6d 70 6c 65 74 65 64 3a 20 20 20 22  n-completed:   "
5bf0: 20 28 72 75 6e 73 3a 70 72 65 74 74 79 2d 73 74   (runs:pretty-st
5c00: 72 69 6e 67 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74  ring non-complet
5c10: 65 64 29 20 0a 09 09 09 09 20 20 20 22 5c 6e 20  ed) .....   "\n 
5c20: 66 61 69 6c 73 3a 20 20 20 20 20 20 20 20 20 20  fails:          
5c30: 20 22 20 28 72 75 6e 73 3a 70 72 65 74 74 79 2d   " (runs:pretty-
5c40: 73 74 72 69 6e 67 20 66 61 69 6c 73 29 0a 09 09  string fails)...
5c50: 09 09 20 20 20 22 5c 6e 20 74 65 73 74 6d 6f 64  ..   "\n testmod
5c60: 65 3a 20 20 20 20 20 20 20 20 22 20 74 65 73 74  e:        " test
5c70: 6d 6f 64 65 0a 09 09 09 09 20 20 20 22 5c 6e 20  mode.....   "\n 
5c80: 6e 75 6d 2d 72 65 74 72 69 65 73 3a 20 20 20 20  num-retries:    
5c90: 20 22 20 6e 75 6d 2d 72 65 74 72 69 65 73 0a 09   " num-retries..
5ca0: 09 09 09 20 20 20 22 5c 6e 20 28 65 71 3f 20 74  ...   "\n (eq? t
5cb0: 65 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65  estmode 'topleve
5cc0: 6c 29 3a 20 22 20 28 65 71 3f 20 74 65 73 74 6d  l): " (eq? testm
5cd0: 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c 29 0a 09  ode 'toplevel)..
5ce0: 09 09 09 20 20 20 22 5c 6e 20 28 6e 75 6c 6c 3f  ...   "\n (null?
5cf0: 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 3a   non-completed):
5d00: 20 20 20 20 22 20 28 6e 75 6c 6c 3f 20 6e 6f 6e      " (null? non
5d10: 2d 63 6f 6d 70 6c 65 74 65 64 29 0a 09 09 09 09  -completed).....
5d20: 20 20 20 22 5c 6e 20 72 65 72 75 6e 73 3a 20 20     "\n reruns:  
5d30: 20 20 20 20 20 20 20 20 22 20 72 65 72 75 6e 73          " reruns
5d40: 0a 09 09 09 09 20 20 20 22 5c 6e 20 69 74 65 6d  .....   "\n item
5d50: 73 3a 20 20 20 20 20 20 20 20 20 20 20 22 20 69  s:           " i
5d60: 74 65 6d 73 0a 09 09 09 09 20 20 20 22 5c 6e 20  tems.....   "\n 
5d70: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 3a 20 20 20  can-run-more:   
5d80: 20 22 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 29   " can-run-more)
5d90: 0a 09 09 20 20 20 20 20 20 3b 3b 20 28 74 68 72  ...      ;; (thr
5da0: 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 30 2e  ead-sleep! (+ 0.
5db0: 30 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61  01 *global-delta
5dc0: 2a 29 29 0a 09 09 20 20 20 20 20 20 28 63 6f 6e  *))...      (con
5dd0: 64 20 3b 3b 20 49 4e 4e 45 52 20 43 4f 4e 44 20  d ;; INNER COND 
5de0: 23 32 0a 09 09 20 20 20 20 20 20 20 28 28 6f 72  #2...       ((or
5df0: 20 28 6e 75 6c 6c 3f 20 70 72 65 72 65 71 73 2d   (null? prereqs-
5e00: 6e 6f 74 2d 6d 65 74 29 20 3b 3b 20 61 6c 6c 20  not-met) ;; all 
5e10: 70 72 65 72 65 71 73 20 6d 65 74 2c 20 66 69 72  prereqs met, fir
5e20: 65 20 6f 66 66 20 74 68 65 20 74 65 73 74 0a 09  e off the test..
5e30: 09 09 20 20 20 20 3b 3b 20 6f 72 2c 20 69 66 20  ..    ;; or, if 
5e40: 69 74 20 69 73 20 61 20 27 74 6f 70 6c 65 76 65  it is a 'topleve
5e50: 6c 20 74 65 73 74 20 61 6e 64 20 61 6c 6c 20 70  l test and all p
5e60: 72 65 72 65 71 73 20 6e 6f 74 20 6d 65 74 20 61  rereqs not met a
5e70: 72 65 20 43 4f 4d 50 4c 45 54 45 44 20 74 68 65  re COMPLETED the
5e80: 6e 20 6c 61 75 6e 63 68 0a 09 09 09 20 20 20 20  n launch....    
5e90: 28 61 6e 64 20 28 65 71 3f 20 74 65 73 74 6d 6f  (and (eq? testmo
5ea0: 64 65 20 27 74 6f 70 6c 65 76 65 6c 29 0a 09 09  de 'toplevel)...
5eb0: 09 09 20 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f  .. (null? non-co
5ec0: 6d 70 6c 65 74 65 64 29 29 29 0a 09 09 09 28 6c  mpleted)))....(l
5ed0: 65 74 20 28 28 74 65 73 74 2d 6e 61 6d 65 20 28  et ((test-name (
5ee0: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
5ef0: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73  get-testname tes
5f00: 74 2d 72 65 63 6f 72 64 29 29 29 0a 09 09 09 20  t-record))).... 
5f10: 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 54 45 53   (setenv "MT_TES
5f20: 54 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d  T_NAME" test-nam
5f30: 65 29 20 3b 3b 20 0a 09 09 09 20 20 28 73 65 74  e) ;; ....  (set
5f40: 65 6e 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22  env "MT_RUNNAME"
5f50: 20 20 20 72 75 6e 6e 61 6d 65 29 0a 09 09 09 20     runname).... 
5f60: 20 28 73 65 74 2d 6d 65 67 61 74 65 73 74 2d 65   (set-megatest-e
5f70: 6e 76 2d 76 61 72 73 20 72 75 6e 2d 69 64 29 20  nv-vars run-id) 
5f80: 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62 65 20  ;; these may be 
5f90: 6e 65 65 64 65 64 20 62 79 20 74 68 65 20 6c 61  needed by the la
5fa0: 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 73 0a  unching process.
5fb0: 09 09 09 20 20 28 6c 65 74 20 28 28 69 74 65 6d  ...  (let ((item
5fc0: 73 2d 6c 69 73 74 20 28 69 74 65 6d 73 3a 67 65  s-list (items:ge
5fd0: 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e  t-items-from-con
5fe0: 66 69 67 20 74 63 6f 6e 66 69 67 29 29 29 0a 09  fig tconfig)))..
5ff0: 09 09 20 20 20 20 28 69 66 20 28 6c 69 73 74 3f  ..    (if (list?
6000: 20 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09 09 09   items-list)....
6010: 09 28 62 65 67 69 6e 0a 09 09 09 09 20 20 28 74  .(begin.....  (t
6020: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 73  ests:testqueue-s
6030: 65 74 2d 69 74 65 6d 73 21 20 74 65 73 74 2d 72  et-items! test-r
6040: 65 63 6f 72 64 20 69 74 65 6d 73 2d 6c 69 73 74  ecord items-list
6050: 29 0a 09 09 09 09 20 20 28 74 68 72 65 61 64 2d  ).....  (thread-
6060: 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64  sleep! *global-d
6070: 65 6c 74 61 2a 29 0a 09 09 09 09 20 20 28 6c 6f  elta*).....  (lo
6080: 6f 70 20 68 65 64 20 74 61 6c 20 72 65 72 75 6e  op hed tal rerun
6090: 73 29 29 0a 09 09 09 09 28 62 65 67 69 6e 0a 09  s)).....(begin..
60a0: 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e  ...  (debug:prin
60b0: 74 20 30 20 22 45 52 52 4f 52 3a 20 54 68 65 20  t 0 "ERROR: The 
60c0: 70 72 6f 63 20 66 72 6f 6d 20 72 65 61 64 69 6e  proc from readin
60d0: 67 20 74 68 65 20 73 65 74 75 70 20 64 69 64 20  g the setup did 
60e0: 6e 6f 74 20 79 69 65 6c 64 20 61 20 6c 69 73 74  not yield a list
60f0: 20 2d 20 70 6c 65 61 73 65 20 72 65 70 6f 72 74   - please report
6100: 20 74 68 69 73 22 29 0a 09 09 09 09 20 20 28 65   this").....  (e
6110: 78 69 74 20 31 29 29 29 29 29 29 0a 09 09 20 20  xit 1))))))...  
6120: 20 20 20 20 20 28 28 6e 75 6c 6c 3f 20 66 61 69       ((null? fai
6130: 6c 73 29 0a 09 09 09 28 64 65 62 75 67 3a 70 72  ls)....(debug:pr
6140: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 66 61 69 6c  int-info 4 "fail
6150: 73 20 69 73 20 6e 75 6c 6c 2c 20 6d 6f 76 69 6e  s is null, movin
6160: 67 20 6f 6e 20 69 6e 20 74 68 65 20 71 75 65 75  g on in the queu
6170: 65 20 62 75 74 20 6b 65 65 70 69 6e 67 20 22 20  e but keeping " 
6180: 68 65 64 20 22 20 66 6f 72 20 6e 6f 77 22 29 0a  hed " for now").
6190: 09 09 09 3b 3b 20 6f 6e 6c 79 20 69 6e 63 72 65  ...;; only incre
61a0: 6d 65 6e 74 20 6e 75 6d 2d 72 65 74 72 69 65 73  ment num-retries
61b0: 20 77 68 65 6e 20 74 68 65 72 65 20 61 72 65 20   when there are 
61c0: 6e 6f 20 74 65 73 74 73 20 72 75 6e 69 6e 67 0a  no tests runing.
61d0: 09 09 09 28 69 66 20 28 65 71 3f 20 30 20 28 6c  ...(if (eq? 0 (l
61e0: 69 73 74 2d 72 65 66 20 63 61 6e 2d 72 75 6e 2d  ist-ref can-run-
61f0: 6d 6f 72 65 20 31 29 29 0a 09 09 09 20 20 20 20  more 1))....    
6200: 28 62 65 67 69 6e 0a 09 09 09 20 20 20 20 20 20  (begin....      
6210: 28 69 66 20 28 3e 20 6e 75 6d 2d 72 65 74 72 69  (if (> num-retri
6220: 65 73 20 31 30 30 29 20 3b 3b 20 66 69 72 73 74  es 100) ;; first
6230: 20 31 30 30 20 72 65 74 72 69 65 73 20 61 72 65   100 retries are
6240: 20 6c 6f 77 20 74 69 6d 65 20 63 6f 73 74 0a 09   low time cost..
6250: 09 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65  ...  (thread-sle
6260: 65 70 21 20 28 2b 20 32 20 2a 67 6c 6f 62 61 6c  ep! (+ 2 *global
6270: 2d 64 65 6c 74 61 2a 29 29 0a 09 09 09 09 20 20  -delta*)).....  
6280: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28  (thread-sleep! (
6290: 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d 64  + 0.01 *global-d
62a0: 65 6c 74 61 2a 29 29 29 0a 09 09 09 20 20 20 20  elta*)))....    
62b0: 20 20 28 73 65 74 21 20 6e 75 6d 2d 72 65 74 72    (set! num-retr
62c0: 69 65 73 20 28 2b 20 6e 75 6d 2d 72 65 74 72 69  ies (+ num-retri
62d0: 65 73 20 31 29 29 29 29 0a 09 09 09 28 69 66 20  es 1))))....(if 
62e0: 28 3e 20 6e 75 6d 2d 72 65 74 72 69 65 73 20 20  (> num-retries  
62f0: 6d 61 78 2d 72 65 74 72 69 65 73 29 0a 09 09 09  max-retries)....
6300: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75      (if (not (nu
6310: 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 09 09 28 6c  ll? tal)).....(l
6320: 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63 64  oop (car tal)(cd
6330: 72 20 74 61 6c 29 20 72 65 72 75 6e 73 29 29 0a  r tal) reruns)).
6340: 09 09 09 20 20 20 20 28 6c 6f 6f 70 20 28 63 61  ...    (loop (ca
6350: 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65  r newtal)(cdr ne
6360: 77 74 61 6c 29 20 72 65 72 75 6e 73 29 29 29 20  wtal) reruns))) 
6370: 3b 3b 20 61 6e 20 69 73 73 75 65 20 77 69 74 68  ;; an issue with
6380: 20 70 72 65 72 65 71 73 20 6e 6f 74 20 79 65 74   prereqs not yet
6390: 20 6d 65 74 3f 0a 09 09 20 20 20 20 20 20 20 28   met?...       (
63a0: 28 61 6e 64 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f  (and (not (null?
63b0: 20 66 61 69 6c 73 29 29 28 65 71 3f 20 74 65 73   fails))(eq? tes
63c0: 74 6d 6f 64 65 20 27 6e 6f 72 6d 61 6c 29 29 0a  tmode 'normal)).
63d0: 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 2d  ...(debug:print-
63e0: 69 6e 66 6f 20 31 20 22 74 65 73 74 20 22 20 20  info 1 "test "  
63f0: 68 65 64 20 22 20 28 6d 6f 64 65 3d 22 20 74 65  hed " (mode=" te
6400: 73 74 6d 6f 64 65 20 22 29 20 68 61 73 20 66 61  stmode ") has fa
6410: 69 6c 65 64 20 70 72 65 72 65 71 75 69 73 69 74  iled prerequisit
6420: 65 28 73 29 3b 20 22 0a 09 09 09 09 20 20 20 20  e(s); ".....    
6430: 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70   (string-intersp
6440: 65 72 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 64  erse (map (lambd
6450: 61 20 28 74 29 28 63 6f 6e 63 20 28 64 62 3a 74  a (t)(conc (db:t
6460: 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65  est-get-testname
6470: 20 74 29 20 22 3a 22 20 28 64 62 3a 74 65 73 74   t) ":" (db:test
6480: 2d 67 65 74 2d 73 74 61 74 65 20 74 29 22 2f 22  -get-state t)"/"
6490: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61  (db:test-get-sta
64a0: 74 75 73 20 74 29 29 29 20 66 61 69 6c 73 29 20  tus t))) fails) 
64b0: 22 2c 20 22 29 0a 09 09 09 09 20 20 20 20 20 22  ", ").....     "
64c0: 2c 20 72 65 6d 6f 76 69 6e 67 20 69 74 20 66 72  , removing it fr
64d0: 6f 6d 20 74 6f 2d 64 6f 20 6c 69 73 74 22 29 0a  om to-do list").
64e0: 09 09 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c  ...(if (not (nul
64f0: 6c 3f 20 74 61 6c 29 29 0a 09 09 09 20 20 20 20  l? tal))....    
6500: 28 62 65 67 69 6e 0a 09 09 09 20 20 20 20 20 20  (begin....      
6510: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a  (thread-sleep! *
6520: 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09  global-delta*)..
6530: 09 09 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63  ..      (loop (c
6540: 61 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29  ar tal)(cdr tal)
6550: 28 63 6f 6e 73 20 68 65 64 20 72 65 72 75 6e 73  (cons hed reruns
6560: 29 29 29 29 29 0a 09 09 20 20 20 20 20 20 20 28  )))))...       (
6570: 65 6c 73 65 0a 09 09 09 28 64 65 62 75 67 3a 70  else....(debug:p
6580: 72 69 6e 74 20 38 20 22 45 52 52 4f 52 3a 20 4e  rint 8 "ERROR: N
6590: 6f 20 68 61 6e 64 6c 65 72 20 66 6f 72 20 74 68  o handler for th
65a0: 69 73 20 63 6f 6e 64 69 74 69 6f 6e 2e 22 29 0a  is condition.").
65b0: 09 09 09 28 74 68 72 65 61 64 2d 73 6c 65 65 70  ...(thread-sleep
65c0: 21 20 28 2b 20 31 20 2a 67 6c 6f 62 61 6c 2d 64  ! (+ 1 *global-d
65d0: 65 6c 74 61 2a 29 29 0a 09 09 09 28 6c 6f 6f 70  elta*))....(loop
65e0: 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64   (car newtal)(cd
65f0: 72 20 6e 65 77 74 61 6c 29 20 72 65 72 75 6e 73  r newtal) reruns
6600: 29 29 29 29 20 3b 3b 20 45 4e 44 20 4f 46 20 49  )))) ;; END OF I
6610: 46 20 43 41 4e 20 52 55 4e 20 4d 4f 52 45 0a 0a  F CAN RUN MORE..
6620: 09 09 20 20 20 20 3b 3b 20 69 66 20 63 61 6e 27  ..    ;; if can'
6630: 74 20 72 75 6e 20 6d 6f 72 65 20 6a 75 73 74 20  t run more just 
6640: 6c 6f 6f 70 20 77 69 74 68 20 6e 65 78 74 20 70  loop with next p
6650: 6f 73 73 69 62 6c 65 20 74 65 73 74 0a 09 09 20  ossible test... 
6660: 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20     (begin...    
6670: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69    (debug:print-i
6680: 6e 66 6f 20 34 20 22 70 72 6f 63 65 73 73 69 6e  nfo 4 "processin
6690: 67 20 74 68 65 20 63 61 73 65 20 77 69 74 68 20  g the case with 
66a0: 61 20 6c 61 6d 62 64 61 20 66 6f 72 20 69 74 65  a lambda for ite
66b0: 6d 73 20 6f 72 20 27 68 61 76 65 2d 70 72 6f 63  ms or 'have-proc
66c0: 65 64 75 72 65 2e 20 4d 6f 76 69 6e 67 20 74 68  edure. Moving th
66d0: 72 6f 75 67 68 20 74 68 65 20 71 75 65 75 65 20  rough the queue 
66e0: 77 69 74 68 6f 75 74 20 64 72 6f 70 70 69 6e 67  without dropping
66f0: 20 22 20 68 65 64 29 0a 09 09 20 20 20 20 20 20   " hed)...      
6700: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28  (thread-sleep! (
6710: 2b 20 32 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74  + 2 *global-delt
6720: 61 2a 29 29 0a 09 09 20 20 20 20 20 20 28 6c 6f  a*))...      (lo
6730: 6f 70 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28  op (car newtal)(
6740: 63 64 72 20 6e 65 77 74 61 6c 29 20 72 65 72 75  cdr newtal) reru
6750: 6e 73 29 29 29 29 29 20 3b 3b 20 45 4e 44 20 4f  ns))))) ;; END O
6760: 46 20 28 6f 72 20 28 70 72 6f 63 65 64 75 72 65  F (or (procedure
6770: 3f 20 69 74 65 6d 73 29 28 65 71 3f 20 69 74 65  ? items)(eq? ite
6780: 6d 73 20 27 68 61 76 65 2d 70 72 6f 63 65 64 75  ms 'have-procedu
6790: 72 65 29 29 0a 09 20 20 20 20 20 0a 09 20 20 20  re))..     ..   
67a0: 20 20 3b 3b 20 74 68 69 73 20 63 61 73 65 20 73    ;; this case s
67b0: 68 6f 75 6c 64 20 6e 6f 74 20 68 61 70 70 65 6e  hould not happen
67c0: 2c 20 61 64 64 65 64 20 74 6f 20 68 65 6c 70 20  , added to help 
67d0: 63 61 74 63 68 20 61 6e 79 20 62 75 67 73 0a 09  catch any bugs..
67e0: 20 20 20 20 20 28 28 61 6e 64 20 28 6c 69 73 74       ((and (list
67f0: 3f 20 69 74 65 6d 73 29 20 69 74 65 6d 64 61 74  ? items) itemdat
6800: 29 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 3a  )..      (debug:
6810: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
6820: 53 68 6f 75 6c 64 20 6e 6f 74 20 68 61 76 65 20  Should not have 
6830: 61 20 6c 69 73 74 20 6f 66 20 69 74 65 6d 73 20  a list of items 
6840: 69 6e 20 61 20 74 65 73 74 20 61 6e 64 20 74 68  in a test and th
6850: 65 20 69 74 65 6d 73 70 61 74 68 20 73 65 74 20  e itemspath set 
6860: 2d 20 70 6c 65 61 73 65 20 72 65 70 6f 72 74 20  - please report 
6870: 74 68 69 73 22 29 0a 09 20 20 20 20 20 20 28 65  this")..      (e
6880: 78 69 74 20 31 29 29 0a 09 20 20 20 20 20 28 28  xit 1))..     ((
6890: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 72 75 6e  not (null? rerun
68a0: 73 29 29 0a 09 20 20 20 20 20 20 28 6c 65 74 2a  s))..      (let*
68b0: 20 28 28 6e 65 77 6c 73 74 20 28 74 65 73 74 73   ((newlst (tests
68c0: 3a 66 69 6c 74 65 72 2d 6e 6f 6e 2d 72 75 6e 6e  :filter-non-runn
68d0: 61 62 6c 65 20 72 75 6e 2d 69 64 20 74 61 6c 20  able run-id tal 
68e0: 74 65 73 74 2d 72 65 63 6f 72 64 73 29 29 20 3b  test-records)) ;
68f0: 3b 20 69 2e 65 2e 20 6e 6f 74 20 46 41 49 4c 2c  ; i.e. not FAIL,
6900: 20 57 41 49 56 45 44 2c 20 49 4e 43 4f 4d 50 4c   WAIVED, INCOMPL
6910: 45 54 45 2c 20 50 41 53 53 2c 20 4b 49 4c 4c 45  ETE, PASS, KILLE
6920: 44 2c 0a 09 09 20 20 20 20 20 28 6a 75 6e 6b 65  D,...     (junke
6930: 64 20 28 6c 73 65 74 2d 64 69 66 66 65 72 65 6e  d (lset-differen
6940: 63 65 20 65 71 75 61 6c 3f 20 74 61 6c 20 6e 65  ce equal? tal ne
6950: 77 6c 73 74 29 29 29 0a 09 09 28 64 65 62 75 67  wlst)))...(debug
6960: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 66  :print-info 4 "f
6970: 75 6c 6c 20 64 72 6f 70 20 74 68 72 6f 75 67 68  ull drop through
6980: 2c 20 69 66 20 72 65 72 75 6e 73 20 69 73 20 6c  , if reruns is l
6990: 65 73 73 20 74 68 61 6e 20 31 30 30 20 77 65 20  ess than 100 we 
69a0: 77 69 6c 6c 20 66 6f 72 63 65 20 72 65 74 72 79  will force retry
69b0: 20 74 68 65 6d 2c 20 72 65 72 75 6e 73 3d 22 20   them, reruns=" 
69c0: 72 65 72 75 6e 73 20 22 2c 20 74 61 6c 3d 22 20  reruns ", tal=" 
69d0: 74 61 6c 29 0a 09 09 28 69 66 20 28 3c 20 6e 75  tal)...(if (< nu
69e0: 6d 2d 72 65 74 72 69 65 73 20 6d 61 78 2d 72 65  m-retries max-re
69f0: 74 72 69 65 73 29 0a 09 09 20 20 20 20 28 73 65  tries)...    (se
6a00: 74 21 20 6e 65 77 6c 73 74 20 28 61 70 70 65 6e  t! newlst (appen
6a10: 64 20 72 65 72 75 6e 73 20 6e 65 77 6c 73 74 29  d reruns newlst)
6a20: 29 29 0a 09 09 28 73 65 74 21 20 6e 75 6d 2d 72  ))...(set! num-r
6a30: 65 74 72 69 65 73 20 28 2b 20 6e 75 6d 2d 72 65  etries (+ num-re
6a40: 74 72 69 65 73 20 31 29 29 0a 09 09 28 74 68 72  tries 1))...(thr
6a50: 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 31 20  ead-sleep! (+ 1 
6a60: 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29  *global-delta*))
6a70: 0a 09 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c  ...(if (not (nul
6a80: 6c 3f 20 6e 65 77 6c 73 74 29 29 0a 09 09 20 20  l? newlst))...  
6a90: 20 20 3b 3b 20 73 69 6e 63 65 20 72 65 72 75 6e    ;; since rerun
6aa0: 73 20 68 61 76 65 20 62 65 65 6e 20 74 61 63 6b  s have been tack
6ab0: 65 64 20 6f 6e 20 74 6f 20 6e 65 77 6c 73 74 20  ed on to newlst 
6ac0: 63 72 65 61 74 65 20 6e 65 77 20 72 65 72 75 6e  create new rerun
6ad0: 73 20 66 72 6f 6d 20 6a 75 6e 6b 65 64 0a 09 09  s from junked...
6ae0: 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e      (loop (car n
6af0: 65 77 6c 73 74 29 28 63 64 72 20 6e 65 77 6c 73  ewlst)(cdr newls
6b00: 74 29 28 64 65 6c 65 74 65 2d 64 75 70 6c 69 63  t)(delete-duplic
6b10: 61 74 65 73 20 6a 75 6e 6b 65 64 29 29 29 29 29  ates junked)))))
6b20: 0a 09 20 20 20 20 20 28 28 6e 6f 74 20 28 6e 75  ..     ((not (nu
6b30: 6c 6c 3f 20 74 61 6c 29 29 0a 09 20 20 20 20 20  ll? tal))..     
6b40: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
6b50: 66 6f 20 34 20 22 49 27 6d 20 70 72 65 74 74 79  fo 4 "I'm pretty
6b60: 20 73 75 72 65 20 49 20 73 68 6f 75 6c 64 6e 27   sure I shouldn'
6b70: 74 20 67 65 74 20 68 65 72 65 2e 22 29 29 0a 09  t get here."))..
6b80: 20 20 20 20 20 28 65 6c 73 65 0a 09 20 20 20 20       (else..    
6b90: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69    (debug:print-i
6ba0: 6e 66 6f 20 34 20 22 45 78 69 74 69 6e 67 20 6c  nfo 4 "Exiting l
6bb0: 6f 6f 70 20 77 69 74 68 2e 2e 2e 5c 6e 20 20 68  oop with...\n  h
6bc0: 65 64 3d 22 20 68 65 64 20 22 5c 6e 20 20 74 61  ed=" hed "\n  ta
6bd0: 6c 3d 22 20 74 61 6c 20 22 5c 6e 20 20 72 65 72  l=" tal "\n  rer
6be0: 75 6e 73 3d 22 20 72 65 72 75 6e 73 29 29 0a 09  uns=" reruns))..
6bf0: 20 20 20 20 20 29 29 29 29 20 3b 3b 20 4c 45 54       )))) ;; LET
6c00: 2a 20 28 28 74 65 73 74 2d 72 65 63 6f 72 64 0a  * ((test-record.
6c10: 0a 20 20 20 20 3b 3b 20 77 65 20 67 65 74 20 68  .    ;; we get h
6c20: 65 72 65 20 6f 6e 20 22 64 72 6f 70 20 74 68 72  ere on "drop thr
6c30: 6f 75 67 68 22 20 2d 20 6c 6f 6f 70 20 66 6f 72  ough" - loop for
6c40: 20 6e 65 78 74 20 74 65 73 74 20 69 6e 20 71 75   next test in qu
6c50: 65 75 65 0a 20 20 20 20 3b 3b 20 46 49 58 4d 45  eue.    ;; FIXME
6c60: 21 21 21 21 20 54 48 49 53 20 53 48 4f 55 4c 44  !!!! THIS SHOULD
6c70: 20 4e 4f 54 20 52 45 51 55 49 52 45 20 41 4e 20   NOT REQUIRE AN 
6c80: 45 58 49 54 21 21 21 21 21 21 21 0a 20 20 20 20  EXIT!!!!!!!.    
6c90: 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  .    (debug:prin
6ca0: 74 2d 69 6e 66 6f 20 31 20 22 41 6c 6c 20 74 65  t-info 1 "All te
6cb0: 73 74 73 20 6c 61 75 6e 63 68 65 64 22 29 0a 20  sts launched"). 
6cc0: 20 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70     (thread-sleep
6cd0: 21 20 30 2e 35 29 0a 20 20 20 20 3b 3b 20 46 49  ! 0.5).    ;; FI
6ce0: 58 4d 45 21 20 54 68 69 73 20 68 61 72 73 68 20  XME! This harsh 
6cf0: 65 78 69 74 20 73 68 6f 75 6c 64 20 6e 6f 74 20  exit should not 
6d00: 62 65 20 6e 65 63 65 73 73 61 72 79 2e 2e 2e 2e  be necessary....
6d10: 0a 20 20 20 20 3b 3b 20 28 69 66 20 28 6e 6f 74  .    ;; (if (not
6d20: 20 2a 72 75 6e 72 65 6d 6f 74 65 2a 29 28 65 78   *runremote*)(ex
6d30: 69 74 29 29 20 3b 3b 20 0a 20 20 20 20 23 66 29  it)) ;; .    #f)
6d40: 29 20 3b 3b 20 72 65 74 75 72 6e 20 61 20 23 66  ) ;; return a #f
6d50: 20 61 73 20 61 20 68 69 6e 74 20 74 68 61 74 20   as a hint that 
6d60: 77 65 20 61 72 65 20 64 6f 6e 65 0a 20 20 3b 3b  we are done.  ;;
6d70: 20 48 65 72 65 20 77 65 20 6e 65 65 64 20 74 6f   Here we need to
6d80: 20 63 68 65 63 6b 20 74 68 61 74 20 61 6c 6c 20   check that all 
6d90: 74 68 65 20 74 65 73 74 73 20 72 65 6d 61 69 6e  the tests remain
6da0: 69 6e 67 20 74 6f 20 62 65 20 72 75 6e 20 61 72  ing to be run ar
6db0: 65 20 65 6c 69 67 69 62 6c 65 20 74 6f 20 72 75  e eligible to ru
6dc0: 6e 0a 20 20 3b 3b 20 61 6e 64 20 61 72 65 20 6e  n.  ;; and are n
6dd0: 6f 74 20 62 6c 6f 63 6b 65 64 20 62 79 20 66 61  ot blocked by fa
6de0: 69 6c 65 64 0a 20 20 0a 0a 3b 3b 20 70 61 72 65  iled.  ..;; pare
6df0: 6e 74 2d 74 65 73 74 20 69 73 20 74 68 65 72 65  nt-test is there
6e00: 20 61 73 20 61 20 70 6c 61 63 65 68 6f 6c 64 65   as a placeholde
6e10: 72 20 66 6f 72 20 77 68 65 6e 20 70 61 72 65 6e  r for when paren
6e20: 74 2d 74 65 73 74 73 20 63 61 6e 20 62 65 20 72  t-tests can be r
6e30: 75 6e 20 61 73 20 61 20 73 65 74 75 70 20 73 74  un as a setup st
6e40: 65 70 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 3a  ep.(define (run:
6e50: 74 65 73 74 20 72 75 6e 2d 69 64 20 72 75 6e 6e  test run-id runn
6e60: 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20 74 65  ame keyvallst te
6e70: 73 74 2d 72 65 63 6f 72 64 20 66 6c 61 67 73 20  st-record flags 
6e80: 70 61 72 65 6e 74 2d 74 65 73 74 29 0a 20 20 3b  parent-test).  ;
6e90: 3b 20 41 6c 6c 20 74 68 65 73 65 20 76 61 72 73  ; All these vars
6ea0: 20 6d 69 67 68 74 20 62 65 20 72 65 66 65 72 65   might be refere
6eb0: 6e 63 65 64 20 62 79 20 74 68 65 20 74 65 73 74  nced by the test
6ec0: 63 6f 6e 66 69 67 20 66 69 6c 65 20 72 65 61 64  config file read
6ed0: 65 72 0a 20 20 28 6c 65 74 2a 20 28 28 74 65 73  er.  (let* ((tes
6ee0: 74 2d 6e 61 6d 65 20 20 20 20 28 74 65 73 74 73  t-name    (tests
6ef0: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74  :testqueue-get-t
6f00: 65 73 74 6e 61 6d 65 20 20 20 74 65 73 74 2d 72  estname   test-r
6f10: 65 63 6f 72 64 29 29 0a 09 20 28 74 65 73 74 2d  ecord)).. (test-
6f20: 77 61 69 74 6f 6e 73 20 28 74 65 73 74 73 3a 74  waitons (tests:t
6f30: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 77 61 69  estqueue-get-wai
6f40: 74 6f 6e 73 20 20 20 20 74 65 73 74 2d 72 65 63  tons    test-rec
6f50: 6f 72 64 29 29 0a 09 20 28 74 65 73 74 2d 63 6f  ord)).. (test-co
6f60: 6e 66 20 20 20 20 28 74 65 73 74 73 3a 74 65 73  nf    (tests:tes
6f70: 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 63  tqueue-get-testc
6f80: 6f 6e 66 69 67 20 74 65 73 74 2d 72 65 63 6f 72  onfig test-recor
6f90: 64 29 29 0a 09 20 28 69 74 65 6d 64 61 74 20 20  d)).. (itemdat  
6fa0: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71      (tests:testq
6fb0: 75 65 75 65 2d 67 65 74 2d 69 74 65 6d 64 61 74  ueue-get-itemdat
6fc0: 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29      test-record)
6fd0: 29 0a 09 20 28 74 65 73 74 2d 70 61 74 68 20 20  ).. (test-path  
6fe0: 20 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68    (conc *toppath
6ff0: 2a 20 22 2f 74 65 73 74 73 2f 22 20 74 65 73 74  * "/tests/" test
7000: 2d 6e 61 6d 65 29 29 20 3b 3b 20 63 6f 75 6c 64  -name)) ;; could
7010: 20 75 73 65 20 74 65 73 74 73 3a 67 65 74 2d 74   use tests:get-t
7020: 65 73 74 63 6f 6e 66 69 67 20 68 65 72 65 20 2e  estconfig here .
7030: 2e 2e 0a 09 20 28 66 6f 72 63 65 20 20 20 20 20  .... (force     
7040: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72     (hash-table-r
7050: 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73  ef/default flags
7060: 20 22 2d 66 6f 72 63 65 22 20 23 66 29 29 0a 09   "-force" #f))..
7070: 20 28 72 65 72 75 6e 20 20 20 20 20 20 20 20 28   (rerun        (
7080: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64  hash-table-ref/d
7090: 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 72  efault flags "-r
70a0: 65 72 75 6e 22 20 23 66 29 29 0a 09 20 28 6b 65  erun" #f)).. (ke
70b0: 65 70 67 6f 69 6e 67 20 20 20 20 28 68 61 73 68  epgoing    (hash
70c0: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75  -table-ref/defau
70d0: 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 65 70 67  lt flags "-keepg
70e0: 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 28 69 74  oing" #f)).. (it
70f0: 65 6d 2d 70 61 74 68 20 20 20 20 20 22 22 29 0a  em-path     "").
7100: 09 20 28 64 62 20 20 20 20 20 20 20 20 20 20 20  . (db           
7110: 23 66 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a  #f)).    (debug:
7120: 70 72 69 6e 74 20 34 0a 09 09 20 22 74 65 73 74  print 4... "test
7130: 2d 63 6f 6e 66 69 67 3a 20 22 20 28 68 61 73 68  -config: " (hash
7140: 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65  -table->alist te
7150: 73 74 2d 63 6f 6e 66 29 0a 09 09 20 22 5c 6e 20  st-conf)... "\n 
7160: 20 20 69 74 65 6d 64 61 74 3a 20 22 20 69 74 65    itemdat: " ite
7170: 6d 64 61 74 0a 09 09 20 29 0a 20 20 20 20 3b 3b  mdat... ).    ;;
7180: 20 73 65 74 74 69 6e 67 20 69 74 65 6d 64 61 74   setting itemdat
7190: 20 74 6f 20 61 20 6c 69 73 74 20 69 66 20 69 74   to a list if it
71a0: 20 69 73 20 23 66 0a 20 20 20 20 28 69 66 20 28   is #f.    (if (
71b0: 6e 6f 74 20 69 74 65 6d 64 61 74 29 28 73 65 74  not itemdat)(set
71c0: 21 20 69 74 65 6d 64 61 74 20 27 28 29 29 29 0a  ! itemdat '())).
71d0: 20 20 20 20 28 73 65 74 21 20 69 74 65 6d 2d 70      (set! item-p
71e0: 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e  ath (item-list->
71f0: 70 61 74 68 20 69 74 65 6d 64 61 74 29 29 0a 20  path itemdat)). 
7200: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
7210: 32 20 22 41 74 74 65 6d 70 74 69 6e 67 20 74 6f  2 "Attempting to
7220: 20 6c 61 75 6e 63 68 20 74 65 73 74 20 22 20 74   launch test " t
7230: 65 73 74 2d 6e 61 6d 65 20 28 69 66 20 28 65 71  est-name (if (eq
7240: 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22  ual? item-path "
7250: 2f 22 29 20 22 2f 22 20 69 74 65 6d 2d 70 61 74  /") "/" item-pat
7260: 68 29 29 0a 20 20 20 20 28 73 65 74 65 6e 76 20  h)).    (setenv 
7270: 22 4d 54 5f 54 45 53 54 5f 4e 41 4d 45 22 20 74  "MT_TEST_NAME" t
7280: 65 73 74 2d 6e 61 6d 65 29 20 3b 3b 20 0a 20 20  est-name) ;; .  
7290: 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55    (setenv "MT_RU
72a0: 4e 4e 41 4d 45 22 20 20 20 72 75 6e 6e 61 6d 65  NNAME"   runname
72b0: 29 0a 20 20 20 20 28 73 65 74 2d 6d 65 67 61 74  ).    (set-megat
72c0: 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 72 75 6e  est-env-vars run
72d0: 2d 69 64 29 20 3b 3b 20 74 68 65 73 65 20 6d 61  -id) ;; these ma
72e0: 79 20 62 65 20 6e 65 65 64 65 64 20 62 79 20 74  y be needed by t
72f0: 68 65 20 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f  he launching pro
7300: 63 65 73 73 0a 20 20 20 20 28 63 68 61 6e 67 65  cess.    (change
7310: 2d 64 69 72 65 63 74 6f 72 79 20 2a 74 6f 70 70  -directory *topp
7320: 61 74 68 2a 29 0a 0a 20 20 20 20 3b 3b 20 48 65  ath*)..    ;; He
7330: 72 65 20 69 73 20 77 68 65 72 65 20 74 68 65 20  re is where the 
7340: 74 65 73 74 5f 6d 65 74 61 20 74 61 62 6c 65 20  test_meta table 
7350: 69 73 20 62 65 73 74 20 75 70 64 61 74 65 64 0a  is best updated.
7360: 20 20 20 20 3b 3b 20 59 65 73 2c 20 61 6e 6f 74      ;; Yes, anot
7370: 68 65 72 20 75 73 65 20 6f 66 20 61 20 67 6c 6f  her use of a glo
7380: 62 61 6c 20 66 6f 72 20 63 61 63 68 69 6e 67 2e  bal for caching.
7390: 20 4e 65 65 64 20 61 20 62 65 74 74 65 72 20 77   Need a better w
73a0: 61 79 3f 0a 20 20 20 20 28 69 66 20 28 6e 6f 74  ay?.    (if (not
73b0: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66   (hash-table-ref
73c0: 2f 64 65 66 61 75 6c 74 20 2a 74 65 73 74 2d 6d  /default *test-m
73d0: 65 74 61 2d 75 70 64 61 74 65 64 2a 20 74 65 73  eta-updated* tes
73e0: 74 2d 6e 61 6d 65 20 23 66 29 29 0a 20 20 20 20  t-name #f)).    
73f0: 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 28      (begin..   (
7400: 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20  hash-table-set! 
7410: 2a 74 65 73 74 2d 6d 65 74 61 2d 75 70 64 61 74  *test-meta-updat
7420: 65 64 2a 20 74 65 73 74 2d 6e 61 6d 65 20 23 74  ed* test-name #t
7430: 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 6f 70  ).           (op
7440: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e  en-run-close run
7450: 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65  s:update-test_me
7460: 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20  ta db test-name 
7470: 74 65 73 74 2d 63 6f 6e 66 29 29 29 0a 20 20 20  test-conf))).   
7480: 20 0a 20 20 20 20 3b 3b 20 28 6c 61 6d 62 64 61   .    ;; (lambda
7490: 20 28 69 74 65 6d 64 61 74 29 20 3b 3b 3b 20 28   (itemdat) ;;; (
74a0: 28 72 69 70 65 6e 65 73 73 20 22 6f 76 65 72 72  (ripeness "overr
74b0: 69 70 65 22 29 20 28 74 65 6d 70 65 72 61 74 75  ipe") (temperatu
74c0: 72 65 20 22 63 6f 6f 6c 22 29 20 28 73 65 61 73  re "cool") (seas
74d0: 6f 6e 20 22 73 75 6d 6d 65 72 22 29 29 0a 20 20  on "summer")).  
74e0: 20 20 28 6c 65 74 2a 20 28 28 6e 65 77 2d 74 65    (let* ((new-te
74f0: 73 74 2d 70 61 74 68 20 28 73 74 72 69 6e 67 2d  st-path (string-
7500: 69 6e 74 65 72 73 70 65 72 73 65 20 28 63 6f 6e  intersperse (con
7510: 73 20 74 65 73 74 2d 70 61 74 68 20 28 6d 61 70  s test-path (map
7520: 20 63 61 64 72 20 69 74 65 6d 64 61 74 29 29 20   cadr itemdat)) 
7530: 22 2f 22 29 29 0a 09 20 20 20 28 6e 65 77 2d 74  "/"))..   (new-t
7540: 65 73 74 2d 6e 61 6d 65 20 28 69 66 20 28 65 71  est-name (if (eq
7550: 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22  ual? item-path "
7560: 22 29 20 74 65 73 74 2d 6e 61 6d 65 20 28 63 6f  ") test-name (co
7570: 6e 63 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22  nc test-name "/"
7580: 20 69 74 65 6d 2d 70 61 74 68 29 29 29 20 3b 3b   item-path))) ;;
7590: 20 6a 75 73 74 20 6e 65 65 64 20 69 74 20 74 6f   just need it to
75a0: 20 62 65 20 75 6e 69 71 75 65 0a 09 20 20 20 28   be unique..   (
75b0: 74 65 73 74 2d 69 64 20 20 20 20 20 20 20 28 63  test-id       (c
75c0: 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64 62  db:remote-run db
75d0: 3a 67 65 74 2d 74 65 73 74 2d 69 64 20 23 66 20  :get-test-id #f 
75e0: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d   run-id test-nam
75f0: 65 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 20  e item-path)).. 
7600: 20 20 28 74 65 73 74 64 61 74 20 20 20 20 20 20    (testdat      
7610: 20 28 63 64 62 3a 67 65 74 2d 74 65 73 74 2d 69   (cdb:get-test-i
7620: 6e 66 6f 2d 62 79 2d 69 64 20 2a 72 75 6e 72 65  nfo-by-id *runre
7630: 6d 6f 74 65 2a 20 74 65 73 74 2d 69 64 29 29 29  mote* test-id)))
7640: 0a 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20  .      (if (not 
7650: 74 65 73 74 64 61 74 29 0a 09 20 20 28 62 65 67  testdat)..  (beg
7660: 69 6e 0a 09 20 20 20 20 3b 3b 20 65 6e 73 75 72  in..    ;; ensur
7670: 65 20 74 68 61 74 20 74 68 65 20 70 61 74 68 20  e that the path 
7680: 65 78 69 73 74 73 20 62 65 66 6f 72 65 20 72 65  exists before re
7690: 67 69 73 74 65 72 69 6e 67 20 74 68 65 20 74 65  gistering the te
76a0: 73 74 0a 09 20 20 20 20 3b 3b 20 4e 4f 50 45 3a  st..    ;; NOPE:
76b0: 20 43 61 6e 6e 6f 74 21 20 44 6f 6e 27 74 20 6b   Cannot! Don't k
76c0: 6e 6f 77 20 79 65 74 20 77 68 69 63 68 20 64 69  now yet which di
76d0: 73 6b 20 61 72 65 61 20 77 69 6c 6c 20 62 65 20  sk area will be 
76e0: 61 73 73 69 67 6e 65 64 2e 2e 2e 2e 0a 09 20 20  assigned......  
76f0: 20 20 3b 3b 20 28 73 79 73 74 65 6d 20 28 63 6f    ;; (system (co
7700: 6e 63 20 22 6d 6b 64 69 72 20 2d 70 20 22 20 6e  nc "mkdir -p " n
7710: 65 77 2d 74 65 73 74 2d 70 61 74 68 29 29 0a 09  ew-test-path))..
7720: 20 20 20 20 3b 3b 0a 09 20 20 20 20 3b 3b 20 28      ;;..    ;; (
7730: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 74  open-run-close t
7740: 65 73 74 73 3a 72 65 67 69 73 74 65 72 2d 74 65  ests:register-te
7750: 73 74 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73  st db run-id tes
7760: 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68  t-name item-path
7770: 29 0a 09 20 20 20 20 3b 3b 0a 09 20 20 20 20 3b  )..    ;;..    ;
7780: 3b 20 4e 42 2f 2f 20 66 6f 72 20 74 68 65 20 61  ; NB// for the a
7790: 62 6f 76 65 20 6c 69 6e 65 2e 20 49 20 77 61 6e  bove line. I wan
77a0: 74 20 74 68 65 20 74 65 73 74 20 74 6f 20 62 65  t the test to be
77b0: 20 72 65 67 69 73 74 65 72 65 64 20 6c 6f 6e 67   registered long
77c0: 20 62 65 66 6f 72 65 20 74 68 69 73 20 72 6f 75   before this rou
77d0: 74 69 6e 65 20 67 65 74 73 20 63 61 6c 6c 65 64  tine gets called
77e0: 21 0a 09 20 20 20 20 3b 3b 0a 09 20 20 20 20 28  !..    ;;..    (
77f0: 73 65 74 21 20 74 65 73 74 2d 69 64 20 28 6f 70  set! test-id (op
7800: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a  en-run-close db:
7810: 67 65 74 2d 74 65 73 74 2d 69 64 20 64 62 20 72  get-test-id db r
7820: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20  un-id test-name 
7830: 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 20 20 20  item-path))..   
7840: 20 28 69 66 20 28 6e 6f 74 20 74 65 73 74 2d 69   (if (not test-i
7850: 64 29 0a 09 09 28 62 65 67 69 6e 0a 09 09 20 20  d)...(begin...  
7860: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22  (debug:print 2 "
7870: 57 41 52 4e 3a 20 54 65 73 74 20 6e 6f 74 20 70  WARN: Test not p
7880: 72 65 2d 63 72 65 61 74 65 64 3f 20 74 65 73 74  re-created? test
7890: 2d 6e 61 6d 65 3d 22 20 74 65 73 74 2d 6e 61 6d  -name=" test-nam
78a0: 65 20 22 2c 20 69 74 65 6d 2d 70 61 74 68 3d 22  e ", item-path="
78b0: 20 69 74 65 6d 2d 70 61 74 68 20 22 2c 20 72 75   item-path ", ru
78c0: 6e 2d 69 64 3d 22 20 72 75 6e 2d 69 64 29 0a 09  n-id=" run-id)..
78d0: 09 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f  .  (open-run-clo
78e0: 73 65 20 64 62 3a 74 65 73 74 73 2d 72 65 67 69  se db:tests-regi
78f0: 73 74 65 72 2d 74 65 73 74 20 23 66 20 72 75 6e  ster-test #f run
7900: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74  -id test-name it
7910: 65 6d 2d 70 61 74 68 29 0a 09 09 20 20 28 73 65  em-path)...  (se
7920: 74 21 20 74 65 73 74 2d 69 64 20 28 6f 70 65 6e  t! test-id (open
7930: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65  -run-close db:ge
7940: 74 2d 74 65 73 74 2d 69 64 20 64 62 20 72 75 6e  t-test-id db run
7950: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74  -id test-name it
7960: 65 6d 2d 70 61 74 68 29 29 29 29 0a 09 20 20 20  em-path))))..   
7970: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e   (debug:print-in
7980: 66 6f 20 34 20 22 74 65 73 74 2d 69 64 3d 22 20  fo 4 "test-id=" 
7990: 74 65 73 74 2d 69 64 20 22 2c 20 72 75 6e 2d 69  test-id ", run-i
79a0: 64 3d 22 20 72 75 6e 2d 69 64 20 22 2c 20 74 65  d=" run-id ", te
79b0: 73 74 2d 6e 61 6d 65 3d 22 20 74 65 73 74 2d 6e  st-name=" test-n
79c0: 61 6d 65 20 22 2c 20 69 74 65 6d 2d 70 61 74 68  ame ", item-path
79d0: 3d 5c 22 22 20 69 74 65 6d 2d 70 61 74 68 20 22  =\"" item-path "
79e0: 5c 22 22 29 0a 09 20 20 20 20 28 73 65 74 21 20  \"")..    (set! 
79f0: 74 65 73 74 64 61 74 20 28 63 64 62 3a 67 65 74  testdat (cdb:get
7a00: 2d 74 65 73 74 2d 69 6e 66 6f 2d 62 79 2d 69 64  -test-info-by-id
7a10: 20 2a 72 75 6e 72 65 6d 6f 74 65 2a 20 74 65 73   *runremote* tes
7a20: 74 2d 69 64 29 29 29 29 0a 20 20 20 20 20 20 28  t-id)))).      (
7a30: 73 65 74 21 20 74 65 73 74 2d 69 64 20 28 64 62  set! test-id (db
7a40: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73  :test-get-id tes
7a50: 74 64 61 74 29 29 0a 20 20 20 20 20 20 28 63 68  tdat)).      (ch
7a60: 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 79 20 74  ange-directory t
7a70: 65 73 74 2d 70 61 74 68 29 0a 20 20 20 20 20 20  est-path).      
7a80: 28 63 61 73 65 20 28 69 66 20 66 6f 72 63 65 20  (case (if force 
7a90: 3b 3b 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  ;; (args:get-arg
7aa0: 20 22 2d 66 6f 72 63 65 22 29 0a 09 09 27 4e 4f   "-force")...'NO
7ab0: 54 5f 53 54 41 52 54 45 44 0a 09 09 28 69 66 20  T_STARTED...(if 
7ac0: 74 65 73 74 64 61 74 0a 09 09 20 20 20 20 28 73  testdat...    (s
7ad0: 74 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c 20 28 74  tring->symbol (t
7ae0: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65  est:get-state te
7af0: 73 74 64 61 74 29 29 0a 09 09 20 20 20 20 27 66  stdat))...    'f
7b00: 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 72 74 29  ailed-to-insert)
7b10: 29 0a 09 28 28 66 61 69 6c 65 64 2d 74 6f 2d 69  )..((failed-to-i
7b20: 6e 73 65 72 74 29 0a 09 20 28 64 65 62 75 67 3a  nsert).. (debug:
7b30: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
7b40: 46 61 69 6c 65 64 20 74 6f 20 69 6e 73 65 72 74  Failed to insert
7b50: 20 74 68 65 20 72 65 63 6f 72 64 20 69 6e 74 6f   the record into
7b60: 20 74 68 65 20 64 62 22 29 29 0a 09 28 28 4e 4f   the db"))..((NO
7b70: 54 5f 53 54 41 52 54 45 44 20 43 4f 4d 50 4c 45  T_STARTED COMPLE
7b80: 54 45 44 20 44 45 4c 45 54 45 44 29 0a 09 20 28  TED DELETED).. (
7b90: 6c 65 74 20 28 28 72 75 6e 66 6c 61 67 20 23 66  let ((runflag #f
7ba0: 29 29 0a 09 20 20 20 28 63 6f 6e 64 0a 09 20 20  ))..   (cond..  
7bb0: 20 20 3b 3b 20 2d 66 6f 72 63 65 2c 20 72 75 6e    ;; -force, run
7bc0: 20 6e 6f 20 6d 61 74 74 65 72 20 77 68 61 74 0a   no matter what.
7bd0: 09 20 20 20 20 28 66 6f 72 63 65 20 28 73 65 74  .    (force (set
7be0: 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09  ! runflag #t))..
7bf0: 20 20 20 20 3b 3b 20 4e 4f 54 5f 53 54 41 52 54      ;; NOT_START
7c00: 45 44 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65  ED, run no matte
7c10: 72 20 77 68 61 74 0a 09 20 20 20 20 28 28 6d 65  r what..    ((me
7c20: 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73  mber (test:get-s
7c30: 74 61 74 65 20 74 65 73 74 64 61 74 29 20 27 28  tate testdat) '(
7c40: 22 44 45 4c 45 54 45 44 22 20 22 4e 4f 54 5f 53  "DELETED" "NOT_S
7c50: 54 41 52 54 45 44 22 29 29 28 73 65 74 21 20 72  TARTED"))(set! r
7c60: 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20  unflag #t))..   
7c70: 20 3b 3b 20 6e 6f 74 20 2d 72 65 72 75 6e 20 61   ;; not -rerun a
7c80: 6e 64 20 50 41 53 53 2c 20 57 41 52 4e 20 6f 72  nd PASS, WARN or
7c90: 20 43 48 45 43 4b 2c 20 64 6f 20 6e 6f 20 72 75   CHECK, do no ru
7ca0: 6e 0a 09 20 20 20 20 28 28 61 6e 64 20 28 6f 72  n..    ((and (or
7cb0: 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09 20   (not rerun)... 
7cc0: 20 20 20 20 20 6b 65 65 70 67 6f 69 6e 67 29 0a       keepgoing).
7cd0: 09 09 20 20 3b 3b 20 52 65 71 75 69 72 65 20 74  ..  ;; Require t
7ce0: 6f 20 66 6f 72 63 65 20 72 65 2d 72 75 6e 20 66  o force re-run f
7cf0: 6f 72 20 43 4f 4d 50 4c 45 54 45 44 20 6f 72 20  or COMPLETED or 
7d00: 2a 61 6e 79 74 68 69 6e 67 2a 20 2b 20 50 41 53  *anything* + PAS
7d10: 53 2c 57 41 52 4e 20 6f 72 20 43 48 45 43 4b 0a  S,WARN or CHECK.
7d20: 09 09 20 20 28 6f 72 20 28 6d 65 6d 62 65 72 20  ..  (or (member 
7d30: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73  (test:get-status
7d40: 20 74 65 73 74 64 61 74 29 20 27 28 22 50 41 53   testdat) '("PAS
7d50: 53 22 20 22 57 41 52 4e 22 20 22 43 48 45 43 4b  S" "WARN" "CHECK
7d60: 22 29 29 0a 09 09 20 20 20 20 20 20 28 6d 65 6d  "))...      (mem
7d70: 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74  ber (test:get-st
7d80: 61 74 65 20 20 74 65 73 74 64 61 74 29 20 27 28  ate  testdat) '(
7d90: 22 43 4f 4d 50 4c 45 54 45 44 22 29 29 29 29 20  "COMPLETED")))) 
7da0: 0a 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72  ..     (debug:pr
7db0: 69 6e 74 2d 69 6e 66 6f 20 32 20 22 72 75 6e 6e  int-info 2 "runn
7dc0: 69 6e 67 20 74 65 73 74 20 22 20 74 65 73 74 2d  ing test " test-
7dd0: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61  name "/" item-pa
7de0: 74 68 20 22 20 73 75 70 70 72 65 73 73 65 64 20  th " suppressed 
7df0: 61 73 20 69 74 20 69 73 20 22 20 28 74 65 73 74  as it is " (test
7e00: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64  :get-state testd
7e10: 61 74 29 20 22 20 61 6e 64 20 22 20 28 74 65 73  at) " and " (tes
7e20: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73  t:get-status tes
7e30: 74 64 61 74 29 29 0a 09 20 20 20 20 20 28 73 65  tdat))..     (se
7e40: 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 0a  t! runflag #f)).
7e50: 09 20 20 20 20 3b 3b 20 2d 72 65 72 75 6e 20 61  .    ;; -rerun a
7e60: 6e 64 20 73 74 61 74 75 73 20 69 73 20 6f 6e 65  nd status is one
7e70: 20 6f 66 20 74 68 65 20 73 70 65 63 69 66 65 64   of the specifed
7e80: 2c 20 72 75 6e 20 69 74 0a 09 20 20 20 20 28 28  , run it..    ((
7e90: 61 6e 64 20 72 65 72 75 6e 0a 09 09 20 20 28 6c  and rerun...  (l
7ea0: 65 74 2a 20 28 28 72 65 72 75 6e 6c 73 74 20 20  et* ((rerunlst  
7eb0: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 72   (string-split r
7ec0: 65 72 75 6e 20 22 2c 22 29 29 0a 09 09 09 20 28  erun ",")).... (
7ed0: 6d 75 73 74 2d 72 65 72 75 6e 20 28 6d 65 6d 62  must-rerun (memb
7ee0: 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61  er (test:get-sta
7ef0: 74 75 73 20 74 65 73 74 64 61 74 29 20 72 65 72  tus testdat) rer
7f00: 75 6e 6c 73 74 29 29 29 0a 09 09 20 20 20 20 28  unlst)))...    (
7f10: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f  debug:print-info
7f20: 20 33 20 22 2d 72 65 72 75 6e 20 6c 69 73 74 3a   3 "-rerun list:
7f30: 20 22 20 72 65 72 75 6e 20 22 2c 20 74 65 73 74   " rerun ", test
7f40: 2d 73 74 61 74 75 73 3a 20 22 20 28 74 65 73 74  -status: " (test
7f50: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74  :get-status test
7f60: 64 61 74 29 22 2c 20 6d 75 73 74 2d 72 65 72 75  dat)", must-reru
7f70: 6e 3a 20 22 20 6d 75 73 74 2d 72 65 72 75 6e 29  n: " must-rerun)
7f80: 0a 09 09 20 20 20 20 6d 75 73 74 2d 72 65 72 75  ...    must-reru
7f90: 6e 29 29 0a 09 20 20 20 20 20 28 64 65 62 75 67  n))..     (debug
7fa0: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 32 20 22 52  :print-info 2 "R
7fb0: 65 72 75 6e 20 66 6f 72 63 65 64 20 66 6f 72 20  erun forced for 
7fc0: 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65  test " test-name
7fd0: 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 0a   "/" item-path).
7fe0: 09 20 20 20 20 20 28 73 65 74 21 20 72 75 6e 66  .     (set! runf
7ff0: 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b 3b  lag #t))..    ;;
8000: 20 2d 6b 65 65 70 67 6f 69 6e 67 2c 20 64 6f 20   -keepgoing, do 
8010: 6e 6f 74 20 72 65 72 75 6e 20 46 41 49 4c 0a 09  not rerun FAIL..
8020: 20 20 20 20 28 28 61 6e 64 20 6b 65 65 70 67 6f      ((and keepgo
8030: 69 6e 67 0a 09 09 20 20 28 6d 65 6d 62 65 72 20  ing...  (member 
8040: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73  (test:get-status
8050: 20 74 65 73 74 64 61 74 29 20 27 28 22 46 41 49   testdat) '("FAI
8060: 4c 22 29 29 29 0a 09 20 20 20 20 20 28 73 65 74  L")))..     (set
8070: 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09  ! runflag #f))..
8080: 20 20 20 20 28 28 61 6e 64 20 28 6e 6f 74 20 72      ((and (not r
8090: 65 72 75 6e 29 0a 09 09 20 20 28 6d 65 6d 62 65  erun)...  (membe
80a0: 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  r (test:get-stat
80b0: 75 73 20 74 65 73 74 64 61 74 29 20 27 28 22 46  us testdat) '("F
80c0: 41 49 4c 22 20 22 6e 2f 61 22 29 29 29 0a 09 20  AIL" "n/a"))).. 
80d0: 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61      (set! runfla
80e0: 67 20 23 74 29 29 0a 09 20 20 20 20 28 65 6c 73  g #t))..    (els
80f0: 65 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20  e (set! runflag 
8100: 23 66 29 29 29 0a 09 20 20 20 28 64 65 62 75 67  #f)))..   (debug
8110: 3a 70 72 69 6e 74 20 36 20 22 52 55 4e 4e 49 4e  :print 6 "RUNNIN
8120: 47 20 3d 3e 20 72 75 6e 66 6c 61 67 3a 20 22 20  G => runflag: " 
8130: 72 75 6e 66 6c 61 67 20 22 20 53 54 41 54 45 3a  runflag " STATE:
8140: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61   " (test:get-sta
8150: 74 65 20 74 65 73 74 64 61 74 29 20 22 20 53 54  te testdat) " ST
8160: 41 54 55 53 3a 20 22 20 28 74 65 73 74 3a 67 65  ATUS: " (test:ge
8170: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74  t-status testdat
8180: 29 29 0a 09 20 20 20 28 69 66 20 28 6e 6f 74 20  ))..   (if (not 
8190: 72 75 6e 66 6c 61 67 29 0a 09 20 20 20 20 20 20  runflag)..      
81a0: 20 28 69 66 20 28 6e 6f 74 20 70 61 72 65 6e 74   (if (not parent
81b0: 2d 74 65 73 74 29 0a 09 09 20 20 20 28 64 65 62  -test)...   (deb
81c0: 75 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 45  ug:print 1 "NOTE
81d0: 3a 20 4e 6f 74 20 73 74 61 72 74 69 6e 67 20 74  : Not starting t
81e0: 65 73 74 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e  est " new-test-n
81f0: 61 6d 65 20 22 20 61 73 20 69 74 20 69 73 20 73  ame " as it is s
8200: 74 61 74 65 20 5c 22 22 20 28 74 65 73 74 3a 67  tate \"" (test:g
8210: 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74  et-state testdat
8220: 29 20 0a 09 09 09 09 22 5c 22 20 61 6e 64 20 73  ) ....."\" and s
8230: 74 61 74 75 73 20 5c 22 22 20 28 74 65 73 74 3a  tatus \"" (test:
8240: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64  get-status testd
8250: 61 74 29 20 22 5c 22 2c 20 75 73 65 20 2d 72 65  at) "\", use -re
8260: 72 75 6e 20 5c 22 22 20 28 74 65 73 74 3a 67 65  run \"" (test:ge
8270: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74  t-status testdat
8280: 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20  ).              
8290: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
82a0: 20 20 22 5c 22 20 6f 72 20 2d 66 6f 72 63 65 20    "\" or -force 
82b0: 74 6f 20 6f 76 65 72 72 69 64 65 22 29 29 0a 09  to override"))..
82c0: 20 20 20 20 20 20 20 3b 3b 20 4e 4f 54 45 3a 20         ;; NOTE: 
82d0: 4e 6f 20 6c 6f 6e 67 65 72 20 62 65 20 63 68 65  No longer be che
82e0: 63 6b 69 6e 67 20 70 72 65 72 65 71 75 69 73 69  cking prerequisi
82f0: 74 65 73 20 68 65 72 65 21 20 57 69 6c 6c 20 6e  tes here! Will n
8300: 65 76 65 72 20 67 65 74 20 68 65 72 65 20 75 6e  ever get here un
8310: 6c 65 73 73 20 70 72 65 72 65 71 73 20 61 72 65  less prereqs are
8320: 0a 09 20 20 20 20 20 20 20 3b 3b 20 20 20 20 20  ..       ;;     
8330: 20 20 61 6c 72 65 61 64 79 20 6d 65 74 2e 0a 09    already met...
8340: 20 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20         (if (not 
8350: 28 6c 61 75 6e 63 68 2d 74 65 73 74 20 23 66 20  (launch-test #f 
8360: 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74  run-id runname t
8370: 65 73 74 2d 63 6f 6e 66 20 6b 65 79 76 61 6c 6c  est-conf keyvall
8380: 73 74 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73  st test-name tes
8390: 74 2d 70 61 74 68 20 69 74 65 6d 64 61 74 20 66  t-path itemdat f
83a0: 6c 61 67 73 29 29 0a 09 09 20 20 20 28 62 65 67  lags))...   (beg
83b0: 69 6e 0a 09 09 20 20 20 20 20 28 70 72 69 6e 74  in...     (print
83c0: 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20   "ERROR: Failed 
83d0: 74 6f 20 6c 61 75 6e 63 68 20 74 68 65 20 74 65  to launch the te
83e0: 73 74 2e 20 45 78 69 74 69 6e 67 20 61 73 20 73  st. Exiting as s
83f0: 6f 6f 6e 20 61 73 20 70 6f 73 73 69 62 6c 65 22  oon as possible"
8400: 29 0a 09 09 20 20 20 20 20 28 73 65 74 21 20 2a  )...     (set! *
8410: 67 6c 6f 62 61 6c 65 78 69 74 73 74 61 74 75 73  globalexitstatus
8420: 2a 20 31 29 20 3b 3b 20 0a 09 09 20 20 20 20 20  * 1) ;; ...     
8430: 28 70 72 6f 63 65 73 73 2d 73 69 67 6e 61 6c 20  (process-signal 
8440: 28 63 75 72 72 65 6e 74 2d 70 72 6f 63 65 73 73  (current-process
8450: 2d 69 64 29 20 73 69 67 6e 61 6c 2f 6b 69 6c 6c  -id) signal/kill
8460: 29 29 29 29 29 29 0a 09 28 28 4b 49 4c 4c 45 44  ))))))..((KILLED
8470: 29 20 0a 09 20 28 64 65 62 75 67 3a 70 72 69 6e  ) .. (debug:prin
8480: 74 20 31 20 22 4e 4f 54 45 3a 20 22 20 6e 65 77  t 1 "NOTE: " new
8490: 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 73 20  -test-name " is 
84a0: 61 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e 67 20  already running 
84b0: 6f 72 20 77 61 73 20 65 78 70 6c 69 63 74 6c 79  or was explictly
84c0: 20 6b 69 6c 6c 65 64 2c 20 75 73 65 20 2d 66 6f   killed, use -fo
84d0: 72 63 65 20 74 6f 20 6c 61 75 6e 63 68 20 69 74  rce to launch it
84e0: 2e 22 29 29 0a 09 28 28 4c 41 55 4e 43 48 45 44  ."))..((LAUNCHED
84f0: 20 52 45 4d 4f 54 45 48 4f 53 54 53 54 41 52 54   REMOTEHOSTSTART
8500: 20 52 55 4e 4e 49 4e 47 29 20 20 0a 09 20 28 69   RUNNING)  .. (i
8510: 66 20 28 3e 20 28 2d 20 28 63 75 72 72 65 6e 74  f (> (- (current
8520: 2d 73 65 63 6f 6e 64 73 29 28 2b 20 28 64 62 3a  -seconds)(+ (db:
8530: 74 65 73 74 2d 67 65 74 2d 65 76 65 6e 74 5f 74  test-get-event_t
8540: 69 6d 65 20 74 65 73 74 64 61 74 29 0a 09 09 09  ime testdat)....
8550: 09 20 20 20 20 20 20 20 28 64 62 3a 74 65 73 74  .       (db:test
8560: 2d 67 65 74 2d 72 75 6e 5f 64 75 72 61 74 69 6f  -get-run_duratio
8570: 6e 20 74 65 73 74 64 61 74 29 29 29 0a 09 09 36  n testdat)))...6
8580: 30 30 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f 20 75  00) ;; i.e. no u
8590: 70 64 61 74 65 20 66 6f 72 20 6d 6f 72 65 20 74  pdate for more t
85a0: 68 61 6e 20 36 30 30 20 73 65 63 6f 6e 64 73 0a  han 600 seconds.
85b0: 09 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20  .     (begin..  
85c0: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
85d0: 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 54 65  t 0 "WARNING: Te
85e0: 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22  st " test-name "
85f0: 20 61 70 70 65 61 72 73 20 74 6f 20 62 65 20 64   appears to be d
8600: 65 61 64 2e 20 46 6f 72 63 69 6e 67 20 69 74 20  ead. Forcing it 
8610: 74 6f 20 73 74 61 74 65 20 49 4e 43 4f 4d 50 4c  to state INCOMPL
8620: 45 54 45 20 61 6e 64 20 73 74 61 74 75 73 20 53  ETE and status S
8630: 54 55 43 4b 2f 44 45 41 44 22 29 0a 09 20 20 20  TUCK/DEAD")..   
8640: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 2d      (tests:test-
8650: 73 65 74 2d 73 74 61 74 75 73 21 20 74 65 73 74  set-status! test
8660: 2d 69 64 20 22 49 4e 43 4f 4d 50 4c 45 54 45 22  -id "INCOMPLETE"
8670: 20 22 53 54 55 43 4b 2f 44 45 41 44 22 20 22 54   "STUCK/DEAD" "T
8680: 65 73 74 20 69 73 20 73 74 75 63 6b 20 6f 72 20  est is stuck or 
8690: 64 65 61 64 22 20 23 66 29 29 0a 09 20 20 20 20  dead" #f))..    
86a0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20   (debug:print 2 
86b0: 22 4e 4f 54 45 3a 20 22 20 74 65 73 74 2d 6e 61  "NOTE: " test-na
86c0: 6d 65 20 22 20 69 73 20 61 6c 72 65 61 64 79 20  me " is already 
86d0: 72 75 6e 6e 69 6e 67 22 29 29 29 0a 09 28 65 6c  running")))..(el
86e0: 73 65 20 20 20 20 20 20 20 28 64 65 62 75 67 3a  se       (debug:
86f0: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
8700: 46 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68  Failed to launch
8710: 20 74 65 73 74 20 22 20 6e 65 77 2d 74 65 73 74   test " new-test
8720: 2d 6e 61 6d 65 20 22 2e 20 55 6e 72 65 63 6f 67  -name ". Unrecog
8730: 6e 69 73 65 64 20 73 74 61 74 65 20 22 20 28 74  nised state " (t
8740: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65  est:get-state te
8750: 73 74 64 61 74 29 29 29 29 29 29 29 0a 0a 3b 3b  stdat)))))))..;;
8760: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8770: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8780: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8790: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
87a0: 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 45 4e 44 20 4f 46  ======.;; END OF
87b0: 20 4e 45 57 20 53 54 55 46 46 0a 3b 3b 3d 3d 3d   NEW STUFF.;;===
87c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
87d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
87e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
87f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8800: 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65 20 28 67 65  ===..(define (ge
8810: 74 2d 64 69 72 2d 75 70 2d 6e 20 64 69 72 20 2e  t-dir-up-n dir .
8820: 20 70 61 72 61 6d 73 29 20 0a 20 20 28 6c 65 74   params) .  (let
8830: 20 28 28 64 70 61 72 74 73 20 20 28 73 74 72 69   ((dparts  (stri
8840: 6e 67 2d 73 70 6c 69 74 20 64 69 72 20 22 2f 22  ng-split dir "/"
8850: 29 29 0a 09 28 63 6f 75 6e 74 20 20 20 28 69 66  ))..(count   (if
8860: 20 28 6e 75 6c 6c 3f 20 70 61 72 61 6d 73 29 20   (null? params) 
8870: 31 20 28 63 61 72 20 70 61 72 61 6d 73 29 29 29  1 (car params)))
8880: 29 0a 20 20 20 20 28 63 6f 6e 63 20 22 2f 22 20  ).    (conc "/" 
8890: 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65  (string-interspe
88a0: 72 73 65 20 0a 09 20 20 20 20 20 20 20 28 74 61  rse ..       (ta
88b0: 6b 65 20 64 70 61 72 74 73 20 28 2d 20 28 6c 65  ke dparts (- (le
88c0: 6e 67 74 68 20 64 70 61 72 74 73 29 20 63 6f 75  ngth dparts) cou
88d0: 6e 74 29 29 0a 09 20 20 20 20 20 20 20 22 2f 22  nt))..       "/"
88e0: 29 29 29 29 0a 3b 3b 20 52 65 6d 6f 76 65 20 72  )))).;; Remove r
88f0: 75 6e 73 0a 3b 3b 20 66 69 65 6c 64 73 20 61 72  uns.;; fields ar
8900: 65 20 70 61 73 73 69 6e 67 20 69 6e 20 74 68 72  e passing in thr
8910: 6f 75 67 68 20 0a 3b 3b 20 61 63 74 69 6f 6e 3a  ough .;; action:
8920: 0a 3b 3b 20 20 20 20 27 72 65 6d 6f 76 65 2d 72  .;;    'remove-r
8930: 75 6e 73 0a 3b 3b 20 20 20 20 27 73 65 74 2d 73  uns.;;    'set-s
8940: 74 61 74 65 2d 73 74 61 74 75 73 0a 3b 3b 0a 3b  tate-status.;;.;
8950: 3b 20 4e 42 2f 2f 20 73 68 6f 75 6c 64 20 70 61  ; NB// should pa
8960: 73 73 20 69 6e 20 6b 65 79 73 3f 0a 3b 3b 0a 28  ss in keys?.;;.(
8970: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 6f 70 65  define (runs:ope
8980: 72 61 74 65 2d 6f 6e 20 61 63 74 69 6f 6e 20 72  rate-on action r
8990: 75 6e 6e 61 6d 65 70 61 74 74 20 74 65 73 74 70  unnamepatt testp
89a0: 61 74 74 20 23 21 6b 65 79 20 28 73 74 61 74 65  att #!key (state
89b0: 20 23 66 29 28 73 74 61 74 75 73 20 23 66 29 28   #f)(status #f)(
89c0: 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73  new-state-status
89d0: 20 23 66 29 29 0a 20 20 28 6c 65 74 2a 20 28 28   #f)).  (let* ((
89e0: 64 62 20 20 20 20 20 20 20 20 20 20 20 23 66 29  db           #f)
89f0: 0a 09 20 28 6b 65 79 73 20 20 20 20 20 20 20 20  .. (keys        
8a00: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
8a10: 20 64 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 29   db:get-keys db)
8a20: 29 0a 09 20 28 72 75 6e 64 61 74 20 20 20 20 20  ).. (rundat     
8a30: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73    (open-run-clos
8a40: 65 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d  e runs:get-runs-
8a50: 62 79 2d 70 61 74 74 20 64 62 20 6b 65 79 73 20  by-patt db keys 
8a60: 72 75 6e 6e 61 6d 65 70 61 74 74 29 29 0a 09 20  runnamepatt)).. 
8a70: 28 68 65 61 64 65 72 20 20 20 20 20 20 20 28 76  (header       (v
8a80: 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74  ector-ref rundat
8a90: 20 30 29 29 0a 09 20 28 72 75 6e 73 20 20 20 20   0)).. (runs    
8aa0: 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66       (vector-ref
8ab0: 20 72 75 6e 64 61 74 20 31 29 29 0a 09 20 28 73   rundat 1)).. (s
8ac0: 74 61 74 65 73 20 20 20 20 20 20 20 28 69 66 20  tates       (if 
8ad0: 73 74 61 74 65 20 20 28 73 74 72 69 6e 67 2d 73  state  (string-s
8ae0: 70 6c 69 74 20 73 74 61 74 65 20 20 22 2c 22 29  plit state  ",")
8af0: 20 27 28 29 29 29 0a 09 20 28 73 74 61 74 75 73   '())).. (status
8b00: 65 73 20 20 20 20 20 28 69 66 20 73 74 61 74 75  es     (if statu
8b10: 73 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20  s (string-split 
8b20: 73 74 61 74 75 73 20 22 2c 22 29 20 27 28 29 29  status ",") '())
8b30: 29 0a 09 20 28 73 74 61 74 65 2d 73 74 61 74 75  ).. (state-statu
8b40: 73 20 28 69 66 20 28 73 74 72 69 6e 67 3f 20 6e  s (if (string? n
8b50: 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73 29  ew-state-status)
8b60: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 6e   (string-split n
8b70: 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73 20  ew-state-status 
8b80: 22 2c 22 29 20 27 28 23 66 20 23 66 29 29 29 29  ",") '(#f #f))))
8b90: 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  .    (debug:prin
8ba0: 74 2d 69 6e 66 6f 20 34 20 22 72 75 6e 73 3a 6f  t-info 4 "runs:o
8bb0: 70 65 72 61 74 65 2d 6f 6e 20 3d 3e 20 48 65 61  perate-on => Hea
8bc0: 64 65 72 3a 20 22 20 68 65 61 64 65 72 20 22 20  der: " header " 
8bd0: 61 63 74 69 6f 6e 3a 20 22 20 61 63 74 69 6f 6e  action: " action
8be0: 20 22 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61   " new-state-sta
8bf0: 74 75 73 3a 20 22 20 6e 65 77 2d 73 74 61 74 65  tus: " new-state
8c00: 2d 73 74 61 74 75 73 29 0a 20 20 20 20 28 69 66  -status).    (if
8c10: 20 28 3e 20 32 20 28 6c 65 6e 67 74 68 20 73 74   (> 2 (length st
8c20: 61 74 65 2d 73 74 61 74 75 73 29 29 0a 09 28 62  ate-status))..(b
8c30: 65 67 69 6e 0a 09 20 20 28 64 65 62 75 67 3a 70  egin..  (debug:p
8c40: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 74  rint 0 "ERROR: t
8c50: 68 65 20 70 61 72 61 6d 65 74 65 72 20 74 6f 20  he parameter to 
8c60: 2d 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75  -set-state-statu
8c70: 73 20 69 73 20 61 20 63 6f 6d 6d 61 20 64 65 6c  s is a comma del
8c80: 69 6d 69 74 65 64 20 73 74 72 69 6e 67 2e 20 45  imited string. E
8c90: 2e 67 2e 20 43 4f 4d 50 4c 45 54 45 44 2c 46 41  .g. COMPLETED,FA
8ca0: 49 4c 22 29 0a 09 20 20 28 65 78 69 74 29 29 29  IL")..  (exit)))
8cb0: 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 20  .    (for-each. 
8cc0: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 72 75 6e      (lambda (run
8cd0: 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28  ).       (let ((
8ce0: 72 75 6e 6b 65 79 20 28 73 74 72 69 6e 67 2d 69  runkey (string-i
8cf0: 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61 70 20  ntersperse (map 
8d00: 28 6c 61 6d 62 64 61 20 28 6b 29 0a 09 09 09 09  (lambda (k).....
8d10: 09 09 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d  ..(db:get-value-
8d20: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65  by-header run he
8d30: 61 64 65 72 20 28 76 65 63 74 6f 72 2d 72 65 66  ader (vector-ref
8d40: 20 6b 20 30 29 29 29 20 6b 65 79 73 29 20 22 2f   k 0))) keys) "/
8d50: 22 29 29 0a 09 20 20 20 20 20 28 64 69 72 73 2d  "))..     (dirs-
8d60: 74 6f 2d 72 65 6d 6f 76 65 20 28 6d 61 6b 65 2d  to-remove (make-
8d70: 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 09 20  hash-table))).. 
8d80: 28 6c 65 74 2a 20 28 28 72 75 6e 2d 69 64 20 20  (let* ((run-id  
8d90: 20 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d    (db:get-value-
8da0: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65  by-header run he
8db0: 61 64 65 72 20 22 69 64 22 29 29 0a 09 09 28 72  ader "id"))...(r
8dc0: 75 6e 2d 73 74 61 74 65 20 28 64 62 3a 67 65 74  un-state (db:get
8dd0: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72  -value-by-header
8de0: 20 72 75 6e 20 68 65 61 64 65 72 20 22 73 74 61   run header "sta
8df0: 74 65 22 29 29 0a 09 09 28 74 65 73 74 73 20 20  te"))...(tests  
8e00: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 65 71 75     (if (not (equ
8e10: 61 6c 3f 20 72 75 6e 2d 73 74 61 74 65 20 22 6c  al? run-state "l
8e20: 6f 63 6b 65 64 22 29 29 0a 09 09 09 20 20 20 20  ocked"))....    
8e30: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f     (open-run-clo
8e40: 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 73 2d  se db:get-tests-
8e50: 66 6f 72 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69  for-run db run-i
8e60: 64 0a 09 09 09 09 09 09 20 20 20 20 20 20 74 65  d.......      te
8e70: 73 74 70 61 74 74 20 73 74 61 74 65 73 20 73 74  stpatt states st
8e80: 61 74 75 73 65 73 0a 09 09 09 09 09 09 20 20 20  atuses.......   
8e90: 20 20 20 6e 6f 74 2d 69 6e 3a 20 20 23 66 0a 09     not-in:  #f..
8ea0: 09 09 09 09 09 20 20 20 20 20 20 73 6f 72 74 2d  .....      sort-
8eb0: 62 79 3a 20 28 63 61 73 65 20 61 63 74 69 6f 6e  by: (case action
8ec0: 0a 09 09 09 09 09 09 09 09 20 28 28 72 65 6d 6f  ......... ((remo
8ed0: 76 65 2d 72 75 6e 73 29 20 27 72 75 6e 64 69 72  ve-runs) 'rundir
8ee0: 29 0a 09 09 09 09 09 09 09 09 20 28 65 6c 73 65  )......... (else
8ef0: 20 20 20 20 20 20 20 20 20 20 27 65 76 65 6e 74            'event
8f00: 5f 74 69 6d 65 29 29 29 0a 09 09 09 20 20 20 20  _time)))....    
8f10: 20 20 20 27 28 29 29 29 0a 09 09 28 6c 61 73 74     '()))...(last
8f20: 74 70 61 74 68 20 22 2f 64 6f 65 73 2f 6e 6f 74  tpath "/does/not
8f30: 2f 65 78 69 73 74 2f 49 2f 68 6f 70 65 22 29 29  /exist/I/hope"))
8f40: 0a 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  ..   (debug:prin
8f50: 74 2d 69 6e 66 6f 20 34 20 22 72 75 6e 73 3a 6f  t-info 4 "runs:o
8f60: 70 65 72 61 74 65 2d 6f 6e 20 72 75 6e 3d 22 20  perate-on run=" 
8f70: 72 75 6e 20 22 2c 20 68 65 61 64 65 72 3d 22 20  run ", header=" 
8f80: 68 65 61 64 65 72 29 0a 09 20 20 20 28 69 66 20  header)..   (if 
8f90: 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 73 74  (not (null? test
8fa0: 73 29 29 0a 09 20 20 20 20 20 20 20 28 62 65 67  s))..       (beg
8fb0: 69 6e 0a 09 09 20 28 63 61 73 65 20 61 63 74 69  in... (case acti
8fc0: 6f 6e 0a 09 09 20 20 20 28 28 72 65 6d 6f 76 65  on...   ((remove
8fd0: 2d 72 75 6e 73 29 0a 09 09 20 20 20 20 28 64 65  -runs)...    (de
8fe0: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d  bug:print 1 "Rem
8ff0: 6f 76 69 6e 67 20 74 65 73 74 73 20 66 6f 72 20  oving tests for 
9000: 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20  run: " runkey " 
9010: 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d  " (db:get-value-
9020: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65  by-header run he
9030: 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 29  ader "runname"))
9040: 29 0a 09 09 20 20 20 28 28 73 65 74 2d 73 74 61  )...   ((set-sta
9050: 74 65 2d 73 74 61 74 75 73 29 0a 09 09 20 20 20  te-status)...   
9060: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20   (debug:print 1 
9070: 22 4d 6f 64 69 66 79 69 6e 67 20 73 74 61 74 65  "Modifying state
9080: 20 61 6e 64 20 73 74 61 75 73 20 66 6f 72 20 74   and staus for t
9090: 65 73 74 73 20 66 6f 72 20 72 75 6e 3a 20 22 20  ests for run: " 
90a0: 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67  runkey " " (db:g
90b0: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64  et-value-by-head
90c0: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 72  er run header "r
90d0: 75 6e 6e 61 6d 65 22 29 29 29 0a 09 09 20 20 20  unname")))...   
90e0: 28 28 70 72 69 6e 74 2d 72 75 6e 29 0a 09 09 20  ((print-run)... 
90f0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
9100: 31 20 22 50 72 69 6e 74 69 6e 67 20 69 6e 66 6f  1 "Printing info
9110: 20 66 6f 72 20 72 75 6e 20 22 20 72 75 6e 6b 65   for run " runke
9120: 79 20 22 2c 20 72 75 6e 3d 22 20 72 75 6e 20 22  y ", run=" run "
9130: 2c 20 74 65 73 74 73 3d 22 20 74 65 73 74 73 20  , tests=" tests 
9140: 22 2c 20 68 65 61 64 65 72 3d 22 20 68 65 61 64  ", header=" head
9150: 65 72 29 0a 09 09 20 20 20 20 61 63 74 69 6f 6e  er)...    action
9160: 29 0a 09 09 20 20 20 28 65 6c 73 65 0a 09 09 20  )...   (else... 
9170: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d     (debug:print-
9180: 69 6e 66 6f 20 30 20 22 61 63 74 69 6f 6e 20 6e  info 0 "action n
9190: 6f 74 20 72 65 63 6f 67 6e 69 73 65 64 20 22 20  ot recognised " 
91a0: 61 63 74 69 6f 6e 29 29 29 0a 09 09 20 28 66 6f  action)))... (fo
91b0: 72 2d 65 61 63 68 0a 09 09 20 20 28 6c 61 6d 62  r-each...  (lamb
91c0: 64 61 20 28 74 65 73 74 29 0a 09 09 20 20 20 20  da (test)...    
91d0: 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d 70 61 74  (let* ((item-pat
91e0: 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  h (db:test-get-i
91f0: 74 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29 0a  tem-path test)).
9200: 09 09 09 20 20 20 28 74 65 73 74 2d 6e 61 6d 65  ...   (test-name
9210: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65   (db:test-get-te
9220: 73 74 6e 61 6d 65 20 74 65 73 74 29 29 0a 09 09  stname test))...
9230: 09 20 20 20 28 72 75 6e 2d 64 69 72 20 20 20 28  .   (run-dir   (
9240: 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 64  db:test-get-rund
9250: 69 72 20 74 65 73 74 29 29 20 20 20 20 3b 3b 20  ir test))    ;; 
9260: 72 75 6e 20 64 69 72 20 69 73 20 66 72 6f 6d 20  run dir is from 
9270: 74 68 65 20 6c 69 6e 6b 20 74 72 65 65 0a 09 09  the link tree...
9280: 09 20 20 20 28 72 65 61 6c 2d 64 69 72 20 20 28  .   (real-dir  (
9290: 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f  if (file-exists?
92a0: 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 09 09 20   run-dir)...... 
92b0: 20 28 72 65 73 6f 6c 76 65 2d 70 61 74 68 6e 61   (resolve-pathna
92c0: 6d 65 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 09  me run-dir).....
92d0: 09 20 20 23 66 29 29 0a 09 09 09 20 20 20 28 74  .  #f))....   (t
92e0: 65 73 74 2d 69 64 20 20 20 28 64 62 3a 74 65 73  est-id   (db:tes
92f0: 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29 29 29  t-get-id test)))
9300: 0a 09 09 20 20 20 20 20 20 3b 3b 20 20 20 28 74  ...      ;;   (t
9310: 64 62 20 20 20 20 20 20 20 28 64 62 3a 6f 70 65  db       (db:ope
9320: 6e 2d 74 65 73 74 2d 64 62 20 72 75 6e 2d 64 69  n-test-db run-di
9330: 72 29 29 29 0a 09 09 20 20 20 20 20 20 28 64 65  r)))...      (de
9340: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34  bug:print-info 4
9350: 20 22 74 65 73 74 3d 22 20 74 65 73 74 29 20 3b   "test=" test) ;
9360: 3b 20 20 20 22 20 28 64 62 3a 74 65 73 74 2d 67  ;   " (db:test-g
9370: 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74  et-testname test
9380: 29 20 22 20 69 64 3a 20 22 20 28 64 62 3a 74 65  ) " id: " (db:te
9390: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29 20  st-get-id test) 
93a0: 22 20 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20  " " item-path " 
93b0: 61 63 74 69 6f 6e 3a 20 22 20 61 63 74 69 6f 6e  action: " action
93c0: 29 0a 09 09 20 20 20 20 20 20 28 63 61 73 65 20  )...      (case 
93d0: 61 63 74 69 6f 6e 0a 09 09 09 28 28 72 65 6d 6f  action....((remo
93e0: 76 65 2d 72 75 6e 73 29 20 3b 3b 20 74 68 65 20  ve-runs) ;; the 
93f0: 74 64 62 20 69 73 20 66 6f 72 20 66 75 74 75 72  tdb is for futur
9400: 65 20 70 6f 73 73 69 62 6c 65 2e 20 0a 09 09 09  e possible. ....
9410: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
9420: 20 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 2d   db:delete-test-
9430: 72 65 63 6f 72 64 73 20 64 62 20 23 66 20 28 64  records db #f (d
9440: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65  b:test-get-id te
9450: 73 74 29 29 0a 09 09 09 20 28 64 65 62 75 67 3a  st)).... (debug:
9460: 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 41 74  print-info 1 "At
9470: 74 65 6d 70 74 69 6e 67 20 74 6f 20 72 65 6d 6f  tempting to remo
9480: 76 65 20 22 20 28 69 66 20 72 65 61 6c 2d 64 69  ve " (if real-di
9490: 72 20 28 63 6f 6e 63 20 22 20 64 69 72 20 22 20  r (conc " dir " 
94a0: 72 65 61 6c 2d 64 69 72 20 22 20 61 6e 64 20 22  real-dir " and "
94b0: 29 20 22 22 29 20 22 20 6c 69 6e 6b 20 22 20 72  ) "") " link " r
94c0: 75 6e 2d 64 69 72 29 0a 09 09 09 20 28 69 66 20  un-dir).... (if 
94d0: 28 61 6e 64 20 72 65 61 6c 2d 64 69 72 20 0a 09  (and real-dir ..
94e0: 09 09 09 20 20 28 3e 20 28 73 74 72 69 6e 67 2d  ...  (> (string-
94f0: 6c 65 6e 67 74 68 20 72 65 61 6c 2d 64 69 72 29  length real-dir)
9500: 20 35 29 0a 09 09 09 09 20 20 28 66 69 6c 65 2d   5).....  (file-
9510: 65 78 69 73 74 73 3f 20 72 65 61 6c 2d 64 69 72  exists? real-dir
9520: 29 29 20 3b 3b 20 62 61 64 20 68 65 75 72 69 73  )) ;; bad heuris
9530: 74 69 63 20 62 75 74 20 73 68 6f 75 6c 64 20 70  tic but should p
9540: 72 65 76 65 6e 74 20 2f 74 6d 70 20 2f 68 6f 6d  revent /tmp /hom
9550: 65 20 65 74 63 2e 0a 09 09 09 20 20 20 20 20 28  e etc.....     (
9560: 62 65 67 69 6e 20 3b 3b 20 6c 65 74 2a 20 28 28  begin ;; let* ((
9570: 72 65 61 6c 70 61 74 68 20 28 72 65 73 6f 6c 76  realpath (resolv
9580: 65 2d 70 61 74 68 6e 61 6d 65 20 72 75 6e 2d 64  e-pathname run-d
9590: 69 72 29 29 29 0a 09 09 09 20 20 20 20 20 20 20  ir)))....       
95a0: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66  (debug:print-inf
95b0: 6f 20 31 20 22 52 65 63 75 72 73 69 76 65 6c 79  o 1 "Recursively
95c0: 20 72 65 6d 6f 76 69 6e 67 20 22 20 72 65 61 6c   removing " real
95d0: 2d 64 69 72 29 0a 09 09 09 20 20 20 20 20 20 20  -dir)....       
95e0: 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73  (if (file-exists
95f0: 3f 20 72 65 61 6c 2d 64 69 72 29 0a 09 09 09 09  ? real-dir).....
9600: 20 20 20 28 69 66 20 28 3e 20 28 73 79 73 74 65     (if (> (syste
9610: 6d 20 28 63 6f 6e 63 20 22 72 6d 20 2d 72 66 20  m (conc "rm -rf 
9620: 22 20 72 65 61 6c 2d 64 69 72 29 29 20 30 29 0a  " real-dir)) 0).
9630: 09 09 09 09 20 20 20 20 20 20 20 28 64 65 62 75  ....       (debu
9640: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52  g:print 0 "ERROR
9650: 3a 20 54 68 65 72 65 20 77 61 73 20 61 20 70 72  : There was a pr
9660: 6f 62 6c 65 6d 20 72 65 6d 6f 76 69 6e 67 20 22  oblem removing "
9670: 20 72 65 61 6c 2d 64 69 72 20 22 20 77 69 74 68   real-dir " with
9680: 20 72 6d 20 2d 66 22 29 29 0a 09 09 09 09 20 20   rm -f")).....  
9690: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
96a0: 22 57 41 52 4e 49 4e 47 3a 20 74 65 73 74 20 64  "WARNING: test d
96b0: 69 72 20 22 20 72 65 61 6c 2d 64 69 72 20 22 20  ir " real-dir " 
96c0: 61 70 70 65 61 72 73 20 74 6f 20 6e 6f 74 20 65  appears to not e
96d0: 78 69 73 74 20 6f 72 20 69 73 20 6e 6f 74 20 72  xist or is not r
96e0: 65 61 64 61 62 6c 65 22 29 29 29 0a 09 09 09 20  eadable"))).... 
96f0: 20 20 20 20 28 69 66 20 72 65 61 6c 2d 64 69 72      (if real-dir
9700: 20 0a 09 09 09 09 20 28 64 65 62 75 67 3a 70 72   ..... (debug:pr
9710: 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20  int 0 "WARNING: 
9720: 64 69 72 65 63 74 6f 72 79 20 22 20 72 65 61 6c  directory " real
9730: 2d 64 69 72 20 22 20 64 6f 65 73 20 6e 6f 74 20  -dir " does not 
9740: 65 78 69 73 74 22 29 0a 09 09 09 09 20 28 64 65  exist")..... (de
9750: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52  bug:print 0 "WAR
9760: 4e 49 4e 47 3a 20 6e 6f 20 72 65 61 6c 20 64 69  NING: no real di
9770: 72 65 63 74 6f 72 79 20 63 6f 72 72 6f 73 70 6f  rectory corrospo
9780: 6e 64 69 6e 67 20 74 6f 20 6c 69 6e 6b 20 22 20  nding to link " 
9790: 72 75 6e 2d 64 69 72 20 22 2c 20 6e 6f 74 68 69  run-dir ", nothi
97a0: 6e 67 20 64 6f 6e 65 22 29 29 29 0a 09 09 09 20  ng done"))).... 
97b0: 28 69 66 20 28 73 79 6d 62 6f 6c 69 63 2d 6c 69  (if (symbolic-li
97c0: 6e 6b 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09 09  nk? run-dir)....
97d0: 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09 20       (begin.... 
97e0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
97f0: 6e 74 2d 69 6e 66 6f 20 31 20 22 52 65 6d 6f 76  nt-info 1 "Remov
9800: 69 6e 67 20 73 79 6d 6c 69 6e 6b 20 22 20 72 75  ing symlink " ru
9810: 6e 2d 64 69 72 29 0a 09 09 09 20 20 20 20 20 20  n-dir)....      
9820: 20 28 64 65 6c 65 74 65 2d 66 69 6c 65 20 72 75   (delete-file ru
9830: 6e 2d 64 69 72 29 29 0a 09 09 09 20 20 20 20 20  n-dir))....     
9840: 28 69 66 20 28 64 69 72 65 63 74 6f 72 79 3f 20  (if (directory? 
9850: 72 75 6e 2d 64 69 72 29 0a 09 09 09 09 20 28 69  run-dir)..... (i
9860: 66 20 28 3e 20 28 64 69 72 65 63 74 6f 72 79 2d  f (> (directory-
9870: 66 6f 6c 64 20 28 6c 61 6d 62 64 61 20 28 66 20  fold (lambda (f 
9880: 78 29 28 2b 20 31 20 78 29 29 20 30 20 72 75 6e  x)(+ 1 x)) 0 run
9890: 2d 64 69 72 29 20 30 29 0a 09 09 09 09 20 20 20  -dir) 0).....   
98a0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
98b0: 20 22 57 41 52 4e 49 4e 47 3a 20 72 65 66 75 73   "WARNING: refus
98c0: 69 6e 67 20 74 6f 20 72 65 6d 6f 76 65 20 22 20  ing to remove " 
98d0: 72 75 6e 2d 64 69 72 20 22 20 61 73 20 69 74 20  run-dir " as it 
98e0: 69 73 20 6e 6f 74 20 65 6d 70 74 79 22 29 0a 09  is not empty")..
98f0: 09 09 09 20 20 20 20 20 28 64 65 6c 65 74 65 2d  ...     (delete-
9900: 64 69 72 65 63 74 6f 72 79 20 72 75 6e 2d 64 69  directory run-di
9910: 72 29 29 20 3b 3b 20 69 74 20 73 68 6f 75 6c 64  r)) ;; it should
9920: 20 62 65 20 65 6d 70 74 79 20 62 79 20 68 65 72   be empty by her
9930: 65 20 42 55 47 20 42 55 47 2c 20 61 64 64 20 65  e BUG BUG, add e
9940: 72 72 6f 72 20 63 61 74 63 68 0a 09 09 09 09 20  rror catch..... 
9950: 28 69 66 20 72 75 6e 2d 64 69 72 0a 09 09 09 09  (if run-dir.....
9960: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
9970: 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 6e 6f  t 0 "WARNING: no
9980: 74 20 72 65 6d 6f 76 69 6e 67 20 22 20 72 75 6e  t removing " run
9990: 2d 64 69 72 20 22 20 61 73 20 69 74 20 65 69 74  -dir " as it eit
99a0: 68 65 72 20 64 6f 65 73 6e 27 74 20 65 78 69 73  her doesn't exis
99b0: 74 20 6f 72 20 69 73 20 6e 6f 74 20 61 20 73 79  t or is not a sy
99c0: 6d 6c 69 6e 6b 22 29 0a 09 09 09 09 20 20 20 20  mlink").....    
99d0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
99e0: 22 4e 4f 54 45 3a 20 74 68 65 20 72 75 6e 20 64  "NOTE: the run d
99f0: 69 72 20 66 6f 72 20 74 68 69 73 20 74 65 73 74  ir for this test
9a00: 20 69 73 20 75 6e 64 65 66 69 6e 65 64 2e 20 54   is undefined. T
9a10: 65 73 74 20 6d 61 79 20 68 61 76 65 20 61 6c 72  est may have alr
9a20: 65 61 64 79 20 62 65 65 6e 20 64 65 6c 65 74 65  eady been delete
9a30: 64 2e 22 29 29 0a 09 09 09 09 20 29 29 29 0a 09  d."))..... )))..
9a40: 09 09 28 28 73 65 74 2d 73 74 61 74 65 2d 73 74  ..((set-state-st
9a50: 61 74 75 73 29 0a 09 09 09 20 28 64 65 62 75 67  atus).... (debug
9a60: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 32 20 22 6e  :print-info 2 "n
9a70: 65 77 20 73 74 61 74 65 20 22 20 28 63 61 72 20  ew state " (car 
9a80: 73 74 61 74 65 2d 73 74 61 74 75 73 29 20 22 2c  state-status) ",
9a90: 20 6e 65 77 20 73 74 61 74 75 73 20 22 20 28 63   new status " (c
9aa0: 61 64 72 20 73 74 61 74 65 2d 73 74 61 74 75 73  adr state-status
9ab0: 29 29 0a 09 09 09 20 28 6f 70 65 6e 2d 72 75 6e  )).... (open-run
9ac0: 2d 63 6c 6f 73 65 20 64 62 3a 74 65 73 74 2d 73  -close db:test-s
9ad0: 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73 2d  et-state-status-
9ae0: 62 79 2d 69 64 20 64 62 20 28 64 62 3a 74 65 73  by-id db (db:tes
9af0: 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29 20 28  t-get-id test) (
9b00: 63 61 72 20 73 74 61 74 65 2d 73 74 61 74 75 73  car state-status
9b10: 29 28 63 61 64 72 20 73 74 61 74 65 2d 73 74 61  )(cadr state-sta
9b20: 74 75 73 29 20 23 66 29 29 29 29 29 0a 09 09 20  tus) #f)))))... 
9b30: 20 28 73 6f 72 74 20 74 65 73 74 73 20 28 6c 61   (sort tests (la
9b40: 6d 62 64 61 20 28 61 20 62 29 28 6c 65 74 20 28  mbda (a b)(let (
9b50: 28 64 69 72 61 20 28 64 62 3a 74 65 73 74 2d 67  (dira (db:test-g
9b60: 65 74 2d 72 75 6e 64 69 72 20 61 29 29 0a 09 09  et-rundir a))...
9b70: 09 09 09 09 20 28 64 69 72 62 20 28 64 62 3a 74  .... (dirb (db:t
9b80: 65 73 74 2d 67 65 74 2d 72 75 6e 64 69 72 20 62  est-get-rundir b
9b90: 29 29 29 0a 09 09 09 09 09 20 20 20 20 20 28 69  )))......     (i
9ba0: 66 20 28 61 6e 64 20 28 73 74 72 69 6e 67 3f 20  f (and (string? 
9bb0: 64 69 72 61 29 28 73 74 72 69 6e 67 3f 20 64 69  dira)(string? di
9bc0: 72 62 29 29 0a 09 09 09 09 09 09 20 28 3e 20 28  rb))....... (> (
9bd0: 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 64 69  string-length di
9be0: 72 61 29 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74  ra)(string-lengt
9bf0: 68 20 64 69 72 62 29 29 0a 09 09 09 09 09 09 20  h dirb))....... 
9c00: 23 66 29 29 29 29 29 29 29 0a 09 20 20 20 3b 3b  #f)))))))..   ;;
9c10: 20 72 65 6d 6f 76 65 20 74 68 65 20 72 75 6e 20   remove the run 
9c20: 69 66 20 7a 65 72 6f 20 74 65 73 74 73 20 72 65  if zero tests re
9c30: 6d 61 69 6e 0a 09 20 20 20 28 69 66 20 28 65 71  main..   (if (eq
9c40: 3f 20 61 63 74 69 6f 6e 20 27 72 65 6d 6f 76 65  ? action 'remove
9c50: 2d 72 75 6e 73 29 0a 09 20 20 20 20 20 20 20 28  -runs)..       (
9c60: 6c 65 74 20 28 28 72 65 6d 74 65 73 74 73 20 28  let ((remtests (
9c70: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64  open-run-close d
9c80: 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d  b:get-tests-for-
9c90: 72 75 6e 20 64 62 20 28 64 62 3a 67 65 74 2d 76  run db (db:get-v
9ca0: 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72  alue-by-header r
9cb0: 75 6e 20 68 65 61 64 65 72 20 22 69 64 22 29 20  un header "id") 
9cc0: 23 66 20 27 28 22 44 45 4c 45 54 45 44 22 29 20  #f '("DELETED") 
9cd0: 27 28 22 6e 2f 61 22 29 20 6e 6f 74 2d 69 6e 3a  '("n/a") not-in:
9ce0: 20 23 74 29 29 29 0a 09 09 20 28 69 66 20 28 6e   #t)))... (if (n
9cf0: 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29 20 3b  ull? remtests) ;
9d00: 3b 20 6e 6f 20 6d 6f 72 65 20 74 65 73 74 73 20  ; no more tests 
9d10: 72 65 6d 61 69 6e 69 6e 67 0a 09 09 20 20 20 20  remaining...    
9d20: 20 28 6c 65 74 2a 20 28 28 64 70 61 72 74 73 20   (let* ((dparts 
9d30: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 6c   (string-split l
9d40: 61 73 74 74 70 61 74 68 20 22 2f 22 29 29 0a 09  asttpath "/"))..
9d50: 09 09 20 20 20 20 28 72 75 6e 70 61 74 68 20 28  ..    (runpath (
9d60: 63 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 6e 67  conc "/" (string
9d70: 2d 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09 09  -intersperse ...
9d80: 09 09 09 09 28 74 61 6b 65 20 64 70 61 72 74 73  ....(take dparts
9d90: 20 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72   (- (length dpar
9da0: 74 73 29 20 31 29 29 0a 09 09 09 09 09 09 22 2f  ts) 1))......."/
9db0: 22 29 29 29 29 0a 09 09 20 20 20 20 20 20 20 28  "))))...       (
9dc0: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52  debug:print 1 "R
9dd0: 65 6d 6f 76 69 6e 67 20 72 75 6e 3a 20 22 20 72  emoving run: " r
9de0: 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65  unkey " " (db:ge
9df0: 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65  t-value-by-heade
9e00: 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 72 75  r run header "ru
9e10: 6e 6e 61 6d 65 22 29 20 22 20 61 6e 64 20 72 65  nname") " and re
9e20: 6c 61 74 65 64 20 72 65 63 6f 72 64 22 29 0a 09  lated record")..
9e30: 09 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75  .       (open-ru
9e40: 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74  n-close db:delet
9e50: 65 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 29  e-run db run-id)
9e60: 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 54 68 69  ...       ;; Thi
9e70: 73 20 69 73 20 61 20 70 72 65 74 74 79 20 67 6f  s is a pretty go
9e80: 6f 64 20 70 6c 61 63 65 20 74 6f 20 70 75 72 67  od place to purg
9e90: 65 20 6f 6c 64 20 44 45 4c 45 54 45 44 20 74 65  e old DELETED te
9ea0: 73 74 73 0a 09 09 20 20 20 20 20 20 20 28 6f 70  sts...       (op
9eb0: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a  en-run-close db:
9ec0: 64 65 6c 65 74 65 2d 74 65 73 74 73 2d 66 6f 72  delete-tests-for
9ed0: 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 29 0a  -run db run-id).
9ee0: 09 09 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72  ..       (open-r
9ef0: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65  un-close db:dele
9f00: 74 65 2d 6f 6c 64 2d 64 65 6c 65 74 65 64 2d 74  te-old-deleted-t
9f10: 65 73 74 2d 72 65 63 6f 72 64 73 20 64 62 29 0a  est-records db).
9f20: 09 09 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72  ..       (open-r
9f30: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 73 65 74 2d  un-close db:set-
9f40: 76 61 72 20 64 62 20 22 44 45 4c 45 54 45 44 5f  var db "DELETED_
9f50: 54 45 53 54 53 22 20 28 63 75 72 72 65 6e 74 2d  TESTS" (current-
9f60: 73 65 63 6f 6e 64 73 29 29 0a 09 09 20 20 20 20  seconds))...    
9f70: 20 20 20 3b 3b 20 6e 65 65 64 20 74 6f 20 66 69     ;; need to fi
9f80: 67 75 72 65 20 6f 75 74 20 74 68 65 20 70 61 74  gure out the pat
9f90: 68 20 74 6f 20 74 68 65 20 72 75 6e 20 64 69 72  h to the run dir
9fa0: 20 61 6e 64 20 72 65 6d 6f 76 65 20 69 74 20 69   and remove it i
9fb0: 66 20 65 6d 70 74 79 0a 09 09 20 20 20 20 20 20  f empty...      
9fc0: 20 3b 3b 20 20 20 20 28 69 66 20 28 6e 75 6c 6c   ;;    (if (null
9fd0: 3f 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20 72 75  ? (glob (conc ru
9fe0: 6e 70 61 74 68 20 22 2f 2a 22 29 29 29 0a 09 09  npath "/*")))...
9ff0: 20 20 20 20 20 20 20 3b 3b 20 20 20 20 20 20 20         ;;       
a000: 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20 20   (begin...      
a010: 20 3b 3b 20 09 20 28 64 65 62 75 67 3a 70 72 69   ;; . (debug:pri
a020: 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 72  nt 1 "Removing r
a030: 75 6e 20 64 69 72 20 22 20 72 75 6e 70 61 74 68  un dir " runpath
a040: 29 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 09 20  )...       ;; . 
a050: 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 72  (system (conc "r
a060: 6d 64 69 72 20 2d 70 20 22 20 72 75 6e 70 61 74  mdir -p " runpat
a070: 68 29 29 29 29 0a 09 09 20 20 20 20 20 20 20 29  h))))...       )
a080: 29 29 29 29 0a 09 20 29 29 0a 20 20 20 20 20 72  )))).. )).     r
a090: 75 6e 73 29 29 0a 20 20 23 74 29 0a 0a 3b 3b 3d  uns)).  #t)..;;=
a0a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a0b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a0c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a0d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a0e0: 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 75 74 69 6e 65  =====.;; Routine
a0f0: 73 20 66 6f 72 20 6d 61 6e 69 70 75 6c 61 74 69  s for manipulati
a100: 6e 67 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d  ng runs.;;======
a110: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a120: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a130: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a140: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a150: 0a 0a 3b 3b 20 53 69 6e 63 65 20 6d 61 6e 79 20  ..;; Since many 
a160: 63 61 6c 6c 73 20 74 6f 20 61 20 72 75 6e 20 72  calls to a run r
a170: 65 71 75 69 72 65 20 70 72 65 74 74 79 20 6d 75  equire pretty mu
a180: 63 68 20 74 68 65 20 73 61 6d 65 20 73 65 74 75  ch the same setu
a190: 70 20 0a 3b 3b 20 74 68 69 73 20 77 72 61 70 70  p .;; this wrapp
a1a0: 65 72 20 69 73 20 75 73 65 64 20 74 6f 20 72 65  er is used to re
a1b0: 64 75 63 65 20 74 68 65 20 72 65 70 6c 69 63 61  duce the replica
a1c0: 74 69 6f 6e 20 6f 66 20 63 6f 64 65 0a 28 64 65  tion of code.(de
a1d0: 66 69 6e 65 20 28 67 65 6e 65 72 61 6c 2d 72 75  fine (general-ru
a1e0: 6e 2d 63 61 6c 6c 20 73 77 69 74 63 68 6e 61 6d  n-call switchnam
a1f0: 65 20 61 63 74 69 6f 6e 2d 64 65 73 63 20 70 72  e action-desc pr
a200: 6f 63 29 0a 20 20 28 6c 65 74 20 28 28 72 75 6e  oc).  (let ((run
a210: 6e 61 6d 65 20 28 61 72 67 73 3a 67 65 74 2d 61  name (args:get-a
a220: 72 67 20 22 3a 72 75 6e 6e 61 6d 65 22 29 29 0a  rg ":runname")).
a230: 09 28 74 61 72 67 65 74 20 20 28 69 66 20 28 61  .(target  (if (a
a240: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61  rgs:get-arg "-ta
a250: 72 67 65 74 22 29 0a 09 09 20 20 20 20 20 28 61  rget")...     (a
a260: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61  rgs:get-arg "-ta
a270: 72 67 65 74 22 29 0a 09 09 20 20 20 20 20 28 61  rget")...     (a
a280: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65  rgs:get-arg "-re
a290: 71 74 61 72 67 22 29 29 29 0a 09 28 74 68 31 20  qtarg")))..(th1 
a2a0: 20 20 20 20 23 66 29 29 0a 20 20 20 20 28 63 6f      #f)).    (co
a2b0: 6e 64 0a 20 20 20 20 20 28 28 6e 6f 74 20 74 61  nd.     ((not ta
a2c0: 72 67 65 74 29 0a 20 20 20 20 20 20 28 64 65 62  rget).      (deb
a2d0: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f  ug:print 0 "ERRO
a2e0: 52 3a 20 4d 69 73 73 69 6e 67 20 72 65 71 75 69  R: Missing requi
a2f0: 72 65 64 20 70 61 72 61 6d 65 74 65 72 20 66 6f  red parameter fo
a300: 72 20 22 20 73 77 69 74 63 68 6e 61 6d 65 20 22  r " switchname "
a310: 2c 20 79 6f 75 20 6d 75 73 74 20 73 70 65 63 69  , you must speci
a320: 66 79 20 74 68 65 20 74 61 72 67 65 74 20 77 69  fy the target wi
a330: 74 68 20 2d 74 61 72 67 65 74 22 29 0a 20 20 20  th -target").   
a340: 20 20 20 28 65 78 69 74 20 33 29 29 0a 20 20 20     (exit 3)).   
a350: 20 20 28 28 6e 6f 74 20 72 75 6e 6e 61 6d 65 29    ((not runname)
a360: 0a 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72  .      (debug:pr
a370: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 4d 69  int 0 "ERROR: Mi
a380: 73 73 69 6e 67 20 72 65 71 75 69 72 65 64 20 70  ssing required p
a390: 61 72 61 6d 65 74 65 72 20 66 6f 72 20 22 20 73  arameter for " s
a3a0: 77 69 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75  witchname ", you
a3b0: 20 6d 75 73 74 20 73 70 65 63 69 66 79 20 74 68   must specify th
a3c0: 65 20 72 75 6e 20 6e 61 6d 65 20 77 69 74 68 20  e run name with 
a3d0: 3a 72 75 6e 6e 61 6d 65 20 72 75 6e 6e 61 6d 65  :runname runname
a3e0: 22 29 0a 20 20 20 20 20 20 28 65 78 69 74 20 33  ").      (exit 3
a3f0: 29 29 0a 20 20 20 20 20 28 65 6c 73 65 0a 20 20  )).     (else.  
a400: 20 20 20 20 28 6c 65 74 20 28 28 64 62 20 20 20      (let ((db   
a410: 23 66 29 0a 09 20 20 20 20 28 6b 65 79 73 20 23  #f)..    (keys #
a420: 66 29 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 73  f))..(if (not (s
a430: 65 74 75 70 2d 66 6f 72 2d 72 75 6e 29 29 0a 09  etup-for-run))..
a440: 20 20 20 20 28 62 65 67 69 6e 20 0a 09 20 20 20      (begin ..   
a450: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
a460: 30 20 22 46 61 69 6c 65 64 20 74 6f 20 73 65 74  0 "Failed to set
a470: 75 70 2c 20 65 78 69 74 69 6e 67 22 29 0a 09 20  up, exiting").. 
a480: 20 20 20 20 20 28 65 78 69 74 20 31 29 29 29 0a       (exit 1))).
a490: 09 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61  .(if (args:get-a
a4a0: 72 67 20 22 2d 73 65 72 76 65 72 22 29 0a 09 20  rg "-server").. 
a4b0: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f     (open-run-clo
a4c0: 73 65 20 73 65 72 76 65 72 3a 73 74 61 72 74 20  se server:start 
a4d0: 64 62 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  db (args:get-arg
a4e0: 20 22 2d 73 65 72 76 65 72 22 29 29 0a 20 09 20   "-server")). . 
a4f0: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6f 72 20     (if (not (or 
a500: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
a510: 72 75 6e 61 6c 6c 22 29 20 20 20 20 20 3b 3b 20  runall")     ;; 
a520: 72 75 6e 61 6c 6c 20 61 6e 64 20 72 75 6e 74 65  runall and runte
a530: 73 74 73 20 61 72 65 20 61 6c 6c 6f 77 65 64 20  sts are allowed 
a540: 74 6f 20 62 65 20 73 65 72 76 65 72 73 0a 20 09  to be servers. .
a550: 09 09 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  .. (args:get-arg
a560: 20 22 2d 72 75 6e 74 65 73 74 73 22 29 29 29 0a   "-runtests"))).
a570: 09 09 28 73 65 72 76 65 72 3a 63 6c 69 65 6e 74  ..(server:client
a580: 2d 73 65 74 75 70 29 20 3b 3b 20 54 68 69 73 20  -setup) ;; This 
a590: 69 73 20 61 20 64 75 70 6c 69 63 61 74 65 20 73  is a duplicate s
a5a0: 74 61 72 74 75 70 21 21 21 3f 3f 3f 20 42 55 47  tartup!!!??? BUG
a5b0: 3f 0a 09 09 29 29 0a 09 28 73 65 74 21 20 6b 65  ?...))..(set! ke
a5c0: 79 73 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f  ys (open-run-clo
a5d0: 73 65 20 64 62 3a 67 65 74 2d 6b 65 79 73 20 64  se db:get-keys d
a5e0: 62 29 29 0a 09 3b 3b 20 68 61 76 65 20 65 6e 6f  b))..;; have eno
a5f0: 75 67 68 20 74 6f 20 70 72 6f 63 65 73 73 20 2d  ugh to process -
a600: 74 61 72 67 65 74 20 6f 72 20 2d 72 65 71 74 61  target or -reqta
a610: 72 67 20 68 65 72 65 0a 09 28 69 66 20 28 61 72  rg here..(if (ar
a620: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71  gs:get-arg "-req
a630: 74 61 72 67 22 29 0a 09 20 20 20 20 28 6c 65 74  targ")..    (let
a640: 2a 20 28 28 72 75 6e 63 6f 6e 66 69 67 66 20 28  * ((runconfigf (
a650: 63 6f 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a 20  conc  *toppath* 
a660: 22 2f 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e  "/runconfigs.con
a670: 66 69 67 22 29 29 20 3b 3b 20 44 4f 20 4e 4f 54  fig")) ;; DO NOT
a680: 20 45 56 41 4c 55 41 54 45 20 41 4c 4c 20 0a 09   EVALUATE ALL ..
a690: 09 20 20 20 28 72 75 6e 63 6f 6e 66 69 67 20 20  .   (runconfig  
a6a0: 28 72 65 61 64 2d 63 6f 6e 66 69 67 20 72 75 6e  (read-config run
a6b0: 63 6f 6e 66 69 67 66 20 23 66 20 23 66 20 65 6e  configf #f #f en
a6c0: 76 69 72 6f 6e 2d 70 61 74 74 3a 20 23 66 29 29  viron-patt: #f))
a6d0: 29 20 0a 09 20 20 20 20 20 20 28 69 66 20 28 68  ) ..      (if (h
a6e0: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65  ash-table-ref/de
a6f0: 66 61 75 6c 74 20 72 75 6e 63 6f 6e 66 69 67 20  fault runconfig 
a700: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
a710: 72 65 71 74 61 72 67 22 29 20 23 66 29 0a 09 09  reqtarg") #f)...
a720: 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 73    (keys:target-s
a730: 65 74 2d 61 72 67 73 20 6b 65 79 73 20 28 61 72  et-args keys (ar
a740: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71  gs:get-arg "-req
a750: 74 61 72 67 22 29 20 61 72 67 73 3a 61 72 67 2d  targ") args:arg-
a760: 68 61 73 68 29 0a 09 09 20 20 28 62 65 67 69 6e  hash)...  (begin
a770: 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72  ...    (debug:pr
a780: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 5b 22  int 0 "ERROR: ["
a790: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
a7a0: 2d 72 65 71 74 61 72 67 22 29 20 22 5d 20 6e 6f  -reqtarg") "] no
a7b0: 74 20 66 6f 75 6e 64 20 69 6e 20 22 20 72 75 6e  t found in " run
a7c0: 63 6f 6e 66 69 67 66 29 0a 09 09 20 20 20 20 28  configf)...    (
a7d0: 69 66 20 64 62 20 28 73 71 6c 69 74 65 33 3a 66  if db (sqlite3:f
a7e0: 69 6e 61 6c 69 7a 65 21 20 64 62 29 29 0a 09 09  inalize! db))...
a7f0: 20 20 20 20 28 65 78 69 74 20 31 29 29 29 29 0a      (exit 1)))).
a800: 09 20 20 20 20 28 69 66 20 28 61 72 67 73 3a 67  .    (if (args:g
a810: 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22  et-arg "-target"
a820: 29 0a 09 09 28 6b 65 79 73 3a 74 61 72 67 65 74  )...(keys:target
a830: 2d 73 65 74 2d 61 72 67 73 20 6b 65 79 73 20 28  -set-args keys (
a840: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74  args:get-arg "-t
a850: 61 72 67 65 74 22 20 61 72 67 73 3a 61 72 67 2d  arget" args:arg-
a860: 68 61 73 68 29 20 61 72 67 73 3a 61 72 67 2d 68  hash) args:arg-h
a870: 61 73 68 29 29 29 0a 09 28 69 66 20 28 6e 6f 74  ash)))..(if (not
a880: 20 28 63 61 72 20 2a 63 6f 6e 66 69 67 69 6e 66   (car *configinf
a890: 6f 2a 29 29 0a 09 20 20 20 20 28 62 65 67 69 6e  o*))..    (begin
a8a0: 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70  ..      (debug:p
a8b0: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 41  rint 0 "ERROR: A
a8c0: 74 74 65 6d 70 74 65 64 20 74 6f 20 22 20 61 63  ttempted to " ac
a8d0: 74 69 6f 6e 2d 64 65 73 63 20 22 20 62 75 74 20  tion-desc " but 
a8e0: 72 75 6e 20 61 72 65 61 20 63 6f 6e 66 69 67 20  run area config 
a8f0: 66 69 6c 65 20 6e 6f 74 20 66 6f 75 6e 64 22 29  file not found")
a900: 0a 09 20 20 20 20 20 20 28 65 78 69 74 20 31 29  ..      (exit 1)
a910: 29 0a 09 20 20 20 20 3b 3b 20 45 78 74 72 61 63  )..    ;; Extrac
a920: 74 20 6f 75 74 20 73 74 75 66 66 20 6e 65 65 64  t out stuff need
a930: 65 64 20 69 6e 20 6d 6f 73 74 20 6f 72 20 6d 61  ed in most or ma
a940: 6e 79 20 63 61 6c 6c 73 0a 09 20 20 20 20 3b 3b  ny calls..    ;;
a950: 20 68 65 72 65 20 74 68 65 6e 20 63 61 6c 6c 20   here then call 
a960: 70 72 6f 63 0a 09 20 20 20 20 28 6c 65 74 2a 20  proc..    (let* 
a970: 28 28 6b 65 79 6e 61 6d 65 73 20 20 20 28 6d 61  ((keynames   (ma
a980: 70 20 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e  p key:get-fieldn
a990: 61 6d 65 20 6b 65 79 73 29 29 0a 09 09 20 20 20  ame keys))...   
a9a0: 28 6b 65 79 76 61 6c 6c 73 74 20 20 28 6b 65 79  (keyvallst  (key
a9b0: 73 2d 3e 76 61 6c 6c 69 73 74 20 6b 65 79 73 20  s->vallist keys 
a9c0: 23 74 29 29 29 0a 09 20 20 20 20 20 20 28 70 72  #t)))..      (pr
a9d0: 6f 63 20 74 61 72 67 65 74 20 72 75 6e 6e 61 6d  oc target runnam
a9e0: 65 20 6b 65 79 73 20 6b 65 79 6e 61 6d 65 73 20  e keys keynames 
a9f0: 6b 65 79 76 61 6c 6c 73 74 29 29 29 0a 09 28 69  keyvallst)))..(i
aa00: 66 20 74 68 31 20 28 74 68 72 65 61 64 2d 6a 6f  f th1 (thread-jo
aa10: 69 6e 21 20 74 68 31 29 29 0a 09 28 69 66 20 64  in! th1))..(if d
aa20: 62 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c  b (sqlite3:final
aa30: 69 7a 65 21 20 64 62 29 29 0a 09 28 73 65 74 21  ize! db))..(set!
aa40: 20 2a 64 69 64 73 6f 6d 65 74 68 69 6e 67 2a 20   *didsomething* 
aa50: 23 74 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d  #t))))))..;;====
aa60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
aa70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
aa80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
aa90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
aaa0: 3d 3d 0a 3b 3b 20 4c 6f 63 6b 2f 75 6e 6c 6f 63  ==.;; Lock/unloc
aab0: 6b 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d  k runs.;;=======
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 3d 0a  ===============.
ab00: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 68  .(define (runs:h
ab10: 61 6e 64 6c 65 2d 6c 6f 63 6b 69 6e 67 20 74 61  andle-locking ta
ab20: 72 67 65 74 20 6b 65 79 73 20 72 75 6e 6e 61 6d  rget keys runnam
ab30: 65 20 6c 6f 63 6b 20 75 6e 6c 6f 63 6b 20 75 73  e lock unlock us
ab40: 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 28 64 62  er).  (let* ((db
ab50: 20 20 20 20 20 20 20 23 66 29 0a 09 20 28 72 75         #f).. (ru
ab60: 6e 64 61 74 20 20 20 28 6f 70 65 6e 2d 72 75 6e  ndat   (open-run
ab70: 2d 63 6c 6f 73 65 20 72 75 6e 73 3a 67 65 74 2d  -close runs:get-
ab80: 72 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20  runs-by-patt db 
ab90: 6b 65 79 73 20 72 75 6e 6e 61 6d 65 29 29 0a 09  keys runname))..
aba0: 20 28 68 65 61 64 65 72 20 20 20 28 76 65 63 74   (header   (vect
abb0: 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 30 29  or-ref rundat 0)
abc0: 29 0a 09 20 28 72 75 6e 73 20 20 20 20 20 28 76  ).. (runs     (v
abd0: 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74  ector-ref rundat
abe0: 20 31 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65   1))).    (for-e
abf0: 61 63 68 20 28 6c 61 6d 62 64 61 20 28 72 75 6e  ach (lambda (run
ac00: 29 0a 09 09 28 6c 65 74 20 28 28 72 75 6e 2d 69  )...(let ((run-i
ac10: 64 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d  d (db:get-value-
ac20: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65  by-header run he
ac30: 61 64 65 72 20 22 69 64 22 29 29 29 0a 09 09 20  ader "id")))... 
ac40: 20 28 69 66 20 28 6f 72 20 6c 6f 63 6b 0a 09 09   (if (or lock...
ac50: 09 20 20 28 61 6e 64 20 75 6e 6c 6f 63 6b 0a 09  .  (and unlock..
ac60: 09 09 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a  ..       (begin.
ac70: 09 09 09 09 20 28 70 72 69 6e 74 20 22 44 6f 20  .... (print "Do 
ac80: 79 6f 75 20 72 65 61 6c 6c 79 20 77 69 73 68 20  you really wish 
ac90: 74 6f 20 75 6e 6c 6f 63 6b 20 72 75 6e 20 22 20  to unlock run " 
aca0: 72 75 6e 2d 69 64 20 22 3f 5c 6e 20 20 20 79 2f  run-id "?\n   y/
acb0: 6e 3a 20 22 29 0a 09 09 09 09 20 28 65 71 75 61  n: ")..... (equa
acc0: 6c 3f 20 22 79 22 20 28 72 65 61 64 2d 6c 69 6e  l? "y" (read-lin
acd0: 65 29 29 29 29 29 0a 09 09 20 20 20 20 20 20 28  e)))))...      (
ace0: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64  open-run-close d
acf0: 62 3a 6c 6f 63 6b 2f 75 6e 6c 6f 63 6b 2d 72 75  b:lock/unlock-ru
ad00: 6e 20 64 62 20 72 75 6e 2d 69 64 20 6c 6f 63 6b  n db run-id lock
ad10: 20 75 6e 6c 6f 63 6b 20 75 73 65 72 29 0a 09 09   unlock user)...
ad20: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
ad30: 6e 74 2d 69 6e 66 6f 20 30 20 22 53 6b 69 70 70  nt-info 0 "Skipp
ad40: 69 6e 67 20 6c 6f 63 6b 2f 75 6e 6c 6f 63 6b 20  ing lock/unlock 
ad50: 6f 6e 20 22 20 72 75 6e 2d 69 64 29 29 29 29 0a  on " run-id)))).
ad60: 09 20 20 20 20 20 20 72 75 6e 73 29 29 29 0a 3b  .      runs))).;
ad70: 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;===============
ad80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
ad90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
ada0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
adb0: 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 6c 6c 75  =======.;; Rollu
adc0: 70 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d  p runs.;;=======
add0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
ade0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
adf0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
ae00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a  ===============.
ae10: 0a 3b 3b 20 55 70 64 61 74 65 20 74 68 65 20 74  .;; Update the t
ae20: 65 73 74 5f 6d 65 74 61 20 74 61 62 6c 65 20 66  est_meta table f
ae30: 6f 72 20 74 68 69 73 20 74 65 73 74 0a 28 64 65  or this test.(de
ae40: 66 69 6e 65 20 28 72 75 6e 73 3a 75 70 64 61 74  fine (runs:updat
ae50: 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20 74  e-test_meta db t
ae60: 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f  est-name test-co
ae70: 6e 66 29 0a 20 20 28 6c 65 74 20 28 28 63 75 72  nf).  (let ((cur
ae80: 72 72 65 63 6f 72 64 20 28 6f 70 65 6e 2d 72 75  rrecord (open-ru
ae90: 6e 2d 63 6c 6f 73 65 20 64 62 3a 74 65 73 74 6d  n-close db:testm
aea0: 65 74 61 2d 67 65 74 2d 72 65 63 6f 72 64 20 64  eta-get-record d
aeb0: 62 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20  b test-name))). 
aec0: 20 20 20 28 69 66 20 28 6e 6f 74 20 63 75 72 72     (if (not curr
aed0: 72 65 63 6f 72 64 29 0a 09 28 62 65 67 69 6e 0a  record)..(begin.
aee0: 09 20 20 28 73 65 74 21 20 63 75 72 72 72 65 63  .  (set! currrec
aef0: 6f 72 64 20 28 6d 61 6b 65 2d 76 65 63 74 6f 72  ord (make-vector
af00: 20 31 30 20 23 66 29 29 0a 09 20 20 28 6f 70 65   10 #f))..  (ope
af10: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 74  n-run-close db:t
af20: 65 73 74 6d 65 74 61 2d 61 64 64 2d 72 65 63 6f  estmeta-add-reco
af30: 72 64 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 29  rd db test-name)
af40: 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68  )).    (for-each
af50: 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28   .     (lambda (
af60: 6b 65 79 29 0a 20 20 20 20 20 20 20 28 6c 65 74  key).       (let
af70: 2a 20 28 28 69 64 78 20 28 63 61 64 72 20 6b 65  * ((idx (cadr ke
af80: 79 29 29 0a 09 20 20 20 20 20 20 28 66 6c 64 20  y))..      (fld 
af90: 28 63 61 72 20 20 6b 65 79 29 29 0a 09 20 20 20  (car  key))..   
afa0: 20 20 20 28 76 61 6c 20 28 63 6f 6e 66 69 67 2d     (val (config-
afb0: 6c 6f 6f 6b 75 70 20 74 65 73 74 2d 63 6f 6e 66  lookup test-conf
afc0: 20 22 74 65 73 74 5f 6d 65 74 61 22 20 66 6c 64   "test_meta" fld
afd0: 29 29 29 0a 09 20 3b 3b 20 28 64 65 62 75 67 3a  ))).. ;; (debug:
afe0: 70 72 69 6e 74 20 35 20 22 69 64 78 3a 20 22 20  print 5 "idx: " 
aff0: 69 64 78 20 22 20 66 6c 64 3a 20 22 20 66 6c 64  idx " fld: " fld
b000: 20 22 20 76 61 6c 3a 20 22 20 76 61 6c 29 0a 09   " val: " val)..
b010: 20 28 69 66 20 28 61 6e 64 20 76 61 6c 20 28 6e   (if (and val (n
b020: 6f 74 20 28 65 71 75 61 6c 3f 20 28 76 65 63 74  ot (equal? (vect
b030: 6f 72 2d 72 65 66 20 63 75 72 72 72 65 63 6f 72  or-ref currrecor
b040: 64 20 69 64 78 29 20 76 61 6c 29 29 29 0a 09 20  d idx) val))).. 
b050: 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20      (begin..    
b060: 20 20 20 28 70 72 69 6e 74 20 22 55 70 64 61 74     (print "Updat
b070: 69 6e 67 20 22 20 74 65 73 74 2d 6e 61 6d 65 20  ing " test-name 
b080: 22 20 22 20 66 6c 64 20 22 20 74 6f 20 22 20 76  " " fld " to " v
b090: 61 6c 29 0a 09 20 20 20 20 20 20 20 28 6f 70 65  al)..       (ope
b0a0: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 74  n-run-close db:t
b0b0: 65 73 74 6d 65 74 61 2d 75 70 64 61 74 65 2d 66  estmeta-update-f
b0c0: 69 65 6c 64 20 64 62 20 74 65 73 74 2d 6e 61 6d  ield db test-nam
b0d0: 65 20 66 6c 64 20 76 61 6c 29 29 29 29 29 0a 20  e fld val))))). 
b0e0: 20 20 20 20 27 28 28 22 61 75 74 68 6f 72 22 20      '(("author" 
b0f0: 32 29 28 22 6f 77 6e 65 72 22 20 33 29 28 22 64  2)("owner" 3)("d
b100: 65 73 63 72 69 70 74 69 6f 6e 22 20 34 29 28 22  escription" 4)("
b110: 72 65 76 69 65 77 65 64 22 20 35 29 28 22 74 61  reviewed" 5)("ta
b120: 67 73 22 20 39 29 29 29 29 29 0a 0a 3b 3b 20 55  gs" 9)))))..;; U
b130: 70 64 61 74 65 20 74 65 73 74 5f 6d 65 74 61 20  pdate test_meta 
b140: 66 6f 72 20 61 6c 6c 20 74 65 73 74 73 0a 28 64  for all tests.(d
b150: 65 66 69 6e 65 20 28 72 75 6e 73 3a 75 70 64 61  efine (runs:upda
b160: 74 65 2d 61 6c 6c 2d 74 65 73 74 5f 6d 65 74 61  te-all-test_meta
b170: 20 64 62 29 0a 20 20 28 6c 65 74 20 28 28 74 65   db).  (let ((te
b180: 73 74 2d 6e 61 6d 65 73 20 28 67 65 74 2d 61 6c  st-names (get-al
b190: 6c 2d 6c 65 67 61 6c 2d 74 65 73 74 73 29 29 29  l-legal-tests)))
b1a0: 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a  .    (for-each .
b1b0: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74 65       (lambda (te
b1c0: 73 74 2d 6e 61 6d 65 29 0a 20 20 20 20 20 20 20  st-name).       
b1d0: 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 70 61 74  (let* ((test-pat
b1e0: 68 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f 70 70  h    (conc *topp
b1f0: 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 20 74  ath* "/tests/" t
b200: 65 73 74 2d 6e 61 6d 65 29 29 0a 09 20 20 20 20  est-name))..    
b210: 20 20 28 74 65 73 74 2d 63 6f 6e 66 69 67 66 20    (test-configf 
b220: 28 63 6f 6e 63 20 74 65 73 74 2d 70 61 74 68 20  (conc test-path 
b230: 22 2f 74 65 73 74 63 6f 6e 66 69 67 22 29 29 0a  "/testconfig")).
b240: 09 20 20 20 20 20 20 28 74 65 73 74 65 78 69 73  .      (testexis
b250: 74 73 20 20 20 28 61 6e 64 20 28 66 69 6c 65 2d  ts   (and (file-
b260: 65 78 69 73 74 73 3f 20 74 65 73 74 2d 63 6f 6e  exists? test-con
b270: 66 69 67 66 29 28 66 69 6c 65 2d 72 65 61 64 2d  figf)(file-read-
b280: 61 63 63 65 73 73 3f 20 74 65 73 74 2d 63 6f 6e  access? test-con
b290: 66 69 67 66 29 29 29 0a 09 20 20 20 20 20 20 3b  figf)))..      ;
b2a0: 3b 20 72 65 61 64 20 63 6f 6e 66 69 67 73 20 77  ; read configs w
b2b0: 69 74 68 20 74 72 69 63 6b 73 20 74 75 72 6e 65  ith tricks turne
b2c0: 64 20 6f 66 66 20 28 69 2e 65 2e 20 6e 6f 20 73  d off (i.e. no s
b2d0: 79 73 74 65 6d 29 0a 09 20 20 20 20 20 20 28 74  ystem)..      (t
b2e0: 65 73 74 2d 63 6f 6e 66 20 20 20 20 28 69 66 20  est-conf    (if 
b2f0: 74 65 73 74 65 78 69 73 74 73 20 28 72 65 61 64  testexists (read
b300: 2d 63 6f 6e 66 69 67 20 74 65 73 74 2d 63 6f 6e  -config test-con
b310: 66 69 67 66 20 23 66 20 23 66 29 28 6d 61 6b 65  figf #f #f)(make
b320: 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 29 0a  -hash-table)))).
b330: 09 20 3b 3b 20 75 73 65 20 74 68 65 20 6f 70 65  . ;; use the ope
b340: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 69 6e 73 74  n-run-close inst
b350: 65 61 64 20 6f 66 20 70 61 73 73 69 6e 67 20 69  ead of passing i
b360: 6e 20 64 62 0a 09 20 28 72 75 6e 73 3a 75 70 64  n db.. (runs:upd
b370: 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 23 66  ate-test_meta #f
b380: 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d   test-name test-
b390: 63 6f 6e 66 29 29 29 0a 20 20 20 20 20 74 65 73  conf))).     tes
b3a0: 74 2d 6e 61 6d 65 73 29 29 29 0a 0a 3b 3b 20 54  t-names)))..;; T
b3b0: 68 69 73 20 63 6f 75 6c 64 20 70 72 6f 62 61 62  his could probab
b3c0: 6c 79 20 62 65 20 72 65 66 61 63 74 6f 72 65 64  ly be refactored
b3d0: 20 69 6e 74 6f 20 6f 6e 65 20 63 6f 6d 70 6c 65   into one comple
b3e0: 78 20 71 75 65 72 79 20 2e 2e 2e 0a 28 64 65 66  x query ....(def
b3f0: 69 6e 65 20 28 72 75 6e 73 3a 72 6f 6c 6c 75 70  ine (runs:rollup
b400: 2d 72 75 6e 20 6b 65 79 73 20 6b 65 79 76 61 6c  -run keys keyval
b410: 6c 73 74 20 72 75 6e 6e 61 6d 65 20 75 73 65 72  lst runname user
b420: 29 20 3b 3b 20 77 61 73 20 74 61 72 67 65 74 2c  ) ;; was target,
b430: 20 6e 6f 77 20 6b 65 79 76 61 6c 6c 73 74 0a 20   now keyvallst. 
b440: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20   (debug:print 4 
b450: 22 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e  "runs:rollup-run
b460: 2c 20 6b 65 79 73 3a 20 22 20 6b 65 79 73 20 22  , keys: " keys "
b470: 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65   keyvallst: " ke
b480: 79 76 61 6c 6c 73 74 20 22 20 3a 72 75 6e 6e 61  yvallst " :runna
b490: 6d 65 20 22 20 72 75 6e 6e 61 6d 65 20 22 20 75  me " runname " u
b4a0: 73 65 72 3a 20 22 20 75 73 65 72 29 0a 20 20 28  ser: " user).  (
b4b0: 6c 65 74 2a 20 28 28 64 62 20 20 20 20 20 20 20  let* ((db       
b4c0: 20 20 20 20 20 20 20 23 66 29 20 3b 3b 20 28 6b         #f) ;; (k
b4d0: 65 79 76 61 6c 6c 6c 73 74 20 20 20 20 20 20 28  eyvalllst      (
b4e0: 6b 65 79 73 3a 74 61 72 67 65 74 2d 3e 6b 65 79  keys:target->key
b4f0: 76 61 6c 20 6b 65 79 73 20 74 61 72 67 65 74 29  val keys target)
b500: 29 0a 09 20 28 6e 65 77 2d 72 75 6e 2d 69 64 20  ).. (new-run-id 
b510: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
b520: 6c 6f 73 65 20 72 75 6e 73 3a 72 65 67 69 73 74  lose runs:regist
b530: 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 6b  er-run db keys k
b540: 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65  eyvallst runname
b550: 20 22 6e 65 77 22 20 22 6e 2f 61 22 20 75 73 65   "new" "n/a" use
b560: 72 29 29 0a 09 20 28 70 72 65 76 2d 74 65 73 74  r)).. (prev-test
b570: 73 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e  s      (open-run
b580: 2d 63 6c 6f 73 65 20 74 65 73 74 3a 67 65 74 2d  -close test:get-
b590: 6d 61 74 63 68 69 6e 67 2d 70 72 65 76 69 6f 75  matching-previou
b5a0: 73 2d 74 65 73 74 2d 72 75 6e 2d 72 65 63 6f 72  s-test-run-recor
b5b0: 64 73 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64  ds db new-run-id
b5c0: 20 22 25 22 20 22 25 22 29 29 0a 09 20 28 63 75   "%" "%")).. (cu
b5d0: 72 72 2d 74 65 73 74 73 20 20 20 20 20 20 28 6f  rr-tests      (o
b5e0: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62  pen-run-close db
b5f0: 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72  :get-tests-for-r
b600: 75 6e 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64  un db new-run-id
b610: 20 22 25 2f 25 22 20 27 28 29 20 27 28 29 29 29   "%/%" '() '()))
b620: 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73 2d 68  .. (curr-tests-h
b630: 61 73 68 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74  ash (make-hash-t
b640: 61 62 6c 65 29 29 29 0a 20 20 20 20 28 6f 70 65  able))).    (ope
b650: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 75  n-run-close db:u
b660: 70 64 61 74 65 2d 72 75 6e 2d 65 76 65 6e 74 5f  pdate-run-event_
b670: 74 69 6d 65 20 64 62 20 6e 65 77 2d 72 75 6e 2d  time db new-run-
b680: 69 64 29 0a 20 20 20 20 3b 3b 20 69 6e 64 65 78  id).    ;; index
b690: 20 74 68 65 20 61 6c 72 65 61 64 79 20 73 61 76   the already sav
b6a0: 65 64 20 74 65 73 74 73 20 62 79 20 74 65 73 74  ed tests by test
b6b0: 6e 61 6d 65 20 61 6e 64 20 69 74 65 6d 64 61 74  name and itemdat
b6c0: 20 69 6e 20 63 75 72 72 2d 74 65 73 74 73 2d 68   in curr-tests-h
b6d0: 61 73 68 0a 20 20 20 20 28 66 6f 72 2d 65 61 63  ash.    (for-eac
b6e0: 68 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28  h.     (lambda (
b6f0: 74 65 73 74 64 61 74 29 0a 20 20 20 20 20 20 20  testdat).       
b700: 28 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65  (let* ((testname
b710: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74    (db:test-get-t
b720: 65 73 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29  estname testdat)
b730: 29 0a 09 20 20 20 20 20 20 28 69 74 65 6d 2d 70  )..      (item-p
b740: 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74  ath (db:test-get
b750: 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 64  -item-path testd
b760: 61 74 29 29 0a 09 20 20 20 20 20 20 28 66 75 6c  at))..      (ful
b770: 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73  l-name (conc tes
b780: 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70  tname "/" item-p
b790: 61 74 68 29 29 29 0a 09 20 28 68 61 73 68 2d 74  ath))).. (hash-t
b7a0: 61 62 6c 65 2d 73 65 74 21 20 63 75 72 72 2d 74  able-set! curr-t
b7b0: 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e  ests-hash full-n
b7c0: 61 6d 65 20 74 65 73 74 64 61 74 29 29 29 0a 20  ame testdat))). 
b7d0: 20 20 20 20 63 75 72 72 2d 74 65 73 74 73 29 0a      curr-tests).
b7e0: 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 4e 6f 6e      ;; NOPE: Non
b7f0: 2d 6f 70 74 69 6d 61 6c 20 61 70 70 72 6f 61 63  -optimal approac
b800: 68 2e 20 54 72 79 20 74 68 69 73 20 69 6e 73 74  h. Try this inst
b810: 65 61 64 2e 0a 20 20 20 20 3b 3b 20 20 20 31 2e  ead..    ;;   1.
b820: 20 74 65 73 74 73 20 61 72 65 20 72 65 63 65 69   tests are recei
b830: 76 65 64 20 69 6e 20 61 20 6c 69 73 74 2c 20 6d  ved in a list, m
b840: 6f 73 74 20 72 65 63 65 6e 74 20 66 69 72 73 74  ost recent first
b850: 0a 20 20 20 20 3b 3b 20 20 20 32 2e 20 72 65 70  .    ;;   2. rep
b860: 6c 61 63 65 20 74 68 65 20 72 6f 6c 6c 75 70 20  lace the rollup 
b870: 74 65 73 74 20 77 69 74 68 20 74 68 65 20 6e 65  test with the ne
b880: 77 20 2a 61 6c 77 61 79 73 2a 0a 20 20 20 20 28  w *always*.    (
b890: 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28  for-each .     (
b8a0: 6c 61 6d 62 64 61 20 28 74 65 73 74 64 61 74 29  lambda (testdat)
b8b0: 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28  .       (let* ((
b8c0: 74 65 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 65  testname  (db:te
b8d0: 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20  st-get-testname 
b8e0: 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20  testdat))..     
b8f0: 20 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a   (item-path (db:
b900: 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61  test-get-item-pa
b910: 74 68 20 74 65 73 74 64 61 74 29 29 0a 09 20 20  th testdat))..  
b920: 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28      (full-name (
b930: 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f  conc testname "/
b940: 22 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 20  " item-path)).. 
b950: 20 20 20 20 20 28 70 72 65 76 2d 74 65 73 74 2d       (prev-test-
b960: 64 61 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d  dat (hash-table-
b970: 72 65 66 2f 64 65 66 61 75 6c 74 20 63 75 72 72  ref/default curr
b980: 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c  -tests-hash full
b990: 2d 6e 61 6d 65 20 23 66 29 29 0a 09 20 20 20 20  -name #f))..    
b9a0: 20 20 28 74 65 73 74 2d 73 74 65 70 73 20 20 20    (test-steps   
b9b0: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f     (open-run-clo
b9c0: 73 65 20 64 62 3a 67 65 74 2d 73 74 65 70 73 2d  se db:get-steps-
b9d0: 66 6f 72 2d 74 65 73 74 20 64 62 20 28 64 62 3a  for-test db (db:
b9e0: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74  test-get-id test
b9f0: 64 61 74 29 29 29 0a 09 20 20 20 20 20 20 28 6e  dat)))..      (n
ba00: 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 23  ew-test-record #
ba10: 66 29 29 0a 09 20 3b 3b 20 72 65 70 6c 61 63 65  f)).. ;; replace
ba20: 20 74 68 65 73 65 20 77 69 74 68 20 69 6e 73 65   these with inse
ba30: 72 74 20 2e 2e 2e 20 73 65 6c 65 63 74 0a 09 20  rt ... select.. 
ba40: 28 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a 65  (apply sqlite3:e
ba50: 78 65 63 75 74 65 20 0a 09 09 64 62 20 0a 09 09  xecute ...db ...
ba60: 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52  (conc "INSERT OR
ba70: 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65   REPLACE INTO te
ba80: 73 74 73 20 28 72 75 6e 5f 69 64 2c 74 65 73 74  sts (run_id,test
ba90: 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75  name,state,statu
baa0: 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 68 6f 73  s,event_time,hos
bab0: 74 2c 63 70 75 6c 6f 61 64 2c 64 69 73 6b 66 72  t,cpuload,diskfr
bac0: 65 65 2c 75 6e 61 6d 65 2c 72 75 6e 64 69 72 2c  ee,uname,rundir,
bad0: 69 74 65 6d 5f 70 61 74 68 2c 72 75 6e 5f 64 75  item_path,run_du
bae0: 72 61 74 69 6f 6e 2c 66 69 6e 61 6c 5f 6c 6f 67  ration,final_log
baf0: 66 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20  f,comment) "... 
bb00: 20 20 20 20 20 22 56 41 4c 55 45 53 20 28 3f 2c       "VALUES (?,
bb10: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c  ?,?,?,?,?,?,?,?,
bb20: 3f 2c 3f 2c 3f 2c 3f 2c 3f 29 3b 22 29 0a 09 09  ?,?,?,?,?);")...
bb30: 6e 65 77 2d 72 75 6e 2d 69 64 20 28 63 64 64 72  new-run-id (cddr
bb40: 20 28 76 65 63 74 6f 72 2d 3e 6c 69 73 74 20 74   (vector->list t
bb50: 65 73 74 64 61 74 29 29 29 0a 09 20 28 73 65 74  estdat))).. (set
bb60: 21 20 6e 65 77 2d 74 65 73 74 64 61 74 20 28 63  ! new-testdat (c
bb70: 61 72 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f  ar (open-run-clo
bb80: 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 73 2d  se db:get-tests-
bb90: 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77 2d 72  for-run db new-r
bba0: 75 6e 2d 69 64 20 28 63 6f 6e 63 20 74 65 73 74  un-id (conc test
bbb0: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61  name "/" item-pa
bbc0: 74 68 29 20 27 28 29 20 27 28 29 29 29 29 0a 09  th) '() '())))..
bbd0: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74   (hash-table-set
bbe0: 21 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73  ! curr-tests-has
bbf0: 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 6e 65 77 2d  h full-name new-
bc00: 74 65 73 74 64 61 74 29 20 3b 3b 20 74 68 69 73  testdat) ;; this
bc10: 20 63 6f 75 6c 64 20 62 65 20 63 6f 6e 66 75 73   could be confus
bc20: 69 6e 67 2c 20 77 68 69 63 68 20 72 65 63 6f 72  ing, which recor
bc30: 64 20 73 68 6f 75 6c 64 20 67 6f 20 69 6e 74 6f  d should go into
bc40: 20 74 68 65 20 6c 6f 6f 6b 75 70 20 74 61 62 6c   the lookup tabl
bc50: 65 3f 0a 09 20 3b 3b 20 4e 6f 77 20 64 75 70 6c  e?.. ;; Now dupl
bc60: 69 63 61 74 65 20 74 68 65 20 74 65 73 74 20 73  icate the test s
bc70: 74 65 70 73 0a 09 20 28 64 65 62 75 67 3a 70 72  teps.. (debug:pr
bc80: 69 6e 74 20 34 20 22 43 6f 70 79 69 6e 67 20 72  int 4 "Copying r
bc90: 65 63 6f 72 64 73 20 69 6e 20 74 65 73 74 5f 73  ecords in test_s
bca0: 74 65 70 73 20 66 72 6f 6d 20 74 65 73 74 5f 69  teps from test_i
bcb0: 64 3d 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74  d=" (db:test-get
bcc0: 2d 69 64 20 74 65 73 74 64 61 74 29 20 22 20 74  -id testdat) " t
bcd0: 6f 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74  o " (db:test-get
bce0: 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29  -id new-testdat)
bcf0: 29 0a 09 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c  ).. (open-run-cl
bd00: 6f 73 65 20 0a 09 20 20 28 6c 61 6d 62 64 61 20  ose ..  (lambda 
bd10: 28 29 0a 09 20 20 20 20 28 73 71 6c 69 74 65 33  ()..    (sqlite3
bd20: 3a 65 78 65 63 75 74 65 20 0a 09 20 20 20 20 20  :execute ..     
bd30: 64 62 20 0a 09 20 20 20 20 20 28 63 6f 6e 63 20  db ..     (conc 
bd40: 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41  "INSERT OR REPLA
bd50: 43 45 20 49 4e 54 4f 20 74 65 73 74 5f 73 74 65  CE INTO test_ste
bd60: 70 73 20 28 74 65 73 74 5f 69 64 2c 73 74 65 70  ps (test_id,step
bd70: 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75  name,state,statu
bd80: 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d  s,event_time,com
bd90: 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 22 53 45  ment) "...   "SE
bda0: 4c 45 43 54 20 22 20 28 64 62 3a 74 65 73 74 2d  LECT " (db:test-
bdb0: 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64  get-id new-testd
bdc0: 61 74 29 20 22 2c 73 74 65 70 6e 61 6d 65 2c 73  at) ",stepname,s
bdd0: 74 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e  tate,status,even
bde0: 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 20 46  t_time,comment F
bdf0: 52 4f 4d 20 74 65 73 74 5f 73 74 65 70 73 20 57  ROM test_steps W
be00: 48 45 52 45 20 74 65 73 74 5f 69 64 3d 3f 3b 22  HERE test_id=?;"
be10: 29 0a 09 20 20 20 20 20 28 64 62 3a 74 65 73 74  )..     (db:test
be20: 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29  -get-id testdat)
be30: 29 0a 09 20 20 20 20 3b 3b 20 4e 6f 77 20 64 75  )..    ;; Now du
be40: 70 6c 69 63 61 74 65 20 74 68 65 20 74 65 73 74  plicate the test
be50: 20 64 61 74 61 0a 09 20 20 20 20 28 64 65 62 75   data..    (debu
be60: 67 3a 70 72 69 6e 74 20 34 20 22 43 6f 70 79 69  g:print 4 "Copyi
be70: 6e 67 20 72 65 63 6f 72 64 73 20 69 6e 20 74 65  ng records in te
be80: 73 74 5f 64 61 74 61 20 66 72 6f 6d 20 74 65 73  st_data from tes
be90: 74 5f 69 64 3d 22 20 28 64 62 3a 74 65 73 74 2d  t_id=" (db:test-
bea0: 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 20  get-id testdat) 
beb0: 22 20 74 6f 20 22 20 28 64 62 3a 74 65 73 74 2d  " to " (db:test-
bec0: 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64  get-id new-testd
bed0: 61 74 29 29 0a 09 20 20 20 20 28 73 71 6c 69 74  at))..    (sqlit
bee0: 65 33 3a 65 78 65 63 75 74 65 20 0a 09 20 20 20  e3:execute ..   
bef0: 20 20 64 62 20 0a 09 20 20 20 20 20 28 63 6f 6e    db ..     (con
bf00: 63 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50  c "INSERT OR REP
bf10: 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 74 5f 64  LACE INTO test_d
bf20: 61 74 61 20 28 74 65 73 74 5f 69 64 2c 63 61 74  ata (test_id,cat
bf30: 65 67 6f 72 79 2c 76 61 72 69 61 62 6c 65 2c 76  egory,variable,v
bf40: 61 6c 75 65 2c 65 78 70 65 63 74 65 64 2c 74 6f  alue,expected,to
bf50: 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65 6e 74 29  l,units,comment)
bf60: 20 22 0a 09 09 20 20 20 22 53 45 4c 45 43 54 20   "...   "SELECT 
bf70: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  " (db:test-get-i
bf80: 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20 22  d new-testdat) "
bf90: 2c 63 61 74 65 67 6f 72 79 2c 76 61 72 69 61 62  ,category,variab
bfa0: 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65 63 74 65  le,value,expecte
bfb0: 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d  d,tol,units,comm
bfc0: 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f 64 61  ent FROM test_da
bfd0: 74 61 20 57 48 45 52 45 20 74 65 73 74 5f 69 64  ta WHERE test_id
bfe0: 3d 3f 3b 22 29 0a 09 20 20 20 20 20 28 64 62 3a  =?;")..     (db:
bff0: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74  test-get-id test
c000: 64 61 74 29 29 29 29 0a 09 20 29 29 0a 20 20 20  dat)))).. )).   
c010: 20 20 70 72 65 76 2d 74 65 73 74 73 29 29 29 0a    prev-tests))).
c020: 09 20 0a 20 20 20 20 20 0a                       . .     .