Megatest

Hex Artifact Content
Login

Artifact ec5f4d2861165507c478077c1532ed3e25fe85c4:


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: 6e 6f 74 20 28 76 65 63 74 6f 72 3f 20 74 29 29  not (vector? t))
36f0: 0a 09 09 09 09 09 20 20 20 20 20 28 63 6f 6e 63  ......     (conc
3700: 20 74 29 0a 09 09 09 09 09 20 20 20 20 20 28 63   t)......     (c
3710: 6f 6e 63 20 28 64 62 3a 74 65 73 74 2d 67 65 74  onc (db:test-get
3720: 2d 74 65 73 74 6e 61 6d 65 20 74 29 20 22 3a 22  -testname t) ":"
3730: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74   (db:test-get-st
3740: 61 74 65 20 74 29 20 22 2f 22 20 28 64 62 3a 74  ate t) "/" (db:t
3750: 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73 20 74  est-get-status t
3760: 29 29 29 29 0a 09 09 09 09 20 20 20 20 20 20 20  )))).....       
3770: 6c 73 74 29 29 29 29 0a 09 20 20 20 20 28 64 65  lst))))..    (de
3780: 62 75 67 3a 70 72 69 6e 74 20 36 0a 09 09 09 20  bug:print 6.... 
3790: 22 69 74 65 6d 64 61 74 3a 20 20 20 20 20 22 20  "itemdat:     " 
37a0: 69 74 65 6d 64 61 74 0a 09 09 09 20 22 5c 6e 20  itemdat.... "\n 
37b0: 20 69 74 65 6d 73 3a 20 20 20 20 20 22 20 69 74   items:     " it
37c0: 65 6d 73 0a 09 09 09 20 22 5c 6e 20 20 69 74 65  ems.... "\n  ite
37d0: 6d 2d 70 61 74 68 3a 20 22 20 69 74 65 6d 2d 70  m-path: " item-p
37e0: 61 74 68 0a 09 09 09 20 22 5c 6e 20 20 77 61 69  ath.... "\n  wai
37f0: 74 6f 6e 73 3a 20 20 20 22 20 77 61 69 74 6f 6e  tons:   " waiton
3800: 73 29 0a 0a 09 20 20 20 20 3b 3b 20 63 68 65 63  s)...    ;; chec
3810: 6b 20 66 6f 72 20 68 65 64 20 69 6e 20 77 61 69  k for hed in wai
3820: 74 6f 6e 73 20 3d 3e 20 74 68 69 73 20 77 6f 75  tons => this wou
3830: 6c 64 20 62 65 20 63 69 72 63 75 6c 61 72 2c 20  ld be circular, 
3840: 72 65 6d 6f 76 65 20 69 74 20 61 6e 64 20 69 73  remove it and is
3850: 73 75 65 20 61 6e 0a 09 20 20 20 20 3b 3b 20 65  sue an..    ;; e
3860: 72 72 6f 72 0a 09 20 20 20 20 28 69 66 20 28 6d  rror..    (if (m
3870: 65 6d 62 65 72 20 68 65 64 20 77 61 69 74 6f 6e  ember hed waiton
3880: 73 29 0a 09 09 28 62 65 67 69 6e 0a 09 09 20 20  s)...(begin...  
3890: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
38a0: 45 52 52 4f 52 3a 20 74 65 73 74 20 22 20 68 65  ERROR: test " he
38b0: 64 20 22 20 68 61 73 20 6c 69 73 74 65 64 20 69  d " has listed i
38c0: 74 73 65 6c 66 20 61 73 20 61 20 77 61 69 74 6f  tself as a waito
38d0: 6e 2c 20 70 6c 65 61 73 65 20 63 6f 72 72 65 63  n, please correc
38e0: 74 20 74 68 69 73 21 22 29 0a 09 09 20 20 28 73  t this!")...  (s
38f0: 65 74 21 20 77 61 69 74 6f 6e 20 28 66 69 6c 74  et! waiton (filt
3900: 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29 28 6e  er (lambda (x)(n
3910: 6f 74 20 28 65 71 75 61 6c 3f 20 78 20 68 65 64  ot (equal? x hed
3920: 29 29 29 20 77 61 69 74 6f 6e 73 29 29 29 29 0a  ))) waitons)))).
3930: 0a 09 20 20 20 20 28 63 6f 6e 64 0a 09 20 20 20  ..    (cond..   
3940: 20 20 28 28 6e 6f 74 20 69 74 65 6d 73 29 20 3b    ((not items) ;
3950: 3b 20 77 68 65 6e 20 66 61 6c 73 65 20 74 68 65  ; when false the
3960: 20 74 65 73 74 20 69 73 20 6f 6b 20 74 6f 20 62   test is ok to b
3970: 65 20 68 61 6e 64 65 64 20 6f 66 66 20 74 6f 20  e handed off to 
3980: 6c 61 75 6e 63 68 20 28 62 75 74 20 6e 6f 74 20  launch (but not 
3990: 62 65 66 6f 72 65 29 0a 09 20 20 20 20 20 20 28  before)..      (
39a0: 6c 65 74 2a 20 28 28 68 61 76 65 2d 72 65 73 6f  let* ((have-reso
39b0: 75 72 63 65 73 20 20 28 72 75 6e 73 3a 63 61 6e  urces  (runs:can
39c0: 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20  -run-more-tests 
39d0: 64 62 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29  db test-record))
39e0: 20 3b 3b 20 6c 6f 6f 6b 20 61 74 20 74 68 65 20   ;; look at the 
39f0: 74 65 73 74 20 6a 6f 62 67 72 6f 75 70 20 61 6e  test jobgroup an
3a00: 64 20 74 6f 74 20 6a 6f 62 73 20 72 75 6e 6e 69  d tot jobs runni
3a10: 6e 67 0a 09 09 20 20 20 20 20 28 70 72 65 72 65  ng...     (prere
3a20: 71 73 2d 6e 6f 74 2d 6d 65 74 20 28 64 62 3a 67  qs-not-met (db:g
3a30: 65 74 2d 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d  et-prereqs-not-m
3a40: 65 74 20 64 62 20 72 75 6e 2d 69 64 20 77 61 69  et db run-id wai
3a50: 74 6f 6e 73 20 69 74 65 6d 2d 70 61 74 68 20 6d  tons item-path m
3a60: 6f 64 65 3a 20 74 65 73 74 6d 6f 64 65 29 29 0a  ode: testmode)).
3a70: 09 09 20 20 20 20 20 28 66 61 69 6c 73 20 20 20  ..     (fails   
3a80: 20 20 20 20 20 20 20 20 28 63 61 6c 63 2d 66 61          (calc-fa
3a90: 69 6c 73 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d  ils prereqs-not-
3aa0: 6d 65 74 29 29 0a 09 09 20 20 20 20 20 28 6e 6f  met))...     (no
3ab0: 6e 2d 63 6f 6d 70 6c 65 74 65 64 20 20 20 28 63  n-completed   (c
3ac0: 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 74 65  alc-not-complete
3ad0: 64 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65  d prereqs-not-me
3ae0: 74 29 29 29 0a 09 09 28 64 65 62 75 67 3a 70 72  t)))...(debug:pr
3af0: 69 6e 74 20 38 20 22 49 4e 46 4f 3a 20 68 61 76  int 8 "INFO: hav
3b00: 65 2d 72 65 73 6f 75 72 63 65 73 3a 20 22 20 68  e-resources: " h
3b10: 61 76 65 2d 72 65 73 6f 75 72 63 65 73 20 22 20  ave-resources " 
3b20: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 3a  prereqs-not-met:
3b30: 20 22 20 0a 09 09 09 20 20 20 20 20 28 73 74 72   " ....     (str
3b40: 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20  ing-intersperse 
3b50: 0a 09 09 09 20 20 20 20 20 20 28 6d 61 70 20 28  ....      (map (
3b60: 6c 61 6d 62 64 61 20 28 74 29 0a 09 09 09 09 20  lambda (t)..... 
3b70: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 76 65      (if (not (ve
3b80: 63 74 6f 72 3f 20 74 29 29 0a 09 09 09 09 09 20  ctor? t))...... 
3b90: 28 63 6f 6e 63 20 22 20 57 41 52 4e 49 4e 47 3a  (conc " WARNING:
3ba0: 20 74 20 69 73 20 6e 6f 74 20 61 20 76 65 63 74   t is not a vect
3bb0: 6f 72 3d 22 20 74 20 29 0a 09 09 09 09 09 20 28  or=" t )...... (
3bc0: 63 6f 6e 63 20 28 64 62 3a 74 65 73 74 2d 67 65  conc (db:test-ge
3bd0: 74 2d 73 74 61 74 65 20 74 29 20 22 2f 22 20 28  t-state t) "/" (
3be0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74  db:test-get-stat
3bf0: 75 73 20 74 29 29 29 29 0a 09 09 09 09 20 20 20  us t)))).....   
3c00: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29  prereqs-not-met)
3c10: 20 22 2c 20 22 29 20 22 20 66 61 69 6c 73 3a 20   ", ") " fails: 
3c20: 22 20 66 61 69 6c 73 29 0a 09 09 3b 3b 20 44 6f  " fails)...;; Do
3c30: 6e 27 74 20 6b 6e 6f 77 20 61 74 20 74 68 69 73  n't know at this
3c40: 20 74 69 6d 65 20 69 66 20 74 68 65 20 74 65 73   time if the tes
3c50: 74 20 68 61 76 65 20 62 65 65 6e 20 6c 61 75 6e  t have been laun
3c60: 63 68 65 64 20 61 74 20 73 6f 6d 65 20 74 69 6d  ched at some tim
3c70: 65 20 69 6e 20 74 68 65 20 70 61 73 74 0a 09 09  e in the past...
3c80: 3b 3b 20 69 2e 65 2e 20 69 73 20 74 68 69 73 20  ;; i.e. is this 
3c90: 61 20 72 65 2d 6c 61 75 6e 63 68 3f 0a 09 09 28  a re-launch?...(
3ca0: 63 6f 6e 64 0a 09 09 20 28 28 61 6e 64 20 68 61  cond... ((and ha
3cb0: 76 65 2d 72 65 73 6f 75 72 63 65 73 0a 09 09 20  ve-resources... 
3cc0: 20 20 20 20 20 20 28 6f 72 20 28 6e 75 6c 6c 3f        (or (null?
3cd0: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74   prereqs-not-met
3ce0: 29 0a 09 09 09 20 20 20 28 61 6e 64 20 28 65 71  )....   (and (eq
3cf0: 3f 20 74 65 73 74 6d 6f 64 65 20 27 74 6f 70 6c  ? testmode 'topl
3d00: 65 76 65 6c 29 0a 09 09 09 09 28 6e 75 6c 6c 3f  evel).....(null?
3d10: 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 29   non-completed))
3d20: 29 29 0a 09 09 20 20 3b 3b 20 6e 6f 20 6c 6f 6f  ))...  ;; no loo
3d30: 70 20 68 65 72 65 2c 20 6a 75 73 74 20 64 72 6f  p here, just dro
3d40: 70 20 74 68 6f 75 67 68 20 61 6e 64 20 75 73 65  p though and use
3d50: 20 74 68 65 20 6c 6f 6f 70 20 61 74 20 74 68 65   the loop at the
3d60: 20 62 6f 74 74 6f 6d 20 0a 09 09 20 20 28 69 66   bottom ...  (if
3d70: 20 28 70 61 74 74 2d 6c 69 73 74 2d 6d 61 74 63   (patt-list-matc
3d80: 68 20 69 74 65 6d 2d 70 61 74 68 20 69 74 65 6d  h item-path item
3d90: 2d 70 61 74 74 73 29 0a 09 09 20 20 20 20 20 20  -patts)...      
3da0: 28 72 75 6e 3a 74 65 73 74 20 64 62 20 72 75 6e  (run:test db run
3db0: 2d 69 64 20 72 75 6e 6e 61 6d 65 20 6b 65 79 76  -id runname keyv
3dc0: 61 6c 6c 73 74 20 74 65 73 74 2d 72 65 63 6f 72  allst test-recor
3dd0: 64 20 66 6c 61 67 73 20 23 66 29 0a 09 09 20 20  d flags #f)...  
3de0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
3df0: 20 31 20 22 49 4e 46 4f 3a 20 53 6b 69 70 70 69   1 "INFO: Skippi
3e00: 6e 67 20 22 20 28 74 65 73 74 73 3a 74 65 73 74  ng " (tests:test
3e10: 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61  queue-get-testna
3e20: 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 29 20  me test-record) 
3e30: 22 20 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20  " " item-path " 
3e40: 61 73 20 69 74 20 64 6f 65 73 6e 27 74 20 6d 61  as it doesn't ma
3e50: 74 63 68 20 22 20 69 74 65 6d 2d 70 61 74 74 73  tch " item-patts
3e60: 29 29 0a 09 09 20 20 3b 3b 20 65 6c 73 65 20 74  ))...  ;; else t
3e70: 68 65 20 72 75 6e 20 69 73 20 73 74 75 63 6b 2c  he run is stuck,
3e80: 20 74 65 6d 70 6f 72 61 72 69 6c 79 20 6f 72 20   temporarily or 
3e90: 70 65 72 6d 61 6e 65 6e 74 6c 79 0a 09 09 20 20  permanently...  
3ea0: 3b 3b 20 62 75 74 20 73 68 6f 75 6c 64 20 63 68  ;; but should ch
3eb0: 65 63 6b 20 69 66 20 69 74 20 69 73 20 64 75 65  eck if it is due
3ec0: 20 74 6f 20 6c 61 63 6b 20 6f 66 20 72 65 73 6f   to lack of reso
3ed0: 75 72 63 65 73 20 76 73 2e 20 70 72 65 72 65 71  urces vs. prereq
3ee0: 75 69 73 69 74 65 73 0a 09 09 20 20 29 0a 09 09  uisites...  )...
3ef0: 20 28 28 6e 6f 74 20 68 61 76 65 2d 72 65 73 6f   ((not have-reso
3f00: 75 72 63 65 73 29 20 3b 3b 20 73 69 6d 70 6c 79  urces) ;; simply
3f10: 20 74 72 79 20 61 67 61 69 6e 20 61 66 74 65 72   try again after
3f20: 20 77 61 69 74 69 6e 67 20 61 20 73 65 63 6f 6e   waiting a secon
3f30: 64 0a 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c  d...  (thread-sl
3f40: 65 65 70 21 20 31 2e 30 29 0a 09 09 20 20 28 64  eep! 1.0)...  (d
3f50: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e  ebug:print 1 "IN
3f60: 46 4f 3a 20 6e 6f 20 72 65 73 6f 75 72 63 65 73  FO: no resources
3f70: 20 74 6f 20 72 75 6e 20 6e 65 77 20 74 65 73 74   to run new test
3f80: 73 2c 20 77 61 69 74 69 6e 67 20 2e 2e 2e 22 29  s, waiting ...")
3f90: 0a 09 09 20 20 3b 3b 20 63 6f 75 6c 64 20 68 61  ...  ;; could ha
3fa0: 76 65 20 64 6f 6e 65 20 68 65 64 20 74 61 6c 20  ve done hed tal 
3fb0: 68 65 72 65 20 62 75 74 20 64 6f 69 6e 67 20 63  here but doing c
3fc0: 61 72 2f 63 64 72 20 6f 66 20 6e 65 77 74 61 6c  ar/cdr of newtal
3fd0: 20 74 6f 20 72 6f 74 61 74 65 20 74 65 73 74 73   to rotate tests
3fe0: 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20  ...  (loop (car 
3ff0: 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74  newtal)(cdr newt
4000: 61 6c 29 29 29 0a 09 09 20 28 65 6c 73 65 20 3b  al)))... (else ;
4010: 3b 20 6d 75 73 74 20 62 65 20 77 65 20 68 61 76  ; must be we hav
4020: 65 20 75 6e 6d 65 74 20 70 72 65 72 65 71 75 69  e unmet prerequi
4030: 73 69 74 65 73 0a 09 09 20 20 20 20 28 64 65 62  sites...    (deb
4040: 75 67 3a 70 72 69 6e 74 20 34 20 22 46 41 49 4c  ug:print 4 "FAIL
4050: 53 3a 20 22 20 66 61 69 6c 73 29 0a 09 09 20 20  S: " fails)...  
4060: 20 20 3b 3b 20 49 66 20 6f 6e 65 20 6f 72 20 6d    ;; If one or m
4070: 6f 72 65 20 6f 66 20 74 68 65 20 70 72 65 72 65  ore of the prere
4080: 71 73 2d 6e 6f 74 2d 6d 65 74 20 61 72 65 20 46  qs-not-met are F
4090: 41 49 4c 20 74 68 65 6e 20 77 65 20 63 61 6e 20  AIL then we can 
40a0: 69 73 73 75 65 0a 09 09 20 20 20 20 3b 3b 20 61  issue...    ;; a
40b0: 20 6d 65 73 73 61 67 65 20 61 6e 64 20 64 72 6f   message and dro
40c0: 70 20 68 65 64 20 66 72 6f 6d 20 74 68 65 20 69  p hed from the i
40d0: 74 65 6d 73 20 74 6f 20 62 65 20 70 72 6f 63 65  tems to be proce
40e0: 73 73 65 64 2e 0a 09 09 20 20 20 20 28 69 66 20  ssed....    (if 
40f0: 28 6e 75 6c 6c 3f 20 66 61 69 6c 73 29 0a 09 09  (null? fails)...
4100: 09 28 62 65 67 69 6e 0a 09 09 09 20 20 3b 3b 20  .(begin....  ;; 
4110: 63 6f 75 6c 64 6e 27 74 20 72 75 6e 2c 20 74 61  couldn't run, ta
4120: 6b 65 20 61 20 62 72 65 61 74 68 65 72 0a 09 09  ke a breather...
4130: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  .  (debug:print 
4140: 34 20 22 49 4e 46 4f 3a 20 53 68 6f 75 6c 64 6e  4 "INFO: Shouldn
4150: 27 74 20 72 65 61 6c 6c 79 20 67 65 74 20 68 65  't really get he
4160: 72 65 2c 20 72 61 63 65 20 63 6f 6e 64 69 74 69  re, race conditi
4170: 6f 6e 3f 20 55 6e 61 62 6c 65 20 74 6f 20 6c 61  on? Unable to la
4180: 75 6e 63 68 20 6d 6f 72 65 20 74 65 73 74 73 20  unch more tests 
4190: 61 74 20 74 68 69 73 20 6d 6f 6d 65 6e 74 2c 20  at this moment, 
41a0: 6b 69 6c 6c 69 6e 67 20 74 69 6d 65 20 2e 2e 2e  killing time ...
41b0: 22 29 0a 09 09 09 20 20 28 74 68 72 65 61 64 2d  ")....  (thread-
41c0: 73 6c 65 65 70 21 20 30 2e 31 29 20 3b 3b 20 6c  sleep! 0.1) ;; l
41d0: 6f 6e 67 20 73 6c 65 65 70 20 68 65 72 65 20 2d  ong sleep here -
41e0: 20 6e 6f 20 72 65 73 6f 75 72 63 65 73 2c 20 6d   no resources, m
41f0: 61 79 20 61 73 20 77 65 6c 6c 20 62 65 20 70 61  ay as well be pa
4200: 74 69 65 6e 74 0a 09 09 09 20 20 3b 3b 20 77 65  tient....  ;; we
4210: 20 6d 61 64 65 20 6e 65 77 20 74 61 6c 20 62 79   made new tal by
4220: 20 73 74 69 63 6b 69 6e 67 20 68 65 64 20 61 74   sticking hed at
4230: 20 74 68 65 20 62 61 63 6b 20 6f 66 20 74 68 65   the back of the
4240: 20 6c 69 73 74 0a 09 09 09 20 20 28 6c 6f 6f 70   list....  (loop
4250: 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64   (car newtal)(cd
4260: 72 20 6e 65 77 74 61 6c 29 29 29 0a 09 09 09 3b  r newtal)))....;
4270: 3b 20 74 68 65 20 77 61 69 74 6f 6e 20 69 73 20  ; the waiton is 
4280: 46 41 49 4c 20 73 6f 20 6e 6f 20 70 6f 69 6e 74  FAIL so no point
4290: 20 69 6e 20 74 72 79 69 6e 67 20 74 6f 20 72 75   in trying to ru
42a0: 6e 20 68 65 64 20 65 76 65 72 20 61 67 61 69 6e  n hed ever again
42b0: 0a 09 09 09 28 69 66 20 28 6e 6f 74 20 28 6e 75  ....(if (not (nu
42c0: 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 09 20 20 20  ll? tal))....   
42d0: 20 28 62 65 67 69 6e 0a 09 09 09 20 20 20 20 20   (begin....     
42e0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20   (debug:print 1 
42f0: 22 57 41 52 4e 3a 20 44 72 6f 70 70 69 6e 67 20  "WARN: Dropping 
4300: 74 65 73 74 20 22 20 28 64 62 3a 74 65 73 74 2d  test " (db:test-
4310: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 68 65 64  get-testname hed
4320: 29 20 22 2f 22 20 28 64 62 3a 74 65 73 74 2d 67  ) "/" (db:test-g
4330: 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 68 65 64  et-item-path hed
4340: 29 0a 09 09 09 09 09 20 20 20 22 20 66 72 6f 6d  )......   " from
4350: 20 74 68 65 20 6c 61 75 6e 63 68 20 6c 69 73 74   the launch list
4360: 20 61 73 20 69 74 20 68 61 73 20 70 72 65 72 65   as it has prere
4370: 71 75 69 73 74 65 73 20 74 68 61 74 20 61 72 65  quistes that are
4380: 20 46 41 49 4c 22 29 0a 09 09 09 20 20 20 20 20   FAIL")....     
4390: 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29   (loop (car tal)
43a0: 28 63 64 72 20 74 61 6c 29 29 29 29 29 29 29 29  (cdr tal))))))))
43b0: 29 0a 09 20 20 20 20 20 0a 09 20 20 20 20 20 3b  )..     ..     ;
43c0: 3b 20 63 61 73 65 20 77 68 65 72 65 20 61 6e 20  ; case where an 
43d0: 69 74 65 6d 73 20 63 61 6d 65 20 69 6e 20 61 73  items came in as
43e0: 20 61 20 6c 69 73 74 20 62 65 65 6e 20 70 72 6f   a list been pro
43f0: 63 65 73 73 65 64 0a 09 20 20 20 20 20 28 28 61  cessed..     ((a
4400: 6e 64 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29  nd (list? items)
4410: 20 20 20 20 20 3b 3b 20 74 68 75 73 20 77 65 20       ;; thus we 
4420: 6b 6e 6f 77 20 6f 75 72 20 69 74 65 6d 73 20 61  know our items a
4430: 72 65 20 61 6c 72 65 61 64 79 20 63 61 6c 63 75  re already calcu
4440: 6c 61 74 65 64 0a 09 09 20 20 20 28 6e 6f 74 20  lated...   (not 
4450: 20 20 69 74 65 6d 64 61 74 29 29 20 3b 3b 20 61    itemdat)) ;; a
4460: 6e 64 20 6e 6f 74 20 79 65 74 20 65 78 70 61 6e  nd not yet expan
4470: 64 65 64 20 69 6e 74 6f 20 74 68 65 20 6c 69 73  ded into the lis
4480: 74 20 6f 66 20 74 68 69 6e 67 73 20 74 6f 20 62  t of things to b
4490: 65 20 64 6f 6e 65 0a 09 20 20 20 20 20 20 28 69  e done..      (i
44a0: 66 20 28 61 6e 64 20 28 3e 3d 20 2a 76 65 72 62  f (and (>= *verb
44b0: 6f 73 69 74 79 2a 20 31 29 0a 09 09 20 20 20 20  osity* 1)...    
44c0: 20 20 20 28 3e 20 28 6c 65 6e 67 74 68 20 69 74     (> (length it
44d0: 65 6d 73 29 20 30 29 0a 09 09 20 20 20 20 20 20  ems) 0)...      
44e0: 20 28 3e 20 28 6c 65 6e 67 74 68 20 28 63 61 72   (> (length (car
44f0: 20 69 74 65 6d 73 29 29 20 30 29 29 0a 09 09 20   items)) 0))... 
4500: 20 28 70 70 20 69 74 65 6d 73 29 29 0a 09 20 20   (pp items))..  
4510: 20 20 20 20 3b 3b 20 28 69 66 20 28 3e 3d 20 2a      ;; (if (>= *
4520: 76 65 72 62 6f 73 69 74 79 2a 20 35 29 0a 09 20  verbosity* 5).. 
4530: 20 20 20 20 20 3b 3b 20 20 20 20 20 28 62 65 67       ;;     (beg
4540: 69 6e 0a 09 20 20 20 20 20 20 3b 3b 20 20 20 20  in..      ;;    
4550: 20 20 20 28 70 72 69 6e 74 20 22 69 74 65 6d 73     (print "items
4560: 3a 20 22 29 20 20 20 20 20 28 70 70 20 28 69 74  : ")     (pp (it
4570: 65 6d 2d 61 73 73 6f 63 2d 3e 69 74 65 6d 2d 6c  em-assoc->item-l
4580: 69 73 74 20 69 74 65 6d 73 29 29 0a 09 20 20 20  ist items))..   
4590: 20 20 20 3b 3b 20 20 20 20 20 20 20 28 70 72 69     ;;       (pri
45a0: 6e 74 20 22 69 74 65 6d 73 74 61 62 6c 65 3a 20  nt "itemstable: 
45b0: 22 29 28 70 70 20 28 69 74 65 6d 2d 74 61 62 6c  ")(pp (item-tabl
45c0: 65 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 69 74 65  e->item-list ite
45d0: 6d 73 74 61 62 6c 65 29 29 29 29 0a 09 20 20 20  mstable))))..   
45e0: 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 09 20 20     (for-each..  
45f0: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6d 79       (lambda (my
4600: 2d 69 74 65 6d 64 61 74 29 0a 09 09 20 28 6c 65  -itemdat)... (le
4610: 74 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d 72 65  t* ((new-test-re
4620: 63 6f 72 64 20 28 6c 65 74 20 28 28 6e 65 77 72  cord (let ((newr
4630: 65 63 20 28 6d 61 6b 65 2d 74 65 73 74 73 3a 74  ec (make-tests:t
4640: 65 73 74 71 75 65 75 65 29 29 29 0a 09 09 09 09  estqueue))).....
4650: 09 20 20 20 28 76 65 63 74 6f 72 2d 63 6f 70 79  .   (vector-copy
4660: 21 20 74 65 73 74 2d 72 65 63 6f 72 64 20 6e 65  ! test-record ne
4670: 77 72 65 63 29 0a 09 09 09 09 09 20 20 20 6e 65  wrec)......   ne
4680: 77 72 65 63 29 29 0a 09 09 09 28 6d 79 2d 69 74  wrec))....(my-it
4690: 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69  em-path (item-li
46a0: 73 74 2d 3e 70 61 74 68 20 6d 79 2d 69 74 65 6d  st->path my-item
46b0: 64 61 74 29 29 29 0a 09 09 20 20 20 28 69 66 20  dat)))...   (if 
46c0: 28 70 61 74 74 2d 6c 69 73 74 2d 6d 61 74 63 68  (patt-list-match
46d0: 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68 20 69 74   my-item-path it
46e0: 65 6d 2d 70 61 74 74 73 29 20 20 20 20 20 20 20  em-patts)       
46f0: 20 20 20 20 3b 3b 20 79 65 73 2c 20 77 65 20 77      ;; yes, we w
4700: 61 6e 74 20 74 6f 20 70 72 6f 63 65 73 73 20 74  ant to process t
4710: 68 69 73 20 69 74 65 6d 2c 20 4e 4f 54 45 3a 20  his item, NOTE: 
4720: 53 68 6f 75 6c 64 20 6e 6f 74 20 6e 65 65 64 20  Should not need 
4730: 74 68 69 73 20 63 68 65 63 6b 20 68 65 72 65 21  this check here!
4740: 0a 09 09 20 20 20 20 20 20 20 28 6c 65 74 20 28  ...       (let (
4750: 28 6e 65 77 74 65 73 74 6e 61 6d 65 20 28 63 6f  (newtestname (co
4760: 6e 63 20 68 65 64 20 22 2f 22 20 6d 79 2d 69 74  nc hed "/" my-it
4770: 65 6d 2d 70 61 74 68 29 29 29 20 20 20 20 3b 3b  em-path)))    ;;
4780: 20 74 65 73 74 20 6e 61 6d 65 73 20 61 72 65 20   test names are 
4790: 75 6e 69 71 75 65 20 6f 6e 20 74 65 73 74 6e 61  unique on testna
47a0: 6d 65 2f 69 74 65 6d 2d 70 61 74 68 0a 09 09 09  me/item-path....
47b0: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75   (tests:testqueu
47c0: 65 2d 73 65 74 2d 69 74 65 6d 73 21 20 20 20 20  e-set-items!    
47d0: 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64   new-test-record
47e0: 20 23 66 29 0a 09 09 09 20 28 74 65 73 74 73 3a   #f).... (tests:
47f0: 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74  testqueue-set-it
4800: 65 6d 64 61 74 21 20 20 20 6e 65 77 2d 74 65 73  emdat!   new-tes
4810: 74 2d 72 65 63 6f 72 64 20 6d 79 2d 69 74 65 6d  t-record my-item
4820: 64 61 74 29 0a 09 09 09 20 28 74 65 73 74 73 3a  dat).... (tests:
4830: 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74  testqueue-set-it
4840: 65 6d 5f 70 61 74 68 21 20 6e 65 77 2d 74 65 73  em_path! new-tes
4850: 74 2d 72 65 63 6f 72 64 20 6d 79 2d 69 74 65 6d  t-record my-item
4860: 2d 70 61 74 68 29 0a 09 09 09 20 28 68 61 73 68  -path).... (hash
4870: 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 65 73 74  -table-set! test
4880: 2d 72 65 63 6f 72 64 73 20 6e 65 77 74 65 73 74  -records newtest
4890: 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74 2d 72 65  name new-test-re
48a0: 63 6f 72 64 29 0a 09 09 09 20 28 73 65 74 21 20  cord).... (set! 
48b0: 74 61 6c 20 28 63 6f 6e 73 20 6e 65 77 74 65 73  tal (cons newtes
48c0: 74 6e 61 6d 65 20 74 61 6c 29 29 29 29 29 29 20  tname tal)))))) 
48d0: 3b 3b 20 73 69 6e 63 65 20 74 68 65 73 65 20 61  ;; since these a
48e0: 72 65 20 69 74 65 6d 69 7a 65 64 20 63 72 65 61  re itemized crea
48f0: 74 65 20 6e 65 77 20 74 65 73 74 20 6e 61 6d 65  te new test name
4900: 73 20 74 65 73 74 6e 61 6d 65 2f 69 74 65 6d 70  s testname/itemp
4910: 61 74 68 0a 09 20 20 20 20 20 20 20 69 74 65 6d  ath..       item
4920: 73 29 0a 09 20 20 20 20 20 20 28 69 66 20 28 6e  s)..      (if (n
4930: 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a  ot (null? tal)).
4940: 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74  ..  (loop (car t
4950: 61 6c 29 28 63 64 72 20 74 61 6c 29 29 29 29 0a  al)(cdr tal)))).
4960: 0a 09 20 20 20 20 20 3b 3b 20 69 66 20 69 74 65  ..     ;; if ite
4970: 6d 73 20 69 73 20 61 20 70 72 6f 63 20 74 68 65  ms is a proc the
4980: 6e 20 6e 65 65 64 20 74 6f 20 72 75 6e 20 69 74  n need to run it
4990: 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72  ems:get-items-fr
49a0: 6f 6d 2d 63 6f 6e 66 69 67 2c 20 67 65 74 20 74  om-config, get t
49b0: 68 65 20 6c 69 73 74 20 61 6e 64 20 6c 6f 6f 70  he list and loop
49c0: 20 0a 09 20 20 20 20 20 3b 3b 20 20 20 20 2d 20   ..     ;;    - 
49d0: 62 75 74 20 6f 6e 6c 79 20 64 6f 20 74 68 61 74  but only do that
49e0: 20 69 66 20 72 65 73 6f 75 72 63 65 73 20 65 78   if resources ex
49f0: 69 73 74 20 74 6f 20 6b 69 63 6b 20 6f 66 66 20  ist to kick off 
4a00: 74 68 65 20 6a 6f 62 0a 09 20 20 20 20 20 28 28  the job..     ((
4a10: 6f 72 20 28 70 72 6f 63 65 64 75 72 65 3f 20 69  or (procedure? i
4a20: 74 65 6d 73 29 28 65 71 3f 20 69 74 65 6d 73 20  tems)(eq? items 
4a30: 27 68 61 76 65 2d 70 72 6f 63 65 64 75 72 65 29  'have-procedure)
4a40: 29 0a 09 20 20 20 20 20 20 28 6c 65 74 20 28 28  )..      (let ((
4a50: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 20 20 20 20  can-run-more    
4a60: 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f  (runs:can-run-mo
4a70: 72 65 2d 74 65 73 74 73 20 64 62 20 74 65 73 74  re-tests db test
4a80: 2d 72 65 63 6f 72 64 29 29 29 0a 09 09 28 69 66  -record)))...(if
4a90: 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 0a 09 09   can-run-more...
4aa0: 20 20 20 20 28 6c 65 74 2a 20 28 28 70 72 65 72      (let* ((prer
4ab0: 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 28 64 62 3a  eqs-not-met (db:
4ac0: 67 65 74 2d 70 72 65 72 65 71 73 2d 6e 6f 74 2d  get-prereqs-not-
4ad0: 6d 65 74 20 64 62 20 72 75 6e 2d 69 64 20 77 61  met db run-id wa
4ae0: 69 74 6f 6e 73 20 69 74 65 6d 2d 70 61 74 68 20  itons item-path 
4af0: 6d 6f 64 65 3a 20 74 65 73 74 6d 6f 64 65 29 29  mode: testmode))
4b00: 0a 09 09 09 20 20 20 28 66 61 69 6c 73 20 20 20  ....   (fails   
4b10: 20 20 20 20 20 20 20 20 28 63 61 6c 63 2d 66 61          (calc-fa
4b20: 69 6c 73 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d  ils prereqs-not-
4b30: 6d 65 74 29 29 0a 09 09 09 20 20 20 28 6e 6f 6e  met))....   (non
4b40: 2d 63 6f 6d 70 6c 65 74 65 64 20 20 20 28 63 61  -completed   (ca
4b50: 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 74 65 64  lc-not-completed
4b60: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74   prereqs-not-met
4b70: 29 29 29 0a 09 09 20 20 20 20 20 20 28 64 65 62  )))...      (deb
4b80: 75 67 3a 70 72 69 6e 74 20 38 20 22 49 4e 46 4f  ug:print 8 "INFO
4b90: 3a 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 3a 20  : can-run-more: 
4ba0: 22 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 0a 09  " can-run-more..
4bb0: 09 09 09 20 20 20 22 5c 6e 20 70 72 65 72 65 71  ...   "\n prereq
4bc0: 73 2d 6e 6f 74 2d 6d 65 74 3a 20 22 20 28 70 72  s-not-met: " (pr
4bd0: 65 74 74 79 2d 73 74 72 69 6e 67 20 70 72 65 72  etty-string prer
4be0: 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09 09  eqs-not-met)....
4bf0: 09 20 20 20 22 5c 6e 20 6e 6f 6e 2d 63 6f 6d 70  .   "\n non-comp
4c00: 6c 65 74 65 64 3a 20 20 20 22 20 28 70 72 65 74  leted:   " (pret
4c10: 74 79 2d 73 74 72 69 6e 67 20 6e 6f 6e 2d 63 6f  ty-string non-co
4c20: 6d 70 6c 65 74 65 64 29 20 0a 09 09 09 09 20 20  mpleted) .....  
4c30: 20 22 5c 6e 20 66 61 69 6c 73 3a 20 20 20 20 20   "\n fails:     
4c40: 20 20 20 20 20 20 22 20 28 70 72 65 74 74 79 2d        " (pretty-
4c50: 73 74 72 69 6e 67 20 66 61 69 6c 73 29 0a 09 09  string fails)...
4c60: 09 09 20 20 20 22 5c 6e 20 74 65 73 74 6d 6f 64  ..   "\n testmod
4c70: 65 3a 20 20 20 20 20 20 20 20 22 20 74 65 73 74  e:        " test
4c80: 6d 6f 64 65 0a 09 09 09 09 20 20 20 22 5c 6e 20  mode.....   "\n 
4c90: 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 74  (eq? testmode 't
4ca0: 6f 70 6c 65 76 65 6c 29 20 22 20 28 65 71 3f 20  oplevel) " (eq? 
4cb0: 74 65 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76  testmode 'toplev
4cc0: 65 6c 29 0a 09 09 09 09 20 20 20 22 5c 6e 20 28  el).....   "\n (
4cd0: 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65  null? non-comple
4ce0: 74 65 64 29 20 20 20 20 22 20 28 6e 75 6c 6c 3f  ted)    " (null?
4cf0: 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 29   non-completed))
4d00: 0a 09 09 20 20 20 20 20 20 28 63 6f 6e 64 20 0a  ...      (cond .
4d10: 09 09 20 20 20 20 20 20 20 28 28 6f 72 20 28 6e  ..       ((or (n
4d20: 75 6c 6c 3f 20 70 72 65 72 65 71 73 2d 6e 6f 74  ull? prereqs-not
4d30: 2d 6d 65 74 29 20 3b 3b 20 61 6c 6c 20 70 72 65  -met) ;; all pre
4d40: 72 65 71 73 20 6d 65 74 2c 20 66 69 72 65 20 6f  reqs met, fire o
4d50: 66 66 20 74 68 65 20 74 65 73 74 0a 09 09 09 20  ff the test.... 
4d60: 20 20 20 3b 3b 20 6f 72 2c 20 69 66 20 69 74 20     ;; or, if it 
4d70: 69 73 20 61 20 27 74 6f 70 6c 65 76 65 6c 20 74  is a 'toplevel t
4d80: 65 73 74 20 61 6e 64 20 61 6c 6c 20 70 72 65 72  est and all prer
4d90: 65 71 73 20 6e 6f 74 20 6d 65 74 20 61 72 65 20  eqs not met are 
4da0: 43 4f 4d 50 4c 45 54 45 44 20 74 68 65 6e 20 6c  COMPLETED then l
4db0: 61 75 6e 63 68 0a 09 09 09 20 20 20 20 28 61 6e  aunch....    (an
4dc0: 64 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20  d (eq? testmode 
4dd0: 27 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09 20  'toplevel)..... 
4de0: 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c  (null? non-compl
4df0: 65 74 65 64 29 29 29 0a 09 09 09 28 6c 65 74 20  eted)))....(let 
4e00: 28 28 74 65 73 74 2d 6e 61 6d 65 20 28 74 65 73  ((test-name (tes
4e10: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
4e20: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72  -testname test-r
4e30: 65 63 6f 72 64 29 29 29 0a 09 09 09 20 20 28 73  ecord)))....  (s
4e40: 65 74 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e  etenv "MT_TEST_N
4e50: 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 20  AME" test-name) 
4e60: 3b 3b 20 0a 09 09 09 20 20 28 73 65 74 65 6e 76  ;; ....  (setenv
4e70: 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20   "MT_RUNNAME"   
4e80: 72 75 6e 6e 61 6d 65 29 0a 09 09 09 20 20 28 73  runname)....  (s
4e90: 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d  et-megatest-env-
4ea0: 76 61 72 73 20 64 62 20 72 75 6e 2d 69 64 29 20  vars db run-id) 
4eb0: 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62 65 20  ;; these may be 
4ec0: 6e 65 65 64 65 64 20 62 79 20 74 68 65 20 6c 61  needed by the la
4ed0: 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 73 0a  unching process.
4ee0: 09 09 09 20 20 28 6c 65 74 20 28 28 69 74 65 6d  ...  (let ((item
4ef0: 73 2d 6c 69 73 74 20 28 69 74 65 6d 73 3a 67 65  s-list (items:ge
4f00: 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e  t-items-from-con
4f10: 66 69 67 20 74 63 6f 6e 66 69 67 29 29 29 0a 09  fig tconfig)))..
4f20: 09 09 20 20 20 20 28 69 66 20 28 6c 69 73 74 3f  ..    (if (list?
4f30: 20 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09 09 09   items-list)....
4f40: 09 28 62 65 67 69 6e 0a 09 09 09 09 20 20 28 74  .(begin.....  (t
4f50: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 73  ests:testqueue-s
4f60: 65 74 2d 69 74 65 6d 73 21 20 74 65 73 74 2d 72  et-items! test-r
4f70: 65 63 6f 72 64 20 69 74 65 6d 73 2d 6c 69 73 74  ecord items-list
4f80: 29 0a 09 09 09 09 20 20 28 6c 6f 6f 70 20 68 65  ).....  (loop he
4f90: 64 20 74 61 6c 29 29 0a 09 09 09 09 28 62 65 67  d tal)).....(beg
4fa0: 69 6e 0a 09 09 09 09 20 20 28 64 65 62 75 67 3a  in.....  (debug:
4fb0: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
4fc0: 54 68 65 20 70 72 6f 63 20 66 72 6f 6d 20 72 65  The proc from re
4fd0: 61 64 69 6e 67 20 74 68 65 20 73 65 74 75 70 20  ading the setup 
4fe0: 64 69 64 20 6e 6f 74 20 79 69 65 6c 64 20 61 20  did not yield a 
4ff0: 6c 69 73 74 20 2d 20 70 6c 65 61 73 65 20 72 65  list - please re
5000: 70 6f 72 74 20 74 68 69 73 22 29 0a 09 09 09 09  port this").....
5010: 20 20 28 65 78 69 74 20 31 29 29 29 29 29 29 0a    (exit 1)))))).
5020: 09 09 20 20 20 20 20 20 20 28 28 6e 75 6c 6c 3f  ..       ((null?
5030: 20 66 61 69 6c 73 29 0a 09 09 09 28 6c 6f 6f 70   fails)....(loop
5040: 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64   (car newtal)(cd
5050: 72 20 6e 65 77 74 61 6c 29 29 29 20 3b 3b 20 61  r newtal))) ;; a
5060: 6e 20 69 73 73 75 65 20 77 69 74 68 20 70 72 65  n issue with pre
5070: 72 65 71 73 20 6e 6f 74 20 79 65 74 20 6d 65 74  reqs not yet met
5080: 3f 0a 09 09 20 20 20 20 20 20 20 28 28 61 6e 64  ?...       ((and
5090: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 66 61 69   (not (null? fai
50a0: 6c 73 29 29 28 65 71 3f 20 74 65 73 74 6d 6f 64  ls))(eq? testmod
50b0: 65 20 27 6e 6f 72 6d 61 6c 29 29 0a 09 09 09 28  e 'normal))....(
50c0: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49  debug:print 1 "I
50d0: 4e 46 4f 3a 20 74 65 73 74 20 22 20 20 68 65 64  NFO: test "  hed
50e0: 20 22 20 28 6d 6f 64 65 3d 22 20 74 65 73 74 6d   " (mode=" testm
50f0: 6f 64 65 20 22 29 20 68 61 73 20 66 61 69 6c 65  ode ") has faile
5100: 64 20 70 72 65 72 65 71 75 69 73 69 74 65 28 73  d prerequisite(s
5110: 29 3b 20 22 0a 09 09 09 09 20 20 20 20 20 28 73  ); ".....     (s
5120: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73  tring-interspers
5130: 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28  e (map (lambda (
5140: 74 29 28 63 6f 6e 63 20 28 64 62 3a 74 65 73 74  t)(conc (db:test
5150: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 29  -get-testname t)
5160: 20 22 3a 22 20 28 64 62 3a 74 65 73 74 2d 67 65   ":" (db:test-ge
5170: 74 2d 73 74 61 74 65 20 74 29 22 2f 22 28 64 62  t-state t)"/"(db
5180: 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73  :test-get-status
5190: 20 74 29 29 29 20 66 61 69 6c 73 29 20 22 2c 20   t))) fails) ", 
51a0: 22 29 0a 09 09 09 09 20 20 20 20 20 22 2c 20 72  ").....     ", r
51b0: 65 6d 6f 76 69 6e 67 20 69 74 20 66 72 6f 6d 20  emoving it from 
51c0: 74 6f 2d 64 6f 20 6c 69 73 74 22 29 0a 09 09 09  to-do list")....
51d0: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20  (if (not (null? 
51e0: 74 61 6c 29 29 0a 09 09 09 20 20 20 20 28 6c 6f  tal))....    (lo
51f0: 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63 64 72  op (car tal)(cdr
5200: 20 74 61 6c 29 29 29 29 0a 09 09 20 20 20 20 20   tal))))...     
5210: 20 20 28 65 6c 73 65 0a 09 09 09 28 64 65 62 75    (else....(debu
5220: 67 3a 70 72 69 6e 74 20 38 20 22 45 52 52 4f 52  g:print 8 "ERROR
5230: 3a 20 4e 6f 20 68 61 6e 64 6c 65 72 20 66 6f 72  : No handler for
5240: 20 74 68 69 73 20 63 6f 6e 64 69 74 69 6f 6e 2e   this condition.
5250: 22 29 0a 09 09 09 3b 3b 20 09 20 20 20 20 20 22  ")....;; .     "
5260: 5c 6e 20 20 68 65 64 3a 20 20 20 20 20 20 20 20  \n  hed:        
5270: 20 20 20 20 22 20 68 65 64 20 0a 09 09 09 3b 3b      " hed ....;;
5280: 20 09 20 20 20 20 20 22 5c 6e 20 66 61 69 6c 73   .     "\n fails
5290: 3a 20 20 20 20 20 20 20 20 20 20 20 22 20 28 73  :           " (s
52a0: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73  tring-interspers
52b0: 65 20 28 6d 61 70 20 64 62 3a 74 65 73 74 2d 67  e (map db:test-g
52c0: 65 74 2d 74 65 73 74 6e 61 6d 65 20 66 61 69 6c  et-testname fail
52d0: 73 29 20 22 2c 22 29 0a 09 09 09 3b 3b 20 09 20  s) ",")....;; . 
52e0: 20 20 20 20 22 5c 6e 20 74 65 73 74 6d 6f 64 65      "\n testmode
52f0: 3a 20 20 20 20 20 20 20 20 22 20 74 65 73 74 6d  :        " testm
5300: 6f 64 65 0a 09 09 09 3b 3b 20 09 20 20 20 20 20  ode....;; .     
5310: 22 5c 6e 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d  "\n prereqs-not-
5320: 6d 65 74 3a 20 22 20 28 70 72 65 74 74 79 2d 73  met: " (pretty-s
5330: 74 72 69 6e 67 20 70 72 65 72 65 71 73 2d 6e 6f  tring prereqs-no
5340: 74 2d 6d 65 74 29 0a 09 09 09 3b 3b 20 09 20 20  t-met)....;; .  
5350: 20 20 20 22 5c 6e 20 69 74 65 6d 73 3a 20 20 20     "\n items:   
5360: 20 20 20 20 20 20 20 20 22 20 69 74 65 6d 73 29          " items)
5370: 0a 09 09 09 28 6c 6f 6f 70 20 28 63 61 72 20 6e  ....(loop (car n
5380: 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61  ewtal)(cdr newta
5390: 6c 29 29 29 29 29 0a 09 09 20 20 20 20 3b 3b 20  l)))))...    ;; 
53a0: 69 66 20 63 61 6e 27 74 20 72 75 6e 20 6d 6f 72  if can't run mor
53b0: 65 20 6a 75 73 74 20 6c 6f 6f 70 20 77 69 74 68  e just loop with
53c0: 20 6e 65 78 74 20 70 6f 73 73 69 62 6c 65 20 74   next possible t
53d0: 65 73 74 0a 09 09 20 20 20 20 28 6c 6f 6f 70 20  est...    (loop 
53e0: 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72  (car newtal)(cdr
53f0: 20 6e 65 77 74 61 6c 29 29 29 29 29 0a 09 20 20   newtal)))))..  
5400: 20 20 20 0a 09 20 20 20 20 20 3b 3b 20 74 68 69     ..     ;; thi
5410: 73 20 63 61 73 65 20 73 68 6f 75 6c 64 20 6e 6f  s case should no
5420: 74 20 68 61 70 70 65 6e 2c 20 61 64 64 65 64 20  t happen, added 
5430: 74 6f 20 68 65 6c 70 20 63 61 74 63 68 20 61 6e  to help catch an
5440: 79 20 62 75 67 73 0a 09 20 20 20 20 20 28 28 61  y bugs..     ((a
5450: 6e 64 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29  nd (list? items)
5460: 20 69 74 65 6d 64 61 74 29 0a 09 20 20 20 20 20   itemdat)..     
5470: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
5480: 22 45 52 52 4f 52 3a 20 53 68 6f 75 6c 64 20 6e  "ERROR: Should n
5490: 6f 74 20 68 61 76 65 20 61 20 6c 69 73 74 20 6f  ot have a list o
54a0: 66 20 69 74 65 6d 73 20 69 6e 20 61 20 74 65 73  f items in a tes
54b0: 74 20 61 6e 64 20 74 68 65 20 69 74 65 6d 73 70  t and the itemsp
54c0: 61 74 68 20 73 65 74 20 2d 20 70 6c 65 61 73 65  ath set - please
54d0: 20 72 65 70 6f 72 74 20 74 68 69 73 22 29 0a 09   report this")..
54e0: 20 20 20 20 20 20 28 65 78 69 74 20 31 29 29 29        (exit 1)))
54f0: 29 0a 09 20 20 0a 09 20 20 3b 3b 20 77 65 20 67  )..  ..  ;; we g
5500: 65 74 20 68 65 72 65 20 6f 6e 20 22 64 72 6f 70  et here on "drop
5510: 20 74 68 72 6f 75 67 68 22 20 2d 20 6c 6f 6f 70   through" - loop
5520: 20 66 6f 72 20 6e 65 78 74 20 74 65 73 74 20 69   for next test i
5530: 6e 20 71 75 65 75 65 0a 09 20 20 28 69 66 20 28  n queue..  (if (
5540: 6e 75 6c 6c 3f 20 74 61 6c 29 0a 09 20 20 20 20  null? tal)..    
5550: 20 20 28 62 65 67 69 6e 0a 09 09 3b 3b 20 46 49    (begin...;; FI
5560: 58 4d 45 21 21 21 21 20 54 48 49 53 20 53 48 4f  XME!!!! THIS SHO
5570: 55 4c 44 20 4e 4f 54 20 52 45 51 55 49 52 45 20  ULD NOT REQUIRE 
5580: 41 4e 20 45 58 49 54 21 21 21 21 21 21 21 0a 09  AN EXIT!!!!!!!..
5590: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20  .(debug:print 1 
55a0: 22 49 4e 46 4f 3a 20 41 6c 6c 20 74 65 73 74 73  "INFO: All tests
55b0: 20 6c 61 75 6e 63 68 65 64 22 29 0a 09 09 28 74   launched")...(t
55c0: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 30 2e 35  hread-sleep! 0.5
55d0: 29 0a 09 09 3b 3b 20 46 49 58 4d 45 21 20 54 68  )...;; FIXME! Th
55e0: 69 73 20 68 61 72 73 68 20 65 78 69 74 20 73 68  is harsh exit sh
55f0: 6f 75 6c 64 20 6e 6f 74 20 62 65 20 6e 65 63 65  ould not be nece
5600: 73 73 61 72 79 2e 2e 2e 2e 0a 09 09 28 69 66 20  ssary.......(if 
5610: 28 6e 6f 74 20 2a 72 75 6e 72 65 6d 6f 74 65 2a  (not *runremote*
5620: 29 28 65 78 69 74 29 29 20 3b 3b 20 0a 09 09 23  )(exit)) ;; ...#
5630: 66 29 20 3b 3b 20 72 65 74 75 72 6e 20 61 20 23  f) ;; return a #
5640: 66 20 61 73 20 61 20 68 69 6e 74 20 74 68 61 74  f as a hint that
5650: 20 77 65 20 61 72 65 20 64 6f 6e 65 0a 09 20 20   we are done..  
5660: 20 20 20 20 3b 3b 20 48 65 72 65 20 77 65 20 6e      ;; Here we n
5670: 65 65 64 20 74 6f 20 63 68 65 63 6b 20 74 68 61  eed to check tha
5680: 74 20 61 6c 6c 20 74 68 65 20 74 65 73 74 73 20  t all the tests 
5690: 72 65 6d 61 69 6e 69 6e 67 20 74 6f 20 62 65 20  remaining to be 
56a0: 72 75 6e 20 61 72 65 20 65 6c 69 67 69 62 6c 65  run are eligible
56b0: 20 74 6f 20 72 75 6e 0a 09 20 20 20 20 20 20 3b   to run..      ;
56c0: 3b 20 61 6e 64 20 61 72 65 20 6e 6f 74 20 62 6c  ; and are not bl
56d0: 6f 63 6b 65 64 20 62 79 20 66 61 69 6c 65 64 0a  ocked by failed.
56e0: 09 20 20 20 20 20 20 28 6c 65 74 20 28 28 6e 65  .      (let ((ne
56f0: 77 6c 73 74 20 28 74 65 73 74 73 3a 66 69 6c 74  wlst (tests:filt
5700: 65 72 2d 6e 6f 6e 2d 72 75 6e 6e 61 62 6c 65 20  er-non-runnable 
5710: 64 62 20 72 75 6e 2d 69 64 20 74 61 6c 20 74 65  db run-id tal te
5720: 73 74 2d 72 65 63 6f 72 64 73 29 29 29 20 3b 3b  st-records))) ;;
5730: 20 69 2e 65 2e 20 6e 6f 74 20 46 41 49 4c 2c 20   i.e. not FAIL, 
5740: 57 41 49 56 45 44 2c 20 49 4e 43 4f 4d 50 4c 45  WAIVED, INCOMPLE
5750: 54 45 2c 20 50 41 53 53 2c 20 4b 49 4c 4c 45 44  TE, PASS, KILLED
5760: 2c 0a 09 09 28 74 68 72 65 61 64 2d 73 6c 65 65  ,...(thread-slee
5770: 70 21 20 30 2e 31 29 0a 09 09 28 69 66 20 28 6e  p! 0.1)...(if (n
5780: 6f 74 20 28 6e 75 6c 6c 3f 20 6e 65 77 6c 73 74  ot (null? newlst
5790: 29 29 0a 09 09 20 20 20 20 28 6c 6f 6f 70 20 28  ))...    (loop (
57a0: 63 61 72 20 6e 65 77 6c 73 74 29 28 63 64 72 20  car newlst)(cdr 
57b0: 6e 65 77 6c 73 74 29 29 29 29 29 29 29 29 29 0a  newlst))))))))).
57c0: 0a 3b 3b 20 70 61 72 65 6e 74 2d 74 65 73 74 20  .;; parent-test 
57d0: 69 73 20 74 68 65 72 65 20 61 73 20 61 20 70 6c  is there as a pl
57e0: 61 63 65 68 6f 6c 64 65 72 20 66 6f 72 20 77 68  aceholder for wh
57f0: 65 6e 20 70 61 72 65 6e 74 2d 74 65 73 74 73 20  en parent-tests 
5800: 63 61 6e 20 62 65 20 72 75 6e 20 61 73 20 61 20  can be run as a 
5810: 73 65 74 75 70 20 73 74 65 70 0a 28 64 65 66 69  setup step.(defi
5820: 6e 65 20 28 72 75 6e 3a 74 65 73 74 20 64 62 20  ne (run:test db 
5830: 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 6b  run-id runname k
5840: 65 79 76 61 6c 6c 73 74 20 74 65 73 74 2d 72 65  eyvallst test-re
5850: 63 6f 72 64 20 66 6c 61 67 73 20 70 61 72 65 6e  cord flags paren
5860: 74 2d 74 65 73 74 29 0a 20 20 3b 3b 20 41 6c 6c  t-test).  ;; All
5870: 20 74 68 65 73 65 20 76 61 72 73 20 6d 69 67 68   these vars migh
5880: 74 20 62 65 20 72 65 66 65 72 65 6e 63 65 64 20  t be referenced 
5890: 62 79 20 74 68 65 20 74 65 73 74 63 6f 6e 66 69  by the testconfi
58a0: 67 20 66 69 6c 65 20 72 65 61 64 65 72 0a 20 20  g file reader.  
58b0: 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 6e 61 6d  (let* ((test-nam
58c0: 65 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74  e    (tests:test
58d0: 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61  queue-get-testna
58e0: 6d 65 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64  me   test-record
58f0: 29 29 0a 09 20 28 74 65 73 74 2d 77 61 69 74 6f  )).. (test-waito
5900: 6e 73 20 28 74 65 73 74 73 3a 74 65 73 74 71 75  ns (tests:testqu
5910: 65 75 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20  eue-get-waitons 
5920: 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29     test-record))
5930: 0a 09 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 20  .. (test-conf   
5940: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75   (tests:testqueu
5950: 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67  e-get-testconfig
5960: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09   test-record))..
5970: 20 28 69 74 65 6d 64 61 74 20 20 20 20 20 20 28   (itemdat      (
5980: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
5990: 67 65 74 2d 69 74 65 6d 64 61 74 20 20 20 20 74  get-itemdat    t
59a0: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28  est-record)).. (
59b0: 74 65 73 74 2d 70 61 74 68 20 20 20 20 28 63 6f  test-path    (co
59c0: 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74  nc *toppath* "/t
59d0: 65 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d 65  ests/" test-name
59e0: 29 29 20 3b 3b 20 63 6f 75 6c 64 20 75 73 65 20  )) ;; could use 
59f0: 74 65 73 74 73 3a 67 65 74 2d 74 65 73 74 63 6f  tests:get-testco
5a00: 6e 66 69 67 20 68 65 72 65 20 2e 2e 2e 0a 09 20  nfig here ..... 
5a10: 28 66 6f 72 63 65 20 20 20 20 20 20 20 20 28 68  (force        (h
5a20: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65  ash-table-ref/de
5a30: 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 66 6f  fault flags "-fo
5a40: 72 63 65 22 20 23 66 29 29 0a 09 20 28 72 65 72  rce" #f)).. (rer
5a50: 75 6e 20 20 20 20 20 20 20 20 28 68 61 73 68 2d  un        (hash-
5a60: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c  table-ref/defaul
5a70: 74 20 66 6c 61 67 73 20 22 2d 72 65 72 75 6e 22  t flags "-rerun"
5a80: 20 23 66 29 29 0a 09 20 28 6b 65 65 70 67 6f 69   #f)).. (keepgoi
5a90: 6e 67 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c  ng    (hash-tabl
5aa0: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c  e-ref/default fl
5ab0: 61 67 73 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22  ags "-keepgoing"
5ac0: 20 23 66 29 29 0a 09 20 28 69 74 65 6d 2d 70 61   #f)).. (item-pa
5ad0: 74 68 20 20 20 20 20 22 22 29 29 0a 20 20 20 20  th     "")).    
5ae0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 35 0a 09  (debug:print 5..
5af0: 09 20 22 74 65 73 74 2d 63 6f 6e 66 69 67 3a 20  . "test-config: 
5b00: 22 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61  " (hash-table->a
5b10: 6c 69 73 74 20 74 65 73 74 2d 63 6f 6e 66 29 0a  list test-conf).
5b20: 09 09 20 22 5c 6e 20 20 20 69 74 65 6d 64 61 74  .. "\n   itemdat
5b30: 3a 20 22 20 69 74 65 6d 64 61 74 0a 09 09 20 29  : " itemdat... )
5b40: 0a 20 20 20 20 3b 3b 20 73 65 74 74 69 6e 67 20  .    ;; setting 
5b50: 69 74 65 6d 64 61 74 20 74 6f 20 61 20 6c 69 73  itemdat to a lis
5b60: 74 20 69 66 20 69 74 20 69 73 20 23 66 0a 20 20  t if it is #f.  
5b70: 20 20 28 69 66 20 28 6e 6f 74 20 69 74 65 6d 64    (if (not itemd
5b80: 61 74 29 28 73 65 74 21 20 69 74 65 6d 64 61 74  at)(set! itemdat
5b90: 20 27 28 29 29 29 0a 20 20 20 20 28 73 65 74 21   '())).    (set!
5ba0: 20 69 74 65 6d 2d 70 61 74 68 20 28 69 74 65 6d   item-path (item
5bb0: 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d  -list->path item
5bc0: 64 61 74 29 29 0a 20 20 20 20 28 64 65 62 75 67  dat)).    (debug
5bd0: 3a 70 72 69 6e 74 20 32 20 22 41 74 74 65 6d 70  :print 2 "Attemp
5be0: 74 69 6e 67 20 74 6f 20 6c 61 75 6e 63 68 20 74  ting to launch t
5bf0: 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20  est " test-name 
5c00: 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 20  "/" item-path). 
5c10: 20 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 54     (setenv "MT_T
5c20: 45 53 54 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e  EST_NAME" test-n
5c30: 61 6d 65 29 20 3b 3b 20 0a 20 20 20 20 28 73 65  ame) ;; .    (se
5c40: 74 65 6e 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45  tenv "MT_RUNNAME
5c50: 22 20 20 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20  "   runname).   
5c60: 20 28 73 65 74 2d 6d 65 67 61 74 65 73 74 2d 65   (set-megatest-e
5c70: 6e 76 2d 76 61 72 73 20 64 62 20 72 75 6e 2d 69  nv-vars db run-i
5c80: 64 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20  d) ;; these may 
5c90: 62 65 20 6e 65 65 64 65 64 20 62 79 20 74 68 65  be needed by the
5ca0: 20 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65   launching proce
5cb0: 73 73 0a 20 20 20 20 28 63 68 61 6e 67 65 2d 64  ss.    (change-d
5cc0: 69 72 65 63 74 6f 72 79 20 2a 74 6f 70 70 61 74  irectory *toppat
5cd0: 68 2a 29 0a 0a 20 20 20 20 3b 3b 20 48 65 72 65  h*)..    ;; Here
5ce0: 20 69 73 20 77 68 65 72 65 20 74 68 65 20 74 65   is where the te
5cf0: 73 74 5f 6d 65 74 61 20 74 61 62 6c 65 20 69 73  st_meta table is
5d00: 20 62 65 73 74 20 75 70 64 61 74 65 64 0a 20 20   best updated.  
5d10: 20 20 3b 3b 20 59 65 73 2c 20 61 6e 6f 74 68 65    ;; Yes, anothe
5d20: 72 20 75 73 65 20 6f 66 20 61 20 67 6c 6f 62 61  r use of a globa
5d30: 6c 20 66 6f 72 20 63 61 63 68 69 6e 67 2e 20 4e  l for caching. N
5d40: 65 65 64 20 61 20 62 65 74 74 65 72 20 77 61 79  eed a better way
5d50: 3f 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28  ?.    (if (not (
5d60: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64  hash-table-ref/d
5d70: 65 66 61 75 6c 74 20 2a 74 65 73 74 2d 6d 65 74  efault *test-met
5d80: 61 2d 75 70 64 61 74 65 64 2a 20 74 65 73 74 2d  a-updated* test-
5d90: 6e 61 6d 65 20 23 66 29 29 0a 20 20 20 20 20 20  name #f)).      
5da0: 20 20 28 62 65 67 69 6e 0a 09 20 20 20 28 68 61    (begin..   (ha
5db0: 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 2a 74  sh-table-set! *t
5dc0: 65 73 74 2d 6d 65 74 61 2d 75 70 64 61 74 65 64  est-meta-updated
5dd0: 2a 20 74 65 73 74 2d 6e 61 6d 65 20 23 74 29 0a  * test-name #t).
5de0: 20 20 20 20 20 20 20 20 20 20 20 28 72 75 6e 73             (runs
5df0: 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74  :update-test_met
5e00: 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 74  a db test-name t
5e10: 65 73 74 2d 63 6f 6e 66 29 29 29 0a 20 20 20 20  est-conf))).    
5e20: 0a 20 20 20 20 3b 3b 20 28 6c 61 6d 62 64 61 20  .    ;; (lambda 
5e30: 28 69 74 65 6d 64 61 74 29 20 3b 3b 3b 20 28 28  (itemdat) ;;; ((
5e40: 72 69 70 65 6e 65 73 73 20 22 6f 76 65 72 72 69  ripeness "overri
5e50: 70 65 22 29 20 28 74 65 6d 70 65 72 61 74 75 72  pe") (temperatur
5e60: 65 20 22 63 6f 6f 6c 22 29 20 28 73 65 61 73 6f  e "cool") (seaso
5e70: 6e 20 22 73 75 6d 6d 65 72 22 29 29 0a 20 20 20  n "summer")).   
5e80: 20 28 6c 65 74 2a 20 28 28 6e 65 77 2d 74 65 73   (let* ((new-tes
5e90: 74 2d 70 61 74 68 20 28 73 74 72 69 6e 67 2d 69  t-path (string-i
5ea0: 6e 74 65 72 73 70 65 72 73 65 20 28 63 6f 6e 73  ntersperse (cons
5eb0: 20 74 65 73 74 2d 70 61 74 68 20 28 6d 61 70 20   test-path (map 
5ec0: 63 61 64 72 20 69 74 65 6d 64 61 74 29 29 20 22  cadr itemdat)) "
5ed0: 2f 22 29 29 0a 09 20 20 20 28 6e 65 77 2d 74 65  /"))..   (new-te
5ee0: 73 74 2d 6e 61 6d 65 20 28 69 66 20 28 65 71 75  st-name (if (equ
5ef0: 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 22  al? item-path ""
5f00: 29 20 74 65 73 74 2d 6e 61 6d 65 20 28 63 6f 6e  ) test-name (con
5f10: 63 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20  c test-name "/" 
5f20: 69 74 65 6d 2d 70 61 74 68 29 29 29 20 3b 3b 20  item-path))) ;; 
5f30: 6a 75 73 74 20 6e 65 65 64 20 69 74 20 74 6f 20  just need it to 
5f40: 62 65 20 75 6e 69 71 75 65 0a 09 20 20 20 28 74  be unique..   (t
5f50: 65 73 74 64 61 74 20 20 20 20 20 20 20 28 64 62  estdat       (db
5f60: 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64  :get-test-info d
5f70: 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61  b run-id test-na
5f80: 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 09  me item-path))..
5f90: 20 20 20 28 74 65 73 74 2d 69 64 20 20 20 20 20     (test-id     
5fa0: 20 20 23 66 29 29 0a 20 20 20 20 20 20 28 69 66    #f)).      (if
5fb0: 20 28 6e 6f 74 20 74 65 73 74 64 61 74 29 0a 09   (not testdat)..
5fc0: 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 3b 3b    (begin..    ;;
5fd0: 20 65 6e 73 75 72 65 20 74 68 61 74 20 74 68 65   ensure that the
5fe0: 20 70 61 74 68 20 65 78 69 73 74 73 20 62 65 66   path exists bef
5ff0: 6f 72 65 20 72 65 67 69 73 74 65 72 69 6e 67 20  ore registering 
6000: 74 68 65 20 74 65 73 74 0a 09 20 20 20 20 3b 3b  the test..    ;;
6010: 20 4e 4f 50 45 3a 20 43 61 6e 6e 6f 74 21 20 44   NOPE: Cannot! D
6020: 6f 6e 27 74 20 6b 6e 6f 77 20 79 65 74 20 77 68  on't know yet wh
6030: 69 63 68 20 64 69 73 6b 20 61 72 65 61 20 77 69  ich disk area wi
6040: 6c 6c 20 62 65 20 61 73 73 69 67 6e 65 64 2e 2e  ll be assigned..
6050: 2e 2e 0a 09 20 20 20 20 3b 3b 20 28 73 79 73 74  ....    ;; (syst
6060: 65 6d 20 28 63 6f 6e 63 20 22 6d 6b 64 69 72 20  em (conc "mkdir 
6070: 2d 70 20 22 20 6e 65 77 2d 74 65 73 74 2d 70 61  -p " new-test-pa
6080: 74 68 29 29 0a 09 20 20 20 20 28 72 74 65 73 74  th))..    (rtest
6090: 73 3a 72 65 67 69 73 74 65 72 2d 74 65 73 74 20  s:register-test 
60a0: 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e  db run-id test-n
60b0: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 09  ame item-path)..
60c0: 20 20 20 20 28 73 65 74 21 20 74 65 73 74 64 61      (set! testda
60d0: 74 20 28 64 62 3a 67 65 74 2d 74 65 73 74 2d 69  t (db:get-test-i
60e0: 6e 66 6f 20 64 62 20 72 75 6e 2d 69 64 20 74 65  nfo db run-id te
60f0: 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74  st-name item-pat
6100: 68 29 29 29 29 0a 20 20 20 20 20 20 28 73 65 74  h)))).      (set
6110: 21 20 74 65 73 74 2d 69 64 20 28 64 62 3a 74 65  ! test-id (db:te
6120: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61  st-get-id testda
6130: 74 29 29 0a 20 20 20 20 20 20 28 63 68 61 6e 67  t)).      (chang
6140: 65 2d 64 69 72 65 63 74 6f 72 79 20 74 65 73 74  e-directory test
6150: 2d 70 61 74 68 29 0a 20 20 20 20 20 20 28 63 61  -path).      (ca
6160: 73 65 20 28 69 66 20 66 6f 72 63 65 20 3b 3b 20  se (if force ;; 
6170: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
6180: 66 6f 72 63 65 22 29 0a 09 09 27 4e 4f 54 5f 53  force")...'NOT_S
6190: 54 41 52 54 45 44 0a 09 09 28 69 66 20 74 65 73  TARTED...(if tes
61a0: 74 64 61 74 0a 09 09 20 20 20 20 28 73 74 72 69  tdat...    (stri
61b0: 6e 67 2d 3e 73 79 6d 62 6f 6c 20 28 74 65 73 74  ng->symbol (test
61c0: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64  :get-state testd
61d0: 61 74 29 29 0a 09 09 20 20 20 20 27 66 61 69 6c  at))...    'fail
61e0: 65 64 2d 74 6f 2d 69 6e 73 65 72 74 29 29 0a 09  ed-to-insert))..
61f0: 28 28 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65  ((failed-to-inse
6200: 72 74 29 0a 09 20 28 64 65 62 75 67 3a 70 72 69  rt).. (debug:pri
6210: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 46 61 69  nt 0 "ERROR: Fai
6220: 6c 65 64 20 74 6f 20 69 6e 73 65 72 74 20 74 68  led to insert th
6230: 65 20 72 65 63 6f 72 64 20 69 6e 74 6f 20 74 68  e record into th
6240: 65 20 64 62 22 29 29 0a 09 28 28 4e 4f 54 5f 53  e db"))..((NOT_S
6250: 54 41 52 54 45 44 20 43 4f 4d 50 4c 45 54 45 44  TARTED COMPLETED
6260: 29 0a 09 20 28 6c 65 74 20 28 28 72 75 6e 66 6c  ).. (let ((runfl
6270: 61 67 20 23 66 29 29 0a 09 20 20 20 28 63 6f 6e  ag #f))..   (con
6280: 64 0a 09 20 20 20 20 3b 3b 20 2d 66 6f 72 63 65  d..    ;; -force
6290: 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20  , run no matter 
62a0: 77 68 61 74 0a 09 20 20 20 20 28 66 6f 72 63 65  what..    (force
62b0: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23   (set! runflag #
62c0: 74 29 29 0a 09 20 20 20 20 3b 3b 20 4e 4f 54 5f  t))..    ;; NOT_
62d0: 53 54 41 52 54 45 44 2c 20 72 75 6e 20 6e 6f 20  STARTED, run no 
62e0: 6d 61 74 74 65 72 20 77 68 61 74 0a 09 20 20 20  matter what..   
62f0: 20 28 28 65 71 75 61 6c 3f 20 28 74 65 73 74 3a   ((equal? (test:
6300: 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61  get-state testda
6310: 74 29 20 22 4e 4f 54 5f 53 54 41 52 54 45 44 22  t) "NOT_STARTED"
6320: 29 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23  )(set! runflag #
6330: 74 29 29 0a 09 20 20 20 20 3b 3b 20 6e 6f 74 20  t))..    ;; not 
6340: 2d 72 65 72 75 6e 20 61 6e 64 20 50 41 53 53 2c  -rerun and PASS,
6350: 20 57 41 52 4e 20 6f 72 20 43 48 45 43 4b 2c 20   WARN or CHECK, 
6360: 64 6f 20 6e 6f 20 72 75 6e 0a 09 20 20 20 20 28  do no run..    (
6370: 28 61 6e 64 20 28 6f 72 20 28 6e 6f 74 20 72 65  (and (or (not re
6380: 72 75 6e 29 0a 09 09 20 20 20 20 20 20 6b 65 65  run)...      kee
6390: 70 67 6f 69 6e 67 29 0a 09 09 20 20 3b 3b 20 52  pgoing)...  ;; R
63a0: 65 71 75 69 72 65 20 74 6f 20 66 6f 72 63 65 20  equire to force 
63b0: 72 65 2d 72 75 6e 20 66 6f 72 20 43 4f 4d 50 4c  re-run for COMPL
63c0: 45 54 45 44 20 6f 72 20 2a 61 6e 79 74 68 69 6e  ETED or *anythin
63d0: 67 2a 20 2b 20 50 41 53 53 2c 57 41 52 4e 20 6f  g* + PASS,WARN o
63e0: 72 20 43 48 45 43 4b 0a 09 09 20 20 28 6f 72 20  r CHECK...  (or 
63f0: 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65  (member (test:ge
6400: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74  t-status testdat
6410: 29 20 27 28 22 50 41 53 53 22 20 22 57 41 52 4e  ) '("PASS" "WARN
6420: 22 20 22 43 48 45 43 4b 22 29 29 0a 09 09 20 20  " "CHECK"))...  
6430: 20 20 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73      (member (tes
6440: 74 3a 67 65 74 2d 73 74 61 74 65 20 20 74 65 73  t:get-state  tes
6450: 74 64 61 74 29 20 27 28 22 43 4f 4d 50 4c 45 54  tdat) '("COMPLET
6460: 45 44 22 29 29 29 29 20 0a 09 20 20 20 20 20 28  ED")))) ..     (
6470: 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 49  debug:print 2 "I
6480: 4e 46 4f 3a 20 72 75 6e 6e 69 6e 67 20 74 65 73  NFO: running tes
6490: 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f  t " test-name "/
64a0: 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20 73 75  " item-path " su
64b0: 70 70 72 65 73 73 65 64 20 61 73 20 69 74 20 69  ppressed as it i
64c0: 73 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74  s " (test:get-st
64d0: 61 74 65 20 74 65 73 74 64 61 74 29 20 22 20 61  ate testdat) " a
64e0: 6e 64 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73  nd " (test:get-s
64f0: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 29 0a  tatus testdat)).
6500: 09 20 20 20 20 20 28 73 65 74 21 20 72 75 6e 66  .     (set! runf
6510: 6c 61 67 20 23 66 29 29 0a 09 20 20 20 20 3b 3b  lag #f))..    ;;
6520: 20 2d 72 65 72 75 6e 20 61 6e 64 20 73 74 61 74   -rerun and stat
6530: 75 73 20 69 73 20 6f 6e 65 20 6f 66 20 74 68 65  us is one of the
6540: 20 73 70 65 63 69 66 65 64 2c 20 72 75 6e 20 69   specifed, run i
6550: 74 0a 09 20 20 20 20 28 28 61 6e 64 20 72 65 72  t..    ((and rer
6560: 75 6e 0a 09 09 20 20 28 6c 65 74 2a 20 28 28 72  un...  (let* ((r
6570: 65 72 75 6e 6c 73 74 20 20 20 28 73 74 72 69 6e  erunlst   (strin
6580: 67 2d 73 70 6c 69 74 20 72 65 72 75 6e 20 22 2c  g-split rerun ",
6590: 22 29 29 0a 09 09 09 20 28 6d 75 73 74 2d 72 65  ")).... (must-re
65a0: 72 75 6e 20 28 6d 65 6d 62 65 72 20 28 74 65 73  run (member (tes
65b0: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73  t:get-status tes
65c0: 74 64 61 74 29 20 72 65 72 75 6e 6c 73 74 29 29  tdat) rerunlst))
65d0: 29 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70  )...    (debug:p
65e0: 72 69 6e 74 20 33 20 22 49 4e 46 4f 3a 20 2d 72  rint 3 "INFO: -r
65f0: 65 72 75 6e 20 6c 69 73 74 3a 20 22 20 72 65 72  erun list: " rer
6600: 75 6e 20 22 2c 20 74 65 73 74 2d 73 74 61 74 75  un ", test-statu
6610: 73 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73  s: " (test:get-s
6620: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 22 2c  tatus testdat)",
6630: 20 6d 75 73 74 2d 72 65 72 75 6e 3a 20 22 20 6d   must-rerun: " m
6640: 75 73 74 2d 72 65 72 75 6e 29 0a 09 09 20 20 20  ust-rerun)...   
6650: 20 6d 75 73 74 2d 72 65 72 75 6e 29 29 0a 09 20   must-rerun)).. 
6660: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
6670: 20 32 20 22 49 4e 46 4f 3a 20 52 65 72 75 6e 20   2 "INFO: Rerun 
6680: 66 6f 72 63 65 64 20 66 6f 72 20 74 65 73 74 20  forced for test 
6690: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20  " test-name "/" 
66a0: 69 74 65 6d 2d 70 61 74 68 29 0a 09 20 20 20 20  item-path)..    
66b0: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23   (set! runflag #
66c0: 74 29 29 0a 09 20 20 20 20 3b 3b 20 2d 6b 65 65  t))..    ;; -kee
66d0: 70 67 6f 69 6e 67 2c 20 64 6f 20 6e 6f 74 20 72  pgoing, do not r
66e0: 65 72 75 6e 20 46 41 49 4c 0a 09 20 20 20 20 28  erun FAIL..    (
66f0: 28 61 6e 64 20 6b 65 65 70 67 6f 69 6e 67 0a 09  (and keepgoing..
6700: 09 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74  .  (member (test
6710: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74  :get-status test
6720: 64 61 74 29 20 27 28 22 46 41 49 4c 22 29 29 29  dat) '("FAIL")))
6730: 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 75 6e  ..     (set! run
6740: 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20 20 28  flag #f))..    (
6750: 28 61 6e 64 20 28 6e 6f 74 20 72 65 72 75 6e 29  (and (not rerun)
6760: 0a 09 09 20 20 28 6d 65 6d 62 65 72 20 28 74 65  ...  (member (te
6770: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65  st:get-status te
6780: 73 74 64 61 74 29 20 27 28 22 46 41 49 4c 22 20  stdat) '("FAIL" 
6790: 22 6e 2f 61 22 29 29 29 0a 09 20 20 20 20 20 28  "n/a")))..     (
67a0: 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29  set! runflag #t)
67b0: 29 0a 09 20 20 20 20 28 65 6c 73 65 20 28 73 65  )..    (else (se
67c0: 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 29  t! runflag #f)))
67d0: 0a 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  ..   (debug:prin
67e0: 74 20 36 20 22 52 55 4e 4e 49 4e 47 20 3d 3e 20  t 6 "RUNNING => 
67f0: 72 75 6e 66 6c 61 67 3a 20 22 20 72 75 6e 66 6c  runflag: " runfl
6800: 61 67 20 22 20 53 54 41 54 45 3a 20 22 20 28 74  ag " STATE: " (t
6810: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65  est:get-state te
6820: 73 74 64 61 74 29 20 22 20 53 54 41 54 55 53 3a  stdat) " STATUS:
6830: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61   " (test:get-sta
6840: 74 75 73 20 74 65 73 74 64 61 74 29 29 0a 09 20  tus testdat)).. 
6850: 20 20 28 69 66 20 28 6e 6f 74 20 72 75 6e 66 6c    (if (not runfl
6860: 61 67 29 0a 09 20 20 20 20 20 20 20 28 69 66 20  ag)..       (if 
6870: 28 6e 6f 74 20 70 61 72 65 6e 74 2d 74 65 73 74  (not parent-test
6880: 29 0a 09 09 20 20 20 28 64 65 62 75 67 3a 70 72  )...   (debug:pr
6890: 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 4e 6f 74  int 1 "NOTE: Not
68a0: 20 73 74 61 72 74 69 6e 67 20 74 65 73 74 20 22   starting test "
68b0: 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22   new-test-name "
68c0: 20 61 73 20 69 74 20 69 73 20 73 74 61 74 65 20   as it is state 
68d0: 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74  \"" (test:get-st
68e0: 61 74 65 20 74 65 73 74 64 61 74 29 20 0a 09 09  ate testdat) ...
68f0: 09 09 22 5c 22 20 61 6e 64 20 73 74 61 74 75 73  .."\" and status
6900: 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73   \"" (test:get-s
6910: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20 22  tatus testdat) "
6920: 5c 22 2c 20 75 73 65 20 2d 72 65 72 75 6e 20 5c  \", use -rerun \
6930: 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61  "" (test:get-sta
6940: 74 75 73 20 74 65 73 74 64 61 74 29 0a 20 20 20  tus testdat).   
6950: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
6960: 20 20 20 20 20 20 20 20 20 20 20 20 20 22 5c 22               "\"
6970: 20 6f 72 20 2d 66 6f 72 63 65 20 74 6f 20 6f 76   or -force to ov
6980: 65 72 72 69 64 65 22 29 29 0a 09 20 20 20 20 20  erride"))..     
6990: 20 20 3b 3b 20 4e 4f 54 45 3a 20 4e 6f 20 6c 6f    ;; NOTE: No lo
69a0: 6e 67 65 72 20 62 65 20 63 68 65 63 6b 69 6e 67  nger be checking
69b0: 20 70 72 65 72 65 71 75 69 73 69 74 65 73 20 68   prerequisites h
69c0: 65 72 65 21 20 57 69 6c 6c 20 6e 65 76 65 72 20  ere! Will never 
69d0: 67 65 74 20 68 65 72 65 20 75 6e 6c 65 73 73 20  get here unless 
69e0: 70 72 65 72 65 71 73 20 61 72 65 0a 09 20 20 20  prereqs are..   
69f0: 20 20 20 20 3b 3b 20 20 20 20 20 20 20 61 6c 72      ;;       alr
6a00: 65 61 64 79 20 6d 65 74 2e 0a 09 20 20 20 20 20  eady met...     
6a10: 20 20 28 69 66 20 28 6e 6f 74 20 28 6c 61 75 6e    (if (not (laun
6a20: 63 68 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69  ch-test db run-i
6a30: 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d 63  d runname test-c
6a40: 6f 6e 66 20 6b 65 79 76 61 6c 6c 73 74 20 74 65  onf keyvallst te
6a50: 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 70 61 74  st-name test-pat
6a60: 68 20 69 74 65 6d 64 61 74 20 66 6c 61 67 73 29  h itemdat flags)
6a70: 29 0a 09 09 20 20 20 28 62 65 67 69 6e 0a 09 09  )...   (begin...
6a80: 20 20 20 20 20 28 70 72 69 6e 74 20 22 45 52 52       (print "ERR
6a90: 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c 61  OR: Failed to la
6aa0: 75 6e 63 68 20 74 68 65 20 74 65 73 74 2e 20 45  unch the test. E
6ab0: 78 69 74 69 6e 67 20 61 73 20 73 6f 6f 6e 20 61  xiting as soon a
6ac0: 73 20 70 6f 73 73 69 62 6c 65 22 29 0a 09 09 20  s possible")... 
6ad0: 20 20 20 20 28 73 65 74 21 20 2a 67 6c 6f 62 61      (set! *globa
6ae0: 6c 65 78 69 74 73 74 61 74 75 73 2a 20 31 29 20  lexitstatus* 1) 
6af0: 3b 3b 20 0a 09 09 20 20 20 20 20 28 70 72 6f 63  ;; ...     (proc
6b00: 65 73 73 2d 73 69 67 6e 61 6c 20 28 63 75 72 72  ess-signal (curr
6b10: 65 6e 74 2d 70 72 6f 63 65 73 73 2d 69 64 29 20  ent-process-id) 
6b20: 73 69 67 6e 61 6c 2f 6b 69 6c 6c 29 29 29 29 29  signal/kill)))))
6b30: 29 0a 09 28 28 4b 49 4c 4c 45 44 29 20 0a 09 20  )..((KILLED) .. 
6b40: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22  (debug:print 1 "
6b50: 4e 4f 54 45 3a 20 22 20 6e 65 77 2d 74 65 73 74  NOTE: " new-test
6b60: 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72 65 61  -name " is alrea
6b70: 64 79 20 72 75 6e 6e 69 6e 67 20 6f 72 20 77 61  dy running or wa
6b80: 73 20 65 78 70 6c 69 63 74 6c 79 20 6b 69 6c 6c  s explictly kill
6b90: 65 64 2c 20 75 73 65 20 2d 66 6f 72 63 65 20 74  ed, use -force t
6ba0: 6f 20 6c 61 75 6e 63 68 20 69 74 2e 22 29 29 0a  o launch it.")).
6bb0: 09 28 28 4c 41 55 4e 43 48 45 44 20 52 45 4d 4f  .((LAUNCHED REMO
6bc0: 54 45 48 4f 53 54 53 54 41 52 54 20 52 55 4e 4e  TEHOSTSTART RUNN
6bd0: 49 4e 47 29 20 20 0a 09 20 28 69 66 20 28 3e 20  ING)  .. (if (> 
6be0: 28 2d 20 28 63 75 72 72 65 6e 74 2d 73 65 63 6f  (- (current-seco
6bf0: 6e 64 73 29 28 2b 20 28 64 62 3a 74 65 73 74 2d  nds)(+ (db:test-
6c00: 67 65 74 2d 65 76 65 6e 74 5f 74 69 6d 65 20 74  get-event_time t
6c10: 65 73 74 64 61 74 29 0a 09 09 09 09 20 20 20 20  estdat).....    
6c20: 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d     (db:test-get-
6c30: 72 75 6e 5f 64 75 72 61 74 69 6f 6e 20 74 65 73  run_duration tes
6c40: 74 64 61 74 29 29 29 0a 09 09 36 30 30 29 20 3b  tdat)))...600) ;
6c50: 3b 20 69 2e 65 2e 20 6e 6f 20 75 70 64 61 74 65  ; i.e. no update
6c60: 20 66 6f 72 20 6d 6f 72 65 20 74 68 61 6e 20 36   for more than 6
6c70: 30 30 20 73 65 63 6f 6e 64 73 0a 09 20 20 20 20  00 seconds..    
6c80: 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 20   (begin..       
6c90: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
6ca0: 57 41 52 4e 49 4e 47 3a 20 54 65 73 74 20 22 20  WARNING: Test " 
6cb0: 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 70 70 65  test-name " appe
6cc0: 61 72 73 20 74 6f 20 62 65 20 64 65 61 64 2e 20  ars to be dead. 
6cd0: 46 6f 72 63 69 6e 67 20 69 74 20 74 6f 20 73 74  Forcing it to st
6ce0: 61 74 65 20 49 4e 43 4f 4d 50 4c 45 54 45 20 61  ate INCOMPLETE a
6cf0: 6e 64 20 73 74 61 74 75 73 20 53 54 55 43 4b 2f  nd status STUCK/
6d00: 44 45 41 44 22 29 0a 09 20 20 20 20 20 20 20 28  DEAD")..       (
6d10: 74 65 73 74 2d 73 65 74 2d 73 74 61 74 75 73 21  test-set-status!
6d20: 20 64 62 20 74 65 73 74 2d 69 64 20 22 49 4e 43   db test-id "INC
6d30: 4f 4d 50 4c 45 54 45 22 20 22 53 54 55 43 4b 2f  OMPLETE" "STUCK/
6d40: 44 45 41 44 22 20 22 54 65 73 74 20 69 73 20 73  DEAD" "Test is s
6d50: 74 75 63 6b 20 6f 72 20 64 65 61 64 22 20 23 66  tuck or dead" #f
6d60: 29 29 0a 09 20 20 20 20 20 28 64 65 62 75 67 3a  ))..     (debug:
6d70: 70 72 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 22  print 2 "NOTE: "
6d80: 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 73 20   test-name " is 
6d90: 61 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e 67 22  already running"
6da0: 29 29 29 0a 09 28 65 6c 73 65 20 20 20 20 20 20  )))..(else      
6db0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
6dc0: 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74  "ERROR: Failed t
6dd0: 6f 20 6c 61 75 6e 63 68 20 74 65 73 74 20 22 20  o launch test " 
6de0: 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 2e  new-test-name ".
6df0: 20 55 6e 72 65 63 6f 67 6e 69 73 65 64 20 73 74   Unrecognised st
6e00: 61 74 65 20 22 20 28 74 65 73 74 3a 67 65 74 2d  ate " (test:get-
6e10: 73 74 61 74 65 20 74 65 73 74 64 61 74 29 29 29  state testdat)))
6e20: 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d  ))))..;;========
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 0a 3b  ==============.;
6e70: 3b 20 45 4e 44 20 4f 46 20 4e 45 57 20 53 54 55  ; END OF NEW STU
6e80: 46 46 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  FF.;;===========
6e90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6ea0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6eb0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6ec0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65  ===========..(de
6ed0: 66 69 6e 65 20 28 67 65 74 2d 64 69 72 2d 75 70  fine (get-dir-up
6ee0: 2d 6e 20 64 69 72 20 2e 20 70 61 72 61 6d 73 29  -n dir . params)
6ef0: 20 0a 20 20 28 6c 65 74 20 28 28 64 70 61 72 74   .  (let ((dpart
6f00: 73 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74  s  (string-split
6f10: 20 64 69 72 20 22 2f 22 29 29 0a 09 28 63 6f 75   dir "/"))..(cou
6f20: 6e 74 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20  nt   (if (null? 
6f30: 70 61 72 61 6d 73 29 20 31 20 28 63 61 72 20 70  params) 1 (car p
6f40: 61 72 61 6d 73 29 29 29 29 0a 20 20 20 20 28 63  arams)))).    (c
6f50: 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 6e 67 2d  onc "/" (string-
6f60: 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09 20 20  intersperse ..  
6f70: 20 20 20 20 20 28 74 61 6b 65 20 64 70 61 72 74       (take dpart
6f80: 73 20 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 61  s (- (length dpa
6f90: 72 74 73 29 20 63 6f 75 6e 74 29 29 0a 09 20 20  rts) count))..  
6fa0: 20 20 20 20 20 22 2f 22 29 29 29 29 0a 3b 3b 20       "/")))).;; 
6fb0: 52 65 6d 6f 76 65 20 72 75 6e 73 0a 3b 3b 20 66  Remove runs.;; f
6fc0: 69 65 6c 64 73 20 61 72 65 20 70 61 73 73 69 6e  ields are passin
6fd0: 67 20 69 6e 20 74 68 72 6f 75 67 68 20 0a 3b 3b  g in through .;;
6fe0: 20 61 63 74 69 6f 6e 3a 0a 3b 3b 20 20 20 20 27   action:.;;    '
6ff0: 72 65 6d 6f 76 65 2d 72 75 6e 73 0a 3b 3b 20 20  remove-runs.;;  
7000: 20 20 27 73 65 74 2d 73 74 61 74 65 2d 73 74 61    'set-state-sta
7010: 74 75 73 0a 3b 3b 0a 3b 3b 20 4e 42 2f 2f 20 73  tus.;;.;; NB// s
7020: 68 6f 75 6c 64 20 70 61 73 73 20 69 6e 20 6b 65  hould pass in ke
7030: 79 73 3f 0a 3b 3b 0a 28 64 65 66 69 6e 65 20 28  ys?.;;.(define (
7040: 72 75 6e 73 3a 6f 70 65 72 61 74 65 2d 6f 6e 20  runs:operate-on 
7050: 64 62 20 61 63 74 69 6f 6e 20 72 75 6e 6e 61 6d  db action runnam
7060: 65 70 61 74 74 20 74 65 73 74 70 61 74 74 20 69  epatt testpatt i
7070: 74 65 6d 70 61 74 74 20 23 21 6b 65 79 20 28 73  tempatt #!key (s
7080: 74 61 74 65 20 23 66 29 28 73 74 61 74 75 73 20  tate #f)(status 
7090: 23 66 29 28 6e 65 77 2d 73 74 61 74 65 2d 73 74  #f)(new-state-st
70a0: 61 74 75 73 20 23 66 29 29 0a 20 20 28 6c 65 74  atus #f)).  (let
70b0: 2a 20 28 28 6b 65 79 73 20 20 20 20 20 20 20 20  * ((keys        
70c0: 20 28 72 64 62 3a 67 65 74 2d 6b 65 79 73 20 64   (rdb:get-keys d
70d0: 62 29 29 0a 09 20 28 72 75 6e 64 61 74 20 20 20  b)).. (rundat   
70e0: 20 20 20 20 28 72 75 6e 73 3a 67 65 74 2d 72 75      (runs:get-ru
70f0: 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20 6b 65  ns-by-patt db ke
7100: 79 73 20 72 75 6e 6e 61 6d 65 70 61 74 74 29 29  ys runnamepatt))
7110: 0a 09 20 28 68 65 61 64 65 72 20 20 20 20 20 20  .. (header      
7120: 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e   (vector-ref run
7130: 64 61 74 20 30 29 29 0a 09 20 28 72 75 6e 73 20  dat 0)).. (runs 
7140: 20 20 20 20 20 20 20 20 28 76 65 63 74 6f 72 2d          (vector-
7150: 72 65 66 20 72 75 6e 64 61 74 20 31 29 29 0a 09  ref rundat 1))..
7160: 20 28 73 74 61 74 65 73 20 20 20 20 20 20 20 28   (states       (
7170: 69 66 20 73 74 61 74 65 20 20 28 73 74 72 69 6e  if state  (strin
7180: 67 2d 73 70 6c 69 74 20 73 74 61 74 65 20 20 22  g-split state  "
7190: 2c 22 29 20 27 28 29 29 29 0a 09 20 28 73 74 61  ,") '())).. (sta
71a0: 74 75 73 65 73 20 20 20 20 20 28 69 66 20 73 74  tuses     (if st
71b0: 61 74 75 73 20 28 73 74 72 69 6e 67 2d 73 70 6c  atus (string-spl
71c0: 69 74 20 73 74 61 74 75 73 20 22 2c 22 29 20 27  it status ",") '
71d0: 28 29 29 29 0a 09 20 28 73 74 61 74 65 2d 73 74  ())).. (state-st
71e0: 61 74 75 73 20 28 69 66 20 28 73 74 72 69 6e 67  atus (if (string
71f0: 3f 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74  ? new-state-stat
7200: 75 73 29 20 28 73 74 72 69 6e 67 2d 73 70 6c 69  us) (string-spli
7210: 74 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74  t new-state-stat
7220: 75 73 20 22 2c 22 29 20 27 28 23 66 20 23 66 29  us ",") '(#f #f)
7230: 29 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70  ))).    (debug:p
7240: 72 69 6e 74 20 32 20 22 48 65 61 64 65 72 3a 20  rint 2 "Header: 
7250: 22 20 68 65 61 64 65 72 20 22 20 61 63 74 69 6f  " header " actio
7260: 6e 3a 20 22 20 61 63 74 69 6f 6e 20 22 20 6e 65  n: " action " ne
7270: 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73 3a 20  w-state-status: 
7280: 22 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74  " new-state-stat
7290: 75 73 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63  us).    (for-eac
72a0: 68 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28  h.     (lambda (
72b0: 72 75 6e 29 0a 20 20 20 20 20 20 20 28 6c 65 74  run).       (let
72c0: 20 28 28 72 75 6e 6b 65 79 20 28 73 74 72 69 6e   ((runkey (strin
72d0: 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d  g-intersperse (m
72e0: 61 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 0a 09  ap (lambda (k)..
72f0: 09 09 09 09 09 28 64 62 3a 67 65 74 2d 76 61 6c  .....(db:get-val
7300: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e  ue-by-header run
7310: 20 68 65 61 64 65 72 20 28 76 65 63 74 6f 72 2d   header (vector-
7320: 72 65 66 20 6b 20 30 29 29 29 20 6b 65 79 73 29  ref k 0))) keys)
7330: 20 22 2f 22 29 29 0a 09 20 20 20 20 20 28 64 69   "/"))..     (di
7340: 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 28 6d 61  rs-to-remove (ma
7350: 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29  ke-hash-table)))
7360: 0a 09 20 28 6c 65 74 2a 20 28 28 72 75 6e 2d 69  .. (let* ((run-i
7370: 64 20 20 20 20 28 64 62 3a 67 65 74 2d 76 61 6c  d    (db:get-val
7380: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e  ue-by-header run
7390: 20 68 65 61 64 65 72 20 22 69 64 22 29 29 0a 09   header "id"))..
73a0: 09 28 72 75 6e 2d 73 74 61 74 65 20 28 64 62 3a  .(run-state (db:
73b0: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61  get-value-by-hea
73c0: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22  der run header "
73d0: 73 74 61 74 65 22 29 29 0a 09 09 28 74 65 73 74  state"))...(test
73e0: 73 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28  s     (if (not (
73f0: 65 71 75 61 6c 3f 20 72 75 6e 2d 73 74 61 74 65  equal? run-state
7400: 20 22 6c 6f 63 6b 65 64 22 29 29 0a 09 09 09 20   "locked")).... 
7410: 20 20 20 20 20 20 28 72 64 62 3a 67 65 74 2d 74        (rdb:get-t
7420: 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20  ests-for-run db 
7430: 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79  (db:get-value-by
7440: 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64  -header run head
7450: 65 72 20 22 69 64 22 29 0a 09 09 09 09 09 09 20  er "id")....... 
7460: 20 20 20 20 20 74 65 73 74 70 61 74 74 20 69 74       testpatt it
7470: 65 6d 70 61 74 74 20 73 74 61 74 65 73 20 73 74  empatt states st
7480: 61 74 75 73 65 73 0a 09 09 09 09 09 09 20 20 20  atuses.......   
7490: 20 20 20 6e 6f 74 2d 69 6e 3a 20 20 23 66 0a 09     not-in:  #f..
74a0: 09 09 09 09 09 20 20 20 20 20 20 73 6f 72 74 2d  .....      sort-
74b0: 62 79 3a 20 28 63 61 73 65 20 61 63 74 69 6f 6e  by: (case action
74c0: 0a 09 09 09 09 09 09 09 09 20 28 28 72 65 6d 6f  ......... ((remo
74d0: 76 65 2d 72 75 6e 73 29 20 27 72 75 6e 64 69 72  ve-runs) 'rundir
74e0: 29 0a 09 09 09 09 09 09 09 09 20 28 65 6c 73 65  )......... (else
74f0: 20 20 20 20 20 20 20 20 20 20 27 65 76 65 6e 74            'event
7500: 5f 74 69 6d 65 29 29 29 0a 09 09 09 20 20 20 20  _time)))....    
7510: 20 20 20 27 28 29 29 29 0a 09 09 28 6c 61 73 74     '()))...(last
7520: 74 70 61 74 68 20 22 2f 64 6f 65 73 2f 6e 6f 74  tpath "/does/not
7530: 2f 65 78 69 73 74 2f 49 2f 68 6f 70 65 22 29 29  /exist/I/hope"))
7540: 0a 0a 09 20 20 20 28 69 66 20 28 6e 6f 74 20 28  ...   (if (not (
7550: 6e 75 6c 6c 3f 20 74 65 73 74 73 29 29 0a 09 20  null? tests)).. 
7560: 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20        (begin... 
7570: 28 63 61 73 65 20 61 63 74 69 6f 6e 0a 09 09 20  (case action... 
7580: 20 20 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29    ((remove-runs)
7590: 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72  ...    (debug:pr
75a0: 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20  int 1 "Removing 
75b0: 74 65 73 74 73 20 66 6f 72 20 72 75 6e 3a 20 22  tests for run: "
75c0: 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a   runkey " " (db:
75d0: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61  get-value-by-hea
75e0: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22  der run header "
75f0: 72 75 6e 6e 61 6d 65 22 29 29 29 0a 09 09 20 20  runname")))...  
7600: 20 28 28 73 65 74 2d 73 74 61 74 65 2d 73 74 61   ((set-state-sta
7610: 74 75 73 29 0a 09 09 20 20 20 20 28 64 65 62 75  tus)...    (debu
7620: 67 3a 70 72 69 6e 74 20 31 20 22 4d 6f 64 69 66  g:print 1 "Modif
7630: 79 69 6e 67 20 73 74 61 74 65 20 61 6e 64 20 73  ying state and s
7640: 74 61 75 73 20 66 6f 72 20 74 65 73 74 73 20 66  taus for tests f
7650: 6f 72 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79  or run: " runkey
7660: 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c   " " (db:get-val
7670: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e  ue-by-header run
7680: 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65   header "runname
7690: 22 29 29 29 0a 09 09 20 20 20 28 65 6c 73 65 0a  ")))...   (else.
76a0: 09 09 20 20 20 20 28 70 72 69 6e 74 20 22 49 4e  ..    (print "IN
76b0: 46 4f 3a 20 61 63 74 69 6f 6e 20 6e 6f 74 20 72  FO: action not r
76c0: 65 63 6f 67 6e 69 73 65 64 20 22 20 61 63 74 69  ecognised " acti
76d0: 6f 6e 29 29 29 0a 09 09 20 28 66 6f 72 2d 65 61  on)))... (for-ea
76e0: 63 68 0a 09 09 20 20 28 6c 61 6d 62 64 61 20 28  ch...  (lambda (
76f0: 74 65 73 74 29 0a 09 09 20 20 20 20 28 6c 65 74  test)...    (let
7700: 2a 20 28 28 69 74 65 6d 2d 70 61 74 68 20 28 64  * ((item-path (d
7710: 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d  b:test-get-item-
7720: 70 61 74 68 20 74 65 73 74 29 29 0a 09 09 09 20  path test)).... 
7730: 20 20 28 74 65 73 74 2d 6e 61 6d 65 20 28 64 62    (test-name (db
7740: 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61  :test-get-testna
7750: 6d 65 20 74 65 73 74 29 29 0a 09 09 09 20 20 20  me test))....   
7760: 28 72 75 6e 2d 64 69 72 20 20 20 28 64 62 3a 74  (run-dir   (db:t
7770: 65 73 74 2d 67 65 74 2d 72 75 6e 64 69 72 20 74  est-get-rundir t
7780: 65 73 74 29 29 29 0a 09 09 20 20 20 20 20 20 28  est)))...      (
7790: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 20  debug:print 1 " 
77a0: 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d   " (db:test-get-
77b0: 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29 20 22  testname test) "
77c0: 20 69 64 3a 20 22 20 28 64 62 3a 74 65 73 74 2d   id: " (db:test-
77d0: 67 65 74 2d 69 64 20 74 65 73 74 29 20 22 20 22  get-id test) " "
77e0: 20 69 74 65 6d 2d 70 61 74 68 20 22 20 61 63 74   item-path " act
77f0: 69 6f 6e 3a 20 22 20 61 63 74 69 6f 6e 29 0a 09  ion: " action)..
7800: 09 20 20 20 20 20 20 28 63 61 73 65 20 61 63 74  .      (case act
7810: 69 6f 6e 0a 09 09 09 28 28 72 65 6d 6f 76 65 2d  ion....((remove-
7820: 72 75 6e 73 29 0a 09 09 09 20 28 72 64 62 3a 64  runs).... (rdb:d
7830: 65 6c 65 74 65 2d 74 65 73 74 2d 72 65 63 6f 72  elete-test-recor
7840: 64 73 20 64 62 20 28 64 62 3a 74 65 73 74 2d 67  ds db (db:test-g
7850: 65 74 2d 69 64 20 74 65 73 74 29 29 0a 09 09 09  et-id test))....
7860: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20   (debug:print 1 
7870: 22 49 4e 46 4f 3a 20 41 74 74 65 6d 70 74 69 6e  "INFO: Attemptin
7880: 67 20 74 6f 20 72 65 6d 6f 76 65 20 64 69 72 20  g to remove dir 
7890: 22 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 20 28  " run-dir).... (
78a0: 69 66 20 28 61 6e 64 20 28 3e 20 28 73 74 72 69  if (and (> (stri
78b0: 6e 67 2d 6c 65 6e 67 74 68 20 72 75 6e 2d 64 69  ng-length run-di
78c0: 72 29 20 35 29 0a 09 09 09 09 20 20 28 66 69 6c  r) 5).....  (fil
78d0: 65 2d 65 78 69 73 74 73 3f 20 72 75 6e 2d 64 69  e-exists? run-di
78e0: 72 29 29 20 3b 3b 20 62 61 64 20 68 65 75 72 69  r)) ;; bad heuri
78f0: 73 74 69 63 20 62 75 74 20 73 68 6f 75 6c 64 20  stic but should 
7900: 70 72 65 76 65 6e 74 20 2f 74 6d 70 20 2f 68 6f  prevent /tmp /ho
7910: 6d 65 20 65 74 63 2e 0a 09 09 09 20 20 20 20 20  me etc.....     
7920: 28 6c 65 74 2a 20 28 28 72 65 61 6c 70 61 74 68  (let* ((realpath
7930: 20 28 72 65 73 6f 6c 76 65 2d 70 61 74 68 6e 61   (resolve-pathna
7940: 6d 65 20 72 75 6e 2d 64 69 72 29 29 29 0a 09 09  me run-dir)))...
7950: 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70  .       (debug:p
7960: 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 52 65  rint 1 "INFO: Re
7970: 61 6c 20 70 61 74 68 20 6f 66 20 69 73 20 22 20  al path of is " 
7980: 72 65 61 6c 70 61 74 68 29 0a 09 09 09 20 20 20  realpath)....   
7990: 20 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78      (if (file-ex
79a0: 69 73 74 73 3f 20 72 65 61 6c 70 61 74 68 29 0a  ists? realpath).
79b0: 09 09 09 09 20 20 20 28 69 66 20 28 3e 20 28 73  ....   (if (> (s
79c0: 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 20  ystem (conc "rm 
79d0: 2d 72 66 20 22 20 72 65 61 6c 70 61 74 68 29 29  -rf " realpath))
79e0: 20 30 29 0a 09 09 09 09 20 20 20 20 20 20 20 28   0).....       (
79f0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45  debug:print 0 "E
7a00: 52 52 4f 52 3a 20 54 68 65 72 65 20 77 61 73 20  RROR: There was 
7a10: 61 20 70 72 6f 62 6c 65 6d 20 72 65 6d 6f 76 69  a problem removi
7a20: 6e 67 20 22 20 72 65 61 6c 70 61 74 68 20 22 20  ng " realpath " 
7a30: 77 69 74 68 20 72 6d 20 2d 66 22 29 29 0a 09 09  with rm -f"))...
7a40: 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  ..   (debug:prin
7a50: 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 74 65  t 0 "WARNING: te
7a60: 73 74 20 72 75 6e 20 64 69 72 20 22 20 72 65 61  st run dir " rea
7a70: 6c 70 61 74 68 20 22 20 61 70 70 65 61 72 73 20  lpath " appears 
7a80: 74 6f 20 6e 6f 74 20 65 78 69 73 74 22 29 29 0a  to not exist")).
7a90: 09 09 09 20 20 20 20 20 20 20 28 69 66 20 28 66  ...       (if (f
7aa0: 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 75 6e 2d  ile-exists? run-
7ab0: 64 69 72 29 20 3b 3b 20 74 68 65 20 6c 69 6e 6b  dir) ;; the link
7ac0: 0a 09 09 09 09 20 20 20 28 69 66 20 28 73 79 6d  .....   (if (sym
7ad0: 62 6f 6c 69 63 2d 6c 69 6e 6b 3f 20 72 75 6e 2d  bolic-link? run-
7ae0: 64 69 72 29 0a 09 09 09 09 20 20 20 20 20 20 20  dir).....       
7af0: 28 64 65 6c 65 74 65 2d 66 69 6c 65 20 72 75 6e  (delete-file run
7b00: 2d 64 69 72 29 0a 09 09 09 09 20 20 20 20 20 20  -dir).....      
7b10: 20 28 69 66 20 28 64 69 72 65 63 74 6f 72 79 3f   (if (directory?
7b20: 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 09 09 20   run-dir)...... 
7b30: 20 20 28 69 66 20 28 3e 20 28 64 69 72 65 63 74    (if (> (direct
7b40: 6f 72 79 2d 66 6f 6c 64 20 28 6c 61 6d 62 64 61  ory-fold (lambda
7b50: 20 28 66 20 78 29 28 2b 20 31 20 78 29 29 20 30   (f x)(+ 1 x)) 0
7b60: 20 72 75 6e 2d 64 69 72 29 20 30 29 0a 09 09 09   run-dir) 0)....
7b70: 09 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a  ..       (debug:
7b80: 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47  print 0 "WARNING
7b90: 3a 20 72 65 66 75 73 69 6e 67 20 74 6f 20 72 65  : refusing to re
7ba0: 6d 6f 76 65 20 22 20 72 75 6e 2d 64 69 72 20 22  move " run-dir "
7bb0: 20 61 73 20 69 74 20 69 73 20 6e 6f 74 20 65 6d   as it is not em
7bc0: 70 74 79 22 29 0a 09 09 09 09 09 20 20 20 20 20  pty")......     
7bd0: 20 20 28 64 65 6c 65 74 65 2d 64 69 72 65 63 74    (delete-direct
7be0: 6f 72 79 20 72 75 6e 2d 64 69 72 29 29 20 3b 3b  ory run-dir)) ;;
7bf0: 20 69 74 20 73 68 6f 75 6c 64 20 62 65 20 65 6d   it should be em
7c00: 70 74 79 20 62 79 20 68 65 72 65 20 42 55 47 20  pty by here BUG 
7c10: 42 55 47 2c 20 61 64 64 20 65 72 72 6f 72 20 63  BUG, add error c
7c20: 61 74 63 68 0a 09 09 09 09 09 20 20 20 28 64 65  atch......   (de
7c30: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52  bug:print 0 "ERR
7c40: 4f 52 3a 20 72 65 66 75 73 69 6e 67 20 74 6f 20  OR: refusing to 
7c50: 72 65 6d 6f 76 65 20 22 20 72 75 6e 2d 64 69 72  remove " run-dir
7c60: 20 22 20 61 73 20 69 74 20 69 73 20 6e 65 69 74   " as it is neit
7c70: 68 65 72 20 61 20 73 79 6d 6c 69 6e 6b 20 6e 6f  her a symlink no
7c80: 72 20 61 20 64 69 72 65 63 74 6f 72 79 22 29 0a  r a directory").
7c90: 09 09 09 09 09 20 20 20 29 29 29 29 0a 09 09 09  .....   ))))....
7ca0: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
7cb0: 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 64 69  t 0 "WARNING: di
7cc0: 72 65 63 74 6f 72 79 20 61 6c 72 65 61 64 79 20  rectory already 
7cd0: 72 65 6d 6f 76 65 64 20 22 20 72 75 6e 2d 64 69  removed " run-di
7ce0: 72 29 29 29 0a 09 09 09 28 28 73 65 74 2d 73 74  r)))....((set-st
7cf0: 61 74 65 2d 73 74 61 74 75 73 29 0a 09 09 09 20  ate-status).... 
7d00: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22  (debug:print 2 "
7d10: 49 4e 46 4f 3a 20 6e 65 77 20 73 74 61 74 65 20  INFO: new state 
7d20: 22 20 28 63 61 72 20 73 74 61 74 65 2d 73 74 61  " (car state-sta
7d30: 74 75 73 29 20 22 2c 20 6e 65 77 20 73 74 61 74  tus) ", new stat
7d40: 75 73 20 22 20 28 63 61 64 72 20 73 74 61 74 65  us " (cadr state
7d50: 2d 73 74 61 74 75 73 29 29 0a 09 09 09 20 28 64  -status)).... (d
7d60: 62 3a 74 65 73 74 2d 73 65 74 2d 73 74 61 74 65  b:test-set-state
7d70: 2d 73 74 61 74 75 73 2d 62 79 2d 69 64 20 64 62  -status-by-id db
7d80: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64   (db:test-get-id
7d90: 20 74 65 73 74 29 20 28 63 61 72 20 73 74 61 74   test) (car stat
7da0: 65 2d 73 74 61 74 75 73 29 28 63 61 64 72 20 73  e-status)(cadr s
7db0: 74 61 74 65 2d 73 74 61 74 75 73 29 20 23 66 29  tate-status) #f)
7dc0: 29 29 29 29 0a 09 09 20 20 74 65 73 74 73 29 29  ))))...  tests))
7dd0: 29 0a 09 20 20 20 0a 09 20 20 20 3b 3b 20 72 65  )..   ..   ;; re
7de0: 6d 6f 76 65 20 74 68 65 20 72 75 6e 20 69 66 20  move the run if 
7df0: 7a 65 72 6f 20 74 65 73 74 73 20 72 65 6d 61 69  zero tests remai
7e00: 6e 0a 09 20 20 20 28 69 66 20 28 65 71 3f 20 61  n..   (if (eq? a
7e10: 63 74 69 6f 6e 20 27 72 65 6d 6f 76 65 2d 72 75  ction 'remove-ru
7e20: 6e 73 29 0a 09 20 20 20 20 20 20 20 28 6c 65 74  ns)..       (let
7e30: 20 28 28 72 65 6d 74 65 73 74 73 20 28 72 64 62   ((remtests (rdb
7e40: 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72  :get-tests-for-r
7e50: 75 6e 20 64 62 20 28 64 62 3a 67 65 74 2d 76 61  un db (db:get-va
7e60: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75  lue-by-header ru
7e70: 6e 20 68 65 61 64 65 72 20 22 69 64 22 29 20 23  n header "id") #
7e80: 66 20 23 66 20 27 28 29 20 27 28 29 29 29 29 0a  f #f '() '()))).
7e90: 09 09 20 28 69 66 20 28 6e 75 6c 6c 3f 20 72 65  .. (if (null? re
7ea0: 6d 74 65 73 74 73 29 20 3b 3b 20 6e 6f 20 6d 6f  mtests) ;; no mo
7eb0: 72 65 20 74 65 73 74 73 20 72 65 6d 61 69 6e 69  re tests remaini
7ec0: 6e 67 0a 09 09 20 20 20 20 20 28 6c 65 74 2a 20  ng...     (let* 
7ed0: 28 28 64 70 61 72 74 73 20 20 28 73 74 72 69 6e  ((dparts  (strin
7ee0: 67 2d 73 70 6c 69 74 20 6c 61 73 74 74 70 61 74  g-split lasttpat
7ef0: 68 20 22 2f 22 29 29 0a 09 09 09 20 20 20 20 28  h "/"))....    (
7f00: 72 75 6e 70 61 74 68 20 28 63 6f 6e 63 20 22 2f  runpath (conc "/
7f10: 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73  " (string-inters
7f20: 70 65 72 73 65 20 0a 09 09 09 09 09 09 28 74 61  perse .......(ta
7f30: 6b 65 20 64 70 61 72 74 73 20 28 2d 20 28 6c 65  ke dparts (- (le
7f40: 6e 67 74 68 20 64 70 61 72 74 73 29 20 31 29 29  ngth dparts) 1))
7f50: 0a 09 09 09 09 09 09 22 2f 22 29 29 29 29 0a 09  ......."/"))))..
7f60: 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70  .       (debug:p
7f70: 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67  rint 1 "Removing
7f80: 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22   run: " runkey "
7f90: 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65   " (db:get-value
7fa0: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68  -by-header run h
7fb0: 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29  eader "runname")
7fc0: 29 0a 09 09 20 20 20 20 20 20 20 28 64 62 3a 64  )...       (db:d
7fd0: 65 6c 65 74 65 2d 72 75 6e 20 64 62 20 72 75 6e  elete-run db run
7fe0: 2d 69 64 29 0a 09 09 20 20 20 20 20 20 20 3b 3b  -id)...       ;;
7ff0: 20 6e 65 65 64 20 74 6f 20 66 69 67 75 72 65 20   need to figure 
8000: 6f 75 74 20 74 68 65 20 70 61 74 68 20 74 6f 20  out the path to 
8010: 74 68 65 20 72 75 6e 20 64 69 72 20 61 6e 64 20  the run dir and 
8020: 72 65 6d 6f 76 65 20 69 74 20 69 66 20 65 6d 70  remove it if emp
8030: 74 79 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 20  ty...       ;;  
8040: 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 28 67 6c    (if (null? (gl
8050: 6f 62 20 28 63 6f 6e 63 20 72 75 6e 70 61 74 68  ob (conc runpath
8060: 20 22 2f 2a 22 29 29 29 0a 09 09 20 20 20 20 20   "/*")))...     
8070: 20 20 3b 3b 20 20 20 20 20 20 20 20 28 62 65 67    ;;        (beg
8080: 69 6e 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 09  in...       ;; .
8090: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20   (debug:print 1 
80a0: 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 20 64 69  "Removing run di
80b0: 72 20 22 20 72 75 6e 70 61 74 68 29 0a 09 09 20  r " runpath)... 
80c0: 20 20 20 20 20 20 3b 3b 20 09 20 28 73 79 73 74        ;; . (syst
80d0: 65 6d 20 28 63 6f 6e 63 20 22 72 6d 64 69 72 20  em (conc "rmdir 
80e0: 2d 70 20 22 20 72 75 6e 70 61 74 68 29 29 29 29  -p " runpath))))
80f0: 0a 09 09 20 20 20 20 20 20 20 29 29 29 29 29 0a  ...       ))))).
8100: 09 20 29 29 0a 20 20 20 20 20 72 75 6e 73 29 29  . )).     runs))
8110: 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  )..;;===========
8120: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
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 0a 3b 3b 20 52  ===========.;; R
8160: 6f 75 74 69 6e 65 73 20 66 6f 72 20 6d 61 6e 69  outines for mani
8170: 70 75 6c 61 74 69 6e 67 20 72 75 6e 73 0a 3b 3b  pulating runs.;;
8180: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8190: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
81a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
81b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
81c0: 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 53 69 6e 63 65  ======..;; Since
81d0: 20 6d 61 6e 79 20 63 61 6c 6c 73 20 74 6f 20 61   many calls to a
81e0: 20 72 75 6e 20 72 65 71 75 69 72 65 20 70 72 65   run require pre
81f0: 74 74 79 20 6d 75 63 68 20 74 68 65 20 73 61 6d  tty much the sam
8200: 65 20 73 65 74 75 70 20 0a 3b 3b 20 74 68 69 73  e setup .;; this
8210: 20 77 72 61 70 70 65 72 20 69 73 20 75 73 65 64   wrapper is used
8220: 20 74 6f 20 72 65 64 75 63 65 20 74 68 65 20 72   to reduce the r
8230: 65 70 6c 69 63 61 74 69 6f 6e 20 6f 66 20 63 6f  eplication of co
8240: 64 65 0a 28 64 65 66 69 6e 65 20 28 67 65 6e 65  de.(define (gene
8250: 72 61 6c 2d 72 75 6e 2d 63 61 6c 6c 20 73 77 69  ral-run-call swi
8260: 74 63 68 6e 61 6d 65 20 61 63 74 69 6f 6e 2d 64  tchname action-d
8270: 65 73 63 20 70 72 6f 63 29 0a 20 20 28 6c 65 74  esc proc).  (let
8280: 20 28 28 72 75 6e 6e 61 6d 65 20 28 61 72 67 73   ((runname (args
8290: 3a 67 65 74 2d 61 72 67 20 22 3a 72 75 6e 6e 61  :get-arg ":runna
82a0: 6d 65 22 29 29 0a 09 28 74 61 72 67 65 74 20 20  me"))..(target  
82b0: 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72  (if (args:get-ar
82c0: 67 20 22 2d 74 61 72 67 65 74 22 29 0a 09 09 20  g "-target")... 
82d0: 20 20 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72      (args:get-ar
82e0: 67 20 22 2d 74 61 72 67 65 74 22 29 0a 09 09 20  g "-target")... 
82f0: 20 20 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72      (args:get-ar
8300: 67 20 22 2d 72 65 71 74 61 72 67 22 29 29 29 0a  g "-reqtarg"))).
8310: 09 28 74 68 31 20 20 20 20 20 23 66 29 29 0a 20  .(th1     #f)). 
8320: 20 20 20 28 63 6f 6e 64 0a 20 20 20 20 20 28 28     (cond.     ((
8330: 6e 6f 74 20 74 61 72 67 65 74 29 0a 20 20 20 20  not target).    
8340: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
8350: 20 22 45 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67   "ERROR: Missing
8360: 20 72 65 71 75 69 72 65 64 20 70 61 72 61 6d 65   required parame
8370: 74 65 72 20 66 6f 72 20 22 20 73 77 69 74 63 68  ter for " switch
8380: 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d 75 73 74  name ", you must
8390: 20 73 70 65 63 69 66 79 20 74 68 65 20 74 61 72   specify the tar
83a0: 67 65 74 20 77 69 74 68 20 2d 74 61 72 67 65 74  get with -target
83b0: 22 29 0a 20 20 20 20 20 20 28 65 78 69 74 20 33  ").      (exit 3
83c0: 29 29 0a 20 20 20 20 20 28 28 6e 6f 74 20 72 75  )).     ((not ru
83d0: 6e 6e 61 6d 65 29 0a 20 20 20 20 20 20 28 64 65  nname).      (de
83e0: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52  bug:print 0 "ERR
83f0: 4f 52 3a 20 4d 69 73 73 69 6e 67 20 72 65 71 75  OR: Missing requ
8400: 69 72 65 64 20 70 61 72 61 6d 65 74 65 72 20 66  ired parameter f
8410: 6f 72 20 22 20 73 77 69 74 63 68 6e 61 6d 65 20  or " switchname 
8420: 22 2c 20 79 6f 75 20 6d 75 73 74 20 73 70 65 63  ", you must spec
8430: 69 66 79 20 74 68 65 20 72 75 6e 20 6e 61 6d 65  ify the run name
8440: 20 77 69 74 68 20 3a 72 75 6e 6e 61 6d 65 20 72   with :runname r
8450: 75 6e 6e 61 6d 65 22 29 0a 20 20 20 20 20 20 28  unname").      (
8460: 65 78 69 74 20 33 29 29 0a 20 20 20 20 20 28 65  exit 3)).     (e
8470: 6c 73 65 0a 20 20 20 20 20 20 28 6c 65 74 20 28  lse.      (let (
8480: 28 64 62 20 20 20 23 66 29 0a 09 20 20 20 20 28  (db   #f)..    (
8490: 6b 65 79 73 20 23 66 29 29 0a 09 28 69 66 20 28  keys #f))..(if (
84a0: 6e 6f 74 20 28 73 65 74 75 70 2d 66 6f 72 2d 72  not (setup-for-r
84b0: 75 6e 29 29 0a 09 20 20 20 20 28 62 65 67 69 6e  un))..    (begin
84c0: 20 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 3a   ..      (debug:
84d0: 70 72 69 6e 74 20 30 20 22 46 61 69 6c 65 64 20  print 0 "Failed 
84e0: 74 6f 20 73 65 74 75 70 2c 20 65 78 69 74 69 6e  to setup, exitin
84f0: 67 22 29 0a 09 20 20 20 20 20 20 28 65 78 69 74  g")..      (exit
8500: 20 31 29 29 29 0a 09 28 73 65 74 21 20 64 62 20   1)))..(set! db 
8510: 20 20 28 6f 70 65 6e 2d 64 62 29 29 0a 09 28 69    (open-db))..(i
8520: 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20  f (args:get-arg 
8530: 22 2d 73 65 72 76 65 72 22 29 0a 09 20 20 20 20  "-server")..    
8540: 28 73 65 72 76 65 72 3a 73 74 61 72 74 20 64 62  (server:start db
8550: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
8560: 2d 73 65 72 76 65 72 22 29 29 0a 09 20 20 20 20  -server"))..    
8570: 28 69 66 20 28 6e 6f 74 20 28 6f 72 20 28 61 72  (if (not (or (ar
8580: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 75 6e  gs:get-arg "-run
8590: 61 6c 6c 22 29 0a 09 09 09 20 20 28 61 72 67 73  all")....  (args
85a0: 3a 67 65 74 2d 61 72 67 20 22 2d 72 75 6e 74 65  :get-arg "-runte
85b0: 73 74 73 22 29 29 29 0a 09 09 28 73 65 72 76 65  sts")))...(serve
85c0: 72 3a 63 6c 69 65 6e 74 2d 73 65 74 75 70 20 64  r:client-setup d
85d0: 62 29 29 29 0a 09 28 73 65 74 21 20 6b 65 79 73  b)))..(set! keys
85e0: 20 28 72 64 62 3a 67 65 74 2d 6b 65 79 73 20 64   (rdb:get-keys d
85f0: 62 29 29 0a 09 3b 3b 20 68 61 76 65 20 65 6e 6f  b))..;; have eno
8600: 75 67 68 20 74 6f 20 70 72 6f 63 65 73 73 20 2d  ugh to process -
8610: 74 61 72 67 65 74 20 6f 72 20 2d 72 65 71 74 61  target or -reqta
8620: 72 67 20 68 65 72 65 0a 09 28 69 66 20 28 61 72  rg here..(if (ar
8630: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71  gs:get-arg "-req
8640: 74 61 72 67 22 29 0a 09 20 20 20 20 28 6c 65 74  targ")..    (let
8650: 2a 20 28 28 72 75 6e 63 6f 6e 66 69 67 66 20 28  * ((runconfigf (
8660: 63 6f 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a 20  conc  *toppath* 
8670: 22 2f 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e  "/runconfigs.con
8680: 66 69 67 22 29 29 20 3b 3b 20 44 4f 20 4e 4f 54  fig")) ;; DO NOT
8690: 20 45 56 41 4c 55 41 54 45 20 41 4c 4c 20 0a 09   EVALUATE ALL ..
86a0: 09 20 20 20 28 72 75 6e 63 6f 6e 66 69 67 20 20  .   (runconfig  
86b0: 28 72 65 61 64 2d 63 6f 6e 66 69 67 20 72 75 6e  (read-config run
86c0: 63 6f 6e 66 69 67 66 20 23 66 20 23 66 20 65 6e  configf #f #f en
86d0: 76 69 72 6f 6e 2d 70 61 74 74 3a 20 23 66 29 29  viron-patt: #f))
86e0: 29 20 0a 09 20 20 20 20 20 20 28 69 66 20 28 68  ) ..      (if (h
86f0: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65  ash-table-ref/de
8700: 66 61 75 6c 74 20 72 75 6e 63 6f 6e 66 69 67 20  fault runconfig 
8710: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
8720: 72 65 71 74 61 72 67 22 29 20 23 66 29 0a 09 09  reqtarg") #f)...
8730: 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 73    (keys:target-s
8740: 65 74 2d 61 72 67 73 20 6b 65 79 73 20 28 61 72  et-args keys (ar
8750: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71  gs:get-arg "-req
8760: 74 61 72 67 22 29 20 61 72 67 73 3a 61 72 67 2d  targ") args:arg-
8770: 68 61 73 68 29 0a 09 09 20 20 28 62 65 67 69 6e  hash)...  (begin
8780: 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72  ...    (debug:pr
8790: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 5b 22  int 0 "ERROR: ["
87a0: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
87b0: 2d 72 65 71 74 61 72 67 22 29 20 22 5d 20 6e 6f  -reqtarg") "] no
87c0: 74 20 66 6f 75 6e 64 20 69 6e 20 22 20 72 75 6e  t found in " run
87d0: 63 6f 6e 66 69 67 66 29 0a 09 09 20 20 20 20 28  configf)...    (
87e0: 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65  sqlite3:finalize
87f0: 21 20 64 62 29 0a 09 09 20 20 20 20 28 65 78 69  ! db)...    (exi
8800: 74 20 31 29 29 29 29 0a 09 20 20 20 20 28 69 66  t 1))))..    (if
8810: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
8820: 2d 74 61 72 67 65 74 22 29 0a 09 09 28 6b 65 79  -target")...(key
8830: 73 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 72 67  s:target-set-arg
8840: 73 20 6b 65 79 73 20 28 61 72 67 73 3a 67 65 74  s keys (args:get
8850: 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 20 61  -arg "-target" a
8860: 72 67 73 3a 61 72 67 2d 68 61 73 68 29 20 61 72  rgs:arg-hash) ar
8870: 67 73 3a 61 72 67 2d 68 61 73 68 29 29 29 0a 09  gs:arg-hash)))..
8880: 28 69 66 20 28 6e 6f 74 20 28 63 61 72 20 2a 63  (if (not (car *c
8890: 6f 6e 66 69 67 69 6e 66 6f 2a 29 29 0a 09 20 20  onfiginfo*))..  
88a0: 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20    (begin..      
88b0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
88c0: 45 52 52 4f 52 3a 20 41 74 74 65 6d 70 74 65 64  ERROR: Attempted
88d0: 20 74 6f 20 22 20 61 63 74 69 6f 6e 2d 64 65 73   to " action-des
88e0: 63 20 22 20 62 75 74 20 72 75 6e 20 61 72 65 61  c " but run area
88f0: 20 63 6f 6e 66 69 67 20 66 69 6c 65 20 6e 6f 74   config file not
8900: 20 66 6f 75 6e 64 22 29 0a 09 20 20 20 20 20 20   found")..      
8910: 28 65 78 69 74 20 31 29 29 0a 09 20 20 20 20 3b  (exit 1))..    ;
8920: 3b 20 45 78 74 72 61 63 74 20 6f 75 74 20 73 74  ; Extract out st
8930: 75 66 66 20 6e 65 65 64 65 64 20 69 6e 20 6d 6f  uff needed in mo
8940: 73 74 20 6f 72 20 6d 61 6e 79 20 63 61 6c 6c 73  st or many calls
8950: 0a 09 20 20 20 20 3b 3b 20 68 65 72 65 20 74 68  ..    ;; here th
8960: 65 6e 20 63 61 6c 6c 20 70 72 6f 63 0a 09 20 20  en call proc..  
8970: 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 6e 61 6d    (let* ((keynam
8980: 65 73 20 20 20 28 6d 61 70 20 6b 65 79 3a 67 65  es   (map key:ge
8990: 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79 73  t-fieldname keys
89a0: 29 29 0a 09 09 20 20 20 28 6b 65 79 76 61 6c 6c  ))...   (keyvall
89b0: 73 74 20 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69  st  (keys->valli
89c0: 73 74 20 6b 65 79 73 20 23 74 29 29 29 0a 09 20  st keys #t))).. 
89d0: 20 20 20 20 20 28 70 72 6f 63 20 64 62 20 74 61       (proc db ta
89e0: 72 67 65 74 20 72 75 6e 6e 61 6d 65 20 6b 65 79  rget runname key
89f0: 73 20 6b 65 79 6e 61 6d 65 73 20 6b 65 79 76 61  s keynames keyva
8a00: 6c 6c 73 74 29 29 29 0a 09 28 69 66 20 74 68 31  llst)))..(if th1
8a10: 20 28 74 68 72 65 61 64 2d 6a 6f 69 6e 21 20 74   (thread-join! t
8a20: 68 31 29 29 0a 09 28 73 71 6c 69 74 65 33 3a 66  h1))..(sqlite3:f
8a30: 69 6e 61 6c 69 7a 65 21 20 64 62 29 0a 09 28 73  inalize! db)..(s
8a40: 65 74 21 20 2a 64 69 64 73 6f 6d 65 74 68 69 6e  et! *didsomethin
8a50: 67 2a 20 23 74 29 29 29 29 29 29 0a 0a 3b 3b 3d  g* #t))))))..;;=
8a60: 3d 3d 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 0a 3b 3b 20 4c 6f 63 6b 2f 75 6e  =====.;; Lock/un
8ab0: 6c 6f 63 6b 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d  lock runs.;;====
8ac0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8ad0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8ae0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8af0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8b00: 3d 3d 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e  ==..(define (run
8b10: 73 3a 68 61 6e 64 6c 65 2d 6c 6f 63 6b 69 6e 67  s:handle-locking
8b20: 20 64 62 20 74 61 72 67 65 74 20 6b 65 79 73 20   db target keys 
8b30: 72 75 6e 6e 61 6d 65 20 6c 6f 63 6b 20 75 6e 6c  runname lock unl
8b40: 6f 63 6b 20 75 73 65 72 29 0a 20 20 28 6c 65 74  ock user).  (let
8b50: 2a 20 28 28 72 75 6e 64 61 74 20 20 20 28 72 75  * ((rundat   (ru
8b60: 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70  ns:get-runs-by-p
8b70: 61 74 74 20 64 62 20 6b 65 79 73 20 72 75 6e 6e  att db keys runn
8b80: 61 6d 65 29 29 0a 09 20 28 68 65 61 64 65 72 20  ame)).. (header 
8b90: 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75    (vector-ref ru
8ba0: 6e 64 61 74 20 30 29 29 0a 09 20 28 72 75 6e 73  ndat 0)).. (runs
8bb0: 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66       (vector-ref
8bc0: 20 72 75 6e 64 61 74 20 31 29 29 29 0a 20 20 20   rundat 1))).   
8bd0: 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62   (for-each (lamb
8be0: 64 61 20 28 72 75 6e 29 0a 09 09 28 6c 65 74 20  da (run)...(let 
8bf0: 28 28 72 75 6e 2d 69 64 20 28 64 62 3a 67 65 74  ((run-id (db:get
8c00: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72  -value-by-header
8c10: 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 22   run header "id"
8c20: 29 29 29 0a 09 09 20 20 28 69 66 20 28 6f 72 20  )))...  (if (or 
8c30: 6c 6f 63 6b 0a 09 09 09 20 20 28 61 6e 64 20 75  lock....  (and u
8c40: 6e 6c 6f 63 6b 0a 09 09 09 20 20 20 20 20 20 20  nlock....       
8c50: 28 62 65 67 69 6e 0a 09 09 09 09 20 28 70 72 69  (begin..... (pri
8c60: 6e 74 20 22 44 6f 20 79 6f 75 20 72 65 61 6c 6c  nt "Do you reall
8c70: 79 20 77 69 73 68 20 74 6f 20 75 6e 6c 6f 63 6b  y wish to unlock
8c80: 20 72 75 6e 20 22 20 72 75 6e 2d 69 64 20 22 3f   run " run-id "?
8c90: 5c 6e 20 20 20 79 2f 6e 3a 20 22 29 0a 09 09 09  \n   y/n: ")....
8ca0: 09 20 28 65 71 75 61 6c 3f 20 22 79 22 20 28 72  . (equal? "y" (r
8cb0: 65 61 64 2d 6c 69 6e 65 29 29 29 29 29 0a 09 09  ead-line)))))...
8cc0: 20 20 20 20 20 20 28 64 62 3a 6c 6f 63 6b 2f 75        (db:lock/u
8cd0: 6e 6c 6f 63 6b 2d 72 75 6e 20 64 62 20 72 75 6e  nlock-run db run
8ce0: 2d 69 64 20 6c 6f 63 6b 20 75 6e 6c 6f 63 6b 20  -id lock unlock 
8cf0: 75 73 65 72 29 0a 09 09 20 20 20 20 20 20 28 64  user)...      (d
8d00: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 49 4e  ebug:print 0 "IN
8d10: 46 4f 3a 20 53 6b 69 70 70 69 6e 67 20 6c 6f 63  FO: Skipping loc
8d20: 6b 2f 75 6e 6c 6f 63 6b 20 6f 6e 20 22 20 72 75  k/unlock on " ru
8d30: 6e 2d 69 64 29 29 29 29 0a 09 20 20 20 20 20 20  n-id))))..      
8d40: 72 75 6e 73 29 29 29 0a 3b 3b 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 3d 3d  ================
8d90: 0a 3b 3b 20 52 6f 6c 6c 75 70 20 72 75 6e 73 0a  .;; Rollup runs.
8da0: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;;==============
8db0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8dc0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8dd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8de0: 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 55 70 64  ========..;; Upd
8df0: 61 74 65 20 74 68 65 20 74 65 73 74 5f 6d 65 74  ate the test_met
8e00: 61 20 74 61 62 6c 65 20 66 6f 72 20 74 68 69 73  a table for this
8e10: 20 74 65 73 74 0a 28 64 65 66 69 6e 65 20 28 72   test.(define (r
8e20: 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f  uns:update-test_
8e30: 6d 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d  meta db test-nam
8e40: 65 20 74 65 73 74 2d 63 6f 6e 66 29 0a 20 20 28  e test-conf).  (
8e50: 6c 65 74 20 28 28 63 75 72 72 72 65 63 6f 72 64  let ((currrecord
8e60: 20 28 64 62 3a 74 65 73 74 6d 65 74 61 2d 67 65   (db:testmeta-ge
8e70: 74 2d 72 65 63 6f 72 64 20 64 62 20 74 65 73 74  t-record db test
8e80: 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 69 66  -name))).    (if
8e90: 20 28 6e 6f 74 20 63 75 72 72 72 65 63 6f 72 64   (not currrecord
8ea0: 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 73 65  )..(begin..  (se
8eb0: 74 21 20 63 75 72 72 72 65 63 6f 72 64 20 28 6d  t! currrecord (m
8ec0: 61 6b 65 2d 76 65 63 74 6f 72 20 31 30 20 23 66  ake-vector 10 #f
8ed0: 29 29 0a 09 20 20 28 64 62 3a 74 65 73 74 6d 65  ))..  (db:testme
8ee0: 74 61 2d 61 64 64 2d 72 65 63 6f 72 64 20 64 62  ta-add-record db
8ef0: 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20   test-name))).  
8f00: 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20    (for-each .   
8f10: 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 29 0a    (lambda (key).
8f20: 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 69         (let* ((i
8f30: 64 78 20 28 63 61 64 72 20 6b 65 79 29 29 0a 09  dx (cadr key))..
8f40: 20 20 20 20 20 20 28 66 6c 64 20 28 63 61 72 20        (fld (car 
8f50: 20 6b 65 79 29 29 0a 09 20 20 20 20 20 20 28 76   key))..      (v
8f60: 61 6c 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75  al (config-looku
8f70: 70 20 74 65 73 74 2d 63 6f 6e 66 20 22 74 65 73  p test-conf "tes
8f80: 74 5f 6d 65 74 61 22 20 66 6c 64 29 29 29 0a 09  t_meta" fld)))..
8f90: 20 3b 3b 20 28 64 65 62 75 67 3a 70 72 69 6e 74   ;; (debug:print
8fa0: 20 35 20 22 69 64 78 3a 20 22 20 69 64 78 20 22   5 "idx: " idx "
8fb0: 20 66 6c 64 3a 20 22 20 66 6c 64 20 22 20 76 61   fld: " fld " va
8fc0: 6c 3a 20 22 20 76 61 6c 29 0a 09 20 28 69 66 20  l: " val).. (if 
8fd0: 28 61 6e 64 20 76 61 6c 20 28 6e 6f 74 20 28 65  (and val (not (e
8fe0: 71 75 61 6c 3f 20 28 76 65 63 74 6f 72 2d 72 65  qual? (vector-re
8ff0: 66 20 63 75 72 72 72 65 63 6f 72 64 20 69 64 78  f currrecord idx
9000: 29 20 76 61 6c 29 29 29 0a 09 20 20 20 20 20 28  ) val)))..     (
9010: 62 65 67 69 6e 0a 09 20 20 20 20 20 20 20 28 70  begin..       (p
9020: 72 69 6e 74 20 22 55 70 64 61 74 69 6e 67 20 22  rint "Updating "
9030: 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 22 20 66   test-name " " f
9040: 6c 64 20 22 20 74 6f 20 22 20 76 61 6c 29 0a 09  ld " to " val)..
9050: 20 20 20 20 20 20 20 28 64 62 3a 74 65 73 74 6d         (db:testm
9060: 65 74 61 2d 75 70 64 61 74 65 2d 66 69 65 6c 64  eta-update-field
9070: 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 66 6c   db test-name fl
9080: 64 20 76 61 6c 29 29 29 29 29 0a 20 20 20 20 20  d val))))).     
9090: 27 28 28 22 61 75 74 68 6f 72 22 20 32 29 28 22  '(("author" 2)("
90a0: 6f 77 6e 65 72 22 20 33 29 28 22 64 65 73 63 72  owner" 3)("descr
90b0: 69 70 74 69 6f 6e 22 20 34 29 28 22 72 65 76 69  iption" 4)("revi
90c0: 65 77 65 64 22 20 35 29 28 22 74 61 67 73 22 20  ewed" 5)("tags" 
90d0: 39 29 29 29 29 29 0a 0a 3b 3b 20 55 70 64 61 74  9)))))..;; Updat
90e0: 65 20 74 65 73 74 5f 6d 65 74 61 20 66 6f 72 20  e test_meta for 
90f0: 61 6c 6c 20 74 65 73 74 73 0a 28 64 65 66 69 6e  all tests.(defin
9100: 65 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 61  e (runs:update-a
9110: 6c 6c 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 29  ll-test_meta db)
9120: 0a 20 20 28 6c 65 74 20 28 28 74 65 73 74 2d 6e  .  (let ((test-n
9130: 61 6d 65 73 20 28 67 65 74 2d 61 6c 6c 2d 6c 65  ames (get-all-le
9140: 67 61 6c 2d 74 65 73 74 73 29 29 29 0a 20 20 20  gal-tests))).   
9150: 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20   (for-each .    
9160: 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 2d 6e   (lambda (test-n
9170: 61 6d 65 29 0a 20 20 20 20 20 20 20 28 6c 65 74  ame).       (let
9180: 2a 20 28 28 74 65 73 74 2d 70 61 74 68 20 20 20  * ((test-path   
9190: 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a   (conc *toppath*
91a0: 20 22 2f 74 65 73 74 73 2f 22 20 74 65 73 74 2d   "/tests/" test-
91b0: 6e 61 6d 65 29 29 0a 09 20 20 20 20 20 20 28 74  name))..      (t
91c0: 65 73 74 2d 63 6f 6e 66 69 67 66 20 28 63 6f 6e  est-configf (con
91d0: 63 20 74 65 73 74 2d 70 61 74 68 20 22 2f 74 65  c test-path "/te
91e0: 73 74 63 6f 6e 66 69 67 22 29 29 0a 09 20 20 20  stconfig"))..   
91f0: 20 20 20 28 74 65 73 74 65 78 69 73 74 73 20 20     (testexists  
9200: 20 28 61 6e 64 20 28 66 69 6c 65 2d 65 78 69 73   (and (file-exis
9210: 74 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66  ts? test-configf
9220: 29 28 66 69 6c 65 2d 72 65 61 64 2d 61 63 63 65  )(file-read-acce
9230: 73 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66  ss? test-configf
9240: 29 29 29 0a 09 20 20 20 20 20 20 3b 3b 20 72 65  )))..      ;; re
9250: 61 64 20 63 6f 6e 66 69 67 73 20 77 69 74 68 20  ad configs with 
9260: 74 72 69 63 6b 73 20 74 75 72 6e 65 64 20 6f 66  tricks turned of
9270: 66 20 28 69 2e 65 2e 20 6e 6f 20 73 79 73 74 65  f (i.e. no syste
9280: 6d 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d  m)..      (test-
9290: 63 6f 6e 66 20 20 20 20 28 69 66 20 74 65 73 74  conf    (if test
92a0: 65 78 69 73 74 73 20 28 72 65 61 64 2d 63 6f 6e  exists (read-con
92b0: 66 69 67 20 74 65 73 74 2d 63 6f 6e 66 69 67 66  fig test-configf
92c0: 20 23 66 20 23 66 29 28 6d 61 6b 65 2d 68 61 73   #f #f)(make-has
92d0: 68 2d 74 61 62 6c 65 29 29 29 29 0a 09 20 28 72  h-table)))).. (r
92e0: 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f  uns:update-test_
92f0: 6d 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d  meta db test-nam
9300: 65 20 74 65 73 74 2d 63 6f 6e 66 29 29 29 0a 20  e test-conf))). 
9310: 20 20 20 20 74 65 73 74 2d 6e 61 6d 65 73 29 29      test-names))
9320: 29 0a 0a 3b 3b 20 54 68 69 73 20 63 6f 75 6c 64  )..;; This could
9330: 20 70 72 6f 62 61 62 6c 79 20 62 65 20 72 65 66   probably be ref
9340: 61 63 74 6f 72 65 64 20 69 6e 74 6f 20 6f 6e 65  actored into one
9350: 20 63 6f 6d 70 6c 65 78 20 71 75 65 72 79 20 2e   complex query .
9360: 2e 2e 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73  ...(define (runs
9370: 3a 72 6f 6c 6c 75 70 2d 72 75 6e 20 64 62 20 6b  :rollup-run db k
9380: 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75  eys keyvallst ru
9390: 6e 6e 61 6d 65 20 75 73 65 72 29 20 3b 3b 20 77  nname user) ;; w
93a0: 61 73 20 74 61 72 67 65 74 2c 20 6e 6f 77 20 6b  as target, now k
93b0: 65 79 76 61 6c 6c 73 74 0a 20 20 28 64 65 62 75  eyvallst.  (debu
93c0: 67 3a 70 72 69 6e 74 20 34 20 22 72 75 6e 73 3a  g:print 4 "runs:
93d0: 72 6f 6c 6c 75 70 2d 72 75 6e 2c 20 6b 65 79 73  rollup-run, keys
93e0: 3a 20 22 20 6b 65 79 73 20 22 20 6b 65 79 76 61  : " keys " keyva
93f0: 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73  llst: " keyvalls
9400: 74 20 22 20 3a 72 75 6e 6e 61 6d 65 20 22 20 72  t " :runname " r
9410: 75 6e 6e 61 6d 65 20 22 20 75 73 65 72 3a 20 22  unname " user: "
9420: 20 75 73 65 72 29 0a 20 20 28 6c 65 74 2a 20 28   user).  (let* (
9430: 3b 20 28 6b 65 79 76 61 6c 6c 6c 73 74 20 20 20  ; (keyvalllst   
9440: 20 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74 2d     (keys:target-
9450: 3e 6b 65 79 76 61 6c 20 6b 65 79 73 20 74 61 72  >keyval keys tar
9460: 67 65 74 29 29 0a 09 20 28 6e 65 77 2d 72 75 6e  get)).. (new-run
9470: 2d 69 64 20 20 20 20 20 20 28 72 75 6e 73 3a 72  -id      (runs:r
9480: 65 67 69 73 74 65 72 2d 72 75 6e 20 64 62 20 6b  egister-run db k
9490: 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75  eys keyvallst ru
94a0: 6e 6e 61 6d 65 20 22 6e 65 77 22 20 22 6e 2f 61  nname "new" "n/a
94b0: 22 20 75 73 65 72 29 29 0a 09 20 28 70 72 65 76  " user)).. (prev
94c0: 2d 74 65 73 74 73 20 20 20 20 20 20 28 74 65 73  -tests      (tes
94d0: 74 3a 67 65 74 2d 6d 61 74 63 68 69 6e 67 2d 70  t:get-matching-p
94e0: 72 65 76 69 6f 75 73 2d 74 65 73 74 2d 72 75 6e  revious-test-run
94f0: 2d 72 65 63 6f 72 64 73 20 64 62 20 6e 65 77 2d  -records db new-
9500: 72 75 6e 2d 69 64 20 22 25 22 20 22 25 22 29 29  run-id "%" "%"))
9510: 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73 20 20  .. (curr-tests  
9520: 20 20 20 20 28 72 64 62 3a 67 65 74 2d 74 65 73      (rdb:get-tes
9530: 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65  ts-for-run db ne
9540: 77 2d 72 75 6e 2d 69 64 20 22 25 22 20 22 25 22  w-run-id "%" "%"
9550: 20 27 28 29 20 27 28 29 29 29 0a 09 20 28 63 75   '() '())).. (cu
9560: 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 28 6d  rr-tests-hash (m
9570: 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29  ake-hash-table))
9580: 29 0a 20 20 20 20 28 64 62 3a 75 70 64 61 74 65  ).    (db:update
9590: 2d 72 75 6e 2d 65 76 65 6e 74 5f 74 69 6d 65 20  -run-event_time 
95a0: 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 29 0a 20  db new-run-id). 
95b0: 20 20 20 3b 3b 20 69 6e 64 65 78 20 74 68 65 20     ;; index the 
95c0: 61 6c 72 65 61 64 79 20 73 61 76 65 64 20 74 65  already saved te
95d0: 73 74 73 20 62 79 20 74 65 73 74 6e 61 6d 65 20  sts by testname 
95e0: 61 6e 64 20 69 74 65 6d 64 61 74 20 69 6e 20 63  and itemdat in c
95f0: 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 0a 20  urr-tests-hash. 
9600: 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 20     (for-each.   
9610: 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 64    (lambda (testd
9620: 61 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a  at).       (let*
9630: 20 28 28 74 65 73 74 6e 61 6d 65 20 20 28 64 62   ((testname  (db
9640: 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61  :test-get-testna
9650: 6d 65 20 74 65 73 74 64 61 74 29 29 0a 09 20 20  me testdat))..  
9660: 20 20 20 20 28 69 74 65 6d 2d 70 61 74 68 20 28      (item-path (
9670: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d  db:test-get-item
9680: 2d 70 61 74 68 20 74 65 73 74 64 61 74 29 29 0a  -path testdat)).
9690: 09 20 20 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d  .      (full-nam
96a0: 65 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65  e (conc testname
96b0: 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29   "/" item-path))
96c0: 29 0a 09 20 28 68 61 73 68 2d 74 61 62 6c 65 2d  ).. (hash-table-
96d0: 73 65 74 21 20 63 75 72 72 2d 74 65 73 74 73 2d  set! curr-tests-
96e0: 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 74  hash full-name t
96f0: 65 73 74 64 61 74 29 29 29 0a 20 20 20 20 20 63  estdat))).     c
9700: 75 72 72 2d 74 65 73 74 73 29 0a 20 20 20 20 3b  urr-tests).    ;
9710: 3b 20 4e 4f 50 45 3a 20 4e 6f 6e 2d 6f 70 74 69  ; NOPE: Non-opti
9720: 6d 61 6c 20 61 70 70 72 6f 61 63 68 2e 20 54 72  mal approach. Tr
9730: 79 20 74 68 69 73 20 69 6e 73 74 65 61 64 2e 0a  y this instead..
9740: 20 20 20 20 3b 3b 20 20 20 31 2e 20 74 65 73 74      ;;   1. test
9750: 73 20 61 72 65 20 72 65 63 65 69 76 65 64 20 69  s are received i
9760: 6e 20 61 20 6c 69 73 74 2c 20 6d 6f 73 74 20 72  n a list, most r
9770: 65 63 65 6e 74 20 66 69 72 73 74 0a 20 20 20 20  ecent first.    
9780: 3b 3b 20 20 20 32 2e 20 72 65 70 6c 61 63 65 20  ;;   2. replace 
9790: 74 68 65 20 72 6f 6c 6c 75 70 20 74 65 73 74 20  the rollup test 
97a0: 77 69 74 68 20 74 68 65 20 6e 65 77 20 2a 61 6c  with the new *al
97b0: 77 61 79 73 2a 0a 20 20 20 20 28 66 6f 72 2d 65  ways*.    (for-e
97c0: 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64  ach .     (lambd
97d0: 61 20 28 74 65 73 74 64 61 74 29 0a 20 20 20 20  a (testdat).    
97e0: 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 6e     (let* ((testn
97f0: 61 6d 65 20 20 28 64 62 3a 74 65 73 74 2d 67 65  ame  (db:test-ge
9800: 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 64  t-testname testd
9810: 61 74 29 29 0a 09 20 20 20 20 20 20 28 69 74 65  at))..      (ite
9820: 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d  m-path (db:test-
9830: 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65  get-item-path te
9840: 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28  stdat))..      (
9850: 66 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20  full-name (conc 
9860: 74 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65  testname "/" ite
9870: 6d 2d 70 61 74 68 29 29 0a 09 20 20 20 20 20 20  m-path))..      
9880: 28 70 72 65 76 2d 74 65 73 74 2d 64 61 74 20 28  (prev-test-dat (
9890: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64  hash-table-ref/d
98a0: 65 66 61 75 6c 74 20 63 75 72 72 2d 74 65 73 74  efault curr-test
98b0: 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65  s-hash full-name
98c0: 20 23 66 29 29 0a 09 20 20 20 20 20 20 28 74 65   #f))..      (te
98d0: 73 74 2d 73 74 65 70 73 20 20 20 20 20 20 28 64  st-steps      (d
98e0: 62 3a 67 65 74 2d 73 74 65 70 73 2d 66 6f 72 2d  b:get-steps-for-
98f0: 74 65 73 74 20 64 62 20 28 64 62 3a 74 65 73 74  test db (db:test
9900: 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29  -get-id testdat)
9910: 29 29 0a 09 20 20 20 20 20 20 28 6e 65 77 2d 74  ))..      (new-t
9920: 65 73 74 2d 72 65 63 6f 72 64 20 23 66 29 29 0a  est-record #f)).
9930: 09 20 3b 3b 20 72 65 70 6c 61 63 65 20 74 68 65  . ;; replace the
9940: 73 65 20 77 69 74 68 20 69 6e 73 65 72 74 20 2e  se with insert .
9950: 2e 2e 20 73 65 6c 65 63 74 0a 09 20 28 61 70 70  .. select.. (app
9960: 6c 79 20 73 71 6c 69 74 65 33 3a 65 78 65 63 75  ly sqlite3:execu
9970: 74 65 20 0a 09 09 64 62 20 0a 09 09 28 63 6f 6e  te ...db ...(con
9980: 63 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50  c "INSERT OR REP
9990: 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 74 73 20  LACE INTO tests 
99a0: 28 72 75 6e 5f 69 64 2c 74 65 73 74 6e 61 6d 65  (run_id,testname
99b0: 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c 65 76  ,state,status,ev
99c0: 65 6e 74 5f 74 69 6d 65 2c 68 6f 73 74 2c 63 70  ent_time,host,cp
99d0: 75 6c 6f 61 64 2c 64 69 73 6b 66 72 65 65 2c 75  uload,diskfree,u
99e0: 6e 61 6d 65 2c 72 75 6e 64 69 72 2c 69 74 65 6d  name,rundir,item
99f0: 5f 70 61 74 68 2c 72 75 6e 5f 64 75 72 61 74 69  _path,run_durati
9a00: 6f 6e 2c 66 69 6e 61 6c 5f 6c 6f 67 66 2c 63 6f  on,final_logf,co
9a10: 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 20 20  mment) "...     
9a20: 20 22 56 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f 2c   "VALUES (?,?,?,
9a30: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c  ?,?,?,?,?,?,?,?,
9a40: 3f 2c 3f 2c 3f 29 3b 22 29 0a 09 09 6e 65 77 2d  ?,?,?);")...new-
9a50: 72 75 6e 2d 69 64 20 28 63 64 64 72 20 28 76 65  run-id (cddr (ve
9a60: 63 74 6f 72 2d 3e 6c 69 73 74 20 74 65 73 74 64  ctor->list testd
9a70: 61 74 29 29 29 0a 09 20 28 73 65 74 21 20 6e 65  at))).. (set! ne
9a80: 77 2d 74 65 73 74 64 61 74 20 28 63 61 72 20 28  w-testdat (car (
9a90: 72 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f  rdb:get-tests-fo
9aa0: 72 2d 72 75 6e 20 64 62 20 6e 65 77 2d 72 75 6e  r-run db new-run
9ab0: 2d 69 64 20 74 65 73 74 6e 61 6d 65 20 69 74 65  -id testname ite
9ac0: 6d 2d 70 61 74 68 20 27 28 29 20 27 28 29 29 29  m-path '() '()))
9ad0: 29 0a 09 20 28 68 61 73 68 2d 74 61 62 6c 65 2d  ).. (hash-table-
9ae0: 73 65 74 21 20 63 75 72 72 2d 74 65 73 74 73 2d  set! curr-tests-
9af0: 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 6e  hash full-name n
9b00: 65 77 2d 74 65 73 74 64 61 74 29 20 3b 3b 20 74  ew-testdat) ;; t
9b10: 68 69 73 20 63 6f 75 6c 64 20 62 65 20 63 6f 6e  his could be con
9b20: 66 75 73 69 6e 67 2c 20 77 68 69 63 68 20 72 65  fusing, which re
9b30: 63 6f 72 64 20 73 68 6f 75 6c 64 20 67 6f 20 69  cord should go i
9b40: 6e 74 6f 20 74 68 65 20 6c 6f 6f 6b 75 70 20 74  nto the lookup t
9b50: 61 62 6c 65 3f 0a 09 20 3b 3b 20 4e 6f 77 20 64  able?.. ;; Now d
9b60: 75 70 6c 69 63 61 74 65 20 74 68 65 20 74 65 73  uplicate the tes
9b70: 74 20 73 74 65 70 73 0a 09 20 28 64 65 62 75 67  t steps.. (debug
9b80: 3a 70 72 69 6e 74 20 34 20 22 43 6f 70 79 69 6e  :print 4 "Copyin
9b90: 67 20 72 65 63 6f 72 64 73 20 69 6e 20 74 65 73  g records in tes
9ba0: 74 5f 73 74 65 70 73 20 66 72 6f 6d 20 74 65 73  t_steps from tes
9bb0: 74 5f 69 64 3d 22 20 28 64 62 3a 74 65 73 74 2d  t_id=" (db:test-
9bc0: 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 20  get-id testdat) 
9bd0: 22 20 74 6f 20 22 20 28 64 62 3a 74 65 73 74 2d  " to " (db:test-
9be0: 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64  get-id new-testd
9bf0: 61 74 29 29 0a 09 20 28 73 71 6c 69 74 65 33 3a  at)).. (sqlite3:
9c00: 65 78 65 63 75 74 65 20 0a 09 20 20 64 62 20 0a  execute ..  db .
9c10: 09 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54  .  (conc "INSERT
9c20: 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f   OR REPLACE INTO
9c30: 20 74 65 73 74 5f 73 74 65 70 73 20 28 74 65 73   test_steps (tes
9c40: 74 5f 69 64 2c 73 74 65 70 6e 61 6d 65 2c 73 74  t_id,stepname,st
9c50: 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74  ate,status,event
9c60: 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 29 20 22  _time,comment) "
9c70: 0a 09 09 22 53 45 4c 45 43 54 20 22 20 28 64 62  ..."SELECT " (db
9c80: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77  :test-get-id new
9c90: 2d 74 65 73 74 64 61 74 29 20 22 2c 73 74 65 70  -testdat) ",step
9ca0: 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75  name,state,statu
9cb0: 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d  s,event_time,com
9cc0: 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f 73  ment FROM test_s
9cd0: 74 65 70 73 20 57 48 45 52 45 20 74 65 73 74 5f  teps WHERE test_
9ce0: 69 64 3d 3f 3b 22 29 0a 09 20 20 28 64 62 3a 74  id=?;")..  (db:t
9cf0: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64  est-get-id testd
9d00: 61 74 29 29 0a 09 20 3b 3b 20 4e 6f 77 20 64 75  at)).. ;; Now du
9d10: 70 6c 69 63 61 74 65 20 74 68 65 20 74 65 73 74  plicate the test
9d20: 20 64 61 74 61 0a 09 20 28 64 65 62 75 67 3a 70   data.. (debug:p
9d30: 72 69 6e 74 20 34 20 22 43 6f 70 79 69 6e 67 20  rint 4 "Copying 
9d40: 72 65 63 6f 72 64 73 20 69 6e 20 74 65 73 74 5f  records in test_
9d50: 64 61 74 61 20 66 72 6f 6d 20 74 65 73 74 5f 69  data from test_i
9d60: 64 3d 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74  d=" (db:test-get
9d70: 2d 69 64 20 74 65 73 74 64 61 74 29 20 22 20 74  -id testdat) " t
9d80: 6f 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74  o " (db:test-get
9d90: 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29  -id new-testdat)
9da0: 29 0a 09 20 28 73 71 6c 69 74 65 33 3a 65 78 65  ).. (sqlite3:exe
9db0: 63 75 74 65 20 0a 09 20 20 64 62 20 0a 09 20 20  cute ..  db ..  
9dc0: 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52  (conc "INSERT OR
9dd0: 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65   REPLACE INTO te
9de0: 73 74 5f 64 61 74 61 20 28 74 65 73 74 5f 69 64  st_data (test_id
9df0: 2c 63 61 74 65 67 6f 72 79 2c 76 61 72 69 61 62  ,category,variab
9e00: 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65 63 74 65  le,value,expecte
9e10: 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d  d,tol,units,comm
9e20: 65 6e 74 29 20 22 0a 09 09 22 53 45 4c 45 43 54  ent) "..."SELECT
9e30: 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d   " (db:test-get-
9e40: 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20  id new-testdat) 
9e50: 22 2c 63 61 74 65 67 6f 72 79 2c 76 61 72 69 61  ",category,varia
9e60: 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65 63 74  ble,value,expect
9e70: 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d  ed,tol,units,com
9e80: 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f 64  ment FROM test_d
9e90: 61 74 61 20 57 48 45 52 45 20 74 65 73 74 5f 69  ata WHERE test_i
9ea0: 64 3d 3f 3b 22 29 0a 09 20 20 28 64 62 3a 74 65  d=?;")..  (db:te
9eb0: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61  st-get-id testda
9ec0: 74 29 29 0a 09 20 29 29 0a 20 20 20 20 20 70 72  t)).. )).     pr
9ed0: 65 76 2d 74 65 73 74 73 29 29 29 0a 09 20 0a 20  ev-tests))).. . 
9ee0: 20 20 20 20 0a                                       .