Megatest

Hex Artifact Content
Login

Artifact c387192604cf1e20bc5cc917245dda638003bad2:


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 31 2c 20 4d 61 74 74 68 65 77  06-2011, 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: 20 2e 20 70 61 72 61 6d 73 29 20 3b 3b 20 74 65   . params) ;; te
0460: 73 74 2d 6e 61 6d 65 29 0a 20 20 28 6c 65 74 2a  st-name).  (let*
0470: 20 28 28 6b 65 79 76 61 6c 6c 73 74 20 28 6b 65   ((keyvallst (ke
0480: 79 73 2d 3e 76 61 6c 6c 69 73 74 20 6b 65 79 73  ys->vallist keys
0490: 29 29 0a 09 20 28 74 6d 70 20 20 20 20 20 20 28  )).. (tmp      (
04a0: 72 75 6e 73 3a 67 65 74 2d 73 74 64 2d 72 75 6e  runs:get-std-run
04b0: 2d 66 69 65 6c 64 73 20 6b 65 79 73 20 27 28 22  -fields keys '("
04c0: 69 64 22 20 22 72 75 6e 6e 61 6d 65 22 20 22 73  id" "runname" "s
04d0: 74 61 74 65 22 20 22 73 74 61 74 75 73 22 20 22  tate" "status" "
04e0: 6f 77 6e 65 72 22 20 22 65 76 65 6e 74 5f 74 69  owner" "event_ti
04f0: 6d 65 22 29 29 29 0a 09 20 28 6b 65 79 73 74 72  me"))).. (keystr
0500: 20 20 20 28 63 61 72 20 74 6d 70 29 29 0a 09 20     (car tmp)).. 
0510: 28 68 65 61 64 65 72 20 20 20 28 63 61 64 72 20  (header   (cadr 
0520: 74 6d 70 29 29 0a 09 20 28 72 65 73 20 20 20 20  tmp)).. (res    
0530: 20 27 28 29 29 0a 09 20 28 6b 65 79 2d 70 61 74   '()).. (key-pat
0540: 74 20 22 22 29 29 0a 20 20 20 20 28 66 6f 72 2d  t "")).    (for-
0550: 65 61 63 68 20 28 6c 61 6d 62 64 61 20 28 6b 65  each (lambda (ke
0560: 79 76 61 6c 29 0a 09 09 28 6c 65 74 2a 20 28 28  yval)...(let* ((
0570: 6b 65 79 20 20 20 20 28 76 65 63 74 6f 72 2d 72  key    (vector-r
0580: 65 66 20 6b 65 79 76 61 6c 20 30 29 29 0a 09 09  ef keyval 0))...
0590: 20 20 20 20 20 20 20 28 66 75 6c 6b 65 79 20 28         (fulkey (
05a0: 63 6f 6e 63 20 22 3a 22 20 6b 65 79 29 29 0a 09  conc ":" key))..
05b0: 09 20 20 20 20 20 20 20 28 70 61 74 74 20 20 20  .       (patt   
05c0: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 66 75  (args:get-arg fu
05d0: 6c 6b 65 79 29 29 29 0a 09 09 20 20 28 69 66 20  lkey)))...  (if 
05e0: 70 61 74 74 0a 09 09 20 20 20 20 20 20 28 73 65  patt...      (se
05f0: 74 21 20 6b 65 79 2d 70 61 74 74 20 28 63 6f 6e  t! key-patt (con
0600: 63 20 6b 65 79 2d 70 61 74 74 20 22 20 41 4e 44  c key-patt " AND
0610: 20 22 20 6b 65 79 20 22 20 6c 69 6b 65 20 27 22   " key " like '"
0620: 20 70 61 74 74 20 22 27 22 29 29 0a 09 09 20 20   patt "'"))...  
0630: 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09 28 64      (begin....(d
0640: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
0650: 52 4f 52 3a 20 73 65 61 72 63 68 69 6e 67 20 66  ROR: searching f
0660: 6f 72 20 72 75 6e 73 20 77 69 74 68 20 6e 6f 20  or runs with no 
0670: 70 61 74 74 65 72 6e 20 73 65 74 20 66 6f 72 20  pattern set for 
0680: 22 20 66 75 6c 6b 65 79 29 0a 09 09 09 28 65 78  " fulkey)....(ex
0690: 69 74 20 36 29 29 29 29 29 0a 09 20 20 20 20 20  it 6)))))..     
06a0: 20 6b 65 79 73 29 0a 20 20 20 20 28 73 71 6c 69   keys).    (sqli
06b0: 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77  te3:for-each-row
06c0: 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28   .     (lambda (
06d0: 61 20 2e 20 72 29 0a 20 20 20 20 20 20 20 28 73  a . r).       (s
06e0: 65 74 21 20 72 65 73 20 28 63 6f 6e 73 20 28 6c  et! res (cons (l
06f0: 69 73 74 2d 3e 76 65 63 74 6f 72 20 28 63 6f 6e  ist->vector (con
0700: 73 20 61 20 72 29 29 20 72 65 73 29 29 29 0a 20  s a r)) res))). 
0710: 20 20 20 20 64 62 20 0a 20 20 20 20 20 28 63 6f      db .     (co
0720: 6e 63 20 22 53 45 4c 45 43 54 20 22 20 6b 65 79  nc "SELECT " key
0730: 73 74 72 20 22 20 46 52 4f 4d 20 72 75 6e 73 20  str " FROM runs 
0740: 57 48 45 52 45 20 72 75 6e 6e 61 6d 65 20 6c 69  WHERE runname li
0750: 6b 65 20 3f 20 22 20 6b 65 79 2d 70 61 74 74 20  ke ? " key-patt 
0760: 22 3b 22 29 0a 20 20 20 20 20 72 75 6e 6e 61 6d  ";").     runnam
0770: 65 70 61 74 74 29 0a 20 20 20 20 28 76 65 63 74  epatt).    (vect
0780: 6f 72 20 68 65 61 64 65 72 20 72 65 73 29 29 29  or header res)))
0790: 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a  ..(define (runs:
07a0: 74 65 73 74 2d 67 65 74 2d 66 75 6c 6c 2d 70 61  test-get-full-pa
07b0: 74 68 20 74 65 73 74 29 0a 20 20 28 6c 65 74 2a  th test).  (let*
07c0: 20 28 28 74 65 73 74 6e 61 6d 65 20 28 64 62 3a   ((testname (db:
07d0: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d  test-get-testnam
07e0: 65 20 20 20 74 65 73 74 29 29 0a 09 20 28 69 74  e   test)).. (it
07f0: 65 6d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d  empath (db:test-
0800: 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65  get-item-path te
0810: 73 74 29 29 29 0a 20 20 20 20 28 63 6f 6e 63 20  st))).    (conc 
0820: 74 65 73 74 6e 61 6d 65 20 28 69 66 20 28 65 71  testname (if (eq
0830: 75 61 6c 3f 20 69 74 65 6d 70 61 74 68 20 22 22  ual? itempath ""
0840: 29 20 22 22 20 28 63 6f 6e 63 20 22 28 22 20 69  ) "" (conc "(" i
0850: 74 65 6d 70 61 74 68 20 22 29 22 29 29 29 29 29  tempath ")")))))
0860: 0a 0a 0a 28 64 65 66 69 6e 65 20 28 73 65 74 2d  ...(define (set-
0870: 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72  megatest-env-var
0880: 73 20 64 62 20 72 75 6e 2d 69 64 29 0a 20 20 28  s db run-id).  (
0890: 6c 65 74 20 28 28 6b 65 79 73 20 28 72 64 62 3a  let ((keys (rdb:
08a0: 67 65 74 2d 6b 65 79 73 20 64 62 29 29 29 0a 20  get-keys db))). 
08b0: 20 20 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61     (for-each (la
08c0: 6d 62 64 61 20 28 6b 65 79 29 0a 09 09 28 73 71  mbda (key)...(sq
08d0: 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72  lite3:for-each-r
08e0: 6f 77 0a 09 09 20 28 6c 61 6d 62 64 61 20 28 76  ow... (lambda (v
08f0: 61 6c 29 0a 09 09 20 20 20 28 64 65 62 75 67 3a  al)...   (debug:
0900: 70 72 69 6e 74 20 32 20 22 73 65 74 65 6e 76 20  print 2 "setenv 
0910: 22 20 28 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64  " (key:get-field
0920: 6e 61 6d 65 20 6b 65 79 29 20 22 20 22 20 76 61  name key) " " va
0930: 6c 29 0a 09 09 20 20 20 28 73 65 74 65 6e 76 20  l)...   (setenv 
0940: 28 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61  (key:get-fieldna
0950: 6d 65 20 6b 65 79 29 20 76 61 6c 29 29 0a 09 09  me key) val))...
0960: 20 64 62 20 0a 09 09 20 28 63 6f 6e 63 20 22 53   db ... (conc "S
0970: 45 4c 45 43 54 20 22 20 28 6b 65 79 3a 67 65 74  ELECT " (key:get
0980: 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79 29 20  -fieldname key) 
0990: 22 20 46 52 4f 4d 20 72 75 6e 73 20 57 48 45 52  " FROM runs WHER
09a0: 45 20 69 64 3d 3f 3b 22 29 0a 09 09 20 72 75 6e  E id=?;")... run
09b0: 2d 69 64 29 29 0a 09 20 20 20 20 20 20 6b 65 79  -id))..      key
09c0: 73 29 0a 20 20 20 20 28 61 6c 69 73 74 2d 3e 65  s).    (alist->e
09d0: 6e 76 2d 76 61 72 73 20 28 68 61 73 68 2d 74 61  nv-vars (hash-ta
09e0: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20  ble-ref/default 
09f0: 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 65 6e 76  *configdat* "env
0a00: 2d 6f 76 65 72 72 69 64 65 22 20 27 28 29 29 29  -override" '()))
0a10: 0a 20 20 20 20 3b 3b 20 4c 65 74 73 20 75 73 65  .    ;; Lets use
0a20: 20 74 68 69 73 20 61 73 20 61 6e 20 6f 70 70 6f   this as an oppo
0a30: 72 74 75 6e 69 74 79 20 74 6f 20 70 75 74 20 4d  rtunity to put M
0a40: 54 5f 52 55 4e 4e 41 4d 45 20 69 6e 20 74 68 65  T_RUNNAME in the
0a50: 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 20 20 20   environment.   
0a60: 20 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61   (sqlite3:for-ea
0a70: 63 68 2d 72 6f 77 0a 20 20 20 20 20 28 6c 61 6d  ch-row.     (lam
0a80: 62 64 61 20 28 72 75 6e 6e 61 6d 65 29 0a 20 20  bda (runname).  
0a90: 20 20 20 20 20 28 73 65 74 65 6e 76 20 22 4d 54       (setenv "MT
0aa0: 5f 52 55 4e 4e 41 4d 45 22 20 72 75 6e 6e 61 6d  _RUNNAME" runnam
0ab0: 65 29 29 0a 20 20 20 20 20 64 62 0a 20 20 20 20  e)).     db.    
0ac0: 20 22 53 45 4c 45 43 54 20 72 75 6e 6e 61 6d 65   "SELECT runname
0ad0: 20 46 52 4f 4d 20 72 75 6e 73 20 57 48 45 52 45   FROM runs WHERE
0ae0: 20 69 64 3d 3f 3b 22 0a 20 20 20 20 20 72 75 6e   id=?;".     run
0af0: 2d 69 64 29 0a 20 20 20 20 29 29 0a 0a 28 64 65  -id).    ))..(de
0b00: 66 69 6e 65 20 28 73 65 74 2d 69 74 65 6d 2d 65  fine (set-item-e
0b10: 6e 76 2d 76 61 72 73 20 69 74 65 6d 64 61 74 29  nv-vars itemdat)
0b20: 0a 20 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61  .  (for-each (la
0b30: 6d 62 64 61 20 28 69 74 65 6d 29 0a 09 20 20 20  mbda (item)..   
0b40: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
0b50: 32 20 22 73 65 74 65 6e 76 20 22 20 28 63 61 72  2 "setenv " (car
0b60: 20 69 74 65 6d 29 20 22 20 22 20 28 63 61 64 72   item) " " (cadr
0b70: 20 69 74 65 6d 29 29 0a 09 20 20 20 20 20 20 28   item))..      (
0b80: 73 65 74 65 6e 76 20 28 63 61 72 20 69 74 65 6d  setenv (car item
0b90: 29 20 28 63 61 64 72 20 69 74 65 6d 29 29 29 0a  ) (cadr item))).
0ba0: 09 20 20 20 20 69 74 65 6d 64 61 74 29 29 0a 0a  .    itemdat))..
0bb0: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 63 61  (define (runs:ca
0bc0: 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73  n-run-more-tests
0bd0: 20 64 62 20 74 65 73 74 2d 72 65 63 6f 72 64 29   db test-record)
0be0: 0a 20 20 28 6c 65 74 2a 20 28 28 74 63 6f 6e 66  .  (let* ((tconf
0bf0: 69 67 20 20 20 20 20 20 20 20 20 20 20 20 20 20  ig              
0c00: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75     (tests:testqu
0c10: 65 75 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66  eue-get-testconf
0c20: 69 67 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29  ig test-record))
0c30: 0a 09 20 28 6a 6f 62 67 72 6f 75 70 20 20 20 20  .. (jobgroup    
0c40: 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e              (con
0c50: 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 63 6f 6e 66  fig-lookup tconf
0c60: 69 67 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73  ig "requirements
0c70: 22 20 22 6a 6f 62 67 72 6f 75 70 22 29 29 0a 09  " "jobgroup"))..
0c80: 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 20 20   (num-running   
0c90: 20 20 20 20 20 20 20 20 20 20 28 64 62 3a 67 65            (db:ge
0ca0: 74 2d 63 6f 75 6e 74 2d 74 65 73 74 73 2d 72 75  t-count-tests-ru
0cb0: 6e 6e 69 6e 67 20 64 62 29 29 0a 09 20 28 6e 75  nning db)).. (nu
0cc0: 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62  m-running-in-job
0cd0: 67 72 6f 75 70 20 28 64 62 3a 67 65 74 2d 63 6f  group (db:get-co
0ce0: 75 6e 74 2d 74 65 73 74 73 2d 72 75 6e 6e 69 6e  unt-tests-runnin
0cf0: 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 64 62  g-in-jobgroup db
0d00: 20 6a 6f 62 67 72 6f 75 70 29 29 0a 09 20 28 6d   jobgroup)).. (m
0d10: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f  ax-concurrent-jo
0d20: 62 73 20 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c  bs     (config-l
0d30: 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 74  ookup *configdat
0d40: 2a 20 22 73 65 74 75 70 22 20 20 20 20 20 22 6d  * "setup"     "m
0d50: 61 78 5f 63 6f 6e 63 75 72 72 65 6e 74 5f 6a 6f  ax_concurrent_jo
0d60: 62 73 22 29 29 0a 09 20 28 6a 6f 62 2d 67 72 6f  bs")).. (job-gro
0d70: 75 70 2d 6c 69 6d 69 74 20 20 20 20 20 20 20 20  up-limit        
0d80: 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20   (config-lookup 
0d90: 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 6a 6f 62  *configdat* "job
0da0: 67 72 6f 75 70 73 22 20 6a 6f 62 67 72 6f 75 70  groups" jobgroup
0db0: 29 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70  ))).    (debug:p
0dc0: 72 69 6e 74 20 32 20 22 6d 61 78 2d 63 6f 6e 63  rint 2 "max-conc
0dd0: 75 72 72 65 6e 74 2d 6a 6f 62 73 3a 20 22 20 6d  urrent-jobs: " m
0de0: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f  ax-concurrent-jo
0df0: 62 73 20 22 2c 20 6e 75 6d 2d 72 75 6e 6e 69 6e  bs ", num-runnin
0e00: 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67  g: " num-running
0e10: 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28  ).    (if (not (
0e20: 65 71 3f 20 30 20 2a 67 6c 6f 62 61 6c 65 78 69  eq? 0 *globalexi
0e30: 74 73 74 61 74 75 73 2a 29 29 0a 09 23 66 0a 09  tstatus*))..#f..
0e40: 28 6c 65 74 20 28 28 63 61 6e 2d 6e 6f 74 2d 72  (let ((can-not-r
0e50: 75 6e 2d 6d 6f 72 65 20 28 63 6f 6e 64 0a 09 09  un-more (cond...
0e60: 09 09 20 3b 3b 20 69 66 20 6d 61 78 2d 63 6f 6e  .. ;; if max-con
0e70: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 69 73 20  current-jobs is 
0e80: 73 65 74 20 61 6e 64 20 74 68 65 20 6e 75 6d 62  set and the numb
0e90: 65 72 20 72 75 6e 6e 69 6e 67 20 69 73 20 67 72  er running is gr
0ea0: 65 61 74 65 72 20 0a 09 09 09 09 20 3b 3b 20 74  eater ..... ;; t
0eb0: 68 61 6e 20 69 74 20 74 68 61 6e 20 63 61 6e 6e  han it than cann
0ec0: 6f 74 20 72 75 6e 20 6d 6f 72 65 20 6a 6f 62 73  ot run more jobs
0ed0: 0a 09 09 09 09 20 28 28 61 6e 64 20 6d 61 78 2d  ..... ((and max-
0ee0: 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 0a  concurrent-jobs.
0ef0: 09 09 09 09 20 20 20 20 20 20 20 28 73 74 72 69  ....       (stri
0f00: 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 61 78 2d 63  ng->number max-c
0f10: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 29 0a  oncurrent-jobs).
0f20: 09 09 09 09 20 20 20 20 20 20 20 28 3e 3d 20 6e  ....       (>= n
0f30: 75 6d 2d 72 75 6e 6e 69 6e 67 20 28 73 74 72 69  um-running (stri
0f40: 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 61 78 2d 63  ng->number max-c
0f50: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 29 29  oncurrent-jobs))
0f60: 29 0a 09 09 09 09 20 20 28 64 65 62 75 67 3a 70  ).....  (debug:p
0f70: 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a  rint 0 "WARNING:
0f80: 20 4d 61 78 20 72 75 6e 6e 69 6e 67 20 6a 6f 62   Max running job
0f90: 73 20 65 78 63 65 65 64 65 64 2c 20 63 75 72 72  s exceeded, curr
0fa0: 65 6e 74 20 6e 75 6d 62 65 72 20 72 75 6e 6e 69  ent number runni
0fb0: 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e  ng: " num-runnin
0fc0: 67 20 0a 09 09 09 09 09 20 20 20 20 20 20 20 22  g ......       "
0fd0: 2c 20 6d 61 78 5f 63 6f 6e 63 75 72 72 65 6e 74  , max_concurrent
0fe0: 5f 6a 6f 62 73 3a 20 22 20 6d 61 78 2d 63 6f 6e  _jobs: " max-con
0ff0: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 29 0a 09 09  current-jobs)...
1000: 09 09 20 20 23 74 29 0a 09 09 09 09 20 3b 3b 20  ..  #t)..... ;; 
1010: 69 66 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d  if job-group-lim
1020: 69 74 20 69 73 20 73 65 74 20 61 6e 64 20 6e 75  it is set and nu
1030: 6d 62 65 72 20 6f 66 20 6a 6f 62 73 20 69 6e 20  mber of jobs in 
1040: 74 68 65 20 67 72 6f 75 70 20 69 73 20 67 72 65  the group is gre
1050: 61 74 65 72 0a 09 09 09 09 20 3b 3b 20 74 68 61  ater..... ;; tha
1060: 6e 20 74 68 65 20 6c 69 6d 69 74 20 74 68 65 6e  n the limit then
1070: 20 63 61 6e 6e 6f 74 20 72 75 6e 20 6d 6f 72 65   cannot run more
1080: 20 6a 6f 62 73 20 6f 66 20 74 68 69 73 20 6b 69   jobs of this ki
1090: 6e 64 0a 09 09 09 09 20 28 28 61 6e 64 20 6a 6f  nd..... ((and jo
10a0: 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 0a 09 09  b-group-limit...
10b0: 09 09 20 20 20 20 20 20 20 28 3e 3d 20 6e 75 6d  ..       (>= num
10c0: 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67  -running-in-jobg
10d0: 72 6f 75 70 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c  roup job-group-l
10e0: 69 6d 69 74 29 29 0a 09 09 09 09 20 20 28 64 65  imit)).....  (de
10f0: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 57 41 52  bug:print 1 "WAR
1100: 4e 49 4e 47 3a 20 6e 75 6d 62 65 72 20 6f 66 20  NING: number of 
1110: 6a 6f 62 73 20 22 20 6e 75 6d 2d 72 75 6e 6e 69  jobs " num-runni
1120: 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 0a  ng-in-jobgroup .
1130: 09 09 09 09 09 20 20 20 20 20 20 20 22 20 69 6e  .....       " in
1140: 20 22 20 6a 6f 62 67 72 6f 75 70 20 22 20 65 78   " jobgroup " ex
1150: 63 65 65 64 65 64 2c 20 77 69 6c 6c 20 6e 6f 74  ceeded, will not
1160: 20 72 75 6e 20 22 20 28 74 65 73 74 73 3a 74 65   run " (tests:te
1170: 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74  stqueue-get-test
1180: 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64  name test-record
1190: 29 29 0a 09 09 09 09 20 20 23 74 29 0a 09 09 09  )).....  #t)....
11a0: 09 20 28 65 6c 73 65 20 23 66 29 29 29 29 0a 09  . (else #f))))..
11b0: 20 20 28 6e 6f 74 20 63 61 6e 2d 6e 6f 74 2d 72    (not can-not-r
11c0: 75 6e 2d 6d 6f 72 65 29 29 29 29 29 0a 0a 3b 3b  un-more)))))..;;
11d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
11e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
11f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1200: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1210: 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4e 65 77 20 6d 65  ======.;; New me
1220: 74 68 6f 64 6f 6c 6f 67 79 2e 20 54 68 65 73 65  thodology. These
1230: 20 72 6f 75 74 69 6e 65 73 20 77 69 6c 6c 20 72   routines will r
1240: 65 70 6c 61 63 65 20 74 68 65 20 61 62 6f 76 65  eplace the above
1250: 20 69 6e 20 74 69 6d 65 2e 20 46 6f 72 0a 3b 3b   in time. For.;;
1260: 20 6e 6f 77 20 74 68 65 20 63 6f 64 65 20 69 73   now the code is
1270: 20 64 75 70 6c 69 63 61 74 65 64 2e 20 54 68 69   duplicated. Thi
1280: 73 20 73 74 75 66 66 20 69 73 20 69 6e 69 74 69  s stuff is initi
1290: 61 6c 6c 79 20 75 73 65 64 20 69 6e 20 74 68 65  ally used in the
12a0: 20 6d 6f 6e 69 74 6f 72 0a 3b 3b 20 62 61 73 65   monitor.;; base
12b0: 64 20 63 6f 64 65 2e 0a 3b 3b 3d 3d 3d 3d 3d 3d  d code..;;======
12c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
12d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
12e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
12f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1300: 0a 0a 3b 3b 20 72 65 67 69 73 74 65 72 20 61 20  ..;; register a 
1310: 74 65 73 74 20 72 75 6e 20 77 69 74 68 20 74 68  test run with th
1320: 65 20 64 62 0a 28 64 65 66 69 6e 65 20 28 72 75  e db.(define (ru
1330: 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75 6e 20  ns:register-run 
1340: 64 62 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73  db keys keyvalls
1350: 74 20 72 75 6e 6e 61 6d 65 20 73 74 61 74 65 20  t runname state 
1360: 73 74 61 74 75 73 20 75 73 65 72 29 0a 20 20 28  status user).  (
1370: 64 65 62 75 67 3a 70 72 69 6e 74 20 33 20 22 72  debug:print 3 "r
1380: 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75 6e  uns:register-run
1390: 2c 20 6b 65 79 73 3a 20 22 20 6b 65 79 73 20 22  , keys: " keys "
13a0: 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65   keyvallst: " ke
13b0: 79 76 61 6c 6c 73 74 20 22 20 72 75 6e 6e 61 6d  yvallst " runnam
13c0: 65 3a 20 22 20 72 75 6e 6e 61 6d 65 20 22 20 73  e: " runname " s
13d0: 74 61 74 65 3a 20 22 20 73 74 61 74 65 20 22 20  tate: " state " 
13e0: 73 74 61 74 75 73 3a 20 22 20 73 74 61 74 75 73  status: " status
13f0: 20 22 20 75 73 65 72 3a 20 22 20 75 73 65 72 29   " user: " user)
1400: 0a 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73 74  .  (let* ((keyst
1410: 72 20 20 20 20 28 6b 65 79 73 2d 3e 6b 65 79 73  r    (keys->keys
1420: 74 72 20 6b 65 79 73 29 29 0a 09 20 28 63 6f 6d  tr keys)).. (com
1430: 6d 61 20 20 20 20 20 28 69 66 20 28 3e 20 28 6c  ma     (if (> (l
1440: 65 6e 67 74 68 20 6b 65 79 73 29 20 30 29 20 22  ength keys) 0) "
1450: 2c 22 20 22 22 29 29 0a 09 20 28 61 6e 64 73 74  ," "")).. (andst
1460: 72 20 20 20 20 28 69 66 20 28 3e 20 28 6c 65 6e  r    (if (> (len
1470: 67 74 68 20 6b 65 79 73 29 20 30 29 20 22 20 41  gth keys) 0) " A
1480: 4e 44 20 22 20 22 22 29 29 0a 09 20 28 76 61 6c  ND " "")).. (val
1490: 73 6c 6f 74 73 20 20 28 6b 65 79 73 2d 3e 76 61  slots  (keys->va
14a0: 6c 73 6c 6f 74 73 20 6b 65 79 73 29 29 20 3b 3b  lslots keys)) ;;
14b0: 20 3f 2c 3f 2c 3f 20 2e 2e 2e 0a 09 20 28 6b 65   ?,?,? ..... (ke
14c0: 79 76 61 6c 73 20 20 20 28 6d 61 70 20 63 61 64  yvals   (map cad
14d0: 72 20 6b 65 79 76 61 6c 6c 73 74 29 29 0a 09 20  r keyvallst)).. 
14e0: 28 61 6c 6c 76 61 6c 73 20 20 20 28 61 70 70 65  (allvals   (appe
14f0: 6e 64 20 28 6c 69 73 74 20 72 75 6e 6e 61 6d 65  nd (list runname
1500: 20 73 74 61 74 65 20 73 74 61 74 75 73 20 75 73   state status us
1510: 65 72 29 20 6b 65 79 76 61 6c 73 29 29 0a 09 20  er) keyvals)).. 
1520: 28 71 72 79 76 61 6c 73 20 20 20 28 61 70 70 65  (qryvals   (appe
1530: 6e 64 20 28 6c 69 73 74 20 72 75 6e 6e 61 6d 65  nd (list runname
1540: 29 20 6b 65 79 76 61 6c 73 29 29 0a 09 20 28 6b  ) keyvals)).. (k
1550: 65 79 3d 3f 73 74 72 20 20 28 73 74 72 69 6e 67  ey=?str  (string
1560: 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61  -intersperse (ma
1570: 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 28 63 6f  p (lambda (k)(co
1580: 6e 63 20 28 6b 65 79 3a 67 65 74 2d 66 69 65 6c  nc (key:get-fiel
1590: 64 6e 61 6d 65 20 6b 29 20 22 3d 3f 22 29 29 20  dname k) "=?")) 
15a0: 6b 65 79 73 29 20 22 20 41 4e 44 20 22 29 29 29  keys) " AND ")))
15b0: 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  .    (debug:prin
15c0: 74 20 33 20 22 6b 65 79 73 3a 20 22 20 6b 65 79  t 3 "keys: " key
15d0: 73 20 22 20 61 6c 6c 76 61 6c 73 3a 20 22 20 61  s " allvals: " a
15e0: 6c 6c 76 61 6c 73 20 22 20 6b 65 79 76 61 6c 73  llvals " keyvals
15f0: 3a 20 22 20 6b 65 79 76 61 6c 73 29 0a 20 20 20  : " keyvals).   
1600: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20   (debug:print 2 
1610: 22 4e 4f 54 45 3a 20 75 73 69 6e 67 20 74 61 72  "NOTE: using tar
1620: 67 65 74 20 22 20 28 73 74 72 69 6e 67 2d 69 6e  get " (string-in
1630: 74 65 72 73 70 65 72 73 65 20 6b 65 79 76 61 6c  tersperse keyval
1640: 73 20 22 2f 22 29 20 22 20 66 6f 72 20 74 68 69  s "/") " for thi
1650: 73 20 72 75 6e 22 29 0a 20 20 20 20 28 69 66 20  s run").    (if 
1660: 28 61 6e 64 20 72 75 6e 6e 61 6d 65 20 28 6e 75  (and runname (nu
1670: 6c 6c 3f 20 28 66 69 6c 74 65 72 20 28 6c 61 6d  ll? (filter (lam
1680: 62 64 61 20 28 78 29 28 6e 6f 74 20 78 29 29 20  bda (x)(not x)) 
1690: 6b 65 79 76 61 6c 73 29 29 29 20 3b 3b 20 74 68  keyvals))) ;; th
16a0: 65 72 65 20 6d 75 73 74 20 62 65 20 61 20 62 65  ere must be a be
16b0: 74 74 65 72 20 77 61 79 20 74 6f 20 22 61 70 70  tter way to "app
16c0: 6c 79 20 61 6e 64 22 0a 09 28 6c 65 74 20 28 28  ly and"..(let ((
16d0: 72 65 73 20 23 66 29 29 0a 09 20 20 28 61 70 70  res #f))..  (app
16e0: 6c 79 20 73 71 6c 69 74 65 33 3a 65 78 65 63 75  ly sqlite3:execu
16f0: 74 65 20 64 62 20 28 63 6f 6e 63 20 22 49 4e 53  te db (conc "INS
1700: 45 52 54 20 4f 52 20 49 47 4e 4f 52 45 20 49 4e  ERT OR IGNORE IN
1710: 54 4f 20 72 75 6e 73 20 28 72 75 6e 6e 61 6d 65  TO runs (runname
1720: 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c 6f 77  ,state,status,ow
1730: 6e 65 72 2c 65 76 65 6e 74 5f 74 69 6d 65 22 20  ner,event_time" 
1740: 63 6f 6d 6d 61 20 6b 65 79 73 74 72 20 22 29 20  comma keystr ") 
1750: 56 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c  VALUES (?,?,?,?,
1760: 73 74 72 66 74 69 6d 65 28 27 25 73 27 2c 27 6e  strftime('%s','n
1770: 6f 77 27 29 22 20 63 6f 6d 6d 61 20 76 61 6c 73  ow')" comma vals
1780: 6c 6f 74 73 20 22 29 3b 22 29 0a 09 09 20 61 6c  lots ");")... al
1790: 6c 76 61 6c 73 29 0a 09 20 20 28 61 70 70 6c 79  lvals)..  (apply
17a0: 20 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63   sqlite3:for-eac
17b0: 68 2d 72 6f 77 20 0a 09 20 20 20 28 6c 61 6d 62  h-row ..   (lamb
17c0: 64 61 20 28 69 64 29 0a 09 20 20 20 20 20 28 73  da (id)..     (s
17d0: 65 74 21 20 72 65 73 20 69 64 29 29 0a 09 20 20  et! res id))..  
17e0: 20 64 62 0a 09 20 20 20 28 6c 65 74 20 28 28 71   db..   (let ((q
17f0: 72 79 20 28 63 6f 6e 63 20 22 53 45 4c 45 43 54  ry (conc "SELECT
1800: 20 69 64 20 46 52 4f 4d 20 72 75 6e 73 20 57 48   id FROM runs WH
1810: 45 52 45 20 28 72 75 6e 6e 61 6d 65 3d 3f 20 22  ERE (runname=? "
1820: 20 61 6e 64 73 74 72 20 6b 65 79 3d 3f 73 74 72   andstr key=?str
1830: 20 22 29 3b 22 29 29 29 0a 09 20 20 20 20 20 3b   ");")))..     ;
1840: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22  (debug:print 4 "
1850: 71 72 79 3a 20 22 20 71 72 79 29 20 0a 09 20 20  qry: " qry) ..  
1860: 20 20 20 71 72 79 29 0a 09 20 20 20 71 72 79 76     qry)..   qryv
1870: 61 6c 73 29 0a 09 20 20 28 73 71 6c 69 74 65 33  als)..  (sqlite3
1880: 3a 65 78 65 63 75 74 65 20 64 62 20 22 55 50 44  :execute db "UPD
1890: 41 54 45 20 72 75 6e 73 20 53 45 54 20 73 74 61  ATE runs SET sta
18a0: 74 65 3d 3f 2c 73 74 61 74 75 73 3d 3f 20 57 48  te=?,status=? WH
18b0: 45 52 45 20 69 64 3d 3f 3b 22 20 73 74 61 74 65  ERE id=?;" state
18c0: 20 73 74 61 74 75 73 20 72 65 73 29 0a 09 20 20   status res)..  
18d0: 72 65 73 29 20 0a 09 28 62 65 67 69 6e 0a 09 20  res) ..(begin.. 
18e0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
18f0: 22 45 52 52 4f 52 3a 20 43 61 6c 6c 65 64 20 77  "ERROR: Called w
1900: 69 74 68 6f 75 74 20 61 6c 6c 20 6e 65 63 65 73  ithout all neces
1910: 73 61 72 79 20 6b 65 79 73 22 29 0a 09 20 20 23  sary keys")..  #
1920: 66 29 29 29 29 0a 0a 3b 3b 20 54 68 69 73 20 69  f))))..;; This i
1930: 73 20 61 20 64 75 70 6c 69 63 61 74 65 20 6f 66  s a duplicate of
1940: 20 72 75 6e 2d 74 65 73 74 73 20 28 77 68 69 63   run-tests (whic
1950: 68 20 68 61 73 20 62 65 65 6e 20 64 65 70 72 65  h has been depre
1960: 63 61 74 65 64 29 2e 20 55 73 65 20 74 68 69 73  cated). Use this
1970: 20 6f 6e 65 20 69 6e 73 74 65 61 64 20 6f 66 20   one instead of 
1980: 72 75 6e 20 74 65 73 74 73 2e 0a 3b 3b 20 6b 65  run tests..;; ke
1990: 79 76 61 6c 73 0a 28 64 65 66 69 6e 65 20 28 72  yvals.(define (r
19a0: 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 20 64 62  uns:run-tests db
19b0: 20 74 61 72 67 65 74 20 72 75 6e 6e 61 6d 65 20   target runname 
19c0: 74 65 73 74 2d 70 61 74 74 73 20 75 73 65 72 20  test-patts user 
19d0: 66 6c 61 67 73 29 0a 20 20 28 6c 65 74 2a 20 28  flags).  (let* (
19e0: 28 6b 65 79 73 20 20 20 20 20 20 20 20 28 72 64  (keys        (rd
19f0: 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a  b:get-keys db)).
1a00: 09 20 28 6b 65 79 76 61 6c 6c 73 74 20 20 20 28  . (keyvallst   (
1a10: 6b 65 79 73 3a 74 61 72 67 65 74 2d 3e 6b 65 79  keys:target->key
1a20: 76 61 6c 20 6b 65 79 73 20 74 61 72 67 65 74 29  val keys target)
1a30: 29 0a 09 20 28 72 75 6e 2d 69 64 20 20 20 20 20  ).. (run-id     
1a40: 20 28 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d   (runs:register-
1a50: 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76  run db keys keyv
1a60: 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e  allst runname "n
1a70: 65 77 22 20 22 6e 2f 61 22 20 75 73 65 72 29 29  ew" "n/a" user))
1a80: 20 20 3b 3b 20 20 74 65 73 74 2d 6e 61 6d 65 29    ;;  test-name)
1a90: 29 29 0a 09 20 28 64 65 66 65 72 72 65 64 20 20  )).. (deferred  
1aa0: 20 20 27 28 29 29 20 3b 3b 20 64 65 6c 61 79 20    '()) ;; delay 
1ab0: 72 75 6e 6e 69 6e 67 20 74 68 65 73 65 20 73 69  running these si
1ac0: 6e 63 65 20 74 68 65 79 20 68 61 76 65 20 61 20  nce they have a 
1ad0: 77 61 69 74 6f 6e 20 63 6c 61 75 73 65 0a 09 20  waiton clause.. 
1ae0: 3b 3b 20 6b 65 65 70 67 6f 69 6e 67 20 69 73 20  ;; keepgoing is 
1af0: 74 68 65 20 64 65 66 61 63 74 6f 20 6d 6f 64 61  the defacto moda
1b00: 6c 69 74 79 20 6e 6f 77 2c 20 77 69 6c 6c 20 61  lity now, will a
1b10: 64 64 20 68 69 74 2d 6e 2d 72 75 6e 20 61 20 62  dd hit-n-run a b
1b20: 69 74 20 6c 61 74 65 72 0a 09 20 3b 3b 20 28 6b  it later.. ;; (k
1b30: 65 65 70 67 6f 69 6e 67 20 20 20 28 68 61 73 68  eepgoing   (hash
1b40: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75  -table-ref/defau
1b50: 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 65 70 67  lt flags "-keepg
1b60: 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 28 74 65  oing" #f)).. (te
1b70: 73 74 2d 6e 61 6d 65 73 20 20 27 28 29 29 0a 09  st-names  '())..
1b80: 20 28 72 75 6e 63 6f 6e 66 69 67 66 20 20 20 28   (runconfigf   (
1b90: 63 6f 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a 20  conc  *toppath* 
1ba0: 22 2f 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e  "/runconfigs.con
1bb0: 66 69 67 22 29 29 0a 09 20 28 72 65 71 75 69 72  fig")).. (requir
1bc0: 65 64 2d 74 65 73 74 73 20 27 28 29 29 0a 09 20  ed-tests '()).. 
1bd0: 28 74 65 73 74 2d 72 65 63 6f 72 64 73 20 28 6d  (test-records (m
1be0: 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29  ake-hash-table))
1bf0: 29 0a 0a 20 20 20 20 28 73 65 74 2d 6d 65 67 61  )..    (set-mega
1c00: 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 64 62  test-env-vars db
1c10: 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73   run-id) ;; thes
1c20: 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64 20  e may be needed 
1c30: 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e 67  by the launching
1c40: 20 70 72 6f 63 65 73 73 0a 0a 20 20 20 20 28 69   process..    (i
1c50: 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20  f (file-exists? 
1c60: 72 75 6e 63 6f 6e 66 69 67 66 29 0a 09 28 73 65  runconfigf)..(se
1c70: 74 75 70 2d 65 6e 76 2d 64 65 66 61 75 6c 74 73  tup-env-defaults
1c80: 20 64 62 20 72 75 6e 63 6f 6e 66 69 67 66 20 72   db runconfigf r
1c90: 75 6e 2d 69 64 20 2a 61 6c 72 65 61 64 79 2d 73  un-id *already-s
1ca0: 65 65 6e 2d 72 75 6e 63 6f 6e 66 69 67 2d 69 6e  een-runconfig-in
1cb0: 66 6f 2a 20 22 70 72 65 2d 6c 61 75 6e 63 68 2d  fo* "pre-launch-
1cc0: 65 6e 76 2d 76 61 72 73 22 29 0a 09 28 64 65 62  env-vars")..(deb
1cd0: 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e  ug:print 0 "WARN
1ce0: 49 4e 47 3a 20 59 6f 75 20 64 6f 20 6e 6f 74 20  ING: You do not 
1cf0: 68 61 76 65 20 61 20 72 75 6e 20 63 6f 6e 66 69  have a run confi
1d00: 67 20 66 69 6c 65 3a 20 22 20 72 75 6e 63 6f 6e  g file: " runcon
1d10: 66 69 67 66 29 29 0a 20 20 20 20 0a 20 20 20 20  figf)).    .    
1d20: 3b 3b 20 6c 6f 6f 6b 20 75 70 20 61 6c 6c 20 74  ;; look up all t
1d30: 65 73 74 73 20 6d 61 74 63 68 69 6e 67 20 74 68  ests matching th
1d40: 65 20 63 6f 6d 6d 61 20 73 65 70 61 72 61 74 65  e comma separate
1d50: 64 20 6c 69 73 74 20 6f 66 20 67 6c 6f 62 73 20  d list of globs 
1d60: 69 6e 0a 20 20 20 20 3b 3b 20 74 65 73 74 2d 70  in.    ;; test-p
1d70: 61 74 74 73 20 28 75 73 69 6e 67 20 25 20 61 73  atts (using % as
1d80: 20 77 69 6c 64 63 61 72 64 29 0a 20 20 20 20 28   wildcard).    (
1d90: 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28  for-each .     (
1da0: 6c 61 6d 62 64 61 20 28 70 61 74 74 29 0a 20 20  lambda (patt).  
1db0: 20 20 20 20 20 28 6c 65 74 20 28 28 74 65 73 74       (let ((test
1dc0: 73 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20 2a 74  s (glob (conc *t
1dd0: 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f  oppath* "/tests/
1de0: 22 20 28 73 74 72 69 6e 67 2d 74 72 61 6e 73 6c  " (string-transl
1df0: 61 74 65 20 70 61 74 74 20 22 25 22 20 22 2a 22  ate patt "%" "*"
1e00: 29 29 29 29 29 0a 09 20 28 73 65 74 21 20 74 65  ))))).. (set! te
1e10: 73 74 73 20 28 66 69 6c 74 65 72 20 28 6c 61 6d  sts (filter (lam
1e20: 62 64 61 20 28 74 65 73 74 29 28 66 69 6c 65 2d  bda (test)(file-
1e30: 65 78 69 73 74 73 3f 20 28 63 6f 6e 63 20 74 65  exists? (conc te
1e40: 73 74 20 22 2f 74 65 73 74 63 6f 6e 66 69 67 22  st "/testconfig"
1e50: 29 29 29 20 74 65 73 74 73 29 29 0a 09 20 28 73  ))) tests)).. (s
1e60: 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 28  et! test-names (
1e70: 61 70 70 65 6e 64 20 74 65 73 74 2d 6e 61 6d 65  append test-name
1e80: 73 20 0a 09 09 09 09 20 20 28 6d 61 70 20 28 6c  s .....  (map (l
1e90: 61 6d 62 64 61 20 28 74 65 73 74 70 29 0a 09 09  ambda (testp)...
1ea0: 09 09 09 20 28 6c 61 73 74 20 28 73 74 72 69 6e  ... (last (strin
1eb0: 67 2d 73 70 6c 69 74 20 74 65 73 74 70 20 22 2f  g-split testp "/
1ec0: 22 29 29 29 0a 09 09 09 09 20 20 20 20 20 20 20  "))).....       
1ed0: 74 65 73 74 73 29 29 29 29 29 0a 20 20 20 20 20  tests))))).     
1ee0: 28 69 66 20 74 65 73 74 2d 70 61 74 74 73 20 28  (if test-patts (
1ef0: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 74 65 73  string-split tes
1f00: 74 2d 70 61 74 74 73 20 22 2c 22 29 28 6c 69 73  t-patts ",")(lis
1f10: 74 20 22 25 22 29 29 29 0a 0a 20 20 20 20 20 3b  t "%")))..     ;
1f20: 3b 20 6e 6f 77 20 72 65 6d 6f 76 65 20 64 75 70  ; now remove dup
1f30: 6c 69 63 61 74 65 73 0a 20 20 20 20 28 73 65 74  licates.    (set
1f40: 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 28 64 65  ! test-names (de
1f50: 6c 65 74 65 2d 64 75 70 6c 69 63 61 74 65 73 20  lete-duplicates 
1f60: 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 0a 20 20  test-names))..  
1f70: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
1f80: 20 22 49 4e 46 4f 3a 20 74 65 73 74 20 6e 61 6d   "INFO: test nam
1f90: 65 73 20 22 20 74 65 73 74 2d 6e 61 6d 65 73 29  es " test-names)
1fa0: 0a 0a 20 20 20 20 3b 3b 20 6f 6e 20 74 68 65 20  ..    ;; on the 
1fb0: 66 69 72 73 74 20 70 61 73 73 20 6f 72 20 63 61  first pass or ca
1fc0: 6c 6c 20 74 6f 20 72 75 6e 2d 74 65 73 74 73 20  ll to run-tests 
1fd0: 73 65 74 20 46 41 49 4c 53 20 74 6f 20 4e 4f 54  set FAILS to NOT
1fe0: 5f 53 54 41 52 54 45 44 20 69 66 0a 20 20 20 20  _STARTED if.    
1ff0: 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 20 69 73  ;; -keepgoing is
2000: 20 73 70 65 63 69 66 69 65 64 0a 20 20 20 20 28   specified.    (
2010: 69 66 20 28 65 71 3f 20 2a 70 61 73 73 6e 75 6d  if (eq? *passnum
2020: 2a 20 30 29 0a 09 28 62 65 67 69 6e 0a 09 20 20  * 0)..(begin..  
2030: 3b 3b 20 68 61 76 65 20 74 6f 20 64 65 6c 65 74  ;; have to delet
2040: 65 20 74 65 73 74 20 72 65 63 6f 72 64 73 20 77  e test records w
2050: 68 65 72 65 20 4e 4f 54 5f 53 54 41 52 54 45 44  here NOT_STARTED
2060: 20 73 69 6e 63 65 20 74 68 65 79 20 63 61 6e 20   since they can 
2070: 63 61 75 73 65 20 2d 6b 65 65 70 67 6f 69 6e 67  cause -keepgoing
2080: 20 74 6f 20 0a 09 20 20 3b 3b 20 67 65 74 20 73   to ..  ;; get s
2090: 74 75 63 6b 20 64 75 65 20 74 6f 20 62 65 63 6f  tuck due to beco
20a0: 6d 69 6e 67 20 69 6e 61 63 63 65 73 73 69 62 6c  ming inaccessibl
20b0: 65 20 66 72 6f 6d 20 61 20 66 61 69 6c 65 64 20  e from a failed 
20c0: 74 65 73 74 2e 20 49 2e 65 2e 20 69 66 20 74 65  test. I.e. if te
20d0: 73 74 20 42 20 64 65 70 65 6e 64 73 20 0a 09 20  st B depends .. 
20e0: 20 3b 3b 20 6f 6e 20 74 65 73 74 20 41 20 62 75   ;; on test A bu
20f0: 74 20 74 65 73 74 20 42 20 72 65 61 63 68 65 64  t test B reached
2100: 20 74 68 65 20 70 6f 69 6e 74 20 6f 6e 20 62 65   the point on be
2110: 69 6e 67 20 72 65 67 69 73 74 65 72 65 64 20 61  ing registered a
2120: 73 20 4e 4f 54 5f 53 54 41 52 54 45 44 20 61 6e  s NOT_STARTED an
2130: 64 20 74 65 73 74 0a 09 20 20 3b 3b 20 41 20 66  d test..  ;; A f
2140: 61 69 6c 65 64 20 66 6f 72 20 73 6f 6d 65 20 72  ailed for some r
2150: 65 61 73 6f 6e 20 74 68 65 6e 20 6f 6e 20 72 65  eason then on re
2160: 2d 72 75 6e 20 75 73 69 6e 67 20 2d 6b 65 65 70  -run using -keep
2170: 67 6f 69 6e 67 20 74 68 65 20 72 75 6e 20 63 61  going the run ca
2180: 6e 20 6e 65 76 65 72 20 63 6f 6d 70 6c 65 74 65  n never complete
2190: 2e 0a 09 20 20 28 64 62 3a 64 65 6c 65 74 65 2d  ...  (db:delete-
21a0: 74 65 73 74 73 2d 69 6e 2d 73 74 61 74 65 20 64  tests-in-state d
21b0: 62 20 72 75 6e 2d 69 64 20 22 4e 4f 54 5f 53 54  b run-id "NOT_ST
21c0: 41 52 54 45 44 22 29 0a 09 20 20 28 72 64 62 3a  ARTED")..  (rdb:
21d0: 73 65 74 2d 74 65 73 74 73 2d 73 74 61 74 65 2d  set-tests-state-
21e0: 73 74 61 74 75 73 20 64 62 20 72 75 6e 2d 69 64  status db run-id
21f0: 20 74 65 73 74 2d 6e 61 6d 65 73 20 23 66 20 22   test-names #f "
2200: 46 41 49 4c 22 20 22 4e 4f 54 5f 53 54 41 52 54  FAIL" "NOT_START
2210: 45 44 22 20 22 46 41 49 4c 22 29 29 29 0a 0a 20  ED" "FAIL"))).. 
2220: 20 20 20 3b 3b 20 6e 6f 77 20 61 64 64 20 6e 6f     ;; now add no
2230: 6e 2d 64 69 72 65 63 74 6c 79 20 72 65 66 65 72  n-directly refer
2240: 65 6e 63 65 64 20 64 65 70 65 6e 64 65 6e 63 69  enced dependenci
2250: 65 73 20 28 69 2e 65 2e 20 77 61 69 74 6f 6e 29  es (i.e. waiton)
2260: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e  .    (if (not (n
2270: 75 6c 6c 3f 20 74 65 73 74 2d 6e 61 6d 65 73 29  ull? test-names)
2280: 29 0a 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68  )..(let loop ((h
2290: 65 64 20 28 63 61 72 20 74 65 73 74 2d 6e 61 6d  ed (car test-nam
22a0: 65 73 29 29 0a 09 09 20 20 20 28 74 61 6c 20 28  es))...   (tal (
22b0: 63 64 72 20 74 65 73 74 2d 6e 61 6d 65 73 29 29  cdr test-names))
22c0: 29 20 20 20 20 20 20 20 20 20 3b 3b 20 27 72 65  )         ;; 're
22d0: 74 75 72 6e 2d 70 72 6f 63 73 20 74 65 6c 6c 73  turn-procs tells
22e0: 20 74 68 65 20 63 6f 6e 66 69 67 20 72 65 61 64   the config read
22f0: 65 72 20 74 6f 20 70 72 65 70 20 72 75 6e 6e 69  er to prep runni
2300: 6e 67 20 73 79 73 74 65 6d 20 62 75 74 20 72 65  ng system but re
2310: 74 75 72 6e 20 61 20 70 72 6f 63 0a 09 20 20 28  turn a proc..  (
2320: 6c 65 74 2a 20 28 28 63 6f 6e 66 69 67 20 20 28  let* ((config  (
2330: 74 65 73 74 73 3a 67 65 74 2d 74 65 73 74 63 6f  tests:get-testco
2340: 6e 66 69 67 20 68 65 64 20 27 72 65 74 75 72 6e  nfig hed 'return
2350: 2d 70 72 6f 63 73 29 29 0a 09 09 20 28 77 61 69  -procs))... (wai
2360: 74 6f 6e 73 20 28 69 66 20 63 6f 6e 66 69 67 20  tons (if config 
2370: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 28 6c  (string-split (l
2380: 65 74 20 28 28 77 20 28 63 6f 6e 66 69 67 2d 6c  et ((w (config-l
2390: 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 20 22 72 65  ookup config "re
23a0: 71 75 69 72 65 6d 65 6e 74 73 22 20 22 77 61 69  quirements" "wai
23b0: 74 6f 6e 22 29 29 29 0a 09 09 09 09 09 09 20 20  ton"))).......  
23c0: 20 20 20 28 69 66 20 77 20 77 20 22 22 29 29 29     (if w w "")))
23d0: 0a 09 09 09 20 20 20 20 20 20 28 62 65 67 69 6e  ....      (begin
23e0: 0a 09 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e  .....(debug:prin
23f0: 74 20 30 20 22 45 52 52 4f 52 3a 20 6e 6f 6e 2d  t 0 "ERROR: non-
2400: 65 78 69 73 74 65 6e 74 20 72 65 71 75 69 72 65  existent require
2410: 64 20 74 65 73 74 20 5c 22 22 20 68 65 64 20 22  d test \"" hed "
2420: 5c 22 22 29 0a 20 20 20 20 20 20 20 20 20 20 20  \"").           
2430: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
2440: 20 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66 69       (sqlite3:fi
2450: 6e 61 6c 69 7a 65 21 20 64 62 29 0a 09 09 09 09  nalize! db).....
2460: 28 65 78 69 74 20 31 29 29 29 29 29 0a 09 20 20  (exit 1)))))..  
2470: 20 20 3b 3b 20 63 68 65 63 6b 20 66 6f 72 20 68    ;; check for h
2480: 65 64 20 69 6e 20 77 61 69 74 6f 6e 73 20 3d 3e  ed in waitons =>
2490: 20 74 68 69 73 20 77 6f 75 6c 64 20 62 65 20 63   this would be c
24a0: 69 72 63 75 6c 61 72 2c 20 72 65 6d 6f 76 65 20  ircular, remove 
24b0: 69 74 20 61 6e 64 20 69 73 73 75 65 20 61 6e 0a  it and issue an.
24c0: 09 20 20 20 20 3b 3b 20 65 72 72 6f 72 0a 09 20  .    ;; error.. 
24d0: 20 20 20 28 69 66 20 28 6d 65 6d 62 65 72 20 68     (if (member h
24e0: 65 64 20 77 61 69 74 6f 6e 73 29 0a 09 09 28 62  ed waitons)...(b
24f0: 65 67 69 6e 0a 09 09 20 20 28 64 65 62 75 67 3a  egin...  (debug:
2500: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
2510: 74 65 73 74 20 22 20 68 65 64 20 22 20 68 61 73  test " hed " has
2520: 20 6c 69 73 74 65 64 20 69 74 73 65 6c 66 20 61   listed itself a
2530: 73 20 61 20 77 61 69 74 6f 6e 2c 20 70 6c 65 61  s a waiton, plea
2540: 73 65 20 63 6f 72 72 65 63 74 20 74 68 69 73 21  se correct this!
2550: 22 29 0a 09 09 20 20 28 73 65 74 21 20 77 61 69  ")...  (set! wai
2560: 74 6f 6e 73 20 28 66 69 6c 74 65 72 20 28 6c 61  tons (filter (la
2570: 6d 62 64 61 20 28 78 29 28 6e 6f 74 20 28 65 71  mbda (x)(not (eq
2580: 75 61 6c 3f 20 78 20 68 65 64 29 29 29 20 77 61  ual? x hed))) wa
2590: 69 74 6f 6e 73 29 29 29 29 0a 09 20 20 20 20 0a  itons))))..    .
25a0: 09 20 20 20 20 3b 3b 20 28 69 74 65 6d 73 20 20  .    ;; (items  
25b0: 20 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d   (items:get-item
25c0: 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 63 6f  s-from-config co
25d0: 6e 66 69 67 29 29 29 0a 09 20 20 20 20 28 69 66  nfig)))..    (if
25e0: 20 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 62 6c   (not (hash-tabl
25f0: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 74 65  e-ref/default te
2600: 73 74 2d 72 65 63 6f 72 64 73 20 68 65 64 20 23  st-records hed #
2610: 66 29 29 0a 09 09 28 68 61 73 68 2d 74 61 62 6c  f))...(hash-tabl
2620: 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 63 6f  e-set! test-reco
2630: 72 64 73 0a 09 09 09 09 20 68 65 64 20 28 76 65  rds..... hed (ve
2640: 63 74 6f 72 20 68 65 64 20 20 20 20 20 3b 3b 20  ctor hed     ;; 
2650: 30 0a 09 09 09 09 09 20 20 20 20 20 63 6f 6e 66  0......     conf
2660: 69 67 20 20 3b 3b 20 31 0a 09 09 09 09 09 20 20  ig  ;; 1......  
2670: 20 20 20 77 61 69 74 6f 6e 73 20 3b 3b 20 32 0a     waitons ;; 2.
2680: 09 09 09 09 09 20 20 20 20 20 28 63 6f 6e 66 69  .....     (confi
2690: 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 20  g-lookup config 
26a0: 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22  "requirements" "
26b0: 70 72 69 6f 72 69 74 79 22 29 20 20 20 20 20 3b  priority")     ;
26c0: 3b 20 70 72 69 6f 72 69 74 79 20 33 0a 09 09 09  ; priority 3....
26d0: 09 09 20 20 20 20 20 28 6c 65 74 20 28 28 69 74  ..     (let ((it
26e0: 65 6d 73 20 20 20 20 20 20 28 68 61 73 68 2d 74  ems      (hash-t
26f0: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74  able-ref/default
2700: 20 63 6f 6e 66 69 67 20 22 69 74 65 6d 73 22 20   config "items" 
2710: 23 66 29 29 20 3b 3b 20 69 74 65 6d 73 20 34 0a  #f)) ;; items 4.
2720: 09 09 09 09 09 09 20 20 20 28 69 74 65 6d 73 74  ......   (itemst
2730: 61 62 6c 65 20 28 68 61 73 68 2d 74 61 62 6c 65  able (hash-table
2740: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63 6f 6e  -ref/default con
2750: 66 69 67 20 22 69 74 65 6d 73 74 61 62 6c 65 22  fig "itemstable"
2760: 20 23 66 29 29 29 20 0a 09 09 09 09 09 20 20 20   #f))) ......   
2770: 20 20 20 20 3b 3b 20 69 66 20 65 69 74 68 65 72      ;; if either
2780: 20 69 74 65 6d 73 20 6f 72 20 69 74 65 6d 73 20   items or items 
2790: 74 61 62 6c 65 20 69 73 20 61 20 70 72 6f 63 20  table is a proc 
27a0: 72 65 74 75 72 6e 20 69 74 20 73 6f 20 74 65 73  return it so tes
27b0: 74 20 72 75 6e 6e 69 6e 67 0a 09 09 09 09 09 20  t running...... 
27c0: 20 20 20 20 20 20 3b 3b 20 70 72 6f 63 65 73 73        ;; process
27d0: 20 63 61 6e 20 6b 6e 6f 77 20 74 6f 20 63 61 6c   can know to cal
27e0: 6c 20 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d  l items:get-item
27f0: 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 0a 09 09  s-from-config...
2800: 09 09 09 20 20 20 20 20 20 20 3b 3b 20 69 66 20  ...       ;; if 
2810: 65 69 74 68 65 72 20 69 73 20 61 20 6c 69 73 74  either is a list
2820: 20 61 6e 64 20 6e 6f 6e 65 20 69 73 20 61 20 70   and none is a p
2830: 72 6f 63 20 67 6f 20 61 68 65 61 64 20 61 6e 64  roc go ahead and
2840: 20 63 61 6c 6c 20 67 65 74 2d 69 74 65 6d 73 0a   call get-items.
2850: 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20 6f  .....       ;; o
2860: 74 68 65 72 77 69 73 65 20 72 65 74 75 72 6e 20  therwise return 
2870: 23 66 20 2d 20 74 68 69 73 20 69 73 20 6e 6f 74  #f - this is not
2880: 20 61 6e 20 69 74 65 72 61 74 65 64 20 74 65 73   an iterated tes
2890: 74 0a 09 09 09 09 09 20 20 20 20 20 20 20 28 63  t......       (c
28a0: 6f 6e 64 0a 09 09 09 09 09 09 28 28 70 72 6f 63  ond.......((proc
28b0: 65 64 75 72 65 3f 20 69 74 65 6d 73 29 20 20 20  edure? items)   
28c0: 20 20 20 0a 09 09 09 09 09 09 20 28 64 65 62 75     ....... (debu
28d0: 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a  g:print 4 "INFO:
28e0: 20 69 74 65 6d 73 20 69 73 20 61 20 70 72 6f 63   items is a proc
28f0: 65 64 75 72 65 2c 20 77 69 6c 6c 20 63 61 6c 63  edure, will calc
2900: 20 6c 61 74 65 72 22 29 0a 09 09 09 09 09 09 20   later")....... 
2910: 69 74 65 6d 73 29 20 20 20 20 20 20 20 20 20 20  items)          
2920: 20 20 3b 3b 20 63 61 6c 63 20 6c 61 74 65 72 0a    ;; calc later.
2930: 09 09 09 09 09 09 28 28 70 72 6f 63 65 64 75 72  ......((procedur
2940: 65 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 0a 09  e? itemstable)..
2950: 09 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 69  ..... (debug:pri
2960: 6e 74 20 34 20 22 49 4e 46 4f 3a 20 69 74 65 6d  nt 4 "INFO: item
2970: 73 74 61 62 6c 65 20 69 73 20 61 20 70 72 6f 63  stable is a proc
2980: 65 64 75 72 65 2c 20 77 69 6c 6c 20 63 61 6c 63  edure, will calc
2990: 20 6c 61 74 65 72 22 29 0a 09 09 09 09 09 09 20   later")....... 
29a0: 69 74 65 6d 73 74 61 62 6c 65 29 20 20 20 20 20  itemstable)     
29b0: 20 20 3b 3b 20 63 61 6c 63 20 6c 61 74 65 72 0a    ;; calc later.
29c0: 09 09 09 09 09 09 28 28 66 69 6c 74 65 72 20 28  ......((filter (
29d0: 6c 61 6d 62 64 61 20 28 78 29 0a 09 09 09 09 09  lambda (x)......
29e0: 09 09 20 20 20 28 6c 65 74 20 28 28 76 61 6c 20  ..   (let ((val 
29f0: 28 63 61 72 20 78 29 29 29 0a 09 09 09 09 09 09  (car x))).......
2a00: 09 20 20 20 20 20 28 69 66 20 28 70 72 6f 63 65  .     (if (proce
2a10: 64 75 72 65 3f 20 76 61 6c 29 20 76 61 6c 20 23  dure? val) val #
2a20: 66 29 29 29 0a 09 09 09 09 09 09 09 20 28 61 70  f)))........ (ap
2a30: 70 65 6e 64 20 28 69 66 20 28 6c 69 73 74 3f 20  pend (if (list? 
2a40: 69 74 65 6d 73 29 20 69 74 65 6d 73 20 27 28 29  items) items '()
2a50: 29 0a 09 09 09 09 09 09 09 09 20 28 69 66 20 28  )......... (if (
2a60: 6c 69 73 74 3f 20 69 74 65 6d 73 74 61 62 6c 65  list? itemstable
2a70: 29 20 69 74 65 6d 73 74 61 62 6c 65 20 27 28 29  ) itemstable '()
2a80: 29 29 29 0a 09 09 09 09 09 09 20 27 68 61 76 65  )))....... 'have
2a90: 2d 70 72 6f 63 65 64 75 72 65 29 0a 09 09 09 09  -procedure).....
2aa0: 09 09 28 28 6f 72 20 28 6c 69 73 74 3f 20 69 74  ..((or (list? it
2ab0: 65 6d 73 29 28 6c 69 73 74 3f 20 69 74 65 6d 73  ems)(list? items
2ac0: 74 61 62 6c 65 29 29 20 3b 3b 20 63 61 6c 63 20  table)) ;; calc 
2ad0: 6e 6f 77 0a 09 09 09 09 09 09 20 28 64 65 62 75  now....... (debu
2ae0: 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a  g:print 4 "INFO:
2af0: 20 69 74 65 6d 73 20 61 6e 64 20 69 74 65 6d 73   items and items
2b00: 74 61 62 6c 65 20 61 72 65 20 6c 69 73 74 73 2c  table are lists,
2b10: 20 63 61 6c 63 20 6e 6f 77 5c 6e 22 0a 09 09 09   calc now\n"....
2b20: 09 09 09 09 20 20 20 20 20 20 22 20 20 20 20 69  ....      "    i
2b30: 74 65 6d 73 3a 20 22 20 69 74 65 6d 73 20 22 20  tems: " items " 
2b40: 69 74 65 6d 73 74 61 62 6c 65 3a 20 22 20 69 74  itemstable: " it
2b50: 65 6d 73 74 61 62 6c 65 29 0a 09 09 09 09 09 09  emstable).......
2b60: 20 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d   (items:get-item
2b70: 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 63 6f  s-from-config co
2b80: 6e 66 69 67 29 29 0a 09 09 09 09 09 09 28 65 6c  nfig)).......(el
2b90: 73 65 20 23 66 29 29 29 20 20 20 20 20 20 20 20  se #f)))        
2ba0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
2bb0: 20 20 20 3b 3b 20 6e 6f 74 20 69 74 65 72 61 74     ;; not iterat
2bc0: 65 64 0a 09 09 09 09 09 20 20 20 20 20 23 66 20  ed......     #f 
2bd0: 20 20 20 20 20 3b 3b 20 69 74 65 6d 73 64 61 74       ;; itemsdat
2be0: 20 35 0a 09 09 09 09 09 20 20 20 20 20 23 66 20   5......     #f 
2bf0: 20 20 20 20 20 3b 3b 20 73 70 61 72 65 20 2d 20       ;; spare - 
2c00: 75 73 65 64 20 66 6f 72 20 69 74 65 6d 2d 70 61  used for item-pa
2c10: 74 68 0a 09 09 09 09 09 20 20 20 20 20 29 29 29  th......     )))
2c20: 0a 09 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20  ..    (for-each 
2c30: 0a 09 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28  ..     (lambda (
2c40: 77 61 69 74 6f 6e 29 0a 09 20 20 20 20 20 20 20  waiton)..       
2c50: 28 69 66 20 28 61 6e 64 20 77 61 69 74 6f 6e 20  (if (and waiton 
2c60: 28 6e 6f 74 20 28 6d 65 6d 62 65 72 20 77 61 69  (not (member wai
2c70: 74 6f 6e 20 74 65 73 74 2d 6e 61 6d 65 73 29 29  ton test-names))
2c80: 29 0a 09 09 20 20 20 28 62 65 67 69 6e 0a 09 09  )...   (begin...
2c90: 20 20 20 20 20 28 73 65 74 21 20 72 65 71 75 69       (set! requi
2ca0: 72 65 64 2d 74 65 73 74 73 20 28 63 6f 6e 73 20  red-tests (cons 
2cb0: 77 61 69 74 6f 6e 20 72 65 71 75 69 72 65 64 2d  waiton required-
2cc0: 74 65 73 74 73 29 29 0a 09 09 20 20 20 20 20 28  tests))...     (
2cd0: 73 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20  set! test-names 
2ce0: 28 63 6f 6e 73 20 77 61 69 74 6f 6e 20 74 65 73  (cons waiton tes
2cf0: 74 2d 6e 61 6d 65 73 29 29 29 29 29 20 3b 3b 20  t-names))))) ;; 
2d00: 77 61 73 20 61 6e 20 61 70 70 65 6e 64 2c 20 6e  was an append, n
2d10: 6f 77 20 61 20 63 6f 6e 73 0a 09 20 20 20 20 20  ow a cons..     
2d20: 77 61 69 74 6f 6e 73 29 0a 09 20 20 20 20 28 6c  waitons)..    (l
2d30: 65 74 20 28 28 72 65 6d 74 65 73 74 73 20 28 64  et ((remtests (d
2d40: 65 6c 65 74 65 2d 64 75 70 6c 69 63 61 74 65 73  elete-duplicates
2d50: 20 28 61 70 70 65 6e 64 20 77 61 69 74 6f 6e 73   (append waitons
2d60: 20 74 61 6c 29 29 29 29 0a 09 20 20 20 20 20 20   tal))))..      
2d70: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20  (if (not (null? 
2d80: 72 65 6d 74 65 73 74 73 29 29 0a 09 09 20 20 28  remtests))...  (
2d90: 6c 6f 6f 70 20 28 63 61 72 20 72 65 6d 74 65 73  loop (car remtes
2da0: 74 73 29 28 63 64 72 20 72 65 6d 74 65 73 74 73  ts)(cdr remtests
2db0: 29 29 29 29 29 29 29 0a 0a 20 20 20 20 28 69 66  )))))))..    (if
2dc0: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 71   (not (null? req
2dd0: 75 69 72 65 64 2d 74 65 73 74 73 29 29 0a 09 28  uired-tests))..(
2de0: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49  debug:print 1 "I
2df0: 4e 46 4f 3a 20 41 64 64 69 6e 67 20 22 20 72 65  NFO: Adding " re
2e00: 71 75 69 72 65 64 2d 74 65 73 74 73 20 22 20 74  quired-tests " t
2e10: 6f 20 74 68 65 20 72 75 6e 20 71 75 65 75 65 22  o the run queue"
2e20: 29 29 0a 20 20 20 20 3b 3b 20 4e 4f 54 45 3a 20  )).    ;; NOTE: 
2e30: 74 68 65 73 65 20 61 72 65 20 61 6c 6c 20 70 61  these are all pa
2e40: 72 65 6e 74 20 74 65 73 74 73 2c 20 69 74 65 6d  rent tests, item
2e50: 73 20 61 72 65 20 6e 6f 74 20 65 78 70 61 6e 64  s are not expand
2e60: 65 64 20 79 65 74 2e 0a 20 20 20 20 28 72 75 6e  ed yet..    (run
2e70: 73 3a 72 75 6e 2d 74 65 73 74 73 2d 71 75 65 75  s:run-tests-queu
2e80: 65 20 64 62 20 72 75 6e 2d 69 64 20 72 75 6e 6e  e db run-id runn
2e90: 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 73  ame test-records
2ea0: 20 6b 65 79 76 61 6c 6c 73 74 20 66 6c 61 67 73   keyvallst flags
2eb0: 29 0a 20 20 20 20 28 69 66 20 2a 72 70 63 3a 6c  ).    (if *rpc:l
2ec0: 69 73 74 65 6e 65 72 2a 20 28 73 65 72 76 65 72  istener* (server
2ed0: 3a 6b 65 65 70 2d 72 75 6e 6e 69 6e 67 20 64 62  :keep-running db
2ee0: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72  )).    (debug:pr
2ef0: 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 41 6c 6c  int 4 "INFO: All
2f00: 20 64 6f 6e 65 20 62 79 20 68 65 72 65 22 29 29   done by here"))
2f10: 29 0a 0a 3b 3b 20 74 65 73 74 2d 72 65 63 6f 72  )..;; test-recor
2f20: 64 73 20 69 73 20 61 20 68 61 73 68 20 74 61 62  ds is a hash tab
2f30: 6c 65 20 74 65 73 74 6e 61 6d 65 3a 69 74 65 6d  le testname:item
2f40: 5f 70 61 74 68 20 3d 3e 20 76 65 63 74 6f 72 20  _path => vector 
2f50: 3c 20 74 65 73 74 6e 61 6d 65 20 74 65 73 74 63  < testname testc
2f60: 6f 6e 66 69 67 20 77 61 69 74 6f 6e 73 20 70 72  onfig waitons pr
2f70: 69 6f 72 69 74 79 20 69 74 65 6d 73 2d 69 6e 66  iority items-inf
2f80: 6f 20 2e 2e 2e 20 3e 0a 28 64 65 66 69 6e 65 20  o ... >.(define 
2f90: 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d  (runs:run-tests-
2fa0: 71 75 65 75 65 20 64 62 20 72 75 6e 2d 69 64 20  queue db run-id 
2fb0: 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d 72 65 63  runname test-rec
2fc0: 6f 72 64 73 20 6b 65 79 76 61 6c 6c 73 74 20 66  ords keyvallst f
2fd0: 6c 61 67 73 29 0a 20 20 20 20 3b 3b 20 41 74 20  lags).    ;; At 
2fe0: 74 68 69 73 20 70 6f 69 6e 74 20 74 68 65 20 6c  this point the l
2ff0: 69 73 74 20 6f 66 20 70 61 72 65 6e 74 20 74 65  ist of parent te
3000: 73 74 73 20 69 73 20 65 78 70 61 6e 64 65 64 20  sts is expanded 
3010: 0a 20 20 20 20 3b 3b 20 4e 42 2f 2f 20 53 68 6f  .    ;; NB// Sho
3020: 75 6c 64 20 65 78 70 61 6e 64 20 69 74 65 6d 73  uld expand items
3030: 20 68 65 72 65 20 61 6e 64 20 74 68 65 6e 20 69   here and then i
3040: 6e 73 65 72 74 20 69 6e 74 6f 20 74 68 65 20 72  nsert into the r
3050: 75 6e 20 71 75 65 75 65 2e 0a 20 20 28 64 65 62  un queue..  (deb
3060: 75 67 3a 70 72 69 6e 74 20 35 20 22 74 65 73 74  ug:print 5 "test
3070: 2d 72 65 63 6f 72 64 73 3a 20 22 20 74 65 73 74  -records: " test
3080: 2d 72 65 63 6f 72 64 73 20 22 2c 20 6b 65 79 76  -records ", keyv
3090: 61 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c  allst: " keyvall
30a0: 73 74 20 22 20 66 6c 61 67 73 3a 20 22 20 28 68  st " flags: " (h
30b0: 61 73 68 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74  ash-table->alist
30c0: 20 66 6c 61 67 73 29 29 0a 20 20 28 6c 65 74 20   flags)).  (let 
30d0: 28 28 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61  ((sorted-test-na
30e0: 6d 65 73 20 28 74 65 73 74 73 3a 73 6f 72 74 2d  mes (tests:sort-
30f0: 62 79 2d 70 72 69 6f 72 69 74 79 2d 61 6e 64 2d  by-priority-and-
3100: 77 61 69 74 6f 6e 20 74 65 73 74 2d 72 65 63 6f  waiton test-reco
3110: 72 64 73 29 29 0a 09 28 69 74 65 6d 2d 70 61 74  rds))..(item-pat
3120: 74 73 20 20 20 20 20 20 20 20 28 68 61 73 68 2d  ts        (hash-
3130: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c  table-ref/defaul
3140: 74 20 66 6c 61 67 73 20 22 2d 69 74 65 6d 70 61  t flags "-itempa
3150: 74 74 22 20 23 66 29 29 29 0a 20 20 20 20 28 69  tt" #f))).    (i
3160: 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 73 6f  f (not (null? so
3170: 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29  rted-test-names)
3180: 29 0a 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68  )..(let loop ((h
3190: 65 64 20 20 20 20 20 20 20 20 20 28 63 61 72 20  ed         (car 
31a0: 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65  sorted-test-name
31b0: 73 29 29 0a 09 09 20 20 20 28 74 61 6c 20 20 20  s))...   (tal   
31c0: 20 20 20 20 20 20 28 63 64 72 20 73 6f 72 74 65        (cdr sorte
31d0: 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a  d-test-names))).
31e0: 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70  .  (thread-sleep
31f0: 21 20 30 2e 31 29 20 3b 3b 20 67 69 76 65 20 6f  ! 0.1) ;; give o
3200: 74 68 65 72 20 61 70 70 6c 69 63 61 74 69 6f 6e  ther application
3210: 73 20 73 6f 6d 65 20 74 69 6d 65 20 77 69 74 68  s some time with
3220: 20 74 68 65 20 64 62 0a 09 20 20 28 6c 65 74 2a   the db..  (let*
3230: 20 28 28 74 65 73 74 2d 72 65 63 6f 72 64 20 28   ((test-record (
3240: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 20 74  hash-table-ref t
3250: 65 73 74 2d 72 65 63 6f 72 64 73 20 68 65 64 29  est-records hed)
3260: 29 0a 09 09 20 28 74 63 6f 6e 66 69 67 20 20 20  )... (tconfig   
3270: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65    (tests:testque
3280: 75 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66 69  ue-get-testconfi
3290: 67 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a  g test-record)).
32a0: 09 09 20 28 74 65 73 74 6d 6f 64 65 20 20 20 20  .. (testmode    
32b0: 28 6c 65 74 20 28 28 6d 20 28 63 6f 6e 66 69 67  (let ((m (config
32c0: 2d 6c 6f 6f 6b 75 70 20 74 63 6f 6e 66 69 67 20  -lookup tconfig 
32d0: 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22  "requirements" "
32e0: 6d 6f 64 65 22 29 29 29 0a 09 09 09 09 28 69 66  mode"))).....(if
32f0: 20 6d 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62   m (string->symb
3300: 6f 6c 20 6d 29 20 27 6e 6f 72 6d 61 6c 29 29 29  ol m) 'normal)))
3310: 0a 09 09 20 28 77 61 69 74 6f 6e 73 20 20 20 20  ... (waitons    
3320: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75   (tests:testqueu
3330: 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20 20 20  e-get-waitons   
3340: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09   test-record))..
3350: 09 20 28 70 72 69 6f 72 69 74 79 20 20 20 20 28  . (priority    (
3360: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
3370: 67 65 74 2d 70 72 69 6f 72 69 74 79 20 20 20 74  get-priority   t
3380: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 20  est-record))... 
3390: 28 69 74 65 6d 64 61 74 20 20 20 20 20 28 74 65  (itemdat     (te
33a0: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65  sts:testqueue-ge
33b0: 74 2d 69 74 65 6d 64 61 74 20 20 20 20 74 65 73  t-itemdat    tes
33c0: 74 2d 72 65 63 6f 72 64 29 29 20 3b 3b 20 69 74  t-record)) ;; it
33d0: 65 6d 64 61 74 20 63 61 6e 20 62 65 20 61 20 73  emdat can be a s
33e0: 74 72 69 6e 67 2c 20 6c 69 73 74 20 6f 72 20 23  tring, list or #
33f0: 66 0a 09 09 20 28 69 74 65 6d 73 20 20 20 20 20  f... (items     
3400: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65    (tests:testque
3410: 75 65 2d 67 65 74 2d 69 74 65 6d 73 20 20 20 20  ue-get-items    
3420: 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a    test-record)).
3430: 09 09 20 28 69 74 65 6d 2d 70 61 74 68 20 20 20  .. (item-path   
3440: 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68  (item-list->path
3450: 20 69 74 65 6d 64 61 74 29 29 0a 09 09 20 28 6e   itemdat))... (n
3460: 65 77 74 61 6c 20 20 20 20 20 20 28 61 70 70 65  ewtal      (appe
3470: 6e 64 20 74 61 6c 20 28 6c 69 73 74 20 68 65 64  nd tal (list hed
3480: 29 29 29 0a 09 09 20 28 63 61 6c 63 2d 66 61 69  )))... (calc-fai
3490: 6c 73 20 20 28 6c 61 6d 62 64 61 20 28 70 72 65  ls  (lambda (pre
34a0: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09  reqs-not-met)...
34b0: 09 09 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64  ..(filter (lambd
34c0: 61 20 28 74 65 73 74 29 0a 09 09 09 09 09 20 20  a (test)......  
34d0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 39 20 22  (debug:print 9 "
34e0: 74 65 73 74 3a 20 22 20 74 65 73 74 29 0a 09 09  test: " test)...
34f0: 09 09 09 20 20 28 61 6e 64 20 28 76 65 63 74 6f  ...  (and (vecto
3500: 72 3f 20 74 65 73 74 29 20 3b 3b 20 6e 6f 74 20  r? test) ;; not 
3510: 28 73 74 72 69 6e 67 3f 20 74 65 73 74 29 29 0a  (string? test)).
3520: 09 09 09 09 09 20 20 20 20 20 20 20 28 65 71 75  .....       (equ
3530: 61 6c 3f 20 28 64 62 3a 74 65 73 74 2d 67 65 74  al? (db:test-get
3540: 2d 73 74 61 74 65 20 74 65 73 74 29 20 22 43 4f  -state test) "CO
3550: 4d 50 4c 45 54 45 44 22 29 0a 09 09 09 09 09 20  MPLETED")...... 
3560: 20 20 20 20 20 20 28 6e 6f 74 20 28 6d 65 6d 62        (not (memb
3570: 65 72 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  er (db:test-get-
3580: 73 74 61 74 75 73 20 74 65 73 74 29 0a 09 09 09  status test)....
3590: 09 09 09 09 20 20 20 20 27 28 22 50 41 53 53 22  ....    '("PASS"
35a0: 20 22 57 41 52 4e 22 20 22 43 48 45 43 4b 22 20   "WARN" "CHECK" 
35b0: 22 57 41 49 56 45 44 22 29 29 29 29 29 0a 09 09  "WAIVED")))))...
35c0: 09 09 09 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d  ...prereqs-not-m
35d0: 65 74 29 29 29 0a 09 09 20 28 63 61 6c 63 2d 6e  et)))... (calc-n
35e0: 6f 74 2d 63 6f 6d 70 6c 65 74 65 64 20 28 6c 61  ot-completed (la
35f0: 6d 62 64 61 20 28 70 72 65 72 65 71 73 2d 6e 6f  mbda (prereqs-no
3600: 74 2d 6d 65 74 29 0a 09 09 09 09 20 20 20 20 20  t-met).....     
3610: 20 20 28 66 69 6c 74 65 72 0a 09 09 09 09 09 28    (filter......(
3620: 6c 61 6d 62 64 61 20 28 74 29 0a 09 09 09 09 09  lambda (t)......
3630: 20 20 28 6f 72 20 28 6e 6f 74 20 28 76 65 63 74    (or (not (vect
3640: 6f 72 3f 20 74 29 29 0a 09 09 09 09 09 20 20 20  or? t))......   
3650: 20 20 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20     (not (equal? 
3660: 22 43 4f 4d 50 4c 45 54 45 44 22 20 28 64 62 3a  "COMPLETED" (db:
3670: 74 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74  test-get-state t
3680: 29 29 29 29 29 0a 09 09 09 09 09 70 72 65 72 65  )))))......prere
3690: 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a 09 09  qs-not-met)))...
36a0: 20 28 70 72 65 74 74 79 2d 73 74 72 69 6e 67 20   (pretty-string 
36b0: 28 6c 61 6d 62 64 61 20 28 6c 73 74 29 0a 09 09  (lambda (lst)...
36c0: 09 09 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 61  ..  (map (lambda
36d0: 20 28 74 29 0a 09 09 09 09 09 20 28 69 66 20 28   (t)...... (if (
36e0: 73 74 72 69 6e 67 3f 20 74 29 0a 09 09 09 09 09  string? t)......
36f0: 20 20 20 20 20 74 0a 09 09 09 09 09 20 20 20 20       t......    
3700: 20 28 63 6f 6e 63 20 28 64 62 3a 74 65 73 74 2d   (conc (db:test-
3710: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 29 20  get-testname t) 
3720: 22 3a 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74  ":" (db:test-get
3730: 2d 73 74 61 74 65 20 74 29 20 22 2f 22 20 28 64  -state t) "/" (d
3740: 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75  b:test-get-statu
3750: 73 20 74 29 29 29 29 0a 09 09 09 09 20 20 20 20  s t)))).....    
3760: 20 20 20 6c 73 74 29 29 29 29 0a 09 20 20 20 20     lst))))..    
3770: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 36 0a 09  (debug:print 6..
3780: 09 09 20 22 69 74 65 6d 64 61 74 3a 20 20 20 20  .. "itemdat:    
3790: 20 22 20 69 74 65 6d 64 61 74 0a 09 09 09 20 22   " itemdat.... "
37a0: 5c 6e 20 20 69 74 65 6d 73 3a 20 20 20 20 20 22  \n  items:     "
37b0: 20 69 74 65 6d 73 0a 09 09 09 20 22 5c 6e 20 20   items.... "\n  
37c0: 69 74 65 6d 2d 70 61 74 68 3a 20 22 20 69 74 65  item-path: " ite
37d0: 6d 2d 70 61 74 68 0a 09 09 09 20 22 5c 6e 20 20  m-path.... "\n  
37e0: 77 61 69 74 6f 6e 73 3a 20 20 20 22 20 77 61 69  waitons:   " wai
37f0: 74 6f 6e 73 29 0a 0a 09 20 20 20 20 3b 3b 20 63  tons)...    ;; c
3800: 68 65 63 6b 20 66 6f 72 20 68 65 64 20 69 6e 20  heck for hed in 
3810: 77 61 69 74 6f 6e 73 20 3d 3e 20 74 68 69 73 20  waitons => this 
3820: 77 6f 75 6c 64 20 62 65 20 63 69 72 63 75 6c 61  would be circula
3830: 72 2c 20 72 65 6d 6f 76 65 20 69 74 20 61 6e 64  r, remove it and
3840: 20 69 73 73 75 65 20 61 6e 0a 09 20 20 20 20 3b   issue an..    ;
3850: 3b 20 65 72 72 6f 72 0a 09 20 20 20 20 28 69 66  ; error..    (if
3860: 20 28 6d 65 6d 62 65 72 20 68 65 64 20 77 61 69   (member hed wai
3870: 74 6f 6e 73 29 0a 09 09 28 62 65 67 69 6e 0a 09  tons)...(begin..
3880: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  .  (debug:print 
3890: 30 20 22 45 52 52 4f 52 3a 20 74 65 73 74 20 22  0 "ERROR: test "
38a0: 20 68 65 64 20 22 20 68 61 73 20 6c 69 73 74 65   hed " has liste
38b0: 64 20 69 74 73 65 6c 66 20 61 73 20 61 20 77 61  d itself as a wa
38c0: 69 74 6f 6e 2c 20 70 6c 65 61 73 65 20 63 6f 72  iton, please cor
38d0: 72 65 63 74 20 74 68 69 73 21 22 29 0a 09 09 20  rect this!")... 
38e0: 20 28 73 65 74 21 20 77 61 69 74 6f 6e 20 28 66   (set! waiton (f
38f0: 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78  ilter (lambda (x
3900: 29 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 78 20  )(not (equal? x 
3910: 68 65 64 29 29 29 20 77 61 69 74 6f 6e 73 29 29  hed))) waitons))
3920: 29 29 0a 0a 09 20 20 20 20 28 63 6f 6e 64 0a 09  ))...    (cond..
3930: 20 20 20 20 20 28 28 6e 6f 74 20 69 74 65 6d 73       ((not items
3940: 29 20 3b 3b 20 77 68 65 6e 20 66 61 6c 73 65 20  ) ;; when false 
3950: 74 68 65 20 74 65 73 74 20 69 73 20 6f 6b 20 74  the test is ok t
3960: 6f 20 62 65 20 68 61 6e 64 65 64 20 6f 66 66 20  o be handed off 
3970: 74 6f 20 6c 61 75 6e 63 68 20 28 62 75 74 20 6e  to launch (but n
3980: 6f 74 20 62 65 66 6f 72 65 29 0a 09 20 20 20 20  ot before)..    
3990: 20 20 28 6c 65 74 2a 20 28 28 68 61 76 65 2d 72    (let* ((have-r
39a0: 65 73 6f 75 72 63 65 73 20 20 28 72 75 6e 73 3a  esources  (runs:
39b0: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73  can-run-more-tes
39c0: 74 73 20 64 62 20 74 65 73 74 2d 72 65 63 6f 72  ts db test-recor
39d0: 64 29 29 20 3b 3b 20 6c 6f 6f 6b 20 61 74 20 74  d)) ;; look at t
39e0: 68 65 20 74 65 73 74 20 6a 6f 62 67 72 6f 75 70  he test jobgroup
39f0: 20 61 6e 64 20 74 6f 74 20 6a 6f 62 73 20 72 75   and tot jobs ru
3a00: 6e 6e 69 6e 67 0a 09 09 20 20 20 20 20 28 70 72  nning...     (pr
3a10: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 28 64  ereqs-not-met (d
3a20: 62 3a 67 65 74 2d 70 72 65 72 65 71 73 2d 6e 6f  b:get-prereqs-no
3a30: 74 2d 6d 65 74 20 64 62 20 72 75 6e 2d 69 64 20  t-met db run-id 
3a40: 77 61 69 74 6f 6e 73 20 69 74 65 6d 2d 70 61 74  waitons item-pat
3a50: 68 20 6d 6f 64 65 3a 20 74 65 73 74 6d 6f 64 65  h mode: testmode
3a60: 29 29 0a 09 09 20 20 20 20 20 28 66 61 69 6c 73  ))...     (fails
3a70: 20 20 20 20 20 20 20 20 20 20 20 28 63 61 6c 63             (calc
3a80: 2d 66 61 69 6c 73 20 70 72 65 72 65 71 73 2d 6e  -fails prereqs-n
3a90: 6f 74 2d 6d 65 74 29 29 0a 09 09 20 20 20 20 20  ot-met))...     
3aa0: 28 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 20 20  (non-completed  
3ab0: 20 28 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c   (calc-not-compl
3ac0: 65 74 65 64 20 70 72 65 72 65 71 73 2d 6e 6f 74  eted prereqs-not
3ad0: 2d 6d 65 74 29 29 29 0a 09 09 28 64 65 62 75 67  -met)))...(debug
3ae0: 3a 70 72 69 6e 74 20 38 20 22 49 4e 46 4f 3a 20  :print 8 "INFO: 
3af0: 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 3a 20  have-resources: 
3b00: 22 20 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73  " have-resources
3b10: 20 22 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d   " prereqs-not-m
3b20: 65 74 3a 20 22 20 0a 09 09 09 20 20 20 20 20 28  et: " ....     (
3b30: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72  string-intersper
3b40: 73 65 20 0a 09 09 09 20 20 20 20 20 20 28 6d 61  se ....      (ma
3b50: 70 20 28 6c 61 6d 62 64 61 20 28 74 29 0a 09 09  p (lambda (t)...
3b60: 09 09 20 20 20 20 20 28 63 6f 6e 63 20 28 64 62  ..     (conc (db
3b70: 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20  :test-get-state 
3b80: 74 29 22 2f 22 28 64 62 3a 74 65 73 74 2d 67 65  t)"/"(db:test-ge
3b90: 74 2d 73 74 61 74 75 73 20 74 29 29 29 0a 09 09  t-status t)))...
3ba0: 09 09 20 20 20 70 72 65 72 65 71 73 2d 6e 6f 74  ..   prereqs-not
3bb0: 2d 6d 65 74 29 20 22 2c 20 22 29 20 22 20 66 61  -met) ", ") " fa
3bc0: 69 6c 73 3a 20 22 20 66 61 69 6c 73 29 0a 09 09  ils: " fails)...
3bd0: 3b 3b 20 44 6f 6e 27 74 20 6b 6e 6f 77 20 61 74  ;; Don't know at
3be0: 20 74 68 69 73 20 74 69 6d 65 20 69 66 20 74 68   this time if th
3bf0: 65 20 74 65 73 74 20 68 61 76 65 20 62 65 65 6e  e test have been
3c00: 20 6c 61 75 6e 63 68 65 64 20 61 74 20 73 6f 6d   launched at som
3c10: 65 20 74 69 6d 65 20 69 6e 20 74 68 65 20 70 61  e time in the pa
3c20: 73 74 0a 09 09 3b 3b 20 69 2e 65 2e 20 69 73 20  st...;; i.e. is 
3c30: 74 68 69 73 20 61 20 72 65 2d 6c 61 75 6e 63 68  this a re-launch
3c40: 3f 0a 09 09 28 63 6f 6e 64 0a 09 09 20 28 28 61  ?...(cond... ((a
3c50: 6e 64 20 68 61 76 65 2d 72 65 73 6f 75 72 63 65  nd have-resource
3c60: 73 0a 09 09 20 20 20 20 20 20 20 28 6f 72 20 28  s...       (or (
3c70: 6e 75 6c 6c 3f 20 70 72 65 72 65 71 73 2d 6e 6f  null? prereqs-no
3c80: 74 2d 6d 65 74 29 0a 09 09 09 20 20 20 28 61 6e  t-met)....   (an
3c90: 64 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20  d (eq? testmode 
3ca0: 27 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09 28  'toplevel).....(
3cb0: 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65  null? non-comple
3cc0: 74 65 64 29 29 29 29 0a 09 09 20 20 3b 3b 20 6e  ted))))...  ;; n
3cd0: 6f 20 6c 6f 6f 70 20 68 65 72 65 2c 20 6a 75 73  o loop here, jus
3ce0: 74 20 64 72 6f 70 20 74 68 6f 75 67 68 20 61 6e  t drop though an
3cf0: 64 20 75 73 65 20 74 68 65 20 6c 6f 6f 70 20 61  d use the loop a
3d00: 74 20 74 68 65 20 62 6f 74 74 6f 6d 20 0a 09 09  t the bottom ...
3d10: 20 20 28 69 66 20 28 70 61 74 74 2d 6c 69 73 74    (if (patt-list
3d20: 2d 6d 61 74 63 68 20 69 74 65 6d 2d 70 61 74 68  -match item-path
3d30: 20 69 74 65 6d 2d 70 61 74 74 73 29 0a 09 09 20   item-patts)... 
3d40: 20 20 20 20 20 28 72 75 6e 3a 74 65 73 74 20 64       (run:test d
3d50: 62 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65  b run-id runname
3d60: 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 73 74 2d   keyvallst test-
3d70: 72 65 63 6f 72 64 20 66 6c 61 67 73 20 23 66 29  record flags #f)
3d80: 0a 09 09 20 20 20 20 20 20 28 64 65 62 75 67 3a  ...      (debug:
3d90: 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 53  print 1 "INFO: S
3da0: 6b 69 70 70 69 6e 67 20 22 20 28 74 65 73 74 73  kipping " (tests
3db0: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74  :testqueue-get-t
3dc0: 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63  estname test-rec
3dd0: 6f 72 64 29 20 22 20 22 20 69 74 65 6d 2d 70 61  ord) " " item-pa
3de0: 74 68 20 22 20 61 73 20 69 74 20 64 6f 65 73 6e  th " as it doesn
3df0: 27 74 20 6d 61 74 63 68 20 22 20 69 74 65 6d 2d  't match " item-
3e00: 70 61 74 74 73 29 29 0a 09 09 20 20 3b 3b 20 65  patts))...  ;; e
3e10: 6c 73 65 20 74 68 65 20 72 75 6e 20 69 73 20 73  lse the run is s
3e20: 74 75 63 6b 2c 20 74 65 6d 70 6f 72 61 72 69 6c  tuck, temporaril
3e30: 79 20 6f 72 20 70 65 72 6d 61 6e 65 6e 74 6c 79  y or permanently
3e40: 0a 09 09 20 20 3b 3b 20 62 75 74 20 73 68 6f 75  ...  ;; but shou
3e50: 6c 64 20 63 68 65 63 6b 20 69 66 20 69 74 20 69  ld check if it i
3e60: 73 20 64 75 65 20 74 6f 20 6c 61 63 6b 20 6f 66  s due to lack of
3e70: 20 72 65 73 6f 75 72 63 65 73 20 76 73 2e 20 70   resources vs. p
3e80: 72 65 72 65 71 75 69 73 69 74 65 73 0a 09 09 20  rerequisites... 
3e90: 20 29 0a 09 09 20 28 28 6e 6f 74 20 68 61 76 65   )... ((not have
3ea0: 2d 72 65 73 6f 75 72 63 65 73 29 20 3b 3b 20 73  -resources) ;; s
3eb0: 69 6d 70 6c 79 20 74 72 79 20 61 67 61 69 6e 20  imply try again 
3ec0: 61 66 74 65 72 20 77 61 69 74 69 6e 67 20 61 20  after waiting a 
3ed0: 73 65 63 6f 6e 64 0a 09 09 20 20 28 74 68 72 65  second...  (thre
3ee0: 61 64 2d 73 6c 65 65 70 21 20 31 2e 30 29 0a 09  ad-sleep! 1.0)..
3ef0: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  .  (debug:print 
3f00: 31 20 22 49 4e 46 4f 3a 20 6e 6f 20 72 65 73 6f  1 "INFO: no reso
3f10: 75 72 63 65 73 20 74 6f 20 72 75 6e 20 6e 65 77  urces to run new
3f20: 20 74 65 73 74 73 2c 20 77 61 69 74 69 6e 67 20   tests, waiting 
3f30: 2e 2e 2e 22 29 0a 09 09 20 20 3b 3b 20 63 6f 75  ...")...  ;; cou
3f40: 6c 64 20 68 61 76 65 20 64 6f 6e 65 20 68 65 64  ld have done hed
3f50: 20 74 61 6c 20 68 65 72 65 20 62 75 74 20 64 6f   tal here but do
3f60: 69 6e 67 20 63 61 72 2f 63 64 72 20 6f 66 20 6e  ing car/cdr of n
3f70: 65 77 74 61 6c 20 74 6f 20 72 6f 74 61 74 65 20  ewtal to rotate 
3f80: 74 65 73 74 73 0a 09 09 20 20 28 6c 6f 6f 70 20  tests...  (loop 
3f90: 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72  (car newtal)(cdr
3fa0: 20 6e 65 77 74 61 6c 29 29 29 0a 09 09 20 28 65   newtal)))... (e
3fb0: 6c 73 65 20 3b 3b 20 6d 75 73 74 20 62 65 20 77  lse ;; must be w
3fc0: 65 20 68 61 76 65 20 75 6e 6d 65 74 20 70 72 65  e have unmet pre
3fd0: 72 65 71 75 69 73 69 74 65 73 0a 09 09 20 20 20  requisites...   
3fe0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20   (debug:print 4 
3ff0: 22 46 41 49 4c 53 3a 20 22 20 66 61 69 6c 73 29  "FAILS: " fails)
4000: 0a 09 09 20 20 20 20 3b 3b 20 49 66 20 6f 6e 65  ...    ;; If one
4010: 20 6f 72 20 6d 6f 72 65 20 6f 66 20 74 68 65 20   or more of the 
4020: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20  prereqs-not-met 
4030: 61 72 65 20 46 41 49 4c 20 74 68 65 6e 20 77 65  are FAIL then we
4040: 20 63 61 6e 20 69 73 73 75 65 0a 09 09 20 20 20   can issue...   
4050: 20 3b 3b 20 61 20 6d 65 73 73 61 67 65 20 61 6e   ;; a message an
4060: 64 20 64 72 6f 70 20 68 65 64 20 66 72 6f 6d 20  d drop hed from 
4070: 74 68 65 20 69 74 65 6d 73 20 74 6f 20 62 65 20  the items to be 
4080: 70 72 6f 63 65 73 73 65 64 2e 0a 09 09 20 20 20  processed....   
4090: 20 28 69 66 20 28 6e 75 6c 6c 3f 20 66 61 69 6c   (if (null? fail
40a0: 73 29 0a 09 09 09 28 62 65 67 69 6e 0a 09 09 09  s)....(begin....
40b0: 20 20 3b 3b 20 63 6f 75 6c 64 6e 27 74 20 72 75    ;; couldn't ru
40c0: 6e 2c 20 74 61 6b 65 20 61 20 62 72 65 61 74 68  n, take a breath
40d0: 65 72 0a 09 09 09 20 20 28 64 65 62 75 67 3a 70  er....  (debug:p
40e0: 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 53 68  rint 4 "INFO: Sh
40f0: 6f 75 6c 64 6e 27 74 20 72 65 61 6c 6c 79 20 67  ouldn't really g
4100: 65 74 20 68 65 72 65 2c 20 72 61 63 65 20 63 6f  et here, race co
4110: 6e 64 69 74 69 6f 6e 3f 20 55 6e 61 62 6c 65 20  ndition? Unable 
4120: 74 6f 20 6c 61 75 6e 63 68 20 6d 6f 72 65 20 74  to launch more t
4130: 65 73 74 73 20 61 74 20 74 68 69 73 20 6d 6f 6d  ests at this mom
4140: 65 6e 74 2c 20 6b 69 6c 6c 69 6e 67 20 74 69 6d  ent, killing tim
4150: 65 20 2e 2e 2e 22 29 0a 09 09 09 20 20 28 74 68  e ...")....  (th
4160: 72 65 61 64 2d 73 6c 65 65 70 21 20 30 2e 31 29  read-sleep! 0.1)
4170: 20 3b 3b 20 6c 6f 6e 67 20 73 6c 65 65 70 20 68   ;; long sleep h
4180: 65 72 65 20 2d 20 6e 6f 20 72 65 73 6f 75 72 63  ere - no resourc
4190: 65 73 2c 20 6d 61 79 20 61 73 20 77 65 6c 6c 20  es, may as well 
41a0: 62 65 20 70 61 74 69 65 6e 74 0a 09 09 09 20 20  be patient....  
41b0: 3b 3b 20 77 65 20 6d 61 64 65 20 6e 65 77 20 74  ;; we made new t
41c0: 61 6c 20 62 79 20 73 74 69 63 6b 69 6e 67 20 68  al by sticking h
41d0: 65 64 20 61 74 20 74 68 65 20 62 61 63 6b 20 6f  ed at the back o
41e0: 66 20 74 68 65 20 6c 69 73 74 0a 09 09 09 20 20  f the list....  
41f0: 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61  (loop (car newta
4200: 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 29 29  l)(cdr newtal)))
4210: 0a 09 09 09 3b 3b 20 74 68 65 20 77 61 69 74 6f  ....;; the waito
4220: 6e 20 69 73 20 46 41 49 4c 20 73 6f 20 6e 6f 20  n is FAIL so no 
4230: 70 6f 69 6e 74 20 69 6e 20 74 72 79 69 6e 67 20  point in trying 
4240: 74 6f 20 72 75 6e 20 68 65 64 20 65 76 65 72 20  to run hed ever 
4250: 61 67 61 69 6e 0a 09 09 09 28 69 66 20 28 6e 6f  again....(if (no
4260: 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09  t (null? tal))..
4270: 09 09 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09  ..    (begin....
4280: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
4290: 6e 74 20 31 20 22 57 41 52 4e 3a 20 44 72 6f 70  nt 1 "WARN: Drop
42a0: 70 69 6e 67 20 74 65 73 74 20 22 20 28 64 62 3a  ping test " (db:
42b0: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 2d 6e 61  test-get-test-na
42c0: 6d 65 20 68 65 64 29 20 22 2f 22 20 28 64 62 3a  me hed) "/" (db:
42d0: 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61  test-get-item-pa
42e0: 74 68 20 68 65 64 29 0a 09 09 09 09 09 20 20 20  th hed)......   
42f0: 22 20 66 72 6f 6d 20 74 68 65 20 6c 61 75 6e 63  " from the launc
4300: 68 20 6c 69 73 74 20 61 73 20 69 74 20 68 61 73  h list as it has
4310: 20 70 72 65 72 65 71 75 69 73 74 65 73 20 74 68   prerequistes th
4320: 61 74 20 61 72 65 20 46 41 49 4c 22 29 0a 09 09  at are FAIL")...
4330: 09 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61  .      (loop (ca
4340: 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 29  r tal)(cdr tal))
4350: 29 29 29 29 29 29 29 0a 09 20 20 20 20 20 0a 09  )))))))..     ..
4360: 20 20 20 20 20 3b 3b 20 63 61 73 65 20 77 68 65       ;; case whe
4370: 72 65 20 61 6e 20 69 74 65 6d 73 20 63 61 6d 65  re an items came
4380: 20 69 6e 20 61 73 20 61 20 6c 69 73 74 20 62 65   in as a list be
4390: 65 6e 20 70 72 6f 63 65 73 73 65 64 0a 09 20 20  en processed..  
43a0: 20 20 20 28 28 61 6e 64 20 28 6c 69 73 74 3f 20     ((and (list? 
43b0: 69 74 65 6d 73 29 20 20 20 20 20 3b 3b 20 74 68  items)     ;; th
43c0: 75 73 20 77 65 20 6b 6e 6f 77 20 6f 75 72 20 69  us we know our i
43d0: 74 65 6d 73 20 61 72 65 20 61 6c 72 65 61 64 79  tems are already
43e0: 20 63 61 6c 63 75 6c 61 74 65 64 0a 09 09 20 20   calculated...  
43f0: 20 28 6e 6f 74 20 20 20 69 74 65 6d 64 61 74 29   (not   itemdat)
4400: 29 20 3b 3b 20 61 6e 64 20 6e 6f 74 20 79 65 74  ) ;; and not yet
4410: 20 65 78 70 61 6e 64 65 64 20 69 6e 74 6f 20 74   expanded into t
4420: 68 65 20 6c 69 73 74 20 6f 66 20 74 68 69 6e 67  he list of thing
4430: 73 20 74 6f 20 62 65 20 64 6f 6e 65 0a 09 20 20  s to be done..  
4440: 20 20 20 20 28 69 66 20 28 61 6e 64 20 28 3e 3d      (if (and (>=
4450: 20 2a 76 65 72 62 6f 73 69 74 79 2a 20 31 29 0a   *verbosity* 1).
4460: 09 09 20 20 20 20 20 20 20 28 3e 20 28 6c 65 6e  ..       (> (len
4470: 67 74 68 20 69 74 65 6d 73 29 20 30 29 0a 09 09  gth items) 0)...
4480: 20 20 20 20 20 20 20 28 3e 20 28 6c 65 6e 67 74         (> (lengt
4490: 68 20 28 63 61 72 20 69 74 65 6d 73 29 29 20 30  h (car items)) 0
44a0: 29 29 0a 09 09 20 20 28 70 70 20 69 74 65 6d 73  ))...  (pp items
44b0: 29 29 0a 09 20 20 20 20 20 20 3b 3b 20 28 69 66  ))..      ;; (if
44c0: 20 28 3e 3d 20 2a 76 65 72 62 6f 73 69 74 79 2a   (>= *verbosity*
44d0: 20 35 29 0a 09 20 20 20 20 20 20 3b 3b 20 20 20   5)..      ;;   
44e0: 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20    (begin..      
44f0: 3b 3b 20 20 20 20 20 20 20 28 70 72 69 6e 74 20  ;;       (print 
4500: 22 69 74 65 6d 73 3a 20 22 29 20 20 20 20 20 28  "items: ")     (
4510: 70 70 20 28 69 74 65 6d 2d 61 73 73 6f 63 2d 3e  pp (item-assoc->
4520: 69 74 65 6d 2d 6c 69 73 74 20 69 74 65 6d 73 29  item-list items)
4530: 29 0a 09 20 20 20 20 20 20 3b 3b 20 20 20 20 20  )..      ;;     
4540: 20 20 28 70 72 69 6e 74 20 22 69 74 65 6d 73 74    (print "itemst
4550: 61 62 6c 65 3a 20 22 29 28 70 70 20 28 69 74 65  able: ")(pp (ite
4560: 6d 2d 74 61 62 6c 65 2d 3e 69 74 65 6d 2d 6c 69  m-table->item-li
4570: 73 74 20 69 74 65 6d 73 74 61 62 6c 65 29 29 29  st itemstable)))
4580: 29 0a 09 20 20 20 20 20 20 28 66 6f 72 2d 65 61  )..      (for-ea
4590: 63 68 0a 09 20 20 20 20 20 20 20 28 6c 61 6d 62  ch..       (lamb
45a0: 64 61 20 28 6d 79 2d 69 74 65 6d 64 61 74 29 0a  da (my-itemdat).
45b0: 09 09 20 28 6c 65 74 2a 20 28 28 6e 65 77 2d 74  .. (let* ((new-t
45c0: 65 73 74 2d 72 65 63 6f 72 64 20 28 6c 65 74 20  est-record (let 
45d0: 28 28 6e 65 77 72 65 63 20 28 6d 61 6b 65 2d 74  ((newrec (make-t
45e0: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 29 29  ests:testqueue))
45f0: 29 0a 09 09 09 09 09 20 20 20 28 76 65 63 74 6f  )......   (vecto
4600: 72 2d 63 6f 70 79 21 20 74 65 73 74 2d 72 65 63  r-copy! test-rec
4610: 6f 72 64 20 6e 65 77 72 65 63 29 0a 09 09 09 09  ord newrec).....
4620: 09 20 20 20 6e 65 77 72 65 63 29 29 0a 09 09 09  .   newrec))....
4630: 28 6d 79 2d 69 74 65 6d 2d 70 61 74 68 20 28 69  (my-item-path (i
4640: 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 6d  tem-list->path m
4650: 79 2d 69 74 65 6d 64 61 74 29 29 29 0a 09 09 20  y-itemdat)))... 
4660: 20 20 28 69 66 20 28 70 61 74 74 2d 6c 69 73 74    (if (patt-list
4670: 2d 6d 61 74 63 68 20 6d 79 2d 69 74 65 6d 2d 70  -match my-item-p
4680: 61 74 68 20 69 74 65 6d 2d 70 61 74 74 73 29 20  ath item-patts) 
4690: 20 20 20 20 20 20 20 20 20 20 3b 3b 20 79 65 73            ;; yes
46a0: 2c 20 77 65 20 77 61 6e 74 20 74 6f 20 70 72 6f  , we want to pro
46b0: 63 65 73 73 20 74 68 69 73 20 69 74 65 6d 2c 20  cess this item, 
46c0: 4e 4f 54 45 3a 20 53 68 6f 75 6c 64 20 6e 6f 74  NOTE: Should not
46d0: 20 6e 65 65 64 20 74 68 69 73 20 63 68 65 63 6b   need this check
46e0: 20 68 65 72 65 21 0a 09 09 20 20 20 20 20 20 20   here!...       
46f0: 28 6c 65 74 20 28 28 6e 65 77 74 65 73 74 6e 61  (let ((newtestna
4700: 6d 65 20 28 63 6f 6e 63 20 68 65 64 20 22 2f 22  me (conc hed "/"
4710: 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68 29 29 29   my-item-path)))
4720: 20 20 20 20 3b 3b 20 74 65 73 74 20 6e 61 6d 65      ;; test name
4730: 73 20 61 72 65 20 75 6e 69 71 75 65 20 6f 6e 20  s are unique on 
4740: 74 65 73 74 6e 61 6d 65 2f 69 74 65 6d 2d 70 61  testname/item-pa
4750: 74 68 0a 09 09 09 20 28 74 65 73 74 73 3a 74 65  th.... (tests:te
4760: 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d  stqueue-set-item
4770: 73 21 20 20 20 20 20 6e 65 77 2d 74 65 73 74 2d  s!     new-test-
4780: 72 65 63 6f 72 64 20 23 66 29 0a 09 09 09 20 28  record #f).... (
4790: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
47a0: 73 65 74 2d 69 74 65 6d 64 61 74 21 20 20 20 6e  set-itemdat!   n
47b0: 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 6d  ew-test-record m
47c0: 79 2d 69 74 65 6d 64 61 74 29 0a 09 09 09 20 28  y-itemdat).... (
47d0: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
47e0: 73 65 74 2d 69 74 65 6d 5f 70 61 74 68 21 20 6e  set-item_path! n
47f0: 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 6d  ew-test-record m
4800: 79 2d 69 74 65 6d 2d 70 61 74 68 29 0a 09 09 09  y-item-path)....
4810: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74   (hash-table-set
4820: 21 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 6e  ! test-records n
4830: 65 77 74 65 73 74 6e 61 6d 65 20 6e 65 77 2d 74  ewtestname new-t
4840: 65 73 74 2d 72 65 63 6f 72 64 29 0a 09 09 09 20  est-record).... 
4850: 28 73 65 74 21 20 74 61 6c 20 28 63 6f 6e 73 20  (set! tal (cons 
4860: 6e 65 77 74 65 73 74 6e 61 6d 65 20 74 61 6c 29  newtestname tal)
4870: 29 29 29 29 29 20 3b 3b 20 73 69 6e 63 65 20 74  ))))) ;; since t
4880: 68 65 73 65 20 61 72 65 20 69 74 65 6d 69 7a 65  hese are itemize
4890: 64 20 63 72 65 61 74 65 20 6e 65 77 20 74 65 73  d create new tes
48a0: 74 20 6e 61 6d 65 73 20 74 65 73 74 6e 61 6d 65  t names testname
48b0: 2f 69 74 65 6d 70 61 74 68 0a 09 20 20 20 20 20  /itempath..     
48c0: 20 20 69 74 65 6d 73 29 0a 09 20 20 20 20 20 20    items)..      
48d0: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20  (if (not (null? 
48e0: 74 61 6c 29 29 0a 09 09 20 20 28 6c 6f 6f 70 20  tal))...  (loop 
48f0: 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74 61  (car tal)(cdr ta
4900: 6c 29 29 29 29 0a 0a 09 20 20 20 20 20 3b 3b 20  l))))...     ;; 
4910: 69 66 20 69 74 65 6d 73 20 69 73 20 61 20 70 72  if items is a pr
4920: 6f 63 20 74 68 65 6e 20 6e 65 65 64 20 74 6f 20  oc then need to 
4930: 72 75 6e 20 69 74 65 6d 73 3a 67 65 74 2d 69 74  run items:get-it
4940: 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 2c  ems-from-config,
4950: 20 67 65 74 20 74 68 65 20 6c 69 73 74 20 61 6e   get the list an
4960: 64 20 6c 6f 6f 70 20 0a 09 20 20 20 20 20 3b 3b  d loop ..     ;;
4970: 20 20 20 20 2d 20 62 75 74 20 6f 6e 6c 79 20 64      - but only d
4980: 6f 20 74 68 61 74 20 69 66 20 72 65 73 6f 75 72  o that if resour
4990: 63 65 73 20 65 78 69 73 74 20 74 6f 20 6b 69 63  ces exist to kic
49a0: 6b 20 6f 66 66 20 74 68 65 20 6a 6f 62 0a 09 20  k off the job.. 
49b0: 20 20 20 20 28 28 6f 72 20 28 70 72 6f 63 65 64      ((or (proced
49c0: 75 72 65 3f 20 69 74 65 6d 73 29 28 65 71 3f 20  ure? items)(eq? 
49d0: 69 74 65 6d 73 20 27 68 61 76 65 2d 70 72 6f 63  items 'have-proc
49e0: 65 64 75 72 65 29 29 0a 09 20 20 20 20 20 20 28  edure))..      (
49f0: 6c 65 74 20 28 28 63 61 6e 2d 72 75 6e 2d 6d 6f  let ((can-run-mo
4a00: 72 65 20 20 20 20 28 72 75 6e 73 3a 63 61 6e 2d  re    (runs:can-
4a10: 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 64  run-more-tests d
4a20: 62 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 29  b test-record)))
4a30: 0a 09 09 28 69 66 20 63 61 6e 2d 72 75 6e 2d 6d  ...(if can-run-m
4a40: 6f 72 65 0a 09 09 20 20 20 20 28 6c 65 74 2a 20  ore...    (let* 
4a50: 28 28 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65  ((prereqs-not-me
4a60: 74 20 28 64 62 3a 67 65 74 2d 70 72 65 72 65 71  t (db:get-prereq
4a70: 73 2d 6e 6f 74 2d 6d 65 74 20 64 62 20 72 75 6e  s-not-met db run
4a80: 2d 69 64 20 77 61 69 74 6f 6e 73 20 69 74 65 6d  -id waitons item
4a90: 2d 70 61 74 68 20 6d 6f 64 65 3a 20 74 65 73 74  -path mode: test
4aa0: 6d 6f 64 65 29 29 0a 09 09 09 20 20 20 28 66 61  mode))....   (fa
4ab0: 69 6c 73 20 20 20 20 20 20 20 20 20 20 20 28 63  ils           (c
4ac0: 61 6c 63 2d 66 61 69 6c 73 20 70 72 65 72 65 71  alc-fails prereq
4ad0: 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 09 09 09 20  s-not-met)).... 
4ae0: 20 20 28 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64    (non-completed
4af0: 20 20 20 28 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d     (calc-not-com
4b00: 70 6c 65 74 65 64 20 70 72 65 72 65 71 73 2d 6e  pleted prereqs-n
4b10: 6f 74 2d 6d 65 74 29 29 29 0a 09 09 20 20 20 20  ot-met)))...    
4b20: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 38    (debug:print 8
4b30: 20 22 49 4e 46 4f 3a 20 63 61 6e 2d 72 75 6e 2d   "INFO: can-run-
4b40: 6d 6f 72 65 3a 20 22 20 63 61 6e 2d 72 75 6e 2d  more: " can-run-
4b50: 6d 6f 72 65 0a 09 09 09 09 20 20 20 22 5c 6e 20  more.....   "\n 
4b60: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 3a  prereqs-not-met:
4b70: 20 22 20 28 70 72 65 74 74 79 2d 73 74 72 69 6e   " (pretty-strin
4b80: 67 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65  g prereqs-not-me
4b90: 74 29 0a 09 09 09 09 20 20 20 22 5c 6e 20 6e 6f  t).....   "\n no
4ba0: 6e 2d 63 6f 6d 70 6c 65 74 65 64 3a 20 20 20 22  n-completed:   "
4bb0: 20 28 70 72 65 74 74 79 2d 73 74 72 69 6e 67 20   (pretty-string 
4bc0: 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 20 0a  non-completed) .
4bd0: 09 09 09 09 20 20 20 22 5c 6e 20 66 61 69 6c 73  ....   "\n fails
4be0: 3a 20 20 20 20 20 20 20 20 20 20 20 22 20 28 70  :           " (p
4bf0: 72 65 74 74 79 2d 73 74 72 69 6e 67 20 66 61 69  retty-string fai
4c00: 6c 73 29 0a 09 09 09 09 20 20 20 22 5c 6e 20 74  ls).....   "\n t
4c10: 65 73 74 6d 6f 64 65 3a 20 20 20 20 20 20 20 20  estmode:        
4c20: 22 20 74 65 73 74 6d 6f 64 65 0a 09 09 09 09 20  " testmode..... 
4c30: 20 20 22 5c 6e 20 28 65 71 3f 20 74 65 73 74 6d    "\n (eq? testm
4c40: 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c 29 20 22  ode 'toplevel) "
4c50: 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27   (eq? testmode '
4c60: 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09 20 20  toplevel).....  
4c70: 20 22 5c 6e 20 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d   "\n (null? non-
4c80: 63 6f 6d 70 6c 65 74 65 64 29 20 20 20 20 22 20  completed)    " 
4c90: 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c  (null? non-compl
4ca0: 65 74 65 64 29 29 0a 09 09 20 20 20 20 20 20 28  eted))...      (
4cb0: 63 6f 6e 64 20 0a 09 09 20 20 20 20 20 20 20 28  cond ...       (
4cc0: 28 6f 72 20 28 6e 75 6c 6c 3f 20 70 72 65 72 65  (or (null? prere
4cd0: 71 73 2d 6e 6f 74 2d 6d 65 74 29 20 3b 3b 20 61  qs-not-met) ;; a
4ce0: 6c 6c 20 70 72 65 72 65 71 73 20 6d 65 74 2c 20  ll prereqs met, 
4cf0: 66 69 72 65 20 6f 66 66 20 74 68 65 20 74 65 73  fire off the tes
4d00: 74 0a 09 09 09 20 20 20 20 3b 3b 20 6f 72 2c 20  t....    ;; or, 
4d10: 69 66 20 69 74 20 69 73 20 61 20 27 74 6f 70 6c  if it is a 'topl
4d20: 65 76 65 6c 20 74 65 73 74 20 61 6e 64 20 61 6c  evel test and al
4d30: 6c 20 70 72 65 72 65 71 73 20 6e 6f 74 20 6d 65  l prereqs not me
4d40: 74 20 61 72 65 20 43 4f 4d 50 4c 45 54 45 44 20  t are COMPLETED 
4d50: 74 68 65 6e 20 6c 61 75 6e 63 68 0a 09 09 09 20  then launch.... 
4d60: 20 20 20 28 61 6e 64 20 28 65 71 3f 20 74 65 73     (and (eq? tes
4d70: 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c 29  tmode 'toplevel)
4d80: 0a 09 09 09 09 20 28 6e 75 6c 6c 3f 20 6e 6f 6e  ..... (null? non
4d90: 2d 63 6f 6d 70 6c 65 74 65 64 29 29 29 0a 09 09  -completed)))...
4da0: 09 28 6c 65 74 20 28 28 74 65 73 74 2d 6e 61 6d  .(let ((test-nam
4db0: 65 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65  e (tests:testque
4dc0: 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20  ue-get-testname 
4dd0: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 29 0a 09  test-record)))..
4de0: 09 09 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f  ..  (setenv "MT_
4df0: 54 45 53 54 5f 4e 41 4d 45 22 20 74 65 73 74 2d  TEST_NAME" test-
4e00: 6e 61 6d 65 29 20 3b 3b 20 0a 09 09 09 20 20 28  name) ;; ....  (
4e10: 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e 4e 41  setenv "MT_RUNNA
4e20: 4d 45 22 20 20 20 72 75 6e 6e 61 6d 65 29 0a 09  ME"   runname)..
4e30: 09 09 20 20 28 73 65 74 2d 6d 65 67 61 74 65 73  ..  (set-megates
4e40: 74 2d 65 6e 76 2d 76 61 72 73 20 64 62 20 72 75  t-env-vars db ru
4e50: 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73 65 20 6d  n-id) ;; these m
4e60: 61 79 20 62 65 20 6e 65 65 64 65 64 20 62 79 20  ay be needed by 
4e70: 74 68 65 20 6c 61 75 6e 63 68 69 6e 67 20 70 72  the launching pr
4e80: 6f 63 65 73 73 0a 09 09 09 20 20 28 6c 65 74 20  ocess....  (let 
4e90: 28 28 69 74 65 6d 73 2d 6c 69 73 74 20 28 69 74  ((items-list (it
4ea0: 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72  ems:get-items-fr
4eb0: 6f 6d 2d 63 6f 6e 66 69 67 20 74 63 6f 6e 66 69  om-config tconfi
4ec0: 67 29 29 29 0a 09 09 09 20 20 20 20 28 69 66 20  g)))....    (if 
4ed0: 28 6c 69 73 74 3f 20 69 74 65 6d 73 2d 6c 69 73  (list? items-lis
4ee0: 74 29 0a 09 09 09 09 28 62 65 67 69 6e 0a 09 09  t).....(begin...
4ef0: 09 09 20 20 28 74 65 73 74 73 3a 74 65 73 74 71  ..  (tests:testq
4f00: 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 73 21 20  ueue-set-items! 
4f10: 74 65 73 74 2d 72 65 63 6f 72 64 20 69 74 65 6d  test-record item
4f20: 73 2d 6c 69 73 74 29 0a 09 09 09 09 20 20 28 6c  s-list).....  (l
4f30: 6f 6f 70 20 68 65 64 20 74 61 6c 29 29 0a 09 09  oop hed tal))...
4f40: 09 09 28 62 65 67 69 6e 0a 09 09 09 09 20 20 28  ..(begin.....  (
4f50: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45  debug:print 0 "E
4f60: 52 52 4f 52 3a 20 54 68 65 20 70 72 6f 63 20 66  RROR: The proc f
4f70: 72 6f 6d 20 72 65 61 64 69 6e 67 20 74 68 65 20  rom reading the 
4f80: 73 65 74 75 70 20 64 69 64 20 6e 6f 74 20 79 69  setup did not yi
4f90: 65 6c 64 20 61 20 6c 69 73 74 20 2d 20 70 6c 65  eld a list - ple
4fa0: 61 73 65 20 72 65 70 6f 72 74 20 74 68 69 73 22  ase report this"
4fb0: 29 0a 09 09 09 09 20 20 28 65 78 69 74 20 31 29  ).....  (exit 1)
4fc0: 29 29 29 29 29 0a 09 09 20 20 20 20 20 20 20 28  )))))...       (
4fd0: 28 6e 75 6c 6c 3f 20 66 61 69 6c 73 29 0a 09 09  (null? fails)...
4fe0: 09 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74  .(loop (car newt
4ff0: 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 29  al)(cdr newtal))
5000: 29 20 3b 3b 20 61 6e 20 69 73 73 75 65 20 77 69  ) ;; an issue wi
5010: 74 68 20 70 72 65 72 65 71 73 20 6e 6f 74 20 79  th prereqs not y
5020: 65 74 20 6d 65 74 3f 0a 09 09 20 20 20 20 20 20  et met?...      
5030: 20 28 28 61 6e 64 20 28 6e 6f 74 20 28 6e 75 6c   ((and (not (nul
5040: 6c 3f 20 66 61 69 6c 73 29 29 28 65 71 3f 20 74  l? fails))(eq? t
5050: 65 73 74 6d 6f 64 65 20 27 6e 6f 72 6d 61 6c 29  estmode 'normal)
5060: 29 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e  )....(debug:prin
5070: 74 20 31 20 22 49 4e 46 4f 3a 20 74 65 73 74 20  t 1 "INFO: test 
5080: 22 20 20 68 65 64 20 22 20 28 6d 6f 64 65 3d 22  "  hed " (mode="
5090: 20 74 65 73 74 6d 6f 64 65 20 22 29 20 68 61 73   testmode ") has
50a0: 20 66 61 69 6c 65 64 20 70 72 65 72 65 71 75 69   failed prerequi
50b0: 73 69 74 65 28 73 29 3b 20 22 0a 09 09 09 09 20  site(s); "..... 
50c0: 20 20 20 20 28 73 74 72 69 6e 67 2d 69 6e 74 65      (string-inte
50d0: 72 73 70 65 72 73 65 20 28 6d 61 70 20 28 6c 61  rsperse (map (la
50e0: 6d 62 64 61 20 28 74 29 28 63 6f 6e 63 20 28 64  mbda (t)(conc (d
50f0: 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e  b:test-get-testn
5100: 61 6d 65 20 74 29 20 22 3a 22 20 28 64 62 3a 74  ame t) ":" (db:t
5110: 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74 29  est-get-state t)
5120: 22 2f 22 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  "/"(db:test-get-
5130: 73 74 61 74 75 73 20 74 29 29 29 20 66 61 69 6c  status t))) fail
5140: 73 29 20 22 2c 20 22 29 0a 09 09 09 09 20 20 20  s) ", ").....   
5150: 20 20 22 2c 20 72 65 6d 6f 76 69 6e 67 20 69 74    ", removing it
5160: 20 66 72 6f 6d 20 74 6f 2d 64 6f 20 6c 69 73 74   from to-do list
5170: 22 29 0a 09 09 09 28 69 66 20 28 6e 6f 74 20 28  ")....(if (not (
5180: 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 09 20  null? tal)).... 
5190: 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61     (loop (car ta
51a0: 6c 29 28 63 64 72 20 74 61 6c 29 29 29 29 0a 09  l)(cdr tal))))..
51b0: 09 20 20 20 20 20 20 20 28 65 6c 73 65 0a 09 09  .       (else...
51c0: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 38 20  .(debug:print 8 
51d0: 22 45 52 52 4f 52 3a 20 4e 6f 20 68 61 6e 64 6c  "ERROR: No handl
51e0: 65 72 20 66 6f 72 20 74 68 69 73 20 63 6f 6e 64  er for this cond
51f0: 69 74 69 6f 6e 2e 22 29 0a 09 09 09 3b 3b 20 09  ition.")....;; .
5200: 20 20 20 20 20 22 5c 6e 20 20 68 65 64 3a 20 20       "\n  hed:  
5210: 20 20 20 20 20 20 20 20 20 20 22 20 68 65 64 20            " hed 
5220: 0a 09 09 09 3b 3b 20 09 20 20 20 20 20 22 5c 6e  ....;; .     "\n
5230: 20 66 61 69 6c 73 3a 20 20 20 20 20 20 20 20 20   fails:         
5240: 20 20 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 65    " (string-inte
5250: 72 73 70 65 72 73 65 20 28 6d 61 70 20 64 62 3a  rsperse (map db:
5260: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d  test-get-testnam
5270: 65 20 66 61 69 6c 73 29 20 22 2c 22 29 0a 09 09  e fails) ",")...
5280: 09 3b 3b 20 09 20 20 20 20 20 22 5c 6e 20 74 65  .;; .     "\n te
5290: 73 74 6d 6f 64 65 3a 20 20 20 20 20 20 20 20 22  stmode:        "
52a0: 20 74 65 73 74 6d 6f 64 65 0a 09 09 09 3b 3b 20   testmode....;; 
52b0: 09 20 20 20 20 20 22 5c 6e 20 70 72 65 72 65 71  .     "\n prereq
52c0: 73 2d 6e 6f 74 2d 6d 65 74 3a 20 22 20 28 70 72  s-not-met: " (pr
52d0: 65 74 74 79 2d 73 74 72 69 6e 67 20 70 72 65 72  etty-string prer
52e0: 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09 09  eqs-not-met)....
52f0: 3b 3b 20 09 20 20 20 20 20 22 5c 6e 20 69 74 65  ;; .     "\n ite
5300: 6d 73 3a 20 20 20 20 20 20 20 20 20 20 20 22 20  ms:           " 
5310: 69 74 65 6d 73 29 0a 09 09 09 28 6c 6f 6f 70 20  items)....(loop 
5320: 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72  (car newtal)(cdr
5330: 20 6e 65 77 74 61 6c 29 29 29 29 29 0a 09 09 20   newtal)))))... 
5340: 20 20 20 3b 3b 20 69 66 20 63 61 6e 27 74 20 72     ;; if can't r
5350: 75 6e 20 6d 6f 72 65 20 6a 75 73 74 20 6c 6f 6f  un more just loo
5360: 70 20 77 69 74 68 20 6e 65 78 74 20 70 6f 73 73  p with next poss
5370: 69 62 6c 65 20 74 65 73 74 0a 09 09 20 20 20 20  ible test...    
5380: 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61  (loop (car newta
5390: 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 29 29  l)(cdr newtal)))
53a0: 29 29 0a 09 20 20 20 20 20 0a 09 20 20 20 20 20  ))..     ..     
53b0: 3b 3b 20 74 68 69 73 20 63 61 73 65 20 73 68 6f  ;; this case sho
53c0: 75 6c 64 20 6e 6f 74 20 68 61 70 70 65 6e 2c 20  uld not happen, 
53d0: 61 64 64 65 64 20 74 6f 20 68 65 6c 70 20 63 61  added to help ca
53e0: 74 63 68 20 61 6e 79 20 62 75 67 73 0a 09 20 20  tch any bugs..  
53f0: 20 20 20 28 28 61 6e 64 20 28 6c 69 73 74 3f 20     ((and (list? 
5400: 69 74 65 6d 73 29 20 69 74 65 6d 64 61 74 29 0a  items) itemdat).
5410: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72  .      (debug:pr
5420: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 53 68  int 0 "ERROR: Sh
5430: 6f 75 6c 64 20 6e 6f 74 20 68 61 76 65 20 61 20  ould not have a 
5440: 6c 69 73 74 20 6f 66 20 69 74 65 6d 73 20 69 6e  list of items in
5450: 20 61 20 74 65 73 74 20 61 6e 64 20 74 68 65 20   a test and the 
5460: 69 74 65 6d 73 70 61 74 68 20 73 65 74 20 2d 20  itemspath set - 
5470: 70 6c 65 61 73 65 20 72 65 70 6f 72 74 20 74 68  please report th
5480: 69 73 22 29 0a 09 20 20 20 20 20 20 28 65 78 69  is")..      (exi
5490: 74 20 31 29 29 29 29 0a 09 20 20 0a 09 20 20 3b  t 1))))..  ..  ;
54a0: 3b 20 77 65 20 67 65 74 20 68 65 72 65 20 6f 6e  ; we get here on
54b0: 20 22 64 72 6f 70 20 74 68 72 6f 75 67 68 22 20   "drop through" 
54c0: 2d 20 6c 6f 6f 70 20 66 6f 72 20 6e 65 78 74 20  - loop for next 
54d0: 74 65 73 74 20 69 6e 20 71 75 65 75 65 0a 09 20  test in queue.. 
54e0: 20 28 69 66 20 28 6e 75 6c 6c 3f 20 74 61 6c 29   (if (null? tal)
54f0: 0a 09 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09  ..      (begin..
5500: 09 3b 3b 20 46 49 58 4d 45 21 21 21 21 20 54 48  .;; FIXME!!!! TH
5510: 49 53 20 53 48 4f 55 4c 44 20 4e 4f 54 20 52 45  IS SHOULD NOT RE
5520: 51 55 49 52 45 20 41 4e 20 45 58 49 54 21 21 21  QUIRE AN EXIT!!!
5530: 21 21 21 21 0a 09 09 28 64 65 62 75 67 3a 70 72  !!!!...(debug:pr
5540: 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 41 6c 6c  int 1 "INFO: All
5550: 20 74 65 73 74 73 20 6c 61 75 6e 63 68 65 64 22   tests launched"
5560: 29 0a 09 09 28 74 68 72 65 61 64 2d 73 6c 65 65  )...(thread-slee
5570: 70 21 20 30 2e 35 29 0a 09 09 3b 3b 20 46 49 58  p! 0.5)...;; FIX
5580: 4d 45 21 20 54 68 69 73 20 68 61 72 73 68 20 65  ME! This harsh e
5590: 78 69 74 20 73 68 6f 75 6c 64 20 6e 6f 74 20 62  xit should not b
55a0: 65 20 6e 65 63 65 73 73 61 72 79 2e 2e 2e 2e 0a  e necessary.....
55b0: 09 09 28 69 66 20 28 6e 6f 74 20 2a 72 75 6e 72  ..(if (not *runr
55c0: 65 6d 6f 74 65 2a 29 28 65 78 69 74 29 29 20 3b  emote*)(exit)) ;
55d0: 3b 20 0a 09 09 23 66 29 20 3b 3b 20 72 65 74 75  ; ...#f) ;; retu
55e0: 72 6e 20 61 20 23 66 20 61 73 20 61 20 68 69 6e  rn a #f as a hin
55f0: 74 20 74 68 61 74 20 77 65 20 61 72 65 20 64 6f  t that we are do
5600: 6e 65 0a 09 20 20 20 20 20 20 3b 3b 20 48 65 72  ne..      ;; Her
5610: 65 20 77 65 20 6e 65 65 64 20 74 6f 20 63 68 65  e we need to che
5620: 63 6b 20 74 68 61 74 20 61 6c 6c 20 74 68 65 20  ck that all the 
5630: 74 65 73 74 73 20 72 65 6d 61 69 6e 69 6e 67 20  tests remaining 
5640: 74 6f 20 62 65 20 72 75 6e 20 61 72 65 20 65 6c  to be run are el
5650: 69 67 69 62 6c 65 20 74 6f 20 72 75 6e 0a 09 20  igible to run.. 
5660: 20 20 20 20 20 3b 3b 20 61 6e 64 20 61 72 65 20       ;; and are 
5670: 6e 6f 74 20 62 6c 6f 63 6b 65 64 20 62 79 20 66  not blocked by f
5680: 61 69 6c 65 64 0a 09 20 20 20 20 20 20 28 6c 65  ailed..      (le
5690: 74 20 28 28 6e 65 77 6c 73 74 20 28 74 65 73 74  t ((newlst (test
56a0: 73 3a 66 69 6c 74 65 72 2d 6e 6f 6e 2d 72 75 6e  s:filter-non-run
56b0: 6e 61 62 6c 65 20 64 62 20 72 75 6e 2d 69 64 20  nable db run-id 
56c0: 74 61 6c 20 74 65 73 74 2d 72 65 63 6f 72 64 73  tal test-records
56d0: 29 29 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f 74 20  ))) ;; i.e. not 
56e0: 46 41 49 4c 2c 20 57 41 49 56 45 44 2c 20 49 4e  FAIL, WAIVED, IN
56f0: 43 4f 4d 50 4c 45 54 45 2c 20 50 41 53 53 2c 20  COMPLETE, PASS, 
5700: 4b 49 4c 4c 45 44 2c 0a 09 09 28 74 68 72 65 61  KILLED,...(threa
5710: 64 2d 73 6c 65 65 70 21 20 30 2e 31 29 0a 09 09  d-sleep! 0.1)...
5720: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20  (if (not (null? 
5730: 6e 65 77 6c 73 74 29 29 0a 09 09 20 20 20 20 28  newlst))...    (
5740: 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 6c 73 74  loop (car newlst
5750: 29 28 63 64 72 20 6e 65 77 6c 73 74 29 29 29 29  )(cdr newlst))))
5760: 29 29 29 29 29 0a 0a 3b 3b 20 70 61 72 65 6e 74  )))))..;; parent
5770: 2d 74 65 73 74 20 69 73 20 74 68 65 72 65 20 61  -test is there a
5780: 73 20 61 20 70 6c 61 63 65 68 6f 6c 64 65 72 20  s a placeholder 
5790: 66 6f 72 20 77 68 65 6e 20 70 61 72 65 6e 74 2d  for when parent-
57a0: 74 65 73 74 73 20 63 61 6e 20 62 65 20 72 75 6e  tests can be run
57b0: 20 61 73 20 61 20 73 65 74 75 70 20 73 74 65 70   as a setup step
57c0: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 3a 74 65  .(define (run:te
57d0: 73 74 20 64 62 20 72 75 6e 2d 69 64 20 72 75 6e  st db run-id run
57e0: 6e 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20 74  name keyvallst t
57f0: 65 73 74 2d 72 65 63 6f 72 64 20 66 6c 61 67 73  est-record flags
5800: 20 70 61 72 65 6e 74 2d 74 65 73 74 29 0a 20 20   parent-test).  
5810: 3b 3b 20 41 6c 6c 20 74 68 65 73 65 20 76 61 72  ;; All these var
5820: 73 20 6d 69 67 68 74 20 62 65 20 72 65 66 65 72  s might be refer
5830: 65 6e 63 65 64 20 62 79 20 74 68 65 20 74 65 73  enced by the tes
5840: 74 63 6f 6e 66 69 67 20 66 69 6c 65 20 72 65 61  tconfig file rea
5850: 64 65 72 0a 20 20 28 6c 65 74 2a 20 28 28 74 65  der.  (let* ((te
5860: 73 74 2d 6e 61 6d 65 20 20 20 20 28 74 65 73 74  st-name    (test
5870: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d  s:testqueue-get-
5880: 74 65 73 74 6e 61 6d 65 20 20 20 74 65 73 74 2d  testname   test-
5890: 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65 73 74  record)).. (test
58a0: 2d 77 61 69 74 6f 6e 73 20 28 74 65 73 74 73 3a  -waitons (tests:
58b0: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 77 61  testqueue-get-wa
58c0: 69 74 6f 6e 73 20 20 20 20 74 65 73 74 2d 72 65  itons    test-re
58d0: 63 6f 72 64 29 29 0a 09 20 28 74 65 73 74 2d 63  cord)).. (test-c
58e0: 6f 6e 66 20 20 20 20 28 74 65 73 74 73 3a 74 65  onf    (tests:te
58f0: 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74  stqueue-get-test
5900: 63 6f 6e 66 69 67 20 74 65 73 74 2d 72 65 63 6f  config test-reco
5910: 72 64 29 29 0a 09 20 28 69 74 65 6d 64 61 74 20  rd)).. (itemdat 
5920: 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74       (tests:test
5930: 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d 64 61  queue-get-itemda
5940: 74 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64  t    test-record
5950: 29 29 0a 09 20 28 74 65 73 74 2d 70 61 74 68 20  )).. (test-path 
5960: 20 20 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74     (conc *toppat
5970: 68 2a 20 22 2f 74 65 73 74 73 2f 22 20 74 65 73  h* "/tests/" tes
5980: 74 2d 6e 61 6d 65 29 29 20 3b 3b 20 63 6f 75 6c  t-name)) ;; coul
5990: 64 20 75 73 65 20 74 65 73 74 73 3a 67 65 74 2d  d use tests:get-
59a0: 74 65 73 74 63 6f 6e 66 69 67 20 68 65 72 65 20  testconfig here 
59b0: 2e 2e 2e 0a 09 20 28 66 6f 72 63 65 20 20 20 20  ..... (force    
59c0: 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d      (hash-table-
59d0: 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67  ref/default flag
59e0: 73 20 22 2d 66 6f 72 63 65 22 20 23 66 29 29 0a  s "-force" #f)).
59f0: 09 20 28 72 65 72 75 6e 20 20 20 20 20 20 20 20  . (rerun        
5a00: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f  (hash-table-ref/
5a10: 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d  default flags "-
5a20: 72 65 72 75 6e 22 20 23 66 29 29 0a 09 20 28 6b  rerun" #f)).. (k
5a30: 65 65 70 67 6f 69 6e 67 20 20 20 20 28 68 61 73  eepgoing    (has
5a40: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61  h-table-ref/defa
5a50: 75 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 65 70  ult flags "-keep
5a60: 67 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 28 69  going" #f)).. (i
5a70: 74 65 6d 2d 70 61 74 68 20 20 20 20 20 22 22 29  tem-path     "")
5a80: 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ).    (debug:pri
5a90: 6e 74 20 35 0a 09 09 20 22 74 65 73 74 2d 63 6f  nt 5... "test-co
5aa0: 6e 66 69 67 3a 20 22 20 28 68 61 73 68 2d 74 61  nfig: " (hash-ta
5ab0: 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65 73 74 2d  ble->alist test-
5ac0: 63 6f 6e 66 29 0a 09 09 20 22 5c 6e 20 20 20 69  conf)... "\n   i
5ad0: 74 65 6d 64 61 74 3a 20 22 20 69 74 65 6d 64 61  temdat: " itemda
5ae0: 74 0a 09 09 20 29 0a 20 20 20 20 3b 3b 20 73 65  t... ).    ;; se
5af0: 74 74 69 6e 67 20 69 74 65 6d 64 61 74 20 74 6f  tting itemdat to
5b00: 20 61 20 6c 69 73 74 20 69 66 20 69 74 20 69 73   a list if it is
5b10: 20 23 66 0a 20 20 20 20 28 69 66 20 28 6e 6f 74   #f.    (if (not
5b20: 20 69 74 65 6d 64 61 74 29 28 73 65 74 21 20 69   itemdat)(set! i
5b30: 74 65 6d 64 61 74 20 27 28 29 29 29 0a 20 20 20  temdat '())).   
5b40: 20 28 73 65 74 21 20 69 74 65 6d 2d 70 61 74 68   (set! item-path
5b50: 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74   (item-list->pat
5b60: 68 20 69 74 65 6d 64 61 74 29 29 0a 20 20 20 20  h itemdat)).    
5b70: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22  (debug:print 2 "
5b80: 41 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 6c 61  Attempting to la
5b90: 75 6e 63 68 20 74 65 73 74 20 22 20 74 65 73 74  unch test " test
5ba0: 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70  -name "/" item-p
5bb0: 61 74 68 29 0a 20 20 20 20 28 73 65 74 65 6e 76  ath).    (setenv
5bc0: 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d 45 22 20   "MT_TEST_NAME" 
5bd0: 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b 20 0a 20  test-name) ;; . 
5be0: 20 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 52     (setenv "MT_R
5bf0: 55 4e 4e 41 4d 45 22 20 20 20 72 75 6e 6e 61 6d  UNNAME"   runnam
5c00: 65 29 0a 20 20 20 20 28 73 65 74 2d 6d 65 67 61  e).    (set-mega
5c10: 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 64 62  test-env-vars db
5c20: 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73   run-id) ;; thes
5c30: 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64 20  e may be needed 
5c40: 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e 67  by the launching
5c50: 20 70 72 6f 63 65 73 73 0a 20 20 20 20 28 63 68   process.    (ch
5c60: 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 79 20 2a  ange-directory *
5c70: 74 6f 70 70 61 74 68 2a 29 0a 0a 20 20 20 20 3b  toppath*)..    ;
5c80: 3b 20 48 65 72 65 20 69 73 20 77 68 65 72 65 20  ; Here is where 
5c90: 74 68 65 20 74 65 73 74 5f 6d 65 74 61 20 74 61  the test_meta ta
5ca0: 62 6c 65 20 69 73 20 62 65 73 74 20 75 70 64 61  ble is best upda
5cb0: 74 65 64 0a 20 20 20 20 3b 3b 20 59 65 73 2c 20  ted.    ;; Yes, 
5cc0: 61 6e 6f 74 68 65 72 20 75 73 65 20 6f 66 20 61  another use of a
5cd0: 20 67 6c 6f 62 61 6c 20 66 6f 72 20 63 61 63 68   global for cach
5ce0: 69 6e 67 2e 20 4e 65 65 64 20 61 20 62 65 74 74  ing. Need a bett
5cf0: 65 72 20 77 61 79 3f 0a 20 20 20 20 28 69 66 20  er way?.    (if 
5d00: 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 62 6c 65  (not (hash-table
5d10: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 2a 74 65  -ref/default *te
5d20: 73 74 2d 6d 65 74 61 2d 75 70 64 61 74 65 64 2a  st-meta-updated*
5d30: 20 74 65 73 74 2d 6e 61 6d 65 20 23 66 29 29 0a   test-name #f)).
5d40: 20 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09          (begin..
5d50: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73     (hash-table-s
5d60: 65 74 21 20 2a 74 65 73 74 2d 6d 65 74 61 2d 75  et! *test-meta-u
5d70: 70 64 61 74 65 64 2a 20 74 65 73 74 2d 6e 61 6d  pdated* test-nam
5d80: 65 20 23 74 29 0a 20 20 20 20 20 20 20 20 20 20  e #t).          
5d90: 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65   (runs:update-te
5da0: 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74 2d  st_meta db test-
5db0: 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 29  name test-conf))
5dc0: 29 0a 20 20 20 20 0a 20 20 20 20 3b 3b 20 28 6c  ).    .    ;; (l
5dd0: 61 6d 62 64 61 20 28 69 74 65 6d 64 61 74 29 20  ambda (itemdat) 
5de0: 3b 3b 3b 20 28 28 72 69 70 65 6e 65 73 73 20 22  ;;; ((ripeness "
5df0: 6f 76 65 72 72 69 70 65 22 29 20 28 74 65 6d 70  overripe") (temp
5e00: 65 72 61 74 75 72 65 20 22 63 6f 6f 6c 22 29 20  erature "cool") 
5e10: 28 73 65 61 73 6f 6e 20 22 73 75 6d 6d 65 72 22  (season "summer"
5e20: 29 29 0a 20 20 20 20 28 6c 65 74 2a 20 28 28 6e  )).    (let* ((n
5e30: 65 77 2d 74 65 73 74 2d 70 61 74 68 20 28 73 74  ew-test-path (st
5e40: 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65  ring-intersperse
5e50: 20 28 63 6f 6e 73 20 74 65 73 74 2d 70 61 74 68   (cons test-path
5e60: 20 28 6d 61 70 20 63 61 64 72 20 69 74 65 6d 64   (map cadr itemd
5e70: 61 74 29 29 20 22 2f 22 29 29 0a 09 20 20 20 28  at)) "/"))..   (
5e80: 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 28 69  new-test-name (i
5e90: 66 20 28 65 71 75 61 6c 3f 20 69 74 65 6d 2d 70  f (equal? item-p
5ea0: 61 74 68 20 22 22 29 20 74 65 73 74 2d 6e 61 6d  ath "") test-nam
5eb0: 65 20 28 63 6f 6e 63 20 74 65 73 74 2d 6e 61 6d  e (conc test-nam
5ec0: 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29  e "/" item-path)
5ed0: 29 29 20 3b 3b 20 6a 75 73 74 20 6e 65 65 64 20  )) ;; just need 
5ee0: 69 74 20 74 6f 20 62 65 20 75 6e 69 71 75 65 0a  it to be unique.
5ef0: 09 20 20 20 28 74 65 73 74 64 61 74 20 20 20 20  .   (testdat    
5f00: 20 20 20 28 64 62 3a 67 65 74 2d 74 65 73 74 2d     (db:get-test-
5f10: 69 6e 66 6f 20 64 62 20 72 75 6e 2d 69 64 20 74  info db run-id t
5f20: 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61  est-name item-pa
5f30: 74 68 29 29 0a 09 20 20 20 28 74 65 73 74 2d 69  th))..   (test-i
5f40: 64 20 20 20 20 20 20 20 23 66 29 29 0a 20 20 20  d       #f)).   
5f50: 20 20 20 28 69 66 20 28 6e 6f 74 20 74 65 73 74     (if (not test
5f60: 64 61 74 29 0a 09 20 20 28 62 65 67 69 6e 0a 09  dat)..  (begin..
5f70: 20 20 20 20 3b 3b 20 65 6e 73 75 72 65 20 74 68      ;; ensure th
5f80: 61 74 20 74 68 65 20 70 61 74 68 20 65 78 69 73  at the path exis
5f90: 74 73 20 62 65 66 6f 72 65 20 72 65 67 69 73 74  ts before regist
5fa0: 65 72 69 6e 67 20 74 68 65 20 74 65 73 74 0a 09  ering the test..
5fb0: 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 43 61 6e      ;; NOPE: Can
5fc0: 6e 6f 74 21 20 44 6f 6e 27 74 20 6b 6e 6f 77 20  not! Don't know 
5fd0: 79 65 74 20 77 68 69 63 68 20 64 69 73 6b 20 61  yet which disk a
5fe0: 72 65 61 20 77 69 6c 6c 20 62 65 20 61 73 73 69  rea will be assi
5ff0: 67 6e 65 64 2e 2e 2e 2e 0a 09 20 20 20 20 3b 3b  gned......    ;;
6000: 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 22   (system (conc "
6010: 6d 6b 64 69 72 20 2d 70 20 22 20 6e 65 77 2d 74  mkdir -p " new-t
6020: 65 73 74 2d 70 61 74 68 29 29 0a 09 20 20 20 20  est-path))..    
6030: 28 72 74 65 73 74 73 3a 72 65 67 69 73 74 65 72  (rtests:register
6040: 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20  -test db run-id 
6050: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70  test-name item-p
6060: 61 74 68 29 0a 09 20 20 20 20 28 73 65 74 21 20  ath)..    (set! 
6070: 74 65 73 74 64 61 74 20 28 64 62 3a 67 65 74 2d  testdat (db:get-
6080: 74 65 73 74 2d 69 6e 66 6f 20 64 62 20 72 75 6e  test-info db run
6090: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74  -id test-name it
60a0: 65 6d 2d 70 61 74 68 29 29 29 29 0a 20 20 20 20  em-path)))).    
60b0: 20 20 28 73 65 74 21 20 74 65 73 74 2d 69 64 20    (set! test-id 
60c0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20  (db:test-get-id 
60d0: 74 65 73 74 64 61 74 29 29 0a 20 20 20 20 20 20  testdat)).      
60e0: 28 63 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72  (change-director
60f0: 79 20 74 65 73 74 2d 70 61 74 68 29 0a 20 20 20  y test-path).   
6100: 20 20 20 28 63 61 73 65 20 28 69 66 20 66 6f 72     (case (if for
6110: 63 65 20 3b 3b 20 28 61 72 67 73 3a 67 65 74 2d  ce ;; (args:get-
6120: 61 72 67 20 22 2d 66 6f 72 63 65 22 29 0a 09 09  arg "-force")...
6130: 27 4e 4f 54 5f 53 54 41 52 54 45 44 0a 09 09 28  'NOT_STARTED...(
6140: 69 66 20 74 65 73 74 64 61 74 0a 09 09 20 20 20  if testdat...   
6150: 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c   (string->symbol
6160: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65   (test:get-state
6170: 20 74 65 73 74 64 61 74 29 29 0a 09 09 20 20 20   testdat))...   
6180: 20 27 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65   'failed-to-inse
6190: 72 74 29 29 0a 09 28 28 66 61 69 6c 65 64 2d 74  rt))..((failed-t
61a0: 6f 2d 69 6e 73 65 72 74 29 0a 09 20 28 64 65 62  o-insert).. (deb
61b0: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f  ug:print 0 "ERRO
61c0: 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 69 6e 73  R: Failed to ins
61d0: 65 72 74 20 74 68 65 20 72 65 63 6f 72 64 20 69  ert the record i
61e0: 6e 74 6f 20 74 68 65 20 64 62 22 29 29 0a 09 28  nto the db"))..(
61f0: 28 4e 4f 54 5f 53 54 41 52 54 45 44 20 43 4f 4d  (NOT_STARTED COM
6200: 50 4c 45 54 45 44 29 0a 09 20 28 6c 65 74 20 28  PLETED).. (let (
6210: 28 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20  (runflag #f)).. 
6220: 20 20 28 63 6f 6e 64 0a 09 20 20 20 20 3b 3b 20    (cond..    ;; 
6230: 2d 66 6f 72 63 65 2c 20 72 75 6e 20 6e 6f 20 6d  -force, run no m
6240: 61 74 74 65 72 20 77 68 61 74 0a 09 20 20 20 20  atter what..    
6250: 28 66 6f 72 63 65 20 28 73 65 74 21 20 72 75 6e  (force (set! run
6260: 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b  flag #t))..    ;
6270: 3b 20 4e 4f 54 5f 53 54 41 52 54 45 44 2c 20 72  ; NOT_STARTED, r
6280: 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77 68 61  un no matter wha
6290: 74 0a 09 20 20 20 20 28 28 65 71 75 61 6c 3f 20  t..    ((equal? 
62a0: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20  (test:get-state 
62b0: 74 65 73 74 64 61 74 29 20 22 4e 4f 54 5f 53 54  testdat) "NOT_ST
62c0: 41 52 54 45 44 22 29 28 73 65 74 21 20 72 75 6e  ARTED")(set! run
62d0: 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b  flag #t))..    ;
62e0: 3b 20 6e 6f 74 20 2d 72 65 72 75 6e 20 61 6e 64  ; not -rerun and
62f0: 20 50 41 53 53 2c 20 57 41 52 4e 20 6f 72 20 43   PASS, WARN or C
6300: 48 45 43 4b 2c 20 64 6f 20 6e 6f 20 72 75 6e 0a  HECK, do no run.
6310: 09 20 20 20 20 28 28 61 6e 64 20 28 6f 72 20 28  .    ((and (or (
6320: 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09 20 20 20  not rerun)...   
6330: 20 20 20 6b 65 65 70 67 6f 69 6e 67 29 0a 09 09     keepgoing)...
6340: 20 20 3b 3b 20 52 65 71 75 69 72 65 20 74 6f 20    ;; Require to 
6350: 66 6f 72 63 65 20 72 65 2d 72 75 6e 20 66 6f 72  force re-run for
6360: 20 43 4f 4d 50 4c 45 54 45 44 20 6f 72 20 2a 61   COMPLETED or *a
6370: 6e 79 74 68 69 6e 67 2a 20 2b 20 50 41 53 53 2c  nything* + PASS,
6380: 57 41 52 4e 20 6f 72 20 43 48 45 43 4b 0a 09 09  WARN or CHECK...
6390: 20 20 28 6f 72 20 28 6d 65 6d 62 65 72 20 28 74    (or (member (t
63a0: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74  est:get-status t
63b0: 65 73 74 64 61 74 29 20 27 28 22 50 41 53 53 22  estdat) '("PASS"
63c0: 20 22 57 41 52 4e 22 20 22 43 48 45 43 4b 22 29   "WARN" "CHECK")
63d0: 29 0a 09 09 20 20 20 20 20 20 28 6d 65 6d 62 65  )...      (membe
63e0: 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  r (test:get-stat
63f0: 65 20 20 74 65 73 74 64 61 74 29 20 27 28 22 43  e  testdat) '("C
6400: 4f 4d 50 4c 45 54 45 44 22 29 29 29 29 20 0a 09  OMPLETED")))) ..
6410: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
6420: 74 20 32 20 22 49 4e 46 4f 3a 20 72 75 6e 6e 69  t 2 "INFO: runni
6430: 6e 67 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e  ng test " test-n
6440: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74  ame "/" item-pat
6450: 68 20 22 20 73 75 70 70 72 65 73 73 65 64 20 61  h " suppressed a
6460: 73 20 69 74 20 69 73 20 22 20 28 74 65 73 74 3a  s it is " (test:
6470: 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61  get-state testda
6480: 74 29 20 22 20 61 6e 64 20 22 20 28 74 65 73 74  t) " and " (test
6490: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74  :get-status test
64a0: 64 61 74 29 29 0a 09 20 20 20 20 20 28 73 65 74  dat))..     (set
64b0: 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09  ! runflag #f))..
64c0: 20 20 20 20 3b 3b 20 2d 72 65 72 75 6e 20 61 6e      ;; -rerun an
64d0: 64 20 73 74 61 74 75 73 20 69 73 20 6f 6e 65 20  d status is one 
64e0: 6f 66 20 74 68 65 20 73 70 65 63 69 66 65 64 2c  of the specifed,
64f0: 20 72 75 6e 20 69 74 0a 09 20 20 20 20 28 28 61   run it..    ((a
6500: 6e 64 20 72 65 72 75 6e 0a 09 09 20 20 28 6c 65  nd rerun...  (le
6510: 74 2a 20 28 28 72 65 72 75 6e 6c 73 74 20 20 20  t* ((rerunlst   
6520: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 72 65  (string-split re
6530: 72 75 6e 20 22 2c 22 29 29 0a 09 09 09 20 28 6d  run ",")).... (m
6540: 75 73 74 2d 72 65 72 75 6e 20 28 6d 65 6d 62 65  ust-rerun (membe
6550: 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  r (test:get-stat
6560: 75 73 20 74 65 73 74 64 61 74 29 20 72 65 72 75  us testdat) reru
6570: 6e 6c 73 74 29 29 29 0a 09 09 20 20 20 20 28 64  nlst)))...    (d
6580: 65 62 75 67 3a 70 72 69 6e 74 20 33 20 22 49 4e  ebug:print 3 "IN
6590: 46 4f 3a 20 2d 72 65 72 75 6e 20 6c 69 73 74 3a  FO: -rerun list:
65a0: 20 22 20 72 65 72 75 6e 20 22 2c 20 74 65 73 74   " rerun ", test
65b0: 2d 73 74 61 74 75 73 3a 20 22 20 28 74 65 73 74  -status: " (test
65c0: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74  :get-status test
65d0: 64 61 74 29 22 2c 20 6d 75 73 74 2d 72 65 72 75  dat)", must-reru
65e0: 6e 3a 20 22 20 6d 75 73 74 2d 72 65 72 75 6e 29  n: " must-rerun)
65f0: 0a 09 09 20 20 20 20 6d 75 73 74 2d 72 65 72 75  ...    must-reru
6600: 6e 29 29 0a 09 20 20 20 20 20 28 64 65 62 75 67  n))..     (debug
6610: 3a 70 72 69 6e 74 20 32 20 22 49 4e 46 4f 3a 20  :print 2 "INFO: 
6620: 52 65 72 75 6e 20 66 6f 72 63 65 64 20 66 6f 72  Rerun forced for
6630: 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d   test " test-nam
6640: 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29  e "/" item-path)
6650: 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 75 6e  ..     (set! run
6660: 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b  flag #t))..    ;
6670: 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 2c 20 64 6f  ; -keepgoing, do
6680: 20 6e 6f 74 20 72 65 72 75 6e 20 46 41 49 4c 0a   not rerun FAIL.
6690: 09 20 20 20 20 28 28 61 6e 64 20 6b 65 65 70 67  .    ((and keepg
66a0: 6f 69 6e 67 0a 09 09 20 20 28 6d 65 6d 62 65 72  oing...  (member
66b0: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75   (test:get-statu
66c0: 73 20 74 65 73 74 64 61 74 29 20 27 28 22 46 41  s testdat) '("FA
66d0: 49 4c 22 29 29 29 0a 09 20 20 20 20 20 28 73 65  IL")))..     (se
66e0: 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 0a  t! runflag #f)).
66f0: 09 20 20 20 20 28 28 61 6e 64 20 28 6e 6f 74 20  .    ((and (not 
6700: 72 65 72 75 6e 29 0a 09 09 20 20 28 6d 65 6d 62  rerun)...  (memb
6710: 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61  er (test:get-sta
6720: 74 75 73 20 74 65 73 74 64 61 74 29 20 27 28 22  tus testdat) '("
6730: 46 41 49 4c 22 20 22 6e 2f 61 22 29 29 29 0a 09  FAIL" "n/a")))..
6740: 20 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c       (set! runfl
6750: 61 67 20 23 74 29 29 0a 09 20 20 20 20 28 65 6c  ag #t))..    (el
6760: 73 65 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67  se (set! runflag
6770: 20 23 66 29 29 29 0a 09 20 20 20 28 64 65 62 75   #f)))..   (debu
6780: 67 3a 70 72 69 6e 74 20 36 20 22 52 55 4e 4e 49  g:print 6 "RUNNI
6790: 4e 47 20 3d 3e 20 72 75 6e 66 6c 61 67 3a 20 22  NG => runflag: "
67a0: 20 72 75 6e 66 6c 61 67 20 22 20 53 54 41 54 45   runflag " STATE
67b0: 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74  : " (test:get-st
67c0: 61 74 65 20 74 65 73 74 64 61 74 29 20 22 20 53  ate testdat) " S
67d0: 54 41 54 55 53 3a 20 22 20 28 74 65 73 74 3a 67  TATUS: " (test:g
67e0: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61  et-status testda
67f0: 74 29 29 0a 09 20 20 20 28 69 66 20 28 6e 6f 74  t))..   (if (not
6800: 20 72 75 6e 66 6c 61 67 29 0a 09 20 20 20 20 20   runflag)..     
6810: 20 20 28 69 66 20 28 6e 6f 74 20 70 61 72 65 6e    (if (not paren
6820: 74 2d 74 65 73 74 29 0a 09 09 20 20 20 28 64 65  t-test)...   (de
6830: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54  bug:print 1 "NOT
6840: 45 3a 20 4e 6f 74 20 73 74 61 72 74 69 6e 67 20  E: Not starting 
6850: 74 65 73 74 20 22 20 6e 65 77 2d 74 65 73 74 2d  test " new-test-
6860: 6e 61 6d 65 20 22 20 61 73 20 69 74 20 69 73 20  name " as it is 
6870: 73 74 61 74 65 20 5c 22 22 20 28 74 65 73 74 3a  state \"" (test:
6880: 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61  get-state testda
6890: 74 29 20 0a 09 09 09 09 22 5c 22 20 61 6e 64 20  t) ....."\" and 
68a0: 73 74 61 74 75 73 20 5c 22 22 20 28 74 65 73 74  status \"" (test
68b0: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74  :get-status test
68c0: 64 61 74 29 20 22 5c 22 2c 20 75 73 65 20 2d 72  dat) "\", use -r
68d0: 65 72 75 6e 20 5c 22 22 20 28 74 65 73 74 3a 67  erun \"" (test:g
68e0: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61  et-status testda
68f0: 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20  t).             
6900: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
6910: 20 20 20 22 5c 22 20 6f 72 20 2d 66 6f 72 63 65     "\" or -force
6920: 20 74 6f 20 6f 76 65 72 72 69 64 65 22 29 29 0a   to override")).
6930: 09 20 20 20 20 20 20 20 3b 3b 20 4e 4f 54 45 3a  .       ;; NOTE:
6940: 20 4e 6f 20 6c 6f 6e 67 65 72 20 62 65 20 63 68   No longer be ch
6950: 65 63 6b 69 6e 67 20 70 72 65 72 65 71 75 69 73  ecking prerequis
6960: 69 74 65 73 20 68 65 72 65 21 20 57 69 6c 6c 20  ites here! Will 
6970: 6e 65 76 65 72 20 67 65 74 20 68 65 72 65 20 75  never get here u
6980: 6e 6c 65 73 73 20 70 72 65 72 65 71 73 20 61 72  nless prereqs ar
6990: 65 0a 09 20 20 20 20 20 20 20 3b 3b 20 20 20 20  e..       ;;    
69a0: 20 20 20 61 6c 72 65 61 64 79 20 6d 65 74 2e 0a     already met..
69b0: 09 20 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74  .       (if (not
69c0: 20 28 6c 61 75 6e 63 68 2d 74 65 73 74 20 64 62   (launch-test db
69d0: 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20   run-id runname 
69e0: 74 65 73 74 2d 63 6f 6e 66 20 6b 65 79 76 61 6c  test-conf keyval
69f0: 6c 73 74 20 74 65 73 74 2d 6e 61 6d 65 20 74 65  lst test-name te
6a00: 73 74 2d 70 61 74 68 20 69 74 65 6d 64 61 74 20  st-path itemdat 
6a10: 66 6c 61 67 73 29 29 0a 09 09 20 20 20 28 62 65  flags))...   (be
6a20: 67 69 6e 0a 09 09 20 20 20 20 20 28 70 72 69 6e  gin...     (prin
6a30: 74 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64  t "ERROR: Failed
6a40: 20 74 6f 20 6c 61 75 6e 63 68 20 74 68 65 20 74   to launch the t
6a50: 65 73 74 2e 20 45 78 69 74 69 6e 67 20 61 73 20  est. Exiting as 
6a60: 73 6f 6f 6e 20 61 73 20 70 6f 73 73 69 62 6c 65  soon as possible
6a70: 22 29 0a 09 09 20 20 20 20 20 28 73 65 74 21 20  ")...     (set! 
6a80: 2a 67 6c 6f 62 61 6c 65 78 69 74 73 74 61 74 75  *globalexitstatu
6a90: 73 2a 20 31 29 20 3b 3b 20 0a 09 09 20 20 20 20  s* 1) ;; ...    
6aa0: 20 28 70 72 6f 63 65 73 73 2d 73 69 67 6e 61 6c   (process-signal
6ab0: 20 28 63 75 72 72 65 6e 74 2d 70 72 6f 63 65 73   (current-proces
6ac0: 73 2d 69 64 29 20 73 69 67 6e 61 6c 2f 6b 69 6c  s-id) signal/kil
6ad0: 6c 29 29 29 29 29 29 0a 09 28 28 4b 49 4c 4c 45  l))))))..((KILLE
6ae0: 44 29 20 0a 09 20 28 64 65 62 75 67 3a 70 72 69  D) .. (debug:pri
6af0: 6e 74 20 31 20 22 4e 4f 54 45 3a 20 22 20 6e 65  nt 1 "NOTE: " ne
6b00: 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 73  w-test-name " is
6b10: 20 61 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e 67   already running
6b20: 20 6f 72 20 77 61 73 20 65 78 70 6c 69 63 74 6c   or was explictl
6b30: 79 20 6b 69 6c 6c 65 64 2c 20 75 73 65 20 2d 66  y killed, use -f
6b40: 6f 72 63 65 20 74 6f 20 6c 61 75 6e 63 68 20 69  orce to launch i
6b50: 74 2e 22 29 29 0a 09 28 28 4c 41 55 4e 43 48 45  t."))..((LAUNCHE
6b60: 44 20 52 45 4d 4f 54 45 48 4f 53 54 53 54 41 52  D REMOTEHOSTSTAR
6b70: 54 20 52 55 4e 4e 49 4e 47 29 20 20 0a 09 20 28  T RUNNING)  .. (
6b80: 69 66 20 28 3e 20 28 2d 20 28 63 75 72 72 65 6e  if (> (- (curren
6b90: 74 2d 73 65 63 6f 6e 64 73 29 28 2b 20 28 64 62  t-seconds)(+ (db
6ba0: 3a 74 65 73 74 2d 67 65 74 2d 65 76 65 6e 74 5f  :test-get-event_
6bb0: 74 69 6d 65 20 74 65 73 74 64 61 74 29 0a 09 09  time testdat)...
6bc0: 09 09 20 20 20 20 20 20 20 28 64 62 3a 74 65 73  ..       (db:tes
6bd0: 74 2d 67 65 74 2d 72 75 6e 5f 64 75 72 61 74 69  t-get-run_durati
6be0: 6f 6e 20 74 65 73 74 64 61 74 29 29 29 0a 09 09  on testdat)))...
6bf0: 36 30 30 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f 20  600) ;; i.e. no 
6c00: 75 70 64 61 74 65 20 66 6f 72 20 6d 6f 72 65 20  update for more 
6c10: 74 68 61 6e 20 36 30 30 20 73 65 63 6f 6e 64 73  than 600 seconds
6c20: 0a 09 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20  ..     (begin.. 
6c30: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
6c40: 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 54  nt 0 "WARNING: T
6c50: 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20  est " test-name 
6c60: 22 20 61 70 70 65 61 72 73 20 74 6f 20 62 65 20  " appears to be 
6c70: 64 65 61 64 2e 20 46 6f 72 63 69 6e 67 20 69 74  dead. Forcing it
6c80: 20 74 6f 20 73 74 61 74 65 20 49 4e 43 4f 4d 50   to state INCOMP
6c90: 4c 45 54 45 20 61 6e 64 20 73 74 61 74 75 73 20  LETE and status 
6ca0: 53 54 55 43 4b 2f 44 45 41 44 22 29 0a 09 20 20  STUCK/DEAD")..  
6cb0: 20 20 20 20 20 28 74 65 73 74 2d 73 65 74 2d 73       (test-set-s
6cc0: 74 61 74 75 73 21 20 64 62 20 74 65 73 74 2d 69  tatus! db test-i
6cd0: 64 20 22 49 4e 43 4f 4d 50 4c 45 54 45 22 20 22  d "INCOMPLETE" "
6ce0: 53 54 55 43 4b 2f 44 45 41 44 22 20 22 54 65 73  STUCK/DEAD" "Tes
6cf0: 74 20 69 73 20 73 74 75 63 6b 20 6f 72 20 64 65  t is stuck or de
6d00: 61 64 22 20 23 66 29 29 0a 09 20 20 20 20 20 28  ad" #f))..     (
6d10: 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 4e  debug:print 2 "N
6d20: 4f 54 45 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65  OTE: " test-name
6d30: 20 22 20 69 73 20 61 6c 72 65 61 64 79 20 72 75   " is already ru
6d40: 6e 6e 69 6e 67 22 29 29 29 0a 09 28 65 6c 73 65  nning")))..(else
6d50: 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72         (debug:pr
6d60: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 46 61  int 0 "ERROR: Fa
6d70: 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 74  iled to launch t
6d80: 65 73 74 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e  est " new-test-n
6d90: 61 6d 65 20 22 2e 20 55 6e 72 65 63 6f 67 6e 69  ame ". Unrecogni
6da0: 73 65 64 20 73 74 61 74 65 20 22 20 28 74 65 73  sed state " (tes
6db0: 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74  t:get-state test
6dc0: 64 61 74 29 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d  dat)))))))..;;==
6dd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6de0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6df0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6e00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6e10: 3d 3d 3d 3d 0a 3b 3b 20 45 4e 44 20 4f 46 20 4e  ====.;; END OF N
6e20: 45 57 20 53 54 55 46 46 0a 3b 3b 3d 3d 3d 3d 3d  EW STUFF.;;=====
6e30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6e40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6e50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6e60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6e70: 3d 0a 0a 28 64 65 66 69 6e 65 20 28 67 65 74 2d  =..(define (get-
6e80: 64 69 72 2d 75 70 2d 6e 20 64 69 72 20 2e 20 70  dir-up-n dir . p
6e90: 61 72 61 6d 73 29 20 0a 20 20 28 6c 65 74 20 28  arams) .  (let (
6ea0: 28 64 70 61 72 74 73 20 20 28 73 74 72 69 6e 67  (dparts  (string
6eb0: 2d 73 70 6c 69 74 20 64 69 72 20 22 2f 22 29 29  -split dir "/"))
6ec0: 0a 09 28 63 6f 75 6e 74 20 20 20 28 69 66 20 28  ..(count   (if (
6ed0: 6e 75 6c 6c 3f 20 70 61 72 61 6d 73 29 20 31 20  null? params) 1 
6ee0: 28 63 61 72 20 70 61 72 61 6d 73 29 29 29 29 0a  (car params)))).
6ef0: 20 20 20 20 28 63 6f 6e 63 20 22 2f 22 20 28 73      (conc "/" (s
6f00: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73  tring-interspers
6f10: 65 20 0a 09 20 20 20 20 20 20 20 28 74 61 6b 65  e ..       (take
6f20: 20 64 70 61 72 74 73 20 28 2d 20 28 6c 65 6e 67   dparts (- (leng
6f30: 74 68 20 64 70 61 72 74 73 29 20 63 6f 75 6e 74  th dparts) count
6f40: 29 29 0a 09 20 20 20 20 20 20 20 22 2f 22 29 29  ))..       "/"))
6f50: 29 29 0a 3b 3b 20 52 65 6d 6f 76 65 20 72 75 6e  )).;; Remove run
6f60: 73 0a 3b 3b 20 66 69 65 6c 64 73 20 61 72 65 20  s.;; fields are 
6f70: 70 61 73 73 69 6e 67 20 69 6e 20 74 68 72 6f 75  passing in throu
6f80: 67 68 20 0a 3b 3b 20 61 63 74 69 6f 6e 3a 0a 3b  gh .;; action:.;
6f90: 3b 20 20 20 20 27 72 65 6d 6f 76 65 2d 72 75 6e  ;    'remove-run
6fa0: 73 0a 3b 3b 20 20 20 20 27 73 65 74 2d 73 74 61  s.;;    'set-sta
6fb0: 74 65 2d 73 74 61 74 75 73 0a 3b 3b 0a 3b 3b 20  te-status.;;.;; 
6fc0: 4e 42 2f 2f 20 73 68 6f 75 6c 64 20 70 61 73 73  NB// should pass
6fd0: 20 69 6e 20 6b 65 79 73 3f 0a 3b 3b 0a 28 64 65   in keys?.;;.(de
6fe0: 66 69 6e 65 20 28 72 75 6e 73 3a 6f 70 65 72 61  fine (runs:opera
6ff0: 74 65 2d 6f 6e 20 64 62 20 61 63 74 69 6f 6e 20  te-on db action 
7000: 72 75 6e 6e 61 6d 65 70 61 74 74 20 74 65 73 74  runnamepatt test
7010: 70 61 74 74 20 69 74 65 6d 70 61 74 74 20 23 21  patt itempatt #!
7020: 6b 65 79 20 28 73 74 61 74 65 20 23 66 29 28 73  key (state #f)(s
7030: 74 61 74 75 73 20 23 66 29 28 6e 65 77 2d 73 74  tatus #f)(new-st
7040: 61 74 65 2d 73 74 61 74 75 73 20 23 66 29 29 0a  ate-status #f)).
7050: 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73 20 20    (let* ((keys  
7060: 20 20 20 20 20 20 20 28 72 64 62 3a 67 65 74 2d         (rdb:get-
7070: 6b 65 79 73 20 64 62 29 29 0a 09 20 28 72 75 6e  keys db)).. (run
7080: 64 61 74 20 20 20 20 20 20 20 28 72 75 6e 73 3a  dat       (runs:
7090: 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74 74  get-runs-by-patt
70a0: 20 64 62 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65   db keys runname
70b0: 70 61 74 74 29 29 0a 09 20 28 68 65 61 64 65 72  patt)).. (header
70c0: 20 20 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72         (vector-r
70d0: 65 66 20 72 75 6e 64 61 74 20 30 29 29 0a 09 20  ef rundat 0)).. 
70e0: 28 72 75 6e 73 20 20 20 20 20 20 20 20 20 28 76  (runs         (v
70f0: 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74  ector-ref rundat
7100: 20 31 29 29 0a 09 20 28 73 74 61 74 65 73 20 20   1)).. (states  
7110: 20 20 20 20 20 28 69 66 20 73 74 61 74 65 20 20       (if state  
7120: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 73 74  (string-split st
7130: 61 74 65 20 20 22 2c 22 29 20 27 28 29 29 29 0a  ate  ",") '())).
7140: 09 20 28 73 74 61 74 75 73 65 73 20 20 20 20 20  . (statuses     
7150: 28 69 66 20 73 74 61 74 75 73 20 28 73 74 72 69  (if status (stri
7160: 6e 67 2d 73 70 6c 69 74 20 73 74 61 74 75 73 20  ng-split status 
7170: 22 2c 22 29 20 27 28 29 29 29 0a 09 20 28 73 74  ",") '())).. (st
7180: 61 74 65 2d 73 74 61 74 75 73 20 28 69 66 20 28  ate-status (if (
7190: 73 74 72 69 6e 67 3f 20 6e 65 77 2d 73 74 61 74  string? new-stat
71a0: 65 2d 73 74 61 74 75 73 29 20 28 73 74 72 69 6e  e-status) (strin
71b0: 67 2d 73 70 6c 69 74 20 6e 65 77 2d 73 74 61 74  g-split new-stat
71c0: 65 2d 73 74 61 74 75 73 20 22 2c 22 29 20 27 28  e-status ",") '(
71d0: 23 66 20 23 66 29 29 29 29 0a 20 20 20 20 28 64  #f #f)))).    (d
71e0: 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 48 65  ebug:print 2 "He
71f0: 61 64 65 72 3a 20 22 20 68 65 61 64 65 72 20 22  ader: " header "
7200: 20 61 63 74 69 6f 6e 3a 20 22 20 61 63 74 69 6f   action: " actio
7210: 6e 20 22 20 6e 65 77 2d 73 74 61 74 65 2d 73 74  n " new-state-st
7220: 61 74 75 73 3a 20 22 20 6e 65 77 2d 73 74 61 74  atus: " new-stat
7230: 65 2d 73 74 61 74 75 73 29 0a 20 20 20 20 28 66  e-status).    (f
7240: 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 28 6c 61  or-each.     (la
7250: 6d 62 64 61 20 28 72 75 6e 29 0a 20 20 20 20 20  mbda (run).     
7260: 20 20 28 6c 65 74 20 28 28 72 75 6e 6b 65 79 20    (let ((runkey 
7270: 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65  (string-interspe
7280: 72 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61  rse (map (lambda
7290: 20 28 6b 29 0a 09 09 09 09 09 09 28 64 62 3a 67   (k).......(db:g
72a0: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64  et-value-by-head
72b0: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 28 76  er run header (v
72c0: 65 63 74 6f 72 2d 72 65 66 20 6b 20 30 29 29 29  ector-ref k 0)))
72d0: 20 6b 65 79 73 29 20 22 2f 22 29 29 0a 09 20 20   keys) "/"))..  
72e0: 20 20 20 28 64 69 72 73 2d 74 6f 2d 72 65 6d 6f     (dirs-to-remo
72f0: 76 65 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61  ve (make-hash-ta
7300: 62 6c 65 29 29 29 0a 09 20 28 6c 65 74 2a 20 28  ble))).. (let* (
7310: 28 72 75 6e 2d 69 64 20 20 20 20 28 64 62 3a 67  (run-id    (db:g
7320: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64  et-value-by-head
7330: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 69  er run header "i
7340: 64 22 29 29 0a 09 09 28 72 75 6e 2d 73 74 61 74  d"))...(run-stat
7350: 65 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d  e (db:get-value-
7360: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65  by-header run he
7370: 61 64 65 72 20 22 73 74 61 74 65 22 29 29 0a 09  ader "state"))..
7380: 09 28 74 65 73 74 73 20 20 20 20 20 28 69 66 20  .(tests     (if 
7390: 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 72 75 6e  (not (equal? run
73a0: 2d 73 74 61 74 65 20 22 6c 6f 63 6b 65 64 22 29  -state "locked")
73b0: 29 0a 09 09 09 20 20 20 20 20 20 20 28 72 64 62  )....       (rdb
73c0: 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72  :get-tests-for-r
73d0: 75 6e 20 64 62 20 28 64 62 3a 67 65 74 2d 76 61  un db (db:get-va
73e0: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75  lue-by-header ru
73f0: 6e 20 68 65 61 64 65 72 20 22 69 64 22 29 0a 09  n header "id")..
7400: 09 09 09 09 09 20 20 20 20 20 20 74 65 73 74 70  .....      testp
7410: 61 74 74 20 69 74 65 6d 70 61 74 74 20 73 74 61  att itempatt sta
7420: 74 65 73 20 73 74 61 74 75 73 65 73 0a 09 09 09  tes statuses....
7430: 09 09 09 20 20 20 20 20 20 6e 6f 74 2d 69 6e 3a  ...      not-in:
7440: 20 20 23 66 0a 09 09 09 09 09 09 20 20 20 20 20    #f.......     
7450: 20 73 6f 72 74 2d 62 79 3a 20 28 63 61 73 65 20   sort-by: (case 
7460: 61 63 74 69 6f 6e 0a 09 09 09 09 09 09 09 09 20  action......... 
7470: 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29 20 27  ((remove-runs) '
7480: 72 75 6e 64 69 72 29 0a 09 09 09 09 09 09 09 09  rundir).........
7490: 20 28 65 6c 73 65 20 20 20 20 20 20 20 20 20 20   (else          
74a0: 27 65 76 65 6e 74 5f 74 69 6d 65 29 29 29 0a 09  'event_time)))..
74b0: 09 09 20 20 20 20 20 20 20 27 28 29 29 29 0a 09  ..       '()))..
74c0: 09 28 6c 61 73 74 74 70 61 74 68 20 22 2f 64 6f  .(lasttpath "/do
74d0: 65 73 2f 6e 6f 74 2f 65 78 69 73 74 2f 49 2f 68  es/not/exist/I/h
74e0: 6f 70 65 22 29 29 0a 0a 09 20 20 20 28 69 66 20  ope"))...   (if 
74f0: 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 73 74  (not (null? test
7500: 73 29 29 0a 09 20 20 20 20 20 20 20 28 62 65 67  s))..       (beg
7510: 69 6e 0a 09 09 20 28 63 61 73 65 20 61 63 74 69  in... (case acti
7520: 6f 6e 0a 09 09 20 20 20 28 28 72 65 6d 6f 76 65  on...   ((remove
7530: 2d 72 75 6e 73 29 0a 09 09 20 20 20 20 28 64 65  -runs)...    (de
7540: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d  bug:print 1 "Rem
7550: 6f 76 69 6e 67 20 74 65 73 74 73 20 66 6f 72 20  oving tests for 
7560: 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20  run: " runkey " 
7570: 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d  " (db:get-value-
7580: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65  by-header run he
7590: 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 29  ader "runname"))
75a0: 29 0a 09 09 20 20 20 28 28 73 65 74 2d 73 74 61  )...   ((set-sta
75b0: 74 65 2d 73 74 61 74 75 73 29 0a 09 09 20 20 20  te-status)...   
75c0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20   (debug:print 1 
75d0: 22 4d 6f 64 69 66 79 69 6e 67 20 73 74 61 74 65  "Modifying state
75e0: 20 61 6e 64 20 73 74 61 75 73 20 66 6f 72 20 74   and staus for t
75f0: 65 73 74 73 20 66 6f 72 20 72 75 6e 3a 20 22 20  ests for run: " 
7600: 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67  runkey " " (db:g
7610: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64  et-value-by-head
7620: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 72  er run header "r
7630: 75 6e 6e 61 6d 65 22 29 29 29 0a 09 09 20 20 20  unname")))...   
7640: 28 65 6c 73 65 0a 09 09 20 20 20 20 28 70 72 69  (else...    (pri
7650: 6e 74 20 22 49 4e 46 4f 3a 20 61 63 74 69 6f 6e  nt "INFO: action
7660: 20 6e 6f 74 20 72 65 63 6f 67 6e 69 73 65 64 20   not recognised 
7670: 22 20 61 63 74 69 6f 6e 29 29 29 0a 09 09 20 28  " action)))... (
7680: 66 6f 72 2d 65 61 63 68 0a 09 09 20 20 28 6c 61  for-each...  (la
7690: 6d 62 64 61 20 28 74 65 73 74 29 0a 09 09 20 20  mbda (test)...  
76a0: 20 20 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d 70    (let* ((item-p
76b0: 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74  ath (db:test-get
76c0: 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 29  -item-path test)
76d0: 29 0a 09 09 09 20 20 20 28 74 65 73 74 2d 6e 61  )....   (test-na
76e0: 6d 65 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  me (db:test-get-
76f0: 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29 29 0a  testname test)).
7700: 09 09 09 20 20 20 28 72 75 6e 2d 64 69 72 20 20  ...   (run-dir  
7710: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75   (db:test-get-ru
7720: 6e 64 69 72 20 74 65 73 74 29 29 29 0a 09 09 20  ndir test)))... 
7730: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
7740: 74 20 31 20 22 20 20 22 20 28 64 62 3a 74 65 73  t 1 "  " (db:tes
7750: 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74  t-get-testname t
7760: 65 73 74 29 20 22 20 69 64 3a 20 22 20 28 64 62  est) " id: " (db
7770: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73  :test-get-id tes
7780: 74 29 20 22 20 22 20 69 74 65 6d 2d 70 61 74 68  t) " " item-path
7790: 20 22 20 61 63 74 69 6f 6e 3a 20 22 20 61 63 74   " action: " act
77a0: 69 6f 6e 29 0a 09 09 20 20 20 20 20 20 28 63 61  ion)...      (ca
77b0: 73 65 20 61 63 74 69 6f 6e 0a 09 09 09 28 28 72  se action....((r
77c0: 65 6d 6f 76 65 2d 72 75 6e 73 29 0a 09 09 09 20  emove-runs).... 
77d0: 28 72 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74  (rdb:delete-test
77e0: 2d 72 65 63 6f 72 64 73 20 64 62 20 28 64 62 3a  -records db (db:
77f0: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74  test-get-id test
7800: 29 29 0a 09 09 09 20 28 64 65 62 75 67 3a 70 72  )).... (debug:pr
7810: 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 41 74 74  int 1 "INFO: Att
7820: 65 6d 70 74 69 6e 67 20 74 6f 20 72 65 6d 6f 76  empting to remov
7830: 65 20 64 69 72 20 22 20 72 75 6e 2d 64 69 72 29  e dir " run-dir)
7840: 0a 09 09 09 20 28 69 66 20 28 61 6e 64 20 28 3e  .... (if (and (>
7850: 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20   (string-length 
7860: 72 75 6e 2d 64 69 72 29 20 35 29 0a 09 09 09 09  run-dir) 5).....
7870: 20 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20    (file-exists? 
7880: 72 75 6e 2d 64 69 72 29 29 20 3b 3b 20 62 61 64  run-dir)) ;; bad
7890: 20 68 65 75 72 69 73 74 69 63 20 62 75 74 20 73   heuristic but s
78a0: 68 6f 75 6c 64 20 70 72 65 76 65 6e 74 20 2f 74  hould prevent /t
78b0: 6d 70 20 2f 68 6f 6d 65 20 65 74 63 2e 0a 09 09  mp /home etc....
78c0: 09 20 20 20 20 20 28 6c 65 74 2a 20 28 28 72 65  .     (let* ((re
78d0: 61 6c 70 61 74 68 20 28 72 65 73 6f 6c 76 65 2d  alpath (resolve-
78e0: 70 61 74 68 6e 61 6d 65 20 72 75 6e 2d 64 69 72  pathname run-dir
78f0: 29 29 29 0a 09 09 09 20 20 20 20 20 20 20 28 64  )))....       (d
7900: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e  ebug:print 1 "IN
7910: 46 4f 3a 20 52 65 61 6c 20 70 61 74 68 20 6f 66  FO: Real path of
7920: 20 69 73 20 22 20 72 65 61 6c 70 61 74 68 29 0a   is " realpath).
7930: 09 09 09 20 20 20 20 20 20 20 28 69 66 20 28 66  ...       (if (f
7940: 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 65 61 6c  ile-exists? real
7950: 70 61 74 68 29 0a 09 09 09 09 20 20 20 28 69 66  path).....   (if
7960: 20 28 3e 20 28 73 79 73 74 65 6d 20 28 63 6f 6e   (> (system (con
7970: 63 20 22 72 6d 20 2d 72 66 20 22 20 72 65 61 6c  c "rm -rf " real
7980: 70 61 74 68 29 29 20 30 29 0a 09 09 09 09 20 20  path)) 0).....  
7990: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
79a0: 74 20 30 20 22 45 52 52 4f 52 3a 20 54 68 65 72  t 0 "ERROR: Ther
79b0: 65 20 77 61 73 20 61 20 70 72 6f 62 6c 65 6d 20  e was a problem 
79c0: 72 65 6d 6f 76 69 6e 67 20 22 20 72 65 61 6c 70  removing " realp
79d0: 61 74 68 20 22 20 77 69 74 68 20 72 6d 20 2d 66  ath " with rm -f
79e0: 22 29 29 0a 09 09 09 09 20 20 20 28 64 65 62 75  ")).....   (debu
79f0: 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49  g:print 0 "WARNI
7a00: 4e 47 3a 20 74 65 73 74 20 72 75 6e 20 64 69 72  NG: test run dir
7a10: 20 22 20 72 65 61 6c 70 61 74 68 20 22 20 61 70   " realpath " ap
7a20: 70 65 61 72 73 20 74 6f 20 6e 6f 74 20 65 78 69  pears to not exi
7a30: 73 74 22 29 29 0a 09 09 09 20 20 20 20 20 20 20  st"))....       
7a40: 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73  (if (file-exists
7a50: 3f 20 72 75 6e 2d 64 69 72 29 20 3b 3b 20 74 68  ? run-dir) ;; th
7a60: 65 20 6c 69 6e 6b 0a 09 09 09 09 20 20 20 28 69  e link.....   (i
7a70: 66 20 28 73 79 6d 62 6f 6c 69 63 2d 6c 69 6e 6b  f (symbolic-link
7a80: 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 09 20  ? run-dir)..... 
7a90: 20 20 20 20 20 20 28 64 65 6c 65 74 65 2d 66 69        (delete-fi
7aa0: 6c 65 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 09  le run-dir).....
7ab0: 20 20 20 20 20 20 20 28 69 66 20 28 64 69 72 65         (if (dire
7ac0: 63 74 6f 72 79 3f 20 72 75 6e 2d 64 69 72 29 0a  ctory? run-dir).
7ad0: 09 09 09 09 09 20 20 20 28 69 66 20 28 3e 20 28  .....   (if (> (
7ae0: 64 69 72 65 63 74 6f 72 79 2d 66 6f 6c 64 20 28  directory-fold (
7af0: 6c 61 6d 62 64 61 20 28 66 20 78 29 28 2b 20 31  lambda (f x)(+ 1
7b00: 20 78 29 29 20 30 20 72 75 6e 2d 64 69 72 29 20   x)) 0 run-dir) 
7b10: 30 29 0a 09 09 09 09 09 20 20 20 20 20 20 20 28  0)......       (
7b20: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57  debug:print 0 "W
7b30: 41 52 4e 49 4e 47 3a 20 72 65 66 75 73 69 6e 67  ARNING: refusing
7b40: 20 74 6f 20 72 65 6d 6f 76 65 20 22 20 72 75 6e   to remove " run
7b50: 2d 64 69 72 20 22 20 61 73 20 69 74 20 69 73 20  -dir " as it is 
7b60: 6e 6f 74 20 65 6d 70 74 79 22 29 0a 09 09 09 09  not empty").....
7b70: 09 20 20 20 20 20 20 20 28 64 65 6c 65 74 65 2d  .       (delete-
7b80: 64 69 72 65 63 74 6f 72 79 20 72 75 6e 2d 64 69  directory run-di
7b90: 72 29 29 20 3b 3b 20 69 74 20 73 68 6f 75 6c 64  r)) ;; it should
7ba0: 20 62 65 20 65 6d 70 74 79 20 62 79 20 68 65 72   be empty by her
7bb0: 65 20 42 55 47 20 42 55 47 2c 20 61 64 64 20 65  e BUG BUG, add e
7bc0: 72 72 6f 72 20 63 61 74 63 68 0a 09 09 09 09 09  rror catch......
7bd0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
7be0: 30 20 22 45 52 52 4f 52 3a 20 72 65 66 75 73 69  0 "ERROR: refusi
7bf0: 6e 67 20 74 6f 20 72 65 6d 6f 76 65 20 22 20 72  ng to remove " r
7c00: 75 6e 2d 64 69 72 20 22 20 61 73 20 69 74 20 69  un-dir " as it i
7c10: 73 20 6e 65 69 74 68 65 72 20 61 20 73 79 6d 6c  s neither a syml
7c20: 69 6e 6b 20 6e 6f 72 20 61 20 64 69 72 65 63 74  ink nor a direct
7c30: 6f 72 79 22 29 0a 09 09 09 09 09 20 20 20 29 29  ory")......   ))
7c40: 29 29 0a 09 09 09 20 20 20 20 20 28 64 65 62 75  ))....     (debu
7c50: 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49  g:print 0 "WARNI
7c60: 4e 47 3a 20 64 69 72 65 63 74 6f 72 79 20 61 6c  NG: directory al
7c70: 72 65 61 64 79 20 72 65 6d 6f 76 65 64 20 22 20  ready removed " 
7c80: 72 75 6e 2d 64 69 72 29 29 29 0a 09 09 09 28 28  run-dir)))....((
7c90: 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73  set-state-status
7ca0: 29 0a 09 09 09 20 28 64 65 62 75 67 3a 70 72 69  ).... (debug:pri
7cb0: 6e 74 20 32 20 22 49 4e 46 4f 3a 20 6e 65 77 20  nt 2 "INFO: new 
7cc0: 73 74 61 74 65 20 22 20 28 63 61 72 20 73 74 61  state " (car sta
7cd0: 74 65 2d 73 74 61 74 75 73 29 20 22 2c 20 6e 65  te-status) ", ne
7ce0: 77 20 73 74 61 74 75 73 20 22 20 28 63 61 64 72  w status " (cadr
7cf0: 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 29 0a   state-status)).
7d00: 09 09 09 20 28 64 62 3a 74 65 73 74 2d 73 65 74  ... (db:test-set
7d10: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 2d 62 79  -state-status-by
7d20: 2d 69 64 20 64 62 20 28 64 62 3a 74 65 73 74 2d  -id db (db:test-
7d30: 67 65 74 2d 69 64 20 74 65 73 74 29 20 28 63 61  get-id test) (ca
7d40: 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 28  r state-status)(
7d50: 63 61 64 72 20 73 74 61 74 65 2d 73 74 61 74 75  cadr state-statu
7d60: 73 29 20 23 66 29 29 29 29 29 0a 09 09 20 20 74  s) #f)))))...  t
7d70: 65 73 74 73 29 29 29 0a 09 20 20 20 0a 09 20 20  ests)))..   ..  
7d80: 20 3b 3b 20 72 65 6d 6f 76 65 20 74 68 65 20 72   ;; remove the r
7d90: 75 6e 20 69 66 20 7a 65 72 6f 20 74 65 73 74 73  un if zero tests
7da0: 20 72 65 6d 61 69 6e 0a 09 20 20 20 28 69 66 20   remain..   (if 
7db0: 28 65 71 3f 20 61 63 74 69 6f 6e 20 27 72 65 6d  (eq? action 'rem
7dc0: 6f 76 65 2d 72 75 6e 73 29 0a 09 20 20 20 20 20  ove-runs)..     
7dd0: 20 20 28 6c 65 74 20 28 28 72 65 6d 74 65 73 74    (let ((remtest
7de0: 73 20 28 72 64 62 3a 67 65 74 2d 74 65 73 74 73  s (rdb:get-tests
7df0: 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 62 3a  -for-run db (db:
7e00: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61  get-value-by-hea
7e10: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22  der run header "
7e20: 69 64 22 29 20 23 66 20 23 66 20 27 28 29 20 27  id") #f #f '() '
7e30: 28 29 29 29 29 0a 09 09 20 28 69 66 20 28 6e 75  ())))... (if (nu
7e40: 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29 20 3b 3b  ll? remtests) ;;
7e50: 20 6e 6f 20 6d 6f 72 65 20 74 65 73 74 73 20 72   no more tests r
7e60: 65 6d 61 69 6e 69 6e 67 0a 09 09 20 20 20 20 20  emaining...     
7e70: 28 6c 65 74 2a 20 28 28 64 70 61 72 74 73 20 20  (let* ((dparts  
7e80: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 6c 61  (string-split la
7e90: 73 74 74 70 61 74 68 20 22 2f 22 29 29 0a 09 09  sttpath "/"))...
7ea0: 09 20 20 20 20 28 72 75 6e 70 61 74 68 20 28 63  .    (runpath (c
7eb0: 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 6e 67 2d  onc "/" (string-
7ec0: 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09 09 09  intersperse ....
7ed0: 09 09 09 28 74 61 6b 65 20 64 70 61 72 74 73 20  ...(take dparts 
7ee0: 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74  (- (length dpart
7ef0: 73 29 20 31 29 29 0a 09 09 09 09 09 09 22 2f 22  s) 1))......."/"
7f00: 29 29 29 29 0a 09 09 20 20 20 20 20 20 20 28 64  ))))...       (d
7f10: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65  ebug:print 1 "Re
7f20: 6d 6f 76 69 6e 67 20 72 75 6e 3a 20 22 20 72 75  moving run: " ru
7f30: 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74  nkey " " (db:get
7f40: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72  -value-by-header
7f50: 20 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e   run header "run
7f60: 6e 61 6d 65 22 29 29 0a 09 09 20 20 20 20 20 20  name"))...      
7f70: 20 28 64 62 3a 64 65 6c 65 74 65 2d 72 75 6e 20   (db:delete-run 
7f80: 64 62 20 72 75 6e 2d 69 64 29 0a 09 09 20 20 20  db run-id)...   
7f90: 20 20 20 20 3b 3b 20 6e 65 65 64 20 74 6f 20 66      ;; need to f
7fa0: 69 67 75 72 65 20 6f 75 74 20 74 68 65 20 70 61  igure out the pa
7fb0: 74 68 20 74 6f 20 74 68 65 20 72 75 6e 20 64 69  th to the run di
7fc0: 72 20 61 6e 64 20 72 65 6d 6f 76 65 20 69 74 20  r and remove it 
7fd0: 69 66 20 65 6d 70 74 79 0a 09 09 20 20 20 20 20  if empty...     
7fe0: 20 20 3b 3b 20 20 20 20 28 69 66 20 28 6e 75 6c    ;;    (if (nul
7ff0: 6c 3f 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20 72  l? (glob (conc r
8000: 75 6e 70 61 74 68 20 22 2f 2a 22 29 29 29 0a 09  unpath "/*")))..
8010: 09 20 20 20 20 20 20 20 3b 3b 20 20 20 20 20 20  .       ;;      
8020: 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20    (begin...     
8030: 20 20 3b 3b 20 09 20 28 64 65 62 75 67 3a 70 72    ;; . (debug:pr
8040: 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20  int 1 "Removing 
8050: 72 75 6e 20 64 69 72 20 22 20 72 75 6e 70 61 74  run dir " runpat
8060: 68 29 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 09  h)...       ;; .
8070: 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 22   (system (conc "
8080: 72 6d 64 69 72 20 2d 70 20 22 20 72 75 6e 70 61  rmdir -p " runpa
8090: 74 68 29 29 29 29 0a 09 09 20 20 20 20 20 20 20  th))))...       
80a0: 29 29 29 29 29 0a 09 20 29 29 0a 20 20 20 20 20  ))))).. )).     
80b0: 72 75 6e 73 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d  runs)))..;;=====
80c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
80d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
80e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
80f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8100: 3d 0a 3b 3b 20 52 6f 75 74 69 6e 65 73 20 66 6f  =.;; Routines fo
8110: 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 72  r manipulating r
8120: 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  uns.;;==========
8130: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8140: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8150: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8160: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b  ============..;;
8170: 20 53 69 6e 63 65 20 6d 61 6e 79 20 63 61 6c 6c   Since many call
8180: 73 20 74 6f 20 61 20 72 75 6e 20 72 65 71 75 69  s to a run requi
8190: 72 65 20 70 72 65 74 74 79 20 6d 75 63 68 20 74  re pretty much t
81a0: 68 65 20 73 61 6d 65 20 73 65 74 75 70 20 0a 3b  he same setup .;
81b0: 3b 20 74 68 69 73 20 77 72 61 70 70 65 72 20 69  ; this wrapper i
81c0: 73 20 75 73 65 64 20 74 6f 20 72 65 64 75 63 65  s used to reduce
81d0: 20 74 68 65 20 72 65 70 6c 69 63 61 74 69 6f 6e   the replication
81e0: 20 6f 66 20 63 6f 64 65 0a 28 64 65 66 69 6e 65   of code.(define
81f0: 20 28 67 65 6e 65 72 61 6c 2d 72 75 6e 2d 63 61   (general-run-ca
8200: 6c 6c 20 73 77 69 74 63 68 6e 61 6d 65 20 61 63  ll switchname ac
8210: 74 69 6f 6e 2d 64 65 73 63 20 70 72 6f 63 29 0a  tion-desc proc).
8220: 20 20 28 6c 65 74 20 28 28 72 75 6e 6e 61 6d 65    (let ((runname
8230: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
8240: 3a 72 75 6e 6e 61 6d 65 22 29 29 0a 09 28 74 61  :runname"))..(ta
8250: 72 67 65 74 20 20 28 69 66 20 28 61 72 67 73 3a  rget  (if (args:
8260: 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74  get-arg "-target
8270: 22 29 0a 09 09 20 20 20 20 20 28 61 72 67 73 3a  ")...     (args:
8280: 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74  get-arg "-target
8290: 22 29 0a 09 09 20 20 20 20 20 28 61 72 67 73 3a  ")...     (args:
82a0: 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72  get-arg "-reqtar
82b0: 67 22 29 29 29 0a 09 28 74 68 31 20 20 20 20 20  g")))..(th1     
82c0: 23 66 29 29 0a 20 20 20 20 28 63 6f 6e 64 0a 20  #f)).    (cond. 
82d0: 20 20 20 20 28 28 6e 6f 74 20 74 61 72 67 65 74      ((not target
82e0: 29 0a 20 20 20 20 20 20 28 64 65 62 75 67 3a 70  ).      (debug:p
82f0: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 4d  rint 0 "ERROR: M
8300: 69 73 73 69 6e 67 20 72 65 71 75 69 72 65 64 20  issing required 
8310: 70 61 72 61 6d 65 74 65 72 20 66 6f 72 20 22 20  parameter for " 
8320: 73 77 69 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f  switchname ", yo
8330: 75 20 6d 75 73 74 20 73 70 65 63 69 66 79 20 74  u must specify t
8340: 68 65 20 74 61 72 67 65 74 20 77 69 74 68 20 2d  he target with -
8350: 74 61 72 67 65 74 22 29 0a 20 20 20 20 20 20 28  target").      (
8360: 65 78 69 74 20 33 29 29 0a 20 20 20 20 20 28 28  exit 3)).     ((
8370: 6e 6f 74 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20  not runname).   
8380: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
8390: 30 20 22 45 52 52 4f 52 3a 20 4d 69 73 73 69 6e  0 "ERROR: Missin
83a0: 67 20 72 65 71 75 69 72 65 64 20 70 61 72 61 6d  g required param
83b0: 65 74 65 72 20 66 6f 72 20 22 20 73 77 69 74 63  eter for " switc
83c0: 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d 75 73  hname ", you mus
83d0: 74 20 73 70 65 63 69 66 79 20 74 68 65 20 72 75  t specify the ru
83e0: 6e 20 6e 61 6d 65 20 77 69 74 68 20 3a 72 75 6e  n name with :run
83f0: 6e 61 6d 65 20 72 75 6e 6e 61 6d 65 22 29 0a 20  name runname"). 
8400: 20 20 20 20 20 28 65 78 69 74 20 33 29 29 0a 20       (exit 3)). 
8410: 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20      (else.      
8420: 28 6c 65 74 20 28 28 64 62 20 20 20 23 66 29 0a  (let ((db   #f).
8430: 09 20 20 20 20 28 6b 65 79 73 20 23 66 29 29 0a  .    (keys #f)).
8440: 09 28 69 66 20 28 6e 6f 74 20 28 73 65 74 75 70  .(if (not (setup
8450: 2d 66 6f 72 2d 72 75 6e 29 29 0a 09 20 20 20 20  -for-run))..    
8460: 28 62 65 67 69 6e 20 0a 09 20 20 20 20 20 20 28  (begin ..      (
8470: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 46  debug:print 0 "F
8480: 61 69 6c 65 64 20 74 6f 20 73 65 74 75 70 2c 20  ailed to setup, 
8490: 65 78 69 74 69 6e 67 22 29 0a 09 20 20 20 20 20  exiting")..     
84a0: 20 28 65 78 69 74 20 31 29 29 29 0a 09 28 73 65   (exit 1)))..(se
84b0: 74 21 20 64 62 20 20 20 28 6f 70 65 6e 2d 64 62  t! db   (open-db
84c0: 29 29 0a 09 28 69 66 20 28 61 72 67 73 3a 67 65  ))..(if (args:ge
84d0: 74 2d 61 72 67 20 22 2d 73 65 72 76 65 72 22 29  t-arg "-server")
84e0: 0a 09 20 20 20 20 28 73 65 72 76 65 72 3a 73 74  ..    (server:st
84f0: 61 72 74 20 64 62 20 28 61 72 67 73 3a 67 65 74  art db (args:get
8500: 2d 61 72 67 20 22 2d 73 65 72 76 65 72 22 29 29  -arg "-server"))
8510: 0a 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28  ..    (if (not (
8520: 6f 72 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  or (args:get-arg
8530: 20 22 2d 72 75 6e 61 6c 6c 22 29 0a 09 09 09 20   "-runall").... 
8540: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
8550: 2d 72 75 6e 74 65 73 74 73 22 29 29 29 0a 09 09  -runtests")))...
8560: 28 73 65 72 76 65 72 3a 63 6c 69 65 6e 74 2d 73  (server:client-s
8570: 65 74 75 70 20 64 62 29 29 29 0a 09 28 73 65 74  etup db)))..(set
8580: 21 20 6b 65 79 73 20 28 72 64 62 3a 67 65 74 2d  ! keys (rdb:get-
8590: 6b 65 79 73 20 64 62 29 29 0a 09 3b 3b 20 68 61  keys db))..;; ha
85a0: 76 65 20 65 6e 6f 75 67 68 20 74 6f 20 70 72 6f  ve enough to pro
85b0: 63 65 73 73 20 2d 74 61 72 67 65 74 20 6f 72 20  cess -target or 
85c0: 2d 72 65 71 74 61 72 67 20 68 65 72 65 0a 09 28  -reqtarg here..(
85d0: 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  if (args:get-arg
85e0: 20 22 2d 72 65 71 74 61 72 67 22 29 0a 09 20 20   "-reqtarg")..  
85f0: 20 20 28 6c 65 74 2a 20 28 28 72 75 6e 63 6f 6e    (let* ((runcon
8600: 66 69 67 66 20 28 63 6f 6e 63 20 20 2a 74 6f 70  figf (conc  *top
8610: 70 61 74 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 69  path* "/runconfi
8620: 67 73 2e 63 6f 6e 66 69 67 22 29 29 20 3b 3b 20  gs.config")) ;; 
8630: 44 4f 20 4e 4f 54 20 45 56 41 4c 55 41 54 45 20  DO NOT EVALUATE 
8640: 41 4c 4c 20 0a 09 09 20 20 20 28 72 75 6e 63 6f  ALL ...   (runco
8650: 6e 66 69 67 20 20 28 72 65 61 64 2d 63 6f 6e 66  nfig  (read-conf
8660: 69 67 20 72 75 6e 63 6f 6e 66 69 67 66 20 23 66  ig runconfigf #f
8670: 20 23 66 20 65 6e 76 69 72 6f 6e 2d 70 61 74 74   #f environ-patt
8680: 3a 20 23 66 29 29 29 20 0a 09 20 20 20 20 20 20  : #f))) ..      
8690: 28 69 66 20 28 68 61 73 68 2d 74 61 62 6c 65 2d  (if (hash-table-
86a0: 72 65 66 2f 64 65 66 61 75 6c 74 20 72 75 6e 63  ref/default runc
86b0: 6f 6e 66 69 67 20 28 61 72 67 73 3a 67 65 74 2d  onfig (args:get-
86c0: 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 20  arg "-reqtarg") 
86d0: 23 66 29 0a 09 09 20 20 28 6b 65 79 73 3a 74 61  #f)...  (keys:ta
86e0: 72 67 65 74 2d 73 65 74 2d 61 72 67 73 20 6b 65  rget-set-args ke
86f0: 79 73 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  ys (args:get-arg
8700: 20 22 2d 72 65 71 74 61 72 67 22 29 20 61 72 67   "-reqtarg") arg
8710: 73 3a 61 72 67 2d 68 61 73 68 29 0a 09 09 20 20  s:arg-hash)...  
8720: 28 62 65 67 69 6e 0a 09 09 20 20 20 20 28 64 65  (begin...    (de
8730: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52  bug:print 0 "ERR
8740: 4f 52 3a 20 5b 22 20 28 61 72 67 73 3a 67 65 74  OR: [" (args:get
8750: 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29  -arg "-reqtarg")
8760: 20 22 5d 20 6e 6f 74 20 66 6f 75 6e 64 20 69 6e   "] not found in
8770: 20 22 20 72 75 6e 63 6f 6e 66 69 67 66 29 0a 09   " runconfigf)..
8780: 09 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66 69  .    (sqlite3:fi
8790: 6e 61 6c 69 7a 65 21 20 64 62 29 0a 09 09 20 20  nalize! db)...  
87a0: 20 20 28 65 78 69 74 20 31 29 29 29 29 0a 09 20    (exit 1)))).. 
87b0: 20 20 20 28 69 66 20 28 61 72 67 73 3a 67 65 74     (if (args:get
87c0: 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 29 0a  -arg "-target").
87d0: 09 09 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 73  ..(keys:target-s
87e0: 65 74 2d 61 72 67 73 20 6b 65 79 73 20 28 61 72  et-args keys (ar
87f0: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72  gs:get-arg "-tar
8800: 67 65 74 22 20 61 72 67 73 3a 61 72 67 2d 68 61  get" args:arg-ha
8810: 73 68 29 20 61 72 67 73 3a 61 72 67 2d 68 61 73  sh) args:arg-has
8820: 68 29 29 29 0a 09 28 69 66 20 28 6e 6f 74 20 28  h)))..(if (not (
8830: 63 61 72 20 2a 63 6f 6e 66 69 67 69 6e 66 6f 2a  car *configinfo*
8840: 29 29 0a 09 20 20 20 20 28 62 65 67 69 6e 0a 09  ))..    (begin..
8850: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
8860: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 41 74 74  nt 0 "ERROR: Att
8870: 65 6d 70 74 65 64 20 74 6f 20 22 20 61 63 74 69  empted to " acti
8880: 6f 6e 2d 64 65 73 63 20 22 20 62 75 74 20 72 75  on-desc " but ru
8890: 6e 20 61 72 65 61 20 63 6f 6e 66 69 67 20 66 69  n area config fi
88a0: 6c 65 20 6e 6f 74 20 66 6f 75 6e 64 22 29 0a 09  le not found")..
88b0: 20 20 20 20 20 20 28 65 78 69 74 20 31 29 29 0a        (exit 1)).
88c0: 09 20 20 20 20 3b 3b 20 45 78 74 72 61 63 74 20  .    ;; Extract 
88d0: 6f 75 74 20 73 74 75 66 66 20 6e 65 65 64 65 64  out stuff needed
88e0: 20 69 6e 20 6d 6f 73 74 20 6f 72 20 6d 61 6e 79   in most or many
88f0: 20 63 61 6c 6c 73 0a 09 20 20 20 20 3b 3b 20 68   calls..    ;; h
8900: 65 72 65 20 74 68 65 6e 20 63 61 6c 6c 20 70 72  ere then call pr
8910: 6f 63 0a 09 20 20 20 20 28 6c 65 74 2a 20 28 28  oc..    (let* ((
8920: 6b 65 79 6e 61 6d 65 73 20 20 20 28 6d 61 70 20  keynames   (map 
8930: 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d  key:get-fieldnam
8940: 65 20 6b 65 79 73 29 29 0a 09 09 20 20 20 28 6b  e keys))...   (k
8950: 65 79 76 61 6c 6c 73 74 20 20 28 6b 65 79 73 2d  eyvallst  (keys-
8960: 3e 76 61 6c 6c 69 73 74 20 6b 65 79 73 20 23 74  >vallist keys #t
8970: 29 29 29 0a 09 20 20 20 20 20 20 28 70 72 6f 63  )))..      (proc
8980: 20 64 62 20 74 61 72 67 65 74 20 72 75 6e 6e 61   db target runna
8990: 6d 65 20 6b 65 79 73 20 6b 65 79 6e 61 6d 65 73  me keys keynames
89a0: 20 6b 65 79 76 61 6c 6c 73 74 29 29 29 0a 09 28   keyvallst)))..(
89b0: 69 66 20 74 68 31 20 28 74 68 72 65 61 64 2d 6a  if th1 (thread-j
89c0: 6f 69 6e 21 20 74 68 31 29 29 0a 09 28 73 71 6c  oin! th1))..(sql
89d0: 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64  ite3:finalize! d
89e0: 62 29 0a 09 28 73 65 74 21 20 2a 64 69 64 73 6f  b)..(set! *didso
89f0: 6d 65 74 68 69 6e 67 2a 20 23 74 29 29 29 29 29  mething* #t)))))
8a00: 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  )..;;===========
8a10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8a20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8a30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8a40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4c  ===========.;; L
8a50: 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 72 75 6e 73 0a  ock/unlock runs.
8a60: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;;==============
8a70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8a80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8a90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8aa0: 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e  ========..(defin
8ab0: 65 20 28 72 75 6e 73 3a 68 61 6e 64 6c 65 2d 6c  e (runs:handle-l
8ac0: 6f 63 6b 69 6e 67 20 64 62 20 74 61 72 67 65 74  ocking db target
8ad0: 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65 20 6c 6f   keys runname lo
8ae0: 63 6b 20 75 6e 6c 6f 63 6b 20 75 73 65 72 29 0a  ck unlock user).
8af0: 20 20 28 6c 65 74 2a 20 28 28 72 75 6e 64 61 74    (let* ((rundat
8b00: 20 20 20 28 72 75 6e 73 3a 67 65 74 2d 72 75 6e     (runs:get-run
8b10: 73 2d 62 79 2d 70 61 74 74 20 64 62 20 6b 65 79  s-by-patt db key
8b20: 73 20 72 75 6e 6e 61 6d 65 29 29 0a 09 20 28 68  s runname)).. (h
8b30: 65 61 64 65 72 20 20 20 28 76 65 63 74 6f 72 2d  eader   (vector-
8b40: 72 65 66 20 72 75 6e 64 61 74 20 30 29 29 0a 09  ref rundat 0))..
8b50: 20 28 72 75 6e 73 20 20 20 20 20 28 76 65 63 74   (runs     (vect
8b60: 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 31 29  or-ref rundat 1)
8b70: 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68  )).    (for-each
8b80: 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a 09   (lambda (run)..
8b90: 09 28 6c 65 74 20 28 28 72 75 6e 2d 69 64 20 28  .(let ((run-id (
8ba0: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d  db:get-value-by-
8bb0: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65  header run heade
8bc0: 72 20 22 69 64 22 29 29 29 0a 09 09 20 20 28 69  r "id")))...  (i
8bd0: 66 20 28 6f 72 20 6c 6f 63 6b 0a 09 09 09 20 20  f (or lock....  
8be0: 28 61 6e 64 20 75 6e 6c 6f 63 6b 0a 09 09 09 20  (and unlock.... 
8bf0: 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09        (begin....
8c00: 09 20 28 70 72 69 6e 74 20 22 44 6f 20 79 6f 75  . (print "Do you
8c10: 20 72 65 61 6c 6c 79 20 77 69 73 68 20 74 6f 20   really wish to 
8c20: 75 6e 6c 6f 63 6b 20 72 75 6e 20 22 20 72 75 6e  unlock run " run
8c30: 2d 69 64 20 22 3f 5c 6e 20 20 20 79 2f 6e 3a 20  -id "?\n   y/n: 
8c40: 22 29 0a 09 09 09 09 20 28 65 71 75 61 6c 3f 20  ")..... (equal? 
8c50: 22 79 22 20 28 72 65 61 64 2d 6c 69 6e 65 29 29  "y" (read-line))
8c60: 29 29 29 0a 09 09 20 20 20 20 20 20 28 64 62 3a  )))...      (db:
8c70: 6c 6f 63 6b 2f 75 6e 6c 6f 63 6b 2d 72 75 6e 20  lock/unlock-run 
8c80: 64 62 20 72 75 6e 2d 69 64 20 6c 6f 63 6b 20 75  db run-id lock u
8c90: 6e 6c 6f 63 6b 20 75 73 65 72 29 0a 09 09 20 20  nlock user)...  
8ca0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
8cb0: 20 30 20 22 49 4e 46 4f 3a 20 53 6b 69 70 70 69   0 "INFO: Skippi
8cc0: 6e 67 20 6c 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 6f  ng lock/unlock o
8cd0: 6e 20 22 20 72 75 6e 2d 69 64 29 29 29 29 0a 09  n " run-id))))..
8ce0: 20 20 20 20 20 20 72 75 6e 73 29 29 29 0a 3b 3b        runs))).;;
8cf0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8d00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8d10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8d20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8d30: 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 6c 6c 75 70  ======.;; Rollup
8d40: 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d   runs.;;========
8d50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8d60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8d70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8d80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a  ==============..
8d90: 3b 3b 20 55 70 64 61 74 65 20 74 68 65 20 74 65  ;; Update the te
8da0: 73 74 5f 6d 65 74 61 20 74 61 62 6c 65 20 66 6f  st_meta table fo
8db0: 72 20 74 68 69 73 20 74 65 73 74 0a 28 64 65 66  r this test.(def
8dc0: 69 6e 65 20 28 72 75 6e 73 3a 75 70 64 61 74 65  ine (runs:update
8dd0: 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20 74 65  -test_meta db te
8de0: 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e  st-name test-con
8df0: 66 29 0a 20 20 28 6c 65 74 20 28 28 63 75 72 72  f).  (let ((curr
8e00: 72 65 63 6f 72 64 20 28 64 62 3a 74 65 73 74 6d  record (db:testm
8e10: 65 74 61 2d 67 65 74 2d 72 65 63 6f 72 64 20 64  eta-get-record d
8e20: 62 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20  b test-name))). 
8e30: 20 20 20 28 69 66 20 28 6e 6f 74 20 63 75 72 72     (if (not curr
8e40: 72 65 63 6f 72 64 29 0a 09 28 62 65 67 69 6e 0a  record)..(begin.
8e50: 09 20 20 28 73 65 74 21 20 63 75 72 72 72 65 63  .  (set! currrec
8e60: 6f 72 64 20 28 6d 61 6b 65 2d 76 65 63 74 6f 72  ord (make-vector
8e70: 20 31 30 20 23 66 29 29 0a 09 20 20 28 64 62 3a   10 #f))..  (db:
8e80: 74 65 73 74 6d 65 74 61 2d 61 64 64 2d 72 65 63  testmeta-add-rec
8e90: 6f 72 64 20 64 62 20 74 65 73 74 2d 6e 61 6d 65  ord db test-name
8ea0: 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63  ))).    (for-eac
8eb0: 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20  h .     (lambda 
8ec0: 28 6b 65 79 29 0a 20 20 20 20 20 20 20 28 6c 65  (key).       (le
8ed0: 74 2a 20 28 28 69 64 78 20 28 63 61 64 72 20 6b  t* ((idx (cadr k
8ee0: 65 79 29 29 0a 09 20 20 20 20 20 20 28 66 6c 64  ey))..      (fld
8ef0: 20 28 63 61 72 20 20 6b 65 79 29 29 0a 09 20 20   (car  key))..  
8f00: 20 20 20 20 28 76 61 6c 20 28 63 6f 6e 66 69 67      (val (config
8f10: 2d 6c 6f 6f 6b 75 70 20 74 65 73 74 2d 63 6f 6e  -lookup test-con
8f20: 66 20 22 74 65 73 74 5f 6d 65 74 61 22 20 66 6c  f "test_meta" fl
8f30: 64 29 29 29 0a 09 20 3b 3b 20 28 64 65 62 75 67  d))).. ;; (debug
8f40: 3a 70 72 69 6e 74 20 35 20 22 69 64 78 3a 20 22  :print 5 "idx: "
8f50: 20 69 64 78 20 22 20 66 6c 64 3a 20 22 20 66 6c   idx " fld: " fl
8f60: 64 20 22 20 76 61 6c 3a 20 22 20 76 61 6c 29 0a  d " val: " val).
8f70: 09 20 28 69 66 20 28 61 6e 64 20 76 61 6c 20 28  . (if (and val (
8f80: 6e 6f 74 20 28 65 71 75 61 6c 3f 20 28 76 65 63  not (equal? (vec
8f90: 74 6f 72 2d 72 65 66 20 63 75 72 72 72 65 63 6f  tor-ref currreco
8fa0: 72 64 20 69 64 78 29 20 76 61 6c 29 29 29 0a 09  rd idx) val)))..
8fb0: 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20       (begin..   
8fc0: 20 20 20 20 28 70 72 69 6e 74 20 22 55 70 64 61      (print "Upda
8fd0: 74 69 6e 67 20 22 20 74 65 73 74 2d 6e 61 6d 65  ting " test-name
8fe0: 20 22 20 22 20 66 6c 64 20 22 20 74 6f 20 22 20   " " fld " to " 
8ff0: 76 61 6c 29 0a 09 20 20 20 20 20 20 20 28 64 62  val)..       (db
9000: 3a 74 65 73 74 6d 65 74 61 2d 75 70 64 61 74 65  :testmeta-update
9010: 2d 66 69 65 6c 64 20 64 62 20 74 65 73 74 2d 6e  -field db test-n
9020: 61 6d 65 20 66 6c 64 20 76 61 6c 29 29 29 29 29  ame fld val)))))
9030: 0a 20 20 20 20 20 27 28 28 22 61 75 74 68 6f 72  .     '(("author
9040: 22 20 32 29 28 22 6f 77 6e 65 72 22 20 33 29 28  " 2)("owner" 3)(
9050: 22 64 65 73 63 72 69 70 74 69 6f 6e 22 20 34 29  "description" 4)
9060: 28 22 72 65 76 69 65 77 65 64 22 20 35 29 28 22  ("reviewed" 5)("
9070: 74 61 67 73 22 20 39 29 29 29 29 29 0a 0a 3b 3b  tags" 9)))))..;;
9080: 20 55 70 64 61 74 65 20 74 65 73 74 5f 6d 65 74   Update test_met
9090: 61 20 66 6f 72 20 61 6c 6c 20 74 65 73 74 73 0a  a for all tests.
90a0: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 75 70  (define (runs:up
90b0: 64 61 74 65 2d 61 6c 6c 2d 74 65 73 74 5f 6d 65  date-all-test_me
90c0: 74 61 20 64 62 29 0a 20 20 28 6c 65 74 20 28 28  ta db).  (let ((
90d0: 74 65 73 74 2d 6e 61 6d 65 73 20 28 67 65 74 2d  test-names (get-
90e0: 61 6c 6c 2d 6c 65 67 61 6c 2d 74 65 73 74 73 29  all-legal-tests)
90f0: 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68  )).    (for-each
9100: 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28   .     (lambda (
9110: 74 65 73 74 2d 6e 61 6d 65 29 0a 20 20 20 20 20  test-name).     
9120: 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 70    (let* ((test-p
9130: 61 74 68 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f  ath    (conc *to
9140: 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 22  ppath* "/tests/"
9150: 20 74 65 73 74 2d 6e 61 6d 65 29 29 0a 09 20 20   test-name))..  
9160: 20 20 20 20 28 74 65 73 74 2d 63 6f 6e 66 69 67      (test-config
9170: 66 20 28 63 6f 6e 63 20 74 65 73 74 2d 70 61 74  f (conc test-pat
9180: 68 20 22 2f 74 65 73 74 63 6f 6e 66 69 67 22 29  h "/testconfig")
9190: 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 65 78  )..      (testex
91a0: 69 73 74 73 20 20 20 28 61 6e 64 20 28 66 69 6c  ists   (and (fil
91b0: 65 2d 65 78 69 73 74 73 3f 20 74 65 73 74 2d 63  e-exists? test-c
91c0: 6f 6e 66 69 67 66 29 28 66 69 6c 65 2d 72 65 61  onfigf)(file-rea
91d0: 64 2d 61 63 63 65 73 73 3f 20 74 65 73 74 2d 63  d-access? test-c
91e0: 6f 6e 66 69 67 66 29 29 29 0a 09 20 20 20 20 20  onfigf)))..     
91f0: 20 3b 3b 20 72 65 61 64 20 63 6f 6e 66 69 67 73   ;; read configs
9200: 20 77 69 74 68 20 74 72 69 63 6b 73 20 74 75 72   with tricks tur
9210: 6e 65 64 20 6f 66 66 20 28 69 2e 65 2e 20 6e 6f  ned off (i.e. no
9220: 20 73 79 73 74 65 6d 29 0a 09 20 20 20 20 20 20   system)..      
9230: 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 20 28 69  (test-conf    (i
9240: 66 20 74 65 73 74 65 78 69 73 74 73 20 28 72 65  f testexists (re
9250: 61 64 2d 63 6f 6e 66 69 67 20 74 65 73 74 2d 63  ad-config test-c
9260: 6f 6e 66 69 67 66 20 23 66 20 23 66 29 28 6d 61  onfigf #f #f)(ma
9270: 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29  ke-hash-table)))
9280: 29 0a 09 20 28 72 75 6e 73 3a 75 70 64 61 74 65  ).. (runs:update
9290: 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20 74 65  -test_meta db te
92a0: 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e  st-name test-con
92b0: 66 29 29 29 0a 20 20 20 20 20 74 65 73 74 2d 6e  f))).     test-n
92c0: 61 6d 65 73 29 29 29 0a 0a 3b 3b 20 54 68 69 73  ames)))..;; This
92d0: 20 63 6f 75 6c 64 20 70 72 6f 62 61 62 6c 79 20   could probably 
92e0: 62 65 20 72 65 66 61 63 74 6f 72 65 64 20 69 6e  be refactored in
92f0: 74 6f 20 6f 6e 65 20 63 6f 6d 70 6c 65 78 20 71  to one complex q
9300: 75 65 72 79 20 2e 2e 2e 0a 28 64 65 66 69 6e 65  uery ....(define
9310: 20 28 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75   (runs:rollup-ru
9320: 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 61 6c  n db keys keyval
9330: 6c 73 74 20 72 75 6e 6e 61 6d 65 20 75 73 65 72  lst runname user
9340: 29 20 3b 3b 20 77 61 73 20 74 61 72 67 65 74 2c  ) ;; was target,
9350: 20 6e 6f 77 20 6b 65 79 76 61 6c 6c 73 74 0a 20   now keyvallst. 
9360: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20   (debug:print 4 
9370: 22 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e  "runs:rollup-run
9380: 2c 20 6b 65 79 73 3a 20 22 20 6b 65 79 73 20 22  , keys: " keys "
9390: 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65   keyvallst: " ke
93a0: 79 76 61 6c 6c 73 74 20 22 20 3a 72 75 6e 6e 61  yvallst " :runna
93b0: 6d 65 20 22 20 72 75 6e 6e 61 6d 65 20 22 20 75  me " runname " u
93c0: 73 65 72 3a 20 22 20 75 73 65 72 29 0a 20 20 28  ser: " user).  (
93d0: 6c 65 74 2a 20 28 3b 20 28 6b 65 79 76 61 6c 6c  let* (; (keyvall
93e0: 6c 73 74 20 20 20 20 20 20 28 6b 65 79 73 3a 74  lst      (keys:t
93f0: 61 72 67 65 74 2d 3e 6b 65 79 76 61 6c 20 6b 65  arget->keyval ke
9400: 79 73 20 74 61 72 67 65 74 29 29 0a 09 20 28 6e  ys target)).. (n
9410: 65 77 2d 72 75 6e 2d 69 64 20 20 20 20 20 20 28  ew-run-id      (
9420: 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75  runs:register-ru
9430: 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 61 6c  n db keys keyval
9440: 6c 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e 65 77  lst runname "new
9450: 22 20 22 6e 2f 61 22 20 75 73 65 72 29 29 0a 09  " "n/a" user))..
9460: 20 28 70 72 65 76 2d 74 65 73 74 73 20 20 20 20   (prev-tests    
9470: 20 20 28 74 65 73 74 3a 67 65 74 2d 6d 61 74 63    (test:get-matc
9480: 68 69 6e 67 2d 70 72 65 76 69 6f 75 73 2d 74 65  hing-previous-te
9490: 73 74 2d 72 75 6e 2d 72 65 63 6f 72 64 73 20 64  st-run-records d
94a0: 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 22 25 22  b new-run-id "%"
94b0: 20 22 25 22 29 29 0a 09 20 28 63 75 72 72 2d 74   "%")).. (curr-t
94c0: 65 73 74 73 20 20 20 20 20 20 28 72 64 62 3a 67  ests      (rdb:g
94d0: 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e  et-tests-for-run
94e0: 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 22   db new-run-id "
94f0: 25 22 20 22 25 22 20 27 28 29 20 27 28 29 29 29  %" "%" '() '()))
9500: 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73 2d 68  .. (curr-tests-h
9510: 61 73 68 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74  ash (make-hash-t
9520: 61 62 6c 65 29 29 29 0a 20 20 20 20 28 64 62 3a  able))).    (db:
9530: 75 70 64 61 74 65 2d 72 75 6e 2d 65 76 65 6e 74  update-run-event
9540: 5f 74 69 6d 65 20 64 62 20 6e 65 77 2d 72 75 6e  _time db new-run
9550: 2d 69 64 29 0a 20 20 20 20 3b 3b 20 69 6e 64 65  -id).    ;; inde
9560: 78 20 74 68 65 20 61 6c 72 65 61 64 79 20 73 61  x the already sa
9570: 76 65 64 20 74 65 73 74 73 20 62 79 20 74 65 73  ved tests by tes
9580: 74 6e 61 6d 65 20 61 6e 64 20 69 74 65 6d 64 61  tname and itemda
9590: 74 20 69 6e 20 63 75 72 72 2d 74 65 73 74 73 2d  t in curr-tests-
95a0: 68 61 73 68 0a 20 20 20 20 28 66 6f 72 2d 65 61  hash.    (for-ea
95b0: 63 68 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20  ch.     (lambda 
95c0: 28 74 65 73 74 64 61 74 29 0a 20 20 20 20 20 20  (testdat).      
95d0: 20 28 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 6d   (let* ((testnam
95e0: 65 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  e  (db:test-get-
95f0: 74 65 73 74 6e 61 6d 65 20 74 65 73 74 64 61 74  testname testdat
9600: 29 29 0a 09 20 20 20 20 20 20 28 69 74 65 6d 2d  ))..      (item-
9610: 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65  path (db:test-ge
9620: 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74  t-item-path test
9630: 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 66 75  dat))..      (fu
9640: 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65  ll-name (conc te
9650: 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d  stname "/" item-
9660: 70 61 74 68 29 29 29 0a 09 20 28 68 61 73 68 2d  path))).. (hash-
9670: 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72 72 2d  table-set! curr-
9680: 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d  tests-hash full-
9690: 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29 29 0a  name testdat))).
96a0: 20 20 20 20 20 63 75 72 72 2d 74 65 73 74 73 29       curr-tests)
96b0: 0a 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 4e 6f  .    ;; NOPE: No
96c0: 6e 2d 6f 70 74 69 6d 61 6c 20 61 70 70 72 6f 61  n-optimal approa
96d0: 63 68 2e 20 54 72 79 20 74 68 69 73 20 69 6e 73  ch. Try this ins
96e0: 74 65 61 64 2e 0a 20 20 20 20 3b 3b 20 20 20 31  tead..    ;;   1
96f0: 2e 20 74 65 73 74 73 20 61 72 65 20 72 65 63 65  . tests are rece
9700: 69 76 65 64 20 69 6e 20 61 20 6c 69 73 74 2c 20  ived in a list, 
9710: 6d 6f 73 74 20 72 65 63 65 6e 74 20 66 69 72 73  most recent firs
9720: 74 0a 20 20 20 20 3b 3b 20 20 20 32 2e 20 72 65  t.    ;;   2. re
9730: 70 6c 61 63 65 20 74 68 65 20 72 6f 6c 6c 75 70  place the rollup
9740: 20 74 65 73 74 20 77 69 74 68 20 74 68 65 20 6e   test with the n
9750: 65 77 20 2a 61 6c 77 61 79 73 2a 0a 20 20 20 20  ew *always*.    
9760: 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20  (for-each .     
9770: 28 6c 61 6d 62 64 61 20 28 74 65 73 74 64 61 74  (lambda (testdat
9780: 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28  ).       (let* (
9790: 28 74 65 73 74 6e 61 6d 65 20 20 28 64 62 3a 74  (testname  (db:t
97a0: 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65  est-get-testname
97b0: 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20   testdat))..    
97c0: 20 20 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62    (item-path (db
97d0: 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70  :test-get-item-p
97e0: 61 74 68 20 74 65 73 74 64 61 74 29 29 0a 09 20  ath testdat)).. 
97f0: 20 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20       (full-name 
9800: 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22  (conc testname "
9810: 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 09  /" item-path))..
9820: 20 20 20 20 20 20 28 70 72 65 76 2d 74 65 73 74        (prev-test
9830: 2d 64 61 74 20 28 68 61 73 68 2d 74 61 62 6c 65  -dat (hash-table
9840: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63 75 72  -ref/default cur
9850: 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c  r-tests-hash ful
9860: 6c 2d 6e 61 6d 65 20 23 66 29 29 0a 09 20 20 20  l-name #f))..   
9870: 20 20 20 28 74 65 73 74 2d 73 74 65 70 73 20 20     (test-steps  
9880: 20 20 20 20 28 64 62 3a 67 65 74 2d 73 74 65 70      (db:get-step
9890: 73 2d 66 6f 72 2d 74 65 73 74 20 64 62 20 28 64  s-for-test db (d
98a0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65  b:test-get-id te
98b0: 73 74 64 61 74 29 29 29 0a 09 20 20 20 20 20 20  stdat)))..      
98c0: 28 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64  (new-test-record
98d0: 20 23 66 29 29 0a 09 20 3b 3b 20 72 65 70 6c 61   #f)).. ;; repla
98e0: 63 65 20 74 68 65 73 65 20 77 69 74 68 20 69 6e  ce these with in
98f0: 73 65 72 74 20 2e 2e 2e 20 73 65 6c 65 63 74 0a  sert ... select.
9900: 09 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 33  . (apply sqlite3
9910: 3a 65 78 65 63 75 74 65 20 0a 09 09 64 62 20 0a  :execute ...db .
9920: 09 09 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20  ..(conc "INSERT 
9930: 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20  OR REPLACE INTO 
9940: 74 65 73 74 73 20 28 72 75 6e 5f 69 64 2c 74 65  tests (run_id,te
9950: 73 74 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61  stname,state,sta
9960: 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 68  tus,event_time,h
9970: 6f 73 74 2c 63 70 75 6c 6f 61 64 2c 64 69 73 6b  ost,cpuload,disk
9980: 66 72 65 65 2c 75 6e 61 6d 65 2c 72 75 6e 64 69  free,uname,rundi
9990: 72 2c 69 74 65 6d 5f 70 61 74 68 2c 72 75 6e 5f  r,item_path,run_
99a0: 64 75 72 61 74 69 6f 6e 2c 66 69 6e 61 6c 5f 6c  duration,final_l
99b0: 6f 67 66 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09  ogf,comment) "..
99c0: 09 20 20 20 20 20 20 22 56 41 4c 55 45 53 20 28  .      "VALUES (
99d0: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c  ?,?,?,?,?,?,?,?,
99e0: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 29 3b 22 29 0a  ?,?,?,?,?,?);").
99f0: 09 09 6e 65 77 2d 72 75 6e 2d 69 64 20 28 63 64  ..new-run-id (cd
9a00: 64 72 20 28 76 65 63 74 6f 72 2d 3e 6c 69 73 74  dr (vector->list
9a10: 20 74 65 73 74 64 61 74 29 29 29 0a 09 20 28 73   testdat))).. (s
9a20: 65 74 21 20 6e 65 77 2d 74 65 73 74 64 61 74 20  et! new-testdat 
9a30: 28 63 61 72 20 28 72 64 62 3a 67 65 74 2d 74 65  (car (rdb:get-te
9a40: 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e  sts-for-run db n
9a50: 65 77 2d 72 75 6e 2d 69 64 20 74 65 73 74 6e 61  ew-run-id testna
9a60: 6d 65 20 69 74 65 6d 2d 70 61 74 68 20 27 28 29  me item-path '()
9a70: 20 27 28 29 29 29 29 0a 09 20 28 68 61 73 68 2d   '()))).. (hash-
9a80: 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72 72 2d  table-set! curr-
9a90: 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d  tests-hash full-
9aa0: 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74 64 61 74  name new-testdat
9ab0: 29 20 3b 3b 20 74 68 69 73 20 63 6f 75 6c 64 20  ) ;; this could 
9ac0: 62 65 20 63 6f 6e 66 75 73 69 6e 67 2c 20 77 68  be confusing, wh
9ad0: 69 63 68 20 72 65 63 6f 72 64 20 73 68 6f 75 6c  ich record shoul
9ae0: 64 20 67 6f 20 69 6e 74 6f 20 74 68 65 20 6c 6f  d go into the lo
9af0: 6f 6b 75 70 20 74 61 62 6c 65 3f 0a 09 20 3b 3b  okup table?.. ;;
9b00: 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74   Now duplicate t
9b10: 68 65 20 74 65 73 74 20 73 74 65 70 73 0a 09 20  he test steps.. 
9b20: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22  (debug:print 4 "
9b30: 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 73 20  Copying records 
9b40: 69 6e 20 74 65 73 74 5f 73 74 65 70 73 20 66 72  in test_steps fr
9b50: 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62  om test_id=" (db
9b60: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73  :test-get-id tes
9b70: 74 64 61 74 29 20 22 20 74 6f 20 22 20 28 64 62  tdat) " to " (db
9b80: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77  :test-get-id new
9b90: 2d 74 65 73 74 64 61 74 29 29 0a 09 20 28 73 71  -testdat)).. (sq
9ba0: 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09  lite3:execute ..
9bb0: 20 20 64 62 20 0a 09 20 20 28 63 6f 6e 63 20 22    db ..  (conc "
9bc0: 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43  INSERT OR REPLAC
9bd0: 45 20 49 4e 54 4f 20 74 65 73 74 5f 73 74 65 70  E INTO test_step
9be0: 73 20 28 74 65 73 74 5f 69 64 2c 73 74 65 70 6e  s (test_id,stepn
9bf0: 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73  ame,state,status
9c00: 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d  ,event_time,comm
9c10: 65 6e 74 29 20 22 0a 09 09 22 53 45 4c 45 43 54  ent) "..."SELECT
9c20: 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d   " (db:test-get-
9c30: 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20  id new-testdat) 
9c40: 22 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 74 65  ",stepname,state
9c50: 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69  ,status,event_ti
9c60: 6d 65 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20  me,comment FROM 
9c70: 74 65 73 74 5f 73 74 65 70 73 20 57 48 45 52 45  test_steps WHERE
9c80: 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20   test_id=?;").. 
9c90: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64   (db:test-get-id
9ca0: 20 74 65 73 74 64 61 74 29 29 0a 09 20 3b 3b 20   testdat)).. ;; 
9cb0: 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74 68  Now duplicate th
9cc0: 65 20 74 65 73 74 20 64 61 74 61 0a 09 20 28 64  e test data.. (d
9cd0: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 43 6f  ebug:print 4 "Co
9ce0: 70 79 69 6e 67 20 72 65 63 6f 72 64 73 20 69 6e  pying records in
9cf0: 20 74 65 73 74 5f 64 61 74 61 20 66 72 6f 6d 20   test_data from 
9d00: 74 65 73 74 5f 69 64 3d 22 20 28 64 62 3a 74 65  test_id=" (db:te
9d10: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61  st-get-id testda
9d20: 74 29 20 22 20 74 6f 20 22 20 28 64 62 3a 74 65  t) " to " (db:te
9d30: 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65  st-get-id new-te
9d40: 73 74 64 61 74 29 29 0a 09 20 28 73 71 6c 69 74  stdat)).. (sqlit
9d50: 65 33 3a 65 78 65 63 75 74 65 20 0a 09 20 20 64  e3:execute ..  d
9d60: 62 20 0a 09 20 20 28 63 6f 6e 63 20 22 49 4e 53  b ..  (conc "INS
9d70: 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49  ERT OR REPLACE I
9d80: 4e 54 4f 20 74 65 73 74 5f 64 61 74 61 20 28 74  NTO test_data (t
9d90: 65 73 74 5f 69 64 2c 63 61 74 65 67 6f 72 79 2c  est_id,category,
9da0: 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65  variable,value,e
9db0: 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74  xpected,tol,unit
9dc0: 73 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 22  s,comment) "..."
9dd0: 53 45 4c 45 43 54 20 22 20 28 64 62 3a 74 65 73  SELECT " (db:tes
9de0: 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73  t-get-id new-tes
9df0: 74 64 61 74 29 20 22 2c 63 61 74 65 67 6f 72 79  tdat) ",category
9e00: 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c  ,variable,value,
9e10: 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69  expected,tol,uni
9e20: 74 73 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20  ts,comment FROM 
9e30: 74 65 73 74 5f 64 61 74 61 20 57 48 45 52 45 20  test_data WHERE 
9e40: 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20  test_id=?;")..  
9e50: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20  (db:test-get-id 
9e60: 74 65 73 74 64 61 74 29 29 0a 09 20 29 29 0a 20  testdat)).. )). 
9e70: 20 20 20 20 70 72 65 76 2d 74 65 73 74 73 29 29      prev-tests))
9e80: 29 0a 09 20 0a 20 20 20 20 20 0a                 ).. .     .