Megatest

Hex Artifact Content
Login

Artifact 7a34943964e12460748dad3e64625f2e4c6819cf:


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 3a 67 65 74 2d 74 65 73 74 63 6f 6e  test:get-testcon
22e0: 66 69 67 20 68 65 64 20 27 72 65 74 75 72 6e 2d  fig hed 'return-
22f0: 70 72 6f 63 73 29 29 0a 09 09 20 28 77 61 69 74  procs))... (wait
2300: 6f 6e 73 20 28 73 74 72 69 6e 67 2d 73 70 6c 69  ons (string-spli
2310: 74 20 28 6c 65 74 20 28 28 77 20 28 63 6f 6e 66  t (let ((w (conf
2320: 69 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 67  ig-lookup config
2330: 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20   "requirements" 
2340: 22 77 61 69 74 6f 6e 22 29 29 29 0a 09 09 09 09  "waiton"))).....
2350: 09 20 20 28 69 66 20 77 20 77 20 22 22 29 29 29  .  (if w w "")))
2360: 29 29 0a 09 20 20 20 20 3b 3b 20 28 69 74 65 6d  ))..    ;; (item
2370: 73 20 20 20 28 69 74 65 6d 73 3a 67 65 74 2d 69  s   (items:get-i
2380: 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67  tems-from-config
2390: 20 63 6f 6e 66 69 67 29 29 29 0a 09 20 20 20 20   config)))..    
23a0: 28 69 66 20 28 6e 6f 74 20 28 68 61 73 68 2d 74  (if (not (hash-t
23b0: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74  able-ref/default
23c0: 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 68 65   test-records he
23d0: 64 20 23 66 29 29 0a 09 09 28 68 61 73 68 2d 74  d #f))...(hash-t
23e0: 61 62 6c 65 2d 73 65 74 21 20 74 65 73 74 2d 72  able-set! test-r
23f0: 65 63 6f 72 64 73 0a 09 09 09 09 20 68 65 64 20  ecords..... hed 
2400: 28 76 65 63 74 6f 72 20 68 65 64 20 20 20 20 20  (vector hed     
2410: 3b 3b 20 30 0a 09 09 09 09 09 20 20 20 20 20 63  ;; 0......     c
2420: 6f 6e 66 69 67 20 20 3b 3b 20 31 0a 09 09 09 09  onfig  ;; 1.....
2430: 09 20 20 20 20 20 77 61 69 74 6f 6e 73 20 3b 3b  .     waitons ;;
2440: 20 32 0a 09 09 09 09 09 20 20 20 20 20 28 63 6f   2......     (co
2450: 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66  nfig-lookup conf
2460: 69 67 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73  ig "requirements
2470: 22 20 22 70 72 69 6f 72 69 74 79 22 29 20 20 20  " "priority")   
2480: 20 20 3b 3b 20 70 72 69 6f 72 69 74 79 20 33 0a    ;; priority 3.
2490: 09 09 09 09 09 20 20 20 20 20 28 6c 65 74 20 28  .....     (let (
24a0: 28 69 74 65 6d 73 20 20 20 20 20 20 28 68 61 73  (items      (has
24b0: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61  h-table-ref/defa
24c0: 75 6c 74 20 63 6f 6e 66 69 67 20 22 69 74 65 6d  ult config "item
24d0: 73 22 20 23 66 29 29 20 3b 3b 20 69 74 65 6d 73  s" #f)) ;; items
24e0: 20 34 0a 09 09 09 09 09 09 20 20 20 28 69 74 65   4.......   (ite
24f0: 6d 73 74 61 62 6c 65 20 28 68 61 73 68 2d 74 61  mstable (hash-ta
2500: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20  ble-ref/default 
2510: 63 6f 6e 66 69 67 20 22 69 74 65 6d 73 74 61 62  config "itemstab
2520: 6c 65 22 20 23 66 29 29 29 20 0a 09 09 09 09 09  le" #f))) ......
2530: 20 20 20 20 20 20 20 3b 3b 20 69 66 20 65 69 74         ;; if eit
2540: 68 65 72 20 69 74 65 6d 73 20 6f 72 20 69 74 65  her items or ite
2550: 6d 73 20 74 61 62 6c 65 20 69 73 20 61 20 70 72  ms table is a pr
2560: 6f 63 20 72 65 74 75 72 6e 20 69 74 20 73 6f 20  oc return it so 
2570: 74 65 73 74 20 72 75 6e 6e 69 6e 67 0a 09 09 09  test running....
2580: 09 09 20 20 20 20 20 20 20 3b 3b 20 70 72 6f 63  ..       ;; proc
2590: 65 73 73 20 63 61 6e 20 6b 6e 6f 77 20 74 6f 20  ess can know to 
25a0: 63 61 6c 6c 20 69 74 65 6d 73 3a 67 65 74 2d 69  call items:get-i
25b0: 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67  tems-from-config
25c0: 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20  ......       ;; 
25d0: 69 66 20 65 69 74 68 65 72 20 69 73 20 61 20 6c  if either is a l
25e0: 69 73 74 20 61 6e 64 20 6e 6f 6e 65 20 69 73 20  ist and none is 
25f0: 61 20 70 72 6f 63 20 67 6f 20 61 68 65 61 64 20  a proc go ahead 
2600: 61 6e 64 20 63 61 6c 6c 20 67 65 74 2d 69 74 65  and call get-ite
2610: 6d 73 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b  ms......       ;
2620: 3b 20 6f 74 68 65 72 77 69 73 65 20 72 65 74 75  ; otherwise retu
2630: 72 6e 20 23 66 20 2d 20 74 68 69 73 20 69 73 20  rn #f - this is 
2640: 6e 6f 74 20 61 6e 20 69 74 65 72 61 74 65 64 20  not an iterated 
2650: 74 65 73 74 0a 09 09 09 09 09 20 20 20 20 20 20  test......      
2660: 20 28 63 6f 6e 64 0a 09 09 09 09 09 09 28 28 70   (cond.......((p
2670: 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73 29  rocedure? items)
2680: 20 20 20 20 20 20 0a 09 09 09 09 09 09 20 28 64        ....... (d
2690: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e  ebug:print 4 "IN
26a0: 46 4f 3a 20 69 74 65 6d 73 20 69 73 20 61 20 70  FO: items is a p
26b0: 72 6f 63 65 64 75 72 65 2c 20 77 69 6c 6c 20 63  rocedure, will c
26c0: 61 6c 63 20 6c 61 74 65 72 22 29 0a 09 09 09 09  alc later").....
26d0: 09 09 20 69 74 65 6d 73 29 20 20 20 20 20 20 20  .. items)       
26e0: 20 20 20 20 20 3b 3b 20 63 61 6c 63 20 6c 61 74       ;; calc lat
26f0: 65 72 0a 09 09 09 09 09 09 28 28 70 72 6f 63 65  er.......((proce
2700: 64 75 72 65 3f 20 69 74 65 6d 73 74 61 62 6c 65  dure? itemstable
2710: 29 0a 09 09 09 09 09 09 20 28 64 65 62 75 67 3a  )....... (debug:
2720: 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 69  print 4 "INFO: i
2730: 74 65 6d 73 74 61 62 6c 65 20 69 73 20 61 20 70  temstable is a p
2740: 72 6f 63 65 64 75 72 65 2c 20 77 69 6c 6c 20 63  rocedure, will c
2750: 61 6c 63 20 6c 61 74 65 72 22 29 0a 09 09 09 09  alc later").....
2760: 09 09 20 69 74 65 6d 73 74 61 62 6c 65 29 20 20  .. itemstable)  
2770: 20 20 20 20 20 3b 3b 20 63 61 6c 63 20 6c 61 74       ;; calc lat
2780: 65 72 0a 09 09 09 09 09 09 28 28 66 69 6c 74 65  er.......((filte
2790: 72 20 28 6c 61 6d 62 64 61 20 28 78 29 0a 09 09  r (lambda (x)...
27a0: 09 09 09 09 09 20 20 20 28 6c 65 74 20 28 28 76  .....   (let ((v
27b0: 61 6c 20 28 63 61 72 20 78 29 29 29 0a 09 09 09  al (car x)))....
27c0: 09 09 09 09 20 20 20 20 20 28 69 66 20 28 70 72  ....     (if (pr
27d0: 6f 63 65 64 75 72 65 3f 20 76 61 6c 29 20 76 61  ocedure? val) va
27e0: 6c 20 23 66 29 29 29 0a 09 09 09 09 09 09 09 20  l #f)))........ 
27f0: 28 61 70 70 65 6e 64 20 28 69 66 20 28 6c 69 73  (append (if (lis
2800: 74 3f 20 69 74 65 6d 73 29 20 69 74 65 6d 73 20  t? items) items 
2810: 27 28 29 29 0a 09 09 09 09 09 09 09 09 20 28 69  '())......... (i
2820: 66 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 74 61  f (list? itemsta
2830: 62 6c 65 29 20 69 74 65 6d 73 74 61 62 6c 65 20  ble) itemstable 
2840: 27 28 29 29 29 29 0a 09 09 09 09 09 09 20 27 68  '())))....... 'h
2850: 61 76 65 2d 70 72 6f 63 65 64 75 72 65 29 0a 09  ave-procedure)..
2860: 09 09 09 09 09 28 28 6f 72 20 28 6c 69 73 74 3f  .....((or (list?
2870: 20 69 74 65 6d 73 29 28 6c 69 73 74 3f 20 69 74   items)(list? it
2880: 65 6d 73 74 61 62 6c 65 29 29 20 3b 3b 20 63 61  emstable)) ;; ca
2890: 6c 63 20 6e 6f 77 0a 09 09 09 09 09 09 20 28 64  lc now....... (d
28a0: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e  ebug:print 4 "IN
28b0: 46 4f 3a 20 69 74 65 6d 73 20 61 6e 64 20 69 74  FO: items and it
28c0: 65 6d 73 74 61 62 6c 65 20 61 72 65 20 6c 69 73  emstable are lis
28d0: 74 73 2c 20 63 61 6c 63 20 6e 6f 77 5c 6e 22 0a  ts, calc now\n".
28e0: 09 09 09 09 09 09 09 20 20 20 20 20 20 22 20 20  .......      "  
28f0: 20 20 69 74 65 6d 73 3a 20 22 20 69 74 65 6d 73    items: " items
2900: 20 22 20 69 74 65 6d 73 74 61 62 6c 65 3a 20 22   " itemstable: "
2910: 20 69 74 65 6d 73 74 61 62 6c 65 29 0a 09 09 09   itemstable)....
2920: 09 09 09 20 28 69 74 65 6d 73 3a 67 65 74 2d 69  ... (items:get-i
2930: 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67  tems-from-config
2940: 20 63 6f 6e 66 69 67 29 29 0a 09 09 09 09 09 09   config)).......
2950: 28 65 6c 73 65 20 23 66 29 29 29 20 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 3b 3b 20 6e 6f 74 20 69 74 65        ;; not ite
2980: 72 61 74 65 64 0a 09 09 09 09 09 20 20 20 20 20  rated......     
2990: 23 66 20 20 20 20 20 20 3b 3b 20 69 74 65 6d 73  #f      ;; items
29a0: 64 61 74 20 35 0a 09 09 09 09 09 20 20 20 20 20  dat 5......     
29b0: 3b 3b 20 23 66 20 20 20 20 20 20 3b 3b 20 73 70  ;; #f      ;; sp
29c0: 61 72 65 0a 09 09 09 09 09 20 20 20 20 20 29 29  are......     ))
29d0: 29 0a 09 20 20 20 20 28 66 6f 72 2d 65 61 63 68  )..    (for-each
29e0: 20 0a 09 20 20 20 20 20 28 6c 61 6d 62 64 61 20   ..     (lambda 
29f0: 28 77 61 69 74 6f 6e 29 0a 09 20 20 20 20 20 20  (waiton)..      
2a00: 20 28 69 66 20 28 61 6e 64 20 77 61 69 74 6f 6e   (if (and waiton
2a10: 20 28 6e 6f 74 20 28 6d 65 6d 62 65 72 20 77 61   (not (member wa
2a20: 69 74 6f 6e 20 74 65 73 74 2d 6e 61 6d 65 73 29  iton test-names)
2a30: 29 29 0a 09 09 20 20 20 28 62 65 67 69 6e 0a 09  ))...   (begin..
2a40: 09 20 20 20 20 20 28 73 65 74 21 20 72 65 71 75  .     (set! requ
2a50: 69 72 65 64 2d 74 65 73 74 73 20 28 63 6f 6e 73  ired-tests (cons
2a60: 20 77 61 69 74 6f 6e 20 72 65 71 75 69 72 65 64   waiton required
2a70: 2d 74 65 73 74 73 29 29 0a 09 09 20 20 20 20 20  -tests))...     
2a80: 28 73 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73  (set! test-names
2a90: 20 28 63 6f 6e 73 20 77 61 69 74 6f 6e 20 74 65   (cons waiton te
2aa0: 73 74 2d 6e 61 6d 65 73 29 29 29 29 29 20 3b 3b  st-names))))) ;;
2ab0: 20 77 61 73 20 61 6e 20 61 70 70 65 6e 64 2c 20   was an append, 
2ac0: 6e 6f 77 20 61 20 63 6f 6e 73 0a 09 20 20 20 20  now a cons..    
2ad0: 20 77 61 69 74 6f 6e 73 29 0a 09 20 20 20 20 28   waitons)..    (
2ae0: 6c 65 74 20 28 28 72 65 6d 74 65 73 74 73 20 28  let ((remtests (
2af0: 64 65 6c 65 74 65 2d 64 75 70 6c 69 63 61 74 65  delete-duplicate
2b00: 73 20 28 61 70 70 65 6e 64 20 77 61 69 74 6f 6e  s (append waiton
2b10: 73 20 74 61 6c 29 29 29 29 0a 09 20 20 20 20 20  s tal))))..     
2b20: 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f   (if (not (null?
2b30: 20 72 65 6d 74 65 73 74 73 29 29 0a 09 09 20 20   remtests))...  
2b40: 28 6c 6f 6f 70 20 28 63 61 72 20 72 65 6d 74 65  (loop (car remte
2b50: 73 74 73 29 28 63 64 72 20 72 65 6d 74 65 73 74  sts)(cdr remtest
2b60: 73 29 29 29 29 29 29 29 0a 0a 20 20 20 20 28 69  s)))))))..    (i
2b70: 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65  f (not (null? re
2b80: 71 75 69 72 65 64 2d 74 65 73 74 73 29 29 0a 09  quired-tests))..
2b90: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22  (debug:print 1 "
2ba0: 49 4e 46 4f 3a 20 41 64 64 69 6e 67 20 22 20 72  INFO: Adding " r
2bb0: 65 71 75 69 72 65 64 2d 74 65 73 74 73 20 22 20  equired-tests " 
2bc0: 74 6f 20 74 68 65 20 72 75 6e 20 71 75 65 75 65  to the run queue
2bd0: 22 29 29 0a 20 20 20 20 3b 3b 20 4e 4f 54 45 3a  ")).    ;; NOTE:
2be0: 20 74 68 65 73 65 20 61 72 65 20 61 6c 6c 20 70   these are all p
2bf0: 61 72 65 6e 74 20 74 65 73 74 73 2c 20 69 74 65  arent tests, ite
2c00: 6d 73 20 61 72 65 20 6e 6f 74 20 65 78 70 61 6e  ms are not expan
2c10: 64 65 64 20 79 65 74 2e 0a 20 20 20 20 28 72 75  ded yet..    (ru
2c20: 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d 71 75 65  ns:run-tests-que
2c30: 75 65 20 64 62 20 72 75 6e 2d 69 64 20 72 75 6e  ue db run-id run
2c40: 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64  name test-record
2c50: 73 20 6b 65 79 76 61 6c 6c 73 74 20 66 6c 61 67  s keyvallst flag
2c60: 73 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72  s).    (debug:pr
2c70: 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 41 6c 6c  int 4 "INFO: All
2c80: 20 64 6f 6e 65 20 62 79 20 68 65 72 65 22 29 29   done by here"))
2c90: 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73  )..(define (runs
2ca0: 3a 72 75 6e 2d 74 65 73 74 73 2d 71 75 65 75 65  :run-tests-queue
2cb0: 20 64 62 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61   db run-id runna
2cc0: 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20  me test-records 
2cd0: 6b 65 79 76 61 6c 6c 73 74 20 66 6c 61 67 73 29  keyvallst flags)
2ce0: 0a 20 20 20 20 3b 3b 20 41 74 20 74 68 69 73 20  .    ;; At this 
2cf0: 70 6f 69 6e 74 20 74 68 65 20 6c 69 73 74 20 6f  point the list o
2d00: 66 20 70 61 72 65 6e 74 20 74 65 73 74 73 20 69  f parent tests i
2d10: 73 20 65 78 70 61 6e 64 65 64 20 0a 20 20 20 20  s expanded .    
2d20: 3b 3b 20 4e 42 2f 2f 20 53 68 6f 75 6c 64 20 65  ;; NB// Should e
2d30: 78 70 61 6e 64 20 69 74 65 6d 73 20 68 65 72 65  xpand items here
2d40: 20 61 6e 64 20 74 68 65 6e 20 69 6e 73 65 72 74   and then insert
2d50: 20 69 6e 74 6f 20 74 68 65 20 72 75 6e 20 71 75   into the run qu
2d60: 65 75 65 2e 0a 20 20 28 64 65 62 75 67 3a 70 72  eue..  (debug:pr
2d70: 69 6e 74 20 35 20 22 74 65 73 74 2d 72 65 63 6f  int 5 "test-reco
2d80: 72 64 73 3a 20 22 20 74 65 73 74 2d 72 65 63 6f  rds: " test-reco
2d90: 72 64 73 20 22 2c 20 6b 65 79 76 61 6c 6c 73 74  rds ", keyvallst
2da0: 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 29 0a 20  : " keyvallst). 
2db0: 20 28 6c 65 74 20 28 28 73 6f 72 74 65 64 2d 74   (let ((sorted-t
2dc0: 65 73 74 2d 6e 61 6d 65 73 20 28 74 65 73 74 73  est-names (tests
2dd0: 3a 73 6f 72 74 2d 62 79 2d 70 72 69 6f 72 69 74  :sort-by-priorit
2de0: 79 2d 61 6e 64 2d 77 61 69 74 6f 6e 20 74 65 73  y-and-waiton tes
2df0: 74 2d 72 65 63 6f 72 64 73 29 29 0a 09 28 69 74  t-records))..(it
2e00: 65 6d 2d 70 61 74 74 73 20 20 20 20 20 20 20 20  em-patts        
2e10: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f  (hash-table-ref/
2e20: 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d  default flags "-
2e30: 69 74 65 6d 70 61 74 74 22 20 23 66 29 29 29 0a  itempatt" #f))).
2e40: 20 20 20 20 28 6c 65 74 20 6c 6f 6f 70 20 28 3b      (let loop (;
2e50: 20 28 6e 75 6d 74 69 6d 65 73 20 30 29 20 3b 3b   (numtimes 0) ;;
2e60: 20 73 68 6f 75 6c 64 6e 27 74 20 6e 65 65 64 20   shouldn't need 
2e70: 74 68 69 73 0a 09 20 20 20 20 20 20 20 28 68 65  this..       (he
2e80: 64 20 20 20 20 20 20 20 20 20 28 63 61 72 20 73  d         (car s
2e90: 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73  orted-test-names
2ea0: 29 29 0a 09 20 20 20 20 20 20 20 28 74 61 6c 20  ))..       (tal 
2eb0: 20 20 20 20 20 20 20 20 28 63 64 72 20 73 6f 72          (cdr sor
2ec0: 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29  ted-test-names))
2ed0: 29 0a 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28  ).      (let* ((
2ee0: 74 65 73 74 2d 72 65 63 6f 72 64 20 28 68 61 73  test-record (has
2ef0: 68 2d 74 61 62 6c 65 2d 72 65 66 20 74 65 73 74  h-table-ref test
2f00: 2d 72 65 63 6f 72 64 73 20 68 65 64 29 29 0a 09  -records hed))..
2f10: 20 20 20 20 20 28 74 63 6f 6e 66 69 67 20 20 20       (tconfig   
2f20: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65    (tests:testque
2f30: 75 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66 69  ue-get-testconfi
2f40: 67 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a  g test-record)).
2f50: 09 20 20 20 20 20 28 77 61 69 74 6f 6e 73 20 20  .     (waitons  
2f60: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75     (tests:testqu
2f70: 65 75 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20  eue-get-waitons 
2f80: 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29     test-record))
2f90: 0a 09 20 20 20 20 20 28 70 72 69 6f 72 69 74 79  ..     (priority
2fa0: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71      (tests:testq
2fb0: 75 65 75 65 2d 67 65 74 2d 70 72 69 6f 72 69 74  ueue-get-priorit
2fc0: 79 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29  y   test-record)
2fd0: 29 0a 09 20 20 20 20 20 28 69 74 65 6d 64 61 74  )..     (itemdat
2fe0: 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74       (tests:test
2ff0: 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d 64 61  queue-get-itemda
3000: 74 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64  t    test-record
3010: 29 29 0a 09 20 20 20 20 20 28 69 74 65 6d 73 20  ))..     (items 
3020: 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73        (tests:tes
3030: 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d 73  tqueue-get-items
3040: 20 20 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72        test-recor
3050: 64 29 29 0a 09 20 20 20 20 20 28 69 74 65 6d 2d  d))..     (item-
3060: 70 61 74 68 20 20 20 28 69 74 65 6d 2d 6c 69 73  path   (item-lis
3070: 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74 29  t->path itemdat)
3080: 29 29 0a 09 28 64 65 62 75 67 3a 70 72 69 6e 74  ))..(debug:print
3090: 20 36 0a 09 09 20 20 20 20 20 22 69 74 65 6d 64   6...     "itemd
30a0: 61 74 3a 20 20 20 20 20 22 20 69 74 65 6d 64 61  at:     " itemda
30b0: 74 0a 09 09 20 20 20 20 20 22 5c 6e 20 20 69 74  t...     "\n  it
30c0: 65 6d 73 3a 20 20 20 20 20 22 20 69 74 65 6d 73  ems:     " items
30d0: 0a 09 09 20 20 20 20 20 22 5c 6e 20 20 69 74 65  ...     "\n  ite
30e0: 6d 2d 70 61 74 68 3a 20 22 20 69 74 65 6d 2d 70  m-path: " item-p
30f0: 61 74 68 29 0a 09 28 63 6f 6e 64 0a 09 20 28 28  ath)..(cond.. ((
3100: 6e 6f 74 20 69 74 65 6d 73 29 20 3b 3b 20 77 68  not items) ;; wh
3110: 65 6e 20 66 61 6c 73 65 20 74 68 65 20 74 65 73  en false the tes
3120: 74 20 69 73 20 6f 6b 20 74 6f 20 62 65 20 68 61  t is ok to be ha
3130: 6e 64 65 64 20 6f 66 66 20 74 6f 20 6c 61 75 6e  nded off to laun
3140: 63 68 20 28 62 75 74 20 6e 6f 74 20 62 65 66 6f  ch (but not befo
3150: 72 65 29 0a 09 20 20 28 6c 65 74 20 28 28 68 61  re)..  (let ((ha
3160: 76 65 2d 72 65 73 6f 75 72 63 65 73 20 20 28 72  ve-resources  (r
3170: 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65  uns:can-run-more
3180: 2d 74 65 73 74 73 20 64 62 20 74 65 73 74 2d 72  -tests db test-r
3190: 65 63 6f 72 64 29 29 20 3b 3b 20 6c 6f 6f 6b 20  ecord)) ;; look 
31a0: 61 74 20 74 68 65 20 74 65 73 74 20 6a 6f 62 67  at the test jobg
31b0: 72 6f 75 70 20 61 6e 64 20 74 6f 74 20 6a 6f 62  roup and tot job
31c0: 73 20 72 75 6e 6e 69 6e 67 0a 09 09 28 70 72 65  s running...(pre
31d0: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 28 64 62  reqs-not-met (db
31e0: 3a 67 65 74 2d 70 72 65 72 65 71 73 2d 6e 6f 74  :get-prereqs-not
31f0: 2d 6d 65 74 20 64 62 20 72 75 6e 2d 69 64 20 77  -met db run-id w
3200: 61 69 74 6f 6e 73 20 69 74 65 6d 2d 70 61 74 68  aitons item-path
3210: 29 29 29 0a 09 20 20 20 20 3b 3b 20 44 6f 6e 27  )))..    ;; Don'
3220: 74 20 6b 6e 6f 77 20 61 74 20 74 68 69 73 20 74  t know at this t
3230: 69 6d 65 20 69 66 20 74 68 65 20 74 65 73 74 20  ime if the test 
3240: 68 61 76 65 20 62 65 65 6e 20 6c 61 75 6e 63 68  have been launch
3250: 65 64 20 61 74 20 73 6f 6d 65 20 74 69 6d 65 20  ed at some time 
3260: 69 6e 20 74 68 65 20 70 61 73 74 0a 09 20 20 20  in the past..   
3270: 20 3b 3b 20 69 2e 65 2e 20 69 73 20 74 68 69 73   ;; i.e. is this
3280: 20 61 20 72 65 2d 6c 61 75 6e 63 68 3f 0a 09 20   a re-launch?.. 
3290: 20 20 20 28 69 66 20 28 61 6e 64 20 68 61 76 65     (if (and have
32a0: 2d 72 65 73 6f 75 72 63 65 73 0a 09 09 20 20 20  -resources...   
32b0: 20 20 28 6e 75 6c 6c 3f 20 70 72 65 72 65 71 73    (null? prereqs
32c0: 2d 6e 6f 74 2d 6d 65 74 29 29 0a 09 09 3b 3b 20  -not-met))...;; 
32d0: 6e 6f 20 6c 6f 6f 70 20 2d 20 64 72 6f 70 20 74  no loop - drop t
32e0: 68 6f 75 67 68 20 61 6e 64 20 75 73 65 20 74 68  hough and use th
32f0: 65 20 6c 6f 6f 70 20 61 74 20 74 68 65 20 62 6f  e loop at the bo
3300: 74 74 6f 6d 20 0a 09 09 28 72 75 6e 3a 74 65 73  ttom ...(run:tes
3310: 74 20 64 62 20 72 75 6e 2d 69 64 20 72 75 6e 6e  t db run-id runn
3320: 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20 74 65  ame keyvallst te
3330: 73 74 2d 72 65 63 6f 72 64 20 66 6c 61 67 73 20  st-record flags 
3340: 23 66 29 0a 09 09 3b 3b 20 65 6c 73 65 20 74 68  #f)...;; else th
3350: 65 20 72 75 6e 20 69 73 20 73 74 75 63 6b 2c 20  e run is stuck, 
3360: 74 65 6d 70 6f 72 61 72 69 6c 79 20 6f 72 20 70  temporarily or p
3370: 65 72 6d 61 6e 65 6e 74 6c 79 0a 09 09 28 6c 65  ermanently...(le
3380: 74 20 28 28 6e 65 77 74 61 6c 20 28 61 70 70 65  t ((newtal (appe
3390: 6e 64 20 74 61 6c 20 28 6c 69 73 74 20 68 65 64  nd tal (list hed
33a0: 29 29 29 29 0a 09 09 20 20 3b 3b 20 63 6f 75 6c  ))))...  ;; coul
33b0: 64 6e 27 74 20 72 75 6e 2c 20 74 61 6b 65 20 61  dn't run, take a
33c0: 20 62 72 65 61 74 68 65 72 0a 09 09 20 20 28 74   breather...  (t
33d0: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 34 29 0a  hread-sleep! 4).
33e0: 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e  ..  (loop (car n
33f0: 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61  ewtal)(cdr newta
3400: 6c 29 29 29 29 29 29 0a 09 20 0a 09 20 3b 3b 20  l)))))).. .. ;; 
3410: 63 61 73 65 20 77 68 65 72 65 20 61 6e 20 69 74  case where an it
3420: 65 6d 73 20 63 61 6d 65 20 69 6e 20 61 73 20 61  ems came in as a
3430: 20 6c 69 73 74 20 62 65 65 6e 20 70 72 6f 63 65   list been proce
3440: 73 73 65 64 0a 09 20 28 28 61 6e 64 20 28 6c 69  ssed.. ((and (li
3450: 73 74 3f 20 69 74 65 6d 73 29 20 20 20 20 20 3b  st? items)     ;
3460: 3b 20 74 68 75 73 20 77 65 20 6b 6e 6f 77 20 6f  ; thus we know o
3470: 75 72 20 69 74 65 6d 73 20 61 72 65 20 61 6c 72  ur items are alr
3480: 65 61 64 79 20 63 61 6c 63 75 6c 61 74 65 64 0a  eady calculated.
3490: 09 20 20 20 20 20 20 20 28 6e 6f 74 20 20 20 69  .       (not   i
34a0: 74 65 6d 64 61 74 29 29 20 3b 3b 20 61 6e 64 20  temdat)) ;; and 
34b0: 6e 6f 74 20 79 65 74 20 65 78 70 61 6e 64 65 64  not yet expanded
34c0: 20 69 6e 74 6f 20 74 68 65 20 6c 69 73 74 20 6f   into the list o
34d0: 66 20 74 68 69 6e 67 73 20 74 6f 20 62 65 20 64  f things to be d
34e0: 6f 6e 65 0a 09 20 20 28 69 66 20 28 3e 3d 20 2a  one..  (if (>= *
34f0: 76 65 72 62 6f 73 69 74 79 2a 20 31 29 28 70 70  verbosity* 1)(pp
3500: 20 69 74 65 6d 73 29 29 0a 09 20 20 3b 3b 20 28   items))..  ;; (
3510: 69 66 20 28 3e 3d 20 2a 76 65 72 62 6f 73 69 74  if (>= *verbosit
3520: 79 2a 20 35 29 0a 09 20 20 3b 3b 20 20 20 20 20  y* 5)..  ;;     
3530: 28 62 65 67 69 6e 0a 09 20 20 3b 3b 20 20 20 20  (begin..  ;;    
3540: 20 20 20 28 70 72 69 6e 74 20 22 69 74 65 6d 73     (print "items
3550: 3a 20 22 29 20 20 20 20 20 28 70 70 20 28 69 74  : ")     (pp (it
3560: 65 6d 2d 61 73 73 6f 63 2d 3e 69 74 65 6d 2d 6c  em-assoc->item-l
3570: 69 73 74 20 69 74 65 6d 73 29 29 0a 09 20 20 3b  ist items))..  ;
3580: 3b 20 20 20 20 20 20 20 28 70 72 69 6e 74 20 22  ;       (print "
3590: 69 74 65 6d 73 74 61 62 6c 65 3a 20 22 29 28 70  itemstable: ")(p
35a0: 70 20 28 69 74 65 6d 2d 74 61 62 6c 65 2d 3e 69  p (item-table->i
35b0: 74 65 6d 2d 6c 69 73 74 20 69 74 65 6d 73 74 61  tem-list itemsta
35c0: 62 6c 65 29 29 29 29 0a 09 20 20 28 66 6f 72 2d  ble))))..  (for-
35d0: 65 61 63 68 0a 09 20 20 20 28 6c 61 6d 62 64 61  each..   (lambda
35e0: 20 28 6d 79 2d 69 74 65 6d 64 61 74 29 0a 09 20   (my-itemdat).. 
35f0: 20 20 20 20 28 6c 65 74 2a 20 28 28 6e 65 77 2d      (let* ((new-
3600: 74 65 73 74 2d 72 65 63 6f 72 64 20 28 6c 65 74  test-record (let
3610: 20 28 28 6e 65 77 72 65 63 20 28 6d 61 6b 65 2d   ((newrec (make-
3620: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 29  tests:testqueue)
3630: 29 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 76  )).....       (v
3640: 65 63 74 6f 72 2d 63 6f 70 79 21 20 74 65 73 74  ector-copy! test
3650: 2d 72 65 63 6f 72 64 20 6e 65 77 72 65 63 29 0a  -record newrec).
3660: 09 09 09 09 20 20 20 20 20 20 20 6e 65 77 72 65  ....       newre
3670: 63 29 29 0a 09 09 20 20 20 20 28 6d 79 2d 69 74  c))...    (my-it
3680: 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69  em-path (item-li
3690: 73 74 2d 3e 70 61 74 68 20 6d 79 2d 69 74 65 6d  st->path my-item
36a0: 64 61 74 29 29 0a 09 09 20 20 20 20 28 69 74 65  dat))...    (ite
36b0: 6d 2d 6d 61 74 63 68 65 73 20 28 69 66 20 69 74  m-matches (if it
36c0: 65 6d 2d 70 61 74 74 73 20 20 20 20 20 20 20 3b  em-patts       ;
36d0: 3b 20 68 65 72 65 20 77 65 20 61 72 65 20 66 69  ; here we are fi
36e0: 6c 74 65 72 69 6e 67 20 66 6f 72 20 6d 61 74 63  ltering for matc
36f0: 68 65 73 20 77 69 74 68 20 2d 69 74 65 6d 70 61  hes with -itempa
3700: 74 74 0a 09 09 09 09 20 20 20 20 20 20 28 6c 65  tt.....      (le
3710: 74 20 28 28 72 65 73 20 23 66 29 29 09 20 3b 3b  t ((res #f)). ;;
3720: 20 6c 6f 6f 6b 20 74 68 72 6f 75 67 68 20 61 6c   look through al
3730: 6c 20 74 68 65 20 69 74 65 6d 2d 70 61 74 74 73  l the item-patts
3740: 20 69 66 20 64 65 66 69 6e 65 64 2c 20 66 6f 72   if defined, for
3750: 6d 61 74 20 69 73 20 70 61 74 74 31 2c 70 61 74  mat is patt1,pat
3760: 74 32 2c 70 61 74 74 33 20 2e 2e 2e 20 77 69 6c  t2,patt3 ... wil
3770: 64 63 61 72 64 20 69 73 20 25 0a 09 09 09 09 09  dcard is %......
3780: 28 66 6f 72 2d 65 61 63 68 20 0a 09 09 09 09 09  (for-each ......
3790: 20 28 6c 61 6d 62 64 61 20 28 70 61 74 74 29 0a   (lambda (patt).
37a0: 09 09 09 09 09 20 20 20 28 69 66 20 28 73 74 72  .....   (if (str
37b0: 69 6e 67 2d 73 65 61 72 63 68 20 28 67 6c 6f 62  ing-search (glob
37c0: 2d 3e 72 65 67 65 78 70 0a 09 09 09 09 09 09 09  ->regexp........
37d0: 20 20 20 20 20 20 20 28 73 74 72 69 6e 67 2d 74         (string-t
37e0: 72 61 6e 73 6c 61 74 65 20 70 61 74 74 20 22 25  ranslate patt "%
37f0: 22 20 22 2a 22 29 29 0a 09 09 09 09 09 09 09 20  " "*"))........ 
3800: 20 20 20 20 20 69 74 65 6d 2d 70 61 74 68 29 0a       item-path).
3810: 09 09 09 09 09 20 20 20 20 20 20 20 28 73 65 74  .....       (set
3820: 21 20 72 65 73 20 23 74 29 29 29 0a 09 09 09 09  ! res #t))).....
3830: 09 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20  . (string-split 
3840: 69 74 65 6d 2d 70 61 74 74 73 20 22 2c 22 29 29  item-patts ","))
3850: 0a 09 09 09 09 09 72 65 73 29 0a 09 09 09 09 20  ......res)..... 
3860: 20 20 20 20 20 23 74 29 29 29 0a 09 20 20 20 20       #t)))..    
3870: 20 20 20 28 69 66 20 69 74 65 6d 2d 6d 61 74 63     (if item-matc
3880: 68 65 73 20 3b 3b 20 79 65 73 2c 20 77 65 20 77  hes ;; yes, we w
3890: 61 6e 74 20 74 6f 20 70 72 6f 63 65 73 73 20 74  ant to process t
38a0: 68 69 73 20 69 74 65 6d 0a 09 09 20 20 20 28 6c  his item...   (l
38b0: 65 74 20 28 28 6e 65 77 74 65 73 74 6e 61 6d 65  et ((newtestname
38c0: 20 28 63 6f 6e 63 20 68 65 64 20 22 2f 22 20 6d   (conc hed "/" m
38d0: 79 2d 69 74 65 6d 2d 70 61 74 68 29 29 29 20 0a  y-item-path))) .
38e0: 09 09 20 20 20 20 20 28 74 65 73 74 73 3a 74 65  ..     (tests:te
38f0: 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d  stqueue-set-item
3900: 73 21 20 20 20 6e 65 77 2d 74 65 73 74 2d 72 65  s!   new-test-re
3910: 63 6f 72 64 20 23 66 29 0a 09 09 20 20 20 20 20  cord #f)...     
3920: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65  (tests:testqueue
3930: 2d 73 65 74 2d 69 74 65 6d 64 61 74 21 20 6e 65  -set-itemdat! ne
3940: 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 6d 79  w-test-record my
3950: 2d 69 74 65 6d 64 61 74 29 0a 09 09 20 20 20 20  -itemdat)...    
3960: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74   (hash-table-set
3970: 21 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 6e  ! test-records n
3980: 65 77 74 65 73 74 6e 61 6d 65 20 6e 65 77 2d 74  ewtestname new-t
3990: 65 73 74 2d 72 65 63 6f 72 64 29 0a 09 09 20 20  est-record)...  
39a0: 20 20 20 28 73 65 74 21 20 74 61 6c 20 28 63 6f     (set! tal (co
39b0: 6e 73 20 6e 65 77 74 65 73 74 6e 61 6d 65 20 74  ns newtestname t
39c0: 61 6c 29 29 29 29 29 29 20 3b 3b 20 73 69 6e 63  al)))))) ;; sinc
39d0: 65 20 74 68 65 73 65 20 61 72 65 20 69 74 65 6d  e these are item
39e0: 69 7a 65 64 20 63 72 65 61 74 65 20 6e 65 77 20  ized create new 
39f0: 74 65 73 74 20 6e 61 6d 65 73 20 74 65 73 74 6e  test names testn
3a00: 61 6d 65 2f 69 74 65 6d 70 61 74 68 0a 09 20 20  ame/itempath..  
3a10: 20 69 74 65 6d 73 29 0a 09 20 20 28 6c 6f 6f 70   items)..  (loop
3a20: 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74   (car tal)(cdr t
3a30: 61 6c 29 29 29 0a 0a 09 20 3b 3b 20 69 66 20 69  al)))... ;; if i
3a40: 74 65 6d 73 20 69 73 20 61 20 70 72 6f 63 20 74  tems is a proc t
3a50: 68 65 6e 20 6e 65 65 64 20 74 6f 20 72 75 6e 20  hen need to run 
3a60: 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d  items:get-items-
3a70: 66 72 6f 6d 2d 63 6f 6e 66 69 67 2c 20 67 65 74  from-config, get
3a80: 20 74 68 65 20 6c 69 73 74 20 61 6e 64 20 6c 6f   the list and lo
3a90: 6f 70 20 0a 09 20 3b 3b 20 20 20 20 2d 20 62 75  op .. ;;    - bu
3aa0: 74 20 6f 6e 6c 79 20 64 6f 20 74 68 61 74 20 69  t only do that i
3ab0: 66 20 72 65 73 6f 75 72 63 65 73 20 65 78 69 73  f resources exis
3ac0: 74 20 74 6f 20 6b 69 63 6b 20 6f 66 66 20 74 68  t to kick off th
3ad0: 65 20 6a 6f 62 0a 09 20 28 28 6f 72 20 28 70 72  e job.. ((or (pr
3ae0: 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73 29 28  ocedure? items)(
3af0: 65 71 3f 20 69 74 65 6d 73 20 27 68 61 76 65 2d  eq? items 'have-
3b00: 70 72 6f 63 65 64 75 72 65 29 29 0a 09 20 20 28  procedure))..  (
3b10: 69 66 20 28 61 6e 64 20 28 72 75 6e 73 3a 63 61  if (and (runs:ca
3b20: 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73  n-run-more-tests
3b30: 20 64 62 20 74 65 73 74 2d 72 65 63 6f 72 64 29   db test-record)
3b40: 0a 09 09 20 20 20 28 6e 75 6c 6c 3f 20 28 64 62  ...   (null? (db
3b50: 3a 67 65 74 2d 70 72 65 72 65 71 73 2d 6e 6f 74  :get-prereqs-not
3b60: 2d 6d 65 74 20 64 62 20 72 75 6e 2d 69 64 20 77  -met db run-id w
3b70: 61 69 74 6f 6e 73 20 69 74 65 6d 2d 70 61 74 68  aitons item-path
3b80: 29 29 29 0a 09 20 20 20 20 20 20 28 6c 65 74 20  )))..      (let 
3b90: 28 28 74 65 73 74 2d 6e 61 6d 65 20 28 74 65 73  ((test-name (tes
3ba0: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
3bb0: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72  -testname test-r
3bc0: 65 63 6f 72 64 29 29 29 0a 09 09 28 73 65 74 65  ecord)))...(sete
3bd0: 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d 45  nv "MT_TEST_NAME
3be0: 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b 20  " test-name) ;; 
3bf0: 0a 09 09 28 73 65 74 65 6e 76 20 22 4d 54 5f 52  ...(setenv "MT_R
3c00: 55 4e 4e 41 4d 45 22 20 20 20 72 75 6e 6e 61 6d  UNNAME"   runnam
3c10: 65 29 0a 09 09 28 73 65 74 2d 6d 65 67 61 74 65  e)...(set-megate
3c20: 73 74 2d 65 6e 76 2d 76 61 72 73 20 64 62 20 72  st-env-vars db r
3c30: 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73 65 20  un-id) ;; these 
3c40: 6d 61 79 20 62 65 20 6e 65 65 64 65 64 20 62 79  may be needed by
3c50: 20 74 68 65 20 6c 61 75 6e 63 68 69 6e 67 20 70   the launching p
3c60: 72 6f 63 65 73 73 0a 09 09 28 6c 65 74 20 28 28  rocess...(let ((
3c70: 69 74 65 6d 73 2d 6c 69 73 74 20 28 69 74 65 6d  items-list (item
3c80: 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d  s:get-items-from
3c90: 2d 63 6f 6e 66 69 67 20 74 63 6f 6e 66 69 67 29  -config tconfig)
3ca0: 29 29 0a 09 09 20 20 28 69 66 20 28 6c 69 73 74  ))...  (if (list
3cb0: 3f 20 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09 09  ? items-list)...
3cc0: 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09        (begin....
3cd0: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65  (tests:testqueue
3ce0: 2d 73 65 74 2d 69 74 65 6d 73 21 20 74 65 73 74  -set-items! test
3cf0: 2d 72 65 63 6f 72 64 20 69 74 65 6d 73 2d 6c 69  -record items-li
3d00: 73 74 29 0a 09 09 09 28 6c 6f 6f 70 20 68 65 64  st)....(loop hed
3d10: 20 74 61 6c 29 29 0a 09 09 20 20 20 20 20 20 28   tal))...      (
3d20: 62 65 67 69 6e 0a 09 09 09 28 64 65 62 75 67 3a  begin....(debug:
3d30: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
3d40: 54 68 65 20 70 72 6f 63 20 66 72 6f 6d 20 72 65  The proc from re
3d50: 61 64 69 6e 67 20 74 68 65 20 73 65 74 75 70 20  ading the setup 
3d60: 64 69 64 20 6e 6f 74 20 79 69 65 6c 64 20 61 20  did not yield a 
3d70: 6c 69 73 74 20 2d 20 70 6c 65 61 73 65 20 72 65  list - please re
3d80: 70 6f 72 74 20 74 68 69 73 22 29 0a 09 09 09 28  port this")....(
3d90: 65 78 69 74 20 31 29 29 29 29 29 0a 09 20 20 20  exit 1)))))..   
3da0: 20 20 20 28 6c 65 74 20 28 28 6e 65 77 74 61 6c     (let ((newtal
3db0: 20 28 61 70 70 65 6e 64 20 74 61 6c 20 28 6c 69   (append tal (li
3dc0: 73 74 20 68 65 64 29 29 29 29 0a 09 09 3b 3b 20  st hed))))...;; 
3dd0: 69 66 20 63 61 6e 27 74 20 72 75 6e 20 6d 6f 72  if can't run mor
3de0: 65 20 74 65 73 74 73 2c 20 6c 65 74 73 20 74 61  e tests, lets ta
3df0: 6b 65 20 61 20 62 72 65 61 74 68 65 72 0a 09 09  ke a breather...
3e00: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 31  (thread-sleep! 1
3e10: 29 0a 09 09 28 6c 6f 6f 70 20 28 63 61 72 20 6e  )...(loop (car n
3e20: 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61  ewtal)(cdr newta
3e30: 6c 29 29 29 29 29 0a 0a 09 20 3b 3b 20 74 68 69  l)))))... ;; thi
3e40: 73 20 63 61 73 65 20 73 68 6f 75 6c 64 20 6e 6f  s case should no
3e50: 74 20 68 61 70 70 65 6e 2c 20 61 64 64 65 64 20  t happen, added 
3e60: 74 6f 20 68 65 6c 70 20 63 61 74 63 68 20 61 6e  to help catch an
3e70: 79 20 62 75 67 73 0a 09 20 28 28 61 6e 64 20 28  y bugs.. ((and (
3e80: 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 69 74 65  list? items) ite
3e90: 6d 64 61 74 29 0a 09 20 20 28 64 65 62 75 67 3a  mdat)..  (debug:
3ea0: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
3eb0: 53 68 6f 75 6c 64 20 6e 6f 74 20 68 61 76 65 20  Should not have 
3ec0: 61 20 6c 69 73 74 20 6f 66 20 69 74 65 6d 73 20  a list of items 
3ed0: 69 6e 20 61 20 74 65 73 74 20 61 6e 64 20 74 68  in a test and th
3ee0: 65 20 69 74 65 6d 73 70 61 74 68 20 73 65 74 20  e itemspath set 
3ef0: 2d 20 70 6c 65 61 73 65 20 72 65 70 6f 72 74 20  - please report 
3f00: 74 68 69 73 22 29 0a 09 20 20 28 65 78 69 74 20  this")..  (exit 
3f10: 31 29 29 29 29 0a 09 0a 20 20 20 20 20 20 3b 3b  1))))...      ;;
3f20: 20 77 65 20 67 65 74 20 68 65 72 65 20 6f 6e 20   we get here on 
3f30: 22 64 72 6f 70 20 74 68 72 6f 75 67 68 22 20 2d  "drop through" -
3f40: 20 6c 6f 6f 70 20 66 6f 72 20 6e 65 78 74 20 74   loop for next t
3f50: 65 73 74 20 69 6e 20 71 75 65 75 65 0a 20 20 20  est in queue.   
3f60: 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 74 61     (if (null? ta
3f70: 6c 29 0a 09 20 20 28 62 65 67 69 6e 0a 09 20 20  l)..  (begin..  
3f80: 20 20 3b 3b 20 46 49 58 4d 45 21 21 21 21 20 54    ;; FIXME!!!! T
3f90: 48 49 53 20 53 48 4f 55 4c 44 20 4e 4f 54 20 52  HIS SHOULD NOT R
3fa0: 45 51 55 49 52 45 20 41 4e 20 45 58 49 54 21 21  EQUIRE AN EXIT!!
3fb0: 21 21 21 21 21 0a 09 20 20 20 20 28 64 65 62 75  !!!!!..    (debu
3fc0: 67 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a  g:print 1 "INFO:
3fd0: 20 41 6c 6c 20 74 65 73 74 73 20 6c 61 75 6e 63   All tests launc
3fe0: 68 65 64 2c 20 65 78 69 74 69 6e 67 22 29 0a 09  hed, exiting")..
3ff0: 20 20 20 20 28 65 78 69 74 20 30 29 29 0a 09 20      (exit 0)).. 
4000: 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29   (loop (car tal)
4010: 28 63 64 72 20 74 61 6c 29 29 29 29 29 29 0a 0a  (cdr tal))))))..
4020: 3b 3b 20 70 61 72 65 6e 74 2d 74 65 73 74 20 69  ;; parent-test i
4030: 73 20 74 68 65 72 65 20 61 73 20 61 20 70 6c 61  s there as a pla
4040: 63 65 68 6f 6c 64 65 72 20 66 6f 72 20 77 68 65  ceholder for whe
4050: 6e 20 70 61 72 65 6e 74 2d 74 65 73 74 73 20 63  n parent-tests c
4060: 61 6e 20 62 65 20 72 75 6e 20 61 73 20 61 20 73  an be run as a s
4070: 65 74 75 70 20 73 74 65 70 0a 28 64 65 66 69 6e  etup step.(defin
4080: 65 20 28 72 75 6e 3a 74 65 73 74 20 64 62 20 72  e (run:test db r
4090: 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 6b 65  un-id runname ke
40a0: 79 76 61 6c 6c 73 74 20 74 65 73 74 2d 72 65 63  yvallst test-rec
40b0: 6f 72 64 20 66 6c 61 67 73 20 70 61 72 65 6e 74  ord flags parent
40c0: 2d 74 65 73 74 29 0a 20 20 3b 3b 20 41 6c 6c 20  -test).  ;; All 
40d0: 74 68 65 73 65 20 76 61 72 73 20 6d 69 67 68 74  these vars might
40e0: 20 62 65 20 72 65 66 65 72 65 6e 63 65 64 20 62   be referenced b
40f0: 79 20 74 68 65 20 74 65 73 74 63 6f 6e 66 69 67  y the testconfig
4100: 20 66 69 6c 65 20 72 65 61 64 65 72 0a 20 20 28   file reader.  (
4110: 6c 65 74 2a 20 28 28 74 65 73 74 2d 6e 61 6d 65  let* ((test-name
4120: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71      (tests:testq
4130: 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d  ueue-get-testnam
4140: 65 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29  e   test-record)
4150: 29 0a 09 20 28 74 65 73 74 2d 77 61 69 74 6f 6e  ).. (test-waiton
4160: 73 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65  s (tests:testque
4170: 75 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20 20  ue-get-waitons  
4180: 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a    test-record)).
4190: 09 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 20  . (test-conf    
41a0: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65  (tests:testqueue
41b0: 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20  -get-testconfig 
41c0: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20  test-record)).. 
41d0: 28 69 74 65 6d 64 61 74 20 20 20 20 20 20 28 74  (itemdat      (t
41e0: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67  ests:testqueue-g
41f0: 65 74 2d 69 74 65 6d 64 61 74 20 20 20 20 74 65  et-itemdat    te
4200: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74  st-record)).. (t
4210: 65 73 74 2d 70 61 74 68 20 20 20 20 28 63 6f 6e  est-path    (con
4220: 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65  c *toppath* "/te
4230: 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29  sts/" test-name)
4240: 29 20 3b 3b 20 63 6f 75 6c 64 20 75 73 65 20 74  ) ;; could use t
4250: 65 73 74 3a 67 65 74 2d 74 65 73 74 63 6f 6e 66  est:get-testconf
4260: 69 67 20 68 65 72 65 20 2e 2e 2e 0a 09 20 28 66  ig here ..... (f
4270: 6f 72 63 65 20 20 20 20 20 20 20 20 28 68 61 73  orce        (has
4280: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61  h-table-ref/defa
4290: 75 6c 74 20 66 6c 61 67 73 20 22 2d 66 6f 72 63  ult flags "-forc
42a0: 65 22 20 23 66 29 29 0a 09 20 28 72 65 72 75 6e  e" #f)).. (rerun
42b0: 20 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 61          (hash-ta
42c0: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20  ble-ref/default 
42d0: 66 6c 61 67 73 20 22 2d 72 65 72 75 6e 22 20 23  flags "-rerun" #
42e0: 66 29 29 0a 09 20 28 6b 65 65 70 67 6f 69 6e 67  f)).. (keepgoing
42f0: 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d      (hash-table-
4300: 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67  ref/default flag
4310: 73 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 20 23  s "-keepgoing" #
4320: 66 29 29 0a 09 20 28 69 74 65 6d 2d 70 61 74 68  f)).. (item-path
4330: 20 20 20 20 20 22 22 29 29 0a 20 20 20 20 28 64       "")).    (d
4340: 65 62 75 67 3a 70 72 69 6e 74 20 35 0a 09 09 20  ebug:print 5... 
4350: 22 74 65 73 74 2d 63 6f 6e 66 69 67 3a 20 22 20  "test-config: " 
4360: 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61 6c 69  (hash-table->ali
4370: 73 74 20 74 65 73 74 2d 63 6f 6e 66 29 0a 09 09  st test-conf)...
4380: 20 22 5c 6e 20 20 20 69 74 65 6d 64 61 74 3a 20   "\n   itemdat: 
4390: 22 20 69 74 65 6d 64 61 74 0a 09 09 20 29 0a 20  " itemdat... ). 
43a0: 20 20 20 3b 3b 20 73 65 74 74 69 6e 67 20 69 74     ;; setting it
43b0: 65 6d 64 61 74 20 74 6f 20 61 20 6c 69 73 74 20  emdat to a list 
43c0: 69 66 20 69 74 20 69 73 20 23 66 0a 20 20 20 20  if it is #f.    
43d0: 28 69 66 20 28 6e 6f 74 20 69 74 65 6d 64 61 74  (if (not itemdat
43e0: 29 28 73 65 74 21 20 69 74 65 6d 64 61 74 20 27  )(set! itemdat '
43f0: 28 29 29 29 0a 20 20 20 20 28 73 65 74 21 20 69  ())).    (set! i
4400: 74 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c  tem-path (item-l
4410: 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61  ist->path itemda
4420: 74 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70  t)).    (debug:p
4430: 72 69 6e 74 20 32 20 22 41 74 74 65 6d 70 74 69  rint 2 "Attempti
4440: 6e 67 20 74 6f 20 6c 61 75 6e 63 68 20 74 65 73  ng to launch tes
4450: 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f  t " test-name "/
4460: 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 20 20 20  " item-path).   
4470: 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 54 45 53   (setenv "MT_TES
4480: 54 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d  T_NAME" test-nam
4490: 65 29 20 3b 3b 20 0a 20 20 20 20 28 73 65 74 65  e) ;; .    (sete
44a0: 6e 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20  nv "MT_RUNNAME" 
44b0: 20 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20 28    runname).    (
44c0: 73 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76  set-megatest-env
44d0: 2d 76 61 72 73 20 64 62 20 72 75 6e 2d 69 64 29  -vars db run-id)
44e0: 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62 65   ;; these may be
44f0: 20 6e 65 65 64 65 64 20 62 79 20 74 68 65 20 6c   needed by the l
4500: 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 73  aunching process
4510: 0a 20 20 20 20 28 63 68 61 6e 67 65 2d 64 69 72  .    (change-dir
4520: 65 63 74 6f 72 79 20 2a 74 6f 70 70 61 74 68 2a  ectory *toppath*
4530: 29 0a 0a 20 20 20 20 3b 3b 20 48 65 72 65 20 69  )..    ;; Here i
4540: 73 20 77 68 65 72 65 20 74 68 65 20 74 65 73 74  s where the test
4550: 5f 6d 65 74 61 20 74 61 62 6c 65 20 69 73 20 62  _meta table is b
4560: 65 73 74 20 75 70 64 61 74 65 64 0a 20 20 20 20  est updated.    
4570: 3b 3b 20 59 65 73 2c 20 61 6e 6f 74 68 65 72 20  ;; Yes, another 
4580: 75 73 65 20 6f 66 20 61 20 67 6c 6f 62 61 6c 20  use of a global 
4590: 66 6f 72 20 63 61 63 68 69 6e 67 2e 20 4e 65 65  for caching. Nee
45a0: 64 20 61 20 62 65 74 74 65 72 20 77 61 79 3f 0a  d a better way?.
45b0: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 68 61      (if (not (ha
45c0: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66  sh-table-ref/def
45d0: 61 75 6c 74 20 2a 74 65 73 74 2d 6d 65 74 61 2d  ault *test-meta-
45e0: 75 70 64 61 74 65 64 2a 20 74 65 73 74 2d 6e 61  updated* test-na
45f0: 6d 65 20 23 66 29 29 0a 20 20 20 20 20 20 20 20  me #f)).        
4600: 28 62 65 67 69 6e 0a 09 20 20 20 28 68 61 73 68  (begin..   (hash
4610: 2d 74 61 62 6c 65 2d 73 65 74 21 20 2a 74 65 73  -table-set! *tes
4620: 74 2d 6d 65 74 61 2d 75 70 64 61 74 65 64 2a 20  t-meta-updated* 
4630: 74 65 73 74 2d 6e 61 6d 65 20 23 74 29 0a 20 20  test-name #t).  
4640: 20 20 20 20 20 20 20 20 20 28 72 75 6e 73 3a 75           (runs:u
4650: 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 20  pdate-test_meta 
4660: 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73  db test-name tes
4670: 74 2d 63 6f 6e 66 29 29 29 0a 20 20 20 20 0a 20  t-conf))).    . 
4680: 20 20 20 3b 3b 20 28 6c 61 6d 62 64 61 20 28 69     ;; (lambda (i
4690: 74 65 6d 64 61 74 29 20 3b 3b 3b 20 28 28 72 69  temdat) ;;; ((ri
46a0: 70 65 6e 65 73 73 20 22 6f 76 65 72 72 69 70 65  peness "overripe
46b0: 22 29 20 28 74 65 6d 70 65 72 61 74 75 72 65 20  ") (temperature 
46c0: 22 63 6f 6f 6c 22 29 20 28 73 65 61 73 6f 6e 20  "cool") (season 
46d0: 22 73 75 6d 6d 65 72 22 29 29 0a 20 20 20 20 28  "summer")).    (
46e0: 6c 65 74 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d  let* ((new-test-
46f0: 70 61 74 68 20 28 73 74 72 69 6e 67 2d 69 6e 74  path (string-int
4700: 65 72 73 70 65 72 73 65 20 28 63 6f 6e 73 20 74  ersperse (cons t
4710: 65 73 74 2d 70 61 74 68 20 28 6d 61 70 20 63 61  est-path (map ca
4720: 64 72 20 69 74 65 6d 64 61 74 29 29 20 22 2f 22  dr itemdat)) "/"
4730: 29 29 0a 09 20 20 20 28 6e 65 77 2d 74 65 73 74  ))..   (new-test
4740: 2d 6e 61 6d 65 20 28 69 66 20 28 65 71 75 61 6c  -name (if (equal
4750: 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 20  ? item-path "") 
4760: 74 65 73 74 2d 6e 61 6d 65 20 28 63 6f 6e 63 20  test-name (conc 
4770: 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74  test-name "/" it
4780: 65 6d 2d 70 61 74 68 29 29 29 20 3b 3b 20 6a 75  em-path))) ;; ju
4790: 73 74 20 6e 65 65 64 20 69 74 20 74 6f 20 62 65  st need it to be
47a0: 20 75 6e 69 71 75 65 0a 09 20 20 20 28 74 65 73   unique..   (tes
47b0: 74 64 61 74 20 20 20 20 20 20 20 28 64 62 3a 67  tdat       (db:g
47c0: 65 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 20  et-test-info db 
47d0: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65  run-id test-name
47e0: 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 20 20   item-path))).  
47f0: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 74 65 73      (if (not tes
4800: 74 64 61 74 29 0a 09 20 20 28 62 65 67 69 6e 0a  tdat)..  (begin.
4810: 09 20 20 20 20 3b 3b 20 65 6e 73 75 72 65 20 74  .    ;; ensure t
4820: 68 61 74 20 74 68 65 20 70 61 74 68 20 65 78 69  hat the path exi
4830: 73 74 73 20 62 65 66 6f 72 65 20 72 65 67 69 73  sts before regis
4840: 74 65 72 69 6e 67 20 74 68 65 20 74 65 73 74 0a  tering the test.
4850: 09 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 43 61  .    ;; NOPE: Ca
4860: 6e 6e 6f 74 21 20 44 6f 6e 27 74 20 6b 6e 6f 77  nnot! Don't know
4870: 20 79 65 74 20 77 68 69 63 68 20 64 69 73 6b 20   yet which disk 
4880: 61 72 65 61 20 77 69 6c 6c 20 62 65 20 61 73 73  area will be ass
4890: 69 67 6e 65 64 2e 2e 2e 2e 0a 09 20 20 20 20 3b  igned......    ;
48a0: 3b 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20  ; (system (conc 
48b0: 22 6d 6b 64 69 72 20 2d 70 20 22 20 6e 65 77 2d  "mkdir -p " new-
48c0: 74 65 73 74 2d 70 61 74 68 29 29 0a 09 20 20 20  test-path))..   
48d0: 20 28 72 74 65 73 74 73 3a 72 65 67 69 73 74 65   (rtests:registe
48e0: 72 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64  r-test db run-id
48f0: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d   test-name item-
4900: 70 61 74 68 29 0a 09 20 20 20 20 28 73 65 74 21  path)..    (set!
4910: 20 74 65 73 74 64 61 74 20 28 64 62 3a 67 65 74   testdat (db:get
4920: 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 20 72 75  -test-info db ru
4930: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69  n-id test-name i
4940: 74 65 6d 2d 70 61 74 68 29 29 29 29 0a 20 20 20  tem-path)))).   
4950: 20 20 20 28 63 68 61 6e 67 65 2d 64 69 72 65 63     (change-direc
4960: 74 6f 72 79 20 74 65 73 74 2d 70 61 74 68 29 0a  tory test-path).
4970: 20 20 20 20 20 20 28 63 61 73 65 20 28 69 66 20        (case (if 
4980: 66 6f 72 63 65 20 3b 3b 20 28 61 72 67 73 3a 67  force ;; (args:g
4990: 65 74 2d 61 72 67 20 22 2d 66 6f 72 63 65 22 29  et-arg "-force")
49a0: 0a 09 09 27 4e 4f 54 5f 53 54 41 52 54 45 44 0a  ...'NOT_STARTED.
49b0: 09 09 28 69 66 20 74 65 73 74 64 61 74 0a 09 09  ..(if testdat...
49c0: 20 20 20 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d      (string->sym
49d0: 62 6f 6c 20 28 74 65 73 74 3a 67 65 74 2d 73 74  bol (test:get-st
49e0: 61 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 09  ate testdat))...
49f0: 20 20 20 20 27 66 61 69 6c 65 64 2d 74 6f 2d 69      'failed-to-i
4a00: 6e 73 65 72 74 29 29 0a 09 28 28 66 61 69 6c 65  nsert))..((faile
4a10: 64 2d 74 6f 2d 69 6e 73 65 72 74 29 0a 09 20 28  d-to-insert).. (
4a20: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45  debug:print 0 "E
4a30: 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20  RROR: Failed to 
4a40: 69 6e 73 65 72 74 20 74 68 65 20 72 65 63 6f 72  insert the recor
4a50: 64 20 69 6e 74 6f 20 74 68 65 20 64 62 22 29 29  d into the db"))
4a60: 0a 09 28 28 4e 4f 54 5f 53 54 41 52 54 45 44 20  ..((NOT_STARTED 
4a70: 43 4f 4d 50 4c 45 54 45 44 29 0a 09 20 28 64 65  COMPLETED).. (de
4a80: 62 75 67 3a 70 72 69 6e 74 20 36 20 22 47 6f 74  bug:print 6 "Got
4a90: 20 68 65 72 65 2c 20 22 20 28 74 65 73 74 3a 67   here, " (test:g
4aa0: 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74  et-state testdat
4ab0: 29 29 0a 09 20 28 6c 65 74 20 28 28 72 75 6e 66  )).. (let ((runf
4ac0: 6c 61 67 20 23 66 29 29 0a 09 20 20 20 28 63 6f  lag #f))..   (co
4ad0: 6e 64 0a 09 20 20 20 20 3b 3b 20 2d 66 6f 72 63  nd..    ;; -forc
4ae0: 65 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72  e, run no matter
4af0: 20 77 68 61 74 0a 09 20 20 20 20 28 66 6f 72 63   what..    (forc
4b00: 65 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20  e (set! runflag 
4b10: 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 4e 4f 54  #t))..    ;; NOT
4b20: 5f 53 54 41 52 54 45 44 2c 20 72 75 6e 20 6e 6f  _STARTED, run no
4b30: 20 6d 61 74 74 65 72 20 77 68 61 74 0a 09 20 20   matter what..  
4b40: 20 20 28 28 65 71 75 61 6c 3f 20 28 74 65 73 74    ((equal? (test
4b50: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64  :get-state testd
4b60: 61 74 29 20 22 4e 4f 54 5f 53 54 41 52 54 45 44  at) "NOT_STARTED
4b70: 22 29 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20  ")(set! runflag 
4b80: 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 6e 6f 74  #t))..    ;; not
4b90: 20 2d 72 65 72 75 6e 20 61 6e 64 20 50 41 53 53   -rerun and PASS
4ba0: 2c 20 57 41 52 4e 20 6f 72 20 43 48 45 43 4b 2c  , WARN or CHECK,
4bb0: 20 64 6f 20 6e 6f 20 72 75 6e 0a 09 20 20 20 20   do no run..    
4bc0: 28 28 61 6e 64 20 28 6f 72 20 28 6e 6f 74 20 72  ((and (or (not r
4bd0: 65 72 75 6e 29 0a 09 09 20 20 20 20 20 20 6b 65  erun)...      ke
4be0: 65 70 67 6f 69 6e 67 29 0a 09 09 20 20 3b 3b 20  epgoing)...  ;; 
4bf0: 52 65 71 75 69 72 65 20 74 6f 20 66 6f 72 63 65  Require to force
4c00: 20 72 65 2d 72 75 6e 20 66 6f 72 20 43 4f 4d 50   re-run for COMP
4c10: 4c 45 54 45 44 20 6f 72 20 2a 61 6e 79 74 68 69  LETED or *anythi
4c20: 6e 67 2a 20 2b 20 50 41 53 53 2c 57 41 52 4e 20  ng* + PASS,WARN 
4c30: 6f 72 20 43 48 45 43 4b 0a 09 09 20 20 28 6f 72  or CHECK...  (or
4c40: 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67   (member (test:g
4c50: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61  et-status testda
4c60: 74 29 20 27 28 22 50 41 53 53 22 20 22 57 41 52  t) '("PASS" "WAR
4c70: 4e 22 20 22 43 48 45 43 4b 22 29 29 0a 09 09 20  N" "CHECK"))... 
4c80: 20 20 20 20 20 28 6d 65 6d 62 65 72 20 28 74 65       (member (te
4c90: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 20 74 65  st:get-state  te
4ca0: 73 74 64 61 74 29 20 27 28 22 43 4f 4d 50 4c 45  stdat) '("COMPLE
4cb0: 54 45 44 22 29 29 29 29 20 0a 09 20 20 20 20 20  TED")))) ..     
4cc0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22  (debug:print 2 "
4cd0: 49 4e 46 4f 3a 20 72 75 6e 6e 69 6e 67 20 74 65  INFO: running te
4ce0: 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22  st " test-name "
4cf0: 2f 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20 73  /" item-path " s
4d00: 75 70 70 72 65 73 73 65 64 20 61 73 20 69 74 20  uppressed as it 
4d10: 69 73 20 43 4f 4d 50 4c 45 54 45 44 20 61 6e 64  is COMPLETED and
4d20: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61   " (test:get-sta
4d30: 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 20 20  te testdat))..  
4d40: 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67     (set! runflag
4d50: 20 23 66 29 29 0a 09 20 20 20 20 3b 3b 20 2d 72   #f))..    ;; -r
4d60: 65 72 75 6e 20 61 6e 64 20 73 74 61 74 75 73 20  erun and status 
4d70: 69 73 20 6f 6e 65 20 6f 66 20 74 68 65 20 73 70  is one of the sp
4d80: 65 63 69 66 65 64 2c 20 72 75 6e 20 69 74 0a 09  ecifed, run it..
4d90: 20 20 20 20 28 28 61 6e 64 20 72 65 72 75 6e 0a      ((and rerun.
4da0: 09 09 20 20 28 6c 65 74 2a 20 28 28 72 65 72 75  ..  (let* ((reru
4db0: 6e 6c 73 74 20 20 20 28 73 74 72 69 6e 67 2d 73  nlst   (string-s
4dc0: 70 6c 69 74 20 72 65 72 75 6e 20 22 2c 22 29 29  plit rerun ","))
4dd0: 0a 09 09 09 20 28 6d 75 73 74 2d 72 65 72 75 6e  .... (must-rerun
4de0: 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67   (member (test:g
4df0: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61  et-status testda
4e00: 74 29 20 72 65 72 75 6e 6c 73 74 29 29 29 0a 09  t) rerunlst)))..
4e10: 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  .    (debug:prin
4e20: 74 20 33 20 22 49 4e 46 4f 3a 20 2d 72 65 72 75  t 3 "INFO: -reru
4e30: 6e 20 6c 69 73 74 3a 20 22 20 72 65 72 75 6e 20  n list: " rerun 
4e40: 22 2c 20 74 65 73 74 2d 73 74 61 74 75 73 3a 20  ", test-status: 
4e50: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  " (test:get-stat
4e60: 75 73 20 74 65 73 74 64 61 74 29 22 2c 20 6d 75  us testdat)", mu
4e70: 73 74 2d 72 65 72 75 6e 3a 20 22 20 6d 75 73 74  st-rerun: " must
4e80: 2d 72 65 72 75 6e 29 0a 09 09 20 20 20 20 6d 75  -rerun)...    mu
4e90: 73 74 2d 72 65 72 75 6e 29 29 0a 09 20 20 20 20  st-rerun))..    
4ea0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20   (debug:print 2 
4eb0: 22 49 4e 46 4f 3a 20 52 65 72 75 6e 20 66 6f 72  "INFO: Rerun for
4ec0: 63 65 64 20 66 6f 72 20 74 65 73 74 20 22 20 74  ced for test " t
4ed0: 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65  est-name "/" ite
4ee0: 6d 2d 70 61 74 68 29 0a 09 20 20 20 20 20 28 73  m-path)..     (s
4ef0: 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29  et! runflag #t))
4f00: 0a 09 20 20 20 20 3b 3b 20 2d 6b 65 65 70 67 6f  ..    ;; -keepgo
4f10: 69 6e 67 2c 20 64 6f 20 6e 6f 74 20 72 65 72 75  ing, do not reru
4f20: 6e 20 46 41 49 4c 0a 09 20 20 20 20 28 28 61 6e  n FAIL..    ((an
4f30: 64 20 6b 65 65 70 67 6f 69 6e 67 0a 09 09 20 20  d keepgoing...  
4f40: 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65  (member (test:ge
4f50: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74  t-status testdat
4f60: 29 20 27 28 22 46 41 49 4c 22 29 29 29 0a 09 20  ) '("FAIL"))).. 
4f70: 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61      (set! runfla
4f80: 67 20 23 66 29 29 0a 09 20 20 20 20 28 28 61 6e  g #f))..    ((an
4f90: 64 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09  d (not rerun)...
4fa0: 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a    (member (test:
4fb0: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64  get-status testd
4fc0: 61 74 29 20 27 28 22 46 41 49 4c 22 20 22 6e 2f  at) '("FAIL" "n/
4fd0: 61 22 29 29 29 0a 09 20 20 20 20 20 28 73 65 74  a")))..     (set
4fe0: 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09  ! runflag #t))..
4ff0: 20 20 20 20 28 65 6c 73 65 20 28 73 65 74 21 20      (else (set! 
5000: 72 75 6e 66 6c 61 67 20 23 66 29 29 29 0a 09 20  runflag #f))).. 
5010: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 36    (debug:print 6
5020: 20 22 52 55 4e 4e 49 4e 47 20 3d 3e 20 72 75 6e   "RUNNING => run
5030: 66 6c 61 67 3a 20 22 20 72 75 6e 66 6c 61 67 20  flag: " runflag 
5040: 22 20 53 54 41 54 45 3a 20 22 20 28 74 65 73 74  " STATE: " (test
5050: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64  :get-state testd
5060: 61 74 29 20 22 20 53 54 41 54 55 53 3a 20 22 20  at) " STATUS: " 
5070: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73  (test:get-status
5080: 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 28   testdat))..   (
5090: 69 66 20 28 6e 6f 74 20 72 75 6e 66 6c 61 67 29  if (not runflag)
50a0: 0a 09 20 20 20 20 20 20 20 28 69 66 20 28 6e 6f  ..       (if (no
50b0: 74 20 70 61 72 65 6e 74 2d 74 65 73 74 29 0a 09  t parent-test)..
50c0: 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74  .   (debug:print
50d0: 20 31 20 22 4e 4f 54 45 3a 20 4e 6f 74 20 73 74   1 "NOTE: Not st
50e0: 61 72 74 69 6e 67 20 74 65 73 74 20 22 20 6e 65  arting test " ne
50f0: 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 73  w-test-name " as
5100: 20 69 74 20 69 73 20 73 74 61 74 65 20 5c 22 22   it is state \""
5110: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65   (test:get-state
5120: 20 74 65 73 74 64 61 74 29 20 0a 09 09 09 09 22   testdat) ....."
5130: 5c 22 20 61 6e 64 20 73 74 61 74 75 73 20 5c 22  \" and status \"
5140: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  " (test:get-stat
5150: 75 73 20 74 65 73 74 64 61 74 29 20 22 5c 22 2c  us testdat) "\",
5160: 20 75 73 65 20 2d 72 65 72 75 6e 20 5c 22 22 20   use -rerun \"" 
5170: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73  (test:get-status
5180: 20 74 65 73 74 64 61 74 29 0a 20 20 20 20 20 20   testdat).      
5190: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
51a0: 20 20 20 20 20 20 20 20 20 20 22 5c 22 20 6f 72            "\" or
51b0: 20 2d 66 6f 72 63 65 20 74 6f 20 6f 76 65 72 72   -force to overr
51c0: 69 64 65 22 29 29 0a 09 20 20 20 20 20 20 20 3b  ide"))..       ;
51d0: 3b 20 4e 4f 54 45 3a 20 4e 6f 20 6c 6f 6e 67 65  ; NOTE: No longe
51e0: 72 20 62 65 20 63 68 65 63 6b 69 6e 67 20 70 72  r be checking pr
51f0: 65 72 65 71 75 69 73 69 74 65 73 20 68 65 72 65  erequisites here
5200: 21 20 57 69 6c 6c 20 6e 65 76 65 72 20 67 65 74  ! Will never get
5210: 20 68 65 72 65 20 75 6e 6c 65 73 73 20 70 72 65   here unless pre
5220: 72 65 71 73 20 61 72 65 0a 09 20 20 20 20 20 20  reqs are..      
5230: 20 3b 3b 20 20 20 20 20 20 20 61 6c 72 65 61 64   ;;       alread
5240: 79 20 6d 65 74 2e 0a 09 20 20 20 20 20 20 20 28  y met...       (
5250: 69 66 20 28 6e 6f 74 20 28 6c 61 75 6e 63 68 2d  if (not (launch-
5260: 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 72  test db run-id r
5270: 75 6e 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66  unname test-conf
5280: 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 73 74 2d   keyvallst test-
5290: 6e 61 6d 65 20 74 65 73 74 2d 70 61 74 68 20 69  name test-path i
52a0: 74 65 6d 64 61 74 20 66 6c 61 67 73 29 29 0a 09  temdat flags))..
52b0: 09 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20  .   (begin...   
52c0: 20 20 28 70 72 69 6e 74 20 22 45 52 52 4f 52 3a    (print "ERROR:
52d0: 20 46 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63   Failed to launc
52e0: 68 20 74 68 65 20 74 65 73 74 2e 20 45 78 69 74  h the test. Exit
52f0: 69 6e 67 20 61 73 20 73 6f 6f 6e 20 61 73 20 70  ing as soon as p
5300: 6f 73 73 69 62 6c 65 22 29 0a 09 09 20 20 20 20  ossible")...    
5310: 20 28 73 65 74 21 20 2a 67 6c 6f 62 61 6c 65 78   (set! *globalex
5320: 69 74 73 74 61 74 75 73 2a 20 31 29 20 3b 3b 20  itstatus* 1) ;; 
5330: 0a 09 09 20 20 20 20 20 28 70 72 6f 63 65 73 73  ...     (process
5340: 2d 73 69 67 6e 61 6c 20 28 63 75 72 72 65 6e 74  -signal (current
5350: 2d 70 72 6f 63 65 73 73 2d 69 64 29 20 73 69 67  -process-id) sig
5360: 6e 61 6c 2f 6b 69 6c 6c 29 29 29 29 29 29 0a 09  nal/kill))))))..
5370: 28 28 4b 49 4c 4c 45 44 29 20 0a 09 20 28 64 65  ((KILLED) .. (de
5380: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54  bug:print 1 "NOT
5390: 45 3a 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61  E: " new-test-na
53a0: 6d 65 20 22 20 69 73 20 61 6c 72 65 61 64 79 20  me " is already 
53b0: 72 75 6e 6e 69 6e 67 20 6f 72 20 77 61 73 20 65  running or was e
53c0: 78 70 6c 69 63 74 6c 79 20 6b 69 6c 6c 65 64 2c  xplictly killed,
53d0: 20 75 73 65 20 2d 66 6f 72 63 65 20 74 6f 20 6c   use -force to l
53e0: 61 75 6e 63 68 20 69 74 2e 22 29 29 0a 09 28 28  aunch it."))..((
53f0: 4c 41 55 4e 43 48 45 44 20 52 45 4d 4f 54 45 48  LAUNCHED REMOTEH
5400: 4f 53 54 53 54 41 52 54 20 52 55 4e 4e 49 4e 47  OSTSTART RUNNING
5410: 29 20 20 0a 09 20 28 69 66 20 28 3e 20 28 2d 20  )  .. (if (> (- 
5420: 28 63 75 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73  (current-seconds
5430: 29 28 2b 20 28 64 62 3a 74 65 73 74 2d 67 65 74  )(+ (db:test-get
5440: 2d 65 76 65 6e 74 5f 74 69 6d 65 20 74 65 73 74  -event_time test
5450: 64 61 74 29 0a 09 09 09 09 20 20 20 20 20 20 20  dat).....       
5460: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e  (db:test-get-run
5470: 5f 64 75 72 61 74 69 6f 6e 20 74 65 73 74 64 61  _duration testda
5480: 74 29 29 29 0a 09 09 36 30 30 29 20 3b 3b 20 69  t)))...600) ;; i
5490: 2e 65 2e 20 6e 6f 20 75 70 64 61 74 65 20 66 6f  .e. no update fo
54a0: 72 20 6d 6f 72 65 20 74 68 61 6e 20 36 30 30 20  r more than 600 
54b0: 73 65 63 6f 6e 64 73 0a 09 20 20 20 20 20 28 62  seconds..     (b
54c0: 65 67 69 6e 0a 09 20 20 20 20 20 20 20 28 64 65  egin..       (de
54d0: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52  bug:print 0 "WAR
54e0: 4e 49 4e 47 3a 20 54 65 73 74 20 22 20 74 65 73  NING: Test " tes
54f0: 74 2d 6e 61 6d 65 20 22 20 61 70 70 65 61 72 73  t-name " appears
5500: 20 74 6f 20 62 65 20 64 65 61 64 2e 20 46 6f 72   to be dead. For
5510: 63 69 6e 67 20 69 74 20 74 6f 20 73 74 61 74 65  cing it to state
5520: 20 49 4e 43 4f 4d 50 4c 45 54 45 20 61 6e 64 20   INCOMPLETE and 
5530: 73 74 61 74 75 73 20 53 54 55 43 4b 2f 44 45 41  status STUCK/DEA
5540: 44 22 29 0a 09 20 20 20 20 20 20 20 28 74 65 73  D")..       (tes
5550: 74 2d 73 65 74 2d 73 74 61 74 75 73 21 20 64 62  t-set-status! db
5560: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d   run-id test-nam
5570: 65 20 22 49 4e 43 4f 4d 50 4c 45 54 45 22 20 22  e "INCOMPLETE" "
5580: 53 54 55 43 4b 2f 44 45 41 44 22 20 69 74 65 6d  STUCK/DEAD" item
5590: 64 61 74 20 22 54 65 73 74 20 69 73 20 73 74 75  dat "Test is stu
55a0: 63 6b 20 6f 72 20 64 65 61 64 22 20 23 66 29 29  ck or dead" #f))
55b0: 0a 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72  ..     (debug:pr
55c0: 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 22 20 74  int 2 "NOTE: " t
55d0: 65 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c  est-name " is al
55e0: 72 65 61 64 79 20 72 75 6e 6e 69 6e 67 22 29 29  ready running"))
55f0: 29 0a 09 28 65 6c 73 65 20 20 20 20 20 20 20 28  )..(else       (
5600: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45  debug:print 0 "E
5610: 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20  RROR: Failed to 
5620: 6c 61 75 6e 63 68 20 74 65 73 74 20 22 20 6e 65  launch test " ne
5630: 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 2e 20 55  w-test-name ". U
5640: 6e 72 65 63 6f 67 6e 69 73 65 64 20 73 74 61 74  nrecognised stat
5650: 65 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74  e " (test:get-st
5660: 61 74 65 20 74 65 73 74 64 61 74 29 29 29 29 29  ate testdat)))))
5670: 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ))..;;==========
5680: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5690: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
56a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
56b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20  ============.;; 
56c0: 45 4e 44 20 4f 46 20 4e 45 57 20 53 54 55 46 46  END OF NEW STUFF
56d0: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  .;;=============
56e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
56f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5700: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5710: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69  =========..(defi
5720: 6e 65 20 28 67 65 74 2d 64 69 72 2d 75 70 2d 6e  ne (get-dir-up-n
5730: 20 64 69 72 20 2e 20 70 61 72 61 6d 73 29 20 0a   dir . params) .
5740: 20 20 28 6c 65 74 20 28 28 64 70 61 72 74 73 20    (let ((dparts 
5750: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 64   (string-split d
5760: 69 72 20 22 2f 22 29 29 0a 09 28 63 6f 75 6e 74  ir "/"))..(count
5770: 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 70 61     (if (null? pa
5780: 72 61 6d 73 29 20 31 20 28 63 61 72 20 70 61 72  rams) 1 (car par
5790: 61 6d 73 29 29 29 29 0a 20 20 20 20 28 63 6f 6e  ams)))).    (con
57a0: 63 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e  c "/" (string-in
57b0: 74 65 72 73 70 65 72 73 65 20 0a 09 20 20 20 20  tersperse ..    
57c0: 20 20 20 28 74 61 6b 65 20 64 70 61 72 74 73 20     (take dparts 
57d0: 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74  (- (length dpart
57e0: 73 29 20 63 6f 75 6e 74 29 29 0a 09 20 20 20 20  s) count))..    
57f0: 20 20 20 22 2f 22 29 29 29 29 0a 3b 3b 20 52 65     "/")))).;; Re
5800: 6d 6f 76 65 20 72 75 6e 73 0a 3b 3b 20 66 69 65  move runs.;; fie
5810: 6c 64 73 20 61 72 65 20 70 61 73 73 69 6e 67 20  lds are passing 
5820: 69 6e 20 74 68 72 6f 75 67 68 20 0a 28 64 65 66  in through .(def
5830: 69 6e 65 20 28 72 75 6e 73 3a 72 65 6d 6f 76 65  ine (runs:remove
5840: 2d 72 75 6e 73 20 64 62 20 72 75 6e 6e 61 6d 65  -runs db runname
5850: 70 61 74 74 20 74 65 73 74 70 61 74 74 20 69 74  patt testpatt it
5860: 65 6d 70 61 74 74 29 0a 20 20 28 6c 65 74 2a 20  empatt).  (let* 
5870: 28 28 6b 65 79 73 20 20 20 20 20 20 20 20 28 72  ((keys        (r
5880: 64 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29  db:get-keys db))
5890: 0a 09 20 28 72 75 6e 64 61 74 20 20 20 20 20 20  .. (rundat      
58a0: 28 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62  (runs:get-runs-b
58b0: 79 2d 70 61 74 74 20 64 62 20 6b 65 79 73 20 72  y-patt db keys r
58c0: 75 6e 6e 61 6d 65 70 61 74 74 29 29 0a 09 20 28  unnamepatt)).. (
58d0: 68 65 61 64 65 72 20 20 20 20 20 20 28 76 65 63  header      (vec
58e0: 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 30  tor-ref rundat 0
58f0: 29 29 0a 09 20 28 72 75 6e 73 20 20 20 20 20 20  )).. (runs      
5900: 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75    (vector-ref ru
5910: 6e 64 61 74 20 31 29 29 29 0a 20 20 20 20 28 64  ndat 1))).    (d
5920: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 48 65  ebug:print 1 "He
5930: 61 64 65 72 3a 20 22 20 68 65 61 64 65 72 29 0a  ader: " header).
5940: 20 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 20      (for-each.  
5950: 20 20 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 29     (lambda (run)
5960: 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 72  .       (let ((r
5970: 75 6e 6b 65 79 20 28 73 74 72 69 6e 67 2d 69 6e  unkey (string-in
5980: 74 65 72 73 70 65 72 73 65 20 28 6d 61 70 20 28  tersperse (map (
5990: 6c 61 6d 62 64 61 20 28 6b 29 0a 09 09 09 09 09  lambda (k)......
59a0: 09 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62  .(db:get-value-b
59b0: 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61  y-header run hea
59c0: 64 65 72 20 28 76 65 63 74 6f 72 2d 72 65 66 20  der (vector-ref 
59d0: 6b 20 30 29 29 29 20 6b 65 79 73 29 20 22 2f 22  k 0))) keys) "/"
59e0: 29 29 0a 09 20 20 20 20 20 28 64 69 72 73 2d 74  ))..     (dirs-t
59f0: 6f 2d 72 65 6d 6f 76 65 20 28 6d 61 6b 65 2d 68  o-remove (make-h
5a00: 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 09 20 28  ash-table))).. (
5a10: 6c 65 74 2a 20 28 28 72 75 6e 2d 69 64 20 28 64  let* ((run-id (d
5a20: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68  b:get-value-by-h
5a30: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72  eader run header
5a40: 20 22 69 64 22 29 20 29 0a 09 09 28 74 65 73 74   "id") )...(test
5a50: 73 20 20 28 72 64 62 3a 67 65 74 2d 74 65 73 74  s  (rdb:get-test
5a60: 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 62  s-for-run db (db
5a70: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65  :get-value-by-he
5a80: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20  ader run header 
5a90: 22 69 64 22 29 20 74 65 73 74 70 61 74 74 20 69  "id") testpatt i
5aa0: 74 65 6d 70 61 74 74 20 27 28 29 20 27 28 29 29  tempatt '() '())
5ab0: 29 0a 09 09 28 6c 61 73 74 74 70 61 74 68 20 22  )...(lasttpath "
5ac0: 2f 64 6f 65 73 2f 6e 6f 74 2f 65 78 69 73 74 2f  /does/not/exist/
5ad0: 49 2f 68 6f 70 65 22 29 29 0a 0a 09 20 20 20 28  I/hope"))...   (
5ae0: 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74  if (not (null? t
5af0: 65 73 74 73 29 29 0a 09 20 20 20 20 20 20 20 28  ests))..       (
5b00: 62 65 67 69 6e 0a 09 09 20 28 64 65 62 75 67 3a  begin... (debug:
5b10: 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e  print 1 "Removin
5b20: 67 20 74 65 73 74 73 20 66 6f 72 20 72 75 6e 3a  g tests for run:
5b30: 20 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64   " runkey " " (d
5b40: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68  b:get-value-by-h
5b50: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72  eader run header
5b60: 20 22 72 75 6e 6e 61 6d 65 22 29 29 0a 09 09 20   "runname"))... 
5b70: 28 66 6f 72 2d 65 61 63 68 0a 09 09 20 20 28 6c  (for-each...  (l
5b80: 61 6d 62 64 61 20 28 74 65 73 74 29 0a 09 09 20  ambda (test)... 
5b90: 20 20 20 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d     (let* ((item-
5ba0: 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65  path (db:test-ge
5bb0: 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74  t-item-path test
5bc0: 29 29 0a 09 09 09 20 20 20 28 74 65 73 74 2d 6e  ))....   (test-n
5bd0: 61 6d 65 20 28 64 62 3a 74 65 73 74 2d 67 65 74  ame (db:test-get
5be0: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29 29  -testname test))
5bf0: 0a 09 09 09 20 20 20 28 72 75 6e 2d 64 69 72 20  ....   (run-dir 
5c00: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72    (db:test-get-r
5c10: 75 6e 64 69 72 20 74 65 73 74 29 29 29 0a 09 09  undir test)))...
5c20: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
5c30: 6e 74 20 31 20 22 20 20 22 20 28 64 62 3a 74 65  nt 1 "  " (db:te
5c40: 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20  st-get-testname 
5c50: 74 65 73 74 29 20 22 20 69 64 3a 20 22 20 28 64  test) " id: " (d
5c60: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65  b:test-get-id te
5c70: 73 74 29 20 22 20 22 20 69 74 65 6d 2d 70 61 74  st) " " item-pat
5c80: 68 29 0a 09 09 20 20 20 20 20 20 28 72 64 62 3a  h)...      (rdb:
5c90: 64 65 6c 65 74 65 2d 74 65 73 74 2d 72 65 63 6f  delete-test-reco
5ca0: 72 64 73 20 64 62 20 28 64 62 3a 74 65 73 74 2d  rds db (db:test-
5cb0: 67 65 74 2d 69 64 20 74 65 73 74 29 29 0a 09 09  get-id test))...
5cc0: 20 20 20 20 20 20 28 69 66 20 28 3e 20 28 73 74        (if (> (st
5cd0: 72 69 6e 67 2d 6c 65 6e 67 74 68 20 72 75 6e 2d  ring-length run-
5ce0: 64 69 72 29 20 35 29 20 3b 3b 20 62 61 64 20 68  dir) 5) ;; bad h
5cf0: 65 75 72 69 73 74 69 63 20 62 75 74 20 73 68 6f  euristic but sho
5d00: 75 6c 64 20 70 72 65 76 65 6e 74 20 2f 74 6d 70  uld prevent /tmp
5d10: 20 2f 68 6f 6d 65 20 65 74 63 2e 0a 09 09 09 20   /home etc..... 
5d20: 20 28 6c 65 74 20 28 28 66 75 6c 6c 70 61 74 68   (let ((fullpath
5d30: 20 72 75 6e 2d 64 69 72 29 29 20 3b 3b 20 22 2f   run-dir)) ;; "/
5d40: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  " (db:test-get-i
5d50: 74 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29 29  tem-path test)))
5d60: 29 0a 09 09 09 20 20 20 20 28 73 65 74 21 20 6c  )....    (set! l
5d70: 61 73 74 74 70 61 74 68 20 66 75 6c 6c 70 61 74  asttpath fullpat
5d80: 68 29 0a 09 09 09 20 20 20 20 28 68 61 73 68 2d  h)....    (hash-
5d90: 74 61 62 6c 65 2d 73 65 74 21 20 64 69 72 73 2d  table-set! dirs-
5da0: 74 6f 2d 72 65 6d 6f 76 65 20 66 75 6c 6c 70 61  to-remove fullpa
5db0: 74 68 20 23 74 29 0a 09 09 09 20 20 20 20 3b 3b  th #t)....    ;;
5dc0: 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 77   The following w
5dd0: 61 73 20 74 68 65 20 73 61 66 65 20 64 65 6c 65  as the safe dele
5de0: 74 65 20 63 6f 64 65 20 62 75 74 20 69 74 20 77  te code but it w
5df0: 61 73 20 6e 6f 74 20 62 65 69 6e 67 20 65 78 65  as not being exe
5e00: 63 74 75 74 65 64 2e 0a 09 09 09 20 20 20 20 3b  ctuted.....    ;
5e10: 3b 20 28 6c 65 74 2a 20 28 28 64 69 72 73 2d 63  ; (let* ((dirs-c
5e20: 6f 75 6e 74 20 28 2b 20 31 20 28 6c 65 6e 67 74  ount (+ 1 (lengt
5e30: 68 20 6b 65 79 73 29 28 6c 65 6e 67 74 68 20 28  h keys)(length (
5e40: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 69 74 65  string-split ite
5e50: 6d 2d 70 61 74 68 20 22 2f 22 29 29 29 29 0a 09  m-path "/"))))..
5e60: 09 09 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20  ..    ;;        
5e70: 28 64 69 72 2d 74 6f 2d 72 65 6d 20 28 67 65 74  (dir-to-rem (get
5e80: 2d 64 69 72 2d 75 70 2d 6e 20 66 75 6c 6c 70 61  -dir-up-n fullpa
5e90: 74 68 20 64 69 72 73 2d 63 6f 75 6e 74 29 29 0a  th dirs-count)).
5ea0: 09 09 09 20 20 20 20 3b 3b 20 20 20 20 20 20 20  ...    ;;       
5eb0: 20 28 72 65 6d 61 69 6e 69 6e 67 64 20 28 73 74   (remainingd (st
5ec0: 72 69 6e 67 2d 73 75 62 73 74 69 74 75 74 65 20  ring-substitute 
5ed0: 28 72 65 67 65 78 70 20 28 63 6f 6e 63 20 22 5e  (regexp (conc "^
5ee0: 22 20 64 69 72 2d 74 6f 2d 72 65 6d 20 22 2f 22  " dir-to-rem "/"
5ef0: 29 29 20 22 22 20 66 75 6c 6c 70 61 74 68 29 29  )) "" fullpath))
5f00: 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 20 20 20  ....    ;;      
5f10: 20 20 28 63 6d 64 20 28 63 6f 6e 63 20 22 63 64    (cmd (conc "cd
5f20: 20 22 20 64 69 72 2d 74 6f 2d 72 65 6d 20 22 3b   " dir-to-rem ";
5f30: 20 72 6d 64 69 72 20 2d 70 20 22 20 72 65 6d 61   rmdir -p " rema
5f40: 69 6e 69 6e 67 64 20 29 29 29 0a 09 09 09 20 20  iningd )))....  
5f50: 20 20 3b 3b 20 20 20 28 69 66 20 28 66 69 6c 65    ;;   (if (file
5f60: 2d 65 78 69 73 74 73 3f 20 66 75 6c 6c 70 61 74  -exists? fullpat
5f70: 68 29 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 20  h)....    ;;    
5f80: 20 20 20 28 62 65 67 69 6e 0a 09 09 09 20 20 20     (begin....   
5f90: 20 3b 3b 20 20 20 20 20 20 20 20 20 28 64 65 62   ;;         (deb
5fa0: 75 67 3a 70 72 69 6e 74 20 31 20 63 6d 64 29 0a  ug:print 1 cmd).
5fb0: 09 09 09 20 20 20 20 3b 3b 20 20 20 20 20 20 20  ...    ;;       
5fc0: 20 20 28 73 79 73 74 65 6d 20 63 6d 64 29 29 29    (system cmd)))
5fd0: 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 29 29 0a  ....    ;;   )).
5fe0: 09 09 09 20 20 20 20 29 29 29 29 0a 09 09 20 20  ...    ))))...  
5ff0: 20 20 74 65 73 74 73 29 29 29 0a 0a 09 20 20 20    tests)))...   
6000: 3b 3b 20 6c 6f 6f 6b 20 74 68 6f 75 67 68 20 74  ;; look though t
6010: 68 65 20 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76  he dirs-to-remov
6020: 65 20 66 6f 72 20 63 61 6e 64 69 64 61 74 65 73  e for candidates
6030: 20 66 6f 72 20 72 65 6d 6f 76 61 6c 2e 20 44 6f   for removal. Do
6040: 20 74 68 69 73 20 61 66 74 65 72 20 64 65 6c 65   this after dele
6050: 74 69 6e 67 20 74 68 65 20 72 65 63 6f 72 64 73  ting the records
6060: 0a 09 20 20 20 3b 3b 20 66 6f 72 20 65 61 63 68  ..   ;; for each
6070: 20 74 65 73 74 20 69 6e 20 63 61 73 65 20 77 65   test in case we
6080: 20 67 65 74 20 6b 69 6c 6c 65 64 2e 20 54 68 61   get killed. Tha
6090: 74 20 73 68 6f 75 6c 64 20 6d 69 6e 69 6d 69 7a  t should minimiz
60a0: 65 20 74 68 65 20 64 65 74 72 69 74 75 73 20 6c  e the detritus l
60b0: 65 66 74 20 6f 6e 20 64 69 73 6b 0a 09 20 20 20  eft on disk..   
60c0: 3b 3b 20 70 72 6f 63 65 73 73 20 74 68 65 20 64  ;; process the d
60d0: 69 72 73 20 66 72 6f 6d 20 6c 6f 6e 67 65 73 74  irs from longest
60e0: 20 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 74   string length t
60f0: 6f 20 73 68 6f 72 74 65 73 74 0a 09 20 20 20 28  o shortest..   (
6100: 66 6f 72 2d 65 61 63 68 20 0a 09 20 20 20 20 28  for-each ..    (
6110: 6c 61 6d 62 64 61 20 28 64 69 72 2d 74 6f 2d 72  lambda (dir-to-r
6120: 65 6d 6f 76 65 29 0a 09 20 20 20 20 20 20 28 69  emove)..      (i
6130: 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20  f (file-exists? 
6140: 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 29 0a 09  dir-to-remove)..
6150: 09 20 20 28 6c 65 74 20 28 28 64 69 72 2d 69 6e  .  (let ((dir-in
6160: 2d 64 62 20 27 28 29 29 29 0a 09 09 20 20 20 20  -db '()))...    
6170: 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63  (sqlite3:for-eac
6180: 68 2d 72 6f 77 0a 09 09 20 20 20 20 20 28 6c 61  h-row...     (la
6190: 6d 62 64 61 20 28 64 69 72 29 0a 09 09 20 20 20  mbda (dir)...   
61a0: 20 20 20 20 28 73 65 74 21 20 64 69 72 2d 69 6e      (set! dir-in
61b0: 2d 64 62 20 28 63 6f 6e 73 20 64 69 72 20 64 69  -db (cons dir di
61c0: 72 2d 69 6e 2d 64 62 29 29 29 0a 09 09 20 20 20  r-in-db)))...   
61d0: 20 20 64 62 20 22 53 45 4c 45 43 54 20 72 75 6e    db "SELECT run
61e0: 64 69 72 20 46 52 4f 4d 20 74 65 73 74 73 20 57  dir FROM tests W
61f0: 48 45 52 45 20 72 75 6e 64 69 72 20 4c 49 4b 45  HERE rundir LIKE
6200: 20 3f 3b 22 20 0a 09 09 20 20 20 20 20 28 63 6f   ?;" ...     (co
6210: 6e 63 20 22 25 22 20 64 69 72 2d 74 6f 2d 72 65  nc "%" dir-to-re
6220: 6d 6f 76 65 20 22 25 22 29 29 20 3b 3b 20 79 65  move "%")) ;; ye
6230: 73 2c 20 49 27 6d 20 67 6f 69 6e 67 20 74 6f 20  s, I'm going to 
6240: 62 61 69 6c 20 69 66 20 74 68 65 72 65 20 69 73  bail if there is
6250: 20 61 6e 79 74 68 69 6e 67 20 6c 69 6b 65 20 74   anything like t
6260: 68 69 73 20 64 69 72 20 69 6e 20 74 68 65 20 64  his dir in the d
6270: 62 0a 09 09 20 20 20 20 28 69 66 20 28 6e 75 6c  b...    (if (nul
6280: 6c 3f 20 64 69 72 2d 69 6e 2d 64 62 29 0a 09 09  l? dir-in-db)...
6290: 09 28 62 65 67 69 6e 0a 09 09 09 20 20 28 64 65  .(begin....  (de
62a0: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 52 65 6d  bug:print 2 "Rem
62b0: 6f 76 69 6e 67 20 64 69 72 65 63 74 6f 72 79 20  oving directory 
62c0: 77 69 74 68 20 7a 65 72 6f 20 64 62 20 72 65 66  with zero db ref
62d0: 65 72 65 6e 63 65 73 3a 20 22 20 64 69 72 2d 74  erences: " dir-t
62e0: 6f 2d 72 65 6d 6f 76 65 29 0a 09 09 09 20 20 28  o-remove)....  (
62f0: 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d  system (conc "rm
6300: 20 2d 72 66 20 22 20 64 69 72 2d 74 6f 2d 72 65   -rf " dir-to-re
6310: 6d 6f 76 65 29 29 0a 09 09 09 20 20 28 68 61 73  move))....  (has
6320: 68 2d 74 61 62 6c 65 2d 64 65 6c 65 74 65 21 20  h-table-delete! 
6330: 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 64  dirs-to-remove d
6340: 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 29 29 0a 09  ir-to-remove))..
6350: 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32  ..(debug:print 2
6360: 20 22 53 6b 69 70 70 69 6e 67 20 72 65 6d 6f 76   "Skipping remov
6370: 61 6c 20 6f 66 20 22 20 64 69 72 2d 74 6f 2d 72  al of " dir-to-r
6380: 65 6d 6f 76 65 20 22 20 66 6f 72 20 6e 6f 77 20  emove " for now 
6390: 61 73 20 69 74 20 73 74 69 6c 6c 20 68 61 73 20  as it still has 
63a0: 72 65 66 65 72 65 6e 63 65 73 20 69 6e 20 74 68  references in th
63b0: 65 20 64 61 74 61 62 61 73 65 22 29 29 29 29 29  e database")))))
63c0: 0a 09 20 20 20 20 28 73 6f 72 74 20 28 68 61 73  ..    (sort (has
63d0: 68 2d 74 61 62 6c 65 2d 6b 65 79 73 20 64 69 72  h-table-keys dir
63e0: 73 2d 74 6f 2d 72 65 6d 6f 76 65 29 20 28 6c 61  s-to-remove) (la
63f0: 6d 62 64 61 20 28 61 20 62 29 28 3e 20 28 73 74  mbda (a b)(> (st
6400: 72 69 6e 67 2d 6c 65 6e 67 74 68 20 61 29 28 73  ring-length a)(s
6410: 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 62 29 29  tring-length b))
6420: 29 29 29 0a 0a 09 20 20 20 3b 3b 20 72 65 6d 6f  )))...   ;; remo
6430: 76 65 20 74 68 65 20 72 75 6e 20 69 66 20 7a 65  ve the run if ze
6440: 72 6f 20 74 65 73 74 73 20 72 65 6d 61 69 6e 0a  ro tests remain.
6450: 09 20 20 20 28 6c 65 74 20 28 28 72 65 6d 74 65  .   (let ((remte
6460: 73 74 73 20 28 72 64 62 3a 67 65 74 2d 74 65 73  sts (rdb:get-tes
6470: 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28 64  ts-for-run db (d
6480: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68  b:get-value-by-h
6490: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72  eader run header
64a0: 20 22 69 64 22 29 20 23 66 20 23 66 20 27 28 29   "id") #f #f '()
64b0: 20 27 28 29 29 29 29 0a 09 20 20 20 20 20 28 69   '())))..     (i
64c0: 66 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74  f (null? remtest
64d0: 73 29 20 3b 3b 20 6e 6f 20 6d 6f 72 65 20 74 65  s) ;; no more te
64e0: 73 74 73 20 72 65 6d 61 69 6e 69 6e 67 0a 09 09  sts remaining...
64f0: 20 28 6c 65 74 2a 20 28 28 64 70 61 72 74 73 20   (let* ((dparts 
6500: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 6c   (string-split l
6510: 61 73 74 74 70 61 74 68 20 22 2f 22 29 29 0a 09  asttpath "/"))..
6520: 09 09 28 72 75 6e 70 61 74 68 20 28 63 6f 6e 63  ..(runpath (conc
6530: 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74   "/" (string-int
6540: 65 72 73 70 65 72 73 65 20 0a 09 09 09 09 09 20  ersperse ...... 
6550: 20 20 20 28 74 61 6b 65 20 64 70 61 72 74 73 20     (take dparts 
6560: 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74  (- (length dpart
6570: 73 29 20 31 29 29 0a 09 09 09 09 09 20 20 20 20  s) 1))......    
6580: 22 2f 22 29 29 29 29 0a 09 09 20 20 20 28 64 65  "/"))))...   (de
6590: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d  bug:print 1 "Rem
65a0: 6f 76 69 6e 67 20 72 75 6e 3a 20 22 20 72 75 6e  oving run: " run
65b0: 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d  key " " (db:get-
65c0: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20  value-by-header 
65d0: 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e  run header "runn
65e0: 61 6d 65 22 29 29 0a 09 09 20 20 20 28 64 62 3a  ame"))...   (db:
65f0: 64 65 6c 65 74 65 2d 72 75 6e 20 64 62 20 72 75  delete-run db ru
6600: 6e 2d 69 64 29 0a 09 09 20 20 20 3b 3b 20 6e 65  n-id)...   ;; ne
6610: 65 64 20 74 6f 20 66 69 67 75 72 65 20 6f 75 74  ed to figure out
6620: 20 74 68 65 20 70 61 74 68 20 74 6f 20 74 68 65   the path to the
6630: 20 72 75 6e 20 64 69 72 20 61 6e 64 20 72 65 6d   run dir and rem
6640: 6f 76 65 20 69 74 20 69 66 20 65 6d 70 74 79 0a  ove it if empty.
6650: 09 09 20 20 20 3b 3b 20 20 20 20 28 69 66 20 28  ..   ;;    (if (
6660: 6e 75 6c 6c 3f 20 28 67 6c 6f 62 20 28 63 6f 6e  null? (glob (con
6670: 63 20 72 75 6e 70 61 74 68 20 22 2f 2a 22 29 29  c runpath "/*"))
6680: 29 0a 09 09 20 20 20 3b 3b 20 20 20 20 20 20 20  )...   ;;       
6690: 20 28 62 65 67 69 6e 0a 09 09 20 20 20 3b 3b 20   (begin...   ;; 
66a0: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31  . (debug:print 1
66b0: 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 20 64   "Removing run d
66c0: 69 72 20 22 20 72 75 6e 70 61 74 68 29 0a 09 09  ir " runpath)...
66d0: 20 20 20 3b 3b 20 09 20 28 73 79 73 74 65 6d 20     ;; . (system 
66e0: 28 63 6f 6e 63 20 22 72 6d 64 69 72 20 2d 70 20  (conc "rmdir -p 
66f0: 22 20 72 75 6e 70 61 74 68 29 29 29 29 0a 09 09  " runpath))))...
6700: 20 20 20 29 29 29 29 0a 09 20 29 29 0a 20 20 20     )))).. )).   
6710: 20 20 72 75 6e 73 29 29 29 0a 0a 3b 3b 3d 3d 3d    runs)))..;;===
6720: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6730: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6740: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6750: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6760: 3d 3d 3d 0a 3b 3b 20 52 6f 75 74 69 6e 65 73 20  ===.;; Routines 
6770: 66 6f 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67  for manipulating
6780: 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d   runs.;;========
6790: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
67a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
67b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
67c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a  ==============..
67d0: 3b 3b 20 53 69 6e 63 65 20 6d 61 6e 79 20 63 61  ;; Since many ca
67e0: 6c 6c 73 20 74 6f 20 61 20 72 75 6e 20 72 65 71  lls to a run req
67f0: 75 69 72 65 20 70 72 65 74 74 79 20 6d 75 63 68  uire pretty much
6800: 20 74 68 65 20 73 61 6d 65 20 73 65 74 75 70 20   the same setup 
6810: 0a 3b 3b 20 74 68 69 73 20 77 72 61 70 70 65 72  .;; this wrapper
6820: 20 69 73 20 75 73 65 64 20 74 6f 20 72 65 64 75   is used to redu
6830: 63 65 20 74 68 65 20 72 65 70 6c 69 63 61 74 69  ce the replicati
6840: 6f 6e 20 6f 66 20 63 6f 64 65 0a 28 64 65 66 69  on of code.(defi
6850: 6e 65 20 28 67 65 6e 65 72 61 6c 2d 72 75 6e 2d  ne (general-run-
6860: 63 61 6c 6c 20 73 77 69 74 63 68 6e 61 6d 65 20  call switchname 
6870: 61 63 74 69 6f 6e 2d 64 65 73 63 20 70 72 6f 63  action-desc proc
6880: 29 0a 20 20 28 6c 65 74 20 28 28 72 75 6e 6e 61  ).  (let ((runna
6890: 6d 65 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  me (args:get-arg
68a0: 20 22 3a 72 75 6e 6e 61 6d 65 22 29 29 0a 09 28   ":runname"))..(
68b0: 74 61 72 67 65 74 20 20 28 69 66 20 28 61 72 67  target  (if (arg
68c0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67  s:get-arg "-targ
68d0: 65 74 22 29 0a 09 09 20 20 20 20 20 28 61 72 67  et")...     (arg
68e0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67  s:get-arg "-targ
68f0: 65 74 22 29 0a 09 09 20 20 20 20 20 28 61 72 67  et")...     (arg
6900: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74  s:get-arg "-reqt
6910: 61 72 67 22 29 29 29 0a 09 28 74 68 31 20 20 20  arg")))..(th1   
6920: 20 20 23 66 29 29 0a 20 20 20 20 28 63 6f 6e 64    #f)).    (cond
6930: 0a 20 20 20 20 20 28 28 6e 6f 74 20 74 61 72 67  .     ((not targ
6940: 65 74 29 0a 20 20 20 20 20 20 28 64 65 62 75 67  et).      (debug
6950: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a  :print 0 "ERROR:
6960: 20 4d 69 73 73 69 6e 67 20 72 65 71 75 69 72 65   Missing require
6970: 64 20 70 61 72 61 6d 65 74 65 72 20 66 6f 72 20  d parameter for 
6980: 22 20 73 77 69 74 63 68 6e 61 6d 65 20 22 2c 20  " switchname ", 
6990: 79 6f 75 20 6d 75 73 74 20 73 70 65 63 69 66 79  you must specify
69a0: 20 74 68 65 20 74 61 72 67 65 74 20 77 69 74 68   the target with
69b0: 20 2d 74 61 72 67 65 74 22 29 0a 20 20 20 20 20   -target").     
69c0: 20 28 65 78 69 74 20 33 29 29 0a 20 20 20 20 20   (exit 3)).     
69d0: 28 28 6e 6f 74 20 72 75 6e 6e 61 6d 65 29 0a 20  ((not runname). 
69e0: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
69f0: 74 20 30 20 22 45 52 52 4f 52 3a 20 4d 69 73 73  t 0 "ERROR: Miss
6a00: 69 6e 67 20 72 65 71 75 69 72 65 64 20 70 61 72  ing required par
6a10: 61 6d 65 74 65 72 20 66 6f 72 20 22 20 73 77 69  ameter for " swi
6a20: 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d  tchname ", you m
6a30: 75 73 74 20 73 70 65 63 69 66 79 20 74 68 65 20  ust specify the 
6a40: 72 75 6e 20 6e 61 6d 65 20 77 69 74 68 20 3a 72  run name with :r
6a50: 75 6e 6e 61 6d 65 20 72 75 6e 6e 61 6d 65 22 29  unname runname")
6a60: 0a 20 20 20 20 20 20 28 65 78 69 74 20 33 29 29  .      (exit 3))
6a70: 0a 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20  .     (else.    
6a80: 20 20 28 6c 65 74 20 28 28 64 62 20 20 20 23 66    (let ((db   #f
6a90: 29 0a 09 20 20 20 20 28 6b 65 79 73 20 23 66 29  )..    (keys #f)
6aa0: 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 73 65 74  )..(if (not (set
6ab0: 75 70 2d 66 6f 72 2d 72 75 6e 29 29 0a 09 20 20  up-for-run))..  
6ac0: 20 20 28 62 65 67 69 6e 20 0a 09 20 20 20 20 20    (begin ..     
6ad0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20   (debug:print 0 
6ae0: 22 46 61 69 6c 65 64 20 74 6f 20 73 65 74 75 70  "Failed to setup
6af0: 2c 20 65 78 69 74 69 6e 67 22 29 0a 09 20 20 20  , exiting")..   
6b00: 20 20 20 28 65 78 69 74 20 31 29 29 29 0a 09 28     (exit 1)))..(
6b10: 73 65 74 21 20 64 62 20 20 20 28 6f 70 65 6e 2d  set! db   (open-
6b20: 64 62 29 29 0a 09 28 69 66 20 28 61 72 67 73 3a  db))..(if (args:
6b30: 67 65 74 2d 61 72 67 20 22 2d 73 65 72 76 65 72  get-arg "-server
6b40: 22 29 0a 09 20 20 20 20 28 73 65 72 76 65 72 3a  ")..    (server:
6b50: 73 74 61 72 74 20 64 62 20 28 61 72 67 73 3a 67  start db (args:g
6b60: 65 74 2d 61 72 67 20 22 2d 73 65 72 76 65 72 22  et-arg "-server"
6b70: 29 29 0a 09 20 20 20 20 28 69 66 20 28 6e 6f 74  ))..    (if (not
6b80: 20 28 6f 72 20 28 61 72 67 73 3a 67 65 74 2d 61   (or (args:get-a
6b90: 72 67 20 22 2d 72 75 6e 61 6c 6c 22 29 0a 09 09  rg "-runall")...
6ba0: 09 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  .  (args:get-arg
6bb0: 20 22 2d 72 75 6e 74 65 73 74 73 22 29 29 29 0a   "-runtests"))).
6bc0: 09 09 28 73 65 74 21 20 74 68 31 20 28 73 65 72  ..(set! th1 (ser
6bd0: 76 65 72 3a 63 6c 69 65 6e 74 2d 73 65 74 75 70  ver:client-setup
6be0: 20 64 62 29 29 29 29 0a 09 28 73 65 74 21 20 6b   db))))..(set! k
6bf0: 65 79 73 20 28 72 64 62 3a 67 65 74 2d 6b 65 79  eys (rdb:get-key
6c00: 73 20 64 62 29 29 0a 09 3b 3b 20 68 61 76 65 20  s db))..;; have 
6c10: 65 6e 6f 75 67 68 20 74 6f 20 70 72 6f 63 65 73  enough to proces
6c20: 73 20 2d 74 61 72 67 65 74 20 6f 72 20 2d 72 65  s -target or -re
6c30: 71 74 61 72 67 20 68 65 72 65 0a 09 28 69 66 20  qtarg here..(if 
6c40: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
6c50: 72 65 71 74 61 72 67 22 29 0a 09 20 20 20 20 28  reqtarg")..    (
6c60: 6c 65 74 2a 20 28 28 72 75 6e 63 6f 6e 66 69 67  let* ((runconfig
6c70: 66 20 28 63 6f 6e 63 20 20 2a 74 6f 70 70 61 74  f (conc  *toppat
6c80: 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 69 67 73 2e  h* "/runconfigs.
6c90: 63 6f 6e 66 69 67 22 29 29 20 3b 3b 20 44 4f 20  config")) ;; DO 
6ca0: 4e 4f 54 20 45 56 41 4c 55 41 54 45 20 41 4c 4c  NOT EVALUATE ALL
6cb0: 20 0a 09 09 20 20 20 28 72 75 6e 63 6f 6e 66 69   ...   (runconfi
6cc0: 67 20 20 28 72 65 61 64 2d 63 6f 6e 66 69 67 20  g  (read-config 
6cd0: 72 75 6e 63 6f 6e 66 69 67 66 20 23 66 20 23 66  runconfigf #f #f
6ce0: 20 65 6e 76 69 72 6f 6e 2d 70 61 74 74 3a 20 23   environ-patt: #
6cf0: 66 29 29 29 20 0a 09 20 20 20 20 20 20 28 69 66  f))) ..      (if
6d00: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66   (hash-table-ref
6d10: 2f 64 65 66 61 75 6c 74 20 72 75 6e 63 6f 6e 66  /default runconf
6d20: 69 67 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  ig (args:get-arg
6d30: 20 22 2d 72 65 71 74 61 72 67 22 29 20 23 66 29   "-reqtarg") #f)
6d40: 0a 09 09 20 20 28 6b 65 79 73 3a 74 61 72 67 65  ...  (keys:targe
6d50: 74 2d 73 65 74 2d 61 72 67 73 20 6b 65 79 73 20  t-set-args keys 
6d60: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d  (args:get-arg "-
6d70: 72 65 71 74 61 72 67 22 29 20 61 72 67 73 3a 61  reqtarg") args:a
6d80: 72 67 2d 68 61 73 68 29 0a 09 09 20 20 28 62 65  rg-hash)...  (be
6d90: 67 69 6e 0a 09 09 20 20 20 20 28 64 65 62 75 67  gin...    (debug
6da0: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a  :print 0 "ERROR:
6db0: 20 5b 22 20 28 61 72 67 73 3a 67 65 74 2d 61 72   [" (args:get-ar
6dc0: 67 20 22 2d 72 65 71 74 61 72 67 22 29 20 22 5d  g "-reqtarg") "]
6dd0: 20 6e 6f 74 20 66 6f 75 6e 64 20 69 6e 20 22 20   not found in " 
6de0: 72 75 6e 63 6f 6e 66 69 67 66 29 0a 09 09 20 20  runconfigf)...  
6df0: 20 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c    (sqlite3:final
6e00: 69 7a 65 21 20 64 62 29 0a 09 09 20 20 20 20 28  ize! db)...    (
6e10: 65 78 69 74 20 31 29 29 29 29 0a 09 20 20 20 20  exit 1))))..    
6e20: 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72  (if (args:get-ar
6e30: 67 20 22 2d 74 61 72 67 65 74 22 29 0a 09 09 28  g "-target")...(
6e40: 6b 65 79 73 3a 74 61 72 67 65 74 2d 73 65 74 2d  keys:target-set-
6e50: 61 72 67 73 20 6b 65 79 73 20 28 61 72 67 73 3a  args keys (args:
6e60: 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74  get-arg "-target
6e70: 22 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29  " args:arg-hash)
6e80: 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 29   args:arg-hash))
6e90: 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 63 61 72  )..(if (not (car
6ea0: 20 2a 63 6f 6e 66 69 67 69 6e 66 6f 2a 29 29 0a   *configinfo*)).
6eb0: 09 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20  .    (begin..   
6ec0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
6ed0: 30 20 22 45 52 52 4f 52 3a 20 41 74 74 65 6d 70  0 "ERROR: Attemp
6ee0: 74 65 64 20 74 6f 20 22 20 61 63 74 69 6f 6e 2d  ted to " action-
6ef0: 64 65 73 63 20 22 20 62 75 74 20 72 75 6e 20 61  desc " but run a
6f00: 72 65 61 20 63 6f 6e 66 69 67 20 66 69 6c 65 20  rea config file 
6f10: 6e 6f 74 20 66 6f 75 6e 64 22 29 0a 09 20 20 20  not found")..   
6f20: 20 20 20 28 65 78 69 74 20 31 29 29 0a 09 20 20     (exit 1))..  
6f30: 20 20 3b 3b 20 45 78 74 72 61 63 74 20 6f 75 74    ;; Extract out
6f40: 20 73 74 75 66 66 20 6e 65 65 64 65 64 20 69 6e   stuff needed in
6f50: 20 6d 6f 73 74 20 6f 72 20 6d 61 6e 79 20 63 61   most or many ca
6f60: 6c 6c 73 0a 09 20 20 20 20 3b 3b 20 68 65 72 65  lls..    ;; here
6f70: 20 74 68 65 6e 20 63 61 6c 6c 20 70 72 6f 63 0a   then call proc.
6f80: 09 20 20 20 20 28 6c 65 74 2a 20 28 28 6b 65 79  .    (let* ((key
6f90: 6e 61 6d 65 73 20 20 20 28 6d 61 70 20 6b 65 79  names   (map key
6fa0: 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b  :get-fieldname k
6fb0: 65 79 73 29 29 0a 09 09 20 20 20 28 6b 65 79 76  eys))...   (keyv
6fc0: 61 6c 6c 73 74 20 20 28 6b 65 79 73 2d 3e 76 61  allst  (keys->va
6fd0: 6c 6c 69 73 74 20 6b 65 79 73 20 23 74 29 29 29  llist keys #t)))
6fe0: 0a 09 20 20 20 20 20 20 28 70 72 6f 63 20 64 62  ..      (proc db
6ff0: 20 74 61 72 67 65 74 20 72 75 6e 6e 61 6d 65 20   target runname 
7000: 6b 65 79 73 20 6b 65 79 6e 61 6d 65 73 20 6b 65  keys keynames ke
7010: 79 76 61 6c 6c 73 74 29 29 29 0a 09 28 69 66 20  yvallst)))..(if 
7020: 74 68 31 20 28 74 68 72 65 61 64 2d 6a 6f 69 6e  th1 (thread-join
7030: 21 20 74 68 31 29 29 0a 09 28 73 71 6c 69 74 65  ! th1))..(sqlite
7040: 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 29 0a  3:finalize! db).
7050: 09 28 73 65 74 21 20 2a 64 69 64 73 6f 6d 65 74  .(set! *didsomet
7060: 68 69 6e 67 2a 20 23 74 29 29 29 29 29 29 0a 0a  hing* #t))))))..
7070: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;;==============
7080: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7090: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
70a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
70b0: 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 6c 6c  ========.;; Roll
70c0: 75 70 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d  up runs.;;======
70d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
70e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
70f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7100: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7110: 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74 68 65 20  ..;; Update the 
7120: 74 65 73 74 5f 6d 65 74 61 20 74 61 62 6c 65 20  test_meta table 
7130: 66 6f 72 20 74 68 69 73 20 74 65 73 74 0a 28 64  for this test.(d
7140: 65 66 69 6e 65 20 28 72 75 6e 73 3a 75 70 64 61  efine (runs:upda
7150: 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20  te-test_meta db 
7160: 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63  test-name test-c
7170: 6f 6e 66 29 0a 20 20 28 6c 65 74 20 28 28 63 75  onf).  (let ((cu
7180: 72 72 72 65 63 6f 72 64 20 28 64 62 3a 74 65 73  rrrecord (db:tes
7190: 74 6d 65 74 61 2d 67 65 74 2d 72 65 63 6f 72 64  tmeta-get-record
71a0: 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 29 29 29   db test-name)))
71b0: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 63 75  .    (if (not cu
71c0: 72 72 72 65 63 6f 72 64 29 0a 09 28 62 65 67 69  rrrecord)..(begi
71d0: 6e 0a 09 20 20 28 73 65 74 21 20 63 75 72 72 72  n..  (set! currr
71e0: 65 63 6f 72 64 20 28 6d 61 6b 65 2d 76 65 63 74  ecord (make-vect
71f0: 6f 72 20 31 30 20 23 66 29 29 0a 09 20 20 28 64  or 10 #f))..  (d
7200: 62 3a 74 65 73 74 6d 65 74 61 2d 61 64 64 2d 72  b:testmeta-add-r
7210: 65 63 6f 72 64 20 64 62 20 74 65 73 74 2d 6e 61  ecord db test-na
7220: 6d 65 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65  me))).    (for-e
7230: 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64  ach .     (lambd
7240: 61 20 28 6b 65 79 29 0a 20 20 20 20 20 20 20 28  a (key).       (
7250: 6c 65 74 2a 20 28 28 69 64 78 20 28 63 61 64 72  let* ((idx (cadr
7260: 20 6b 65 79 29 29 0a 09 20 20 20 20 20 20 28 66   key))..      (f
7270: 6c 64 20 28 63 61 72 20 20 6b 65 79 29 29 0a 09  ld (car  key))..
7280: 20 20 20 20 20 20 28 76 61 6c 20 28 63 6f 6e 66        (val (conf
7290: 69 67 2d 6c 6f 6f 6b 75 70 20 74 65 73 74 2d 63  ig-lookup test-c
72a0: 6f 6e 66 20 22 74 65 73 74 5f 6d 65 74 61 22 20  onf "test_meta" 
72b0: 66 6c 64 29 29 29 0a 09 20 3b 3b 20 28 64 65 62  fld))).. ;; (deb
72c0: 75 67 3a 70 72 69 6e 74 20 35 20 22 69 64 78 3a  ug:print 5 "idx:
72d0: 20 22 20 69 64 78 20 22 20 66 6c 64 3a 20 22 20   " idx " fld: " 
72e0: 66 6c 64 20 22 20 76 61 6c 3a 20 22 20 76 61 6c  fld " val: " val
72f0: 29 0a 09 20 28 69 66 20 28 61 6e 64 20 76 61 6c  ).. (if (and val
7300: 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 28 76   (not (equal? (v
7310: 65 63 74 6f 72 2d 72 65 66 20 63 75 72 72 72 65  ector-ref currre
7320: 63 6f 72 64 20 69 64 78 29 20 76 61 6c 29 29 29  cord idx) val)))
7330: 0a 09 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20  ..     (begin.. 
7340: 20 20 20 20 20 20 28 70 72 69 6e 74 20 22 55 70        (print "Up
7350: 64 61 74 69 6e 67 20 22 20 74 65 73 74 2d 6e 61  dating " test-na
7360: 6d 65 20 22 20 22 20 66 6c 64 20 22 20 74 6f 20  me " " fld " to 
7370: 22 20 76 61 6c 29 0a 09 20 20 20 20 20 20 20 28  " val)..       (
7380: 64 62 3a 74 65 73 74 6d 65 74 61 2d 75 70 64 61  db:testmeta-upda
7390: 74 65 2d 66 69 65 6c 64 20 64 62 20 74 65 73 74  te-field db test
73a0: 2d 6e 61 6d 65 20 66 6c 64 20 76 61 6c 29 29 29  -name fld val)))
73b0: 29 29 0a 20 20 20 20 20 27 28 28 22 61 75 74 68  )).     '(("auth
73c0: 6f 72 22 20 32 29 28 22 6f 77 6e 65 72 22 20 33  or" 2)("owner" 3
73d0: 29 28 22 64 65 73 63 72 69 70 74 69 6f 6e 22 20  )("description" 
73e0: 34 29 28 22 72 65 76 69 65 77 65 64 22 20 35 29  4)("reviewed" 5)
73f0: 28 22 74 61 67 73 22 20 39 29 29 29 29 29 0a 0a  ("tags" 9)))))..
7400: 3b 3b 20 55 70 64 61 74 65 20 74 65 73 74 5f 6d  ;; Update test_m
7410: 65 74 61 20 66 6f 72 20 61 6c 6c 20 74 65 73 74  eta for all test
7420: 73 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a  s.(define (runs:
7430: 75 70 64 61 74 65 2d 61 6c 6c 2d 74 65 73 74 5f  update-all-test_
7440: 6d 65 74 61 20 64 62 29 0a 20 20 28 6c 65 74 20  meta db).  (let 
7450: 28 28 74 65 73 74 2d 6e 61 6d 65 73 20 28 67 65  ((test-names (ge
7460: 74 2d 61 6c 6c 2d 6c 65 67 61 6c 2d 74 65 73 74  t-all-legal-test
7470: 73 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61  s))).    (for-ea
7480: 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61  ch .     (lambda
7490: 20 28 74 65 73 74 2d 6e 61 6d 65 29 0a 20 20 20   (test-name).   
74a0: 20 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74      (let* ((test
74b0: 2d 70 61 74 68 20 20 20 20 28 63 6f 6e 63 20 2a  -path    (conc *
74c0: 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73  toppath* "/tests
74d0: 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29 29 0a 09  /" test-name))..
74e0: 20 20 20 20 20 20 28 74 65 73 74 2d 63 6f 6e 66        (test-conf
74f0: 69 67 66 20 28 63 6f 6e 63 20 74 65 73 74 2d 70  igf (conc test-p
7500: 61 74 68 20 22 2f 74 65 73 74 63 6f 6e 66 69 67  ath "/testconfig
7510: 22 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 74  "))..      (test
7520: 65 78 69 73 74 73 20 20 20 28 61 6e 64 20 28 66  exists   (and (f
7530: 69 6c 65 2d 65 78 69 73 74 73 3f 20 74 65 73 74  ile-exists? test
7540: 2d 63 6f 6e 66 69 67 66 29 28 66 69 6c 65 2d 72  -configf)(file-r
7550: 65 61 64 2d 61 63 63 65 73 73 3f 20 74 65 73 74  ead-access? test
7560: 2d 63 6f 6e 66 69 67 66 29 29 29 0a 09 20 20 20  -configf)))..   
7570: 20 20 20 3b 3b 20 72 65 61 64 20 63 6f 6e 66 69     ;; read confi
7580: 67 73 20 77 69 74 68 20 74 72 69 63 6b 73 20 74  gs with tricks t
7590: 75 72 6e 65 64 20 6f 66 66 20 28 69 2e 65 2e 20  urned off (i.e. 
75a0: 6e 6f 20 73 79 73 74 65 6d 29 0a 09 20 20 20 20  no system)..    
75b0: 20 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 20    (test-conf    
75c0: 28 69 66 20 74 65 73 74 65 78 69 73 74 73 20 28  (if testexists (
75d0: 72 65 61 64 2d 63 6f 6e 66 69 67 20 74 65 73 74  read-config test
75e0: 2d 63 6f 6e 66 69 67 66 20 23 66 20 23 66 29 28  -configf #f #f)(
75f0: 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29  make-hash-table)
7600: 29 29 29 0a 09 20 28 72 75 6e 73 3a 75 70 64 61  ))).. (runs:upda
7610: 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20  te-test_meta db 
7620: 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63  test-name test-c
7630: 6f 6e 66 29 29 29 0a 20 20 20 20 20 74 65 73 74  onf))).     test
7640: 2d 6e 61 6d 65 73 29 29 29 0a 0a 3b 3b 20 54 68  -names)))..;; Th
7650: 69 73 20 63 6f 75 6c 64 20 70 72 6f 62 61 62 6c  is could probabl
7660: 79 20 62 65 20 72 65 66 61 63 74 6f 72 65 64 20  y be refactored 
7670: 69 6e 74 6f 20 6f 6e 65 20 63 6f 6d 70 6c 65 78  into one complex
7680: 20 71 75 65 72 79 20 2e 2e 2e 0a 28 64 65 66 69   query ....(defi
7690: 6e 65 20 28 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d  ne (runs:rollup-
76a0: 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76  run db keys keyv
76b0: 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 75 73  allst runname us
76c0: 65 72 29 20 3b 3b 20 77 61 73 20 74 61 72 67 65  er) ;; was targe
76d0: 74 2c 20 6e 6f 77 20 6b 65 79 76 61 6c 6c 73 74  t, now keyvallst
76e0: 0a 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  .  (debug:print 
76f0: 34 20 22 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72  4 "runs:rollup-r
7700: 75 6e 2c 20 6b 65 79 73 3a 20 22 20 6b 65 79 73  un, keys: " keys
7710: 20 22 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20   " keyvallst: " 
7720: 6b 65 79 76 61 6c 6c 73 74 20 22 20 3a 72 75 6e  keyvallst " :run
7730: 6e 61 6d 65 20 22 20 72 75 6e 6e 61 6d 65 20 22  name " runname "
7740: 20 75 73 65 72 3a 20 22 20 75 73 65 72 29 0a 20   user: " user). 
7750: 20 28 6c 65 74 2a 20 28 3b 20 28 6b 65 79 76 61   (let* (; (keyva
7760: 6c 6c 6c 73 74 20 20 20 20 20 20 28 6b 65 79 73  lllst      (keys
7770: 3a 74 61 72 67 65 74 2d 3e 6b 65 79 76 61 6c 20  :target->keyval 
7780: 6b 65 79 73 20 74 61 72 67 65 74 29 29 0a 09 20  keys target)).. 
7790: 28 6e 65 77 2d 72 75 6e 2d 69 64 20 20 20 20 20  (new-run-id     
77a0: 20 28 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d   (runs:register-
77b0: 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76  run db keys keyv
77c0: 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e  allst runname "n
77d0: 65 77 22 20 22 6e 2f 61 22 20 75 73 65 72 29 29  ew" "n/a" user))
77e0: 0a 09 20 28 70 72 65 76 2d 74 65 73 74 73 20 20  .. (prev-tests  
77f0: 20 20 20 20 28 74 65 73 74 3a 67 65 74 2d 6d 61      (test:get-ma
7800: 74 63 68 69 6e 67 2d 70 72 65 76 69 6f 75 73 2d  tching-previous-
7810: 74 65 73 74 2d 72 75 6e 2d 72 65 63 6f 72 64 73  test-run-records
7820: 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 22   db new-run-id "
7830: 25 22 20 22 25 22 29 29 0a 09 20 28 63 75 72 72  %" "%")).. (curr
7840: 2d 74 65 73 74 73 20 20 20 20 20 20 28 72 64 62  -tests      (rdb
7850: 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72  :get-tests-for-r
7860: 75 6e 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64  un db new-run-id
7870: 20 22 25 22 20 22 25 22 20 27 28 29 20 27 28 29   "%" "%" '() '()
7880: 29 29 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73  )).. (curr-tests
7890: 2d 68 61 73 68 20 28 6d 61 6b 65 2d 68 61 73 68  -hash (make-hash
78a0: 2d 74 61 62 6c 65 29 29 29 0a 20 20 20 20 28 64  -table))).    (d
78b0: 62 3a 75 70 64 61 74 65 2d 72 75 6e 2d 65 76 65  b:update-run-eve
78c0: 6e 74 5f 74 69 6d 65 20 64 62 20 6e 65 77 2d 72  nt_time db new-r
78d0: 75 6e 2d 69 64 29 0a 20 20 20 20 3b 3b 20 69 6e  un-id).    ;; in
78e0: 64 65 78 20 74 68 65 20 61 6c 72 65 61 64 79 20  dex the already 
78f0: 73 61 76 65 64 20 74 65 73 74 73 20 62 79 20 74  saved tests by t
7900: 65 73 74 6e 61 6d 65 20 61 6e 64 20 69 74 65 6d  estname and item
7910: 64 61 74 20 69 6e 20 63 75 72 72 2d 74 65 73 74  dat in curr-test
7920: 73 2d 68 61 73 68 0a 20 20 20 20 28 66 6f 72 2d  s-hash.    (for-
7930: 65 61 63 68 0a 20 20 20 20 20 28 6c 61 6d 62 64  each.     (lambd
7940: 61 20 28 74 65 73 74 64 61 74 29 0a 20 20 20 20  a (testdat).    
7950: 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 6e     (let* ((testn
7960: 61 6d 65 20 20 28 64 62 3a 74 65 73 74 2d 67 65  ame  (db:test-ge
7970: 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 64  t-testname testd
7980: 61 74 29 29 0a 09 20 20 20 20 20 20 28 69 74 65  at))..      (ite
7990: 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d  m-path (db:test-
79a0: 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65  get-item-path te
79b0: 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28  stdat))..      (
79c0: 66 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20  full-name (conc 
79d0: 74 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65  testname "/" ite
79e0: 6d 2d 70 61 74 68 29 29 29 0a 09 20 28 68 61 73  m-path))).. (has
79f0: 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72  h-table-set! cur
7a00: 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c  r-tests-hash ful
7a10: 6c 2d 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29  l-name testdat))
7a20: 29 0a 20 20 20 20 20 63 75 72 72 2d 74 65 73 74  ).     curr-test
7a30: 73 29 0a 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20  s).    ;; NOPE: 
7a40: 4e 6f 6e 2d 6f 70 74 69 6d 61 6c 20 61 70 70 72  Non-optimal appr
7a50: 6f 61 63 68 2e 20 54 72 79 20 74 68 69 73 20 69  oach. Try this i
7a60: 6e 73 74 65 61 64 2e 0a 20 20 20 20 3b 3b 20 20  nstead..    ;;  
7a70: 20 31 2e 20 74 65 73 74 73 20 61 72 65 20 72 65   1. tests are re
7a80: 63 65 69 76 65 64 20 69 6e 20 61 20 6c 69 73 74  ceived in a list
7a90: 2c 20 6d 6f 73 74 20 72 65 63 65 6e 74 20 66 69  , most recent fi
7aa0: 72 73 74 0a 20 20 20 20 3b 3b 20 20 20 32 2e 20  rst.    ;;   2. 
7ab0: 72 65 70 6c 61 63 65 20 74 68 65 20 72 6f 6c 6c  replace the roll
7ac0: 75 70 20 74 65 73 74 20 77 69 74 68 20 74 68 65  up test with the
7ad0: 20 6e 65 77 20 2a 61 6c 77 61 79 73 2a 0a 20 20   new *always*.  
7ae0: 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20    (for-each .   
7af0: 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 64    (lambda (testd
7b00: 61 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a  at).       (let*
7b10: 20 28 28 74 65 73 74 6e 61 6d 65 20 20 28 64 62   ((testname  (db
7b20: 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61  :test-get-testna
7b30: 6d 65 20 74 65 73 74 64 61 74 29 29 0a 09 20 20  me testdat))..  
7b40: 20 20 20 20 28 69 74 65 6d 2d 70 61 74 68 20 28      (item-path (
7b50: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d  db:test-get-item
7b60: 2d 70 61 74 68 20 74 65 73 74 64 61 74 29 29 0a  -path testdat)).
7b70: 09 20 20 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d  .      (full-nam
7b80: 65 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65  e (conc testname
7b90: 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29   "/" item-path))
7ba0: 0a 09 20 20 20 20 20 20 28 70 72 65 76 2d 74 65  ..      (prev-te
7bb0: 73 74 2d 64 61 74 20 28 68 61 73 68 2d 74 61 62  st-dat (hash-tab
7bc0: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63  le-ref/default c
7bd0: 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66  urr-tests-hash f
7be0: 75 6c 6c 2d 6e 61 6d 65 20 23 66 29 29 0a 09 20  ull-name #f)).. 
7bf0: 20 20 20 20 20 28 74 65 73 74 2d 73 74 65 70 73       (test-steps
7c00: 20 20 20 20 20 20 28 64 62 3a 67 65 74 2d 73 74        (db:get-st
7c10: 65 70 73 2d 66 6f 72 2d 74 65 73 74 20 64 62 20  eps-for-test db 
7c20: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20  (db:test-get-id 
7c30: 74 65 73 74 64 61 74 29 29 29 0a 09 20 20 20 20  testdat)))..    
7c40: 20 20 28 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f    (new-test-reco
7c50: 72 64 20 23 66 29 29 0a 09 20 3b 3b 20 72 65 70  rd #f)).. ;; rep
7c60: 6c 61 63 65 20 74 68 65 73 65 20 77 69 74 68 20  lace these with 
7c70: 69 6e 73 65 72 74 20 2e 2e 2e 20 73 65 6c 65 63  insert ... selec
7c80: 74 0a 09 20 28 61 70 70 6c 79 20 73 71 6c 69 74  t.. (apply sqlit
7c90: 65 33 3a 65 78 65 63 75 74 65 20 0a 09 09 64 62  e3:execute ...db
7ca0: 20 0a 09 09 28 63 6f 6e 63 20 22 49 4e 53 45 52   ...(conc "INSER
7cb0: 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54  T OR REPLACE INT
7cc0: 4f 20 74 65 73 74 73 20 28 72 75 6e 5f 69 64 2c  O tests (run_id,
7cd0: 74 65 73 74 6e 61 6d 65 2c 73 74 61 74 65 2c 73  testname,state,s
7ce0: 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65  tatus,event_time
7cf0: 2c 68 6f 73 74 2c 63 70 75 6c 6f 61 64 2c 64 69  ,host,cpuload,di
7d00: 73 6b 66 72 65 65 2c 75 6e 61 6d 65 2c 72 75 6e  skfree,uname,run
7d10: 64 69 72 2c 69 74 65 6d 5f 70 61 74 68 2c 72 75  dir,item_path,ru
7d20: 6e 5f 64 75 72 61 74 69 6f 6e 2c 66 69 6e 61 6c  n_duration,final
7d30: 5f 6c 6f 67 66 2c 63 6f 6d 6d 65 6e 74 29 20 22  _logf,comment) "
7d40: 0a 09 09 20 20 20 20 20 20 22 56 41 4c 55 45 53  ...      "VALUES
7d50: 20 28 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c   (?,?,?,?,?,?,?,
7d60: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 29 3b 22  ?,?,?,?,?,?,?);"
7d70: 29 0a 09 09 6e 65 77 2d 72 75 6e 2d 69 64 20 28  )...new-run-id (
7d80: 63 64 64 72 20 28 76 65 63 74 6f 72 2d 3e 6c 69  cddr (vector->li
7d90: 73 74 20 74 65 73 74 64 61 74 29 29 29 0a 09 20  st testdat))).. 
7da0: 28 73 65 74 21 20 6e 65 77 2d 74 65 73 74 64 61  (set! new-testda
7db0: 74 20 28 63 61 72 20 28 72 64 62 3a 67 65 74 2d  t (car (rdb:get-
7dc0: 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62  tests-for-run db
7dd0: 20 6e 65 77 2d 72 75 6e 2d 69 64 20 74 65 73 74   new-run-id test
7de0: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 20 27  name item-path '
7df0: 28 29 20 27 28 29 29 29 29 0a 09 20 28 68 61 73  () '()))).. (has
7e00: 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72  h-table-set! cur
7e10: 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c  r-tests-hash ful
7e20: 6c 2d 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74 64  l-name new-testd
7e30: 61 74 29 20 3b 3b 20 74 68 69 73 20 63 6f 75 6c  at) ;; this coul
7e40: 64 20 62 65 20 63 6f 6e 66 75 73 69 6e 67 2c 20  d be confusing, 
7e50: 77 68 69 63 68 20 72 65 63 6f 72 64 20 73 68 6f  which record sho
7e60: 75 6c 64 20 67 6f 20 69 6e 74 6f 20 74 68 65 20  uld go into the 
7e70: 6c 6f 6f 6b 75 70 20 74 61 62 6c 65 3f 0a 09 20  lookup table?.. 
7e80: 3b 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65  ;; Now duplicate
7e90: 20 74 68 65 20 74 65 73 74 20 73 74 65 70 73 0a   the test steps.
7ea0: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34  . (debug:print 4
7eb0: 20 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64   "Copying record
7ec0: 73 20 69 6e 20 74 65 73 74 5f 73 74 65 70 73 20  s in test_steps 
7ed0: 66 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28  from test_id=" (
7ee0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74  db:test-get-id t
7ef0: 65 73 74 64 61 74 29 20 22 20 74 6f 20 22 20 28  estdat) " to " (
7f00: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e  db:test-get-id n
7f10: 65 77 2d 74 65 73 74 64 61 74 29 29 0a 09 20 28  ew-testdat)).. (
7f20: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20  sqlite3:execute 
7f30: 0a 09 20 20 64 62 20 0a 09 20 20 28 63 6f 6e 63  ..  db ..  (conc
7f40: 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c   "INSERT OR REPL
7f50: 41 43 45 20 49 4e 54 4f 20 74 65 73 74 5f 73 74  ACE INTO test_st
7f60: 65 70 73 20 28 74 65 73 74 5f 69 64 2c 73 74 65  eps (test_id,ste
7f70: 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74  pname,state,stat
7f80: 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f  us,event_time,co
7f90: 6d 6d 65 6e 74 29 20 22 0a 09 09 22 53 45 4c 45  mment) "..."SELE
7fa0: 43 54 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65  CT " (db:test-ge
7fb0: 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74  t-id new-testdat
7fc0: 29 20 22 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61  ) ",stepname,sta
7fd0: 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f  te,status,event_
7fe0: 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f  time,comment FRO
7ff0: 4d 20 74 65 73 74 5f 73 74 65 70 73 20 57 48 45  M test_steps WHE
8000: 52 45 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a  RE test_id=?;").
8010: 09 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  .  (db:test-get-
8020: 69 64 20 74 65 73 74 64 61 74 29 29 0a 09 20 3b  id testdat)).. ;
8030: 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20  ; Now duplicate 
8040: 74 68 65 20 74 65 73 74 20 64 61 74 61 0a 09 20  the test data.. 
8050: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22  (debug:print 4 "
8060: 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 73 20  Copying records 
8070: 69 6e 20 74 65 73 74 5f 64 61 74 61 20 66 72 6f  in test_data fro
8080: 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62 3a  m test_id=" (db:
8090: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74  test-get-id test
80a0: 64 61 74 29 20 22 20 74 6f 20 22 20 28 64 62 3a  dat) " to " (db:
80b0: 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d  test-get-id new-
80c0: 74 65 73 74 64 61 74 29 29 0a 09 20 28 73 71 6c  testdat)).. (sql
80d0: 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09 20  ite3:execute .. 
80e0: 20 64 62 20 0a 09 20 20 28 63 6f 6e 63 20 22 49   db ..  (conc "I
80f0: 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45  NSERT OR REPLACE
8100: 20 49 4e 54 4f 20 74 65 73 74 5f 64 61 74 61 20   INTO test_data 
8110: 28 74 65 73 74 5f 69 64 2c 63 61 74 65 67 6f 72  (test_id,categor
8120: 79 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65  y,variable,value
8130: 2c 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e  ,expected,tol,un
8140: 69 74 73 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09  its,comment) "..
8150: 09 22 53 45 4c 45 43 54 20 22 20 28 64 62 3a 74  ."SELECT " (db:t
8160: 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74  est-get-id new-t
8170: 65 73 74 64 61 74 29 20 22 2c 63 61 74 65 67 6f  estdat) ",catego
8180: 72 79 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75  ry,variable,valu
8190: 65 2c 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75  e,expected,tol,u
81a0: 6e 69 74 73 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f  nits,comment FRO
81b0: 4d 20 74 65 73 74 5f 64 61 74 61 20 57 48 45 52  M test_data WHER
81c0: 45 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09  E test_id=?;")..
81d0: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69    (db:test-get-i
81e0: 64 20 74 65 73 74 64 61 74 29 29 0a 09 20 29 29  d testdat)).. ))
81f0: 0a 20 20 20 20 20 70 72 65 76 2d 74 65 73 74 73  .     prev-tests
8200: 29 29 29 0a 09 20 0a 20 20 20 20 20 0a           ))).. .     .