Megatest

Hex Artifact Content
Login

Artifact 2ea5faddfc911de0e86703cdcfb2317a81bf1ea0:


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 28 61 6c 69 73 74  keys).    (alist
09b0: 2d 3e 65 6e 76 2d 76 61 72 73 20 28 68 61 73 68  ->env-vars (hash
09c0: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75  -table-ref/defau
09d0: 6c 74 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22  lt *configdat* "
09e0: 65 6e 76 2d 6f 76 65 72 72 69 64 65 22 20 27 28  env-override" '(
09f0: 29 29 29 0a 20 20 20 20 3b 3b 20 4c 65 74 73 20  ))).    ;; Lets 
0a00: 75 73 65 20 74 68 69 73 20 61 73 20 61 6e 20 6f  use this as an o
0a10: 70 70 6f 72 74 75 6e 69 74 79 20 74 6f 20 70 75  pportunity to pu
0a20: 74 20 4d 54 5f 52 55 4e 4e 41 4d 45 20 69 6e 20  t MT_RUNNAME in 
0a30: 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a  the environment.
0a40: 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66 6f 72      (sqlite3:for
0a50: 2d 65 61 63 68 2d 72 6f 77 0a 20 20 20 20 20 28  -each-row.     (
0a60: 6c 61 6d 62 64 61 20 28 72 75 6e 6e 61 6d 65 29  lambda (runname)
0a70: 0a 20 20 20 20 20 20 20 28 73 65 74 65 6e 76 20  .       (setenv 
0a80: 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 72 75 6e  "MT_RUNNAME" run
0a90: 6e 61 6d 65 29 29 0a 20 20 20 20 20 64 62 0a 20  name)).     db. 
0aa0: 20 20 20 20 22 53 45 4c 45 43 54 20 72 75 6e 6e      "SELECT runn
0ab0: 61 6d 65 20 46 52 4f 4d 20 72 75 6e 73 20 57 48  ame FROM runs WH
0ac0: 45 52 45 20 69 64 3d 3f 3b 22 0a 20 20 20 20 20  ERE id=?;".     
0ad0: 72 75 6e 2d 69 64 29 0a 20 20 20 20 29 29 0a 0a  run-id).    ))..
0ae0: 28 64 65 66 69 6e 65 20 28 73 65 74 2d 69 74 65  (define (set-ite
0af0: 6d 2d 65 6e 76 2d 76 61 72 73 20 69 74 65 6d 64  m-env-vars itemd
0b00: 61 74 29 0a 20 20 28 66 6f 72 2d 65 61 63 68 20  at).  (for-each 
0b10: 28 6c 61 6d 62 64 61 20 28 69 74 65 6d 29 0a 09  (lambda (item)..
0b20: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
0b30: 6e 74 20 32 20 22 73 65 74 65 6e 76 20 22 20 28  nt 2 "setenv " (
0b40: 63 61 72 20 69 74 65 6d 29 20 22 20 22 20 28 63  car item) " " (c
0b50: 61 64 72 20 69 74 65 6d 29 29 0a 09 20 20 20 20  adr item))..    
0b60: 20 20 28 73 65 74 65 6e 76 20 28 63 61 72 20 69    (setenv (car i
0b70: 74 65 6d 29 20 28 63 61 64 72 20 69 74 65 6d 29  tem) (cadr item)
0b80: 29 29 0a 09 20 20 20 20 69 74 65 6d 64 61 74 29  ))..    itemdat)
0b90: 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73  )..(define (runs
0ba0: 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65  :can-run-more-te
0bb0: 73 74 73 20 64 62 20 74 65 73 74 2d 72 65 63 6f  sts db test-reco
0bc0: 72 64 29 0a 20 20 28 6c 65 74 2a 20 28 28 74 63  rd).  (let* ((tc
0bd0: 6f 6e 66 69 67 20 20 20 20 20 20 20 20 20 20 20  onfig           
0be0: 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73        (tests:tes
0bf0: 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 63  tqueue-get-testc
0c00: 6f 6e 66 69 67 20 74 65 73 74 2d 72 65 63 6f 72  onfig test-recor
0c10: 64 29 29 0a 09 20 28 6a 6f 62 67 72 6f 75 70 20  d)).. (jobgroup 
0c20: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28                 (
0c30: 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 63  config-lookup tc
0c40: 6f 6e 66 69 67 20 22 72 65 71 75 69 72 65 6d 65  onfig "requireme
0c50: 6e 74 73 22 20 22 6a 6f 62 67 72 6f 75 70 22 29  nts" "jobgroup")
0c60: 29 0a 09 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67  ).. (num-running
0c70: 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 62               (db
0c80: 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 65 73 74 73  :get-count-tests
0c90: 2d 72 75 6e 6e 69 6e 67 20 64 62 29 29 0a 09 20  -running db)).. 
0ca0: 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d  (num-running-in-
0cb0: 6a 6f 62 67 72 6f 75 70 20 28 64 62 3a 67 65 74  jobgroup (db:get
0cc0: 2d 63 6f 75 6e 74 2d 74 65 73 74 73 2d 72 75 6e  -count-tests-run
0cd0: 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70  ning-in-jobgroup
0ce0: 20 64 62 20 6a 6f 62 67 72 6f 75 70 29 29 0a 09   db jobgroup))..
0cf0: 20 28 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74   (max-concurrent
0d00: 2d 6a 6f 62 73 20 20 20 20 20 28 63 6f 6e 66 69  -jobs     (confi
0d10: 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67  g-lookup *config
0d20: 64 61 74 2a 20 22 73 65 74 75 70 22 20 20 20 20  dat* "setup"    
0d30: 20 22 6d 61 78 5f 63 6f 6e 63 75 72 72 65 6e 74   "max_concurrent
0d40: 5f 6a 6f 62 73 22 29 29 0a 09 20 28 6a 6f 62 2d  _jobs")).. (job-
0d50: 67 72 6f 75 70 2d 6c 69 6d 69 74 20 20 20 20 20  group-limit     
0d60: 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b      (config-look
0d70: 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22  up *configdat* "
0d80: 6a 6f 62 67 72 6f 75 70 73 22 20 6a 6f 62 67 72  jobgroups" jobgr
0d90: 6f 75 70 29 29 29 0a 20 20 20 20 28 64 65 62 75  oup))).    (debu
0da0: 67 3a 70 72 69 6e 74 20 32 20 22 6d 61 78 2d 63  g:print 2 "max-c
0db0: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 3a 20  oncurrent-jobs: 
0dc0: 22 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74  " max-concurrent
0dd0: 2d 6a 6f 62 73 20 22 2c 20 6e 75 6d 2d 72 75 6e  -jobs ", num-run
0de0: 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e  ning: " num-runn
0df0: 69 6e 67 29 0a 20 20 20 20 28 69 66 20 28 6e 6f  ing).    (if (no
0e00: 74 20 28 65 71 3f 20 30 20 2a 67 6c 6f 62 61 6c  t (eq? 0 *global
0e10: 65 78 69 74 73 74 61 74 75 73 2a 29 29 0a 09 23  exitstatus*))..#
0e20: 66 0a 09 28 6c 65 74 20 28 28 63 61 6e 2d 6e 6f  f..(let ((can-no
0e30: 74 2d 72 75 6e 2d 6d 6f 72 65 20 28 63 6f 6e 64  t-run-more (cond
0e40: 0a 09 09 09 09 20 3b 3b 20 69 66 20 6d 61 78 2d  ..... ;; if max-
0e50: 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20  concurrent-jobs 
0e60: 69 73 20 73 65 74 20 61 6e 64 20 74 68 65 20 6e  is set and the n
0e70: 75 6d 62 65 72 20 72 75 6e 6e 69 6e 67 20 69 73  umber running is
0e80: 20 67 72 65 61 74 65 72 20 0a 09 09 09 09 20 3b   greater ..... ;
0e90: 3b 20 74 68 61 6e 20 69 74 20 74 68 61 6e 20 63  ; than it than c
0ea0: 61 6e 6e 6f 74 20 72 75 6e 20 6d 6f 72 65 20 6a  annot run more j
0eb0: 6f 62 73 0a 09 09 09 09 20 28 28 61 6e 64 20 6d  obs..... ((and m
0ec0: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f  ax-concurrent-jo
0ed0: 62 73 0a 09 09 09 09 20 20 20 20 20 20 20 28 73  bs.....       (s
0ee0: 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 61  tring->number ma
0ef0: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62  x-concurrent-job
0f00: 73 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 3e  s).....       (>
0f10: 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 28 73  = num-running (s
0f20: 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 61  tring->number ma
0f30: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62  x-concurrent-job
0f40: 73 29 29 29 0a 09 09 09 09 20 20 28 64 65 62 75  s))).....  (debu
0f50: 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49  g:print 0 "WARNI
0f60: 4e 47 3a 20 4d 61 78 20 72 75 6e 6e 69 6e 67 20  NG: Max running 
0f70: 6a 6f 62 73 20 65 78 63 65 65 64 65 64 2c 20 63  jobs exceeded, c
0f80: 75 72 72 65 6e 74 20 6e 75 6d 62 65 72 20 72 75  urrent number ru
0f90: 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e  nning: " num-run
0fa0: 6e 69 6e 67 20 0a 09 09 09 09 09 20 20 20 20 20  ning ......     
0fb0: 20 20 22 2c 20 6d 61 78 5f 63 6f 6e 63 75 72 72    ", max_concurr
0fc0: 65 6e 74 5f 6a 6f 62 73 3a 20 22 20 6d 61 78 2d  ent_jobs: " max-
0fd0: 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 29  concurrent-jobs)
0fe0: 0a 09 09 09 09 20 20 23 74 29 0a 09 09 09 09 20  .....  #t)..... 
0ff0: 3b 3b 20 69 66 20 6a 6f 62 2d 67 72 6f 75 70 2d  ;; if job-group-
1000: 6c 69 6d 69 74 20 69 73 20 73 65 74 20 61 6e 64  limit is set and
1010: 20 6e 75 6d 62 65 72 20 6f 66 20 6a 6f 62 73 20   number of jobs 
1020: 69 6e 20 74 68 65 20 67 72 6f 75 70 20 69 73 20  in the group is 
1030: 67 72 65 61 74 65 72 0a 09 09 09 09 20 3b 3b 20  greater..... ;; 
1040: 74 68 61 6e 20 74 68 65 20 6c 69 6d 69 74 20 74  than the limit t
1050: 68 65 6e 20 63 61 6e 6e 6f 74 20 72 75 6e 20 6d  hen cannot run m
1060: 6f 72 65 20 6a 6f 62 73 20 6f 66 20 74 68 69 73  ore jobs of this
1070: 20 6b 69 6e 64 0a 09 09 09 09 20 28 28 61 6e 64   kind..... ((and
1080: 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74   job-group-limit
1090: 0a 09 09 09 09 20 20 20 20 20 20 20 28 3e 3d 20  .....       (>= 
10a0: 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a  num-running-in-j
10b0: 6f 62 67 72 6f 75 70 20 6a 6f 62 2d 67 72 6f 75  obgroup job-grou
10c0: 70 2d 6c 69 6d 69 74 29 29 0a 09 09 09 09 20 20  p-limit)).....  
10d0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22  (debug:print 1 "
10e0: 57 41 52 4e 49 4e 47 3a 20 6e 75 6d 62 65 72 20  WARNING: number 
10f0: 6f 66 20 6a 6f 62 73 20 22 20 6e 75 6d 2d 72 75  of jobs " num-ru
1100: 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75  nning-in-jobgrou
1110: 70 20 0a 09 09 09 09 09 20 20 20 20 20 20 20 22  p ......       "
1120: 20 69 6e 20 22 20 6a 6f 62 67 72 6f 75 70 20 22   in " jobgroup "
1130: 20 65 78 63 65 65 64 65 64 2c 20 77 69 6c 6c 20   exceeded, will 
1140: 6e 6f 74 20 72 75 6e 20 22 20 28 74 65 73 74 73  not run " (tests
1150: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74  :testqueue-get-t
1160: 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63  estname test-rec
1170: 6f 72 64 29 29 0a 09 09 09 09 20 20 23 74 29 0a  ord)).....  #t).
1180: 09 09 09 09 20 28 65 6c 73 65 20 23 66 29 29 29  .... (else #f)))
1190: 29 0a 09 20 20 28 6e 6f 74 20 63 61 6e 2d 6e 6f  )..  (not can-no
11a0: 74 2d 72 75 6e 2d 6d 6f 72 65 29 29 29 29 29 0a  t-run-more))))).
11b0: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  .;;=============
11c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
11d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
11e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
11f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4e 65 77  =========.;; New
1200: 20 6d 65 74 68 6f 64 6f 6c 6f 67 79 2e 20 54 68   methodology. Th
1210: 65 73 65 20 72 6f 75 74 69 6e 65 73 20 77 69 6c  ese routines wil
1220: 6c 20 72 65 70 6c 61 63 65 20 74 68 65 20 61 62  l replace the ab
1230: 6f 76 65 20 69 6e 20 74 69 6d 65 2e 20 46 6f 72  ove in time. For
1240: 0a 3b 3b 20 6e 6f 77 20 74 68 65 20 63 6f 64 65  .;; now the code
1250: 20 69 73 20 64 75 70 6c 69 63 61 74 65 64 2e 20   is duplicated. 
1260: 54 68 69 73 20 73 74 75 66 66 20 69 73 20 69 6e  This stuff is in
1270: 69 74 69 61 6c 6c 79 20 75 73 65 64 20 69 6e 20  itially used in 
1280: 74 68 65 20 6d 6f 6e 69 74 6f 72 0a 3b 3b 20 62  the monitor.;; b
1290: 61 73 65 64 20 63 6f 64 65 2e 0a 3b 3b 3d 3d 3d  ased code..;;===
12a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
12b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
12c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
12d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
12e0: 3d 3d 3d 0a 0a 3b 3b 20 72 65 67 69 73 74 65 72  ===..;; register
12f0: 20 61 20 74 65 73 74 20 72 75 6e 20 77 69 74 68   a test run with
1300: 20 74 68 65 20 64 62 0a 28 64 65 66 69 6e 65 20   the db.(define 
1310: 28 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72  (runs:register-r
1320: 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 61  un db keys keyva
1330: 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 73 74 61  llst runname sta
1340: 74 65 20 73 74 61 74 75 73 20 75 73 65 72 29 0a  te status user).
1350: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 33    (debug:print 3
1360: 20 22 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d   "runs:register-
1370: 72 75 6e 2c 20 6b 65 79 73 3a 20 22 20 6b 65 79  run, keys: " key
1380: 73 20 22 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22  s " keyvallst: "
1390: 20 6b 65 79 76 61 6c 6c 73 74 20 22 20 72 75 6e   keyvallst " run
13a0: 6e 61 6d 65 3a 20 22 20 72 75 6e 6e 61 6d 65 20  name: " runname 
13b0: 22 20 73 74 61 74 65 3a 20 22 20 73 74 61 74 65  " state: " state
13c0: 20 22 20 73 74 61 74 75 73 3a 20 22 20 73 74 61   " status: " sta
13d0: 74 75 73 20 22 20 75 73 65 72 3a 20 22 20 75 73  tus " user: " us
13e0: 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 28 6b 65  er).  (let* ((ke
13f0: 79 73 74 72 20 20 20 20 28 6b 65 79 73 2d 3e 6b  ystr    (keys->k
1400: 65 79 73 74 72 20 6b 65 79 73 29 29 0a 09 20 28  eystr keys)).. (
1410: 63 6f 6d 6d 61 20 20 20 20 20 28 69 66 20 28 3e  comma     (if (>
1420: 20 28 6c 65 6e 67 74 68 20 6b 65 79 73 29 20 30   (length keys) 0
1430: 29 20 22 2c 22 20 22 22 29 29 0a 09 20 28 61 6e  ) "," "")).. (an
1440: 64 73 74 72 20 20 20 20 28 69 66 20 28 3e 20 28  dstr    (if (> (
1450: 6c 65 6e 67 74 68 20 6b 65 79 73 29 20 30 29 20  length keys) 0) 
1460: 22 20 41 4e 44 20 22 20 22 22 29 29 0a 09 20 28  " AND " "")).. (
1470: 76 61 6c 73 6c 6f 74 73 20 20 28 6b 65 79 73 2d  valslots  (keys-
1480: 3e 76 61 6c 73 6c 6f 74 73 20 6b 65 79 73 29 29  >valslots keys))
1490: 20 3b 3b 20 3f 2c 3f 2c 3f 20 2e 2e 2e 0a 09 20   ;; ?,?,? ..... 
14a0: 28 6b 65 79 76 61 6c 73 20 20 20 28 6d 61 70 20  (keyvals   (map 
14b0: 63 61 64 72 20 6b 65 79 76 61 6c 6c 73 74 29 29  cadr keyvallst))
14c0: 0a 09 20 28 61 6c 6c 76 61 6c 73 20 20 20 28 61  .. (allvals   (a
14d0: 70 70 65 6e 64 20 28 6c 69 73 74 20 72 75 6e 6e  ppend (list runn
14e0: 61 6d 65 20 73 74 61 74 65 20 73 74 61 74 75 73  ame state status
14f0: 20 75 73 65 72 29 20 6b 65 79 76 61 6c 73 29 29   user) keyvals))
1500: 0a 09 20 28 71 72 79 76 61 6c 73 20 20 20 28 61  .. (qryvals   (a
1510: 70 70 65 6e 64 20 28 6c 69 73 74 20 72 75 6e 6e  ppend (list runn
1520: 61 6d 65 29 20 6b 65 79 76 61 6c 73 29 29 0a 09  ame) keyvals))..
1530: 20 28 6b 65 79 3d 3f 73 74 72 20 20 28 73 74 72   (key=?str  (str
1540: 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20  ing-intersperse 
1550: 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 6b 29  (map (lambda (k)
1560: 28 63 6f 6e 63 20 28 6b 65 79 3a 67 65 74 2d 66  (conc (key:get-f
1570: 69 65 6c 64 6e 61 6d 65 20 6b 29 20 22 3d 3f 22  ieldname k) "=?"
1580: 29 29 20 6b 65 79 73 29 20 22 20 41 4e 44 20 22  )) keys) " AND "
1590: 29 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70  ))).    (debug:p
15a0: 72 69 6e 74 20 33 20 22 6b 65 79 73 3a 20 22 20  rint 3 "keys: " 
15b0: 6b 65 79 73 20 22 20 61 6c 6c 76 61 6c 73 3a 20  keys " allvals: 
15c0: 22 20 61 6c 6c 76 61 6c 73 20 22 20 6b 65 79 76  " allvals " keyv
15d0: 61 6c 73 3a 20 22 20 6b 65 79 76 61 6c 73 29 0a  als: " keyvals).
15e0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
15f0: 20 32 20 22 4e 4f 54 45 3a 20 75 73 69 6e 67 20   2 "NOTE: using 
1600: 74 61 72 67 65 74 20 22 20 28 73 74 72 69 6e 67  target " (string
1610: 2d 69 6e 74 65 72 73 70 65 72 73 65 20 6b 65 79  -intersperse key
1620: 76 61 6c 73 20 22 2f 22 29 20 22 20 66 6f 72 20  vals "/") " for 
1630: 74 68 69 73 20 72 75 6e 22 29 0a 20 20 20 20 28  this run").    (
1640: 69 66 20 28 61 6e 64 20 72 75 6e 6e 61 6d 65 20  if (and runname 
1650: 28 6e 75 6c 6c 3f 20 28 66 69 6c 74 65 72 20 28  (null? (filter (
1660: 6c 61 6d 62 64 61 20 28 78 29 28 6e 6f 74 20 78  lambda (x)(not x
1670: 29 29 20 6b 65 79 76 61 6c 73 29 29 29 20 3b 3b  )) keyvals))) ;;
1680: 20 74 68 65 72 65 20 6d 75 73 74 20 62 65 20 61   there must be a
1690: 20 62 65 74 74 65 72 20 77 61 79 20 74 6f 20 22   better way to "
16a0: 61 70 70 6c 79 20 61 6e 64 22 0a 09 28 6c 65 74  apply and"..(let
16b0: 20 28 28 72 65 73 20 23 66 29 29 0a 09 20 20 28   ((res #f))..  (
16c0: 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a 65 78  apply sqlite3:ex
16d0: 65 63 75 74 65 20 64 62 20 28 63 6f 6e 63 20 22  ecute db (conc "
16e0: 49 4e 53 45 52 54 20 4f 52 20 49 47 4e 4f 52 45  INSERT OR IGNORE
16f0: 20 49 4e 54 4f 20 72 75 6e 73 20 28 72 75 6e 6e   INTO runs (runn
1700: 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73  ame,state,status
1710: 2c 6f 77 6e 65 72 2c 65 76 65 6e 74 5f 74 69 6d  ,owner,event_tim
1720: 65 22 20 63 6f 6d 6d 61 20 6b 65 79 73 74 72 20  e" comma keystr 
1730: 22 29 20 56 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f  ") VALUES (?,?,?
1740: 2c 3f 2c 73 74 72 66 74 69 6d 65 28 27 25 73 27  ,?,strftime('%s'
1750: 2c 27 6e 6f 77 27 29 22 20 63 6f 6d 6d 61 20 76  ,'now')" comma v
1760: 61 6c 73 6c 6f 74 73 20 22 29 3b 22 29 0a 09 09  alslots ");")...
1770: 20 61 6c 6c 76 61 6c 73 29 0a 09 20 20 28 61 70   allvals)..  (ap
1780: 70 6c 79 20 73 71 6c 69 74 65 33 3a 66 6f 72 2d  ply sqlite3:for-
1790: 65 61 63 68 2d 72 6f 77 20 0a 09 20 20 20 28 6c  each-row ..   (l
17a0: 61 6d 62 64 61 20 28 69 64 29 0a 09 20 20 20 20  ambda (id)..    
17b0: 20 28 73 65 74 21 20 72 65 73 20 69 64 29 29 0a   (set! res id)).
17c0: 09 20 20 20 64 62 0a 09 20 20 20 28 6c 65 74 20  .   db..   (let 
17d0: 28 28 71 72 79 20 28 63 6f 6e 63 20 22 53 45 4c  ((qry (conc "SEL
17e0: 45 43 54 20 69 64 20 46 52 4f 4d 20 72 75 6e 73  ECT id FROM runs
17f0: 20 57 48 45 52 45 20 28 72 75 6e 6e 61 6d 65 3d   WHERE (runname=
1800: 3f 20 22 20 61 6e 64 73 74 72 20 6b 65 79 3d 3f  ? " andstr key=?
1810: 73 74 72 20 22 29 3b 22 29 29 29 0a 09 20 20 20  str ");")))..   
1820: 20 20 3b 28 64 65 62 75 67 3a 70 72 69 6e 74 20    ;(debug:print 
1830: 34 20 22 71 72 79 3a 20 22 20 71 72 79 29 20 0a  4 "qry: " qry) .
1840: 09 20 20 20 20 20 71 72 79 29 0a 09 20 20 20 71  .     qry)..   q
1850: 72 79 76 61 6c 73 29 0a 09 20 20 28 73 71 6c 69  ryvals)..  (sqli
1860: 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 20 22  te3:execute db "
1870: 55 50 44 41 54 45 20 72 75 6e 73 20 53 45 54 20  UPDATE runs SET 
1880: 73 74 61 74 65 3d 3f 2c 73 74 61 74 75 73 3d 3f  state=?,status=?
1890: 20 57 48 45 52 45 20 69 64 3d 3f 3b 22 20 73 74   WHERE id=?;" st
18a0: 61 74 65 20 73 74 61 74 75 73 20 72 65 73 29 0a  ate status res).
18b0: 09 20 20 72 65 73 29 20 0a 09 28 62 65 67 69 6e  .  res) ..(begin
18c0: 0a 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ..  (debug:print
18d0: 20 30 20 22 45 52 52 4f 52 3a 20 43 61 6c 6c 65   0 "ERROR: Calle
18e0: 64 20 77 69 74 68 6f 75 74 20 61 6c 6c 20 6e 65  d without all ne
18f0: 63 65 73 73 61 72 79 20 6b 65 79 73 22 29 0a 09  cessary keys")..
1900: 20 20 23 66 29 29 29 29 0a 0a 3b 3b 20 54 68 69    #f))))..;; Thi
1910: 73 20 69 73 20 61 20 64 75 70 6c 69 63 61 74 65  s is a duplicate
1920: 20 6f 66 20 72 75 6e 2d 74 65 73 74 73 20 28 77   of run-tests (w
1930: 68 69 63 68 20 68 61 73 20 62 65 65 6e 20 64 65  hich has been de
1940: 70 72 65 63 61 74 65 64 29 2e 20 55 73 65 20 74  precated). Use t
1950: 68 69 73 20 6f 6e 65 20 69 6e 73 74 65 61 64 20  his one instead 
1960: 6f 66 20 72 75 6e 20 74 65 73 74 73 2e 0a 3b 3b  of run tests..;;
1970: 20 6b 65 79 76 61 6c 73 0a 28 64 65 66 69 6e 65   keyvals.(define
1980: 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73   (runs:run-tests
1990: 20 64 62 20 74 61 72 67 65 74 20 72 75 6e 6e 61   db target runna
19a0: 6d 65 20 74 65 73 74 2d 70 61 74 74 73 20 75 73  me test-patts us
19b0: 65 72 20 66 6c 61 67 73 29 0a 20 20 28 6c 65 74  er flags).  (let
19c0: 2a 20 28 28 6b 65 79 73 20 20 20 20 20 20 20 20  * ((keys        
19d0: 28 72 64 62 3a 67 65 74 2d 6b 65 79 73 20 64 62  (rdb:get-keys db
19e0: 29 29 0a 09 20 28 6b 65 79 76 61 6c 6c 73 74 20  )).. (keyvallst 
19f0: 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 3e    (keys:target->
1a00: 6b 65 79 76 61 6c 20 6b 65 79 73 20 74 61 72 67  keyval keys targ
1a10: 65 74 29 29 0a 09 20 28 72 75 6e 2d 69 64 20 20  et)).. (run-id  
1a20: 20 20 20 20 28 72 75 6e 73 3a 72 65 67 69 73 74      (runs:regist
1a30: 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 6b  er-run db keys k
1a40: 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65  eyvallst runname
1a50: 20 22 6e 65 77 22 20 22 6e 2f 61 22 20 75 73 65   "new" "n/a" use
1a60: 72 29 29 20 20 3b 3b 20 20 74 65 73 74 2d 6e 61  r))  ;;  test-na
1a70: 6d 65 29 29 29 0a 09 20 28 64 65 66 65 72 72 65  me))).. (deferre
1a80: 64 20 20 20 20 27 28 29 29 20 3b 3b 20 64 65 6c  d    '()) ;; del
1a90: 61 79 20 72 75 6e 6e 69 6e 67 20 74 68 65 73 65  ay running these
1aa0: 20 73 69 6e 63 65 20 74 68 65 79 20 68 61 76 65   since they have
1ab0: 20 61 20 77 61 69 74 6f 6e 20 63 6c 61 75 73 65   a waiton clause
1ac0: 0a 09 20 3b 3b 20 6b 65 65 70 67 6f 69 6e 67 20  .. ;; keepgoing 
1ad0: 69 73 20 74 68 65 20 64 65 66 61 63 74 6f 20 6d  is the defacto m
1ae0: 6f 64 61 6c 69 74 79 20 6e 6f 77 2c 20 77 69 6c  odality now, wil
1af0: 6c 20 61 64 64 20 68 69 74 2d 6e 2d 72 75 6e 20  l add hit-n-run 
1b00: 61 20 62 69 74 20 6c 61 74 65 72 0a 09 20 3b 3b  a bit later.. ;;
1b10: 20 28 6b 65 65 70 67 6f 69 6e 67 20 20 20 28 68   (keepgoing   (h
1b20: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65  ash-table-ref/de
1b30: 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65  fault flags "-ke
1b40: 65 70 67 6f 69 6e 67 22 20 23 66 29 29 0a 09 20  epgoing" #f)).. 
1b50: 28 74 65 73 74 2d 6e 61 6d 65 73 20 20 27 28 29  (test-names  '()
1b60: 29 0a 09 20 28 72 75 6e 63 6f 6e 66 69 67 66 20  ).. (runconfigf 
1b70: 20 20 28 63 6f 6e 63 20 20 2a 74 6f 70 70 61 74    (conc  *toppat
1b80: 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 69 67 73 2e  h* "/runconfigs.
1b90: 63 6f 6e 66 69 67 22 29 29 0a 09 20 28 72 65 71  config")).. (req
1ba0: 75 69 72 65 64 2d 74 65 73 74 73 20 27 28 29 29  uired-tests '())
1bb0: 0a 09 20 28 74 65 73 74 2d 72 65 63 6f 72 64 73  .. (test-records
1bc0: 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c   (make-hash-tabl
1bd0: 65 29 29 29 0a 0a 20 20 20 20 28 73 65 74 2d 6d  e)))..    (set-m
1be0: 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73  egatest-env-vars
1bf0: 20 64 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74   db run-id) ;; t
1c00: 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64  hese may be need
1c10: 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68  ed by the launch
1c20: 69 6e 67 20 70 72 6f 63 65 73 73 0a 0a 20 20 20  ing process..   
1c30: 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74   (if (file-exist
1c40: 73 3f 20 72 75 6e 63 6f 6e 66 69 67 66 29 0a 09  s? runconfigf)..
1c50: 28 73 65 74 75 70 2d 65 6e 76 2d 64 65 66 61 75  (setup-env-defau
1c60: 6c 74 73 20 64 62 20 72 75 6e 63 6f 6e 66 69 67  lts db runconfig
1c70: 66 20 72 75 6e 2d 69 64 20 2a 61 6c 72 65 61 64  f run-id *alread
1c80: 79 2d 73 65 65 6e 2d 72 75 6e 63 6f 6e 66 69 67  y-seen-runconfig
1c90: 2d 69 6e 66 6f 2a 20 22 70 72 65 2d 6c 61 75 6e  -info* "pre-laun
1ca0: 63 68 2d 65 6e 76 2d 76 61 72 73 22 29 0a 09 28  ch-env-vars")..(
1cb0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57  debug:print 0 "W
1cc0: 41 52 4e 49 4e 47 3a 20 59 6f 75 20 64 6f 20 6e  ARNING: You do n
1cd0: 6f 74 20 68 61 76 65 20 61 20 72 75 6e 20 63 6f  ot have a run co
1ce0: 6e 66 69 67 20 66 69 6c 65 3a 20 22 20 72 75 6e  nfig file: " run
1cf0: 63 6f 6e 66 69 67 66 29 29 0a 20 20 20 20 0a 20  configf)).    . 
1d00: 20 20 20 3b 3b 20 6c 6f 6f 6b 20 75 70 20 61 6c     ;; look up al
1d10: 6c 20 74 65 73 74 73 20 6d 61 74 63 68 69 6e 67  l tests matching
1d20: 20 74 68 65 20 63 6f 6d 6d 61 20 73 65 70 61 72   the comma separ
1d30: 61 74 65 64 20 6c 69 73 74 20 6f 66 20 67 6c 6f  ated list of glo
1d40: 62 73 20 69 6e 0a 20 20 20 20 3b 3b 20 74 65 73  bs in.    ;; tes
1d50: 74 2d 70 61 74 74 73 20 28 75 73 69 6e 67 20 25  t-patts (using %
1d60: 20 61 73 20 77 69 6c 64 63 61 72 64 29 0a 20 20   as wildcard).  
1d70: 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20    (for-each .   
1d80: 20 20 28 6c 61 6d 62 64 61 20 28 70 61 74 74 29    (lambda (patt)
1d90: 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 74  .       (let ((t
1da0: 65 73 74 73 20 28 67 6c 6f 62 20 28 63 6f 6e 63  ests (glob (conc
1db0: 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73   *toppath* "/tes
1dc0: 74 73 2f 22 20 28 73 74 72 69 6e 67 2d 74 72 61  ts/" (string-tra
1dd0: 6e 73 6c 61 74 65 20 70 61 74 74 20 22 25 22 20  nslate patt "%" 
1de0: 22 2a 22 29 29 29 29 29 0a 09 20 28 73 65 74 21  "*"))))).. (set!
1df0: 20 74 65 73 74 73 20 28 66 69 6c 74 65 72 20 28   tests (filter (
1e00: 6c 61 6d 62 64 61 20 28 74 65 73 74 29 28 66 69  lambda (test)(fi
1e10: 6c 65 2d 65 78 69 73 74 73 3f 20 28 63 6f 6e 63  le-exists? (conc
1e20: 20 74 65 73 74 20 22 2f 74 65 73 74 63 6f 6e 66   test "/testconf
1e30: 69 67 22 29 29 29 20 74 65 73 74 73 29 29 0a 09  ig"))) tests))..
1e40: 20 28 73 65 74 21 20 74 65 73 74 2d 6e 61 6d 65   (set! test-name
1e50: 73 20 28 61 70 70 65 6e 64 20 74 65 73 74 2d 6e  s (append test-n
1e60: 61 6d 65 73 20 0a 09 09 09 09 20 20 28 6d 61 70  ames .....  (map
1e70: 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 70 29   (lambda (testp)
1e80: 0a 09 09 09 09 09 20 28 6c 61 73 74 20 28 73 74  ...... (last (st
1e90: 72 69 6e 67 2d 73 70 6c 69 74 20 74 65 73 74 70  ring-split testp
1ea0: 20 22 2f 22 29 29 29 0a 09 09 09 09 20 20 20 20   "/"))).....    
1eb0: 20 20 20 74 65 73 74 73 29 29 29 29 29 0a 20 20     tests))))).  
1ec0: 20 20 20 28 69 66 20 74 65 73 74 2d 70 61 74 74     (if test-patt
1ed0: 73 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20  s (string-split 
1ee0: 74 65 73 74 2d 70 61 74 74 73 20 22 2c 22 29 28  test-patts ",")(
1ef0: 6c 69 73 74 20 22 25 22 29 29 29 0a 0a 20 20 20  list "%")))..   
1f00: 20 20 3b 3b 20 6e 6f 77 20 72 65 6d 6f 76 65 20    ;; now remove 
1f10: 64 75 70 6c 69 63 61 74 65 73 0a 20 20 20 20 28  duplicates.    (
1f20: 73 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20  set! test-names 
1f30: 28 64 65 6c 65 74 65 2d 64 75 70 6c 69 63 61 74  (delete-duplicat
1f40: 65 73 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a  es test-names)).
1f50: 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  .    (debug:prin
1f60: 74 20 30 20 22 49 4e 46 4f 3a 20 74 65 73 74 20  t 0 "INFO: test 
1f70: 6e 61 6d 65 73 20 22 20 74 65 73 74 2d 6e 61 6d  names " test-nam
1f80: 65 73 29 0a 0a 20 20 20 20 3b 3b 20 6f 6e 20 74  es)..    ;; on t
1f90: 68 65 20 66 69 72 73 74 20 70 61 73 73 20 6f 72  he first pass or
1fa0: 20 63 61 6c 6c 20 74 6f 20 72 75 6e 2d 74 65 73   call to run-tes
1fb0: 74 73 20 73 65 74 20 46 41 49 4c 53 20 74 6f 20  ts set FAILS to 
1fc0: 4e 4f 54 5f 53 54 41 52 54 45 44 20 69 66 0a 20  NOT_STARTED if. 
1fd0: 20 20 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67     ;; -keepgoing
1fe0: 20 69 73 20 73 70 65 63 69 66 69 65 64 0a 20 20   is specified.  
1ff0: 20 20 28 69 66 20 28 65 71 3f 20 2a 70 61 73 73    (if (eq? *pass
2000: 6e 75 6d 2a 20 30 29 0a 09 28 62 65 67 69 6e 0a  num* 0)..(begin.
2010: 09 20 20 3b 3b 20 68 61 76 65 20 74 6f 20 64 65  .  ;; have to de
2020: 6c 65 74 65 20 74 65 73 74 20 72 65 63 6f 72 64  lete test record
2030: 73 20 77 68 65 72 65 20 4e 4f 54 5f 53 54 41 52  s where NOT_STAR
2040: 54 45 44 20 73 69 6e 63 65 20 74 68 65 79 20 63  TED since they c
2050: 61 6e 20 63 61 75 73 65 20 2d 6b 65 65 70 67 6f  an cause -keepgo
2060: 69 6e 67 20 74 6f 20 0a 09 20 20 3b 3b 20 67 65  ing to ..  ;; ge
2070: 74 20 73 74 75 63 6b 20 64 75 65 20 74 6f 20 62  t stuck due to b
2080: 65 63 6f 6d 69 6e 67 20 69 6e 61 63 63 65 73 73  ecoming inaccess
2090: 69 62 6c 65 20 66 72 6f 6d 20 61 20 66 61 69 6c  ible from a fail
20a0: 65 64 20 74 65 73 74 2e 20 49 2e 65 2e 20 69 66  ed test. I.e. if
20b0: 20 74 65 73 74 20 42 20 64 65 70 65 6e 64 73 20   test B depends 
20c0: 0a 09 20 20 3b 3b 20 6f 6e 20 74 65 73 74 20 41  ..  ;; on test A
20d0: 20 62 75 74 20 74 65 73 74 20 42 20 72 65 61 63   but test B reac
20e0: 68 65 64 20 74 68 65 20 70 6f 69 6e 74 20 6f 6e  hed the point on
20f0: 20 62 65 69 6e 67 20 72 65 67 69 73 74 65 72 65   being registere
2100: 64 20 61 73 20 4e 4f 54 5f 53 54 41 52 54 45 44  d as NOT_STARTED
2110: 20 61 6e 64 20 74 65 73 74 0a 09 20 20 3b 3b 20   and test..  ;; 
2120: 41 20 66 61 69 6c 65 64 20 66 6f 72 20 73 6f 6d  A failed for som
2130: 65 20 72 65 61 73 6f 6e 20 74 68 65 6e 20 6f 6e  e reason then on
2140: 20 72 65 2d 72 75 6e 20 75 73 69 6e 67 20 2d 6b   re-run using -k
2150: 65 65 70 67 6f 69 6e 67 20 74 68 65 20 72 75 6e  eepgoing the run
2160: 20 63 61 6e 20 6e 65 76 65 72 20 63 6f 6d 70 6c   can never compl
2170: 65 74 65 2e 0a 09 20 20 28 64 62 3a 64 65 6c 65  ete...  (db:dele
2180: 74 65 2d 74 65 73 74 73 2d 69 6e 2d 73 74 61 74  te-tests-in-stat
2190: 65 20 64 62 20 72 75 6e 2d 69 64 20 22 4e 4f 54  e db run-id "NOT
21a0: 5f 53 54 41 52 54 45 44 22 29 0a 09 20 20 28 72  _STARTED")..  (r
21b0: 64 62 3a 73 65 74 2d 74 65 73 74 73 2d 73 74 61  db:set-tests-sta
21c0: 74 65 2d 73 74 61 74 75 73 20 64 62 20 72 75 6e  te-status db run
21d0: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 73 20 23  -id test-names #
21e0: 66 20 22 46 41 49 4c 22 20 22 4e 4f 54 5f 53 54  f "FAIL" "NOT_ST
21f0: 41 52 54 45 44 22 20 22 46 41 49 4c 22 29 29 29  ARTED" "FAIL")))
2200: 0a 0a 20 20 20 20 3b 3b 20 6e 6f 77 20 61 64 64  ..    ;; now add
2210: 20 6e 6f 6e 2d 64 69 72 65 63 74 6c 79 20 72 65   non-directly re
2220: 66 65 72 65 6e 63 65 64 20 64 65 70 65 6e 64 65  ferenced depende
2230: 6e 63 69 65 73 20 28 69 2e 65 2e 20 77 61 69 74  ncies (i.e. wait
2240: 6f 6e 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74  on).    (if (not
2250: 20 28 6e 75 6c 6c 3f 20 74 65 73 74 2d 6e 61 6d   (null? test-nam
2260: 65 73 29 29 0a 09 28 6c 65 74 20 6c 6f 6f 70 20  es))..(let loop 
2270: 28 28 68 65 64 20 28 63 61 72 20 74 65 73 74 2d  ((hed (car test-
2280: 6e 61 6d 65 73 29 29 0a 09 09 20 20 20 28 74 61  names))...   (ta
2290: 6c 20 28 63 64 72 20 74 65 73 74 2d 6e 61 6d 65  l (cdr test-name
22a0: 73 29 29 29 20 20 20 20 20 20 20 20 20 3b 3b 20  s)))         ;; 
22b0: 27 72 65 74 75 72 6e 2d 70 72 6f 63 73 20 74 65  'return-procs te
22c0: 6c 6c 73 20 74 68 65 20 63 6f 6e 66 69 67 20 72  lls the config r
22d0: 65 61 64 65 72 20 74 6f 20 70 72 65 70 20 72 75  eader to prep ru
22e0: 6e 6e 69 6e 67 20 73 79 73 74 65 6d 20 62 75 74  nning system but
22f0: 20 72 65 74 75 72 6e 20 61 20 70 72 6f 63 0a 09   return a proc..
2300: 20 20 28 6c 65 74 2a 20 28 28 63 6f 6e 66 69 67    (let* ((config
2310: 20 20 28 74 65 73 74 73 3a 67 65 74 2d 74 65 73    (tests:get-tes
2320: 74 63 6f 6e 66 69 67 20 68 65 64 20 27 72 65 74  tconfig hed 'ret
2330: 75 72 6e 2d 70 72 6f 63 73 29 29 0a 09 09 20 28  urn-procs))... (
2340: 77 61 69 74 6f 6e 73 20 28 73 74 72 69 6e 67 2d  waitons (string-
2350: 73 70 6c 69 74 20 28 6c 65 74 20 28 28 77 20 28  split (let ((w (
2360: 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 63 6f  config-lookup co
2370: 6e 66 69 67 20 22 72 65 71 75 69 72 65 6d 65 6e  nfig "requiremen
2380: 74 73 22 20 22 77 61 69 74 6f 6e 22 29 29 29 0a  ts" "waiton"))).
2390: 09 09 09 09 09 20 20 28 69 66 20 77 20 77 20 22  .....  (if w w "
23a0: 22 29 29 29 29 29 0a 09 20 20 20 20 3b 3b 20 28  ")))))..    ;; (
23b0: 69 74 65 6d 73 20 20 20 28 69 74 65 6d 73 3a 67  items   (items:g
23c0: 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f  et-items-from-co
23d0: 6e 66 69 67 20 63 6f 6e 66 69 67 29 29 29 0a 09  nfig config)))..
23e0: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 68 61      (if (not (ha
23f0: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66  sh-table-ref/def
2400: 61 75 6c 74 20 74 65 73 74 2d 72 65 63 6f 72 64  ault test-record
2410: 73 20 68 65 64 20 23 66 29 29 0a 09 09 28 68 61  s hed #f))...(ha
2420: 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 65  sh-table-set! te
2430: 73 74 2d 72 65 63 6f 72 64 73 0a 09 09 09 09 20  st-records..... 
2440: 68 65 64 20 28 76 65 63 74 6f 72 20 68 65 64 20  hed (vector hed 
2450: 20 20 20 20 3b 3b 20 30 0a 09 09 09 09 09 20 20      ;; 0......  
2460: 20 20 20 63 6f 6e 66 69 67 20 20 3b 3b 20 31 0a     config  ;; 1.
2470: 09 09 09 09 09 20 20 20 20 20 77 61 69 74 6f 6e  .....     waiton
2480: 73 20 3b 3b 20 32 0a 09 09 09 09 09 20 20 20 20  s ;; 2......    
2490: 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20   (config-lookup 
24a0: 63 6f 6e 66 69 67 20 22 72 65 71 75 69 72 65 6d  config "requirem
24b0: 65 6e 74 73 22 20 22 70 72 69 6f 72 69 74 79 22  ents" "priority"
24c0: 29 20 20 20 20 20 3b 3b 20 70 72 69 6f 72 69 74  )     ;; priorit
24d0: 79 20 33 0a 09 09 09 09 09 20 20 20 20 20 28 6c  y 3......     (l
24e0: 65 74 20 28 28 69 74 65 6d 73 20 20 20 20 20 20  et ((items      
24f0: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f  (hash-table-ref/
2500: 64 65 66 61 75 6c 74 20 63 6f 6e 66 69 67 20 22  default config "
2510: 69 74 65 6d 73 22 20 23 66 29 29 20 3b 3b 20 69  items" #f)) ;; i
2520: 74 65 6d 73 20 34 0a 09 09 09 09 09 09 20 20 20  tems 4.......   
2530: 28 69 74 65 6d 73 74 61 62 6c 65 20 28 68 61 73  (itemstable (has
2540: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61  h-table-ref/defa
2550: 75 6c 74 20 63 6f 6e 66 69 67 20 22 69 74 65 6d  ult config "item
2560: 73 74 61 62 6c 65 22 20 23 66 29 29 29 20 0a 09  stable" #f))) ..
2570: 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20 69 66  ....       ;; if
2580: 20 65 69 74 68 65 72 20 69 74 65 6d 73 20 6f 72   either items or
2590: 20 69 74 65 6d 73 20 74 61 62 6c 65 20 69 73 20   items table is 
25a0: 61 20 70 72 6f 63 20 72 65 74 75 72 6e 20 69 74  a proc return it
25b0: 20 73 6f 20 74 65 73 74 20 72 75 6e 6e 69 6e 67   so test running
25c0: 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20  ......       ;; 
25d0: 70 72 6f 63 65 73 73 20 63 61 6e 20 6b 6e 6f 77  process can know
25e0: 20 74 6f 20 63 61 6c 6c 20 69 74 65 6d 73 3a 67   to call items:g
25f0: 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f  et-items-from-co
2600: 6e 66 69 67 0a 09 09 09 09 09 20 20 20 20 20 20  nfig......      
2610: 20 3b 3b 20 69 66 20 65 69 74 68 65 72 20 69 73   ;; if either is
2620: 20 61 20 6c 69 73 74 20 61 6e 64 20 6e 6f 6e 65   a list and none
2630: 20 69 73 20 61 20 70 72 6f 63 20 67 6f 20 61 68   is a proc go ah
2640: 65 61 64 20 61 6e 64 20 63 61 6c 6c 20 67 65 74  ead and call get
2650: 2d 69 74 65 6d 73 0a 09 09 09 09 09 20 20 20 20  -items......    
2660: 20 20 20 3b 3b 20 6f 74 68 65 72 77 69 73 65 20     ;; otherwise 
2670: 72 65 74 75 72 6e 20 23 66 20 2d 20 74 68 69 73  return #f - this
2680: 20 69 73 20 6e 6f 74 20 61 6e 20 69 74 65 72 61   is not an itera
2690: 74 65 64 20 74 65 73 74 0a 09 09 09 09 09 20 20  ted test......  
26a0: 20 20 20 20 20 28 63 6f 6e 64 0a 09 09 09 09 09       (cond......
26b0: 09 28 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74  .((procedure? it
26c0: 65 6d 73 29 20 20 20 20 20 20 0a 09 09 09 09 09  ems)      ......
26d0: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34  . (debug:print 4
26e0: 20 22 49 4e 46 4f 3a 20 69 74 65 6d 73 20 69 73   "INFO: items is
26f0: 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20 77 69   a procedure, wi
2700: 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72 22 29 0a  ll calc later").
2710: 09 09 09 09 09 09 20 69 74 65 6d 73 29 20 20 20  ...... items)   
2720: 20 20 20 20 20 20 20 20 20 3b 3b 20 63 61 6c 63           ;; calc
2730: 20 6c 61 74 65 72 0a 09 09 09 09 09 09 28 28 70   later.......((p
2740: 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73 74  rocedure? itemst
2750: 61 62 6c 65 29 0a 09 09 09 09 09 09 20 28 64 65  able)....... (de
2760: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46  bug:print 4 "INF
2770: 4f 3a 20 69 74 65 6d 73 74 61 62 6c 65 20 69 73  O: itemstable is
2780: 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20 77 69   a procedure, wi
2790: 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72 22 29 0a  ll calc later").
27a0: 09 09 09 09 09 09 20 69 74 65 6d 73 74 61 62 6c  ...... itemstabl
27b0: 65 29 20 20 20 20 20 20 20 3b 3b 20 63 61 6c 63  e)       ;; calc
27c0: 20 6c 61 74 65 72 0a 09 09 09 09 09 09 28 28 66   later.......((f
27d0: 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78  ilter (lambda (x
27e0: 29 0a 09 09 09 09 09 09 09 20 20 20 28 6c 65 74  )........   (let
27f0: 20 28 28 76 61 6c 20 28 63 61 72 20 78 29 29 29   ((val (car x)))
2800: 0a 09 09 09 09 09 09 09 20 20 20 20 20 28 69 66  ........     (if
2810: 20 28 70 72 6f 63 65 64 75 72 65 3f 20 76 61 6c   (procedure? val
2820: 29 20 76 61 6c 20 23 66 29 29 29 0a 09 09 09 09  ) val #f))).....
2830: 09 09 09 20 28 61 70 70 65 6e 64 20 28 69 66 20  ... (append (if 
2840: 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 69 74  (list? items) it
2850: 65 6d 73 20 27 28 29 29 0a 09 09 09 09 09 09 09  ems '())........
2860: 09 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74 65  . (if (list? ite
2870: 6d 73 74 61 62 6c 65 29 20 69 74 65 6d 73 74 61  mstable) itemsta
2880: 62 6c 65 20 27 28 29 29 29 29 0a 09 09 09 09 09  ble '())))......
2890: 09 20 27 68 61 76 65 2d 70 72 6f 63 65 64 75 72  . 'have-procedur
28a0: 65 29 0a 09 09 09 09 09 09 28 28 6f 72 20 28 6c  e).......((or (l
28b0: 69 73 74 3f 20 69 74 65 6d 73 29 28 6c 69 73 74  ist? items)(list
28c0: 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 29 20 3b  ? itemstable)) ;
28d0: 3b 20 63 61 6c 63 20 6e 6f 77 0a 09 09 09 09 09  ; calc now......
28e0: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34  . (debug:print 4
28f0: 20 22 49 4e 46 4f 3a 20 69 74 65 6d 73 20 61 6e   "INFO: items an
2900: 64 20 69 74 65 6d 73 74 61 62 6c 65 20 61 72 65  d itemstable are
2910: 20 6c 69 73 74 73 2c 20 63 61 6c 63 20 6e 6f 77   lists, calc now
2920: 5c 6e 22 0a 09 09 09 09 09 09 09 20 20 20 20 20  \n"........     
2930: 20 22 20 20 20 20 69 74 65 6d 73 3a 20 22 20 69   "    items: " i
2940: 74 65 6d 73 20 22 20 69 74 65 6d 73 74 61 62 6c  tems " itemstabl
2950: 65 3a 20 22 20 69 74 65 6d 73 74 61 62 6c 65 29  e: " itemstable)
2960: 0a 09 09 09 09 09 09 20 28 69 74 65 6d 73 3a 67  ....... (items:g
2970: 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f  et-items-from-co
2980: 6e 66 69 67 20 63 6f 6e 66 69 67 29 29 0a 09 09  nfig config))...
2990: 09 09 09 09 28 65 6c 73 65 20 23 66 29 29 29 20  ....(else #f))) 
29a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
29b0: 20 20 20 20 20 20 20 20 20 20 3b 3b 20 6e 6f 74            ;; not
29c0: 20 69 74 65 72 61 74 65 64 0a 09 09 09 09 09 20   iterated...... 
29d0: 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b 20 69      #f      ;; i
29e0: 74 65 6d 73 64 61 74 20 35 0a 09 09 09 09 09 20  temsdat 5...... 
29f0: 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b 20 73      #f      ;; s
2a00: 70 61 72 65 20 2d 20 75 73 65 64 20 66 6f 72 20  pare - used for 
2a10: 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 09 09 20  item-path...... 
2a20: 20 20 20 20 29 29 29 0a 09 20 20 20 20 28 66 6f      )))..    (fo
2a30: 72 2d 65 61 63 68 20 0a 09 20 20 20 20 20 28 6c  r-each ..     (l
2a40: 61 6d 62 64 61 20 28 77 61 69 74 6f 6e 29 0a 09  ambda (waiton)..
2a50: 20 20 20 20 20 20 20 28 69 66 20 28 61 6e 64 20         (if (and 
2a60: 77 61 69 74 6f 6e 20 28 6e 6f 74 20 28 6d 65 6d  waiton (not (mem
2a70: 62 65 72 20 77 61 69 74 6f 6e 20 74 65 73 74 2d  ber waiton test-
2a80: 6e 61 6d 65 73 29 29 29 0a 09 09 20 20 20 28 62  names)))...   (b
2a90: 65 67 69 6e 0a 09 09 20 20 20 20 20 28 73 65 74  egin...     (set
2aa0: 21 20 72 65 71 75 69 72 65 64 2d 74 65 73 74 73  ! required-tests
2ab0: 20 28 63 6f 6e 73 20 77 61 69 74 6f 6e 20 72 65   (cons waiton re
2ac0: 71 75 69 72 65 64 2d 74 65 73 74 73 29 29 0a 09  quired-tests))..
2ad0: 09 20 20 20 20 20 28 73 65 74 21 20 74 65 73 74  .     (set! test
2ae0: 2d 6e 61 6d 65 73 20 28 63 6f 6e 73 20 77 61 69  -names (cons wai
2af0: 74 6f 6e 20 74 65 73 74 2d 6e 61 6d 65 73 29 29  ton test-names))
2b00: 29 29 29 20 3b 3b 20 77 61 73 20 61 6e 20 61 70  ))) ;; was an ap
2b10: 70 65 6e 64 2c 20 6e 6f 77 20 61 20 63 6f 6e 73  pend, now a cons
2b20: 0a 09 20 20 20 20 20 77 61 69 74 6f 6e 73 29 0a  ..     waitons).
2b30: 09 20 20 20 20 28 6c 65 74 20 28 28 72 65 6d 74  .    (let ((remt
2b40: 65 73 74 73 20 28 64 65 6c 65 74 65 2d 64 75 70  ests (delete-dup
2b50: 6c 69 63 61 74 65 73 20 28 61 70 70 65 6e 64 20  licates (append 
2b60: 77 61 69 74 6f 6e 73 20 74 61 6c 29 29 29 29 0a  waitons tal)))).
2b70: 09 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20  .      (if (not 
2b80: 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29  (null? remtests)
2b90: 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72  )...  (loop (car
2ba0: 20 72 65 6d 74 65 73 74 73 29 28 63 64 72 20 72   remtests)(cdr r
2bb0: 65 6d 74 65 73 74 73 29 29 29 29 29 29 29 0a 0a  emtests)))))))..
2bc0: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75      (if (not (nu
2bd0: 6c 6c 3f 20 72 65 71 75 69 72 65 64 2d 74 65 73  ll? required-tes
2be0: 74 73 29 29 0a 09 28 64 65 62 75 67 3a 70 72 69  ts))..(debug:pri
2bf0: 6e 74 20 31 20 22 49 4e 46 4f 3a 20 41 64 64 69  nt 1 "INFO: Addi
2c00: 6e 67 20 22 20 72 65 71 75 69 72 65 64 2d 74 65  ng " required-te
2c10: 73 74 73 20 22 20 74 6f 20 74 68 65 20 72 75 6e  sts " to the run
2c20: 20 71 75 65 75 65 22 29 29 0a 20 20 20 20 3b 3b   queue")).    ;;
2c30: 20 4e 4f 54 45 3a 20 74 68 65 73 65 20 61 72 65   NOTE: these are
2c40: 20 61 6c 6c 20 70 61 72 65 6e 74 20 74 65 73 74   all parent test
2c50: 73 2c 20 69 74 65 6d 73 20 61 72 65 20 6e 6f 74  s, items are not
2c60: 20 65 78 70 61 6e 64 65 64 20 79 65 74 2e 0a 20   expanded yet.. 
2c70: 20 20 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73     (runs:run-tes
2c80: 74 73 2d 71 75 65 75 65 20 64 62 20 72 75 6e 2d  ts-queue db run-
2c90: 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d  id runname test-
2ca0: 72 65 63 6f 72 64 73 20 6b 65 79 76 61 6c 6c 73  records keyvalls
2cb0: 74 20 66 6c 61 67 73 29 0a 20 20 20 20 28 69 66  t flags).    (if
2cc0: 20 2a 72 70 63 3a 6c 69 73 74 65 6e 65 72 2a 20   *rpc:listener* 
2cd0: 28 73 65 72 76 65 72 3a 6b 65 65 70 2d 72 75 6e  (server:keep-run
2ce0: 6e 69 6e 67 20 64 62 29 29 0a 20 20 20 20 28 64  ning db)).    (d
2cf0: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e  ebug:print 4 "IN
2d00: 46 4f 3a 20 41 6c 6c 20 64 6f 6e 65 20 62 79 20  FO: All done by 
2d10: 68 65 72 65 22 29 29 29 0a 0a 3b 3b 20 74 65 73  here")))..;; tes
2d20: 74 2d 72 65 63 6f 72 64 73 20 69 73 20 61 20 68  t-records is a h
2d30: 61 73 68 20 74 61 62 6c 65 20 74 65 73 74 6e 61  ash table testna
2d40: 6d 65 3a 69 74 65 6d 5f 70 61 74 68 20 3d 3e 20  me:item_path => 
2d50: 76 65 63 74 6f 72 20 3c 20 74 65 73 74 6e 61 6d  vector < testnam
2d60: 65 20 74 65 73 74 63 6f 6e 66 69 67 20 77 61 69  e testconfig wai
2d70: 74 6f 6e 73 20 70 72 69 6f 72 69 74 79 20 69 74  tons priority it
2d80: 65 6d 73 2d 69 6e 66 6f 20 2e 2e 2e 20 3e 0a 28  ems-info ... >.(
2d90: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 75 6e  define (runs:run
2da0: 2d 74 65 73 74 73 2d 71 75 65 75 65 20 64 62 20  -tests-queue db 
2db0: 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74  run-id runname t
2dc0: 65 73 74 2d 72 65 63 6f 72 64 73 20 6b 65 79 76  est-records keyv
2dd0: 61 6c 6c 73 74 20 66 6c 61 67 73 29 0a 20 20 20  allst flags).   
2de0: 20 3b 3b 20 41 74 20 74 68 69 73 20 70 6f 69 6e   ;; At this poin
2df0: 74 20 74 68 65 20 6c 69 73 74 20 6f 66 20 70 61  t the list of pa
2e00: 72 65 6e 74 20 74 65 73 74 73 20 69 73 20 65 78  rent tests is ex
2e10: 70 61 6e 64 65 64 20 0a 20 20 20 20 3b 3b 20 4e  panded .    ;; N
2e20: 42 2f 2f 20 53 68 6f 75 6c 64 20 65 78 70 61 6e  B// Should expan
2e30: 64 20 69 74 65 6d 73 20 68 65 72 65 20 61 6e 64  d items here and
2e40: 20 74 68 65 6e 20 69 6e 73 65 72 74 20 69 6e 74   then insert int
2e50: 6f 20 74 68 65 20 72 75 6e 20 71 75 65 75 65 2e  o the run queue.
2e60: 0a 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  .  (debug:print 
2e70: 35 20 22 74 65 73 74 2d 72 65 63 6f 72 64 73 3a  5 "test-records:
2e80: 20 22 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20   " test-records 
2e90: 22 2c 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20  ", keyvallst: " 
2ea0: 6b 65 79 76 61 6c 6c 73 74 20 22 20 66 6c 61 67  keyvallst " flag
2eb0: 73 3a 20 22 20 28 68 61 73 68 2d 74 61 62 6c 65  s: " (hash-table
2ec0: 2d 3e 61 6c 69 73 74 20 66 6c 61 67 73 29 29 0a  ->alist flags)).
2ed0: 20 20 28 6c 65 74 20 28 28 73 6f 72 74 65 64 2d    (let ((sorted-
2ee0: 74 65 73 74 2d 6e 61 6d 65 73 20 28 74 65 73 74  test-names (test
2ef0: 73 3a 73 6f 72 74 2d 62 79 2d 70 72 69 6f 72 69  s:sort-by-priori
2f00: 74 79 2d 61 6e 64 2d 77 61 69 74 6f 6e 20 74 65  ty-and-waiton te
2f10: 73 74 2d 72 65 63 6f 72 64 73 29 29 0a 09 28 69  st-records))..(i
2f20: 74 65 6d 2d 70 61 74 74 73 20 20 20 20 20 20 20  tem-patts       
2f30: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66   (hash-table-ref
2f40: 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22  /default flags "
2f50: 2d 69 74 65 6d 70 61 74 74 22 20 23 66 29 29 29  -itempatt" #f)))
2f60: 0a 20 20 20 20 28 6c 65 74 20 6c 6f 6f 70 20 28  .    (let loop (
2f70: 3b 20 28 6e 75 6d 74 69 6d 65 73 20 30 29 20 3b  ; (numtimes 0) ;
2f80: 3b 20 73 68 6f 75 6c 64 6e 27 74 20 6e 65 65 64  ; shouldn't need
2f90: 20 74 68 69 73 0a 09 20 20 20 20 20 20 20 28 68   this..       (h
2fa0: 65 64 20 20 20 20 20 20 20 20 20 28 63 61 72 20  ed         (car 
2fb0: 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65  sorted-test-name
2fc0: 73 29 29 0a 09 20 20 20 20 20 20 20 28 74 61 6c  s))..       (tal
2fd0: 20 20 20 20 20 20 20 20 20 28 63 64 72 20 73 6f           (cdr so
2fe0: 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29  rted-test-names)
2ff0: 29 29 0a 20 20 20 20 20 20 28 6c 65 74 2a 20 28  )).      (let* (
3000: 28 74 65 73 74 2d 72 65 63 6f 72 64 20 28 68 61  (test-record (ha
3010: 73 68 2d 74 61 62 6c 65 2d 72 65 66 20 74 65 73  sh-table-ref tes
3020: 74 2d 72 65 63 6f 72 64 73 20 68 65 64 29 29 0a  t-records hed)).
3030: 09 20 20 20 20 20 28 74 63 6f 6e 66 69 67 20 20  .     (tconfig  
3040: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75     (tests:testqu
3050: 65 75 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66  eue-get-testconf
3060: 69 67 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29  ig test-record))
3070: 0a 09 20 20 20 20 20 28 77 61 69 74 6f 6e 73 20  ..     (waitons 
3080: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71      (tests:testq
3090: 75 65 75 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73  ueue-get-waitons
30a0: 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29      test-record)
30b0: 29 0a 09 20 20 20 20 20 28 70 72 69 6f 72 69 74  )..     (priorit
30c0: 79 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74  y    (tests:test
30d0: 71 75 65 75 65 2d 67 65 74 2d 70 72 69 6f 72 69  queue-get-priori
30e0: 74 79 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64  ty   test-record
30f0: 29 29 0a 09 20 20 20 20 20 28 69 74 65 6d 64 61  ))..     (itemda
3100: 74 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73  t     (tests:tes
3110: 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d 64  tqueue-get-itemd
3120: 61 74 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72  at    test-recor
3130: 64 29 29 20 3b 3b 20 69 74 65 6d 64 61 74 20 63  d)) ;; itemdat c
3140: 61 6e 20 62 65 20 61 20 73 74 72 69 6e 67 2c 20  an be a string, 
3150: 6c 69 73 74 20 6f 72 20 23 66 0a 09 20 20 20 20  list or #f..    
3160: 20 28 69 74 65 6d 73 20 20 20 20 20 20 20 28 74   (items       (t
3170: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67  ests:testqueue-g
3180: 65 74 2d 69 74 65 6d 73 20 20 20 20 20 20 74 65  et-items      te
3190: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 20 20  st-record))..   
31a0: 20 20 28 69 74 65 6d 2d 70 61 74 68 20 20 20 28    (item-path   (
31b0: 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20  item-list->path 
31c0: 69 74 65 6d 64 61 74 29 29 29 0a 09 28 64 65 62  itemdat)))..(deb
31d0: 75 67 3a 70 72 69 6e 74 20 36 0a 09 09 20 20 20  ug:print 6...   
31e0: 20 20 22 69 74 65 6d 64 61 74 3a 20 20 20 20 20    "itemdat:     
31f0: 22 20 69 74 65 6d 64 61 74 0a 09 09 20 20 20 20  " itemdat...    
3200: 20 22 5c 6e 20 20 69 74 65 6d 73 3a 20 20 20 20   "\n  items:    
3210: 20 22 20 69 74 65 6d 73 0a 09 09 20 20 20 20 20   " items...     
3220: 22 5c 6e 20 20 69 74 65 6d 2d 70 61 74 68 3a 20  "\n  item-path: 
3230: 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 28 63  " item-path)..(c
3240: 6f 6e 64 0a 09 20 28 28 6e 6f 74 20 69 74 65 6d  ond.. ((not item
3250: 73 29 20 3b 3b 20 77 68 65 6e 20 66 61 6c 73 65  s) ;; when false
3260: 20 74 68 65 20 74 65 73 74 20 69 73 20 6f 6b 20   the test is ok 
3270: 74 6f 20 62 65 20 68 61 6e 64 65 64 20 6f 66 66  to be handed off
3280: 20 74 6f 20 6c 61 75 6e 63 68 20 28 62 75 74 20   to launch (but 
3290: 6e 6f 74 20 62 65 66 6f 72 65 29 0a 09 20 20 28  not before)..  (
32a0: 6c 65 74 20 28 28 68 61 76 65 2d 72 65 73 6f 75  let ((have-resou
32b0: 72 63 65 73 20 20 28 72 75 6e 73 3a 63 61 6e 2d  rces  (runs:can-
32c0: 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 64  run-more-tests d
32d0: 62 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 20  b test-record)) 
32e0: 3b 3b 20 6c 6f 6f 6b 20 61 74 20 74 68 65 20 74  ;; look at the t
32f0: 65 73 74 20 6a 6f 62 67 72 6f 75 70 20 61 6e 64  est jobgroup and
3300: 20 74 6f 74 20 6a 6f 62 73 20 72 75 6e 6e 69 6e   tot jobs runnin
3310: 67 0a 09 09 28 70 72 65 72 65 71 73 2d 6e 6f 74  g...(prereqs-not
3320: 2d 6d 65 74 20 28 64 62 3a 67 65 74 2d 70 72 65  -met (db:get-pre
3330: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 64 62 20  reqs-not-met db 
3340: 72 75 6e 2d 69 64 20 77 61 69 74 6f 6e 73 20 69  run-id waitons i
3350: 74 65 6d 2d 70 61 74 68 29 29 29 0a 09 20 20 20  tem-path)))..   
3360: 20 3b 3b 20 44 6f 6e 27 74 20 6b 6e 6f 77 20 61   ;; Don't know a
3370: 74 20 74 68 69 73 20 74 69 6d 65 20 69 66 20 74  t this time if t
3380: 68 65 20 74 65 73 74 20 68 61 76 65 20 62 65 65  he test have bee
3390: 6e 20 6c 61 75 6e 63 68 65 64 20 61 74 20 73 6f  n launched at so
33a0: 6d 65 20 74 69 6d 65 20 69 6e 20 74 68 65 20 70  me time in the p
33b0: 61 73 74 0a 09 20 20 20 20 3b 3b 20 69 2e 65 2e  ast..    ;; i.e.
33c0: 20 69 73 20 74 68 69 73 20 61 20 72 65 2d 6c 61   is this a re-la
33d0: 75 6e 63 68 3f 0a 09 20 20 20 20 28 69 66 20 28  unch?..    (if (
33e0: 61 6e 64 20 68 61 76 65 2d 72 65 73 6f 75 72 63  and have-resourc
33f0: 65 73 0a 09 09 20 20 20 20 20 28 6e 75 6c 6c 3f  es...     (null?
3400: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74   prereqs-not-met
3410: 29 29 0a 09 09 3b 3b 20 6e 6f 20 6c 6f 6f 70 20  ))...;; no loop 
3420: 2d 20 64 72 6f 70 20 74 68 6f 75 67 68 20 61 6e  - drop though an
3430: 64 20 75 73 65 20 74 68 65 20 6c 6f 6f 70 20 61  d use the loop a
3440: 74 20 74 68 65 20 62 6f 74 74 6f 6d 20 0a 09 09  t the bottom ...
3450: 28 69 66 20 28 70 61 74 74 2d 6c 69 73 74 2d 6d  (if (patt-list-m
3460: 61 74 63 68 20 69 74 65 6d 2d 70 61 74 68 20 69  atch item-path i
3470: 74 65 6d 2d 70 61 74 74 73 29 0a 09 09 20 20 20  tem-patts)...   
3480: 20 28 72 75 6e 3a 74 65 73 74 20 64 62 20 72 75   (run:test db ru
3490: 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 6b 65 79  n-id runname key
34a0: 76 61 6c 6c 73 74 20 74 65 73 74 2d 72 65 63 6f  vallst test-reco
34b0: 72 64 20 66 6c 61 67 73 20 23 66 29 0a 09 09 20  rd flags #f)... 
34c0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
34d0: 31 20 22 49 4e 46 4f 3a 20 53 6b 69 70 70 69 6e  1 "INFO: Skippin
34e0: 67 20 22 20 28 74 65 73 74 73 3a 74 65 73 74 71  g " (tests:testq
34f0: 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d  ueue-get-testnam
3500: 65 20 74 65 73 74 2d 72 65 63 6f 72 64 29 20 22  e test-record) "
3510: 20 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20 61   " item-path " a
3520: 73 20 69 74 20 64 6f 65 73 6e 27 74 20 6d 61 74  s it doesn't mat
3530: 63 68 20 22 20 69 74 65 6d 2d 70 61 74 74 73 29  ch " item-patts)
3540: 29 0a 09 09 3b 3b 20 65 6c 73 65 20 74 68 65 20  )...;; else the 
3550: 72 75 6e 20 69 73 20 73 74 75 63 6b 2c 20 74 65  run is stuck, te
3560: 6d 70 6f 72 61 72 69 6c 79 20 6f 72 20 70 65 72  mporarily or per
3570: 6d 61 6e 65 6e 74 6c 79 0a 09 09 28 6c 65 74 20  manently...(let 
3580: 28 28 6e 65 77 74 61 6c 20 28 61 70 70 65 6e 64  ((newtal (append
3590: 20 74 61 6c 20 28 6c 69 73 74 20 68 65 64 29 29   tal (list hed))
35a0: 29 29 0a 09 09 20 20 3b 3b 20 63 6f 75 6c 64 6e  ))...  ;; couldn
35b0: 27 74 20 72 75 6e 2c 20 74 61 6b 65 20 61 20 62  't run, take a b
35c0: 72 65 61 74 68 65 72 0a 09 09 20 20 28 74 68 72  reather...  (thr
35d0: 65 61 64 2d 73 6c 65 65 70 21 20 30 2e 31 29 20  ead-sleep! 0.1) 
35e0: 3b 3b 20 6c 6f 6e 67 20 73 6c 65 65 70 20 68 65  ;; long sleep he
35f0: 72 65 20 2d 20 6e 6f 20 72 65 73 6f 75 72 63 65  re - no resource
3600: 73 2c 20 6d 61 79 20 61 73 20 77 65 6c 6c 20 62  s, may as well b
3610: 65 20 70 61 74 69 65 6e 74 0a 09 09 20 20 28 6c  e patient...  (l
3620: 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61 6c 29  oop (car newtal)
3630: 28 63 64 72 20 6e 65 77 74 61 6c 29 29 29 29 29  (cdr newtal)))))
3640: 29 0a 09 20 0a 09 20 3b 3b 20 63 61 73 65 20 77  ).. .. ;; case w
3650: 68 65 72 65 20 61 6e 20 69 74 65 6d 73 20 63 61  here an items ca
3660: 6d 65 20 69 6e 20 61 73 20 61 20 6c 69 73 74 20  me in as a list 
3670: 62 65 65 6e 20 70 72 6f 63 65 73 73 65 64 0a 09  been processed..
3680: 20 28 28 61 6e 64 20 28 6c 69 73 74 3f 20 69 74   ((and (list? it
3690: 65 6d 73 29 20 20 20 20 20 3b 3b 20 74 68 75 73  ems)     ;; thus
36a0: 20 77 65 20 6b 6e 6f 77 20 6f 75 72 20 69 74 65   we know our ite
36b0: 6d 73 20 61 72 65 20 61 6c 72 65 61 64 79 20 63  ms are already c
36c0: 61 6c 63 75 6c 61 74 65 64 0a 09 20 20 20 20 20  alculated..     
36d0: 20 20 28 6e 6f 74 20 20 20 69 74 65 6d 64 61 74    (not   itemdat
36e0: 29 29 20 3b 3b 20 61 6e 64 20 6e 6f 74 20 79 65  )) ;; and not ye
36f0: 74 20 65 78 70 61 6e 64 65 64 20 69 6e 74 6f 20  t expanded into 
3700: 74 68 65 20 6c 69 73 74 20 6f 66 20 74 68 69 6e  the list of thin
3710: 67 73 20 74 6f 20 62 65 20 64 6f 6e 65 0a 09 20  gs to be done.. 
3720: 20 28 69 66 20 28 61 6e 64 20 28 3e 3d 20 2a 76   (if (and (>= *v
3730: 65 72 62 6f 73 69 74 79 2a 20 31 29 0a 09 09 20  erbosity* 1)... 
3740: 20 20 28 3e 20 28 6c 65 6e 67 74 68 20 69 74 65    (> (length ite
3750: 6d 73 29 20 30 29 0a 09 09 20 20 20 28 3e 20 28  ms) 0)...   (> (
3760: 6c 65 6e 67 74 68 20 28 63 61 72 20 69 74 65 6d  length (car item
3770: 73 29 29 20 30 29 29 0a 09 09 20 20 20 28 70 70  s)) 0))...   (pp
3780: 20 69 74 65 6d 73 29 29 0a 09 20 20 3b 3b 20 28   items))..  ;; (
3790: 69 66 20 28 3e 3d 20 2a 76 65 72 62 6f 73 69 74  if (>= *verbosit
37a0: 79 2a 20 35 29 0a 09 20 20 3b 3b 20 20 20 20 20  y* 5)..  ;;     
37b0: 28 62 65 67 69 6e 0a 09 20 20 3b 3b 20 20 20 20  (begin..  ;;    
37c0: 20 20 20 28 70 72 69 6e 74 20 22 69 74 65 6d 73     (print "items
37d0: 3a 20 22 29 20 20 20 20 20 28 70 70 20 28 69 74  : ")     (pp (it
37e0: 65 6d 2d 61 73 73 6f 63 2d 3e 69 74 65 6d 2d 6c  em-assoc->item-l
37f0: 69 73 74 20 69 74 65 6d 73 29 29 0a 09 20 20 3b  ist items))..  ;
3800: 3b 20 20 20 20 20 20 20 28 70 72 69 6e 74 20 22  ;       (print "
3810: 69 74 65 6d 73 74 61 62 6c 65 3a 20 22 29 28 70  itemstable: ")(p
3820: 70 20 28 69 74 65 6d 2d 74 61 62 6c 65 2d 3e 69  p (item-table->i
3830: 74 65 6d 2d 6c 69 73 74 20 69 74 65 6d 73 74 61  tem-list itemsta
3840: 62 6c 65 29 29 29 29 0a 09 20 20 28 66 6f 72 2d  ble))))..  (for-
3850: 65 61 63 68 0a 09 20 20 20 28 6c 61 6d 62 64 61  each..   (lambda
3860: 20 28 6d 79 2d 69 74 65 6d 64 61 74 29 0a 09 20   (my-itemdat).. 
3870: 20 20 20 20 28 6c 65 74 2a 20 28 28 6e 65 77 2d      (let* ((new-
3880: 74 65 73 74 2d 72 65 63 6f 72 64 20 28 6c 65 74  test-record (let
3890: 20 28 28 6e 65 77 72 65 63 20 28 6d 61 6b 65 2d   ((newrec (make-
38a0: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 29  tests:testqueue)
38b0: 29 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 76  )).....       (v
38c0: 65 63 74 6f 72 2d 63 6f 70 79 21 20 74 65 73 74  ector-copy! test
38d0: 2d 72 65 63 6f 72 64 20 6e 65 77 72 65 63 29 0a  -record newrec).
38e0: 09 09 09 09 20 20 20 20 20 20 20 6e 65 77 72 65  ....       newre
38f0: 63 29 29 0a 09 09 20 20 20 20 28 6d 79 2d 69 74  c))...    (my-it
3900: 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69  em-path (item-li
3910: 73 74 2d 3e 70 61 74 68 20 6d 79 2d 69 74 65 6d  st->path my-item
3920: 64 61 74 29 29 29 0a 09 20 20 20 20 20 20 20 28  dat)))..       (
3930: 69 66 20 28 70 61 74 74 2d 6c 69 73 74 2d 6d 61  if (patt-list-ma
3940: 74 63 68 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68  tch my-item-path
3950: 20 69 74 65 6d 2d 70 61 74 74 73 29 20 20 20 20   item-patts)    
3960: 20 20 20 20 20 20 20 3b 3b 20 79 65 73 2c 20 77         ;; yes, w
3970: 65 20 77 61 6e 74 20 74 6f 20 70 72 6f 63 65 73  e want to proces
3980: 73 20 74 68 69 73 20 69 74 65 6d 2c 20 4e 4f 54  s this item, NOT
3990: 45 3a 20 53 68 6f 75 6c 64 20 6e 6f 74 20 6e 65  E: Should not ne
39a0: 65 64 20 74 68 69 73 20 63 68 65 63 6b 20 68 65  ed this check he
39b0: 72 65 21 0a 09 09 20 20 20 28 6c 65 74 20 28 28  re!...   (let ((
39c0: 6e 65 77 74 65 73 74 6e 61 6d 65 20 28 63 6f 6e  newtestname (con
39d0: 63 20 68 65 64 20 22 2f 22 20 6d 79 2d 69 74 65  c hed "/" my-ite
39e0: 6d 2d 70 61 74 68 29 29 29 20 20 20 20 3b 3b 20  m-path)))    ;; 
39f0: 74 65 73 74 20 6e 61 6d 65 73 20 61 72 65 20 75  test names are u
3a00: 6e 69 71 75 65 20 6f 6e 20 74 65 73 74 6e 61 6d  nique on testnam
3a10: 65 2f 69 74 65 6d 2d 70 61 74 68 0a 09 09 20 20  e/item-path...  
3a20: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75     (tests:testqu
3a30: 65 75 65 2d 73 65 74 2d 69 74 65 6d 73 21 20 20  eue-set-items!  
3a40: 20 20 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f     new-test-reco
3a50: 72 64 20 23 66 29 0a 09 09 20 20 20 20 20 28 74  rd #f)...     (t
3a60: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 73  ests:testqueue-s
3a70: 65 74 2d 69 74 65 6d 64 61 74 21 20 20 20 6e 65  et-itemdat!   ne
3a80: 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 6d 79  w-test-record my
3a90: 2d 69 74 65 6d 64 61 74 29 0a 09 09 20 20 20 20  -itemdat)...    
3aa0: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75   (tests:testqueu
3ab0: 65 2d 73 65 74 2d 69 74 65 6d 5f 70 61 74 68 21  e-set-item_path!
3ac0: 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64   new-test-record
3ad0: 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68 29 0a 09   my-item-path)..
3ae0: 09 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c  .     (hash-tabl
3af0: 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 63 6f  e-set! test-reco
3b00: 72 64 73 20 6e 65 77 74 65 73 74 6e 61 6d 65 20  rds newtestname 
3b10: 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 29  new-test-record)
3b20: 0a 09 09 20 20 20 20 20 28 73 65 74 21 20 74 61  ...     (set! ta
3b30: 6c 20 28 63 6f 6e 73 20 6e 65 77 74 65 73 74 6e  l (cons newtestn
3b40: 61 6d 65 20 74 61 6c 29 29 29 29 29 29 20 3b 3b  ame tal)))))) ;;
3b50: 20 73 69 6e 63 65 20 74 68 65 73 65 20 61 72 65   since these are
3b60: 20 69 74 65 6d 69 7a 65 64 20 63 72 65 61 74 65   itemized create
3b70: 20 6e 65 77 20 74 65 73 74 20 6e 61 6d 65 73 20   new test names 
3b80: 74 65 73 74 6e 61 6d 65 2f 69 74 65 6d 70 61 74  testname/itempat
3b90: 68 0a 09 20 20 20 69 74 65 6d 73 29 0a 09 20 20  h..   items)..  
3ba0: 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28  (loop (car tal)(
3bb0: 63 64 72 20 74 61 6c 29 29 29 0a 0a 09 20 3b 3b  cdr tal)))... ;;
3bc0: 20 69 66 20 69 74 65 6d 73 20 69 73 20 61 20 70   if items is a p
3bd0: 72 6f 63 20 74 68 65 6e 20 6e 65 65 64 20 74 6f  roc then need to
3be0: 20 72 75 6e 20 69 74 65 6d 73 3a 67 65 74 2d 69   run items:get-i
3bf0: 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67  tems-from-config
3c00: 2c 20 67 65 74 20 74 68 65 20 6c 69 73 74 20 61  , get the list a
3c10: 6e 64 20 6c 6f 6f 70 20 0a 09 20 3b 3b 20 20 20  nd loop .. ;;   
3c20: 20 2d 20 62 75 74 20 6f 6e 6c 79 20 64 6f 20 74   - but only do t
3c30: 68 61 74 20 69 66 20 72 65 73 6f 75 72 63 65 73  hat if resources
3c40: 20 65 78 69 73 74 20 74 6f 20 6b 69 63 6b 20 6f   exist to kick o
3c50: 66 66 20 74 68 65 20 6a 6f 62 0a 09 20 28 28 6f  ff the job.. ((o
3c60: 72 20 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74  r (procedure? it
3c70: 65 6d 73 29 28 65 71 3f 20 69 74 65 6d 73 20 27  ems)(eq? items '
3c80: 68 61 76 65 2d 70 72 6f 63 65 64 75 72 65 29 29  have-procedure))
3c90: 0a 09 20 20 28 69 66 20 28 61 6e 64 20 28 72 75  ..  (if (and (ru
3ca0: 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d  ns:can-run-more-
3cb0: 74 65 73 74 73 20 64 62 20 74 65 73 74 2d 72 65  tests db test-re
3cc0: 63 6f 72 64 29 0a 09 09 20 20 20 28 6e 75 6c 6c  cord)...   (null
3cd0: 3f 20 28 64 62 3a 67 65 74 2d 70 72 65 72 65 71  ? (db:get-prereq
3ce0: 73 2d 6e 6f 74 2d 6d 65 74 20 64 62 20 72 75 6e  s-not-met db run
3cf0: 2d 69 64 20 77 61 69 74 6f 6e 73 20 69 74 65 6d  -id waitons item
3d00: 2d 70 61 74 68 29 29 29 0a 09 20 20 20 20 20 20  -path)))..      
3d10: 28 6c 65 74 20 28 28 74 65 73 74 2d 6e 61 6d 65  (let ((test-name
3d20: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75   (tests:testqueu
3d30: 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74  e-get-testname t
3d40: 65 73 74 2d 72 65 63 6f 72 64 29 29 29 0a 09 09  est-record)))...
3d50: 28 73 65 74 65 6e 76 20 22 4d 54 5f 54 45 53 54  (setenv "MT_TEST
3d60: 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65  _NAME" test-name
3d70: 29 20 3b 3b 20 0a 09 09 28 73 65 74 65 6e 76 20  ) ;; ...(setenv 
3d80: 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20 72  "MT_RUNNAME"   r
3d90: 75 6e 6e 61 6d 65 29 0a 09 09 28 73 65 74 2d 6d  unname)...(set-m
3da0: 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73  egatest-env-vars
3db0: 20 64 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74   db run-id) ;; t
3dc0: 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64  hese may be need
3dd0: 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68  ed by the launch
3de0: 69 6e 67 20 70 72 6f 63 65 73 73 0a 09 09 28 6c  ing process...(l
3df0: 65 74 20 28 28 69 74 65 6d 73 2d 6c 69 73 74 20  et ((items-list 
3e00: 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73  (items:get-items
3e10: 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 74 63 6f  -from-config tco
3e20: 6e 66 69 67 29 29 29 0a 09 09 20 20 28 69 66 20  nfig)))...  (if 
3e30: 28 6c 69 73 74 3f 20 69 74 65 6d 73 2d 6c 69 73  (list? items-lis
3e40: 74 29 0a 09 09 20 20 20 20 20 20 28 62 65 67 69  t)...      (begi
3e50: 6e 0a 09 09 09 28 74 65 73 74 73 3a 74 65 73 74  n....(tests:test
3e60: 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 73 21  queue-set-items!
3e70: 20 74 65 73 74 2d 72 65 63 6f 72 64 20 69 74 65   test-record ite
3e80: 6d 73 2d 6c 69 73 74 29 0a 09 09 09 28 6c 6f 6f  ms-list)....(loo
3e90: 70 20 68 65 64 20 74 61 6c 29 29 0a 09 09 20 20  p hed tal))...  
3ea0: 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09 28 64      (begin....(d
3eb0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
3ec0: 52 4f 52 3a 20 54 68 65 20 70 72 6f 63 20 66 72  ROR: The proc fr
3ed0: 6f 6d 20 72 65 61 64 69 6e 67 20 74 68 65 20 73  om reading the s
3ee0: 65 74 75 70 20 64 69 64 20 6e 6f 74 20 79 69 65  etup did not yie
3ef0: 6c 64 20 61 20 6c 69 73 74 20 2d 20 70 6c 65 61  ld a list - plea
3f00: 73 65 20 72 65 70 6f 72 74 20 74 68 69 73 22 29  se report this")
3f10: 0a 09 09 09 28 65 78 69 74 20 31 29 29 29 29 29  ....(exit 1)))))
3f20: 0a 09 20 20 20 20 20 20 28 6c 65 74 20 28 28 6e  ..      (let ((n
3f30: 65 77 74 61 6c 20 28 61 70 70 65 6e 64 20 74 61  ewtal (append ta
3f40: 6c 20 28 6c 69 73 74 20 68 65 64 29 29 29 29 0a  l (list hed)))).
3f50: 09 09 3b 3b 20 69 66 20 63 61 6e 27 74 20 72 75  ..;; if can't ru
3f60: 6e 20 6d 6f 72 65 20 74 65 73 74 73 2c 20 6c 65  n more tests, le
3f70: 74 73 20 74 61 6b 65 20 61 20 62 72 65 61 74 68  ts take a breath
3f80: 65 72 0a 09 09 28 74 68 72 65 61 64 2d 73 6c 65  er...(thread-sle
3f90: 65 70 21 20 30 2e 31 29 20 3b 3b 20 6d 61 79 20  ep! 0.1) ;; may 
3fa0: 61 73 20 77 65 6c 6c 20 77 61 69 74 20 61 20 77  as well wait a w
3fb0: 68 69 6c 65 20 66 6f 72 20 72 65 73 6f 75 72 63  hile for resourc
3fc0: 65 73 20 74 6f 20 66 72 65 65 20 75 70 0a 09 09  es to free up...
3fd0: 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61  (loop (car newta
3fe0: 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 29 29  l)(cdr newtal)))
3ff0: 29 29 0a 0a 09 20 3b 3b 20 74 68 69 73 20 63 61  ))... ;; this ca
4000: 73 65 20 73 68 6f 75 6c 64 20 6e 6f 74 20 68 61  se should not ha
4010: 70 70 65 6e 2c 20 61 64 64 65 64 20 74 6f 20 68  ppen, added to h
4020: 65 6c 70 20 63 61 74 63 68 20 61 6e 79 20 62 75  elp catch any bu
4030: 67 73 0a 09 20 28 28 61 6e 64 20 28 6c 69 73 74  gs.. ((and (list
4040: 3f 20 69 74 65 6d 73 29 20 69 74 65 6d 64 61 74  ? items) itemdat
4050: 29 0a 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e  )..  (debug:prin
4060: 74 20 30 20 22 45 52 52 4f 52 3a 20 53 68 6f 75  t 0 "ERROR: Shou
4070: 6c 64 20 6e 6f 74 20 68 61 76 65 20 61 20 6c 69  ld not have a li
4080: 73 74 20 6f 66 20 69 74 65 6d 73 20 69 6e 20 61  st of items in a
4090: 20 74 65 73 74 20 61 6e 64 20 74 68 65 20 69 74   test and the it
40a0: 65 6d 73 70 61 74 68 20 73 65 74 20 2d 20 70 6c  emspath set - pl
40b0: 65 61 73 65 20 72 65 70 6f 72 74 20 74 68 69 73  ease report this
40c0: 22 29 0a 09 20 20 28 65 78 69 74 20 31 29 29 29  ")..  (exit 1)))
40d0: 29 0a 09 0a 20 20 20 20 20 20 3b 3b 20 77 65 20  )...      ;; we 
40e0: 67 65 74 20 68 65 72 65 20 6f 6e 20 22 64 72 6f  get here on "dro
40f0: 70 20 74 68 72 6f 75 67 68 22 20 2d 20 6c 6f 6f  p through" - loo
4100: 70 20 66 6f 72 20 6e 65 78 74 20 74 65 73 74 20  p for next test 
4110: 69 6e 20 71 75 65 75 65 0a 20 20 20 20 20 20 28  in queue.      (
4120: 69 66 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 0a 09  if (null? tal)..
4130: 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 3b 3b    (begin..    ;;
4140: 20 46 49 58 4d 45 21 21 21 21 20 54 48 49 53 20   FIXME!!!! THIS 
4150: 53 48 4f 55 4c 44 20 4e 4f 54 20 52 45 51 55 49  SHOULD NOT REQUI
4160: 52 45 20 41 4e 20 45 58 49 54 21 21 21 21 21 21  RE AN EXIT!!!!!!
4170: 21 0a 09 20 20 20 20 28 64 65 62 75 67 3a 70 72  !..    (debug:pr
4180: 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 41 6c 6c  int 1 "INFO: All
4190: 20 74 65 73 74 73 20 6c 61 75 6e 63 68 65 64 22   tests launched"
41a0: 29 0a 09 20 20 20 20 28 74 68 72 65 61 64 2d 73  )..    (thread-s
41b0: 6c 65 65 70 21 20 30 2e 35 29 0a 09 20 20 20 20  leep! 0.5)..    
41c0: 3b 3b 20 46 49 58 4d 45 21 20 54 68 69 73 20 68  ;; FIXME! This h
41d0: 61 72 73 68 20 65 78 69 74 20 73 68 6f 75 6c 64  arsh exit should
41e0: 20 6e 6f 74 20 62 65 20 6e 65 63 65 73 73 61 72   not be necessar
41f0: 79 2e 2e 2e 2e 0a 09 20 20 20 20 28 69 66 20 28  y......    (if (
4200: 6e 6f 74 20 2a 72 75 6e 72 65 6d 6f 74 65 2a 29  not *runremote*)
4210: 28 65 78 69 74 29 29 20 3b 3b 20 0a 09 20 20 20  (exit)) ;; ..   
4220: 20 23 66 29 20 3b 3b 20 72 65 74 75 72 6e 20 61   #f) ;; return a
4230: 20 23 66 20 61 73 20 61 20 68 69 6e 74 20 74 68   #f as a hint th
4240: 61 74 20 77 65 20 61 72 65 20 64 6f 6e 65 0a 09  at we are done..
4250: 20 20 3b 3b 20 48 65 72 65 20 77 65 20 6e 65 65    ;; Here we nee
4260: 64 20 74 6f 20 63 68 65 63 6b 20 74 68 61 74 20  d to check that 
4270: 61 6c 6c 20 74 68 65 20 74 65 73 74 73 20 72 65  all the tests re
4280: 6d 61 69 6e 69 6e 67 20 74 6f 20 62 65 20 72 75  maining to be ru
4290: 6e 20 61 72 65 20 65 6c 69 67 69 62 6c 65 20 74  n are eligible t
42a0: 6f 20 72 75 6e 0a 09 20 20 3b 3b 20 61 6e 64 20  o run..  ;; and 
42b0: 61 72 65 20 6e 6f 74 20 62 6c 6f 63 6b 65 64 20  are not blocked 
42c0: 62 79 20 66 61 69 6c 65 64 0a 09 20 20 28 6c 65  by failed..  (le
42d0: 74 20 28 28 6e 65 77 6c 73 74 20 28 74 65 73 74  t ((newlst (test
42e0: 73 3a 66 69 6c 74 65 72 2d 6e 6f 6e 2d 72 75 6e  s:filter-non-run
42f0: 6e 61 62 6c 65 20 64 62 20 72 75 6e 2d 69 64 20  nable db run-id 
4300: 74 61 6c 20 74 65 73 74 2d 72 65 63 6f 72 64 73  tal test-records
4310: 29 29 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f 74 20  ))) ;; i.e. not 
4320: 46 41 49 4c 2c 20 57 41 49 56 45 44 2c 20 49 4e  FAIL, WAIVED, IN
4330: 43 4f 4d 50 4c 45 54 45 2c 20 50 41 53 53 2c 20  COMPLETE, PASS, 
4340: 4b 49 4c 4c 45 44 2c 0a 09 20 20 20 20 28 74 68  KILLED,..    (th
4350: 72 65 61 64 2d 73 6c 65 65 70 21 20 30 2e 31 29  read-sleep! 0.1)
4360: 0a 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28  ..    (if (not (
4370: 6e 75 6c 6c 3f 20 6e 65 77 6c 73 74 29 29 0a 09  null? newlst))..
4380: 09 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 6c  .(loop (car newl
4390: 73 74 29 28 63 64 72 20 6e 65 77 6c 73 74 29 29  st)(cdr newlst))
43a0: 29 29 29 29 29 29 0a 0a 3b 3b 20 70 61 72 65 6e  ))))))..;; paren
43b0: 74 2d 74 65 73 74 20 69 73 20 74 68 65 72 65 20  t-test is there 
43c0: 61 73 20 61 20 70 6c 61 63 65 68 6f 6c 64 65 72  as a placeholder
43d0: 20 66 6f 72 20 77 68 65 6e 20 70 61 72 65 6e 74   for when parent
43e0: 2d 74 65 73 74 73 20 63 61 6e 20 62 65 20 72 75  -tests can be ru
43f0: 6e 20 61 73 20 61 20 73 65 74 75 70 20 73 74 65  n as a setup ste
4400: 70 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 3a 74  p.(define (run:t
4410: 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 72 75  est db run-id ru
4420: 6e 6e 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20  nname keyvallst 
4430: 74 65 73 74 2d 72 65 63 6f 72 64 20 66 6c 61 67  test-record flag
4440: 73 20 70 61 72 65 6e 74 2d 74 65 73 74 29 0a 20  s parent-test). 
4450: 20 3b 3b 20 41 6c 6c 20 74 68 65 73 65 20 76 61   ;; All these va
4460: 72 73 20 6d 69 67 68 74 20 62 65 20 72 65 66 65  rs might be refe
4470: 72 65 6e 63 65 64 20 62 79 20 74 68 65 20 74 65  renced by the te
4480: 73 74 63 6f 6e 66 69 67 20 66 69 6c 65 20 72 65  stconfig file re
4490: 61 64 65 72 0a 20 20 28 6c 65 74 2a 20 28 28 74  ader.  (let* ((t
44a0: 65 73 74 2d 6e 61 6d 65 20 20 20 20 28 74 65 73  est-name    (tes
44b0: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
44c0: 2d 74 65 73 74 6e 61 6d 65 20 20 20 74 65 73 74  -testname   test
44d0: 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65 73  -record)).. (tes
44e0: 74 2d 77 61 69 74 6f 6e 73 20 28 74 65 73 74 73  t-waitons (tests
44f0: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 77  :testqueue-get-w
4500: 61 69 74 6f 6e 73 20 20 20 20 74 65 73 74 2d 72  aitons    test-r
4510: 65 63 6f 72 64 29 29 0a 09 20 28 74 65 73 74 2d  ecord)).. (test-
4520: 63 6f 6e 66 20 20 20 20 28 74 65 73 74 73 3a 74  conf    (tests:t
4530: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73  estqueue-get-tes
4540: 74 63 6f 6e 66 69 67 20 74 65 73 74 2d 72 65 63  tconfig test-rec
4550: 6f 72 64 29 29 0a 09 20 28 69 74 65 6d 64 61 74  ord)).. (itemdat
4560: 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73        (tests:tes
4570: 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d 64  tqueue-get-itemd
4580: 61 74 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72  at    test-recor
4590: 64 29 29 0a 09 20 28 74 65 73 74 2d 70 61 74 68  d)).. (test-path
45a0: 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61      (conc *toppa
45b0: 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 20 74 65  th* "/tests/" te
45c0: 73 74 2d 6e 61 6d 65 29 29 20 3b 3b 20 63 6f 75  st-name)) ;; cou
45d0: 6c 64 20 75 73 65 20 74 65 73 74 73 3a 67 65 74  ld use tests:get
45e0: 2d 74 65 73 74 63 6f 6e 66 69 67 20 68 65 72 65  -testconfig here
45f0: 20 2e 2e 2e 0a 09 20 28 66 6f 72 63 65 20 20 20   ..... (force   
4600: 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65       (hash-table
4610: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61  -ref/default fla
4620: 67 73 20 22 2d 66 6f 72 63 65 22 20 23 66 29 29  gs "-force" #f))
4630: 0a 09 20 28 72 65 72 75 6e 20 20 20 20 20 20 20  .. (rerun       
4640: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66   (hash-table-ref
4650: 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22  /default flags "
4660: 2d 72 65 72 75 6e 22 20 23 66 29 29 0a 09 20 28  -rerun" #f)).. (
4670: 6b 65 65 70 67 6f 69 6e 67 20 20 20 20 28 68 61  keepgoing    (ha
4680: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66  sh-table-ref/def
4690: 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 65  ault flags "-kee
46a0: 70 67 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 28  pgoing" #f)).. (
46b0: 69 74 65 6d 2d 70 61 74 68 20 20 20 20 20 22 22  item-path     ""
46c0: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72  )).    (debug:pr
46d0: 69 6e 74 20 35 0a 09 09 20 22 74 65 73 74 2d 63  int 5... "test-c
46e0: 6f 6e 66 69 67 3a 20 22 20 28 68 61 73 68 2d 74  onfig: " (hash-t
46f0: 61 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65 73 74  able->alist test
4700: 2d 63 6f 6e 66 29 0a 09 09 20 22 5c 6e 20 20 20  -conf)... "\n   
4710: 69 74 65 6d 64 61 74 3a 20 22 20 69 74 65 6d 64  itemdat: " itemd
4720: 61 74 0a 09 09 20 29 0a 20 20 20 20 3b 3b 20 73  at... ).    ;; s
4730: 65 74 74 69 6e 67 20 69 74 65 6d 64 61 74 20 74  etting itemdat t
4740: 6f 20 61 20 6c 69 73 74 20 69 66 20 69 74 20 69  o a list if it i
4750: 73 20 23 66 0a 20 20 20 20 28 69 66 20 28 6e 6f  s #f.    (if (no
4760: 74 20 69 74 65 6d 64 61 74 29 28 73 65 74 21 20  t itemdat)(set! 
4770: 69 74 65 6d 64 61 74 20 27 28 29 29 29 0a 20 20  itemdat '())).  
4780: 20 20 28 73 65 74 21 20 69 74 65 6d 2d 70 61 74    (set! item-pat
4790: 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61  h (item-list->pa
47a0: 74 68 20 69 74 65 6d 64 61 74 29 29 0a 20 20 20  th itemdat)).   
47b0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20   (debug:print 2 
47c0: 22 41 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 6c  "Attempting to l
47d0: 61 75 6e 63 68 20 74 65 73 74 20 22 20 74 65 73  aunch test " tes
47e0: 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d  t-name "/" item-
47f0: 70 61 74 68 29 0a 20 20 20 20 28 73 65 74 65 6e  path).    (seten
4800: 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d 45 22  v "MT_TEST_NAME"
4810: 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b 20 0a   test-name) ;; .
4820: 20 20 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f      (setenv "MT_
4830: 52 55 4e 4e 41 4d 45 22 20 20 20 72 75 6e 6e 61  RUNNAME"   runna
4840: 6d 65 29 0a 20 20 20 20 28 73 65 74 2d 6d 65 67  me).    (set-meg
4850: 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 64  atest-env-vars d
4860: 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65  b run-id) ;; the
4870: 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64  se may be needed
4880: 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e   by the launchin
4890: 67 20 70 72 6f 63 65 73 73 0a 20 20 20 20 28 63  g process.    (c
48a0: 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 79 20  hange-directory 
48b0: 2a 74 6f 70 70 61 74 68 2a 29 0a 0a 20 20 20 20  *toppath*)..    
48c0: 3b 3b 20 48 65 72 65 20 69 73 20 77 68 65 72 65  ;; Here is where
48d0: 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61 20 74   the test_meta t
48e0: 61 62 6c 65 20 69 73 20 62 65 73 74 20 75 70 64  able is best upd
48f0: 61 74 65 64 0a 20 20 20 20 3b 3b 20 59 65 73 2c  ated.    ;; Yes,
4900: 20 61 6e 6f 74 68 65 72 20 75 73 65 20 6f 66 20   another use of 
4910: 61 20 67 6c 6f 62 61 6c 20 66 6f 72 20 63 61 63  a global for cac
4920: 68 69 6e 67 2e 20 4e 65 65 64 20 61 20 62 65 74  hing. Need a bet
4930: 74 65 72 20 77 61 79 3f 0a 20 20 20 20 28 69 66  ter way?.    (if
4940: 20 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 62 6c   (not (hash-tabl
4950: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 2a 74  e-ref/default *t
4960: 65 73 74 2d 6d 65 74 61 2d 75 70 64 61 74 65 64  est-meta-updated
4970: 2a 20 74 65 73 74 2d 6e 61 6d 65 20 23 66 29 29  * test-name #f))
4980: 0a 20 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a  .        (begin.
4990: 09 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d  .   (hash-table-
49a0: 73 65 74 21 20 2a 74 65 73 74 2d 6d 65 74 61 2d  set! *test-meta-
49b0: 75 70 64 61 74 65 64 2a 20 74 65 73 74 2d 6e 61  updated* test-na
49c0: 6d 65 20 23 74 29 0a 20 20 20 20 20 20 20 20 20  me #t).         
49d0: 20 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74    (runs:update-t
49e0: 65 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74  est_meta db test
49f0: 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29  -name test-conf)
4a00: 29 29 0a 20 20 20 20 0a 20 20 20 20 3b 3b 20 28  )).    .    ;; (
4a10: 6c 61 6d 62 64 61 20 28 69 74 65 6d 64 61 74 29  lambda (itemdat)
4a20: 20 3b 3b 3b 20 28 28 72 69 70 65 6e 65 73 73 20   ;;; ((ripeness 
4a30: 22 6f 76 65 72 72 69 70 65 22 29 20 28 74 65 6d  "overripe") (tem
4a40: 70 65 72 61 74 75 72 65 20 22 63 6f 6f 6c 22 29  perature "cool")
4a50: 20 28 73 65 61 73 6f 6e 20 22 73 75 6d 6d 65 72   (season "summer
4a60: 22 29 29 0a 20 20 20 20 28 6c 65 74 2a 20 28 28  ")).    (let* ((
4a70: 6e 65 77 2d 74 65 73 74 2d 70 61 74 68 20 28 73  new-test-path (s
4a80: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73  tring-interspers
4a90: 65 20 28 63 6f 6e 73 20 74 65 73 74 2d 70 61 74  e (cons test-pat
4aa0: 68 20 28 6d 61 70 20 63 61 64 72 20 69 74 65 6d  h (map cadr item
4ab0: 64 61 74 29 29 20 22 2f 22 29 29 0a 09 20 20 20  dat)) "/"))..   
4ac0: 28 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 28  (new-test-name (
4ad0: 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65 6d 2d  if (equal? item-
4ae0: 70 61 74 68 20 22 22 29 20 74 65 73 74 2d 6e 61  path "") test-na
4af0: 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 2d 6e 61  me (conc test-na
4b00: 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68  me "/" item-path
4b10: 29 29 29 20 3b 3b 20 6a 75 73 74 20 6e 65 65 64  ))) ;; just need
4b20: 20 69 74 20 74 6f 20 62 65 20 75 6e 69 71 75 65   it to be unique
4b30: 0a 09 20 20 20 28 74 65 73 74 64 61 74 20 20 20  ..   (testdat   
4b40: 20 20 20 20 28 64 62 3a 67 65 74 2d 74 65 73 74      (db:get-test
4b50: 2d 69 6e 66 6f 20 64 62 20 72 75 6e 2d 69 64 20  -info db run-id 
4b60: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70  test-name item-p
4b70: 61 74 68 29 29 0a 09 20 20 20 28 74 65 73 74 2d  ath))..   (test-
4b80: 69 64 20 20 20 20 20 20 20 23 66 29 29 0a 20 20  id       #f)).  
4b90: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 74 65 73      (if (not tes
4ba0: 74 64 61 74 29 0a 09 20 20 28 62 65 67 69 6e 0a  tdat)..  (begin.
4bb0: 09 20 20 20 20 3b 3b 20 65 6e 73 75 72 65 20 74  .    ;; ensure t
4bc0: 68 61 74 20 74 68 65 20 70 61 74 68 20 65 78 69  hat the path exi
4bd0: 73 74 73 20 62 65 66 6f 72 65 20 72 65 67 69 73  sts before regis
4be0: 74 65 72 69 6e 67 20 74 68 65 20 74 65 73 74 0a  tering the test.
4bf0: 09 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 43 61  .    ;; NOPE: Ca
4c00: 6e 6e 6f 74 21 20 44 6f 6e 27 74 20 6b 6e 6f 77  nnot! Don't know
4c10: 20 79 65 74 20 77 68 69 63 68 20 64 69 73 6b 20   yet which disk 
4c20: 61 72 65 61 20 77 69 6c 6c 20 62 65 20 61 73 73  area will be ass
4c30: 69 67 6e 65 64 2e 2e 2e 2e 0a 09 20 20 20 20 3b  igned......    ;
4c40: 3b 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20  ; (system (conc 
4c50: 22 6d 6b 64 69 72 20 2d 70 20 22 20 6e 65 77 2d  "mkdir -p " new-
4c60: 74 65 73 74 2d 70 61 74 68 29 29 0a 09 20 20 20  test-path))..   
4c70: 20 28 72 74 65 73 74 73 3a 72 65 67 69 73 74 65   (rtests:registe
4c80: 72 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64  r-test db run-id
4c90: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d   test-name item-
4ca0: 70 61 74 68 29 0a 09 20 20 20 20 28 73 65 74 21  path)..    (set!
4cb0: 20 74 65 73 74 64 61 74 20 28 64 62 3a 67 65 74   testdat (db:get
4cc0: 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 20 72 75  -test-info db ru
4cd0: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69  n-id test-name i
4ce0: 74 65 6d 2d 70 61 74 68 29 29 29 29 0a 20 20 20  tem-path)))).   
4cf0: 20 20 20 28 73 65 74 21 20 74 65 73 74 2d 69 64     (set! test-id
4d00: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64   (db:test-get-id
4d10: 20 74 65 73 74 64 61 74 29 29 0a 20 20 20 20 20   testdat)).     
4d20: 20 28 63 68 61 6e 67 65 2d 64 69 72 65 63 74 6f   (change-directo
4d30: 72 79 20 74 65 73 74 2d 70 61 74 68 29 0a 20 20  ry test-path).  
4d40: 20 20 20 20 28 63 61 73 65 20 28 69 66 20 66 6f      (case (if fo
4d50: 72 63 65 20 3b 3b 20 28 61 72 67 73 3a 67 65 74  rce ;; (args:get
4d60: 2d 61 72 67 20 22 2d 66 6f 72 63 65 22 29 0a 09  -arg "-force")..
4d70: 09 27 4e 4f 54 5f 53 54 41 52 54 45 44 0a 09 09  .'NOT_STARTED...
4d80: 28 69 66 20 74 65 73 74 64 61 74 0a 09 09 20 20  (if testdat...  
4d90: 20 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62 6f    (string->symbo
4da0: 6c 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  l (test:get-stat
4db0: 65 20 74 65 73 74 64 61 74 29 29 0a 09 09 20 20  e testdat))...  
4dc0: 20 20 27 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73    'failed-to-ins
4dd0: 65 72 74 29 29 0a 09 28 28 66 61 69 6c 65 64 2d  ert))..((failed-
4de0: 74 6f 2d 69 6e 73 65 72 74 29 0a 09 20 28 64 65  to-insert).. (de
4df0: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52  bug:print 0 "ERR
4e00: 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 69 6e  OR: Failed to in
4e10: 73 65 72 74 20 74 68 65 20 72 65 63 6f 72 64 20  sert the record 
4e20: 69 6e 74 6f 20 74 68 65 20 64 62 22 29 29 0a 09  into the db"))..
4e30: 28 28 4e 4f 54 5f 53 54 41 52 54 45 44 20 43 4f  ((NOT_STARTED CO
4e40: 4d 50 4c 45 54 45 44 29 0a 09 20 28 64 65 62 75  MPLETED).. (debu
4e50: 67 3a 70 72 69 6e 74 20 36 20 22 47 6f 74 20 68  g:print 6 "Got h
4e60: 65 72 65 2c 20 22 20 28 74 65 73 74 3a 67 65 74  ere, " (test:get
4e70: 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 29  -state testdat))
4e80: 0a 09 20 28 6c 65 74 20 28 28 72 75 6e 66 6c 61  .. (let ((runfla
4e90: 67 20 23 66 29 29 0a 09 20 20 20 28 63 6f 6e 64  g #f))..   (cond
4ea0: 0a 09 20 20 20 20 3b 3b 20 2d 66 6f 72 63 65 2c  ..    ;; -force,
4eb0: 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77   run no matter w
4ec0: 68 61 74 0a 09 20 20 20 20 28 66 6f 72 63 65 20  hat..    (force 
4ed0: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74  (set! runflag #t
4ee0: 29 29 0a 09 20 20 20 20 3b 3b 20 4e 4f 54 5f 53  ))..    ;; NOT_S
4ef0: 54 41 52 54 45 44 2c 20 72 75 6e 20 6e 6f 20 6d  TARTED, run no m
4f00: 61 74 74 65 72 20 77 68 61 74 0a 09 20 20 20 20  atter what..    
4f10: 28 28 65 71 75 61 6c 3f 20 28 74 65 73 74 3a 67  ((equal? (test:g
4f20: 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74  et-state testdat
4f30: 29 20 22 4e 4f 54 5f 53 54 41 52 54 45 44 22 29  ) "NOT_STARTED")
4f40: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74  (set! runflag #t
4f50: 29 29 0a 09 20 20 20 20 3b 3b 20 6e 6f 74 20 2d  ))..    ;; not -
4f60: 72 65 72 75 6e 20 61 6e 64 20 50 41 53 53 2c 20  rerun and PASS, 
4f70: 57 41 52 4e 20 6f 72 20 43 48 45 43 4b 2c 20 64  WARN or CHECK, d
4f80: 6f 20 6e 6f 20 72 75 6e 0a 09 20 20 20 20 28 28  o no run..    ((
4f90: 61 6e 64 20 28 6f 72 20 28 6e 6f 74 20 72 65 72  and (or (not rer
4fa0: 75 6e 29 0a 09 09 20 20 20 20 20 20 6b 65 65 70  un)...      keep
4fb0: 67 6f 69 6e 67 29 0a 09 09 20 20 3b 3b 20 52 65  going)...  ;; Re
4fc0: 71 75 69 72 65 20 74 6f 20 66 6f 72 63 65 20 72  quire to force r
4fd0: 65 2d 72 75 6e 20 66 6f 72 20 43 4f 4d 50 4c 45  e-run for COMPLE
4fe0: 54 45 44 20 6f 72 20 2a 61 6e 79 74 68 69 6e 67  TED or *anything
4ff0: 2a 20 2b 20 50 41 53 53 2c 57 41 52 4e 20 6f 72  * + PASS,WARN or
5000: 20 43 48 45 43 4b 0a 09 09 20 20 28 6f 72 20 28   CHECK...  (or (
5010: 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74  member (test:get
5020: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29  -status testdat)
5030: 20 27 28 22 50 41 53 53 22 20 22 57 41 52 4e 22   '("PASS" "WARN"
5040: 20 22 43 48 45 43 4b 22 29 29 0a 09 09 20 20 20   "CHECK"))...   
5050: 20 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74     (member (test
5060: 3a 67 65 74 2d 73 74 61 74 65 20 20 74 65 73 74  :get-state  test
5070: 64 61 74 29 20 27 28 22 43 4f 4d 50 4c 45 54 45  dat) '("COMPLETE
5080: 44 22 29 29 29 29 20 0a 09 20 20 20 20 20 28 64  D")))) ..     (d
5090: 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 49 4e  ebug:print 2 "IN
50a0: 46 4f 3a 20 72 75 6e 6e 69 6e 67 20 74 65 73 74  FO: running test
50b0: 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22   " test-name "/"
50c0: 20 69 74 65 6d 2d 70 61 74 68 20 22 20 73 75 70   item-path " sup
50d0: 70 72 65 73 73 65 64 20 61 73 20 69 74 20 69 73  pressed as it is
50e0: 20 43 4f 4d 50 4c 45 54 45 44 20 61 6e 64 20 22   COMPLETED and "
50f0: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65   (test:get-state
5100: 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20   testdat))..    
5110: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23   (set! runflag #
5120: 66 29 29 0a 09 20 20 20 20 3b 3b 20 2d 72 65 72  f))..    ;; -rer
5130: 75 6e 20 61 6e 64 20 73 74 61 74 75 73 20 69 73  un and status is
5140: 20 6f 6e 65 20 6f 66 20 74 68 65 20 73 70 65 63   one of the spec
5150: 69 66 65 64 2c 20 72 75 6e 20 69 74 0a 09 20 20  ifed, run it..  
5160: 20 20 28 28 61 6e 64 20 72 65 72 75 6e 0a 09 09    ((and rerun...
5170: 20 20 28 6c 65 74 2a 20 28 28 72 65 72 75 6e 6c    (let* ((rerunl
5180: 73 74 20 20 20 28 73 74 72 69 6e 67 2d 73 70 6c  st   (string-spl
5190: 69 74 20 72 65 72 75 6e 20 22 2c 22 29 29 0a 09  it rerun ","))..
51a0: 09 09 20 28 6d 75 73 74 2d 72 65 72 75 6e 20 28  .. (must-rerun (
51b0: 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74  member (test:get
51c0: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29  -status testdat)
51d0: 20 72 65 72 75 6e 6c 73 74 29 29 29 0a 09 09 20   rerunlst)))... 
51e0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
51f0: 33 20 22 49 4e 46 4f 3a 20 2d 72 65 72 75 6e 20  3 "INFO: -rerun 
5200: 6c 69 73 74 3a 20 22 20 72 65 72 75 6e 20 22 2c  list: " rerun ",
5210: 20 74 65 73 74 2d 73 74 61 74 75 73 3a 20 22 20   test-status: " 
5220: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73  (test:get-status
5230: 20 74 65 73 74 64 61 74 29 22 2c 20 6d 75 73 74   testdat)", must
5240: 2d 72 65 72 75 6e 3a 20 22 20 6d 75 73 74 2d 72  -rerun: " must-r
5250: 65 72 75 6e 29 0a 09 09 20 20 20 20 6d 75 73 74  erun)...    must
5260: 2d 72 65 72 75 6e 29 29 0a 09 20 20 20 20 20 28  -rerun))..     (
5270: 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 49  debug:print 2 "I
5280: 4e 46 4f 3a 20 52 65 72 75 6e 20 66 6f 72 63 65  NFO: Rerun force
5290: 64 20 66 6f 72 20 74 65 73 74 20 22 20 74 65 73  d for test " tes
52a0: 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d  t-name "/" item-
52b0: 70 61 74 68 29 0a 09 20 20 20 20 20 28 73 65 74  path)..     (set
52c0: 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09  ! runflag #t))..
52d0: 20 20 20 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e      ;; -keepgoin
52e0: 67 2c 20 64 6f 20 6e 6f 74 20 72 65 72 75 6e 20  g, do not rerun 
52f0: 46 41 49 4c 0a 09 20 20 20 20 28 28 61 6e 64 20  FAIL..    ((and 
5300: 6b 65 65 70 67 6f 69 6e 67 0a 09 09 20 20 28 6d  keepgoing...  (m
5310: 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d  ember (test:get-
5320: 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20  status testdat) 
5330: 27 28 22 46 41 49 4c 22 29 29 29 0a 09 20 20 20  '("FAIL")))..   
5340: 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20    (set! runflag 
5350: 23 66 29 29 0a 09 20 20 20 20 28 28 61 6e 64 20  #f))..    ((and 
5360: 28 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09 20 20  (not rerun)...  
5370: 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65  (member (test:ge
5380: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74  t-status testdat
5390: 29 20 27 28 22 46 41 49 4c 22 20 22 6e 2f 61 22  ) '("FAIL" "n/a"
53a0: 29 29 29 0a 09 20 20 20 20 20 28 73 65 74 21 20  )))..     (set! 
53b0: 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20  runflag #t))..  
53c0: 20 20 28 65 6c 73 65 20 28 73 65 74 21 20 72 75    (else (set! ru
53d0: 6e 66 6c 61 67 20 23 66 29 29 29 0a 09 20 20 20  nflag #f)))..   
53e0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 36 20 22  (debug:print 6 "
53f0: 52 55 4e 4e 49 4e 47 20 3d 3e 20 72 75 6e 66 6c  RUNNING => runfl
5400: 61 67 3a 20 22 20 72 75 6e 66 6c 61 67 20 22 20  ag: " runflag " 
5410: 53 54 41 54 45 3a 20 22 20 28 74 65 73 74 3a 67  STATE: " (test:g
5420: 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74  et-state testdat
5430: 29 20 22 20 53 54 41 54 55 53 3a 20 22 20 28 74  ) " STATUS: " (t
5440: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74  est:get-status t
5450: 65 73 74 64 61 74 29 29 0a 09 20 20 20 28 69 66  estdat))..   (if
5460: 20 28 6e 6f 74 20 72 75 6e 66 6c 61 67 29 0a 09   (not runflag)..
5470: 20 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20         (if (not 
5480: 70 61 72 65 6e 74 2d 74 65 73 74 29 0a 09 09 20  parent-test)... 
5490: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31    (debug:print 1
54a0: 20 22 4e 4f 54 45 3a 20 4e 6f 74 20 73 74 61 72   "NOTE: Not star
54b0: 74 69 6e 67 20 74 65 73 74 20 22 20 6e 65 77 2d  ting test " new-
54c0: 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 73 20 69  test-name " as i
54d0: 74 20 69 73 20 73 74 61 74 65 20 5c 22 22 20 28  t is state \"" (
54e0: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74  test:get-state t
54f0: 65 73 74 64 61 74 29 20 0a 09 09 09 09 22 5c 22  estdat) ....."\"
5500: 20 61 6e 64 20 73 74 61 74 75 73 20 5c 22 22 20   and status \"" 
5510: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73  (test:get-status
5520: 20 74 65 73 74 64 61 74 29 20 22 5c 22 2c 20 75   testdat) "\", u
5530: 73 65 20 2d 72 65 72 75 6e 20 5c 22 22 20 28 74  se -rerun \"" (t
5540: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74  est:get-status t
5550: 65 73 74 64 61 74 29 0a 20 20 20 20 20 20 20 20  estdat).        
5560: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
5570: 20 20 20 20 20 20 20 20 22 5c 22 20 6f 72 20 2d          "\" or -
5580: 66 6f 72 63 65 20 74 6f 20 6f 76 65 72 72 69 64  force to overrid
5590: 65 22 29 29 0a 09 20 20 20 20 20 20 20 3b 3b 20  e"))..       ;; 
55a0: 4e 4f 54 45 3a 20 4e 6f 20 6c 6f 6e 67 65 72 20  NOTE: No longer 
55b0: 62 65 20 63 68 65 63 6b 69 6e 67 20 70 72 65 72  be checking prer
55c0: 65 71 75 69 73 69 74 65 73 20 68 65 72 65 21 20  equisites here! 
55d0: 57 69 6c 6c 20 6e 65 76 65 72 20 67 65 74 20 68  Will never get h
55e0: 65 72 65 20 75 6e 6c 65 73 73 20 70 72 65 72 65  ere unless prere
55f0: 71 73 20 61 72 65 0a 09 20 20 20 20 20 20 20 3b  qs are..       ;
5600: 3b 20 20 20 20 20 20 20 61 6c 72 65 61 64 79 20  ;       already 
5610: 6d 65 74 2e 0a 09 20 20 20 20 20 20 20 28 69 66  met...       (if
5620: 20 28 6e 6f 74 20 28 6c 61 75 6e 63 68 2d 74 65   (not (launch-te
5630: 73 74 20 64 62 20 72 75 6e 2d 69 64 20 72 75 6e  st db run-id run
5640: 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 20 6b  name test-conf k
5650: 65 79 76 61 6c 6c 73 74 20 74 65 73 74 2d 6e 61  eyvallst test-na
5660: 6d 65 20 74 65 73 74 2d 70 61 74 68 20 69 74 65  me test-path ite
5670: 6d 64 61 74 20 66 6c 61 67 73 29 29 0a 09 09 20  mdat flags))... 
5680: 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20    (begin...     
5690: 28 70 72 69 6e 74 20 22 45 52 52 4f 52 3a 20 46  (print "ERROR: F
56a0: 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 20  ailed to launch 
56b0: 74 68 65 20 74 65 73 74 2e 20 45 78 69 74 69 6e  the test. Exitin
56c0: 67 20 61 73 20 73 6f 6f 6e 20 61 73 20 70 6f 73  g as soon as pos
56d0: 73 69 62 6c 65 22 29 0a 09 09 20 20 20 20 20 28  sible")...     (
56e0: 73 65 74 21 20 2a 67 6c 6f 62 61 6c 65 78 69 74  set! *globalexit
56f0: 73 74 61 74 75 73 2a 20 31 29 20 3b 3b 20 0a 09  status* 1) ;; ..
5700: 09 20 20 20 20 20 28 70 72 6f 63 65 73 73 2d 73  .     (process-s
5710: 69 67 6e 61 6c 20 28 63 75 72 72 65 6e 74 2d 70  ignal (current-p
5720: 72 6f 63 65 73 73 2d 69 64 29 20 73 69 67 6e 61  rocess-id) signa
5730: 6c 2f 6b 69 6c 6c 29 29 29 29 29 29 0a 09 28 28  l/kill))))))..((
5740: 4b 49 4c 4c 45 44 29 20 0a 09 20 28 64 65 62 75  KILLED) .. (debu
5750: 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a  g:print 1 "NOTE:
5760: 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65   " new-test-name
5770: 20 22 20 69 73 20 61 6c 72 65 61 64 79 20 72 75   " is already ru
5780: 6e 6e 69 6e 67 20 6f 72 20 77 61 73 20 65 78 70  nning or was exp
5790: 6c 69 63 74 6c 79 20 6b 69 6c 6c 65 64 2c 20 75  lictly killed, u
57a0: 73 65 20 2d 66 6f 72 63 65 20 74 6f 20 6c 61 75  se -force to lau
57b0: 6e 63 68 20 69 74 2e 22 29 29 0a 09 28 28 4c 41  nch it."))..((LA
57c0: 55 4e 43 48 45 44 20 52 45 4d 4f 54 45 48 4f 53  UNCHED REMOTEHOS
57d0: 54 53 54 41 52 54 20 52 55 4e 4e 49 4e 47 29 20  TSTART RUNNING) 
57e0: 20 0a 09 20 28 69 66 20 28 3e 20 28 2d 20 28 63   .. (if (> (- (c
57f0: 75 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73 29 28  urrent-seconds)(
5800: 2b 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 65  + (db:test-get-e
5810: 76 65 6e 74 5f 74 69 6d 65 20 74 65 73 74 64 61  vent_time testda
5820: 74 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 64  t).....       (d
5830: 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 5f 64  b:test-get-run_d
5840: 75 72 61 74 69 6f 6e 20 74 65 73 74 64 61 74 29  uration testdat)
5850: 29 29 0a 09 09 36 30 30 29 20 3b 3b 20 69 2e 65  ))...600) ;; i.e
5860: 2e 20 6e 6f 20 75 70 64 61 74 65 20 66 6f 72 20  . no update for 
5870: 6d 6f 72 65 20 74 68 61 6e 20 36 30 30 20 73 65  more than 600 se
5880: 63 6f 6e 64 73 0a 09 20 20 20 20 20 28 62 65 67  conds..     (beg
5890: 69 6e 0a 09 20 20 20 20 20 20 20 28 64 65 62 75  in..       (debu
58a0: 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49  g:print 0 "WARNI
58b0: 4e 47 3a 20 54 65 73 74 20 22 20 74 65 73 74 2d  NG: Test " test-
58c0: 6e 61 6d 65 20 22 20 61 70 70 65 61 72 73 20 74  name " appears t
58d0: 6f 20 62 65 20 64 65 61 64 2e 20 46 6f 72 63 69  o be dead. Forci
58e0: 6e 67 20 69 74 20 74 6f 20 73 74 61 74 65 20 49  ng it to state I
58f0: 4e 43 4f 4d 50 4c 45 54 45 20 61 6e 64 20 73 74  NCOMPLETE and st
5900: 61 74 75 73 20 53 54 55 43 4b 2f 44 45 41 44 22  atus STUCK/DEAD"
5910: 29 0a 09 20 20 20 20 20 20 20 28 74 65 73 74 2d  )..       (test-
5920: 73 65 74 2d 73 74 61 74 75 73 21 20 64 62 20 74  set-status! db t
5930: 65 73 74 2d 69 64 20 22 49 4e 43 4f 4d 50 4c 45  est-id "INCOMPLE
5940: 54 45 22 20 22 53 54 55 43 4b 2f 44 45 41 44 22  TE" "STUCK/DEAD"
5950: 20 22 54 65 73 74 20 69 73 20 73 74 75 63 6b 20   "Test is stuck 
5960: 6f 72 20 64 65 61 64 22 20 23 66 29 29 0a 09 20  or dead" #f)).. 
5970: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
5980: 20 32 20 22 4e 4f 54 45 3a 20 22 20 74 65 73 74   2 "NOTE: " test
5990: 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72 65 61  -name " is alrea
59a0: 64 79 20 72 75 6e 6e 69 6e 67 22 29 29 29 0a 09  dy running")))..
59b0: 28 65 6c 73 65 20 20 20 20 20 20 20 28 64 65 62  (else       (deb
59c0: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f  ug:print 0 "ERRO
59d0: 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c 61 75  R: Failed to lau
59e0: 6e 63 68 20 74 65 73 74 20 22 20 6e 65 77 2d 74  nch test " new-t
59f0: 65 73 74 2d 6e 61 6d 65 20 22 2e 20 55 6e 72 65  est-name ". Unre
5a00: 63 6f 67 6e 69 73 65 64 20 73 74 61 74 65 20 22  cognised state "
5a10: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65   (test:get-state
5a20: 20 74 65 73 74 64 61 74 29 29 29 29 29 29 29 0a   testdat))))))).
5a30: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  .;;=============
5a40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5a50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5a60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5a70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 45 4e 44  =========.;; END
5a80: 20 4f 46 20 4e 45 57 20 53 54 55 46 46 0a 3b 3b   OF NEW STUFF.;;
5a90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5aa0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5ab0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5ac0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5ad0: 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65 20  ======..(define 
5ae0: 28 67 65 74 2d 64 69 72 2d 75 70 2d 6e 20 64 69  (get-dir-up-n di
5af0: 72 20 2e 20 70 61 72 61 6d 73 29 20 0a 20 20 28  r . params) .  (
5b00: 6c 65 74 20 28 28 64 70 61 72 74 73 20 20 28 73  let ((dparts  (s
5b10: 74 72 69 6e 67 2d 73 70 6c 69 74 20 64 69 72 20  tring-split dir 
5b20: 22 2f 22 29 29 0a 09 28 63 6f 75 6e 74 20 20 20  "/"))..(count   
5b30: 28 69 66 20 28 6e 75 6c 6c 3f 20 70 61 72 61 6d  (if (null? param
5b40: 73 29 20 31 20 28 63 61 72 20 70 61 72 61 6d 73  s) 1 (car params
5b50: 29 29 29 29 0a 20 20 20 20 28 63 6f 6e 63 20 22  )))).    (conc "
5b60: 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72  /" (string-inter
5b70: 73 70 65 72 73 65 20 0a 09 20 20 20 20 20 20 20  sperse ..       
5b80: 28 74 61 6b 65 20 64 70 61 72 74 73 20 28 2d 20  (take dparts (- 
5b90: 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73 29 20  (length dparts) 
5ba0: 63 6f 75 6e 74 29 29 0a 09 20 20 20 20 20 20 20  count))..       
5bb0: 22 2f 22 29 29 29 29 0a 3b 3b 20 52 65 6d 6f 76  "/")))).;; Remov
5bc0: 65 20 72 75 6e 73 0a 3b 3b 20 66 69 65 6c 64 73  e runs.;; fields
5bd0: 20 61 72 65 20 70 61 73 73 69 6e 67 20 69 6e 20   are passing in 
5be0: 74 68 72 6f 75 67 68 20 0a 28 64 65 66 69 6e 65  through .(define
5bf0: 20 28 72 75 6e 73 3a 72 65 6d 6f 76 65 2d 72 75   (runs:remove-ru
5c00: 6e 73 20 64 62 20 72 75 6e 6e 61 6d 65 70 61 74  ns db runnamepat
5c10: 74 20 74 65 73 74 70 61 74 74 20 69 74 65 6d 70  t testpatt itemp
5c20: 61 74 74 20 23 21 6b 65 79 20 28 73 74 61 74 65  att #!key (state
5c30: 20 23 66 29 28 73 74 61 74 75 73 20 23 66 29 29   #f)(status #f))
5c40: 0a 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73 20  .  (let* ((keys 
5c50: 20 20 20 20 20 20 20 28 72 64 62 3a 67 65 74 2d         (rdb:get-
5c60: 6b 65 79 73 20 64 62 29 29 0a 09 20 28 72 75 6e  keys db)).. (run
5c70: 64 61 74 20 20 20 20 20 20 28 72 75 6e 73 3a 67  dat      (runs:g
5c80: 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74 74 20  et-runs-by-patt 
5c90: 64 62 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65 70  db keys runnamep
5ca0: 61 74 74 29 29 0a 09 20 28 68 65 61 64 65 72 20  att)).. (header 
5cb0: 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66       (vector-ref
5cc0: 20 72 75 6e 64 61 74 20 30 29 29 0a 09 20 28 72   rundat 0)).. (r
5cd0: 75 6e 73 20 20 20 20 20 20 20 20 28 76 65 63 74  uns        (vect
5ce0: 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 31 29  or-ref rundat 1)
5cf0: 29 0a 09 20 28 73 74 61 74 65 73 20 20 20 20 20  ).. (states     
5d00: 20 28 69 66 20 73 74 61 74 65 20 20 28 73 74 72   (if state  (str
5d10: 69 6e 67 2d 73 70 6c 69 74 20 73 74 61 74 65 20  ing-split state 
5d20: 20 22 2c 22 29 20 27 28 29 29 29 0a 09 20 28 73   ",") '())).. (s
5d30: 74 61 74 75 73 65 73 20 20 20 20 28 69 66 20 73  tatuses    (if s
5d40: 74 61 74 75 73 20 28 73 74 72 69 6e 67 2d 73 70  tatus (string-sp
5d50: 6c 69 74 20 73 74 61 74 75 73 20 22 2c 22 29 20  lit status ",") 
5d60: 27 28 29 29 29 29 0a 20 20 20 20 28 64 65 62 75  '()))).    (debu
5d70: 67 3a 70 72 69 6e 74 20 31 20 22 48 65 61 64 65  g:print 1 "Heade
5d80: 72 3a 20 22 20 68 65 61 64 65 72 29 0a 20 20 20  r: " header).   
5d90: 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20   (for-each.     
5da0: 28 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a 20 20  (lambda (run).  
5db0: 20 20 20 20 20 28 6c 65 74 20 28 28 72 75 6e 6b       (let ((runk
5dc0: 65 79 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72  ey (string-inter
5dd0: 73 70 65 72 73 65 20 28 6d 61 70 20 28 6c 61 6d  sperse (map (lam
5de0: 62 64 61 20 28 6b 29 0a 09 09 09 09 09 09 28 64  bda (k).......(d
5df0: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68  b:get-value-by-h
5e00: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72  eader run header
5e10: 20 28 76 65 63 74 6f 72 2d 72 65 66 20 6b 20 30   (vector-ref k 0
5e20: 29 29 29 20 6b 65 79 73 29 20 22 2f 22 29 29 0a  ))) keys) "/")).
5e30: 09 20 20 20 20 20 28 64 69 72 73 2d 74 6f 2d 72  .     (dirs-to-r
5e40: 65 6d 6f 76 65 20 28 6d 61 6b 65 2d 68 61 73 68  emove (make-hash
5e50: 2d 74 61 62 6c 65 29 29 29 0a 09 20 28 6c 65 74  -table))).. (let
5e60: 2a 20 28 28 72 75 6e 2d 69 64 20 20 20 20 28 64  * ((run-id    (d
5e70: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68  b:get-value-by-h
5e80: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72  eader run header
5e90: 20 22 69 64 22 29 29 0a 09 09 28 72 75 6e 2d 73   "id"))...(run-s
5ea0: 74 61 74 65 20 28 64 62 3a 67 65 74 2d 76 61 6c  tate (db:get-val
5eb0: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e  ue-by-header run
5ec0: 20 68 65 61 64 65 72 20 22 73 74 61 74 65 22 29   header "state")
5ed0: 29 0a 09 09 28 74 65 73 74 73 20 20 20 20 20 28  )...(tests     (
5ee0: 69 66 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20  if (not (equal? 
5ef0: 72 75 6e 2d 73 74 61 74 65 20 22 6c 6f 63 6b 65  run-state "locke
5f00: 64 22 29 29 0a 09 09 09 20 20 20 20 20 20 20 28  d"))....       (
5f10: 72 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f  rdb:get-tests-fo
5f20: 72 2d 72 75 6e 20 64 62 20 28 64 62 3a 67 65 74  r-run db (db:get
5f30: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72  -value-by-header
5f40: 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 22   run header "id"
5f50: 29 20 74 65 73 74 70 61 74 74 20 69 74 65 6d 70  ) testpatt itemp
5f60: 61 74 74 20 73 74 61 74 65 73 20 73 74 61 74 75  att states statu
5f70: 73 65 73 20 6e 6f 74 2d 69 6e 3a 20 23 66 29 0a  ses not-in: #f).
5f80: 09 09 09 20 20 20 20 20 20 20 27 28 29 29 29 0a  ...       '())).
5f90: 09 09 28 6c 61 73 74 74 70 61 74 68 20 22 2f 64  ..(lasttpath "/d
5fa0: 6f 65 73 2f 6e 6f 74 2f 65 78 69 73 74 2f 49 2f  oes/not/exist/I/
5fb0: 68 6f 70 65 22 29 29 0a 0a 09 20 20 20 28 69 66  hope"))...   (if
5fc0: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 73   (not (null? tes
5fd0: 74 73 29 29 0a 09 20 20 20 20 20 20 20 28 62 65  ts))..       (be
5fe0: 67 69 6e 0a 09 09 20 28 64 65 62 75 67 3a 70 72  gin... (debug:pr
5ff0: 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20  int 1 "Removing 
6000: 74 65 73 74 73 20 66 6f 72 20 72 75 6e 3a 20 22  tests for run: "
6010: 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a   runkey " " (db:
6020: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61  get-value-by-hea
6030: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22  der run header "
6040: 72 75 6e 6e 61 6d 65 22 29 29 0a 09 09 20 28 66  runname"))... (f
6050: 6f 72 2d 65 61 63 68 0a 09 09 20 20 28 6c 61 6d  or-each...  (lam
6060: 62 64 61 20 28 74 65 73 74 29 0a 09 09 20 20 20  bda (test)...   
6070: 20 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d 70 61   (let* ((item-pa
6080: 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  th (db:test-get-
6090: 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29  item-path test))
60a0: 0a 09 09 09 20 20 20 28 74 65 73 74 2d 6e 61 6d  ....   (test-nam
60b0: 65 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74  e (db:test-get-t
60c0: 65 73 74 6e 61 6d 65 20 74 65 73 74 29 29 0a 09  estname test))..
60d0: 09 09 20 20 20 28 72 75 6e 2d 64 69 72 20 20 20  ..   (run-dir   
60e0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e  (db:test-get-run
60f0: 64 69 72 20 74 65 73 74 29 29 29 0a 09 09 20 20  dir test)))...  
6100: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
6110: 20 31 20 22 20 20 22 20 28 64 62 3a 74 65 73 74   1 "  " (db:test
6120: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65  -get-testname te
6130: 73 74 29 20 22 20 69 64 3a 20 22 20 28 64 62 3a  st) " id: " (db:
6140: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74  test-get-id test
6150: 29 20 22 20 22 20 69 74 65 6d 2d 70 61 74 68 29  ) " " item-path)
6160: 0a 09 09 20 20 20 20 20 20 28 72 64 62 3a 64 65  ...      (rdb:de
6170: 6c 65 74 65 2d 74 65 73 74 2d 72 65 63 6f 72 64  lete-test-record
6180: 73 20 64 62 20 28 64 62 3a 74 65 73 74 2d 67 65  s db (db:test-ge
6190: 74 2d 69 64 20 74 65 73 74 29 29 0a 09 09 20 20  t-id test))...  
61a0: 20 20 20 20 28 69 66 20 28 3e 20 28 73 74 72 69      (if (> (stri
61b0: 6e 67 2d 6c 65 6e 67 74 68 20 72 75 6e 2d 64 69  ng-length run-di
61c0: 72 29 20 35 29 20 3b 3b 20 62 61 64 20 68 65 75  r) 5) ;; bad heu
61d0: 72 69 73 74 69 63 20 62 75 74 20 73 68 6f 75 6c  ristic but shoul
61e0: 64 20 70 72 65 76 65 6e 74 20 2f 74 6d 70 20 2f  d prevent /tmp /
61f0: 68 6f 6d 65 20 65 74 63 2e 0a 09 09 09 20 20 28  home etc.....  (
6200: 6c 65 74 20 28 28 66 75 6c 6c 70 61 74 68 20 72  let ((fullpath r
6210: 75 6e 2d 64 69 72 29 29 20 3b 3b 20 22 2f 22 20  un-dir)) ;; "/" 
6220: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65  (db:test-get-ite
6230: 6d 2d 70 61 74 68 20 74 65 73 74 29 29 29 29 0a  m-path test)))).
6240: 09 09 09 20 20 20 20 28 73 65 74 21 20 6c 61 73  ...    (set! las
6250: 74 74 70 61 74 68 20 66 75 6c 6c 70 61 74 68 29  ttpath fullpath)
6260: 0a 09 09 09 20 20 20 20 28 68 61 73 68 2d 74 61  ....    (hash-ta
6270: 62 6c 65 2d 73 65 74 21 20 64 69 72 73 2d 74 6f  ble-set! dirs-to
6280: 2d 72 65 6d 6f 76 65 20 66 75 6c 6c 70 61 74 68  -remove fullpath
6290: 20 23 74 29 0a 09 09 09 20 20 20 20 3b 3b 20 54   #t)....    ;; T
62a0: 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 77 61 73  he following was
62b0: 20 74 68 65 20 73 61 66 65 20 64 65 6c 65 74 65   the safe delete
62c0: 20 63 6f 64 65 20 62 75 74 20 69 74 20 77 61 73   code but it was
62d0: 20 6e 6f 74 20 62 65 69 6e 67 20 65 78 65 63 74   not being exect
62e0: 75 74 65 64 2e 0a 09 09 09 20 20 20 20 3b 3b 20  uted.....    ;; 
62f0: 28 6c 65 74 2a 20 28 28 64 69 72 73 2d 63 6f 75  (let* ((dirs-cou
6300: 6e 74 20 28 2b 20 31 20 28 6c 65 6e 67 74 68 20  nt (+ 1 (length 
6310: 6b 65 79 73 29 28 6c 65 6e 67 74 68 20 28 73 74  keys)(length (st
6320: 72 69 6e 67 2d 73 70 6c 69 74 20 69 74 65 6d 2d  ring-split item-
6330: 70 61 74 68 20 22 2f 22 29 29 29 29 0a 09 09 09  path "/"))))....
6340: 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20 28 64      ;;        (d
6350: 69 72 2d 74 6f 2d 72 65 6d 20 28 67 65 74 2d 64  ir-to-rem (get-d
6360: 69 72 2d 75 70 2d 6e 20 66 75 6c 6c 70 61 74 68  ir-up-n fullpath
6370: 20 64 69 72 73 2d 63 6f 75 6e 74 29 29 0a 09 09   dirs-count))...
6380: 09 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20 28  .    ;;        (
6390: 72 65 6d 61 69 6e 69 6e 67 64 20 28 73 74 72 69  remainingd (stri
63a0: 6e 67 2d 73 75 62 73 74 69 74 75 74 65 20 28 72  ng-substitute (r
63b0: 65 67 65 78 70 20 28 63 6f 6e 63 20 22 5e 22 20  egexp (conc "^" 
63c0: 64 69 72 2d 74 6f 2d 72 65 6d 20 22 2f 22 29 29  dir-to-rem "/"))
63d0: 20 22 22 20 66 75 6c 6c 70 61 74 68 29 29 0a 09   "" fullpath))..
63e0: 09 09 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20  ..    ;;        
63f0: 28 63 6d 64 20 28 63 6f 6e 63 20 22 63 64 20 22  (cmd (conc "cd "
6400: 20 64 69 72 2d 74 6f 2d 72 65 6d 20 22 3b 20 72   dir-to-rem "; r
6410: 6d 64 69 72 20 2d 70 20 22 20 72 65 6d 61 69 6e  mdir -p " remain
6420: 69 6e 67 64 20 29 29 29 0a 09 09 09 20 20 20 20  ingd )))....    
6430: 3b 3b 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65  ;;   (if (file-e
6440: 78 69 73 74 73 3f 20 66 75 6c 6c 70 61 74 68 29  xists? fullpath)
6450: 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 20 20 20  ....    ;;      
6460: 20 28 62 65 67 69 6e 0a 09 09 09 20 20 20 20 3b   (begin....    ;
6470: 3b 20 20 20 20 20 20 20 20 20 28 64 65 62 75 67  ;         (debug
6480: 3a 70 72 69 6e 74 20 31 20 63 6d 64 29 0a 09 09  :print 1 cmd)...
6490: 09 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20 20  .    ;;         
64a0: 28 73 79 73 74 65 6d 20 63 6d 64 29 29 29 0a 09  (system cmd)))..
64b0: 09 09 20 20 20 20 3b 3b 20 20 20 29 29 0a 09 09  ..    ;;   ))...
64c0: 09 20 20 20 20 29 29 29 29 0a 09 09 20 20 20 20  .    ))))...    
64d0: 74 65 73 74 73 29 29 29 0a 0a 09 20 20 20 3b 3b  tests)))...   ;;
64e0: 20 6c 6f 6f 6b 20 74 68 6f 75 67 68 20 74 68 65   look though the
64f0: 20 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20   dirs-to-remove 
6500: 66 6f 72 20 63 61 6e 64 69 64 61 74 65 73 20 66  for candidates f
6510: 6f 72 20 72 65 6d 6f 76 61 6c 2e 20 44 6f 20 74  or removal. Do t
6520: 68 69 73 20 61 66 74 65 72 20 64 65 6c 65 74 69  his after deleti
6530: 6e 67 20 74 68 65 20 72 65 63 6f 72 64 73 0a 09  ng the records..
6540: 20 20 20 3b 3b 20 66 6f 72 20 65 61 63 68 20 74     ;; for each t
6550: 65 73 74 20 69 6e 20 63 61 73 65 20 77 65 20 67  est in case we g
6560: 65 74 20 6b 69 6c 6c 65 64 2e 20 54 68 61 74 20  et killed. That 
6570: 73 68 6f 75 6c 64 20 6d 69 6e 69 6d 69 7a 65 20  should minimize 
6580: 74 68 65 20 64 65 74 72 69 74 75 73 20 6c 65 66  the detritus lef
6590: 74 20 6f 6e 20 64 69 73 6b 0a 09 20 20 20 3b 3b  t on disk..   ;;
65a0: 20 70 72 6f 63 65 73 73 20 74 68 65 20 64 69 72   process the dir
65b0: 73 20 66 72 6f 6d 20 6c 6f 6e 67 65 73 74 20 73  s from longest s
65c0: 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 74 6f 20  tring length to 
65d0: 73 68 6f 72 74 65 73 74 0a 09 20 20 20 28 66 6f  shortest..   (fo
65e0: 72 2d 65 61 63 68 20 0a 09 20 20 20 20 28 6c 61  r-each ..    (la
65f0: 6d 62 64 61 20 28 64 69 72 2d 74 6f 2d 72 65 6d  mbda (dir-to-rem
6600: 6f 76 65 29 0a 09 20 20 20 20 20 20 28 69 66 20  ove)..      (if 
6610: 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 64 69  (file-exists? di
6620: 72 2d 74 6f 2d 72 65 6d 6f 76 65 29 0a 09 09 20  r-to-remove)... 
6630: 20 28 6c 65 74 20 28 28 64 69 72 2d 69 6e 2d 64   (let ((dir-in-d
6640: 62 20 27 28 29 29 29 0a 09 09 20 20 20 20 28 73  b '()))...    (s
6650: 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d  qlite3:for-each-
6660: 72 6f 77 0a 09 09 20 20 20 20 20 28 6c 61 6d 62  row...     (lamb
6670: 64 61 20 28 64 69 72 29 0a 09 09 20 20 20 20 20  da (dir)...     
6680: 20 20 28 73 65 74 21 20 64 69 72 2d 69 6e 2d 64    (set! dir-in-d
6690: 62 20 28 63 6f 6e 73 20 64 69 72 20 64 69 72 2d  b (cons dir dir-
66a0: 69 6e 2d 64 62 29 29 29 0a 09 09 20 20 20 20 20  in-db)))...     
66b0: 64 62 20 22 53 45 4c 45 43 54 20 72 75 6e 64 69  db "SELECT rundi
66c0: 72 20 46 52 4f 4d 20 74 65 73 74 73 20 57 48 45  r FROM tests WHE
66d0: 52 45 20 72 75 6e 64 69 72 20 4c 49 4b 45 20 3f  RE rundir LIKE ?
66e0: 3b 22 20 0a 09 09 20 20 20 20 20 28 63 6f 6e 63  ;" ...     (conc
66f0: 20 22 25 22 20 64 69 72 2d 74 6f 2d 72 65 6d 6f   "%" dir-to-remo
6700: 76 65 20 22 25 22 29 29 20 3b 3b 20 79 65 73 2c  ve "%")) ;; yes,
6710: 20 49 27 6d 20 67 6f 69 6e 67 20 74 6f 20 62 61   I'm going to ba
6720: 69 6c 20 69 66 20 74 68 65 72 65 20 69 73 20 61  il if there is a
6730: 6e 79 74 68 69 6e 67 20 6c 69 6b 65 20 74 68 69  nything like thi
6740: 73 20 64 69 72 20 69 6e 20 74 68 65 20 64 62 0a  s dir in the db.
6750: 09 09 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f  ..    (if (null?
6760: 20 64 69 72 2d 69 6e 2d 64 62 29 0a 09 09 09 28   dir-in-db)....(
6770: 62 65 67 69 6e 0a 09 09 09 20 20 28 64 65 62 75  begin....  (debu
6780: 67 3a 70 72 69 6e 74 20 32 20 22 52 65 6d 6f 76  g:print 2 "Remov
6790: 69 6e 67 20 64 69 72 65 63 74 6f 72 79 20 77 69  ing directory wi
67a0: 74 68 20 7a 65 72 6f 20 64 62 20 72 65 66 65 72  th zero db refer
67b0: 65 6e 63 65 73 3a 20 22 20 64 69 72 2d 74 6f 2d  ences: " dir-to-
67c0: 72 65 6d 6f 76 65 29 0a 09 09 09 20 20 28 73 79  remove)....  (sy
67d0: 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 20 2d  stem (conc "rm -
67e0: 72 66 20 22 20 64 69 72 2d 74 6f 2d 72 65 6d 6f  rf " dir-to-remo
67f0: 76 65 29 29 0a 09 09 09 20 20 28 68 61 73 68 2d  ve))....  (hash-
6800: 74 61 62 6c 65 2d 64 65 6c 65 74 65 21 20 64 69  table-delete! di
6810: 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 64 69 72  rs-to-remove dir
6820: 2d 74 6f 2d 72 65 6d 6f 76 65 29 29 0a 09 09 09  -to-remove))....
6830: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22  (debug:print 2 "
6840: 53 6b 69 70 70 69 6e 67 20 72 65 6d 6f 76 61 6c  Skipping removal
6850: 20 6f 66 20 22 20 64 69 72 2d 74 6f 2d 72 65 6d   of " dir-to-rem
6860: 6f 76 65 20 22 20 66 6f 72 20 6e 6f 77 20 61 73  ove " for now as
6870: 20 69 74 20 73 74 69 6c 6c 20 68 61 73 20 72 65   it still has re
6880: 66 65 72 65 6e 63 65 73 20 69 6e 20 74 68 65 20  ferences in the 
6890: 64 61 74 61 62 61 73 65 22 29 29 29 29 29 0a 09  database")))))..
68a0: 20 20 20 20 28 73 6f 72 74 20 28 68 61 73 68 2d      (sort (hash-
68b0: 74 61 62 6c 65 2d 6b 65 79 73 20 64 69 72 73 2d  table-keys dirs-
68c0: 74 6f 2d 72 65 6d 6f 76 65 29 20 28 6c 61 6d 62  to-remove) (lamb
68d0: 64 61 20 28 61 20 62 29 28 3e 20 28 73 74 72 69  da (a b)(> (stri
68e0: 6e 67 2d 6c 65 6e 67 74 68 20 61 29 28 73 74 72  ng-length a)(str
68f0: 69 6e 67 2d 6c 65 6e 67 74 68 20 62 29 29 29 29  ing-length b))))
6900: 29 0a 0a 09 20 20 20 3b 3b 20 72 65 6d 6f 76 65  )...   ;; remove
6910: 20 74 68 65 20 72 75 6e 20 69 66 20 7a 65 72 6f   the run if zero
6920: 20 74 65 73 74 73 20 72 65 6d 61 69 6e 0a 09 20   tests remain.. 
6930: 20 20 28 6c 65 74 20 28 28 72 65 6d 74 65 73 74    (let ((remtest
6940: 73 20 28 72 64 62 3a 67 65 74 2d 74 65 73 74 73  s (rdb:get-tests
6950: 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 62 3a  -for-run db (db:
6960: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61  get-value-by-hea
6970: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22  der run header "
6980: 69 64 22 29 20 23 66 20 23 66 20 27 28 29 20 27  id") #f #f '() '
6990: 28 29 29 29 29 0a 09 20 20 20 20 20 28 69 66 20  ())))..     (if 
69a0: 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29  (null? remtests)
69b0: 20 3b 3b 20 6e 6f 20 6d 6f 72 65 20 74 65 73 74   ;; no more test
69c0: 73 20 72 65 6d 61 69 6e 69 6e 67 0a 09 09 20 28  s remaining... (
69d0: 6c 65 74 2a 20 28 28 64 70 61 72 74 73 20 20 28  let* ((dparts  (
69e0: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 6c 61 73  string-split las
69f0: 74 74 70 61 74 68 20 22 2f 22 29 29 0a 09 09 09  ttpath "/"))....
6a00: 28 72 75 6e 70 61 74 68 20 28 63 6f 6e 63 20 22  (runpath (conc "
6a10: 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72  /" (string-inter
6a20: 73 70 65 72 73 65 20 0a 09 09 09 09 09 20 20 20  sperse ......   
6a30: 20 28 74 61 6b 65 20 64 70 61 72 74 73 20 28 2d   (take dparts (-
6a40: 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73 29   (length dparts)
6a50: 20 31 29 29 0a 09 09 09 09 09 20 20 20 20 22 2f   1))......    "/
6a60: 22 29 29 29 29 0a 09 09 20 20 20 28 64 65 62 75  "))))...   (debu
6a70: 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76  g:print 1 "Remov
6a80: 69 6e 67 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65  ing run: " runke
6a90: 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61  y " " (db:get-va
6aa0: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75  lue-by-header ru
6ab0: 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d  n header "runnam
6ac0: 65 22 29 29 0a 09 09 20 20 20 28 64 62 3a 64 65  e"))...   (db:de
6ad0: 6c 65 74 65 2d 72 75 6e 20 64 62 20 72 75 6e 2d  lete-run db run-
6ae0: 69 64 29 0a 09 09 20 20 20 3b 3b 20 6e 65 65 64  id)...   ;; need
6af0: 20 74 6f 20 66 69 67 75 72 65 20 6f 75 74 20 74   to figure out t
6b00: 68 65 20 70 61 74 68 20 74 6f 20 74 68 65 20 72  he path to the r
6b10: 75 6e 20 64 69 72 20 61 6e 64 20 72 65 6d 6f 76  un dir and remov
6b20: 65 20 69 74 20 69 66 20 65 6d 70 74 79 0a 09 09  e it if empty...
6b30: 20 20 20 3b 3b 20 20 20 20 28 69 66 20 28 6e 75     ;;    (if (nu
6b40: 6c 6c 3f 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20  ll? (glob (conc 
6b50: 72 75 6e 70 61 74 68 20 22 2f 2a 22 29 29 29 0a  runpath "/*"))).
6b60: 09 09 20 20 20 3b 3b 20 20 20 20 20 20 20 20 28  ..   ;;        (
6b70: 62 65 67 69 6e 0a 09 09 20 20 20 3b 3b 20 09 20  begin...   ;; . 
6b80: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22  (debug:print 1 "
6b90: 52 65 6d 6f 76 69 6e 67 20 72 75 6e 20 64 69 72  Removing run dir
6ba0: 20 22 20 72 75 6e 70 61 74 68 29 0a 09 09 20 20   " runpath)...  
6bb0: 20 3b 3b 20 09 20 28 73 79 73 74 65 6d 20 28 63   ;; . (system (c
6bc0: 6f 6e 63 20 22 72 6d 64 69 72 20 2d 70 20 22 20  onc "rmdir -p " 
6bd0: 72 75 6e 70 61 74 68 29 29 29 29 0a 09 09 20 20  runpath))))...  
6be0: 20 29 29 29 29 0a 09 20 29 29 0a 20 20 20 20 20   )))).. )).     
6bf0: 72 75 6e 73 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d  runs)))..;;=====
6c00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6c10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6c20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6c30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6c40: 3d 0a 3b 3b 20 52 6f 75 74 69 6e 65 73 20 66 6f  =.;; Routines fo
6c50: 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 72  r manipulating r
6c60: 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  uns.;;==========
6c70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6c80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6c90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6ca0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b  ============..;;
6cb0: 20 53 69 6e 63 65 20 6d 61 6e 79 20 63 61 6c 6c   Since many call
6cc0: 73 20 74 6f 20 61 20 72 75 6e 20 72 65 71 75 69  s to a run requi
6cd0: 72 65 20 70 72 65 74 74 79 20 6d 75 63 68 20 74  re pretty much t
6ce0: 68 65 20 73 61 6d 65 20 73 65 74 75 70 20 0a 3b  he same setup .;
6cf0: 3b 20 74 68 69 73 20 77 72 61 70 70 65 72 20 69  ; this wrapper i
6d00: 73 20 75 73 65 64 20 74 6f 20 72 65 64 75 63 65  s used to reduce
6d10: 20 74 68 65 20 72 65 70 6c 69 63 61 74 69 6f 6e   the replication
6d20: 20 6f 66 20 63 6f 64 65 0a 28 64 65 66 69 6e 65   of code.(define
6d30: 20 28 67 65 6e 65 72 61 6c 2d 72 75 6e 2d 63 61   (general-run-ca
6d40: 6c 6c 20 73 77 69 74 63 68 6e 61 6d 65 20 61 63  ll switchname ac
6d50: 74 69 6f 6e 2d 64 65 73 63 20 70 72 6f 63 29 0a  tion-desc proc).
6d60: 20 20 28 6c 65 74 20 28 28 72 75 6e 6e 61 6d 65    (let ((runname
6d70: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
6d80: 3a 72 75 6e 6e 61 6d 65 22 29 29 0a 09 28 74 61  :runname"))..(ta
6d90: 72 67 65 74 20 20 28 69 66 20 28 61 72 67 73 3a  rget  (if (args:
6da0: 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74  get-arg "-target
6db0: 22 29 0a 09 09 20 20 20 20 20 28 61 72 67 73 3a  ")...     (args:
6dc0: 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74  get-arg "-target
6dd0: 22 29 0a 09 09 20 20 20 20 20 28 61 72 67 73 3a  ")...     (args:
6de0: 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72  get-arg "-reqtar
6df0: 67 22 29 29 29 0a 09 28 74 68 31 20 20 20 20 20  g")))..(th1     
6e00: 23 66 29 29 0a 20 20 20 20 28 63 6f 6e 64 0a 20  #f)).    (cond. 
6e10: 20 20 20 20 28 28 6e 6f 74 20 74 61 72 67 65 74      ((not target
6e20: 29 0a 20 20 20 20 20 20 28 64 65 62 75 67 3a 70  ).      (debug:p
6e30: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 4d  rint 0 "ERROR: M
6e40: 69 73 73 69 6e 67 20 72 65 71 75 69 72 65 64 20  issing required 
6e50: 70 61 72 61 6d 65 74 65 72 20 66 6f 72 20 22 20  parameter for " 
6e60: 73 77 69 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f  switchname ", yo
6e70: 75 20 6d 75 73 74 20 73 70 65 63 69 66 79 20 74  u must specify t
6e80: 68 65 20 74 61 72 67 65 74 20 77 69 74 68 20 2d  he target with -
6e90: 74 61 72 67 65 74 22 29 0a 20 20 20 20 20 20 28  target").      (
6ea0: 65 78 69 74 20 33 29 29 0a 20 20 20 20 20 28 28  exit 3)).     ((
6eb0: 6e 6f 74 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20  not runname).   
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 4d 69 73 73 69 6e  0 "ERROR: Missin
6ee0: 67 20 72 65 71 75 69 72 65 64 20 70 61 72 61 6d  g required param
6ef0: 65 74 65 72 20 66 6f 72 20 22 20 73 77 69 74 63  eter for " switc
6f00: 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d 75 73  hname ", you mus
6f10: 74 20 73 70 65 63 69 66 79 20 74 68 65 20 72 75  t specify the ru
6f20: 6e 20 6e 61 6d 65 20 77 69 74 68 20 3a 72 75 6e  n name with :run
6f30: 6e 61 6d 65 20 72 75 6e 6e 61 6d 65 22 29 0a 20  name runname"). 
6f40: 20 20 20 20 20 28 65 78 69 74 20 33 29 29 0a 20       (exit 3)). 
6f50: 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20      (else.      
6f60: 28 6c 65 74 20 28 28 64 62 20 20 20 23 66 29 0a  (let ((db   #f).
6f70: 09 20 20 20 20 28 6b 65 79 73 20 23 66 29 29 0a  .    (keys #f)).
6f80: 09 28 69 66 20 28 6e 6f 74 20 28 73 65 74 75 70  .(if (not (setup
6f90: 2d 66 6f 72 2d 72 75 6e 29 29 0a 09 20 20 20 20  -for-run))..    
6fa0: 28 62 65 67 69 6e 20 0a 09 20 20 20 20 20 20 28  (begin ..      (
6fb0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 46  debug:print 0 "F
6fc0: 61 69 6c 65 64 20 74 6f 20 73 65 74 75 70 2c 20  ailed to setup, 
6fd0: 65 78 69 74 69 6e 67 22 29 0a 09 20 20 20 20 20  exiting")..     
6fe0: 20 28 65 78 69 74 20 31 29 29 29 0a 09 28 73 65   (exit 1)))..(se
6ff0: 74 21 20 64 62 20 20 20 28 6f 70 65 6e 2d 64 62  t! db   (open-db
7000: 29 29 0a 09 28 69 66 20 28 61 72 67 73 3a 67 65  ))..(if (args:ge
7010: 74 2d 61 72 67 20 22 2d 73 65 72 76 65 72 22 29  t-arg "-server")
7020: 0a 09 20 20 20 20 28 73 65 72 76 65 72 3a 73 74  ..    (server:st
7030: 61 72 74 20 64 62 20 28 61 72 67 73 3a 67 65 74  art db (args:get
7040: 2d 61 72 67 20 22 2d 73 65 72 76 65 72 22 29 29  -arg "-server"))
7050: 0a 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28  ..    (if (not (
7060: 6f 72 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  or (args:get-arg
7070: 20 22 2d 72 75 6e 61 6c 6c 22 29 0a 09 09 09 20   "-runall").... 
7080: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
7090: 2d 72 75 6e 74 65 73 74 73 22 29 29 29 0a 09 09  -runtests")))...
70a0: 28 73 65 72 76 65 72 3a 63 6c 69 65 6e 74 2d 73  (server:client-s
70b0: 65 74 75 70 20 64 62 29 29 29 0a 09 28 73 65 74  etup db)))..(set
70c0: 21 20 6b 65 79 73 20 28 72 64 62 3a 67 65 74 2d  ! keys (rdb:get-
70d0: 6b 65 79 73 20 64 62 29 29 0a 09 3b 3b 20 68 61  keys db))..;; ha
70e0: 76 65 20 65 6e 6f 75 67 68 20 74 6f 20 70 72 6f  ve enough to pro
70f0: 63 65 73 73 20 2d 74 61 72 67 65 74 20 6f 72 20  cess -target or 
7100: 2d 72 65 71 74 61 72 67 20 68 65 72 65 0a 09 28  -reqtarg here..(
7110: 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  if (args:get-arg
7120: 20 22 2d 72 65 71 74 61 72 67 22 29 0a 09 20 20   "-reqtarg")..  
7130: 20 20 28 6c 65 74 2a 20 28 28 72 75 6e 63 6f 6e    (let* ((runcon
7140: 66 69 67 66 20 28 63 6f 6e 63 20 20 2a 74 6f 70  figf (conc  *top
7150: 70 61 74 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 69  path* "/runconfi
7160: 67 73 2e 63 6f 6e 66 69 67 22 29 29 20 3b 3b 20  gs.config")) ;; 
7170: 44 4f 20 4e 4f 54 20 45 56 41 4c 55 41 54 45 20  DO NOT EVALUATE 
7180: 41 4c 4c 20 0a 09 09 20 20 20 28 72 75 6e 63 6f  ALL ...   (runco
7190: 6e 66 69 67 20 20 28 72 65 61 64 2d 63 6f 6e 66  nfig  (read-conf
71a0: 69 67 20 72 75 6e 63 6f 6e 66 69 67 66 20 23 66  ig runconfigf #f
71b0: 20 23 66 20 65 6e 76 69 72 6f 6e 2d 70 61 74 74   #f environ-patt
71c0: 3a 20 23 66 29 29 29 20 0a 09 20 20 20 20 20 20  : #f))) ..      
71d0: 28 69 66 20 28 68 61 73 68 2d 74 61 62 6c 65 2d  (if (hash-table-
71e0: 72 65 66 2f 64 65 66 61 75 6c 74 20 72 75 6e 63  ref/default runc
71f0: 6f 6e 66 69 67 20 28 61 72 67 73 3a 67 65 74 2d  onfig (args:get-
7200: 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 20  arg "-reqtarg") 
7210: 23 66 29 0a 09 09 20 20 28 6b 65 79 73 3a 74 61  #f)...  (keys:ta
7220: 72 67 65 74 2d 73 65 74 2d 61 72 67 73 20 6b 65  rget-set-args ke
7230: 79 73 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  ys (args:get-arg
7240: 20 22 2d 72 65 71 74 61 72 67 22 29 20 61 72 67   "-reqtarg") arg
7250: 73 3a 61 72 67 2d 68 61 73 68 29 0a 09 09 20 20  s:arg-hash)...  
7260: 28 62 65 67 69 6e 0a 09 09 20 20 20 20 28 64 65  (begin...    (de
7270: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52  bug:print 0 "ERR
7280: 4f 52 3a 20 5b 22 20 28 61 72 67 73 3a 67 65 74  OR: [" (args:get
7290: 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29  -arg "-reqtarg")
72a0: 20 22 5d 20 6e 6f 74 20 66 6f 75 6e 64 20 69 6e   "] not found in
72b0: 20 22 20 72 75 6e 63 6f 6e 66 69 67 66 29 0a 09   " runconfigf)..
72c0: 09 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66 69  .    (sqlite3:fi
72d0: 6e 61 6c 69 7a 65 21 20 64 62 29 0a 09 09 20 20  nalize! db)...  
72e0: 20 20 28 65 78 69 74 20 31 29 29 29 29 0a 09 20    (exit 1)))).. 
72f0: 20 20 20 28 69 66 20 28 61 72 67 73 3a 67 65 74     (if (args:get
7300: 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 29 0a  -arg "-target").
7310: 09 09 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 73  ..(keys:target-s
7320: 65 74 2d 61 72 67 73 20 6b 65 79 73 20 28 61 72  et-args keys (ar
7330: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72  gs:get-arg "-tar
7340: 67 65 74 22 20 61 72 67 73 3a 61 72 67 2d 68 61  get" args:arg-ha
7350: 73 68 29 20 61 72 67 73 3a 61 72 67 2d 68 61 73  sh) args:arg-has
7360: 68 29 29 29 0a 09 28 69 66 20 28 6e 6f 74 20 28  h)))..(if (not (
7370: 63 61 72 20 2a 63 6f 6e 66 69 67 69 6e 66 6f 2a  car *configinfo*
7380: 29 29 0a 09 20 20 20 20 28 62 65 67 69 6e 0a 09  ))..    (begin..
7390: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
73a0: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 41 74 74  nt 0 "ERROR: Att
73b0: 65 6d 70 74 65 64 20 74 6f 20 22 20 61 63 74 69  empted to " acti
73c0: 6f 6e 2d 64 65 73 63 20 22 20 62 75 74 20 72 75  on-desc " but ru
73d0: 6e 20 61 72 65 61 20 63 6f 6e 66 69 67 20 66 69  n area config fi
73e0: 6c 65 20 6e 6f 74 20 66 6f 75 6e 64 22 29 0a 09  le not found")..
73f0: 20 20 20 20 20 20 28 65 78 69 74 20 31 29 29 0a        (exit 1)).
7400: 09 20 20 20 20 3b 3b 20 45 78 74 72 61 63 74 20  .    ;; Extract 
7410: 6f 75 74 20 73 74 75 66 66 20 6e 65 65 64 65 64  out stuff needed
7420: 20 69 6e 20 6d 6f 73 74 20 6f 72 20 6d 61 6e 79   in most or many
7430: 20 63 61 6c 6c 73 0a 09 20 20 20 20 3b 3b 20 68   calls..    ;; h
7440: 65 72 65 20 74 68 65 6e 20 63 61 6c 6c 20 70 72  ere then call pr
7450: 6f 63 0a 09 20 20 20 20 28 6c 65 74 2a 20 28 28  oc..    (let* ((
7460: 6b 65 79 6e 61 6d 65 73 20 20 20 28 6d 61 70 20  keynames   (map 
7470: 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d  key:get-fieldnam
7480: 65 20 6b 65 79 73 29 29 0a 09 09 20 20 20 28 6b  e keys))...   (k
7490: 65 79 76 61 6c 6c 73 74 20 20 28 6b 65 79 73 2d  eyvallst  (keys-
74a0: 3e 76 61 6c 6c 69 73 74 20 6b 65 79 73 20 23 74  >vallist keys #t
74b0: 29 29 29 0a 09 20 20 20 20 20 20 28 70 72 6f 63  )))..      (proc
74c0: 20 64 62 20 74 61 72 67 65 74 20 72 75 6e 6e 61   db target runna
74d0: 6d 65 20 6b 65 79 73 20 6b 65 79 6e 61 6d 65 73  me keys keynames
74e0: 20 6b 65 79 76 61 6c 6c 73 74 29 29 29 0a 09 28   keyvallst)))..(
74f0: 69 66 20 74 68 31 20 28 74 68 72 65 61 64 2d 6a  if th1 (thread-j
7500: 6f 69 6e 21 20 74 68 31 29 29 0a 09 28 73 71 6c  oin! th1))..(sql
7510: 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64  ite3:finalize! d
7520: 62 29 0a 09 28 73 65 74 21 20 2a 64 69 64 73 6f  b)..(set! *didso
7530: 6d 65 74 68 69 6e 67 2a 20 23 74 29 29 29 29 29  mething* #t)))))
7540: 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  )..;;===========
7550: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7560: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7570: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7580: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52  ===========.;; R
7590: 6f 6c 6c 75 70 20 72 75 6e 73 0a 3b 3b 3d 3d 3d  ollup runs.;;===
75a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
75b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
75c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
75d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
75e0: 3d 3d 3d 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74  ===..;; Update t
75f0: 68 65 20 74 65 73 74 5f 6d 65 74 61 20 74 61 62  he test_meta tab
7600: 6c 65 20 66 6f 72 20 74 68 69 73 20 74 65 73 74  le for this test
7610: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 75  .(define (runs:u
7620: 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 20  pdate-test_meta 
7630: 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73  db test-name tes
7640: 74 2d 63 6f 6e 66 29 0a 20 20 28 6c 65 74 20 28  t-conf).  (let (
7650: 28 63 75 72 72 72 65 63 6f 72 64 20 28 64 62 3a  (currrecord (db:
7660: 74 65 73 74 6d 65 74 61 2d 67 65 74 2d 72 65 63  testmeta-get-rec
7670: 6f 72 64 20 64 62 20 74 65 73 74 2d 6e 61 6d 65  ord db test-name
7680: 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74  ))).    (if (not
7690: 20 63 75 72 72 72 65 63 6f 72 64 29 0a 09 28 62   currrecord)..(b
76a0: 65 67 69 6e 0a 09 20 20 28 73 65 74 21 20 63 75  egin..  (set! cu
76b0: 72 72 72 65 63 6f 72 64 20 28 6d 61 6b 65 2d 76  rrrecord (make-v
76c0: 65 63 74 6f 72 20 31 30 20 23 66 29 29 0a 09 20  ector 10 #f)).. 
76d0: 20 28 64 62 3a 74 65 73 74 6d 65 74 61 2d 61 64   (db:testmeta-ad
76e0: 64 2d 72 65 63 6f 72 64 20 64 62 20 74 65 73 74  d-record db test
76f0: 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 66 6f  -name))).    (fo
7700: 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c 61  r-each .     (la
7710: 6d 62 64 61 20 28 6b 65 79 29 0a 20 20 20 20 20  mbda (key).     
7720: 20 20 28 6c 65 74 2a 20 28 28 69 64 78 20 28 63    (let* ((idx (c
7730: 61 64 72 20 6b 65 79 29 29 0a 09 20 20 20 20 20  adr key))..     
7740: 20 28 66 6c 64 20 28 63 61 72 20 20 6b 65 79 29   (fld (car  key)
7750: 29 0a 09 20 20 20 20 20 20 28 76 61 6c 20 28 63  )..      (val (c
7760: 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 65 73  onfig-lookup tes
7770: 74 2d 63 6f 6e 66 20 22 74 65 73 74 5f 6d 65 74  t-conf "test_met
7780: 61 22 20 66 6c 64 29 29 29 0a 09 20 3b 3b 20 28  a" fld))).. ;; (
7790: 64 65 62 75 67 3a 70 72 69 6e 74 20 35 20 22 69  debug:print 5 "i
77a0: 64 78 3a 20 22 20 69 64 78 20 22 20 66 6c 64 3a  dx: " idx " fld:
77b0: 20 22 20 66 6c 64 20 22 20 76 61 6c 3a 20 22 20   " fld " val: " 
77c0: 76 61 6c 29 0a 09 20 28 69 66 20 28 61 6e 64 20  val).. (if (and 
77d0: 76 61 6c 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f  val (not (equal?
77e0: 20 28 76 65 63 74 6f 72 2d 72 65 66 20 63 75 72   (vector-ref cur
77f0: 72 72 65 63 6f 72 64 20 69 64 78 29 20 76 61 6c  rrecord idx) val
7800: 29 29 29 0a 09 20 20 20 20 20 28 62 65 67 69 6e  )))..     (begin
7810: 0a 09 20 20 20 20 20 20 20 28 70 72 69 6e 74 20  ..       (print 
7820: 22 55 70 64 61 74 69 6e 67 20 22 20 74 65 73 74  "Updating " test
7830: 2d 6e 61 6d 65 20 22 20 22 20 66 6c 64 20 22 20  -name " " fld " 
7840: 74 6f 20 22 20 76 61 6c 29 0a 09 20 20 20 20 20  to " val)..     
7850: 20 20 28 64 62 3a 74 65 73 74 6d 65 74 61 2d 75    (db:testmeta-u
7860: 70 64 61 74 65 2d 66 69 65 6c 64 20 64 62 20 74  pdate-field db t
7870: 65 73 74 2d 6e 61 6d 65 20 66 6c 64 20 76 61 6c  est-name fld val
7880: 29 29 29 29 29 0a 20 20 20 20 20 27 28 28 22 61  ))))).     '(("a
7890: 75 74 68 6f 72 22 20 32 29 28 22 6f 77 6e 65 72  uthor" 2)("owner
78a0: 22 20 33 29 28 22 64 65 73 63 72 69 70 74 69 6f  " 3)("descriptio
78b0: 6e 22 20 34 29 28 22 72 65 76 69 65 77 65 64 22  n" 4)("reviewed"
78c0: 20 35 29 28 22 74 61 67 73 22 20 39 29 29 29 29   5)("tags" 9))))
78d0: 29 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74 65 73  )..;; Update tes
78e0: 74 5f 6d 65 74 61 20 66 6f 72 20 61 6c 6c 20 74  t_meta for all t
78f0: 65 73 74 73 0a 28 64 65 66 69 6e 65 20 28 72 75  ests.(define (ru
7900: 6e 73 3a 75 70 64 61 74 65 2d 61 6c 6c 2d 74 65  ns:update-all-te
7910: 73 74 5f 6d 65 74 61 20 64 62 29 0a 20 20 28 6c  st_meta db).  (l
7920: 65 74 20 28 28 74 65 73 74 2d 6e 61 6d 65 73 20  et ((test-names 
7930: 28 67 65 74 2d 61 6c 6c 2d 6c 65 67 61 6c 2d 74  (get-all-legal-t
7940: 65 73 74 73 29 29 29 0a 20 20 20 20 28 66 6f 72  ests))).    (for
7950: 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d  -each .     (lam
7960: 62 64 61 20 28 74 65 73 74 2d 6e 61 6d 65 29 0a  bda (test-name).
7970: 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74         (let* ((t
7980: 65 73 74 2d 70 61 74 68 20 20 20 20 28 63 6f 6e  est-path    (con
7990: 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65  c *toppath* "/te
79a0: 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29  sts/" test-name)
79b0: 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d 63  )..      (test-c
79c0: 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 74 65 73  onfigf (conc tes
79d0: 74 2d 70 61 74 68 20 22 2f 74 65 73 74 63 6f 6e  t-path "/testcon
79e0: 66 69 67 22 29 29 0a 09 20 20 20 20 20 20 28 74  fig"))..      (t
79f0: 65 73 74 65 78 69 73 74 73 20 20 20 28 61 6e 64  estexists   (and
7a00: 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 74   (file-exists? t
7a10: 65 73 74 2d 63 6f 6e 66 69 67 66 29 28 66 69 6c  est-configf)(fil
7a20: 65 2d 72 65 61 64 2d 61 63 63 65 73 73 3f 20 74  e-read-access? t
7a30: 65 73 74 2d 63 6f 6e 66 69 67 66 29 29 29 0a 09  est-configf)))..
7a40: 20 20 20 20 20 20 3b 3b 20 72 65 61 64 20 63 6f        ;; read co
7a50: 6e 66 69 67 73 20 77 69 74 68 20 74 72 69 63 6b  nfigs with trick
7a60: 73 20 74 75 72 6e 65 64 20 6f 66 66 20 28 69 2e  s turned off (i.
7a70: 65 2e 20 6e 6f 20 73 79 73 74 65 6d 29 0a 09 20  e. no system).. 
7a80: 20 20 20 20 20 28 74 65 73 74 2d 63 6f 6e 66 20       (test-conf 
7a90: 20 20 20 28 69 66 20 74 65 73 74 65 78 69 73 74     (if testexist
7aa0: 73 20 28 72 65 61 64 2d 63 6f 6e 66 69 67 20 74  s (read-config t
7ab0: 65 73 74 2d 63 6f 6e 66 69 67 66 20 23 66 20 23  est-configf #f #
7ac0: 66 29 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62  f)(make-hash-tab
7ad0: 6c 65 29 29 29 29 0a 09 20 28 72 75 6e 73 3a 75  le)))).. (runs:u
7ae0: 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 20  pdate-test_meta 
7af0: 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73  db test-name tes
7b00: 74 2d 63 6f 6e 66 29 29 29 0a 20 20 20 20 20 74  t-conf))).     t
7b10: 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a 0a 3b 3b  est-names)))..;;
7b20: 20 54 68 69 73 20 63 6f 75 6c 64 20 70 72 6f 62   This could prob
7b30: 61 62 6c 79 20 62 65 20 72 65 66 61 63 74 6f 72  ably be refactor
7b40: 65 64 20 69 6e 74 6f 20 6f 6e 65 20 63 6f 6d 70  ed into one comp
7b50: 6c 65 78 20 71 75 65 72 79 20 2e 2e 2e 0a 28 64  lex query ....(d
7b60: 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 6f 6c 6c  efine (runs:roll
7b70: 75 70 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 6b  up-run db keys k
7b80: 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65  eyvallst runname
7b90: 20 75 73 65 72 29 20 3b 3b 20 77 61 73 20 74 61   user) ;; was ta
7ba0: 72 67 65 74 2c 20 6e 6f 77 20 6b 65 79 76 61 6c  rget, now keyval
7bb0: 6c 73 74 0a 20 20 28 64 65 62 75 67 3a 70 72 69  lst.  (debug:pri
7bc0: 6e 74 20 34 20 22 72 75 6e 73 3a 72 6f 6c 6c 75  nt 4 "runs:rollu
7bd0: 70 2d 72 75 6e 2c 20 6b 65 79 73 3a 20 22 20 6b  p-run, keys: " k
7be0: 65 79 73 20 22 20 6b 65 79 76 61 6c 6c 73 74 3a  eys " keyvallst:
7bf0: 20 22 20 6b 65 79 76 61 6c 6c 73 74 20 22 20 3a   " keyvallst " :
7c00: 72 75 6e 6e 61 6d 65 20 22 20 72 75 6e 6e 61 6d  runname " runnam
7c10: 65 20 22 20 75 73 65 72 3a 20 22 20 75 73 65 72  e " user: " user
7c20: 29 0a 20 20 28 6c 65 74 2a 20 28 3b 20 28 6b 65  ).  (let* (; (ke
7c30: 79 76 61 6c 6c 6c 73 74 20 20 20 20 20 20 28 6b  yvalllst      (k
7c40: 65 79 73 3a 74 61 72 67 65 74 2d 3e 6b 65 79 76  eys:target->keyv
7c50: 61 6c 20 6b 65 79 73 20 74 61 72 67 65 74 29 29  al keys target))
7c60: 0a 09 20 28 6e 65 77 2d 72 75 6e 2d 69 64 20 20  .. (new-run-id  
7c70: 20 20 20 20 28 72 75 6e 73 3a 72 65 67 69 73 74      (runs:regist
7c80: 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 6b  er-run db keys k
7c90: 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65  eyvallst runname
7ca0: 20 22 6e 65 77 22 20 22 6e 2f 61 22 20 75 73 65   "new" "n/a" use
7cb0: 72 29 29 0a 09 20 28 70 72 65 76 2d 74 65 73 74  r)).. (prev-test
7cc0: 73 20 20 20 20 20 20 28 74 65 73 74 3a 67 65 74  s      (test:get
7cd0: 2d 6d 61 74 63 68 69 6e 67 2d 70 72 65 76 69 6f  -matching-previo
7ce0: 75 73 2d 74 65 73 74 2d 72 75 6e 2d 72 65 63 6f  us-test-run-reco
7cf0: 72 64 73 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69  rds db new-run-i
7d00: 64 20 22 25 22 20 22 25 22 29 29 0a 09 20 28 63  d "%" "%")).. (c
7d10: 75 72 72 2d 74 65 73 74 73 20 20 20 20 20 20 28  urr-tests      (
7d20: 72 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f  rdb:get-tests-fo
7d30: 72 2d 72 75 6e 20 64 62 20 6e 65 77 2d 72 75 6e  r-run db new-run
7d40: 2d 69 64 20 22 25 22 20 22 25 22 20 27 28 29 20  -id "%" "%" '() 
7d50: 27 28 29 29 29 0a 09 20 28 63 75 72 72 2d 74 65  '())).. (curr-te
7d60: 73 74 73 2d 68 61 73 68 20 28 6d 61 6b 65 2d 68  sts-hash (make-h
7d70: 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 20 20 20  ash-table))).   
7d80: 20 28 64 62 3a 75 70 64 61 74 65 2d 72 75 6e 2d   (db:update-run-
7d90: 65 76 65 6e 74 5f 74 69 6d 65 20 64 62 20 6e 65  event_time db ne
7da0: 77 2d 72 75 6e 2d 69 64 29 0a 20 20 20 20 3b 3b  w-run-id).    ;;
7db0: 20 69 6e 64 65 78 20 74 68 65 20 61 6c 72 65 61   index the alrea
7dc0: 64 79 20 73 61 76 65 64 20 74 65 73 74 73 20 62  dy saved tests b
7dd0: 79 20 74 65 73 74 6e 61 6d 65 20 61 6e 64 20 69  y testname and i
7de0: 74 65 6d 64 61 74 20 69 6e 20 63 75 72 72 2d 74  temdat in curr-t
7df0: 65 73 74 73 2d 68 61 73 68 0a 20 20 20 20 28 66  ests-hash.    (f
7e00: 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 28 6c 61  or-each.     (la
7e10: 6d 62 64 61 20 28 74 65 73 74 64 61 74 29 0a 20  mbda (testdat). 
7e20: 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74 65        (let* ((te
7e30: 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 65 73 74  stname  (db:test
7e40: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65  -get-testname te
7e50: 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28  stdat))..      (
7e60: 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74 65  item-path (db:te
7e70: 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68  st-get-item-path
7e80: 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20   testdat))..    
7e90: 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f    (full-name (co
7ea0: 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22 20  nc testname "/" 
7eb0: 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 09 20 28  item-path))).. (
7ec0: 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20  hash-table-set! 
7ed0: 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20  curr-tests-hash 
7ee0: 66 75 6c 6c 2d 6e 61 6d 65 20 74 65 73 74 64 61  full-name testda
7ef0: 74 29 29 29 0a 20 20 20 20 20 63 75 72 72 2d 74  t))).     curr-t
7f00: 65 73 74 73 29 0a 20 20 20 20 3b 3b 20 4e 4f 50  ests).    ;; NOP
7f10: 45 3a 20 4e 6f 6e 2d 6f 70 74 69 6d 61 6c 20 61  E: Non-optimal a
7f20: 70 70 72 6f 61 63 68 2e 20 54 72 79 20 74 68 69  pproach. Try thi
7f30: 73 20 69 6e 73 74 65 61 64 2e 0a 20 20 20 20 3b  s instead..    ;
7f40: 3b 20 20 20 31 2e 20 74 65 73 74 73 20 61 72 65  ;   1. tests are
7f50: 20 72 65 63 65 69 76 65 64 20 69 6e 20 61 20 6c   received in a l
7f60: 69 73 74 2c 20 6d 6f 73 74 20 72 65 63 65 6e 74  ist, most recent
7f70: 20 66 69 72 73 74 0a 20 20 20 20 3b 3b 20 20 20   first.    ;;   
7f80: 32 2e 20 72 65 70 6c 61 63 65 20 74 68 65 20 72  2. replace the r
7f90: 6f 6c 6c 75 70 20 74 65 73 74 20 77 69 74 68 20  ollup test with 
7fa0: 74 68 65 20 6e 65 77 20 2a 61 6c 77 61 79 73 2a  the new *always*
7fb0: 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a  .    (for-each .
7fc0: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74 65       (lambda (te
7fd0: 73 74 64 61 74 29 0a 20 20 20 20 20 20 20 28 6c  stdat).       (l
7fe0: 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 20 20  et* ((testname  
7ff0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73  (db:test-get-tes
8000: 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29 0a  tname testdat)).
8010: 09 20 20 20 20 20 20 28 69 74 65 6d 2d 70 61 74  .      (item-pat
8020: 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  h (db:test-get-i
8030: 74 65 6d 2d 70 61 74 68 20 74 65 73 74 64 61 74  tem-path testdat
8040: 29 29 0a 09 20 20 20 20 20 20 28 66 75 6c 6c 2d  ))..      (full-
8050: 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 6e  name (conc testn
8060: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74  ame "/" item-pat
8070: 68 29 29 0a 09 20 20 20 20 20 20 28 70 72 65 76  h))..      (prev
8080: 2d 74 65 73 74 2d 64 61 74 20 28 68 61 73 68 2d  -test-dat (hash-
8090: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c  table-ref/defaul
80a0: 74 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73  t curr-tests-has
80b0: 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 23 66 29 29  h full-name #f))
80c0: 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d 73 74  ..      (test-st
80d0: 65 70 73 20 20 20 20 20 20 28 64 62 3a 67 65 74  eps      (db:get
80e0: 2d 73 74 65 70 73 2d 66 6f 72 2d 74 65 73 74 20  -steps-for-test 
80f0: 64 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  db (db:test-get-
8100: 69 64 20 74 65 73 74 64 61 74 29 29 29 0a 09 20  id testdat))).. 
8110: 20 20 20 20 20 28 6e 65 77 2d 74 65 73 74 2d 72       (new-test-r
8120: 65 63 6f 72 64 20 23 66 29 29 0a 09 20 3b 3b 20  ecord #f)).. ;; 
8130: 72 65 70 6c 61 63 65 20 74 68 65 73 65 20 77 69  replace these wi
8140: 74 68 20 69 6e 73 65 72 74 20 2e 2e 2e 20 73 65  th insert ... se
8150: 6c 65 63 74 0a 09 20 28 61 70 70 6c 79 20 73 71  lect.. (apply sq
8160: 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09  lite3:execute ..
8170: 09 64 62 20 0a 09 09 28 63 6f 6e 63 20 22 49 4e  .db ...(conc "IN
8180: 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20  SERT OR REPLACE 
8190: 49 4e 54 4f 20 74 65 73 74 73 20 28 72 75 6e 5f  INTO tests (run_
81a0: 69 64 2c 74 65 73 74 6e 61 6d 65 2c 73 74 61 74  id,testname,stat
81b0: 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74  e,status,event_t
81c0: 69 6d 65 2c 68 6f 73 74 2c 63 70 75 6c 6f 61 64  ime,host,cpuload
81d0: 2c 64 69 73 6b 66 72 65 65 2c 75 6e 61 6d 65 2c  ,diskfree,uname,
81e0: 72 75 6e 64 69 72 2c 69 74 65 6d 5f 70 61 74 68  rundir,item_path
81f0: 2c 72 75 6e 5f 64 75 72 61 74 69 6f 6e 2c 66 69  ,run_duration,fi
8200: 6e 61 6c 5f 6c 6f 67 66 2c 63 6f 6d 6d 65 6e 74  nal_logf,comment
8210: 29 20 22 0a 09 09 20 20 20 20 20 20 22 56 41 4c  ) "...      "VAL
8220: 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f  UES (?,?,?,?,?,?
8230: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f  ,?,?,?,?,?,?,?,?
8240: 29 3b 22 29 0a 09 09 6e 65 77 2d 72 75 6e 2d 69  );")...new-run-i
8250: 64 20 28 63 64 64 72 20 28 76 65 63 74 6f 72 2d  d (cddr (vector-
8260: 3e 6c 69 73 74 20 74 65 73 74 64 61 74 29 29 29  >list testdat)))
8270: 0a 09 20 28 73 65 74 21 20 6e 65 77 2d 74 65 73  .. (set! new-tes
8280: 74 64 61 74 20 28 63 61 72 20 28 72 64 62 3a 67  tdat (car (rdb:g
8290: 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e  et-tests-for-run
82a0: 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 74   db new-run-id t
82b0: 65 73 74 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74  estname item-pat
82c0: 68 20 27 28 29 20 27 28 29 29 29 29 0a 09 20 28  h '() '()))).. (
82d0: 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20  hash-table-set! 
82e0: 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20  curr-tests-hash 
82f0: 66 75 6c 6c 2d 6e 61 6d 65 20 6e 65 77 2d 74 65  full-name new-te
8300: 73 74 64 61 74 29 20 3b 3b 20 74 68 69 73 20 63  stdat) ;; this c
8310: 6f 75 6c 64 20 62 65 20 63 6f 6e 66 75 73 69 6e  ould be confusin
8320: 67 2c 20 77 68 69 63 68 20 72 65 63 6f 72 64 20  g, which record 
8330: 73 68 6f 75 6c 64 20 67 6f 20 69 6e 74 6f 20 74  should go into t
8340: 68 65 20 6c 6f 6f 6b 75 70 20 74 61 62 6c 65 3f  he lookup table?
8350: 0a 09 20 3b 3b 20 4e 6f 77 20 64 75 70 6c 69 63  .. ;; Now duplic
8360: 61 74 65 20 74 68 65 20 74 65 73 74 20 73 74 65  ate the test ste
8370: 70 73 0a 09 20 28 64 65 62 75 67 3a 70 72 69 6e  ps.. (debug:prin
8380: 74 20 34 20 22 43 6f 70 79 69 6e 67 20 72 65 63  t 4 "Copying rec
8390: 6f 72 64 73 20 69 6e 20 74 65 73 74 5f 73 74 65  ords in test_ste
83a0: 70 73 20 66 72 6f 6d 20 74 65 73 74 5f 69 64 3d  ps from test_id=
83b0: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  " (db:test-get-i
83c0: 64 20 74 65 73 74 64 61 74 29 20 22 20 74 6f 20  d testdat) " to 
83d0: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69  " (db:test-get-i
83e0: 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 29 0a  d new-testdat)).
83f0: 09 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75  . (sqlite3:execu
8400: 74 65 20 0a 09 20 20 64 62 20 0a 09 20 20 28 63  te ..  db ..  (c
8410: 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 52  onc "INSERT OR R
8420: 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 74  EPLACE INTO test
8430: 5f 73 74 65 70 73 20 28 74 65 73 74 5f 69 64 2c  _steps (test_id,
8440: 73 74 65 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73  stepname,state,s
8450: 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65  tatus,event_time
8460: 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 22 53  ,comment) "..."S
8470: 45 4c 45 43 54 20 22 20 28 64 62 3a 74 65 73 74  ELECT " (db:test
8480: 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74  -get-id new-test
8490: 64 61 74 29 20 22 2c 73 74 65 70 6e 61 6d 65 2c  dat) ",stepname,
84a0: 73 74 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65  state,status,eve
84b0: 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 20  nt_time,comment 
84c0: 46 52 4f 4d 20 74 65 73 74 5f 73 74 65 70 73 20  FROM test_steps 
84d0: 57 48 45 52 45 20 74 65 73 74 5f 69 64 3d 3f 3b  WHERE test_id=?;
84e0: 22 29 0a 09 20 20 28 64 62 3a 74 65 73 74 2d 67  ")..  (db:test-g
84f0: 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 29 0a  et-id testdat)).
8500: 09 20 3b 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61  . ;; Now duplica
8510: 74 65 20 74 68 65 20 74 65 73 74 20 64 61 74 61  te the test data
8520: 0a 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  .. (debug:print 
8530: 34 20 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 72  4 "Copying recor
8540: 64 73 20 69 6e 20 74 65 73 74 5f 64 61 74 61 20  ds in test_data 
8550: 66 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28  from test_id=" (
8560: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74  db:test-get-id t
8570: 65 73 74 64 61 74 29 20 22 20 74 6f 20 22 20 28  estdat) " to " (
8580: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e  db:test-get-id n
8590: 65 77 2d 74 65 73 74 64 61 74 29 29 0a 09 20 28  ew-testdat)).. (
85a0: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20  sqlite3:execute 
85b0: 0a 09 20 20 64 62 20 0a 09 20 20 28 63 6f 6e 63  ..  db ..  (conc
85c0: 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c   "INSERT OR REPL
85d0: 41 43 45 20 49 4e 54 4f 20 74 65 73 74 5f 64 61  ACE INTO test_da
85e0: 74 61 20 28 74 65 73 74 5f 69 64 2c 63 61 74 65  ta (test_id,cate
85f0: 67 6f 72 79 2c 76 61 72 69 61 62 6c 65 2c 76 61  gory,variable,va
8600: 6c 75 65 2c 65 78 70 65 63 74 65 64 2c 74 6f 6c  lue,expected,tol
8610: 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65 6e 74 29 20  ,units,comment) 
8620: 22 0a 09 09 22 53 45 4c 45 43 54 20 22 20 28 64  "..."SELECT " (d
8630: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65  b:test-get-id ne
8640: 77 2d 74 65 73 74 64 61 74 29 20 22 2c 63 61 74  w-testdat) ",cat
8650: 65 67 6f 72 79 2c 76 61 72 69 61 62 6c 65 2c 76  egory,variable,v
8660: 61 6c 75 65 2c 65 78 70 65 63 74 65 64 2c 74 6f  alue,expected,to
8670: 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65 6e 74 20  l,units,comment 
8680: 46 52 4f 4d 20 74 65 73 74 5f 64 61 74 61 20 57  FROM test_data W
8690: 48 45 52 45 20 74 65 73 74 5f 69 64 3d 3f 3b 22  HERE test_id=?;"
86a0: 29 0a 09 20 20 28 64 62 3a 74 65 73 74 2d 67 65  )..  (db:test-ge
86b0: 74 2d 69 64 20 74 65 73 74 64 61 74 29 29 0a 09  t-id testdat))..
86c0: 20 29 29 0a 20 20 20 20 20 70 72 65 76 2d 74 65   )).     prev-te
86d0: 73 74 73 29 29 29 0a 09 20 0a 20 20 20 20 20 0a  sts))).. .     .