Megatest

Hex Artifact Content
Login

Artifact e177dce855d56a8323431f4a7fb0fd99b5c246bd:


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 69 66 20 28 70 61 74  ttom ...(if (pat
33f0: 74 2d 6c 69 73 74 2d 6d 61 74 63 68 20 69 74 65  t-list-match ite
3400: 6d 2d 70 61 74 68 20 69 74 65 6d 2d 70 61 74 74  m-path item-patt
3410: 73 29 0a 09 09 20 20 20 20 28 72 75 6e 3a 74 65  s)...    (run:te
3420: 73 74 20 64 62 20 72 75 6e 2d 69 64 20 72 75 6e  st db run-id run
3430: 6e 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20 74  name keyvallst t
3440: 65 73 74 2d 72 65 63 6f 72 64 20 66 6c 61 67 73  est-record flags
3450: 20 23 66 29 0a 09 09 20 20 20 20 28 64 65 62 75   #f)...    (debu
3460: 67 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a  g:print 1 "INFO:
3470: 20 53 6b 69 70 70 69 6e 67 20 22 20 28 74 65 73   Skipping " (tes
3480: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
3490: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72  -testname test-r
34a0: 65 63 6f 72 64 29 20 22 20 22 20 69 74 65 6d 2d  ecord) " " item-
34b0: 70 61 74 68 20 22 20 61 73 20 69 74 20 64 6f 65  path " as it doe
34c0: 73 6e 27 74 20 6d 61 74 63 68 20 22 20 69 74 65  sn't match " ite
34d0: 6d 2d 70 61 74 74 73 29 29 0a 09 09 3b 3b 20 65  m-patts))...;; e
34e0: 6c 73 65 20 74 68 65 20 72 75 6e 20 69 73 20 73  lse the run is s
34f0: 74 75 63 6b 2c 20 74 65 6d 70 6f 72 61 72 69 6c  tuck, temporaril
3500: 79 20 6f 72 20 70 65 72 6d 61 6e 65 6e 74 6c 79  y or permanently
3510: 0a 09 09 28 6c 65 74 20 28 28 6e 65 77 74 61 6c  ...(let ((newtal
3520: 20 28 61 70 70 65 6e 64 20 74 61 6c 20 28 6c 69   (append tal (li
3530: 73 74 20 68 65 64 29 29 29 29 0a 09 09 20 20 3b  st hed))))...  ;
3540: 3b 20 63 6f 75 6c 64 6e 27 74 20 72 75 6e 2c 20  ; couldn't run, 
3550: 74 61 6b 65 20 61 20 62 72 65 61 74 68 65 72 0a  take a breather.
3560: 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65  ..  (thread-slee
3570: 70 21 20 30 2e 35 29 0a 09 09 20 20 28 6c 6f 6f  p! 0.5)...  (loo
3580: 70 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63  p (car newtal)(c
3590: 64 72 20 6e 65 77 74 61 6c 29 29 29 29 29 29 0a  dr newtal)))))).
35a0: 09 20 0a 09 20 3b 3b 20 63 61 73 65 20 77 68 65  . .. ;; case whe
35b0: 72 65 20 61 6e 20 69 74 65 6d 73 20 63 61 6d 65  re an items came
35c0: 20 69 6e 20 61 73 20 61 20 6c 69 73 74 20 62 65   in as a list be
35d0: 65 6e 20 70 72 6f 63 65 73 73 65 64 0a 09 20 28  en processed.. (
35e0: 28 61 6e 64 20 28 6c 69 73 74 3f 20 69 74 65 6d  (and (list? item
35f0: 73 29 20 20 20 20 20 3b 3b 20 74 68 75 73 20 77  s)     ;; thus w
3600: 65 20 6b 6e 6f 77 20 6f 75 72 20 69 74 65 6d 73  e know our items
3610: 20 61 72 65 20 61 6c 72 65 61 64 79 20 63 61 6c   are already cal
3620: 63 75 6c 61 74 65 64 0a 09 20 20 20 20 20 20 20  culated..       
3630: 28 6e 6f 74 20 20 20 69 74 65 6d 64 61 74 29 29  (not   itemdat))
3640: 20 3b 3b 20 61 6e 64 20 6e 6f 74 20 79 65 74 20   ;; and not yet 
3650: 65 78 70 61 6e 64 65 64 20 69 6e 74 6f 20 74 68  expanded into th
3660: 65 20 6c 69 73 74 20 6f 66 20 74 68 69 6e 67 73  e list of things
3670: 20 74 6f 20 62 65 20 64 6f 6e 65 0a 09 20 20 28   to be done..  (
3680: 69 66 20 28 61 6e 64 20 28 3e 3d 20 2a 76 65 72  if (and (>= *ver
3690: 62 6f 73 69 74 79 2a 20 31 29 0a 09 09 20 20 20  bosity* 1)...   
36a0: 28 3e 20 28 6c 65 6e 67 74 68 20 69 74 65 6d 73  (> (length items
36b0: 29 20 30 29 0a 09 09 20 20 20 28 3e 20 28 6c 65  ) 0)...   (> (le
36c0: 6e 67 74 68 20 28 63 61 72 20 69 74 65 6d 73 29  ngth (car items)
36d0: 29 20 30 29 29 0a 09 09 20 20 20 28 70 70 20 69  ) 0))...   (pp i
36e0: 74 65 6d 73 29 29 0a 09 20 20 3b 3b 20 28 69 66  tems))..  ;; (if
36f0: 20 28 3e 3d 20 2a 76 65 72 62 6f 73 69 74 79 2a   (>= *verbosity*
3700: 20 35 29 0a 09 20 20 3b 3b 20 20 20 20 20 28 62   5)..  ;;     (b
3710: 65 67 69 6e 0a 09 20 20 3b 3b 20 20 20 20 20 20  egin..  ;;      
3720: 20 28 70 72 69 6e 74 20 22 69 74 65 6d 73 3a 20   (print "items: 
3730: 22 29 20 20 20 20 20 28 70 70 20 28 69 74 65 6d  ")     (pp (item
3740: 2d 61 73 73 6f 63 2d 3e 69 74 65 6d 2d 6c 69 73  -assoc->item-lis
3750: 74 20 69 74 65 6d 73 29 29 0a 09 20 20 3b 3b 20  t items))..  ;; 
3760: 20 20 20 20 20 20 28 70 72 69 6e 74 20 22 69 74        (print "it
3770: 65 6d 73 74 61 62 6c 65 3a 20 22 29 28 70 70 20  emstable: ")(pp 
3780: 28 69 74 65 6d 2d 74 61 62 6c 65 2d 3e 69 74 65  (item-table->ite
3790: 6d 2d 6c 69 73 74 20 69 74 65 6d 73 74 61 62 6c  m-list itemstabl
37a0: 65 29 29 29 29 0a 09 20 20 28 66 6f 72 2d 65 61  e))))..  (for-ea
37b0: 63 68 0a 09 20 20 20 28 6c 61 6d 62 64 61 20 28  ch..   (lambda (
37c0: 6d 79 2d 69 74 65 6d 64 61 74 29 0a 09 20 20 20  my-itemdat)..   
37d0: 20 20 28 6c 65 74 2a 20 28 28 6e 65 77 2d 74 65    (let* ((new-te
37e0: 73 74 2d 72 65 63 6f 72 64 20 28 6c 65 74 20 28  st-record (let (
37f0: 28 6e 65 77 72 65 63 20 28 6d 61 6b 65 2d 74 65  (newrec (make-te
3800: 73 74 73 3a 74 65 73 74 71 75 65 75 65 29 29 29  sts:testqueue)))
3810: 0a 09 09 09 09 20 20 20 20 20 20 20 28 76 65 63  .....       (vec
3820: 74 6f 72 2d 63 6f 70 79 21 20 74 65 73 74 2d 72  tor-copy! test-r
3830: 65 63 6f 72 64 20 6e 65 77 72 65 63 29 0a 09 09  ecord newrec)...
3840: 09 09 20 20 20 20 20 20 20 6e 65 77 72 65 63 29  ..       newrec)
3850: 29 0a 09 09 20 20 20 20 28 6d 79 2d 69 74 65 6d  )...    (my-item
3860: 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74  -path (item-list
3870: 2d 3e 70 61 74 68 20 6d 79 2d 69 74 65 6d 64 61  ->path my-itemda
3880: 74 29 29 29 0a 09 20 20 20 20 20 20 20 28 69 66  t)))..       (if
3890: 20 28 70 61 74 74 2d 6c 69 73 74 2d 6d 61 74 63   (patt-list-matc
38a0: 68 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68 20 69  h my-item-path i
38b0: 74 65 6d 2d 70 61 74 74 73 29 20 20 20 20 20 20  tem-patts)      
38c0: 20 20 20 20 20 3b 3b 20 79 65 73 2c 20 77 65 20       ;; yes, we 
38d0: 77 61 6e 74 20 74 6f 20 70 72 6f 63 65 73 73 20  want to process 
38e0: 74 68 69 73 20 69 74 65 6d 0a 09 09 20 20 20 28  this item...   (
38f0: 6c 65 74 20 28 28 6e 65 77 74 65 73 74 6e 61 6d  let ((newtestnam
3900: 65 20 28 63 6f 6e 63 20 68 65 64 20 22 2f 22 20  e (conc hed "/" 
3910: 6d 79 2d 69 74 65 6d 2d 70 61 74 68 29 29 29 20  my-item-path))) 
3920: 20 20 20 3b 3b 20 74 65 73 74 20 6e 61 6d 65 73     ;; test names
3930: 20 61 72 65 20 75 6e 69 71 75 65 20 6f 6e 20 74   are unique on t
3940: 65 73 74 6e 61 6d 65 2f 69 74 65 6d 2d 70 61 74  estname/item-pat
3950: 68 0a 09 09 20 20 20 20 20 28 74 65 73 74 73 3a  h...     (tests:
3960: 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74  testqueue-set-it
3970: 65 6d 73 21 20 20 20 20 20 6e 65 77 2d 74 65 73  ems!     new-tes
3980: 74 2d 72 65 63 6f 72 64 20 23 66 29 0a 09 09 20  t-record #f)... 
3990: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71      (tests:testq
39a0: 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 64 61 74  ueue-set-itemdat
39b0: 21 20 20 20 6e 65 77 2d 74 65 73 74 2d 72 65 63  !   new-test-rec
39c0: 6f 72 64 20 6d 79 2d 69 74 65 6d 64 61 74 29 0a  ord my-itemdat).
39d0: 09 09 20 20 20 20 20 28 74 65 73 74 73 3a 74 65  ..     (tests:te
39e0: 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d  stqueue-set-item
39f0: 5f 70 61 74 68 21 20 6e 65 77 2d 74 65 73 74 2d  _path! new-test-
3a00: 72 65 63 6f 72 64 20 6d 79 2d 69 74 65 6d 2d 70  record my-item-p
3a10: 61 74 68 29 0a 09 09 20 20 20 20 20 28 68 61 73  ath)...     (has
3a20: 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 65 73  h-table-set! tes
3a30: 74 2d 72 65 63 6f 72 64 73 20 6e 65 77 74 65 73  t-records newtes
3a40: 74 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74 2d 72  tname new-test-r
3a50: 65 63 6f 72 64 29 0a 09 09 20 20 20 20 20 28 73  ecord)...     (s
3a60: 65 74 21 20 74 61 6c 20 28 63 6f 6e 73 20 6e 65  et! tal (cons ne
3a70: 77 74 65 73 74 6e 61 6d 65 20 74 61 6c 29 29 29  wtestname tal)))
3a80: 29 29 29 20 3b 3b 20 73 69 6e 63 65 20 74 68 65  ))) ;; since the
3a90: 73 65 20 61 72 65 20 69 74 65 6d 69 7a 65 64 20  se are itemized 
3aa0: 63 72 65 61 74 65 20 6e 65 77 20 74 65 73 74 20  create new test 
3ab0: 6e 61 6d 65 73 20 74 65 73 74 6e 61 6d 65 2f 69  names testname/i
3ac0: 74 65 6d 70 61 74 68 0a 09 20 20 20 69 74 65 6d  tempath..   item
3ad0: 73 29 0a 09 20 20 28 6c 6f 6f 70 20 28 63 61 72  s)..  (loop (car
3ae0: 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 29 29   tal)(cdr tal)))
3af0: 0a 0a 09 20 3b 3b 20 69 66 20 69 74 65 6d 73 20  ... ;; if items 
3b00: 69 73 20 61 20 70 72 6f 63 20 74 68 65 6e 20 6e  is a proc then n
3b10: 65 65 64 20 74 6f 20 72 75 6e 20 69 74 65 6d 73  eed to run items
3b20: 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d  :get-items-from-
3b30: 63 6f 6e 66 69 67 2c 20 67 65 74 20 74 68 65 20  config, get the 
3b40: 6c 69 73 74 20 61 6e 64 20 6c 6f 6f 70 20 0a 09  list and loop ..
3b50: 20 3b 3b 20 20 20 20 2d 20 62 75 74 20 6f 6e 6c   ;;    - but onl
3b60: 79 20 64 6f 20 74 68 61 74 20 69 66 20 72 65 73  y do that if res
3b70: 6f 75 72 63 65 73 20 65 78 69 73 74 20 74 6f 20  ources exist to 
3b80: 6b 69 63 6b 20 6f 66 66 20 74 68 65 20 6a 6f 62  kick off the job
3b90: 0a 09 20 28 28 6f 72 20 28 70 72 6f 63 65 64 75  .. ((or (procedu
3ba0: 72 65 3f 20 69 74 65 6d 73 29 28 65 71 3f 20 69  re? items)(eq? i
3bb0: 74 65 6d 73 20 27 68 61 76 65 2d 70 72 6f 63 65  tems 'have-proce
3bc0: 64 75 72 65 29 29 0a 09 20 20 28 69 66 20 28 61  dure))..  (if (a
3bd0: 6e 64 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e  nd (runs:can-run
3be0: 2d 6d 6f 72 65 2d 74 65 73 74 73 20 64 62 20 74  -more-tests db t
3bf0: 65 73 74 2d 72 65 63 6f 72 64 29 0a 09 09 20 20  est-record)...  
3c00: 20 28 6e 75 6c 6c 3f 20 28 64 62 3a 67 65 74 2d   (null? (db:get-
3c10: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20  prereqs-not-met 
3c20: 64 62 20 72 75 6e 2d 69 64 20 77 61 69 74 6f 6e  db run-id waiton
3c30: 73 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 09  s item-path)))..
3c40: 20 20 20 20 20 20 28 6c 65 74 20 28 28 74 65 73        (let ((tes
3c50: 74 2d 6e 61 6d 65 20 28 74 65 73 74 73 3a 74 65  t-name (tests:te
3c60: 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74  stqueue-get-test
3c70: 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64  name test-record
3c80: 29 29 29 0a 09 09 28 73 65 74 65 6e 76 20 22 4d  )))...(setenv "M
3c90: 54 5f 54 45 53 54 5f 4e 41 4d 45 22 20 74 65 73  T_TEST_NAME" tes
3ca0: 74 2d 6e 61 6d 65 29 20 3b 3b 20 0a 09 09 28 73  t-name) ;; ...(s
3cb0: 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e 4e 41 4d  etenv "MT_RUNNAM
3cc0: 45 22 20 20 20 72 75 6e 6e 61 6d 65 29 0a 09 09  E"   runname)...
3cd0: 28 73 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e  (set-megatest-en
3ce0: 76 2d 76 61 72 73 20 64 62 20 72 75 6e 2d 69 64  v-vars db run-id
3cf0: 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62  ) ;; these may b
3d00: 65 20 6e 65 65 64 65 64 20 62 79 20 74 68 65 20  e needed by the 
3d10: 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73  launching proces
3d20: 73 0a 09 09 28 6c 65 74 20 28 28 69 74 65 6d 73  s...(let ((items
3d30: 2d 6c 69 73 74 20 28 69 74 65 6d 73 3a 67 65 74  -list (items:get
3d40: 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66  -items-from-conf
3d50: 69 67 20 74 63 6f 6e 66 69 67 29 29 29 0a 09 09  ig tconfig)))...
3d60: 20 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74 65    (if (list? ite
3d70: 6d 73 2d 6c 69 73 74 29 0a 09 09 20 20 20 20 20  ms-list)...     
3d80: 20 28 62 65 67 69 6e 0a 09 09 09 28 74 65 73 74   (begin....(test
3d90: 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d  s:testqueue-set-
3da0: 69 74 65 6d 73 21 20 74 65 73 74 2d 72 65 63 6f  items! test-reco
3db0: 72 64 20 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09  rd items-list)..
3dc0: 09 09 28 6c 6f 6f 70 20 68 65 64 20 74 61 6c 29  ..(loop hed tal)
3dd0: 29 0a 09 09 20 20 20 20 20 20 28 62 65 67 69 6e  )...      (begin
3de0: 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74  ....(debug:print
3df0: 20 30 20 22 45 52 52 4f 52 3a 20 54 68 65 20 70   0 "ERROR: The p
3e00: 72 6f 63 20 66 72 6f 6d 20 72 65 61 64 69 6e 67  roc from reading
3e10: 20 74 68 65 20 73 65 74 75 70 20 64 69 64 20 6e   the setup did n
3e20: 6f 74 20 79 69 65 6c 64 20 61 20 6c 69 73 74 20  ot yield a list 
3e30: 2d 20 70 6c 65 61 73 65 20 72 65 70 6f 72 74 20  - please report 
3e40: 74 68 69 73 22 29 0a 09 09 09 28 65 78 69 74 20  this")....(exit 
3e50: 31 29 29 29 29 29 0a 09 20 20 20 20 20 20 28 6c  1)))))..      (l
3e60: 65 74 20 28 28 6e 65 77 74 61 6c 20 28 61 70 70  et ((newtal (app
3e70: 65 6e 64 20 74 61 6c 20 28 6c 69 73 74 20 68 65  end tal (list he
3e80: 64 29 29 29 29 0a 09 09 3b 3b 20 69 66 20 63 61  d))))...;; if ca
3e90: 6e 27 74 20 72 75 6e 20 6d 6f 72 65 20 74 65 73  n't run more tes
3ea0: 74 73 2c 20 6c 65 74 73 20 74 61 6b 65 20 61 20  ts, lets take a 
3eb0: 62 72 65 61 74 68 65 72 0a 09 09 28 74 68 72 65  breather...(thre
3ec0: 61 64 2d 73 6c 65 65 70 21 20 30 2e 35 29 0a 09  ad-sleep! 0.5)..
3ed0: 09 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74  .(loop (car newt
3ee0: 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 29  al)(cdr newtal))
3ef0: 29 29 29 0a 0a 09 20 3b 3b 20 74 68 69 73 20 63  )))... ;; this c
3f00: 61 73 65 20 73 68 6f 75 6c 64 20 6e 6f 74 20 68  ase should not h
3f10: 61 70 70 65 6e 2c 20 61 64 64 65 64 20 74 6f 20  appen, added to 
3f20: 68 65 6c 70 20 63 61 74 63 68 20 61 6e 79 20 62  help catch any b
3f30: 75 67 73 0a 09 20 28 28 61 6e 64 20 28 6c 69 73  ugs.. ((and (lis
3f40: 74 3f 20 69 74 65 6d 73 29 20 69 74 65 6d 64 61  t? items) itemda
3f50: 74 29 0a 09 20 20 28 64 65 62 75 67 3a 70 72 69  t)..  (debug:pri
3f60: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 53 68 6f  nt 0 "ERROR: Sho
3f70: 75 6c 64 20 6e 6f 74 20 68 61 76 65 20 61 20 6c  uld not have a l
3f80: 69 73 74 20 6f 66 20 69 74 65 6d 73 20 69 6e 20  ist of items in 
3f90: 61 20 74 65 73 74 20 61 6e 64 20 74 68 65 20 69  a test and the i
3fa0: 74 65 6d 73 70 61 74 68 20 73 65 74 20 2d 20 70  temspath set - p
3fb0: 6c 65 61 73 65 20 72 65 70 6f 72 74 20 74 68 69  lease report thi
3fc0: 73 22 29 0a 09 20 20 28 65 78 69 74 20 31 29 29  s")..  (exit 1))
3fd0: 29 29 0a 09 0a 20 20 20 20 20 20 3b 3b 20 77 65  ))...      ;; we
3fe0: 20 67 65 74 20 68 65 72 65 20 6f 6e 20 22 64 72   get here on "dr
3ff0: 6f 70 20 74 68 72 6f 75 67 68 22 20 2d 20 6c 6f  op through" - lo
4000: 6f 70 20 66 6f 72 20 6e 65 78 74 20 74 65 73 74  op for next test
4010: 20 69 6e 20 71 75 65 75 65 0a 20 20 20 20 20 20   in queue.      
4020: 28 69 66 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 0a  (if (null? tal).
4030: 09 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 3b  .  (begin..    ;
4040: 3b 20 46 49 58 4d 45 21 21 21 21 20 54 48 49 53  ; FIXME!!!! THIS
4050: 20 53 48 4f 55 4c 44 20 4e 4f 54 20 52 45 51 55   SHOULD NOT REQU
4060: 49 52 45 20 41 4e 20 45 58 49 54 21 21 21 21 21  IRE AN EXIT!!!!!
4070: 21 21 0a 09 20 20 20 20 28 64 65 62 75 67 3a 70  !!..    (debug:p
4080: 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 41 6c  rint 1 "INFO: Al
4090: 6c 20 74 65 73 74 73 20 6c 61 75 6e 63 68 65 64  l tests launched
40a0: 22 29 0a 09 20 20 20 20 28 74 68 72 65 61 64 2d  ")..    (thread-
40b0: 73 6c 65 65 70 21 20 30 2e 35 29 0a 09 20 20 20  sleep! 0.5)..   
40c0: 20 3b 3b 20 46 49 58 4d 45 21 20 54 68 69 73 20   ;; FIXME! This 
40d0: 68 61 72 73 68 20 65 78 69 74 20 73 68 6f 75 6c  harsh exit shoul
40e0: 64 20 6e 6f 74 20 62 65 20 6e 65 63 65 73 73 61  d not be necessa
40f0: 72 79 2e 2e 2e 2e 0a 09 20 20 20 20 28 69 66 20  ry......    (if 
4100: 28 6e 6f 74 20 2a 72 75 6e 72 65 6d 6f 74 65 2a  (not *runremote*
4110: 29 28 65 78 69 74 29 29 20 3b 3b 20 0a 09 20 20  )(exit)) ;; ..  
4120: 20 20 23 66 29 20 3b 3b 20 72 65 74 75 72 6e 20    #f) ;; return 
4130: 61 20 23 66 20 61 73 20 61 20 68 69 6e 74 20 74  a #f as a hint t
4140: 68 61 74 20 77 65 20 61 72 65 20 64 6f 6e 65 0a  hat we are done.
4150: 09 20 20 3b 3b 20 48 65 72 65 20 77 65 20 6e 65  .  ;; Here we ne
4160: 65 64 20 74 6f 20 63 68 65 63 6b 20 74 68 61 74  ed to check that
4170: 20 61 6c 6c 20 74 68 65 20 74 65 73 74 73 20 72   all the tests r
4180: 65 6d 61 69 6e 69 6e 67 20 74 6f 20 62 65 20 72  emaining to be r
4190: 75 6e 20 61 72 65 20 65 6c 69 67 69 62 6c 65 20  un are eligible 
41a0: 74 6f 20 72 75 6e 0a 09 20 20 3b 3b 20 61 6e 64  to run..  ;; and
41b0: 20 61 72 65 20 6e 6f 74 20 62 6c 6f 63 6b 65 64   are not blocked
41c0: 20 62 79 20 66 61 69 6c 65 64 0a 09 20 20 28 6c   by failed..  (l
41d0: 65 74 20 28 28 6e 65 77 6c 73 74 20 28 74 65 73  et ((newlst (tes
41e0: 74 73 3a 66 69 6c 74 65 72 2d 6e 6f 6e 2d 72 75  ts:filter-non-ru
41f0: 6e 6e 61 62 6c 65 20 64 62 20 72 75 6e 2d 69 64  nnable db run-id
4200: 20 74 61 6c 20 74 65 73 74 2d 72 65 63 6f 72 64   tal test-record
4210: 73 29 29 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f 74  s))) ;; i.e. not
4220: 20 46 41 49 4c 2c 20 57 41 49 56 45 44 2c 20 49   FAIL, WAIVED, I
4230: 4e 43 4f 4d 50 4c 45 54 45 2c 20 50 41 53 53 2c  NCOMPLETE, PASS,
4240: 20 4b 49 4c 4c 45 44 2c 0a 09 20 20 20 20 28 74   KILLED,..    (t
4250: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 30 2e 35  hread-sleep! 0.5
4260: 29 0a 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20  )..    (if (not 
4270: 28 6e 75 6c 6c 3f 20 6e 65 77 6c 73 74 29 29 0a  (null? newlst)).
4280: 09 09 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77  ..(loop (car new
4290: 6c 73 74 29 28 63 64 72 20 6e 65 77 6c 73 74 29  lst)(cdr newlst)
42a0: 29 29 29 29 29 29 29 0a 0a 3b 3b 20 70 61 72 65  )))))))..;; pare
42b0: 6e 74 2d 74 65 73 74 20 69 73 20 74 68 65 72 65  nt-test is there
42c0: 20 61 73 20 61 20 70 6c 61 63 65 68 6f 6c 64 65   as a placeholde
42d0: 72 20 66 6f 72 20 77 68 65 6e 20 70 61 72 65 6e  r for when paren
42e0: 74 2d 74 65 73 74 73 20 63 61 6e 20 62 65 20 72  t-tests can be r
42f0: 75 6e 20 61 73 20 61 20 73 65 74 75 70 20 73 74  un as a setup st
4300: 65 70 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 3a  ep.(define (run:
4310: 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 72  test db run-id r
4320: 75 6e 6e 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74  unname keyvallst
4330: 20 74 65 73 74 2d 72 65 63 6f 72 64 20 66 6c 61   test-record fla
4340: 67 73 20 70 61 72 65 6e 74 2d 74 65 73 74 29 0a  gs parent-test).
4350: 20 20 3b 3b 20 41 6c 6c 20 74 68 65 73 65 20 76    ;; All these v
4360: 61 72 73 20 6d 69 67 68 74 20 62 65 20 72 65 66  ars might be ref
4370: 65 72 65 6e 63 65 64 20 62 79 20 74 68 65 20 74  erenced by the t
4380: 65 73 74 63 6f 6e 66 69 67 20 66 69 6c 65 20 72  estconfig file r
4390: 65 61 64 65 72 0a 20 20 28 6c 65 74 2a 20 28 28  eader.  (let* ((
43a0: 74 65 73 74 2d 6e 61 6d 65 20 20 20 20 28 74 65  test-name    (te
43b0: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65  sts:testqueue-ge
43c0: 74 2d 74 65 73 74 6e 61 6d 65 20 20 20 74 65 73  t-testname   tes
43d0: 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65  t-record)).. (te
43e0: 73 74 2d 77 61 69 74 6f 6e 73 20 28 74 65 73 74  st-waitons (test
43f0: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d  s:testqueue-get-
4400: 77 61 69 74 6f 6e 73 20 20 20 20 74 65 73 74 2d  waitons    test-
4410: 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65 73 74  record)).. (test
4420: 2d 63 6f 6e 66 20 20 20 20 28 74 65 73 74 73 3a  -conf    (tests:
4430: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65  testqueue-get-te
4440: 73 74 63 6f 6e 66 69 67 20 74 65 73 74 2d 72 65  stconfig test-re
4450: 63 6f 72 64 29 29 0a 09 20 28 69 74 65 6d 64 61  cord)).. (itemda
4460: 74 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 65  t      (tests:te
4470: 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d  stqueue-get-item
4480: 64 61 74 20 20 20 20 74 65 73 74 2d 72 65 63 6f  dat    test-reco
4490: 72 64 29 29 0a 09 20 28 74 65 73 74 2d 70 61 74  rd)).. (test-pat
44a0: 68 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f 70 70  h    (conc *topp
44b0: 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 20 74  ath* "/tests/" t
44c0: 65 73 74 2d 6e 61 6d 65 29 29 20 3b 3b 20 63 6f  est-name)) ;; co
44d0: 75 6c 64 20 75 73 65 20 74 65 73 74 73 3a 67 65  uld use tests:ge
44e0: 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 68 65 72  t-testconfig her
44f0: 65 20 2e 2e 2e 0a 09 20 28 66 6f 72 63 65 20 20  e ..... (force  
4500: 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c        (hash-tabl
4510: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c  e-ref/default fl
4520: 61 67 73 20 22 2d 66 6f 72 63 65 22 20 23 66 29  ags "-force" #f)
4530: 29 0a 09 20 28 72 65 72 75 6e 20 20 20 20 20 20  ).. (rerun      
4540: 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65    (hash-table-re
4550: 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20  f/default flags 
4560: 22 2d 72 65 72 75 6e 22 20 23 66 29 29 0a 09 20  "-rerun" #f)).. 
4570: 28 6b 65 65 70 67 6f 69 6e 67 20 20 20 20 28 68  (keepgoing    (h
4580: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65  ash-table-ref/de
4590: 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65  fault flags "-ke
45a0: 65 70 67 6f 69 6e 67 22 20 23 66 29 29 0a 09 20  epgoing" #f)).. 
45b0: 28 69 74 65 6d 2d 70 61 74 68 20 20 20 20 20 22  (item-path     "
45c0: 22 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70  ")).    (debug:p
45d0: 72 69 6e 74 20 35 0a 09 09 20 22 74 65 73 74 2d  rint 5... "test-
45e0: 63 6f 6e 66 69 67 3a 20 22 20 28 68 61 73 68 2d  config: " (hash-
45f0: 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65 73  table->alist tes
4600: 74 2d 63 6f 6e 66 29 0a 09 09 20 22 5c 6e 20 20  t-conf)... "\n  
4610: 20 69 74 65 6d 64 61 74 3a 20 22 20 69 74 65 6d   itemdat: " item
4620: 64 61 74 0a 09 09 20 29 0a 20 20 20 20 3b 3b 20  dat... ).    ;; 
4630: 73 65 74 74 69 6e 67 20 69 74 65 6d 64 61 74 20  setting itemdat 
4640: 74 6f 20 61 20 6c 69 73 74 20 69 66 20 69 74 20  to a list if it 
4650: 69 73 20 23 66 0a 20 20 20 20 28 69 66 20 28 6e  is #f.    (if (n
4660: 6f 74 20 69 74 65 6d 64 61 74 29 28 73 65 74 21  ot itemdat)(set!
4670: 20 69 74 65 6d 64 61 74 20 27 28 29 29 29 0a 20   itemdat '())). 
4680: 20 20 20 28 73 65 74 21 20 69 74 65 6d 2d 70 61     (set! item-pa
4690: 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70  th (item-list->p
46a0: 61 74 68 20 69 74 65 6d 64 61 74 29 29 0a 20 20  ath itemdat)).  
46b0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32    (debug:print 2
46c0: 20 22 41 74 74 65 6d 70 74 69 6e 67 20 74 6f 20   "Attempting to 
46d0: 6c 61 75 6e 63 68 20 74 65 73 74 20 22 20 74 65  launch test " te
46e0: 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d  st-name "/" item
46f0: 2d 70 61 74 68 29 0a 20 20 20 20 28 73 65 74 65  -path).    (sete
4700: 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d 45  nv "MT_TEST_NAME
4710: 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b 20  " test-name) ;; 
4720: 0a 20 20 20 20 28 73 65 74 65 6e 76 20 22 4d 54  .    (setenv "MT
4730: 5f 52 55 4e 4e 41 4d 45 22 20 20 20 72 75 6e 6e  _RUNNAME"   runn
4740: 61 6d 65 29 0a 20 20 20 20 28 73 65 74 2d 6d 65  ame).    (set-me
4750: 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20  gatest-env-vars 
4760: 64 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68  db run-id) ;; th
4770: 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65  ese may be neede
4780: 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69  d by the launchi
4790: 6e 67 20 70 72 6f 63 65 73 73 0a 20 20 20 20 28  ng process.    (
47a0: 63 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 79  change-directory
47b0: 20 2a 74 6f 70 70 61 74 68 2a 29 0a 0a 20 20 20   *toppath*)..   
47c0: 20 3b 3b 20 48 65 72 65 20 69 73 20 77 68 65 72   ;; Here is wher
47d0: 65 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61 20  e the test_meta 
47e0: 74 61 62 6c 65 20 69 73 20 62 65 73 74 20 75 70  table is best up
47f0: 64 61 74 65 64 0a 20 20 20 20 3b 3b 20 59 65 73  dated.    ;; Yes
4800: 2c 20 61 6e 6f 74 68 65 72 20 75 73 65 20 6f 66  , another use of
4810: 20 61 20 67 6c 6f 62 61 6c 20 66 6f 72 20 63 61   a global for ca
4820: 63 68 69 6e 67 2e 20 4e 65 65 64 20 61 20 62 65  ching. Need a be
4830: 74 74 65 72 20 77 61 79 3f 0a 20 20 20 20 28 69  tter way?.    (i
4840: 66 20 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 62  f (not (hash-tab
4850: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 2a  le-ref/default *
4860: 74 65 73 74 2d 6d 65 74 61 2d 75 70 64 61 74 65  test-meta-update
4870: 64 2a 20 74 65 73 74 2d 6e 61 6d 65 20 23 66 29  d* test-name #f)
4880: 29 0a 20 20 20 20 20 20 20 20 28 62 65 67 69 6e  ).        (begin
4890: 0a 09 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65  ..   (hash-table
48a0: 2d 73 65 74 21 20 2a 74 65 73 74 2d 6d 65 74 61  -set! *test-meta
48b0: 2d 75 70 64 61 74 65 64 2a 20 74 65 73 74 2d 6e  -updated* test-n
48c0: 61 6d 65 20 23 74 29 0a 20 20 20 20 20 20 20 20  ame #t).        
48d0: 20 20 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d     (runs:update-
48e0: 74 65 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73  test_meta db tes
48f0: 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66  t-name test-conf
4900: 29 29 29 0a 20 20 20 20 0a 20 20 20 20 3b 3b 20  ))).    .    ;; 
4910: 28 6c 61 6d 62 64 61 20 28 69 74 65 6d 64 61 74  (lambda (itemdat
4920: 29 20 3b 3b 3b 20 28 28 72 69 70 65 6e 65 73 73  ) ;;; ((ripeness
4930: 20 22 6f 76 65 72 72 69 70 65 22 29 20 28 74 65   "overripe") (te
4940: 6d 70 65 72 61 74 75 72 65 20 22 63 6f 6f 6c 22  mperature "cool"
4950: 29 20 28 73 65 61 73 6f 6e 20 22 73 75 6d 6d 65  ) (season "summe
4960: 72 22 29 29 0a 20 20 20 20 28 6c 65 74 2a 20 28  r")).    (let* (
4970: 28 6e 65 77 2d 74 65 73 74 2d 70 61 74 68 20 28  (new-test-path (
4980: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72  string-intersper
4990: 73 65 20 28 63 6f 6e 73 20 74 65 73 74 2d 70 61  se (cons test-pa
49a0: 74 68 20 28 6d 61 70 20 63 61 64 72 20 69 74 65  th (map cadr ite
49b0: 6d 64 61 74 29 29 20 22 2f 22 29 29 0a 09 20 20  mdat)) "/"))..  
49c0: 20 28 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20   (new-test-name 
49d0: 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65 6d  (if (equal? item
49e0: 2d 70 61 74 68 20 22 22 29 20 74 65 73 74 2d 6e  -path "") test-n
49f0: 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 2d 6e  ame (conc test-n
4a00: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74  ame "/" item-pat
4a10: 68 29 29 29 20 3b 3b 20 6a 75 73 74 20 6e 65 65  h))) ;; just nee
4a20: 64 20 69 74 20 74 6f 20 62 65 20 75 6e 69 71 75  d it to be uniqu
4a30: 65 0a 09 20 20 20 28 74 65 73 74 64 61 74 20 20  e..   (testdat  
4a40: 20 20 20 20 20 28 64 62 3a 67 65 74 2d 74 65 73       (db:get-tes
4a50: 74 2d 69 6e 66 6f 20 64 62 20 72 75 6e 2d 69 64  t-info db run-id
4a60: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d   test-name item-
4a70: 70 61 74 68 29 29 0a 09 20 20 20 28 74 65 73 74  path))..   (test
4a80: 2d 69 64 20 20 20 20 20 20 20 23 66 29 29 0a 20  -id       #f)). 
4a90: 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 74 65       (if (not te
4aa0: 73 74 64 61 74 29 0a 09 20 20 28 62 65 67 69 6e  stdat)..  (begin
4ab0: 0a 09 20 20 20 20 3b 3b 20 65 6e 73 75 72 65 20  ..    ;; ensure 
4ac0: 74 68 61 74 20 74 68 65 20 70 61 74 68 20 65 78  that the path ex
4ad0: 69 73 74 73 20 62 65 66 6f 72 65 20 72 65 67 69  ists before regi
4ae0: 73 74 65 72 69 6e 67 20 74 68 65 20 74 65 73 74  stering the test
4af0: 0a 09 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 43  ..    ;; NOPE: C
4b00: 61 6e 6e 6f 74 21 20 44 6f 6e 27 74 20 6b 6e 6f  annot! Don't kno
4b10: 77 20 79 65 74 20 77 68 69 63 68 20 64 69 73 6b  w yet which disk
4b20: 20 61 72 65 61 20 77 69 6c 6c 20 62 65 20 61 73   area will be as
4b30: 73 69 67 6e 65 64 2e 2e 2e 2e 0a 09 20 20 20 20  signed......    
4b40: 3b 3b 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63  ;; (system (conc
4b50: 20 22 6d 6b 64 69 72 20 2d 70 20 22 20 6e 65 77   "mkdir -p " new
4b60: 2d 74 65 73 74 2d 70 61 74 68 29 29 0a 09 20 20  -test-path))..  
4b70: 20 20 28 72 74 65 73 74 73 3a 72 65 67 69 73 74    (rtests:regist
4b80: 65 72 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69  er-test db run-i
4b90: 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d  d test-name item
4ba0: 2d 70 61 74 68 29 0a 09 20 20 20 20 28 73 65 74  -path)..    (set
4bb0: 21 20 74 65 73 74 64 61 74 20 28 64 62 3a 67 65  ! testdat (db:ge
4bc0: 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 20 72  t-test-info db r
4bd0: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20  un-id test-name 
4be0: 69 74 65 6d 2d 70 61 74 68 29 29 29 29 0a 20 20  item-path)))).  
4bf0: 20 20 20 20 28 73 65 74 21 20 74 65 73 74 2d 69      (set! test-i
4c00: 64 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  d (db:test-get-i
4c10: 64 20 74 65 73 74 64 61 74 29 29 0a 20 20 20 20  d testdat)).    
4c20: 20 20 28 63 68 61 6e 67 65 2d 64 69 72 65 63 74    (change-direct
4c30: 6f 72 79 20 74 65 73 74 2d 70 61 74 68 29 0a 20  ory test-path). 
4c40: 20 20 20 20 20 28 63 61 73 65 20 28 69 66 20 66       (case (if f
4c50: 6f 72 63 65 20 3b 3b 20 28 61 72 67 73 3a 67 65  orce ;; (args:ge
4c60: 74 2d 61 72 67 20 22 2d 66 6f 72 63 65 22 29 0a  t-arg "-force").
4c70: 09 09 27 4e 4f 54 5f 53 54 41 52 54 45 44 0a 09  ..'NOT_STARTED..
4c80: 09 28 69 66 20 74 65 73 74 64 61 74 0a 09 09 20  .(if testdat... 
4c90: 20 20 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62     (string->symb
4ca0: 6f 6c 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61  ol (test:get-sta
4cb0: 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 09 20  te testdat))... 
4cc0: 20 20 20 27 66 61 69 6c 65 64 2d 74 6f 2d 69 6e     'failed-to-in
4cd0: 73 65 72 74 29 29 0a 09 28 28 66 61 69 6c 65 64  sert))..((failed
4ce0: 2d 74 6f 2d 69 6e 73 65 72 74 29 0a 09 20 28 64  -to-insert).. (d
4cf0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
4d00: 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 69  ROR: Failed to i
4d10: 6e 73 65 72 74 20 74 68 65 20 72 65 63 6f 72 64  nsert the record
4d20: 20 69 6e 74 6f 20 74 68 65 20 64 62 22 29 29 0a   into the db")).
4d30: 09 28 28 4e 4f 54 5f 53 54 41 52 54 45 44 20 43  .((NOT_STARTED C
4d40: 4f 4d 50 4c 45 54 45 44 29 0a 09 20 28 64 65 62  OMPLETED).. (deb
4d50: 75 67 3a 70 72 69 6e 74 20 36 20 22 47 6f 74 20  ug:print 6 "Got 
4d60: 68 65 72 65 2c 20 22 20 28 74 65 73 74 3a 67 65  here, " (test:ge
4d70: 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29  t-state testdat)
4d80: 29 0a 09 20 28 6c 65 74 20 28 28 72 75 6e 66 6c  ).. (let ((runfl
4d90: 61 67 20 23 66 29 29 0a 09 20 20 20 28 63 6f 6e  ag #f))..   (con
4da0: 64 0a 09 20 20 20 20 3b 3b 20 2d 66 6f 72 63 65  d..    ;; -force
4db0: 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20  , run no matter 
4dc0: 77 68 61 74 0a 09 20 20 20 20 28 66 6f 72 63 65  what..    (force
4dd0: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23   (set! runflag #
4de0: 74 29 29 0a 09 20 20 20 20 3b 3b 20 4e 4f 54 5f  t))..    ;; NOT_
4df0: 53 54 41 52 54 45 44 2c 20 72 75 6e 20 6e 6f 20  STARTED, run no 
4e00: 6d 61 74 74 65 72 20 77 68 61 74 0a 09 20 20 20  matter what..   
4e10: 20 28 28 65 71 75 61 6c 3f 20 28 74 65 73 74 3a   ((equal? (test:
4e20: 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61  get-state testda
4e30: 74 29 20 22 4e 4f 54 5f 53 54 41 52 54 45 44 22  t) "NOT_STARTED"
4e40: 29 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23  )(set! runflag #
4e50: 74 29 29 0a 09 20 20 20 20 3b 3b 20 6e 6f 74 20  t))..    ;; not 
4e60: 2d 72 65 72 75 6e 20 61 6e 64 20 50 41 53 53 2c  -rerun and PASS,
4e70: 20 57 41 52 4e 20 6f 72 20 43 48 45 43 4b 2c 20   WARN or CHECK, 
4e80: 64 6f 20 6e 6f 20 72 75 6e 0a 09 20 20 20 20 28  do no run..    (
4e90: 28 61 6e 64 20 28 6f 72 20 28 6e 6f 74 20 72 65  (and (or (not re
4ea0: 72 75 6e 29 0a 09 09 20 20 20 20 20 20 6b 65 65  run)...      kee
4eb0: 70 67 6f 69 6e 67 29 0a 09 09 20 20 3b 3b 20 52  pgoing)...  ;; R
4ec0: 65 71 75 69 72 65 20 74 6f 20 66 6f 72 63 65 20  equire to force 
4ed0: 72 65 2d 72 75 6e 20 66 6f 72 20 43 4f 4d 50 4c  re-run for COMPL
4ee0: 45 54 45 44 20 6f 72 20 2a 61 6e 79 74 68 69 6e  ETED or *anythin
4ef0: 67 2a 20 2b 20 50 41 53 53 2c 57 41 52 4e 20 6f  g* + PASS,WARN o
4f00: 72 20 43 48 45 43 4b 0a 09 09 20 20 28 6f 72 20  r CHECK...  (or 
4f10: 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65  (member (test:ge
4f20: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74  t-status testdat
4f30: 29 20 27 28 22 50 41 53 53 22 20 22 57 41 52 4e  ) '("PASS" "WARN
4f40: 22 20 22 43 48 45 43 4b 22 29 29 0a 09 09 20 20  " "CHECK"))...  
4f50: 20 20 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73      (member (tes
4f60: 74 3a 67 65 74 2d 73 74 61 74 65 20 20 74 65 73  t:get-state  tes
4f70: 74 64 61 74 29 20 27 28 22 43 4f 4d 50 4c 45 54  tdat) '("COMPLET
4f80: 45 44 22 29 29 29 29 20 0a 09 20 20 20 20 20 28  ED")))) ..     (
4f90: 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 49  debug:print 2 "I
4fa0: 4e 46 4f 3a 20 72 75 6e 6e 69 6e 67 20 74 65 73  NFO: running tes
4fb0: 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f  t " test-name "/
4fc0: 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20 73 75  " item-path " su
4fd0: 70 70 72 65 73 73 65 64 20 61 73 20 69 74 20 69  ppressed as it i
4fe0: 73 20 43 4f 4d 50 4c 45 54 45 44 20 61 6e 64 20  s COMPLETED and 
4ff0: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  " (test:get-stat
5000: 65 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20  e testdat))..   
5010: 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20    (set! runflag 
5020: 23 66 29 29 0a 09 20 20 20 20 3b 3b 20 2d 72 65  #f))..    ;; -re
5030: 72 75 6e 20 61 6e 64 20 73 74 61 74 75 73 20 69  run and status i
5040: 73 20 6f 6e 65 20 6f 66 20 74 68 65 20 73 70 65  s one of the spe
5050: 63 69 66 65 64 2c 20 72 75 6e 20 69 74 0a 09 20  cifed, run it.. 
5060: 20 20 20 28 28 61 6e 64 20 72 65 72 75 6e 0a 09     ((and rerun..
5070: 09 20 20 28 6c 65 74 2a 20 28 28 72 65 72 75 6e  .  (let* ((rerun
5080: 6c 73 74 20 20 20 28 73 74 72 69 6e 67 2d 73 70  lst   (string-sp
5090: 6c 69 74 20 72 65 72 75 6e 20 22 2c 22 29 29 0a  lit rerun ",")).
50a0: 09 09 09 20 28 6d 75 73 74 2d 72 65 72 75 6e 20  ... (must-rerun 
50b0: 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65  (member (test:ge
50c0: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74  t-status testdat
50d0: 29 20 72 65 72 75 6e 6c 73 74 29 29 29 0a 09 09  ) rerunlst)))...
50e0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
50f0: 20 33 20 22 49 4e 46 4f 3a 20 2d 72 65 72 75 6e   3 "INFO: -rerun
5100: 20 6c 69 73 74 3a 20 22 20 72 65 72 75 6e 20 22   list: " rerun "
5110: 2c 20 74 65 73 74 2d 73 74 61 74 75 73 3a 20 22  , test-status: "
5120: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75   (test:get-statu
5130: 73 20 74 65 73 74 64 61 74 29 22 2c 20 6d 75 73  s testdat)", mus
5140: 74 2d 72 65 72 75 6e 3a 20 22 20 6d 75 73 74 2d  t-rerun: " must-
5150: 72 65 72 75 6e 29 0a 09 09 20 20 20 20 6d 75 73  rerun)...    mus
5160: 74 2d 72 65 72 75 6e 29 29 0a 09 20 20 20 20 20  t-rerun))..     
5170: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22  (debug:print 2 "
5180: 49 4e 46 4f 3a 20 52 65 72 75 6e 20 66 6f 72 63  INFO: Rerun forc
5190: 65 64 20 66 6f 72 20 74 65 73 74 20 22 20 74 65  ed for test " te
51a0: 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d  st-name "/" item
51b0: 2d 70 61 74 68 29 0a 09 20 20 20 20 20 28 73 65  -path)..     (se
51c0: 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a  t! runflag #t)).
51d0: 09 20 20 20 20 3b 3b 20 2d 6b 65 65 70 67 6f 69  .    ;; -keepgoi
51e0: 6e 67 2c 20 64 6f 20 6e 6f 74 20 72 65 72 75 6e  ng, do not rerun
51f0: 20 46 41 49 4c 0a 09 20 20 20 20 28 28 61 6e 64   FAIL..    ((and
5200: 20 6b 65 65 70 67 6f 69 6e 67 0a 09 09 20 20 28   keepgoing...  (
5210: 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74  member (test:get
5220: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29  -status testdat)
5230: 20 27 28 22 46 41 49 4c 22 29 29 29 0a 09 20 20   '("FAIL")))..  
5240: 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67     (set! runflag
5250: 20 23 66 29 29 0a 09 20 20 20 20 28 28 61 6e 64   #f))..    ((and
5260: 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09 20   (not rerun)... 
5270: 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67   (member (test:g
5280: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61  et-status testda
5290: 74 29 20 27 28 22 46 41 49 4c 22 20 22 6e 2f 61  t) '("FAIL" "n/a
52a0: 22 29 29 29 0a 09 20 20 20 20 20 28 73 65 74 21  ")))..     (set!
52b0: 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20   runflag #t)).. 
52c0: 20 20 20 28 65 6c 73 65 20 28 73 65 74 21 20 72     (else (set! r
52d0: 75 6e 66 6c 61 67 20 23 66 29 29 29 0a 09 20 20  unflag #f)))..  
52e0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 36 20   (debug:print 6 
52f0: 22 52 55 4e 4e 49 4e 47 20 3d 3e 20 72 75 6e 66  "RUNNING => runf
5300: 6c 61 67 3a 20 22 20 72 75 6e 66 6c 61 67 20 22  lag: " runflag "
5310: 20 53 54 41 54 45 3a 20 22 20 28 74 65 73 74 3a   STATE: " (test:
5320: 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61  get-state testda
5330: 74 29 20 22 20 53 54 41 54 55 53 3a 20 22 20 28  t) " STATUS: " (
5340: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20  test:get-status 
5350: 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 28 69  testdat))..   (i
5360: 66 20 28 6e 6f 74 20 72 75 6e 66 6c 61 67 29 0a  f (not runflag).
5370: 09 20 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74  .       (if (not
5380: 20 70 61 72 65 6e 74 2d 74 65 73 74 29 0a 09 09   parent-test)...
5390: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
53a0: 31 20 22 4e 4f 54 45 3a 20 4e 6f 74 20 73 74 61  1 "NOTE: Not sta
53b0: 72 74 69 6e 67 20 74 65 73 74 20 22 20 6e 65 77  rting test " new
53c0: 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 73 20  -test-name " as 
53d0: 69 74 20 69 73 20 73 74 61 74 65 20 5c 22 22 20  it is state \"" 
53e0: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20  (test:get-state 
53f0: 74 65 73 74 64 61 74 29 20 0a 09 09 09 09 22 5c  testdat) ....."\
5400: 22 20 61 6e 64 20 73 74 61 74 75 73 20 5c 22 22  " and status \""
5410: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75   (test:get-statu
5420: 73 20 74 65 73 74 64 61 74 29 20 22 5c 22 2c 20  s testdat) "\", 
5430: 75 73 65 20 2d 72 65 72 75 6e 20 5c 22 22 20 28  use -rerun \"" (
5440: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20  test:get-status 
5450: 74 65 73 74 64 61 74 29 0a 20 20 20 20 20 20 20  testdat).       
5460: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
5470: 20 20 20 20 20 20 20 20 20 22 5c 22 20 6f 72 20           "\" or 
5480: 2d 66 6f 72 63 65 20 74 6f 20 6f 76 65 72 72 69  -force to overri
5490: 64 65 22 29 29 0a 09 20 20 20 20 20 20 20 3b 3b  de"))..       ;;
54a0: 20 4e 4f 54 45 3a 20 4e 6f 20 6c 6f 6e 67 65 72   NOTE: No longer
54b0: 20 62 65 20 63 68 65 63 6b 69 6e 67 20 70 72 65   be checking pre
54c0: 72 65 71 75 69 73 69 74 65 73 20 68 65 72 65 21  requisites here!
54d0: 20 57 69 6c 6c 20 6e 65 76 65 72 20 67 65 74 20   Will never get 
54e0: 68 65 72 65 20 75 6e 6c 65 73 73 20 70 72 65 72  here unless prer
54f0: 65 71 73 20 61 72 65 0a 09 20 20 20 20 20 20 20  eqs are..       
5500: 3b 3b 20 20 20 20 20 20 20 61 6c 72 65 61 64 79  ;;       already
5510: 20 6d 65 74 2e 0a 09 20 20 20 20 20 20 20 28 69   met...       (i
5520: 66 20 28 6e 6f 74 20 28 6c 61 75 6e 63 68 2d 74  f (not (launch-t
5530: 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 72 75  est db run-id ru
5540: 6e 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 20  nname test-conf 
5550: 6b 65 79 76 61 6c 6c 73 74 20 74 65 73 74 2d 6e  keyvallst test-n
5560: 61 6d 65 20 74 65 73 74 2d 70 61 74 68 20 69 74  ame test-path it
5570: 65 6d 64 61 74 20 66 6c 61 67 73 29 29 0a 09 09  emdat flags))...
5580: 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20     (begin...    
5590: 20 28 70 72 69 6e 74 20 22 45 52 52 4f 52 3a 20   (print "ERROR: 
55a0: 46 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68  Failed to launch
55b0: 20 74 68 65 20 74 65 73 74 2e 20 45 78 69 74 69   the test. Exiti
55c0: 6e 67 20 61 73 20 73 6f 6f 6e 20 61 73 20 70 6f  ng as soon as po
55d0: 73 73 69 62 6c 65 22 29 0a 09 09 20 20 20 20 20  ssible")...     
55e0: 28 73 65 74 21 20 2a 67 6c 6f 62 61 6c 65 78 69  (set! *globalexi
55f0: 74 73 74 61 74 75 73 2a 20 31 29 20 3b 3b 20 0a  tstatus* 1) ;; .
5600: 09 09 20 20 20 20 20 28 70 72 6f 63 65 73 73 2d  ..     (process-
5610: 73 69 67 6e 61 6c 20 28 63 75 72 72 65 6e 74 2d  signal (current-
5620: 70 72 6f 63 65 73 73 2d 69 64 29 20 73 69 67 6e  process-id) sign
5630: 61 6c 2f 6b 69 6c 6c 29 29 29 29 29 29 0a 09 28  al/kill))))))..(
5640: 28 4b 49 4c 4c 45 44 29 20 0a 09 20 28 64 65 62  (KILLED) .. (deb
5650: 75 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 45  ug:print 1 "NOTE
5660: 3a 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d  : " new-test-nam
5670: 65 20 22 20 69 73 20 61 6c 72 65 61 64 79 20 72  e " is already r
5680: 75 6e 6e 69 6e 67 20 6f 72 20 77 61 73 20 65 78  unning or was ex
5690: 70 6c 69 63 74 6c 79 20 6b 69 6c 6c 65 64 2c 20  plictly killed, 
56a0: 75 73 65 20 2d 66 6f 72 63 65 20 74 6f 20 6c 61  use -force to la
56b0: 75 6e 63 68 20 69 74 2e 22 29 29 0a 09 28 28 4c  unch it."))..((L
56c0: 41 55 4e 43 48 45 44 20 52 45 4d 4f 54 45 48 4f  AUNCHED REMOTEHO
56d0: 53 54 53 54 41 52 54 20 52 55 4e 4e 49 4e 47 29  STSTART RUNNING)
56e0: 20 20 0a 09 20 28 69 66 20 28 3e 20 28 2d 20 28    .. (if (> (- (
56f0: 63 75 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73 29  current-seconds)
5700: 28 2b 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  (+ (db:test-get-
5710: 65 76 65 6e 74 5f 74 69 6d 65 20 74 65 73 74 64  event_time testd
5720: 61 74 29 0a 09 09 09 09 20 20 20 20 20 20 20 28  at).....       (
5730: 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 5f  db:test-get-run_
5740: 64 75 72 61 74 69 6f 6e 20 74 65 73 74 64 61 74  duration testdat
5750: 29 29 29 0a 09 09 36 30 30 29 20 3b 3b 20 69 2e  )))...600) ;; i.
5760: 65 2e 20 6e 6f 20 75 70 64 61 74 65 20 66 6f 72  e. no update for
5770: 20 6d 6f 72 65 20 74 68 61 6e 20 36 30 30 20 73   more than 600 s
5780: 65 63 6f 6e 64 73 0a 09 20 20 20 20 20 28 62 65  econds..     (be
5790: 67 69 6e 0a 09 20 20 20 20 20 20 20 28 64 65 62  gin..       (deb
57a0: 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e  ug:print 0 "WARN
57b0: 49 4e 47 3a 20 54 65 73 74 20 22 20 74 65 73 74  ING: Test " test
57c0: 2d 6e 61 6d 65 20 22 20 61 70 70 65 61 72 73 20  -name " appears 
57d0: 74 6f 20 62 65 20 64 65 61 64 2e 20 46 6f 72 63  to be dead. Forc
57e0: 69 6e 67 20 69 74 20 74 6f 20 73 74 61 74 65 20  ing it to state 
57f0: 49 4e 43 4f 4d 50 4c 45 54 45 20 61 6e 64 20 73  INCOMPLETE and s
5800: 74 61 74 75 73 20 53 54 55 43 4b 2f 44 45 41 44  tatus STUCK/DEAD
5810: 22 29 0a 09 20 20 20 20 20 20 20 28 74 65 73 74  ")..       (test
5820: 2d 73 65 74 2d 73 74 61 74 75 73 21 20 64 62 20  -set-status! db 
5830: 74 65 73 74 2d 69 64 20 22 49 4e 43 4f 4d 50 4c  test-id "INCOMPL
5840: 45 54 45 22 20 22 53 54 55 43 4b 2f 44 45 41 44  ETE" "STUCK/DEAD
5850: 22 20 22 54 65 73 74 20 69 73 20 73 74 75 63 6b  " "Test is stuck
5860: 20 6f 72 20 64 65 61 64 22 20 23 66 29 29 0a 09   or dead" #f))..
5870: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
5880: 74 20 32 20 22 4e 4f 54 45 3a 20 22 20 74 65 73  t 2 "NOTE: " tes
5890: 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72 65  t-name " is alre
58a0: 61 64 79 20 72 75 6e 6e 69 6e 67 22 29 29 29 0a  ady running"))).
58b0: 09 28 65 6c 73 65 20 20 20 20 20 20 20 28 64 65  .(else       (de
58c0: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52  bug:print 0 "ERR
58d0: 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c 61  OR: Failed to la
58e0: 75 6e 63 68 20 74 65 73 74 20 22 20 6e 65 77 2d  unch test " new-
58f0: 74 65 73 74 2d 6e 61 6d 65 20 22 2e 20 55 6e 72  test-name ". Unr
5900: 65 63 6f 67 6e 69 73 65 64 20 73 74 61 74 65 20  ecognised state 
5910: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  " (test:get-stat
5920: 65 20 74 65 73 74 64 61 74 29 29 29 29 29 29 29  e testdat)))))))
5930: 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ..;;============
5940: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5950: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5960: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5970: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 45 4e  ==========.;; EN
5980: 44 20 4f 46 20 4e 45 57 20 53 54 55 46 46 0a 3b  D OF NEW STUFF.;
5990: 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;===============
59a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
59b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
59c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
59d0: 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65  =======..(define
59e0: 20 28 67 65 74 2d 64 69 72 2d 75 70 2d 6e 20 64   (get-dir-up-n d
59f0: 69 72 20 2e 20 70 61 72 61 6d 73 29 20 0a 20 20  ir . params) .  
5a00: 28 6c 65 74 20 28 28 64 70 61 72 74 73 20 20 28  (let ((dparts  (
5a10: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 64 69 72  string-split dir
5a20: 20 22 2f 22 29 29 0a 09 28 63 6f 75 6e 74 20 20   "/"))..(count  
5a30: 20 28 69 66 20 28 6e 75 6c 6c 3f 20 70 61 72 61   (if (null? para
5a40: 6d 73 29 20 31 20 28 63 61 72 20 70 61 72 61 6d  ms) 1 (car param
5a50: 73 29 29 29 29 0a 20 20 20 20 28 63 6f 6e 63 20  s)))).    (conc 
5a60: 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 65  "/" (string-inte
5a70: 72 73 70 65 72 73 65 20 0a 09 20 20 20 20 20 20  rsperse ..      
5a80: 20 28 74 61 6b 65 20 64 70 61 72 74 73 20 28 2d   (take dparts (-
5a90: 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73 29   (length dparts)
5aa0: 20 63 6f 75 6e 74 29 29 0a 09 20 20 20 20 20 20   count))..      
5ab0: 20 22 2f 22 29 29 29 29 0a 3b 3b 20 52 65 6d 6f   "/")))).;; Remo
5ac0: 76 65 20 72 75 6e 73 0a 3b 3b 20 66 69 65 6c 64  ve runs.;; field
5ad0: 73 20 61 72 65 20 70 61 73 73 69 6e 67 20 69 6e  s are passing in
5ae0: 20 74 68 72 6f 75 67 68 20 0a 28 64 65 66 69 6e   through .(defin
5af0: 65 20 28 72 75 6e 73 3a 72 65 6d 6f 76 65 2d 72  e (runs:remove-r
5b00: 75 6e 73 20 64 62 20 72 75 6e 6e 61 6d 65 70 61  uns db runnamepa
5b10: 74 74 20 74 65 73 74 70 61 74 74 20 69 74 65 6d  tt testpatt item
5b20: 70 61 74 74 20 23 21 6b 65 79 20 28 73 74 61 74  patt #!key (stat
5b30: 65 20 23 66 29 28 73 74 61 74 75 73 20 23 66 29  e #f)(status #f)
5b40: 29 0a 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73  ).  (let* ((keys
5b50: 20 20 20 20 20 20 20 20 28 72 64 62 3a 67 65 74          (rdb:get
5b60: 2d 6b 65 79 73 20 64 62 29 29 0a 09 20 28 72 75  -keys db)).. (ru
5b70: 6e 64 61 74 20 20 20 20 20 20 28 72 75 6e 73 3a  ndat      (runs:
5b80: 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74 74  get-runs-by-patt
5b90: 20 64 62 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65   db keys runname
5ba0: 70 61 74 74 29 29 0a 09 20 28 68 65 61 64 65 72  patt)).. (header
5bb0: 20 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65        (vector-re
5bc0: 66 20 72 75 6e 64 61 74 20 30 29 29 0a 09 20 28  f rundat 0)).. (
5bd0: 72 75 6e 73 20 20 20 20 20 20 20 20 28 76 65 63  runs        (vec
5be0: 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 31  tor-ref rundat 1
5bf0: 29 29 0a 09 20 28 73 74 61 74 65 73 20 20 20 20  )).. (states    
5c00: 20 20 28 69 66 20 73 74 61 74 65 20 20 28 73 74    (if state  (st
5c10: 72 69 6e 67 2d 73 70 6c 69 74 20 73 74 61 74 65  ring-split state
5c20: 20 20 22 2c 22 29 20 27 28 29 29 29 0a 09 20 28    ",") '())).. (
5c30: 73 74 61 74 75 73 65 73 20 20 20 20 28 69 66 20  statuses    (if 
5c40: 73 74 61 74 75 73 20 28 73 74 72 69 6e 67 2d 73  status (string-s
5c50: 70 6c 69 74 20 73 74 61 74 75 73 20 22 2c 22 29  plit status ",")
5c60: 20 27 28 29 29 29 29 0a 20 20 20 20 28 64 65 62   '()))).    (deb
5c70: 75 67 3a 70 72 69 6e 74 20 31 20 22 48 65 61 64  ug:print 1 "Head
5c80: 65 72 3a 20 22 20 68 65 61 64 65 72 29 0a 20 20  er: " header).  
5c90: 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 20    (for-each.    
5ca0: 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a 20   (lambda (run). 
5cb0: 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 75 6e        (let ((run
5cc0: 6b 65 79 20 28 73 74 72 69 6e 67 2d 69 6e 74 65  key (string-inte
5cd0: 72 73 70 65 72 73 65 20 28 6d 61 70 20 28 6c 61  rsperse (map (la
5ce0: 6d 62 64 61 20 28 6b 29 0a 09 09 09 09 09 09 28  mbda (k).......(
5cf0: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d  db:get-value-by-
5d00: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65  header run heade
5d10: 72 20 28 76 65 63 74 6f 72 2d 72 65 66 20 6b 20  r (vector-ref k 
5d20: 30 29 29 29 20 6b 65 79 73 29 20 22 2f 22 29 29  0))) keys) "/"))
5d30: 0a 09 20 20 20 20 20 28 64 69 72 73 2d 74 6f 2d  ..     (dirs-to-
5d40: 72 65 6d 6f 76 65 20 28 6d 61 6b 65 2d 68 61 73  remove (make-has
5d50: 68 2d 74 61 62 6c 65 29 29 29 0a 09 20 28 6c 65  h-table))).. (le
5d60: 74 2a 20 28 28 72 75 6e 2d 69 64 20 28 64 62 3a  t* ((run-id (db:
5d70: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61  get-value-by-hea
5d80: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22  der run header "
5d90: 69 64 22 29 20 29 0a 09 09 3b 3b 20 6e 6f 74 2d  id") )...;; not-
5da0: 69 6e 3a 20 73 77 69 74 63 68 65 73 20 66 72 6f  in: switches fro
5db0: 6d 20 74 68 65 20 64 65 66 61 75 6c 74 20 67 65  m the default ge
5dc0: 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20  t-tests-for-run 
5dd0: 62 65 68 61 76 69 6f 72 20 74 6f 20 72 65 71 75  behavior to requ
5de0: 69 72 65 20 61 20 6d 61 74 63 68 0a 09 09 28 74  ire a match...(t
5df0: 65 73 74 73 20 20 28 72 64 62 3a 67 65 74 2d 74  ests  (rdb:get-t
5e00: 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20  ests-for-run db 
5e10: 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79  (db:get-value-by
5e20: 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64  -header run head
5e30: 65 72 20 22 69 64 22 29 20 74 65 73 74 70 61 74  er "id") testpat
5e40: 74 20 69 74 65 6d 70 61 74 74 20 73 74 61 74 65  t itempatt state
5e50: 73 20 73 74 61 74 75 73 65 73 20 6e 6f 74 2d 69  s statuses not-i
5e60: 6e 3a 20 23 66 29 29 0a 09 09 28 6c 61 73 74 74  n: #f))...(lastt
5e70: 70 61 74 68 20 22 2f 64 6f 65 73 2f 6e 6f 74 2f  path "/does/not/
5e80: 65 78 69 73 74 2f 49 2f 68 6f 70 65 22 29 29 0a  exist/I/hope")).
5e90: 0a 09 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e  ..   (if (not (n
5ea0: 75 6c 6c 3f 20 74 65 73 74 73 29 29 0a 09 20 20  ull? tests))..  
5eb0: 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 28       (begin... (
5ec0: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52  debug:print 1 "R
5ed0: 65 6d 6f 76 69 6e 67 20 74 65 73 74 73 20 66 6f  emoving tests fo
5ee0: 72 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20  r run: " runkey 
5ef0: 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75  " " (db:get-valu
5f00: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20  e-by-header run 
5f10: 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22  header "runname"
5f20: 29 29 0a 09 09 20 28 66 6f 72 2d 65 61 63 68 0a  ))... (for-each.
5f30: 09 09 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73  ..  (lambda (tes
5f40: 74 29 0a 09 09 20 20 20 20 28 6c 65 74 2a 20 28  t)...    (let* (
5f50: 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74  (item-path (db:t
5f60: 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74  est-get-item-pat
5f70: 68 20 74 65 73 74 29 29 0a 09 09 09 20 20 20 28  h test))....   (
5f80: 74 65 73 74 2d 6e 61 6d 65 20 28 64 62 3a 74 65  test-name (db:te
5f90: 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20  st-get-testname 
5fa0: 74 65 73 74 29 29 0a 09 09 09 20 20 20 28 72 75  test))....   (ru
5fb0: 6e 2d 64 69 72 20 20 20 28 64 62 3a 74 65 73 74  n-dir   (db:test
5fc0: 2d 67 65 74 2d 72 75 6e 64 69 72 20 74 65 73 74  -get-rundir test
5fd0: 29 29 29 0a 09 09 20 20 20 20 20 20 28 64 65 62  )))...      (deb
5fe0: 75 67 3a 70 72 69 6e 74 20 31 20 22 20 20 22 20  ug:print 1 "  " 
5ff0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73  (db:test-get-tes
6000: 74 6e 61 6d 65 20 74 65 73 74 29 20 22 20 69 64  tname test) " id
6010: 3a 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74  : " (db:test-get
6020: 2d 69 64 20 74 65 73 74 29 20 22 20 22 20 69 74  -id test) " " it
6030: 65 6d 2d 70 61 74 68 29 0a 09 09 20 20 20 20 20  em-path)...     
6040: 20 28 72 64 62 3a 64 65 6c 65 74 65 2d 74 65 73   (rdb:delete-tes
6050: 74 2d 72 65 63 6f 72 64 73 20 64 62 20 28 64 62  t-records db (db
6060: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73  :test-get-id tes
6070: 74 29 29 0a 09 09 20 20 20 20 20 20 28 69 66 20  t))...      (if 
6080: 28 3e 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74  (> (string-lengt
6090: 68 20 72 75 6e 2d 64 69 72 29 20 35 29 20 3b 3b  h run-dir) 5) ;;
60a0: 20 62 61 64 20 68 65 75 72 69 73 74 69 63 20 62   bad heuristic b
60b0: 75 74 20 73 68 6f 75 6c 64 20 70 72 65 76 65 6e  ut should preven
60c0: 74 20 2f 74 6d 70 20 2f 68 6f 6d 65 20 65 74 63  t /tmp /home etc
60d0: 2e 0a 09 09 09 20 20 28 6c 65 74 20 28 28 66 75  .....  (let ((fu
60e0: 6c 6c 70 61 74 68 20 72 75 6e 2d 64 69 72 29 29  llpath run-dir))
60f0: 20 3b 3b 20 22 2f 22 20 28 64 62 3a 74 65 73 74   ;; "/" (db:test
6100: 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74  -get-item-path t
6110: 65 73 74 29 29 29 29 0a 09 09 09 20 20 20 20 28  est))))....    (
6120: 73 65 74 21 20 6c 61 73 74 74 70 61 74 68 20 66  set! lasttpath f
6130: 75 6c 6c 70 61 74 68 29 0a 09 09 09 20 20 20 20  ullpath)....    
6140: 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21  (hash-table-set!
6150: 20 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20   dirs-to-remove 
6160: 66 75 6c 6c 70 61 74 68 20 23 74 29 0a 09 09 09  fullpath #t)....
6170: 20 20 20 20 3b 3b 20 54 68 65 20 66 6f 6c 6c 6f      ;; The follo
6180: 77 69 6e 67 20 77 61 73 20 74 68 65 20 73 61 66  wing was the saf
6190: 65 20 64 65 6c 65 74 65 20 63 6f 64 65 20 62 75  e delete code bu
61a0: 74 20 69 74 20 77 61 73 20 6e 6f 74 20 62 65 69  t it was not bei
61b0: 6e 67 20 65 78 65 63 74 75 74 65 64 2e 0a 09 09  ng exectuted....
61c0: 09 20 20 20 20 3b 3b 20 28 6c 65 74 2a 20 28 28  .    ;; (let* ((
61d0: 64 69 72 73 2d 63 6f 75 6e 74 20 28 2b 20 31 20  dirs-count (+ 1 
61e0: 28 6c 65 6e 67 74 68 20 6b 65 79 73 29 28 6c 65  (length keys)(le
61f0: 6e 67 74 68 20 28 73 74 72 69 6e 67 2d 73 70 6c  ngth (string-spl
6200: 69 74 20 69 74 65 6d 2d 70 61 74 68 20 22 2f 22  it item-path "/"
6210: 29 29 29 29 0a 09 09 09 20 20 20 20 3b 3b 20 20  ))))....    ;;  
6220: 20 20 20 20 20 20 28 64 69 72 2d 74 6f 2d 72 65        (dir-to-re
6230: 6d 20 28 67 65 74 2d 64 69 72 2d 75 70 2d 6e 20  m (get-dir-up-n 
6240: 66 75 6c 6c 70 61 74 68 20 64 69 72 73 2d 63 6f  fullpath dirs-co
6250: 75 6e 74 29 29 0a 09 09 09 20 20 20 20 3b 3b 20  unt))....    ;; 
6260: 20 20 20 20 20 20 20 28 72 65 6d 61 69 6e 69 6e         (remainin
6270: 67 64 20 28 73 74 72 69 6e 67 2d 73 75 62 73 74  gd (string-subst
6280: 69 74 75 74 65 20 28 72 65 67 65 78 70 20 28 63  itute (regexp (c
6290: 6f 6e 63 20 22 5e 22 20 64 69 72 2d 74 6f 2d 72  onc "^" dir-to-r
62a0: 65 6d 20 22 2f 22 29 29 20 22 22 20 66 75 6c 6c  em "/")) "" full
62b0: 70 61 74 68 29 29 0a 09 09 09 20 20 20 20 3b 3b  path))....    ;;
62c0: 20 20 20 20 20 20 20 20 28 63 6d 64 20 28 63 6f          (cmd (co
62d0: 6e 63 20 22 63 64 20 22 20 64 69 72 2d 74 6f 2d  nc "cd " dir-to-
62e0: 72 65 6d 20 22 3b 20 72 6d 64 69 72 20 2d 70 20  rem "; rmdir -p 
62f0: 22 20 72 65 6d 61 69 6e 69 6e 67 64 20 29 29 29  " remainingd )))
6300: 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 28 69 66  ....    ;;   (if
6310: 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 66   (file-exists? f
6320: 75 6c 6c 70 61 74 68 29 0a 09 09 09 20 20 20 20  ullpath)....    
6330: 3b 3b 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a  ;;       (begin.
6340: 09 09 09 20 20 20 20 3b 3b 20 20 20 20 20 20 20  ...    ;;       
6350: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31    (debug:print 1
6360: 20 63 6d 64 29 0a 09 09 09 20 20 20 20 3b 3b 20   cmd)....    ;; 
6370: 20 20 20 20 20 20 20 20 28 73 79 73 74 65 6d 20          (system 
6380: 63 6d 64 29 29 29 0a 09 09 09 20 20 20 20 3b 3b  cmd)))....    ;;
6390: 20 20 20 29 29 0a 09 09 09 20 20 20 20 29 29 29     ))....    )))
63a0: 29 0a 09 09 20 20 20 20 74 65 73 74 73 29 29 29  )...    tests)))
63b0: 0a 0a 09 20 20 20 3b 3b 20 6c 6f 6f 6b 20 74 68  ...   ;; look th
63c0: 6f 75 67 68 20 74 68 65 20 64 69 72 73 2d 74 6f  ough the dirs-to
63d0: 2d 72 65 6d 6f 76 65 20 66 6f 72 20 63 61 6e 64  -remove for cand
63e0: 69 64 61 74 65 73 20 66 6f 72 20 72 65 6d 6f 76  idates for remov
63f0: 61 6c 2e 20 44 6f 20 74 68 69 73 20 61 66 74 65  al. Do this afte
6400: 72 20 64 65 6c 65 74 69 6e 67 20 74 68 65 20 72  r deleting the r
6410: 65 63 6f 72 64 73 0a 09 20 20 20 3b 3b 20 66 6f  ecords..   ;; fo
6420: 72 20 65 61 63 68 20 74 65 73 74 20 69 6e 20 63  r each test in c
6430: 61 73 65 20 77 65 20 67 65 74 20 6b 69 6c 6c 65  ase we get kille
6440: 64 2e 20 54 68 61 74 20 73 68 6f 75 6c 64 20 6d  d. That should m
6450: 69 6e 69 6d 69 7a 65 20 74 68 65 20 64 65 74 72  inimize the detr
6460: 69 74 75 73 20 6c 65 66 74 20 6f 6e 20 64 69 73  itus left on dis
6470: 6b 0a 09 20 20 20 3b 3b 20 70 72 6f 63 65 73 73  k..   ;; process
6480: 20 74 68 65 20 64 69 72 73 20 66 72 6f 6d 20 6c   the dirs from l
6490: 6f 6e 67 65 73 74 20 73 74 72 69 6e 67 20 6c 65  ongest string le
64a0: 6e 67 74 68 20 74 6f 20 73 68 6f 72 74 65 73 74  ngth to shortest
64b0: 0a 09 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a  ..   (for-each .
64c0: 09 20 20 20 20 28 6c 61 6d 62 64 61 20 28 64 69  .    (lambda (di
64d0: 72 2d 74 6f 2d 72 65 6d 6f 76 65 29 0a 09 20 20  r-to-remove)..  
64e0: 20 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78      (if (file-ex
64f0: 69 73 74 73 3f 20 64 69 72 2d 74 6f 2d 72 65 6d  ists? dir-to-rem
6500: 6f 76 65 29 0a 09 09 20 20 28 6c 65 74 20 28 28  ove)...  (let ((
6510: 64 69 72 2d 69 6e 2d 64 62 20 27 28 29 29 29 0a  dir-in-db '())).
6520: 09 09 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66  ..    (sqlite3:f
6530: 6f 72 2d 65 61 63 68 2d 72 6f 77 0a 09 09 20 20  or-each-row...  
6540: 20 20 20 28 6c 61 6d 62 64 61 20 28 64 69 72 29     (lambda (dir)
6550: 0a 09 09 20 20 20 20 20 20 20 28 73 65 74 21 20  ...       (set! 
6560: 64 69 72 2d 69 6e 2d 64 62 20 28 63 6f 6e 73 20  dir-in-db (cons 
6570: 64 69 72 20 64 69 72 2d 69 6e 2d 64 62 29 29 29  dir dir-in-db)))
6580: 0a 09 09 20 20 20 20 20 64 62 20 22 53 45 4c 45  ...     db "SELE
6590: 43 54 20 72 75 6e 64 69 72 20 46 52 4f 4d 20 74  CT rundir FROM t
65a0: 65 73 74 73 20 57 48 45 52 45 20 72 75 6e 64 69  ests WHERE rundi
65b0: 72 20 4c 49 4b 45 20 3f 3b 22 20 0a 09 09 20 20  r LIKE ?;" ...  
65c0: 20 20 20 28 63 6f 6e 63 20 22 25 22 20 64 69 72     (conc "%" dir
65d0: 2d 74 6f 2d 72 65 6d 6f 76 65 20 22 25 22 29 29  -to-remove "%"))
65e0: 20 3b 3b 20 79 65 73 2c 20 49 27 6d 20 67 6f 69   ;; yes, I'm goi
65f0: 6e 67 20 74 6f 20 62 61 69 6c 20 69 66 20 74 68  ng to bail if th
6600: 65 72 65 20 69 73 20 61 6e 79 74 68 69 6e 67 20  ere is anything 
6610: 6c 69 6b 65 20 74 68 69 73 20 64 69 72 20 69 6e  like this dir in
6620: 20 74 68 65 20 64 62 0a 09 09 20 20 20 20 28 69   the db...    (i
6630: 66 20 28 6e 75 6c 6c 3f 20 64 69 72 2d 69 6e 2d  f (null? dir-in-
6640: 64 62 29 0a 09 09 09 28 62 65 67 69 6e 0a 09 09  db)....(begin...
6650: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  .  (debug:print 
6660: 32 20 22 52 65 6d 6f 76 69 6e 67 20 64 69 72 65  2 "Removing dire
6670: 63 74 6f 72 79 20 77 69 74 68 20 7a 65 72 6f 20  ctory with zero 
6680: 64 62 20 72 65 66 65 72 65 6e 63 65 73 3a 20 22  db references: "
6690: 20 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 29 0a   dir-to-remove).
66a0: 09 09 09 20 20 28 73 79 73 74 65 6d 20 28 63 6f  ...  (system (co
66b0: 6e 63 20 22 72 6d 20 2d 72 66 20 22 20 64 69 72  nc "rm -rf " dir
66c0: 2d 74 6f 2d 72 65 6d 6f 76 65 29 29 0a 09 09 09  -to-remove))....
66d0: 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 64 65    (hash-table-de
66e0: 6c 65 74 65 21 20 64 69 72 73 2d 74 6f 2d 72 65  lete! dirs-to-re
66f0: 6d 6f 76 65 20 64 69 72 2d 74 6f 2d 72 65 6d 6f  move dir-to-remo
6700: 76 65 29 29 0a 09 09 09 28 64 65 62 75 67 3a 70  ve))....(debug:p
6710: 72 69 6e 74 20 32 20 22 53 6b 69 70 70 69 6e 67  rint 2 "Skipping
6720: 20 72 65 6d 6f 76 61 6c 20 6f 66 20 22 20 64 69   removal of " di
6730: 72 2d 74 6f 2d 72 65 6d 6f 76 65 20 22 20 66 6f  r-to-remove " fo
6740: 72 20 6e 6f 77 20 61 73 20 69 74 20 73 74 69 6c  r now as it stil
6750: 6c 20 68 61 73 20 72 65 66 65 72 65 6e 63 65 73  l has references
6760: 20 69 6e 20 74 68 65 20 64 61 74 61 62 61 73 65   in the database
6770: 22 29 29 29 29 29 0a 09 20 20 20 20 28 73 6f 72  ")))))..    (sor
6780: 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 6b 65  t (hash-table-ke
6790: 79 73 20 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76  ys dirs-to-remov
67a0: 65 29 20 28 6c 61 6d 62 64 61 20 28 61 20 62 29  e) (lambda (a b)
67b0: 28 3e 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74  (> (string-lengt
67c0: 68 20 61 29 28 73 74 72 69 6e 67 2d 6c 65 6e 67  h a)(string-leng
67d0: 74 68 20 62 29 29 29 29 29 0a 0a 09 20 20 20 3b  th b)))))...   ;
67e0: 3b 20 72 65 6d 6f 76 65 20 74 68 65 20 72 75 6e  ; remove the run
67f0: 20 69 66 20 7a 65 72 6f 20 74 65 73 74 73 20 72   if zero tests r
6800: 65 6d 61 69 6e 0a 09 20 20 20 28 6c 65 74 20 28  emain..   (let (
6810: 28 72 65 6d 74 65 73 74 73 20 28 72 64 62 3a 67  (remtests (rdb:g
6820: 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e  et-tests-for-run
6830: 20 64 62 20 28 64 62 3a 67 65 74 2d 76 61 6c 75   db (db:get-valu
6840: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20  e-by-header run 
6850: 68 65 61 64 65 72 20 22 69 64 22 29 20 23 66 20  header "id") #f 
6860: 23 66 20 27 28 29 20 27 28 29 29 29 29 0a 09 20  #f '() '()))).. 
6870: 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 72      (if (null? r
6880: 65 6d 74 65 73 74 73 29 20 3b 3b 20 6e 6f 20 6d  emtests) ;; no m
6890: 6f 72 65 20 74 65 73 74 73 20 72 65 6d 61 69 6e  ore tests remain
68a0: 69 6e 67 0a 09 09 20 28 6c 65 74 2a 20 28 28 64  ing... (let* ((d
68b0: 70 61 72 74 73 20 20 28 73 74 72 69 6e 67 2d 73  parts  (string-s
68c0: 70 6c 69 74 20 6c 61 73 74 74 70 61 74 68 20 22  plit lasttpath "
68d0: 2f 22 29 29 0a 09 09 09 28 72 75 6e 70 61 74 68  /"))....(runpath
68e0: 20 28 63 6f 6e 63 20 22 2f 22 20 28 73 74 72 69   (conc "/" (stri
68f0: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 0a  ng-intersperse .
6900: 09 09 09 09 09 20 20 20 20 28 74 61 6b 65 20 64  .....    (take d
6910: 70 61 72 74 73 20 28 2d 20 28 6c 65 6e 67 74 68  parts (- (length
6920: 20 64 70 61 72 74 73 29 20 31 29 29 0a 09 09 09   dparts) 1))....
6930: 09 09 20 20 20 20 22 2f 22 29 29 29 29 0a 09 09  ..    "/"))))...
6940: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
6950: 31 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 3a  1 "Removing run:
6960: 20 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64   " runkey " " (d
6970: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68  b:get-value-by-h
6980: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72  eader run header
6990: 20 22 72 75 6e 6e 61 6d 65 22 29 29 0a 09 09 20   "runname"))... 
69a0: 20 20 28 64 62 3a 64 65 6c 65 74 65 2d 72 75 6e    (db:delete-run
69b0: 20 64 62 20 72 75 6e 2d 69 64 29 0a 09 09 20 20   db run-id)...  
69c0: 20 3b 3b 20 6e 65 65 64 20 74 6f 20 66 69 67 75   ;; need to figu
69d0: 72 65 20 6f 75 74 20 74 68 65 20 70 61 74 68 20  re out the path 
69e0: 74 6f 20 74 68 65 20 72 75 6e 20 64 69 72 20 61  to the run dir a
69f0: 6e 64 20 72 65 6d 6f 76 65 20 69 74 20 69 66 20  nd remove it if 
6a00: 65 6d 70 74 79 0a 09 09 20 20 20 3b 3b 20 20 20  empty...   ;;   
6a10: 20 28 69 66 20 28 6e 75 6c 6c 3f 20 28 67 6c 6f   (if (null? (glo
6a20: 62 20 28 63 6f 6e 63 20 72 75 6e 70 61 74 68 20  b (conc runpath 
6a30: 22 2f 2a 22 29 29 29 0a 09 09 20 20 20 3b 3b 20  "/*")))...   ;; 
6a40: 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09         (begin...
6a50: 20 20 20 3b 3b 20 09 20 28 64 65 62 75 67 3a 70     ;; . (debug:p
6a60: 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67  rint 1 "Removing
6a70: 20 72 75 6e 20 64 69 72 20 22 20 72 75 6e 70 61   run dir " runpa
6a80: 74 68 29 0a 09 09 20 20 20 3b 3b 20 09 20 28 73  th)...   ;; . (s
6a90: 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 64  ystem (conc "rmd
6aa0: 69 72 20 2d 70 20 22 20 72 75 6e 70 61 74 68 29  ir -p " runpath)
6ab0: 29 29 29 0a 09 09 20 20 20 29 29 29 29 0a 09 20  )))...   )))).. 
6ac0: 29 29 0a 20 20 20 20 20 72 75 6e 73 29 29 29 0a  )).     runs))).
6ad0: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  .;;=============
6ae0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6af0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6b00: 3d 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 0a 3b 3b 20 52 6f 75  =========.;; Rou
6b20: 74 69 6e 65 73 20 66 6f 72 20 6d 61 6e 69 70 75  tines for manipu
6b30: 6c 61 74 69 6e 67 20 72 75 6e 73 0a 3b 3b 3d 3d  lating runs.;;==
6b40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6b50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6b60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6b70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6b80: 3d 3d 3d 3d 0a 0a 3b 3b 20 53 69 6e 63 65 20 6d  ====..;; Since m
6b90: 61 6e 79 20 63 61 6c 6c 73 20 74 6f 20 61 20 72  any calls to a r
6ba0: 75 6e 20 72 65 71 75 69 72 65 20 70 72 65 74 74  un require prett
6bb0: 79 20 6d 75 63 68 20 74 68 65 20 73 61 6d 65 20  y much the same 
6bc0: 73 65 74 75 70 20 0a 3b 3b 20 74 68 69 73 20 77  setup .;; this w
6bd0: 72 61 70 70 65 72 20 69 73 20 75 73 65 64 20 74  rapper is used t
6be0: 6f 20 72 65 64 75 63 65 20 74 68 65 20 72 65 70  o reduce the rep
6bf0: 6c 69 63 61 74 69 6f 6e 20 6f 66 20 63 6f 64 65  lication of code
6c00: 0a 28 64 65 66 69 6e 65 20 28 67 65 6e 65 72 61  .(define (genera
6c10: 6c 2d 72 75 6e 2d 63 61 6c 6c 20 73 77 69 74 63  l-run-call switc
6c20: 68 6e 61 6d 65 20 61 63 74 69 6f 6e 2d 64 65 73  hname action-des
6c30: 63 20 70 72 6f 63 29 0a 20 20 28 6c 65 74 20 28  c proc).  (let (
6c40: 28 72 75 6e 6e 61 6d 65 20 28 61 72 67 73 3a 67  (runname (args:g
6c50: 65 74 2d 61 72 67 20 22 3a 72 75 6e 6e 61 6d 65  et-arg ":runname
6c60: 22 29 29 0a 09 28 74 61 72 67 65 74 20 20 28 69  "))..(target  (i
6c70: 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20  f (args:get-arg 
6c80: 22 2d 74 61 72 67 65 74 22 29 0a 09 09 20 20 20  "-target")...   
6c90: 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20    (args:get-arg 
6ca0: 22 2d 74 61 72 67 65 74 22 29 0a 09 09 20 20 20  "-target")...   
6cb0: 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20    (args:get-arg 
6cc0: 22 2d 72 65 71 74 61 72 67 22 29 29 29 0a 09 28  "-reqtarg")))..(
6cd0: 74 68 31 20 20 20 20 20 23 66 29 29 0a 20 20 20  th1     #f)).   
6ce0: 20 28 63 6f 6e 64 0a 20 20 20 20 20 28 28 6e 6f   (cond.     ((no
6cf0: 74 20 74 61 72 67 65 74 29 0a 20 20 20 20 20 20  t target).      
6d00: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
6d10: 45 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67 20 72  ERROR: Missing r
6d20: 65 71 75 69 72 65 64 20 70 61 72 61 6d 65 74 65  equired paramete
6d30: 72 20 66 6f 72 20 22 20 73 77 69 74 63 68 6e 61  r for " switchna
6d40: 6d 65 20 22 2c 20 79 6f 75 20 6d 75 73 74 20 73  me ", you must s
6d50: 70 65 63 69 66 79 20 74 68 65 20 74 61 72 67 65  pecify the targe
6d60: 74 20 77 69 74 68 20 2d 74 61 72 67 65 74 22 29  t with -target")
6d70: 0a 20 20 20 20 20 20 28 65 78 69 74 20 33 29 29  .      (exit 3))
6d80: 0a 20 20 20 20 20 28 28 6e 6f 74 20 72 75 6e 6e  .     ((not runn
6d90: 61 6d 65 29 0a 20 20 20 20 20 20 28 64 65 62 75  ame).      (debu
6da0: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52  g:print 0 "ERROR
6db0: 3a 20 4d 69 73 73 69 6e 67 20 72 65 71 75 69 72  : Missing requir
6dc0: 65 64 20 70 61 72 61 6d 65 74 65 72 20 66 6f 72  ed parameter for
6dd0: 20 22 20 73 77 69 74 63 68 6e 61 6d 65 20 22 2c   " switchname ",
6de0: 20 79 6f 75 20 6d 75 73 74 20 73 70 65 63 69 66   you must specif
6df0: 79 20 74 68 65 20 72 75 6e 20 6e 61 6d 65 20 77  y the run name w
6e00: 69 74 68 20 3a 72 75 6e 6e 61 6d 65 20 72 75 6e  ith :runname run
6e10: 6e 61 6d 65 22 29 0a 20 20 20 20 20 20 28 65 78  name").      (ex
6e20: 69 74 20 33 29 29 0a 20 20 20 20 20 28 65 6c 73  it 3)).     (els
6e30: 65 0a 20 20 20 20 20 20 28 6c 65 74 20 28 28 64  e.      (let ((d
6e40: 62 20 20 20 23 66 29 0a 09 20 20 20 20 28 6b 65  b   #f)..    (ke
6e50: 79 73 20 23 66 29 29 0a 09 28 69 66 20 28 6e 6f  ys #f))..(if (no
6e60: 74 20 28 73 65 74 75 70 2d 66 6f 72 2d 72 75 6e  t (setup-for-run
6e70: 29 29 0a 09 20 20 20 20 28 62 65 67 69 6e 20 0a  ))..    (begin .
6e80: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72  .      (debug:pr
6e90: 69 6e 74 20 30 20 22 46 61 69 6c 65 64 20 74 6f  int 0 "Failed to
6ea0: 20 73 65 74 75 70 2c 20 65 78 69 74 69 6e 67 22   setup, exiting"
6eb0: 29 0a 09 20 20 20 20 20 20 28 65 78 69 74 20 31  )..      (exit 1
6ec0: 29 29 29 0a 09 28 73 65 74 21 20 64 62 20 20 20  )))..(set! db   
6ed0: 28 6f 70 65 6e 2d 64 62 29 29 0a 09 28 69 66 20  (open-db))..(if 
6ee0: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
6ef0: 73 65 72 76 65 72 22 29 0a 09 20 20 20 20 28 73  server")..    (s
6f00: 65 72 76 65 72 3a 73 74 61 72 74 20 64 62 20 28  erver:start db (
6f10: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 73  args:get-arg "-s
6f20: 65 72 76 65 72 22 29 29 0a 09 20 20 20 20 28 69  erver"))..    (i
6f30: 66 20 28 6e 6f 74 20 28 6f 72 20 28 61 72 67 73  f (not (or (args
6f40: 3a 67 65 74 2d 61 72 67 20 22 2d 72 75 6e 61 6c  :get-arg "-runal
6f50: 6c 22 29 0a 09 09 09 20 20 28 61 72 67 73 3a 67  l")....  (args:g
6f60: 65 74 2d 61 72 67 20 22 2d 72 75 6e 74 65 73 74  et-arg "-runtest
6f70: 73 22 29 29 29 0a 09 09 28 73 65 72 76 65 72 3a  s")))...(server:
6f80: 63 6c 69 65 6e 74 2d 73 65 74 75 70 20 64 62 29  client-setup db)
6f90: 29 29 0a 09 28 73 65 74 21 20 6b 65 79 73 20 28  ))..(set! keys (
6fa0: 72 64 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 29  rdb:get-keys db)
6fb0: 29 0a 09 3b 3b 20 68 61 76 65 20 65 6e 6f 75 67  )..;; have enoug
6fc0: 68 20 74 6f 20 70 72 6f 63 65 73 73 20 2d 74 61  h to process -ta
6fd0: 72 67 65 74 20 6f 72 20 2d 72 65 71 74 61 72 67  rget or -reqtarg
6fe0: 20 68 65 72 65 0a 09 28 69 66 20 28 61 72 67 73   here..(if (args
6ff0: 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61  :get-arg "-reqta
7000: 72 67 22 29 0a 09 20 20 20 20 28 6c 65 74 2a 20  rg")..    (let* 
7010: 28 28 72 75 6e 63 6f 6e 66 69 67 66 20 28 63 6f  ((runconfigf (co
7020: 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f  nc  *toppath* "/
7030: 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69  runconfigs.confi
7040: 67 22 29 29 20 3b 3b 20 44 4f 20 4e 4f 54 20 45  g")) ;; DO NOT E
7050: 56 41 4c 55 41 54 45 20 41 4c 4c 20 0a 09 09 20  VALUATE ALL ... 
7060: 20 20 28 72 75 6e 63 6f 6e 66 69 67 20 20 28 72    (runconfig  (r
7070: 65 61 64 2d 63 6f 6e 66 69 67 20 72 75 6e 63 6f  ead-config runco
7080: 6e 66 69 67 66 20 23 66 20 23 66 20 65 6e 76 69  nfigf #f #f envi
7090: 72 6f 6e 2d 70 61 74 74 3a 20 23 66 29 29 29 20  ron-patt: #f))) 
70a0: 0a 09 20 20 20 20 20 20 28 69 66 20 28 68 61 73  ..      (if (has
70b0: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61  h-table-ref/defa
70c0: 75 6c 74 20 72 75 6e 63 6f 6e 66 69 67 20 28 61  ult runconfig (a
70d0: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65  rgs:get-arg "-re
70e0: 71 74 61 72 67 22 29 20 23 66 29 0a 09 09 20 20  qtarg") #f)...  
70f0: 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 73 65 74  (keys:target-set
7100: 2d 61 72 67 73 20 6b 65 79 73 20 28 61 72 67 73  -args keys (args
7110: 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61  :get-arg "-reqta
7120: 72 67 22 29 20 61 72 67 73 3a 61 72 67 2d 68 61  rg") args:arg-ha
7130: 73 68 29 0a 09 09 20 20 28 62 65 67 69 6e 0a 09  sh)...  (begin..
7140: 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  .    (debug:prin
7150: 74 20 30 20 22 45 52 52 4f 52 3a 20 5b 22 20 28  t 0 "ERROR: [" (
7160: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72  args:get-arg "-r
7170: 65 71 74 61 72 67 22 29 20 22 5d 20 6e 6f 74 20  eqtarg") "] not 
7180: 66 6f 75 6e 64 20 69 6e 20 22 20 72 75 6e 63 6f  found in " runco
7190: 6e 66 69 67 66 29 0a 09 09 20 20 20 20 28 73 71  nfigf)...    (sq
71a0: 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20  lite3:finalize! 
71b0: 64 62 29 0a 09 09 20 20 20 20 28 65 78 69 74 20  db)...    (exit 
71c0: 31 29 29 29 29 0a 09 20 20 20 20 28 69 66 20 28  1))))..    (if (
71d0: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74  args:get-arg "-t
71e0: 61 72 67 65 74 22 29 0a 09 09 28 6b 65 79 73 3a  arget")...(keys:
71f0: 74 61 72 67 65 74 2d 73 65 74 2d 61 72 67 73 20  target-set-args 
7200: 6b 65 79 73 20 28 61 72 67 73 3a 67 65 74 2d 61  keys (args:get-a
7210: 72 67 20 22 2d 74 61 72 67 65 74 22 20 61 72 67  rg "-target" arg
7220: 73 3a 61 72 67 2d 68 61 73 68 29 20 61 72 67 73  s:arg-hash) args
7230: 3a 61 72 67 2d 68 61 73 68 29 29 29 0a 09 28 69  :arg-hash)))..(i
7240: 66 20 28 6e 6f 74 20 28 63 61 72 20 2a 63 6f 6e  f (not (car *con
7250: 66 69 67 69 6e 66 6f 2a 29 29 0a 09 20 20 20 20  figinfo*))..    
7260: 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 28 64  (begin..      (d
7270: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
7280: 52 4f 52 3a 20 41 74 74 65 6d 70 74 65 64 20 74  ROR: Attempted t
7290: 6f 20 22 20 61 63 74 69 6f 6e 2d 64 65 73 63 20  o " action-desc 
72a0: 22 20 62 75 74 20 72 75 6e 20 61 72 65 61 20 63  " but run area c
72b0: 6f 6e 66 69 67 20 66 69 6c 65 20 6e 6f 74 20 66  onfig file not f
72c0: 6f 75 6e 64 22 29 0a 09 20 20 20 20 20 20 28 65  ound")..      (e
72d0: 78 69 74 20 31 29 29 0a 09 20 20 20 20 3b 3b 20  xit 1))..    ;; 
72e0: 45 78 74 72 61 63 74 20 6f 75 74 20 73 74 75 66  Extract out stuf
72f0: 66 20 6e 65 65 64 65 64 20 69 6e 20 6d 6f 73 74  f needed in most
7300: 20 6f 72 20 6d 61 6e 79 20 63 61 6c 6c 73 0a 09   or many calls..
7310: 20 20 20 20 3b 3b 20 68 65 72 65 20 74 68 65 6e      ;; here then
7320: 20 63 61 6c 6c 20 70 72 6f 63 0a 09 20 20 20 20   call proc..    
7330: 28 6c 65 74 2a 20 28 28 6b 65 79 6e 61 6d 65 73  (let* ((keynames
7340: 20 20 20 28 6d 61 70 20 6b 65 79 3a 67 65 74 2d     (map key:get-
7350: 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79 73 29 29  fieldname keys))
7360: 0a 09 09 20 20 20 28 6b 65 79 76 61 6c 6c 73 74  ...   (keyvallst
7370: 20 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69 73 74    (keys->vallist
7380: 20 6b 65 79 73 20 23 74 29 29 29 0a 09 20 20 20   keys #t)))..   
7390: 20 20 20 28 70 72 6f 63 20 64 62 20 74 61 72 67     (proc db targ
73a0: 65 74 20 72 75 6e 6e 61 6d 65 20 6b 65 79 73 20  et runname keys 
73b0: 6b 65 79 6e 61 6d 65 73 20 6b 65 79 76 61 6c 6c  keynames keyvall
73c0: 73 74 29 29 29 0a 09 28 69 66 20 74 68 31 20 28  st)))..(if th1 (
73d0: 74 68 72 65 61 64 2d 6a 6f 69 6e 21 20 74 68 31  thread-join! th1
73e0: 29 29 0a 09 28 73 71 6c 69 74 65 33 3a 66 69 6e  ))..(sqlite3:fin
73f0: 61 6c 69 7a 65 21 20 64 62 29 0a 09 28 73 65 74  alize! db)..(set
7400: 21 20 2a 64 69 64 73 6f 6d 65 74 68 69 6e 67 2a  ! *didsomething*
7410: 20 23 74 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d   #t))))))..;;===
7420: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7430: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7440: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7450: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7460: 3d 3d 3d 0a 3b 3b 20 52 6f 6c 6c 75 70 20 72 75  ===.;; Rollup ru
7470: 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ns.;;===========
7480: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7490: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
74a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
74b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20  ===========..;; 
74c0: 55 70 64 61 74 65 20 74 68 65 20 74 65 73 74 5f  Update the test_
74d0: 6d 65 74 61 20 74 61 62 6c 65 20 66 6f 72 20 74  meta table for t
74e0: 68 69 73 20 74 65 73 74 0a 28 64 65 66 69 6e 65  his test.(define
74f0: 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65   (runs:update-te
7500: 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74 2d  st_meta db test-
7510: 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 0a  name test-conf).
7520: 20 20 28 6c 65 74 20 28 28 63 75 72 72 72 65 63    (let ((currrec
7530: 6f 72 64 20 28 64 62 3a 74 65 73 74 6d 65 74 61  ord (db:testmeta
7540: 2d 67 65 74 2d 72 65 63 6f 72 64 20 64 62 20 74  -get-record db t
7550: 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20  est-name))).    
7560: 28 69 66 20 28 6e 6f 74 20 63 75 72 72 72 65 63  (if (not currrec
7570: 6f 72 64 29 0a 09 28 62 65 67 69 6e 0a 09 20 20  ord)..(begin..  
7580: 28 73 65 74 21 20 63 75 72 72 72 65 63 6f 72 64  (set! currrecord
7590: 20 28 6d 61 6b 65 2d 76 65 63 74 6f 72 20 31 30   (make-vector 10
75a0: 20 23 66 29 29 0a 09 20 20 28 64 62 3a 74 65 73   #f))..  (db:tes
75b0: 74 6d 65 74 61 2d 61 64 64 2d 72 65 63 6f 72 64  tmeta-add-record
75c0: 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 29 29 29   db test-name)))
75d0: 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a  .    (for-each .
75e0: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6b 65       (lambda (ke
75f0: 79 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20  y).       (let* 
7600: 28 28 69 64 78 20 28 63 61 64 72 20 6b 65 79 29  ((idx (cadr key)
7610: 29 0a 09 20 20 20 20 20 20 28 66 6c 64 20 28 63  )..      (fld (c
7620: 61 72 20 20 6b 65 79 29 29 0a 09 20 20 20 20 20  ar  key))..     
7630: 20 28 76 61 6c 20 28 63 6f 6e 66 69 67 2d 6c 6f   (val (config-lo
7640: 6f 6b 75 70 20 74 65 73 74 2d 63 6f 6e 66 20 22  okup test-conf "
7650: 74 65 73 74 5f 6d 65 74 61 22 20 66 6c 64 29 29  test_meta" fld))
7660: 29 0a 09 20 3b 3b 20 28 64 65 62 75 67 3a 70 72  ).. ;; (debug:pr
7670: 69 6e 74 20 35 20 22 69 64 78 3a 20 22 20 69 64  int 5 "idx: " id
7680: 78 20 22 20 66 6c 64 3a 20 22 20 66 6c 64 20 22  x " fld: " fld "
7690: 20 76 61 6c 3a 20 22 20 76 61 6c 29 0a 09 20 28   val: " val).. (
76a0: 69 66 20 28 61 6e 64 20 76 61 6c 20 28 6e 6f 74  if (and val (not
76b0: 20 28 65 71 75 61 6c 3f 20 28 76 65 63 74 6f 72   (equal? (vector
76c0: 2d 72 65 66 20 63 75 72 72 72 65 63 6f 72 64 20  -ref currrecord 
76d0: 69 64 78 29 20 76 61 6c 29 29 29 0a 09 20 20 20  idx) val)))..   
76e0: 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20    (begin..      
76f0: 20 28 70 72 69 6e 74 20 22 55 70 64 61 74 69 6e   (print "Updatin
7700: 67 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20  g " test-name " 
7710: 22 20 66 6c 64 20 22 20 74 6f 20 22 20 76 61 6c  " fld " to " val
7720: 29 0a 09 20 20 20 20 20 20 20 28 64 62 3a 74 65  )..       (db:te
7730: 73 74 6d 65 74 61 2d 75 70 64 61 74 65 2d 66 69  stmeta-update-fi
7740: 65 6c 64 20 64 62 20 74 65 73 74 2d 6e 61 6d 65  eld db test-name
7750: 20 66 6c 64 20 76 61 6c 29 29 29 29 29 0a 20 20   fld val))))).  
7760: 20 20 20 27 28 28 22 61 75 74 68 6f 72 22 20 32     '(("author" 2
7770: 29 28 22 6f 77 6e 65 72 22 20 33 29 28 22 64 65  )("owner" 3)("de
7780: 73 63 72 69 70 74 69 6f 6e 22 20 34 29 28 22 72  scription" 4)("r
7790: 65 76 69 65 77 65 64 22 20 35 29 28 22 74 61 67  eviewed" 5)("tag
77a0: 73 22 20 39 29 29 29 29 29 0a 0a 3b 3b 20 55 70  s" 9)))))..;; Up
77b0: 64 61 74 65 20 74 65 73 74 5f 6d 65 74 61 20 66  date test_meta f
77c0: 6f 72 20 61 6c 6c 20 74 65 73 74 73 0a 28 64 65  or all tests.(de
77d0: 66 69 6e 65 20 28 72 75 6e 73 3a 75 70 64 61 74  fine (runs:updat
77e0: 65 2d 61 6c 6c 2d 74 65 73 74 5f 6d 65 74 61 20  e-all-test_meta 
77f0: 64 62 29 0a 20 20 28 6c 65 74 20 28 28 74 65 73  db).  (let ((tes
7800: 74 2d 6e 61 6d 65 73 20 28 67 65 74 2d 61 6c 6c  t-names (get-all
7810: 2d 6c 65 67 61 6c 2d 74 65 73 74 73 29 29 29 0a  -legal-tests))).
7820: 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20      (for-each . 
7830: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73      (lambda (tes
7840: 74 2d 6e 61 6d 65 29 0a 20 20 20 20 20 20 20 28  t-name).       (
7850: 6c 65 74 2a 20 28 28 74 65 73 74 2d 70 61 74 68  let* ((test-path
7860: 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61      (conc *toppa
7870: 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 20 74 65  th* "/tests/" te
7880: 73 74 2d 6e 61 6d 65 29 29 0a 09 20 20 20 20 20  st-name))..     
7890: 20 28 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 28   (test-configf (
78a0: 63 6f 6e 63 20 74 65 73 74 2d 70 61 74 68 20 22  conc test-path "
78b0: 2f 74 65 73 74 63 6f 6e 66 69 67 22 29 29 0a 09  /testconfig"))..
78c0: 20 20 20 20 20 20 28 74 65 73 74 65 78 69 73 74        (testexist
78d0: 73 20 20 20 28 61 6e 64 20 28 66 69 6c 65 2d 65  s   (and (file-e
78e0: 78 69 73 74 73 3f 20 74 65 73 74 2d 63 6f 6e 66  xists? test-conf
78f0: 69 67 66 29 28 66 69 6c 65 2d 72 65 61 64 2d 61  igf)(file-read-a
7900: 63 63 65 73 73 3f 20 74 65 73 74 2d 63 6f 6e 66  ccess? test-conf
7910: 69 67 66 29 29 29 0a 09 20 20 20 20 20 20 3b 3b  igf)))..      ;;
7920: 20 72 65 61 64 20 63 6f 6e 66 69 67 73 20 77 69   read configs wi
7930: 74 68 20 74 72 69 63 6b 73 20 74 75 72 6e 65 64  th tricks turned
7940: 20 6f 66 66 20 28 69 2e 65 2e 20 6e 6f 20 73 79   off (i.e. no sy
7950: 73 74 65 6d 29 0a 09 20 20 20 20 20 20 28 74 65  stem)..      (te
7960: 73 74 2d 63 6f 6e 66 20 20 20 20 28 69 66 20 74  st-conf    (if t
7970: 65 73 74 65 78 69 73 74 73 20 28 72 65 61 64 2d  estexists (read-
7980: 63 6f 6e 66 69 67 20 74 65 73 74 2d 63 6f 6e 66  config test-conf
7990: 69 67 66 20 23 66 20 23 66 29 28 6d 61 6b 65 2d  igf #f #f)(make-
79a0: 68 61 73 68 2d 74 61 62 6c 65 29 29 29 29 0a 09  hash-table))))..
79b0: 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65   (runs:update-te
79c0: 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74 2d  st_meta db test-
79d0: 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 29  name test-conf))
79e0: 29 0a 20 20 20 20 20 74 65 73 74 2d 6e 61 6d 65  ).     test-name
79f0: 73 29 29 29 0a 0a 3b 3b 20 54 68 69 73 20 63 6f  s)))..;; This co
7a00: 75 6c 64 20 70 72 6f 62 61 62 6c 79 20 62 65 20  uld probably be 
7a10: 72 65 66 61 63 74 6f 72 65 64 20 69 6e 74 6f 20  refactored into 
7a20: 6f 6e 65 20 63 6f 6d 70 6c 65 78 20 71 75 65 72  one complex quer
7a30: 79 20 2e 2e 2e 0a 28 64 65 66 69 6e 65 20 28 72  y ....(define (r
7a40: 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 20 64  uns:rollup-run d
7a50: 62 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74  b keys keyvallst
7a60: 20 72 75 6e 6e 61 6d 65 20 75 73 65 72 29 20 3b   runname user) ;
7a70: 3b 20 77 61 73 20 74 61 72 67 65 74 2c 20 6e 6f  ; was target, no
7a80: 77 20 6b 65 79 76 61 6c 6c 73 74 0a 20 20 28 64  w keyvallst.  (d
7a90: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 72 75  ebug:print 4 "ru
7aa0: 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 2c 20 6b  ns:rollup-run, k
7ab0: 65 79 73 3a 20 22 20 6b 65 79 73 20 22 20 6b 65  eys: " keys " ke
7ac0: 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61  yvallst: " keyva
7ad0: 6c 6c 73 74 20 22 20 3a 72 75 6e 6e 61 6d 65 20  llst " :runname 
7ae0: 22 20 72 75 6e 6e 61 6d 65 20 22 20 75 73 65 72  " runname " user
7af0: 3a 20 22 20 75 73 65 72 29 0a 20 20 28 6c 65 74  : " user).  (let
7b00: 2a 20 28 3b 20 28 6b 65 79 76 61 6c 6c 6c 73 74  * (; (keyvalllst
7b10: 20 20 20 20 20 20 28 6b 65 79 73 3a 74 61 72 67        (keys:targ
7b20: 65 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 79 73 20  et->keyval keys 
7b30: 74 61 72 67 65 74 29 29 0a 09 20 28 6e 65 77 2d  target)).. (new-
7b40: 72 75 6e 2d 69 64 20 20 20 20 20 20 28 72 75 6e  run-id      (run
7b50: 73 3a 72 65 67 69 73 74 65 72 2d 72 75 6e 20 64  s:register-run d
7b60: 62 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74  b keys keyvallst
7b70: 20 72 75 6e 6e 61 6d 65 20 22 6e 65 77 22 20 22   runname "new" "
7b80: 6e 2f 61 22 20 75 73 65 72 29 29 0a 09 20 28 70  n/a" user)).. (p
7b90: 72 65 76 2d 74 65 73 74 73 20 20 20 20 20 20 28  rev-tests      (
7ba0: 74 65 73 74 3a 67 65 74 2d 6d 61 74 63 68 69 6e  test:get-matchin
7bb0: 67 2d 70 72 65 76 69 6f 75 73 2d 74 65 73 74 2d  g-previous-test-
7bc0: 72 75 6e 2d 72 65 63 6f 72 64 73 20 64 62 20 6e  run-records db n
7bd0: 65 77 2d 72 75 6e 2d 69 64 20 22 25 22 20 22 25  ew-run-id "%" "%
7be0: 22 29 29 0a 09 20 28 63 75 72 72 2d 74 65 73 74  ")).. (curr-test
7bf0: 73 20 20 20 20 20 20 28 72 64 62 3a 67 65 74 2d  s      (rdb:get-
7c00: 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62  tests-for-run db
7c10: 20 6e 65 77 2d 72 75 6e 2d 69 64 20 22 25 22 20   new-run-id "%" 
7c20: 22 25 22 20 27 28 29 20 27 28 29 29 29 0a 09 20  "%" '() '())).. 
7c30: 28 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68  (curr-tests-hash
7c40: 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c   (make-hash-tabl
7c50: 65 29 29 29 0a 20 20 20 20 28 64 62 3a 75 70 64  e))).    (db:upd
7c60: 61 74 65 2d 72 75 6e 2d 65 76 65 6e 74 5f 74 69  ate-run-event_ti
7c70: 6d 65 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64  me db new-run-id
7c80: 29 0a 20 20 20 20 3b 3b 20 69 6e 64 65 78 20 74  ).    ;; index t
7c90: 68 65 20 61 6c 72 65 61 64 79 20 73 61 76 65 64  he already saved
7ca0: 20 74 65 73 74 73 20 62 79 20 74 65 73 74 6e 61   tests by testna
7cb0: 6d 65 20 61 6e 64 20 69 74 65 6d 64 61 74 20 69  me and itemdat i
7cc0: 6e 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73  n curr-tests-has
7cd0: 68 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 0a  h.    (for-each.
7ce0: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74 65       (lambda (te
7cf0: 73 74 64 61 74 29 0a 20 20 20 20 20 20 20 28 6c  stdat).       (l
7d00: 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 20 20  et* ((testname  
7d10: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73  (db:test-get-tes
7d20: 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29 0a  tname testdat)).
7d30: 09 20 20 20 20 20 20 28 69 74 65 6d 2d 70 61 74  .      (item-pat
7d40: 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  h (db:test-get-i
7d50: 74 65 6d 2d 70 61 74 68 20 74 65 73 74 64 61 74  tem-path testdat
7d60: 29 29 0a 09 20 20 20 20 20 20 28 66 75 6c 6c 2d  ))..      (full-
7d70: 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 6e  name (conc testn
7d80: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74  ame "/" item-pat
7d90: 68 29 29 29 0a 09 20 28 68 61 73 68 2d 74 61 62  h))).. (hash-tab
7da0: 6c 65 2d 73 65 74 21 20 63 75 72 72 2d 74 65 73  le-set! curr-tes
7db0: 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d  ts-hash full-nam
7dc0: 65 20 74 65 73 74 64 61 74 29 29 29 0a 20 20 20  e testdat))).   
7dd0: 20 20 63 75 72 72 2d 74 65 73 74 73 29 0a 20 20    curr-tests).  
7de0: 20 20 3b 3b 20 4e 4f 50 45 3a 20 4e 6f 6e 2d 6f    ;; NOPE: Non-o
7df0: 70 74 69 6d 61 6c 20 61 70 70 72 6f 61 63 68 2e  ptimal approach.
7e00: 20 54 72 79 20 74 68 69 73 20 69 6e 73 74 65 61   Try this instea
7e10: 64 2e 0a 20 20 20 20 3b 3b 20 20 20 31 2e 20 74  d..    ;;   1. t
7e20: 65 73 74 73 20 61 72 65 20 72 65 63 65 69 76 65  ests are receive
7e30: 64 20 69 6e 20 61 20 6c 69 73 74 2c 20 6d 6f 73  d in a list, mos
7e40: 74 20 72 65 63 65 6e 74 20 66 69 72 73 74 0a 20  t recent first. 
7e50: 20 20 20 3b 3b 20 20 20 32 2e 20 72 65 70 6c 61     ;;   2. repla
7e60: 63 65 20 74 68 65 20 72 6f 6c 6c 75 70 20 74 65  ce the rollup te
7e70: 73 74 20 77 69 74 68 20 74 68 65 20 6e 65 77 20  st with the new 
7e80: 2a 61 6c 77 61 79 73 2a 0a 20 20 20 20 28 66 6f  *always*.    (fo
7e90: 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c 61  r-each .     (la
7ea0: 6d 62 64 61 20 28 74 65 73 74 64 61 74 29 0a 20  mbda (testdat). 
7eb0: 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74 65        (let* ((te
7ec0: 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 65 73 74  stname  (db:test
7ed0: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65  -get-testname te
7ee0: 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28  stdat))..      (
7ef0: 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74 65  item-path (db:te
7f00: 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68  st-get-item-path
7f10: 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20   testdat))..    
7f20: 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f    (full-name (co
7f30: 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22 20  nc testname "/" 
7f40: 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 20 20 20  item-path))..   
7f50: 20 20 20 28 70 72 65 76 2d 74 65 73 74 2d 64 61     (prev-test-da
7f60: 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65  t (hash-table-re
7f70: 66 2f 64 65 66 61 75 6c 74 20 63 75 72 72 2d 74  f/default curr-t
7f80: 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e  ests-hash full-n
7f90: 61 6d 65 20 23 66 29 29 0a 09 20 20 20 20 20 20  ame #f))..      
7fa0: 28 74 65 73 74 2d 73 74 65 70 73 20 20 20 20 20  (test-steps     
7fb0: 20 28 64 62 3a 67 65 74 2d 73 74 65 70 73 2d 66   (db:get-steps-f
7fc0: 6f 72 2d 74 65 73 74 20 64 62 20 28 64 62 3a 74  or-test db (db:t
7fd0: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64  est-get-id testd
7fe0: 61 74 29 29 29 0a 09 20 20 20 20 20 20 28 6e 65  at)))..      (ne
7ff0: 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 23 66  w-test-record #f
8000: 29 29 0a 09 20 3b 3b 20 72 65 70 6c 61 63 65 20  )).. ;; replace 
8010: 74 68 65 73 65 20 77 69 74 68 20 69 6e 73 65 72  these with inser
8020: 74 20 2e 2e 2e 20 73 65 6c 65 63 74 0a 09 20 28  t ... select.. (
8030: 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a 65 78  apply sqlite3:ex
8040: 65 63 75 74 65 20 0a 09 09 64 62 20 0a 09 09 28  ecute ...db ...(
8050: 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20  conc "INSERT OR 
8060: 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 73  REPLACE INTO tes
8070: 74 73 20 28 72 75 6e 5f 69 64 2c 74 65 73 74 6e  ts (run_id,testn
8080: 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73  ame,state,status
8090: 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 68 6f 73 74  ,event_time,host
80a0: 2c 63 70 75 6c 6f 61 64 2c 64 69 73 6b 66 72 65  ,cpuload,diskfre
80b0: 65 2c 75 6e 61 6d 65 2c 72 75 6e 64 69 72 2c 69  e,uname,rundir,i
80c0: 74 65 6d 5f 70 61 74 68 2c 72 75 6e 5f 64 75 72  tem_path,run_dur
80d0: 61 74 69 6f 6e 2c 66 69 6e 61 6c 5f 6c 6f 67 66  ation,final_logf
80e0: 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20  ,comment) "...  
80f0: 20 20 20 20 22 56 41 4c 55 45 53 20 28 3f 2c 3f      "VALUES (?,?
8100: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f  ,?,?,?,?,?,?,?,?
8110: 2c 3f 2c 3f 2c 3f 2c 3f 29 3b 22 29 0a 09 09 6e  ,?,?,?,?);")...n
8120: 65 77 2d 72 75 6e 2d 69 64 20 28 63 64 64 72 20  ew-run-id (cddr 
8130: 28 76 65 63 74 6f 72 2d 3e 6c 69 73 74 20 74 65  (vector->list te
8140: 73 74 64 61 74 29 29 29 0a 09 20 28 73 65 74 21  stdat))).. (set!
8150: 20 6e 65 77 2d 74 65 73 74 64 61 74 20 28 63 61   new-testdat (ca
8160: 72 20 28 72 64 62 3a 67 65 74 2d 74 65 73 74 73  r (rdb:get-tests
8170: 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77 2d  -for-run db new-
8180: 72 75 6e 2d 69 64 20 74 65 73 74 6e 61 6d 65 20  run-id testname 
8190: 69 74 65 6d 2d 70 61 74 68 20 27 28 29 20 27 28  item-path '() '(
81a0: 29 29 29 29 0a 09 20 28 68 61 73 68 2d 74 61 62  )))).. (hash-tab
81b0: 6c 65 2d 73 65 74 21 20 63 75 72 72 2d 74 65 73  le-set! curr-tes
81c0: 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d  ts-hash full-nam
81d0: 65 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20 3b  e new-testdat) ;
81e0: 3b 20 74 68 69 73 20 63 6f 75 6c 64 20 62 65 20  ; this could be 
81f0: 63 6f 6e 66 75 73 69 6e 67 2c 20 77 68 69 63 68  confusing, which
8200: 20 72 65 63 6f 72 64 20 73 68 6f 75 6c 64 20 67   record should g
8210: 6f 20 69 6e 74 6f 20 74 68 65 20 6c 6f 6f 6b 75  o into the looku
8220: 70 20 74 61 62 6c 65 3f 0a 09 20 3b 3b 20 4e 6f  p table?.. ;; No
8230: 77 20 64 75 70 6c 69 63 61 74 65 20 74 68 65 20  w duplicate the 
8240: 74 65 73 74 20 73 74 65 70 73 0a 09 20 28 64 65  test steps.. (de
8250: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 43 6f 70  bug:print 4 "Cop
8260: 79 69 6e 67 20 72 65 63 6f 72 64 73 20 69 6e 20  ying records in 
8270: 74 65 73 74 5f 73 74 65 70 73 20 66 72 6f 6d 20  test_steps from 
8280: 74 65 73 74 5f 69 64 3d 22 20 28 64 62 3a 74 65  test_id=" (db:te
8290: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61  st-get-id testda
82a0: 74 29 20 22 20 74 6f 20 22 20 28 64 62 3a 74 65  t) " to " (db:te
82b0: 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65  st-get-id new-te
82c0: 73 74 64 61 74 29 29 0a 09 20 28 73 71 6c 69 74  stdat)).. (sqlit
82d0: 65 33 3a 65 78 65 63 75 74 65 20 0a 09 20 20 64  e3:execute ..  d
82e0: 62 20 0a 09 20 20 28 63 6f 6e 63 20 22 49 4e 53  b ..  (conc "INS
82f0: 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49  ERT OR REPLACE I
8300: 4e 54 4f 20 74 65 73 74 5f 73 74 65 70 73 20 28  NTO test_steps (
8310: 74 65 73 74 5f 69 64 2c 73 74 65 70 6e 61 6d 65  test_id,stepname
8320: 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c 65 76  ,state,status,ev
8330: 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74  ent_time,comment
8340: 29 20 22 0a 09 09 22 53 45 4c 45 43 54 20 22 20  ) "..."SELECT " 
8350: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20  (db:test-get-id 
8360: 6e 65 77 2d 74 65 73 74 64 61 74 29 20 22 2c 73  new-testdat) ",s
8370: 74 65 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74  tepname,state,st
8380: 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c  atus,event_time,
8390: 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73  comment FROM tes
83a0: 74 5f 73 74 65 70 73 20 57 48 45 52 45 20 74 65  t_steps WHERE te
83b0: 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 28 64  st_id=?;")..  (d
83c0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65  b:test-get-id te
83d0: 73 74 64 61 74 29 29 0a 09 20 3b 3b 20 4e 6f 77  stdat)).. ;; Now
83e0: 20 64 75 70 6c 69 63 61 74 65 20 74 68 65 20 74   duplicate the t
83f0: 65 73 74 20 64 61 74 61 0a 09 20 28 64 65 62 75  est data.. (debu
8400: 67 3a 70 72 69 6e 74 20 34 20 22 43 6f 70 79 69  g:print 4 "Copyi
8410: 6e 67 20 72 65 63 6f 72 64 73 20 69 6e 20 74 65  ng records in te
8420: 73 74 5f 64 61 74 61 20 66 72 6f 6d 20 74 65 73  st_data from tes
8430: 74 5f 69 64 3d 22 20 28 64 62 3a 74 65 73 74 2d  t_id=" (db:test-
8440: 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 20  get-id testdat) 
8450: 22 20 74 6f 20 22 20 28 64 62 3a 74 65 73 74 2d  " to " (db:test-
8460: 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64  get-id new-testd
8470: 61 74 29 29 0a 09 20 28 73 71 6c 69 74 65 33 3a  at)).. (sqlite3:
8480: 65 78 65 63 75 74 65 20 0a 09 20 20 64 62 20 0a  execute ..  db .
8490: 09 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54  .  (conc "INSERT
84a0: 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f   OR REPLACE INTO
84b0: 20 74 65 73 74 5f 64 61 74 61 20 28 74 65 73 74   test_data (test
84c0: 5f 69 64 2c 63 61 74 65 67 6f 72 79 2c 76 61 72  _id,category,var
84d0: 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65  iable,value,expe
84e0: 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63  cted,tol,units,c
84f0: 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 22 53 45 4c  omment) "..."SEL
8500: 45 43 54 20 22 20 28 64 62 3a 74 65 73 74 2d 67  ECT " (db:test-g
8510: 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61  et-id new-testda
8520: 74 29 20 22 2c 63 61 74 65 67 6f 72 79 2c 76 61  t) ",category,va
8530: 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70  riable,value,exp
8540: 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c  ected,tol,units,
8550: 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73  comment FROM tes
8560: 74 5f 64 61 74 61 20 57 48 45 52 45 20 74 65 73  t_data WHERE tes
8570: 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 28 64 62  t_id=?;")..  (db
8580: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73  :test-get-id tes
8590: 74 64 61 74 29 29 0a 09 20 29 29 0a 20 20 20 20  tdat)).. )).    
85a0: 20 70 72 65 76 2d 74 65 73 74 73 29 29 29 0a 09   prev-tests)))..
85b0: 20 0a 20 20 20 20 20 0a                           .     .