Megatest

Hex Artifact Content
Login

Artifact 8cce014215aaf48a8f31abb0e163f98240435b0f:


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 3e 3d   done..  (if (>=
35d0: 20 2a 76 65 72 62 6f 73 69 74 79 2a 20 31 29 28   *verbosity* 1)(
35e0: 70 70 20 69 74 65 6d 73 29 29 0a 09 20 20 3b 3b  pp items))..  ;;
35f0: 20 28 69 66 20 28 3e 3d 20 2a 76 65 72 62 6f 73   (if (>= *verbos
3600: 69 74 79 2a 20 35 29 0a 09 20 20 3b 3b 20 20 20  ity* 5)..  ;;   
3610: 20 20 28 62 65 67 69 6e 0a 09 20 20 3b 3b 20 20    (begin..  ;;  
3620: 20 20 20 20 20 28 70 72 69 6e 74 20 22 69 74 65       (print "ite
3630: 6d 73 3a 20 22 29 20 20 20 20 20 28 70 70 20 28  ms: ")     (pp (
3640: 69 74 65 6d 2d 61 73 73 6f 63 2d 3e 69 74 65 6d  item-assoc->item
3650: 2d 6c 69 73 74 20 69 74 65 6d 73 29 29 0a 09 20  -list items)).. 
3660: 20 3b 3b 20 20 20 20 20 20 20 28 70 72 69 6e 74   ;;       (print
3670: 20 22 69 74 65 6d 73 74 61 62 6c 65 3a 20 22 29   "itemstable: ")
3680: 28 70 70 20 28 69 74 65 6d 2d 74 61 62 6c 65 2d  (pp (item-table-
3690: 3e 69 74 65 6d 2d 6c 69 73 74 20 69 74 65 6d 73  >item-list items
36a0: 74 61 62 6c 65 29 29 29 29 0a 09 20 20 28 66 6f  table))))..  (fo
36b0: 72 2d 65 61 63 68 0a 09 20 20 20 28 6c 61 6d 62  r-each..   (lamb
36c0: 64 61 20 28 6d 79 2d 69 74 65 6d 64 61 74 29 0a  da (my-itemdat).
36d0: 09 20 20 20 20 20 28 6c 65 74 2a 20 28 28 6e 65  .     (let* ((ne
36e0: 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 28 6c  w-test-record (l
36f0: 65 74 20 28 28 6e 65 77 72 65 63 20 28 6d 61 6b  et ((newrec (mak
3700: 65 2d 74 65 73 74 73 3a 74 65 73 74 71 75 65 75  e-tests:testqueu
3710: 65 29 29 29 0a 09 09 09 09 20 20 20 20 20 20 20  e))).....       
3720: 28 76 65 63 74 6f 72 2d 63 6f 70 79 21 20 74 65  (vector-copy! te
3730: 73 74 2d 72 65 63 6f 72 64 20 6e 65 77 72 65 63  st-record newrec
3740: 29 0a 09 09 09 09 20 20 20 20 20 20 20 6e 65 77  ).....       new
3750: 72 65 63 29 29 0a 09 09 20 20 20 20 28 6d 79 2d  rec))...    (my-
3760: 69 74 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d  item-path (item-
3770: 6c 69 73 74 2d 3e 70 61 74 68 20 6d 79 2d 69 74  list->path my-it
3780: 65 6d 64 61 74 29 29 0a 09 09 20 20 20 20 0a 09  emdat))...    ..
3790: 09 20 20 20 20 3b 3b 20 33 2f 32 35 2f 32 30 31  .    ;; 3/25/201
37a0: 32 20 2d 20 74 68 69 73 20 6d 61 74 63 68 20 69  2 - this match i
37b0: 73 20 2a 61 6c 77 61 79 73 2a 20 72 65 74 75 72  s *always* retur
37c0: 6e 69 6e 67 20 74 72 75 65 20 49 20 62 65 6c 69  ning true I beli
37d0: 65 76 65 2e 20 4f 72 20 69 73 20 69 74 20 74 68  eve. Or is it th
37e0: 65 20 74 65 73 74 73 20 74 68 61 74 20 61 72 65  e tests that are
37f0: 20 6e 6f 74 20 62 65 69 6e 67 20 68 61 6e 64 6c   not being handl
3800: 65 64 3f 0a 09 09 20 20 20 20 3b 3b 0a 09 09 20  ed?...    ;;... 
3810: 20 20 20 28 69 74 65 6d 2d 6d 61 74 63 68 65 73     (item-matches
3820: 20 28 69 66 20 69 74 65 6d 2d 70 61 74 74 73 20   (if item-patts 
3830: 20 20 20 20 20 20 3b 3b 20 68 65 72 65 20 77 65        ;; here we
3840: 20 61 72 65 20 66 69 6c 74 65 72 69 6e 67 20 66   are filtering f
3850: 6f 72 20 6d 61 74 63 68 65 73 20 77 69 74 68 20  or matches with 
3860: 2d 69 74 65 6d 70 61 74 74 0a 09 09 09 09 20 20  -itempatt.....  
3870: 20 20 20 20 28 6c 65 74 20 28 28 72 65 73 20 23      (let ((res #
3880: 66 29 29 09 20 3b 3b 20 6c 6f 6f 6b 20 74 68 72  f)). ;; look thr
3890: 6f 75 67 68 20 61 6c 6c 20 74 68 65 20 69 74 65  ough all the ite
38a0: 6d 2d 70 61 74 74 73 20 69 66 20 64 65 66 69 6e  m-patts if defin
38b0: 65 64 2c 20 66 6f 72 6d 61 74 20 69 73 20 70 61  ed, format is pa
38c0: 74 74 31 2c 70 61 74 74 32 2c 70 61 74 74 33 20  tt1,patt2,patt3 
38d0: 2e 2e 2e 20 77 69 6c 64 63 61 72 64 20 69 73 20  ... wildcard is 
38e0: 25 0a 09 09 09 09 09 28 66 6f 72 2d 65 61 63 68  %......(for-each
38f0: 20 0a 09 09 09 09 09 20 28 6c 61 6d 62 64 61 20   ...... (lambda 
3900: 28 70 61 74 74 29 0a 09 09 09 09 09 20 20 20 28  (patt)......   (
3910: 69 66 20 28 73 74 72 69 6e 67 2d 73 65 61 72 63  if (string-searc
3920: 68 20 28 67 6c 6f 62 2d 3e 72 65 67 65 78 70 0a  h (glob->regexp.
3930: 09 09 09 09 09 09 09 20 20 20 20 20 20 20 28 73  .......       (s
3940: 74 72 69 6e 67 2d 74 72 61 6e 73 6c 61 74 65 20  tring-translate 
3950: 70 61 74 74 20 22 25 22 20 22 2a 22 29 29 0a 09  patt "%" "*"))..
3960: 09 09 09 09 09 09 20 20 20 20 20 20 69 74 65 6d  ......      item
3970: 2d 70 61 74 68 29 0a 09 09 09 09 09 20 20 20 20  -path)......    
3980: 20 20 20 28 73 65 74 21 20 72 65 73 20 23 74 29     (set! res #t)
3990: 29 29 0a 09 09 09 09 09 20 28 73 74 72 69 6e 67  ))...... (string
39a0: 2d 73 70 6c 69 74 20 69 74 65 6d 2d 70 61 74 74  -split item-patt
39b0: 73 20 22 2c 22 29 29 0a 09 09 09 09 09 72 65 73  s ","))......res
39c0: 29 0a 09 09 09 09 20 20 20 20 20 20 23 74 29 29  ).....      #t))
39d0: 29 0a 09 20 20 20 20 20 20 20 28 69 66 20 69 74  )..       (if it
39e0: 65 6d 2d 6d 61 74 63 68 65 73 20 3b 3b 20 79 65  em-matches ;; ye
39f0: 73 2c 20 77 65 20 77 61 6e 74 20 74 6f 20 70 72  s, we want to pr
3a00: 6f 63 65 73 73 20 74 68 69 73 20 69 74 65 6d 0a  ocess this item.
3a10: 09 09 20 20 20 28 6c 65 74 20 28 28 6e 65 77 74  ..   (let ((newt
3a20: 65 73 74 6e 61 6d 65 20 28 63 6f 6e 63 20 68 65  estname (conc he
3a30: 64 20 22 2f 22 20 6d 79 2d 69 74 65 6d 2d 70 61  d "/" my-item-pa
3a40: 74 68 29 29 29 20 20 20 20 3b 3b 20 74 65 73 74  th)))    ;; test
3a50: 20 6e 61 6d 65 73 20 61 72 65 20 75 6e 69 71 75   names are uniqu
3a60: 65 20 6f 6e 20 74 65 73 74 6e 61 6d 65 2f 69 74  e on testname/it
3a70: 65 6d 2d 70 61 74 68 0a 09 09 20 20 20 20 20 28  em-path...     (
3a80: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
3a90: 73 65 74 2d 69 74 65 6d 73 21 20 20 20 20 20 6e  set-items!     n
3aa0: 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 23  ew-test-record #
3ab0: 66 29 0a 09 09 20 20 20 20 20 28 74 65 73 74 73  f)...     (tests
3ac0: 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69  :testqueue-set-i
3ad0: 74 65 6d 64 61 74 21 20 20 20 6e 65 77 2d 74 65  temdat!   new-te
3ae0: 73 74 2d 72 65 63 6f 72 64 20 6d 79 2d 69 74 65  st-record my-ite
3af0: 6d 64 61 74 29 0a 09 09 20 20 20 20 20 28 74 65  mdat)...     (te
3b00: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65  sts:testqueue-se
3b10: 74 2d 69 74 65 6d 5f 70 61 74 68 21 20 6e 65 77  t-item_path! new
3b20: 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 6d 79 2d  -test-record my-
3b30: 69 74 65 6d 2d 70 61 74 68 29 0a 09 09 20 20 20  item-path)...   
3b40: 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65    (hash-table-se
3b50: 74 21 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20  t! test-records 
3b60: 6e 65 77 74 65 73 74 6e 61 6d 65 20 6e 65 77 2d  newtestname new-
3b70: 74 65 73 74 2d 72 65 63 6f 72 64 29 0a 09 09 20  test-record)... 
3b80: 20 20 20 20 28 73 65 74 21 20 74 61 6c 20 28 63      (set! tal (c
3b90: 6f 6e 73 20 6e 65 77 74 65 73 74 6e 61 6d 65 20  ons newtestname 
3ba0: 74 61 6c 29 29 29 29 29 29 20 3b 3b 20 73 69 6e  tal)))))) ;; sin
3bb0: 63 65 20 74 68 65 73 65 20 61 72 65 20 69 74 65  ce these are ite
3bc0: 6d 69 7a 65 64 20 63 72 65 61 74 65 20 6e 65 77  mized create new
3bd0: 20 74 65 73 74 20 6e 61 6d 65 73 20 74 65 73 74   test names test
3be0: 6e 61 6d 65 2f 69 74 65 6d 70 61 74 68 0a 09 20  name/itempath.. 
3bf0: 20 20 69 74 65 6d 73 29 0a 09 20 20 28 6c 6f 6f    items)..  (loo
3c00: 70 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20  p (car tal)(cdr 
3c10: 74 61 6c 29 29 29 0a 0a 09 20 3b 3b 20 69 66 20  tal)))... ;; if 
3c20: 69 74 65 6d 73 20 69 73 20 61 20 70 72 6f 63 20  items is a proc 
3c30: 74 68 65 6e 20 6e 65 65 64 20 74 6f 20 72 75 6e  then need to run
3c40: 20 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73   items:get-items
3c50: 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 2c 20 67 65  -from-config, ge
3c60: 74 20 74 68 65 20 6c 69 73 74 20 61 6e 64 20 6c  t the list and l
3c70: 6f 6f 70 20 0a 09 20 3b 3b 20 20 20 20 2d 20 62  oop .. ;;    - b
3c80: 75 74 20 6f 6e 6c 79 20 64 6f 20 74 68 61 74 20  ut only do that 
3c90: 69 66 20 72 65 73 6f 75 72 63 65 73 20 65 78 69  if resources exi
3ca0: 73 74 20 74 6f 20 6b 69 63 6b 20 6f 66 66 20 74  st to kick off t
3cb0: 68 65 20 6a 6f 62 0a 09 20 28 28 6f 72 20 28 70  he job.. ((or (p
3cc0: 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73 29  rocedure? items)
3cd0: 28 65 71 3f 20 69 74 65 6d 73 20 27 68 61 76 65  (eq? items 'have
3ce0: 2d 70 72 6f 63 65 64 75 72 65 29 29 0a 09 20 20  -procedure))..  
3cf0: 28 69 66 20 28 61 6e 64 20 28 72 75 6e 73 3a 63  (if (and (runs:c
3d00: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74  an-run-more-test
3d10: 73 20 64 62 20 74 65 73 74 2d 72 65 63 6f 72 64  s db test-record
3d20: 29 0a 09 09 20 20 20 28 6e 75 6c 6c 3f 20 28 64  )...   (null? (d
3d30: 62 3a 67 65 74 2d 70 72 65 72 65 71 73 2d 6e 6f  b:get-prereqs-no
3d40: 74 2d 6d 65 74 20 64 62 20 72 75 6e 2d 69 64 20  t-met db run-id 
3d50: 77 61 69 74 6f 6e 73 20 69 74 65 6d 2d 70 61 74  waitons item-pat
3d60: 68 29 29 29 0a 09 20 20 20 20 20 20 28 6c 65 74  h)))..      (let
3d70: 20 28 28 74 65 73 74 2d 6e 61 6d 65 20 28 74 65   ((test-name (te
3d80: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65  sts:testqueue-ge
3d90: 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d  t-testname test-
3da0: 72 65 63 6f 72 64 29 29 29 0a 09 09 28 73 65 74  record)))...(set
3db0: 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d  env "MT_TEST_NAM
3dc0: 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b  E" test-name) ;;
3dd0: 20 0a 09 09 28 73 65 74 65 6e 76 20 22 4d 54 5f   ...(setenv "MT_
3de0: 52 55 4e 4e 41 4d 45 22 20 20 20 72 75 6e 6e 61  RUNNAME"   runna
3df0: 6d 65 29 0a 09 09 28 73 65 74 2d 6d 65 67 61 74  me)...(set-megat
3e00: 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 64 62 20  est-env-vars db 
3e10: 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73 65  run-id) ;; these
3e20: 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64 20 62   may be needed b
3e30: 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e 67 20  y the launching 
3e40: 70 72 6f 63 65 73 73 0a 09 09 28 6c 65 74 20 28  process...(let (
3e50: 28 69 74 65 6d 73 2d 6c 69 73 74 20 28 69 74 65  (items-list (ite
3e60: 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f  ms:get-items-fro
3e70: 6d 2d 63 6f 6e 66 69 67 20 74 63 6f 6e 66 69 67  m-config tconfig
3e80: 29 29 29 0a 09 09 20 20 28 69 66 20 28 6c 69 73  )))...  (if (lis
3e90: 74 3f 20 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09  t? items-list)..
3ea0: 09 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09  .      (begin...
3eb0: 09 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75  .(tests:testqueu
3ec0: 65 2d 73 65 74 2d 69 74 65 6d 73 21 20 74 65 73  e-set-items! tes
3ed0: 74 2d 72 65 63 6f 72 64 20 69 74 65 6d 73 2d 6c  t-record items-l
3ee0: 69 73 74 29 0a 09 09 09 28 6c 6f 6f 70 20 68 65  ist)....(loop he
3ef0: 64 20 74 61 6c 29 29 0a 09 09 20 20 20 20 20 20  d tal))...      
3f00: 28 62 65 67 69 6e 0a 09 09 09 28 64 65 62 75 67  (begin....(debug
3f10: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a  :print 0 "ERROR:
3f20: 20 54 68 65 20 70 72 6f 63 20 66 72 6f 6d 20 72   The proc from r
3f30: 65 61 64 69 6e 67 20 74 68 65 20 73 65 74 75 70  eading the setup
3f40: 20 64 69 64 20 6e 6f 74 20 79 69 65 6c 64 20 61   did not yield a
3f50: 20 6c 69 73 74 20 2d 20 70 6c 65 61 73 65 20 72   list - please r
3f60: 65 70 6f 72 74 20 74 68 69 73 22 29 0a 09 09 09  eport this")....
3f70: 28 65 78 69 74 20 31 29 29 29 29 29 0a 09 20 20  (exit 1)))))..  
3f80: 20 20 20 20 28 6c 65 74 20 28 28 6e 65 77 74 61      (let ((newta
3f90: 6c 20 28 61 70 70 65 6e 64 20 74 61 6c 20 28 6c  l (append tal (l
3fa0: 69 73 74 20 68 65 64 29 29 29 29 0a 09 09 3b 3b  ist hed))))...;;
3fb0: 20 69 66 20 63 61 6e 27 74 20 72 75 6e 20 6d 6f   if can't run mo
3fc0: 72 65 20 74 65 73 74 73 2c 20 6c 65 74 73 20 74  re tests, lets t
3fd0: 61 6b 65 20 61 20 62 72 65 61 74 68 65 72 0a 09  ake a breather..
3fe0: 09 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20  .(thread-sleep! 
3ff0: 30 2e 35 29 0a 09 09 28 6c 6f 6f 70 20 28 63 61  0.5)...(loop (ca
4000: 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65  r newtal)(cdr ne
4010: 77 74 61 6c 29 29 29 29 29 0a 0a 09 20 3b 3b 20  wtal)))))... ;; 
4020: 74 68 69 73 20 63 61 73 65 20 73 68 6f 75 6c 64  this case should
4030: 20 6e 6f 74 20 68 61 70 70 65 6e 2c 20 61 64 64   not happen, add
4040: 65 64 20 74 6f 20 68 65 6c 70 20 63 61 74 63 68  ed to help catch
4050: 20 61 6e 79 20 62 75 67 73 0a 09 20 28 28 61 6e   any bugs.. ((an
4060: 64 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20  d (list? items) 
4070: 69 74 65 6d 64 61 74 29 0a 09 20 20 28 64 65 62  itemdat)..  (deb
4080: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f  ug:print 0 "ERRO
4090: 52 3a 20 53 68 6f 75 6c 64 20 6e 6f 74 20 68 61  R: Should not ha
40a0: 76 65 20 61 20 6c 69 73 74 20 6f 66 20 69 74 65  ve a list of ite
40b0: 6d 73 20 69 6e 20 61 20 74 65 73 74 20 61 6e 64  ms in a test and
40c0: 20 74 68 65 20 69 74 65 6d 73 70 61 74 68 20 73   the itemspath s
40d0: 65 74 20 2d 20 70 6c 65 61 73 65 20 72 65 70 6f  et - please repo
40e0: 72 74 20 74 68 69 73 22 29 0a 09 20 20 28 65 78  rt this")..  (ex
40f0: 69 74 20 31 29 29 29 29 0a 09 0a 20 20 20 20 20  it 1))))...     
4100: 20 3b 3b 20 77 65 20 67 65 74 20 68 65 72 65 20   ;; we get here 
4110: 6f 6e 20 22 64 72 6f 70 20 74 68 72 6f 75 67 68  on "drop through
4120: 22 20 2d 20 6c 6f 6f 70 20 66 6f 72 20 6e 65 78  " - loop for nex
4130: 74 20 74 65 73 74 20 69 6e 20 71 75 65 75 65 0a  t test in queue.
4140: 20 20 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f        (if (null?
4150: 20 74 61 6c 29 0a 09 20 20 28 62 65 67 69 6e 0a   tal)..  (begin.
4160: 09 20 20 20 20 3b 3b 20 46 49 58 4d 45 21 21 21  .    ;; FIXME!!!
4170: 21 20 54 48 49 53 20 53 48 4f 55 4c 44 20 4e 4f  ! THIS SHOULD NO
4180: 54 20 52 45 51 55 49 52 45 20 41 4e 20 45 58 49  T REQUIRE AN EXI
4190: 54 21 21 21 21 21 21 21 0a 09 20 20 20 20 28 64  T!!!!!!!..    (d
41a0: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e  ebug:print 1 "IN
41b0: 46 4f 3a 20 41 6c 6c 20 74 65 73 74 73 20 6c 61  FO: All tests la
41c0: 75 6e 63 68 65 64 22 29 0a 09 20 20 20 20 28 74  unched")..    (t
41d0: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 30 2e 35  hread-sleep! 0.5
41e0: 29 0a 09 20 20 20 20 3b 3b 20 46 49 58 4d 45 21  )..    ;; FIXME!
41f0: 20 54 68 69 73 20 68 61 72 73 68 20 65 78 69 74   This harsh exit
4200: 20 73 68 6f 75 6c 64 20 6e 6f 74 20 62 65 20 6e   should not be n
4210: 65 63 65 73 73 61 72 79 2e 2e 2e 2e 0a 09 20 20  ecessary......  
4220: 20 20 28 69 66 20 28 6e 6f 74 20 2a 72 75 6e 72    (if (not *runr
4230: 65 6d 6f 74 65 2a 29 28 65 78 69 74 29 29 20 3b  emote*)(exit)) ;
4240: 3b 20 0a 09 20 20 20 20 23 66 29 20 3b 3b 20 72  ; ..    #f) ;; r
4250: 65 74 75 72 6e 20 61 20 23 66 20 61 73 20 61 20  eturn a #f as a 
4260: 68 69 6e 74 20 74 68 61 74 20 77 65 20 61 72 65  hint that we are
4270: 20 64 6f 6e 65 0a 09 20 20 3b 3b 20 48 65 72 65   done..  ;; Here
4280: 20 77 65 20 6e 65 65 64 20 74 6f 20 63 68 65 63   we need to chec
4290: 6b 20 74 68 61 74 20 61 6c 6c 20 74 68 65 20 74  k that all the t
42a0: 65 73 74 73 20 72 65 6d 61 69 6e 69 6e 67 20 74  ests remaining t
42b0: 6f 20 62 65 20 72 75 6e 20 61 72 65 20 65 6c 69  o be run are eli
42c0: 67 69 62 6c 65 20 74 6f 20 72 75 6e 0a 09 20 20  gible to run..  
42d0: 3b 3b 20 61 6e 64 20 61 72 65 20 6e 6f 74 20 62  ;; and are not b
42e0: 6c 6f 63 6b 65 64 20 62 79 20 66 61 69 6c 65 64  locked by failed
42f0: 0a 09 20 20 28 6c 65 74 20 28 28 6e 65 77 6c 73  ..  (let ((newls
4300: 74 20 28 74 65 73 74 73 3a 66 69 6c 74 65 72 2d  t (tests:filter-
4310: 6e 6f 6e 2d 72 75 6e 6e 61 62 6c 65 20 64 62 20  non-runnable db 
4320: 72 75 6e 2d 69 64 20 74 61 6c 20 74 65 73 74 2d  run-id tal test-
4330: 72 65 63 6f 72 64 73 29 29 29 20 3b 3b 20 69 2e  records))) ;; i.
4340: 65 2e 20 6e 6f 74 20 46 41 49 4c 2c 20 57 41 49  e. not FAIL, WAI
4350: 56 45 44 2c 20 49 4e 43 4f 4d 50 4c 45 54 45 2c  VED, INCOMPLETE,
4360: 20 50 41 53 53 2c 20 4b 49 4c 4c 45 44 2c 0a 09   PASS, KILLED,..
4370: 20 20 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65      (thread-slee
4380: 70 21 20 30 2e 35 29 0a 09 20 20 20 20 28 69 66  p! 0.5)..    (if
4390: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 6e 65 77   (not (null? new
43a0: 6c 73 74 29 29 0a 09 09 28 6c 6f 6f 70 20 28 63  lst))...(loop (c
43b0: 61 72 20 6e 65 77 6c 73 74 29 28 63 64 72 20 6e  ar newlst)(cdr n
43c0: 65 77 6c 73 74 29 29 29 29 29 29 29 29 0a 0a 3b  ewlst))))))))..;
43d0: 3b 20 70 61 72 65 6e 74 2d 74 65 73 74 20 69 73  ; parent-test is
43e0: 20 74 68 65 72 65 20 61 73 20 61 20 70 6c 61 63   there as a plac
43f0: 65 68 6f 6c 64 65 72 20 66 6f 72 20 77 68 65 6e  eholder for when
4400: 20 70 61 72 65 6e 74 2d 74 65 73 74 73 20 63 61   parent-tests ca
4410: 6e 20 62 65 20 72 75 6e 20 61 73 20 61 20 73 65  n be run as a se
4420: 74 75 70 20 73 74 65 70 0a 28 64 65 66 69 6e 65  tup step.(define
4430: 20 28 72 75 6e 3a 74 65 73 74 20 64 62 20 72 75   (run:test db ru
4440: 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 6b 65 79  n-id runname key
4450: 76 61 6c 6c 73 74 20 74 65 73 74 2d 72 65 63 6f  vallst test-reco
4460: 72 64 20 66 6c 61 67 73 20 70 61 72 65 6e 74 2d  rd flags parent-
4470: 74 65 73 74 29 0a 20 20 3b 3b 20 41 6c 6c 20 74  test).  ;; All t
4480: 68 65 73 65 20 76 61 72 73 20 6d 69 67 68 74 20  hese vars might 
4490: 62 65 20 72 65 66 65 72 65 6e 63 65 64 20 62 79  be referenced by
44a0: 20 74 68 65 20 74 65 73 74 63 6f 6e 66 69 67 20   the testconfig 
44b0: 66 69 6c 65 20 72 65 61 64 65 72 0a 20 20 28 6c  file reader.  (l
44c0: 65 74 2a 20 28 28 74 65 73 74 2d 6e 61 6d 65 20  et* ((test-name 
44d0: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75     (tests:testqu
44e0: 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65  eue-get-testname
44f0: 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29     test-record))
4500: 0a 09 20 28 74 65 73 74 2d 77 61 69 74 6f 6e 73  .. (test-waitons
4510: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75   (tests:testqueu
4520: 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20 20 20  e-get-waitons   
4530: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09   test-record))..
4540: 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 20 28   (test-conf    (
4550: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
4560: 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 74  get-testconfig t
4570: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28  est-record)).. (
4580: 69 74 65 6d 64 61 74 20 20 20 20 20 20 28 74 65  itemdat      (te
4590: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65  sts:testqueue-ge
45a0: 74 2d 69 74 65 6d 64 61 74 20 20 20 20 74 65 73  t-itemdat    tes
45b0: 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65  t-record)).. (te
45c0: 73 74 2d 70 61 74 68 20 20 20 20 28 63 6f 6e 63  st-path    (conc
45d0: 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73   *toppath* "/tes
45e0: 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29 29  ts/" test-name))
45f0: 20 3b 3b 20 63 6f 75 6c 64 20 75 73 65 20 74 65   ;; could use te
4600: 73 74 73 3a 67 65 74 2d 74 65 73 74 63 6f 6e 66  sts:get-testconf
4610: 69 67 20 68 65 72 65 20 2e 2e 2e 0a 09 20 28 66  ig here ..... (f
4620: 6f 72 63 65 20 20 20 20 20 20 20 20 28 68 61 73  orce        (has
4630: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61  h-table-ref/defa
4640: 75 6c 74 20 66 6c 61 67 73 20 22 2d 66 6f 72 63  ult flags "-forc
4650: 65 22 20 23 66 29 29 0a 09 20 28 72 65 72 75 6e  e" #f)).. (rerun
4660: 20 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 61          (hash-ta
4670: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20  ble-ref/default 
4680: 66 6c 61 67 73 20 22 2d 72 65 72 75 6e 22 20 23  flags "-rerun" #
4690: 66 29 29 0a 09 20 28 6b 65 65 70 67 6f 69 6e 67  f)).. (keepgoing
46a0: 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d      (hash-table-
46b0: 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67  ref/default flag
46c0: 73 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 20 23  s "-keepgoing" #
46d0: 66 29 29 0a 09 20 28 69 74 65 6d 2d 70 61 74 68  f)).. (item-path
46e0: 20 20 20 20 20 22 22 29 29 0a 20 20 20 20 28 64       "")).    (d
46f0: 65 62 75 67 3a 70 72 69 6e 74 20 35 0a 09 09 20  ebug:print 5... 
4700: 22 74 65 73 74 2d 63 6f 6e 66 69 67 3a 20 22 20  "test-config: " 
4710: 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61 6c 69  (hash-table->ali
4720: 73 74 20 74 65 73 74 2d 63 6f 6e 66 29 0a 09 09  st test-conf)...
4730: 20 22 5c 6e 20 20 20 69 74 65 6d 64 61 74 3a 20   "\n   itemdat: 
4740: 22 20 69 74 65 6d 64 61 74 0a 09 09 20 29 0a 20  " itemdat... ). 
4750: 20 20 20 3b 3b 20 73 65 74 74 69 6e 67 20 69 74     ;; setting it
4760: 65 6d 64 61 74 20 74 6f 20 61 20 6c 69 73 74 20  emdat to a list 
4770: 69 66 20 69 74 20 69 73 20 23 66 0a 20 20 20 20  if it is #f.    
4780: 28 69 66 20 28 6e 6f 74 20 69 74 65 6d 64 61 74  (if (not itemdat
4790: 29 28 73 65 74 21 20 69 74 65 6d 64 61 74 20 27  )(set! itemdat '
47a0: 28 29 29 29 0a 20 20 20 20 28 73 65 74 21 20 69  ())).    (set! i
47b0: 74 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c  tem-path (item-l
47c0: 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61  ist->path itemda
47d0: 74 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70  t)).    (debug:p
47e0: 72 69 6e 74 20 32 20 22 41 74 74 65 6d 70 74 69  rint 2 "Attempti
47f0: 6e 67 20 74 6f 20 6c 61 75 6e 63 68 20 74 65 73  ng to launch tes
4800: 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f  t " test-name "/
4810: 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 20 20 20  " item-path).   
4820: 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 54 45 53   (setenv "MT_TES
4830: 54 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d  T_NAME" test-nam
4840: 65 29 20 3b 3b 20 0a 20 20 20 20 28 73 65 74 65  e) ;; .    (sete
4850: 6e 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20  nv "MT_RUNNAME" 
4860: 20 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20 28    runname).    (
4870: 73 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76  set-megatest-env
4880: 2d 76 61 72 73 20 64 62 20 72 75 6e 2d 69 64 29  -vars db run-id)
4890: 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62 65   ;; these may be
48a0: 20 6e 65 65 64 65 64 20 62 79 20 74 68 65 20 6c   needed by the l
48b0: 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 73  aunching process
48c0: 0a 20 20 20 20 28 63 68 61 6e 67 65 2d 64 69 72  .    (change-dir
48d0: 65 63 74 6f 72 79 20 2a 74 6f 70 70 61 74 68 2a  ectory *toppath*
48e0: 29 0a 0a 20 20 20 20 3b 3b 20 48 65 72 65 20 69  )..    ;; Here i
48f0: 73 20 77 68 65 72 65 20 74 68 65 20 74 65 73 74  s where the test
4900: 5f 6d 65 74 61 20 74 61 62 6c 65 20 69 73 20 62  _meta table is b
4910: 65 73 74 20 75 70 64 61 74 65 64 0a 20 20 20 20  est updated.    
4920: 3b 3b 20 59 65 73 2c 20 61 6e 6f 74 68 65 72 20  ;; Yes, another 
4930: 75 73 65 20 6f 66 20 61 20 67 6c 6f 62 61 6c 20  use of a global 
4940: 66 6f 72 20 63 61 63 68 69 6e 67 2e 20 4e 65 65  for caching. Nee
4950: 64 20 61 20 62 65 74 74 65 72 20 77 61 79 3f 0a  d a better way?.
4960: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 68 61      (if (not (ha
4970: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66  sh-table-ref/def
4980: 61 75 6c 74 20 2a 74 65 73 74 2d 6d 65 74 61 2d  ault *test-meta-
4990: 75 70 64 61 74 65 64 2a 20 74 65 73 74 2d 6e 61  updated* test-na
49a0: 6d 65 20 23 66 29 29 0a 20 20 20 20 20 20 20 20  me #f)).        
49b0: 28 62 65 67 69 6e 0a 09 20 20 20 28 68 61 73 68  (begin..   (hash
49c0: 2d 74 61 62 6c 65 2d 73 65 74 21 20 2a 74 65 73  -table-set! *tes
49d0: 74 2d 6d 65 74 61 2d 75 70 64 61 74 65 64 2a 20  t-meta-updated* 
49e0: 74 65 73 74 2d 6e 61 6d 65 20 23 74 29 0a 20 20  test-name #t).  
49f0: 20 20 20 20 20 20 20 20 20 28 72 75 6e 73 3a 75           (runs:u
4a00: 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 20  pdate-test_meta 
4a10: 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73  db test-name tes
4a20: 74 2d 63 6f 6e 66 29 29 29 0a 20 20 20 20 0a 20  t-conf))).    . 
4a30: 20 20 20 3b 3b 20 28 6c 61 6d 62 64 61 20 28 69     ;; (lambda (i
4a40: 74 65 6d 64 61 74 29 20 3b 3b 3b 20 28 28 72 69  temdat) ;;; ((ri
4a50: 70 65 6e 65 73 73 20 22 6f 76 65 72 72 69 70 65  peness "overripe
4a60: 22 29 20 28 74 65 6d 70 65 72 61 74 75 72 65 20  ") (temperature 
4a70: 22 63 6f 6f 6c 22 29 20 28 73 65 61 73 6f 6e 20  "cool") (season 
4a80: 22 73 75 6d 6d 65 72 22 29 29 0a 20 20 20 20 28  "summer")).    (
4a90: 6c 65 74 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d  let* ((new-test-
4aa0: 70 61 74 68 20 28 73 74 72 69 6e 67 2d 69 6e 74  path (string-int
4ab0: 65 72 73 70 65 72 73 65 20 28 63 6f 6e 73 20 74  ersperse (cons t
4ac0: 65 73 74 2d 70 61 74 68 20 28 6d 61 70 20 63 61  est-path (map ca
4ad0: 64 72 20 69 74 65 6d 64 61 74 29 29 20 22 2f 22  dr itemdat)) "/"
4ae0: 29 29 0a 09 20 20 20 28 6e 65 77 2d 74 65 73 74  ))..   (new-test
4af0: 2d 6e 61 6d 65 20 28 69 66 20 28 65 71 75 61 6c  -name (if (equal
4b00: 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 20  ? item-path "") 
4b10: 74 65 73 74 2d 6e 61 6d 65 20 28 63 6f 6e 63 20  test-name (conc 
4b20: 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74  test-name "/" it
4b30: 65 6d 2d 70 61 74 68 29 29 29 20 3b 3b 20 6a 75  em-path))) ;; ju
4b40: 73 74 20 6e 65 65 64 20 69 74 20 74 6f 20 62 65  st need it to be
4b50: 20 75 6e 69 71 75 65 0a 09 20 20 20 28 74 65 73   unique..   (tes
4b60: 74 64 61 74 20 20 20 20 20 20 20 28 64 62 3a 67  tdat       (db:g
4b70: 65 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 20  et-test-info db 
4b80: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65  run-id test-name
4b90: 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 20 20   item-path))..  
4ba0: 20 28 74 65 73 74 2d 69 64 20 20 20 20 20 20 20   (test-id       
4bb0: 23 66 29 29 0a 20 20 20 20 20 20 28 69 66 20 28  #f)).      (if (
4bc0: 6e 6f 74 20 74 65 73 74 64 61 74 29 0a 09 20 20  not testdat)..  
4bd0: 28 62 65 67 69 6e 0a 09 20 20 20 20 3b 3b 20 65  (begin..    ;; e
4be0: 6e 73 75 72 65 20 74 68 61 74 20 74 68 65 20 70  nsure that the p
4bf0: 61 74 68 20 65 78 69 73 74 73 20 62 65 66 6f 72  ath exists befor
4c00: 65 20 72 65 67 69 73 74 65 72 69 6e 67 20 74 68  e registering th
4c10: 65 20 74 65 73 74 0a 09 20 20 20 20 3b 3b 20 4e  e test..    ;; N
4c20: 4f 50 45 3a 20 43 61 6e 6e 6f 74 21 20 44 6f 6e  OPE: Cannot! Don
4c30: 27 74 20 6b 6e 6f 77 20 79 65 74 20 77 68 69 63  't know yet whic
4c40: 68 20 64 69 73 6b 20 61 72 65 61 20 77 69 6c 6c  h disk area will
4c50: 20 62 65 20 61 73 73 69 67 6e 65 64 2e 2e 2e 2e   be assigned....
4c60: 0a 09 20 20 20 20 3b 3b 20 28 73 79 73 74 65 6d  ..    ;; (system
4c70: 20 28 63 6f 6e 63 20 22 6d 6b 64 69 72 20 2d 70   (conc "mkdir -p
4c80: 20 22 20 6e 65 77 2d 74 65 73 74 2d 70 61 74 68   " new-test-path
4c90: 29 29 0a 09 20 20 20 20 28 72 74 65 73 74 73 3a  ))..    (rtests:
4ca0: 72 65 67 69 73 74 65 72 2d 74 65 73 74 20 64 62  register-test db
4cb0: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d   run-id test-nam
4cc0: 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 20 20  e item-path)..  
4cd0: 20 20 28 73 65 74 21 20 74 65 73 74 64 61 74 20    (set! testdat 
4ce0: 28 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66  (db:get-test-inf
4cf0: 6f 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74  o db run-id test
4d00: 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29  -name item-path)
4d10: 29 29 29 0a 20 20 20 20 20 20 28 73 65 74 21 20  ))).      (set! 
4d20: 74 65 73 74 2d 69 64 20 28 64 62 3a 74 65 73 74  test-id (db:test
4d30: 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29  -get-id testdat)
4d40: 29 0a 20 20 20 20 20 20 28 63 68 61 6e 67 65 2d  ).      (change-
4d50: 64 69 72 65 63 74 6f 72 79 20 74 65 73 74 2d 70  directory test-p
4d60: 61 74 68 29 0a 20 20 20 20 20 20 28 63 61 73 65  ath).      (case
4d70: 20 28 69 66 20 66 6f 72 63 65 20 3b 3b 20 28 61   (if force ;; (a
4d80: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 66 6f  rgs:get-arg "-fo
4d90: 72 63 65 22 29 0a 09 09 27 4e 4f 54 5f 53 54 41  rce")...'NOT_STA
4da0: 52 54 45 44 0a 09 09 28 69 66 20 74 65 73 74 64  RTED...(if testd
4db0: 61 74 0a 09 09 20 20 20 20 28 73 74 72 69 6e 67  at...    (string
4dc0: 2d 3e 73 79 6d 62 6f 6c 20 28 74 65 73 74 3a 67  ->symbol (test:g
4dd0: 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74  et-state testdat
4de0: 29 29 0a 09 09 20 20 20 20 27 66 61 69 6c 65 64  ))...    'failed
4df0: 2d 74 6f 2d 69 6e 73 65 72 74 29 29 0a 09 28 28  -to-insert))..((
4e00: 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 72 74  failed-to-insert
4e10: 29 0a 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ).. (debug:print
4e20: 20 30 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65   0 "ERROR: Faile
4e30: 64 20 74 6f 20 69 6e 73 65 72 74 20 74 68 65 20  d to insert the 
4e40: 72 65 63 6f 72 64 20 69 6e 74 6f 20 74 68 65 20  record into the 
4e50: 64 62 22 29 29 0a 09 28 28 4e 4f 54 5f 53 54 41  db"))..((NOT_STA
4e60: 52 54 45 44 20 43 4f 4d 50 4c 45 54 45 44 29 0a  RTED COMPLETED).
4e70: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 36  . (debug:print 6
4e80: 20 22 47 6f 74 20 68 65 72 65 2c 20 22 20 28 74   "Got here, " (t
4e90: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65  est:get-state te
4ea0: 73 74 64 61 74 29 29 0a 09 20 28 6c 65 74 20 28  stdat)).. (let (
4eb0: 28 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20  (runflag #f)).. 
4ec0: 20 20 28 63 6f 6e 64 0a 09 20 20 20 20 3b 3b 20    (cond..    ;; 
4ed0: 2d 66 6f 72 63 65 2c 20 72 75 6e 20 6e 6f 20 6d  -force, run no m
4ee0: 61 74 74 65 72 20 77 68 61 74 0a 09 20 20 20 20  atter what..    
4ef0: 28 66 6f 72 63 65 20 28 73 65 74 21 20 72 75 6e  (force (set! run
4f00: 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b  flag #t))..    ;
4f10: 3b 20 4e 4f 54 5f 53 54 41 52 54 45 44 2c 20 72  ; NOT_STARTED, r
4f20: 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77 68 61  un no matter wha
4f30: 74 0a 09 20 20 20 20 28 28 65 71 75 61 6c 3f 20  t..    ((equal? 
4f40: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20  (test:get-state 
4f50: 74 65 73 74 64 61 74 29 20 22 4e 4f 54 5f 53 54  testdat) "NOT_ST
4f60: 41 52 54 45 44 22 29 28 73 65 74 21 20 72 75 6e  ARTED")(set! run
4f70: 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b  flag #t))..    ;
4f80: 3b 20 6e 6f 74 20 2d 72 65 72 75 6e 20 61 6e 64  ; not -rerun and
4f90: 20 50 41 53 53 2c 20 57 41 52 4e 20 6f 72 20 43   PASS, WARN or C
4fa0: 48 45 43 4b 2c 20 64 6f 20 6e 6f 20 72 75 6e 0a  HECK, do no run.
4fb0: 09 20 20 20 20 28 28 61 6e 64 20 28 6f 72 20 28  .    ((and (or (
4fc0: 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09 20 20 20  not rerun)...   
4fd0: 20 20 20 6b 65 65 70 67 6f 69 6e 67 29 0a 09 09     keepgoing)...
4fe0: 20 20 3b 3b 20 52 65 71 75 69 72 65 20 74 6f 20    ;; Require to 
4ff0: 66 6f 72 63 65 20 72 65 2d 72 75 6e 20 66 6f 72  force re-run for
5000: 20 43 4f 4d 50 4c 45 54 45 44 20 6f 72 20 2a 61   COMPLETED or *a
5010: 6e 79 74 68 69 6e 67 2a 20 2b 20 50 41 53 53 2c  nything* + PASS,
5020: 57 41 52 4e 20 6f 72 20 43 48 45 43 4b 0a 09 09  WARN or CHECK...
5030: 20 20 28 6f 72 20 28 6d 65 6d 62 65 72 20 28 74    (or (member (t
5040: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74  est:get-status t
5050: 65 73 74 64 61 74 29 20 27 28 22 50 41 53 53 22  estdat) '("PASS"
5060: 20 22 57 41 52 4e 22 20 22 43 48 45 43 4b 22 29   "WARN" "CHECK")
5070: 29 0a 09 09 20 20 20 20 20 20 28 6d 65 6d 62 65  )...      (membe
5080: 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  r (test:get-stat
5090: 65 20 20 74 65 73 74 64 61 74 29 20 27 28 22 43  e  testdat) '("C
50a0: 4f 4d 50 4c 45 54 45 44 22 29 29 29 29 20 0a 09  OMPLETED")))) ..
50b0: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
50c0: 74 20 32 20 22 49 4e 46 4f 3a 20 72 75 6e 6e 69  t 2 "INFO: runni
50d0: 6e 67 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e  ng test " test-n
50e0: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74  ame "/" item-pat
50f0: 68 20 22 20 73 75 70 70 72 65 73 73 65 64 20 61  h " suppressed a
5100: 73 20 69 74 20 69 73 20 43 4f 4d 50 4c 45 54 45  s it is COMPLETE
5110: 44 20 61 6e 64 20 22 20 28 74 65 73 74 3a 67 65  D and " (test:ge
5120: 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29  t-state testdat)
5130: 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 75  )..     (set! ru
5140: 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20 20  nflag #f))..    
5150: 3b 3b 20 2d 72 65 72 75 6e 20 61 6e 64 20 73 74  ;; -rerun and st
5160: 61 74 75 73 20 69 73 20 6f 6e 65 20 6f 66 20 74  atus is one of t
5170: 68 65 20 73 70 65 63 69 66 65 64 2c 20 72 75 6e  he specifed, run
5180: 20 69 74 0a 09 20 20 20 20 28 28 61 6e 64 20 72   it..    ((and r
5190: 65 72 75 6e 0a 09 09 20 20 28 6c 65 74 2a 20 28  erun...  (let* (
51a0: 28 72 65 72 75 6e 6c 73 74 20 20 20 28 73 74 72  (rerunlst   (str
51b0: 69 6e 67 2d 73 70 6c 69 74 20 72 65 72 75 6e 20  ing-split rerun 
51c0: 22 2c 22 29 29 0a 09 09 09 20 28 6d 75 73 74 2d  ",")).... (must-
51d0: 72 65 72 75 6e 20 28 6d 65 6d 62 65 72 20 28 74  rerun (member (t
51e0: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74  est:get-status t
51f0: 65 73 74 64 61 74 29 20 72 65 72 75 6e 6c 73 74  estdat) rerunlst
5200: 29 29 29 0a 09 09 20 20 20 20 28 64 65 62 75 67  )))...    (debug
5210: 3a 70 72 69 6e 74 20 33 20 22 49 4e 46 4f 3a 20  :print 3 "INFO: 
5220: 2d 72 65 72 75 6e 20 6c 69 73 74 3a 20 22 20 72  -rerun list: " r
5230: 65 72 75 6e 20 22 2c 20 74 65 73 74 2d 73 74 61  erun ", test-sta
5240: 74 75 73 3a 20 22 20 28 74 65 73 74 3a 67 65 74  tus: " (test:get
5250: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29  -status testdat)
5260: 22 2c 20 6d 75 73 74 2d 72 65 72 75 6e 3a 20 22  ", must-rerun: "
5270: 20 6d 75 73 74 2d 72 65 72 75 6e 29 0a 09 09 20   must-rerun)... 
5280: 20 20 20 6d 75 73 74 2d 72 65 72 75 6e 29 29 0a     must-rerun)).
5290: 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  .     (debug:pri
52a0: 6e 74 20 32 20 22 49 4e 46 4f 3a 20 52 65 72 75  nt 2 "INFO: Reru
52b0: 6e 20 66 6f 72 63 65 64 20 66 6f 72 20 74 65 73  n forced for tes
52c0: 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f  t " test-name "/
52d0: 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 20 20  " item-path)..  
52e0: 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67     (set! runflag
52f0: 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 2d 6b   #t))..    ;; -k
5300: 65 65 70 67 6f 69 6e 67 2c 20 64 6f 20 6e 6f 74  eepgoing, do not
5310: 20 72 65 72 75 6e 20 46 41 49 4c 0a 09 20 20 20   rerun FAIL..   
5320: 20 28 28 61 6e 64 20 6b 65 65 70 67 6f 69 6e 67   ((and keepgoing
5330: 0a 09 09 20 20 28 6d 65 6d 62 65 72 20 28 74 65  ...  (member (te
5340: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65  st:get-status te
5350: 73 74 64 61 74 29 20 27 28 22 46 41 49 4c 22 29  stdat) '("FAIL")
5360: 29 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72  ))..     (set! r
5370: 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20  unflag #f))..   
5380: 20 28 28 61 6e 64 20 28 6e 6f 74 20 72 65 72 75   ((and (not reru
5390: 6e 29 0a 09 09 20 20 28 6d 65 6d 62 65 72 20 28  n)...  (member (
53a0: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20  test:get-status 
53b0: 74 65 73 74 64 61 74 29 20 27 28 22 46 41 49 4c  testdat) '("FAIL
53c0: 22 20 22 6e 2f 61 22 29 29 29 0a 09 20 20 20 20  " "n/a")))..    
53d0: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23   (set! runflag #
53e0: 74 29 29 0a 09 20 20 20 20 28 65 6c 73 65 20 28  t))..    (else (
53f0: 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29  set! runflag #f)
5400: 29 29 0a 09 20 20 20 28 64 65 62 75 67 3a 70 72  ))..   (debug:pr
5410: 69 6e 74 20 36 20 22 52 55 4e 4e 49 4e 47 20 3d  int 6 "RUNNING =
5420: 3e 20 72 75 6e 66 6c 61 67 3a 20 22 20 72 75 6e  > runflag: " run
5430: 66 6c 61 67 20 22 20 53 54 41 54 45 3a 20 22 20  flag " STATE: " 
5440: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20  (test:get-state 
5450: 74 65 73 74 64 61 74 29 20 22 20 53 54 41 54 55  testdat) " STATU
5460: 53 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73  S: " (test:get-s
5470: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 29 0a  tatus testdat)).
5480: 09 20 20 20 28 69 66 20 28 6e 6f 74 20 72 75 6e  .   (if (not run
5490: 66 6c 61 67 29 0a 09 20 20 20 20 20 20 20 28 69  flag)..       (i
54a0: 66 20 28 6e 6f 74 20 70 61 72 65 6e 74 2d 74 65  f (not parent-te
54b0: 73 74 29 0a 09 09 20 20 20 28 64 65 62 75 67 3a  st)...   (debug:
54c0: 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 4e  print 1 "NOTE: N
54d0: 6f 74 20 73 74 61 72 74 69 6e 67 20 74 65 73 74  ot starting test
54e0: 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65   " new-test-name
54f0: 20 22 20 61 73 20 69 74 20 69 73 20 73 74 61 74   " as it is stat
5500: 65 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d  e \"" (test:get-
5510: 73 74 61 74 65 20 74 65 73 74 64 61 74 29 20 0a  state testdat) .
5520: 09 09 09 09 22 5c 22 20 61 6e 64 20 73 74 61 74  ...."\" and stat
5530: 75 73 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74  us \"" (test:get
5540: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29  -status testdat)
5550: 20 22 5c 22 2c 20 75 73 65 20 2d 72 65 72 75 6e   "\", use -rerun
5560: 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73   \"" (test:get-s
5570: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 0a 20  tatus testdat). 
5580: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
5590: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22                 "
55a0: 5c 22 20 6f 72 20 2d 66 6f 72 63 65 20 74 6f 20  \" or -force to 
55b0: 6f 76 65 72 72 69 64 65 22 29 29 0a 09 20 20 20  override"))..   
55c0: 20 20 20 20 3b 3b 20 4e 4f 54 45 3a 20 4e 6f 20      ;; NOTE: No 
55d0: 6c 6f 6e 67 65 72 20 62 65 20 63 68 65 63 6b 69  longer be checki
55e0: 6e 67 20 70 72 65 72 65 71 75 69 73 69 74 65 73  ng prerequisites
55f0: 20 68 65 72 65 21 20 57 69 6c 6c 20 6e 65 76 65   here! Will neve
5600: 72 20 67 65 74 20 68 65 72 65 20 75 6e 6c 65 73  r get here unles
5610: 73 20 70 72 65 72 65 71 73 20 61 72 65 0a 09 20  s prereqs are.. 
5620: 20 20 20 20 20 20 3b 3b 20 20 20 20 20 20 20 61        ;;       a
5630: 6c 72 65 61 64 79 20 6d 65 74 2e 0a 09 20 20 20  lready met...   
5640: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6c 61      (if (not (la
5650: 75 6e 63 68 2d 74 65 73 74 20 64 62 20 72 75 6e  unch-test db run
5660: 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74  -id runname test
5670: 2d 63 6f 6e 66 20 6b 65 79 76 61 6c 6c 73 74 20  -conf keyvallst 
5680: 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 70  test-name test-p
5690: 61 74 68 20 69 74 65 6d 64 61 74 20 66 6c 61 67  ath itemdat flag
56a0: 73 29 29 0a 09 09 20 20 20 28 62 65 67 69 6e 0a  s))...   (begin.
56b0: 09 09 20 20 20 20 20 28 70 72 69 6e 74 20 22 45  ..     (print "E
56c0: 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20  RROR: Failed to 
56d0: 6c 61 75 6e 63 68 20 74 68 65 20 74 65 73 74 2e  launch the test.
56e0: 20 45 78 69 74 69 6e 67 20 61 73 20 73 6f 6f 6e   Exiting as soon
56f0: 20 61 73 20 70 6f 73 73 69 62 6c 65 22 29 0a 09   as possible")..
5700: 09 20 20 20 20 20 28 73 65 74 21 20 2a 67 6c 6f  .     (set! *glo
5710: 62 61 6c 65 78 69 74 73 74 61 74 75 73 2a 20 31  balexitstatus* 1
5720: 29 20 3b 3b 20 0a 09 09 20 20 20 20 20 28 70 72  ) ;; ...     (pr
5730: 6f 63 65 73 73 2d 73 69 67 6e 61 6c 20 28 63 75  ocess-signal (cu
5740: 72 72 65 6e 74 2d 70 72 6f 63 65 73 73 2d 69 64  rrent-process-id
5750: 29 20 73 69 67 6e 61 6c 2f 6b 69 6c 6c 29 29 29  ) signal/kill)))
5760: 29 29 29 0a 09 28 28 4b 49 4c 4c 45 44 29 20 0a  )))..((KILLED) .
5770: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31  . (debug:print 1
5780: 20 22 4e 4f 54 45 3a 20 22 20 6e 65 77 2d 74 65   "NOTE: " new-te
5790: 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72  st-name " is alr
57a0: 65 61 64 79 20 72 75 6e 6e 69 6e 67 20 6f 72 20  eady running or 
57b0: 77 61 73 20 65 78 70 6c 69 63 74 6c 79 20 6b 69  was explictly ki
57c0: 6c 6c 65 64 2c 20 75 73 65 20 2d 66 6f 72 63 65  lled, use -force
57d0: 20 74 6f 20 6c 61 75 6e 63 68 20 69 74 2e 22 29   to launch it.")
57e0: 29 0a 09 28 28 4c 41 55 4e 43 48 45 44 20 52 45  )..((LAUNCHED RE
57f0: 4d 4f 54 45 48 4f 53 54 53 54 41 52 54 20 52 55  MOTEHOSTSTART RU
5800: 4e 4e 49 4e 47 29 20 20 0a 09 20 28 69 66 20 28  NNING)  .. (if (
5810: 3e 20 28 2d 20 28 63 75 72 72 65 6e 74 2d 73 65  > (- (current-se
5820: 63 6f 6e 64 73 29 28 2b 20 28 64 62 3a 74 65 73  conds)(+ (db:tes
5830: 74 2d 67 65 74 2d 65 76 65 6e 74 5f 74 69 6d 65  t-get-event_time
5840: 20 74 65 73 74 64 61 74 29 0a 09 09 09 09 20 20   testdat).....  
5850: 20 20 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65       (db:test-ge
5860: 74 2d 72 75 6e 5f 64 75 72 61 74 69 6f 6e 20 74  t-run_duration t
5870: 65 73 74 64 61 74 29 29 29 0a 09 09 36 30 30 29  estdat)))...600)
5880: 20 3b 3b 20 69 2e 65 2e 20 6e 6f 20 75 70 64 61   ;; i.e. no upda
5890: 74 65 20 66 6f 72 20 6d 6f 72 65 20 74 68 61 6e  te for more than
58a0: 20 36 30 30 20 73 65 63 6f 6e 64 73 0a 09 20 20   600 seconds..  
58b0: 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20     (begin..     
58c0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
58d0: 20 22 57 41 52 4e 49 4e 47 3a 20 54 65 73 74 20   "WARNING: Test 
58e0: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 70  " test-name " ap
58f0: 70 65 61 72 73 20 74 6f 20 62 65 20 64 65 61 64  pears to be dead
5900: 2e 20 46 6f 72 63 69 6e 67 20 69 74 20 74 6f 20  . Forcing it to 
5910: 73 74 61 74 65 20 49 4e 43 4f 4d 50 4c 45 54 45  state INCOMPLETE
5920: 20 61 6e 64 20 73 74 61 74 75 73 20 53 54 55 43   and status STUC
5930: 4b 2f 44 45 41 44 22 29 0a 09 20 20 20 20 20 20  K/DEAD")..      
5940: 20 28 74 65 73 74 2d 73 65 74 2d 73 74 61 74 75   (test-set-statu
5950: 73 21 20 64 62 20 74 65 73 74 2d 69 64 20 22 49  s! db test-id "I
5960: 4e 43 4f 4d 50 4c 45 54 45 22 20 22 53 54 55 43  NCOMPLETE" "STUC
5970: 4b 2f 44 45 41 44 22 20 22 54 65 73 74 20 69 73  K/DEAD" "Test is
5980: 20 73 74 75 63 6b 20 6f 72 20 64 65 61 64 22 20   stuck or dead" 
5990: 23 66 29 29 0a 09 20 20 20 20 20 28 64 65 62 75  #f))..     (debu
59a0: 67 3a 70 72 69 6e 74 20 32 20 22 4e 4f 54 45 3a  g:print 2 "NOTE:
59b0: 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 69   " test-name " i
59c0: 73 20 61 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e  s already runnin
59d0: 67 22 29 29 29 0a 09 28 65 6c 73 65 20 20 20 20  g")))..(else    
59e0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
59f0: 30 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64  0 "ERROR: Failed
5a00: 20 74 6f 20 6c 61 75 6e 63 68 20 74 65 73 74 20   to launch test 
5a10: 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20  " new-test-name 
5a20: 22 2e 20 55 6e 72 65 63 6f 67 6e 69 73 65 64 20  ". Unrecognised 
5a30: 73 74 61 74 65 20 22 20 28 74 65 73 74 3a 67 65  state " (test:ge
5a40: 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29  t-state testdat)
5a50: 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d  ))))))..;;======
5a60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5a70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5a80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5a90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5aa0: 0a 3b 3b 20 45 4e 44 20 4f 46 20 4e 45 57 20 53  .;; END OF NEW S
5ab0: 54 55 46 46 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d  TUFF.;;=========
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 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5af0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28  =============..(
5b00: 64 65 66 69 6e 65 20 28 67 65 74 2d 64 69 72 2d  define (get-dir-
5b10: 75 70 2d 6e 20 64 69 72 20 2e 20 70 61 72 61 6d  up-n dir . param
5b20: 73 29 20 0a 20 20 28 6c 65 74 20 28 28 64 70 61  s) .  (let ((dpa
5b30: 72 74 73 20 20 28 73 74 72 69 6e 67 2d 73 70 6c  rts  (string-spl
5b40: 69 74 20 64 69 72 20 22 2f 22 29 29 0a 09 28 63  it dir "/"))..(c
5b50: 6f 75 6e 74 20 20 20 28 69 66 20 28 6e 75 6c 6c  ount   (if (null
5b60: 3f 20 70 61 72 61 6d 73 29 20 31 20 28 63 61 72  ? params) 1 (car
5b70: 20 70 61 72 61 6d 73 29 29 29 29 0a 20 20 20 20   params)))).    
5b80: 28 63 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 6e  (conc "/" (strin
5b90: 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09  g-intersperse ..
5ba0: 20 20 20 20 20 20 20 28 74 61 6b 65 20 64 70 61         (take dpa
5bb0: 72 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 20 64  rts (- (length d
5bc0: 70 61 72 74 73 29 20 63 6f 75 6e 74 29 29 0a 09  parts) count))..
5bd0: 20 20 20 20 20 20 20 22 2f 22 29 29 29 29 0a 3b         "/")))).;
5be0: 3b 20 52 65 6d 6f 76 65 20 72 75 6e 73 0a 3b 3b  ; Remove runs.;;
5bf0: 20 66 69 65 6c 64 73 20 61 72 65 20 70 61 73 73   fields are pass
5c00: 69 6e 67 20 69 6e 20 74 68 72 6f 75 67 68 20 0a  ing in through .
5c10: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 65  (define (runs:re
5c20: 6d 6f 76 65 2d 72 75 6e 73 20 64 62 20 72 75 6e  move-runs db run
5c30: 6e 61 6d 65 70 61 74 74 20 74 65 73 74 70 61 74  namepatt testpat
5c40: 74 20 69 74 65 6d 70 61 74 74 29 0a 20 20 28 6c  t itempatt).  (l
5c50: 65 74 2a 20 28 28 6b 65 79 73 20 20 20 20 20 20  et* ((keys      
5c60: 20 20 28 72 64 62 3a 67 65 74 2d 6b 65 79 73 20    (rdb:get-keys 
5c70: 64 62 29 29 0a 09 20 28 72 75 6e 64 61 74 20 20  db)).. (rundat  
5c80: 20 20 20 20 28 72 75 6e 73 3a 67 65 74 2d 72 75      (runs:get-ru
5c90: 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20 6b 65  ns-by-patt db ke
5ca0: 79 73 20 72 75 6e 6e 61 6d 65 70 61 74 74 29 29  ys runnamepatt))
5cb0: 0a 09 20 28 68 65 61 64 65 72 20 20 20 20 20 20  .. (header      
5cc0: 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64  (vector-ref rund
5cd0: 61 74 20 30 29 29 0a 09 20 28 72 75 6e 73 20 20  at 0)).. (runs  
5ce0: 20 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65        (vector-re
5cf0: 66 20 72 75 6e 64 61 74 20 31 29 29 29 0a 20 20  f rundat 1))).  
5d00: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31    (debug:print 1
5d10: 20 22 48 65 61 64 65 72 3a 20 22 20 68 65 61 64   "Header: " head
5d20: 65 72 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63  er).    (for-eac
5d30: 68 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28  h.     (lambda (
5d40: 72 75 6e 29 0a 20 20 20 20 20 20 20 28 6c 65 74  run).       (let
5d50: 20 28 28 72 75 6e 6b 65 79 20 28 73 74 72 69 6e   ((runkey (strin
5d60: 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d  g-intersperse (m
5d70: 61 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 0a 09  ap (lambda (k)..
5d80: 09 09 09 09 09 28 64 62 3a 67 65 74 2d 76 61 6c  .....(db:get-val
5d90: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e  ue-by-header run
5da0: 20 68 65 61 64 65 72 20 28 76 65 63 74 6f 72 2d   header (vector-
5db0: 72 65 66 20 6b 20 30 29 29 29 20 6b 65 79 73 29  ref k 0))) keys)
5dc0: 20 22 2f 22 29 29 0a 09 20 20 20 20 20 28 64 69   "/"))..     (di
5dd0: 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 28 6d 61  rs-to-remove (ma
5de0: 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29  ke-hash-table)))
5df0: 0a 09 20 28 6c 65 74 2a 20 28 28 72 75 6e 2d 69  .. (let* ((run-i
5e00: 64 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d  d (db:get-value-
5e10: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65  by-header run he
5e20: 61 64 65 72 20 22 69 64 22 29 20 29 0a 09 09 28  ader "id") )...(
5e30: 74 65 73 74 73 20 20 28 72 64 62 3a 67 65 74 2d  tests  (rdb:get-
5e40: 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62  tests-for-run db
5e50: 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62   (db:get-value-b
5e60: 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61  y-header run hea
5e70: 64 65 72 20 22 69 64 22 29 20 74 65 73 74 70 61  der "id") testpa
5e80: 74 74 20 69 74 65 6d 70 61 74 74 20 27 28 29 20  tt itempatt '() 
5e90: 27 28 29 29 29 0a 09 09 28 6c 61 73 74 74 70 61  '()))...(lasttpa
5ea0: 74 68 20 22 2f 64 6f 65 73 2f 6e 6f 74 2f 65 78  th "/does/not/ex
5eb0: 69 73 74 2f 49 2f 68 6f 70 65 22 29 29 0a 0a 09  ist/I/hope"))...
5ec0: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c     (if (not (nul
5ed0: 6c 3f 20 74 65 73 74 73 29 29 0a 09 20 20 20 20  l? tests))..    
5ee0: 20 20 20 28 62 65 67 69 6e 0a 09 09 20 28 64 65     (begin... (de
5ef0: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d  bug:print 1 "Rem
5f00: 6f 76 69 6e 67 20 74 65 73 74 73 20 66 6f 72 20  oving tests for 
5f10: 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20  run: " runkey " 
5f20: 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d  " (db:get-value-
5f30: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65  by-header run he
5f40: 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 29  ader "runname"))
5f50: 0a 09 09 20 28 66 6f 72 2d 65 61 63 68 0a 09 09  ... (for-each...
5f60: 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 29    (lambda (test)
5f70: 0a 09 09 20 20 20 20 28 6c 65 74 2a 20 28 28 69  ...    (let* ((i
5f80: 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 73  tem-path (db:tes
5f90: 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20  t-get-item-path 
5fa0: 74 65 73 74 29 29 0a 09 09 09 20 20 20 28 74 65  test))....   (te
5fb0: 73 74 2d 6e 61 6d 65 20 28 64 62 3a 74 65 73 74  st-name (db:test
5fc0: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65  -get-testname te
5fd0: 73 74 29 29 0a 09 09 09 20 20 20 28 72 75 6e 2d  st))....   (run-
5fe0: 64 69 72 20 20 20 28 64 62 3a 74 65 73 74 2d 67  dir   (db:test-g
5ff0: 65 74 2d 72 75 6e 64 69 72 20 74 65 73 74 29 29  et-rundir test))
6000: 29 0a 09 09 20 20 20 20 20 20 28 64 65 62 75 67  )...      (debug
6010: 3a 70 72 69 6e 74 20 31 20 22 20 20 22 20 28 64  :print 1 "  " (d
6020: 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e  b:test-get-testn
6030: 61 6d 65 20 74 65 73 74 29 20 22 20 69 64 3a 20  ame test) " id: 
6040: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  " (db:test-get-i
6050: 64 20 74 65 73 74 29 20 22 20 22 20 69 74 65 6d  d test) " " item
6060: 2d 70 61 74 68 29 0a 09 09 20 20 20 20 20 20 28  -path)...      (
6070: 72 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 2d  rdb:delete-test-
6080: 72 65 63 6f 72 64 73 20 64 62 20 28 64 62 3a 74  records db (db:t
6090: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29  est-get-id test)
60a0: 29 0a 09 09 20 20 20 20 20 20 28 69 66 20 28 3e  )...      (if (>
60b0: 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20   (string-length 
60c0: 72 75 6e 2d 64 69 72 29 20 35 29 20 3b 3b 20 62  run-dir) 5) ;; b
60d0: 61 64 20 68 65 75 72 69 73 74 69 63 20 62 75 74  ad heuristic but
60e0: 20 73 68 6f 75 6c 64 20 70 72 65 76 65 6e 74 20   should prevent 
60f0: 2f 74 6d 70 20 2f 68 6f 6d 65 20 65 74 63 2e 0a  /tmp /home etc..
6100: 09 09 09 20 20 28 6c 65 74 20 28 28 66 75 6c 6c  ...  (let ((full
6110: 70 61 74 68 20 72 75 6e 2d 64 69 72 29 29 20 3b  path run-dir)) ;
6120: 3b 20 22 2f 22 20 28 64 62 3a 74 65 73 74 2d 67  ; "/" (db:test-g
6130: 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73  et-item-path tes
6140: 74 29 29 29 29 0a 09 09 09 20 20 20 20 28 73 65  t))))....    (se
6150: 74 21 20 6c 61 73 74 74 70 61 74 68 20 66 75 6c  t! lasttpath ful
6160: 6c 70 61 74 68 29 0a 09 09 09 20 20 20 20 28 68  lpath)....    (h
6170: 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 64  ash-table-set! d
6180: 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 66 75  irs-to-remove fu
6190: 6c 6c 70 61 74 68 20 23 74 29 0a 09 09 09 20 20  llpath #t)....  
61a0: 20 20 3b 3b 20 54 68 65 20 66 6f 6c 6c 6f 77 69    ;; The followi
61b0: 6e 67 20 77 61 73 20 74 68 65 20 73 61 66 65 20  ng was the safe 
61c0: 64 65 6c 65 74 65 20 63 6f 64 65 20 62 75 74 20  delete code but 
61d0: 69 74 20 77 61 73 20 6e 6f 74 20 62 65 69 6e 67  it was not being
61e0: 20 65 78 65 63 74 75 74 65 64 2e 0a 09 09 09 20   exectuted..... 
61f0: 20 20 20 3b 3b 20 28 6c 65 74 2a 20 28 28 64 69     ;; (let* ((di
6200: 72 73 2d 63 6f 75 6e 74 20 28 2b 20 31 20 28 6c  rs-count (+ 1 (l
6210: 65 6e 67 74 68 20 6b 65 79 73 29 28 6c 65 6e 67  ength keys)(leng
6220: 74 68 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74  th (string-split
6230: 20 69 74 65 6d 2d 70 61 74 68 20 22 2f 22 29 29   item-path "/"))
6240: 29 29 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 20  ))....    ;;    
6250: 20 20 20 20 28 64 69 72 2d 74 6f 2d 72 65 6d 20      (dir-to-rem 
6260: 28 67 65 74 2d 64 69 72 2d 75 70 2d 6e 20 66 75  (get-dir-up-n fu
6270: 6c 6c 70 61 74 68 20 64 69 72 73 2d 63 6f 75 6e  llpath dirs-coun
6280: 74 29 29 0a 09 09 09 20 20 20 20 3b 3b 20 20 20  t))....    ;;   
6290: 20 20 20 20 20 28 72 65 6d 61 69 6e 69 6e 67 64       (remainingd
62a0: 20 28 73 74 72 69 6e 67 2d 73 75 62 73 74 69 74   (string-substit
62b0: 75 74 65 20 28 72 65 67 65 78 70 20 28 63 6f 6e  ute (regexp (con
62c0: 63 20 22 5e 22 20 64 69 72 2d 74 6f 2d 72 65 6d  c "^" dir-to-rem
62d0: 20 22 2f 22 29 29 20 22 22 20 66 75 6c 6c 70 61   "/")) "" fullpa
62e0: 74 68 29 29 0a 09 09 09 20 20 20 20 3b 3b 20 20  th))....    ;;  
62f0: 20 20 20 20 20 20 28 63 6d 64 20 28 63 6f 6e 63        (cmd (conc
6300: 20 22 63 64 20 22 20 64 69 72 2d 74 6f 2d 72 65   "cd " dir-to-re
6310: 6d 20 22 3b 20 72 6d 64 69 72 20 2d 70 20 22 20  m "; rmdir -p " 
6320: 72 65 6d 61 69 6e 69 6e 67 64 20 29 29 29 0a 09  remainingd )))..
6330: 09 09 20 20 20 20 3b 3b 20 20 20 28 69 66 20 28  ..    ;;   (if (
6340: 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 66 75 6c  file-exists? ful
6350: 6c 70 61 74 68 29 0a 09 09 09 20 20 20 20 3b 3b  lpath)....    ;;
6360: 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09         (begin...
6370: 09 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20 20  .    ;;         
6380: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 63  (debug:print 1 c
6390: 6d 64 29 0a 09 09 09 20 20 20 20 3b 3b 20 20 20  md)....    ;;   
63a0: 20 20 20 20 20 20 28 73 79 73 74 65 6d 20 63 6d        (system cm
63b0: 64 29 29 29 0a 09 09 09 20 20 20 20 3b 3b 20 20  d)))....    ;;  
63c0: 20 29 29 0a 09 09 09 20 20 20 20 29 29 29 29 0a   ))....    )))).
63d0: 09 09 20 20 20 20 74 65 73 74 73 29 29 29 0a 0a  ..    tests)))..
63e0: 09 20 20 20 3b 3b 20 6c 6f 6f 6b 20 74 68 6f 75  .   ;; look thou
63f0: 67 68 20 74 68 65 20 64 69 72 73 2d 74 6f 2d 72  gh the dirs-to-r
6400: 65 6d 6f 76 65 20 66 6f 72 20 63 61 6e 64 69 64  emove for candid
6410: 61 74 65 73 20 66 6f 72 20 72 65 6d 6f 76 61 6c  ates for removal
6420: 2e 20 44 6f 20 74 68 69 73 20 61 66 74 65 72 20  . Do this after 
6430: 64 65 6c 65 74 69 6e 67 20 74 68 65 20 72 65 63  deleting the rec
6440: 6f 72 64 73 0a 09 20 20 20 3b 3b 20 66 6f 72 20  ords..   ;; for 
6450: 65 61 63 68 20 74 65 73 74 20 69 6e 20 63 61 73  each test in cas
6460: 65 20 77 65 20 67 65 74 20 6b 69 6c 6c 65 64 2e  e we get killed.
6470: 20 54 68 61 74 20 73 68 6f 75 6c 64 20 6d 69 6e   That should min
6480: 69 6d 69 7a 65 20 74 68 65 20 64 65 74 72 69 74  imize the detrit
6490: 75 73 20 6c 65 66 74 20 6f 6e 20 64 69 73 6b 0a  us left on disk.
64a0: 09 20 20 20 3b 3b 20 70 72 6f 63 65 73 73 20 74  .   ;; process t
64b0: 68 65 20 64 69 72 73 20 66 72 6f 6d 20 6c 6f 6e  he dirs from lon
64c0: 67 65 73 74 20 73 74 72 69 6e 67 20 6c 65 6e 67  gest string leng
64d0: 74 68 20 74 6f 20 73 68 6f 72 74 65 73 74 0a 09  th to shortest..
64e0: 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 09 20     (for-each .. 
64f0: 20 20 20 28 6c 61 6d 62 64 61 20 28 64 69 72 2d     (lambda (dir-
6500: 74 6f 2d 72 65 6d 6f 76 65 29 0a 09 20 20 20 20  to-remove)..    
6510: 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73    (if (file-exis
6520: 74 73 3f 20 64 69 72 2d 74 6f 2d 72 65 6d 6f 76  ts? dir-to-remov
6530: 65 29 0a 09 09 20 20 28 6c 65 74 20 28 28 64 69  e)...  (let ((di
6540: 72 2d 69 6e 2d 64 62 20 27 28 29 29 29 0a 09 09  r-in-db '()))...
6550: 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66 6f 72      (sqlite3:for
6560: 2d 65 61 63 68 2d 72 6f 77 0a 09 09 20 20 20 20  -each-row...    
6570: 20 28 6c 61 6d 62 64 61 20 28 64 69 72 29 0a 09   (lambda (dir)..
6580: 09 20 20 20 20 20 20 20 28 73 65 74 21 20 64 69  .       (set! di
6590: 72 2d 69 6e 2d 64 62 20 28 63 6f 6e 73 20 64 69  r-in-db (cons di
65a0: 72 20 64 69 72 2d 69 6e 2d 64 62 29 29 29 0a 09  r dir-in-db)))..
65b0: 09 20 20 20 20 20 64 62 20 22 53 45 4c 45 43 54  .     db "SELECT
65c0: 20 72 75 6e 64 69 72 20 46 52 4f 4d 20 74 65 73   rundir FROM tes
65d0: 74 73 20 57 48 45 52 45 20 72 75 6e 64 69 72 20  ts WHERE rundir 
65e0: 4c 49 4b 45 20 3f 3b 22 20 0a 09 09 20 20 20 20  LIKE ?;" ...    
65f0: 20 28 63 6f 6e 63 20 22 25 22 20 64 69 72 2d 74   (conc "%" dir-t
6600: 6f 2d 72 65 6d 6f 76 65 20 22 25 22 29 29 20 3b  o-remove "%")) ;
6610: 3b 20 79 65 73 2c 20 49 27 6d 20 67 6f 69 6e 67  ; yes, I'm going
6620: 20 74 6f 20 62 61 69 6c 20 69 66 20 74 68 65 72   to bail if ther
6630: 65 20 69 73 20 61 6e 79 74 68 69 6e 67 20 6c 69  e is anything li
6640: 6b 65 20 74 68 69 73 20 64 69 72 20 69 6e 20 74  ke this dir in t
6650: 68 65 20 64 62 0a 09 09 20 20 20 20 28 69 66 20  he db...    (if 
6660: 28 6e 75 6c 6c 3f 20 64 69 72 2d 69 6e 2d 64 62  (null? dir-in-db
6670: 29 0a 09 09 09 28 62 65 67 69 6e 0a 09 09 09 20  )....(begin.... 
6680: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20   (debug:print 2 
6690: 22 52 65 6d 6f 76 69 6e 67 20 64 69 72 65 63 74  "Removing direct
66a0: 6f 72 79 20 77 69 74 68 20 7a 65 72 6f 20 64 62  ory with zero db
66b0: 20 72 65 66 65 72 65 6e 63 65 73 3a 20 22 20 64   references: " d
66c0: 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 29 0a 09 09  ir-to-remove)...
66d0: 09 20 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63  .  (system (conc
66e0: 20 22 72 6d 20 2d 72 66 20 22 20 64 69 72 2d 74   "rm -rf " dir-t
66f0: 6f 2d 72 65 6d 6f 76 65 29 29 0a 09 09 09 20 20  o-remove))....  
6700: 28 68 61 73 68 2d 74 61 62 6c 65 2d 64 65 6c 65  (hash-table-dele
6710: 74 65 21 20 64 69 72 73 2d 74 6f 2d 72 65 6d 6f  te! dirs-to-remo
6720: 76 65 20 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 65  ve dir-to-remove
6730: 29 29 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69  ))....(debug:pri
6740: 6e 74 20 32 20 22 53 6b 69 70 70 69 6e 67 20 72  nt 2 "Skipping r
6750: 65 6d 6f 76 61 6c 20 6f 66 20 22 20 64 69 72 2d  emoval of " dir-
6760: 74 6f 2d 72 65 6d 6f 76 65 20 22 20 66 6f 72 20  to-remove " for 
6770: 6e 6f 77 20 61 73 20 69 74 20 73 74 69 6c 6c 20  now as it still 
6780: 68 61 73 20 72 65 66 65 72 65 6e 63 65 73 20 69  has references i
6790: 6e 20 74 68 65 20 64 61 74 61 62 61 73 65 22 29  n the database")
67a0: 29 29 29 29 0a 09 20 20 20 20 28 73 6f 72 74 20  ))))..    (sort 
67b0: 28 68 61 73 68 2d 74 61 62 6c 65 2d 6b 65 79 73  (hash-table-keys
67c0: 20 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 29   dirs-to-remove)
67d0: 20 28 6c 61 6d 62 64 61 20 28 61 20 62 29 28 3e   (lambda (a b)(>
67e0: 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20   (string-length 
67f0: 61 29 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68  a)(string-length
6800: 20 62 29 29 29 29 29 0a 0a 09 20 20 20 3b 3b 20   b)))))...   ;; 
6810: 72 65 6d 6f 76 65 20 74 68 65 20 72 75 6e 20 69  remove the run i
6820: 66 20 7a 65 72 6f 20 74 65 73 74 73 20 72 65 6d  f zero tests rem
6830: 61 69 6e 0a 09 20 20 20 28 6c 65 74 20 28 28 72  ain..   (let ((r
6840: 65 6d 74 65 73 74 73 20 28 72 64 62 3a 67 65 74  emtests (rdb:get
6850: 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64  -tests-for-run d
6860: 62 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d  b (db:get-value-
6870: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65  by-header run he
6880: 61 64 65 72 20 22 69 64 22 29 20 23 66 20 23 66  ader "id") #f #f
6890: 20 27 28 29 20 27 28 29 29 29 29 0a 09 20 20 20   '() '())))..   
68a0: 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 72 65 6d    (if (null? rem
68b0: 74 65 73 74 73 29 20 3b 3b 20 6e 6f 20 6d 6f 72  tests) ;; no mor
68c0: 65 20 74 65 73 74 73 20 72 65 6d 61 69 6e 69 6e  e tests remainin
68d0: 67 0a 09 09 20 28 6c 65 74 2a 20 28 28 64 70 61  g... (let* ((dpa
68e0: 72 74 73 20 20 28 73 74 72 69 6e 67 2d 73 70 6c  rts  (string-spl
68f0: 69 74 20 6c 61 73 74 74 70 61 74 68 20 22 2f 22  it lasttpath "/"
6900: 29 29 0a 09 09 09 28 72 75 6e 70 61 74 68 20 28  ))....(runpath (
6910: 63 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 6e 67  conc "/" (string
6920: 2d 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09 09  -intersperse ...
6930: 09 09 09 20 20 20 20 28 74 61 6b 65 20 64 70 61  ...    (take dpa
6940: 72 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 20 64  rts (- (length d
6950: 70 61 72 74 73 29 20 31 29 29 0a 09 09 09 09 09  parts) 1))......
6960: 20 20 20 20 22 2f 22 29 29 29 29 0a 09 09 20 20      "/"))))...  
6970: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20   (debug:print 1 
6980: 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 3a 20 22  "Removing run: "
6990: 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a   runkey " " (db:
69a0: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61  get-value-by-hea
69b0: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22  der run header "
69c0: 72 75 6e 6e 61 6d 65 22 29 29 0a 09 09 20 20 20  runname"))...   
69d0: 28 64 62 3a 64 65 6c 65 74 65 2d 72 75 6e 20 64  (db:delete-run d
69e0: 62 20 72 75 6e 2d 69 64 29 0a 09 09 20 20 20 3b  b run-id)...   ;
69f0: 3b 20 6e 65 65 64 20 74 6f 20 66 69 67 75 72 65  ; need to figure
6a00: 20 6f 75 74 20 74 68 65 20 70 61 74 68 20 74 6f   out the path to
6a10: 20 74 68 65 20 72 75 6e 20 64 69 72 20 61 6e 64   the run dir and
6a20: 20 72 65 6d 6f 76 65 20 69 74 20 69 66 20 65 6d   remove it if em
6a30: 70 74 79 0a 09 09 20 20 20 3b 3b 20 20 20 20 28  pty...   ;;    (
6a40: 69 66 20 28 6e 75 6c 6c 3f 20 28 67 6c 6f 62 20  if (null? (glob 
6a50: 28 63 6f 6e 63 20 72 75 6e 70 61 74 68 20 22 2f  (conc runpath "/
6a60: 2a 22 29 29 29 0a 09 09 20 20 20 3b 3b 20 20 20  *")))...   ;;   
6a70: 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20       (begin...  
6a80: 20 3b 3b 20 09 20 28 64 65 62 75 67 3a 70 72 69   ;; . (debug:pri
6a90: 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 72  nt 1 "Removing r
6aa0: 75 6e 20 64 69 72 20 22 20 72 75 6e 70 61 74 68  un dir " runpath
6ab0: 29 0a 09 09 20 20 20 3b 3b 20 09 20 28 73 79 73  )...   ;; . (sys
6ac0: 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 64 69 72  tem (conc "rmdir
6ad0: 20 2d 70 20 22 20 72 75 6e 70 61 74 68 29 29 29   -p " runpath)))
6ae0: 29 0a 09 09 20 20 20 29 29 29 29 0a 09 20 29 29  )...   )))).. ))
6af0: 0a 20 20 20 20 20 72 75 6e 73 29 29 29 0a 0a 3b  .     runs)))..;
6b00: 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;===============
6b10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6b20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6b30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6b40: 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 75 74 69  =======.;; Routi
6b50: 6e 65 73 20 66 6f 72 20 6d 61 6e 69 70 75 6c 61  nes for manipula
6b60: 74 69 6e 67 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d  ting runs.;;====
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 3d 3d 3d  ================
6b90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6ba0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6bb0: 3d 3d 0a 0a 3b 3b 20 53 69 6e 63 65 20 6d 61 6e  ==..;; Since man
6bc0: 79 20 63 61 6c 6c 73 20 74 6f 20 61 20 72 75 6e  y calls to a run
6bd0: 20 72 65 71 75 69 72 65 20 70 72 65 74 74 79 20   require pretty 
6be0: 6d 75 63 68 20 74 68 65 20 73 61 6d 65 20 73 65  much the same se
6bf0: 74 75 70 20 0a 3b 3b 20 74 68 69 73 20 77 72 61  tup .;; this wra
6c00: 70 70 65 72 20 69 73 20 75 73 65 64 20 74 6f 20  pper is used to 
6c10: 72 65 64 75 63 65 20 74 68 65 20 72 65 70 6c 69  reduce the repli
6c20: 63 61 74 69 6f 6e 20 6f 66 20 63 6f 64 65 0a 28  cation of code.(
6c30: 64 65 66 69 6e 65 20 28 67 65 6e 65 72 61 6c 2d  define (general-
6c40: 72 75 6e 2d 63 61 6c 6c 20 73 77 69 74 63 68 6e  run-call switchn
6c50: 61 6d 65 20 61 63 74 69 6f 6e 2d 64 65 73 63 20  ame action-desc 
6c60: 70 72 6f 63 29 0a 20 20 28 6c 65 74 20 28 28 72  proc).  (let ((r
6c70: 75 6e 6e 61 6d 65 20 28 61 72 67 73 3a 67 65 74  unname (args:get
6c80: 2d 61 72 67 20 22 3a 72 75 6e 6e 61 6d 65 22 29  -arg ":runname")
6c90: 29 0a 09 28 74 61 72 67 65 74 20 20 28 69 66 20  )..(target  (if 
6ca0: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
6cb0: 74 61 72 67 65 74 22 29 0a 09 09 20 20 20 20 20  target")...     
6cc0: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
6cd0: 74 61 72 67 65 74 22 29 0a 09 09 20 20 20 20 20  target")...     
6ce0: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
6cf0: 72 65 71 74 61 72 67 22 29 29 29 0a 09 28 74 68  reqtarg")))..(th
6d00: 31 20 20 20 20 20 23 66 29 29 0a 20 20 20 20 28  1     #f)).    (
6d10: 63 6f 6e 64 0a 20 20 20 20 20 28 28 6e 6f 74 20  cond.     ((not 
6d20: 74 61 72 67 65 74 29 0a 20 20 20 20 20 20 28 64  target).      (d
6d30: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
6d40: 52 4f 52 3a 20 4d 69 73 73 69 6e 67 20 72 65 71  ROR: Missing req
6d50: 75 69 72 65 64 20 70 61 72 61 6d 65 74 65 72 20  uired parameter 
6d60: 66 6f 72 20 22 20 73 77 69 74 63 68 6e 61 6d 65  for " switchname
6d70: 20 22 2c 20 79 6f 75 20 6d 75 73 74 20 73 70 65   ", you must spe
6d80: 63 69 66 79 20 74 68 65 20 74 61 72 67 65 74 20  cify the target 
6d90: 77 69 74 68 20 2d 74 61 72 67 65 74 22 29 0a 20  with -target"). 
6da0: 20 20 20 20 20 28 65 78 69 74 20 33 29 29 0a 20       (exit 3)). 
6db0: 20 20 20 20 28 28 6e 6f 74 20 72 75 6e 6e 61 6d      ((not runnam
6dc0: 65 29 0a 20 20 20 20 20 20 28 64 65 62 75 67 3a  e).      (debug:
6dd0: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
6de0: 4d 69 73 73 69 6e 67 20 72 65 71 75 69 72 65 64  Missing required
6df0: 20 70 61 72 61 6d 65 74 65 72 20 66 6f 72 20 22   parameter for "
6e00: 20 73 77 69 74 63 68 6e 61 6d 65 20 22 2c 20 79   switchname ", y
6e10: 6f 75 20 6d 75 73 74 20 73 70 65 63 69 66 79 20  ou must specify 
6e20: 74 68 65 20 72 75 6e 20 6e 61 6d 65 20 77 69 74  the run name wit
6e30: 68 20 3a 72 75 6e 6e 61 6d 65 20 72 75 6e 6e 61  h :runname runna
6e40: 6d 65 22 29 0a 20 20 20 20 20 20 28 65 78 69 74  me").      (exit
6e50: 20 33 29 29 0a 20 20 20 20 20 28 65 6c 73 65 0a   3)).     (else.
6e60: 20 20 20 20 20 20 28 6c 65 74 20 28 28 64 62 20        (let ((db 
6e70: 20 20 23 66 29 0a 09 20 20 20 20 28 6b 65 79 73    #f)..    (keys
6e80: 20 23 66 29 29 0a 09 28 69 66 20 28 6e 6f 74 20   #f))..(if (not 
6e90: 28 73 65 74 75 70 2d 66 6f 72 2d 72 75 6e 29 29  (setup-for-run))
6ea0: 0a 09 20 20 20 20 28 62 65 67 69 6e 20 0a 09 20  ..    (begin .. 
6eb0: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
6ec0: 74 20 30 20 22 46 61 69 6c 65 64 20 74 6f 20 73  t 0 "Failed to s
6ed0: 65 74 75 70 2c 20 65 78 69 74 69 6e 67 22 29 0a  etup, exiting").
6ee0: 09 20 20 20 20 20 20 28 65 78 69 74 20 31 29 29  .      (exit 1))
6ef0: 29 0a 09 28 73 65 74 21 20 64 62 20 20 20 28 6f  )..(set! db   (o
6f00: 70 65 6e 2d 64 62 29 29 0a 09 28 69 66 20 28 61  pen-db))..(if (a
6f10: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 73 65  rgs:get-arg "-se
6f20: 72 76 65 72 22 29 0a 09 20 20 20 20 28 73 65 72  rver")..    (ser
6f30: 76 65 72 3a 73 74 61 72 74 20 64 62 20 28 61 72  ver:start db (ar
6f40: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 73 65 72  gs:get-arg "-ser
6f50: 76 65 72 22 29 29 0a 09 20 20 20 20 28 69 66 20  ver"))..    (if 
6f60: 28 6e 6f 74 20 28 6f 72 20 28 61 72 67 73 3a 67  (not (or (args:g
6f70: 65 74 2d 61 72 67 20 22 2d 72 75 6e 61 6c 6c 22  et-arg "-runall"
6f80: 29 0a 09 09 09 20 20 28 61 72 67 73 3a 67 65 74  )....  (args:get
6f90: 2d 61 72 67 20 22 2d 72 75 6e 74 65 73 74 73 22  -arg "-runtests"
6fa0: 29 29 29 0a 09 09 28 73 65 72 76 65 72 3a 63 6c  )))...(server:cl
6fb0: 69 65 6e 74 2d 73 65 74 75 70 20 64 62 29 29 29  ient-setup db)))
6fc0: 0a 09 28 73 65 74 21 20 6b 65 79 73 20 28 72 64  ..(set! keys (rd
6fd0: 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a  b:get-keys db)).
6fe0: 09 3b 3b 20 68 61 76 65 20 65 6e 6f 75 67 68 20  .;; have enough 
6ff0: 74 6f 20 70 72 6f 63 65 73 73 20 2d 74 61 72 67  to process -targ
7000: 65 74 20 6f 72 20 2d 72 65 71 74 61 72 67 20 68  et or -reqtarg h
7010: 65 72 65 0a 09 28 69 66 20 28 61 72 67 73 3a 67  ere..(if (args:g
7020: 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67  et-arg "-reqtarg
7030: 22 29 0a 09 20 20 20 20 28 6c 65 74 2a 20 28 28  ")..    (let* ((
7040: 72 75 6e 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63  runconfigf (conc
7050: 20 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72 75    *toppath* "/ru
7060: 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22  nconfigs.config"
7070: 29 29 20 3b 3b 20 44 4f 20 4e 4f 54 20 45 56 41  )) ;; DO NOT EVA
7080: 4c 55 41 54 45 20 41 4c 4c 20 0a 09 09 20 20 20  LUATE ALL ...   
7090: 28 72 75 6e 63 6f 6e 66 69 67 20 20 28 72 65 61  (runconfig  (rea
70a0: 64 2d 63 6f 6e 66 69 67 20 72 75 6e 63 6f 6e 66  d-config runconf
70b0: 69 67 66 20 23 66 20 23 66 20 65 6e 76 69 72 6f  igf #f #f enviro
70c0: 6e 2d 70 61 74 74 3a 20 23 66 29 29 29 20 0a 09  n-patt: #f))) ..
70d0: 20 20 20 20 20 20 28 69 66 20 28 68 61 73 68 2d        (if (hash-
70e0: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c  table-ref/defaul
70f0: 74 20 72 75 6e 63 6f 6e 66 69 67 20 28 61 72 67  t runconfig (arg
7100: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74  s:get-arg "-reqt
7110: 61 72 67 22 29 20 23 66 29 0a 09 09 20 20 28 6b  arg") #f)...  (k
7120: 65 79 73 3a 74 61 72 67 65 74 2d 73 65 74 2d 61  eys:target-set-a
7130: 72 67 73 20 6b 65 79 73 20 28 61 72 67 73 3a 67  rgs keys (args:g
7140: 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67  et-arg "-reqtarg
7150: 22 29 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68  ") args:arg-hash
7160: 29 0a 09 09 20 20 28 62 65 67 69 6e 0a 09 09 20  )...  (begin... 
7170: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
7180: 30 20 22 45 52 52 4f 52 3a 20 5b 22 20 28 61 72  0 "ERROR: [" (ar
7190: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71  gs:get-arg "-req
71a0: 74 61 72 67 22 29 20 22 5d 20 6e 6f 74 20 66 6f  targ") "] not fo
71b0: 75 6e 64 20 69 6e 20 22 20 72 75 6e 63 6f 6e 66  und in " runconf
71c0: 69 67 66 29 0a 09 09 20 20 20 20 28 73 71 6c 69  igf)...    (sqli
71d0: 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62  te3:finalize! db
71e0: 29 0a 09 09 20 20 20 20 28 65 78 69 74 20 31 29  )...    (exit 1)
71f0: 29 29 29 0a 09 20 20 20 20 28 69 66 20 28 61 72  )))..    (if (ar
7200: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72  gs:get-arg "-tar
7210: 67 65 74 22 29 0a 09 09 28 6b 65 79 73 3a 74 61  get")...(keys:ta
7220: 72 67 65 74 2d 73 65 74 2d 61 72 67 73 20 6b 65  rget-set-args ke
7230: 79 73 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  ys (args:get-arg
7240: 20 22 2d 74 61 72 67 65 74 22 20 61 72 67 73 3a   "-target" args:
7250: 61 72 67 2d 68 61 73 68 29 20 61 72 67 73 3a 61  arg-hash) args:a
7260: 72 67 2d 68 61 73 68 29 29 29 0a 09 28 69 66 20  rg-hash)))..(if 
7270: 28 6e 6f 74 20 28 63 61 72 20 2a 63 6f 6e 66 69  (not (car *confi
7280: 67 69 6e 66 6f 2a 29 29 0a 09 20 20 20 20 28 62  ginfo*))..    (b
7290: 65 67 69 6e 0a 09 20 20 20 20 20 20 28 64 65 62  egin..      (deb
72a0: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f  ug:print 0 "ERRO
72b0: 52 3a 20 41 74 74 65 6d 70 74 65 64 20 74 6f 20  R: Attempted to 
72c0: 22 20 61 63 74 69 6f 6e 2d 64 65 73 63 20 22 20  " action-desc " 
72d0: 62 75 74 20 72 75 6e 20 61 72 65 61 20 63 6f 6e  but run area con
72e0: 66 69 67 20 66 69 6c 65 20 6e 6f 74 20 66 6f 75  fig file not fou
72f0: 6e 64 22 29 0a 09 20 20 20 20 20 20 28 65 78 69  nd")..      (exi
7300: 74 20 31 29 29 0a 09 20 20 20 20 3b 3b 20 45 78  t 1))..    ;; Ex
7310: 74 72 61 63 74 20 6f 75 74 20 73 74 75 66 66 20  tract out stuff 
7320: 6e 65 65 64 65 64 20 69 6e 20 6d 6f 73 74 20 6f  needed in most o
7330: 72 20 6d 61 6e 79 20 63 61 6c 6c 73 0a 09 20 20  r many calls..  
7340: 20 20 3b 3b 20 68 65 72 65 20 74 68 65 6e 20 63    ;; here then c
7350: 61 6c 6c 20 70 72 6f 63 0a 09 20 20 20 20 28 6c  all proc..    (l
7360: 65 74 2a 20 28 28 6b 65 79 6e 61 6d 65 73 20 20  et* ((keynames  
7370: 20 28 6d 61 70 20 6b 65 79 3a 67 65 74 2d 66 69   (map key:get-fi
7380: 65 6c 64 6e 61 6d 65 20 6b 65 79 73 29 29 0a 09  eldname keys))..
7390: 09 20 20 20 28 6b 65 79 76 61 6c 6c 73 74 20 20  .   (keyvallst  
73a0: 28 6b 65 79 73 2d 3e 76 61 6c 6c 69 73 74 20 6b  (keys->vallist k
73b0: 65 79 73 20 23 74 29 29 29 0a 09 20 20 20 20 20  eys #t)))..     
73c0: 20 28 70 72 6f 63 20 64 62 20 74 61 72 67 65 74   (proc db target
73d0: 20 72 75 6e 6e 61 6d 65 20 6b 65 79 73 20 6b 65   runname keys ke
73e0: 79 6e 61 6d 65 73 20 6b 65 79 76 61 6c 6c 73 74  ynames keyvallst
73f0: 29 29 29 0a 09 28 69 66 20 74 68 31 20 28 74 68  )))..(if th1 (th
7400: 72 65 61 64 2d 6a 6f 69 6e 21 20 74 68 31 29 29  read-join! th1))
7410: 0a 09 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c  ..(sqlite3:final
7420: 69 7a 65 21 20 64 62 29 0a 09 28 73 65 74 21 20  ize! db)..(set! 
7430: 2a 64 69 64 73 6f 6d 65 74 68 69 6e 67 2a 20 23  *didsomething* #
7440: 74 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d  t))))))..;;=====
7450: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7460: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7470: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7480: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7490: 3d 0a 3b 3b 20 52 6f 6c 6c 75 70 20 72 75 6e 73  =.;; Rollup runs
74a0: 0a 3b 3b 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 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
74e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 55 70  =========..;; Up
74f0: 64 61 74 65 20 74 68 65 20 74 65 73 74 5f 6d 65  date the test_me
7500: 74 61 20 74 61 62 6c 65 20 66 6f 72 20 74 68 69  ta table for thi
7510: 73 20 74 65 73 74 0a 28 64 65 66 69 6e 65 20 28  s test.(define (
7520: 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74  runs:update-test
7530: 5f 6d 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61  _meta db test-na
7540: 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 0a 20 20  me test-conf).  
7550: 28 6c 65 74 20 28 28 63 75 72 72 72 65 63 6f 72  (let ((currrecor
7560: 64 20 28 64 62 3a 74 65 73 74 6d 65 74 61 2d 67  d (db:testmeta-g
7570: 65 74 2d 72 65 63 6f 72 64 20 64 62 20 74 65 73  et-record db tes
7580: 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 69  t-name))).    (i
7590: 66 20 28 6e 6f 74 20 63 75 72 72 72 65 63 6f 72  f (not currrecor
75a0: 64 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 73  d)..(begin..  (s
75b0: 65 74 21 20 63 75 72 72 72 65 63 6f 72 64 20 28  et! currrecord (
75c0: 6d 61 6b 65 2d 76 65 63 74 6f 72 20 31 30 20 23  make-vector 10 #
75d0: 66 29 29 0a 09 20 20 28 64 62 3a 74 65 73 74 6d  f))..  (db:testm
75e0: 65 74 61 2d 61 64 64 2d 72 65 63 6f 72 64 20 64  eta-add-record d
75f0: 62 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20  b test-name))). 
7600: 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20     (for-each .  
7610: 20 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 29     (lambda (key)
7620: 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28  .       (let* ((
7630: 69 64 78 20 28 63 61 64 72 20 6b 65 79 29 29 0a  idx (cadr key)).
7640: 09 20 20 20 20 20 20 28 66 6c 64 20 28 63 61 72  .      (fld (car
7650: 20 20 6b 65 79 29 29 0a 09 20 20 20 20 20 20 28    key))..      (
7660: 76 61 6c 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b  val (config-look
7670: 75 70 20 74 65 73 74 2d 63 6f 6e 66 20 22 74 65  up test-conf "te
7680: 73 74 5f 6d 65 74 61 22 20 66 6c 64 29 29 29 0a  st_meta" fld))).
7690: 09 20 3b 3b 20 28 64 65 62 75 67 3a 70 72 69 6e  . ;; (debug:prin
76a0: 74 20 35 20 22 69 64 78 3a 20 22 20 69 64 78 20  t 5 "idx: " idx 
76b0: 22 20 66 6c 64 3a 20 22 20 66 6c 64 20 22 20 76  " fld: " fld " v
76c0: 61 6c 3a 20 22 20 76 61 6c 29 0a 09 20 28 69 66  al: " val).. (if
76d0: 20 28 61 6e 64 20 76 61 6c 20 28 6e 6f 74 20 28   (and val (not (
76e0: 65 71 75 61 6c 3f 20 28 76 65 63 74 6f 72 2d 72  equal? (vector-r
76f0: 65 66 20 63 75 72 72 72 65 63 6f 72 64 20 69 64  ef currrecord id
7700: 78 29 20 76 61 6c 29 29 29 0a 09 20 20 20 20 20  x) val)))..     
7710: 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 20 28  (begin..       (
7720: 70 72 69 6e 74 20 22 55 70 64 61 74 69 6e 67 20  print "Updating 
7730: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 22 20  " test-name " " 
7740: 66 6c 64 20 22 20 74 6f 20 22 20 76 61 6c 29 0a  fld " to " val).
7750: 09 20 20 20 20 20 20 20 28 64 62 3a 74 65 73 74  .       (db:test
7760: 6d 65 74 61 2d 75 70 64 61 74 65 2d 66 69 65 6c  meta-update-fiel
7770: 64 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 66  d db test-name f
7780: 6c 64 20 76 61 6c 29 29 29 29 29 0a 20 20 20 20  ld val))))).    
7790: 20 27 28 28 22 61 75 74 68 6f 72 22 20 32 29 28   '(("author" 2)(
77a0: 22 6f 77 6e 65 72 22 20 33 29 28 22 64 65 73 63  "owner" 3)("desc
77b0: 72 69 70 74 69 6f 6e 22 20 34 29 28 22 72 65 76  ription" 4)("rev
77c0: 69 65 77 65 64 22 20 35 29 28 22 74 61 67 73 22  iewed" 5)("tags"
77d0: 20 39 29 29 29 29 29 0a 0a 3b 3b 20 55 70 64 61   9)))))..;; Upda
77e0: 74 65 20 74 65 73 74 5f 6d 65 74 61 20 66 6f 72  te test_meta for
77f0: 20 61 6c 6c 20 74 65 73 74 73 0a 28 64 65 66 69   all tests.(defi
7800: 6e 65 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d  ne (runs:update-
7810: 61 6c 6c 2d 74 65 73 74 5f 6d 65 74 61 20 64 62  all-test_meta db
7820: 29 0a 20 20 28 6c 65 74 20 28 28 74 65 73 74 2d  ).  (let ((test-
7830: 6e 61 6d 65 73 20 28 67 65 74 2d 61 6c 6c 2d 6c  names (get-all-l
7840: 65 67 61 6c 2d 74 65 73 74 73 29 29 29 0a 20 20  egal-tests))).  
7850: 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20    (for-each .   
7860: 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 2d    (lambda (test-
7870: 6e 61 6d 65 29 0a 20 20 20 20 20 20 20 28 6c 65  name).       (le
7880: 74 2a 20 28 28 74 65 73 74 2d 70 61 74 68 20 20  t* ((test-path  
7890: 20 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68    (conc *toppath
78a0: 2a 20 22 2f 74 65 73 74 73 2f 22 20 74 65 73 74  * "/tests/" test
78b0: 2d 6e 61 6d 65 29 29 0a 09 20 20 20 20 20 20 28  -name))..      (
78c0: 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 28 63 6f  test-configf (co
78d0: 6e 63 20 74 65 73 74 2d 70 61 74 68 20 22 2f 74  nc test-path "/t
78e0: 65 73 74 63 6f 6e 66 69 67 22 29 29 0a 09 20 20  estconfig"))..  
78f0: 20 20 20 20 28 74 65 73 74 65 78 69 73 74 73 20      (testexists 
7900: 20 20 28 61 6e 64 20 28 66 69 6c 65 2d 65 78 69    (and (file-exi
7910: 73 74 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67  sts? test-config
7920: 66 29 28 66 69 6c 65 2d 72 65 61 64 2d 61 63 63  f)(file-read-acc
7930: 65 73 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67  ess? test-config
7940: 66 29 29 29 0a 09 20 20 20 20 20 20 3b 3b 20 72  f)))..      ;; r
7950: 65 61 64 20 63 6f 6e 66 69 67 73 20 77 69 74 68  ead configs with
7960: 20 74 72 69 63 6b 73 20 74 75 72 6e 65 64 20 6f   tricks turned o
7970: 66 66 20 28 69 2e 65 2e 20 6e 6f 20 73 79 73 74  ff (i.e. no syst
7980: 65 6d 29 0a 09 20 20 20 20 20 20 28 74 65 73 74  em)..      (test
7990: 2d 63 6f 6e 66 20 20 20 20 28 69 66 20 74 65 73  -conf    (if tes
79a0: 74 65 78 69 73 74 73 20 28 72 65 61 64 2d 63 6f  texists (read-co
79b0: 6e 66 69 67 20 74 65 73 74 2d 63 6f 6e 66 69 67  nfig test-config
79c0: 66 20 23 66 20 23 66 29 28 6d 61 6b 65 2d 68 61  f #f #f)(make-ha
79d0: 73 68 2d 74 61 62 6c 65 29 29 29 29 0a 09 20 28  sh-table)))).. (
79e0: 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74  runs:update-test
79f0: 5f 6d 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61  _meta db test-na
7a00: 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 29 29 0a  me test-conf))).
7a10: 20 20 20 20 20 74 65 73 74 2d 6e 61 6d 65 73 29       test-names)
7a20: 29 29 0a 0a 3b 3b 20 54 68 69 73 20 63 6f 75 6c  ))..;; This coul
7a30: 64 20 70 72 6f 62 61 62 6c 79 20 62 65 20 72 65  d probably be re
7a40: 66 61 63 74 6f 72 65 64 20 69 6e 74 6f 20 6f 6e  factored into on
7a50: 65 20 63 6f 6d 70 6c 65 78 20 71 75 65 72 79 20  e complex query 
7a60: 2e 2e 2e 0a 28 64 65 66 69 6e 65 20 28 72 75 6e  ....(define (run
7a70: 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 20 64 62 20  s:rollup-run db 
7a80: 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72  keys keyvallst r
7a90: 75 6e 6e 61 6d 65 20 75 73 65 72 29 20 3b 3b 20  unname user) ;; 
7aa0: 77 61 73 20 74 61 72 67 65 74 2c 20 6e 6f 77 20  was target, now 
7ab0: 6b 65 79 76 61 6c 6c 73 74 0a 20 20 28 64 65 62  keyvallst.  (deb
7ac0: 75 67 3a 70 72 69 6e 74 20 34 20 22 72 75 6e 73  ug:print 4 "runs
7ad0: 3a 72 6f 6c 6c 75 70 2d 72 75 6e 2c 20 6b 65 79  :rollup-run, key
7ae0: 73 3a 20 22 20 6b 65 79 73 20 22 20 6b 65 79 76  s: " keys " keyv
7af0: 61 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c  allst: " keyvall
7b00: 73 74 20 22 20 3a 72 75 6e 6e 61 6d 65 20 22 20  st " :runname " 
7b10: 72 75 6e 6e 61 6d 65 20 22 20 75 73 65 72 3a 20  runname " user: 
7b20: 22 20 75 73 65 72 29 0a 20 20 28 6c 65 74 2a 20  " user).  (let* 
7b30: 28 3b 20 28 6b 65 79 76 61 6c 6c 6c 73 74 20 20  (; (keyvalllst  
7b40: 20 20 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74      (keys:target
7b50: 2d 3e 6b 65 79 76 61 6c 20 6b 65 79 73 20 74 61  ->keyval keys ta
7b60: 72 67 65 74 29 29 0a 09 20 28 6e 65 77 2d 72 75  rget)).. (new-ru
7b70: 6e 2d 69 64 20 20 20 20 20 20 28 72 75 6e 73 3a  n-id      (runs:
7b80: 72 65 67 69 73 74 65 72 2d 72 75 6e 20 64 62 20  register-run db 
7b90: 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72  keys keyvallst r
7ba0: 75 6e 6e 61 6d 65 20 22 6e 65 77 22 20 22 6e 2f  unname "new" "n/
7bb0: 61 22 20 75 73 65 72 29 29 0a 09 20 28 70 72 65  a" user)).. (pre
7bc0: 76 2d 74 65 73 74 73 20 20 20 20 20 20 28 74 65  v-tests      (te
7bd0: 73 74 3a 67 65 74 2d 6d 61 74 63 68 69 6e 67 2d  st:get-matching-
7be0: 70 72 65 76 69 6f 75 73 2d 74 65 73 74 2d 72 75  previous-test-ru
7bf0: 6e 2d 72 65 63 6f 72 64 73 20 64 62 20 6e 65 77  n-records db new
7c00: 2d 72 75 6e 2d 69 64 20 22 25 22 20 22 25 22 29  -run-id "%" "%")
7c10: 29 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73 20  ).. (curr-tests 
7c20: 20 20 20 20 20 28 72 64 62 3a 67 65 74 2d 74 65       (rdb:get-te
7c30: 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e  sts-for-run db n
7c40: 65 77 2d 72 75 6e 2d 69 64 20 22 25 22 20 22 25  ew-run-id "%" "%
7c50: 22 20 27 28 29 20 27 28 29 29 29 0a 09 20 28 63  " '() '())).. (c
7c60: 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 28  urr-tests-hash (
7c70: 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29  make-hash-table)
7c80: 29 29 0a 20 20 20 20 28 64 62 3a 75 70 64 61 74  )).    (db:updat
7c90: 65 2d 72 75 6e 2d 65 76 65 6e 74 5f 74 69 6d 65  e-run-event_time
7ca0: 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 29 0a   db new-run-id).
7cb0: 20 20 20 20 3b 3b 20 69 6e 64 65 78 20 74 68 65      ;; index the
7cc0: 20 61 6c 72 65 61 64 79 20 73 61 76 65 64 20 74   already saved t
7cd0: 65 73 74 73 20 62 79 20 74 65 73 74 6e 61 6d 65  ests by testname
7ce0: 20 61 6e 64 20 69 74 65 6d 64 61 74 20 69 6e 20   and itemdat in 
7cf0: 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 0a  curr-tests-hash.
7d00: 20 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 20      (for-each.  
7d10: 20 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74     (lambda (test
7d20: 64 61 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74  dat).       (let
7d30: 2a 20 28 28 74 65 73 74 6e 61 6d 65 20 20 28 64  * ((testname  (d
7d40: 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e  b:test-get-testn
7d50: 61 6d 65 20 74 65 73 74 64 61 74 29 29 0a 09 20  ame testdat)).. 
7d60: 20 20 20 20 20 28 69 74 65 6d 2d 70 61 74 68 20       (item-path 
7d70: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65  (db:test-get-ite
7d80: 6d 2d 70 61 74 68 20 74 65 73 74 64 61 74 29 29  m-path testdat))
7d90: 0a 09 20 20 20 20 20 20 28 66 75 6c 6c 2d 6e 61  ..      (full-na
7da0: 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d  me (conc testnam
7db0: 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29  e "/" item-path)
7dc0: 29 29 0a 09 20 28 68 61 73 68 2d 74 61 62 6c 65  )).. (hash-table
7dd0: 2d 73 65 74 21 20 63 75 72 72 2d 74 65 73 74 73  -set! curr-tests
7de0: 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20  -hash full-name 
7df0: 74 65 73 74 64 61 74 29 29 29 0a 20 20 20 20 20  testdat))).     
7e00: 63 75 72 72 2d 74 65 73 74 73 29 0a 20 20 20 20  curr-tests).    
7e10: 3b 3b 20 4e 4f 50 45 3a 20 4e 6f 6e 2d 6f 70 74  ;; NOPE: Non-opt
7e20: 69 6d 61 6c 20 61 70 70 72 6f 61 63 68 2e 20 54  imal approach. T
7e30: 72 79 20 74 68 69 73 20 69 6e 73 74 65 61 64 2e  ry this instead.
7e40: 0a 20 20 20 20 3b 3b 20 20 20 31 2e 20 74 65 73  .    ;;   1. tes
7e50: 74 73 20 61 72 65 20 72 65 63 65 69 76 65 64 20  ts are received 
7e60: 69 6e 20 61 20 6c 69 73 74 2c 20 6d 6f 73 74 20  in a list, most 
7e70: 72 65 63 65 6e 74 20 66 69 72 73 74 0a 20 20 20  recent first.   
7e80: 20 3b 3b 20 20 20 32 2e 20 72 65 70 6c 61 63 65   ;;   2. replace
7e90: 20 74 68 65 20 72 6f 6c 6c 75 70 20 74 65 73 74   the rollup test
7ea0: 20 77 69 74 68 20 74 68 65 20 6e 65 77 20 2a 61   with the new *a
7eb0: 6c 77 61 79 73 2a 0a 20 20 20 20 28 66 6f 72 2d  lways*.    (for-
7ec0: 65 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62  each .     (lamb
7ed0: 64 61 20 28 74 65 73 74 64 61 74 29 0a 20 20 20  da (testdat).   
7ee0: 20 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74      (let* ((test
7ef0: 6e 61 6d 65 20 20 28 64 62 3a 74 65 73 74 2d 67  name  (db:test-g
7f00: 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74  et-testname test
7f10: 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 69 74  dat))..      (it
7f20: 65 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74  em-path (db:test
7f30: 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74  -get-item-path t
7f40: 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20  estdat))..      
7f50: 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63  (full-name (conc
7f60: 20 74 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 74   testname "/" it
7f70: 65 6d 2d 70 61 74 68 29 29 0a 09 20 20 20 20 20  em-path))..     
7f80: 20 28 70 72 65 76 2d 74 65 73 74 2d 64 61 74 20   (prev-test-dat 
7f90: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f  (hash-table-ref/
7fa0: 64 65 66 61 75 6c 74 20 63 75 72 72 2d 74 65 73  default curr-tes
7fb0: 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d  ts-hash full-nam
7fc0: 65 20 23 66 29 29 0a 09 20 20 20 20 20 20 28 74  e #f))..      (t
7fd0: 65 73 74 2d 73 74 65 70 73 20 20 20 20 20 20 28  est-steps      (
7fe0: 64 62 3a 67 65 74 2d 73 74 65 70 73 2d 66 6f 72  db:get-steps-for
7ff0: 2d 74 65 73 74 20 64 62 20 28 64 62 3a 74 65 73  -test db (db:tes
8000: 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 74  t-get-id testdat
8010: 29 29 29 0a 09 20 20 20 20 20 20 28 6e 65 77 2d  )))..      (new-
8020: 74 65 73 74 2d 72 65 63 6f 72 64 20 23 66 29 29  test-record #f))
8030: 0a 09 20 3b 3b 20 72 65 70 6c 61 63 65 20 74 68  .. ;; replace th
8040: 65 73 65 20 77 69 74 68 20 69 6e 73 65 72 74 20  ese with insert 
8050: 2e 2e 2e 20 73 65 6c 65 63 74 0a 09 20 28 61 70  ... select.. (ap
8060: 70 6c 79 20 73 71 6c 69 74 65 33 3a 65 78 65 63  ply sqlite3:exec
8070: 75 74 65 20 0a 09 09 64 62 20 0a 09 09 28 63 6f  ute ...db ...(co
8080: 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45  nc "INSERT OR RE
8090: 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 74 73  PLACE INTO tests
80a0: 20 28 72 75 6e 5f 69 64 2c 74 65 73 74 6e 61 6d   (run_id,testnam
80b0: 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c 65  e,state,status,e
80c0: 76 65 6e 74 5f 74 69 6d 65 2c 68 6f 73 74 2c 63  vent_time,host,c
80d0: 70 75 6c 6f 61 64 2c 64 69 73 6b 66 72 65 65 2c  puload,diskfree,
80e0: 75 6e 61 6d 65 2c 72 75 6e 64 69 72 2c 69 74 65  uname,rundir,ite
80f0: 6d 5f 70 61 74 68 2c 72 75 6e 5f 64 75 72 61 74  m_path,run_durat
8100: 69 6f 6e 2c 66 69 6e 61 6c 5f 6c 6f 67 66 2c 63  ion,final_logf,c
8110: 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 20  omment) "...    
8120: 20 20 22 56 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f    "VALUES (?,?,?
8130: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f  ,?,?,?,?,?,?,?,?
8140: 2c 3f 2c 3f 2c 3f 29 3b 22 29 0a 09 09 6e 65 77  ,?,?,?);")...new
8150: 2d 72 75 6e 2d 69 64 20 28 63 64 64 72 20 28 76  -run-id (cddr (v
8160: 65 63 74 6f 72 2d 3e 6c 69 73 74 20 74 65 73 74  ector->list test
8170: 64 61 74 29 29 29 0a 09 20 28 73 65 74 21 20 6e  dat))).. (set! n
8180: 65 77 2d 74 65 73 74 64 61 74 20 28 63 61 72 20  ew-testdat (car 
8190: 28 72 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66  (rdb:get-tests-f
81a0: 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77 2d 72 75  or-run db new-ru
81b0: 6e 2d 69 64 20 74 65 73 74 6e 61 6d 65 20 69 74  n-id testname it
81c0: 65 6d 2d 70 61 74 68 20 27 28 29 20 27 28 29 29  em-path '() '())
81d0: 29 29 0a 09 20 28 68 61 73 68 2d 74 61 62 6c 65  )).. (hash-table
81e0: 2d 73 65 74 21 20 63 75 72 72 2d 74 65 73 74 73  -set! curr-tests
81f0: 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20  -hash full-name 
8200: 6e 65 77 2d 74 65 73 74 64 61 74 29 20 3b 3b 20  new-testdat) ;; 
8210: 74 68 69 73 20 63 6f 75 6c 64 20 62 65 20 63 6f  this could be co
8220: 6e 66 75 73 69 6e 67 2c 20 77 68 69 63 68 20 72  nfusing, which r
8230: 65 63 6f 72 64 20 73 68 6f 75 6c 64 20 67 6f 20  ecord should go 
8240: 69 6e 74 6f 20 74 68 65 20 6c 6f 6f 6b 75 70 20  into the lookup 
8250: 74 61 62 6c 65 3f 0a 09 20 3b 3b 20 4e 6f 77 20  table?.. ;; Now 
8260: 64 75 70 6c 69 63 61 74 65 20 74 68 65 20 74 65  duplicate the te
8270: 73 74 20 73 74 65 70 73 0a 09 20 28 64 65 62 75  st steps.. (debu
8280: 67 3a 70 72 69 6e 74 20 34 20 22 43 6f 70 79 69  g:print 4 "Copyi
8290: 6e 67 20 72 65 63 6f 72 64 73 20 69 6e 20 74 65  ng records in te
82a0: 73 74 5f 73 74 65 70 73 20 66 72 6f 6d 20 74 65  st_steps from te
82b0: 73 74 5f 69 64 3d 22 20 28 64 62 3a 74 65 73 74  st_id=" (db:test
82c0: 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29  -get-id testdat)
82d0: 20 22 20 74 6f 20 22 20 28 64 62 3a 74 65 73 74   " to " (db:test
82e0: 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74  -get-id new-test
82f0: 64 61 74 29 29 0a 09 20 28 73 71 6c 69 74 65 33  dat)).. (sqlite3
8300: 3a 65 78 65 63 75 74 65 20 0a 09 20 20 64 62 20  :execute ..  db 
8310: 0a 09 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 52  ..  (conc "INSER
8320: 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54  T OR REPLACE INT
8330: 4f 20 74 65 73 74 5f 73 74 65 70 73 20 28 74 65  O test_steps (te
8340: 73 74 5f 69 64 2c 73 74 65 70 6e 61 6d 65 2c 73  st_id,stepname,s
8350: 74 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e  tate,status,even
8360: 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 29 20  t_time,comment) 
8370: 22 0a 09 09 22 53 45 4c 45 43 54 20 22 20 28 64  "..."SELECT " (d
8380: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65  b:test-get-id ne
8390: 77 2d 74 65 73 74 64 61 74 29 20 22 2c 73 74 65  w-testdat) ",ste
83a0: 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74  pname,state,stat
83b0: 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f  us,event_time,co
83c0: 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f  mment FROM test_
83d0: 73 74 65 70 73 20 57 48 45 52 45 20 74 65 73 74  steps WHERE test
83e0: 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 28 64 62 3a  _id=?;")..  (db:
83f0: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74  test-get-id test
8400: 64 61 74 29 29 0a 09 20 3b 3b 20 4e 6f 77 20 64  dat)).. ;; Now d
8410: 75 70 6c 69 63 61 74 65 20 74 68 65 20 74 65 73  uplicate the tes
8420: 74 20 64 61 74 61 0a 09 20 28 64 65 62 75 67 3a  t data.. (debug:
8430: 70 72 69 6e 74 20 34 20 22 43 6f 70 79 69 6e 67  print 4 "Copying
8440: 20 72 65 63 6f 72 64 73 20 69 6e 20 74 65 73 74   records in test
8450: 5f 64 61 74 61 20 66 72 6f 6d 20 74 65 73 74 5f  _data from test_
8460: 69 64 3d 22 20 28 64 62 3a 74 65 73 74 2d 67 65  id=" (db:test-ge
8470: 74 2d 69 64 20 74 65 73 74 64 61 74 29 20 22 20  t-id testdat) " 
8480: 74 6f 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65  to " (db:test-ge
8490: 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74  t-id new-testdat
84a0: 29 29 0a 09 20 28 73 71 6c 69 74 65 33 3a 65 78  )).. (sqlite3:ex
84b0: 65 63 75 74 65 20 0a 09 20 20 64 62 20 0a 09 20  ecute ..  db .. 
84c0: 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f   (conc "INSERT O
84d0: 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74  R REPLACE INTO t
84e0: 65 73 74 5f 64 61 74 61 20 28 74 65 73 74 5f 69  est_data (test_i
84f0: 64 2c 63 61 74 65 67 6f 72 79 2c 76 61 72 69 61  d,category,varia
8500: 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65 63 74  ble,value,expect
8510: 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d  ed,tol,units,com
8520: 6d 65 6e 74 29 20 22 0a 09 09 22 53 45 4c 45 43  ment) "..."SELEC
8530: 54 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74  T " (db:test-get
8540: 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29  -id new-testdat)
8550: 20 22 2c 63 61 74 65 67 6f 72 79 2c 76 61 72 69   ",category,vari
8560: 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65 63  able,value,expec
8570: 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f  ted,tol,units,co
8580: 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f  mment FROM test_
8590: 64 61 74 61 20 57 48 45 52 45 20 74 65 73 74 5f  data WHERE test_
85a0: 69 64 3d 3f 3b 22 29 0a 09 20 20 28 64 62 3a 74  id=?;")..  (db:t
85b0: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64  est-get-id testd
85c0: 61 74 29 29 0a 09 20 29 29 0a 20 20 20 20 20 70  at)).. )).     p
85d0: 72 65 76 2d 74 65 73 74 73 29 29 29 0a 09 20 0a  rev-tests))).. .
85e0: 20 20 20 20 20 0a                                     .