Megatest

Hex Artifact Content
Login

Artifact b0555ec7173669e742eaf304a353f090b6da6308:


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 73 74 72 69 6e 67 2d 73 70 6c  tons (string-spl
2370: 69 74 20 28 6c 65 74 20 28 28 77 20 28 63 6f 6e  it (let ((w (con
2380: 66 69 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69  fig-lookup confi
2390: 67 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22  g "requirements"
23a0: 20 22 77 61 69 74 6f 6e 22 29 29 29 0a 09 09 09   "waiton")))....
23b0: 09 09 20 20 28 69 66 20 77 20 77 20 22 22 29 29  ..  (if w w ""))
23c0: 29 29 29 0a 09 20 20 20 20 3b 3b 20 63 68 65 63  )))..    ;; chec
23d0: 6b 20 66 6f 72 20 68 65 64 20 69 6e 20 77 61 69  k for hed in wai
23e0: 74 6f 6e 73 20 3d 3e 20 74 68 69 73 20 77 6f 75  tons => this wou
23f0: 6c 64 20 62 65 20 63 69 72 63 75 6c 61 72 2c 20  ld be circular, 
2400: 72 65 6d 6f 76 65 20 69 74 20 61 6e 64 20 69 73  remove it and is
2410: 73 75 65 20 61 6e 0a 09 20 20 20 20 3b 3b 20 65  sue an..    ;; e
2420: 72 72 6f 72 0a 09 20 20 20 20 28 69 66 20 28 6d  rror..    (if (m
2430: 65 6d 62 65 72 20 68 65 64 20 77 61 69 74 6f 6e  ember hed waiton
2440: 73 29 0a 09 09 28 62 65 67 69 6e 0a 09 09 20 20  s)...(begin...  
2450: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
2460: 45 52 52 4f 52 3a 20 74 65 73 74 20 22 20 68 65  ERROR: test " he
2470: 64 20 22 20 68 61 73 20 6c 69 73 74 65 64 20 69  d " has listed i
2480: 74 73 65 6c 66 20 61 73 20 61 20 77 61 69 74 6f  tself as a waito
2490: 6e 2c 20 70 6c 65 61 73 65 20 63 6f 72 72 65 63  n, please correc
24a0: 74 20 74 68 69 73 21 22 29 0a 09 09 20 20 28 73  t this!")...  (s
24b0: 65 74 21 20 77 61 69 74 6f 6e 73 20 28 66 69 6c  et! waitons (fil
24c0: 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29 28  ter (lambda (x)(
24d0: 6e 6f 74 20 28 65 71 75 61 6c 3f 20 78 20 68 65  not (equal? x he
24e0: 64 29 29 29 20 77 61 69 74 6f 6e 73 29 29 29 29  d))) waitons))))
24f0: 0a 09 20 20 20 20 0a 09 20 20 20 20 3b 3b 20 28  ..    ..    ;; (
2500: 69 74 65 6d 73 20 20 20 28 69 74 65 6d 73 3a 67  items   (items:g
2510: 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f  et-items-from-co
2520: 6e 66 69 67 20 63 6f 6e 66 69 67 29 29 29 0a 09  nfig config)))..
2530: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 68 61      (if (not (ha
2540: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66  sh-table-ref/def
2550: 61 75 6c 74 20 74 65 73 74 2d 72 65 63 6f 72 64  ault test-record
2560: 73 20 68 65 64 20 23 66 29 29 0a 09 09 28 68 61  s hed #f))...(ha
2570: 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 65  sh-table-set! te
2580: 73 74 2d 72 65 63 6f 72 64 73 0a 09 09 09 09 20  st-records..... 
2590: 68 65 64 20 28 76 65 63 74 6f 72 20 68 65 64 20  hed (vector hed 
25a0: 20 20 20 20 3b 3b 20 30 0a 09 09 09 09 09 20 20      ;; 0......  
25b0: 20 20 20 63 6f 6e 66 69 67 20 20 3b 3b 20 31 0a     config  ;; 1.
25c0: 09 09 09 09 09 20 20 20 20 20 77 61 69 74 6f 6e  .....     waiton
25d0: 73 20 3b 3b 20 32 0a 09 09 09 09 09 20 20 20 20  s ;; 2......    
25e0: 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20   (config-lookup 
25f0: 63 6f 6e 66 69 67 20 22 72 65 71 75 69 72 65 6d  config "requirem
2600: 65 6e 74 73 22 20 22 70 72 69 6f 72 69 74 79 22  ents" "priority"
2610: 29 20 20 20 20 20 3b 3b 20 70 72 69 6f 72 69 74  )     ;; priorit
2620: 79 20 33 0a 09 09 09 09 09 20 20 20 20 20 28 6c  y 3......     (l
2630: 65 74 20 28 28 69 74 65 6d 73 20 20 20 20 20 20  et ((items      
2640: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f  (hash-table-ref/
2650: 64 65 66 61 75 6c 74 20 63 6f 6e 66 69 67 20 22  default config "
2660: 69 74 65 6d 73 22 20 23 66 29 29 20 3b 3b 20 69  items" #f)) ;; i
2670: 74 65 6d 73 20 34 0a 09 09 09 09 09 09 20 20 20  tems 4.......   
2680: 28 69 74 65 6d 73 74 61 62 6c 65 20 28 68 61 73  (itemstable (has
2690: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61  h-table-ref/defa
26a0: 75 6c 74 20 63 6f 6e 66 69 67 20 22 69 74 65 6d  ult config "item
26b0: 73 74 61 62 6c 65 22 20 23 66 29 29 29 20 0a 09  stable" #f))) ..
26c0: 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20 69 66  ....       ;; if
26d0: 20 65 69 74 68 65 72 20 69 74 65 6d 73 20 6f 72   either items or
26e0: 20 69 74 65 6d 73 20 74 61 62 6c 65 20 69 73 20   items table is 
26f0: 61 20 70 72 6f 63 20 72 65 74 75 72 6e 20 69 74  a proc return it
2700: 20 73 6f 20 74 65 73 74 20 72 75 6e 6e 69 6e 67   so test running
2710: 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20  ......       ;; 
2720: 70 72 6f 63 65 73 73 20 63 61 6e 20 6b 6e 6f 77  process can know
2730: 20 74 6f 20 63 61 6c 6c 20 69 74 65 6d 73 3a 67   to call items:g
2740: 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f  et-items-from-co
2750: 6e 66 69 67 0a 09 09 09 09 09 20 20 20 20 20 20  nfig......      
2760: 20 3b 3b 20 69 66 20 65 69 74 68 65 72 20 69 73   ;; if either is
2770: 20 61 20 6c 69 73 74 20 61 6e 64 20 6e 6f 6e 65   a list and none
2780: 20 69 73 20 61 20 70 72 6f 63 20 67 6f 20 61 68   is a proc go ah
2790: 65 61 64 20 61 6e 64 20 63 61 6c 6c 20 67 65 74  ead and call get
27a0: 2d 69 74 65 6d 73 0a 09 09 09 09 09 20 20 20 20  -items......    
27b0: 20 20 20 3b 3b 20 6f 74 68 65 72 77 69 73 65 20     ;; otherwise 
27c0: 72 65 74 75 72 6e 20 23 66 20 2d 20 74 68 69 73  return #f - this
27d0: 20 69 73 20 6e 6f 74 20 61 6e 20 69 74 65 72 61   is not an itera
27e0: 74 65 64 20 74 65 73 74 0a 09 09 09 09 09 20 20  ted test......  
27f0: 20 20 20 20 20 28 63 6f 6e 64 0a 09 09 09 09 09       (cond......
2800: 09 28 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74  .((procedure? it
2810: 65 6d 73 29 20 20 20 20 20 20 0a 09 09 09 09 09  ems)      ......
2820: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34  . (debug:print 4
2830: 20 22 49 4e 46 4f 3a 20 69 74 65 6d 73 20 69 73   "INFO: items is
2840: 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20 77 69   a procedure, wi
2850: 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72 22 29 0a  ll calc later").
2860: 09 09 09 09 09 09 20 69 74 65 6d 73 29 20 20 20  ...... items)   
2870: 20 20 20 20 20 20 20 20 20 3b 3b 20 63 61 6c 63           ;; calc
2880: 20 6c 61 74 65 72 0a 09 09 09 09 09 09 28 28 70   later.......((p
2890: 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73 74  rocedure? itemst
28a0: 61 62 6c 65 29 0a 09 09 09 09 09 09 20 28 64 65  able)....... (de
28b0: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46  bug:print 4 "INF
28c0: 4f 3a 20 69 74 65 6d 73 74 61 62 6c 65 20 69 73  O: itemstable is
28d0: 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20 77 69   a procedure, wi
28e0: 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72 22 29 0a  ll calc later").
28f0: 09 09 09 09 09 09 20 69 74 65 6d 73 74 61 62 6c  ...... itemstabl
2900: 65 29 20 20 20 20 20 20 20 3b 3b 20 63 61 6c 63  e)       ;; calc
2910: 20 6c 61 74 65 72 0a 09 09 09 09 09 09 28 28 66   later.......((f
2920: 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78  ilter (lambda (x
2930: 29 0a 09 09 09 09 09 09 09 20 20 20 28 6c 65 74  )........   (let
2940: 20 28 28 76 61 6c 20 28 63 61 72 20 78 29 29 29   ((val (car x)))
2950: 0a 09 09 09 09 09 09 09 20 20 20 20 20 28 69 66  ........     (if
2960: 20 28 70 72 6f 63 65 64 75 72 65 3f 20 76 61 6c   (procedure? val
2970: 29 20 76 61 6c 20 23 66 29 29 29 0a 09 09 09 09  ) val #f))).....
2980: 09 09 09 20 28 61 70 70 65 6e 64 20 28 69 66 20  ... (append (if 
2990: 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 69 74  (list? items) it
29a0: 65 6d 73 20 27 28 29 29 0a 09 09 09 09 09 09 09  ems '())........
29b0: 09 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74 65  . (if (list? ite
29c0: 6d 73 74 61 62 6c 65 29 20 69 74 65 6d 73 74 61  mstable) itemsta
29d0: 62 6c 65 20 27 28 29 29 29 29 0a 09 09 09 09 09  ble '())))......
29e0: 09 20 27 68 61 76 65 2d 70 72 6f 63 65 64 75 72  . 'have-procedur
29f0: 65 29 0a 09 09 09 09 09 09 28 28 6f 72 20 28 6c  e).......((or (l
2a00: 69 73 74 3f 20 69 74 65 6d 73 29 28 6c 69 73 74  ist? items)(list
2a10: 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 29 20 3b  ? itemstable)) ;
2a20: 3b 20 63 61 6c 63 20 6e 6f 77 0a 09 09 09 09 09  ; calc now......
2a30: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34  . (debug:print 4
2a40: 20 22 49 4e 46 4f 3a 20 69 74 65 6d 73 20 61 6e   "INFO: items an
2a50: 64 20 69 74 65 6d 73 74 61 62 6c 65 20 61 72 65  d itemstable are
2a60: 20 6c 69 73 74 73 2c 20 63 61 6c 63 20 6e 6f 77   lists, calc now
2a70: 5c 6e 22 0a 09 09 09 09 09 09 09 20 20 20 20 20  \n"........     
2a80: 20 22 20 20 20 20 69 74 65 6d 73 3a 20 22 20 69   "    items: " i
2a90: 74 65 6d 73 20 22 20 69 74 65 6d 73 74 61 62 6c  tems " itemstabl
2aa0: 65 3a 20 22 20 69 74 65 6d 73 74 61 62 6c 65 29  e: " itemstable)
2ab0: 0a 09 09 09 09 09 09 20 28 69 74 65 6d 73 3a 67  ....... (items:g
2ac0: 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f  et-items-from-co
2ad0: 6e 66 69 67 20 63 6f 6e 66 69 67 29 29 0a 09 09  nfig config))...
2ae0: 09 09 09 09 28 65 6c 73 65 20 23 66 29 29 29 20  ....(else #f))) 
2af0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
2b00: 20 20 20 20 20 20 20 20 20 20 3b 3b 20 6e 6f 74            ;; not
2b10: 20 69 74 65 72 61 74 65 64 0a 09 09 09 09 09 20   iterated...... 
2b20: 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b 20 69      #f      ;; i
2b30: 74 65 6d 73 64 61 74 20 35 0a 09 09 09 09 09 20  temsdat 5...... 
2b40: 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b 20 73      #f      ;; s
2b50: 70 61 72 65 20 2d 20 75 73 65 64 20 66 6f 72 20  pare - used for 
2b60: 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 09 09 20  item-path...... 
2b70: 20 20 20 20 29 29 29 0a 09 20 20 20 20 28 66 6f      )))..    (fo
2b80: 72 2d 65 61 63 68 20 0a 09 20 20 20 20 20 28 6c  r-each ..     (l
2b90: 61 6d 62 64 61 20 28 77 61 69 74 6f 6e 29 0a 09  ambda (waiton)..
2ba0: 20 20 20 20 20 20 20 28 69 66 20 28 61 6e 64 20         (if (and 
2bb0: 77 61 69 74 6f 6e 20 28 6e 6f 74 20 28 6d 65 6d  waiton (not (mem
2bc0: 62 65 72 20 77 61 69 74 6f 6e 20 74 65 73 74 2d  ber waiton test-
2bd0: 6e 61 6d 65 73 29 29 29 0a 09 09 20 20 20 28 62  names)))...   (b
2be0: 65 67 69 6e 0a 09 09 20 20 20 20 20 28 73 65 74  egin...     (set
2bf0: 21 20 72 65 71 75 69 72 65 64 2d 74 65 73 74 73  ! required-tests
2c00: 20 28 63 6f 6e 73 20 77 61 69 74 6f 6e 20 72 65   (cons waiton re
2c10: 71 75 69 72 65 64 2d 74 65 73 74 73 29 29 0a 09  quired-tests))..
2c20: 09 20 20 20 20 20 28 73 65 74 21 20 74 65 73 74  .     (set! test
2c30: 2d 6e 61 6d 65 73 20 28 63 6f 6e 73 20 77 61 69  -names (cons wai
2c40: 74 6f 6e 20 74 65 73 74 2d 6e 61 6d 65 73 29 29  ton test-names))
2c50: 29 29 29 20 3b 3b 20 77 61 73 20 61 6e 20 61 70  ))) ;; was an ap
2c60: 70 65 6e 64 2c 20 6e 6f 77 20 61 20 63 6f 6e 73  pend, now a cons
2c70: 0a 09 20 20 20 20 20 77 61 69 74 6f 6e 73 29 0a  ..     waitons).
2c80: 09 20 20 20 20 28 6c 65 74 20 28 28 72 65 6d 74  .    (let ((remt
2c90: 65 73 74 73 20 28 64 65 6c 65 74 65 2d 64 75 70  ests (delete-dup
2ca0: 6c 69 63 61 74 65 73 20 28 61 70 70 65 6e 64 20  licates (append 
2cb0: 77 61 69 74 6f 6e 73 20 74 61 6c 29 29 29 29 0a  waitons tal)))).
2cc0: 09 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20  .      (if (not 
2cd0: 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29  (null? remtests)
2ce0: 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72  )...  (loop (car
2cf0: 20 72 65 6d 74 65 73 74 73 29 28 63 64 72 20 72   remtests)(cdr r
2d00: 65 6d 74 65 73 74 73 29 29 29 29 29 29 29 0a 0a  emtests)))))))..
2d10: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75      (if (not (nu
2d20: 6c 6c 3f 20 72 65 71 75 69 72 65 64 2d 74 65 73  ll? required-tes
2d30: 74 73 29 29 0a 09 28 64 65 62 75 67 3a 70 72 69  ts))..(debug:pri
2d40: 6e 74 20 31 20 22 49 4e 46 4f 3a 20 41 64 64 69  nt 1 "INFO: Addi
2d50: 6e 67 20 22 20 72 65 71 75 69 72 65 64 2d 74 65  ng " required-te
2d60: 73 74 73 20 22 20 74 6f 20 74 68 65 20 72 75 6e  sts " to the run
2d70: 20 71 75 65 75 65 22 29 29 0a 20 20 20 20 3b 3b   queue")).    ;;
2d80: 20 4e 4f 54 45 3a 20 74 68 65 73 65 20 61 72 65   NOTE: these are
2d90: 20 61 6c 6c 20 70 61 72 65 6e 74 20 74 65 73 74   all parent test
2da0: 73 2c 20 69 74 65 6d 73 20 61 72 65 20 6e 6f 74  s, items are not
2db0: 20 65 78 70 61 6e 64 65 64 20 79 65 74 2e 0a 20   expanded yet.. 
2dc0: 20 20 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73     (runs:run-tes
2dd0: 74 73 2d 71 75 65 75 65 20 64 62 20 72 75 6e 2d  ts-queue db run-
2de0: 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d  id runname test-
2df0: 72 65 63 6f 72 64 73 20 6b 65 79 76 61 6c 6c 73  records keyvalls
2e00: 74 20 66 6c 61 67 73 29 0a 20 20 20 20 28 69 66  t flags).    (if
2e10: 20 2a 72 70 63 3a 6c 69 73 74 65 6e 65 72 2a 20   *rpc:listener* 
2e20: 28 73 65 72 76 65 72 3a 6b 65 65 70 2d 72 75 6e  (server:keep-run
2e30: 6e 69 6e 67 20 64 62 29 29 0a 20 20 20 20 28 64  ning db)).    (d
2e40: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e  ebug:print 4 "IN
2e50: 46 4f 3a 20 41 6c 6c 20 64 6f 6e 65 20 62 79 20  FO: All done by 
2e60: 68 65 72 65 22 29 29 29 0a 0a 3b 3b 20 74 65 73  here")))..;; tes
2e70: 74 2d 72 65 63 6f 72 64 73 20 69 73 20 61 20 68  t-records is a h
2e80: 61 73 68 20 74 61 62 6c 65 20 74 65 73 74 6e 61  ash table testna
2e90: 6d 65 3a 69 74 65 6d 5f 70 61 74 68 20 3d 3e 20  me:item_path => 
2ea0: 76 65 63 74 6f 72 20 3c 20 74 65 73 74 6e 61 6d  vector < testnam
2eb0: 65 20 74 65 73 74 63 6f 6e 66 69 67 20 77 61 69  e testconfig wai
2ec0: 74 6f 6e 73 20 70 72 69 6f 72 69 74 79 20 69 74  tons priority it
2ed0: 65 6d 73 2d 69 6e 66 6f 20 2e 2e 2e 20 3e 0a 28  ems-info ... >.(
2ee0: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 75 6e  define (runs:run
2ef0: 2d 74 65 73 74 73 2d 71 75 65 75 65 20 64 62 20  -tests-queue db 
2f00: 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74  run-id runname t
2f10: 65 73 74 2d 72 65 63 6f 72 64 73 20 6b 65 79 76  est-records keyv
2f20: 61 6c 6c 73 74 20 66 6c 61 67 73 29 0a 20 20 20  allst flags).   
2f30: 20 3b 3b 20 41 74 20 74 68 69 73 20 70 6f 69 6e   ;; At this poin
2f40: 74 20 74 68 65 20 6c 69 73 74 20 6f 66 20 70 61  t the list of pa
2f50: 72 65 6e 74 20 74 65 73 74 73 20 69 73 20 65 78  rent tests is ex
2f60: 70 61 6e 64 65 64 20 0a 20 20 20 20 3b 3b 20 4e  panded .    ;; N
2f70: 42 2f 2f 20 53 68 6f 75 6c 64 20 65 78 70 61 6e  B// Should expan
2f80: 64 20 69 74 65 6d 73 20 68 65 72 65 20 61 6e 64  d items here and
2f90: 20 74 68 65 6e 20 69 6e 73 65 72 74 20 69 6e 74   then insert int
2fa0: 6f 20 74 68 65 20 72 75 6e 20 71 75 65 75 65 2e  o the run queue.
2fb0: 0a 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  .  (debug:print 
2fc0: 35 20 22 74 65 73 74 2d 72 65 63 6f 72 64 73 3a  5 "test-records:
2fd0: 20 22 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20   " test-records 
2fe0: 22 2c 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20  ", keyvallst: " 
2ff0: 6b 65 79 76 61 6c 6c 73 74 20 22 20 66 6c 61 67  keyvallst " flag
3000: 73 3a 20 22 20 28 68 61 73 68 2d 74 61 62 6c 65  s: " (hash-table
3010: 2d 3e 61 6c 69 73 74 20 66 6c 61 67 73 29 29 0a  ->alist flags)).
3020: 20 20 28 6c 65 74 20 28 28 73 6f 72 74 65 64 2d    (let ((sorted-
3030: 74 65 73 74 2d 6e 61 6d 65 73 20 28 74 65 73 74  test-names (test
3040: 73 3a 73 6f 72 74 2d 62 79 2d 70 72 69 6f 72 69  s:sort-by-priori
3050: 74 79 2d 61 6e 64 2d 77 61 69 74 6f 6e 20 74 65  ty-and-waiton te
3060: 73 74 2d 72 65 63 6f 72 64 73 29 29 0a 09 28 69  st-records))..(i
3070: 74 65 6d 2d 70 61 74 74 73 20 20 20 20 20 20 20  tem-patts       
3080: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66   (hash-table-ref
3090: 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22  /default flags "
30a0: 2d 69 74 65 6d 70 61 74 74 22 20 23 66 29 29 29  -itempatt" #f)))
30b0: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e  .    (if (not (n
30c0: 75 6c 6c 3f 20 73 6f 72 74 65 64 2d 74 65 73 74  ull? sorted-test
30d0: 2d 6e 61 6d 65 73 29 29 0a 09 28 6c 65 74 20 6c  -names))..(let l
30e0: 6f 6f 70 20 28 28 68 65 64 20 20 20 20 20 20 20  oop ((hed       
30f0: 20 20 28 63 61 72 20 73 6f 72 74 65 64 2d 74 65    (car sorted-te
3100: 73 74 2d 6e 61 6d 65 73 29 29 0a 09 09 20 20 20  st-names))...   
3110: 28 74 61 6c 20 20 20 20 20 20 20 20 20 28 63 64  (tal         (cd
3120: 72 20 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61  r sorted-test-na
3130: 6d 65 73 29 29 29 0a 09 20 20 28 74 68 72 65 61  mes)))..  (threa
3140: 64 2d 73 6c 65 65 70 21 20 30 2e 31 29 20 3b 3b  d-sleep! 0.1) ;;
3150: 20 67 69 76 65 20 6f 74 68 65 72 20 61 70 70 6c   give other appl
3160: 69 63 61 74 69 6f 6e 73 20 73 6f 6d 65 20 74 69  ications some ti
3170: 6d 65 20 77 69 74 68 20 74 68 65 20 64 62 0a 09  me with the db..
3180: 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 72    (let* ((test-r
3190: 65 63 6f 72 64 20 28 68 61 73 68 2d 74 61 62 6c  ecord (hash-tabl
31a0: 65 2d 72 65 66 20 74 65 73 74 2d 72 65 63 6f 72  e-ref test-recor
31b0: 64 73 20 68 65 64 29 29 0a 09 09 20 28 74 63 6f  ds hed))... (tco
31c0: 6e 66 69 67 20 20 20 20 20 28 74 65 73 74 73 3a  nfig     (tests:
31d0: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65  testqueue-get-te
31e0: 73 74 63 6f 6e 66 69 67 20 74 65 73 74 2d 72 65  stconfig test-re
31f0: 63 6f 72 64 29 29 0a 09 09 20 28 74 65 73 74 6d  cord))... (testm
3200: 6f 64 65 20 20 20 20 28 6c 65 74 20 28 28 6d 20  ode    (let ((m 
3210: 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74  (config-lookup t
3220: 63 6f 6e 66 69 67 20 22 72 65 71 75 69 72 65 6d  config "requirem
3230: 65 6e 74 73 22 20 22 6d 6f 64 65 22 29 29 29 0a  ents" "mode"))).
3240: 09 09 09 09 28 69 66 20 6d 20 28 73 74 72 69 6e  ....(if m (strin
3250: 67 2d 3e 73 79 6d 62 6f 6c 20 6d 29 20 27 6e 6f  g->symbol m) 'no
3260: 72 6d 61 6c 29 29 29 0a 09 09 20 28 77 61 69 74  rmal)))... (wait
3270: 6f 6e 73 20 20 20 20 20 28 74 65 73 74 73 3a 74  ons     (tests:t
3280: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 77 61 69  estqueue-get-wai
3290: 74 6f 6e 73 20 20 20 20 74 65 73 74 2d 72 65 63  tons    test-rec
32a0: 6f 72 64 29 29 0a 09 09 20 28 70 72 69 6f 72 69  ord))... (priori
32b0: 74 79 20 20 20 20 28 74 65 73 74 73 3a 74 65 73  ty    (tests:tes
32c0: 74 71 75 65 75 65 2d 67 65 74 2d 70 72 69 6f 72  tqueue-get-prior
32d0: 69 74 79 20 20 20 74 65 73 74 2d 72 65 63 6f 72  ity   test-recor
32e0: 64 29 29 0a 09 09 20 28 69 74 65 6d 64 61 74 20  d))... (itemdat 
32f0: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71      (tests:testq
3300: 75 65 75 65 2d 67 65 74 2d 69 74 65 6d 64 61 74  ueue-get-itemdat
3310: 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29      test-record)
3320: 29 20 3b 3b 20 69 74 65 6d 64 61 74 20 63 61 6e  ) ;; itemdat can
3330: 20 62 65 20 61 20 73 74 72 69 6e 67 2c 20 6c 69   be a string, li
3340: 73 74 20 6f 72 20 23 66 0a 09 09 20 28 69 74 65  st or #f... (ite
3350: 6d 73 20 20 20 20 20 20 20 28 74 65 73 74 73 3a  ms       (tests:
3360: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74  testqueue-get-it
3370: 65 6d 73 20 20 20 20 20 20 74 65 73 74 2d 72 65  ems      test-re
3380: 63 6f 72 64 29 29 0a 09 09 20 28 69 74 65 6d 2d  cord))... (item-
3390: 70 61 74 68 20 20 20 28 69 74 65 6d 2d 6c 69 73  path   (item-lis
33a0: 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74 29  t->path itemdat)
33b0: 29 0a 09 09 20 28 6e 65 77 74 61 6c 20 20 20 20  )... (newtal    
33c0: 20 20 28 61 70 70 65 6e 64 20 74 61 6c 20 28 6c    (append tal (l
33d0: 69 73 74 20 68 65 64 29 29 29 0a 09 09 20 28 63  ist hed)))... (c
33e0: 61 6c 63 2d 66 61 69 6c 73 20 20 28 6c 61 6d 62  alc-fails  (lamb
33f0: 64 61 20 28 70 72 65 72 65 71 73 2d 6e 6f 74 2d  da (prereqs-not-
3400: 6d 65 74 29 0a 09 09 09 09 28 66 69 6c 74 65 72  met).....(filter
3410: 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 29 0a   (lambda (test).
3420: 09 09 09 09 09 20 20 28 64 65 62 75 67 3a 70 72  .....  (debug:pr
3430: 69 6e 74 20 39 20 22 74 65 73 74 3a 20 22 20 74  int 9 "test: " t
3440: 65 73 74 29 0a 09 09 09 09 09 20 20 28 61 6e 64  est)......  (and
3450: 20 28 76 65 63 74 6f 72 3f 20 74 65 73 74 29 20   (vector? test) 
3460: 3b 3b 20 6e 6f 74 20 28 73 74 72 69 6e 67 3f 20  ;; not (string? 
3470: 74 65 73 74 29 29 0a 09 09 09 09 09 20 20 20 20  test))......    
3480: 20 20 20 28 65 71 75 61 6c 3f 20 28 64 62 3a 74     (equal? (db:t
3490: 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74 65  est-get-state te
34a0: 73 74 29 20 22 43 4f 4d 50 4c 45 54 45 44 22 29  st) "COMPLETED")
34b0: 0a 09 09 09 09 09 20 20 20 20 20 20 20 28 6e 6f  ......       (no
34c0: 74 20 28 6d 65 6d 62 65 72 20 28 64 62 3a 74 65  t (member (db:te
34d0: 73 74 2d 67 65 74 2d 73 74 61 74 75 73 20 74 65  st-get-status te
34e0: 73 74 29 0a 09 09 09 09 09 09 09 20 20 20 20 27  st)........    '
34f0: 28 22 50 41 53 53 22 20 22 57 41 52 4e 22 20 22  ("PASS" "WARN" "
3500: 43 48 45 43 4b 22 20 22 57 41 49 56 45 44 22 29  CHECK" "WAIVED")
3510: 29 29 29 29 0a 09 09 09 09 09 70 72 65 72 65 71  ))))......prereq
3520: 73 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a 09 09 20  s-not-met)))... 
3530: 28 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65  (calc-not-comple
3540: 74 65 64 20 28 6c 61 6d 62 64 61 20 28 70 72 65  ted (lambda (pre
3550: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09  reqs-not-met)...
3560: 09 09 20 20 20 20 20 20 20 28 66 69 6c 74 65 72  ..       (filter
3570: 0a 09 09 09 09 09 28 6c 61 6d 62 64 61 20 28 74  ......(lambda (t
3580: 29 0a 09 09 09 09 09 20 20 28 6f 72 20 28 6e 6f  )......  (or (no
3590: 74 20 28 76 65 63 74 6f 72 3f 20 74 29 29 0a 09  t (vector? t))..
35a0: 09 09 09 09 20 20 20 20 20 20 28 6e 6f 74 20 28  ....      (not (
35b0: 65 71 75 61 6c 3f 20 22 43 4f 4d 50 4c 45 54 45  equal? "COMPLETE
35c0: 44 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  D" (db:test-get-
35d0: 73 74 61 74 65 20 74 29 29 29 29 29 0a 09 09 09  state t)))))....
35e0: 09 09 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65  ..prereqs-not-me
35f0: 74 29 29 29 0a 09 09 20 28 70 72 65 74 74 79 2d  t)))... (pretty-
3600: 73 74 72 69 6e 67 20 28 6c 61 6d 62 64 61 20 28  string (lambda (
3610: 6c 73 74 29 0a 09 09 09 09 20 20 28 6d 61 70 20  lst).....  (map 
3620: 28 6c 61 6d 62 64 61 20 28 74 29 0a 09 09 09 09  (lambda (t).....
3630: 09 20 28 69 66 20 28 73 74 72 69 6e 67 3f 20 74  . (if (string? t
3640: 29 0a 09 09 09 09 09 20 20 20 20 20 74 0a 09 09  )......     t...
3650: 09 09 09 20 20 20 20 20 28 63 6f 6e 63 20 28 64  ...     (conc (d
3660: 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e  b:test-get-testn
3670: 61 6d 65 20 74 29 20 22 3a 22 20 28 64 62 3a 74  ame t) ":" (db:t
3680: 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74 29  est-get-state t)
3690: 20 22 2f 22 20 28 64 62 3a 74 65 73 74 2d 67 65   "/" (db:test-ge
36a0: 74 2d 73 74 61 74 75 73 20 74 29 29 29 29 0a 09  t-status t))))..
36b0: 09 09 09 20 20 20 20 20 20 20 6c 73 74 29 29 29  ...       lst)))
36c0: 29 0a 09 20 20 20 20 28 64 65 62 75 67 3a 70 72  )..    (debug:pr
36d0: 69 6e 74 20 36 0a 09 09 09 20 22 69 74 65 6d 64  int 6.... "itemd
36e0: 61 74 3a 20 20 20 20 20 22 20 69 74 65 6d 64 61  at:     " itemda
36f0: 74 0a 09 09 09 20 22 5c 6e 20 20 69 74 65 6d 73  t.... "\n  items
3700: 3a 20 20 20 20 20 22 20 69 74 65 6d 73 0a 09 09  :     " items...
3710: 09 20 22 5c 6e 20 20 69 74 65 6d 2d 70 61 74 68  . "\n  item-path
3720: 3a 20 22 20 69 74 65 6d 2d 70 61 74 68 0a 09 09  : " item-path...
3730: 09 20 22 5c 6e 20 20 77 61 69 74 6f 6e 73 3a 20  . "\n  waitons: 
3740: 20 20 22 20 77 61 69 74 6f 6e 73 29 0a 0a 09 20    " waitons)... 
3750: 20 20 20 3b 3b 20 63 68 65 63 6b 20 66 6f 72 20     ;; check for 
3760: 68 65 64 20 69 6e 20 77 61 69 74 6f 6e 73 20 3d  hed in waitons =
3770: 3e 20 74 68 69 73 20 77 6f 75 6c 64 20 62 65 20  > this would be 
3780: 63 69 72 63 75 6c 61 72 2c 20 72 65 6d 6f 76 65  circular, remove
3790: 20 69 74 20 61 6e 64 20 69 73 73 75 65 20 61 6e   it and issue an
37a0: 0a 09 20 20 20 20 3b 3b 20 65 72 72 6f 72 0a 09  ..    ;; error..
37b0: 20 20 20 20 28 69 66 20 28 6d 65 6d 62 65 72 20      (if (member 
37c0: 68 65 64 20 77 61 69 74 6f 6e 73 29 0a 09 09 28  hed waitons)...(
37d0: 62 65 67 69 6e 0a 09 09 20 20 28 64 65 62 75 67  begin...  (debug
37e0: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a  :print 0 "ERROR:
37f0: 20 74 65 73 74 20 22 20 68 65 64 20 22 20 68 61   test " hed " ha
3800: 73 20 6c 69 73 74 65 64 20 69 74 73 65 6c 66 20  s listed itself 
3810: 61 73 20 61 20 77 61 69 74 6f 6e 2c 20 70 6c 65  as a waiton, ple
3820: 61 73 65 20 63 6f 72 72 65 63 74 20 74 68 69 73  ase correct this
3830: 21 22 29 0a 09 09 20 20 28 73 65 74 21 20 77 61  !")...  (set! wa
3840: 69 74 6f 6e 20 28 66 69 6c 74 65 72 20 28 6c 61  iton (filter (la
3850: 6d 62 64 61 20 28 78 29 28 6e 6f 74 20 28 65 71  mbda (x)(not (eq
3860: 75 61 6c 3f 20 78 20 68 65 64 29 29 29 20 77 61  ual? x hed))) wa
3870: 69 74 6f 6e 73 29 29 29 29 0a 0a 09 20 20 20 20  itons))))...    
3880: 28 63 6f 6e 64 0a 09 20 20 20 20 20 28 28 6e 6f  (cond..     ((no
3890: 74 20 69 74 65 6d 73 29 20 3b 3b 20 77 68 65 6e  t items) ;; when
38a0: 20 66 61 6c 73 65 20 74 68 65 20 74 65 73 74 20   false the test 
38b0: 69 73 20 6f 6b 20 74 6f 20 62 65 20 68 61 6e 64  is ok to be hand
38c0: 65 64 20 6f 66 66 20 74 6f 20 6c 61 75 6e 63 68  ed off to launch
38d0: 20 28 62 75 74 20 6e 6f 74 20 62 65 66 6f 72 65   (but not before
38e0: 29 0a 09 20 20 20 20 20 20 28 6c 65 74 2a 20 28  )..      (let* (
38f0: 28 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 20  (have-resources 
3900: 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d   (runs:can-run-m
3910: 6f 72 65 2d 74 65 73 74 73 20 64 62 20 74 65 73  ore-tests db tes
3920: 74 2d 72 65 63 6f 72 64 29 29 20 3b 3b 20 6c 6f  t-record)) ;; lo
3930: 6f 6b 20 61 74 20 74 68 65 20 74 65 73 74 20 6a  ok at the test j
3940: 6f 62 67 72 6f 75 70 20 61 6e 64 20 74 6f 74 20  obgroup and tot 
3950: 6a 6f 62 73 20 72 75 6e 6e 69 6e 67 0a 09 09 20  jobs running... 
3960: 20 20 20 20 28 70 72 65 72 65 71 73 2d 6e 6f 74      (prereqs-not
3970: 2d 6d 65 74 20 28 64 62 3a 67 65 74 2d 70 72 65  -met (db:get-pre
3980: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 64 62 20  reqs-not-met db 
3990: 72 75 6e 2d 69 64 20 77 61 69 74 6f 6e 73 20 69  run-id waitons i
39a0: 74 65 6d 2d 70 61 74 68 20 6d 6f 64 65 3a 20 74  tem-path mode: t
39b0: 65 73 74 6d 6f 64 65 29 29 0a 09 09 20 20 20 20  estmode))...    
39c0: 20 28 66 61 69 6c 73 20 20 20 20 20 20 20 20 20   (fails         
39d0: 20 20 28 63 61 6c 63 2d 66 61 69 6c 73 20 70 72    (calc-fails pr
39e0: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a  ereqs-not-met)).
39f0: 09 09 20 20 20 20 20 28 6e 6f 6e 2d 63 6f 6d 70  ..     (non-comp
3a00: 6c 65 74 65 64 20 20 20 28 63 61 6c 63 2d 6e 6f  leted   (calc-no
3a10: 74 2d 63 6f 6d 70 6c 65 74 65 64 20 70 72 65 72  t-completed prer
3a20: 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a 09  eqs-not-met)))..
3a30: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 38 20  .(debug:print 8 
3a40: 22 49 4e 46 4f 3a 20 68 61 76 65 2d 72 65 73 6f  "INFO: have-reso
3a50: 75 72 63 65 73 3a 20 22 20 68 61 76 65 2d 72 65  urces: " have-re
3a60: 73 6f 75 72 63 65 73 20 22 20 70 72 65 72 65 71  sources " prereq
3a70: 73 2d 6e 6f 74 2d 6d 65 74 3a 20 22 20 0a 09 09  s-not-met: " ...
3a80: 09 20 20 20 20 20 28 73 74 72 69 6e 67 2d 69 6e  .     (string-in
3a90: 74 65 72 73 70 65 72 73 65 20 0a 09 09 09 20 20  tersperse ....  
3aa0: 20 20 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 61      (map (lambda
3ab0: 20 28 74 29 0a 09 09 09 09 20 20 20 20 20 28 63   (t).....     (c
3ac0: 6f 6e 63 20 28 64 62 3a 74 65 73 74 2d 67 65 74  onc (db:test-get
3ad0: 2d 73 74 61 74 65 20 74 29 22 2f 22 28 64 62 3a  -state t)"/"(db:
3ae0: 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73 20  test-get-status 
3af0: 74 29 29 29 0a 09 09 09 09 20 20 20 70 72 65 72  t))).....   prer
3b00: 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 20 22 2c 20  eqs-not-met) ", 
3b10: 22 29 20 22 20 66 61 69 6c 73 3a 20 22 20 66 61  ") " fails: " fa
3b20: 69 6c 73 29 0a 09 09 3b 3b 20 44 6f 6e 27 74 20  ils)...;; Don't 
3b30: 6b 6e 6f 77 20 61 74 20 74 68 69 73 20 74 69 6d  know at this tim
3b40: 65 20 69 66 20 74 68 65 20 74 65 73 74 20 68 61  e if the test ha
3b50: 76 65 20 62 65 65 6e 20 6c 61 75 6e 63 68 65 64  ve been launched
3b60: 20 61 74 20 73 6f 6d 65 20 74 69 6d 65 20 69 6e   at some time in
3b70: 20 74 68 65 20 70 61 73 74 0a 09 09 3b 3b 20 69   the past...;; i
3b80: 2e 65 2e 20 69 73 20 74 68 69 73 20 61 20 72 65  .e. is this a re
3b90: 2d 6c 61 75 6e 63 68 3f 0a 09 09 28 63 6f 6e 64  -launch?...(cond
3ba0: 0a 09 09 20 28 28 61 6e 64 20 68 61 76 65 2d 72  ... ((and have-r
3bb0: 65 73 6f 75 72 63 65 73 0a 09 09 20 20 20 20 20  esources...     
3bc0: 20 20 28 6f 72 20 28 6e 75 6c 6c 3f 20 70 72 65    (or (null? pre
3bd0: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09  reqs-not-met)...
3be0: 09 20 20 20 28 61 6e 64 20 28 65 71 3f 20 74 65  .   (and (eq? te
3bf0: 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c  stmode 'toplevel
3c00: 29 0a 09 09 09 09 28 6e 75 6c 6c 3f 20 6e 6f 6e  ).....(null? non
3c10: 2d 63 6f 6d 70 6c 65 74 65 64 29 29 29 29 0a 09  -completed))))..
3c20: 09 20 20 3b 3b 20 6e 6f 20 6c 6f 6f 70 20 68 65  .  ;; no loop he
3c30: 72 65 2c 20 6a 75 73 74 20 64 72 6f 70 20 74 68  re, just drop th
3c40: 6f 75 67 68 20 61 6e 64 20 75 73 65 20 74 68 65  ough and use the
3c50: 20 6c 6f 6f 70 20 61 74 20 74 68 65 20 62 6f 74   loop at the bot
3c60: 74 6f 6d 20 0a 09 09 20 20 28 69 66 20 28 70 61  tom ...  (if (pa
3c70: 74 74 2d 6c 69 73 74 2d 6d 61 74 63 68 20 69 74  tt-list-match it
3c80: 65 6d 2d 70 61 74 68 20 69 74 65 6d 2d 70 61 74  em-path item-pat
3c90: 74 73 29 0a 09 09 20 20 20 20 20 20 28 72 75 6e  ts)...      (run
3ca0: 3a 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20  :test db run-id 
3cb0: 72 75 6e 6e 61 6d 65 20 6b 65 79 76 61 6c 6c 73  runname keyvalls
3cc0: 74 20 74 65 73 74 2d 72 65 63 6f 72 64 20 66 6c  t test-record fl
3cd0: 61 67 73 20 23 66 29 0a 09 09 20 20 20 20 20 20  ags #f)...      
3ce0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22  (debug:print 1 "
3cf0: 49 4e 46 4f 3a 20 53 6b 69 70 70 69 6e 67 20 22  INFO: Skipping "
3d00: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75   (tests:testqueu
3d10: 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74  e-get-testname t
3d20: 65 73 74 2d 72 65 63 6f 72 64 29 20 22 20 22 20  est-record) " " 
3d30: 69 74 65 6d 2d 70 61 74 68 20 22 20 61 73 20 69  item-path " as i
3d40: 74 20 64 6f 65 73 6e 27 74 20 6d 61 74 63 68 20  t doesn't match 
3d50: 22 20 69 74 65 6d 2d 70 61 74 74 73 29 29 0a 09  " item-patts))..
3d60: 09 20 20 3b 3b 20 65 6c 73 65 20 74 68 65 20 72  .  ;; else the r
3d70: 75 6e 20 69 73 20 73 74 75 63 6b 2c 20 74 65 6d  un is stuck, tem
3d80: 70 6f 72 61 72 69 6c 79 20 6f 72 20 70 65 72 6d  porarily or perm
3d90: 61 6e 65 6e 74 6c 79 0a 09 09 20 20 3b 3b 20 62  anently...  ;; b
3da0: 75 74 20 73 68 6f 75 6c 64 20 63 68 65 63 6b 20  ut should check 
3db0: 69 66 20 69 74 20 69 73 20 64 75 65 20 74 6f 20  if it is due to 
3dc0: 6c 61 63 6b 20 6f 66 20 72 65 73 6f 75 72 63 65  lack of resource
3dd0: 73 20 76 73 2e 20 70 72 65 72 65 71 75 69 73 69  s vs. prerequisi
3de0: 74 65 73 0a 09 09 20 20 29 0a 09 09 20 28 28 6e  tes...  )... ((n
3df0: 6f 74 20 68 61 76 65 2d 72 65 73 6f 75 72 63 65  ot have-resource
3e00: 73 29 20 3b 3b 20 73 69 6d 70 6c 79 20 74 72 79  s) ;; simply try
3e10: 20 61 67 61 69 6e 20 61 66 74 65 72 20 77 61 69   again after wai
3e20: 74 69 6e 67 20 61 20 73 65 63 6f 6e 64 0a 09 09  ting a second...
3e30: 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21    (thread-sleep!
3e40: 20 31 2e 30 29 0a 09 09 20 20 28 64 65 62 75 67   1.0)...  (debug
3e50: 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20  :print 1 "INFO: 
3e60: 6e 6f 20 72 65 73 6f 75 72 63 65 73 20 74 6f 20  no resources to 
3e70: 72 75 6e 20 6e 65 77 20 74 65 73 74 73 2c 20 77  run new tests, w
3e80: 61 69 74 69 6e 67 20 2e 2e 2e 22 29 0a 09 09 20  aiting ...")... 
3e90: 20 3b 3b 20 63 6f 75 6c 64 20 68 61 76 65 20 64   ;; could have d
3ea0: 6f 6e 65 20 68 65 64 20 74 61 6c 20 68 65 72 65  one hed tal here
3eb0: 20 62 75 74 20 64 6f 69 6e 67 20 63 61 72 2f 63   but doing car/c
3ec0: 64 72 20 6f 66 20 6e 65 77 74 61 6c 20 74 6f 20  dr of newtal to 
3ed0: 72 6f 74 61 74 65 20 74 65 73 74 73 0a 09 09 20  rotate tests... 
3ee0: 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74   (loop (car newt
3ef0: 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 29  al)(cdr newtal))
3f00: 29 0a 09 09 20 28 65 6c 73 65 20 3b 3b 20 6d 75  )... (else ;; mu
3f10: 73 74 20 62 65 20 77 65 20 68 61 76 65 20 75 6e  st be we have un
3f20: 6d 65 74 20 70 72 65 72 65 71 75 69 73 69 74 65  met prerequisite
3f30: 73 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70  s...    (debug:p
3f40: 72 69 6e 74 20 34 20 22 46 41 49 4c 53 3a 20 22  rint 4 "FAILS: "
3f50: 20 66 61 69 6c 73 29 0a 09 09 20 20 20 20 3b 3b   fails)...    ;;
3f60: 20 49 66 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 20   If one or more 
3f70: 6f 66 20 74 68 65 20 70 72 65 72 65 71 73 2d 6e  of the prereqs-n
3f80: 6f 74 2d 6d 65 74 20 61 72 65 20 46 41 49 4c 20  ot-met are FAIL 
3f90: 74 68 65 6e 20 77 65 20 63 61 6e 20 69 73 73 75  then we can issu
3fa0: 65 0a 09 09 20 20 20 20 3b 3b 20 61 20 6d 65 73  e...    ;; a mes
3fb0: 73 61 67 65 20 61 6e 64 20 64 72 6f 70 20 68 65  sage and drop he
3fc0: 64 20 66 72 6f 6d 20 74 68 65 20 69 74 65 6d 73  d from the items
3fd0: 20 74 6f 20 62 65 20 70 72 6f 63 65 73 73 65 64   to be processed
3fe0: 2e 0a 09 09 20 20 20 20 28 69 66 20 28 6e 75 6c  ....    (if (nul
3ff0: 6c 3f 20 66 61 69 6c 73 29 0a 09 09 09 28 62 65  l? fails)....(be
4000: 67 69 6e 0a 09 09 09 20 20 3b 3b 20 63 6f 75 6c  gin....  ;; coul
4010: 64 6e 27 74 20 72 75 6e 2c 20 74 61 6b 65 20 61  dn't run, take a
4020: 20 62 72 65 61 74 68 65 72 0a 09 09 09 20 20 28   breather....  (
4030: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49  debug:print 4 "I
4040: 4e 46 4f 3a 20 53 68 6f 75 6c 64 6e 27 74 20 72  NFO: Shouldn't r
4050: 65 61 6c 6c 79 20 67 65 74 20 68 65 72 65 2c 20  eally get here, 
4060: 72 61 63 65 20 63 6f 6e 64 69 74 69 6f 6e 3f 20  race condition? 
4070: 55 6e 61 62 6c 65 20 74 6f 20 6c 61 75 6e 63 68  Unable to launch
4080: 20 6d 6f 72 65 20 74 65 73 74 73 20 61 74 20 74   more tests at t
4090: 68 69 73 20 6d 6f 6d 65 6e 74 2c 20 6b 69 6c 6c  his moment, kill
40a0: 69 6e 67 20 74 69 6d 65 20 2e 2e 2e 22 29 0a 09  ing time ...")..
40b0: 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65  ..  (thread-slee
40c0: 70 21 20 30 2e 31 29 20 3b 3b 20 6c 6f 6e 67 20  p! 0.1) ;; long 
40d0: 73 6c 65 65 70 20 68 65 72 65 20 2d 20 6e 6f 20  sleep here - no 
40e0: 72 65 73 6f 75 72 63 65 73 2c 20 6d 61 79 20 61  resources, may a
40f0: 73 20 77 65 6c 6c 20 62 65 20 70 61 74 69 65 6e  s well be patien
4100: 74 0a 09 09 09 20 20 3b 3b 20 77 65 20 6d 61 64  t....  ;; we mad
4110: 65 20 6e 65 77 20 74 61 6c 20 62 79 20 73 74 69  e new tal by sti
4120: 63 6b 69 6e 67 20 68 65 64 20 61 74 20 74 68 65  cking hed at the
4130: 20 62 61 63 6b 20 6f 66 20 74 68 65 20 6c 69 73   back of the lis
4140: 74 0a 09 09 09 20 20 28 6c 6f 6f 70 20 28 63 61  t....  (loop (ca
4150: 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65  r newtal)(cdr ne
4160: 77 74 61 6c 29 29 29 0a 09 09 09 3b 3b 20 74 68  wtal)))....;; th
4170: 65 20 77 61 69 74 6f 6e 20 69 73 20 46 41 49 4c  e waiton is FAIL
4180: 20 73 6f 20 6e 6f 20 70 6f 69 6e 74 20 69 6e 20   so no point in 
4190: 74 72 79 69 6e 67 20 74 6f 20 72 75 6e 20 68 65  trying to run he
41a0: 64 20 65 76 65 72 20 61 67 61 69 6e 0a 09 09 09  d ever again....
41b0: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20  (if (not (null? 
41c0: 74 61 6c 29 29 0a 09 09 09 20 20 20 20 28 62 65  tal))....    (be
41d0: 67 69 6e 0a 09 09 09 20 20 20 20 20 20 28 64 65  gin....      (de
41e0: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 57 41 52  bug:print 1 "WAR
41f0: 4e 3a 20 44 72 6f 70 70 69 6e 67 20 74 65 73 74  N: Dropping test
4200: 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d   " (db:test-get-
4210: 74 65 73 74 2d 6e 61 6d 65 20 68 65 64 29 20 22  test-name hed) "
4220: 2f 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  /" (db:test-get-
4230: 69 74 65 6d 2d 70 61 74 68 20 68 65 64 29 0a 09  item-path hed)..
4240: 09 09 09 09 20 20 20 22 20 66 72 6f 6d 20 74 68  ....   " from th
4250: 65 20 6c 61 75 6e 63 68 20 6c 69 73 74 20 61 73  e launch list as
4260: 20 69 74 20 68 61 73 20 70 72 65 72 65 71 75 69   it has prerequi
4270: 73 74 65 73 20 74 68 61 74 20 61 72 65 20 46 41  stes that are FA
4280: 49 4c 22 29 0a 09 09 09 20 20 20 20 20 20 28 6c  IL")....      (l
4290: 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63 64  oop (car tal)(cd
42a0: 72 20 74 61 6c 29 29 29 29 29 29 29 29 29 0a 09  r tal)))))))))..
42b0: 20 20 20 20 20 0a 09 20 20 20 20 20 3b 3b 20 63       ..     ;; c
42c0: 61 73 65 20 77 68 65 72 65 20 61 6e 20 69 74 65  ase where an ite
42d0: 6d 73 20 63 61 6d 65 20 69 6e 20 61 73 20 61 20  ms came in as a 
42e0: 6c 69 73 74 20 62 65 65 6e 20 70 72 6f 63 65 73  list been proces
42f0: 73 65 64 0a 09 20 20 20 20 20 28 28 61 6e 64 20  sed..     ((and 
4300: 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 20 20  (list? items)   
4310: 20 20 3b 3b 20 74 68 75 73 20 77 65 20 6b 6e 6f    ;; thus we kno
4320: 77 20 6f 75 72 20 69 74 65 6d 73 20 61 72 65 20  w our items are 
4330: 61 6c 72 65 61 64 79 20 63 61 6c 63 75 6c 61 74  already calculat
4340: 65 64 0a 09 09 20 20 20 28 6e 6f 74 20 20 20 69  ed...   (not   i
4350: 74 65 6d 64 61 74 29 29 20 3b 3b 20 61 6e 64 20  temdat)) ;; and 
4360: 6e 6f 74 20 79 65 74 20 65 78 70 61 6e 64 65 64  not yet expanded
4370: 20 69 6e 74 6f 20 74 68 65 20 6c 69 73 74 20 6f   into the list o
4380: 66 20 74 68 69 6e 67 73 20 74 6f 20 62 65 20 64  f things to be d
4390: 6f 6e 65 0a 09 20 20 20 20 20 20 28 69 66 20 28  one..      (if (
43a0: 61 6e 64 20 28 3e 3d 20 2a 76 65 72 62 6f 73 69  and (>= *verbosi
43b0: 74 79 2a 20 31 29 0a 09 09 20 20 20 20 20 20 20  ty* 1)...       
43c0: 28 3e 20 28 6c 65 6e 67 74 68 20 69 74 65 6d 73  (> (length items
43d0: 29 20 30 29 0a 09 09 20 20 20 20 20 20 20 28 3e  ) 0)...       (>
43e0: 20 28 6c 65 6e 67 74 68 20 28 63 61 72 20 69 74   (length (car it
43f0: 65 6d 73 29 29 20 30 29 29 0a 09 09 20 20 28 70  ems)) 0))...  (p
4400: 70 20 69 74 65 6d 73 29 29 0a 09 20 20 20 20 20  p items))..     
4410: 20 3b 3b 20 28 69 66 20 28 3e 3d 20 2a 76 65 72   ;; (if (>= *ver
4420: 62 6f 73 69 74 79 2a 20 35 29 0a 09 20 20 20 20  bosity* 5)..    
4430: 20 20 3b 3b 20 20 20 20 20 28 62 65 67 69 6e 0a    ;;     (begin.
4440: 09 20 20 20 20 20 20 3b 3b 20 20 20 20 20 20 20  .      ;;       
4450: 28 70 72 69 6e 74 20 22 69 74 65 6d 73 3a 20 22  (print "items: "
4460: 29 20 20 20 20 20 28 70 70 20 28 69 74 65 6d 2d  )     (pp (item-
4470: 61 73 73 6f 63 2d 3e 69 74 65 6d 2d 6c 69 73 74  assoc->item-list
4480: 20 69 74 65 6d 73 29 29 0a 09 20 20 20 20 20 20   items))..      
4490: 3b 3b 20 20 20 20 20 20 20 28 70 72 69 6e 74 20  ;;       (print 
44a0: 22 69 74 65 6d 73 74 61 62 6c 65 3a 20 22 29 28  "itemstable: ")(
44b0: 70 70 20 28 69 74 65 6d 2d 74 61 62 6c 65 2d 3e  pp (item-table->
44c0: 69 74 65 6d 2d 6c 69 73 74 20 69 74 65 6d 73 74  item-list itemst
44d0: 61 62 6c 65 29 29 29 29 0a 09 20 20 20 20 20 20  able))))..      
44e0: 28 66 6f 72 2d 65 61 63 68 0a 09 20 20 20 20 20  (for-each..     
44f0: 20 20 28 6c 61 6d 62 64 61 20 28 6d 79 2d 69 74    (lambda (my-it
4500: 65 6d 64 61 74 29 0a 09 09 20 28 6c 65 74 2a 20  emdat)... (let* 
4510: 28 28 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72  ((new-test-recor
4520: 64 20 28 6c 65 74 20 28 28 6e 65 77 72 65 63 20  d (let ((newrec 
4530: 28 6d 61 6b 65 2d 74 65 73 74 73 3a 74 65 73 74  (make-tests:test
4540: 71 75 65 75 65 29 29 29 0a 09 09 09 09 09 20 20  queue)))......  
4550: 20 28 76 65 63 74 6f 72 2d 63 6f 70 79 21 20 74   (vector-copy! t
4560: 65 73 74 2d 72 65 63 6f 72 64 20 6e 65 77 72 65  est-record newre
4570: 63 29 0a 09 09 09 09 09 20 20 20 6e 65 77 72 65  c)......   newre
4580: 63 29 29 0a 09 09 09 28 6d 79 2d 69 74 65 6d 2d  c))....(my-item-
4590: 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d  path (item-list-
45a0: 3e 70 61 74 68 20 6d 79 2d 69 74 65 6d 64 61 74  >path my-itemdat
45b0: 29 29 29 0a 09 09 20 20 20 28 69 66 20 28 70 61  )))...   (if (pa
45c0: 74 74 2d 6c 69 73 74 2d 6d 61 74 63 68 20 6d 79  tt-list-match my
45d0: 2d 69 74 65 6d 2d 70 61 74 68 20 69 74 65 6d 2d  -item-path item-
45e0: 70 61 74 74 73 29 20 20 20 20 20 20 20 20 20 20  patts)          
45f0: 20 3b 3b 20 79 65 73 2c 20 77 65 20 77 61 6e 74   ;; yes, we want
4600: 20 74 6f 20 70 72 6f 63 65 73 73 20 74 68 69 73   to process this
4610: 20 69 74 65 6d 2c 20 4e 4f 54 45 3a 20 53 68 6f   item, NOTE: Sho
4620: 75 6c 64 20 6e 6f 74 20 6e 65 65 64 20 74 68 69  uld not need thi
4630: 73 20 63 68 65 63 6b 20 68 65 72 65 21 0a 09 09  s check here!...
4640: 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 6e 65         (let ((ne
4650: 77 74 65 73 74 6e 61 6d 65 20 28 63 6f 6e 63 20  wtestname (conc 
4660: 68 65 64 20 22 2f 22 20 6d 79 2d 69 74 65 6d 2d  hed "/" my-item-
4670: 70 61 74 68 29 29 29 20 20 20 20 3b 3b 20 74 65  path)))    ;; te
4680: 73 74 20 6e 61 6d 65 73 20 61 72 65 20 75 6e 69  st names are uni
4690: 71 75 65 20 6f 6e 20 74 65 73 74 6e 61 6d 65 2f  que on testname/
46a0: 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 20 28 74  item-path.... (t
46b0: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 73  ests:testqueue-s
46c0: 65 74 2d 69 74 65 6d 73 21 20 20 20 20 20 6e 65  et-items!     ne
46d0: 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 23 66  w-test-record #f
46e0: 29 0a 09 09 09 20 28 74 65 73 74 73 3a 74 65 73  ).... (tests:tes
46f0: 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 64  tqueue-set-itemd
4700: 61 74 21 20 20 20 6e 65 77 2d 74 65 73 74 2d 72  at!   new-test-r
4710: 65 63 6f 72 64 20 6d 79 2d 69 74 65 6d 64 61 74  ecord my-itemdat
4720: 29 0a 09 09 09 20 28 74 65 73 74 73 3a 74 65 73  ).... (tests:tes
4730: 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 5f  tqueue-set-item_
4740: 70 61 74 68 21 20 6e 65 77 2d 74 65 73 74 2d 72  path! new-test-r
4750: 65 63 6f 72 64 20 6d 79 2d 69 74 65 6d 2d 70 61  ecord my-item-pa
4760: 74 68 29 0a 09 09 09 20 28 68 61 73 68 2d 74 61  th).... (hash-ta
4770: 62 6c 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65  ble-set! test-re
4780: 63 6f 72 64 73 20 6e 65 77 74 65 73 74 6e 61 6d  cords newtestnam
4790: 65 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72  e new-test-recor
47a0: 64 29 0a 09 09 09 20 28 73 65 74 21 20 74 61 6c  d).... (set! tal
47b0: 20 28 63 6f 6e 73 20 6e 65 77 74 65 73 74 6e 61   (cons newtestna
47c0: 6d 65 20 74 61 6c 29 29 29 29 29 29 20 3b 3b 20  me tal)))))) ;; 
47d0: 73 69 6e 63 65 20 74 68 65 73 65 20 61 72 65 20  since these are 
47e0: 69 74 65 6d 69 7a 65 64 20 63 72 65 61 74 65 20  itemized create 
47f0: 6e 65 77 20 74 65 73 74 20 6e 61 6d 65 73 20 74  new test names t
4800: 65 73 74 6e 61 6d 65 2f 69 74 65 6d 70 61 74 68  estname/itempath
4810: 0a 09 20 20 20 20 20 20 20 69 74 65 6d 73 29 0a  ..       items).
4820: 09 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20  .      (if (not 
4830: 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 20  (null? tal))... 
4840: 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29   (loop (car tal)
4850: 28 63 64 72 20 74 61 6c 29 29 29 29 0a 0a 09 20  (cdr tal))))... 
4860: 20 20 20 20 3b 3b 20 69 66 20 69 74 65 6d 73 20      ;; if items 
4870: 69 73 20 61 20 70 72 6f 63 20 74 68 65 6e 20 6e  is a proc then n
4880: 65 65 64 20 74 6f 20 72 75 6e 20 69 74 65 6d 73  eed to run items
4890: 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d  :get-items-from-
48a0: 63 6f 6e 66 69 67 2c 20 67 65 74 20 74 68 65 20  config, get the 
48b0: 6c 69 73 74 20 61 6e 64 20 6c 6f 6f 70 20 0a 09  list and loop ..
48c0: 20 20 20 20 20 3b 3b 20 20 20 20 2d 20 62 75 74       ;;    - but
48d0: 20 6f 6e 6c 79 20 64 6f 20 74 68 61 74 20 69 66   only do that if
48e0: 20 72 65 73 6f 75 72 63 65 73 20 65 78 69 73 74   resources exist
48f0: 20 74 6f 20 6b 69 63 6b 20 6f 66 66 20 74 68 65   to kick off the
4900: 20 6a 6f 62 0a 09 20 20 20 20 20 28 28 6f 72 20   job..     ((or 
4910: 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d  (procedure? item
4920: 73 29 28 65 71 3f 20 69 74 65 6d 73 20 27 68 61  s)(eq? items 'ha
4930: 76 65 2d 70 72 6f 63 65 64 75 72 65 29 29 0a 09  ve-procedure))..
4940: 20 20 20 20 20 20 28 6c 65 74 20 28 28 63 61 6e        (let ((can
4950: 2d 72 75 6e 2d 6d 6f 72 65 20 20 20 20 28 72 75  -run-more    (ru
4960: 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d  ns:can-run-more-
4970: 74 65 73 74 73 20 64 62 20 74 65 73 74 2d 72 65  tests db test-re
4980: 63 6f 72 64 29 29 29 0a 09 09 28 69 66 20 63 61  cord)))...(if ca
4990: 6e 2d 72 75 6e 2d 6d 6f 72 65 0a 09 09 20 20 20  n-run-more...   
49a0: 20 28 6c 65 74 2a 20 28 28 70 72 65 72 65 71 73   (let* ((prereqs
49b0: 2d 6e 6f 74 2d 6d 65 74 20 28 64 62 3a 67 65 74  -not-met (db:get
49c0: 2d 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74  -prereqs-not-met
49d0: 20 64 62 20 72 75 6e 2d 69 64 20 77 61 69 74 6f   db run-id waito
49e0: 6e 73 20 69 74 65 6d 2d 70 61 74 68 20 6d 6f 64  ns item-path mod
49f0: 65 3a 20 74 65 73 74 6d 6f 64 65 29 29 0a 09 09  e: testmode))...
4a00: 09 20 20 20 28 66 61 69 6c 73 20 20 20 20 20 20  .   (fails      
4a10: 20 20 20 20 20 28 63 61 6c 63 2d 66 61 69 6c 73       (calc-fails
4a20: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74   prereqs-not-met
4a30: 29 29 0a 09 09 09 20 20 20 28 6e 6f 6e 2d 63 6f  ))....   (non-co
4a40: 6d 70 6c 65 74 65 64 20 20 20 28 63 61 6c 63 2d  mpleted   (calc-
4a50: 6e 6f 74 2d 63 6f 6d 70 6c 65 74 65 64 20 70 72  not-completed pr
4a60: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 29  ereqs-not-met)))
4a70: 0a 09 09 20 20 20 20 20 20 28 64 65 62 75 67 3a  ...      (debug:
4a80: 70 72 69 6e 74 20 38 20 22 49 4e 46 4f 3a 20 63  print 8 "INFO: c
4a90: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 3a 20 22 20 63  an-run-more: " c
4aa0: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 0a 09 09 09 09  an-run-more.....
4ab0: 20 20 20 22 5c 6e 20 70 72 65 72 65 71 73 2d 6e     "\n prereqs-n
4ac0: 6f 74 2d 6d 65 74 3a 20 22 20 28 70 72 65 74 74  ot-met: " (prett
4ad0: 79 2d 73 74 72 69 6e 67 20 70 72 65 72 65 71 73  y-string prereqs
4ae0: 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09 09 09 20 20  -not-met).....  
4af0: 20 22 5c 6e 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74   "\n non-complet
4b00: 65 64 3a 20 20 20 22 20 28 70 72 65 74 74 79 2d  ed:   " (pretty-
4b10: 73 74 72 69 6e 67 20 6e 6f 6e 2d 63 6f 6d 70 6c  string non-compl
4b20: 65 74 65 64 29 20 0a 09 09 09 09 20 20 20 22 5c  eted) .....   "\
4b30: 6e 20 66 61 69 6c 73 3a 20 20 20 20 20 20 20 20  n fails:        
4b40: 20 20 20 22 20 28 70 72 65 74 74 79 2d 73 74 72     " (pretty-str
4b50: 69 6e 67 20 66 61 69 6c 73 29 0a 09 09 09 09 20  ing fails)..... 
4b60: 20 20 22 5c 6e 20 74 65 73 74 6d 6f 64 65 3a 20    "\n testmode: 
4b70: 20 20 20 20 20 20 20 22 20 74 65 73 74 6d 6f 64         " testmod
4b80: 65 0a 09 09 09 09 20 20 20 22 5c 6e 20 28 65 71  e.....   "\n (eq
4b90: 3f 20 74 65 73 74 6d 6f 64 65 20 27 74 6f 70 6c  ? testmode 'topl
4ba0: 65 76 65 6c 29 20 22 20 28 65 71 3f 20 74 65 73  evel) " (eq? tes
4bb0: 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c 29  tmode 'toplevel)
4bc0: 0a 09 09 09 09 20 20 20 22 5c 6e 20 28 6e 75 6c  .....   "\n (nul
4bd0: 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64  l? non-completed
4be0: 29 20 20 20 20 22 20 28 6e 75 6c 6c 3f 20 6e 6f  )    " (null? no
4bf0: 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 29 0a 09 09  n-completed))...
4c00: 20 20 20 20 20 20 28 63 6f 6e 64 20 0a 09 09 20        (cond ... 
4c10: 20 20 20 20 20 20 28 28 6f 72 20 28 6e 75 6c 6c        ((or (null
4c20: 3f 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65  ? prereqs-not-me
4c30: 74 29 20 3b 3b 20 61 6c 6c 20 70 72 65 72 65 71  t) ;; all prereq
4c40: 73 20 6d 65 74 2c 20 66 69 72 65 20 6f 66 66 20  s met, fire off 
4c50: 74 68 65 20 74 65 73 74 0a 09 09 09 20 20 20 20  the test....    
4c60: 3b 3b 20 6f 72 2c 20 69 66 20 69 74 20 69 73 20  ;; or, if it is 
4c70: 61 20 27 74 6f 70 6c 65 76 65 6c 20 74 65 73 74  a 'toplevel test
4c80: 20 61 6e 64 20 61 6c 6c 20 70 72 65 72 65 71 73   and all prereqs
4c90: 20 6e 6f 74 20 6d 65 74 20 61 72 65 20 43 4f 4d   not met are COM
4ca0: 50 4c 45 54 45 44 20 74 68 65 6e 20 6c 61 75 6e  PLETED then laun
4cb0: 63 68 0a 09 09 09 20 20 20 20 28 61 6e 64 20 28  ch....    (and (
4cc0: 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 74 6f  eq? testmode 'to
4cd0: 70 6c 65 76 65 6c 29 0a 09 09 09 09 20 28 6e 75  plevel)..... (nu
4ce0: 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65  ll? non-complete
4cf0: 64 29 29 29 0a 09 09 09 28 6c 65 74 20 28 28 74  d)))....(let ((t
4d00: 65 73 74 2d 6e 61 6d 65 20 28 74 65 73 74 73 3a  est-name (tests:
4d10: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65  testqueue-get-te
4d20: 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f  stname test-reco
4d30: 72 64 29 29 29 0a 09 09 09 20 20 28 73 65 74 65  rd)))....  (sete
4d40: 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d 45  nv "MT_TEST_NAME
4d50: 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b 20  " test-name) ;; 
4d60: 0a 09 09 09 20 20 28 73 65 74 65 6e 76 20 22 4d  ....  (setenv "M
4d70: 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20 72 75 6e  T_RUNNAME"   run
4d80: 6e 61 6d 65 29 0a 09 09 09 20 20 28 73 65 74 2d  name)....  (set-
4d90: 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72  megatest-env-var
4da0: 73 20 64 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20  s db run-id) ;; 
4db0: 74 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65  these may be nee
4dc0: 64 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63  ded by the launc
4dd0: 68 69 6e 67 20 70 72 6f 63 65 73 73 0a 09 09 09  hing process....
4de0: 20 20 28 6c 65 74 20 28 28 69 74 65 6d 73 2d 6c    (let ((items-l
4df0: 69 73 74 20 28 69 74 65 6d 73 3a 67 65 74 2d 69  ist (items:get-i
4e00: 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67  tems-from-config
4e10: 20 74 63 6f 6e 66 69 67 29 29 29 0a 09 09 09 20   tconfig))).... 
4e20: 20 20 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74     (if (list? it
4e30: 65 6d 73 2d 6c 69 73 74 29 0a 09 09 09 09 28 62  ems-list).....(b
4e40: 65 67 69 6e 0a 09 09 09 09 20 20 28 74 65 73 74  egin.....  (test
4e50: 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d  s:testqueue-set-
4e60: 69 74 65 6d 73 21 20 74 65 73 74 2d 72 65 63 6f  items! test-reco
4e70: 72 64 20 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09  rd items-list)..
4e80: 09 09 09 20 20 28 6c 6f 6f 70 20 68 65 64 20 74  ...  (loop hed t
4e90: 61 6c 29 29 0a 09 09 09 09 28 62 65 67 69 6e 0a  al)).....(begin.
4ea0: 09 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 69  ....  (debug:pri
4eb0: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 54 68 65  nt 0 "ERROR: The
4ec0: 20 70 72 6f 63 20 66 72 6f 6d 20 72 65 61 64 69   proc from readi
4ed0: 6e 67 20 74 68 65 20 73 65 74 75 70 20 64 69 64  ng the setup did
4ee0: 20 6e 6f 74 20 79 69 65 6c 64 20 61 20 6c 69 73   not yield a lis
4ef0: 74 20 2d 20 70 6c 65 61 73 65 20 72 65 70 6f 72  t - please repor
4f00: 74 20 74 68 69 73 22 29 0a 09 09 09 09 20 20 28  t this").....  (
4f10: 65 78 69 74 20 31 29 29 29 29 29 29 0a 09 09 20  exit 1))))))... 
4f20: 20 20 20 20 20 20 28 28 6e 75 6c 6c 3f 20 66 61        ((null? fa
4f30: 69 6c 73 29 0a 09 09 09 28 6c 6f 6f 70 20 28 63  ils)....(loop (c
4f40: 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e  ar newtal)(cdr n
4f50: 65 77 74 61 6c 29 29 29 20 3b 3b 20 61 6e 20 69  ewtal))) ;; an i
4f60: 73 73 75 65 20 77 69 74 68 20 70 72 65 72 65 71  ssue with prereq
4f70: 73 20 6e 6f 74 20 79 65 74 20 6d 65 74 3f 0a 09  s not yet met?..
4f80: 09 20 20 20 20 20 20 20 28 28 61 6e 64 20 28 6e  .       ((and (n
4f90: 6f 74 20 28 6e 75 6c 6c 3f 20 66 61 69 6c 73 29  ot (null? fails)
4fa0: 29 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27  )(eq? testmode '
4fb0: 6e 6f 72 6d 61 6c 29 29 0a 09 09 09 28 64 65 62  normal))....(deb
4fc0: 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 4f  ug:print 1 "INFO
4fd0: 3a 20 74 65 73 74 20 22 20 20 68 65 64 20 22 20  : test "  hed " 
4fe0: 28 6d 6f 64 65 3d 22 20 74 65 73 74 6d 6f 64 65  (mode=" testmode
4ff0: 20 22 29 20 68 61 73 20 66 61 69 6c 65 64 20 70   ") has failed p
5000: 72 65 72 65 71 75 69 73 69 74 65 28 73 29 3b 20  rerequisite(s); 
5010: 22 0a 09 09 09 09 20 20 20 20 20 28 73 74 72 69  ".....     (stri
5020: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28  ng-intersperse (
5030: 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 74 29 28  map (lambda (t)(
5040: 63 6f 6e 63 20 28 64 62 3a 74 65 73 74 2d 67 65  conc (db:test-ge
5050: 74 2d 74 65 73 74 6e 61 6d 65 20 74 29 20 22 3a  t-testname t) ":
5060: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73  " (db:test-get-s
5070: 74 61 74 65 20 74 29 22 2f 22 28 64 62 3a 74 65  tate t)"/"(db:te
5080: 73 74 2d 67 65 74 2d 73 74 61 74 75 73 20 74 29  st-get-status t)
5090: 29 29 20 66 61 69 6c 73 29 20 22 2c 20 22 29 0a  )) fails) ", ").
50a0: 09 09 09 09 20 20 20 20 20 22 2c 20 72 65 6d 6f  ....     ", remo
50b0: 76 69 6e 67 20 69 74 20 66 72 6f 6d 20 74 6f 2d  ving it from to-
50c0: 64 6f 20 6c 69 73 74 22 29 0a 09 09 09 28 69 66  do list")....(if
50d0: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c   (not (null? tal
50e0: 29 29 0a 09 09 09 20 20 20 20 28 6c 6f 6f 70 20  ))....    (loop 
50f0: 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74 61  (car tal)(cdr ta
5100: 6c 29 29 29 29 0a 09 09 20 20 20 20 20 20 20 28  l))))...       (
5110: 65 6c 73 65 0a 09 09 09 28 64 65 62 75 67 3a 70  else....(debug:p
5120: 72 69 6e 74 20 38 20 22 45 52 52 4f 52 3a 20 4e  rint 8 "ERROR: N
5130: 6f 20 68 61 6e 64 6c 65 72 20 66 6f 72 20 74 68  o handler for th
5140: 69 73 20 63 6f 6e 64 69 74 69 6f 6e 2e 22 29 0a  is condition.").
5150: 09 09 09 3b 3b 20 09 20 20 20 20 20 22 5c 6e 20  ...;; .     "\n 
5160: 20 68 65 64 3a 20 20 20 20 20 20 20 20 20 20 20   hed:           
5170: 20 22 20 68 65 64 20 0a 09 09 09 3b 3b 20 09 20   " hed ....;; . 
5180: 20 20 20 20 22 5c 6e 20 66 61 69 6c 73 3a 20 20      "\n fails:  
5190: 20 20 20 20 20 20 20 20 20 22 20 28 73 74 72 69           " (stri
51a0: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28  ng-intersperse (
51b0: 6d 61 70 20 64 62 3a 74 65 73 74 2d 67 65 74 2d  map db:test-get-
51c0: 74 65 73 74 6e 61 6d 65 20 66 61 69 6c 73 29 20  testname fails) 
51d0: 22 2c 22 29 0a 09 09 09 3b 3b 20 09 20 20 20 20  ",")....;; .    
51e0: 20 22 5c 6e 20 74 65 73 74 6d 6f 64 65 3a 20 20   "\n testmode:  
51f0: 20 20 20 20 20 20 22 20 74 65 73 74 6d 6f 64 65        " testmode
5200: 0a 09 09 09 3b 3b 20 09 20 20 20 20 20 22 5c 6e  ....;; .     "\n
5210: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74   prereqs-not-met
5220: 3a 20 22 20 28 70 72 65 74 74 79 2d 73 74 72 69  : " (pretty-stri
5230: 6e 67 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d  ng prereqs-not-m
5240: 65 74 29 0a 09 09 09 3b 3b 20 09 20 20 20 20 20  et)....;; .     
5250: 22 5c 6e 20 69 74 65 6d 73 3a 20 20 20 20 20 20  "\n items:      
5260: 20 20 20 20 20 22 20 69 74 65 6d 73 29 0a 09 09       " items)...
5270: 09 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74  .(loop (car newt
5280: 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 29  al)(cdr newtal))
5290: 29 29 29 0a 09 09 20 20 20 20 3b 3b 20 69 66 20  )))...    ;; if 
52a0: 63 61 6e 27 74 20 72 75 6e 20 6d 6f 72 65 20 6a  can't run more j
52b0: 75 73 74 20 6c 6f 6f 70 20 77 69 74 68 20 6e 65  ust loop with ne
52c0: 78 74 20 70 6f 73 73 69 62 6c 65 20 74 65 73 74  xt possible test
52d0: 0a 09 09 20 20 20 20 28 6c 6f 6f 70 20 28 63 61  ...    (loop (ca
52e0: 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65  r newtal)(cdr ne
52f0: 77 74 61 6c 29 29 29 29 29 0a 09 20 20 20 20 20  wtal)))))..     
5300: 0a 09 20 20 20 20 20 3b 3b 20 74 68 69 73 20 63  ..     ;; this c
5310: 61 73 65 20 73 68 6f 75 6c 64 20 6e 6f 74 20 68  ase should not h
5320: 61 70 70 65 6e 2c 20 61 64 64 65 64 20 74 6f 20  appen, added to 
5330: 68 65 6c 70 20 63 61 74 63 68 20 61 6e 79 20 62  help catch any b
5340: 75 67 73 0a 09 20 20 20 20 20 28 28 61 6e 64 20  ugs..     ((and 
5350: 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 69 74  (list? items) it
5360: 65 6d 64 61 74 29 0a 09 20 20 20 20 20 20 28 64  emdat)..      (d
5370: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
5380: 52 4f 52 3a 20 53 68 6f 75 6c 64 20 6e 6f 74 20  ROR: Should not 
5390: 68 61 76 65 20 61 20 6c 69 73 74 20 6f 66 20 69  have a list of i
53a0: 74 65 6d 73 20 69 6e 20 61 20 74 65 73 74 20 61  tems in a test a
53b0: 6e 64 20 74 68 65 20 69 74 65 6d 73 70 61 74 68  nd the itemspath
53c0: 20 73 65 74 20 2d 20 70 6c 65 61 73 65 20 72 65   set - please re
53d0: 70 6f 72 74 20 74 68 69 73 22 29 0a 09 20 20 20  port this")..   
53e0: 20 20 20 28 65 78 69 74 20 31 29 29 29 29 0a 09     (exit 1))))..
53f0: 20 20 0a 09 20 20 3b 3b 20 77 65 20 67 65 74 20    ..  ;; we get 
5400: 68 65 72 65 20 6f 6e 20 22 64 72 6f 70 20 74 68  here on "drop th
5410: 72 6f 75 67 68 22 20 2d 20 6c 6f 6f 70 20 66 6f  rough" - loop fo
5420: 72 20 6e 65 78 74 20 74 65 73 74 20 69 6e 20 71  r next test in q
5430: 75 65 75 65 0a 09 20 20 28 69 66 20 28 6e 75 6c  ueue..  (if (nul
5440: 6c 3f 20 74 61 6c 29 0a 09 20 20 20 20 20 20 28  l? tal)..      (
5450: 62 65 67 69 6e 0a 09 09 3b 3b 20 46 49 58 4d 45  begin...;; FIXME
5460: 21 21 21 21 20 54 48 49 53 20 53 48 4f 55 4c 44  !!!! THIS SHOULD
5470: 20 4e 4f 54 20 52 45 51 55 49 52 45 20 41 4e 20   NOT REQUIRE AN 
5480: 45 58 49 54 21 21 21 21 21 21 21 0a 09 09 28 64  EXIT!!!!!!!...(d
5490: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e  ebug:print 1 "IN
54a0: 46 4f 3a 20 41 6c 6c 20 74 65 73 74 73 20 6c 61  FO: All tests la
54b0: 75 6e 63 68 65 64 22 29 0a 09 09 28 74 68 72 65  unched")...(thre
54c0: 61 64 2d 73 6c 65 65 70 21 20 30 2e 35 29 0a 09  ad-sleep! 0.5)..
54d0: 09 3b 3b 20 46 49 58 4d 45 21 20 54 68 69 73 20  .;; FIXME! This 
54e0: 68 61 72 73 68 20 65 78 69 74 20 73 68 6f 75 6c  harsh exit shoul
54f0: 64 20 6e 6f 74 20 62 65 20 6e 65 63 65 73 73 61  d not be necessa
5500: 72 79 2e 2e 2e 2e 0a 09 09 28 69 66 20 28 6e 6f  ry.......(if (no
5510: 74 20 2a 72 75 6e 72 65 6d 6f 74 65 2a 29 28 65  t *runremote*)(e
5520: 78 69 74 29 29 20 3b 3b 20 0a 09 09 23 66 29 20  xit)) ;; ...#f) 
5530: 3b 3b 20 72 65 74 75 72 6e 20 61 20 23 66 20 61  ;; return a #f a
5540: 73 20 61 20 68 69 6e 74 20 74 68 61 74 20 77 65  s a hint that we
5550: 20 61 72 65 20 64 6f 6e 65 0a 09 20 20 20 20 20   are done..     
5560: 20 3b 3b 20 48 65 72 65 20 77 65 20 6e 65 65 64   ;; Here we need
5570: 20 74 6f 20 63 68 65 63 6b 20 74 68 61 74 20 61   to check that a
5580: 6c 6c 20 74 68 65 20 74 65 73 74 73 20 72 65 6d  ll the tests rem
5590: 61 69 6e 69 6e 67 20 74 6f 20 62 65 20 72 75 6e  aining to be run
55a0: 20 61 72 65 20 65 6c 69 67 69 62 6c 65 20 74 6f   are eligible to
55b0: 20 72 75 6e 0a 09 20 20 20 20 20 20 3b 3b 20 61   run..      ;; a
55c0: 6e 64 20 61 72 65 20 6e 6f 74 20 62 6c 6f 63 6b  nd are not block
55d0: 65 64 20 62 79 20 66 61 69 6c 65 64 0a 09 20 20  ed by failed..  
55e0: 20 20 20 20 28 6c 65 74 20 28 28 6e 65 77 6c 73      (let ((newls
55f0: 74 20 28 74 65 73 74 73 3a 66 69 6c 74 65 72 2d  t (tests:filter-
5600: 6e 6f 6e 2d 72 75 6e 6e 61 62 6c 65 20 64 62 20  non-runnable db 
5610: 72 75 6e 2d 69 64 20 74 61 6c 20 74 65 73 74 2d  run-id tal test-
5620: 72 65 63 6f 72 64 73 29 29 29 20 3b 3b 20 69 2e  records))) ;; i.
5630: 65 2e 20 6e 6f 74 20 46 41 49 4c 2c 20 57 41 49  e. not FAIL, WAI
5640: 56 45 44 2c 20 49 4e 43 4f 4d 50 4c 45 54 45 2c  VED, INCOMPLETE,
5650: 20 50 41 53 53 2c 20 4b 49 4c 4c 45 44 2c 0a 09   PASS, KILLED,..
5660: 09 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20  .(thread-sleep! 
5670: 30 2e 31 29 0a 09 09 28 69 66 20 28 6e 6f 74 20  0.1)...(if (not 
5680: 28 6e 75 6c 6c 3f 20 6e 65 77 6c 73 74 29 29 0a  (null? newlst)).
5690: 09 09 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72  ..    (loop (car
56a0: 20 6e 65 77 6c 73 74 29 28 63 64 72 20 6e 65 77   newlst)(cdr new
56b0: 6c 73 74 29 29 29 29 29 29 29 29 29 0a 0a 3b 3b  lst)))))))))..;;
56c0: 20 70 61 72 65 6e 74 2d 74 65 73 74 20 69 73 20   parent-test is 
56d0: 74 68 65 72 65 20 61 73 20 61 20 70 6c 61 63 65  there as a place
56e0: 68 6f 6c 64 65 72 20 66 6f 72 20 77 68 65 6e 20  holder for when 
56f0: 70 61 72 65 6e 74 2d 74 65 73 74 73 20 63 61 6e  parent-tests can
5700: 20 62 65 20 72 75 6e 20 61 73 20 61 20 73 65 74   be run as a set
5710: 75 70 20 73 74 65 70 0a 28 64 65 66 69 6e 65 20  up step.(define 
5720: 28 72 75 6e 3a 74 65 73 74 20 64 62 20 72 75 6e  (run:test db run
5730: 2d 69 64 20 72 75 6e 6e 61 6d 65 20 6b 65 79 76  -id runname keyv
5740: 61 6c 6c 73 74 20 74 65 73 74 2d 72 65 63 6f 72  allst test-recor
5750: 64 20 66 6c 61 67 73 20 70 61 72 65 6e 74 2d 74  d flags parent-t
5760: 65 73 74 29 0a 20 20 3b 3b 20 41 6c 6c 20 74 68  est).  ;; All th
5770: 65 73 65 20 76 61 72 73 20 6d 69 67 68 74 20 62  ese vars might b
5780: 65 20 72 65 66 65 72 65 6e 63 65 64 20 62 79 20  e referenced by 
5790: 74 68 65 20 74 65 73 74 63 6f 6e 66 69 67 20 66  the testconfig f
57a0: 69 6c 65 20 72 65 61 64 65 72 0a 20 20 28 6c 65  ile reader.  (le
57b0: 74 2a 20 28 28 74 65 73 74 2d 6e 61 6d 65 20 20  t* ((test-name  
57c0: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65    (tests:testque
57d0: 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20  ue-get-testname 
57e0: 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a    test-record)).
57f0: 09 20 28 74 65 73 74 2d 77 61 69 74 6f 6e 73 20  . (test-waitons 
5800: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65  (tests:testqueue
5810: 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20 20 20 20  -get-waitons    
5820: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20  test-record)).. 
5830: 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 20 28 74  (test-conf    (t
5840: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67  ests:testqueue-g
5850: 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 74 65  et-testconfig te
5860: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 69  st-record)).. (i
5870: 74 65 6d 64 61 74 20 20 20 20 20 20 28 74 65 73  temdat      (tes
5880: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
5890: 2d 69 74 65 6d 64 61 74 20 20 20 20 74 65 73 74  -itemdat    test
58a0: 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65 73  -record)).. (tes
58b0: 74 2d 70 61 74 68 20 20 20 20 28 63 6f 6e 63 20  t-path    (conc 
58c0: 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74  *toppath* "/test
58d0: 73 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29 29 20  s/" test-name)) 
58e0: 3b 3b 20 63 6f 75 6c 64 20 75 73 65 20 74 65 73  ;; could use tes
58f0: 74 73 3a 67 65 74 2d 74 65 73 74 63 6f 6e 66 69  ts:get-testconfi
5900: 67 20 68 65 72 65 20 2e 2e 2e 0a 09 20 28 66 6f  g here ..... (fo
5910: 72 63 65 20 20 20 20 20 20 20 20 28 68 61 73 68  rce        (hash
5920: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75  -table-ref/defau
5930: 6c 74 20 66 6c 61 67 73 20 22 2d 66 6f 72 63 65  lt flags "-force
5940: 22 20 23 66 29 29 0a 09 20 28 72 65 72 75 6e 20  " #f)).. (rerun 
5950: 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 62         (hash-tab
5960: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66  le-ref/default f
5970: 6c 61 67 73 20 22 2d 72 65 72 75 6e 22 20 23 66  lags "-rerun" #f
5980: 29 29 0a 09 20 28 6b 65 65 70 67 6f 69 6e 67 20  )).. (keepgoing 
5990: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72     (hash-table-r
59a0: 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73  ef/default flags
59b0: 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 20 23 66   "-keepgoing" #f
59c0: 29 29 0a 09 20 28 69 74 65 6d 2d 70 61 74 68 20  )).. (item-path 
59d0: 20 20 20 20 22 22 29 29 0a 20 20 20 20 28 64 65      "")).    (de
59e0: 62 75 67 3a 70 72 69 6e 74 20 35 0a 09 09 20 22  bug:print 5... "
59f0: 74 65 73 74 2d 63 6f 6e 66 69 67 3a 20 22 20 28  test-config: " (
5a00: 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61 6c 69 73  hash-table->alis
5a10: 74 20 74 65 73 74 2d 63 6f 6e 66 29 0a 09 09 20  t test-conf)... 
5a20: 22 5c 6e 20 20 20 69 74 65 6d 64 61 74 3a 20 22  "\n   itemdat: "
5a30: 20 69 74 65 6d 64 61 74 0a 09 09 20 29 0a 20 20   itemdat... ).  
5a40: 20 20 3b 3b 20 73 65 74 74 69 6e 67 20 69 74 65    ;; setting ite
5a50: 6d 64 61 74 20 74 6f 20 61 20 6c 69 73 74 20 69  mdat to a list i
5a60: 66 20 69 74 20 69 73 20 23 66 0a 20 20 20 20 28  f it is #f.    (
5a70: 69 66 20 28 6e 6f 74 20 69 74 65 6d 64 61 74 29  if (not itemdat)
5a80: 28 73 65 74 21 20 69 74 65 6d 64 61 74 20 27 28  (set! itemdat '(
5a90: 29 29 29 0a 20 20 20 20 28 73 65 74 21 20 69 74  ))).    (set! it
5aa0: 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69  em-path (item-li
5ab0: 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74  st->path itemdat
5ac0: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72  )).    (debug:pr
5ad0: 69 6e 74 20 32 20 22 41 74 74 65 6d 70 74 69 6e  int 2 "Attemptin
5ae0: 67 20 74 6f 20 6c 61 75 6e 63 68 20 74 65 73 74  g to launch test
5af0: 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22   " test-name "/"
5b00: 20 69 74 65 6d 2d 70 61 74 68 29 0a 20 20 20 20   item-path).    
5b10: 28 73 65 74 65 6e 76 20 22 4d 54 5f 54 45 53 54  (setenv "MT_TEST
5b20: 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65  _NAME" test-name
5b30: 29 20 3b 3b 20 0a 20 20 20 20 28 73 65 74 65 6e  ) ;; .    (seten
5b40: 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20  v "MT_RUNNAME"  
5b50: 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20 28 73   runname).    (s
5b60: 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d  et-megatest-env-
5b70: 76 61 72 73 20 64 62 20 72 75 6e 2d 69 64 29 20  vars db run-id) 
5b80: 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62 65 20  ;; these may be 
5b90: 6e 65 65 64 65 64 20 62 79 20 74 68 65 20 6c 61  needed by the la
5ba0: 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 73 0a  unching process.
5bb0: 20 20 20 20 28 63 68 61 6e 67 65 2d 64 69 72 65      (change-dire
5bc0: 63 74 6f 72 79 20 2a 74 6f 70 70 61 74 68 2a 29  ctory *toppath*)
5bd0: 0a 0a 20 20 20 20 3b 3b 20 48 65 72 65 20 69 73  ..    ;; Here is
5be0: 20 77 68 65 72 65 20 74 68 65 20 74 65 73 74 5f   where the test_
5bf0: 6d 65 74 61 20 74 61 62 6c 65 20 69 73 20 62 65  meta table is be
5c00: 73 74 20 75 70 64 61 74 65 64 0a 20 20 20 20 3b  st updated.    ;
5c10: 3b 20 59 65 73 2c 20 61 6e 6f 74 68 65 72 20 75  ; Yes, another u
5c20: 73 65 20 6f 66 20 61 20 67 6c 6f 62 61 6c 20 66  se of a global f
5c30: 6f 72 20 63 61 63 68 69 6e 67 2e 20 4e 65 65 64  or caching. Need
5c40: 20 61 20 62 65 74 74 65 72 20 77 61 79 3f 0a 20   a better way?. 
5c50: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 68 61 73     (if (not (has
5c60: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61  h-table-ref/defa
5c70: 75 6c 74 20 2a 74 65 73 74 2d 6d 65 74 61 2d 75  ult *test-meta-u
5c80: 70 64 61 74 65 64 2a 20 74 65 73 74 2d 6e 61 6d  pdated* test-nam
5c90: 65 20 23 66 29 29 0a 20 20 20 20 20 20 20 20 28  e #f)).        (
5ca0: 62 65 67 69 6e 0a 09 20 20 20 28 68 61 73 68 2d  begin..   (hash-
5cb0: 74 61 62 6c 65 2d 73 65 74 21 20 2a 74 65 73 74  table-set! *test
5cc0: 2d 6d 65 74 61 2d 75 70 64 61 74 65 64 2a 20 74  -meta-updated* t
5cd0: 65 73 74 2d 6e 61 6d 65 20 23 74 29 0a 20 20 20  est-name #t).   
5ce0: 20 20 20 20 20 20 20 20 28 72 75 6e 73 3a 75 70          (runs:up
5cf0: 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 64  date-test_meta d
5d00: 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74  b test-name test
5d10: 2d 63 6f 6e 66 29 29 29 0a 20 20 20 20 0a 20 20  -conf))).    .  
5d20: 20 20 3b 3b 20 28 6c 61 6d 62 64 61 20 28 69 74    ;; (lambda (it
5d30: 65 6d 64 61 74 29 20 3b 3b 3b 20 28 28 72 69 70  emdat) ;;; ((rip
5d40: 65 6e 65 73 73 20 22 6f 76 65 72 72 69 70 65 22  eness "overripe"
5d50: 29 20 28 74 65 6d 70 65 72 61 74 75 72 65 20 22  ) (temperature "
5d60: 63 6f 6f 6c 22 29 20 28 73 65 61 73 6f 6e 20 22  cool") (season "
5d70: 73 75 6d 6d 65 72 22 29 29 0a 20 20 20 20 28 6c  summer")).    (l
5d80: 65 74 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d 70  et* ((new-test-p
5d90: 61 74 68 20 28 73 74 72 69 6e 67 2d 69 6e 74 65  ath (string-inte
5da0: 72 73 70 65 72 73 65 20 28 63 6f 6e 73 20 74 65  rsperse (cons te
5db0: 73 74 2d 70 61 74 68 20 28 6d 61 70 20 63 61 64  st-path (map cad
5dc0: 72 20 69 74 65 6d 64 61 74 29 29 20 22 2f 22 29  r itemdat)) "/")
5dd0: 29 0a 09 20 20 20 28 6e 65 77 2d 74 65 73 74 2d  )..   (new-test-
5de0: 6e 61 6d 65 20 28 69 66 20 28 65 71 75 61 6c 3f  name (if (equal?
5df0: 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 20 74   item-path "") t
5e00: 65 73 74 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74  est-name (conc t
5e10: 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65  est-name "/" ite
5e20: 6d 2d 70 61 74 68 29 29 29 20 3b 3b 20 6a 75 73  m-path))) ;; jus
5e30: 74 20 6e 65 65 64 20 69 74 20 74 6f 20 62 65 20  t need it to be 
5e40: 75 6e 69 71 75 65 0a 09 20 20 20 28 74 65 73 74  unique..   (test
5e50: 64 61 74 20 20 20 20 20 20 20 28 64 62 3a 67 65  dat       (db:ge
5e60: 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 20 72  t-test-info db r
5e70: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20  un-id test-name 
5e80: 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 20 20 20  item-path))..   
5e90: 28 74 65 73 74 2d 69 64 20 20 20 20 20 20 20 23  (test-id       #
5ea0: 66 29 29 0a 20 20 20 20 20 20 28 69 66 20 28 6e  f)).      (if (n
5eb0: 6f 74 20 74 65 73 74 64 61 74 29 0a 09 20 20 28  ot testdat)..  (
5ec0: 62 65 67 69 6e 0a 09 20 20 20 20 3b 3b 20 65 6e  begin..    ;; en
5ed0: 73 75 72 65 20 74 68 61 74 20 74 68 65 20 70 61  sure that the pa
5ee0: 74 68 20 65 78 69 73 74 73 20 62 65 66 6f 72 65  th exists before
5ef0: 20 72 65 67 69 73 74 65 72 69 6e 67 20 74 68 65   registering the
5f00: 20 74 65 73 74 0a 09 20 20 20 20 3b 3b 20 4e 4f   test..    ;; NO
5f10: 50 45 3a 20 43 61 6e 6e 6f 74 21 20 44 6f 6e 27  PE: Cannot! Don'
5f20: 74 20 6b 6e 6f 77 20 79 65 74 20 77 68 69 63 68  t know yet which
5f30: 20 64 69 73 6b 20 61 72 65 61 20 77 69 6c 6c 20   disk area will 
5f40: 62 65 20 61 73 73 69 67 6e 65 64 2e 2e 2e 2e 0a  be assigned.....
5f50: 09 20 20 20 20 3b 3b 20 28 73 79 73 74 65 6d 20  .    ;; (system 
5f60: 28 63 6f 6e 63 20 22 6d 6b 64 69 72 20 2d 70 20  (conc "mkdir -p 
5f70: 22 20 6e 65 77 2d 74 65 73 74 2d 70 61 74 68 29  " new-test-path)
5f80: 29 0a 09 20 20 20 20 28 72 74 65 73 74 73 3a 72  )..    (rtests:r
5f90: 65 67 69 73 74 65 72 2d 74 65 73 74 20 64 62 20  egister-test db 
5fa0: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65  run-id test-name
5fb0: 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 20 20 20   item-path)..   
5fc0: 20 28 73 65 74 21 20 74 65 73 74 64 61 74 20 28   (set! testdat (
5fd0: 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f  db:get-test-info
5fe0: 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d   db run-id test-
5ff0: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29  name item-path))
6000: 29 29 0a 20 20 20 20 20 20 28 73 65 74 21 20 74  )).      (set! t
6010: 65 73 74 2d 69 64 20 28 64 62 3a 74 65 73 74 2d  est-id (db:test-
6020: 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 29  get-id testdat))
6030: 0a 20 20 20 20 20 20 28 63 68 61 6e 67 65 2d 64  .      (change-d
6040: 69 72 65 63 74 6f 72 79 20 74 65 73 74 2d 70 61  irectory test-pa
6050: 74 68 29 0a 20 20 20 20 20 20 28 63 61 73 65 20  th).      (case 
6060: 28 69 66 20 66 6f 72 63 65 20 3b 3b 20 28 61 72  (if force ;; (ar
6070: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 66 6f 72  gs:get-arg "-for
6080: 63 65 22 29 0a 09 09 27 4e 4f 54 5f 53 54 41 52  ce")...'NOT_STAR
6090: 54 45 44 0a 09 09 28 69 66 20 74 65 73 74 64 61  TED...(if testda
60a0: 74 0a 09 09 20 20 20 20 28 73 74 72 69 6e 67 2d  t...    (string-
60b0: 3e 73 79 6d 62 6f 6c 20 28 74 65 73 74 3a 67 65  >symbol (test:ge
60c0: 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29  t-state testdat)
60d0: 29 0a 09 09 20 20 20 20 27 66 61 69 6c 65 64 2d  )...    'failed-
60e0: 74 6f 2d 69 6e 73 65 72 74 29 29 0a 09 28 28 66  to-insert))..((f
60f0: 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 72 74 29  ailed-to-insert)
6100: 0a 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  .. (debug:print 
6110: 30 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64  0 "ERROR: Failed
6120: 20 74 6f 20 69 6e 73 65 72 74 20 74 68 65 20 72   to insert the r
6130: 65 63 6f 72 64 20 69 6e 74 6f 20 74 68 65 20 64  ecord into the d
6140: 62 22 29 29 0a 09 28 28 4e 4f 54 5f 53 54 41 52  b"))..((NOT_STAR
6150: 54 45 44 20 43 4f 4d 50 4c 45 54 45 44 29 0a 09  TED COMPLETED)..
6160: 20 28 6c 65 74 20 28 28 72 75 6e 66 6c 61 67 20   (let ((runflag 
6170: 23 66 29 29 0a 09 20 20 20 28 63 6f 6e 64 0a 09  #f))..   (cond..
6180: 20 20 20 20 3b 3b 20 2d 66 6f 72 63 65 2c 20 72      ;; -force, r
6190: 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77 68 61  un no matter wha
61a0: 74 0a 09 20 20 20 20 28 66 6f 72 63 65 20 28 73  t..    (force (s
61b0: 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29  et! runflag #t))
61c0: 0a 09 20 20 20 20 3b 3b 20 4e 4f 54 5f 53 54 41  ..    ;; NOT_STA
61d0: 52 54 45 44 2c 20 72 75 6e 20 6e 6f 20 6d 61 74  RTED, run no mat
61e0: 74 65 72 20 77 68 61 74 0a 09 20 20 20 20 28 28  ter what..    ((
61f0: 65 71 75 61 6c 3f 20 28 74 65 73 74 3a 67 65 74  equal? (test:get
6200: 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 20  -state testdat) 
6210: 22 4e 4f 54 5f 53 54 41 52 54 45 44 22 29 28 73  "NOT_STARTED")(s
6220: 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29  et! runflag #t))
6230: 0a 09 20 20 20 20 3b 3b 20 6e 6f 74 20 2d 72 65  ..    ;; not -re
6240: 72 75 6e 20 61 6e 64 20 50 41 53 53 2c 20 57 41  run and PASS, WA
6250: 52 4e 20 6f 72 20 43 48 45 43 4b 2c 20 64 6f 20  RN or CHECK, do 
6260: 6e 6f 20 72 75 6e 0a 09 20 20 20 20 28 28 61 6e  no run..    ((an
6270: 64 20 28 6f 72 20 28 6e 6f 74 20 72 65 72 75 6e  d (or (not rerun
6280: 29 0a 09 09 20 20 20 20 20 20 6b 65 65 70 67 6f  )...      keepgo
6290: 69 6e 67 29 0a 09 09 20 20 3b 3b 20 52 65 71 75  ing)...  ;; Requ
62a0: 69 72 65 20 74 6f 20 66 6f 72 63 65 20 72 65 2d  ire to force re-
62b0: 72 75 6e 20 66 6f 72 20 43 4f 4d 50 4c 45 54 45  run for COMPLETE
62c0: 44 20 6f 72 20 2a 61 6e 79 74 68 69 6e 67 2a 20  D or *anything* 
62d0: 2b 20 50 41 53 53 2c 57 41 52 4e 20 6f 72 20 43  + PASS,WARN or C
62e0: 48 45 43 4b 0a 09 09 20 20 28 6f 72 20 28 6d 65  HECK...  (or (me
62f0: 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73  mber (test:get-s
6300: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20 27  tatus testdat) '
6310: 28 22 50 41 53 53 22 20 22 57 41 52 4e 22 20 22  ("PASS" "WARN" "
6320: 43 48 45 43 4b 22 29 29 0a 09 09 20 20 20 20 20  CHECK"))...     
6330: 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67   (member (test:g
6340: 65 74 2d 73 74 61 74 65 20 20 74 65 73 74 64 61  et-state  testda
6350: 74 29 20 27 28 22 43 4f 4d 50 4c 45 54 45 44 22  t) '("COMPLETED"
6360: 29 29 29 29 20 0a 09 20 20 20 20 20 28 64 65 62  )))) ..     (deb
6370: 75 67 3a 70 72 69 6e 74 20 32 20 22 49 4e 46 4f  ug:print 2 "INFO
6380: 3a 20 72 75 6e 6e 69 6e 67 20 74 65 73 74 20 22  : running test "
6390: 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69   test-name "/" i
63a0: 74 65 6d 2d 70 61 74 68 20 22 20 73 75 70 70 72  tem-path " suppr
63b0: 65 73 73 65 64 20 61 73 20 69 74 20 69 73 20 22  essed as it is "
63c0: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65   (test:get-state
63d0: 20 74 65 73 74 64 61 74 29 20 22 20 61 6e 64 20   testdat) " and 
63e0: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  " (test:get-stat
63f0: 75 73 20 74 65 73 74 64 61 74 29 29 0a 09 20 20  us testdat))..  
6400: 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67     (set! runflag
6410: 20 23 66 29 29 0a 09 20 20 20 20 3b 3b 20 2d 72   #f))..    ;; -r
6420: 65 72 75 6e 20 61 6e 64 20 73 74 61 74 75 73 20  erun and status 
6430: 69 73 20 6f 6e 65 20 6f 66 20 74 68 65 20 73 70  is one of the sp
6440: 65 63 69 66 65 64 2c 20 72 75 6e 20 69 74 0a 09  ecifed, run it..
6450: 20 20 20 20 28 28 61 6e 64 20 72 65 72 75 6e 0a      ((and rerun.
6460: 09 09 20 20 28 6c 65 74 2a 20 28 28 72 65 72 75  ..  (let* ((reru
6470: 6e 6c 73 74 20 20 20 28 73 74 72 69 6e 67 2d 73  nlst   (string-s
6480: 70 6c 69 74 20 72 65 72 75 6e 20 22 2c 22 29 29  plit rerun ","))
6490: 0a 09 09 09 20 28 6d 75 73 74 2d 72 65 72 75 6e  .... (must-rerun
64a0: 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67   (member (test:g
64b0: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61  et-status testda
64c0: 74 29 20 72 65 72 75 6e 6c 73 74 29 29 29 0a 09  t) rerunlst)))..
64d0: 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  .    (debug:prin
64e0: 74 20 33 20 22 49 4e 46 4f 3a 20 2d 72 65 72 75  t 3 "INFO: -reru
64f0: 6e 20 6c 69 73 74 3a 20 22 20 72 65 72 75 6e 20  n list: " rerun 
6500: 22 2c 20 74 65 73 74 2d 73 74 61 74 75 73 3a 20  ", test-status: 
6510: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  " (test:get-stat
6520: 75 73 20 74 65 73 74 64 61 74 29 22 2c 20 6d 75  us testdat)", mu
6530: 73 74 2d 72 65 72 75 6e 3a 20 22 20 6d 75 73 74  st-rerun: " must
6540: 2d 72 65 72 75 6e 29 0a 09 09 20 20 20 20 6d 75  -rerun)...    mu
6550: 73 74 2d 72 65 72 75 6e 29 29 0a 09 20 20 20 20  st-rerun))..    
6560: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20   (debug:print 2 
6570: 22 49 4e 46 4f 3a 20 52 65 72 75 6e 20 66 6f 72  "INFO: Rerun for
6580: 63 65 64 20 66 6f 72 20 74 65 73 74 20 22 20 74  ced for test " t
6590: 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65  est-name "/" ite
65a0: 6d 2d 70 61 74 68 29 0a 09 20 20 20 20 20 28 73  m-path)..     (s
65b0: 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29  et! runflag #t))
65c0: 0a 09 20 20 20 20 3b 3b 20 2d 6b 65 65 70 67 6f  ..    ;; -keepgo
65d0: 69 6e 67 2c 20 64 6f 20 6e 6f 74 20 72 65 72 75  ing, do not reru
65e0: 6e 20 46 41 49 4c 0a 09 20 20 20 20 28 28 61 6e  n FAIL..    ((an
65f0: 64 20 6b 65 65 70 67 6f 69 6e 67 0a 09 09 20 20  d keepgoing...  
6600: 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65  (member (test:ge
6610: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74  t-status testdat
6620: 29 20 27 28 22 46 41 49 4c 22 29 29 29 0a 09 20  ) '("FAIL"))).. 
6630: 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61      (set! runfla
6640: 67 20 23 66 29 29 0a 09 20 20 20 20 28 28 61 6e  g #f))..    ((an
6650: 64 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09  d (not rerun)...
6660: 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a    (member (test:
6670: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64  get-status testd
6680: 61 74 29 20 27 28 22 46 41 49 4c 22 20 22 6e 2f  at) '("FAIL" "n/
6690: 61 22 29 29 29 0a 09 20 20 20 20 20 28 73 65 74  a")))..     (set
66a0: 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09  ! runflag #t))..
66b0: 20 20 20 20 28 65 6c 73 65 20 28 73 65 74 21 20      (else (set! 
66c0: 72 75 6e 66 6c 61 67 20 23 66 29 29 29 0a 09 20  runflag #f))).. 
66d0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 36    (debug:print 6
66e0: 20 22 52 55 4e 4e 49 4e 47 20 3d 3e 20 72 75 6e   "RUNNING => run
66f0: 66 6c 61 67 3a 20 22 20 72 75 6e 66 6c 61 67 20  flag: " runflag 
6700: 22 20 53 54 41 54 45 3a 20 22 20 28 74 65 73 74  " STATE: " (test
6710: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64  :get-state testd
6720: 61 74 29 20 22 20 53 54 41 54 55 53 3a 20 22 20  at) " STATUS: " 
6730: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73  (test:get-status
6740: 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 28   testdat))..   (
6750: 69 66 20 28 6e 6f 74 20 72 75 6e 66 6c 61 67 29  if (not runflag)
6760: 0a 09 20 20 20 20 20 20 20 28 69 66 20 28 6e 6f  ..       (if (no
6770: 74 20 70 61 72 65 6e 74 2d 74 65 73 74 29 0a 09  t parent-test)..
6780: 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74  .   (debug:print
6790: 20 31 20 22 4e 4f 54 45 3a 20 4e 6f 74 20 73 74   1 "NOTE: Not st
67a0: 61 72 74 69 6e 67 20 74 65 73 74 20 22 20 6e 65  arting test " ne
67b0: 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 73  w-test-name " as
67c0: 20 69 74 20 69 73 20 73 74 61 74 65 20 5c 22 22   it is state \""
67d0: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65   (test:get-state
67e0: 20 74 65 73 74 64 61 74 29 20 0a 09 09 09 09 22   testdat) ....."
67f0: 5c 22 20 61 6e 64 20 73 74 61 74 75 73 20 5c 22  \" and status \"
6800: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  " (test:get-stat
6810: 75 73 20 74 65 73 74 64 61 74 29 20 22 5c 22 2c  us testdat) "\",
6820: 20 75 73 65 20 2d 72 65 72 75 6e 20 5c 22 22 20   use -rerun \"" 
6830: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73  (test:get-status
6840: 20 74 65 73 74 64 61 74 29 0a 20 20 20 20 20 20   testdat).      
6850: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
6860: 20 20 20 20 20 20 20 20 20 20 22 5c 22 20 6f 72            "\" or
6870: 20 2d 66 6f 72 63 65 20 74 6f 20 6f 76 65 72 72   -force to overr
6880: 69 64 65 22 29 29 0a 09 20 20 20 20 20 20 20 3b  ide"))..       ;
6890: 3b 20 4e 4f 54 45 3a 20 4e 6f 20 6c 6f 6e 67 65  ; NOTE: No longe
68a0: 72 20 62 65 20 63 68 65 63 6b 69 6e 67 20 70 72  r be checking pr
68b0: 65 72 65 71 75 69 73 69 74 65 73 20 68 65 72 65  erequisites here
68c0: 21 20 57 69 6c 6c 20 6e 65 76 65 72 20 67 65 74  ! Will never get
68d0: 20 68 65 72 65 20 75 6e 6c 65 73 73 20 70 72 65   here unless pre
68e0: 72 65 71 73 20 61 72 65 0a 09 20 20 20 20 20 20  reqs are..      
68f0: 20 3b 3b 20 20 20 20 20 20 20 61 6c 72 65 61 64   ;;       alread
6900: 79 20 6d 65 74 2e 0a 09 20 20 20 20 20 20 20 28  y met...       (
6910: 69 66 20 28 6e 6f 74 20 28 6c 61 75 6e 63 68 2d  if (not (launch-
6920: 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 72  test db run-id r
6930: 75 6e 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66  unname test-conf
6940: 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 73 74 2d   keyvallst test-
6950: 6e 61 6d 65 20 74 65 73 74 2d 70 61 74 68 20 69  name test-path i
6960: 74 65 6d 64 61 74 20 66 6c 61 67 73 29 29 0a 09  temdat flags))..
6970: 09 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20  .   (begin...   
6980: 20 20 28 70 72 69 6e 74 20 22 45 52 52 4f 52 3a    (print "ERROR:
6990: 20 46 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63   Failed to launc
69a0: 68 20 74 68 65 20 74 65 73 74 2e 20 45 78 69 74  h the test. Exit
69b0: 69 6e 67 20 61 73 20 73 6f 6f 6e 20 61 73 20 70  ing as soon as p
69c0: 6f 73 73 69 62 6c 65 22 29 0a 09 09 20 20 20 20  ossible")...    
69d0: 20 28 73 65 74 21 20 2a 67 6c 6f 62 61 6c 65 78   (set! *globalex
69e0: 69 74 73 74 61 74 75 73 2a 20 31 29 20 3b 3b 20  itstatus* 1) ;; 
69f0: 0a 09 09 20 20 20 20 20 28 70 72 6f 63 65 73 73  ...     (process
6a00: 2d 73 69 67 6e 61 6c 20 28 63 75 72 72 65 6e 74  -signal (current
6a10: 2d 70 72 6f 63 65 73 73 2d 69 64 29 20 73 69 67  -process-id) sig
6a20: 6e 61 6c 2f 6b 69 6c 6c 29 29 29 29 29 29 0a 09  nal/kill))))))..
6a30: 28 28 4b 49 4c 4c 45 44 29 20 0a 09 20 28 64 65  ((KILLED) .. (de
6a40: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54  bug:print 1 "NOT
6a50: 45 3a 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61  E: " new-test-na
6a60: 6d 65 20 22 20 69 73 20 61 6c 72 65 61 64 79 20  me " is already 
6a70: 72 75 6e 6e 69 6e 67 20 6f 72 20 77 61 73 20 65  running or was e
6a80: 78 70 6c 69 63 74 6c 79 20 6b 69 6c 6c 65 64 2c  xplictly killed,
6a90: 20 75 73 65 20 2d 66 6f 72 63 65 20 74 6f 20 6c   use -force to l
6aa0: 61 75 6e 63 68 20 69 74 2e 22 29 29 0a 09 28 28  aunch it."))..((
6ab0: 4c 41 55 4e 43 48 45 44 20 52 45 4d 4f 54 45 48  LAUNCHED REMOTEH
6ac0: 4f 53 54 53 54 41 52 54 20 52 55 4e 4e 49 4e 47  OSTSTART RUNNING
6ad0: 29 20 20 0a 09 20 28 69 66 20 28 3e 20 28 2d 20  )  .. (if (> (- 
6ae0: 28 63 75 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73  (current-seconds
6af0: 29 28 2b 20 28 64 62 3a 74 65 73 74 2d 67 65 74  )(+ (db:test-get
6b00: 2d 65 76 65 6e 74 5f 74 69 6d 65 20 74 65 73 74  -event_time test
6b10: 64 61 74 29 0a 09 09 09 09 20 20 20 20 20 20 20  dat).....       
6b20: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e  (db:test-get-run
6b30: 5f 64 75 72 61 74 69 6f 6e 20 74 65 73 74 64 61  _duration testda
6b40: 74 29 29 29 0a 09 09 36 30 30 29 20 3b 3b 20 69  t)))...600) ;; i
6b50: 2e 65 2e 20 6e 6f 20 75 70 64 61 74 65 20 66 6f  .e. no update fo
6b60: 72 20 6d 6f 72 65 20 74 68 61 6e 20 36 30 30 20  r more than 600 
6b70: 73 65 63 6f 6e 64 73 0a 09 20 20 20 20 20 28 62  seconds..     (b
6b80: 65 67 69 6e 0a 09 20 20 20 20 20 20 20 28 64 65  egin..       (de
6b90: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52  bug:print 0 "WAR
6ba0: 4e 49 4e 47 3a 20 54 65 73 74 20 22 20 74 65 73  NING: Test " tes
6bb0: 74 2d 6e 61 6d 65 20 22 20 61 70 70 65 61 72 73  t-name " appears
6bc0: 20 74 6f 20 62 65 20 64 65 61 64 2e 20 46 6f 72   to be dead. For
6bd0: 63 69 6e 67 20 69 74 20 74 6f 20 73 74 61 74 65  cing it to state
6be0: 20 49 4e 43 4f 4d 50 4c 45 54 45 20 61 6e 64 20   INCOMPLETE and 
6bf0: 73 74 61 74 75 73 20 53 54 55 43 4b 2f 44 45 41  status STUCK/DEA
6c00: 44 22 29 0a 09 20 20 20 20 20 20 20 28 74 65 73  D")..       (tes
6c10: 74 2d 73 65 74 2d 73 74 61 74 75 73 21 20 64 62  t-set-status! db
6c20: 20 74 65 73 74 2d 69 64 20 22 49 4e 43 4f 4d 50   test-id "INCOMP
6c30: 4c 45 54 45 22 20 22 53 54 55 43 4b 2f 44 45 41  LETE" "STUCK/DEA
6c40: 44 22 20 22 54 65 73 74 20 69 73 20 73 74 75 63  D" "Test is stuc
6c50: 6b 20 6f 72 20 64 65 61 64 22 20 23 66 29 29 0a  k or dead" #f)).
6c60: 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  .     (debug:pri
6c70: 6e 74 20 32 20 22 4e 4f 54 45 3a 20 22 20 74 65  nt 2 "NOTE: " te
6c80: 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72  st-name " is alr
6c90: 65 61 64 79 20 72 75 6e 6e 69 6e 67 22 29 29 29  eady running")))
6ca0: 0a 09 28 65 6c 73 65 20 20 20 20 20 20 20 28 64  ..(else       (d
6cb0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
6cc0: 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c  ROR: Failed to l
6cd0: 61 75 6e 63 68 20 74 65 73 74 20 22 20 6e 65 77  aunch test " new
6ce0: 2d 74 65 73 74 2d 6e 61 6d 65 20 22 2e 20 55 6e  -test-name ". Un
6cf0: 72 65 63 6f 67 6e 69 73 65 64 20 73 74 61 74 65  recognised state
6d00: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61   " (test:get-sta
6d10: 74 65 20 74 65 73 74 64 61 74 29 29 29 29 29 29  te testdat))))))
6d20: 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  )..;;===========
6d30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6d40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6d50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6d60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 45  ===========.;; E
6d70: 4e 44 20 4f 46 20 4e 45 57 20 53 54 55 46 46 0a  ND OF NEW STUFF.
6d80: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;;==============
6d90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6da0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6db0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6dc0: 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e  ========..(defin
6dd0: 65 20 28 67 65 74 2d 64 69 72 2d 75 70 2d 6e 20  e (get-dir-up-n 
6de0: 64 69 72 20 2e 20 70 61 72 61 6d 73 29 20 0a 20  dir . params) . 
6df0: 20 28 6c 65 74 20 28 28 64 70 61 72 74 73 20 20   (let ((dparts  
6e00: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 64 69  (string-split di
6e10: 72 20 22 2f 22 29 29 0a 09 28 63 6f 75 6e 74 20  r "/"))..(count 
6e20: 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 70 61 72    (if (null? par
6e30: 61 6d 73 29 20 31 20 28 63 61 72 20 70 61 72 61  ams) 1 (car para
6e40: 6d 73 29 29 29 29 0a 20 20 20 20 28 63 6f 6e 63  ms)))).    (conc
6e50: 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74   "/" (string-int
6e60: 65 72 73 70 65 72 73 65 20 0a 09 20 20 20 20 20  ersperse ..     
6e70: 20 20 28 74 61 6b 65 20 64 70 61 72 74 73 20 28    (take dparts (
6e80: 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73  - (length dparts
6e90: 29 20 63 6f 75 6e 74 29 29 0a 09 20 20 20 20 20  ) count))..     
6ea0: 20 20 22 2f 22 29 29 29 29 0a 3b 3b 20 52 65 6d    "/")))).;; Rem
6eb0: 6f 76 65 20 72 75 6e 73 0a 3b 3b 20 66 69 65 6c  ove runs.;; fiel
6ec0: 64 73 20 61 72 65 20 70 61 73 73 69 6e 67 20 69  ds are passing i
6ed0: 6e 20 74 68 72 6f 75 67 68 20 0a 3b 3b 20 61 63  n through .;; ac
6ee0: 74 69 6f 6e 3a 0a 3b 3b 20 20 20 20 27 72 65 6d  tion:.;;    'rem
6ef0: 6f 76 65 2d 72 75 6e 73 0a 3b 3b 20 20 20 20 27  ove-runs.;;    '
6f00: 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73  set-state-status
6f10: 0a 3b 3b 0a 3b 3b 20 4e 42 2f 2f 20 73 68 6f 75  .;;.;; NB// shou
6f20: 6c 64 20 70 61 73 73 20 69 6e 20 6b 65 79 73 3f  ld pass in keys?
6f30: 0a 3b 3b 0a 28 64 65 66 69 6e 65 20 28 72 75 6e  .;;.(define (run
6f40: 73 3a 6f 70 65 72 61 74 65 2d 6f 6e 20 64 62 20  s:operate-on db 
6f50: 61 63 74 69 6f 6e 20 72 75 6e 6e 61 6d 65 70 61  action runnamepa
6f60: 74 74 20 74 65 73 74 70 61 74 74 20 69 74 65 6d  tt testpatt item
6f70: 70 61 74 74 20 23 21 6b 65 79 20 28 73 74 61 74  patt #!key (stat
6f80: 65 20 23 66 29 28 73 74 61 74 75 73 20 23 66 29  e #f)(status #f)
6f90: 28 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75  (new-state-statu
6fa0: 73 20 23 66 29 29 0a 20 20 28 6c 65 74 2a 20 28  s #f)).  (let* (
6fb0: 28 6b 65 79 73 20 20 20 20 20 20 20 20 20 28 72  (keys         (r
6fc0: 64 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29  db:get-keys db))
6fd0: 0a 09 20 28 72 75 6e 64 61 74 20 20 20 20 20 20  .. (rundat      
6fe0: 20 28 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d   (runs:get-runs-
6ff0: 62 79 2d 70 61 74 74 20 64 62 20 6b 65 79 73 20  by-patt db keys 
7000: 72 75 6e 6e 61 6d 65 70 61 74 74 29 29 0a 09 20  runnamepatt)).. 
7010: 28 68 65 61 64 65 72 20 20 20 20 20 20 20 28 76  (header       (v
7020: 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74  ector-ref rundat
7030: 20 30 29 29 0a 09 20 28 72 75 6e 73 20 20 20 20   0)).. (runs    
7040: 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66       (vector-ref
7050: 20 72 75 6e 64 61 74 20 31 29 29 0a 09 20 28 73   rundat 1)).. (s
7060: 74 61 74 65 73 20 20 20 20 20 20 20 28 69 66 20  tates       (if 
7070: 73 74 61 74 65 20 20 28 73 74 72 69 6e 67 2d 73  state  (string-s
7080: 70 6c 69 74 20 73 74 61 74 65 20 20 22 2c 22 29  plit state  ",")
7090: 20 27 28 29 29 29 0a 09 20 28 73 74 61 74 75 73   '())).. (status
70a0: 65 73 20 20 20 20 20 28 69 66 20 73 74 61 74 75  es     (if statu
70b0: 73 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20  s (string-split 
70c0: 73 74 61 74 75 73 20 22 2c 22 29 20 27 28 29 29  status ",") '())
70d0: 29 0a 09 20 28 73 74 61 74 65 2d 73 74 61 74 75  ).. (state-statu
70e0: 73 20 28 69 66 20 28 73 74 72 69 6e 67 3f 20 6e  s (if (string? n
70f0: 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73 29  ew-state-status)
7100: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 6e   (string-split n
7110: 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73 20  ew-state-status 
7120: 22 2c 22 29 20 27 28 23 66 20 23 66 29 29 29 29  ",") '(#f #f))))
7130: 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  .    (debug:prin
7140: 74 20 32 20 22 48 65 61 64 65 72 3a 20 22 20 68  t 2 "Header: " h
7150: 65 61 64 65 72 20 22 20 61 63 74 69 6f 6e 3a 20  eader " action: 
7160: 22 20 61 63 74 69 6f 6e 20 22 20 6e 65 77 2d 73  " action " new-s
7170: 74 61 74 65 2d 73 74 61 74 75 73 3a 20 22 20 6e  tate-status: " n
7180: 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73 29  ew-state-status)
7190: 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 20  .    (for-each. 
71a0: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 72 75 6e      (lambda (run
71b0: 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28  ).       (let ((
71c0: 72 75 6e 6b 65 79 20 28 73 74 72 69 6e 67 2d 69  runkey (string-i
71d0: 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61 70 20  ntersperse (map 
71e0: 28 6c 61 6d 62 64 61 20 28 6b 29 0a 09 09 09 09  (lambda (k).....
71f0: 09 09 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d  ..(db:get-value-
7200: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65  by-header run he
7210: 61 64 65 72 20 28 76 65 63 74 6f 72 2d 72 65 66  ader (vector-ref
7220: 20 6b 20 30 29 29 29 20 6b 65 79 73 29 20 22 2f   k 0))) keys) "/
7230: 22 29 29 0a 09 20 20 20 20 20 28 64 69 72 73 2d  "))..     (dirs-
7240: 74 6f 2d 72 65 6d 6f 76 65 20 28 6d 61 6b 65 2d  to-remove (make-
7250: 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 09 20  hash-table))).. 
7260: 28 6c 65 74 2a 20 28 28 72 75 6e 2d 69 64 20 20  (let* ((run-id  
7270: 20 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d    (db:get-value-
7280: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65  by-header run he
7290: 61 64 65 72 20 22 69 64 22 29 29 0a 09 09 28 72  ader "id"))...(r
72a0: 75 6e 2d 73 74 61 74 65 20 28 64 62 3a 67 65 74  un-state (db:get
72b0: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72  -value-by-header
72c0: 20 72 75 6e 20 68 65 61 64 65 72 20 22 73 74 61   run header "sta
72d0: 74 65 22 29 29 0a 09 09 28 74 65 73 74 73 20 20  te"))...(tests  
72e0: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 65 71 75     (if (not (equ
72f0: 61 6c 3f 20 72 75 6e 2d 73 74 61 74 65 20 22 6c  al? run-state "l
7300: 6f 63 6b 65 64 22 29 29 0a 09 09 09 20 20 20 20  ocked"))....    
7310: 20 20 20 28 72 64 62 3a 67 65 74 2d 74 65 73 74     (rdb:get-test
7320: 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 62  s-for-run db (db
7330: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65  :get-value-by-he
7340: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20  ader run header 
7350: 22 69 64 22 29 0a 09 09 09 09 09 09 20 20 20 20  "id").......    
7360: 20 20 74 65 73 74 70 61 74 74 20 69 74 65 6d 70    testpatt itemp
7370: 61 74 74 20 73 74 61 74 65 73 20 73 74 61 74 75  att states statu
7380: 73 65 73 0a 09 09 09 09 09 09 20 20 20 20 20 20  ses.......      
7390: 6e 6f 74 2d 69 6e 3a 20 20 23 66 0a 09 09 09 09  not-in:  #f.....
73a0: 09 09 20 20 20 20 20 20 73 6f 72 74 2d 62 79 3a  ..      sort-by:
73b0: 20 28 63 61 73 65 20 61 63 74 69 6f 6e 0a 09 09   (case action...
73c0: 09 09 09 09 09 09 20 28 28 72 65 6d 6f 76 65 2d  ...... ((remove-
73d0: 72 75 6e 73 29 20 27 72 75 6e 64 69 72 29 0a 09  runs) 'rundir)..
73e0: 09 09 09 09 09 09 09 20 28 65 6c 73 65 20 20 20  ....... (else   
73f0: 20 20 20 20 20 20 20 27 65 76 65 6e 74 5f 74 69         'event_ti
7400: 6d 65 29 29 29 0a 09 09 09 20 20 20 20 20 20 20  me)))....       
7410: 27 28 29 29 29 0a 09 09 28 6c 61 73 74 74 70 61  '()))...(lasttpa
7420: 74 68 20 22 2f 64 6f 65 73 2f 6e 6f 74 2f 65 78  th "/does/not/ex
7430: 69 73 74 2f 49 2f 68 6f 70 65 22 29 29 0a 0a 09  ist/I/hope"))...
7440: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c     (if (not (nul
7450: 6c 3f 20 74 65 73 74 73 29 29 0a 09 20 20 20 20  l? tests))..    
7460: 20 20 20 28 62 65 67 69 6e 0a 09 09 20 28 63 61     (begin... (ca
7470: 73 65 20 61 63 74 69 6f 6e 0a 09 09 20 20 20 28  se action...   (
7480: 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29 0a 09 09  (remove-runs)...
7490: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
74a0: 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 74 65 73   1 "Removing tes
74b0: 74 73 20 66 6f 72 20 72 75 6e 3a 20 22 20 72 75  ts for run: " ru
74c0: 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74  nkey " " (db:get
74d0: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72  -value-by-header
74e0: 20 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e   run header "run
74f0: 6e 61 6d 65 22 29 29 29 0a 09 09 20 20 20 28 28  name")))...   ((
7500: 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73  set-state-status
7510: 29 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70  )...    (debug:p
7520: 72 69 6e 74 20 31 20 22 4d 6f 64 69 66 79 69 6e  rint 1 "Modifyin
7530: 67 20 73 74 61 74 65 20 61 6e 64 20 73 74 61 75  g state and stau
7540: 73 20 66 6f 72 20 74 65 73 74 73 20 66 6f 72 20  s for tests for 
7550: 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20  run: " runkey " 
7560: 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d  " (db:get-value-
7570: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65  by-header run he
7580: 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 29  ader "runname"))
7590: 29 0a 09 09 20 20 20 28 65 6c 73 65 0a 09 09 20  )...   (else... 
75a0: 20 20 20 28 70 72 69 6e 74 20 22 49 4e 46 4f 3a     (print "INFO:
75b0: 20 61 63 74 69 6f 6e 20 6e 6f 74 20 72 65 63 6f   action not reco
75c0: 67 6e 69 73 65 64 20 22 20 61 63 74 69 6f 6e 29  gnised " action)
75d0: 29 29 0a 09 09 20 28 66 6f 72 2d 65 61 63 68 0a  ))... (for-each.
75e0: 09 09 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73  ..  (lambda (tes
75f0: 74 29 0a 09 09 20 20 20 20 28 6c 65 74 2a 20 28  t)...    (let* (
7600: 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74  (item-path (db:t
7610: 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74  est-get-item-pat
7620: 68 20 74 65 73 74 29 29 0a 09 09 09 20 20 20 28  h test))....   (
7630: 74 65 73 74 2d 6e 61 6d 65 20 28 64 62 3a 74 65  test-name (db:te
7640: 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20  st-get-testname 
7650: 74 65 73 74 29 29 0a 09 09 09 20 20 20 28 72 75  test))....   (ru
7660: 6e 2d 64 69 72 20 20 20 28 64 62 3a 74 65 73 74  n-dir   (db:test
7670: 2d 67 65 74 2d 72 75 6e 64 69 72 20 74 65 73 74  -get-rundir test
7680: 29 29 29 0a 09 09 20 20 20 20 20 20 28 64 65 62  )))...      (deb
7690: 75 67 3a 70 72 69 6e 74 20 31 20 22 20 20 22 20  ug:print 1 "  " 
76a0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73  (db:test-get-tes
76b0: 74 6e 61 6d 65 20 74 65 73 74 29 20 22 20 69 64  tname test) " id
76c0: 3a 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74  : " (db:test-get
76d0: 2d 69 64 20 74 65 73 74 29 20 22 20 22 20 69 74  -id test) " " it
76e0: 65 6d 2d 70 61 74 68 20 22 20 61 63 74 69 6f 6e  em-path " action
76f0: 3a 20 22 20 61 63 74 69 6f 6e 29 0a 09 09 20 20  : " action)...  
7700: 20 20 20 20 28 63 61 73 65 20 61 63 74 69 6f 6e      (case action
7710: 0a 09 09 09 28 28 72 65 6d 6f 76 65 2d 72 75 6e  ....((remove-run
7720: 73 29 0a 09 09 09 20 28 72 64 62 3a 64 65 6c 65  s).... (rdb:dele
7730: 74 65 2d 74 65 73 74 2d 72 65 63 6f 72 64 73 20  te-test-records 
7740: 64 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  db (db:test-get-
7750: 69 64 20 74 65 73 74 29 29 0a 09 09 09 20 28 64  id test)).... (d
7760: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e  ebug:print 1 "IN
7770: 46 4f 3a 20 41 74 74 65 6d 70 74 69 6e 67 20 74  FO: Attempting t
7780: 6f 20 72 65 6d 6f 76 65 20 64 69 72 20 22 20 72  o remove dir " r
7790: 75 6e 2d 64 69 72 29 0a 09 09 09 20 28 69 66 20  un-dir).... (if 
77a0: 28 61 6e 64 20 28 3e 20 28 73 74 72 69 6e 67 2d  (and (> (string-
77b0: 6c 65 6e 67 74 68 20 72 75 6e 2d 64 69 72 29 20  length run-dir) 
77c0: 35 29 0a 09 09 09 09 20 20 28 66 69 6c 65 2d 65  5).....  (file-e
77d0: 78 69 73 74 73 3f 20 72 75 6e 2d 64 69 72 29 29  xists? run-dir))
77e0: 20 3b 3b 20 62 61 64 20 68 65 75 72 69 73 74 69   ;; bad heuristi
77f0: 63 20 62 75 74 20 73 68 6f 75 6c 64 20 70 72 65  c but should pre
7800: 76 65 6e 74 20 2f 74 6d 70 20 2f 68 6f 6d 65 20  vent /tmp /home 
7810: 65 74 63 2e 0a 09 09 09 20 20 20 20 20 28 6c 65  etc.....     (le
7820: 74 2a 20 28 28 72 65 61 6c 70 61 74 68 20 28 72  t* ((realpath (r
7830: 65 73 6f 6c 76 65 2d 70 61 74 68 6e 61 6d 65 20  esolve-pathname 
7840: 72 75 6e 2d 64 69 72 29 29 29 0a 09 09 09 20 20  run-dir)))....  
7850: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
7860: 74 20 31 20 22 49 4e 46 4f 3a 20 52 65 61 6c 20  t 1 "INFO: Real 
7870: 70 61 74 68 20 6f 66 20 69 73 20 22 20 72 65 61  path of is " rea
7880: 6c 70 61 74 68 29 0a 09 09 09 20 20 20 20 20 20  lpath)....      
7890: 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74   (if (file-exist
78a0: 73 3f 20 72 65 61 6c 70 61 74 68 29 0a 09 09 09  s? realpath)....
78b0: 09 20 20 20 28 69 66 20 28 3e 20 28 73 79 73 74  .   (if (> (syst
78c0: 65 6d 20 28 63 6f 6e 63 20 22 72 6d 20 2d 72 66  em (conc "rm -rf
78d0: 20 22 20 72 65 61 6c 70 61 74 68 29 29 20 30 29   " realpath)) 0)
78e0: 0a 09 09 09 09 20 20 20 20 20 20 20 28 64 65 62  .....       (deb
78f0: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f  ug:print 0 "ERRO
7900: 52 3a 20 54 68 65 72 65 20 77 61 73 20 61 20 70  R: There was a p
7910: 72 6f 62 6c 65 6d 20 72 65 6d 6f 76 69 6e 67 20  roblem removing 
7920: 22 20 72 65 61 6c 70 61 74 68 20 22 20 77 69 74  " realpath " wit
7930: 68 20 72 6d 20 2d 66 22 29 29 0a 09 09 09 09 20  h rm -f"))..... 
7940: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
7950: 20 22 57 41 52 4e 49 4e 47 3a 20 74 65 73 74 20   "WARNING: test 
7960: 72 75 6e 20 64 69 72 20 22 20 72 65 61 6c 70 61  run dir " realpa
7970: 74 68 20 22 20 61 70 70 65 61 72 73 20 74 6f 20  th " appears to 
7980: 6e 6f 74 20 65 78 69 73 74 22 29 29 0a 09 09 09  not exist"))....
7990: 20 20 20 20 20 20 20 28 69 66 20 28 66 69 6c 65         (if (file
79a0: 2d 65 78 69 73 74 73 3f 20 72 75 6e 2d 64 69 72  -exists? run-dir
79b0: 29 20 3b 3b 20 74 68 65 20 6c 69 6e 6b 0a 09 09  ) ;; the link...
79c0: 09 09 20 20 20 28 69 66 20 28 73 79 6d 62 6f 6c  ..   (if (symbol
79d0: 69 63 2d 6c 69 6e 6b 3f 20 72 75 6e 2d 64 69 72  ic-link? run-dir
79e0: 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 64 65  ).....       (de
79f0: 6c 65 74 65 2d 66 69 6c 65 20 72 75 6e 2d 64 69  lete-file run-di
7a00: 72 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 69  r).....       (i
7a10: 66 20 28 64 69 72 65 63 74 6f 72 79 3f 20 72 75  f (directory? ru
7a20: 6e 2d 64 69 72 29 0a 09 09 09 09 09 20 20 20 28  n-dir)......   (
7a30: 69 66 20 28 3e 20 28 64 69 72 65 63 74 6f 72 79  if (> (directory
7a40: 2d 66 6f 6c 64 20 28 6c 61 6d 62 64 61 20 28 66  -fold (lambda (f
7a50: 20 78 29 28 2b 20 31 20 78 29 29 20 30 20 72 75   x)(+ 1 x)) 0 ru
7a60: 6e 2d 64 69 72 29 20 30 29 0a 09 09 09 09 09 20  n-dir) 0)...... 
7a70: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
7a80: 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 72  nt 0 "WARNING: r
7a90: 65 66 75 73 69 6e 67 20 74 6f 20 72 65 6d 6f 76  efusing to remov
7aa0: 65 20 22 20 72 75 6e 2d 64 69 72 20 22 20 61 73  e " run-dir " as
7ab0: 20 69 74 20 69 73 20 6e 6f 74 20 65 6d 70 74 79   it is not empty
7ac0: 22 29 0a 09 09 09 09 09 20 20 20 20 20 20 20 28  ")......       (
7ad0: 64 65 6c 65 74 65 2d 64 69 72 65 63 74 6f 72 79  delete-directory
7ae0: 20 72 75 6e 2d 64 69 72 29 29 20 3b 3b 20 69 74   run-dir)) ;; it
7af0: 20 73 68 6f 75 6c 64 20 62 65 20 65 6d 70 74 79   should be empty
7b00: 20 62 79 20 68 65 72 65 20 42 55 47 20 42 55 47   by here BUG BUG
7b10: 2c 20 61 64 64 20 65 72 72 6f 72 20 63 61 74 63  , add error catc
7b20: 68 0a 09 09 09 09 09 20 20 20 28 64 65 62 75 67  h......   (debug
7b30: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a  :print 0 "ERROR:
7b40: 20 72 65 66 75 73 69 6e 67 20 74 6f 20 72 65 6d   refusing to rem
7b50: 6f 76 65 20 22 20 72 75 6e 2d 64 69 72 20 22 20  ove " run-dir " 
7b60: 61 73 20 69 74 20 69 73 20 6e 65 69 74 68 65 72  as it is neither
7b70: 20 61 20 73 79 6d 6c 69 6e 6b 20 6e 6f 72 20 61   a symlink nor a
7b80: 20 64 69 72 65 63 74 6f 72 79 22 29 0a 09 09 09   directory")....
7b90: 09 09 20 20 20 29 29 29 29 0a 09 09 09 20 20 20  ..   ))))....   
7ba0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
7bb0: 20 22 57 41 52 4e 49 4e 47 3a 20 64 69 72 65 63   "WARNING: direc
7bc0: 74 6f 72 79 20 61 6c 72 65 61 64 79 20 72 65 6d  tory already rem
7bd0: 6f 76 65 64 20 22 20 72 75 6e 2d 64 69 72 29 29  oved " run-dir))
7be0: 29 0a 09 09 09 28 28 73 65 74 2d 73 74 61 74 65  )....((set-state
7bf0: 2d 73 74 61 74 75 73 29 0a 09 09 09 20 28 64 65  -status).... (de
7c00: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 49 4e 46  bug:print 2 "INF
7c10: 4f 3a 20 6e 65 77 20 73 74 61 74 65 20 22 20 28  O: new state " (
7c20: 63 61 72 20 73 74 61 74 65 2d 73 74 61 74 75 73  car state-status
7c30: 29 20 22 2c 20 6e 65 77 20 73 74 61 74 75 73 20  ) ", new status 
7c40: 22 20 28 63 61 64 72 20 73 74 61 74 65 2d 73 74  " (cadr state-st
7c50: 61 74 75 73 29 29 0a 09 09 09 20 28 64 62 3a 74  atus)).... (db:t
7c60: 65 73 74 2d 73 65 74 2d 73 74 61 74 65 2d 73 74  est-set-state-st
7c70: 61 74 75 73 2d 62 79 2d 69 64 20 64 62 20 28 64  atus-by-id db (d
7c80: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65  b:test-get-id te
7c90: 73 74 29 20 28 63 61 72 20 73 74 61 74 65 2d 73  st) (car state-s
7ca0: 74 61 74 75 73 29 28 63 61 64 72 20 73 74 61 74  tatus)(cadr stat
7cb0: 65 2d 73 74 61 74 75 73 29 20 23 66 29 29 29 29  e-status) #f))))
7cc0: 29 0a 09 09 20 20 74 65 73 74 73 29 29 29 0a 09  )...  tests)))..
7cd0: 20 20 20 0a 09 20 20 20 3b 3b 20 72 65 6d 6f 76     ..   ;; remov
7ce0: 65 20 74 68 65 20 72 75 6e 20 69 66 20 7a 65 72  e the run if zer
7cf0: 6f 20 74 65 73 74 73 20 72 65 6d 61 69 6e 0a 09  o tests remain..
7d00: 20 20 20 28 69 66 20 28 65 71 3f 20 61 63 74 69     (if (eq? acti
7d10: 6f 6e 20 27 72 65 6d 6f 76 65 2d 72 75 6e 73 29  on 'remove-runs)
7d20: 0a 09 20 20 20 20 20 20 20 28 6c 65 74 20 28 28  ..       (let ((
7d30: 72 65 6d 74 65 73 74 73 20 28 72 64 62 3a 67 65  remtests (rdb:ge
7d40: 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20  t-tests-for-run 
7d50: 64 62 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65  db (db:get-value
7d60: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68  -by-header run h
7d70: 65 61 64 65 72 20 22 69 64 22 29 20 23 66 20 23  eader "id") #f #
7d80: 66 20 27 28 29 20 27 28 29 29 29 29 0a 09 09 20  f '() '())))... 
7d90: 28 69 66 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65  (if (null? remte
7da0: 73 74 73 29 20 3b 3b 20 6e 6f 20 6d 6f 72 65 20  sts) ;; no more 
7db0: 74 65 73 74 73 20 72 65 6d 61 69 6e 69 6e 67 0a  tests remaining.
7dc0: 09 09 20 20 20 20 20 28 6c 65 74 2a 20 28 28 64  ..     (let* ((d
7dd0: 70 61 72 74 73 20 20 28 73 74 72 69 6e 67 2d 73  parts  (string-s
7de0: 70 6c 69 74 20 6c 61 73 74 74 70 61 74 68 20 22  plit lasttpath "
7df0: 2f 22 29 29 0a 09 09 09 20 20 20 20 28 72 75 6e  /"))....    (run
7e00: 70 61 74 68 20 28 63 6f 6e 63 20 22 2f 22 20 28  path (conc "/" (
7e10: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72  string-intersper
7e20: 73 65 20 0a 09 09 09 09 09 09 28 74 61 6b 65 20  se .......(take 
7e30: 64 70 61 72 74 73 20 28 2d 20 28 6c 65 6e 67 74  dparts (- (lengt
7e40: 68 20 64 70 61 72 74 73 29 20 31 29 29 0a 09 09  h dparts) 1))...
7e50: 09 09 09 09 22 2f 22 29 29 29 29 0a 09 09 20 20  ...."/"))))...  
7e60: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
7e70: 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 72 75  t 1 "Removing ru
7e80: 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20 22 20  n: " runkey " " 
7e90: 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79  (db:get-value-by
7ea0: 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64  -header run head
7eb0: 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 29 0a 09  er "runname"))..
7ec0: 09 20 20 20 20 20 20 20 28 64 62 3a 64 65 6c 65  .       (db:dele
7ed0: 74 65 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 64  te-run db run-id
7ee0: 29 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 6e 65  )...       ;; ne
7ef0: 65 64 20 74 6f 20 66 69 67 75 72 65 20 6f 75 74  ed to figure out
7f00: 20 74 68 65 20 70 61 74 68 20 74 6f 20 74 68 65   the path to the
7f10: 20 72 75 6e 20 64 69 72 20 61 6e 64 20 72 65 6d   run dir and rem
7f20: 6f 76 65 20 69 74 20 69 66 20 65 6d 70 74 79 0a  ove it if empty.
7f30: 09 09 20 20 20 20 20 20 20 3b 3b 20 20 20 20 28  ..       ;;    (
7f40: 69 66 20 28 6e 75 6c 6c 3f 20 28 67 6c 6f 62 20  if (null? (glob 
7f50: 28 63 6f 6e 63 20 72 75 6e 70 61 74 68 20 22 2f  (conc runpath "/
7f60: 2a 22 29 29 29 0a 09 09 20 20 20 20 20 20 20 3b  *")))...       ;
7f70: 3b 20 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a  ;        (begin.
7f80: 09 09 20 20 20 20 20 20 20 3b 3b 20 09 20 28 64  ..       ;; . (d
7f90: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65  ebug:print 1 "Re
7fa0: 6d 6f 76 69 6e 67 20 72 75 6e 20 64 69 72 20 22  moving run dir "
7fb0: 20 72 75 6e 70 61 74 68 29 0a 09 09 20 20 20 20   runpath)...    
7fc0: 20 20 20 3b 3b 20 09 20 28 73 79 73 74 65 6d 20     ;; . (system 
7fd0: 28 63 6f 6e 63 20 22 72 6d 64 69 72 20 2d 70 20  (conc "rmdir -p 
7fe0: 22 20 72 75 6e 70 61 74 68 29 29 29 29 0a 09 09  " runpath))))...
7ff0: 20 20 20 20 20 20 20 29 29 29 29 29 0a 09 20 29         ))))).. )
8000: 29 0a 20 20 20 20 20 72 75 6e 73 29 29 29 0a 0a  ).     runs)))..
8010: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;;==============
8020: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8030: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8040: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8050: 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 75 74  ========.;; Rout
8060: 69 6e 65 73 20 66 6f 72 20 6d 61 6e 69 70 75 6c  ines for manipul
8070: 61 74 69 6e 67 20 72 75 6e 73 0a 3b 3b 3d 3d 3d  ating runs.;;===
8080: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8090: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
80a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
80b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
80c0: 3d 3d 3d 0a 0a 3b 3b 20 53 69 6e 63 65 20 6d 61  ===..;; Since ma
80d0: 6e 79 20 63 61 6c 6c 73 20 74 6f 20 61 20 72 75  ny calls to a ru
80e0: 6e 20 72 65 71 75 69 72 65 20 70 72 65 74 74 79  n require pretty
80f0: 20 6d 75 63 68 20 74 68 65 20 73 61 6d 65 20 73   much the same s
8100: 65 74 75 70 20 0a 3b 3b 20 74 68 69 73 20 77 72  etup .;; this wr
8110: 61 70 70 65 72 20 69 73 20 75 73 65 64 20 74 6f  apper is used to
8120: 20 72 65 64 75 63 65 20 74 68 65 20 72 65 70 6c   reduce the repl
8130: 69 63 61 74 69 6f 6e 20 6f 66 20 63 6f 64 65 0a  ication of code.
8140: 28 64 65 66 69 6e 65 20 28 67 65 6e 65 72 61 6c  (define (general
8150: 2d 72 75 6e 2d 63 61 6c 6c 20 73 77 69 74 63 68  -run-call switch
8160: 6e 61 6d 65 20 61 63 74 69 6f 6e 2d 64 65 73 63  name action-desc
8170: 20 70 72 6f 63 29 0a 20 20 28 6c 65 74 20 28 28   proc).  (let ((
8180: 72 75 6e 6e 61 6d 65 20 28 61 72 67 73 3a 67 65  runname (args:ge
8190: 74 2d 61 72 67 20 22 3a 72 75 6e 6e 61 6d 65 22  t-arg ":runname"
81a0: 29 29 0a 09 28 74 61 72 67 65 74 20 20 28 69 66  ))..(target  (if
81b0: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
81c0: 2d 74 61 72 67 65 74 22 29 0a 09 09 20 20 20 20  -target")...    
81d0: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
81e0: 2d 74 61 72 67 65 74 22 29 0a 09 09 20 20 20 20  -target")...    
81f0: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
8200: 2d 72 65 71 74 61 72 67 22 29 29 29 0a 09 28 74  -reqtarg")))..(t
8210: 68 31 20 20 20 20 20 23 66 29 29 0a 20 20 20 20  h1     #f)).    
8220: 28 63 6f 6e 64 0a 20 20 20 20 20 28 28 6e 6f 74  (cond.     ((not
8230: 20 74 61 72 67 65 74 29 0a 20 20 20 20 20 20 28   target).      (
8240: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45  debug:print 0 "E
8250: 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67 20 72 65  RROR: Missing re
8260: 71 75 69 72 65 64 20 70 61 72 61 6d 65 74 65 72  quired parameter
8270: 20 66 6f 72 20 22 20 73 77 69 74 63 68 6e 61 6d   for " switchnam
8280: 65 20 22 2c 20 79 6f 75 20 6d 75 73 74 20 73 70  e ", you must sp
8290: 65 63 69 66 79 20 74 68 65 20 74 61 72 67 65 74  ecify the target
82a0: 20 77 69 74 68 20 2d 74 61 72 67 65 74 22 29 0a   with -target").
82b0: 20 20 20 20 20 20 28 65 78 69 74 20 33 29 29 0a        (exit 3)).
82c0: 20 20 20 20 20 28 28 6e 6f 74 20 72 75 6e 6e 61       ((not runna
82d0: 6d 65 29 0a 20 20 20 20 20 20 28 64 65 62 75 67  me).      (debug
82e0: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a  :print 0 "ERROR:
82f0: 20 4d 69 73 73 69 6e 67 20 72 65 71 75 69 72 65   Missing require
8300: 64 20 70 61 72 61 6d 65 74 65 72 20 66 6f 72 20  d parameter for 
8310: 22 20 73 77 69 74 63 68 6e 61 6d 65 20 22 2c 20  " switchname ", 
8320: 79 6f 75 20 6d 75 73 74 20 73 70 65 63 69 66 79  you must specify
8330: 20 74 68 65 20 72 75 6e 20 6e 61 6d 65 20 77 69   the run name wi
8340: 74 68 20 3a 72 75 6e 6e 61 6d 65 20 72 75 6e 6e  th :runname runn
8350: 61 6d 65 22 29 0a 20 20 20 20 20 20 28 65 78 69  ame").      (exi
8360: 74 20 33 29 29 0a 20 20 20 20 20 28 65 6c 73 65  t 3)).     (else
8370: 0a 20 20 20 20 20 20 28 6c 65 74 20 28 28 64 62  .      (let ((db
8380: 20 20 20 23 66 29 0a 09 20 20 20 20 28 6b 65 79     #f)..    (key
8390: 73 20 23 66 29 29 0a 09 28 69 66 20 28 6e 6f 74  s #f))..(if (not
83a0: 20 28 73 65 74 75 70 2d 66 6f 72 2d 72 75 6e 29   (setup-for-run)
83b0: 29 0a 09 20 20 20 20 28 62 65 67 69 6e 20 0a 09  )..    (begin ..
83c0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
83d0: 6e 74 20 30 20 22 46 61 69 6c 65 64 20 74 6f 20  nt 0 "Failed to 
83e0: 73 65 74 75 70 2c 20 65 78 69 74 69 6e 67 22 29  setup, exiting")
83f0: 0a 09 20 20 20 20 20 20 28 65 78 69 74 20 31 29  ..      (exit 1)
8400: 29 29 0a 09 28 73 65 74 21 20 64 62 20 20 20 28  ))..(set! db   (
8410: 6f 70 65 6e 2d 64 62 29 29 0a 09 28 69 66 20 28  open-db))..(if (
8420: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 73  args:get-arg "-s
8430: 65 72 76 65 72 22 29 0a 09 20 20 20 20 28 73 65  erver")..    (se
8440: 72 76 65 72 3a 73 74 61 72 74 20 64 62 20 28 61  rver:start db (a
8450: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 73 65  rgs:get-arg "-se
8460: 72 76 65 72 22 29 29 0a 09 20 20 20 20 28 69 66  rver"))..    (if
8470: 20 28 6e 6f 74 20 28 6f 72 20 28 61 72 67 73 3a   (not (or (args:
8480: 67 65 74 2d 61 72 67 20 22 2d 72 75 6e 61 6c 6c  get-arg "-runall
8490: 22 29 0a 09 09 09 20 20 28 61 72 67 73 3a 67 65  ")....  (args:ge
84a0: 74 2d 61 72 67 20 22 2d 72 75 6e 74 65 73 74 73  t-arg "-runtests
84b0: 22 29 29 29 0a 09 09 28 73 65 72 76 65 72 3a 63  ")))...(server:c
84c0: 6c 69 65 6e 74 2d 73 65 74 75 70 20 64 62 29 29  lient-setup db))
84d0: 29 0a 09 28 73 65 74 21 20 6b 65 79 73 20 28 72  )..(set! keys (r
84e0: 64 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29  db:get-keys db))
84f0: 0a 09 3b 3b 20 68 61 76 65 20 65 6e 6f 75 67 68  ..;; have enough
8500: 20 74 6f 20 70 72 6f 63 65 73 73 20 2d 74 61 72   to process -tar
8510: 67 65 74 20 6f 72 20 2d 72 65 71 74 61 72 67 20  get or -reqtarg 
8520: 68 65 72 65 0a 09 28 69 66 20 28 61 72 67 73 3a  here..(if (args:
8530: 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72  get-arg "-reqtar
8540: 67 22 29 0a 09 20 20 20 20 28 6c 65 74 2a 20 28  g")..    (let* (
8550: 28 72 75 6e 63 6f 6e 66 69 67 66 20 28 63 6f 6e  (runconfigf (con
8560: 63 20 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72  c  *toppath* "/r
8570: 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67  unconfigs.config
8580: 22 29 29 20 3b 3b 20 44 4f 20 4e 4f 54 20 45 56  ")) ;; DO NOT EV
8590: 41 4c 55 41 54 45 20 41 4c 4c 20 0a 09 09 20 20  ALUATE ALL ...  
85a0: 20 28 72 75 6e 63 6f 6e 66 69 67 20 20 28 72 65   (runconfig  (re
85b0: 61 64 2d 63 6f 6e 66 69 67 20 72 75 6e 63 6f 6e  ad-config runcon
85c0: 66 69 67 66 20 23 66 20 23 66 20 65 6e 76 69 72  figf #f #f envir
85d0: 6f 6e 2d 70 61 74 74 3a 20 23 66 29 29 29 20 0a  on-patt: #f))) .
85e0: 09 20 20 20 20 20 20 28 69 66 20 28 68 61 73 68  .      (if (hash
85f0: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75  -table-ref/defau
8600: 6c 74 20 72 75 6e 63 6f 6e 66 69 67 20 28 61 72  lt runconfig (ar
8610: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71  gs:get-arg "-req
8620: 74 61 72 67 22 29 20 23 66 29 0a 09 09 20 20 28  targ") #f)...  (
8630: 6b 65 79 73 3a 74 61 72 67 65 74 2d 73 65 74 2d  keys:target-set-
8640: 61 72 67 73 20 6b 65 79 73 20 28 61 72 67 73 3a  args keys (args:
8650: 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72  get-arg "-reqtar
8660: 67 22 29 20 61 72 67 73 3a 61 72 67 2d 68 61 73  g") args:arg-has
8670: 68 29 0a 09 09 20 20 28 62 65 67 69 6e 0a 09 09  h)...  (begin...
8680: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
8690: 20 30 20 22 45 52 52 4f 52 3a 20 5b 22 20 28 61   0 "ERROR: [" (a
86a0: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65  rgs:get-arg "-re
86b0: 71 74 61 72 67 22 29 20 22 5d 20 6e 6f 74 20 66  qtarg") "] not f
86c0: 6f 75 6e 64 20 69 6e 20 22 20 72 75 6e 63 6f 6e  ound in " runcon
86d0: 66 69 67 66 29 0a 09 09 20 20 20 20 28 73 71 6c  figf)...    (sql
86e0: 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64  ite3:finalize! d
86f0: 62 29 0a 09 09 20 20 20 20 28 65 78 69 74 20 31  b)...    (exit 1
8700: 29 29 29 29 0a 09 20 20 20 20 28 69 66 20 28 61  ))))..    (if (a
8710: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61  rgs:get-arg "-ta
8720: 72 67 65 74 22 29 0a 09 09 28 6b 65 79 73 3a 74  rget")...(keys:t
8730: 61 72 67 65 74 2d 73 65 74 2d 61 72 67 73 20 6b  arget-set-args k
8740: 65 79 73 20 28 61 72 67 73 3a 67 65 74 2d 61 72  eys (args:get-ar
8750: 67 20 22 2d 74 61 72 67 65 74 22 20 61 72 67 73  g "-target" args
8760: 3a 61 72 67 2d 68 61 73 68 29 20 61 72 67 73 3a  :arg-hash) args:
8770: 61 72 67 2d 68 61 73 68 29 29 29 0a 09 28 69 66  arg-hash)))..(if
8780: 20 28 6e 6f 74 20 28 63 61 72 20 2a 63 6f 6e 66   (not (car *conf
8790: 69 67 69 6e 66 6f 2a 29 29 0a 09 20 20 20 20 28  iginfo*))..    (
87a0: 62 65 67 69 6e 0a 09 20 20 20 20 20 20 28 64 65  begin..      (de
87b0: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52  bug:print 0 "ERR
87c0: 4f 52 3a 20 41 74 74 65 6d 70 74 65 64 20 74 6f  OR: Attempted to
87d0: 20 22 20 61 63 74 69 6f 6e 2d 64 65 73 63 20 22   " action-desc "
87e0: 20 62 75 74 20 72 75 6e 20 61 72 65 61 20 63 6f   but run area co
87f0: 6e 66 69 67 20 66 69 6c 65 20 6e 6f 74 20 66 6f  nfig file not fo
8800: 75 6e 64 22 29 0a 09 20 20 20 20 20 20 28 65 78  und")..      (ex
8810: 69 74 20 31 29 29 0a 09 20 20 20 20 3b 3b 20 45  it 1))..    ;; E
8820: 78 74 72 61 63 74 20 6f 75 74 20 73 74 75 66 66  xtract out stuff
8830: 20 6e 65 65 64 65 64 20 69 6e 20 6d 6f 73 74 20   needed in most 
8840: 6f 72 20 6d 61 6e 79 20 63 61 6c 6c 73 0a 09 20  or many calls.. 
8850: 20 20 20 3b 3b 20 68 65 72 65 20 74 68 65 6e 20     ;; here then 
8860: 63 61 6c 6c 20 70 72 6f 63 0a 09 20 20 20 20 28  call proc..    (
8870: 6c 65 74 2a 20 28 28 6b 65 79 6e 61 6d 65 73 20  let* ((keynames 
8880: 20 20 28 6d 61 70 20 6b 65 79 3a 67 65 74 2d 66    (map key:get-f
8890: 69 65 6c 64 6e 61 6d 65 20 6b 65 79 73 29 29 0a  ieldname keys)).
88a0: 09 09 20 20 20 28 6b 65 79 76 61 6c 6c 73 74 20  ..   (keyvallst 
88b0: 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69 73 74 20   (keys->vallist 
88c0: 6b 65 79 73 20 23 74 29 29 29 0a 09 20 20 20 20  keys #t)))..    
88d0: 20 20 28 70 72 6f 63 20 64 62 20 74 61 72 67 65    (proc db targe
88e0: 74 20 72 75 6e 6e 61 6d 65 20 6b 65 79 73 20 6b  t runname keys k
88f0: 65 79 6e 61 6d 65 73 20 6b 65 79 76 61 6c 6c 73  eynames keyvalls
8900: 74 29 29 29 0a 09 28 69 66 20 74 68 31 20 28 74  t)))..(if th1 (t
8910: 68 72 65 61 64 2d 6a 6f 69 6e 21 20 74 68 31 29  hread-join! th1)
8920: 29 0a 09 28 73 71 6c 69 74 65 33 3a 66 69 6e 61  )..(sqlite3:fina
8930: 6c 69 7a 65 21 20 64 62 29 0a 09 28 73 65 74 21  lize! db)..(set!
8940: 20 2a 64 69 64 73 6f 6d 65 74 68 69 6e 67 2a 20   *didsomething* 
8950: 23 74 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d  #t))))))..;;====
8960: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8970: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8980: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8990: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
89a0: 3d 3d 0a 3b 3b 20 4c 6f 63 6b 2f 75 6e 6c 6f 63  ==.;; Lock/unloc
89b0: 6b 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d  k runs.;;=======
89c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
89d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
89e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
89f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a  ===============.
8a00: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 68  .(define (runs:h
8a10: 61 6e 64 6c 65 2d 6c 6f 63 6b 69 6e 67 20 64 62  andle-locking db
8a20: 20 74 61 72 67 65 74 20 6b 65 79 73 20 72 75 6e   target keys run
8a30: 6e 61 6d 65 20 6c 6f 63 6b 20 75 6e 6c 6f 63 6b  name lock unlock
8a40: 20 75 73 65 72 29 0a 20 20 28 6c 65 74 2a 20 28   user).  (let* (
8a50: 28 72 75 6e 64 61 74 20 20 20 28 72 75 6e 73 3a  (rundat   (runs:
8a60: 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74 74  get-runs-by-patt
8a70: 20 64 62 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65   db keys runname
8a80: 29 29 0a 09 20 28 68 65 61 64 65 72 20 20 20 28  )).. (header   (
8a90: 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61  vector-ref runda
8aa0: 74 20 30 29 29 0a 09 20 28 72 75 6e 73 20 20 20  t 0)).. (runs   
8ab0: 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75    (vector-ref ru
8ac0: 6e 64 61 74 20 31 29 29 29 0a 20 20 20 20 28 66  ndat 1))).    (f
8ad0: 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 61 20  or-each (lambda 
8ae0: 28 72 75 6e 29 0a 09 09 28 6c 65 74 20 28 28 72  (run)...(let ((r
8af0: 75 6e 2d 69 64 20 28 64 62 3a 67 65 74 2d 76 61  un-id (db:get-va
8b00: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75  lue-by-header ru
8b10: 6e 20 68 65 61 64 65 72 20 22 69 64 22 29 29 29  n header "id")))
8b20: 0a 09 09 20 20 28 69 66 20 28 6f 72 20 6c 6f 63  ...  (if (or loc
8b30: 6b 0a 09 09 09 20 20 28 61 6e 64 20 75 6e 6c 6f  k....  (and unlo
8b40: 63 6b 0a 09 09 09 20 20 20 20 20 20 20 28 62 65  ck....       (be
8b50: 67 69 6e 0a 09 09 09 09 20 28 70 72 69 6e 74 20  gin..... (print 
8b60: 22 44 6f 20 79 6f 75 20 72 65 61 6c 6c 79 20 77  "Do you really w
8b70: 69 73 68 20 74 6f 20 75 6e 6c 6f 63 6b 20 72 75  ish to unlock ru
8b80: 6e 20 22 20 72 75 6e 2d 69 64 20 22 3f 5c 6e 20  n " run-id "?\n 
8b90: 20 20 79 2f 6e 3a 20 22 29 0a 09 09 09 09 20 28    y/n: ")..... (
8ba0: 65 71 75 61 6c 3f 20 22 79 22 20 28 72 65 61 64  equal? "y" (read
8bb0: 2d 6c 69 6e 65 29 29 29 29 29 0a 09 09 20 20 20  -line)))))...   
8bc0: 20 20 20 28 64 62 3a 6c 6f 63 6b 2f 75 6e 6c 6f     (db:lock/unlo
8bd0: 63 6b 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 64  ck-run db run-id
8be0: 20 6c 6f 63 6b 20 75 6e 6c 6f 63 6b 20 75 73 65   lock unlock use
8bf0: 72 29 0a 09 09 20 20 20 20 20 20 28 64 65 62 75  r)...      (debu
8c00: 67 3a 70 72 69 6e 74 20 30 20 22 49 4e 46 4f 3a  g:print 0 "INFO:
8c10: 20 53 6b 69 70 70 69 6e 67 20 6c 6f 63 6b 2f 75   Skipping lock/u
8c20: 6e 6c 6f 63 6b 20 6f 6e 20 22 20 72 75 6e 2d 69  nlock on " run-i
8c30: 64 29 29 29 29 0a 09 20 20 20 20 20 20 72 75 6e  d))))..      run
8c40: 73 29 29 29 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d  s))).;;=========
8c50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8c60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8c70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8c80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b  =============.;;
8c90: 20 52 6f 6c 6c 75 70 20 72 75 6e 73 0a 3b 3b 3d   Rollup runs.;;=
8ca0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8cb0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8cc0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8cd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8ce0: 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 55 70 64 61 74 65  =====..;; Update
8cf0: 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61 20 74   the test_meta t
8d00: 61 62 6c 65 20 66 6f 72 20 74 68 69 73 20 74 65  able for this te
8d10: 73 74 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73  st.(define (runs
8d20: 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74  :update-test_met
8d30: 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 74  a db test-name t
8d40: 65 73 74 2d 63 6f 6e 66 29 0a 20 20 28 6c 65 74  est-conf).  (let
8d50: 20 28 28 63 75 72 72 72 65 63 6f 72 64 20 28 64   ((currrecord (d
8d60: 62 3a 74 65 73 74 6d 65 74 61 2d 67 65 74 2d 72  b:testmeta-get-r
8d70: 65 63 6f 72 64 20 64 62 20 74 65 73 74 2d 6e 61  ecord db test-na
8d80: 6d 65 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e  me))).    (if (n
8d90: 6f 74 20 63 75 72 72 72 65 63 6f 72 64 29 0a 09  ot currrecord)..
8da0: 28 62 65 67 69 6e 0a 09 20 20 28 73 65 74 21 20  (begin..  (set! 
8db0: 63 75 72 72 72 65 63 6f 72 64 20 28 6d 61 6b 65  currrecord (make
8dc0: 2d 76 65 63 74 6f 72 20 31 30 20 23 66 29 29 0a  -vector 10 #f)).
8dd0: 09 20 20 28 64 62 3a 74 65 73 74 6d 65 74 61 2d  .  (db:testmeta-
8de0: 61 64 64 2d 72 65 63 6f 72 64 20 64 62 20 74 65  add-record db te
8df0: 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 28  st-name))).    (
8e00: 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28  for-each .     (
8e10: 6c 61 6d 62 64 61 20 28 6b 65 79 29 0a 20 20 20  lambda (key).   
8e20: 20 20 20 20 28 6c 65 74 2a 20 28 28 69 64 78 20      (let* ((idx 
8e30: 28 63 61 64 72 20 6b 65 79 29 29 0a 09 20 20 20  (cadr key))..   
8e40: 20 20 20 28 66 6c 64 20 28 63 61 72 20 20 6b 65     (fld (car  ke
8e50: 79 29 29 0a 09 20 20 20 20 20 20 28 76 61 6c 20  y))..      (val 
8e60: 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74  (config-lookup t
8e70: 65 73 74 2d 63 6f 6e 66 20 22 74 65 73 74 5f 6d  est-conf "test_m
8e80: 65 74 61 22 20 66 6c 64 29 29 29 0a 09 20 3b 3b  eta" fld))).. ;;
8e90: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 35 20   (debug:print 5 
8ea0: 22 69 64 78 3a 20 22 20 69 64 78 20 22 20 66 6c  "idx: " idx " fl
8eb0: 64 3a 20 22 20 66 6c 64 20 22 20 76 61 6c 3a 20  d: " fld " val: 
8ec0: 22 20 76 61 6c 29 0a 09 20 28 69 66 20 28 61 6e  " val).. (if (an
8ed0: 64 20 76 61 6c 20 28 6e 6f 74 20 28 65 71 75 61  d val (not (equa
8ee0: 6c 3f 20 28 76 65 63 74 6f 72 2d 72 65 66 20 63  l? (vector-ref c
8ef0: 75 72 72 72 65 63 6f 72 64 20 69 64 78 29 20 76  urrrecord idx) v
8f00: 61 6c 29 29 29 0a 09 20 20 20 20 20 28 62 65 67  al)))..     (beg
8f10: 69 6e 0a 09 20 20 20 20 20 20 20 28 70 72 69 6e  in..       (prin
8f20: 74 20 22 55 70 64 61 74 69 6e 67 20 22 20 74 65  t "Updating " te
8f30: 73 74 2d 6e 61 6d 65 20 22 20 22 20 66 6c 64 20  st-name " " fld 
8f40: 22 20 74 6f 20 22 20 76 61 6c 29 0a 09 20 20 20  " to " val)..   
8f50: 20 20 20 20 28 64 62 3a 74 65 73 74 6d 65 74 61      (db:testmeta
8f60: 2d 75 70 64 61 74 65 2d 66 69 65 6c 64 20 64 62  -update-field db
8f70: 20 74 65 73 74 2d 6e 61 6d 65 20 66 6c 64 20 76   test-name fld v
8f80: 61 6c 29 29 29 29 29 0a 20 20 20 20 20 27 28 28  al))))).     '((
8f90: 22 61 75 74 68 6f 72 22 20 32 29 28 22 6f 77 6e  "author" 2)("own
8fa0: 65 72 22 20 33 29 28 22 64 65 73 63 72 69 70 74  er" 3)("descript
8fb0: 69 6f 6e 22 20 34 29 28 22 72 65 76 69 65 77 65  ion" 4)("reviewe
8fc0: 64 22 20 35 29 28 22 74 61 67 73 22 20 39 29 29  d" 5)("tags" 9))
8fd0: 29 29 29 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74  )))..;; Update t
8fe0: 65 73 74 5f 6d 65 74 61 20 66 6f 72 20 61 6c 6c  est_meta for all
8ff0: 20 74 65 73 74 73 0a 28 64 65 66 69 6e 65 20 28   tests.(define (
9000: 72 75 6e 73 3a 75 70 64 61 74 65 2d 61 6c 6c 2d  runs:update-all-
9010: 74 65 73 74 5f 6d 65 74 61 20 64 62 29 0a 20 20  test_meta db).  
9020: 28 6c 65 74 20 28 28 74 65 73 74 2d 6e 61 6d 65  (let ((test-name
9030: 73 20 28 67 65 74 2d 61 6c 6c 2d 6c 65 67 61 6c  s (get-all-legal
9040: 2d 74 65 73 74 73 29 29 29 0a 20 20 20 20 28 66  -tests))).    (f
9050: 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c  or-each .     (l
9060: 61 6d 62 64 61 20 28 74 65 73 74 2d 6e 61 6d 65  ambda (test-name
9070: 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28  ).       (let* (
9080: 28 74 65 73 74 2d 70 61 74 68 20 20 20 20 28 63  (test-path    (c
9090: 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f  onc *toppath* "/
90a0: 74 65 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d  tests/" test-nam
90b0: 65 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 74  e))..      (test
90c0: 2d 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 74  -configf (conc t
90d0: 65 73 74 2d 70 61 74 68 20 22 2f 74 65 73 74 63  est-path "/testc
90e0: 6f 6e 66 69 67 22 29 29 0a 09 20 20 20 20 20 20  onfig"))..      
90f0: 28 74 65 73 74 65 78 69 73 74 73 20 20 20 28 61  (testexists   (a
9100: 6e 64 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f  nd (file-exists?
9110: 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 28 66   test-configf)(f
9120: 69 6c 65 2d 72 65 61 64 2d 61 63 63 65 73 73 3f  ile-read-access?
9130: 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 29 29   test-configf)))
9140: 0a 09 20 20 20 20 20 20 3b 3b 20 72 65 61 64 20  ..      ;; read 
9150: 63 6f 6e 66 69 67 73 20 77 69 74 68 20 74 72 69  configs with tri
9160: 63 6b 73 20 74 75 72 6e 65 64 20 6f 66 66 20 28  cks turned off (
9170: 69 2e 65 2e 20 6e 6f 20 73 79 73 74 65 6d 29 0a  i.e. no system).
9180: 09 20 20 20 20 20 20 28 74 65 73 74 2d 63 6f 6e  .      (test-con
9190: 66 20 20 20 20 28 69 66 20 74 65 73 74 65 78 69  f    (if testexi
91a0: 73 74 73 20 28 72 65 61 64 2d 63 6f 6e 66 69 67  sts (read-config
91b0: 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 23 66   test-configf #f
91c0: 20 23 66 29 28 6d 61 6b 65 2d 68 61 73 68 2d 74   #f)(make-hash-t
91d0: 61 62 6c 65 29 29 29 29 0a 09 20 28 72 75 6e 73  able)))).. (runs
91e0: 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74  :update-test_met
91f0: 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 74  a db test-name t
9200: 65 73 74 2d 63 6f 6e 66 29 29 29 0a 20 20 20 20  est-conf))).    
9210: 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a 0a   test-names)))..
9220: 3b 3b 20 54 68 69 73 20 63 6f 75 6c 64 20 70 72  ;; This could pr
9230: 6f 62 61 62 6c 79 20 62 65 20 72 65 66 61 63 74  obably be refact
9240: 6f 72 65 64 20 69 6e 74 6f 20 6f 6e 65 20 63 6f  ored into one co
9250: 6d 70 6c 65 78 20 71 75 65 72 79 20 2e 2e 2e 0a  mplex query ....
9260: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 6f  (define (runs:ro
9270: 6c 6c 75 70 2d 72 75 6e 20 64 62 20 6b 65 79 73  llup-run db keys
9280: 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61   keyvallst runna
9290: 6d 65 20 75 73 65 72 29 20 3b 3b 20 77 61 73 20  me user) ;; was 
92a0: 74 61 72 67 65 74 2c 20 6e 6f 77 20 6b 65 79 76  target, now keyv
92b0: 61 6c 6c 73 74 0a 20 20 28 64 65 62 75 67 3a 70  allst.  (debug:p
92c0: 72 69 6e 74 20 34 20 22 72 75 6e 73 3a 72 6f 6c  rint 4 "runs:rol
92d0: 6c 75 70 2d 72 75 6e 2c 20 6b 65 79 73 3a 20 22  lup-run, keys: "
92e0: 20 6b 65 79 73 20 22 20 6b 65 79 76 61 6c 6c 73   keys " keyvalls
92f0: 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 20 22  t: " keyvallst "
9300: 20 3a 72 75 6e 6e 61 6d 65 20 22 20 72 75 6e 6e   :runname " runn
9310: 61 6d 65 20 22 20 75 73 65 72 3a 20 22 20 75 73  ame " user: " us
9320: 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 3b 20 28  er).  (let* (; (
9330: 6b 65 79 76 61 6c 6c 6c 73 74 20 20 20 20 20 20  keyvalllst      
9340: 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 3e 6b 65  (keys:target->ke
9350: 79 76 61 6c 20 6b 65 79 73 20 74 61 72 67 65 74  yval keys target
9360: 29 29 0a 09 20 28 6e 65 77 2d 72 75 6e 2d 69 64  )).. (new-run-id
9370: 20 20 20 20 20 20 28 72 75 6e 73 3a 72 65 67 69        (runs:regi
9380: 73 74 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73  ster-run db keys
9390: 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61   keyvallst runna
93a0: 6d 65 20 22 6e 65 77 22 20 22 6e 2f 61 22 20 75  me "new" "n/a" u
93b0: 73 65 72 29 29 0a 09 20 28 70 72 65 76 2d 74 65  ser)).. (prev-te
93c0: 73 74 73 20 20 20 20 20 20 28 74 65 73 74 3a 67  sts      (test:g
93d0: 65 74 2d 6d 61 74 63 68 69 6e 67 2d 70 72 65 76  et-matching-prev
93e0: 69 6f 75 73 2d 74 65 73 74 2d 72 75 6e 2d 72 65  ious-test-run-re
93f0: 63 6f 72 64 73 20 64 62 20 6e 65 77 2d 72 75 6e  cords db new-run
9400: 2d 69 64 20 22 25 22 20 22 25 22 29 29 0a 09 20  -id "%" "%")).. 
9410: 28 63 75 72 72 2d 74 65 73 74 73 20 20 20 20 20  (curr-tests     
9420: 20 28 72 64 62 3a 67 65 74 2d 74 65 73 74 73 2d   (rdb:get-tests-
9430: 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77 2d 72  for-run db new-r
9440: 75 6e 2d 69 64 20 22 25 22 20 22 25 22 20 27 28  un-id "%" "%" '(
9450: 29 20 27 28 29 29 29 0a 09 20 28 63 75 72 72 2d  ) '())).. (curr-
9460: 74 65 73 74 73 2d 68 61 73 68 20 28 6d 61 6b 65  tests-hash (make
9470: 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 20  -hash-table))). 
9480: 20 20 20 28 64 62 3a 75 70 64 61 74 65 2d 72 75     (db:update-ru
9490: 6e 2d 65 76 65 6e 74 5f 74 69 6d 65 20 64 62 20  n-event_time db 
94a0: 6e 65 77 2d 72 75 6e 2d 69 64 29 0a 20 20 20 20  new-run-id).    
94b0: 3b 3b 20 69 6e 64 65 78 20 74 68 65 20 61 6c 72  ;; index the alr
94c0: 65 61 64 79 20 73 61 76 65 64 20 74 65 73 74 73  eady saved tests
94d0: 20 62 79 20 74 65 73 74 6e 61 6d 65 20 61 6e 64   by testname and
94e0: 20 69 74 65 6d 64 61 74 20 69 6e 20 63 75 72 72   itemdat in curr
94f0: 2d 74 65 73 74 73 2d 68 61 73 68 0a 20 20 20 20  -tests-hash.    
9500: 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 28  (for-each.     (
9510: 6c 61 6d 62 64 61 20 28 74 65 73 74 64 61 74 29  lambda (testdat)
9520: 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28  .       (let* ((
9530: 74 65 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 65  testname  (db:te
9540: 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20  st-get-testname 
9550: 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20  testdat))..     
9560: 20 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a   (item-path (db:
9570: 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61  test-get-item-pa
9580: 74 68 20 74 65 73 74 64 61 74 29 29 0a 09 20 20  th testdat))..  
9590: 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28      (full-name (
95a0: 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f  conc testname "/
95b0: 22 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 09  " item-path)))..
95c0: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74   (hash-table-set
95d0: 21 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73  ! curr-tests-has
95e0: 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 74 65 73 74  h full-name test
95f0: 64 61 74 29 29 29 0a 20 20 20 20 20 63 75 72 72  dat))).     curr
9600: 2d 74 65 73 74 73 29 0a 20 20 20 20 3b 3b 20 4e  -tests).    ;; N
9610: 4f 50 45 3a 20 4e 6f 6e 2d 6f 70 74 69 6d 61 6c  OPE: Non-optimal
9620: 20 61 70 70 72 6f 61 63 68 2e 20 54 72 79 20 74   approach. Try t
9630: 68 69 73 20 69 6e 73 74 65 61 64 2e 0a 20 20 20  his instead..   
9640: 20 3b 3b 20 20 20 31 2e 20 74 65 73 74 73 20 61   ;;   1. tests a
9650: 72 65 20 72 65 63 65 69 76 65 64 20 69 6e 20 61  re received in a
9660: 20 6c 69 73 74 2c 20 6d 6f 73 74 20 72 65 63 65   list, most rece
9670: 6e 74 20 66 69 72 73 74 0a 20 20 20 20 3b 3b 20  nt first.    ;; 
9680: 20 20 32 2e 20 72 65 70 6c 61 63 65 20 74 68 65    2. replace the
9690: 20 72 6f 6c 6c 75 70 20 74 65 73 74 20 77 69 74   rollup test wit
96a0: 68 20 74 68 65 20 6e 65 77 20 2a 61 6c 77 61 79  h the new *alway
96b0: 73 2a 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68  s*.    (for-each
96c0: 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28   .     (lambda (
96d0: 74 65 73 74 64 61 74 29 0a 20 20 20 20 20 20 20  testdat).       
96e0: 28 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65  (let* ((testname
96f0: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74    (db:test-get-t
9700: 65 73 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29  estname testdat)
9710: 29 0a 09 20 20 20 20 20 20 28 69 74 65 6d 2d 70  )..      (item-p
9720: 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74  ath (db:test-get
9730: 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 64  -item-path testd
9740: 61 74 29 29 0a 09 20 20 20 20 20 20 28 66 75 6c  at))..      (ful
9750: 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73  l-name (conc tes
9760: 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70  tname "/" item-p
9770: 61 74 68 29 29 0a 09 20 20 20 20 20 20 28 70 72  ath))..      (pr
9780: 65 76 2d 74 65 73 74 2d 64 61 74 20 28 68 61 73  ev-test-dat (has
9790: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61  h-table-ref/defa
97a0: 75 6c 74 20 63 75 72 72 2d 74 65 73 74 73 2d 68  ult curr-tests-h
97b0: 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 23 66  ash full-name #f
97c0: 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d  ))..      (test-
97d0: 73 74 65 70 73 20 20 20 20 20 20 28 64 62 3a 67  steps      (db:g
97e0: 65 74 2d 73 74 65 70 73 2d 66 6f 72 2d 74 65 73  et-steps-for-tes
97f0: 74 20 64 62 20 28 64 62 3a 74 65 73 74 2d 67 65  t db (db:test-ge
9800: 74 2d 69 64 20 74 65 73 74 64 61 74 29 29 29 0a  t-id testdat))).
9810: 09 20 20 20 20 20 20 28 6e 65 77 2d 74 65 73 74  .      (new-test
9820: 2d 72 65 63 6f 72 64 20 23 66 29 29 0a 09 20 3b  -record #f)).. ;
9830: 3b 20 72 65 70 6c 61 63 65 20 74 68 65 73 65 20  ; replace these 
9840: 77 69 74 68 20 69 6e 73 65 72 74 20 2e 2e 2e 20  with insert ... 
9850: 73 65 6c 65 63 74 0a 09 20 28 61 70 70 6c 79 20  select.. (apply 
9860: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20  sqlite3:execute 
9870: 0a 09 09 64 62 20 0a 09 09 28 63 6f 6e 63 20 22  ...db ...(conc "
9880: 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43  INSERT OR REPLAC
9890: 45 20 49 4e 54 4f 20 74 65 73 74 73 20 28 72 75  E INTO tests (ru
98a0: 6e 5f 69 64 2c 74 65 73 74 6e 61 6d 65 2c 73 74  n_id,testname,st
98b0: 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74  ate,status,event
98c0: 5f 74 69 6d 65 2c 68 6f 73 74 2c 63 70 75 6c 6f  _time,host,cpulo
98d0: 61 64 2c 64 69 73 6b 66 72 65 65 2c 75 6e 61 6d  ad,diskfree,unam
98e0: 65 2c 72 75 6e 64 69 72 2c 69 74 65 6d 5f 70 61  e,rundir,item_pa
98f0: 74 68 2c 72 75 6e 5f 64 75 72 61 74 69 6f 6e 2c  th,run_duration,
9900: 66 69 6e 61 6c 5f 6c 6f 67 66 2c 63 6f 6d 6d 65  final_logf,comme
9910: 6e 74 29 20 22 0a 09 09 20 20 20 20 20 20 22 56  nt) "...      "V
9920: 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c 3f  ALUES (?,?,?,?,?
9930: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f  ,?,?,?,?,?,?,?,?
9940: 2c 3f 29 3b 22 29 0a 09 09 6e 65 77 2d 72 75 6e  ,?);")...new-run
9950: 2d 69 64 20 28 63 64 64 72 20 28 76 65 63 74 6f  -id (cddr (vecto
9960: 72 2d 3e 6c 69 73 74 20 74 65 73 74 64 61 74 29  r->list testdat)
9970: 29 29 0a 09 20 28 73 65 74 21 20 6e 65 77 2d 74  )).. (set! new-t
9980: 65 73 74 64 61 74 20 28 63 61 72 20 28 72 64 62  estdat (car (rdb
9990: 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72  :get-tests-for-r
99a0: 75 6e 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64  un db new-run-id
99b0: 20 74 65 73 74 6e 61 6d 65 20 69 74 65 6d 2d 70   testname item-p
99c0: 61 74 68 20 27 28 29 20 27 28 29 29 29 29 0a 09  ath '() '())))..
99d0: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74   (hash-table-set
99e0: 21 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73  ! curr-tests-has
99f0: 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 6e 65 77 2d  h full-name new-
9a00: 74 65 73 74 64 61 74 29 20 3b 3b 20 74 68 69 73  testdat) ;; this
9a10: 20 63 6f 75 6c 64 20 62 65 20 63 6f 6e 66 75 73   could be confus
9a20: 69 6e 67 2c 20 77 68 69 63 68 20 72 65 63 6f 72  ing, which recor
9a30: 64 20 73 68 6f 75 6c 64 20 67 6f 20 69 6e 74 6f  d should go into
9a40: 20 74 68 65 20 6c 6f 6f 6b 75 70 20 74 61 62 6c   the lookup tabl
9a50: 65 3f 0a 09 20 3b 3b 20 4e 6f 77 20 64 75 70 6c  e?.. ;; Now dupl
9a60: 69 63 61 74 65 20 74 68 65 20 74 65 73 74 20 73  icate the test s
9a70: 74 65 70 73 0a 09 20 28 64 65 62 75 67 3a 70 72  teps.. (debug:pr
9a80: 69 6e 74 20 34 20 22 43 6f 70 79 69 6e 67 20 72  int 4 "Copying r
9a90: 65 63 6f 72 64 73 20 69 6e 20 74 65 73 74 5f 73  ecords in test_s
9aa0: 74 65 70 73 20 66 72 6f 6d 20 74 65 73 74 5f 69  teps from test_i
9ab0: 64 3d 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74  d=" (db:test-get
9ac0: 2d 69 64 20 74 65 73 74 64 61 74 29 20 22 20 74  -id testdat) " t
9ad0: 6f 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74  o " (db:test-get
9ae0: 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29  -id new-testdat)
9af0: 29 0a 09 20 28 73 71 6c 69 74 65 33 3a 65 78 65  ).. (sqlite3:exe
9b00: 63 75 74 65 20 0a 09 20 20 64 62 20 0a 09 20 20  cute ..  db ..  
9b10: 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52  (conc "INSERT OR
9b20: 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65   REPLACE INTO te
9b30: 73 74 5f 73 74 65 70 73 20 28 74 65 73 74 5f 69  st_steps (test_i
9b40: 64 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 74 65  d,stepname,state
9b50: 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69  ,status,event_ti
9b60: 6d 65 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09  me,comment) "...
9b70: 22 53 45 4c 45 43 54 20 22 20 28 64 62 3a 74 65  "SELECT " (db:te
9b80: 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65  st-get-id new-te
9b90: 73 74 64 61 74 29 20 22 2c 73 74 65 70 6e 61 6d  stdat) ",stepnam
9ba0: 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c 65  e,state,status,e
9bb0: 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e  vent_time,commen
9bc0: 74 20 46 52 4f 4d 20 74 65 73 74 5f 73 74 65 70  t FROM test_step
9bd0: 73 20 57 48 45 52 45 20 74 65 73 74 5f 69 64 3d  s WHERE test_id=
9be0: 3f 3b 22 29 0a 09 20 20 28 64 62 3a 74 65 73 74  ?;")..  (db:test
9bf0: 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29  -get-id testdat)
9c00: 29 0a 09 20 3b 3b 20 4e 6f 77 20 64 75 70 6c 69  ).. ;; Now dupli
9c10: 63 61 74 65 20 74 68 65 20 74 65 73 74 20 64 61  cate the test da
9c20: 74 61 0a 09 20 28 64 65 62 75 67 3a 70 72 69 6e  ta.. (debug:prin
9c30: 74 20 34 20 22 43 6f 70 79 69 6e 67 20 72 65 63  t 4 "Copying rec
9c40: 6f 72 64 73 20 69 6e 20 74 65 73 74 5f 64 61 74  ords in test_dat
9c50: 61 20 66 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22  a from test_id="
9c60: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64   (db:test-get-id
9c70: 20 74 65 73 74 64 61 74 29 20 22 20 74 6f 20 22   testdat) " to "
9c80: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64   (db:test-get-id
9c90: 20 6e 65 77 2d 74 65 73 74 64 61 74 29 29 0a 09   new-testdat))..
9ca0: 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74   (sqlite3:execut
9cb0: 65 20 0a 09 20 20 64 62 20 0a 09 20 20 28 63 6f  e ..  db ..  (co
9cc0: 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45  nc "INSERT OR RE
9cd0: 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 74 5f  PLACE INTO test_
9ce0: 64 61 74 61 20 28 74 65 73 74 5f 69 64 2c 63 61  data (test_id,ca
9cf0: 74 65 67 6f 72 79 2c 76 61 72 69 61 62 6c 65 2c  tegory,variable,
9d00: 76 61 6c 75 65 2c 65 78 70 65 63 74 65 64 2c 74  value,expected,t
9d10: 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65 6e 74  ol,units,comment
9d20: 29 20 22 0a 09 09 22 53 45 4c 45 43 54 20 22 20  ) "..."SELECT " 
9d30: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20  (db:test-get-id 
9d40: 6e 65 77 2d 74 65 73 74 64 61 74 29 20 22 2c 63  new-testdat) ",c
9d50: 61 74 65 67 6f 72 79 2c 76 61 72 69 61 62 6c 65  ategory,variable
9d60: 2c 76 61 6c 75 65 2c 65 78 70 65 63 74 65 64 2c  ,value,expected,
9d70: 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65 6e  tol,units,commen
9d80: 74 20 46 52 4f 4d 20 74 65 73 74 5f 64 61 74 61  t FROM test_data
9d90: 20 57 48 45 52 45 20 74 65 73 74 5f 69 64 3d 3f   WHERE test_id=?
9da0: 3b 22 29 0a 09 20 20 28 64 62 3a 74 65 73 74 2d  ;")..  (db:test-
9db0: 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 29  get-id testdat))
9dc0: 0a 09 20 29 29 0a 20 20 20 20 20 70 72 65 76 2d  .. )).     prev-
9dd0: 74 65 73 74 73 29 29 29 0a 09 20 0a 20 20 20 20  tests))).. .    
9de0: 20 0a                                             .