Megatest

Hex Artifact Content
Login

Artifact a3880499000fdece0b3bec64fa9e2eba41adc49e:


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 6d 20 27 6e 6f 72  ....(if m m 'nor
3250: 6d 61 6c 29 29 29 0a 09 09 20 28 77 61 69 74 6f  mal)))... (waito
3260: 6e 73 20 20 20 20 20 28 74 65 73 74 73 3a 74 65  ns     (tests:te
3270: 73 74 71 75 65 75 65 2d 67 65 74 2d 77 61 69 74  stqueue-get-wait
3280: 6f 6e 73 20 20 20 20 74 65 73 74 2d 72 65 63 6f  ons    test-reco
3290: 72 64 29 29 0a 09 09 20 28 70 72 69 6f 72 69 74  rd))... (priorit
32a0: 79 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74  y    (tests:test
32b0: 71 75 65 75 65 2d 67 65 74 2d 70 72 69 6f 72 69  queue-get-priori
32c0: 74 79 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64  ty   test-record
32d0: 29 29 0a 09 09 20 28 69 74 65 6d 64 61 74 20 20  ))... (itemdat  
32e0: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75     (tests:testqu
32f0: 65 75 65 2d 67 65 74 2d 69 74 65 6d 64 61 74 20  eue-get-itemdat 
3300: 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29     test-record))
3310: 20 3b 3b 20 69 74 65 6d 64 61 74 20 63 61 6e 20   ;; itemdat can 
3320: 62 65 20 61 20 73 74 72 69 6e 67 2c 20 6c 69 73  be a string, lis
3330: 74 20 6f 72 20 23 66 0a 09 09 20 28 69 74 65 6d  t or #f... (item
3340: 73 20 20 20 20 20 20 20 28 74 65 73 74 73 3a 74  s       (tests:t
3350: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65  estqueue-get-ite
3360: 6d 73 20 20 20 20 20 20 74 65 73 74 2d 72 65 63  ms      test-rec
3370: 6f 72 64 29 29 0a 09 09 20 28 69 74 65 6d 2d 70  ord))... (item-p
3380: 61 74 68 20 20 20 28 69 74 65 6d 2d 6c 69 73 74  ath   (item-list
3390: 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74 29 29  ->path itemdat))
33a0: 0a 09 09 20 28 6e 65 77 74 61 6c 20 20 20 20 20  ... (newtal     
33b0: 20 28 61 70 70 65 6e 64 20 74 61 6c 20 28 6c 69   (append tal (li
33c0: 73 74 20 68 65 64 29 29 29 0a 09 09 20 28 63 61  st hed)))... (ca
33d0: 6c 63 2d 66 61 69 6c 73 20 20 28 6c 61 6d 62 64  lc-fails  (lambd
33e0: 61 20 28 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d  a (prereqs-not-m
33f0: 65 74 29 0a 09 09 09 09 28 66 69 6c 74 65 72 20  et).....(filter 
3400: 28 6c 61 6d 62 64 61 20 28 74 65 73 74 29 0a 09  (lambda (test)..
3410: 09 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 69  ....  (debug:pri
3420: 6e 74 20 39 20 22 74 65 73 74 3a 20 22 20 74 65  nt 9 "test: " te
3430: 73 74 29 0a 09 09 09 09 09 20 20 28 61 6e 64 20  st)......  (and 
3440: 28 76 65 63 74 6f 72 3f 20 74 65 73 74 29 20 3b  (vector? test) ;
3450: 3b 20 6e 6f 74 20 28 73 74 72 69 6e 67 3f 20 74  ; not (string? t
3460: 65 73 74 29 29 0a 09 09 09 09 09 20 20 20 20 20  est))......     
3470: 20 20 28 65 71 75 61 6c 3f 20 28 64 62 3a 74 65    (equal? (db:te
3480: 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74 65 73  st-get-state tes
3490: 74 29 20 22 43 4f 4d 50 4c 45 54 45 44 22 29 0a  t) "COMPLETED").
34a0: 09 09 09 09 09 20 20 20 20 20 20 20 28 6e 6f 74  .....       (not
34b0: 20 28 6d 65 6d 62 65 72 20 28 64 62 3a 74 65 73   (member (db:tes
34c0: 74 2d 67 65 74 2d 73 74 61 74 75 73 20 74 65 73  t-get-status tes
34d0: 74 29 0a 09 09 09 09 09 09 09 20 20 20 20 27 28  t)........    '(
34e0: 22 50 41 53 53 22 20 22 57 41 52 4e 22 20 22 43  "PASS" "WARN" "C
34f0: 48 45 43 4b 22 20 22 57 41 49 56 45 44 22 29 29  HECK" "WAIVED"))
3500: 29 29 29 0a 09 09 09 09 09 70 72 65 72 65 71 73  )))......prereqs
3510: 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a 09 09 20 28  -not-met)))... (
3520: 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 74  calc-not-complet
3530: 65 64 20 28 6c 61 6d 62 64 61 20 28 70 72 65 72  ed (lambda (prer
3540: 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09 09  eqs-not-met)....
3550: 09 20 20 20 20 20 20 20 28 66 69 6c 74 65 72 0a  .       (filter.
3560: 09 09 09 09 09 28 6c 61 6d 62 64 61 20 28 74 29  .....(lambda (t)
3570: 0a 09 09 09 09 09 20 20 28 6f 72 20 28 6e 6f 74  ......  (or (not
3580: 20 28 76 65 63 74 6f 72 3f 20 74 29 29 0a 09 09   (vector? t))...
3590: 09 09 09 20 20 20 20 20 20 28 6e 6f 74 20 28 65  ...      (not (e
35a0: 71 75 61 6c 3f 20 22 43 4f 4d 50 4c 45 54 45 44  qual? "COMPLETED
35b0: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73  " (db:test-get-s
35c0: 74 61 74 65 20 74 29 29 29 29 29 0a 09 09 09 09  tate t))))).....
35d0: 09 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74  .prereqs-not-met
35e0: 29 29 29 0a 09 09 20 28 70 72 65 74 74 79 2d 73  )))... (pretty-s
35f0: 74 72 69 6e 67 20 28 6c 61 6d 62 64 61 20 28 6c  tring (lambda (l
3600: 73 74 29 0a 09 09 09 09 20 20 28 6d 61 70 20 28  st).....  (map (
3610: 6c 61 6d 62 64 61 20 28 74 29 0a 09 09 09 09 09  lambda (t)......
3620: 20 28 69 66 20 28 73 74 72 69 6e 67 3f 20 74 29   (if (string? t)
3630: 0a 09 09 09 09 09 20 20 20 20 20 74 0a 09 09 09  ......     t....
3640: 09 09 20 20 20 20 20 28 63 6f 6e 63 20 28 64 62  ..     (conc (db
3650: 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61  :test-get-testna
3660: 6d 65 20 74 29 20 22 3a 22 20 28 64 62 3a 74 65  me t) ":" (db:te
3670: 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74 29 20  st-get-state t) 
3680: 22 2f 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74  "/" (db:test-get
3690: 2d 73 74 61 74 75 73 20 74 29 29 29 29 0a 09 09  -status t))))...
36a0: 09 09 20 20 20 20 20 20 20 6c 73 74 29 29 29 29  ..       lst))))
36b0: 0a 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ..    (debug:pri
36c0: 6e 74 20 36 0a 09 09 09 20 22 69 74 65 6d 64 61  nt 6.... "itemda
36d0: 74 3a 20 20 20 20 20 22 20 69 74 65 6d 64 61 74  t:     " itemdat
36e0: 0a 09 09 09 20 22 5c 6e 20 20 69 74 65 6d 73 3a  .... "\n  items:
36f0: 20 20 20 20 20 22 20 69 74 65 6d 73 0a 09 09 09       " items....
3700: 20 22 5c 6e 20 20 69 74 65 6d 2d 70 61 74 68 3a   "\n  item-path:
3710: 20 22 20 69 74 65 6d 2d 70 61 74 68 0a 09 09 09   " item-path....
3720: 20 22 5c 6e 20 20 77 61 69 74 6f 6e 73 3a 20 20   "\n  waitons:  
3730: 20 22 20 77 61 69 74 6f 6e 73 29 0a 0a 09 20 20   " waitons)...  
3740: 20 20 3b 3b 20 63 68 65 63 6b 20 66 6f 72 20 68    ;; check for h
3750: 65 64 20 69 6e 20 77 61 69 74 6f 6e 73 20 3d 3e  ed in waitons =>
3760: 20 74 68 69 73 20 77 6f 75 6c 64 20 62 65 20 63   this would be c
3770: 69 72 63 75 6c 61 72 2c 20 72 65 6d 6f 76 65 20  ircular, remove 
3780: 69 74 20 61 6e 64 20 69 73 73 75 65 20 61 6e 0a  it and issue an.
3790: 09 20 20 20 20 3b 3b 20 65 72 72 6f 72 0a 09 20  .    ;; error.. 
37a0: 20 20 20 28 69 66 20 28 6d 65 6d 62 65 72 20 68     (if (member h
37b0: 65 64 20 77 61 69 74 6f 6e 73 29 0a 09 09 28 62  ed waitons)...(b
37c0: 65 67 69 6e 0a 09 09 20 20 28 64 65 62 75 67 3a  egin...  (debug:
37d0: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
37e0: 74 65 73 74 20 22 20 68 65 64 20 22 20 68 61 73  test " hed " has
37f0: 20 6c 69 73 74 65 64 20 69 74 73 65 6c 66 20 61   listed itself a
3800: 73 20 61 20 77 61 69 74 6f 6e 2c 20 70 6c 65 61  s a waiton, plea
3810: 73 65 20 63 6f 72 72 65 63 74 20 74 68 69 73 21  se correct this!
3820: 22 29 0a 09 09 20 20 28 73 65 74 21 20 77 61 69  ")...  (set! wai
3830: 74 6f 6e 20 28 66 69 6c 74 65 72 20 28 6c 61 6d  ton (filter (lam
3840: 62 64 61 20 28 78 29 28 6e 6f 74 20 28 65 71 75  bda (x)(not (equ
3850: 61 6c 3f 20 78 20 68 65 64 29 29 29 20 77 61 69  al? x hed))) wai
3860: 74 6f 6e 73 29 29 29 29 0a 0a 09 20 20 20 20 28  tons))))...    (
3870: 63 6f 6e 64 0a 09 20 20 20 20 20 28 28 6e 6f 74  cond..     ((not
3880: 20 69 74 65 6d 73 29 20 3b 3b 20 77 68 65 6e 20   items) ;; when 
3890: 66 61 6c 73 65 20 74 68 65 20 74 65 73 74 20 69  false the test i
38a0: 73 20 6f 6b 20 74 6f 20 62 65 20 68 61 6e 64 65  s ok to be hande
38b0: 64 20 6f 66 66 20 74 6f 20 6c 61 75 6e 63 68 20  d off to launch 
38c0: 28 62 75 74 20 6e 6f 74 20 62 65 66 6f 72 65 29  (but not before)
38d0: 0a 09 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28  ..      (let* ((
38e0: 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 20 20  have-resources  
38f0: 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f  (runs:can-run-mo
3900: 72 65 2d 74 65 73 74 73 20 64 62 20 74 65 73 74  re-tests db test
3910: 2d 72 65 63 6f 72 64 29 29 20 3b 3b 20 6c 6f 6f  -record)) ;; loo
3920: 6b 20 61 74 20 74 68 65 20 74 65 73 74 20 6a 6f  k at the test jo
3930: 62 67 72 6f 75 70 20 61 6e 64 20 74 6f 74 20 6a  bgroup and tot j
3940: 6f 62 73 20 72 75 6e 6e 69 6e 67 0a 09 09 20 20  obs running...  
3950: 20 20 20 28 70 72 65 72 65 71 73 2d 6e 6f 74 2d     (prereqs-not-
3960: 6d 65 74 20 28 64 62 3a 67 65 74 2d 70 72 65 72  met (db:get-prer
3970: 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 64 62 20 72  eqs-not-met db r
3980: 75 6e 2d 69 64 20 77 61 69 74 6f 6e 73 20 69 74  un-id waitons it
3990: 65 6d 2d 70 61 74 68 20 6d 6f 64 65 3a 20 74 65  em-path mode: te
39a0: 73 74 6d 6f 64 65 29 29 0a 09 09 20 20 20 20 20  stmode))...     
39b0: 28 66 61 69 6c 73 20 20 20 20 20 20 20 20 20 20  (fails          
39c0: 20 28 63 61 6c 63 2d 66 61 69 6c 73 20 70 72 65   (calc-fails pre
39d0: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 09  reqs-not-met))..
39e0: 09 20 20 20 20 20 28 6e 6f 6e 2d 63 6f 6d 70 6c  .     (non-compl
39f0: 65 74 65 64 20 20 20 28 63 61 6c 63 2d 6e 6f 74  eted   (calc-not
3a00: 2d 63 6f 6d 70 6c 65 74 65 64 20 70 72 65 72 65  -completed prere
3a10: 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a 09 09  qs-not-met)))...
3a20: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 38 20 22  (debug:print 8 "
3a30: 49 4e 46 4f 3a 20 68 61 76 65 2d 72 65 73 6f 75  INFO: have-resou
3a40: 72 63 65 73 3a 20 22 20 68 61 76 65 2d 72 65 73  rces: " have-res
3a50: 6f 75 72 63 65 73 20 22 20 70 72 65 72 65 71 73  ources " prereqs
3a60: 2d 6e 6f 74 2d 6d 65 74 3a 20 22 20 0a 09 09 09  -not-met: " ....
3a70: 20 20 20 20 20 28 73 74 72 69 6e 67 2d 69 6e 74       (string-int
3a80: 65 72 73 70 65 72 73 65 20 0a 09 09 09 20 20 20  ersperse ....   
3a90: 20 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20     (map (lambda 
3aa0: 28 74 29 0a 09 09 09 09 20 20 20 20 20 28 63 6f  (t).....     (co
3ab0: 6e 63 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  nc (db:test-get-
3ac0: 73 74 61 74 65 20 74 29 22 2f 22 28 64 62 3a 74  state t)"/"(db:t
3ad0: 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73 20 74  est-get-status t
3ae0: 29 29 29 0a 09 09 09 09 20 20 20 70 72 65 72 65  ))).....   prere
3af0: 71 73 2d 6e 6f 74 2d 6d 65 74 29 20 22 2c 20 22  qs-not-met) ", "
3b00: 29 20 22 20 66 61 69 6c 73 3a 20 22 20 66 61 69  ) " fails: " fai
3b10: 6c 73 29 0a 09 09 3b 3b 20 44 6f 6e 27 74 20 6b  ls)...;; Don't k
3b20: 6e 6f 77 20 61 74 20 74 68 69 73 20 74 69 6d 65  now at this time
3b30: 20 69 66 20 74 68 65 20 74 65 73 74 20 68 61 76   if the test hav
3b40: 65 20 62 65 65 6e 20 6c 61 75 6e 63 68 65 64 20  e been launched 
3b50: 61 74 20 73 6f 6d 65 20 74 69 6d 65 20 69 6e 20  at some time in 
3b60: 74 68 65 20 70 61 73 74 0a 09 09 3b 3b 20 69 2e  the past...;; i.
3b70: 65 2e 20 69 73 20 74 68 69 73 20 61 20 72 65 2d  e. is this a re-
3b80: 6c 61 75 6e 63 68 3f 0a 09 09 28 63 6f 6e 64 0a  launch?...(cond.
3b90: 09 09 20 28 28 61 6e 64 20 68 61 76 65 2d 72 65  .. ((and have-re
3ba0: 73 6f 75 72 63 65 73 0a 09 09 20 20 20 20 20 20  sources...      
3bb0: 20 28 6f 72 20 28 6e 75 6c 6c 3f 20 70 72 65 72   (or (null? prer
3bc0: 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09 09  eqs-not-met)....
3bd0: 20 20 20 28 61 6e 64 20 28 65 71 3f 20 74 65 73     (and (eq? tes
3be0: 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c 29  tmode 'toplevel)
3bf0: 0a 09 09 09 09 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d  .....(null? non-
3c00: 63 6f 6d 70 6c 65 74 65 64 29 29 29 29 0a 09 09  completed))))...
3c10: 20 20 3b 3b 20 6e 6f 20 6c 6f 6f 70 20 68 65 72    ;; no loop her
3c20: 65 2c 20 6a 75 73 74 20 64 72 6f 70 20 74 68 6f  e, just drop tho
3c30: 75 67 68 20 61 6e 64 20 75 73 65 20 74 68 65 20  ugh and use the 
3c40: 6c 6f 6f 70 20 61 74 20 74 68 65 20 62 6f 74 74  loop at the bott
3c50: 6f 6d 20 0a 09 09 20 20 28 69 66 20 28 70 61 74  om ...  (if (pat
3c60: 74 2d 6c 69 73 74 2d 6d 61 74 63 68 20 69 74 65  t-list-match ite
3c70: 6d 2d 70 61 74 68 20 69 74 65 6d 2d 70 61 74 74  m-path item-patt
3c80: 73 29 0a 09 09 20 20 20 20 20 20 28 72 75 6e 3a  s)...      (run:
3c90: 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 72  test db run-id r
3ca0: 75 6e 6e 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74  unname keyvallst
3cb0: 20 74 65 73 74 2d 72 65 63 6f 72 64 20 66 6c 61   test-record fla
3cc0: 67 73 20 23 66 29 0a 09 09 20 20 20 20 20 20 28  gs #f)...      (
3cd0: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49  debug:print 1 "I
3ce0: 4e 46 4f 3a 20 53 6b 69 70 70 69 6e 67 20 22 20  NFO: Skipping " 
3cf0: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65  (tests:testqueue
3d00: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65  -get-testname te
3d10: 73 74 2d 72 65 63 6f 72 64 29 20 22 20 22 20 69  st-record) " " i
3d20: 74 65 6d 2d 70 61 74 68 20 22 20 61 73 20 69 74  tem-path " as it
3d30: 20 64 6f 65 73 6e 27 74 20 6d 61 74 63 68 20 22   doesn't match "
3d40: 20 69 74 65 6d 2d 70 61 74 74 73 29 29 0a 09 09   item-patts))...
3d50: 20 20 3b 3b 20 65 6c 73 65 20 74 68 65 20 72 75    ;; else the ru
3d60: 6e 20 69 73 20 73 74 75 63 6b 2c 20 74 65 6d 70  n is stuck, temp
3d70: 6f 72 61 72 69 6c 79 20 6f 72 20 70 65 72 6d 61  orarily or perma
3d80: 6e 65 6e 74 6c 79 0a 09 09 20 20 3b 3b 20 62 75  nently...  ;; bu
3d90: 74 20 73 68 6f 75 6c 64 20 63 68 65 63 6b 20 69  t should check i
3da0: 66 20 69 74 20 69 73 20 64 75 65 20 74 6f 20 6c  f it is due to l
3db0: 61 63 6b 20 6f 66 20 72 65 73 6f 75 72 63 65 73  ack of resources
3dc0: 20 76 73 2e 20 70 72 65 72 65 71 75 69 73 69 74   vs. prerequisit
3dd0: 65 73 0a 09 09 20 20 29 0a 09 09 20 28 28 6e 6f  es...  )... ((no
3de0: 74 20 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73  t have-resources
3df0: 29 20 3b 3b 20 73 69 6d 70 6c 79 20 74 72 79 20  ) ;; simply try 
3e00: 61 67 61 69 6e 20 61 66 74 65 72 20 77 61 69 74  again after wait
3e10: 69 6e 67 20 61 20 73 65 63 6f 6e 64 0a 09 09 20  ing a second... 
3e20: 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20   (thread-sleep! 
3e30: 31 2e 30 29 0a 09 09 20 20 28 64 65 62 75 67 3a  1.0)...  (debug:
3e40: 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 6e  print 1 "INFO: n
3e50: 6f 20 72 65 73 6f 75 72 63 65 73 20 74 6f 20 72  o resources to r
3e60: 75 6e 20 6e 65 77 20 74 65 73 74 73 2c 20 77 61  un new tests, wa
3e70: 69 74 69 6e 67 20 2e 2e 2e 22 29 0a 09 09 20 20  iting ...")...  
3e80: 3b 3b 20 63 6f 75 6c 64 20 68 61 76 65 20 64 6f  ;; could have do
3e90: 6e 65 20 68 65 64 20 74 61 6c 20 68 65 72 65 20  ne hed tal here 
3ea0: 62 75 74 20 64 6f 69 6e 67 20 63 61 72 2f 63 64  but doing car/cd
3eb0: 72 20 6f 66 20 6e 65 77 74 61 6c 20 74 6f 20 72  r of newtal to r
3ec0: 6f 74 61 74 65 20 74 65 73 74 73 0a 09 09 20 20  otate tests...  
3ed0: 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61  (loop (car newta
3ee0: 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 29 29  l)(cdr newtal)))
3ef0: 0a 09 09 20 28 65 6c 73 65 20 3b 3b 20 6d 75 73  ... (else ;; mus
3f00: 74 20 62 65 20 77 65 20 68 61 76 65 20 75 6e 6d  t be we have unm
3f10: 65 74 20 70 72 65 72 65 71 75 69 73 69 74 65 73  et prerequisites
3f20: 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72  ...    (debug:pr
3f30: 69 6e 74 20 34 20 22 46 41 49 4c 53 3a 20 22 20  int 4 "FAILS: " 
3f40: 66 61 69 6c 73 29 0a 09 09 20 20 20 20 3b 3b 20  fails)...    ;; 
3f50: 49 66 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 20 6f  If one or more o
3f60: 66 20 74 68 65 20 70 72 65 72 65 71 73 2d 6e 6f  f the prereqs-no
3f70: 74 2d 6d 65 74 20 61 72 65 20 46 41 49 4c 20 74  t-met are FAIL t
3f80: 68 65 6e 20 77 65 20 63 61 6e 20 69 73 73 75 65  hen we can issue
3f90: 0a 09 09 20 20 20 20 3b 3b 20 61 20 6d 65 73 73  ...    ;; a mess
3fa0: 61 67 65 20 61 6e 64 20 64 72 6f 70 20 68 65 64  age and drop hed
3fb0: 20 66 72 6f 6d 20 74 68 65 20 69 74 65 6d 73 20   from the items 
3fc0: 74 6f 20 62 65 20 70 72 6f 63 65 73 73 65 64 2e  to be processed.
3fd0: 0a 09 09 20 20 20 20 28 69 66 20 28 6e 75 6c 6c  ...    (if (null
3fe0: 3f 20 66 61 69 6c 73 29 0a 09 09 09 28 62 65 67  ? fails)....(beg
3ff0: 69 6e 0a 09 09 09 20 20 3b 3b 20 63 6f 75 6c 64  in....  ;; could
4000: 6e 27 74 20 72 75 6e 2c 20 74 61 6b 65 20 61 20  n't run, take a 
4010: 62 72 65 61 74 68 65 72 0a 09 09 09 20 20 28 64  breather....  (d
4020: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e  ebug:print 4 "IN
4030: 46 4f 3a 20 53 68 6f 75 6c 64 6e 27 74 20 72 65  FO: Shouldn't re
4040: 61 6c 6c 79 20 67 65 74 20 68 65 72 65 2c 20 72  ally get here, r
4050: 61 63 65 20 63 6f 6e 64 69 74 69 6f 6e 3f 20 55  ace condition? U
4060: 6e 61 62 6c 65 20 74 6f 20 6c 61 75 6e 63 68 20  nable to launch 
4070: 6d 6f 72 65 20 74 65 73 74 73 20 61 74 20 74 68  more tests at th
4080: 69 73 20 6d 6f 6d 65 6e 74 2c 20 6b 69 6c 6c 69  is moment, killi
4090: 6e 67 20 74 69 6d 65 20 2e 2e 2e 22 29 0a 09 09  ng time ...")...
40a0: 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70  .  (thread-sleep
40b0: 21 20 30 2e 31 29 20 3b 3b 20 6c 6f 6e 67 20 73  ! 0.1) ;; long s
40c0: 6c 65 65 70 20 68 65 72 65 20 2d 20 6e 6f 20 72  leep here - no r
40d0: 65 73 6f 75 72 63 65 73 2c 20 6d 61 79 20 61 73  esources, may as
40e0: 20 77 65 6c 6c 20 62 65 20 70 61 74 69 65 6e 74   well be patient
40f0: 0a 09 09 09 20 20 3b 3b 20 77 65 20 6d 61 64 65  ....  ;; we made
4100: 20 6e 65 77 20 74 61 6c 20 62 79 20 73 74 69 63   new tal by stic
4110: 6b 69 6e 67 20 68 65 64 20 61 74 20 74 68 65 20  king hed at the 
4120: 62 61 63 6b 20 6f 66 20 74 68 65 20 6c 69 73 74  back of the list
4130: 0a 09 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72  ....  (loop (car
4140: 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77   newtal)(cdr new
4150: 74 61 6c 29 29 29 0a 09 09 09 3b 3b 20 74 68 65  tal)))....;; the
4160: 20 77 61 69 74 6f 6e 20 69 73 20 46 41 49 4c 20   waiton is FAIL 
4170: 73 6f 20 6e 6f 20 70 6f 69 6e 74 20 69 6e 20 74  so no point in t
4180: 72 79 69 6e 67 20 74 6f 20 72 75 6e 20 68 65 64  rying to run hed
4190: 20 65 76 65 72 20 61 67 61 69 6e 0a 09 09 09 28   ever again....(
41a0: 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74  if (not (null? t
41b0: 61 6c 29 29 0a 09 09 09 20 20 20 20 28 62 65 67  al))....    (beg
41c0: 69 6e 0a 09 09 09 20 20 20 20 20 20 28 64 65 62  in....      (deb
41d0: 75 67 3a 70 72 69 6e 74 20 31 20 22 57 41 52 4e  ug:print 1 "WARN
41e0: 3a 20 44 72 6f 70 70 69 6e 67 20 74 65 73 74 20  : Dropping test 
41f0: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74  " (db:test-get-t
4200: 65 73 74 2d 6e 61 6d 65 20 68 65 64 29 20 22 2f  est-name hed) "/
4210: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  " (db:test-get-i
4220: 74 65 6d 2d 70 61 74 68 20 68 65 64 29 0a 09 09  tem-path hed)...
4230: 09 09 09 20 20 20 22 20 66 72 6f 6d 20 74 68 65  ...   " from the
4240: 20 6c 61 75 6e 63 68 20 6c 69 73 74 20 61 73 20   launch list as 
4250: 69 74 20 68 61 73 20 70 72 65 72 65 71 75 69 73  it has prerequis
4260: 74 65 73 20 74 68 61 74 20 61 72 65 20 46 41 49  tes that are FAI
4270: 4c 22 29 0a 09 09 09 20 20 20 20 20 20 28 6c 6f  L")....      (lo
4280: 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63 64 72  op (car tal)(cdr
4290: 20 74 61 6c 29 29 29 29 29 29 29 29 29 0a 09 20   tal))))))))).. 
42a0: 20 20 20 20 0a 09 20 20 20 20 20 3b 3b 20 63 61      ..     ;; ca
42b0: 73 65 20 77 68 65 72 65 20 61 6e 20 69 74 65 6d  se where an item
42c0: 73 20 63 61 6d 65 20 69 6e 20 61 73 20 61 20 6c  s came in as a l
42d0: 69 73 74 20 62 65 65 6e 20 70 72 6f 63 65 73 73  ist been process
42e0: 65 64 0a 09 20 20 20 20 20 28 28 61 6e 64 20 28  ed..     ((and (
42f0: 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 20 20 20  list? items)    
4300: 20 3b 3b 20 74 68 75 73 20 77 65 20 6b 6e 6f 77   ;; thus we know
4310: 20 6f 75 72 20 69 74 65 6d 73 20 61 72 65 20 61   our items are a
4320: 6c 72 65 61 64 79 20 63 61 6c 63 75 6c 61 74 65  lready calculate
4330: 64 0a 09 09 20 20 20 28 6e 6f 74 20 20 20 69 74  d...   (not   it
4340: 65 6d 64 61 74 29 29 20 3b 3b 20 61 6e 64 20 6e  emdat)) ;; and n
4350: 6f 74 20 79 65 74 20 65 78 70 61 6e 64 65 64 20  ot yet expanded 
4360: 69 6e 74 6f 20 74 68 65 20 6c 69 73 74 20 6f 66  into the list of
4370: 20 74 68 69 6e 67 73 20 74 6f 20 62 65 20 64 6f   things to be do
4380: 6e 65 0a 09 20 20 20 20 20 20 28 69 66 20 28 61  ne..      (if (a
4390: 6e 64 20 28 3e 3d 20 2a 76 65 72 62 6f 73 69 74  nd (>= *verbosit
43a0: 79 2a 20 31 29 0a 09 09 20 20 20 20 20 20 20 28  y* 1)...       (
43b0: 3e 20 28 6c 65 6e 67 74 68 20 69 74 65 6d 73 29  > (length items)
43c0: 20 30 29 0a 09 09 20 20 20 20 20 20 20 28 3e 20   0)...       (> 
43d0: 28 6c 65 6e 67 74 68 20 28 63 61 72 20 69 74 65  (length (car ite
43e0: 6d 73 29 29 20 30 29 29 0a 09 09 20 20 28 70 70  ms)) 0))...  (pp
43f0: 20 69 74 65 6d 73 29 29 0a 09 20 20 20 20 20 20   items))..      
4400: 3b 3b 20 28 69 66 20 28 3e 3d 20 2a 76 65 72 62  ;; (if (>= *verb
4410: 6f 73 69 74 79 2a 20 35 29 0a 09 20 20 20 20 20  osity* 5)..     
4420: 20 3b 3b 20 20 20 20 20 28 62 65 67 69 6e 0a 09   ;;     (begin..
4430: 20 20 20 20 20 20 3b 3b 20 20 20 20 20 20 20 28        ;;       (
4440: 70 72 69 6e 74 20 22 69 74 65 6d 73 3a 20 22 29  print "items: ")
4450: 20 20 20 20 20 28 70 70 20 28 69 74 65 6d 2d 61       (pp (item-a
4460: 73 73 6f 63 2d 3e 69 74 65 6d 2d 6c 69 73 74 20  ssoc->item-list 
4470: 69 74 65 6d 73 29 29 0a 09 20 20 20 20 20 20 3b  items))..      ;
4480: 3b 20 20 20 20 20 20 20 28 70 72 69 6e 74 20 22  ;       (print "
4490: 69 74 65 6d 73 74 61 62 6c 65 3a 20 22 29 28 70  itemstable: ")(p
44a0: 70 20 28 69 74 65 6d 2d 74 61 62 6c 65 2d 3e 69  p (item-table->i
44b0: 74 65 6d 2d 6c 69 73 74 20 69 74 65 6d 73 74 61  tem-list itemsta
44c0: 62 6c 65 29 29 29 29 0a 09 20 20 20 20 20 20 28  ble))))..      (
44d0: 66 6f 72 2d 65 61 63 68 0a 09 20 20 20 20 20 20  for-each..      
44e0: 20 28 6c 61 6d 62 64 61 20 28 6d 79 2d 69 74 65   (lambda (my-ite
44f0: 6d 64 61 74 29 0a 09 09 20 28 6c 65 74 2a 20 28  mdat)... (let* (
4500: 28 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64  (new-test-record
4510: 20 28 6c 65 74 20 28 28 6e 65 77 72 65 63 20 28   (let ((newrec (
4520: 6d 61 6b 65 2d 74 65 73 74 73 3a 74 65 73 74 71  make-tests:testq
4530: 75 65 75 65 29 29 29 0a 09 09 09 09 09 20 20 20  ueue)))......   
4540: 28 76 65 63 74 6f 72 2d 63 6f 70 79 21 20 74 65  (vector-copy! te
4550: 73 74 2d 72 65 63 6f 72 64 20 6e 65 77 72 65 63  st-record newrec
4560: 29 0a 09 09 09 09 09 20 20 20 6e 65 77 72 65 63  )......   newrec
4570: 29 29 0a 09 09 09 28 6d 79 2d 69 74 65 6d 2d 70  ))....(my-item-p
4580: 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e  ath (item-list->
4590: 70 61 74 68 20 6d 79 2d 69 74 65 6d 64 61 74 29  path my-itemdat)
45a0: 29 29 0a 09 09 20 20 20 28 69 66 20 28 70 61 74  ))...   (if (pat
45b0: 74 2d 6c 69 73 74 2d 6d 61 74 63 68 20 6d 79 2d  t-list-match my-
45c0: 69 74 65 6d 2d 70 61 74 68 20 69 74 65 6d 2d 70  item-path item-p
45d0: 61 74 74 73 29 20 20 20 20 20 20 20 20 20 20 20  atts)           
45e0: 3b 3b 20 79 65 73 2c 20 77 65 20 77 61 6e 74 20  ;; yes, we want 
45f0: 74 6f 20 70 72 6f 63 65 73 73 20 74 68 69 73 20  to process this 
4600: 69 74 65 6d 2c 20 4e 4f 54 45 3a 20 53 68 6f 75  item, NOTE: Shou
4610: 6c 64 20 6e 6f 74 20 6e 65 65 64 20 74 68 69 73  ld not need this
4620: 20 63 68 65 63 6b 20 68 65 72 65 21 0a 09 09 20   check here!... 
4630: 20 20 20 20 20 20 28 6c 65 74 20 28 28 6e 65 77        (let ((new
4640: 74 65 73 74 6e 61 6d 65 20 28 63 6f 6e 63 20 68  testname (conc h
4650: 65 64 20 22 2f 22 20 6d 79 2d 69 74 65 6d 2d 70  ed "/" my-item-p
4660: 61 74 68 29 29 29 20 20 20 20 3b 3b 20 74 65 73  ath)))    ;; tes
4670: 74 20 6e 61 6d 65 73 20 61 72 65 20 75 6e 69 71  t names are uniq
4680: 75 65 20 6f 6e 20 74 65 73 74 6e 61 6d 65 2f 69  ue on testname/i
4690: 74 65 6d 2d 70 61 74 68 0a 09 09 09 20 28 74 65  tem-path.... (te
46a0: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65  sts:testqueue-se
46b0: 74 2d 69 74 65 6d 73 21 20 20 20 20 20 6e 65 77  t-items!     new
46c0: 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 23 66 29  -test-record #f)
46d0: 0a 09 09 09 20 28 74 65 73 74 73 3a 74 65 73 74  .... (tests:test
46e0: 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 64 61  queue-set-itemda
46f0: 74 21 20 20 20 6e 65 77 2d 74 65 73 74 2d 72 65  t!   new-test-re
4700: 63 6f 72 64 20 6d 79 2d 69 74 65 6d 64 61 74 29  cord my-itemdat)
4710: 0a 09 09 09 20 28 74 65 73 74 73 3a 74 65 73 74  .... (tests:test
4720: 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 5f 70  queue-set-item_p
4730: 61 74 68 21 20 6e 65 77 2d 74 65 73 74 2d 72 65  ath! new-test-re
4740: 63 6f 72 64 20 6d 79 2d 69 74 65 6d 2d 70 61 74  cord my-item-pat
4750: 68 29 0a 09 09 09 20 28 68 61 73 68 2d 74 61 62  h).... (hash-tab
4760: 6c 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 63  le-set! test-rec
4770: 6f 72 64 73 20 6e 65 77 74 65 73 74 6e 61 6d 65  ords newtestname
4780: 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64   new-test-record
4790: 29 0a 09 09 09 20 28 73 65 74 21 20 74 61 6c 20  ).... (set! tal 
47a0: 28 63 6f 6e 73 20 6e 65 77 74 65 73 74 6e 61 6d  (cons newtestnam
47b0: 65 20 74 61 6c 29 29 29 29 29 29 20 3b 3b 20 73  e tal)))))) ;; s
47c0: 69 6e 63 65 20 74 68 65 73 65 20 61 72 65 20 69  ince these are i
47d0: 74 65 6d 69 7a 65 64 20 63 72 65 61 74 65 20 6e  temized create n
47e0: 65 77 20 74 65 73 74 20 6e 61 6d 65 73 20 74 65  ew test names te
47f0: 73 74 6e 61 6d 65 2f 69 74 65 6d 70 61 74 68 0a  stname/itempath.
4800: 09 20 20 20 20 20 20 20 69 74 65 6d 73 29 0a 09  .       items)..
4810: 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28        (if (not (
4820: 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 20 20  null? tal))...  
4830: 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28  (loop (car tal)(
4840: 63 64 72 20 74 61 6c 29 29 29 29 0a 0a 09 20 20  cdr tal))))...  
4850: 20 20 20 3b 3b 20 69 66 20 69 74 65 6d 73 20 69     ;; if items i
4860: 73 20 61 20 70 72 6f 63 20 74 68 65 6e 20 6e 65  s a proc then ne
4870: 65 64 20 74 6f 20 72 75 6e 20 69 74 65 6d 73 3a  ed to run items:
4880: 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63  get-items-from-c
4890: 6f 6e 66 69 67 2c 20 67 65 74 20 74 68 65 20 6c  onfig, get the l
48a0: 69 73 74 20 61 6e 64 20 6c 6f 6f 70 20 0a 09 20  ist and loop .. 
48b0: 20 20 20 20 3b 3b 20 20 20 20 2d 20 62 75 74 20      ;;    - but 
48c0: 6f 6e 6c 79 20 64 6f 20 74 68 61 74 20 69 66 20  only do that if 
48d0: 72 65 73 6f 75 72 63 65 73 20 65 78 69 73 74 20  resources exist 
48e0: 74 6f 20 6b 69 63 6b 20 6f 66 66 20 74 68 65 20  to kick off the 
48f0: 6a 6f 62 0a 09 20 20 20 20 20 28 28 6f 72 20 28  job..     ((or (
4900: 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73  procedure? items
4910: 29 28 65 71 3f 20 69 74 65 6d 73 20 27 68 61 76  )(eq? items 'hav
4920: 65 2d 70 72 6f 63 65 64 75 72 65 29 29 0a 09 20  e-procedure)).. 
4930: 20 20 20 20 20 28 6c 65 74 20 28 28 63 61 6e 2d       (let ((can-
4940: 72 75 6e 2d 6d 6f 72 65 20 20 20 20 28 72 75 6e  run-more    (run
4950: 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74  s:can-run-more-t
4960: 65 73 74 73 20 64 62 20 74 65 73 74 2d 72 65 63  ests db test-rec
4970: 6f 72 64 29 29 29 0a 09 09 28 69 66 20 63 61 6e  ord)))...(if can
4980: 2d 72 75 6e 2d 6d 6f 72 65 0a 09 09 20 20 20 20  -run-more...    
4990: 28 6c 65 74 2a 20 28 28 70 72 65 72 65 71 73 2d  (let* ((prereqs-
49a0: 6e 6f 74 2d 6d 65 74 20 28 64 62 3a 67 65 74 2d  not-met (db:get-
49b0: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20  prereqs-not-met 
49c0: 64 62 20 72 75 6e 2d 69 64 20 77 61 69 74 6f 6e  db run-id waiton
49d0: 73 20 69 74 65 6d 2d 70 61 74 68 20 6d 6f 64 65  s item-path mode
49e0: 3a 20 74 65 73 74 6d 6f 64 65 29 29 0a 09 09 09  : testmode))....
49f0: 20 20 20 28 66 61 69 6c 73 20 20 20 20 20 20 20     (fails       
4a00: 20 20 20 20 28 63 61 6c 63 2d 66 61 69 6c 73 20      (calc-fails 
4a10: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29  prereqs-not-met)
4a20: 29 0a 09 09 09 20 20 20 28 6e 6f 6e 2d 63 6f 6d  )....   (non-com
4a30: 70 6c 65 74 65 64 20 20 20 28 63 61 6c 63 2d 6e  pleted   (calc-n
4a40: 6f 74 2d 63 6f 6d 70 6c 65 74 65 64 20 70 72 65  ot-completed pre
4a50: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a  reqs-not-met))).
4a60: 09 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70  ..      (debug:p
4a70: 72 69 6e 74 20 38 20 22 49 4e 46 4f 3a 20 63 61  rint 8 "INFO: ca
4a80: 6e 2d 72 75 6e 2d 6d 6f 72 65 3a 20 22 20 63 61  n-run-more: " ca
4a90: 6e 2d 72 75 6e 2d 6d 6f 72 65 0a 09 09 09 09 20  n-run-more..... 
4aa0: 20 20 22 5c 6e 20 70 72 65 72 65 71 73 2d 6e 6f    "\n prereqs-no
4ab0: 74 2d 6d 65 74 3a 20 22 20 28 70 72 65 74 74 79  t-met: " (pretty
4ac0: 2d 73 74 72 69 6e 67 20 70 72 65 72 65 71 73 2d  -string prereqs-
4ad0: 6e 6f 74 2d 6d 65 74 29 0a 09 09 09 09 20 20 20  not-met).....   
4ae0: 22 5c 6e 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65  "\n non-complete
4af0: 64 3a 20 20 20 22 20 28 70 72 65 74 74 79 2d 73  d:   " (pretty-s
4b00: 74 72 69 6e 67 20 6e 6f 6e 2d 63 6f 6d 70 6c 65  tring non-comple
4b10: 74 65 64 29 20 0a 09 09 09 09 20 20 20 22 5c 6e  ted) .....   "\n
4b20: 20 66 61 69 6c 73 3a 20 20 20 20 20 20 20 20 20   fails:         
4b30: 20 20 22 20 28 70 72 65 74 74 79 2d 73 74 72 69    " (pretty-stri
4b40: 6e 67 20 66 61 69 6c 73 29 29 0a 09 09 20 20 20  ng fails))...   
4b50: 20 20 20 28 63 6f 6e 64 20 0a 09 09 20 20 20 20     (cond ...    
4b60: 20 20 20 28 28 6f 72 20 28 6e 75 6c 6c 3f 20 70     ((or (null? p
4b70: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 20  rereqs-not-met) 
4b80: 3b 3b 20 61 6c 6c 20 70 72 65 72 65 71 73 20 6d  ;; all prereqs m
4b90: 65 74 2c 20 66 69 72 65 20 6f 66 66 20 74 68 65  et, fire off the
4ba0: 20 74 65 73 74 0a 09 09 09 20 20 20 20 3b 3b 20   test....    ;; 
4bb0: 6f 72 2c 20 69 66 20 69 74 20 69 73 20 61 20 27  or, if it is a '
4bc0: 74 6f 70 6c 65 76 65 6c 20 74 65 73 74 20 61 6e  toplevel test an
4bd0: 64 20 61 6c 6c 20 70 72 65 72 65 71 73 20 6e 6f  d all prereqs no
4be0: 74 20 6d 65 74 20 61 72 65 20 43 4f 4d 50 4c 45  t met are COMPLE
4bf0: 54 45 44 20 74 68 65 6e 20 6c 61 75 6e 63 68 0a  TED then launch.
4c00: 09 09 09 20 20 20 20 28 61 6e 64 20 28 65 71 3f  ...    (and (eq?
4c10: 20 74 65 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65   testmode 'tople
4c20: 76 65 6c 29 0a 09 09 09 09 20 28 6e 75 6c 6c 3f  vel)..... (null?
4c30: 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 29   non-completed))
4c40: 29 0a 09 09 09 28 6c 65 74 20 28 28 74 65 73 74  )....(let ((test
4c50: 2d 6e 61 6d 65 20 28 74 65 73 74 73 3a 74 65 73  -name (tests:tes
4c60: 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e  tqueue-get-testn
4c70: 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 29  ame test-record)
4c80: 29 29 0a 09 09 09 20 20 28 73 65 74 65 6e 76 20  ))....  (setenv 
4c90: 22 4d 54 5f 54 45 53 54 5f 4e 41 4d 45 22 20 74  "MT_TEST_NAME" t
4ca0: 65 73 74 2d 6e 61 6d 65 29 20 3b 3b 20 0a 09 09  est-name) ;; ...
4cb0: 09 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 52  .  (setenv "MT_R
4cc0: 55 4e 4e 41 4d 45 22 20 20 20 72 75 6e 6e 61 6d  UNNAME"   runnam
4cd0: 65 29 0a 09 09 09 20 20 28 73 65 74 2d 6d 65 67  e)....  (set-meg
4ce0: 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 64  atest-env-vars d
4cf0: 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65  b run-id) ;; the
4d00: 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64  se may be needed
4d10: 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e   by the launchin
4d20: 67 20 70 72 6f 63 65 73 73 0a 09 09 09 20 20 28  g process....  (
4d30: 6c 65 74 20 28 28 69 74 65 6d 73 2d 6c 69 73 74  let ((items-list
4d40: 20 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d   (items:get-item
4d50: 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 74 63  s-from-config tc
4d60: 6f 6e 66 69 67 29 29 29 0a 09 09 09 20 20 20 20  onfig)))....    
4d70: 28 69 66 20 28 6c 69 73 74 3f 20 69 74 65 6d 73  (if (list? items
4d80: 2d 6c 69 73 74 29 0a 09 09 09 09 28 62 65 67 69  -list).....(begi
4d90: 6e 0a 09 09 09 09 20 20 28 74 65 73 74 73 3a 74  n.....  (tests:t
4da0: 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65  estqueue-set-ite
4db0: 6d 73 21 20 74 65 73 74 2d 72 65 63 6f 72 64 20  ms! test-record 
4dc0: 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09 09 09 09  items-list).....
4dd0: 20 20 28 6c 6f 6f 70 20 68 65 64 20 74 61 6c 29    (loop hed tal)
4de0: 29 0a 09 09 09 09 28 62 65 67 69 6e 0a 09 09 09  ).....(begin....
4df0: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  .  (debug:print 
4e00: 30 20 22 45 52 52 4f 52 3a 20 54 68 65 20 70 72  0 "ERROR: The pr
4e10: 6f 63 20 66 72 6f 6d 20 72 65 61 64 69 6e 67 20  oc from reading 
4e20: 74 68 65 20 73 65 74 75 70 20 64 69 64 20 6e 6f  the setup did no
4e30: 74 20 79 69 65 6c 64 20 61 20 6c 69 73 74 20 2d  t yield a list -
4e40: 20 70 6c 65 61 73 65 20 72 65 70 6f 72 74 20 74   please report t
4e50: 68 69 73 22 29 0a 09 09 09 09 20 20 28 65 78 69  his").....  (exi
4e60: 74 20 31 29 29 29 29 29 29 0a 09 09 20 20 20 20  t 1))))))...    
4e70: 20 20 20 28 28 6e 75 6c 6c 3f 20 66 61 69 6c 73     ((null? fails
4e80: 29 0a 09 09 09 28 6c 6f 6f 70 20 28 63 61 72 20  )....(loop (car 
4e90: 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74  newtal)(cdr newt
4ea0: 61 6c 29 29 29 20 3b 3b 20 61 6e 20 69 73 73 75  al))) ;; an issu
4eb0: 65 20 77 69 74 68 20 70 72 65 72 65 71 73 20 6e  e with prereqs n
4ec0: 6f 74 20 79 65 74 20 6d 65 74 3f 0a 09 09 20 20  ot yet met?...  
4ed0: 20 20 20 20 20 28 28 61 6e 64 20 28 6e 6f 74 20       ((and (not 
4ee0: 28 6e 75 6c 6c 3f 20 66 61 69 6c 73 29 29 28 65  (null? fails))(e
4ef0: 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 6e 6f 72  q? testmode 'nor
4f00: 6d 61 6c 29 29 0a 09 09 09 28 64 65 62 75 67 3a  mal))....(debug:
4f10: 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 74  print 1 "INFO: t
4f20: 65 73 74 20 22 20 20 68 65 64 20 22 20 28 6d 6f  est "  hed " (mo
4f30: 64 65 3d 22 20 74 65 73 74 6d 6f 64 65 20 22 29  de=" testmode ")
4f40: 20 68 61 73 20 66 61 69 6c 65 64 20 70 72 65 72   has failed prer
4f50: 65 71 75 69 73 69 74 65 28 73 29 3b 20 22 0a 09  equisite(s); "..
4f60: 09 09 09 20 20 20 20 20 28 73 74 72 69 6e 67 2d  ...     (string-
4f70: 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61 70  intersperse (map
4f80: 20 28 6c 61 6d 62 64 61 20 28 74 29 28 63 6f 6e   (lambda (t)(con
4f90: 63 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74  c (db:test-get-t
4fa0: 65 73 74 6e 61 6d 65 20 74 29 20 22 3a 22 20 28  estname t) ":" (
4fb0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74  db:test-get-stat
4fc0: 65 20 74 29 22 2f 22 28 64 62 3a 74 65 73 74 2d  e t)"/"(db:test-
4fd0: 67 65 74 2d 73 74 61 74 75 73 20 74 29 29 29 20  get-status t))) 
4fe0: 66 61 69 6c 73 29 20 22 2c 20 22 29 0a 09 09 09  fails) ", ")....
4ff0: 09 20 20 20 20 20 22 2c 20 72 65 6d 6f 76 69 6e  .     ", removin
5000: 67 20 69 74 20 66 72 6f 6d 20 74 6f 2d 64 6f 20  g it from to-do 
5010: 6c 69 73 74 22 29 0a 09 09 09 28 69 66 20 28 6e  list")....(if (n
5020: 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a  ot (null? tal)).
5030: 09 09 09 20 20 20 20 28 6c 6f 6f 70 20 28 63 61  ...    (loop (ca
5040: 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 29  r tal)(cdr tal))
5050: 29 29 0a 09 09 20 20 20 20 20 20 20 28 65 6c 73  ))...       (els
5060: 65 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e  e....(debug:prin
5070: 74 20 38 20 22 45 52 52 4f 52 3a 20 4e 6f 20 68  t 8 "ERROR: No h
5080: 61 6e 64 6c 65 72 20 66 6f 72 20 74 68 69 73 20  andler for this 
5090: 63 6f 6e 64 69 74 69 6f 6e 2c 20 68 65 64 3a 20  condition, hed: 
50a0: 22 20 68 65 64 20 22 20 66 61 69 6c 73 3a 20 22  " hed " fails: "
50b0: 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70   (string-intersp
50c0: 65 72 73 65 20 28 6d 61 70 20 64 62 3a 74 65 73  erse (map db:tes
50d0: 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 66  t-get-testname f
50e0: 61 69 6c 73 29 20 22 2c 22 29 20 22 20 74 65 73  ails) ",") " tes
50f0: 74 6d 6f 64 65 3a 20 22 20 74 65 73 74 6d 6f 64  tmode: " testmod
5100: 65 20 22 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d  e " prereqs-not-
5110: 6d 65 74 3a 20 22 20 28 70 72 65 74 74 79 2d 73  met: " (pretty-s
5120: 74 72 69 6e 67 20 70 72 65 72 65 71 73 2d 6e 6f  tring prereqs-no
5130: 74 2d 6d 65 74 29 29 0a 09 09 09 28 6c 6f 6f 70  t-met))....(loop
5140: 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64   (car newtal)(cd
5150: 72 20 6e 65 77 74 61 6c 29 29 29 29 29 0a 09 09  r newtal)))))...
5160: 20 20 20 20 3b 3b 20 69 66 20 63 61 6e 27 74 20      ;; if can't 
5170: 72 75 6e 20 6d 6f 72 65 20 6a 75 73 74 20 6c 6f  run more just lo
5180: 6f 70 20 77 69 74 68 20 6e 65 78 74 20 70 6f 73  op with next pos
5190: 73 69 62 6c 65 20 74 65 73 74 0a 09 09 20 20 20  sible test...   
51a0: 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74   (loop (car newt
51b0: 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 29  al)(cdr newtal))
51c0: 29 29 29 0a 09 20 20 20 20 20 0a 09 20 20 20 20  )))..     ..    
51d0: 20 3b 3b 20 74 68 69 73 20 63 61 73 65 20 73 68   ;; this case sh
51e0: 6f 75 6c 64 20 6e 6f 74 20 68 61 70 70 65 6e 2c  ould not happen,
51f0: 20 61 64 64 65 64 20 74 6f 20 68 65 6c 70 20 63   added to help c
5200: 61 74 63 68 20 61 6e 79 20 62 75 67 73 0a 09 20  atch any bugs.. 
5210: 20 20 20 20 28 28 61 6e 64 20 28 6c 69 73 74 3f      ((and (list?
5220: 20 69 74 65 6d 73 29 20 69 74 65 6d 64 61 74 29   items) itemdat)
5230: 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70  ..      (debug:p
5240: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 53  rint 0 "ERROR: S
5250: 68 6f 75 6c 64 20 6e 6f 74 20 68 61 76 65 20 61  hould not have a
5260: 20 6c 69 73 74 20 6f 66 20 69 74 65 6d 73 20 69   list of items i
5270: 6e 20 61 20 74 65 73 74 20 61 6e 64 20 74 68 65  n a test and the
5280: 20 69 74 65 6d 73 70 61 74 68 20 73 65 74 20 2d   itemspath set -
5290: 20 70 6c 65 61 73 65 20 72 65 70 6f 72 74 20 74   please report t
52a0: 68 69 73 22 29 0a 09 20 20 20 20 20 20 28 65 78  his")..      (ex
52b0: 69 74 20 31 29 29 29 29 0a 09 20 20 0a 09 20 20  it 1))))..  ..  
52c0: 3b 3b 20 77 65 20 67 65 74 20 68 65 72 65 20 6f  ;; we get here o
52d0: 6e 20 22 64 72 6f 70 20 74 68 72 6f 75 67 68 22  n "drop through"
52e0: 20 2d 20 6c 6f 6f 70 20 66 6f 72 20 6e 65 78 74   - loop for next
52f0: 20 74 65 73 74 20 69 6e 20 71 75 65 75 65 0a 09   test in queue..
5300: 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 74 61 6c    (if (null? tal
5310: 29 0a 09 20 20 20 20 20 20 28 62 65 67 69 6e 0a  )..      (begin.
5320: 09 09 3b 3b 20 46 49 58 4d 45 21 21 21 21 20 54  ..;; FIXME!!!! T
5330: 48 49 53 20 53 48 4f 55 4c 44 20 4e 4f 54 20 52  HIS SHOULD NOT R
5340: 45 51 55 49 52 45 20 41 4e 20 45 58 49 54 21 21  EQUIRE AN EXIT!!
5350: 21 21 21 21 21 0a 09 09 28 64 65 62 75 67 3a 70  !!!!!...(debug:p
5360: 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 41 6c  rint 1 "INFO: Al
5370: 6c 20 74 65 73 74 73 20 6c 61 75 6e 63 68 65 64  l tests launched
5380: 22 29 0a 09 09 28 74 68 72 65 61 64 2d 73 6c 65  ")...(thread-sle
5390: 65 70 21 20 30 2e 35 29 0a 09 09 3b 3b 20 46 49  ep! 0.5)...;; FI
53a0: 58 4d 45 21 20 54 68 69 73 20 68 61 72 73 68 20  XME! This harsh 
53b0: 65 78 69 74 20 73 68 6f 75 6c 64 20 6e 6f 74 20  exit should not 
53c0: 62 65 20 6e 65 63 65 73 73 61 72 79 2e 2e 2e 2e  be necessary....
53d0: 0a 09 09 28 69 66 20 28 6e 6f 74 20 2a 72 75 6e  ...(if (not *run
53e0: 72 65 6d 6f 74 65 2a 29 28 65 78 69 74 29 29 20  remote*)(exit)) 
53f0: 3b 3b 20 0a 09 09 23 66 29 20 3b 3b 20 72 65 74  ;; ...#f) ;; ret
5400: 75 72 6e 20 61 20 23 66 20 61 73 20 61 20 68 69  urn a #f as a hi
5410: 6e 74 20 74 68 61 74 20 77 65 20 61 72 65 20 64  nt that we are d
5420: 6f 6e 65 0a 09 20 20 20 20 20 20 3b 3b 20 48 65  one..      ;; He
5430: 72 65 20 77 65 20 6e 65 65 64 20 74 6f 20 63 68  re we need to ch
5440: 65 63 6b 20 74 68 61 74 20 61 6c 6c 20 74 68 65  eck that all the
5450: 20 74 65 73 74 73 20 72 65 6d 61 69 6e 69 6e 67   tests remaining
5460: 20 74 6f 20 62 65 20 72 75 6e 20 61 72 65 20 65   to be run are e
5470: 6c 69 67 69 62 6c 65 20 74 6f 20 72 75 6e 0a 09  ligible to run..
5480: 20 20 20 20 20 20 3b 3b 20 61 6e 64 20 61 72 65        ;; and are
5490: 20 6e 6f 74 20 62 6c 6f 63 6b 65 64 20 62 79 20   not blocked by 
54a0: 66 61 69 6c 65 64 0a 09 20 20 20 20 20 20 28 6c  failed..      (l
54b0: 65 74 20 28 28 6e 65 77 6c 73 74 20 28 74 65 73  et ((newlst (tes
54c0: 74 73 3a 66 69 6c 74 65 72 2d 6e 6f 6e 2d 72 75  ts:filter-non-ru
54d0: 6e 6e 61 62 6c 65 20 64 62 20 72 75 6e 2d 69 64  nnable db run-id
54e0: 20 74 61 6c 20 74 65 73 74 2d 72 65 63 6f 72 64   tal test-record
54f0: 73 29 29 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f 74  s))) ;; i.e. not
5500: 20 46 41 49 4c 2c 20 57 41 49 56 45 44 2c 20 49   FAIL, WAIVED, I
5510: 4e 43 4f 4d 50 4c 45 54 45 2c 20 50 41 53 53 2c  NCOMPLETE, PASS,
5520: 20 4b 49 4c 4c 45 44 2c 0a 09 09 28 74 68 72 65   KILLED,...(thre
5530: 61 64 2d 73 6c 65 65 70 21 20 30 2e 31 29 0a 09  ad-sleep! 0.1)..
5540: 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f  .(if (not (null?
5550: 20 6e 65 77 6c 73 74 29 29 0a 09 09 20 20 20 20   newlst))...    
5560: 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 6c 73  (loop (car newls
5570: 74 29 28 63 64 72 20 6e 65 77 6c 73 74 29 29 29  t)(cdr newlst)))
5580: 29 29 29 29 29 29 0a 0a 3b 3b 20 70 61 72 65 6e  ))))))..;; paren
5590: 74 2d 74 65 73 74 20 69 73 20 74 68 65 72 65 20  t-test is there 
55a0: 61 73 20 61 20 70 6c 61 63 65 68 6f 6c 64 65 72  as a placeholder
55b0: 20 66 6f 72 20 77 68 65 6e 20 70 61 72 65 6e 74   for when parent
55c0: 2d 74 65 73 74 73 20 63 61 6e 20 62 65 20 72 75  -tests can be ru
55d0: 6e 20 61 73 20 61 20 73 65 74 75 70 20 73 74 65  n as a setup ste
55e0: 70 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 3a 74  p.(define (run:t
55f0: 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 72 75  est db run-id ru
5600: 6e 6e 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20  nname keyvallst 
5610: 74 65 73 74 2d 72 65 63 6f 72 64 20 66 6c 61 67  test-record flag
5620: 73 20 70 61 72 65 6e 74 2d 74 65 73 74 29 0a 20  s parent-test). 
5630: 20 3b 3b 20 41 6c 6c 20 74 68 65 73 65 20 76 61   ;; All these va
5640: 72 73 20 6d 69 67 68 74 20 62 65 20 72 65 66 65  rs might be refe
5650: 72 65 6e 63 65 64 20 62 79 20 74 68 65 20 74 65  renced by the te
5660: 73 74 63 6f 6e 66 69 67 20 66 69 6c 65 20 72 65  stconfig file re
5670: 61 64 65 72 0a 20 20 28 6c 65 74 2a 20 28 28 74  ader.  (let* ((t
5680: 65 73 74 2d 6e 61 6d 65 20 20 20 20 28 74 65 73  est-name    (tes
5690: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
56a0: 2d 74 65 73 74 6e 61 6d 65 20 20 20 74 65 73 74  -testname   test
56b0: 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65 73  -record)).. (tes
56c0: 74 2d 77 61 69 74 6f 6e 73 20 28 74 65 73 74 73  t-waitons (tests
56d0: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 77  :testqueue-get-w
56e0: 61 69 74 6f 6e 73 20 20 20 20 74 65 73 74 2d 72  aitons    test-r
56f0: 65 63 6f 72 64 29 29 0a 09 20 28 74 65 73 74 2d  ecord)).. (test-
5700: 63 6f 6e 66 20 20 20 20 28 74 65 73 74 73 3a 74  conf    (tests:t
5710: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73  estqueue-get-tes
5720: 74 63 6f 6e 66 69 67 20 74 65 73 74 2d 72 65 63  tconfig test-rec
5730: 6f 72 64 29 29 0a 09 20 28 69 74 65 6d 64 61 74  ord)).. (itemdat
5740: 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73        (tests:tes
5750: 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d 64  tqueue-get-itemd
5760: 61 74 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72  at    test-recor
5770: 64 29 29 0a 09 20 28 74 65 73 74 2d 70 61 74 68  d)).. (test-path
5780: 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61      (conc *toppa
5790: 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 20 74 65  th* "/tests/" te
57a0: 73 74 2d 6e 61 6d 65 29 29 20 3b 3b 20 63 6f 75  st-name)) ;; cou
57b0: 6c 64 20 75 73 65 20 74 65 73 74 73 3a 67 65 74  ld use tests:get
57c0: 2d 74 65 73 74 63 6f 6e 66 69 67 20 68 65 72 65  -testconfig here
57d0: 20 2e 2e 2e 0a 09 20 28 66 6f 72 63 65 20 20 20   ..... (force   
57e0: 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65       (hash-table
57f0: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61  -ref/default fla
5800: 67 73 20 22 2d 66 6f 72 63 65 22 20 23 66 29 29  gs "-force" #f))
5810: 0a 09 20 28 72 65 72 75 6e 20 20 20 20 20 20 20  .. (rerun       
5820: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66   (hash-table-ref
5830: 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22  /default flags "
5840: 2d 72 65 72 75 6e 22 20 23 66 29 29 0a 09 20 28  -rerun" #f)).. (
5850: 6b 65 65 70 67 6f 69 6e 67 20 20 20 20 28 68 61  keepgoing    (ha
5860: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66  sh-table-ref/def
5870: 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 65  ault flags "-kee
5880: 70 67 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 28  pgoing" #f)).. (
5890: 69 74 65 6d 2d 70 61 74 68 20 20 20 20 20 22 22  item-path     ""
58a0: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72  )).    (debug:pr
58b0: 69 6e 74 20 35 0a 09 09 20 22 74 65 73 74 2d 63  int 5... "test-c
58c0: 6f 6e 66 69 67 3a 20 22 20 28 68 61 73 68 2d 74  onfig: " (hash-t
58d0: 61 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65 73 74  able->alist test
58e0: 2d 63 6f 6e 66 29 0a 09 09 20 22 5c 6e 20 20 20  -conf)... "\n   
58f0: 69 74 65 6d 64 61 74 3a 20 22 20 69 74 65 6d 64  itemdat: " itemd
5900: 61 74 0a 09 09 20 29 0a 20 20 20 20 3b 3b 20 73  at... ).    ;; s
5910: 65 74 74 69 6e 67 20 69 74 65 6d 64 61 74 20 74  etting itemdat t
5920: 6f 20 61 20 6c 69 73 74 20 69 66 20 69 74 20 69  o a list if it i
5930: 73 20 23 66 0a 20 20 20 20 28 69 66 20 28 6e 6f  s #f.    (if (no
5940: 74 20 69 74 65 6d 64 61 74 29 28 73 65 74 21 20  t itemdat)(set! 
5950: 69 74 65 6d 64 61 74 20 27 28 29 29 29 0a 20 20  itemdat '())).  
5960: 20 20 28 73 65 74 21 20 69 74 65 6d 2d 70 61 74    (set! item-pat
5970: 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61  h (item-list->pa
5980: 74 68 20 69 74 65 6d 64 61 74 29 29 0a 20 20 20  th itemdat)).   
5990: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20   (debug:print 2 
59a0: 22 41 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 6c  "Attempting to l
59b0: 61 75 6e 63 68 20 74 65 73 74 20 22 20 74 65 73  aunch test " tes
59c0: 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d  t-name "/" item-
59d0: 70 61 74 68 29 0a 20 20 20 20 28 73 65 74 65 6e  path).    (seten
59e0: 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d 45 22  v "MT_TEST_NAME"
59f0: 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b 20 0a   test-name) ;; .
5a00: 20 20 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f      (setenv "MT_
5a10: 52 55 4e 4e 41 4d 45 22 20 20 20 72 75 6e 6e 61  RUNNAME"   runna
5a20: 6d 65 29 0a 20 20 20 20 28 73 65 74 2d 6d 65 67  me).    (set-meg
5a30: 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 64  atest-env-vars d
5a40: 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65  b run-id) ;; the
5a50: 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64  se may be needed
5a60: 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e   by the launchin
5a70: 67 20 70 72 6f 63 65 73 73 0a 20 20 20 20 28 63  g process.    (c
5a80: 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 79 20  hange-directory 
5a90: 2a 74 6f 70 70 61 74 68 2a 29 0a 0a 20 20 20 20  *toppath*)..    
5aa0: 3b 3b 20 48 65 72 65 20 69 73 20 77 68 65 72 65  ;; Here is where
5ab0: 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61 20 74   the test_meta t
5ac0: 61 62 6c 65 20 69 73 20 62 65 73 74 20 75 70 64  able is best upd
5ad0: 61 74 65 64 0a 20 20 20 20 3b 3b 20 59 65 73 2c  ated.    ;; Yes,
5ae0: 20 61 6e 6f 74 68 65 72 20 75 73 65 20 6f 66 20   another use of 
5af0: 61 20 67 6c 6f 62 61 6c 20 66 6f 72 20 63 61 63  a global for cac
5b00: 68 69 6e 67 2e 20 4e 65 65 64 20 61 20 62 65 74  hing. Need a bet
5b10: 74 65 72 20 77 61 79 3f 0a 20 20 20 20 28 69 66  ter way?.    (if
5b20: 20 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 62 6c   (not (hash-tabl
5b30: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 2a 74  e-ref/default *t
5b40: 65 73 74 2d 6d 65 74 61 2d 75 70 64 61 74 65 64  est-meta-updated
5b50: 2a 20 74 65 73 74 2d 6e 61 6d 65 20 23 66 29 29  * test-name #f))
5b60: 0a 20 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a  .        (begin.
5b70: 09 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d  .   (hash-table-
5b80: 73 65 74 21 20 2a 74 65 73 74 2d 6d 65 74 61 2d  set! *test-meta-
5b90: 75 70 64 61 74 65 64 2a 20 74 65 73 74 2d 6e 61  updated* test-na
5ba0: 6d 65 20 23 74 29 0a 20 20 20 20 20 20 20 20 20  me #t).         
5bb0: 20 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74    (runs:update-t
5bc0: 65 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74  est_meta db test
5bd0: 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29  -name test-conf)
5be0: 29 29 0a 20 20 20 20 0a 20 20 20 20 3b 3b 20 28  )).    .    ;; (
5bf0: 6c 61 6d 62 64 61 20 28 69 74 65 6d 64 61 74 29  lambda (itemdat)
5c00: 20 3b 3b 3b 20 28 28 72 69 70 65 6e 65 73 73 20   ;;; ((ripeness 
5c10: 22 6f 76 65 72 72 69 70 65 22 29 20 28 74 65 6d  "overripe") (tem
5c20: 70 65 72 61 74 75 72 65 20 22 63 6f 6f 6c 22 29  perature "cool")
5c30: 20 28 73 65 61 73 6f 6e 20 22 73 75 6d 6d 65 72   (season "summer
5c40: 22 29 29 0a 20 20 20 20 28 6c 65 74 2a 20 28 28  ")).    (let* ((
5c50: 6e 65 77 2d 74 65 73 74 2d 70 61 74 68 20 28 73  new-test-path (s
5c60: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73  tring-interspers
5c70: 65 20 28 63 6f 6e 73 20 74 65 73 74 2d 70 61 74  e (cons test-pat
5c80: 68 20 28 6d 61 70 20 63 61 64 72 20 69 74 65 6d  h (map cadr item
5c90: 64 61 74 29 29 20 22 2f 22 29 29 0a 09 20 20 20  dat)) "/"))..   
5ca0: 28 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 28  (new-test-name (
5cb0: 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65 6d 2d  if (equal? item-
5cc0: 70 61 74 68 20 22 22 29 20 74 65 73 74 2d 6e 61  path "") test-na
5cd0: 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 2d 6e 61  me (conc test-na
5ce0: 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68  me "/" item-path
5cf0: 29 29 29 20 3b 3b 20 6a 75 73 74 20 6e 65 65 64  ))) ;; just need
5d00: 20 69 74 20 74 6f 20 62 65 20 75 6e 69 71 75 65   it to be unique
5d10: 0a 09 20 20 20 28 74 65 73 74 64 61 74 20 20 20  ..   (testdat   
5d20: 20 20 20 20 28 64 62 3a 67 65 74 2d 74 65 73 74      (db:get-test
5d30: 2d 69 6e 66 6f 20 64 62 20 72 75 6e 2d 69 64 20  -info db run-id 
5d40: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70  test-name item-p
5d50: 61 74 68 29 29 0a 09 20 20 20 28 74 65 73 74 2d  ath))..   (test-
5d60: 69 64 20 20 20 20 20 20 20 23 66 29 29 0a 20 20  id       #f)).  
5d70: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 74 65 73      (if (not tes
5d80: 74 64 61 74 29 0a 09 20 20 28 62 65 67 69 6e 0a  tdat)..  (begin.
5d90: 09 20 20 20 20 3b 3b 20 65 6e 73 75 72 65 20 74  .    ;; ensure t
5da0: 68 61 74 20 74 68 65 20 70 61 74 68 20 65 78 69  hat the path exi
5db0: 73 74 73 20 62 65 66 6f 72 65 20 72 65 67 69 73  sts before regis
5dc0: 74 65 72 69 6e 67 20 74 68 65 20 74 65 73 74 0a  tering the test.
5dd0: 09 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 43 61  .    ;; NOPE: Ca
5de0: 6e 6e 6f 74 21 20 44 6f 6e 27 74 20 6b 6e 6f 77  nnot! Don't know
5df0: 20 79 65 74 20 77 68 69 63 68 20 64 69 73 6b 20   yet which disk 
5e00: 61 72 65 61 20 77 69 6c 6c 20 62 65 20 61 73 73  area will be ass
5e10: 69 67 6e 65 64 2e 2e 2e 2e 0a 09 20 20 20 20 3b  igned......    ;
5e20: 3b 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20  ; (system (conc 
5e30: 22 6d 6b 64 69 72 20 2d 70 20 22 20 6e 65 77 2d  "mkdir -p " new-
5e40: 74 65 73 74 2d 70 61 74 68 29 29 0a 09 20 20 20  test-path))..   
5e50: 20 28 72 74 65 73 74 73 3a 72 65 67 69 73 74 65   (rtests:registe
5e60: 72 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64  r-test db run-id
5e70: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d   test-name item-
5e80: 70 61 74 68 29 0a 09 20 20 20 20 28 73 65 74 21  path)..    (set!
5e90: 20 74 65 73 74 64 61 74 20 28 64 62 3a 67 65 74   testdat (db:get
5ea0: 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 20 72 75  -test-info db ru
5eb0: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69  n-id test-name i
5ec0: 74 65 6d 2d 70 61 74 68 29 29 29 29 0a 20 20 20  tem-path)))).   
5ed0: 20 20 20 28 73 65 74 21 20 74 65 73 74 2d 69 64     (set! test-id
5ee0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64   (db:test-get-id
5ef0: 20 74 65 73 74 64 61 74 29 29 0a 20 20 20 20 20   testdat)).     
5f00: 20 28 63 68 61 6e 67 65 2d 64 69 72 65 63 74 6f   (change-directo
5f10: 72 79 20 74 65 73 74 2d 70 61 74 68 29 0a 20 20  ry test-path).  
5f20: 20 20 20 20 28 63 61 73 65 20 28 69 66 20 66 6f      (case (if fo
5f30: 72 63 65 20 3b 3b 20 28 61 72 67 73 3a 67 65 74  rce ;; (args:get
5f40: 2d 61 72 67 20 22 2d 66 6f 72 63 65 22 29 0a 09  -arg "-force")..
5f50: 09 27 4e 4f 54 5f 53 54 41 52 54 45 44 0a 09 09  .'NOT_STARTED...
5f60: 28 69 66 20 74 65 73 74 64 61 74 0a 09 09 20 20  (if testdat...  
5f70: 20 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62 6f    (string->symbo
5f80: 6c 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  l (test:get-stat
5f90: 65 20 74 65 73 74 64 61 74 29 29 0a 09 09 20 20  e testdat))...  
5fa0: 20 20 27 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73    'failed-to-ins
5fb0: 65 72 74 29 29 0a 09 28 28 66 61 69 6c 65 64 2d  ert))..((failed-
5fc0: 74 6f 2d 69 6e 73 65 72 74 29 0a 09 20 28 64 65  to-insert).. (de
5fd0: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52  bug:print 0 "ERR
5fe0: 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 69 6e  OR: Failed to in
5ff0: 73 65 72 74 20 74 68 65 20 72 65 63 6f 72 64 20  sert the record 
6000: 69 6e 74 6f 20 74 68 65 20 64 62 22 29 29 0a 09  into the db"))..
6010: 28 28 4e 4f 54 5f 53 54 41 52 54 45 44 20 43 4f  ((NOT_STARTED CO
6020: 4d 50 4c 45 54 45 44 29 0a 09 20 28 6c 65 74 20  MPLETED).. (let 
6030: 28 28 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09  ((runflag #f))..
6040: 20 20 20 28 63 6f 6e 64 0a 09 20 20 20 20 3b 3b     (cond..    ;;
6050: 20 2d 66 6f 72 63 65 2c 20 72 75 6e 20 6e 6f 20   -force, run no 
6060: 6d 61 74 74 65 72 20 77 68 61 74 0a 09 20 20 20  matter what..   
6070: 20 28 66 6f 72 63 65 20 28 73 65 74 21 20 72 75   (force (set! ru
6080: 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20  nflag #t))..    
6090: 3b 3b 20 4e 4f 54 5f 53 54 41 52 54 45 44 2c 20  ;; NOT_STARTED, 
60a0: 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77 68  run no matter wh
60b0: 61 74 0a 09 20 20 20 20 28 28 65 71 75 61 6c 3f  at..    ((equal?
60c0: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65   (test:get-state
60d0: 20 74 65 73 74 64 61 74 29 20 22 4e 4f 54 5f 53   testdat) "NOT_S
60e0: 54 41 52 54 45 44 22 29 28 73 65 74 21 20 72 75  TARTED")(set! ru
60f0: 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20  nflag #t))..    
6100: 3b 3b 20 6e 6f 74 20 2d 72 65 72 75 6e 20 61 6e  ;; not -rerun an
6110: 64 20 50 41 53 53 2c 20 57 41 52 4e 20 6f 72 20  d PASS, WARN or 
6120: 43 48 45 43 4b 2c 20 64 6f 20 6e 6f 20 72 75 6e  CHECK, do no run
6130: 0a 09 20 20 20 20 28 28 61 6e 64 20 28 6f 72 20  ..    ((and (or 
6140: 28 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09 20 20  (not rerun)...  
6150: 20 20 20 20 6b 65 65 70 67 6f 69 6e 67 29 0a 09      keepgoing)..
6160: 09 20 20 3b 3b 20 52 65 71 75 69 72 65 20 74 6f  .  ;; Require to
6170: 20 66 6f 72 63 65 20 72 65 2d 72 75 6e 20 66 6f   force re-run fo
6180: 72 20 43 4f 4d 50 4c 45 54 45 44 20 6f 72 20 2a  r COMPLETED or *
6190: 61 6e 79 74 68 69 6e 67 2a 20 2b 20 50 41 53 53  anything* + PASS
61a0: 2c 57 41 52 4e 20 6f 72 20 43 48 45 43 4b 0a 09  ,WARN or CHECK..
61b0: 09 20 20 28 6f 72 20 28 6d 65 6d 62 65 72 20 28  .  (or (member (
61c0: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20  test:get-status 
61d0: 74 65 73 74 64 61 74 29 20 27 28 22 50 41 53 53  testdat) '("PASS
61e0: 22 20 22 57 41 52 4e 22 20 22 43 48 45 43 4b 22  " "WARN" "CHECK"
61f0: 29 29 0a 09 09 20 20 20 20 20 20 28 6d 65 6d 62  ))...      (memb
6200: 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61  er (test:get-sta
6210: 74 65 20 20 74 65 73 74 64 61 74 29 20 27 28 22  te  testdat) '("
6220: 43 4f 4d 50 4c 45 54 45 44 22 29 29 29 29 20 0a  COMPLETED")))) .
6230: 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  .     (debug:pri
6240: 6e 74 20 32 20 22 49 4e 46 4f 3a 20 72 75 6e 6e  nt 2 "INFO: runn
6250: 69 6e 67 20 74 65 73 74 20 22 20 74 65 73 74 2d  ing test " test-
6260: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61  name "/" item-pa
6270: 74 68 20 22 20 73 75 70 70 72 65 73 73 65 64 20  th " suppressed 
6280: 61 73 20 69 74 20 69 73 20 22 20 28 74 65 73 74  as it is " (test
6290: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64  :get-state testd
62a0: 61 74 29 20 22 20 61 6e 64 20 22 20 28 74 65 73  at) " and " (tes
62b0: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73  t:get-status tes
62c0: 74 64 61 74 29 29 0a 09 20 20 20 20 20 28 73 65  tdat))..     (se
62d0: 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 0a  t! runflag #f)).
62e0: 09 20 20 20 20 3b 3b 20 2d 72 65 72 75 6e 20 61  .    ;; -rerun a
62f0: 6e 64 20 73 74 61 74 75 73 20 69 73 20 6f 6e 65  nd status is one
6300: 20 6f 66 20 74 68 65 20 73 70 65 63 69 66 65 64   of the specifed
6310: 2c 20 72 75 6e 20 69 74 0a 09 20 20 20 20 28 28  , run it..    ((
6320: 61 6e 64 20 72 65 72 75 6e 0a 09 09 20 20 28 6c  and rerun...  (l
6330: 65 74 2a 20 28 28 72 65 72 75 6e 6c 73 74 20 20  et* ((rerunlst  
6340: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 72   (string-split r
6350: 65 72 75 6e 20 22 2c 22 29 29 0a 09 09 09 20 28  erun ",")).... (
6360: 6d 75 73 74 2d 72 65 72 75 6e 20 28 6d 65 6d 62  must-rerun (memb
6370: 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61  er (test:get-sta
6380: 74 75 73 20 74 65 73 74 64 61 74 29 20 72 65 72  tus testdat) rer
6390: 75 6e 6c 73 74 29 29 29 0a 09 09 20 20 20 20 28  unlst)))...    (
63a0: 64 65 62 75 67 3a 70 72 69 6e 74 20 33 20 22 49  debug:print 3 "I
63b0: 4e 46 4f 3a 20 2d 72 65 72 75 6e 20 6c 69 73 74  NFO: -rerun list
63c0: 3a 20 22 20 72 65 72 75 6e 20 22 2c 20 74 65 73  : " rerun ", tes
63d0: 74 2d 73 74 61 74 75 73 3a 20 22 20 28 74 65 73  t-status: " (tes
63e0: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73  t:get-status tes
63f0: 74 64 61 74 29 22 2c 20 6d 75 73 74 2d 72 65 72  tdat)", must-rer
6400: 75 6e 3a 20 22 20 6d 75 73 74 2d 72 65 72 75 6e  un: " must-rerun
6410: 29 0a 09 09 20 20 20 20 6d 75 73 74 2d 72 65 72  )...    must-rer
6420: 75 6e 29 29 0a 09 20 20 20 20 20 28 64 65 62 75  un))..     (debu
6430: 67 3a 70 72 69 6e 74 20 32 20 22 49 4e 46 4f 3a  g:print 2 "INFO:
6440: 20 52 65 72 75 6e 20 66 6f 72 63 65 64 20 66 6f   Rerun forced fo
6450: 72 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61  r test " test-na
6460: 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68  me "/" item-path
6470: 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 75  )..     (set! ru
6480: 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20  nflag #t))..    
6490: 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 2c 20 64  ;; -keepgoing, d
64a0: 6f 20 6e 6f 74 20 72 65 72 75 6e 20 46 41 49 4c  o not rerun FAIL
64b0: 0a 09 20 20 20 20 28 28 61 6e 64 20 6b 65 65 70  ..    ((and keep
64c0: 67 6f 69 6e 67 0a 09 09 20 20 28 6d 65 6d 62 65  going...  (membe
64d0: 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  r (test:get-stat
64e0: 75 73 20 74 65 73 74 64 61 74 29 20 27 28 22 46  us testdat) '("F
64f0: 41 49 4c 22 29 29 29 0a 09 20 20 20 20 20 28 73  AIL")))..     (s
6500: 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29  et! runflag #f))
6510: 0a 09 20 20 20 20 28 28 61 6e 64 20 28 6e 6f 74  ..    ((and (not
6520: 20 72 65 72 75 6e 29 0a 09 09 20 20 28 6d 65 6d   rerun)...  (mem
6530: 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74  ber (test:get-st
6540: 61 74 75 73 20 74 65 73 74 64 61 74 29 20 27 28  atus testdat) '(
6550: 22 46 41 49 4c 22 20 22 6e 2f 61 22 29 29 29 0a  "FAIL" "n/a"))).
6560: 09 20 20 20 20 20 28 73 65 74 21 20 72 75 6e 66  .     (set! runf
6570: 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 28 65  lag #t))..    (e
6580: 6c 73 65 20 28 73 65 74 21 20 72 75 6e 66 6c 61  lse (set! runfla
6590: 67 20 23 66 29 29 29 0a 09 20 20 20 28 64 65 62  g #f)))..   (deb
65a0: 75 67 3a 70 72 69 6e 74 20 36 20 22 52 55 4e 4e  ug:print 6 "RUNN
65b0: 49 4e 47 20 3d 3e 20 72 75 6e 66 6c 61 67 3a 20  ING => runflag: 
65c0: 22 20 72 75 6e 66 6c 61 67 20 22 20 53 54 41 54  " runflag " STAT
65d0: 45 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73  E: " (test:get-s
65e0: 74 61 74 65 20 74 65 73 74 64 61 74 29 20 22 20  tate testdat) " 
65f0: 53 54 41 54 55 53 3a 20 22 20 28 74 65 73 74 3a  STATUS: " (test:
6600: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64  get-status testd
6610: 61 74 29 29 0a 09 20 20 20 28 69 66 20 28 6e 6f  at))..   (if (no
6620: 74 20 72 75 6e 66 6c 61 67 29 0a 09 20 20 20 20  t runflag)..    
6630: 20 20 20 28 69 66 20 28 6e 6f 74 20 70 61 72 65     (if (not pare
6640: 6e 74 2d 74 65 73 74 29 0a 09 09 20 20 20 28 64  nt-test)...   (d
6650: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f  ebug:print 1 "NO
6660: 54 45 3a 20 4e 6f 74 20 73 74 61 72 74 69 6e 67  TE: Not starting
6670: 20 74 65 73 74 20 22 20 6e 65 77 2d 74 65 73 74   test " new-test
6680: 2d 6e 61 6d 65 20 22 20 61 73 20 69 74 20 69 73  -name " as it is
6690: 20 73 74 61 74 65 20 5c 22 22 20 28 74 65 73 74   state \"" (test
66a0: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64  :get-state testd
66b0: 61 74 29 20 0a 09 09 09 09 22 5c 22 20 61 6e 64  at) ....."\" and
66c0: 20 73 74 61 74 75 73 20 5c 22 22 20 28 74 65 73   status \"" (tes
66d0: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73  t:get-status tes
66e0: 74 64 61 74 29 20 22 5c 22 2c 20 75 73 65 20 2d  tdat) "\", use -
66f0: 72 65 72 75 6e 20 5c 22 22 20 28 74 65 73 74 3a  rerun \"" (test:
6700: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64  get-status testd
6710: 61 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20  at).            
6720: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
6730: 20 20 20 20 22 5c 22 20 6f 72 20 2d 66 6f 72 63      "\" or -forc
6740: 65 20 74 6f 20 6f 76 65 72 72 69 64 65 22 29 29  e to override"))
6750: 0a 09 20 20 20 20 20 20 20 3b 3b 20 4e 4f 54 45  ..       ;; NOTE
6760: 3a 20 4e 6f 20 6c 6f 6e 67 65 72 20 62 65 20 63  : No longer be c
6770: 68 65 63 6b 69 6e 67 20 70 72 65 72 65 71 75 69  hecking prerequi
6780: 73 69 74 65 73 20 68 65 72 65 21 20 57 69 6c 6c  sites here! Will
6790: 20 6e 65 76 65 72 20 67 65 74 20 68 65 72 65 20   never get here 
67a0: 75 6e 6c 65 73 73 20 70 72 65 72 65 71 73 20 61  unless prereqs a
67b0: 72 65 0a 09 20 20 20 20 20 20 20 3b 3b 20 20 20  re..       ;;   
67c0: 20 20 20 20 61 6c 72 65 61 64 79 20 6d 65 74 2e      already met.
67d0: 0a 09 20 20 20 20 20 20 20 28 69 66 20 28 6e 6f  ..       (if (no
67e0: 74 20 28 6c 61 75 6e 63 68 2d 74 65 73 74 20 64  t (launch-test d
67f0: 62 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65  b run-id runname
6800: 20 74 65 73 74 2d 63 6f 6e 66 20 6b 65 79 76 61   test-conf keyva
6810: 6c 6c 73 74 20 74 65 73 74 2d 6e 61 6d 65 20 74  llst test-name t
6820: 65 73 74 2d 70 61 74 68 20 69 74 65 6d 64 61 74  est-path itemdat
6830: 20 66 6c 61 67 73 29 29 0a 09 09 20 20 20 28 62   flags))...   (b
6840: 65 67 69 6e 0a 09 09 20 20 20 20 20 28 70 72 69  egin...     (pri
6850: 6e 74 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65  nt "ERROR: Faile
6860: 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 68 65 20  d to launch the 
6870: 74 65 73 74 2e 20 45 78 69 74 69 6e 67 20 61 73  test. Exiting as
6880: 20 73 6f 6f 6e 20 61 73 20 70 6f 73 73 69 62 6c   soon as possibl
6890: 65 22 29 0a 09 09 20 20 20 20 20 28 73 65 74 21  e")...     (set!
68a0: 20 2a 67 6c 6f 62 61 6c 65 78 69 74 73 74 61 74   *globalexitstat
68b0: 75 73 2a 20 31 29 20 3b 3b 20 0a 09 09 20 20 20  us* 1) ;; ...   
68c0: 20 20 28 70 72 6f 63 65 73 73 2d 73 69 67 6e 61    (process-signa
68d0: 6c 20 28 63 75 72 72 65 6e 74 2d 70 72 6f 63 65  l (current-proce
68e0: 73 73 2d 69 64 29 20 73 69 67 6e 61 6c 2f 6b 69  ss-id) signal/ki
68f0: 6c 6c 29 29 29 29 29 29 0a 09 28 28 4b 49 4c 4c  ll))))))..((KILL
6900: 45 44 29 20 0a 09 20 28 64 65 62 75 67 3a 70 72  ED) .. (debug:pr
6910: 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 22 20 6e  int 1 "NOTE: " n
6920: 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 69  ew-test-name " i
6930: 73 20 61 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e  s already runnin
6940: 67 20 6f 72 20 77 61 73 20 65 78 70 6c 69 63 74  g or was explict
6950: 6c 79 20 6b 69 6c 6c 65 64 2c 20 75 73 65 20 2d  ly killed, use -
6960: 66 6f 72 63 65 20 74 6f 20 6c 61 75 6e 63 68 20  force to launch 
6970: 69 74 2e 22 29 29 0a 09 28 28 4c 41 55 4e 43 48  it."))..((LAUNCH
6980: 45 44 20 52 45 4d 4f 54 45 48 4f 53 54 53 54 41  ED REMOTEHOSTSTA
6990: 52 54 20 52 55 4e 4e 49 4e 47 29 20 20 0a 09 20  RT RUNNING)  .. 
69a0: 28 69 66 20 28 3e 20 28 2d 20 28 63 75 72 72 65  (if (> (- (curre
69b0: 6e 74 2d 73 65 63 6f 6e 64 73 29 28 2b 20 28 64  nt-seconds)(+ (d
69c0: 62 3a 74 65 73 74 2d 67 65 74 2d 65 76 65 6e 74  b:test-get-event
69d0: 5f 74 69 6d 65 20 74 65 73 74 64 61 74 29 0a 09  _time testdat)..
69e0: 09 09 09 20 20 20 20 20 20 20 28 64 62 3a 74 65  ...       (db:te
69f0: 73 74 2d 67 65 74 2d 72 75 6e 5f 64 75 72 61 74  st-get-run_durat
6a00: 69 6f 6e 20 74 65 73 74 64 61 74 29 29 29 0a 09  ion testdat)))..
6a10: 09 36 30 30 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f  .600) ;; i.e. no
6a20: 20 75 70 64 61 74 65 20 66 6f 72 20 6d 6f 72 65   update for more
6a30: 20 74 68 61 6e 20 36 30 30 20 73 65 63 6f 6e 64   than 600 second
6a40: 73 0a 09 20 20 20 20 20 28 62 65 67 69 6e 0a 09  s..     (begin..
6a50: 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72         (debug:pr
6a60: 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20  int 0 "WARNING: 
6a70: 54 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65  Test " test-name
6a80: 20 22 20 61 70 70 65 61 72 73 20 74 6f 20 62 65   " appears to be
6a90: 20 64 65 61 64 2e 20 46 6f 72 63 69 6e 67 20 69   dead. Forcing i
6aa0: 74 20 74 6f 20 73 74 61 74 65 20 49 4e 43 4f 4d  t to state INCOM
6ab0: 50 4c 45 54 45 20 61 6e 64 20 73 74 61 74 75 73  PLETE and status
6ac0: 20 53 54 55 43 4b 2f 44 45 41 44 22 29 0a 09 20   STUCK/DEAD").. 
6ad0: 20 20 20 20 20 20 28 74 65 73 74 2d 73 65 74 2d        (test-set-
6ae0: 73 74 61 74 75 73 21 20 64 62 20 74 65 73 74 2d  status! db test-
6af0: 69 64 20 22 49 4e 43 4f 4d 50 4c 45 54 45 22 20  id "INCOMPLETE" 
6b00: 22 53 54 55 43 4b 2f 44 45 41 44 22 20 22 54 65  "STUCK/DEAD" "Te
6b10: 73 74 20 69 73 20 73 74 75 63 6b 20 6f 72 20 64  st is stuck or d
6b20: 65 61 64 22 20 23 66 29 29 0a 09 20 20 20 20 20  ead" #f))..     
6b30: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22  (debug:print 2 "
6b40: 4e 4f 54 45 3a 20 22 20 74 65 73 74 2d 6e 61 6d  NOTE: " test-nam
6b50: 65 20 22 20 69 73 20 61 6c 72 65 61 64 79 20 72  e " is already r
6b60: 75 6e 6e 69 6e 67 22 29 29 29 0a 09 28 65 6c 73  unning")))..(els
6b70: 65 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70  e       (debug:p
6b80: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 46  rint 0 "ERROR: F
6b90: 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 20  ailed to launch 
6ba0: 74 65 73 74 20 22 20 6e 65 77 2d 74 65 73 74 2d  test " new-test-
6bb0: 6e 61 6d 65 20 22 2e 20 55 6e 72 65 63 6f 67 6e  name ". Unrecogn
6bc0: 69 73 65 64 20 73 74 61 74 65 20 22 20 28 74 65  ised state " (te
6bd0: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73  st:get-state tes
6be0: 74 64 61 74 29 29 29 29 29 29 29 0a 0a 3b 3b 3d  tdat)))))))..;;=
6bf0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6c00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6c10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6c20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6c30: 3d 3d 3d 3d 3d 0a 3b 3b 20 45 4e 44 20 4f 46 20  =====.;; END OF 
6c40: 4e 45 57 20 53 54 55 46 46 0a 3b 3b 3d 3d 3d 3d  NEW STUFF.;;====
6c50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6c60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6c70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6c80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6c90: 3d 3d 0a 0a 28 64 65 66 69 6e 65 20 28 67 65 74  ==..(define (get
6ca0: 2d 64 69 72 2d 75 70 2d 6e 20 64 69 72 20 2e 20  -dir-up-n dir . 
6cb0: 70 61 72 61 6d 73 29 20 0a 20 20 28 6c 65 74 20  params) .  (let 
6cc0: 28 28 64 70 61 72 74 73 20 20 28 73 74 72 69 6e  ((dparts  (strin
6cd0: 67 2d 73 70 6c 69 74 20 64 69 72 20 22 2f 22 29  g-split dir "/")
6ce0: 29 0a 09 28 63 6f 75 6e 74 20 20 20 28 69 66 20  )..(count   (if 
6cf0: 28 6e 75 6c 6c 3f 20 70 61 72 61 6d 73 29 20 31  (null? params) 1
6d00: 20 28 63 61 72 20 70 61 72 61 6d 73 29 29 29 29   (car params))))
6d10: 0a 20 20 20 20 28 63 6f 6e 63 20 22 2f 22 20 28  .    (conc "/" (
6d20: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72  string-intersper
6d30: 73 65 20 0a 09 20 20 20 20 20 20 20 28 74 61 6b  se ..       (tak
6d40: 65 20 64 70 61 72 74 73 20 28 2d 20 28 6c 65 6e  e dparts (- (len
6d50: 67 74 68 20 64 70 61 72 74 73 29 20 63 6f 75 6e  gth dparts) coun
6d60: 74 29 29 0a 09 20 20 20 20 20 20 20 22 2f 22 29  t))..       "/")
6d70: 29 29 29 0a 3b 3b 20 52 65 6d 6f 76 65 20 72 75  ))).;; Remove ru
6d80: 6e 73 0a 3b 3b 20 66 69 65 6c 64 73 20 61 72 65  ns.;; fields are
6d90: 20 70 61 73 73 69 6e 67 20 69 6e 20 74 68 72 6f   passing in thro
6da0: 75 67 68 20 0a 3b 3b 20 61 63 74 69 6f 6e 3a 0a  ugh .;; action:.
6db0: 3b 3b 20 20 20 20 27 72 65 6d 6f 76 65 2d 72 75  ;;    'remove-ru
6dc0: 6e 73 0a 3b 3b 20 20 20 20 27 73 65 74 2d 73 74  ns.;;    'set-st
6dd0: 61 74 65 2d 73 74 61 74 75 73 0a 3b 3b 0a 3b 3b  ate-status.;;.;;
6de0: 20 4e 42 2f 2f 20 73 68 6f 75 6c 64 20 70 61 73   NB// should pas
6df0: 73 20 69 6e 20 6b 65 79 73 3f 0a 3b 3b 0a 28 64  s in keys?.;;.(d
6e00: 65 66 69 6e 65 20 28 72 75 6e 73 3a 6f 70 65 72  efine (runs:oper
6e10: 61 74 65 2d 6f 6e 20 64 62 20 61 63 74 69 6f 6e  ate-on db action
6e20: 20 72 75 6e 6e 61 6d 65 70 61 74 74 20 74 65 73   runnamepatt tes
6e30: 74 70 61 74 74 20 69 74 65 6d 70 61 74 74 20 23  tpatt itempatt #
6e40: 21 6b 65 79 20 28 73 74 61 74 65 20 23 66 29 28  !key (state #f)(
6e50: 73 74 61 74 75 73 20 23 66 29 28 6e 65 77 2d 73  status #f)(new-s
6e60: 74 61 74 65 2d 73 74 61 74 75 73 20 23 66 29 29  tate-status #f))
6e70: 0a 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73 20  .  (let* ((keys 
6e80: 20 20 20 20 20 20 20 20 28 72 64 62 3a 67 65 74          (rdb:get
6e90: 2d 6b 65 79 73 20 64 62 29 29 0a 09 20 28 72 75  -keys db)).. (ru
6ea0: 6e 64 61 74 20 20 20 20 20 20 20 28 72 75 6e 73  ndat       (runs
6eb0: 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74  :get-runs-by-pat
6ec0: 74 20 64 62 20 6b 65 79 73 20 72 75 6e 6e 61 6d  t db keys runnam
6ed0: 65 70 61 74 74 29 29 0a 09 20 28 68 65 61 64 65  epatt)).. (heade
6ee0: 72 20 20 20 20 20 20 20 28 76 65 63 74 6f 72 2d  r       (vector-
6ef0: 72 65 66 20 72 75 6e 64 61 74 20 30 29 29 0a 09  ref rundat 0))..
6f00: 20 28 72 75 6e 73 20 20 20 20 20 20 20 20 20 28   (runs         (
6f10: 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61  vector-ref runda
6f20: 74 20 31 29 29 0a 09 20 28 73 74 61 74 65 73 20  t 1)).. (states 
6f30: 20 20 20 20 20 20 28 69 66 20 73 74 61 74 65 20        (if state 
6f40: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 73   (string-split s
6f50: 74 61 74 65 20 20 22 2c 22 29 20 27 28 29 29 29  tate  ",") '()))
6f60: 0a 09 20 28 73 74 61 74 75 73 65 73 20 20 20 20  .. (statuses    
6f70: 20 28 69 66 20 73 74 61 74 75 73 20 28 73 74 72   (if status (str
6f80: 69 6e 67 2d 73 70 6c 69 74 20 73 74 61 74 75 73  ing-split status
6f90: 20 22 2c 22 29 20 27 28 29 29 29 0a 09 20 28 73   ",") '())).. (s
6fa0: 74 61 74 65 2d 73 74 61 74 75 73 20 28 69 66 20  tate-status (if 
6fb0: 28 73 74 72 69 6e 67 3f 20 6e 65 77 2d 73 74 61  (string? new-sta
6fc0: 74 65 2d 73 74 61 74 75 73 29 20 28 73 74 72 69  te-status) (stri
6fd0: 6e 67 2d 73 70 6c 69 74 20 6e 65 77 2d 73 74 61  ng-split new-sta
6fe0: 74 65 2d 73 74 61 74 75 73 20 22 2c 22 29 20 27  te-status ",") '
6ff0: 28 23 66 20 23 66 29 29 29 29 0a 20 20 20 20 28  (#f #f)))).    (
7000: 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 48  debug:print 2 "H
7010: 65 61 64 65 72 3a 20 22 20 68 65 61 64 65 72 20  eader: " header 
7020: 22 20 61 63 74 69 6f 6e 3a 20 22 20 61 63 74 69  " action: " acti
7030: 6f 6e 20 22 20 6e 65 77 2d 73 74 61 74 65 2d 73  on " new-state-s
7040: 74 61 74 75 73 3a 20 22 20 6e 65 77 2d 73 74 61  tatus: " new-sta
7050: 74 65 2d 73 74 61 74 75 73 29 0a 20 20 20 20 28  te-status).    (
7060: 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 28 6c  for-each.     (l
7070: 61 6d 62 64 61 20 28 72 75 6e 29 0a 20 20 20 20  ambda (run).    
7080: 20 20 20 28 6c 65 74 20 28 28 72 75 6e 6b 65 79     (let ((runkey
7090: 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70   (string-intersp
70a0: 65 72 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 64  erse (map (lambd
70b0: 61 20 28 6b 29 0a 09 09 09 09 09 09 28 64 62 3a  a (k).......(db:
70c0: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61  get-value-by-hea
70d0: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 28  der run header (
70e0: 76 65 63 74 6f 72 2d 72 65 66 20 6b 20 30 29 29  vector-ref k 0))
70f0: 29 20 6b 65 79 73 29 20 22 2f 22 29 29 0a 09 20  ) keys) "/")).. 
7100: 20 20 20 20 28 64 69 72 73 2d 74 6f 2d 72 65 6d      (dirs-to-rem
7110: 6f 76 65 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74  ove (make-hash-t
7120: 61 62 6c 65 29 29 29 0a 09 20 28 6c 65 74 2a 20  able))).. (let* 
7130: 28 28 72 75 6e 2d 69 64 20 20 20 20 28 64 62 3a  ((run-id    (db:
7140: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61  get-value-by-hea
7150: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22  der run header "
7160: 69 64 22 29 29 0a 09 09 28 72 75 6e 2d 73 74 61  id"))...(run-sta
7170: 74 65 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65  te (db:get-value
7180: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68  -by-header run h
7190: 65 61 64 65 72 20 22 73 74 61 74 65 22 29 29 0a  eader "state")).
71a0: 09 09 28 74 65 73 74 73 20 20 20 20 20 28 69 66  ..(tests     (if
71b0: 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 72 75   (not (equal? ru
71c0: 6e 2d 73 74 61 74 65 20 22 6c 6f 63 6b 65 64 22  n-state "locked"
71d0: 29 29 0a 09 09 09 20 20 20 20 20 20 20 28 72 64  ))....       (rd
71e0: 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d  b:get-tests-for-
71f0: 72 75 6e 20 64 62 20 28 64 62 3a 67 65 74 2d 76  run db (db:get-v
7200: 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72  alue-by-header r
7210: 75 6e 20 68 65 61 64 65 72 20 22 69 64 22 29 0a  un header "id").
7220: 09 09 09 09 09 09 20 20 20 20 20 20 74 65 73 74  ......      test
7230: 70 61 74 74 20 69 74 65 6d 70 61 74 74 20 73 74  patt itempatt st
7240: 61 74 65 73 20 73 74 61 74 75 73 65 73 0a 09 09  ates statuses...
7250: 09 09 09 09 20 20 20 20 20 20 6e 6f 74 2d 69 6e  ....      not-in
7260: 3a 20 20 23 66 0a 09 09 09 09 09 09 20 20 20 20  :  #f.......    
7270: 20 20 73 6f 72 74 2d 62 79 3a 20 28 63 61 73 65    sort-by: (case
7280: 20 61 63 74 69 6f 6e 0a 09 09 09 09 09 09 09 09   action.........
7290: 20 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29 20   ((remove-runs) 
72a0: 27 72 75 6e 64 69 72 29 0a 09 09 09 09 09 09 09  'rundir)........
72b0: 09 20 28 65 6c 73 65 20 20 20 20 20 20 20 20 20  . (else         
72c0: 20 27 65 76 65 6e 74 5f 74 69 6d 65 29 29 29 0a   'event_time))).
72d0: 09 09 09 20 20 20 20 20 20 20 27 28 29 29 29 0a  ...       '())).
72e0: 09 09 28 6c 61 73 74 74 70 61 74 68 20 22 2f 64  ..(lasttpath "/d
72f0: 6f 65 73 2f 6e 6f 74 2f 65 78 69 73 74 2f 49 2f  oes/not/exist/I/
7300: 68 6f 70 65 22 29 29 0a 0a 09 20 20 20 28 69 66  hope"))...   (if
7310: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 73   (not (null? tes
7320: 74 73 29 29 0a 09 20 20 20 20 20 20 20 28 62 65  ts))..       (be
7330: 67 69 6e 0a 09 09 20 28 63 61 73 65 20 61 63 74  gin... (case act
7340: 69 6f 6e 0a 09 09 20 20 20 28 28 72 65 6d 6f 76  ion...   ((remov
7350: 65 2d 72 75 6e 73 29 0a 09 09 20 20 20 20 28 64  e-runs)...    (d
7360: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65  ebug:print 1 "Re
7370: 6d 6f 76 69 6e 67 20 74 65 73 74 73 20 66 6f 72  moving tests for
7380: 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22   run: " runkey "
7390: 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65   " (db:get-value
73a0: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68  -by-header run h
73b0: 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29  eader "runname")
73c0: 29 29 0a 09 09 20 20 20 28 28 73 65 74 2d 73 74  ))...   ((set-st
73d0: 61 74 65 2d 73 74 61 74 75 73 29 0a 09 09 20 20  ate-status)...  
73e0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31    (debug:print 1
73f0: 20 22 4d 6f 64 69 66 79 69 6e 67 20 73 74 61 74   "Modifying stat
7400: 65 20 61 6e 64 20 73 74 61 75 73 20 66 6f 72 20  e and staus for 
7410: 74 65 73 74 73 20 66 6f 72 20 72 75 6e 3a 20 22  tests for run: "
7420: 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a   runkey " " (db:
7430: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61  get-value-by-hea
7440: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22  der run header "
7450: 72 75 6e 6e 61 6d 65 22 29 29 29 0a 09 09 20 20  runname")))...  
7460: 20 28 65 6c 73 65 0a 09 09 20 20 20 20 28 70 72   (else...    (pr
7470: 69 6e 74 20 22 49 4e 46 4f 3a 20 61 63 74 69 6f  int "INFO: actio
7480: 6e 20 6e 6f 74 20 72 65 63 6f 67 6e 69 73 65 64  n not recognised
7490: 20 22 20 61 63 74 69 6f 6e 29 29 29 0a 09 09 20   " action)))... 
74a0: 28 66 6f 72 2d 65 61 63 68 0a 09 09 20 20 28 6c  (for-each...  (l
74b0: 61 6d 62 64 61 20 28 74 65 73 74 29 0a 09 09 20  ambda (test)... 
74c0: 20 20 20 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d     (let* ((item-
74d0: 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65  path (db:test-ge
74e0: 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74  t-item-path test
74f0: 29 29 0a 09 09 09 20 20 20 28 74 65 73 74 2d 6e  ))....   (test-n
7500: 61 6d 65 20 28 64 62 3a 74 65 73 74 2d 67 65 74  ame (db:test-get
7510: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29 29  -testname test))
7520: 0a 09 09 09 20 20 20 28 72 75 6e 2d 64 69 72 20  ....   (run-dir 
7530: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72    (db:test-get-r
7540: 75 6e 64 69 72 20 74 65 73 74 29 29 29 0a 09 09  undir test)))...
7550: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
7560: 6e 74 20 31 20 22 20 20 22 20 28 64 62 3a 74 65  nt 1 "  " (db:te
7570: 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20  st-get-testname 
7580: 74 65 73 74 29 20 22 20 69 64 3a 20 22 20 28 64  test) " id: " (d
7590: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65  b:test-get-id te
75a0: 73 74 29 20 22 20 22 20 69 74 65 6d 2d 70 61 74  st) " " item-pat
75b0: 68 20 22 20 61 63 74 69 6f 6e 3a 20 22 20 61 63  h " action: " ac
75c0: 74 69 6f 6e 29 0a 09 09 20 20 20 20 20 20 28 63  tion)...      (c
75d0: 61 73 65 20 61 63 74 69 6f 6e 0a 09 09 09 28 28  ase action....((
75e0: 72 65 6d 6f 76 65 2d 72 75 6e 73 29 0a 09 09 09  remove-runs)....
75f0: 20 28 72 64 62 3a 64 65 6c 65 74 65 2d 74 65 73   (rdb:delete-tes
7600: 74 2d 72 65 63 6f 72 64 73 20 64 62 20 28 64 62  t-records db (db
7610: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73  :test-get-id tes
7620: 74 29 29 0a 09 09 09 20 28 64 65 62 75 67 3a 70  t)).... (debug:p
7630: 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 41 74  rint 1 "INFO: At
7640: 74 65 6d 70 74 69 6e 67 20 74 6f 20 72 65 6d 6f  tempting to remo
7650: 76 65 20 64 69 72 20 22 20 72 75 6e 2d 64 69 72  ve dir " run-dir
7660: 29 0a 09 09 09 20 28 69 66 20 28 61 6e 64 20 28  ).... (if (and (
7670: 3e 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68  > (string-length
7680: 20 72 75 6e 2d 64 69 72 29 20 35 29 0a 09 09 09   run-dir) 5)....
7690: 09 20 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f  .  (file-exists?
76a0: 20 72 75 6e 2d 64 69 72 29 29 20 3b 3b 20 62 61   run-dir)) ;; ba
76b0: 64 20 68 65 75 72 69 73 74 69 63 20 62 75 74 20  d heuristic but 
76c0: 73 68 6f 75 6c 64 20 70 72 65 76 65 6e 74 20 2f  should prevent /
76d0: 74 6d 70 20 2f 68 6f 6d 65 20 65 74 63 2e 0a 09  tmp /home etc...
76e0: 09 09 20 20 20 20 20 28 6c 65 74 2a 20 28 28 72  ..     (let* ((r
76f0: 65 61 6c 70 61 74 68 20 28 72 65 73 6f 6c 76 65  ealpath (resolve
7700: 2d 70 61 74 68 6e 61 6d 65 20 72 75 6e 2d 64 69  -pathname run-di
7710: 72 29 29 29 0a 09 09 09 20 20 20 20 20 20 20 28  r)))....       (
7720: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49  debug:print 1 "I
7730: 4e 46 4f 3a 20 52 65 61 6c 20 70 61 74 68 20 6f  NFO: Real path o
7740: 66 20 69 73 20 22 20 72 65 61 6c 70 61 74 68 29  f is " realpath)
7750: 0a 09 09 09 20 20 20 20 20 20 20 28 69 66 20 28  ....       (if (
7760: 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 65 61  file-exists? rea
7770: 6c 70 61 74 68 29 0a 09 09 09 09 20 20 20 28 69  lpath).....   (i
7780: 66 20 28 3e 20 28 73 79 73 74 65 6d 20 28 63 6f  f (> (system (co
7790: 6e 63 20 22 72 6d 20 2d 72 66 20 22 20 72 65 61  nc "rm -rf " rea
77a0: 6c 70 61 74 68 29 29 20 30 29 0a 09 09 09 09 20  lpath)) 0)..... 
77b0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
77c0: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 54 68 65  nt 0 "ERROR: The
77d0: 72 65 20 77 61 73 20 61 20 70 72 6f 62 6c 65 6d  re was a problem
77e0: 20 72 65 6d 6f 76 69 6e 67 20 22 20 72 65 61 6c   removing " real
77f0: 70 61 74 68 20 22 20 77 69 74 68 20 72 6d 20 2d  path " with rm -
7800: 66 22 29 29 0a 09 09 09 09 20 20 20 28 64 65 62  f")).....   (deb
7810: 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e  ug:print 0 "WARN
7820: 49 4e 47 3a 20 74 65 73 74 20 72 75 6e 20 64 69  ING: test run di
7830: 72 20 22 20 72 65 61 6c 70 61 74 68 20 22 20 61  r " realpath " a
7840: 70 70 65 61 72 73 20 74 6f 20 6e 6f 74 20 65 78  ppears to not ex
7850: 69 73 74 22 29 29 0a 09 09 09 20 20 20 20 20 20  ist"))....      
7860: 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74   (if (file-exist
7870: 73 3f 20 72 75 6e 2d 64 69 72 29 20 3b 3b 20 74  s? run-dir) ;; t
7880: 68 65 20 6c 69 6e 6b 0a 09 09 09 09 20 20 20 28  he link.....   (
7890: 69 66 20 28 73 79 6d 62 6f 6c 69 63 2d 6c 69 6e  if (symbolic-lin
78a0: 6b 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 09  k? run-dir).....
78b0: 20 20 20 20 20 20 20 28 64 65 6c 65 74 65 2d 66         (delete-f
78c0: 69 6c 65 20 72 75 6e 2d 64 69 72 29 0a 09 09 09  ile run-dir)....
78d0: 09 20 20 20 20 20 20 20 28 69 66 20 28 64 69 72  .       (if (dir
78e0: 65 63 74 6f 72 79 3f 20 72 75 6e 2d 64 69 72 29  ectory? run-dir)
78f0: 0a 09 09 09 09 09 20 20 20 28 69 66 20 28 3e 20  ......   (if (> 
7900: 28 64 69 72 65 63 74 6f 72 79 2d 66 6f 6c 64 20  (directory-fold 
7910: 28 6c 61 6d 62 64 61 20 28 66 20 78 29 28 2b 20  (lambda (f x)(+ 
7920: 31 20 78 29 29 20 30 20 72 75 6e 2d 64 69 72 29  1 x)) 0 run-dir)
7930: 20 30 29 0a 09 09 09 09 09 20 20 20 20 20 20 20   0)......       
7940: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
7950: 57 41 52 4e 49 4e 47 3a 20 72 65 66 75 73 69 6e  WARNING: refusin
7960: 67 20 74 6f 20 72 65 6d 6f 76 65 20 22 20 72 75  g to remove " ru
7970: 6e 2d 64 69 72 20 22 20 61 73 20 69 74 20 69 73  n-dir " as it is
7980: 20 6e 6f 74 20 65 6d 70 74 79 22 29 0a 09 09 09   not empty")....
7990: 09 09 20 20 20 20 20 20 20 28 64 65 6c 65 74 65  ..       (delete
79a0: 2d 64 69 72 65 63 74 6f 72 79 20 72 75 6e 2d 64  -directory run-d
79b0: 69 72 29 29 20 3b 3b 20 69 74 20 73 68 6f 75 6c  ir)) ;; it shoul
79c0: 64 20 62 65 20 65 6d 70 74 79 20 62 79 20 68 65  d be empty by he
79d0: 72 65 20 42 55 47 20 42 55 47 2c 20 61 64 64 20  re BUG BUG, add 
79e0: 65 72 72 6f 72 20 63 61 74 63 68 0a 09 09 09 09  error catch.....
79f0: 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74  .   (debug:print
7a00: 20 30 20 22 45 52 52 4f 52 3a 20 72 65 66 75 73   0 "ERROR: refus
7a10: 69 6e 67 20 74 6f 20 72 65 6d 6f 76 65 20 22 20  ing to remove " 
7a20: 72 75 6e 2d 64 69 72 20 22 20 61 73 20 69 74 20  run-dir " as it 
7a30: 69 73 20 6e 65 69 74 68 65 72 20 61 20 73 79 6d  is neither a sym
7a40: 6c 69 6e 6b 20 6e 6f 72 20 61 20 64 69 72 65 63  link nor a direc
7a50: 74 6f 72 79 22 29 0a 09 09 09 09 09 20 20 20 29  tory")......   )
7a60: 29 29 29 0a 09 09 09 20 20 20 20 20 28 64 65 62  )))....     (deb
7a70: 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e  ug:print 0 "WARN
7a80: 49 4e 47 3a 20 64 69 72 65 63 74 6f 72 79 20 61  ING: directory a
7a90: 6c 72 65 61 64 79 20 72 65 6d 6f 76 65 64 20 22  lready removed "
7aa0: 20 72 75 6e 2d 64 69 72 29 29 29 0a 09 09 09 28   run-dir)))....(
7ab0: 28 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75  (set-state-statu
7ac0: 73 29 0a 09 09 09 20 28 64 65 62 75 67 3a 70 72  s).... (debug:pr
7ad0: 69 6e 74 20 32 20 22 49 4e 46 4f 3a 20 6e 65 77  int 2 "INFO: new
7ae0: 20 73 74 61 74 65 20 22 20 28 63 61 72 20 73 74   state " (car st
7af0: 61 74 65 2d 73 74 61 74 75 73 29 20 22 2c 20 6e  ate-status) ", n
7b00: 65 77 20 73 74 61 74 75 73 20 22 20 28 63 61 64  ew status " (cad
7b10: 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 29  r state-status))
7b20: 0a 09 09 09 20 28 64 62 3a 74 65 73 74 2d 73 65  .... (db:test-se
7b30: 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73 2d 62  t-state-status-b
7b40: 79 2d 69 64 20 64 62 20 28 64 62 3a 74 65 73 74  y-id db (db:test
7b50: 2d 67 65 74 2d 69 64 20 74 65 73 74 29 20 28 63  -get-id test) (c
7b60: 61 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 29  ar state-status)
7b70: 28 63 61 64 72 20 73 74 61 74 65 2d 73 74 61 74  (cadr state-stat
7b80: 75 73 29 20 23 66 29 29 29 29 29 0a 09 09 20 20  us) #f)))))...  
7b90: 74 65 73 74 73 29 29 29 0a 09 20 20 20 0a 09 20  tests)))..   .. 
7ba0: 20 20 3b 3b 20 72 65 6d 6f 76 65 20 74 68 65 20    ;; remove the 
7bb0: 72 75 6e 20 69 66 20 7a 65 72 6f 20 74 65 73 74  run if zero test
7bc0: 73 20 72 65 6d 61 69 6e 0a 09 20 20 20 28 69 66  s remain..   (if
7bd0: 20 28 65 71 3f 20 61 63 74 69 6f 6e 20 27 72 65   (eq? action 're
7be0: 6d 6f 76 65 2d 72 75 6e 73 29 0a 09 20 20 20 20  move-runs)..    
7bf0: 20 20 20 28 6c 65 74 20 28 28 72 65 6d 74 65 73     (let ((remtes
7c00: 74 73 20 28 72 64 62 3a 67 65 74 2d 74 65 73 74  ts (rdb:get-test
7c10: 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 62  s-for-run db (db
7c20: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65  :get-value-by-he
7c30: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20  ader run header 
7c40: 22 69 64 22 29 20 23 66 20 23 66 20 27 28 29 20  "id") #f #f '() 
7c50: 27 28 29 29 29 29 0a 09 09 20 28 69 66 20 28 6e  '())))... (if (n
7c60: 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29 20 3b  ull? remtests) ;
7c70: 3b 20 6e 6f 20 6d 6f 72 65 20 74 65 73 74 73 20  ; no more tests 
7c80: 72 65 6d 61 69 6e 69 6e 67 0a 09 09 20 20 20 20  remaining...    
7c90: 20 28 6c 65 74 2a 20 28 28 64 70 61 72 74 73 20   (let* ((dparts 
7ca0: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 6c   (string-split l
7cb0: 61 73 74 74 70 61 74 68 20 22 2f 22 29 29 0a 09  asttpath "/"))..
7cc0: 09 09 20 20 20 20 28 72 75 6e 70 61 74 68 20 28  ..    (runpath (
7cd0: 63 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 6e 67  conc "/" (string
7ce0: 2d 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09 09  -intersperse ...
7cf0: 09 09 09 09 28 74 61 6b 65 20 64 70 61 72 74 73  ....(take dparts
7d00: 20 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72   (- (length dpar
7d10: 74 73 29 20 31 29 29 0a 09 09 09 09 09 09 22 2f  ts) 1))......."/
7d20: 22 29 29 29 29 0a 09 09 20 20 20 20 20 20 20 28  "))))...       (
7d30: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52  debug:print 1 "R
7d40: 65 6d 6f 76 69 6e 67 20 72 75 6e 3a 20 22 20 72  emoving run: " r
7d50: 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65  unkey " " (db:ge
7d60: 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65  t-value-by-heade
7d70: 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 72 75  r run header "ru
7d80: 6e 6e 61 6d 65 22 29 29 0a 09 09 20 20 20 20 20  nname"))...     
7d90: 20 20 28 64 62 3a 64 65 6c 65 74 65 2d 72 75 6e    (db:delete-run
7da0: 20 64 62 20 72 75 6e 2d 69 64 29 0a 09 09 20 20   db run-id)...  
7db0: 20 20 20 20 20 3b 3b 20 6e 65 65 64 20 74 6f 20       ;; need to 
7dc0: 66 69 67 75 72 65 20 6f 75 74 20 74 68 65 20 70  figure out the p
7dd0: 61 74 68 20 74 6f 20 74 68 65 20 72 75 6e 20 64  ath to the run d
7de0: 69 72 20 61 6e 64 20 72 65 6d 6f 76 65 20 69 74  ir and remove it
7df0: 20 69 66 20 65 6d 70 74 79 0a 09 09 20 20 20 20   if empty...    
7e00: 20 20 20 3b 3b 20 20 20 20 28 69 66 20 28 6e 75     ;;    (if (nu
7e10: 6c 6c 3f 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20  ll? (glob (conc 
7e20: 72 75 6e 70 61 74 68 20 22 2f 2a 22 29 29 29 0a  runpath "/*"))).
7e30: 09 09 20 20 20 20 20 20 20 3b 3b 20 20 20 20 20  ..       ;;     
7e40: 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20     (begin...    
7e50: 20 20 20 3b 3b 20 09 20 28 64 65 62 75 67 3a 70     ;; . (debug:p
7e60: 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67  rint 1 "Removing
7e70: 20 72 75 6e 20 64 69 72 20 22 20 72 75 6e 70 61   run dir " runpa
7e80: 74 68 29 0a 09 09 20 20 20 20 20 20 20 3b 3b 20  th)...       ;; 
7e90: 09 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20  . (system (conc 
7ea0: 22 72 6d 64 69 72 20 2d 70 20 22 20 72 75 6e 70  "rmdir -p " runp
7eb0: 61 74 68 29 29 29 29 0a 09 09 20 20 20 20 20 20  ath))))...      
7ec0: 20 29 29 29 29 29 0a 09 20 29 29 0a 20 20 20 20   ))))).. )).    
7ed0: 20 72 75 6e 73 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d   runs)))..;;====
7ee0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7ef0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7f00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7f10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7f20: 3d 3d 0a 3b 3b 20 52 6f 75 74 69 6e 65 73 20 66  ==.;; Routines f
7f30: 6f 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20  or manipulating 
7f40: 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d  runs.;;=========
7f50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7f60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7f70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7f80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b  =============..;
7f90: 3b 20 53 69 6e 63 65 20 6d 61 6e 79 20 63 61 6c  ; Since many cal
7fa0: 6c 73 20 74 6f 20 61 20 72 75 6e 20 72 65 71 75  ls to a run requ
7fb0: 69 72 65 20 70 72 65 74 74 79 20 6d 75 63 68 20  ire pretty much 
7fc0: 74 68 65 20 73 61 6d 65 20 73 65 74 75 70 20 0a  the same setup .
7fd0: 3b 3b 20 74 68 69 73 20 77 72 61 70 70 65 72 20  ;; this wrapper 
7fe0: 69 73 20 75 73 65 64 20 74 6f 20 72 65 64 75 63  is used to reduc
7ff0: 65 20 74 68 65 20 72 65 70 6c 69 63 61 74 69 6f  e the replicatio
8000: 6e 20 6f 66 20 63 6f 64 65 0a 28 64 65 66 69 6e  n of code.(defin
8010: 65 20 28 67 65 6e 65 72 61 6c 2d 72 75 6e 2d 63  e (general-run-c
8020: 61 6c 6c 20 73 77 69 74 63 68 6e 61 6d 65 20 61  all switchname a
8030: 63 74 69 6f 6e 2d 64 65 73 63 20 70 72 6f 63 29  ction-desc proc)
8040: 0a 20 20 28 6c 65 74 20 28 28 72 75 6e 6e 61 6d  .  (let ((runnam
8050: 65 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20  e (args:get-arg 
8060: 22 3a 72 75 6e 6e 61 6d 65 22 29 29 0a 09 28 74  ":runname"))..(t
8070: 61 72 67 65 74 20 20 28 69 66 20 28 61 72 67 73  arget  (if (args
8080: 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65  :get-arg "-targe
8090: 74 22 29 0a 09 09 20 20 20 20 20 28 61 72 67 73  t")...     (args
80a0: 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65  :get-arg "-targe
80b0: 74 22 29 0a 09 09 20 20 20 20 20 28 61 72 67 73  t")...     (args
80c0: 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61  :get-arg "-reqta
80d0: 72 67 22 29 29 29 0a 09 28 74 68 31 20 20 20 20  rg")))..(th1    
80e0: 20 23 66 29 29 0a 20 20 20 20 28 63 6f 6e 64 0a   #f)).    (cond.
80f0: 20 20 20 20 20 28 28 6e 6f 74 20 74 61 72 67 65       ((not targe
8100: 74 29 0a 20 20 20 20 20 20 28 64 65 62 75 67 3a  t).      (debug:
8110: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
8120: 4d 69 73 73 69 6e 67 20 72 65 71 75 69 72 65 64  Missing required
8130: 20 70 61 72 61 6d 65 74 65 72 20 66 6f 72 20 22   parameter for "
8140: 20 73 77 69 74 63 68 6e 61 6d 65 20 22 2c 20 79   switchname ", y
8150: 6f 75 20 6d 75 73 74 20 73 70 65 63 69 66 79 20  ou must specify 
8160: 74 68 65 20 74 61 72 67 65 74 20 77 69 74 68 20  the target with 
8170: 2d 74 61 72 67 65 74 22 29 0a 20 20 20 20 20 20  -target").      
8180: 28 65 78 69 74 20 33 29 29 0a 20 20 20 20 20 28  (exit 3)).     (
8190: 28 6e 6f 74 20 72 75 6e 6e 61 6d 65 29 0a 20 20  (not runname).  
81a0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
81b0: 20 30 20 22 45 52 52 4f 52 3a 20 4d 69 73 73 69   0 "ERROR: Missi
81c0: 6e 67 20 72 65 71 75 69 72 65 64 20 70 61 72 61  ng required para
81d0: 6d 65 74 65 72 20 66 6f 72 20 22 20 73 77 69 74  meter for " swit
81e0: 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d 75  chname ", you mu
81f0: 73 74 20 73 70 65 63 69 66 79 20 74 68 65 20 72  st specify the r
8200: 75 6e 20 6e 61 6d 65 20 77 69 74 68 20 3a 72 75  un name with :ru
8210: 6e 6e 61 6d 65 20 72 75 6e 6e 61 6d 65 22 29 0a  nname runname").
8220: 20 20 20 20 20 20 28 65 78 69 74 20 33 29 29 0a        (exit 3)).
8230: 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20 20       (else.     
8240: 20 28 6c 65 74 20 28 28 64 62 20 20 20 23 66 29   (let ((db   #f)
8250: 0a 09 20 20 20 20 28 6b 65 79 73 20 23 66 29 29  ..    (keys #f))
8260: 0a 09 28 69 66 20 28 6e 6f 74 20 28 73 65 74 75  ..(if (not (setu
8270: 70 2d 66 6f 72 2d 72 75 6e 29 29 0a 09 20 20 20  p-for-run))..   
8280: 20 28 62 65 67 69 6e 20 0a 09 20 20 20 20 20 20   (begin ..      
8290: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
82a0: 46 61 69 6c 65 64 20 74 6f 20 73 65 74 75 70 2c  Failed to setup,
82b0: 20 65 78 69 74 69 6e 67 22 29 0a 09 20 20 20 20   exiting")..    
82c0: 20 20 28 65 78 69 74 20 31 29 29 29 0a 09 28 73    (exit 1)))..(s
82d0: 65 74 21 20 64 62 20 20 20 28 6f 70 65 6e 2d 64  et! db   (open-d
82e0: 62 29 29 0a 09 28 69 66 20 28 61 72 67 73 3a 67  b))..(if (args:g
82f0: 65 74 2d 61 72 67 20 22 2d 73 65 72 76 65 72 22  et-arg "-server"
8300: 29 0a 09 20 20 20 20 28 73 65 72 76 65 72 3a 73  )..    (server:s
8310: 74 61 72 74 20 64 62 20 28 61 72 67 73 3a 67 65  tart db (args:ge
8320: 74 2d 61 72 67 20 22 2d 73 65 72 76 65 72 22 29  t-arg "-server")
8330: 29 0a 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20  )..    (if (not 
8340: 28 6f 72 20 28 61 72 67 73 3a 67 65 74 2d 61 72  (or (args:get-ar
8350: 67 20 22 2d 72 75 6e 61 6c 6c 22 29 0a 09 09 09  g "-runall")....
8360: 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20    (args:get-arg 
8370: 22 2d 72 75 6e 74 65 73 74 73 22 29 29 29 0a 09  "-runtests")))..
8380: 09 28 73 65 72 76 65 72 3a 63 6c 69 65 6e 74 2d  .(server:client-
8390: 73 65 74 75 70 20 64 62 29 29 29 0a 09 28 73 65  setup db)))..(se
83a0: 74 21 20 6b 65 79 73 20 28 72 64 62 3a 67 65 74  t! keys (rdb:get
83b0: 2d 6b 65 79 73 20 64 62 29 29 0a 09 3b 3b 20 68  -keys db))..;; h
83c0: 61 76 65 20 65 6e 6f 75 67 68 20 74 6f 20 70 72  ave enough to pr
83d0: 6f 63 65 73 73 20 2d 74 61 72 67 65 74 20 6f 72  ocess -target or
83e0: 20 2d 72 65 71 74 61 72 67 20 68 65 72 65 0a 09   -reqtarg here..
83f0: 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72  (if (args:get-ar
8400: 67 20 22 2d 72 65 71 74 61 72 67 22 29 0a 09 20  g "-reqtarg").. 
8410: 20 20 20 28 6c 65 74 2a 20 28 28 72 75 6e 63 6f     (let* ((runco
8420: 6e 66 69 67 66 20 28 63 6f 6e 63 20 20 2a 74 6f  nfigf (conc  *to
8430: 70 70 61 74 68 2a 20 22 2f 72 75 6e 63 6f 6e 66  ppath* "/runconf
8440: 69 67 73 2e 63 6f 6e 66 69 67 22 29 29 20 3b 3b  igs.config")) ;;
8450: 20 44 4f 20 4e 4f 54 20 45 56 41 4c 55 41 54 45   DO NOT EVALUATE
8460: 20 41 4c 4c 20 0a 09 09 20 20 20 28 72 75 6e 63   ALL ...   (runc
8470: 6f 6e 66 69 67 20 20 28 72 65 61 64 2d 63 6f 6e  onfig  (read-con
8480: 66 69 67 20 72 75 6e 63 6f 6e 66 69 67 66 20 23  fig runconfigf #
8490: 66 20 23 66 20 65 6e 76 69 72 6f 6e 2d 70 61 74  f #f environ-pat
84a0: 74 3a 20 23 66 29 29 29 20 0a 09 20 20 20 20 20  t: #f))) ..     
84b0: 20 28 69 66 20 28 68 61 73 68 2d 74 61 62 6c 65   (if (hash-table
84c0: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 72 75 6e  -ref/default run
84d0: 63 6f 6e 66 69 67 20 28 61 72 67 73 3a 67 65 74  config (args:get
84e0: 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29  -arg "-reqtarg")
84f0: 20 23 66 29 0a 09 09 20 20 28 6b 65 79 73 3a 74   #f)...  (keys:t
8500: 61 72 67 65 74 2d 73 65 74 2d 61 72 67 73 20 6b  arget-set-args k
8510: 65 79 73 20 28 61 72 67 73 3a 67 65 74 2d 61 72  eys (args:get-ar
8520: 67 20 22 2d 72 65 71 74 61 72 67 22 29 20 61 72  g "-reqtarg") ar
8530: 67 73 3a 61 72 67 2d 68 61 73 68 29 0a 09 09 20  gs:arg-hash)... 
8540: 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 28 64   (begin...    (d
8550: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
8560: 52 4f 52 3a 20 5b 22 20 28 61 72 67 73 3a 67 65  ROR: [" (args:ge
8570: 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22  t-arg "-reqtarg"
8580: 29 20 22 5d 20 6e 6f 74 20 66 6f 75 6e 64 20 69  ) "] not found i
8590: 6e 20 22 20 72 75 6e 63 6f 6e 66 69 67 66 29 0a  n " runconfigf).
85a0: 09 09 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66  ..    (sqlite3:f
85b0: 69 6e 61 6c 69 7a 65 21 20 64 62 29 0a 09 09 20  inalize! db)... 
85c0: 20 20 20 28 65 78 69 74 20 31 29 29 29 29 0a 09     (exit 1))))..
85d0: 20 20 20 20 28 69 66 20 28 61 72 67 73 3a 67 65      (if (args:ge
85e0: 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 29  t-arg "-target")
85f0: 0a 09 09 28 6b 65 79 73 3a 74 61 72 67 65 74 2d  ...(keys:target-
8600: 73 65 74 2d 61 72 67 73 20 6b 65 79 73 20 28 61  set-args keys (a
8610: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61  rgs:get-arg "-ta
8620: 72 67 65 74 22 20 61 72 67 73 3a 61 72 67 2d 68  rget" args:arg-h
8630: 61 73 68 29 20 61 72 67 73 3a 61 72 67 2d 68 61  ash) args:arg-ha
8640: 73 68 29 29 29 0a 09 28 69 66 20 28 6e 6f 74 20  sh)))..(if (not 
8650: 28 63 61 72 20 2a 63 6f 6e 66 69 67 69 6e 66 6f  (car *configinfo
8660: 2a 29 29 0a 09 20 20 20 20 28 62 65 67 69 6e 0a  *))..    (begin.
8670: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72  .      (debug:pr
8680: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 41 74  int 0 "ERROR: At
8690: 74 65 6d 70 74 65 64 20 74 6f 20 22 20 61 63 74  tempted to " act
86a0: 69 6f 6e 2d 64 65 73 63 20 22 20 62 75 74 20 72  ion-desc " but r
86b0: 75 6e 20 61 72 65 61 20 63 6f 6e 66 69 67 20 66  un area config f
86c0: 69 6c 65 20 6e 6f 74 20 66 6f 75 6e 64 22 29 0a  ile not found").
86d0: 09 20 20 20 20 20 20 28 65 78 69 74 20 31 29 29  .      (exit 1))
86e0: 0a 09 20 20 20 20 3b 3b 20 45 78 74 72 61 63 74  ..    ;; Extract
86f0: 20 6f 75 74 20 73 74 75 66 66 20 6e 65 65 64 65   out stuff neede
8700: 64 20 69 6e 20 6d 6f 73 74 20 6f 72 20 6d 61 6e  d in most or man
8710: 79 20 63 61 6c 6c 73 0a 09 20 20 20 20 3b 3b 20  y calls..    ;; 
8720: 68 65 72 65 20 74 68 65 6e 20 63 61 6c 6c 20 70  here then call p
8730: 72 6f 63 0a 09 20 20 20 20 28 6c 65 74 2a 20 28  roc..    (let* (
8740: 28 6b 65 79 6e 61 6d 65 73 20 20 20 28 6d 61 70  (keynames   (map
8750: 20 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61   key:get-fieldna
8760: 6d 65 20 6b 65 79 73 29 29 0a 09 09 20 20 20 28  me keys))...   (
8770: 6b 65 79 76 61 6c 6c 73 74 20 20 28 6b 65 79 73  keyvallst  (keys
8780: 2d 3e 76 61 6c 6c 69 73 74 20 6b 65 79 73 20 23  ->vallist keys #
8790: 74 29 29 29 0a 09 20 20 20 20 20 20 28 70 72 6f  t)))..      (pro
87a0: 63 20 64 62 20 74 61 72 67 65 74 20 72 75 6e 6e  c db target runn
87b0: 61 6d 65 20 6b 65 79 73 20 6b 65 79 6e 61 6d 65  ame keys keyname
87c0: 73 20 6b 65 79 76 61 6c 6c 73 74 29 29 29 0a 09  s keyvallst)))..
87d0: 28 69 66 20 74 68 31 20 28 74 68 72 65 61 64 2d  (if th1 (thread-
87e0: 6a 6f 69 6e 21 20 74 68 31 29 29 0a 09 28 73 71  join! th1))..(sq
87f0: 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20  lite3:finalize! 
8800: 64 62 29 0a 09 28 73 65 74 21 20 2a 64 69 64 73  db)..(set! *dids
8810: 6f 6d 65 74 68 69 6e 67 2a 20 23 74 29 29 29 29  omething* #t))))
8820: 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ))..;;==========
8830: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8840: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8850: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8860: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20  ============.;; 
8870: 4c 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 72 75 6e 73  Lock/unlock runs
8880: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  .;;=============
8890: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
88a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
88b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
88c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69  =========..(defi
88d0: 6e 65 20 28 72 75 6e 73 3a 68 61 6e 64 6c 65 2d  ne (runs:handle-
88e0: 6c 6f 63 6b 69 6e 67 20 64 62 20 74 61 72 67 65  locking db targe
88f0: 74 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65 20 6c  t keys runname l
8900: 6f 63 6b 20 75 6e 6c 6f 63 6b 20 75 73 65 72 29  ock unlock user)
8910: 0a 20 20 28 6c 65 74 2a 20 28 28 72 75 6e 64 61  .  (let* ((runda
8920: 74 20 20 20 28 72 75 6e 73 3a 67 65 74 2d 72 75  t   (runs:get-ru
8930: 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20 6b 65  ns-by-patt db ke
8940: 79 73 20 72 75 6e 6e 61 6d 65 29 29 0a 09 20 28  ys runname)).. (
8950: 68 65 61 64 65 72 20 20 20 28 76 65 63 74 6f 72  header   (vector
8960: 2d 72 65 66 20 72 75 6e 64 61 74 20 30 29 29 0a  -ref rundat 0)).
8970: 09 20 28 72 75 6e 73 20 20 20 20 20 28 76 65 63  . (runs     (vec
8980: 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 31  tor-ref rundat 1
8990: 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63  ))).    (for-eac
89a0: 68 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a  h (lambda (run).
89b0: 09 09 28 6c 65 74 20 28 28 72 75 6e 2d 69 64 20  ..(let ((run-id 
89c0: 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79  (db:get-value-by
89d0: 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64  -header run head
89e0: 65 72 20 22 69 64 22 29 29 29 0a 09 09 20 20 28  er "id")))...  (
89f0: 69 66 20 28 6f 72 20 6c 6f 63 6b 0a 09 09 09 20  if (or lock.... 
8a00: 20 28 61 6e 64 20 75 6e 6c 6f 63 6b 0a 09 09 09   (and unlock....
8a10: 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09         (begin...
8a20: 09 09 20 28 70 72 69 6e 74 20 22 44 6f 20 79 6f  .. (print "Do yo
8a30: 75 20 72 65 61 6c 6c 79 20 77 69 73 68 20 74 6f  u really wish to
8a40: 20 75 6e 6c 6f 63 6b 20 72 75 6e 20 22 20 72 75   unlock run " ru
8a50: 6e 2d 69 64 20 22 3f 5c 6e 20 20 20 79 2f 6e 3a  n-id "?\n   y/n:
8a60: 20 22 29 0a 09 09 09 09 20 28 65 71 75 61 6c 3f   ")..... (equal?
8a70: 20 22 79 22 20 28 72 65 61 64 2d 6c 69 6e 65 29   "y" (read-line)
8a80: 29 29 29 29 0a 09 09 20 20 20 20 20 20 28 64 62  ))))...      (db
8a90: 3a 6c 6f 63 6b 2f 75 6e 6c 6f 63 6b 2d 72 75 6e  :lock/unlock-run
8aa0: 20 64 62 20 72 75 6e 2d 69 64 20 6c 6f 63 6b 20   db run-id lock 
8ab0: 75 6e 6c 6f 63 6b 20 75 73 65 72 29 0a 09 09 20  unlock user)... 
8ac0: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
8ad0: 74 20 30 20 22 49 4e 46 4f 3a 20 53 6b 69 70 70  t 0 "INFO: Skipp
8ae0: 69 6e 67 20 6c 6f 63 6b 2f 75 6e 6c 6f 63 6b 20  ing lock/unlock 
8af0: 6f 6e 20 22 20 72 75 6e 2d 69 64 29 29 29 29 0a  on " run-id)))).
8b00: 09 20 20 20 20 20 20 72 75 6e 73 29 29 29 0a 3b  .      runs))).;
8b10: 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;===============
8b20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8b30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8b40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8b50: 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 6c 6c 75  =======.;; Rollu
8b60: 70 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d  p runs.;;=======
8b70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8b80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8b90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
8ba0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a  ===============.
8bb0: 0a 3b 3b 20 55 70 64 61 74 65 20 74 68 65 20 74  .;; Update the t
8bc0: 65 73 74 5f 6d 65 74 61 20 74 61 62 6c 65 20 66  est_meta table f
8bd0: 6f 72 20 74 68 69 73 20 74 65 73 74 0a 28 64 65  or this test.(de
8be0: 66 69 6e 65 20 28 72 75 6e 73 3a 75 70 64 61 74  fine (runs:updat
8bf0: 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20 74  e-test_meta db t
8c00: 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f  est-name test-co
8c10: 6e 66 29 0a 20 20 28 6c 65 74 20 28 28 63 75 72  nf).  (let ((cur
8c20: 72 72 65 63 6f 72 64 20 28 64 62 3a 74 65 73 74  rrecord (db:test
8c30: 6d 65 74 61 2d 67 65 74 2d 72 65 63 6f 72 64 20  meta-get-record 
8c40: 64 62 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a  db test-name))).
8c50: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 63 75 72      (if (not cur
8c60: 72 72 65 63 6f 72 64 29 0a 09 28 62 65 67 69 6e  rrecord)..(begin
8c70: 0a 09 20 20 28 73 65 74 21 20 63 75 72 72 72 65  ..  (set! currre
8c80: 63 6f 72 64 20 28 6d 61 6b 65 2d 76 65 63 74 6f  cord (make-vecto
8c90: 72 20 31 30 20 23 66 29 29 0a 09 20 20 28 64 62  r 10 #f))..  (db
8ca0: 3a 74 65 73 74 6d 65 74 61 2d 61 64 64 2d 72 65  :testmeta-add-re
8cb0: 63 6f 72 64 20 64 62 20 74 65 73 74 2d 6e 61 6d  cord db test-nam
8cc0: 65 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61  e))).    (for-ea
8cd0: 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61  ch .     (lambda
8ce0: 20 28 6b 65 79 29 0a 20 20 20 20 20 20 20 28 6c   (key).       (l
8cf0: 65 74 2a 20 28 28 69 64 78 20 28 63 61 64 72 20  et* ((idx (cadr 
8d00: 6b 65 79 29 29 0a 09 20 20 20 20 20 20 28 66 6c  key))..      (fl
8d10: 64 20 28 63 61 72 20 20 6b 65 79 29 29 0a 09 20  d (car  key)).. 
8d20: 20 20 20 20 20 28 76 61 6c 20 28 63 6f 6e 66 69       (val (confi
8d30: 67 2d 6c 6f 6f 6b 75 70 20 74 65 73 74 2d 63 6f  g-lookup test-co
8d40: 6e 66 20 22 74 65 73 74 5f 6d 65 74 61 22 20 66  nf "test_meta" f
8d50: 6c 64 29 29 29 0a 09 20 3b 3b 20 28 64 65 62 75  ld))).. ;; (debu
8d60: 67 3a 70 72 69 6e 74 20 35 20 22 69 64 78 3a 20  g:print 5 "idx: 
8d70: 22 20 69 64 78 20 22 20 66 6c 64 3a 20 22 20 66  " idx " fld: " f
8d80: 6c 64 20 22 20 76 61 6c 3a 20 22 20 76 61 6c 29  ld " val: " val)
8d90: 0a 09 20 28 69 66 20 28 61 6e 64 20 76 61 6c 20  .. (if (and val 
8da0: 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 28 76 65  (not (equal? (ve
8db0: 63 74 6f 72 2d 72 65 66 20 63 75 72 72 72 65 63  ctor-ref currrec
8dc0: 6f 72 64 20 69 64 78 29 20 76 61 6c 29 29 29 0a  ord idx) val))).
8dd0: 09 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20  .     (begin..  
8de0: 20 20 20 20 20 28 70 72 69 6e 74 20 22 55 70 64       (print "Upd
8df0: 61 74 69 6e 67 20 22 20 74 65 73 74 2d 6e 61 6d  ating " test-nam
8e00: 65 20 22 20 22 20 66 6c 64 20 22 20 74 6f 20 22  e " " fld " to "
8e10: 20 76 61 6c 29 0a 09 20 20 20 20 20 20 20 28 64   val)..       (d
8e20: 62 3a 74 65 73 74 6d 65 74 61 2d 75 70 64 61 74  b:testmeta-updat
8e30: 65 2d 66 69 65 6c 64 20 64 62 20 74 65 73 74 2d  e-field db test-
8e40: 6e 61 6d 65 20 66 6c 64 20 76 61 6c 29 29 29 29  name fld val))))
8e50: 29 0a 20 20 20 20 20 27 28 28 22 61 75 74 68 6f  ).     '(("autho
8e60: 72 22 20 32 29 28 22 6f 77 6e 65 72 22 20 33 29  r" 2)("owner" 3)
8e70: 28 22 64 65 73 63 72 69 70 74 69 6f 6e 22 20 34  ("description" 4
8e80: 29 28 22 72 65 76 69 65 77 65 64 22 20 35 29 28  )("reviewed" 5)(
8e90: 22 74 61 67 73 22 20 39 29 29 29 29 29 0a 0a 3b  "tags" 9)))))..;
8ea0: 3b 20 55 70 64 61 74 65 20 74 65 73 74 5f 6d 65  ; Update test_me
8eb0: 74 61 20 66 6f 72 20 61 6c 6c 20 74 65 73 74 73  ta for all tests
8ec0: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 75  .(define (runs:u
8ed0: 70 64 61 74 65 2d 61 6c 6c 2d 74 65 73 74 5f 6d  pdate-all-test_m
8ee0: 65 74 61 20 64 62 29 0a 20 20 28 6c 65 74 20 28  eta db).  (let (
8ef0: 28 74 65 73 74 2d 6e 61 6d 65 73 20 28 67 65 74  (test-names (get
8f00: 2d 61 6c 6c 2d 6c 65 67 61 6c 2d 74 65 73 74 73  -all-legal-tests
8f10: 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63  ))).    (for-eac
8f20: 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20  h .     (lambda 
8f30: 28 74 65 73 74 2d 6e 61 6d 65 29 0a 20 20 20 20  (test-name).    
8f40: 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d     (let* ((test-
8f50: 70 61 74 68 20 20 20 20 28 63 6f 6e 63 20 2a 74  path    (conc *t
8f60: 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f  oppath* "/tests/
8f70: 22 20 74 65 73 74 2d 6e 61 6d 65 29 29 0a 09 20  " test-name)).. 
8f80: 20 20 20 20 20 28 74 65 73 74 2d 63 6f 6e 66 69       (test-confi
8f90: 67 66 20 28 63 6f 6e 63 20 74 65 73 74 2d 70 61  gf (conc test-pa
8fa0: 74 68 20 22 2f 74 65 73 74 63 6f 6e 66 69 67 22  th "/testconfig"
8fb0: 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 65  ))..      (teste
8fc0: 78 69 73 74 73 20 20 20 28 61 6e 64 20 28 66 69  xists   (and (fi
8fd0: 6c 65 2d 65 78 69 73 74 73 3f 20 74 65 73 74 2d  le-exists? test-
8fe0: 63 6f 6e 66 69 67 66 29 28 66 69 6c 65 2d 72 65  configf)(file-re
8ff0: 61 64 2d 61 63 63 65 73 73 3f 20 74 65 73 74 2d  ad-access? test-
9000: 63 6f 6e 66 69 67 66 29 29 29 0a 09 20 20 20 20  configf)))..    
9010: 20 20 3b 3b 20 72 65 61 64 20 63 6f 6e 66 69 67    ;; read config
9020: 73 20 77 69 74 68 20 74 72 69 63 6b 73 20 74 75  s with tricks tu
9030: 72 6e 65 64 20 6f 66 66 20 28 69 2e 65 2e 20 6e  rned off (i.e. n
9040: 6f 20 73 79 73 74 65 6d 29 0a 09 20 20 20 20 20  o system)..     
9050: 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 20 28   (test-conf    (
9060: 69 66 20 74 65 73 74 65 78 69 73 74 73 20 28 72  if testexists (r
9070: 65 61 64 2d 63 6f 6e 66 69 67 20 74 65 73 74 2d  ead-config test-
9080: 63 6f 6e 66 69 67 66 20 23 66 20 23 66 29 28 6d  configf #f #f)(m
9090: 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29  ake-hash-table))
90a0: 29 29 0a 09 20 28 72 75 6e 73 3a 75 70 64 61 74  )).. (runs:updat
90b0: 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20 74  e-test_meta db t
90c0: 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f  est-name test-co
90d0: 6e 66 29 29 29 0a 20 20 20 20 20 74 65 73 74 2d  nf))).     test-
90e0: 6e 61 6d 65 73 29 29 29 0a 0a 3b 3b 20 54 68 69  names)))..;; Thi
90f0: 73 20 63 6f 75 6c 64 20 70 72 6f 62 61 62 6c 79  s could probably
9100: 20 62 65 20 72 65 66 61 63 74 6f 72 65 64 20 69   be refactored i
9110: 6e 74 6f 20 6f 6e 65 20 63 6f 6d 70 6c 65 78 20  nto one complex 
9120: 71 75 65 72 79 20 2e 2e 2e 0a 28 64 65 66 69 6e  query ....(defin
9130: 65 20 28 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72  e (runs:rollup-r
9140: 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 61  un db keys keyva
9150: 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 75 73 65  llst runname use
9160: 72 29 20 3b 3b 20 77 61 73 20 74 61 72 67 65 74  r) ;; was target
9170: 2c 20 6e 6f 77 20 6b 65 79 76 61 6c 6c 73 74 0a  , now keyvallst.
9180: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34    (debug:print 4
9190: 20 22 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75   "runs:rollup-ru
91a0: 6e 2c 20 6b 65 79 73 3a 20 22 20 6b 65 79 73 20  n, keys: " keys 
91b0: 22 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b  " keyvallst: " k
91c0: 65 79 76 61 6c 6c 73 74 20 22 20 3a 72 75 6e 6e  eyvallst " :runn
91d0: 61 6d 65 20 22 20 72 75 6e 6e 61 6d 65 20 22 20  ame " runname " 
91e0: 75 73 65 72 3a 20 22 20 75 73 65 72 29 0a 20 20  user: " user).  
91f0: 28 6c 65 74 2a 20 28 3b 20 28 6b 65 79 76 61 6c  (let* (; (keyval
9200: 6c 6c 73 74 20 20 20 20 20 20 28 6b 65 79 73 3a  llst      (keys:
9210: 74 61 72 67 65 74 2d 3e 6b 65 79 76 61 6c 20 6b  target->keyval k
9220: 65 79 73 20 74 61 72 67 65 74 29 29 0a 09 20 28  eys target)).. (
9230: 6e 65 77 2d 72 75 6e 2d 69 64 20 20 20 20 20 20  new-run-id      
9240: 28 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72  (runs:register-r
9250: 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 61  un db keys keyva
9260: 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e 65  llst runname "ne
9270: 77 22 20 22 6e 2f 61 22 20 75 73 65 72 29 29 0a  w" "n/a" user)).
9280: 09 20 28 70 72 65 76 2d 74 65 73 74 73 20 20 20  . (prev-tests   
9290: 20 20 20 28 74 65 73 74 3a 67 65 74 2d 6d 61 74     (test:get-mat
92a0: 63 68 69 6e 67 2d 70 72 65 76 69 6f 75 73 2d 74  ching-previous-t
92b0: 65 73 74 2d 72 75 6e 2d 72 65 63 6f 72 64 73 20  est-run-records 
92c0: 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 22 25  db new-run-id "%
92d0: 22 20 22 25 22 29 29 0a 09 20 28 63 75 72 72 2d  " "%")).. (curr-
92e0: 74 65 73 74 73 20 20 20 20 20 20 28 72 64 62 3a  tests      (rdb:
92f0: 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75  get-tests-for-ru
9300: 6e 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20  n db new-run-id 
9310: 22 25 22 20 22 25 22 20 27 28 29 20 27 28 29 29  "%" "%" '() '())
9320: 29 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73 2d  ).. (curr-tests-
9330: 68 61 73 68 20 28 6d 61 6b 65 2d 68 61 73 68 2d  hash (make-hash-
9340: 74 61 62 6c 65 29 29 29 0a 20 20 20 20 28 64 62  table))).    (db
9350: 3a 75 70 64 61 74 65 2d 72 75 6e 2d 65 76 65 6e  :update-run-even
9360: 74 5f 74 69 6d 65 20 64 62 20 6e 65 77 2d 72 75  t_time db new-ru
9370: 6e 2d 69 64 29 0a 20 20 20 20 3b 3b 20 69 6e 64  n-id).    ;; ind
9380: 65 78 20 74 68 65 20 61 6c 72 65 61 64 79 20 73  ex the already s
9390: 61 76 65 64 20 74 65 73 74 73 20 62 79 20 74 65  aved tests by te
93a0: 73 74 6e 61 6d 65 20 61 6e 64 20 69 74 65 6d 64  stname and itemd
93b0: 61 74 20 69 6e 20 63 75 72 72 2d 74 65 73 74 73  at in curr-tests
93c0: 2d 68 61 73 68 0a 20 20 20 20 28 66 6f 72 2d 65  -hash.    (for-e
93d0: 61 63 68 0a 20 20 20 20 20 28 6c 61 6d 62 64 61  ach.     (lambda
93e0: 20 28 74 65 73 74 64 61 74 29 0a 20 20 20 20 20   (testdat).     
93f0: 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 6e 61    (let* ((testna
9400: 6d 65 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74  me  (db:test-get
9410: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 64 61  -testname testda
9420: 74 29 29 0a 09 20 20 20 20 20 20 28 69 74 65 6d  t))..      (item
9430: 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67  -path (db:test-g
9440: 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73  et-item-path tes
9450: 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 66  tdat))..      (f
9460: 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74  ull-name (conc t
9470: 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d  estname "/" item
9480: 2d 70 61 74 68 29 29 29 0a 09 20 28 68 61 73 68  -path))).. (hash
9490: 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72 72  -table-set! curr
94a0: 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c  -tests-hash full
94b0: 2d 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29 29  -name testdat)))
94c0: 0a 20 20 20 20 20 63 75 72 72 2d 74 65 73 74 73  .     curr-tests
94d0: 29 0a 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 4e  ).    ;; NOPE: N
94e0: 6f 6e 2d 6f 70 74 69 6d 61 6c 20 61 70 70 72 6f  on-optimal appro
94f0: 61 63 68 2e 20 54 72 79 20 74 68 69 73 20 69 6e  ach. Try this in
9500: 73 74 65 61 64 2e 0a 20 20 20 20 3b 3b 20 20 20  stead..    ;;   
9510: 31 2e 20 74 65 73 74 73 20 61 72 65 20 72 65 63  1. tests are rec
9520: 65 69 76 65 64 20 69 6e 20 61 20 6c 69 73 74 2c  eived in a list,
9530: 20 6d 6f 73 74 20 72 65 63 65 6e 74 20 66 69 72   most recent fir
9540: 73 74 0a 20 20 20 20 3b 3b 20 20 20 32 2e 20 72  st.    ;;   2. r
9550: 65 70 6c 61 63 65 20 74 68 65 20 72 6f 6c 6c 75  eplace the rollu
9560: 70 20 74 65 73 74 20 77 69 74 68 20 74 68 65 20  p test with the 
9570: 6e 65 77 20 2a 61 6c 77 61 79 73 2a 0a 20 20 20  new *always*.   
9580: 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20   (for-each .    
9590: 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 64 61   (lambda (testda
95a0: 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20  t).       (let* 
95b0: 28 28 74 65 73 74 6e 61 6d 65 20 20 28 64 62 3a  ((testname  (db:
95c0: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d  test-get-testnam
95d0: 65 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20  e testdat))..   
95e0: 20 20 20 28 69 74 65 6d 2d 70 61 74 68 20 28 64     (item-path (d
95f0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d  b:test-get-item-
9600: 70 61 74 68 20 74 65 73 74 64 61 74 29 29 0a 09  path testdat))..
9610: 20 20 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65        (full-name
9620: 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20   (conc testname 
9630: 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 0a  "/" item-path)).
9640: 09 20 20 20 20 20 20 28 70 72 65 76 2d 74 65 73  .      (prev-tes
9650: 74 2d 64 61 74 20 28 68 61 73 68 2d 74 61 62 6c  t-dat (hash-tabl
9660: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63 75  e-ref/default cu
9670: 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75  rr-tests-hash fu
9680: 6c 6c 2d 6e 61 6d 65 20 23 66 29 29 0a 09 20 20  ll-name #f))..  
9690: 20 20 20 20 28 74 65 73 74 2d 73 74 65 70 73 20      (test-steps 
96a0: 20 20 20 20 20 28 64 62 3a 67 65 74 2d 73 74 65       (db:get-ste
96b0: 70 73 2d 66 6f 72 2d 74 65 73 74 20 64 62 20 28  ps-for-test db (
96c0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74  db:test-get-id t
96d0: 65 73 74 64 61 74 29 29 29 0a 09 20 20 20 20 20  estdat)))..     
96e0: 20 28 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72   (new-test-recor
96f0: 64 20 23 66 29 29 0a 09 20 3b 3b 20 72 65 70 6c  d #f)).. ;; repl
9700: 61 63 65 20 74 68 65 73 65 20 77 69 74 68 20 69  ace these with i
9710: 6e 73 65 72 74 20 2e 2e 2e 20 73 65 6c 65 63 74  nsert ... select
9720: 0a 09 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65  .. (apply sqlite
9730: 33 3a 65 78 65 63 75 74 65 20 0a 09 09 64 62 20  3:execute ...db 
9740: 0a 09 09 28 63 6f 6e 63 20 22 49 4e 53 45 52 54  ...(conc "INSERT
9750: 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f   OR REPLACE INTO
9760: 20 74 65 73 74 73 20 28 72 75 6e 5f 69 64 2c 74   tests (run_id,t
9770: 65 73 74 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74  estname,state,st
9780: 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c  atus,event_time,
9790: 68 6f 73 74 2c 63 70 75 6c 6f 61 64 2c 64 69 73  host,cpuload,dis
97a0: 6b 66 72 65 65 2c 75 6e 61 6d 65 2c 72 75 6e 64  kfree,uname,rund
97b0: 69 72 2c 69 74 65 6d 5f 70 61 74 68 2c 72 75 6e  ir,item_path,run
97c0: 5f 64 75 72 61 74 69 6f 6e 2c 66 69 6e 61 6c 5f  _duration,final_
97d0: 6c 6f 67 66 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a  logf,comment) ".
97e0: 09 09 20 20 20 20 20 20 22 56 41 4c 55 45 53 20  ..      "VALUES 
97f0: 28 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f  (?,?,?,?,?,?,?,?
9800: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 29 3b 22 29  ,?,?,?,?,?,?);")
9810: 0a 09 09 6e 65 77 2d 72 75 6e 2d 69 64 20 28 63  ...new-run-id (c
9820: 64 64 72 20 28 76 65 63 74 6f 72 2d 3e 6c 69 73  ddr (vector->lis
9830: 74 20 74 65 73 74 64 61 74 29 29 29 0a 09 20 28  t testdat))).. (
9840: 73 65 74 21 20 6e 65 77 2d 74 65 73 74 64 61 74  set! new-testdat
9850: 20 28 63 61 72 20 28 72 64 62 3a 67 65 74 2d 74   (car (rdb:get-t
9860: 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20  ests-for-run db 
9870: 6e 65 77 2d 72 75 6e 2d 69 64 20 74 65 73 74 6e  new-run-id testn
9880: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 20 27 28  ame item-path '(
9890: 29 20 27 28 29 29 29 29 0a 09 20 28 68 61 73 68  ) '()))).. (hash
98a0: 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72 72  -table-set! curr
98b0: 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c  -tests-hash full
98c0: 2d 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74 64 61  -name new-testda
98d0: 74 29 20 3b 3b 20 74 68 69 73 20 63 6f 75 6c 64  t) ;; this could
98e0: 20 62 65 20 63 6f 6e 66 75 73 69 6e 67 2c 20 77   be confusing, w
98f0: 68 69 63 68 20 72 65 63 6f 72 64 20 73 68 6f 75  hich record shou
9900: 6c 64 20 67 6f 20 69 6e 74 6f 20 74 68 65 20 6c  ld go into the l
9910: 6f 6f 6b 75 70 20 74 61 62 6c 65 3f 0a 09 20 3b  ookup table?.. ;
9920: 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20  ; Now duplicate 
9930: 74 68 65 20 74 65 73 74 20 73 74 65 70 73 0a 09  the test steps..
9940: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20   (debug:print 4 
9950: 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 73  "Copying records
9960: 20 69 6e 20 74 65 73 74 5f 73 74 65 70 73 20 66   in test_steps f
9970: 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64  rom test_id=" (d
9980: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65  b:test-get-id te
9990: 73 74 64 61 74 29 20 22 20 74 6f 20 22 20 28 64  stdat) " to " (d
99a0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65  b:test-get-id ne
99b0: 77 2d 74 65 73 74 64 61 74 29 29 0a 09 20 28 73  w-testdat)).. (s
99c0: 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a  qlite3:execute .
99d0: 09 20 20 64 62 20 0a 09 20 20 28 63 6f 6e 63 20  .  db ..  (conc 
99e0: 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41  "INSERT OR REPLA
99f0: 43 45 20 49 4e 54 4f 20 74 65 73 74 5f 73 74 65  CE INTO test_ste
9a00: 70 73 20 28 74 65 73 74 5f 69 64 2c 73 74 65 70  ps (test_id,step
9a10: 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75  name,state,statu
9a20: 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d  s,event_time,com
9a30: 6d 65 6e 74 29 20 22 0a 09 09 22 53 45 4c 45 43  ment) "..."SELEC
9a40: 54 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74  T " (db:test-get
9a50: 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29  -id new-testdat)
9a60: 20 22 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 74   ",stepname,stat
9a70: 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74  e,status,event_t
9a80: 69 6d 65 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d  ime,comment FROM
9a90: 20 74 65 73 74 5f 73 74 65 70 73 20 57 48 45 52   test_steps WHER
9aa0: 45 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09  E test_id=?;")..
9ab0: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69    (db:test-get-i
9ac0: 64 20 74 65 73 74 64 61 74 29 29 0a 09 20 3b 3b  d testdat)).. ;;
9ad0: 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74   Now duplicate t
9ae0: 68 65 20 74 65 73 74 20 64 61 74 61 0a 09 20 28  he test data.. (
9af0: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 43  debug:print 4 "C
9b00: 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 73 20 69  opying records i
9b10: 6e 20 74 65 73 74 5f 64 61 74 61 20 66 72 6f 6d  n test_data from
9b20: 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62 3a 74   test_id=" (db:t
9b30: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64  est-get-id testd
9b40: 61 74 29 20 22 20 74 6f 20 22 20 28 64 62 3a 74  at) " to " (db:t
9b50: 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74  est-get-id new-t
9b60: 65 73 74 64 61 74 29 29 0a 09 20 28 73 71 6c 69  estdat)).. (sqli
9b70: 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09 20 20  te3:execute ..  
9b80: 64 62 20 0a 09 20 20 28 63 6f 6e 63 20 22 49 4e  db ..  (conc "IN
9b90: 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20  SERT OR REPLACE 
9ba0: 49 4e 54 4f 20 74 65 73 74 5f 64 61 74 61 20 28  INTO test_data (
9bb0: 74 65 73 74 5f 69 64 2c 63 61 74 65 67 6f 72 79  test_id,category
9bc0: 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c  ,variable,value,
9bd0: 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69  expected,tol,uni
9be0: 74 73 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09  ts,comment) "...
9bf0: 22 53 45 4c 45 43 54 20 22 20 28 64 62 3a 74 65  "SELECT " (db:te
9c00: 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65  st-get-id new-te
9c10: 73 74 64 61 74 29 20 22 2c 63 61 74 65 67 6f 72  stdat) ",categor
9c20: 79 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65  y,variable,value
9c30: 2c 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e  ,expected,tol,un
9c40: 69 74 73 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d  its,comment FROM
9c50: 20 74 65 73 74 5f 64 61 74 61 20 57 48 45 52 45   test_data WHERE
9c60: 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20   test_id=?;").. 
9c70: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64   (db:test-get-id
9c80: 20 74 65 73 74 64 61 74 29 29 0a 09 20 29 29 0a   testdat)).. )).
9c90: 20 20 20 20 20 70 72 65 76 2d 74 65 73 74 73 29       prev-tests)
9ca0: 29 29 0a 09 20 0a 20 20 20 20 20 0a              )).. .     .