Megatest

Hex Artifact Content
Login

Artifact b3a5700d1136807127638a23b4378cd9be02732a:


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 29 0a 28 69 6d 70 6f 72  srfi 18)).(impor
01d0: 74 20 28 70 72 65 66 69 78 20 73 71 6c 69 74 65  t (prefix sqlite
01e0: 33 20 73 71 6c 69 74 65 33 3a 29 29 0a 0a 28 64  3 sqlite3:))..(d
01f0: 65 63 6c 61 72 65 20 28 75 6e 69 74 20 72 75 6e  eclare (unit run
0200: 73 29 29 0a 28 64 65 63 6c 61 72 65 20 28 75 73  s)).(declare (us
0210: 65 73 20 64 62 29 29 0a 28 64 65 63 6c 61 72 65  es db)).(declare
0220: 20 28 75 73 65 73 20 63 6f 6d 6d 6f 6e 29 29 0a   (uses common)).
0230: 28 64 65 63 6c 61 72 65 20 28 75 73 65 73 20 69  (declare (uses i
0240: 74 65 6d 73 29 29 0a 28 64 65 63 6c 61 72 65 20  tems)).(declare 
0250: 28 75 73 65 73 20 72 75 6e 63 6f 6e 66 69 67 29  (uses runconfig)
0260: 29 0a 28 64 65 63 6c 61 72 65 20 28 75 73 65 73  ).(declare (uses
0270: 20 74 65 73 74 73 29 29 0a 28 64 65 63 6c 61 72   tests)).(declar
0280: 65 20 28 75 73 65 73 20 73 65 72 76 65 72 29 29  e (uses server))
0290: 0a 0a 28 69 6e 63 6c 75 64 65 20 22 63 6f 6d 6d  ..(include "comm
02a0: 6f 6e 5f 72 65 63 6f 72 64 73 2e 73 63 6d 22 29  on_records.scm")
02b0: 0a 28 69 6e 63 6c 75 64 65 20 22 6b 65 79 5f 72  .(include "key_r
02c0: 65 63 6f 72 64 73 2e 73 63 6d 22 29 0a 28 69 6e  ecords.scm").(in
02d0: 63 6c 75 64 65 20 22 64 62 5f 72 65 63 6f 72 64  clude "db_record
02e0: 73 2e 73 63 6d 22 29 0a 28 69 6e 63 6c 75 64 65  s.scm").(include
02f0: 20 22 72 75 6e 5f 72 65 63 6f 72 64 73 2e 73 63   "run_records.sc
0300: 6d 22 29 0a 28 69 6e 63 6c 75 64 65 20 22 74 65  m").(include "te
0310: 73 74 5f 72 65 63 6f 72 64 73 2e 73 63 6d 22 29  st_records.scm")
0320: 0a 0a 3b 3b 20 72 75 6e 73 3a 67 65 74 2d 72 75  ..;; runs:get-ru
0330: 6e 73 2d 62 79 2d 70 61 74 74 0a 3b 3b 20 67 65  ns-by-patt.;; ge
0340: 74 20 72 75 6e 73 20 62 79 20 6c 69 73 74 20 6f  t runs by list o
0350: 66 20 63 72 69 74 65 72 69 61 0a 3b 3b 20 72 65  f criteria.;; re
0360: 67 69 73 74 65 72 20 61 20 74 65 73 74 20 72 75  gister a test ru
0370: 6e 20 77 69 74 68 20 74 68 65 20 64 62 0a 3b 3b  n with the db.;;
0380: 0a 3b 3b 20 55 73 65 3a 20 28 64 62 2d 67 65 74  .;; Use: (db-get
0390: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72  -value-by-header
03a0: 20 28 64 62 3a 67 65 74 2d 68 65 61 64 65 72 20   (db:get-header 
03b0: 72 75 6e 69 6e 66 6f 29 28 64 62 3a 67 65 74 2d  runinfo)(db:get-
03c0: 72 6f 77 20 72 75 6e 69 6e 66 6f 29 29 0a 3b 3b  row runinfo)).;;
03d0: 20 20 74 6f 20 65 78 74 72 61 63 74 20 69 6e 66    to extract inf
03e0: 6f 20 66 72 6f 6d 20 74 68 65 20 73 74 72 75 63  o from the struc
03f0: 74 75 72 65 20 72 65 74 75 72 6e 65 64 0a 3b 3b  ture returned.;;
0400: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 67  .(define (runs:g
0410: 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74 74 20  et-runs-by-patt 
0420: 64 62 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65 70  db keys runnamep
0430: 61 74 74 20 2e 20 70 61 72 61 6d 73 29 20 3b 3b  att . params) ;;
0440: 20 74 65 73 74 2d 6e 61 6d 65 29 0a 20 20 28 6c   test-name).  (l
0450: 65 74 2a 20 28 28 6b 65 79 76 61 6c 6c 73 74 20  et* ((keyvallst 
0460: 28 6b 65 79 73 2d 3e 76 61 6c 6c 69 73 74 20 6b  (keys->vallist k
0470: 65 79 73 29 29 0a 09 20 28 74 6d 70 20 20 20 20  eys)).. (tmp    
0480: 20 20 28 72 75 6e 73 3a 67 65 74 2d 73 74 64 2d    (runs:get-std-
0490: 72 75 6e 2d 66 69 65 6c 64 73 20 6b 65 79 73 20  run-fields keys 
04a0: 27 28 22 69 64 22 20 22 72 75 6e 6e 61 6d 65 22  '("id" "runname"
04b0: 20 22 73 74 61 74 65 22 20 22 73 74 61 74 75 73   "state" "status
04c0: 22 20 22 6f 77 6e 65 72 22 20 22 65 76 65 6e 74  " "owner" "event
04d0: 5f 74 69 6d 65 22 29 29 29 0a 09 20 28 6b 65 79  _time"))).. (key
04e0: 73 74 72 20 20 20 28 63 61 72 20 74 6d 70 29 29  str   (car tmp))
04f0: 0a 09 20 28 68 65 61 64 65 72 20 20 20 28 63 61  .. (header   (ca
0500: 64 72 20 74 6d 70 29 29 0a 09 20 28 72 65 73 20  dr tmp)).. (res 
0510: 20 20 20 20 27 28 29 29 0a 09 20 28 6b 65 79 2d      '()).. (key-
0520: 70 61 74 74 20 22 22 29 29 0a 20 20 20 20 28 66  patt "")).    (f
0530: 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 61 20  or-each (lambda 
0540: 28 6b 65 79 76 61 6c 29 0a 09 09 28 6c 65 74 2a  (keyval)...(let*
0550: 20 28 28 6b 65 79 20 20 20 20 28 76 65 63 74 6f   ((key    (vecto
0560: 72 2d 72 65 66 20 6b 65 79 76 61 6c 20 30 29 29  r-ref keyval 0))
0570: 0a 09 09 20 20 20 20 20 20 20 28 66 75 6c 6b 65  ...       (fulke
0580: 79 20 28 63 6f 6e 63 20 22 3a 22 20 6b 65 79 29  y (conc ":" key)
0590: 29 0a 09 09 20 20 20 20 20 20 20 28 70 61 74 74  )...       (patt
05a0: 20 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67     (args:get-arg
05b0: 20 66 75 6c 6b 65 79 29 29 29 0a 09 09 20 20 28   fulkey)))...  (
05c0: 69 66 20 70 61 74 74 0a 09 09 20 20 20 20 20 20  if patt...      
05d0: 28 73 65 74 21 20 6b 65 79 2d 70 61 74 74 20 28  (set! key-patt (
05e0: 63 6f 6e 63 20 6b 65 79 2d 70 61 74 74 20 22 20  conc key-patt " 
05f0: 41 4e 44 20 22 20 6b 65 79 20 22 20 6c 69 6b 65  AND " key " like
0600: 20 27 22 20 70 61 74 74 20 22 27 22 29 29 0a 09   '" patt "'"))..
0610: 09 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09  .      (begin...
0620: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20  .(debug:print 0 
0630: 22 45 52 52 4f 52 3a 20 73 65 61 72 63 68 69 6e  "ERROR: searchin
0640: 67 20 66 6f 72 20 72 75 6e 73 20 77 69 74 68 20  g for runs with 
0650: 6e 6f 20 70 61 74 74 65 72 6e 20 73 65 74 20 66  no pattern set f
0660: 6f 72 20 22 20 66 75 6c 6b 65 79 29 0a 09 09 09  or " fulkey)....
0670: 28 65 78 69 74 20 36 29 29 29 29 29 0a 09 20 20  (exit 6)))))..  
0680: 20 20 20 20 6b 65 79 73 29 0a 20 20 20 20 28 73      keys).    (s
0690: 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d  qlite3:for-each-
06a0: 72 6f 77 20 0a 20 20 20 20 20 28 6c 61 6d 62 64  row .     (lambd
06b0: 61 20 28 61 20 2e 20 72 29 0a 20 20 20 20 20 20  a (a . r).      
06c0: 20 28 73 65 74 21 20 72 65 73 20 28 63 6f 6e 73   (set! res (cons
06d0: 20 28 6c 69 73 74 2d 3e 76 65 63 74 6f 72 20 28   (list->vector (
06e0: 63 6f 6e 73 20 61 20 72 29 29 20 72 65 73 29 29  cons a r)) res))
06f0: 29 0a 20 20 20 20 20 64 62 20 0a 20 20 20 20 20  ).     db .     
0700: 28 63 6f 6e 63 20 22 53 45 4c 45 43 54 20 22 20  (conc "SELECT " 
0710: 6b 65 79 73 74 72 20 22 20 46 52 4f 4d 20 72 75  keystr " FROM ru
0720: 6e 73 20 57 48 45 52 45 20 72 75 6e 6e 61 6d 65  ns WHERE runname
0730: 20 6c 69 6b 65 20 3f 20 22 20 6b 65 79 2d 70 61   like ? " key-pa
0740: 74 74 20 22 3b 22 29 0a 20 20 20 20 20 72 75 6e  tt ";").     run
0750: 6e 61 6d 65 70 61 74 74 29 0a 20 20 20 20 28 76  namepatt).    (v
0760: 65 63 74 6f 72 20 68 65 61 64 65 72 20 72 65 73  ector header res
0770: 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75  )))..(define (ru
0780: 6e 73 3a 74 65 73 74 2d 67 65 74 2d 66 75 6c 6c  ns:test-get-full
0790: 2d 70 61 74 68 20 74 65 73 74 29 0a 20 20 28 6c  -path test).  (l
07a0: 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 20 28  et* ((testname (
07b0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74  db:test-get-test
07c0: 6e 61 6d 65 20 20 20 74 65 73 74 29 29 0a 09 20  name   test)).. 
07d0: 28 69 74 65 6d 70 61 74 68 20 28 64 62 3a 74 65  (itempath (db:te
07e0: 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68  st-get-item-path
07f0: 20 74 65 73 74 29 29 29 0a 20 20 20 20 28 63 6f   test))).    (co
0800: 6e 63 20 74 65 73 74 6e 61 6d 65 20 28 69 66 20  nc testname (if 
0810: 28 65 71 75 61 6c 3f 20 69 74 65 6d 70 61 74 68  (equal? itempath
0820: 20 22 22 29 20 22 22 20 28 63 6f 6e 63 20 22 28   "") "" (conc "(
0830: 22 20 69 74 65 6d 70 61 74 68 20 22 29 22 29 29  " itempath ")"))
0840: 29 29 29 0a 0a 0a 28 64 65 66 69 6e 65 20 28 73  )))...(define (s
0850: 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d  et-megatest-env-
0860: 76 61 72 73 20 64 62 20 72 75 6e 2d 69 64 29 0a  vars db run-id).
0870: 20 20 28 6c 65 74 20 28 28 6b 65 79 73 20 28 72    (let ((keys (r
0880: 64 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29  db:get-keys db))
0890: 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20  ).    (for-each 
08a0: 28 6c 61 6d 62 64 61 20 28 6b 65 79 29 0a 09 09  (lambda (key)...
08b0: 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63  (sqlite3:for-eac
08c0: 68 2d 72 6f 77 0a 09 09 20 28 6c 61 6d 62 64 61  h-row... (lambda
08d0: 20 28 76 61 6c 29 0a 09 09 20 20 20 28 64 65 62   (val)...   (deb
08e0: 75 67 3a 70 72 69 6e 74 20 32 20 22 73 65 74 65  ug:print 2 "sete
08f0: 6e 76 20 22 20 28 6b 65 79 3a 67 65 74 2d 66 69  nv " (key:get-fi
0900: 65 6c 64 6e 61 6d 65 20 6b 65 79 29 20 22 20 22  eldname key) " "
0910: 20 76 61 6c 29 0a 09 09 20 20 20 28 73 65 74 65   val)...   (sete
0920: 6e 76 20 28 6b 65 79 3a 67 65 74 2d 66 69 65 6c  nv (key:get-fiel
0930: 64 6e 61 6d 65 20 6b 65 79 29 20 76 61 6c 29 29  dname key) val))
0940: 0a 09 09 20 64 62 20 0a 09 09 20 28 63 6f 6e 63  ... db ... (conc
0950: 20 22 53 45 4c 45 43 54 20 22 20 28 6b 65 79 3a   "SELECT " (key:
0960: 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65  get-fieldname ke
0970: 79 29 20 22 20 46 52 4f 4d 20 72 75 6e 73 20 57  y) " FROM runs W
0980: 48 45 52 45 20 69 64 3d 3f 3b 22 29 0a 09 09 20  HERE id=?;")... 
0990: 72 75 6e 2d 69 64 29 29 0a 09 20 20 20 20 20 20  run-id))..      
09a0: 6b 65 79 73 29 0a 20 20 20 20 3b 3b 20 4c 65 74  keys).    ;; Let
09b0: 73 20 75 73 65 20 74 68 69 73 20 61 73 20 61 6e  s use this as an
09c0: 20 6f 70 70 6f 72 74 75 6e 69 74 79 20 74 6f 20   opportunity to 
09d0: 70 75 74 20 4d 54 5f 52 55 4e 4e 41 4d 45 20 69  put MT_RUNNAME i
09e0: 6e 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e  n the environmen
09f0: 74 0a 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66  t.    (sqlite3:f
0a00: 6f 72 2d 65 61 63 68 2d 72 6f 77 0a 20 20 20 20  or-each-row.    
0a10: 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 6e 61 6d   (lambda (runnam
0a20: 65 29 0a 20 20 20 20 20 20 20 28 73 65 74 65 6e  e).       (seten
0a30: 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 72  v "MT_RUNNAME" r
0a40: 75 6e 6e 61 6d 65 29 29 0a 20 20 20 20 20 64 62  unname)).     db
0a50: 0a 20 20 20 20 20 22 53 45 4c 45 43 54 20 72 75  .     "SELECT ru
0a60: 6e 6e 61 6d 65 20 46 52 4f 4d 20 72 75 6e 73 20  nname FROM runs 
0a70: 57 48 45 52 45 20 69 64 3d 3f 3b 22 0a 20 20 20  WHERE id=?;".   
0a80: 20 20 72 75 6e 2d 69 64 29 0a 20 20 20 20 29 29    run-id).    ))
0a90: 0a 0a 28 64 65 66 69 6e 65 20 28 73 65 74 2d 69  ..(define (set-i
0aa0: 74 65 6d 2d 65 6e 76 2d 76 61 72 73 20 69 74 65  tem-env-vars ite
0ab0: 6d 64 61 74 29 0a 20 20 28 66 6f 72 2d 65 61 63  mdat).  (for-eac
0ac0: 68 20 28 6c 61 6d 62 64 61 20 28 69 74 65 6d 29  h (lambda (item)
0ad0: 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70  ..      (debug:p
0ae0: 72 69 6e 74 20 32 20 22 73 65 74 65 6e 76 20 22  rint 2 "setenv "
0af0: 20 28 63 61 72 20 69 74 65 6d 29 20 22 20 22 20   (car item) " " 
0b00: 28 63 61 64 72 20 69 74 65 6d 29 29 0a 09 20 20  (cadr item))..  
0b10: 20 20 20 20 28 73 65 74 65 6e 76 20 28 63 61 72      (setenv (car
0b20: 20 69 74 65 6d 29 20 28 63 61 64 72 20 69 74 65   item) (cadr ite
0b30: 6d 29 29 29 0a 09 20 20 20 20 69 74 65 6d 64 61  m)))..    itemda
0b40: 74 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75  t))..(define (ru
0b50: 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d  ns:can-run-more-
0b60: 74 65 73 74 73 20 64 62 20 74 65 73 74 2d 72 65  tests db test-re
0b70: 63 6f 72 64 29 0a 20 20 28 6c 65 74 2a 20 28 28  cord).  (let* ((
0b80: 74 63 6f 6e 66 69 67 20 20 20 20 20 20 20 20 20  tconfig         
0b90: 20 20 20 20 20 20 20 20 28 74 65 73 74 73 3a 74          (tests:t
0ba0: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73  estqueue-get-tes
0bb0: 74 63 6f 6e 66 69 67 20 74 65 73 74 2d 72 65 63  tconfig test-rec
0bc0: 6f 72 64 29 29 0a 09 20 28 6a 6f 62 67 72 6f 75  ord)).. (jobgrou
0bd0: 70 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  p               
0be0: 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20   (config-lookup 
0bf0: 74 63 6f 6e 66 69 67 20 22 72 65 71 75 69 72 65  tconfig "require
0c00: 6d 65 6e 74 73 22 20 22 6a 6f 62 67 72 6f 75 70  ments" "jobgroup
0c10: 22 29 29 0a 09 20 28 6e 75 6d 2d 72 75 6e 6e 69  ")).. (num-runni
0c20: 6e 67 20 20 20 20 20 20 20 20 20 20 20 20 20 28  ng             (
0c30: 64 62 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 65 73  db:get-count-tes
0c40: 74 73 2d 72 75 6e 6e 69 6e 67 20 64 62 29 29 0a  ts-running db)).
0c50: 09 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69  . (num-running-i
0c60: 6e 2d 6a 6f 62 67 72 6f 75 70 20 28 64 62 3a 67  n-jobgroup (db:g
0c70: 65 74 2d 63 6f 75 6e 74 2d 74 65 73 74 73 2d 72  et-count-tests-r
0c80: 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f  unning-in-jobgro
0c90: 75 70 20 64 62 20 6a 6f 62 67 72 6f 75 70 29 29  up db jobgroup))
0ca0: 0a 09 20 28 6d 61 78 2d 63 6f 6e 63 75 72 72 65  .. (max-concurre
0cb0: 6e 74 2d 6a 6f 62 73 20 20 20 20 20 28 63 6f 6e  nt-jobs     (con
0cc0: 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66  fig-lookup *conf
0cd0: 69 67 64 61 74 2a 20 22 73 65 74 75 70 22 20 20  igdat* "setup"  
0ce0: 20 20 20 22 6d 61 78 5f 63 6f 6e 63 75 72 72 65     "max_concurre
0cf0: 6e 74 5f 6a 6f 62 73 22 29 29 0a 09 20 28 6a 6f  nt_jobs")).. (jo
0d00: 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 20 20 20  b-group-limit   
0d10: 20 20 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f        (config-lo
0d20: 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a  okup *configdat*
0d30: 20 22 6a 6f 62 67 72 6f 75 70 73 22 20 6a 6f 62   "jobgroups" job
0d40: 67 72 6f 75 70 29 29 29 0a 20 20 20 20 28 64 65  group))).    (de
0d50: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 6d 61 78  bug:print 2 "max
0d60: 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73  -concurrent-jobs
0d70: 3a 20 22 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65  : " max-concurre
0d80: 6e 74 2d 6a 6f 62 73 20 22 2c 20 6e 75 6d 2d 72  nt-jobs ", num-r
0d90: 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75  unning: " num-ru
0da0: 6e 6e 69 6e 67 29 0a 20 20 20 20 28 69 66 20 28  nning).    (if (
0db0: 6e 6f 74 20 28 65 71 3f 20 30 20 2a 67 6c 6f 62  not (eq? 0 *glob
0dc0: 61 6c 65 78 69 74 73 74 61 74 75 73 2a 29 29 0a  alexitstatus*)).
0dd0: 09 23 66 0a 09 28 6c 65 74 20 28 28 63 61 6e 2d  .#f..(let ((can-
0de0: 6e 6f 74 2d 72 75 6e 2d 6d 6f 72 65 20 28 63 6f  not-run-more (co
0df0: 6e 64 0a 09 09 09 09 20 3b 3b 20 69 66 20 6d 61  nd..... ;; if ma
0e00: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62  x-concurrent-job
0e10: 73 20 69 73 20 73 65 74 20 61 6e 64 20 74 68 65  s is set and the
0e20: 20 6e 75 6d 62 65 72 20 72 75 6e 6e 69 6e 67 20   number running 
0e30: 69 73 20 67 72 65 61 74 65 72 20 0a 09 09 09 09  is greater .....
0e40: 20 3b 3b 20 74 68 61 6e 20 69 74 20 74 68 61 6e   ;; than it than
0e50: 20 63 61 6e 6e 6f 74 20 72 75 6e 20 6d 6f 72 65   cannot run more
0e60: 20 6a 6f 62 73 0a 09 09 09 09 20 28 28 61 6e 64   jobs..... ((and
0e70: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d   max-concurrent-
0e80: 6a 6f 62 73 0a 09 09 09 09 20 20 20 20 20 20 20  jobs.....       
0e90: 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 20  (string->number 
0ea0: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a  max-concurrent-j
0eb0: 6f 62 73 29 0a 09 09 09 09 20 20 20 20 20 20 20  obs).....       
0ec0: 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20  (>= num-running 
0ed0: 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 20  (string->number 
0ee0: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a  max-concurrent-j
0ef0: 6f 62 73 29 29 29 0a 09 09 09 09 20 20 28 64 65  obs))).....  (de
0f00: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52  bug:print 0 "WAR
0f10: 4e 49 4e 47 3a 20 4d 61 78 20 72 75 6e 6e 69 6e  NING: Max runnin
0f20: 67 20 6a 6f 62 73 20 65 78 63 65 65 64 65 64 2c  g jobs exceeded,
0f30: 20 63 75 72 72 65 6e 74 20 6e 75 6d 62 65 72 20   current number 
0f40: 72 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d 72  running: " num-r
0f50: 75 6e 6e 69 6e 67 20 0a 09 09 09 09 09 20 20 20  unning ......   
0f60: 20 20 20 20 22 2c 20 6d 61 78 5f 63 6f 6e 63 75      ", max_concu
0f70: 72 72 65 6e 74 5f 6a 6f 62 73 3a 20 22 20 6d 61  rrent_jobs: " ma
0f80: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62  x-concurrent-job
0f90: 73 29 0a 09 09 09 09 20 20 23 74 29 0a 09 09 09  s).....  #t)....
0fa0: 09 20 3b 3b 20 69 66 20 6a 6f 62 2d 67 72 6f 75  . ;; if job-grou
0fb0: 70 2d 6c 69 6d 69 74 20 69 73 20 73 65 74 20 61  p-limit is set a
0fc0: 6e 64 20 6e 75 6d 62 65 72 20 6f 66 20 6a 6f 62  nd number of job
0fd0: 73 20 69 6e 20 74 68 65 20 67 72 6f 75 70 20 69  s in the group i
0fe0: 73 20 67 72 65 61 74 65 72 0a 09 09 09 09 20 3b  s greater..... ;
0ff0: 3b 20 74 68 61 6e 20 74 68 65 20 6c 69 6d 69 74  ; than the limit
1000: 20 74 68 65 6e 20 63 61 6e 6e 6f 74 20 72 75 6e   then cannot run
1010: 20 6d 6f 72 65 20 6a 6f 62 73 20 6f 66 20 74 68   more jobs of th
1020: 69 73 20 6b 69 6e 64 0a 09 09 09 09 20 28 28 61  is kind..... ((a
1030: 6e 64 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d  nd job-group-lim
1040: 69 74 0a 09 09 09 09 20 20 20 20 20 20 20 28 3e  it.....       (>
1050: 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e  = num-running-in
1060: 2d 6a 6f 62 67 72 6f 75 70 20 6a 6f 62 2d 67 72  -jobgroup job-gr
1070: 6f 75 70 2d 6c 69 6d 69 74 29 29 0a 09 09 09 09  oup-limit)).....
1080: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31    (debug:print 1
1090: 20 22 57 41 52 4e 49 4e 47 3a 20 6e 75 6d 62 65   "WARNING: numbe
10a0: 72 20 6f 66 20 6a 6f 62 73 20 22 20 6e 75 6d 2d  r of jobs " num-
10b0: 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72  running-in-jobgr
10c0: 6f 75 70 20 0a 09 09 09 09 09 20 20 20 20 20 20  oup ......      
10d0: 20 22 20 69 6e 20 22 20 6a 6f 62 67 72 6f 75 70   " in " jobgroup
10e0: 20 22 20 65 78 63 65 65 64 65 64 2c 20 77 69 6c   " exceeded, wil
10f0: 6c 20 6e 6f 74 20 72 75 6e 20 22 20 28 74 65 73  l not run " (tes
1100: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
1110: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72  -testname test-r
1120: 65 63 6f 72 64 29 29 0a 09 09 09 09 20 20 23 74  ecord)).....  #t
1130: 29 0a 09 09 09 09 20 28 65 6c 73 65 20 23 66 29  )..... (else #f)
1140: 29 29 29 0a 09 20 20 28 6e 6f 74 20 63 61 6e 2d  )))..  (not can-
1150: 6e 6f 74 2d 72 75 6e 2d 6d 6f 72 65 29 29 29 29  not-run-more))))
1160: 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  )..;;===========
1170: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1180: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1190: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
11a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4e  ===========.;; N
11b0: 65 77 20 6d 65 74 68 6f 64 6f 6c 6f 67 79 2e 20  ew methodology. 
11c0: 54 68 65 73 65 20 72 6f 75 74 69 6e 65 73 20 77  These routines w
11d0: 69 6c 6c 20 72 65 70 6c 61 63 65 20 74 68 65 20  ill replace the 
11e0: 61 62 6f 76 65 20 69 6e 20 74 69 6d 65 2e 20 46  above in time. F
11f0: 6f 72 0a 3b 3b 20 6e 6f 77 20 74 68 65 20 63 6f  or.;; now the co
1200: 64 65 20 69 73 20 64 75 70 6c 69 63 61 74 65 64  de is duplicated
1210: 2e 20 54 68 69 73 20 73 74 75 66 66 20 69 73 20  . This stuff is 
1220: 69 6e 69 74 69 61 6c 6c 79 20 75 73 65 64 20 69  initially used i
1230: 6e 20 74 68 65 20 6d 6f 6e 69 74 6f 72 0a 3b 3b  n the monitor.;;
1240: 20 62 61 73 65 64 20 63 6f 64 65 2e 0a 3b 3b 3d   based code..;;=
1250: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1260: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1270: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1280: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1290: 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 72 65 67 69 73 74  =====..;; regist
12a0: 65 72 20 61 20 74 65 73 74 20 72 75 6e 20 77 69  er a test run wi
12b0: 74 68 20 74 68 65 20 64 62 0a 28 64 65 66 69 6e  th the db.(defin
12c0: 65 20 28 72 75 6e 73 3a 72 65 67 69 73 74 65 72  e (runs:register
12d0: 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79  -run db keys key
12e0: 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 73  vallst runname s
12f0: 74 61 74 65 20 73 74 61 74 75 73 20 75 73 65 72  tate status user
1300: 29 0a 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ).  (debug:print
1310: 20 33 20 22 72 75 6e 73 3a 72 65 67 69 73 74 65   3 "runs:registe
1320: 72 2d 72 75 6e 2c 20 6b 65 79 73 3a 20 22 20 6b  r-run, keys: " k
1330: 65 79 73 20 22 20 6b 65 79 76 61 6c 6c 73 74 3a  eys " keyvallst:
1340: 20 22 20 6b 65 79 76 61 6c 6c 73 74 20 22 20 72   " keyvallst " r
1350: 75 6e 6e 61 6d 65 3a 20 22 20 72 75 6e 6e 61 6d  unname: " runnam
1360: 65 20 22 20 73 74 61 74 65 3a 20 22 20 73 74 61  e " state: " sta
1370: 74 65 20 22 20 73 74 61 74 75 73 3a 20 22 20 73  te " status: " s
1380: 74 61 74 75 73 20 22 20 75 73 65 72 3a 20 22 20  tatus " user: " 
1390: 75 73 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 28  user).  (let* ((
13a0: 6b 65 79 73 74 72 20 20 20 20 28 6b 65 79 73 2d  keystr    (keys-
13b0: 3e 6b 65 79 73 74 72 20 6b 65 79 73 29 29 0a 09  >keystr keys))..
13c0: 20 28 63 6f 6d 6d 61 20 20 20 20 20 28 69 66 20   (comma     (if 
13d0: 28 3e 20 28 6c 65 6e 67 74 68 20 6b 65 79 73 29  (> (length keys)
13e0: 20 30 29 20 22 2c 22 20 22 22 29 29 0a 09 20 28   0) "," "")).. (
13f0: 61 6e 64 73 74 72 20 20 20 20 28 69 66 20 28 3e  andstr    (if (>
1400: 20 28 6c 65 6e 67 74 68 20 6b 65 79 73 29 20 30   (length keys) 0
1410: 29 20 22 20 41 4e 44 20 22 20 22 22 29 29 0a 09  ) " AND " ""))..
1420: 20 28 76 61 6c 73 6c 6f 74 73 20 20 28 6b 65 79   (valslots  (key
1430: 73 2d 3e 76 61 6c 73 6c 6f 74 73 20 6b 65 79 73  s->valslots keys
1440: 29 29 20 3b 3b 20 3f 2c 3f 2c 3f 20 2e 2e 2e 0a  )) ;; ?,?,? ....
1450: 09 20 28 6b 65 79 76 61 6c 73 20 20 20 28 6d 61  . (keyvals   (ma
1460: 70 20 63 61 64 72 20 6b 65 79 76 61 6c 6c 73 74  p cadr keyvallst
1470: 29 29 0a 09 20 28 61 6c 6c 76 61 6c 73 20 20 20  )).. (allvals   
1480: 28 61 70 70 65 6e 64 20 28 6c 69 73 74 20 72 75  (append (list ru
1490: 6e 6e 61 6d 65 20 73 74 61 74 65 20 73 74 61 74  nname state stat
14a0: 75 73 20 75 73 65 72 29 20 6b 65 79 76 61 6c 73  us user) keyvals
14b0: 29 29 0a 09 20 28 71 72 79 76 61 6c 73 20 20 20  )).. (qryvals   
14c0: 28 61 70 70 65 6e 64 20 28 6c 69 73 74 20 72 75  (append (list ru
14d0: 6e 6e 61 6d 65 29 20 6b 65 79 76 61 6c 73 29 29  nname) keyvals))
14e0: 0a 09 20 28 6b 65 79 3d 3f 73 74 72 20 20 28 73  .. (key=?str  (s
14f0: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73  tring-interspers
1500: 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28  e (map (lambda (
1510: 6b 29 28 63 6f 6e 63 20 28 6b 65 79 3a 67 65 74  k)(conc (key:get
1520: 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 29 20 22 3d  -fieldname k) "=
1530: 3f 22 29 29 20 6b 65 79 73 29 20 22 20 41 4e 44  ?")) keys) " AND
1540: 20 22 29 29 29 0a 20 20 20 20 28 64 65 62 75 67   "))).    (debug
1550: 3a 70 72 69 6e 74 20 33 20 22 6b 65 79 73 3a 20  :print 3 "keys: 
1560: 22 20 6b 65 79 73 20 22 20 61 6c 6c 76 61 6c 73  " keys " allvals
1570: 3a 20 22 20 61 6c 6c 76 61 6c 73 20 22 20 6b 65  : " allvals " ke
1580: 79 76 61 6c 73 3a 20 22 20 6b 65 79 76 61 6c 73  yvals: " keyvals
1590: 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  ).    (debug:pri
15a0: 6e 74 20 32 20 22 4e 4f 54 45 3a 20 75 73 69 6e  nt 2 "NOTE: usin
15b0: 67 20 74 61 72 67 65 74 20 22 20 28 73 74 72 69  g target " (stri
15c0: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 6b  ng-intersperse k
15d0: 65 79 76 61 6c 73 20 22 2f 22 29 20 22 20 66 6f  eyvals "/") " fo
15e0: 72 20 74 68 69 73 20 72 75 6e 22 29 0a 20 20 20  r this run").   
15f0: 20 28 69 66 20 28 61 6e 64 20 72 75 6e 6e 61 6d   (if (and runnam
1600: 65 20 28 6e 75 6c 6c 3f 20 28 66 69 6c 74 65 72  e (null? (filter
1610: 20 28 6c 61 6d 62 64 61 20 28 78 29 28 6e 6f 74   (lambda (x)(not
1620: 20 78 29 29 20 6b 65 79 76 61 6c 73 29 29 29 20   x)) keyvals))) 
1630: 3b 3b 20 74 68 65 72 65 20 6d 75 73 74 20 62 65  ;; there must be
1640: 20 61 20 62 65 74 74 65 72 20 77 61 79 20 74 6f   a better way to
1650: 20 22 61 70 70 6c 79 20 61 6e 64 22 0a 09 28 6c   "apply and"..(l
1660: 65 74 20 28 28 72 65 73 20 23 66 29 29 0a 09 20  et ((res #f)).. 
1670: 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a   (apply sqlite3:
1680: 65 78 65 63 75 74 65 20 64 62 20 28 63 6f 6e 63  execute db (conc
1690: 20 22 49 4e 53 45 52 54 20 4f 52 20 49 47 4e 4f   "INSERT OR IGNO
16a0: 52 45 20 49 4e 54 4f 20 72 75 6e 73 20 28 72 75  RE INTO runs (ru
16b0: 6e 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74  nname,state,stat
16c0: 75 73 2c 6f 77 6e 65 72 2c 65 76 65 6e 74 5f 74  us,owner,event_t
16d0: 69 6d 65 22 20 63 6f 6d 6d 61 20 6b 65 79 73 74  ime" comma keyst
16e0: 72 20 22 29 20 56 41 4c 55 45 53 20 28 3f 2c 3f  r ") VALUES (?,?
16f0: 2c 3f 2c 3f 2c 73 74 72 66 74 69 6d 65 28 27 25  ,?,?,strftime('%
1700: 73 27 2c 27 6e 6f 77 27 29 22 20 63 6f 6d 6d 61  s','now')" comma
1710: 20 76 61 6c 73 6c 6f 74 73 20 22 29 3b 22 29 0a   valslots ");").
1720: 09 09 20 61 6c 6c 76 61 6c 73 29 0a 09 20 20 28  .. allvals)..  (
1730: 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a 66 6f  apply sqlite3:fo
1740: 72 2d 65 61 63 68 2d 72 6f 77 20 0a 09 20 20 20  r-each-row ..   
1750: 28 6c 61 6d 62 64 61 20 28 69 64 29 0a 09 20 20  (lambda (id)..  
1760: 20 20 20 28 73 65 74 21 20 72 65 73 20 69 64 29     (set! res id)
1770: 29 0a 09 20 20 20 64 62 0a 09 20 20 20 28 6c 65  )..   db..   (le
1780: 74 20 28 28 71 72 79 20 28 63 6f 6e 63 20 22 53  t ((qry (conc "S
1790: 45 4c 45 43 54 20 69 64 20 46 52 4f 4d 20 72 75  ELECT id FROM ru
17a0: 6e 73 20 57 48 45 52 45 20 28 72 75 6e 6e 61 6d  ns WHERE (runnam
17b0: 65 3d 3f 20 22 20 61 6e 64 73 74 72 20 6b 65 79  e=? " andstr key
17c0: 3d 3f 73 74 72 20 22 29 3b 22 29 29 29 0a 09 20  =?str ");"))).. 
17d0: 20 20 20 20 3b 28 64 65 62 75 67 3a 70 72 69 6e      ;(debug:prin
17e0: 74 20 34 20 22 71 72 79 3a 20 22 20 71 72 79 29  t 4 "qry: " qry)
17f0: 20 0a 09 20 20 20 20 20 71 72 79 29 0a 09 20 20   ..     qry)..  
1800: 20 71 72 79 76 61 6c 73 29 0a 09 20 20 28 73 71   qryvals)..  (sq
1810: 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 62  lite3:execute db
1820: 20 22 55 50 44 41 54 45 20 72 75 6e 73 20 53 45   "UPDATE runs SE
1830: 54 20 73 74 61 74 65 3d 3f 2c 73 74 61 74 75 73  T state=?,status
1840: 3d 3f 20 57 48 45 52 45 20 69 64 3d 3f 3b 22 20  =? WHERE id=?;" 
1850: 73 74 61 74 65 20 73 74 61 74 75 73 20 72 65 73  state status res
1860: 29 0a 09 20 20 72 65 73 29 20 0a 09 28 62 65 67  )..  res) ..(beg
1870: 69 6e 0a 09 20 20 28 64 65 62 75 67 3a 70 72 69  in..  (debug:pri
1880: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 43 61 6c  nt 0 "ERROR: Cal
1890: 6c 65 64 20 77 69 74 68 6f 75 74 20 61 6c 6c 20  led without all 
18a0: 6e 65 63 65 73 73 61 72 79 20 6b 65 79 73 22 29  necessary keys")
18b0: 0a 09 20 20 23 66 29 29 29 29 0a 0a 3b 3b 20 54  ..  #f))))..;; T
18c0: 68 69 73 20 69 73 20 61 20 64 75 70 6c 69 63 61  his is a duplica
18d0: 74 65 20 6f 66 20 72 75 6e 2d 74 65 73 74 73 20  te of run-tests 
18e0: 28 77 68 69 63 68 20 68 61 73 20 62 65 65 6e 20  (which has been 
18f0: 64 65 70 72 65 63 61 74 65 64 29 2e 20 55 73 65  deprecated). Use
1900: 20 74 68 69 73 20 6f 6e 65 20 69 6e 73 74 65 61   this one instea
1910: 64 20 6f 66 20 72 75 6e 20 74 65 73 74 73 2e 0a  d of run tests..
1920: 3b 3b 20 6b 65 79 76 61 6c 73 0a 28 64 65 66 69  ;; keyvals.(defi
1930: 6e 65 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73  ne (runs:run-tes
1940: 74 73 20 64 62 20 74 61 72 67 65 74 20 72 75 6e  ts db target run
1950: 6e 61 6d 65 20 74 65 73 74 2d 70 61 74 74 73 20  name test-patts 
1960: 69 74 65 6d 2d 70 61 74 74 73 20 75 73 65 72 20  item-patts user 
1970: 66 6c 61 67 73 29 0a 20 20 28 6c 65 74 2a 20 28  flags).  (let* (
1980: 28 6b 65 79 73 20 20 20 20 20 20 20 20 28 72 64  (keys        (rd
1990: 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a  b:get-keys db)).
19a0: 09 20 28 6b 65 79 76 61 6c 6c 73 74 20 20 20 28  . (keyvallst   (
19b0: 6b 65 79 73 3a 74 61 72 67 65 74 2d 3e 6b 65 79  keys:target->key
19c0: 76 61 6c 20 6b 65 79 73 20 74 61 72 67 65 74 29  val keys target)
19d0: 29 0a 09 20 28 72 75 6e 2d 69 64 20 20 20 20 20  ).. (run-id     
19e0: 20 28 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d   (runs:register-
19f0: 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76  run db keys keyv
1a00: 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e  allst runname "n
1a10: 65 77 22 20 22 6e 2f 61 22 20 75 73 65 72 29 29  ew" "n/a" user))
1a20: 20 20 3b 3b 20 20 74 65 73 74 2d 6e 61 6d 65 29    ;;  test-name)
1a30: 29 29 0a 09 20 28 64 65 66 65 72 72 65 64 20 20  )).. (deferred  
1a40: 20 20 27 28 29 29 20 3b 3b 20 64 65 6c 61 79 20    '()) ;; delay 
1a50: 72 75 6e 6e 69 6e 67 20 74 68 65 73 65 20 73 69  running these si
1a60: 6e 63 65 20 74 68 65 79 20 68 61 76 65 20 61 20  nce they have a 
1a70: 77 61 69 74 6f 6e 20 63 6c 61 75 73 65 0a 09 20  waiton clause.. 
1a80: 3b 3b 20 6b 65 65 70 67 6f 69 6e 67 20 69 73 20  ;; keepgoing is 
1a90: 74 68 65 20 64 65 66 61 63 74 6f 20 6d 6f 64 61  the defacto moda
1aa0: 6c 69 74 79 20 6e 6f 77 2c 20 77 69 6c 6c 20 61  lity now, will a
1ab0: 64 64 20 68 69 74 2d 6e 2d 72 75 6e 20 61 20 62  dd hit-n-run a b
1ac0: 69 74 20 6c 61 74 65 72 0a 09 20 3b 3b 20 28 6b  it later.. ;; (k
1ad0: 65 65 70 67 6f 69 6e 67 20 20 20 28 68 61 73 68  eepgoing   (hash
1ae0: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75  -table-ref/defau
1af0: 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 65 70 67  lt flags "-keepg
1b00: 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 28 74 65  oing" #f)).. (te
1b10: 73 74 2d 6e 61 6d 65 73 20 20 27 28 29 29 0a 09  st-names  '())..
1b20: 20 28 72 75 6e 63 6f 6e 66 69 67 66 20 20 20 28   (runconfigf   (
1b30: 63 6f 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a 20  conc  *toppath* 
1b40: 22 2f 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e  "/runconfigs.con
1b50: 66 69 67 22 29 29 0a 09 20 28 72 65 71 75 69 72  fig")).. (requir
1b60: 65 64 2d 74 65 73 74 73 20 27 28 29 29 0a 09 20  ed-tests '()).. 
1b70: 28 74 65 73 74 2d 72 65 63 6f 72 64 73 20 28 6d  (test-records (m
1b80: 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29  ake-hash-table))
1b90: 29 0a 0a 20 20 20 20 28 73 65 74 2d 6d 65 67 61  )..    (set-mega
1ba0: 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 64 62  test-env-vars db
1bb0: 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73   run-id) ;; thes
1bc0: 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64 20  e may be needed 
1bd0: 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e 67  by the launching
1be0: 20 70 72 6f 63 65 73 73 0a 0a 20 20 20 20 28 69   process..    (i
1bf0: 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20  f (file-exists? 
1c00: 72 75 6e 63 6f 6e 66 69 67 66 29 0a 09 28 73 65  runconfigf)..(se
1c10: 74 75 70 2d 65 6e 76 2d 64 65 66 61 75 6c 74 73  tup-env-defaults
1c20: 20 64 62 20 72 75 6e 63 6f 6e 66 69 67 66 20 72   db runconfigf r
1c30: 75 6e 2d 69 64 20 2a 61 6c 72 65 61 64 79 2d 73  un-id *already-s
1c40: 65 65 6e 2d 72 75 6e 63 6f 6e 66 69 67 2d 69 6e  een-runconfig-in
1c50: 66 6f 2a 20 22 70 72 65 2d 6c 61 75 6e 63 68 2d  fo* "pre-launch-
1c60: 65 6e 76 2d 76 61 72 73 22 29 0a 09 28 64 65 62  env-vars")..(deb
1c70: 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e  ug:print 0 "WARN
1c80: 49 4e 47 3a 20 59 6f 75 20 64 6f 20 6e 6f 74 20  ING: You do not 
1c90: 68 61 76 65 20 61 20 72 75 6e 20 63 6f 6e 66 69  have a run confi
1ca0: 67 20 66 69 6c 65 3a 20 22 20 72 75 6e 63 6f 6e  g file: " runcon
1cb0: 66 69 67 66 29 29 0a 20 20 20 20 0a 20 20 20 20  figf)).    .    
1cc0: 3b 3b 20 6c 6f 6f 6b 20 75 70 20 61 6c 6c 20 74  ;; look up all t
1cd0: 65 73 74 73 20 6d 61 74 63 68 69 6e 67 20 74 68  ests matching th
1ce0: 65 20 63 6f 6d 6d 61 20 73 65 70 61 72 61 74 65  e comma separate
1cf0: 64 20 6c 69 73 74 20 6f 66 20 67 6c 6f 62 73 20  d list of globs 
1d00: 69 6e 0a 20 20 20 20 3b 3b 20 74 65 73 74 2d 70  in.    ;; test-p
1d10: 61 74 74 73 20 28 75 73 69 6e 67 20 25 20 61 73  atts (using % as
1d20: 20 77 69 6c 64 63 61 72 64 29 0a 20 20 20 20 28   wildcard).    (
1d30: 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28  for-each .     (
1d40: 6c 61 6d 62 64 61 20 28 70 61 74 74 29 0a 20 20  lambda (patt).  
1d50: 20 20 20 20 20 28 6c 65 74 20 28 28 74 65 73 74       (let ((test
1d60: 73 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20 2a 74  s (glob (conc *t
1d70: 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f  oppath* "/tests/
1d80: 22 20 28 73 74 72 69 6e 67 2d 74 72 61 6e 73 6c  " (string-transl
1d90: 61 74 65 20 70 61 74 74 20 22 25 22 20 22 2a 22  ate patt "%" "*"
1da0: 29 29 29 29 29 0a 09 20 28 73 65 74 21 20 74 65  ))))).. (set! te
1db0: 73 74 73 20 28 66 69 6c 74 65 72 20 28 6c 61 6d  sts (filter (lam
1dc0: 62 64 61 20 28 74 65 73 74 29 28 66 69 6c 65 2d  bda (test)(file-
1dd0: 65 78 69 73 74 73 3f 20 28 63 6f 6e 63 20 74 65  exists? (conc te
1de0: 73 74 20 22 2f 74 65 73 74 63 6f 6e 66 69 67 22  st "/testconfig"
1df0: 29 29 29 20 74 65 73 74 73 29 29 0a 09 20 28 73  ))) tests)).. (s
1e00: 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 28  et! test-names (
1e10: 61 70 70 65 6e 64 20 74 65 73 74 2d 6e 61 6d 65  append test-name
1e20: 73 20 0a 09 09 09 09 20 20 28 6d 61 70 20 28 6c  s .....  (map (l
1e30: 61 6d 62 64 61 20 28 74 65 73 74 70 29 0a 09 09  ambda (testp)...
1e40: 09 09 09 20 28 6c 61 73 74 20 28 73 74 72 69 6e  ... (last (strin
1e50: 67 2d 73 70 6c 69 74 20 74 65 73 74 70 20 22 2f  g-split testp "/
1e60: 22 29 29 29 0a 09 09 09 09 20 20 20 20 20 20 20  "))).....       
1e70: 74 65 73 74 73 29 29 29 29 29 0a 20 20 20 20 20  tests))))).     
1e80: 28 69 66 20 74 65 73 74 2d 70 61 74 74 73 20 28  (if test-patts (
1e90: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 74 65 73  string-split tes
1ea0: 74 2d 70 61 74 74 73 20 22 2c 22 29 28 6c 69 73  t-patts ",")(lis
1eb0: 74 20 22 25 22 29 29 29 0a 0a 20 20 20 20 20 3b  t "%")))..     ;
1ec0: 3b 20 6e 6f 77 20 72 65 6d 6f 76 65 20 64 75 70  ; now remove dup
1ed0: 6c 69 63 61 74 65 73 0a 20 20 20 20 28 73 65 74  licates.    (set
1ee0: 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 28 64 65  ! test-names (de
1ef0: 6c 65 74 65 2d 64 75 70 6c 69 63 61 74 65 73 20  lete-duplicates 
1f00: 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 0a 20 20  test-names))..  
1f10: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
1f20: 20 22 49 4e 46 4f 3a 20 74 65 73 74 20 6e 61 6d   "INFO: test nam
1f30: 65 73 20 22 20 74 65 73 74 2d 6e 61 6d 65 73 29  es " test-names)
1f40: 0a 0a 20 20 20 20 3b 3b 20 6f 6e 20 74 68 65 20  ..    ;; on the 
1f50: 66 69 72 73 74 20 70 61 73 73 20 6f 72 20 63 61  first pass or ca
1f60: 6c 6c 20 74 6f 20 72 75 6e 2d 74 65 73 74 73 20  ll to run-tests 
1f70: 73 65 74 20 46 41 49 4c 53 20 74 6f 20 4e 4f 54  set FAILS to NOT
1f80: 5f 53 54 41 52 54 45 44 20 69 66 0a 20 20 20 20  _STARTED if.    
1f90: 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 20 69 73  ;; -keepgoing is
1fa0: 20 73 70 65 63 69 66 69 65 64 0a 20 20 20 20 28   specified.    (
1fb0: 69 66 20 28 65 71 3f 20 2a 70 61 73 73 6e 75 6d  if (eq? *passnum
1fc0: 2a 20 30 29 0a 09 28 62 65 67 69 6e 0a 09 20 20  * 0)..(begin..  
1fd0: 3b 3b 20 68 61 76 65 20 74 6f 20 64 65 6c 65 74  ;; have to delet
1fe0: 65 20 74 65 73 74 20 72 65 63 6f 72 64 73 20 77  e test records w
1ff0: 68 65 72 65 20 4e 4f 54 5f 53 54 41 52 54 45 44  here NOT_STARTED
2000: 20 73 69 6e 63 65 20 74 68 65 79 20 63 61 6e 20   since they can 
2010: 63 61 75 73 65 20 2d 6b 65 65 70 67 6f 69 6e 67  cause -keepgoing
2020: 20 74 6f 20 0a 09 20 20 3b 3b 20 67 65 74 20 73   to ..  ;; get s
2030: 74 75 63 6b 20 64 75 65 20 74 6f 20 62 65 63 6f  tuck due to beco
2040: 6d 69 6e 67 20 69 6e 61 63 63 65 73 73 69 62 6c  ming inaccessibl
2050: 65 20 66 72 6f 6d 20 61 20 66 61 69 6c 65 64 20  e from a failed 
2060: 74 65 73 74 2e 20 49 2e 65 2e 20 69 66 20 74 65  test. I.e. if te
2070: 73 74 20 42 20 64 65 70 65 6e 64 73 20 0a 09 20  st B depends .. 
2080: 20 3b 3b 20 6f 6e 20 74 65 73 74 20 41 20 62 75   ;; on test A bu
2090: 74 20 74 65 73 74 20 42 20 72 65 61 63 68 65 64  t test B reached
20a0: 20 74 68 65 20 70 6f 69 6e 74 20 6f 6e 20 62 65   the point on be
20b0: 69 6e 67 20 72 65 67 69 73 74 65 72 65 64 20 61  ing registered a
20c0: 73 20 4e 4f 54 5f 53 54 41 52 54 45 44 20 61 6e  s NOT_STARTED an
20d0: 64 20 74 65 73 74 0a 09 20 20 3b 3b 20 41 20 66  d test..  ;; A f
20e0: 61 69 6c 65 64 20 66 6f 72 20 73 6f 6d 65 20 72  ailed for some r
20f0: 65 61 73 6f 6e 20 74 68 65 6e 20 6f 6e 20 72 65  eason then on re
2100: 2d 72 75 6e 20 75 73 69 6e 67 20 2d 6b 65 65 70  -run using -keep
2110: 67 6f 69 6e 67 20 74 68 65 20 72 75 6e 20 63 61  going the run ca
2120: 6e 20 6e 65 76 65 72 20 63 6f 6d 70 6c 65 74 65  n never complete
2130: 2e 0a 09 20 20 28 64 62 3a 64 65 6c 65 74 65 2d  ...  (db:delete-
2140: 74 65 73 74 73 2d 69 6e 2d 73 74 61 74 65 20 64  tests-in-state d
2150: 62 20 72 75 6e 2d 69 64 20 22 4e 4f 54 5f 53 54  b run-id "NOT_ST
2160: 41 52 54 45 44 22 29 0a 09 20 20 28 72 64 62 3a  ARTED")..  (rdb:
2170: 73 65 74 2d 74 65 73 74 73 2d 73 74 61 74 65 2d  set-tests-state-
2180: 73 74 61 74 75 73 20 64 62 20 72 75 6e 2d 69 64  status db run-id
2190: 20 74 65 73 74 2d 6e 61 6d 65 73 20 23 66 20 22   test-names #f "
21a0: 46 41 49 4c 22 20 22 4e 4f 54 5f 53 54 41 52 54  FAIL" "NOT_START
21b0: 45 44 22 20 22 46 41 49 4c 22 29 29 29 0a 0a 20  ED" "FAIL"))).. 
21c0: 20 20 20 3b 3b 20 6e 6f 77 20 61 64 64 20 6e 6f     ;; now add no
21d0: 6e 2d 64 69 72 65 63 74 6c 79 20 72 65 66 65 72  n-directly refer
21e0: 65 6e 63 65 64 20 64 65 70 65 6e 64 65 6e 63 69  enced dependenci
21f0: 65 73 20 28 69 2e 65 2e 20 77 61 69 74 6f 6e 29  es (i.e. waiton)
2200: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e  .    (if (not (n
2210: 75 6c 6c 3f 20 74 65 73 74 2d 6e 61 6d 65 73 29  ull? test-names)
2220: 29 0a 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68  )..(let loop ((h
2230: 65 64 20 28 63 61 72 20 74 65 73 74 2d 6e 61 6d  ed (car test-nam
2240: 65 73 29 29 0a 09 09 20 20 20 28 74 61 6c 20 28  es))...   (tal (
2250: 63 64 72 20 74 65 73 74 2d 6e 61 6d 65 73 29 29  cdr test-names))
2260: 29 20 20 20 20 20 20 20 20 20 3b 3b 20 27 72 65  )         ;; 're
2270: 74 75 72 6e 2d 70 72 6f 63 73 20 74 65 6c 6c 73  turn-procs tells
2280: 20 74 68 65 20 63 6f 6e 66 69 67 20 72 65 61 64   the config read
2290: 65 72 20 74 6f 20 70 72 65 70 20 72 75 6e 6e 69  er to prep runni
22a0: 6e 67 20 73 79 73 74 65 6d 20 62 75 74 20 72 65  ng system but re
22b0: 74 75 72 6e 20 61 20 70 72 6f 63 0a 09 20 20 28  turn a proc..  (
22c0: 6c 65 74 2a 20 28 28 63 6f 6e 66 69 67 20 20 28  let* ((config  (
22d0: 74 65 73 74 73 3a 67 65 74 2d 74 65 73 74 63 6f  tests:get-testco
22e0: 6e 66 69 67 20 68 65 64 20 27 72 65 74 75 72 6e  nfig hed 'return
22f0: 2d 70 72 6f 63 73 29 29 0a 09 09 20 28 77 61 69  -procs))... (wai
2300: 74 6f 6e 73 20 28 73 74 72 69 6e 67 2d 73 70 6c  tons (string-spl
2310: 69 74 20 28 6c 65 74 20 28 28 77 20 28 63 6f 6e  it (let ((w (con
2320: 66 69 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69  fig-lookup confi
2330: 67 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22  g "requirements"
2340: 20 22 77 61 69 74 6f 6e 22 29 29 29 0a 09 09 09   "waiton")))....
2350: 09 09 20 20 28 69 66 20 77 20 77 20 22 22 29 29  ..  (if w w ""))
2360: 29 29 29 0a 09 20 20 20 20 3b 3b 20 28 69 74 65  )))..    ;; (ite
2370: 6d 73 20 20 20 28 69 74 65 6d 73 3a 67 65 74 2d  ms   (items:get-
2380: 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69  items-from-confi
2390: 67 20 63 6f 6e 66 69 67 29 29 29 0a 09 20 20 20  g config)))..   
23a0: 20 28 69 66 20 28 6e 6f 74 20 28 68 61 73 68 2d   (if (not (hash-
23b0: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c  table-ref/defaul
23c0: 74 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 68  t test-records h
23d0: 65 64 20 23 66 29 29 0a 09 09 28 68 61 73 68 2d  ed #f))...(hash-
23e0: 74 61 62 6c 65 2d 73 65 74 21 20 74 65 73 74 2d  table-set! test-
23f0: 72 65 63 6f 72 64 73 0a 09 09 09 09 20 68 65 64  records..... hed
2400: 20 28 76 65 63 74 6f 72 20 68 65 64 20 20 20 20   (vector hed    
2410: 20 3b 3b 20 30 0a 09 09 09 09 09 20 20 20 20 20   ;; 0......     
2420: 63 6f 6e 66 69 67 20 20 3b 3b 20 31 0a 09 09 09  config  ;; 1....
2430: 09 09 20 20 20 20 20 77 61 69 74 6f 6e 73 20 3b  ..     waitons ;
2440: 3b 20 32 0a 09 09 09 09 09 20 20 20 20 20 28 63  ; 2......     (c
2450: 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e  onfig-lookup con
2460: 66 69 67 20 22 72 65 71 75 69 72 65 6d 65 6e 74  fig "requirement
2470: 73 22 20 22 70 72 69 6f 72 69 74 79 22 29 20 20  s" "priority")  
2480: 20 20 20 3b 3b 20 70 72 69 6f 72 69 74 79 20 33     ;; priority 3
2490: 0a 09 09 09 09 09 20 20 20 20 20 28 6c 65 74 20  ......     (let 
24a0: 28 28 69 74 65 6d 73 20 20 20 20 20 20 28 68 61  ((items      (ha
24b0: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66  sh-table-ref/def
24c0: 61 75 6c 74 20 63 6f 6e 66 69 67 20 22 69 74 65  ault config "ite
24d0: 6d 73 22 20 23 66 29 29 20 3b 3b 20 69 74 65 6d  ms" #f)) ;; item
24e0: 73 20 34 0a 09 09 09 09 09 09 20 20 20 28 69 74  s 4.......   (it
24f0: 65 6d 73 74 61 62 6c 65 20 28 68 61 73 68 2d 74  emstable (hash-t
2500: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74  able-ref/default
2510: 20 63 6f 6e 66 69 67 20 22 69 74 65 6d 73 74 61   config "itemsta
2520: 62 6c 65 22 20 23 66 29 29 29 20 0a 09 09 09 09  ble" #f))) .....
2530: 09 20 20 20 20 20 20 20 3b 3b 20 69 66 20 65 69  .       ;; if ei
2540: 74 68 65 72 20 69 74 65 6d 73 20 6f 72 20 69 74  ther items or it
2550: 65 6d 73 20 74 61 62 6c 65 20 69 73 20 61 20 70  ems table is a p
2560: 72 6f 63 20 72 65 74 75 72 6e 20 69 74 20 73 6f  roc return it so
2570: 20 74 65 73 74 20 72 75 6e 6e 69 6e 67 0a 09 09   test running...
2580: 09 09 09 20 20 20 20 20 20 20 3b 3b 20 70 72 6f  ...       ;; pro
2590: 63 65 73 73 20 63 61 6e 20 6b 6e 6f 77 20 74 6f  cess can know to
25a0: 20 63 61 6c 6c 20 69 74 65 6d 73 3a 67 65 74 2d   call items:get-
25b0: 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69  items-from-confi
25c0: 67 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b  g......       ;;
25d0: 20 69 66 20 65 69 74 68 65 72 20 69 73 20 61 20   if either is a 
25e0: 6c 69 73 74 20 61 6e 64 20 6e 6f 6e 65 20 69 73  list and none is
25f0: 20 61 20 70 72 6f 63 20 67 6f 20 61 68 65 61 64   a proc go ahead
2600: 20 61 6e 64 20 63 61 6c 6c 20 67 65 74 2d 69 74   and call get-it
2610: 65 6d 73 0a 09 09 09 09 09 20 20 20 20 20 20 20  ems......       
2620: 3b 3b 20 6f 74 68 65 72 77 69 73 65 20 72 65 74  ;; otherwise ret
2630: 75 72 6e 20 23 66 20 2d 20 74 68 69 73 20 69 73  urn #f - this is
2640: 20 6e 6f 74 20 61 6e 20 69 74 65 72 61 74 65 64   not an iterated
2650: 20 74 65 73 74 0a 09 09 09 09 09 20 20 20 20 20   test......     
2660: 20 20 28 63 6f 6e 64 0a 09 09 09 09 09 09 28 28    (cond.......((
2670: 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73  procedure? items
2680: 29 20 20 20 20 20 20 0a 09 09 09 09 09 09 20 28  )      ....... (
2690: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49  debug:print 4 "I
26a0: 4e 46 4f 3a 20 69 74 65 6d 73 20 69 73 20 61 20  NFO: items is a 
26b0: 70 72 6f 63 65 64 75 72 65 2c 20 77 69 6c 6c 20  procedure, will 
26c0: 63 61 6c 63 20 6c 61 74 65 72 22 29 0a 09 09 09  calc later")....
26d0: 09 09 09 20 69 74 65 6d 73 29 20 20 20 20 20 20  ... items)      
26e0: 20 20 20 20 20 20 3b 3b 20 63 61 6c 63 20 6c 61        ;; calc la
26f0: 74 65 72 0a 09 09 09 09 09 09 28 28 70 72 6f 63  ter.......((proc
2700: 65 64 75 72 65 3f 20 69 74 65 6d 73 74 61 62 6c  edure? itemstabl
2710: 65 29 0a 09 09 09 09 09 09 20 28 64 65 62 75 67  e)....... (debug
2720: 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20  :print 4 "INFO: 
2730: 69 74 65 6d 73 74 61 62 6c 65 20 69 73 20 61 20  itemstable is a 
2740: 70 72 6f 63 65 64 75 72 65 2c 20 77 69 6c 6c 20  procedure, will 
2750: 63 61 6c 63 20 6c 61 74 65 72 22 29 0a 09 09 09  calc later")....
2760: 09 09 09 20 69 74 65 6d 73 74 61 62 6c 65 29 20  ... itemstable) 
2770: 20 20 20 20 20 20 3b 3b 20 63 61 6c 63 20 6c 61        ;; calc la
2780: 74 65 72 0a 09 09 09 09 09 09 28 28 66 69 6c 74  ter.......((filt
2790: 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29 0a 09  er (lambda (x)..
27a0: 09 09 09 09 09 09 20 20 20 28 6c 65 74 20 28 28  ......   (let ((
27b0: 76 61 6c 20 28 63 61 72 20 78 29 29 29 0a 09 09  val (car x)))...
27c0: 09 09 09 09 09 20 20 20 20 20 28 69 66 20 28 70  .....     (if (p
27d0: 72 6f 63 65 64 75 72 65 3f 20 76 61 6c 29 20 76  rocedure? val) v
27e0: 61 6c 20 23 66 29 29 29 0a 09 09 09 09 09 09 09  al #f)))........
27f0: 20 28 61 70 70 65 6e 64 20 28 69 66 20 28 6c 69   (append (if (li
2800: 73 74 3f 20 69 74 65 6d 73 29 20 69 74 65 6d 73  st? items) items
2810: 20 27 28 29 29 0a 09 09 09 09 09 09 09 09 20 28   '())......... (
2820: 69 66 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 74  if (list? itemst
2830: 61 62 6c 65 29 20 69 74 65 6d 73 74 61 62 6c 65  able) itemstable
2840: 20 27 28 29 29 29 29 0a 09 09 09 09 09 09 20 27   '())))....... '
2850: 68 61 76 65 2d 70 72 6f 63 65 64 75 72 65 29 0a  have-procedure).
2860: 09 09 09 09 09 09 28 28 6f 72 20 28 6c 69 73 74  ......((or (list
2870: 3f 20 69 74 65 6d 73 29 28 6c 69 73 74 3f 20 69  ? items)(list? i
2880: 74 65 6d 73 74 61 62 6c 65 29 29 20 3b 3b 20 63  temstable)) ;; c
2890: 61 6c 63 20 6e 6f 77 0a 09 09 09 09 09 09 20 28  alc now....... (
28a0: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49  debug:print 4 "I
28b0: 4e 46 4f 3a 20 69 74 65 6d 73 20 61 6e 64 20 69  NFO: items and i
28c0: 74 65 6d 73 74 61 62 6c 65 20 61 72 65 20 6c 69  temstable are li
28d0: 73 74 73 2c 20 63 61 6c 63 20 6e 6f 77 5c 6e 22  sts, calc now\n"
28e0: 0a 09 09 09 09 09 09 09 20 20 20 20 20 20 22 20  ........      " 
28f0: 20 20 20 69 74 65 6d 73 3a 20 22 20 69 74 65 6d     items: " item
2900: 73 20 22 20 69 74 65 6d 73 74 61 62 6c 65 3a 20  s " itemstable: 
2910: 22 20 69 74 65 6d 73 74 61 62 6c 65 29 0a 09 09  " itemstable)...
2920: 09 09 09 09 20 28 69 74 65 6d 73 3a 67 65 74 2d  .... (items:get-
2930: 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69  items-from-confi
2940: 67 20 63 6f 6e 66 69 67 29 29 0a 09 09 09 09 09  g config))......
2950: 09 28 65 6c 73 65 20 23 66 29 29 29 20 20 20 20  .(else #f)))    
2960: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
2970: 20 20 20 20 20 20 20 3b 3b 20 6e 6f 74 20 69 74         ;; not it
2980: 65 72 61 74 65 64 0a 09 09 09 09 09 20 20 20 20  erated......    
2990: 20 23 66 20 20 20 20 20 20 3b 3b 20 69 74 65 6d   #f      ;; item
29a0: 73 64 61 74 20 35 0a 09 09 09 09 09 20 20 20 20  sdat 5......    
29b0: 20 23 66 20 20 20 20 20 20 3b 3b 20 73 70 61 72   #f      ;; spar
29c0: 65 20 2d 20 75 73 65 64 20 66 6f 72 20 69 74 65  e - used for ite
29d0: 6d 2d 70 61 74 68 0a 09 09 09 09 09 20 20 20 20  m-path......    
29e0: 20 29 29 29 0a 09 20 20 20 20 28 66 6f 72 2d 65   )))..    (for-e
29f0: 61 63 68 20 0a 09 20 20 20 20 20 28 6c 61 6d 62  ach ..     (lamb
2a00: 64 61 20 28 77 61 69 74 6f 6e 29 0a 09 20 20 20  da (waiton)..   
2a10: 20 20 20 20 28 69 66 20 28 61 6e 64 20 77 61 69      (if (and wai
2a20: 74 6f 6e 20 28 6e 6f 74 20 28 6d 65 6d 62 65 72  ton (not (member
2a30: 20 77 61 69 74 6f 6e 20 74 65 73 74 2d 6e 61 6d   waiton test-nam
2a40: 65 73 29 29 29 0a 09 09 20 20 20 28 62 65 67 69  es)))...   (begi
2a50: 6e 0a 09 09 20 20 20 20 20 28 73 65 74 21 20 72  n...     (set! r
2a60: 65 71 75 69 72 65 64 2d 74 65 73 74 73 20 28 63  equired-tests (c
2a70: 6f 6e 73 20 77 61 69 74 6f 6e 20 72 65 71 75 69  ons waiton requi
2a80: 72 65 64 2d 74 65 73 74 73 29 29 0a 09 09 20 20  red-tests))...  
2a90: 20 20 20 28 73 65 74 21 20 74 65 73 74 2d 6e 61     (set! test-na
2aa0: 6d 65 73 20 28 63 6f 6e 73 20 77 61 69 74 6f 6e  mes (cons waiton
2ab0: 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 29 29   test-names)))))
2ac0: 20 3b 3b 20 77 61 73 20 61 6e 20 61 70 70 65 6e   ;; was an appen
2ad0: 64 2c 20 6e 6f 77 20 61 20 63 6f 6e 73 0a 09 20  d, now a cons.. 
2ae0: 20 20 20 20 77 61 69 74 6f 6e 73 29 0a 09 20 20      waitons)..  
2af0: 20 20 28 6c 65 74 20 28 28 72 65 6d 74 65 73 74    (let ((remtest
2b00: 73 20 28 64 65 6c 65 74 65 2d 64 75 70 6c 69 63  s (delete-duplic
2b10: 61 74 65 73 20 28 61 70 70 65 6e 64 20 77 61 69  ates (append wai
2b20: 74 6f 6e 73 20 74 61 6c 29 29 29 29 0a 09 20 20  tons tal))))..  
2b30: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75      (if (not (nu
2b40: 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29 29 0a 09  ll? remtests))..
2b50: 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 72 65  .  (loop (car re
2b60: 6d 74 65 73 74 73 29 28 63 64 72 20 72 65 6d 74  mtests)(cdr remt
2b70: 65 73 74 73 29 29 29 29 29 29 29 0a 0a 20 20 20  ests)))))))..   
2b80: 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f   (if (not (null?
2b90: 20 72 65 71 75 69 72 65 64 2d 74 65 73 74 73 29   required-tests)
2ba0: 29 0a 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20  )..(debug:print 
2bb0: 31 20 22 49 4e 46 4f 3a 20 41 64 64 69 6e 67 20  1 "INFO: Adding 
2bc0: 22 20 72 65 71 75 69 72 65 64 2d 74 65 73 74 73  " required-tests
2bd0: 20 22 20 74 6f 20 74 68 65 20 72 75 6e 20 71 75   " to the run qu
2be0: 65 75 65 22 29 29 0a 20 20 20 20 3b 3b 20 4e 4f  eue")).    ;; NO
2bf0: 54 45 3a 20 74 68 65 73 65 20 61 72 65 20 61 6c  TE: these are al
2c00: 6c 20 70 61 72 65 6e 74 20 74 65 73 74 73 2c 20  l parent tests, 
2c10: 69 74 65 6d 73 20 61 72 65 20 6e 6f 74 20 65 78  items are not ex
2c20: 70 61 6e 64 65 64 20 79 65 74 2e 0a 20 20 20 20  panded yet..    
2c30: 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d  (runs:run-tests-
2c40: 71 75 65 75 65 20 64 62 20 72 75 6e 2d 69 64 20  queue db run-id 
2c50: 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d 72 65 63  runname test-rec
2c60: 6f 72 64 73 20 6b 65 79 76 61 6c 6c 73 74 20 66  ords keyvallst f
2c70: 6c 61 67 73 29 0a 20 20 20 20 28 69 66 20 2a 72  lags).    (if *r
2c80: 70 63 3a 6c 69 73 74 65 6e 65 72 2a 20 28 73 65  pc:listener* (se
2c90: 72 76 65 72 3a 6b 65 65 70 2d 72 75 6e 6e 69 6e  rver:keep-runnin
2ca0: 67 20 64 62 29 29 0a 20 20 20 20 28 64 65 62 75  g db)).    (debu
2cb0: 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a  g:print 4 "INFO:
2cc0: 20 41 6c 6c 20 64 6f 6e 65 20 62 79 20 68 65 72   All done by her
2cd0: 65 22 29 29 29 0a 0a 3b 3b 20 74 65 73 74 2d 72  e")))..;; test-r
2ce0: 65 63 6f 72 64 73 20 69 73 20 61 20 68 61 73 68  ecords is a hash
2cf0: 20 74 61 62 6c 65 20 74 65 73 74 6e 61 6d 65 3a   table testname:
2d00: 69 74 65 6d 5f 70 61 74 68 20 3d 3e 20 76 65 63  item_path => vec
2d10: 74 6f 72 20 3c 20 74 65 73 74 6e 61 6d 65 20 74  tor < testname t
2d20: 65 73 74 63 6f 6e 66 69 67 20 77 61 69 74 6f 6e  estconfig waiton
2d30: 73 20 70 72 69 6f 72 69 74 79 20 69 74 65 6d 73  s priority items
2d40: 2d 69 6e 66 6f 20 2e 2e 2e 20 3e 0a 28 64 65 66  -info ... >.(def
2d50: 69 6e 65 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65  ine (runs:run-te
2d60: 73 74 73 2d 71 75 65 75 65 20 64 62 20 72 75 6e  sts-queue db run
2d70: 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74  -id runname test
2d80: 2d 72 65 63 6f 72 64 73 20 6b 65 79 76 61 6c 6c  -records keyvall
2d90: 73 74 20 66 6c 61 67 73 29 0a 20 20 20 20 3b 3b  st flags).    ;;
2da0: 20 41 74 20 74 68 69 73 20 70 6f 69 6e 74 20 74   At this point t
2db0: 68 65 20 6c 69 73 74 20 6f 66 20 70 61 72 65 6e  he list of paren
2dc0: 74 20 74 65 73 74 73 20 69 73 20 65 78 70 61 6e  t tests is expan
2dd0: 64 65 64 20 0a 20 20 20 20 3b 3b 20 4e 42 2f 2f  ded .    ;; NB//
2de0: 20 53 68 6f 75 6c 64 20 65 78 70 61 6e 64 20 69   Should expand i
2df0: 74 65 6d 73 20 68 65 72 65 20 61 6e 64 20 74 68  tems here and th
2e00: 65 6e 20 69 6e 73 65 72 74 20 69 6e 74 6f 20 74  en insert into t
2e10: 68 65 20 72 75 6e 20 71 75 65 75 65 2e 0a 20 20  he run queue..  
2e20: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 35 20 22  (debug:print 5 "
2e30: 74 65 73 74 2d 72 65 63 6f 72 64 73 3a 20 22 20  test-records: " 
2e40: 74 65 73 74 2d 72 65 63 6f 72 64 73 20 22 2c 20  test-records ", 
2e50: 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65 79  keyvallst: " key
2e60: 76 61 6c 6c 73 74 29 0a 20 20 28 6c 65 74 20 28  vallst).  (let (
2e70: 28 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d  (sorted-test-nam
2e80: 65 73 20 28 74 65 73 74 73 3a 73 6f 72 74 2d 62  es (tests:sort-b
2e90: 79 2d 70 72 69 6f 72 69 74 79 2d 61 6e 64 2d 77  y-priority-and-w
2ea0: 61 69 74 6f 6e 20 74 65 73 74 2d 72 65 63 6f 72  aiton test-recor
2eb0: 64 73 29 29 0a 09 28 69 74 65 6d 2d 70 61 74 74  ds))..(item-patt
2ec0: 73 20 20 20 20 20 20 20 20 28 68 61 73 68 2d 74  s        (hash-t
2ed0: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74  able-ref/default
2ee0: 20 66 6c 61 67 73 20 22 2d 69 74 65 6d 70 61 74   flags "-itempat
2ef0: 74 22 20 23 66 29 29 29 0a 20 20 20 20 28 6c 65  t" #f))).    (le
2f00: 74 20 6c 6f 6f 70 20 28 3b 20 28 6e 75 6d 74 69  t loop (; (numti
2f10: 6d 65 73 20 30 29 20 3b 3b 20 73 68 6f 75 6c 64  mes 0) ;; should
2f20: 6e 27 74 20 6e 65 65 64 20 74 68 69 73 0a 09 20  n't need this.. 
2f30: 20 20 20 20 20 20 28 68 65 64 20 20 20 20 20 20        (hed      
2f40: 20 20 20 28 63 61 72 20 73 6f 72 74 65 64 2d 74     (car sorted-t
2f50: 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 20 20 20  est-names))..   
2f60: 20 20 20 20 28 74 61 6c 20 20 20 20 20 20 20 20      (tal        
2f70: 20 28 63 64 72 20 73 6f 72 74 65 64 2d 74 65 73   (cdr sorted-tes
2f80: 74 2d 6e 61 6d 65 73 29 29 29 0a 20 20 20 20 20  t-names))).     
2f90: 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 72 65   (let* ((test-re
2fa0: 63 6f 72 64 20 28 68 61 73 68 2d 74 61 62 6c 65  cord (hash-table
2fb0: 2d 72 65 66 20 74 65 73 74 2d 72 65 63 6f 72 64  -ref test-record
2fc0: 73 20 68 65 64 29 29 0a 09 20 20 20 20 20 28 74  s hed))..     (t
2fd0: 63 6f 6e 66 69 67 20 20 20 20 20 28 74 65 73 74  config     (test
2fe0: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d  s:testqueue-get-
2ff0: 74 65 73 74 63 6f 6e 66 69 67 20 74 65 73 74 2d  testconfig test-
3000: 72 65 63 6f 72 64 29 29 0a 09 20 20 20 20 20 28  record))..     (
3010: 77 61 69 74 6f 6e 73 20 20 20 20 20 28 74 65 73  waitons     (tes
3020: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
3030: 2d 77 61 69 74 6f 6e 73 20 20 20 20 74 65 73 74  -waitons    test
3040: 2d 72 65 63 6f 72 64 29 29 0a 09 20 20 20 20 20  -record))..     
3050: 28 70 72 69 6f 72 69 74 79 20 20 20 20 28 74 65  (priority    (te
3060: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65  sts:testqueue-ge
3070: 74 2d 70 72 69 6f 72 69 74 79 20 20 20 74 65 73  t-priority   tes
3080: 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 20 20 20  t-record))..    
3090: 20 28 69 74 65 6d 64 61 74 20 20 20 20 20 28 74   (itemdat     (t
30a0: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67  ests:testqueue-g
30b0: 65 74 2d 69 74 65 6d 64 61 74 20 20 20 20 74 65  et-itemdat    te
30c0: 73 74 2d 72 65 63 6f 72 64 29 29 20 3b 3b 20 69  st-record)) ;; i
30d0: 74 65 6d 64 61 74 20 63 61 6e 20 62 65 20 61 20  temdat can be a 
30e0: 73 74 72 69 6e 67 2c 20 6c 69 73 74 20 6f 72 20  string, list or 
30f0: 23 66 0a 09 20 20 20 20 20 28 69 74 65 6d 73 20  #f..     (items 
3100: 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73        (tests:tes
3110: 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d 73  tqueue-get-items
3120: 20 20 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72        test-recor
3130: 64 29 29 0a 09 20 20 20 20 20 28 69 74 65 6d 2d  d))..     (item-
3140: 70 61 74 68 20 20 20 28 69 74 65 6d 2d 6c 69 73  path   (item-lis
3150: 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74 29  t->path itemdat)
3160: 29 29 0a 09 28 64 65 62 75 67 3a 70 72 69 6e 74  ))..(debug:print
3170: 20 36 0a 09 09 20 20 20 20 20 22 69 74 65 6d 64   6...     "itemd
3180: 61 74 3a 20 20 20 20 20 22 20 69 74 65 6d 64 61  at:     " itemda
3190: 74 0a 09 09 20 20 20 20 20 22 5c 6e 20 20 69 74  t...     "\n  it
31a0: 65 6d 73 3a 20 20 20 20 20 22 20 69 74 65 6d 73  ems:     " items
31b0: 0a 09 09 20 20 20 20 20 22 5c 6e 20 20 69 74 65  ...     "\n  ite
31c0: 6d 2d 70 61 74 68 3a 20 22 20 69 74 65 6d 2d 70  m-path: " item-p
31d0: 61 74 68 29 0a 09 28 63 6f 6e 64 0a 09 20 28 28  ath)..(cond.. ((
31e0: 6e 6f 74 20 69 74 65 6d 73 29 20 3b 3b 20 77 68  not items) ;; wh
31f0: 65 6e 20 66 61 6c 73 65 20 74 68 65 20 74 65 73  en false the tes
3200: 74 20 69 73 20 6f 6b 20 74 6f 20 62 65 20 68 61  t is ok to be ha
3210: 6e 64 65 64 20 6f 66 66 20 74 6f 20 6c 61 75 6e  nded off to laun
3220: 63 68 20 28 62 75 74 20 6e 6f 74 20 62 65 66 6f  ch (but not befo
3230: 72 65 29 0a 09 20 20 28 6c 65 74 20 28 28 68 61  re)..  (let ((ha
3240: 76 65 2d 72 65 73 6f 75 72 63 65 73 20 20 28 72  ve-resources  (r
3250: 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65  uns:can-run-more
3260: 2d 74 65 73 74 73 20 64 62 20 74 65 73 74 2d 72  -tests db test-r
3270: 65 63 6f 72 64 29 29 20 3b 3b 20 6c 6f 6f 6b 20  ecord)) ;; look 
3280: 61 74 20 74 68 65 20 74 65 73 74 20 6a 6f 62 67  at the test jobg
3290: 72 6f 75 70 20 61 6e 64 20 74 6f 74 20 6a 6f 62  roup and tot job
32a0: 73 20 72 75 6e 6e 69 6e 67 0a 09 09 28 70 72 65  s running...(pre
32b0: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 28 64 62  reqs-not-met (db
32c0: 3a 67 65 74 2d 70 72 65 72 65 71 73 2d 6e 6f 74  :get-prereqs-not
32d0: 2d 6d 65 74 20 64 62 20 72 75 6e 2d 69 64 20 77  -met db run-id w
32e0: 61 69 74 6f 6e 73 20 69 74 65 6d 2d 70 61 74 68  aitons item-path
32f0: 29 29 29 0a 09 20 20 20 20 3b 3b 20 44 6f 6e 27  )))..    ;; Don'
3300: 74 20 6b 6e 6f 77 20 61 74 20 74 68 69 73 20 74  t know at this t
3310: 69 6d 65 20 69 66 20 74 68 65 20 74 65 73 74 20  ime if the test 
3320: 68 61 76 65 20 62 65 65 6e 20 6c 61 75 6e 63 68  have been launch
3330: 65 64 20 61 74 20 73 6f 6d 65 20 74 69 6d 65 20  ed at some time 
3340: 69 6e 20 74 68 65 20 70 61 73 74 0a 09 20 20 20  in the past..   
3350: 20 3b 3b 20 69 2e 65 2e 20 69 73 20 74 68 69 73   ;; i.e. is this
3360: 20 61 20 72 65 2d 6c 61 75 6e 63 68 3f 0a 09 20   a re-launch?.. 
3370: 20 20 20 28 69 66 20 28 61 6e 64 20 68 61 76 65     (if (and have
3380: 2d 72 65 73 6f 75 72 63 65 73 0a 09 09 20 20 20  -resources...   
3390: 20 20 28 6e 75 6c 6c 3f 20 70 72 65 72 65 71 73    (null? prereqs
33a0: 2d 6e 6f 74 2d 6d 65 74 29 29 0a 09 09 3b 3b 20  -not-met))...;; 
33b0: 6e 6f 20 6c 6f 6f 70 20 2d 20 64 72 6f 70 20 74  no loop - drop t
33c0: 68 6f 75 67 68 20 61 6e 64 20 75 73 65 20 74 68  hough and use th
33d0: 65 20 6c 6f 6f 70 20 61 74 20 74 68 65 20 62 6f  e loop at the bo
33e0: 74 74 6f 6d 20 0a 09 09 28 72 75 6e 3a 74 65 73  ttom ...(run:tes
33f0: 74 20 64 62 20 72 75 6e 2d 69 64 20 72 75 6e 6e  t db run-id runn
3400: 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20 74 65  ame keyvallst te
3410: 73 74 2d 72 65 63 6f 72 64 20 66 6c 61 67 73 20  st-record flags 
3420: 23 66 29 0a 09 09 3b 3b 20 65 6c 73 65 20 74 68  #f)...;; else th
3430: 65 20 72 75 6e 20 69 73 20 73 74 75 63 6b 2c 20  e run is stuck, 
3440: 74 65 6d 70 6f 72 61 72 69 6c 79 20 6f 72 20 70  temporarily or p
3450: 65 72 6d 61 6e 65 6e 74 6c 79 0a 09 09 28 6c 65  ermanently...(le
3460: 74 20 28 28 6e 65 77 74 61 6c 20 28 61 70 70 65  t ((newtal (appe
3470: 6e 64 20 74 61 6c 20 28 6c 69 73 74 20 68 65 64  nd tal (list hed
3480: 29 29 29 29 0a 09 09 20 20 3b 3b 20 63 6f 75 6c  ))))...  ;; coul
3490: 64 6e 27 74 20 72 75 6e 2c 20 74 61 6b 65 20 61  dn't run, take a
34a0: 20 62 72 65 61 74 68 65 72 0a 09 09 20 20 28 74   breather...  (t
34b0: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 30 2e 35  hread-sleep! 0.5
34c0: 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72  )...  (loop (car
34d0: 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77   newtal)(cdr new
34e0: 74 61 6c 29 29 29 29 29 29 0a 09 20 0a 09 20 3b  tal)))))).. .. ;
34f0: 3b 20 63 61 73 65 20 77 68 65 72 65 20 61 6e 20  ; case where an 
3500: 69 74 65 6d 73 20 63 61 6d 65 20 69 6e 20 61 73  items came in as
3510: 20 61 20 6c 69 73 74 20 62 65 65 6e 20 70 72 6f   a list been pro
3520: 63 65 73 73 65 64 0a 09 20 28 28 61 6e 64 20 28  cessed.. ((and (
3530: 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 20 20 20  list? items)    
3540: 20 3b 3b 20 74 68 75 73 20 77 65 20 6b 6e 6f 77   ;; thus we know
3550: 20 6f 75 72 20 69 74 65 6d 73 20 61 72 65 20 61   our items are a
3560: 6c 72 65 61 64 79 20 63 61 6c 63 75 6c 61 74 65  lready calculate
3570: 64 0a 09 20 20 20 20 20 20 20 28 6e 6f 74 20 20  d..       (not  
3580: 20 69 74 65 6d 64 61 74 29 29 20 3b 3b 20 61 6e   itemdat)) ;; an
3590: 64 20 6e 6f 74 20 79 65 74 20 65 78 70 61 6e 64  d not yet expand
35a0: 65 64 20 69 6e 74 6f 20 74 68 65 20 6c 69 73 74  ed into the list
35b0: 20 6f 66 20 74 68 69 6e 67 73 20 74 6f 20 62 65   of things to be
35c0: 20 64 6f 6e 65 0a 09 20 20 28 69 66 20 28 61 6e   done..  (if (an
35d0: 64 20 28 3e 3d 20 2a 76 65 72 62 6f 73 69 74 79  d (>= *verbosity
35e0: 2a 20 31 29 0a 09 09 20 20 20 28 3e 20 28 6c 65  * 1)...   (> (le
35f0: 6e 67 74 68 20 69 74 65 6d 73 29 20 30 29 0a 09  ngth items) 0)..
3600: 09 20 20 20 28 3e 20 28 6c 65 6e 67 74 68 20 28  .   (> (length (
3610: 63 61 72 20 69 74 65 6d 73 29 29 20 30 29 29 0a  car items)) 0)).
3620: 09 09 20 20 20 28 70 70 20 69 74 65 6d 73 29 29  ..   (pp items))
3630: 0a 09 20 20 3b 3b 20 28 69 66 20 28 3e 3d 20 2a  ..  ;; (if (>= *
3640: 76 65 72 62 6f 73 69 74 79 2a 20 35 29 0a 09 20  verbosity* 5).. 
3650: 20 3b 3b 20 20 20 20 20 28 62 65 67 69 6e 0a 09   ;;     (begin..
3660: 20 20 3b 3b 20 20 20 20 20 20 20 28 70 72 69 6e    ;;       (prin
3670: 74 20 22 69 74 65 6d 73 3a 20 22 29 20 20 20 20  t "items: ")    
3680: 20 28 70 70 20 28 69 74 65 6d 2d 61 73 73 6f 63   (pp (item-assoc
3690: 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 69 74 65 6d  ->item-list item
36a0: 73 29 29 0a 09 20 20 3b 3b 20 20 20 20 20 20 20  s))..  ;;       
36b0: 28 70 72 69 6e 74 20 22 69 74 65 6d 73 74 61 62  (print "itemstab
36c0: 6c 65 3a 20 22 29 28 70 70 20 28 69 74 65 6d 2d  le: ")(pp (item-
36d0: 74 61 62 6c 65 2d 3e 69 74 65 6d 2d 6c 69 73 74  table->item-list
36e0: 20 69 74 65 6d 73 74 61 62 6c 65 29 29 29 29 0a   itemstable)))).
36f0: 09 20 20 28 66 6f 72 2d 65 61 63 68 0a 09 20 20  .  (for-each..  
3700: 20 28 6c 61 6d 62 64 61 20 28 6d 79 2d 69 74 65   (lambda (my-ite
3710: 6d 64 61 74 29 0a 09 20 20 20 20 20 28 6c 65 74  mdat)..     (let
3720: 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d 72 65 63  * ((new-test-rec
3730: 6f 72 64 20 28 6c 65 74 20 28 28 6e 65 77 72 65  ord (let ((newre
3740: 63 20 28 6d 61 6b 65 2d 74 65 73 74 73 3a 74 65  c (make-tests:te
3750: 73 74 71 75 65 75 65 29 29 29 0a 09 09 09 09 20  stqueue)))..... 
3760: 20 20 20 20 20 20 28 76 65 63 74 6f 72 2d 63 6f        (vector-co
3770: 70 79 21 20 74 65 73 74 2d 72 65 63 6f 72 64 20  py! test-record 
3780: 6e 65 77 72 65 63 29 0a 09 09 09 09 20 20 20 20  newrec).....    
3790: 20 20 20 6e 65 77 72 65 63 29 29 0a 09 09 20 20     newrec))...  
37a0: 20 20 28 6d 79 2d 69 74 65 6d 2d 70 61 74 68 20    (my-item-path 
37b0: 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68  (item-list->path
37c0: 20 6d 79 2d 69 74 65 6d 64 61 74 29 29 0a 09 09   my-itemdat))...
37d0: 20 20 20 20 0a 09 09 20 20 20 20 3b 3b 20 33 2f      ...    ;; 3/
37e0: 32 35 2f 32 30 31 32 20 2d 20 74 68 69 73 20 6d  25/2012 - this m
37f0: 61 74 63 68 20 69 73 20 2a 61 6c 77 61 79 73 2a  atch is *always*
3800: 20 72 65 74 75 72 6e 69 6e 67 20 74 72 75 65 20   returning true 
3810: 49 20 62 65 6c 69 65 76 65 2e 20 4f 72 20 69 73  I believe. Or is
3820: 20 69 74 20 74 68 65 20 74 65 73 74 73 20 74 68   it the tests th
3830: 61 74 20 61 72 65 20 6e 6f 74 20 62 65 69 6e 67  at are not being
3840: 20 68 61 6e 64 6c 65 64 3f 0a 09 09 20 20 20 20   handled?...    
3850: 3b 3b 0a 09 09 20 20 20 20 28 69 74 65 6d 2d 6d  ;;...    (item-m
3860: 61 74 63 68 65 73 20 28 69 66 20 69 74 65 6d 2d  atches (if item-
3870: 70 61 74 74 73 20 20 20 20 20 20 20 3b 3b 20 68  patts       ;; h
3880: 65 72 65 20 77 65 20 61 72 65 20 66 69 6c 74 65  ere we are filte
3890: 72 69 6e 67 20 66 6f 72 20 6d 61 74 63 68 65 73  ring for matches
38a0: 20 77 69 74 68 20 2d 69 74 65 6d 70 61 74 74 0a   with -itempatt.
38b0: 09 09 09 09 20 20 20 20 20 20 28 6c 65 74 20 28  ....      (let (
38c0: 28 72 65 73 20 23 66 29 29 09 20 3b 3b 20 6c 6f  (res #f)). ;; lo
38d0: 6f 6b 20 74 68 72 6f 75 67 68 20 61 6c 6c 20 74  ok through all t
38e0: 68 65 20 69 74 65 6d 2d 70 61 74 74 73 20 69 66  he item-patts if
38f0: 20 64 65 66 69 6e 65 64 2c 20 66 6f 72 6d 61 74   defined, format
3900: 20 69 73 20 70 61 74 74 31 2c 70 61 74 74 32 2c   is patt1,patt2,
3910: 70 61 74 74 33 20 2e 2e 2e 20 77 69 6c 64 63 61  patt3 ... wildca
3920: 72 64 20 69 73 20 25 0a 09 09 09 09 09 28 66 6f  rd is %......(fo
3930: 72 2d 65 61 63 68 20 0a 09 09 09 09 09 20 28 6c  r-each ...... (l
3940: 61 6d 62 64 61 20 28 70 61 74 74 29 0a 09 09 09  ambda (patt)....
3950: 09 09 20 20 20 28 69 66 20 28 73 74 72 69 6e 67  ..   (if (string
3960: 2d 73 65 61 72 63 68 20 28 67 6c 6f 62 2d 3e 72  -search (glob->r
3970: 65 67 65 78 70 0a 09 09 09 09 09 09 09 20 20 20  egexp........   
3980: 20 20 20 20 28 73 74 72 69 6e 67 2d 74 72 61 6e      (string-tran
3990: 73 6c 61 74 65 20 70 61 74 74 20 22 25 22 20 22  slate patt "%" "
39a0: 2a 22 29 29 0a 09 09 09 09 09 09 09 20 20 20 20  *"))........    
39b0: 20 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 09 09    item-path)....
39c0: 09 09 20 20 20 20 20 20 20 28 73 65 74 21 20 72  ..       (set! r
39d0: 65 73 20 23 74 29 29 29 0a 09 09 09 09 09 20 28  es #t)))...... (
39e0: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 69 74 65  string-split ite
39f0: 6d 2d 70 61 74 74 73 20 22 2c 22 29 29 0a 09 09  m-patts ","))...
3a00: 09 09 09 72 65 73 29 0a 09 09 09 09 20 20 20 20  ...res).....    
3a10: 20 20 23 74 29 29 29 0a 09 20 20 20 20 20 20 20    #t)))..       
3a20: 28 69 66 20 69 74 65 6d 2d 6d 61 74 63 68 65 73  (if item-matches
3a30: 20 3b 3b 20 79 65 73 2c 20 77 65 20 77 61 6e 74   ;; yes, we want
3a40: 20 74 6f 20 70 72 6f 63 65 73 73 20 74 68 69 73   to process this
3a50: 20 69 74 65 6d 0a 09 09 20 20 20 28 6c 65 74 20   item...   (let 
3a60: 28 28 6e 65 77 74 65 73 74 6e 61 6d 65 20 28 63  ((newtestname (c
3a70: 6f 6e 63 20 68 65 64 20 22 2f 22 20 6d 79 2d 69  onc hed "/" my-i
3a80: 74 65 6d 2d 70 61 74 68 29 29 29 20 20 20 20 3b  tem-path)))    ;
3a90: 3b 20 74 65 73 74 20 6e 61 6d 65 73 20 61 72 65  ; test names are
3aa0: 20 75 6e 69 71 75 65 20 6f 6e 20 74 65 73 74 6e   unique on testn
3ab0: 61 6d 65 2f 69 74 65 6d 2d 70 61 74 68 0a 09 09  ame/item-path...
3ac0: 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74       (tests:test
3ad0: 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 73 21  queue-set-items!
3ae0: 20 20 20 20 20 6e 65 77 2d 74 65 73 74 2d 72 65       new-test-re
3af0: 63 6f 72 64 20 23 66 29 0a 09 09 20 20 20 20 20  cord #f)...     
3b00: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65  (tests:testqueue
3b10: 2d 73 65 74 2d 69 74 65 6d 64 61 74 21 20 20 20  -set-itemdat!   
3b20: 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20  new-test-record 
3b30: 6d 79 2d 69 74 65 6d 64 61 74 29 0a 09 09 20 20  my-itemdat)...  
3b40: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75     (tests:testqu
3b50: 65 75 65 2d 73 65 74 2d 69 74 65 6d 5f 70 61 74  eue-set-item_pat
3b60: 68 21 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f  h! new-test-reco
3b70: 72 64 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68 29  rd my-item-path)
3b80: 0a 09 09 20 20 20 20 20 28 68 61 73 68 2d 74 61  ...     (hash-ta
3b90: 62 6c 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65  ble-set! test-re
3ba0: 63 6f 72 64 73 20 6e 65 77 74 65 73 74 6e 61 6d  cords newtestnam
3bb0: 65 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72  e new-test-recor
3bc0: 64 29 0a 09 09 20 20 20 20 20 28 73 65 74 21 20  d)...     (set! 
3bd0: 74 61 6c 20 28 63 6f 6e 73 20 6e 65 77 74 65 73  tal (cons newtes
3be0: 74 6e 61 6d 65 20 74 61 6c 29 29 29 29 29 29 20  tname tal)))))) 
3bf0: 3b 3b 20 73 69 6e 63 65 20 74 68 65 73 65 20 61  ;; since these a
3c00: 72 65 20 69 74 65 6d 69 7a 65 64 20 63 72 65 61  re itemized crea
3c10: 74 65 20 6e 65 77 20 74 65 73 74 20 6e 61 6d 65  te new test name
3c20: 73 20 74 65 73 74 6e 61 6d 65 2f 69 74 65 6d 70  s testname/itemp
3c30: 61 74 68 0a 09 20 20 20 69 74 65 6d 73 29 0a 09  ath..   items)..
3c40: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c    (loop (car tal
3c50: 29 28 63 64 72 20 74 61 6c 29 29 29 0a 0a 09 20  )(cdr tal)))... 
3c60: 3b 3b 20 69 66 20 69 74 65 6d 73 20 69 73 20 61  ;; if items is a
3c70: 20 70 72 6f 63 20 74 68 65 6e 20 6e 65 65 64 20   proc then need 
3c80: 74 6f 20 72 75 6e 20 69 74 65 6d 73 3a 67 65 74  to run items:get
3c90: 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66  -items-from-conf
3ca0: 69 67 2c 20 67 65 74 20 74 68 65 20 6c 69 73 74  ig, get the list
3cb0: 20 61 6e 64 20 6c 6f 6f 70 20 0a 09 20 3b 3b 20   and loop .. ;; 
3cc0: 20 20 20 2d 20 62 75 74 20 6f 6e 6c 79 20 64 6f     - but only do
3cd0: 20 74 68 61 74 20 69 66 20 72 65 73 6f 75 72 63   that if resourc
3ce0: 65 73 20 65 78 69 73 74 20 74 6f 20 6b 69 63 6b  es exist to kick
3cf0: 20 6f 66 66 20 74 68 65 20 6a 6f 62 0a 09 20 28   off the job.. (
3d00: 28 6f 72 20 28 70 72 6f 63 65 64 75 72 65 3f 20  (or (procedure? 
3d10: 69 74 65 6d 73 29 28 65 71 3f 20 69 74 65 6d 73  items)(eq? items
3d20: 20 27 68 61 76 65 2d 70 72 6f 63 65 64 75 72 65   'have-procedure
3d30: 29 29 0a 09 20 20 28 69 66 20 28 61 6e 64 20 28  ))..  (if (and (
3d40: 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72  runs:can-run-mor
3d50: 65 2d 74 65 73 74 73 20 64 62 20 74 65 73 74 2d  e-tests db test-
3d60: 72 65 63 6f 72 64 29 0a 09 09 20 20 20 28 6e 75  record)...   (nu
3d70: 6c 6c 3f 20 28 64 62 3a 67 65 74 2d 70 72 65 72  ll? (db:get-prer
3d80: 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 64 62 20 72  eqs-not-met db r
3d90: 75 6e 2d 69 64 20 77 61 69 74 6f 6e 73 20 69 74  un-id waitons it
3da0: 65 6d 2d 70 61 74 68 29 29 29 0a 09 20 20 20 20  em-path)))..    
3db0: 20 20 28 6c 65 74 20 28 28 74 65 73 74 2d 6e 61    (let ((test-na
3dc0: 6d 65 20 28 74 65 73 74 73 3a 74 65 73 74 71 75  me (tests:testqu
3dd0: 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65  eue-get-testname
3de0: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 29 0a   test-record))).
3df0: 09 09 28 73 65 74 65 6e 76 20 22 4d 54 5f 54 45  ..(setenv "MT_TE
3e00: 53 54 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e 61  ST_NAME" test-na
3e10: 6d 65 29 20 3b 3b 20 0a 09 09 28 73 65 74 65 6e  me) ;; ...(seten
3e20: 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20  v "MT_RUNNAME"  
3e30: 20 72 75 6e 6e 61 6d 65 29 0a 09 09 28 73 65 74   runname)...(set
3e40: 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61  -megatest-env-va
3e50: 72 73 20 64 62 20 72 75 6e 2d 69 64 29 20 3b 3b  rs db run-id) ;;
3e60: 20 74 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65   these may be ne
3e70: 65 64 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e  eded by the laun
3e80: 63 68 69 6e 67 20 70 72 6f 63 65 73 73 0a 09 09  ching process...
3e90: 28 6c 65 74 20 28 28 69 74 65 6d 73 2d 6c 69 73  (let ((items-lis
3ea0: 74 20 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 65  t (items:get-ite
3eb0: 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 74  ms-from-config t
3ec0: 63 6f 6e 66 69 67 29 29 29 0a 09 09 20 20 28 69  config)))...  (i
3ed0: 66 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 2d 6c  f (list? items-l
3ee0: 69 73 74 29 0a 09 09 20 20 20 20 20 20 28 62 65  ist)...      (be
3ef0: 67 69 6e 0a 09 09 09 28 74 65 73 74 73 3a 74 65  gin....(tests:te
3f00: 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d  stqueue-set-item
3f10: 73 21 20 74 65 73 74 2d 72 65 63 6f 72 64 20 69  s! test-record i
3f20: 74 65 6d 73 2d 6c 69 73 74 29 0a 09 09 09 28 6c  tems-list)....(l
3f30: 6f 6f 70 20 68 65 64 20 74 61 6c 29 29 0a 09 09  oop hed tal))...
3f40: 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09        (begin....
3f50: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
3f60: 45 52 52 4f 52 3a 20 54 68 65 20 70 72 6f 63 20  ERROR: The proc 
3f70: 66 72 6f 6d 20 72 65 61 64 69 6e 67 20 74 68 65  from reading the
3f80: 20 73 65 74 75 70 20 64 69 64 20 6e 6f 74 20 79   setup did not y
3f90: 69 65 6c 64 20 61 20 6c 69 73 74 20 2d 20 70 6c  ield a list - pl
3fa0: 65 61 73 65 20 72 65 70 6f 72 74 20 74 68 69 73  ease report this
3fb0: 22 29 0a 09 09 09 28 65 78 69 74 20 31 29 29 29  ")....(exit 1)))
3fc0: 29 29 0a 09 20 20 20 20 20 20 28 6c 65 74 20 28  ))..      (let (
3fd0: 28 6e 65 77 74 61 6c 20 28 61 70 70 65 6e 64 20  (newtal (append 
3fe0: 74 61 6c 20 28 6c 69 73 74 20 68 65 64 29 29 29  tal (list hed)))
3ff0: 29 0a 09 09 3b 3b 20 69 66 20 63 61 6e 27 74 20  )...;; if can't 
4000: 72 75 6e 20 6d 6f 72 65 20 74 65 73 74 73 2c 20  run more tests, 
4010: 6c 65 74 73 20 74 61 6b 65 20 61 20 62 72 65 61  lets take a brea
4020: 74 68 65 72 0a 09 09 28 74 68 72 65 61 64 2d 73  ther...(thread-s
4030: 6c 65 65 70 21 20 30 2e 35 29 0a 09 09 28 6c 6f  leep! 0.5)...(lo
4040: 6f 70 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28  op (car newtal)(
4050: 63 64 72 20 6e 65 77 74 61 6c 29 29 29 29 29 0a  cdr newtal))))).
4060: 0a 09 20 3b 3b 20 74 68 69 73 20 63 61 73 65 20  .. ;; this case 
4070: 73 68 6f 75 6c 64 20 6e 6f 74 20 68 61 70 70 65  should not happe
4080: 6e 2c 20 61 64 64 65 64 20 74 6f 20 68 65 6c 70  n, added to help
4090: 20 63 61 74 63 68 20 61 6e 79 20 62 75 67 73 0a   catch any bugs.
40a0: 09 20 28 28 61 6e 64 20 28 6c 69 73 74 3f 20 69  . ((and (list? i
40b0: 74 65 6d 73 29 20 69 74 65 6d 64 61 74 29 0a 09  tems) itemdat)..
40c0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
40d0: 20 22 45 52 52 4f 52 3a 20 53 68 6f 75 6c 64 20   "ERROR: Should 
40e0: 6e 6f 74 20 68 61 76 65 20 61 20 6c 69 73 74 20  not have a list 
40f0: 6f 66 20 69 74 65 6d 73 20 69 6e 20 61 20 74 65  of items in a te
4100: 73 74 20 61 6e 64 20 74 68 65 20 69 74 65 6d 73  st and the items
4110: 70 61 74 68 20 73 65 74 20 2d 20 70 6c 65 61 73  path set - pleas
4120: 65 20 72 65 70 6f 72 74 20 74 68 69 73 22 29 0a  e report this").
4130: 09 20 20 28 65 78 69 74 20 31 29 29 29 29 0a 09  .  (exit 1))))..
4140: 0a 20 20 20 20 20 20 3b 3b 20 77 65 20 67 65 74  .      ;; we get
4150: 20 68 65 72 65 20 6f 6e 20 22 64 72 6f 70 20 74   here on "drop t
4160: 68 72 6f 75 67 68 22 20 2d 20 6c 6f 6f 70 20 66  hrough" - loop f
4170: 6f 72 20 6e 65 78 74 20 74 65 73 74 20 69 6e 20  or next test in 
4180: 71 75 65 75 65 0a 20 20 20 20 20 20 28 69 66 20  queue.      (if 
4190: 28 6e 75 6c 6c 3f 20 74 61 6c 29 0a 09 20 20 28  (null? tal)..  (
41a0: 62 65 67 69 6e 0a 09 20 20 20 20 3b 3b 20 46 49  begin..    ;; FI
41b0: 58 4d 45 21 21 21 21 20 54 48 49 53 20 53 48 4f  XME!!!! THIS SHO
41c0: 55 4c 44 20 4e 4f 54 20 52 45 51 55 49 52 45 20  ULD NOT REQUIRE 
41d0: 41 4e 20 45 58 49 54 21 21 21 21 21 21 21 0a 09  AN EXIT!!!!!!!..
41e0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
41f0: 20 31 20 22 49 4e 46 4f 3a 20 41 6c 6c 20 74 65   1 "INFO: All te
4200: 73 74 73 20 6c 61 75 6e 63 68 65 64 22 29 0a 09  sts launched")..
4210: 20 20 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65      (thread-slee
4220: 70 21 20 30 2e 35 29 0a 09 20 20 20 20 3b 3b 20  p! 0.5)..    ;; 
4230: 46 49 58 4d 45 21 20 54 68 69 73 20 68 61 72 73  FIXME! This hars
4240: 68 20 65 78 69 74 20 73 68 6f 75 6c 64 20 6e 6f  h exit should no
4250: 74 20 62 65 20 6e 65 63 65 73 73 61 72 79 2e 2e  t be necessary..
4260: 2e 2e 0a 09 20 20 20 20 28 69 66 20 28 6e 6f 74  ....    (if (not
4270: 20 2a 72 75 6e 72 65 6d 6f 74 65 2a 29 28 65 78   *runremote*)(ex
4280: 69 74 29 29 20 3b 3b 20 0a 09 20 20 20 20 23 66  it)) ;; ..    #f
4290: 29 20 3b 3b 20 72 65 74 75 72 6e 20 61 20 23 66  ) ;; return a #f
42a0: 20 61 73 20 61 20 68 69 6e 74 20 74 68 61 74 20   as a hint that 
42b0: 77 65 20 61 72 65 20 64 6f 6e 65 0a 09 20 20 3b  we are done..  ;
42c0: 3b 20 48 65 72 65 20 77 65 20 6e 65 65 64 20 74  ; Here we need t
42d0: 6f 20 63 68 65 63 6b 20 74 68 61 74 20 61 6c 6c  o check that all
42e0: 20 74 68 65 20 74 65 73 74 73 20 72 65 6d 61 69   the tests remai
42f0: 6e 69 6e 67 20 74 6f 20 62 65 20 72 75 6e 20 61  ning to be run a
4300: 72 65 20 65 6c 69 67 69 62 6c 65 20 74 6f 20 72  re eligible to r
4310: 75 6e 0a 09 20 20 3b 3b 20 61 6e 64 20 61 72 65  un..  ;; and are
4320: 20 6e 6f 74 20 62 6c 6f 63 6b 65 64 20 62 79 20   not blocked by 
4330: 66 61 69 6c 65 64 0a 09 20 20 28 6c 65 74 20 28  failed..  (let (
4340: 28 6e 65 77 6c 73 74 20 28 74 65 73 74 73 3a 66  (newlst (tests:f
4350: 69 6c 74 65 72 2d 6e 6f 6e 2d 72 75 6e 6e 61 62  ilter-non-runnab
4360: 6c 65 20 64 62 20 72 75 6e 2d 69 64 20 74 61 6c  le db run-id tal
4370: 20 74 65 73 74 2d 72 65 63 6f 72 64 73 29 29 29   test-records)))
4380: 20 3b 3b 20 69 2e 65 2e 20 6e 6f 74 20 46 41 49   ;; i.e. not FAI
4390: 4c 2c 20 57 41 49 56 45 44 2c 20 49 4e 43 4f 4d  L, WAIVED, INCOM
43a0: 50 4c 45 54 45 2c 20 50 41 53 53 2c 20 4b 49 4c  PLETE, PASS, KIL
43b0: 4c 45 44 2c 0a 09 20 20 20 20 28 74 68 72 65 61  LED,..    (threa
43c0: 64 2d 73 6c 65 65 70 21 20 30 2e 35 29 0a 09 20  d-sleep! 0.5).. 
43d0: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c     (if (not (nul
43e0: 6c 3f 20 6e 65 77 6c 73 74 29 29 0a 09 09 28 6c  l? newlst))...(l
43f0: 6f 6f 70 20 28 63 61 72 20 6e 65 77 6c 73 74 29  oop (car newlst)
4400: 28 63 64 72 20 6e 65 77 6c 73 74 29 29 29 29 29  (cdr newlst)))))
4410: 29 29 29 0a 0a 3b 3b 20 70 61 72 65 6e 74 2d 74  )))..;; parent-t
4420: 65 73 74 20 69 73 20 74 68 65 72 65 20 61 73 20  est is there as 
4430: 61 20 70 6c 61 63 65 68 6f 6c 64 65 72 20 66 6f  a placeholder fo
4440: 72 20 77 68 65 6e 20 70 61 72 65 6e 74 2d 74 65  r when parent-te
4450: 73 74 73 20 63 61 6e 20 62 65 20 72 75 6e 20 61  sts can be run a
4460: 73 20 61 20 73 65 74 75 70 20 73 74 65 70 0a 28  s a setup step.(
4470: 64 65 66 69 6e 65 20 28 72 75 6e 3a 74 65 73 74  define (run:test
4480: 20 64 62 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61   db run-id runna
4490: 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 73  me keyvallst tes
44a0: 74 2d 72 65 63 6f 72 64 20 66 6c 61 67 73 20 70  t-record flags p
44b0: 61 72 65 6e 74 2d 74 65 73 74 29 0a 20 20 3b 3b  arent-test).  ;;
44c0: 20 41 6c 6c 20 74 68 65 73 65 20 76 61 72 73 20   All these vars 
44d0: 6d 69 67 68 74 20 62 65 20 72 65 66 65 72 65 6e  might be referen
44e0: 63 65 64 20 62 79 20 74 68 65 20 74 65 73 74 63  ced by the testc
44f0: 6f 6e 66 69 67 20 66 69 6c 65 20 72 65 61 64 65  onfig file reade
4500: 72 0a 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74  r.  (let* ((test
4510: 2d 6e 61 6d 65 20 20 20 20 28 74 65 73 74 73 3a  -name    (tests:
4520: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65  testqueue-get-te
4530: 73 74 6e 61 6d 65 20 20 20 74 65 73 74 2d 72 65  stname   test-re
4540: 63 6f 72 64 29 29 0a 09 20 28 74 65 73 74 2d 77  cord)).. (test-w
4550: 61 69 74 6f 6e 73 20 28 74 65 73 74 73 3a 74 65  aitons (tests:te
4560: 73 74 71 75 65 75 65 2d 67 65 74 2d 77 61 69 74  stqueue-get-wait
4570: 6f 6e 73 20 20 20 20 74 65 73 74 2d 72 65 63 6f  ons    test-reco
4580: 72 64 29 29 0a 09 20 28 74 65 73 74 2d 63 6f 6e  rd)).. (test-con
4590: 66 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74  f    (tests:test
45a0: 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 63 6f  queue-get-testco
45b0: 6e 66 69 67 20 74 65 73 74 2d 72 65 63 6f 72 64  nfig test-record
45c0: 29 29 0a 09 20 28 69 74 65 6d 64 61 74 20 20 20  )).. (itemdat   
45d0: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75     (tests:testqu
45e0: 65 75 65 2d 67 65 74 2d 69 74 65 6d 64 61 74 20  eue-get-itemdat 
45f0: 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29     test-record))
4600: 0a 09 20 28 74 65 73 74 2d 70 61 74 68 20 20 20  .. (test-path   
4610: 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a   (conc *toppath*
4620: 20 22 2f 74 65 73 74 73 2f 22 20 74 65 73 74 2d   "/tests/" test-
4630: 6e 61 6d 65 29 29 20 3b 3b 20 63 6f 75 6c 64 20  name)) ;; could 
4640: 75 73 65 20 74 65 73 74 73 3a 67 65 74 2d 74 65  use tests:get-te
4650: 73 74 63 6f 6e 66 69 67 20 68 65 72 65 20 2e 2e  stconfig here ..
4660: 2e 0a 09 20 28 66 6f 72 63 65 20 20 20 20 20 20  ... (force      
4670: 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65    (hash-table-re
4680: 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20  f/default flags 
4690: 22 2d 66 6f 72 63 65 22 20 23 66 29 29 0a 09 20  "-force" #f)).. 
46a0: 28 72 65 72 75 6e 20 20 20 20 20 20 20 20 28 68  (rerun        (h
46b0: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65  ash-table-ref/de
46c0: 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 72 65  fault flags "-re
46d0: 72 75 6e 22 20 23 66 29 29 0a 09 20 28 6b 65 65  run" #f)).. (kee
46e0: 70 67 6f 69 6e 67 20 20 20 20 28 68 61 73 68 2d  pgoing    (hash-
46f0: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c  table-ref/defaul
4700: 74 20 66 6c 61 67 73 20 22 2d 6b 65 65 70 67 6f  t flags "-keepgo
4710: 69 6e 67 22 20 23 66 29 29 0a 09 20 28 69 74 65  ing" #f)).. (ite
4720: 6d 2d 70 61 74 68 20 20 20 20 20 22 22 29 29 0a  m-path     "")).
4730: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
4740: 20 35 0a 09 09 20 22 74 65 73 74 2d 63 6f 6e 66   5... "test-conf
4750: 69 67 3a 20 22 20 28 68 61 73 68 2d 74 61 62 6c  ig: " (hash-tabl
4760: 65 2d 3e 61 6c 69 73 74 20 74 65 73 74 2d 63 6f  e->alist test-co
4770: 6e 66 29 0a 09 09 20 22 5c 6e 20 20 20 69 74 65  nf)... "\n   ite
4780: 6d 64 61 74 3a 20 22 20 69 74 65 6d 64 61 74 0a  mdat: " itemdat.
4790: 09 09 20 29 0a 20 20 20 20 3b 3b 20 73 65 74 74  .. ).    ;; sett
47a0: 69 6e 67 20 69 74 65 6d 64 61 74 20 74 6f 20 61  ing itemdat to a
47b0: 20 6c 69 73 74 20 69 66 20 69 74 20 69 73 20 23   list if it is #
47c0: 66 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 69  f.    (if (not i
47d0: 74 65 6d 64 61 74 29 28 73 65 74 21 20 69 74 65  temdat)(set! ite
47e0: 6d 64 61 74 20 27 28 29 29 29 0a 20 20 20 20 28  mdat '())).    (
47f0: 73 65 74 21 20 69 74 65 6d 2d 70 61 74 68 20 28  set! item-path (
4800: 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20  item-list->path 
4810: 69 74 65 6d 64 61 74 29 29 0a 20 20 20 20 28 64  itemdat)).    (d
4820: 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 41 74  ebug:print 2 "At
4830: 74 65 6d 70 74 69 6e 67 20 74 6f 20 6c 61 75 6e  tempting to laun
4840: 63 68 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e  ch test " test-n
4850: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74  ame "/" item-pat
4860: 68 29 0a 20 20 20 20 28 73 65 74 65 6e 76 20 22  h).    (setenv "
4870: 4d 54 5f 54 45 53 54 5f 4e 41 4d 45 22 20 74 65  MT_TEST_NAME" te
4880: 73 74 2d 6e 61 6d 65 29 20 3b 3b 20 0a 20 20 20  st-name) ;; .   
4890: 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e   (setenv "MT_RUN
48a0: 4e 41 4d 45 22 20 20 20 72 75 6e 6e 61 6d 65 29  NAME"   runname)
48b0: 0a 20 20 20 20 28 73 65 74 2d 6d 65 67 61 74 65  .    (set-megate
48c0: 73 74 2d 65 6e 76 2d 76 61 72 73 20 64 62 20 72  st-env-vars db r
48d0: 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73 65 20  un-id) ;; these 
48e0: 6d 61 79 20 62 65 20 6e 65 65 64 65 64 20 62 79  may be needed by
48f0: 20 74 68 65 20 6c 61 75 6e 63 68 69 6e 67 20 70   the launching p
4900: 72 6f 63 65 73 73 0a 20 20 20 20 28 63 68 61 6e  rocess.    (chan
4910: 67 65 2d 64 69 72 65 63 74 6f 72 79 20 2a 74 6f  ge-directory *to
4920: 70 70 61 74 68 2a 29 0a 0a 20 20 20 20 3b 3b 20  ppath*)..    ;; 
4930: 48 65 72 65 20 69 73 20 77 68 65 72 65 20 74 68  Here is where th
4940: 65 20 74 65 73 74 5f 6d 65 74 61 20 74 61 62 6c  e test_meta tabl
4950: 65 20 69 73 20 62 65 73 74 20 75 70 64 61 74 65  e is best update
4960: 64 0a 20 20 20 20 3b 3b 20 59 65 73 2c 20 61 6e  d.    ;; Yes, an
4970: 6f 74 68 65 72 20 75 73 65 20 6f 66 20 61 20 67  other use of a g
4980: 6c 6f 62 61 6c 20 66 6f 72 20 63 61 63 68 69 6e  lobal for cachin
4990: 67 2e 20 4e 65 65 64 20 61 20 62 65 74 74 65 72  g. Need a better
49a0: 20 77 61 79 3f 0a 20 20 20 20 28 69 66 20 28 6e   way?.    (if (n
49b0: 6f 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72  ot (hash-table-r
49c0: 65 66 2f 64 65 66 61 75 6c 74 20 2a 74 65 73 74  ef/default *test
49d0: 2d 6d 65 74 61 2d 75 70 64 61 74 65 64 2a 20 74  -meta-updated* t
49e0: 65 73 74 2d 6e 61 6d 65 20 23 66 29 29 0a 20 20  est-name #f)).  
49f0: 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20        (begin..  
4a00: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74   (hash-table-set
4a10: 21 20 2a 74 65 73 74 2d 6d 65 74 61 2d 75 70 64  ! *test-meta-upd
4a20: 61 74 65 64 2a 20 74 65 73 74 2d 6e 61 6d 65 20  ated* test-name 
4a30: 23 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 28  #t).           (
4a40: 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74  runs:update-test
4a50: 5f 6d 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61  _meta db test-na
4a60: 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 29 29 0a  me test-conf))).
4a70: 20 20 20 20 0a 20 20 20 20 3b 3b 20 28 6c 61 6d      .    ;; (lam
4a80: 62 64 61 20 28 69 74 65 6d 64 61 74 29 20 3b 3b  bda (itemdat) ;;
4a90: 3b 20 28 28 72 69 70 65 6e 65 73 73 20 22 6f 76  ; ((ripeness "ov
4aa0: 65 72 72 69 70 65 22 29 20 28 74 65 6d 70 65 72  erripe") (temper
4ab0: 61 74 75 72 65 20 22 63 6f 6f 6c 22 29 20 28 73  ature "cool") (s
4ac0: 65 61 73 6f 6e 20 22 73 75 6d 6d 65 72 22 29 29  eason "summer"))
4ad0: 0a 20 20 20 20 28 6c 65 74 2a 20 28 28 6e 65 77  .    (let* ((new
4ae0: 2d 74 65 73 74 2d 70 61 74 68 20 28 73 74 72 69  -test-path (stri
4af0: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28  ng-intersperse (
4b00: 63 6f 6e 73 20 74 65 73 74 2d 70 61 74 68 20 28  cons test-path (
4b10: 6d 61 70 20 63 61 64 72 20 69 74 65 6d 64 61 74  map cadr itemdat
4b20: 29 29 20 22 2f 22 29 29 0a 09 20 20 20 28 6e 65  )) "/"))..   (ne
4b30: 77 2d 74 65 73 74 2d 6e 61 6d 65 20 28 69 66 20  w-test-name (if 
4b40: 28 65 71 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74  (equal? item-pat
4b50: 68 20 22 22 29 20 74 65 73 74 2d 6e 61 6d 65 20  h "") test-name 
4b60: 28 63 6f 6e 63 20 74 65 73 74 2d 6e 61 6d 65 20  (conc test-name 
4b70: 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 29  "/" item-path)))
4b80: 20 3b 3b 20 6a 75 73 74 20 6e 65 65 64 20 69 74   ;; just need it
4b90: 20 74 6f 20 62 65 20 75 6e 69 71 75 65 0a 09 20   to be unique.. 
4ba0: 20 20 28 74 65 73 74 64 61 74 20 20 20 20 20 20    (testdat      
4bb0: 20 28 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e   (db:get-test-in
4bc0: 66 6f 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73  fo db run-id tes
4bd0: 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68  t-name item-path
4be0: 29 29 0a 09 20 20 20 28 74 65 73 74 2d 69 64 20  ))..   (test-id 
4bf0: 20 20 20 20 20 20 23 66 29 29 0a 20 20 20 20 20        #f)).     
4c00: 20 28 69 66 20 28 6e 6f 74 20 74 65 73 74 64 61   (if (not testda
4c10: 74 29 0a 09 20 20 28 62 65 67 69 6e 0a 09 20 20  t)..  (begin..  
4c20: 20 20 3b 3b 20 65 6e 73 75 72 65 20 74 68 61 74    ;; ensure that
4c30: 20 74 68 65 20 70 61 74 68 20 65 78 69 73 74 73   the path exists
4c40: 20 62 65 66 6f 72 65 20 72 65 67 69 73 74 65 72   before register
4c50: 69 6e 67 20 74 68 65 20 74 65 73 74 0a 09 20 20  ing the test..  
4c60: 20 20 3b 3b 20 4e 4f 50 45 3a 20 43 61 6e 6e 6f    ;; NOPE: Canno
4c70: 74 21 20 44 6f 6e 27 74 20 6b 6e 6f 77 20 79 65  t! Don't know ye
4c80: 74 20 77 68 69 63 68 20 64 69 73 6b 20 61 72 65  t which disk are
4c90: 61 20 77 69 6c 6c 20 62 65 20 61 73 73 69 67 6e  a will be assign
4ca0: 65 64 2e 2e 2e 2e 0a 09 20 20 20 20 3b 3b 20 28  ed......    ;; (
4cb0: 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 6d 6b  system (conc "mk
4cc0: 64 69 72 20 2d 70 20 22 20 6e 65 77 2d 74 65 73  dir -p " new-tes
4cd0: 74 2d 70 61 74 68 29 29 0a 09 20 20 20 20 28 72  t-path))..    (r
4ce0: 74 65 73 74 73 3a 72 65 67 69 73 74 65 72 2d 74  tests:register-t
4cf0: 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 74 65  est db run-id te
4d00: 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74  st-name item-pat
4d10: 68 29 0a 09 20 20 20 20 28 73 65 74 21 20 74 65  h)..    (set! te
4d20: 73 74 64 61 74 20 28 64 62 3a 67 65 74 2d 74 65  stdat (db:get-te
4d30: 73 74 2d 69 6e 66 6f 20 64 62 20 72 75 6e 2d 69  st-info db run-i
4d40: 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d  d test-name item
4d50: 2d 70 61 74 68 29 29 29 29 0a 20 20 20 20 20 20  -path)))).      
4d60: 28 73 65 74 21 20 74 65 73 74 2d 69 64 20 28 64  (set! test-id (d
4d70: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65  b:test-get-id te
4d80: 73 74 64 61 74 29 29 0a 20 20 20 20 20 20 28 63  stdat)).      (c
4d90: 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 79 20  hange-directory 
4da0: 74 65 73 74 2d 70 61 74 68 29 0a 20 20 20 20 20  test-path).     
4db0: 20 28 63 61 73 65 20 28 69 66 20 66 6f 72 63 65   (case (if force
4dc0: 20 3b 3b 20 28 61 72 67 73 3a 67 65 74 2d 61 72   ;; (args:get-ar
4dd0: 67 20 22 2d 66 6f 72 63 65 22 29 0a 09 09 27 4e  g "-force")...'N
4de0: 4f 54 5f 53 54 41 52 54 45 44 0a 09 09 28 69 66  OT_STARTED...(if
4df0: 20 74 65 73 74 64 61 74 0a 09 09 20 20 20 20 28   testdat...    (
4e00: 73 74 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c 20 28  string->symbol (
4e10: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74  test:get-state t
4e20: 65 73 74 64 61 74 29 29 0a 09 09 20 20 20 20 27  estdat))...    '
4e30: 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 72 74  failed-to-insert
4e40: 29 29 0a 09 28 28 66 61 69 6c 65 64 2d 74 6f 2d  ))..((failed-to-
4e50: 69 6e 73 65 72 74 29 0a 09 20 28 64 65 62 75 67  insert).. (debug
4e60: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a  :print 0 "ERROR:
4e70: 20 46 61 69 6c 65 64 20 74 6f 20 69 6e 73 65 72   Failed to inser
4e80: 74 20 74 68 65 20 72 65 63 6f 72 64 20 69 6e 74  t the record int
4e90: 6f 20 74 68 65 20 64 62 22 29 29 0a 09 28 28 4e  o the db"))..((N
4ea0: 4f 54 5f 53 54 41 52 54 45 44 20 43 4f 4d 50 4c  OT_STARTED COMPL
4eb0: 45 54 45 44 29 0a 09 20 28 64 65 62 75 67 3a 70  ETED).. (debug:p
4ec0: 72 69 6e 74 20 36 20 22 47 6f 74 20 68 65 72 65  rint 6 "Got here
4ed0: 2c 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74  , " (test:get-st
4ee0: 61 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 20  ate testdat)).. 
4ef0: 28 6c 65 74 20 28 28 72 75 6e 66 6c 61 67 20 23  (let ((runflag #
4f00: 66 29 29 0a 09 20 20 20 28 63 6f 6e 64 0a 09 20  f))..   (cond.. 
4f10: 20 20 20 3b 3b 20 2d 66 6f 72 63 65 2c 20 72 75     ;; -force, ru
4f20: 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77 68 61 74  n no matter what
4f30: 0a 09 20 20 20 20 28 66 6f 72 63 65 20 28 73 65  ..    (force (se
4f40: 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a  t! runflag #t)).
4f50: 09 20 20 20 20 3b 3b 20 4e 4f 54 5f 53 54 41 52  .    ;; NOT_STAR
4f60: 54 45 44 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74  TED, run no matt
4f70: 65 72 20 77 68 61 74 0a 09 20 20 20 20 28 28 65  er what..    ((e
4f80: 71 75 61 6c 3f 20 28 74 65 73 74 3a 67 65 74 2d  qual? (test:get-
4f90: 73 74 61 74 65 20 74 65 73 74 64 61 74 29 20 22  state testdat) "
4fa0: 4e 4f 54 5f 53 54 41 52 54 45 44 22 29 28 73 65  NOT_STARTED")(se
4fb0: 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a  t! runflag #t)).
4fc0: 09 20 20 20 20 3b 3b 20 6e 6f 74 20 2d 72 65 72  .    ;; not -rer
4fd0: 75 6e 20 61 6e 64 20 50 41 53 53 2c 20 57 41 52  un and PASS, WAR
4fe0: 4e 20 6f 72 20 43 48 45 43 4b 2c 20 64 6f 20 6e  N or CHECK, do n
4ff0: 6f 20 72 75 6e 0a 09 20 20 20 20 28 28 61 6e 64  o run..    ((and
5000: 20 28 6f 72 20 28 6e 6f 74 20 72 65 72 75 6e 29   (or (not rerun)
5010: 0a 09 09 20 20 20 20 20 20 6b 65 65 70 67 6f 69  ...      keepgoi
5020: 6e 67 29 0a 09 09 20 20 3b 3b 20 52 65 71 75 69  ng)...  ;; Requi
5030: 72 65 20 74 6f 20 66 6f 72 63 65 20 72 65 2d 72  re to force re-r
5040: 75 6e 20 66 6f 72 20 43 4f 4d 50 4c 45 54 45 44  un for COMPLETED
5050: 20 6f 72 20 2a 61 6e 79 74 68 69 6e 67 2a 20 2b   or *anything* +
5060: 20 50 41 53 53 2c 57 41 52 4e 20 6f 72 20 43 48   PASS,WARN or CH
5070: 45 43 4b 0a 09 09 20 20 28 6f 72 20 28 6d 65 6d  ECK...  (or (mem
5080: 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74  ber (test:get-st
5090: 61 74 75 73 20 74 65 73 74 64 61 74 29 20 27 28  atus testdat) '(
50a0: 22 50 41 53 53 22 20 22 57 41 52 4e 22 20 22 43  "PASS" "WARN" "C
50b0: 48 45 43 4b 22 29 29 0a 09 09 20 20 20 20 20 20  HECK"))...      
50c0: 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65  (member (test:ge
50d0: 74 2d 73 74 61 74 65 20 20 74 65 73 74 64 61 74  t-state  testdat
50e0: 29 20 27 28 22 43 4f 4d 50 4c 45 54 45 44 22 29  ) '("COMPLETED")
50f0: 29 29 29 20 0a 09 20 20 20 20 20 28 64 65 62 75  ))) ..     (debu
5100: 67 3a 70 72 69 6e 74 20 32 20 22 49 4e 46 4f 3a  g:print 2 "INFO:
5110: 20 72 75 6e 6e 69 6e 67 20 74 65 73 74 20 22 20   running test " 
5120: 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74  test-name "/" it
5130: 65 6d 2d 70 61 74 68 20 22 20 73 75 70 70 72 65  em-path " suppre
5140: 73 73 65 64 20 61 73 20 69 74 20 69 73 20 43 4f  ssed as it is CO
5150: 4d 50 4c 45 54 45 44 20 61 6e 64 20 22 20 28 74  MPLETED and " (t
5160: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65  est:get-state te
5170: 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 28 73  stdat))..     (s
5180: 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29  et! runflag #f))
5190: 0a 09 20 20 20 20 3b 3b 20 2d 72 65 72 75 6e 20  ..    ;; -rerun 
51a0: 61 6e 64 20 73 74 61 74 75 73 20 69 73 20 6f 6e  and status is on
51b0: 65 20 6f 66 20 74 68 65 20 73 70 65 63 69 66 65  e of the specife
51c0: 64 2c 20 72 75 6e 20 69 74 0a 09 20 20 20 20 28  d, run it..    (
51d0: 28 61 6e 64 20 72 65 72 75 6e 0a 09 09 20 20 28  (and rerun...  (
51e0: 6c 65 74 2a 20 28 28 72 65 72 75 6e 6c 73 74 20  let* ((rerunlst 
51f0: 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20    (string-split 
5200: 72 65 72 75 6e 20 22 2c 22 29 29 0a 09 09 09 20  rerun ",")).... 
5210: 28 6d 75 73 74 2d 72 65 72 75 6e 20 28 6d 65 6d  (must-rerun (mem
5220: 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74  ber (test:get-st
5230: 61 74 75 73 20 74 65 73 74 64 61 74 29 20 72 65  atus testdat) re
5240: 72 75 6e 6c 73 74 29 29 29 0a 09 09 20 20 20 20  runlst)))...    
5250: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 33 20 22  (debug:print 3 "
5260: 49 4e 46 4f 3a 20 2d 72 65 72 75 6e 20 6c 69 73  INFO: -rerun lis
5270: 74 3a 20 22 20 72 65 72 75 6e 20 22 2c 20 74 65  t: " rerun ", te
5280: 73 74 2d 73 74 61 74 75 73 3a 20 22 20 28 74 65  st-status: " (te
5290: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65  st:get-status te
52a0: 73 74 64 61 74 29 22 2c 20 6d 75 73 74 2d 72 65  stdat)", must-re
52b0: 72 75 6e 3a 20 22 20 6d 75 73 74 2d 72 65 72 75  run: " must-reru
52c0: 6e 29 0a 09 09 20 20 20 20 6d 75 73 74 2d 72 65  n)...    must-re
52d0: 72 75 6e 29 29 0a 09 20 20 20 20 20 28 64 65 62  run))..     (deb
52e0: 75 67 3a 70 72 69 6e 74 20 32 20 22 49 4e 46 4f  ug:print 2 "INFO
52f0: 3a 20 52 65 72 75 6e 20 66 6f 72 63 65 64 20 66  : Rerun forced f
5300: 6f 72 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e  or test " test-n
5310: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74  ame "/" item-pat
5320: 68 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72  h)..     (set! r
5330: 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20  unflag #t))..   
5340: 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 2c 20   ;; -keepgoing, 
5350: 64 6f 20 6e 6f 74 20 72 65 72 75 6e 20 46 41 49  do not rerun FAI
5360: 4c 0a 09 20 20 20 20 28 28 61 6e 64 20 6b 65 65  L..    ((and kee
5370: 70 67 6f 69 6e 67 0a 09 09 20 20 28 6d 65 6d 62  pgoing...  (memb
5380: 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61  er (test:get-sta
5390: 74 75 73 20 74 65 73 74 64 61 74 29 20 27 28 22  tus testdat) '("
53a0: 46 41 49 4c 22 29 29 29 0a 09 20 20 20 20 20 28  FAIL")))..     (
53b0: 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29  set! runflag #f)
53c0: 29 0a 09 20 20 20 20 28 28 61 6e 64 20 28 6e 6f  )..    ((and (no
53d0: 74 20 72 65 72 75 6e 29 0a 09 09 20 20 28 6d 65  t rerun)...  (me
53e0: 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73  mber (test:get-s
53f0: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20 27  tatus testdat) '
5400: 28 22 46 41 49 4c 22 20 22 6e 2f 61 22 29 29 29  ("FAIL" "n/a")))
5410: 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 75 6e  ..     (set! run
5420: 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 28  flag #t))..    (
5430: 65 6c 73 65 20 28 73 65 74 21 20 72 75 6e 66 6c  else (set! runfl
5440: 61 67 20 23 66 29 29 29 0a 09 20 20 20 28 64 65  ag #f)))..   (de
5450: 62 75 67 3a 70 72 69 6e 74 20 36 20 22 52 55 4e  bug:print 6 "RUN
5460: 4e 49 4e 47 20 3d 3e 20 72 75 6e 66 6c 61 67 3a  NING => runflag:
5470: 20 22 20 72 75 6e 66 6c 61 67 20 22 20 53 54 41   " runflag " STA
5480: 54 45 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d  TE: " (test:get-
5490: 73 74 61 74 65 20 74 65 73 74 64 61 74 29 20 22  state testdat) "
54a0: 20 53 54 41 54 55 53 3a 20 22 20 28 74 65 73 74   STATUS: " (test
54b0: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74  :get-status test
54c0: 64 61 74 29 29 0a 09 20 20 20 28 69 66 20 28 6e  dat))..   (if (n
54d0: 6f 74 20 72 75 6e 66 6c 61 67 29 0a 09 20 20 20  ot runflag)..   
54e0: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 70 61 72      (if (not par
54f0: 65 6e 74 2d 74 65 73 74 29 0a 09 09 20 20 20 28  ent-test)...   (
5500: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4e  debug:print 1 "N
5510: 4f 54 45 3a 20 4e 6f 74 20 73 74 61 72 74 69 6e  OTE: Not startin
5520: 67 20 74 65 73 74 20 22 20 6e 65 77 2d 74 65 73  g test " new-tes
5530: 74 2d 6e 61 6d 65 20 22 20 61 73 20 69 74 20 69  t-name " as it i
5540: 73 20 73 74 61 74 65 20 5c 22 22 20 28 74 65 73  s state \"" (tes
5550: 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74  t:get-state test
5560: 64 61 74 29 20 0a 09 09 09 09 22 5c 22 20 61 6e  dat) ....."\" an
5570: 64 20 73 74 61 74 75 73 20 5c 22 22 20 28 74 65  d status \"" (te
5580: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65  st:get-status te
5590: 73 74 64 61 74 29 20 22 5c 22 2c 20 75 73 65 20  stdat) "\", use 
55a0: 2d 72 65 72 75 6e 20 5c 22 22 20 28 74 65 73 74  -rerun \"" (test
55b0: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74  :get-status test
55c0: 64 61 74 29 0a 20 20 20 20 20 20 20 20 20 20 20  dat).           
55d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
55e0: 20 20 20 20 20 22 5c 22 20 6f 72 20 2d 66 6f 72       "\" or -for
55f0: 63 65 20 74 6f 20 6f 76 65 72 72 69 64 65 22 29  ce to override")
5600: 29 0a 09 20 20 20 20 20 20 20 3b 3b 20 4e 4f 54  )..       ;; NOT
5610: 45 3a 20 4e 6f 20 6c 6f 6e 67 65 72 20 62 65 20  E: No longer be 
5620: 63 68 65 63 6b 69 6e 67 20 70 72 65 72 65 71 75  checking prerequ
5630: 69 73 69 74 65 73 20 68 65 72 65 21 20 57 69 6c  isites here! Wil
5640: 6c 20 6e 65 76 65 72 20 67 65 74 20 68 65 72 65  l never get here
5650: 20 75 6e 6c 65 73 73 20 70 72 65 72 65 71 73 20   unless prereqs 
5660: 61 72 65 0a 09 20 20 20 20 20 20 20 3b 3b 20 20  are..       ;;  
5670: 20 20 20 20 20 61 6c 72 65 61 64 79 20 6d 65 74       already met
5680: 2e 0a 09 20 20 20 20 20 20 20 28 69 66 20 28 6e  ...       (if (n
5690: 6f 74 20 28 6c 61 75 6e 63 68 2d 74 65 73 74 20  ot (launch-test 
56a0: 64 62 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d  db run-id runnam
56b0: 65 20 74 65 73 74 2d 63 6f 6e 66 20 6b 65 79 76  e test-conf keyv
56c0: 61 6c 6c 73 74 20 74 65 73 74 2d 6e 61 6d 65 20  allst test-name 
56d0: 74 65 73 74 2d 70 61 74 68 20 69 74 65 6d 64 61  test-path itemda
56e0: 74 20 66 6c 61 67 73 29 29 0a 09 09 20 20 20 28  t flags))...   (
56f0: 62 65 67 69 6e 0a 09 09 20 20 20 20 20 28 70 72  begin...     (pr
5700: 69 6e 74 20 22 45 52 52 4f 52 3a 20 46 61 69 6c  int "ERROR: Fail
5710: 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 68 65  ed to launch the
5720: 20 74 65 73 74 2e 20 45 78 69 74 69 6e 67 20 61   test. Exiting a
5730: 73 20 73 6f 6f 6e 20 61 73 20 70 6f 73 73 69 62  s soon as possib
5740: 6c 65 22 29 0a 09 09 20 20 20 20 20 28 73 65 74  le")...     (set
5750: 21 20 2a 67 6c 6f 62 61 6c 65 78 69 74 73 74 61  ! *globalexitsta
5760: 74 75 73 2a 20 31 29 20 3b 3b 20 0a 09 09 20 20  tus* 1) ;; ...  
5770: 20 20 20 28 70 72 6f 63 65 73 73 2d 73 69 67 6e     (process-sign
5780: 61 6c 20 28 63 75 72 72 65 6e 74 2d 70 72 6f 63  al (current-proc
5790: 65 73 73 2d 69 64 29 20 73 69 67 6e 61 6c 2f 6b  ess-id) signal/k
57a0: 69 6c 6c 29 29 29 29 29 29 0a 09 28 28 4b 49 4c  ill))))))..((KIL
57b0: 4c 45 44 29 20 0a 09 20 28 64 65 62 75 67 3a 70  LED) .. (debug:p
57c0: 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 22 20  rint 1 "NOTE: " 
57d0: 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20  new-test-name " 
57e0: 69 73 20 61 6c 72 65 61 64 79 20 72 75 6e 6e 69  is already runni
57f0: 6e 67 20 6f 72 20 77 61 73 20 65 78 70 6c 69 63  ng or was explic
5800: 74 6c 79 20 6b 69 6c 6c 65 64 2c 20 75 73 65 20  tly killed, use 
5810: 2d 66 6f 72 63 65 20 74 6f 20 6c 61 75 6e 63 68  -force to launch
5820: 20 69 74 2e 22 29 29 0a 09 28 28 4c 41 55 4e 43   it."))..((LAUNC
5830: 48 45 44 20 52 45 4d 4f 54 45 48 4f 53 54 53 54  HED REMOTEHOSTST
5840: 41 52 54 20 52 55 4e 4e 49 4e 47 29 20 20 0a 09  ART RUNNING)  ..
5850: 20 28 69 66 20 28 3e 20 28 2d 20 28 63 75 72 72   (if (> (- (curr
5860: 65 6e 74 2d 73 65 63 6f 6e 64 73 29 28 2b 20 28  ent-seconds)(+ (
5870: 64 62 3a 74 65 73 74 2d 67 65 74 2d 65 76 65 6e  db:test-get-even
5880: 74 5f 74 69 6d 65 20 74 65 73 74 64 61 74 29 0a  t_time testdat).
5890: 09 09 09 09 20 20 20 20 20 20 20 28 64 62 3a 74  ....       (db:t
58a0: 65 73 74 2d 67 65 74 2d 72 75 6e 5f 64 75 72 61  est-get-run_dura
58b0: 74 69 6f 6e 20 74 65 73 74 64 61 74 29 29 29 0a  tion testdat))).
58c0: 09 09 36 30 30 29 20 3b 3b 20 69 2e 65 2e 20 6e  ..600) ;; i.e. n
58d0: 6f 20 75 70 64 61 74 65 20 66 6f 72 20 6d 6f 72  o update for mor
58e0: 65 20 74 68 61 6e 20 36 30 30 20 73 65 63 6f 6e  e than 600 secon
58f0: 64 73 0a 09 20 20 20 20 20 28 62 65 67 69 6e 0a  ds..     (begin.
5900: 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70  .       (debug:p
5910: 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a  rint 0 "WARNING:
5920: 20 54 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d   Test " test-nam
5930: 65 20 22 20 61 70 70 65 61 72 73 20 74 6f 20 62  e " appears to b
5940: 65 20 64 65 61 64 2e 20 46 6f 72 63 69 6e 67 20  e dead. Forcing 
5950: 69 74 20 74 6f 20 73 74 61 74 65 20 49 4e 43 4f  it to state INCO
5960: 4d 50 4c 45 54 45 20 61 6e 64 20 73 74 61 74 75  MPLETE and statu
5970: 73 20 53 54 55 43 4b 2f 44 45 41 44 22 29 0a 09  s STUCK/DEAD")..
5980: 20 20 20 20 20 20 20 28 74 65 73 74 2d 73 65 74         (test-set
5990: 2d 73 74 61 74 75 73 21 20 64 62 20 74 65 73 74  -status! db test
59a0: 2d 69 64 20 22 49 4e 43 4f 4d 50 4c 45 54 45 22  -id "INCOMPLETE"
59b0: 20 22 53 54 55 43 4b 2f 44 45 41 44 22 20 22 54   "STUCK/DEAD" "T
59c0: 65 73 74 20 69 73 20 73 74 75 63 6b 20 6f 72 20  est is stuck or 
59d0: 64 65 61 64 22 20 23 66 29 29 0a 09 20 20 20 20  dead" #f))..    
59e0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20   (debug:print 2 
59f0: 22 4e 4f 54 45 3a 20 22 20 74 65 73 74 2d 6e 61  "NOTE: " test-na
5a00: 6d 65 20 22 20 69 73 20 61 6c 72 65 61 64 79 20  me " is already 
5a10: 72 75 6e 6e 69 6e 67 22 29 29 29 0a 09 28 65 6c  running")))..(el
5a20: 73 65 20 20 20 20 20 20 20 28 64 65 62 75 67 3a  se       (debug:
5a30: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
5a40: 46 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68  Failed to launch
5a50: 20 74 65 73 74 20 22 20 6e 65 77 2d 74 65 73 74   test " new-test
5a60: 2d 6e 61 6d 65 20 22 2e 20 55 6e 72 65 63 6f 67  -name ". Unrecog
5a70: 6e 69 73 65 64 20 73 74 61 74 65 20 22 20 28 74  nised state " (t
5a80: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65  est:get-state te
5a90: 73 74 64 61 74 29 29 29 29 29 29 29 0a 0a 3b 3b  stdat)))))))..;;
5aa0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5ab0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5ac0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5ad0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5ae0: 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 45 4e 44 20 4f 46  ======.;; END OF
5af0: 20 4e 45 57 20 53 54 55 46 46 0a 3b 3b 3d 3d 3d   NEW STUFF.;;===
5b00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5b10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5b20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5b30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5b40: 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65 20 28 67 65  ===..(define (ge
5b50: 74 2d 64 69 72 2d 75 70 2d 6e 20 64 69 72 20 2e  t-dir-up-n dir .
5b60: 20 70 61 72 61 6d 73 29 20 0a 20 20 28 6c 65 74   params) .  (let
5b70: 20 28 28 64 70 61 72 74 73 20 20 28 73 74 72 69   ((dparts  (stri
5b80: 6e 67 2d 73 70 6c 69 74 20 64 69 72 20 22 2f 22  ng-split dir "/"
5b90: 29 29 0a 09 28 63 6f 75 6e 74 20 20 20 28 69 66  ))..(count   (if
5ba0: 20 28 6e 75 6c 6c 3f 20 70 61 72 61 6d 73 29 20   (null? params) 
5bb0: 31 20 28 63 61 72 20 70 61 72 61 6d 73 29 29 29  1 (car params)))
5bc0: 29 0a 20 20 20 20 28 63 6f 6e 63 20 22 2f 22 20  ).    (conc "/" 
5bd0: 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65  (string-interspe
5be0: 72 73 65 20 0a 09 20 20 20 20 20 20 20 28 74 61  rse ..       (ta
5bf0: 6b 65 20 64 70 61 72 74 73 20 28 2d 20 28 6c 65  ke dparts (- (le
5c00: 6e 67 74 68 20 64 70 61 72 74 73 29 20 63 6f 75  ngth dparts) cou
5c10: 6e 74 29 29 0a 09 20 20 20 20 20 20 20 22 2f 22  nt))..       "/"
5c20: 29 29 29 29 0a 3b 3b 20 52 65 6d 6f 76 65 20 72  )))).;; Remove r
5c30: 75 6e 73 0a 3b 3b 20 66 69 65 6c 64 73 20 61 72  uns.;; fields ar
5c40: 65 20 70 61 73 73 69 6e 67 20 69 6e 20 74 68 72  e passing in thr
5c50: 6f 75 67 68 20 0a 28 64 65 66 69 6e 65 20 28 72  ough .(define (r
5c60: 75 6e 73 3a 72 65 6d 6f 76 65 2d 72 75 6e 73 20  uns:remove-runs 
5c70: 64 62 20 72 75 6e 6e 61 6d 65 70 61 74 74 20 74  db runnamepatt t
5c80: 65 73 74 70 61 74 74 20 69 74 65 6d 70 61 74 74  estpatt itempatt
5c90: 29 0a 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73  ).  (let* ((keys
5ca0: 20 20 20 20 20 20 20 20 28 72 64 62 3a 67 65 74          (rdb:get
5cb0: 2d 6b 65 79 73 20 64 62 29 29 0a 09 20 28 72 75  -keys db)).. (ru
5cc0: 6e 64 61 74 20 20 20 20 20 20 28 72 75 6e 73 3a  ndat      (runs:
5cd0: 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74 74  get-runs-by-patt
5ce0: 20 64 62 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65   db keys runname
5cf0: 70 61 74 74 29 29 0a 09 20 28 68 65 61 64 65 72  patt)).. (header
5d00: 20 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65        (vector-re
5d10: 66 20 72 75 6e 64 61 74 20 30 29 29 0a 09 20 28  f rundat 0)).. (
5d20: 72 75 6e 73 20 20 20 20 20 20 20 20 28 76 65 63  runs        (vec
5d30: 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 31  tor-ref rundat 1
5d40: 29 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70  ))).    (debug:p
5d50: 72 69 6e 74 20 31 20 22 48 65 61 64 65 72 3a 20  rint 1 "Header: 
5d60: 22 20 68 65 61 64 65 72 29 0a 20 20 20 20 28 66  " header).    (f
5d70: 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 28 6c 61  or-each.     (la
5d80: 6d 62 64 61 20 28 72 75 6e 29 0a 20 20 20 20 20  mbda (run).     
5d90: 20 20 28 6c 65 74 20 28 28 72 75 6e 6b 65 79 20    (let ((runkey 
5da0: 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65  (string-interspe
5db0: 72 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61  rse (map (lambda
5dc0: 20 28 6b 29 0a 09 09 09 09 09 09 28 64 62 3a 67   (k).......(db:g
5dd0: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64  et-value-by-head
5de0: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 28 76  er run header (v
5df0: 65 63 74 6f 72 2d 72 65 66 20 6b 20 30 29 29 29  ector-ref k 0)))
5e00: 20 6b 65 79 73 29 20 22 2f 22 29 29 0a 09 20 20   keys) "/"))..  
5e10: 20 20 20 28 64 69 72 73 2d 74 6f 2d 72 65 6d 6f     (dirs-to-remo
5e20: 76 65 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61  ve (make-hash-ta
5e30: 62 6c 65 29 29 29 0a 09 20 28 6c 65 74 2a 20 28  ble))).. (let* (
5e40: 28 72 75 6e 2d 69 64 20 28 64 62 3a 67 65 74 2d  (run-id (db:get-
5e50: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20  value-by-header 
5e60: 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 22 29  run header "id")
5e70: 20 29 0a 09 09 28 74 65 73 74 73 20 20 28 72 64   )...(tests  (rd
5e80: 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d  b:get-tests-for-
5e90: 72 75 6e 20 64 62 20 28 64 62 3a 67 65 74 2d 76  run db (db:get-v
5ea0: 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72  alue-by-header r
5eb0: 75 6e 20 68 65 61 64 65 72 20 22 69 64 22 29 20  un header "id") 
5ec0: 74 65 73 74 70 61 74 74 20 69 74 65 6d 70 61 74  testpatt itempat
5ed0: 74 20 27 28 29 20 27 28 29 29 29 0a 09 09 28 6c  t '() '()))...(l
5ee0: 61 73 74 74 70 61 74 68 20 22 2f 64 6f 65 73 2f  asttpath "/does/
5ef0: 6e 6f 74 2f 65 78 69 73 74 2f 49 2f 68 6f 70 65  not/exist/I/hope
5f00: 22 29 29 0a 0a 09 20 20 20 28 69 66 20 28 6e 6f  "))...   (if (no
5f10: 74 20 28 6e 75 6c 6c 3f 20 74 65 73 74 73 29 29  t (null? tests))
5f20: 0a 09 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a  ..       (begin.
5f30: 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  .. (debug:print 
5f40: 31 20 22 52 65 6d 6f 76 69 6e 67 20 74 65 73 74  1 "Removing test
5f50: 73 20 66 6f 72 20 72 75 6e 3a 20 22 20 72 75 6e  s for run: " run
5f60: 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d  key " " (db:get-
5f70: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20  value-by-header 
5f80: 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e  run header "runn
5f90: 61 6d 65 22 29 29 0a 09 09 20 28 66 6f 72 2d 65  ame"))... (for-e
5fa0: 61 63 68 0a 09 09 20 20 28 6c 61 6d 62 64 61 20  ach...  (lambda 
5fb0: 28 74 65 73 74 29 0a 09 09 20 20 20 20 28 6c 65  (test)...    (le
5fc0: 74 2a 20 28 28 69 74 65 6d 2d 70 61 74 68 20 28  t* ((item-path (
5fd0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d  db:test-get-item
5fe0: 2d 70 61 74 68 20 74 65 73 74 29 29 0a 09 09 09  -path test))....
5ff0: 20 20 20 28 74 65 73 74 2d 6e 61 6d 65 20 28 64     (test-name (d
6000: 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e  b:test-get-testn
6010: 61 6d 65 20 74 65 73 74 29 29 0a 09 09 09 20 20  ame test))....  
6020: 20 28 72 75 6e 2d 64 69 72 20 20 20 28 64 62 3a   (run-dir   (db:
6030: 74 65 73 74 2d 67 65 74 2d 72 75 6e 64 69 72 20  test-get-rundir 
6040: 74 65 73 74 29 29 29 0a 09 09 20 20 20 20 20 20  test)))...      
6050: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22  (debug:print 1 "
6060: 20 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74    " (db:test-get
6070: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29 20  -testname test) 
6080: 22 20 69 64 3a 20 22 20 28 64 62 3a 74 65 73 74  " id: " (db:test
6090: 2d 67 65 74 2d 69 64 20 74 65 73 74 29 20 22 20  -get-id test) " 
60a0: 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 09 20  " item-path)... 
60b0: 20 20 20 20 20 28 72 64 62 3a 64 65 6c 65 74 65       (rdb:delete
60c0: 2d 74 65 73 74 2d 72 65 63 6f 72 64 73 20 64 62  -test-records db
60d0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64   (db:test-get-id
60e0: 20 74 65 73 74 29 29 0a 09 09 20 20 20 20 20 20   test))...      
60f0: 28 69 66 20 28 3e 20 28 73 74 72 69 6e 67 2d 6c  (if (> (string-l
6100: 65 6e 67 74 68 20 72 75 6e 2d 64 69 72 29 20 35  ength run-dir) 5
6110: 29 20 3b 3b 20 62 61 64 20 68 65 75 72 69 73 74  ) ;; bad heurist
6120: 69 63 20 62 75 74 20 73 68 6f 75 6c 64 20 70 72  ic but should pr
6130: 65 76 65 6e 74 20 2f 74 6d 70 20 2f 68 6f 6d 65  event /tmp /home
6140: 20 65 74 63 2e 0a 09 09 09 20 20 28 6c 65 74 20   etc.....  (let 
6150: 28 28 66 75 6c 6c 70 61 74 68 20 72 75 6e 2d 64  ((fullpath run-d
6160: 69 72 29 29 20 3b 3b 20 22 2f 22 20 28 64 62 3a  ir)) ;; "/" (db:
6170: 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61  test-get-item-pa
6180: 74 68 20 74 65 73 74 29 29 29 29 0a 09 09 09 20  th test)))).... 
6190: 20 20 20 28 73 65 74 21 20 6c 61 73 74 74 70 61     (set! lasttpa
61a0: 74 68 20 66 75 6c 6c 70 61 74 68 29 0a 09 09 09  th fullpath)....
61b0: 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d      (hash-table-
61c0: 73 65 74 21 20 64 69 72 73 2d 74 6f 2d 72 65 6d  set! dirs-to-rem
61d0: 6f 76 65 20 66 75 6c 6c 70 61 74 68 20 23 74 29  ove fullpath #t)
61e0: 0a 09 09 09 20 20 20 20 3b 3b 20 54 68 65 20 66  ....    ;; The f
61f0: 6f 6c 6c 6f 77 69 6e 67 20 77 61 73 20 74 68 65  ollowing was the
6200: 20 73 61 66 65 20 64 65 6c 65 74 65 20 63 6f 64   safe delete cod
6210: 65 20 62 75 74 20 69 74 20 77 61 73 20 6e 6f 74  e but it was not
6220: 20 62 65 69 6e 67 20 65 78 65 63 74 75 74 65 64   being exectuted
6230: 2e 0a 09 09 09 20 20 20 20 3b 3b 20 28 6c 65 74  .....    ;; (let
6240: 2a 20 28 28 64 69 72 73 2d 63 6f 75 6e 74 20 28  * ((dirs-count (
6250: 2b 20 31 20 28 6c 65 6e 67 74 68 20 6b 65 79 73  + 1 (length keys
6260: 29 28 6c 65 6e 67 74 68 20 28 73 74 72 69 6e 67  )(length (string
6270: 2d 73 70 6c 69 74 20 69 74 65 6d 2d 70 61 74 68  -split item-path
6280: 20 22 2f 22 29 29 29 29 0a 09 09 09 20 20 20 20   "/"))))....    
6290: 3b 3b 20 20 20 20 20 20 20 20 28 64 69 72 2d 74  ;;        (dir-t
62a0: 6f 2d 72 65 6d 20 28 67 65 74 2d 64 69 72 2d 75  o-rem (get-dir-u
62b0: 70 2d 6e 20 66 75 6c 6c 70 61 74 68 20 64 69 72  p-n fullpath dir
62c0: 73 2d 63 6f 75 6e 74 29 29 0a 09 09 09 20 20 20  s-count))....   
62d0: 20 3b 3b 20 20 20 20 20 20 20 20 28 72 65 6d 61   ;;        (rema
62e0: 69 6e 69 6e 67 64 20 28 73 74 72 69 6e 67 2d 73  iningd (string-s
62f0: 75 62 73 74 69 74 75 74 65 20 28 72 65 67 65 78  ubstitute (regex
6300: 70 20 28 63 6f 6e 63 20 22 5e 22 20 64 69 72 2d  p (conc "^" dir-
6310: 74 6f 2d 72 65 6d 20 22 2f 22 29 29 20 22 22 20  to-rem "/")) "" 
6320: 66 75 6c 6c 70 61 74 68 29 29 0a 09 09 09 20 20  fullpath))....  
6330: 20 20 3b 3b 20 20 20 20 20 20 20 20 28 63 6d 64    ;;        (cmd
6340: 20 28 63 6f 6e 63 20 22 63 64 20 22 20 64 69 72   (conc "cd " dir
6350: 2d 74 6f 2d 72 65 6d 20 22 3b 20 72 6d 64 69 72  -to-rem "; rmdir
6360: 20 2d 70 20 22 20 72 65 6d 61 69 6e 69 6e 67 64   -p " remainingd
6370: 20 29 29 29 0a 09 09 09 20 20 20 20 3b 3b 20 20   )))....    ;;  
6380: 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74   (if (file-exist
6390: 73 3f 20 66 75 6c 6c 70 61 74 68 29 0a 09 09 09  s? fullpath)....
63a0: 20 20 20 20 3b 3b 20 20 20 20 20 20 20 28 62 65      ;;       (be
63b0: 67 69 6e 0a 09 09 09 20 20 20 20 3b 3b 20 20 20  gin....    ;;   
63c0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
63d0: 6e 74 20 31 20 63 6d 64 29 0a 09 09 09 20 20 20  nt 1 cmd)....   
63e0: 20 3b 3b 20 20 20 20 20 20 20 20 20 28 73 79 73   ;;         (sys
63f0: 74 65 6d 20 63 6d 64 29 29 29 0a 09 09 09 20 20  tem cmd)))....  
6400: 20 20 3b 3b 20 20 20 29 29 0a 09 09 09 20 20 20    ;;   ))....   
6410: 20 29 29 29 29 0a 09 09 20 20 20 20 74 65 73 74   ))))...    test
6420: 73 29 29 29 0a 0a 09 20 20 20 3b 3b 20 6c 6f 6f  s)))...   ;; loo
6430: 6b 20 74 68 6f 75 67 68 20 74 68 65 20 64 69 72  k though the dir
6440: 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 66 6f 72 20  s-to-remove for 
6450: 63 61 6e 64 69 64 61 74 65 73 20 66 6f 72 20 72  candidates for r
6460: 65 6d 6f 76 61 6c 2e 20 44 6f 20 74 68 69 73 20  emoval. Do this 
6470: 61 66 74 65 72 20 64 65 6c 65 74 69 6e 67 20 74  after deleting t
6480: 68 65 20 72 65 63 6f 72 64 73 0a 09 20 20 20 3b  he records..   ;
6490: 3b 20 66 6f 72 20 65 61 63 68 20 74 65 73 74 20  ; for each test 
64a0: 69 6e 20 63 61 73 65 20 77 65 20 67 65 74 20 6b  in case we get k
64b0: 69 6c 6c 65 64 2e 20 54 68 61 74 20 73 68 6f 75  illed. That shou
64c0: 6c 64 20 6d 69 6e 69 6d 69 7a 65 20 74 68 65 20  ld minimize the 
64d0: 64 65 74 72 69 74 75 73 20 6c 65 66 74 20 6f 6e  detritus left on
64e0: 20 64 69 73 6b 0a 09 20 20 20 3b 3b 20 70 72 6f   disk..   ;; pro
64f0: 63 65 73 73 20 74 68 65 20 64 69 72 73 20 66 72  cess the dirs fr
6500: 6f 6d 20 6c 6f 6e 67 65 73 74 20 73 74 72 69 6e  om longest strin
6510: 67 20 6c 65 6e 67 74 68 20 74 6f 20 73 68 6f 72  g length to shor
6520: 74 65 73 74 0a 09 20 20 20 28 66 6f 72 2d 65 61  test..   (for-ea
6530: 63 68 20 0a 09 20 20 20 20 28 6c 61 6d 62 64 61  ch ..    (lambda
6540: 20 28 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 29   (dir-to-remove)
6550: 0a 09 20 20 20 20 20 20 28 69 66 20 28 66 69 6c  ..      (if (fil
6560: 65 2d 65 78 69 73 74 73 3f 20 64 69 72 2d 74 6f  e-exists? dir-to
6570: 2d 72 65 6d 6f 76 65 29 0a 09 09 20 20 28 6c 65  -remove)...  (le
6580: 74 20 28 28 64 69 72 2d 69 6e 2d 64 62 20 27 28  t ((dir-in-db '(
6590: 29 29 29 0a 09 09 20 20 20 20 28 73 71 6c 69 74  )))...    (sqlit
65a0: 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 0a  e3:for-each-row.
65b0: 09 09 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28  ..     (lambda (
65c0: 64 69 72 29 0a 09 09 20 20 20 20 20 20 20 28 73  dir)...       (s
65d0: 65 74 21 20 64 69 72 2d 69 6e 2d 64 62 20 28 63  et! dir-in-db (c
65e0: 6f 6e 73 20 64 69 72 20 64 69 72 2d 69 6e 2d 64  ons dir dir-in-d
65f0: 62 29 29 29 0a 09 09 20 20 20 20 20 64 62 20 22  b)))...     db "
6600: 53 45 4c 45 43 54 20 72 75 6e 64 69 72 20 46 52  SELECT rundir FR
6610: 4f 4d 20 74 65 73 74 73 20 57 48 45 52 45 20 72  OM tests WHERE r
6620: 75 6e 64 69 72 20 4c 49 4b 45 20 3f 3b 22 20 0a  undir LIKE ?;" .
6630: 09 09 20 20 20 20 20 28 63 6f 6e 63 20 22 25 22  ..     (conc "%"
6640: 20 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 20 22   dir-to-remove "
6650: 25 22 29 29 20 3b 3b 20 79 65 73 2c 20 49 27 6d  %")) ;; yes, I'm
6660: 20 67 6f 69 6e 67 20 74 6f 20 62 61 69 6c 20 69   going to bail i
6670: 66 20 74 68 65 72 65 20 69 73 20 61 6e 79 74 68  f there is anyth
6680: 69 6e 67 20 6c 69 6b 65 20 74 68 69 73 20 64 69  ing like this di
6690: 72 20 69 6e 20 74 68 65 20 64 62 0a 09 09 20 20  r in the db...  
66a0: 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 64 69 72    (if (null? dir
66b0: 2d 69 6e 2d 64 62 29 0a 09 09 09 28 62 65 67 69  -in-db)....(begi
66c0: 6e 0a 09 09 09 20 20 28 64 65 62 75 67 3a 70 72  n....  (debug:pr
66d0: 69 6e 74 20 32 20 22 52 65 6d 6f 76 69 6e 67 20  int 2 "Removing 
66e0: 64 69 72 65 63 74 6f 72 79 20 77 69 74 68 20 7a  directory with z
66f0: 65 72 6f 20 64 62 20 72 65 66 65 72 65 6e 63 65  ero db reference
6700: 73 3a 20 22 20 64 69 72 2d 74 6f 2d 72 65 6d 6f  s: " dir-to-remo
6710: 76 65 29 0a 09 09 09 20 20 28 73 79 73 74 65 6d  ve)....  (system
6720: 20 28 63 6f 6e 63 20 22 72 6d 20 2d 72 66 20 22   (conc "rm -rf "
6730: 20 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 29 29   dir-to-remove))
6740: 0a 09 09 09 20 20 28 68 61 73 68 2d 74 61 62 6c  ....  (hash-tabl
6750: 65 2d 64 65 6c 65 74 65 21 20 64 69 72 73 2d 74  e-delete! dirs-t
6760: 6f 2d 72 65 6d 6f 76 65 20 64 69 72 2d 74 6f 2d  o-remove dir-to-
6770: 72 65 6d 6f 76 65 29 29 0a 09 09 09 28 64 65 62  remove))....(deb
6780: 75 67 3a 70 72 69 6e 74 20 32 20 22 53 6b 69 70  ug:print 2 "Skip
6790: 70 69 6e 67 20 72 65 6d 6f 76 61 6c 20 6f 66 20  ping removal of 
67a0: 22 20 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 20  " dir-to-remove 
67b0: 22 20 66 6f 72 20 6e 6f 77 20 61 73 20 69 74 20  " for now as it 
67c0: 73 74 69 6c 6c 20 68 61 73 20 72 65 66 65 72 65  still has refere
67d0: 6e 63 65 73 20 69 6e 20 74 68 65 20 64 61 74 61  nces in the data
67e0: 62 61 73 65 22 29 29 29 29 29 0a 09 20 20 20 20  base")))))..    
67f0: 28 73 6f 72 74 20 28 68 61 73 68 2d 74 61 62 6c  (sort (hash-tabl
6800: 65 2d 6b 65 79 73 20 64 69 72 73 2d 74 6f 2d 72  e-keys dirs-to-r
6810: 65 6d 6f 76 65 29 20 28 6c 61 6d 62 64 61 20 28  emove) (lambda (
6820: 61 20 62 29 28 3e 20 28 73 74 72 69 6e 67 2d 6c  a b)(> (string-l
6830: 65 6e 67 74 68 20 61 29 28 73 74 72 69 6e 67 2d  ength a)(string-
6840: 6c 65 6e 67 74 68 20 62 29 29 29 29 29 0a 0a 09  length b)))))...
6850: 20 20 20 3b 3b 20 72 65 6d 6f 76 65 20 74 68 65     ;; remove the
6860: 20 72 75 6e 20 69 66 20 7a 65 72 6f 20 74 65 73   run if zero tes
6870: 74 73 20 72 65 6d 61 69 6e 0a 09 20 20 20 28 6c  ts remain..   (l
6880: 65 74 20 28 28 72 65 6d 74 65 73 74 73 20 28 72  et ((remtests (r
6890: 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72  db:get-tests-for
68a0: 2d 72 75 6e 20 64 62 20 28 64 62 3a 67 65 74 2d  -run db (db:get-
68b0: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20  value-by-header 
68c0: 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 22 29  run header "id")
68d0: 20 23 66 20 23 66 20 27 28 29 20 27 28 29 29 29   #f #f '() '()))
68e0: 29 0a 09 20 20 20 20 20 28 69 66 20 28 6e 75 6c  )..     (if (nul
68f0: 6c 3f 20 72 65 6d 74 65 73 74 73 29 20 3b 3b 20  l? remtests) ;; 
6900: 6e 6f 20 6d 6f 72 65 20 74 65 73 74 73 20 72 65  no more tests re
6910: 6d 61 69 6e 69 6e 67 0a 09 09 20 28 6c 65 74 2a  maining... (let*
6920: 20 28 28 64 70 61 72 74 73 20 20 28 73 74 72 69   ((dparts  (stri
6930: 6e 67 2d 73 70 6c 69 74 20 6c 61 73 74 74 70 61  ng-split lasttpa
6940: 74 68 20 22 2f 22 29 29 0a 09 09 09 28 72 75 6e  th "/"))....(run
6950: 70 61 74 68 20 28 63 6f 6e 63 20 22 2f 22 20 28  path (conc "/" (
6960: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72  string-intersper
6970: 73 65 20 0a 09 09 09 09 09 20 20 20 20 28 74 61  se ......    (ta
6980: 6b 65 20 64 70 61 72 74 73 20 28 2d 20 28 6c 65  ke dparts (- (le
6990: 6e 67 74 68 20 64 70 61 72 74 73 29 20 31 29 29  ngth dparts) 1))
69a0: 0a 09 09 09 09 09 20 20 20 20 22 2f 22 29 29 29  ......    "/")))
69b0: 29 0a 09 09 20 20 20 28 64 65 62 75 67 3a 70 72  )...   (debug:pr
69c0: 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20  int 1 "Removing 
69d0: 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20  run: " runkey " 
69e0: 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d  " (db:get-value-
69f0: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65  by-header run he
6a00: 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 29  ader "runname"))
6a10: 0a 09 09 20 20 20 28 64 62 3a 64 65 6c 65 74 65  ...   (db:delete
6a20: 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 29 0a  -run db run-id).
6a30: 09 09 20 20 20 3b 3b 20 6e 65 65 64 20 74 6f 20  ..   ;; need to 
6a40: 66 69 67 75 72 65 20 6f 75 74 20 74 68 65 20 70  figure out the p
6a50: 61 74 68 20 74 6f 20 74 68 65 20 72 75 6e 20 64  ath to the run d
6a60: 69 72 20 61 6e 64 20 72 65 6d 6f 76 65 20 69 74  ir and remove it
6a70: 20 69 66 20 65 6d 70 74 79 0a 09 09 20 20 20 3b   if empty...   ;
6a80: 3b 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20  ;    (if (null? 
6a90: 28 67 6c 6f 62 20 28 63 6f 6e 63 20 72 75 6e 70  (glob (conc runp
6aa0: 61 74 68 20 22 2f 2a 22 29 29 29 0a 09 09 20 20  ath "/*")))...  
6ab0: 20 3b 3b 20 20 20 20 20 20 20 20 28 62 65 67 69   ;;        (begi
6ac0: 6e 0a 09 09 20 20 20 3b 3b 20 09 20 28 64 65 62  n...   ;; . (deb
6ad0: 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f  ug:print 1 "Remo
6ae0: 76 69 6e 67 20 72 75 6e 20 64 69 72 20 22 20 72  ving run dir " r
6af0: 75 6e 70 61 74 68 29 0a 09 09 20 20 20 3b 3b 20  unpath)...   ;; 
6b00: 09 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20  . (system (conc 
6b10: 22 72 6d 64 69 72 20 2d 70 20 22 20 72 75 6e 70  "rmdir -p " runp
6b20: 61 74 68 29 29 29 29 0a 09 09 20 20 20 29 29 29  ath))))...   )))
6b30: 29 0a 09 20 29 29 0a 20 20 20 20 20 72 75 6e 73  ).. )).     runs
6b40: 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d  )))..;;=========
6b50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6b60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6b70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6b80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b  =============.;;
6b90: 20 52 6f 75 74 69 6e 65 73 20 66 6f 72 20 6d 61   Routines for ma
6ba0: 6e 69 70 75 6c 61 74 69 6e 67 20 72 75 6e 73 0a  nipulating runs.
6bb0: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;;==============
6bc0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6bd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6be0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6bf0: 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 53 69 6e  ========..;; Sin
6c00: 63 65 20 6d 61 6e 79 20 63 61 6c 6c 73 20 74 6f  ce many calls to
6c10: 20 61 20 72 75 6e 20 72 65 71 75 69 72 65 20 70   a run require p
6c20: 72 65 74 74 79 20 6d 75 63 68 20 74 68 65 20 73  retty much the s
6c30: 61 6d 65 20 73 65 74 75 70 20 0a 3b 3b 20 74 68  ame setup .;; th
6c40: 69 73 20 77 72 61 70 70 65 72 20 69 73 20 75 73  is wrapper is us
6c50: 65 64 20 74 6f 20 72 65 64 75 63 65 20 74 68 65  ed to reduce the
6c60: 20 72 65 70 6c 69 63 61 74 69 6f 6e 20 6f 66 20   replication of 
6c70: 63 6f 64 65 0a 28 64 65 66 69 6e 65 20 28 67 65  code.(define (ge
6c80: 6e 65 72 61 6c 2d 72 75 6e 2d 63 61 6c 6c 20 73  neral-run-call s
6c90: 77 69 74 63 68 6e 61 6d 65 20 61 63 74 69 6f 6e  witchname action
6ca0: 2d 64 65 73 63 20 70 72 6f 63 29 0a 20 20 28 6c  -desc proc).  (l
6cb0: 65 74 20 28 28 72 75 6e 6e 61 6d 65 20 28 61 72  et ((runname (ar
6cc0: 67 73 3a 67 65 74 2d 61 72 67 20 22 3a 72 75 6e  gs:get-arg ":run
6cd0: 6e 61 6d 65 22 29 29 0a 09 28 74 61 72 67 65 74  name"))..(target
6ce0: 20 20 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d    (if (args:get-
6cf0: 61 72 67 20 22 2d 74 61 72 67 65 74 22 29 0a 09  arg "-target")..
6d00: 09 20 20 20 20 20 28 61 72 67 73 3a 67 65 74 2d  .     (args:get-
6d10: 61 72 67 20 22 2d 74 61 72 67 65 74 22 29 0a 09  arg "-target")..
6d20: 09 20 20 20 20 20 28 61 72 67 73 3a 67 65 74 2d  .     (args:get-
6d30: 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 29  arg "-reqtarg"))
6d40: 29 0a 09 28 74 68 31 20 20 20 20 20 23 66 29 29  )..(th1     #f))
6d50: 0a 20 20 20 20 28 63 6f 6e 64 0a 20 20 20 20 20  .    (cond.     
6d60: 28 28 6e 6f 74 20 74 61 72 67 65 74 29 0a 20 20  ((not target).  
6d70: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
6d80: 20 30 20 22 45 52 52 4f 52 3a 20 4d 69 73 73 69   0 "ERROR: Missi
6d90: 6e 67 20 72 65 71 75 69 72 65 64 20 70 61 72 61  ng required para
6da0: 6d 65 74 65 72 20 66 6f 72 20 22 20 73 77 69 74  meter for " swit
6db0: 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d 75  chname ", you mu
6dc0: 73 74 20 73 70 65 63 69 66 79 20 74 68 65 20 74  st specify the t
6dd0: 61 72 67 65 74 20 77 69 74 68 20 2d 74 61 72 67  arget with -targ
6de0: 65 74 22 29 0a 20 20 20 20 20 20 28 65 78 69 74  et").      (exit
6df0: 20 33 29 29 0a 20 20 20 20 20 28 28 6e 6f 74 20   3)).     ((not 
6e00: 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20 20 20 28  runname).      (
6e10: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45  debug:print 0 "E
6e20: 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67 20 72 65  RROR: Missing re
6e30: 71 75 69 72 65 64 20 70 61 72 61 6d 65 74 65 72  quired parameter
6e40: 20 66 6f 72 20 22 20 73 77 69 74 63 68 6e 61 6d   for " switchnam
6e50: 65 20 22 2c 20 79 6f 75 20 6d 75 73 74 20 73 70  e ", you must sp
6e60: 65 63 69 66 79 20 74 68 65 20 72 75 6e 20 6e 61  ecify the run na
6e70: 6d 65 20 77 69 74 68 20 3a 72 75 6e 6e 61 6d 65  me with :runname
6e80: 20 72 75 6e 6e 61 6d 65 22 29 0a 20 20 20 20 20   runname").     
6e90: 20 28 65 78 69 74 20 33 29 29 0a 20 20 20 20 20   (exit 3)).     
6ea0: 28 65 6c 73 65 0a 20 20 20 20 20 20 28 6c 65 74  (else.      (let
6eb0: 20 28 28 64 62 20 20 20 23 66 29 0a 09 20 20 20   ((db   #f)..   
6ec0: 20 28 6b 65 79 73 20 23 66 29 29 0a 09 28 69 66   (keys #f))..(if
6ed0: 20 28 6e 6f 74 20 28 73 65 74 75 70 2d 66 6f 72   (not (setup-for
6ee0: 2d 72 75 6e 29 29 0a 09 20 20 20 20 28 62 65 67  -run))..    (beg
6ef0: 69 6e 20 0a 09 20 20 20 20 20 20 28 64 65 62 75  in ..      (debu
6f00: 67 3a 70 72 69 6e 74 20 30 20 22 46 61 69 6c 65  g:print 0 "Faile
6f10: 64 20 74 6f 20 73 65 74 75 70 2c 20 65 78 69 74  d to setup, exit
6f20: 69 6e 67 22 29 0a 09 20 20 20 20 20 20 28 65 78  ing")..      (ex
6f30: 69 74 20 31 29 29 29 0a 09 28 73 65 74 21 20 64  it 1)))..(set! d
6f40: 62 20 20 20 28 6f 70 65 6e 2d 64 62 29 29 0a 09  b   (open-db))..
6f50: 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72  (if (args:get-ar
6f60: 67 20 22 2d 73 65 72 76 65 72 22 29 0a 09 20 20  g "-server")..  
6f70: 20 20 28 73 65 72 76 65 72 3a 73 74 61 72 74 20    (server:start 
6f80: 64 62 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  db (args:get-arg
6f90: 20 22 2d 73 65 72 76 65 72 22 29 29 0a 09 20 20   "-server"))..  
6fa0: 20 20 28 69 66 20 28 6e 6f 74 20 28 6f 72 20 28    (if (not (or (
6fb0: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72  args:get-arg "-r
6fc0: 75 6e 61 6c 6c 22 29 0a 09 09 09 20 20 28 61 72  unall")....  (ar
6fd0: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 75 6e  gs:get-arg "-run
6fe0: 74 65 73 74 73 22 29 29 29 0a 09 09 28 73 65 72  tests")))...(ser
6ff0: 76 65 72 3a 63 6c 69 65 6e 74 2d 73 65 74 75 70  ver:client-setup
7000: 20 64 62 29 29 29 0a 09 28 73 65 74 21 20 6b 65   db)))..(set! ke
7010: 79 73 20 28 72 64 62 3a 67 65 74 2d 6b 65 79 73  ys (rdb:get-keys
7020: 20 64 62 29 29 0a 09 3b 3b 20 68 61 76 65 20 65   db))..;; have e
7030: 6e 6f 75 67 68 20 74 6f 20 70 72 6f 63 65 73 73  nough to process
7040: 20 2d 74 61 72 67 65 74 20 6f 72 20 2d 72 65 71   -target or -req
7050: 74 61 72 67 20 68 65 72 65 0a 09 28 69 66 20 28  targ here..(if (
7060: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72  args:get-arg "-r
7070: 65 71 74 61 72 67 22 29 0a 09 20 20 20 20 28 6c  eqtarg")..    (l
7080: 65 74 2a 20 28 28 72 75 6e 63 6f 6e 66 69 67 66  et* ((runconfigf
7090: 20 28 63 6f 6e 63 20 20 2a 74 6f 70 70 61 74 68   (conc  *toppath
70a0: 2a 20 22 2f 72 75 6e 63 6f 6e 66 69 67 73 2e 63  * "/runconfigs.c
70b0: 6f 6e 66 69 67 22 29 29 20 3b 3b 20 44 4f 20 4e  onfig")) ;; DO N
70c0: 4f 54 20 45 56 41 4c 55 41 54 45 20 41 4c 4c 20  OT EVALUATE ALL 
70d0: 0a 09 09 20 20 20 28 72 75 6e 63 6f 6e 66 69 67  ...   (runconfig
70e0: 20 20 28 72 65 61 64 2d 63 6f 6e 66 69 67 20 72    (read-config r
70f0: 75 6e 63 6f 6e 66 69 67 66 20 23 66 20 23 66 20  unconfigf #f #f 
7100: 65 6e 76 69 72 6f 6e 2d 70 61 74 74 3a 20 23 66  environ-patt: #f
7110: 29 29 29 20 0a 09 20 20 20 20 20 20 28 69 66 20  ))) ..      (if 
7120: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f  (hash-table-ref/
7130: 64 65 66 61 75 6c 74 20 72 75 6e 63 6f 6e 66 69  default runconfi
7140: 67 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20  g (args:get-arg 
7150: 22 2d 72 65 71 74 61 72 67 22 29 20 23 66 29 0a  "-reqtarg") #f).
7160: 09 09 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74  ..  (keys:target
7170: 2d 73 65 74 2d 61 72 67 73 20 6b 65 79 73 20 28  -set-args keys (
7180: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72  args:get-arg "-r
7190: 65 71 74 61 72 67 22 29 20 61 72 67 73 3a 61 72  eqtarg") args:ar
71a0: 67 2d 68 61 73 68 29 0a 09 09 20 20 28 62 65 67  g-hash)...  (beg
71b0: 69 6e 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a  in...    (debug:
71c0: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
71d0: 5b 22 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  [" (args:get-arg
71e0: 20 22 2d 72 65 71 74 61 72 67 22 29 20 22 5d 20   "-reqtarg") "] 
71f0: 6e 6f 74 20 66 6f 75 6e 64 20 69 6e 20 22 20 72  not found in " r
7200: 75 6e 63 6f 6e 66 69 67 66 29 0a 09 09 20 20 20  unconfigf)...   
7210: 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69   (sqlite3:finali
7220: 7a 65 21 20 64 62 29 0a 09 09 20 20 20 20 28 65  ze! db)...    (e
7230: 78 69 74 20 31 29 29 29 29 0a 09 20 20 20 20 28  xit 1))))..    (
7240: 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  if (args:get-arg
7250: 20 22 2d 74 61 72 67 65 74 22 29 0a 09 09 28 6b   "-target")...(k
7260: 65 79 73 3a 74 61 72 67 65 74 2d 73 65 74 2d 61  eys:target-set-a
7270: 72 67 73 20 6b 65 79 73 20 28 61 72 67 73 3a 67  rgs keys (args:g
7280: 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22  et-arg "-target"
7290: 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 20   args:arg-hash) 
72a0: 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 29 29  args:arg-hash)))
72b0: 0a 09 28 69 66 20 28 6e 6f 74 20 28 63 61 72 20  ..(if (not (car 
72c0: 2a 63 6f 6e 66 69 67 69 6e 66 6f 2a 29 29 0a 09  *configinfo*))..
72d0: 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20      (begin..    
72e0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
72f0: 20 22 45 52 52 4f 52 3a 20 41 74 74 65 6d 70 74   "ERROR: Attempt
7300: 65 64 20 74 6f 20 22 20 61 63 74 69 6f 6e 2d 64  ed to " action-d
7310: 65 73 63 20 22 20 62 75 74 20 72 75 6e 20 61 72  esc " but run ar
7320: 65 61 20 63 6f 6e 66 69 67 20 66 69 6c 65 20 6e  ea config file n
7330: 6f 74 20 66 6f 75 6e 64 22 29 0a 09 20 20 20 20  ot found")..    
7340: 20 20 28 65 78 69 74 20 31 29 29 0a 09 20 20 20    (exit 1))..   
7350: 20 3b 3b 20 45 78 74 72 61 63 74 20 6f 75 74 20   ;; Extract out 
7360: 73 74 75 66 66 20 6e 65 65 64 65 64 20 69 6e 20  stuff needed in 
7370: 6d 6f 73 74 20 6f 72 20 6d 61 6e 79 20 63 61 6c  most or many cal
7380: 6c 73 0a 09 20 20 20 20 3b 3b 20 68 65 72 65 20  ls..    ;; here 
7390: 74 68 65 6e 20 63 61 6c 6c 20 70 72 6f 63 0a 09  then call proc..
73a0: 20 20 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 6e      (let* ((keyn
73b0: 61 6d 65 73 20 20 20 28 6d 61 70 20 6b 65 79 3a  ames   (map key:
73c0: 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65  get-fieldname ke
73d0: 79 73 29 29 0a 09 09 20 20 20 28 6b 65 79 76 61  ys))...   (keyva
73e0: 6c 6c 73 74 20 20 28 6b 65 79 73 2d 3e 76 61 6c  llst  (keys->val
73f0: 6c 69 73 74 20 6b 65 79 73 20 23 74 29 29 29 0a  list keys #t))).
7400: 09 20 20 20 20 20 20 28 70 72 6f 63 20 64 62 20  .      (proc db 
7410: 74 61 72 67 65 74 20 72 75 6e 6e 61 6d 65 20 6b  target runname k
7420: 65 79 73 20 6b 65 79 6e 61 6d 65 73 20 6b 65 79  eys keynames key
7430: 76 61 6c 6c 73 74 29 29 29 0a 09 28 69 66 20 74  vallst)))..(if t
7440: 68 31 20 28 74 68 72 65 61 64 2d 6a 6f 69 6e 21  h1 (thread-join!
7450: 20 74 68 31 29 29 0a 09 28 73 71 6c 69 74 65 33   th1))..(sqlite3
7460: 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 29 0a 09  :finalize! db)..
7470: 28 73 65 74 21 20 2a 64 69 64 73 6f 6d 65 74 68  (set! *didsometh
7480: 69 6e 67 2a 20 23 74 29 29 29 29 29 29 0a 0a 3b  ing* #t))))))..;
7490: 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;===============
74a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
74b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
74c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
74d0: 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 6c 6c 75  =======.;; Rollu
74e0: 70 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d  p runs.;;=======
74f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7500: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7510: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7520: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a  ===============.
7530: 0a 3b 3b 20 55 70 64 61 74 65 20 74 68 65 20 74  .;; Update the t
7540: 65 73 74 5f 6d 65 74 61 20 74 61 62 6c 65 20 66  est_meta table f
7550: 6f 72 20 74 68 69 73 20 74 65 73 74 0a 28 64 65  or this test.(de
7560: 66 69 6e 65 20 28 72 75 6e 73 3a 75 70 64 61 74  fine (runs:updat
7570: 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20 74  e-test_meta db t
7580: 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f  est-name test-co
7590: 6e 66 29 0a 20 20 28 6c 65 74 20 28 28 63 75 72  nf).  (let ((cur
75a0: 72 72 65 63 6f 72 64 20 28 64 62 3a 74 65 73 74  rrecord (db:test
75b0: 6d 65 74 61 2d 67 65 74 2d 72 65 63 6f 72 64 20  meta-get-record 
75c0: 64 62 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a  db test-name))).
75d0: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 63 75 72      (if (not cur
75e0: 72 72 65 63 6f 72 64 29 0a 09 28 62 65 67 69 6e  rrecord)..(begin
75f0: 0a 09 20 20 28 73 65 74 21 20 63 75 72 72 72 65  ..  (set! currre
7600: 63 6f 72 64 20 28 6d 61 6b 65 2d 76 65 63 74 6f  cord (make-vecto
7610: 72 20 31 30 20 23 66 29 29 0a 09 20 20 28 64 62  r 10 #f))..  (db
7620: 3a 74 65 73 74 6d 65 74 61 2d 61 64 64 2d 72 65  :testmeta-add-re
7630: 63 6f 72 64 20 64 62 20 74 65 73 74 2d 6e 61 6d  cord db test-nam
7640: 65 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61  e))).    (for-ea
7650: 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61  ch .     (lambda
7660: 20 28 6b 65 79 29 0a 20 20 20 20 20 20 20 28 6c   (key).       (l
7670: 65 74 2a 20 28 28 69 64 78 20 28 63 61 64 72 20  et* ((idx (cadr 
7680: 6b 65 79 29 29 0a 09 20 20 20 20 20 20 28 66 6c  key))..      (fl
7690: 64 20 28 63 61 72 20 20 6b 65 79 29 29 0a 09 20  d (car  key)).. 
76a0: 20 20 20 20 20 28 76 61 6c 20 28 63 6f 6e 66 69       (val (confi
76b0: 67 2d 6c 6f 6f 6b 75 70 20 74 65 73 74 2d 63 6f  g-lookup test-co
76c0: 6e 66 20 22 74 65 73 74 5f 6d 65 74 61 22 20 66  nf "test_meta" f
76d0: 6c 64 29 29 29 0a 09 20 3b 3b 20 28 64 65 62 75  ld))).. ;; (debu
76e0: 67 3a 70 72 69 6e 74 20 35 20 22 69 64 78 3a 20  g:print 5 "idx: 
76f0: 22 20 69 64 78 20 22 20 66 6c 64 3a 20 22 20 66  " idx " fld: " f
7700: 6c 64 20 22 20 76 61 6c 3a 20 22 20 76 61 6c 29  ld " val: " val)
7710: 0a 09 20 28 69 66 20 28 61 6e 64 20 76 61 6c 20  .. (if (and val 
7720: 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 28 76 65  (not (equal? (ve
7730: 63 74 6f 72 2d 72 65 66 20 63 75 72 72 72 65 63  ctor-ref currrec
7740: 6f 72 64 20 69 64 78 29 20 76 61 6c 29 29 29 0a  ord idx) val))).
7750: 09 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20  .     (begin..  
7760: 20 20 20 20 20 28 70 72 69 6e 74 20 22 55 70 64       (print "Upd
7770: 61 74 69 6e 67 20 22 20 74 65 73 74 2d 6e 61 6d  ating " test-nam
7780: 65 20 22 20 22 20 66 6c 64 20 22 20 74 6f 20 22  e " " fld " to "
7790: 20 76 61 6c 29 0a 09 20 20 20 20 20 20 20 28 64   val)..       (d
77a0: 62 3a 74 65 73 74 6d 65 74 61 2d 75 70 64 61 74  b:testmeta-updat
77b0: 65 2d 66 69 65 6c 64 20 64 62 20 74 65 73 74 2d  e-field db test-
77c0: 6e 61 6d 65 20 66 6c 64 20 76 61 6c 29 29 29 29  name fld val))))
77d0: 29 0a 20 20 20 20 20 27 28 28 22 61 75 74 68 6f  ).     '(("autho
77e0: 72 22 20 32 29 28 22 6f 77 6e 65 72 22 20 33 29  r" 2)("owner" 3)
77f0: 28 22 64 65 73 63 72 69 70 74 69 6f 6e 22 20 34  ("description" 4
7800: 29 28 22 72 65 76 69 65 77 65 64 22 20 35 29 28  )("reviewed" 5)(
7810: 22 74 61 67 73 22 20 39 29 29 29 29 29 0a 0a 3b  "tags" 9)))))..;
7820: 3b 20 55 70 64 61 74 65 20 74 65 73 74 5f 6d 65  ; Update test_me
7830: 74 61 20 66 6f 72 20 61 6c 6c 20 74 65 73 74 73  ta for all tests
7840: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 75  .(define (runs:u
7850: 70 64 61 74 65 2d 61 6c 6c 2d 74 65 73 74 5f 6d  pdate-all-test_m
7860: 65 74 61 20 64 62 29 0a 20 20 28 6c 65 74 20 28  eta db).  (let (
7870: 28 74 65 73 74 2d 6e 61 6d 65 73 20 28 67 65 74  (test-names (get
7880: 2d 61 6c 6c 2d 6c 65 67 61 6c 2d 74 65 73 74 73  -all-legal-tests
7890: 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63  ))).    (for-eac
78a0: 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20  h .     (lambda 
78b0: 28 74 65 73 74 2d 6e 61 6d 65 29 0a 20 20 20 20  (test-name).    
78c0: 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d     (let* ((test-
78d0: 70 61 74 68 20 20 20 20 28 63 6f 6e 63 20 2a 74  path    (conc *t
78e0: 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f  oppath* "/tests/
78f0: 22 20 74 65 73 74 2d 6e 61 6d 65 29 29 0a 09 20  " test-name)).. 
7900: 20 20 20 20 20 28 74 65 73 74 2d 63 6f 6e 66 69       (test-confi
7910: 67 66 20 28 63 6f 6e 63 20 74 65 73 74 2d 70 61  gf (conc test-pa
7920: 74 68 20 22 2f 74 65 73 74 63 6f 6e 66 69 67 22  th "/testconfig"
7930: 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 65  ))..      (teste
7940: 78 69 73 74 73 20 20 20 28 61 6e 64 20 28 66 69  xists   (and (fi
7950: 6c 65 2d 65 78 69 73 74 73 3f 20 74 65 73 74 2d  le-exists? test-
7960: 63 6f 6e 66 69 67 66 29 28 66 69 6c 65 2d 72 65  configf)(file-re
7970: 61 64 2d 61 63 63 65 73 73 3f 20 74 65 73 74 2d  ad-access? test-
7980: 63 6f 6e 66 69 67 66 29 29 29 0a 09 20 20 20 20  configf)))..    
7990: 20 20 3b 3b 20 72 65 61 64 20 63 6f 6e 66 69 67    ;; read config
79a0: 73 20 77 69 74 68 20 74 72 69 63 6b 73 20 74 75  s with tricks tu
79b0: 72 6e 65 64 20 6f 66 66 20 28 69 2e 65 2e 20 6e  rned off (i.e. n
79c0: 6f 20 73 79 73 74 65 6d 29 0a 09 20 20 20 20 20  o system)..     
79d0: 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 20 28   (test-conf    (
79e0: 69 66 20 74 65 73 74 65 78 69 73 74 73 20 28 72  if testexists (r
79f0: 65 61 64 2d 63 6f 6e 66 69 67 20 74 65 73 74 2d  ead-config test-
7a00: 63 6f 6e 66 69 67 66 20 23 66 20 23 66 29 28 6d  configf #f #f)(m
7a10: 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29  ake-hash-table))
7a20: 29 29 0a 09 20 28 72 75 6e 73 3a 75 70 64 61 74  )).. (runs:updat
7a30: 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20 74  e-test_meta db t
7a40: 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f  est-name test-co
7a50: 6e 66 29 29 29 0a 20 20 20 20 20 74 65 73 74 2d  nf))).     test-
7a60: 6e 61 6d 65 73 29 29 29 0a 0a 3b 3b 20 54 68 69  names)))..;; Thi
7a70: 73 20 63 6f 75 6c 64 20 70 72 6f 62 61 62 6c 79  s could probably
7a80: 20 62 65 20 72 65 66 61 63 74 6f 72 65 64 20 69   be refactored i
7a90: 6e 74 6f 20 6f 6e 65 20 63 6f 6d 70 6c 65 78 20  nto one complex 
7aa0: 71 75 65 72 79 20 2e 2e 2e 0a 28 64 65 66 69 6e  query ....(defin
7ab0: 65 20 28 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72  e (runs:rollup-r
7ac0: 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 61  un db keys keyva
7ad0: 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 75 73 65  llst runname use
7ae0: 72 29 20 3b 3b 20 77 61 73 20 74 61 72 67 65 74  r) ;; was target
7af0: 2c 20 6e 6f 77 20 6b 65 79 76 61 6c 6c 73 74 0a  , now keyvallst.
7b00: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34    (debug:print 4
7b10: 20 22 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75   "runs:rollup-ru
7b20: 6e 2c 20 6b 65 79 73 3a 20 22 20 6b 65 79 73 20  n, keys: " keys 
7b30: 22 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b  " keyvallst: " k
7b40: 65 79 76 61 6c 6c 73 74 20 22 20 3a 72 75 6e 6e  eyvallst " :runn
7b50: 61 6d 65 20 22 20 72 75 6e 6e 61 6d 65 20 22 20  ame " runname " 
7b60: 75 73 65 72 3a 20 22 20 75 73 65 72 29 0a 20 20  user: " user).  
7b70: 28 6c 65 74 2a 20 28 3b 20 28 6b 65 79 76 61 6c  (let* (; (keyval
7b80: 6c 6c 73 74 20 20 20 20 20 20 28 6b 65 79 73 3a  llst      (keys:
7b90: 74 61 72 67 65 74 2d 3e 6b 65 79 76 61 6c 20 6b  target->keyval k
7ba0: 65 79 73 20 74 61 72 67 65 74 29 29 0a 09 20 28  eys target)).. (
7bb0: 6e 65 77 2d 72 75 6e 2d 69 64 20 20 20 20 20 20  new-run-id      
7bc0: 28 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72  (runs:register-r
7bd0: 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 61  un db keys keyva
7be0: 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e 65  llst runname "ne
7bf0: 77 22 20 22 6e 2f 61 22 20 75 73 65 72 29 29 0a  w" "n/a" user)).
7c00: 09 20 28 70 72 65 76 2d 74 65 73 74 73 20 20 20  . (prev-tests   
7c10: 20 20 20 28 74 65 73 74 3a 67 65 74 2d 6d 61 74     (test:get-mat
7c20: 63 68 69 6e 67 2d 70 72 65 76 69 6f 75 73 2d 74  ching-previous-t
7c30: 65 73 74 2d 72 75 6e 2d 72 65 63 6f 72 64 73 20  est-run-records 
7c40: 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 22 25  db new-run-id "%
7c50: 22 20 22 25 22 29 29 0a 09 20 28 63 75 72 72 2d  " "%")).. (curr-
7c60: 74 65 73 74 73 20 20 20 20 20 20 28 72 64 62 3a  tests      (rdb:
7c70: 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75  get-tests-for-ru
7c80: 6e 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20  n db new-run-id 
7c90: 22 25 22 20 22 25 22 20 27 28 29 20 27 28 29 29  "%" "%" '() '())
7ca0: 29 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73 2d  ).. (curr-tests-
7cb0: 68 61 73 68 20 28 6d 61 6b 65 2d 68 61 73 68 2d  hash (make-hash-
7cc0: 74 61 62 6c 65 29 29 29 0a 20 20 20 20 28 64 62  table))).    (db
7cd0: 3a 75 70 64 61 74 65 2d 72 75 6e 2d 65 76 65 6e  :update-run-even
7ce0: 74 5f 74 69 6d 65 20 64 62 20 6e 65 77 2d 72 75  t_time db new-ru
7cf0: 6e 2d 69 64 29 0a 20 20 20 20 3b 3b 20 69 6e 64  n-id).    ;; ind
7d00: 65 78 20 74 68 65 20 61 6c 72 65 61 64 79 20 73  ex the already s
7d10: 61 76 65 64 20 74 65 73 74 73 20 62 79 20 74 65  aved tests by te
7d20: 73 74 6e 61 6d 65 20 61 6e 64 20 69 74 65 6d 64  stname and itemd
7d30: 61 74 20 69 6e 20 63 75 72 72 2d 74 65 73 74 73  at in curr-tests
7d40: 2d 68 61 73 68 0a 20 20 20 20 28 66 6f 72 2d 65  -hash.    (for-e
7d50: 61 63 68 0a 20 20 20 20 20 28 6c 61 6d 62 64 61  ach.     (lambda
7d60: 20 28 74 65 73 74 64 61 74 29 0a 20 20 20 20 20   (testdat).     
7d70: 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 6e 61    (let* ((testna
7d80: 6d 65 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74  me  (db:test-get
7d90: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 64 61  -testname testda
7da0: 74 29 29 0a 09 20 20 20 20 20 20 28 69 74 65 6d  t))..      (item
7db0: 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67  -path (db:test-g
7dc0: 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73  et-item-path tes
7dd0: 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 66  tdat))..      (f
7de0: 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74  ull-name (conc t
7df0: 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d  estname "/" item
7e00: 2d 70 61 74 68 29 29 29 0a 09 20 28 68 61 73 68  -path))).. (hash
7e10: 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72 72  -table-set! curr
7e20: 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c  -tests-hash full
7e30: 2d 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29 29  -name testdat)))
7e40: 0a 20 20 20 20 20 63 75 72 72 2d 74 65 73 74 73  .     curr-tests
7e50: 29 0a 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 4e  ).    ;; NOPE: N
7e60: 6f 6e 2d 6f 70 74 69 6d 61 6c 20 61 70 70 72 6f  on-optimal appro
7e70: 61 63 68 2e 20 54 72 79 20 74 68 69 73 20 69 6e  ach. Try this in
7e80: 73 74 65 61 64 2e 0a 20 20 20 20 3b 3b 20 20 20  stead..    ;;   
7e90: 31 2e 20 74 65 73 74 73 20 61 72 65 20 72 65 63  1. tests are rec
7ea0: 65 69 76 65 64 20 69 6e 20 61 20 6c 69 73 74 2c  eived in a list,
7eb0: 20 6d 6f 73 74 20 72 65 63 65 6e 74 20 66 69 72   most recent fir
7ec0: 73 74 0a 20 20 20 20 3b 3b 20 20 20 32 2e 20 72  st.    ;;   2. r
7ed0: 65 70 6c 61 63 65 20 74 68 65 20 72 6f 6c 6c 75  eplace the rollu
7ee0: 70 20 74 65 73 74 20 77 69 74 68 20 74 68 65 20  p test with the 
7ef0: 6e 65 77 20 2a 61 6c 77 61 79 73 2a 0a 20 20 20  new *always*.   
7f00: 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20   (for-each .    
7f10: 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 64 61   (lambda (testda
7f20: 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20  t).       (let* 
7f30: 28 28 74 65 73 74 6e 61 6d 65 20 20 28 64 62 3a  ((testname  (db:
7f40: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d  test-get-testnam
7f50: 65 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20  e testdat))..   
7f60: 20 20 20 28 69 74 65 6d 2d 70 61 74 68 20 28 64     (item-path (d
7f70: 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d  b:test-get-item-
7f80: 70 61 74 68 20 74 65 73 74 64 61 74 29 29 0a 09  path testdat))..
7f90: 20 20 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65        (full-name
7fa0: 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20   (conc testname 
7fb0: 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 0a  "/" item-path)).
7fc0: 09 20 20 20 20 20 20 28 70 72 65 76 2d 74 65 73  .      (prev-tes
7fd0: 74 2d 64 61 74 20 28 68 61 73 68 2d 74 61 62 6c  t-dat (hash-tabl
7fe0: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63 75  e-ref/default cu
7ff0: 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75  rr-tests-hash fu
8000: 6c 6c 2d 6e 61 6d 65 20 23 66 29 29 0a 09 20 20  ll-name #f))..  
8010: 20 20 20 20 28 74 65 73 74 2d 73 74 65 70 73 20      (test-steps 
8020: 20 20 20 20 20 28 64 62 3a 67 65 74 2d 73 74 65       (db:get-ste
8030: 70 73 2d 66 6f 72 2d 74 65 73 74 20 64 62 20 28  ps-for-test db (
8040: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74  db:test-get-id t
8050: 65 73 74 64 61 74 29 29 29 0a 09 20 20 20 20 20  estdat)))..     
8060: 20 28 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72   (new-test-recor
8070: 64 20 23 66 29 29 0a 09 20 3b 3b 20 72 65 70 6c  d #f)).. ;; repl
8080: 61 63 65 20 74 68 65 73 65 20 77 69 74 68 20 69  ace these with i
8090: 6e 73 65 72 74 20 2e 2e 2e 20 73 65 6c 65 63 74  nsert ... select
80a0: 0a 09 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65  .. (apply sqlite
80b0: 33 3a 65 78 65 63 75 74 65 20 0a 09 09 64 62 20  3:execute ...db 
80c0: 0a 09 09 28 63 6f 6e 63 20 22 49 4e 53 45 52 54  ...(conc "INSERT
80d0: 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f   OR REPLACE INTO
80e0: 20 74 65 73 74 73 20 28 72 75 6e 5f 69 64 2c 74   tests (run_id,t
80f0: 65 73 74 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74  estname,state,st
8100: 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c  atus,event_time,
8110: 68 6f 73 74 2c 63 70 75 6c 6f 61 64 2c 64 69 73  host,cpuload,dis
8120: 6b 66 72 65 65 2c 75 6e 61 6d 65 2c 72 75 6e 64  kfree,uname,rund
8130: 69 72 2c 69 74 65 6d 5f 70 61 74 68 2c 72 75 6e  ir,item_path,run
8140: 5f 64 75 72 61 74 69 6f 6e 2c 66 69 6e 61 6c 5f  _duration,final_
8150: 6c 6f 67 66 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a  logf,comment) ".
8160: 09 09 20 20 20 20 20 20 22 56 41 4c 55 45 53 20  ..      "VALUES 
8170: 28 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f  (?,?,?,?,?,?,?,?
8180: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 29 3b 22 29  ,?,?,?,?,?,?);")
8190: 0a 09 09 6e 65 77 2d 72 75 6e 2d 69 64 20 28 63  ...new-run-id (c
81a0: 64 64 72 20 28 76 65 63 74 6f 72 2d 3e 6c 69 73  ddr (vector->lis
81b0: 74 20 74 65 73 74 64 61 74 29 29 29 0a 09 20 28  t testdat))).. (
81c0: 73 65 74 21 20 6e 65 77 2d 74 65 73 74 64 61 74  set! new-testdat
81d0: 20 28 63 61 72 20 28 72 64 62 3a 67 65 74 2d 74   (car (rdb:get-t
81e0: 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20  ests-for-run db 
81f0: 6e 65 77 2d 72 75 6e 2d 69 64 20 74 65 73 74 6e  new-run-id testn
8200: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 20 27 28  ame item-path '(
8210: 29 20 27 28 29 29 29 29 0a 09 20 28 68 61 73 68  ) '()))).. (hash
8220: 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72 72  -table-set! curr
8230: 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c  -tests-hash full
8240: 2d 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74 64 61  -name new-testda
8250: 74 29 20 3b 3b 20 74 68 69 73 20 63 6f 75 6c 64  t) ;; this could
8260: 20 62 65 20 63 6f 6e 66 75 73 69 6e 67 2c 20 77   be confusing, w
8270: 68 69 63 68 20 72 65 63 6f 72 64 20 73 68 6f 75  hich record shou
8280: 6c 64 20 67 6f 20 69 6e 74 6f 20 74 68 65 20 6c  ld go into the l
8290: 6f 6f 6b 75 70 20 74 61 62 6c 65 3f 0a 09 20 3b  ookup table?.. ;
82a0: 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20  ; Now duplicate 
82b0: 74 68 65 20 74 65 73 74 20 73 74 65 70 73 0a 09  the test steps..
82c0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20   (debug:print 4 
82d0: 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 73  "Copying records
82e0: 20 69 6e 20 74 65 73 74 5f 73 74 65 70 73 20 66   in test_steps f
82f0: 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64  rom test_id=" (d
8300: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65  b:test-get-id te
8310: 73 74 64 61 74 29 20 22 20 74 6f 20 22 20 28 64  stdat) " to " (d
8320: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65  b:test-get-id ne
8330: 77 2d 74 65 73 74 64 61 74 29 29 0a 09 20 28 73  w-testdat)).. (s
8340: 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a  qlite3:execute .
8350: 09 20 20 64 62 20 0a 09 20 20 28 63 6f 6e 63 20  .  db ..  (conc 
8360: 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41  "INSERT OR REPLA
8370: 43 45 20 49 4e 54 4f 20 74 65 73 74 5f 73 74 65  CE INTO test_ste
8380: 70 73 20 28 74 65 73 74 5f 69 64 2c 73 74 65 70  ps (test_id,step
8390: 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75  name,state,statu
83a0: 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d  s,event_time,com
83b0: 6d 65 6e 74 29 20 22 0a 09 09 22 53 45 4c 45 43  ment) "..."SELEC
83c0: 54 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74  T " (db:test-get
83d0: 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29  -id new-testdat)
83e0: 20 22 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 74   ",stepname,stat
83f0: 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74  e,status,event_t
8400: 69 6d 65 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d  ime,comment FROM
8410: 20 74 65 73 74 5f 73 74 65 70 73 20 57 48 45 52   test_steps WHER
8420: 45 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09  E test_id=?;")..
8430: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69    (db:test-get-i
8440: 64 20 74 65 73 74 64 61 74 29 29 0a 09 20 3b 3b  d testdat)).. ;;
8450: 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74   Now duplicate t
8460: 68 65 20 74 65 73 74 20 64 61 74 61 0a 09 20 28  he test data.. (
8470: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 43  debug:print 4 "C
8480: 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 73 20 69  opying records i
8490: 6e 20 74 65 73 74 5f 64 61 74 61 20 66 72 6f 6d  n test_data from
84a0: 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62 3a 74   test_id=" (db:t
84b0: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64  est-get-id testd
84c0: 61 74 29 20 22 20 74 6f 20 22 20 28 64 62 3a 74  at) " to " (db:t
84d0: 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74  est-get-id new-t
84e0: 65 73 74 64 61 74 29 29 0a 09 20 28 73 71 6c 69  estdat)).. (sqli
84f0: 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09 20 20  te3:execute ..  
8500: 64 62 20 0a 09 20 20 28 63 6f 6e 63 20 22 49 4e  db ..  (conc "IN
8510: 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20  SERT OR REPLACE 
8520: 49 4e 54 4f 20 74 65 73 74 5f 64 61 74 61 20 28  INTO test_data (
8530: 74 65 73 74 5f 69 64 2c 63 61 74 65 67 6f 72 79  test_id,category
8540: 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c  ,variable,value,
8550: 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69  expected,tol,uni
8560: 74 73 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09  ts,comment) "...
8570: 22 53 45 4c 45 43 54 20 22 20 28 64 62 3a 74 65  "SELECT " (db:te
8580: 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65  st-get-id new-te
8590: 73 74 64 61 74 29 20 22 2c 63 61 74 65 67 6f 72  stdat) ",categor
85a0: 79 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65  y,variable,value
85b0: 2c 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e  ,expected,tol,un
85c0: 69 74 73 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d  its,comment FROM
85d0: 20 74 65 73 74 5f 64 61 74 61 20 57 48 45 52 45   test_data WHERE
85e0: 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20   test_id=?;").. 
85f0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64   (db:test-get-id
8600: 20 74 65 73 74 64 61 74 29 29 0a 09 20 29 29 0a   testdat)).. )).
8610: 20 20 20 20 20 70 72 65 76 2d 74 65 73 74 73 29       prev-tests)
8620: 29 29 0a 09 20 0a 20 20 20 20 20 0a              )).. .     .