Megatest

Hex Artifact Content
Login

Artifact 985ca1292de4373d1f514fbc70ff88a9a1317178:


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 20 70 6f 73 69 78 2d 65  srfi 18) posix-e
01d0: 78 74 72 61 73 20 64 69 72 65 63 74 6f 72 79 2d  xtras directory-
01e0: 75 74 69 6c 73 29 0a 28 69 6d 70 6f 72 74 20 28  utils).(import (
01f0: 70 72 65 66 69 78 20 73 71 6c 69 74 65 33 20 73  prefix sqlite3 s
0200: 71 6c 69 74 65 33 3a 29 29 0a 0a 28 64 65 63 6c  qlite3:))..(decl
0210: 61 72 65 20 28 75 6e 69 74 20 72 75 6e 73 29 29  are (unit runs))
0220: 0a 28 64 65 63 6c 61 72 65 20 28 75 73 65 73 20  .(declare (uses 
0230: 64 62 29 29 0a 28 64 65 63 6c 61 72 65 20 28 75  db)).(declare (u
0240: 73 65 73 20 63 6f 6d 6d 6f 6e 29 29 0a 28 64 65  ses common)).(de
0250: 63 6c 61 72 65 20 28 75 73 65 73 20 69 74 65 6d  clare (uses item
0260: 73 29 29 0a 28 64 65 63 6c 61 72 65 20 28 75 73  s)).(declare (us
0270: 65 73 20 72 75 6e 63 6f 6e 66 69 67 29 29 0a 28  es runconfig)).(
0280: 64 65 63 6c 61 72 65 20 28 75 73 65 73 20 74 65  declare (uses te
0290: 73 74 73 29 29 0a 28 64 65 63 6c 61 72 65 20 28  sts)).(declare (
02a0: 75 73 65 73 20 73 65 72 76 65 72 29 29 0a 0a 28  uses server))..(
02b0: 69 6e 63 6c 75 64 65 20 22 63 6f 6d 6d 6f 6e 5f  include "common_
02c0: 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 0a 28 69  records.scm").(i
02d0: 6e 63 6c 75 64 65 20 22 6b 65 79 5f 72 65 63 6f  nclude "key_reco
02e0: 72 64 73 2e 73 63 6d 22 29 0a 28 69 6e 63 6c 75  rds.scm").(inclu
02f0: 64 65 20 22 64 62 5f 72 65 63 6f 72 64 73 2e 73  de "db_records.s
0300: 63 6d 22 29 0a 28 69 6e 63 6c 75 64 65 20 22 72  cm").(include "r
0310: 75 6e 5f 72 65 63 6f 72 64 73 2e 73 63 6d 22 29  un_records.scm")
0320: 0a 28 69 6e 63 6c 75 64 65 20 22 74 65 73 74 5f  .(include "test_
0330: 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 0a 0a 3b  records.scm")..;
0340: 3b 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d  ; runs:get-runs-
0350: 62 79 2d 70 61 74 74 0a 3b 3b 20 67 65 74 20 72  by-patt.;; get r
0360: 75 6e 73 20 62 79 20 6c 69 73 74 20 6f 66 20 63  uns by list of c
0370: 72 69 74 65 72 69 61 0a 3b 3b 20 72 65 67 69 73  riteria.;; regis
0380: 74 65 72 20 61 20 74 65 73 74 20 72 75 6e 20 77  ter a test run w
0390: 69 74 68 20 74 68 65 20 64 62 0a 3b 3b 0a 3b 3b  ith the db.;;.;;
03a0: 20 55 73 65 3a 20 28 64 62 2d 67 65 74 2d 76 61   Use: (db-get-va
03b0: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 28 64  lue-by-header (d
03c0: 62 3a 67 65 74 2d 68 65 61 64 65 72 20 72 75 6e  b:get-header run
03d0: 69 6e 66 6f 29 28 64 62 3a 67 65 74 2d 72 6f 77  info)(db:get-row
03e0: 20 72 75 6e 69 6e 66 6f 29 29 0a 3b 3b 20 20 74   runinfo)).;;  t
03f0: 6f 20 65 78 74 72 61 63 74 20 69 6e 66 6f 20 66  o extract info f
0400: 72 6f 6d 20 74 68 65 20 73 74 72 75 63 74 75 72  rom the structur
0410: 65 20 72 65 74 75 72 6e 65 64 0a 3b 3b 0a 28 64  e returned.;;.(d
0420: 65 66 69 6e 65 20 28 72 75 6e 73 3a 67 65 74 2d  efine (runs:get-
0430: 72 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20  runs-by-patt db 
0440: 6b 65 79 73 20 72 75 6e 6e 61 6d 65 70 61 74 74  keys runnamepatt
0450: 20 2e 20 70 61 72 61 6d 73 29 20 3b 3b 20 74 65   . params) ;; te
0460: 73 74 2d 6e 61 6d 65 29 0a 20 20 28 6c 65 74 2a  st-name).  (let*
0470: 20 28 28 6b 65 79 76 61 6c 6c 73 74 20 28 6b 65   ((keyvallst (ke
0480: 79 73 2d 3e 76 61 6c 6c 69 73 74 20 6b 65 79 73  ys->vallist keys
0490: 29 29 0a 09 20 28 74 6d 70 20 20 20 20 20 20 28  )).. (tmp      (
04a0: 72 75 6e 73 3a 67 65 74 2d 73 74 64 2d 72 75 6e  runs:get-std-run
04b0: 2d 66 69 65 6c 64 73 20 6b 65 79 73 20 27 28 22  -fields keys '("
04c0: 69 64 22 20 22 72 75 6e 6e 61 6d 65 22 20 22 73  id" "runname" "s
04d0: 74 61 74 65 22 20 22 73 74 61 74 75 73 22 20 22  tate" "status" "
04e0: 6f 77 6e 65 72 22 20 22 65 76 65 6e 74 5f 74 69  owner" "event_ti
04f0: 6d 65 22 29 29 29 0a 09 20 28 6b 65 79 73 74 72  me"))).. (keystr
0500: 20 20 20 28 63 61 72 20 74 6d 70 29 29 0a 09 20     (car tmp)).. 
0510: 28 68 65 61 64 65 72 20 20 20 28 63 61 64 72 20  (header   (cadr 
0520: 74 6d 70 29 29 0a 09 20 28 72 65 73 20 20 20 20  tmp)).. (res    
0530: 20 27 28 29 29 0a 09 20 28 6b 65 79 2d 70 61 74   '()).. (key-pat
0540: 74 20 22 22 29 29 0a 20 20 20 20 28 66 6f 72 2d  t "")).    (for-
0550: 65 61 63 68 20 28 6c 61 6d 62 64 61 20 28 6b 65  each (lambda (ke
0560: 79 76 61 6c 29 0a 09 09 28 6c 65 74 2a 20 28 28  yval)...(let* ((
0570: 6b 65 79 20 20 20 20 28 76 65 63 74 6f 72 2d 72  key    (vector-r
0580: 65 66 20 6b 65 79 76 61 6c 20 30 29 29 0a 09 09  ef keyval 0))...
0590: 20 20 20 20 20 20 20 28 66 75 6c 6b 65 79 20 28         (fulkey (
05a0: 63 6f 6e 63 20 22 3a 22 20 6b 65 79 29 29 0a 09  conc ":" key))..
05b0: 09 20 20 20 20 20 20 20 28 70 61 74 74 20 20 20  .       (patt   
05c0: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 66 75  (args:get-arg fu
05d0: 6c 6b 65 79 29 29 29 0a 09 09 20 20 28 69 66 20  lkey)))...  (if 
05e0: 70 61 74 74 0a 09 09 20 20 20 20 20 20 28 73 65  patt...      (se
05f0: 74 21 20 6b 65 79 2d 70 61 74 74 20 28 63 6f 6e  t! key-patt (con
0600: 63 20 6b 65 79 2d 70 61 74 74 20 22 20 41 4e 44  c key-patt " AND
0610: 20 22 20 6b 65 79 20 22 20 6c 69 6b 65 20 27 22   " key " like '"
0620: 20 70 61 74 74 20 22 27 22 29 29 0a 09 09 20 20   patt "'"))...  
0630: 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09 28 64      (begin....(d
0640: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52  ebug:print 0 "ER
0650: 52 4f 52 3a 20 73 65 61 72 63 68 69 6e 67 20 66  ROR: searching f
0660: 6f 72 20 72 75 6e 73 20 77 69 74 68 20 6e 6f 20  or runs with no 
0670: 70 61 74 74 65 72 6e 20 73 65 74 20 66 6f 72 20  pattern set for 
0680: 22 20 66 75 6c 6b 65 79 29 0a 09 09 09 28 65 78  " fulkey)....(ex
0690: 69 74 20 36 29 29 29 29 29 0a 09 20 20 20 20 20  it 6)))))..     
06a0: 20 6b 65 79 73 29 0a 20 20 20 20 28 73 71 6c 69   keys).    (sqli
06b0: 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77  te3:for-each-row
06c0: 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28   .     (lambda (
06d0: 61 20 2e 20 72 29 0a 20 20 20 20 20 20 20 28 73  a . r).       (s
06e0: 65 74 21 20 72 65 73 20 28 63 6f 6e 73 20 28 6c  et! res (cons (l
06f0: 69 73 74 2d 3e 76 65 63 74 6f 72 20 28 63 6f 6e  ist->vector (con
0700: 73 20 61 20 72 29 29 20 72 65 73 29 29 29 0a 20  s a r)) res))). 
0710: 20 20 20 20 64 62 20 0a 20 20 20 20 20 28 63 6f      db .     (co
0720: 6e 63 20 22 53 45 4c 45 43 54 20 22 20 6b 65 79  nc "SELECT " key
0730: 73 74 72 20 22 20 46 52 4f 4d 20 72 75 6e 73 20  str " FROM runs 
0740: 57 48 45 52 45 20 72 75 6e 6e 61 6d 65 20 6c 69  WHERE runname li
0750: 6b 65 20 3f 20 22 20 6b 65 79 2d 70 61 74 74 20  ke ? " key-patt 
0760: 22 3b 22 29 0a 20 20 20 20 20 72 75 6e 6e 61 6d  ";").     runnam
0770: 65 70 61 74 74 29 0a 20 20 20 20 28 76 65 63 74  epatt).    (vect
0780: 6f 72 20 68 65 61 64 65 72 20 72 65 73 29 29 29  or header res)))
0790: 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a  ..(define (runs:
07a0: 74 65 73 74 2d 67 65 74 2d 66 75 6c 6c 2d 70 61  test-get-full-pa
07b0: 74 68 20 74 65 73 74 29 0a 20 20 28 6c 65 74 2a  th test).  (let*
07c0: 20 28 28 74 65 73 74 6e 61 6d 65 20 28 64 62 3a   ((testname (db:
07d0: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d  test-get-testnam
07e0: 65 20 20 20 74 65 73 74 29 29 0a 09 20 28 69 74  e   test)).. (it
07f0: 65 6d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d  empath (db:test-
0800: 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65  get-item-path te
0810: 73 74 29 29 29 0a 20 20 20 20 28 63 6f 6e 63 20  st))).    (conc 
0820: 74 65 73 74 6e 61 6d 65 20 28 69 66 20 28 65 71  testname (if (eq
0830: 75 61 6c 3f 20 69 74 65 6d 70 61 74 68 20 22 22  ual? itempath ""
0840: 29 20 22 22 20 28 63 6f 6e 63 20 22 28 22 20 69  ) "" (conc "(" i
0850: 74 65 6d 70 61 74 68 20 22 29 22 29 29 29 29 29  tempath ")")))))
0860: 0a 0a 3b 3b 20 41 77 66 75 6c 2e 20 50 6c 65 61  ..;; Awful. Plea
0870: 73 65 20 46 49 58 4d 45 0a 28 64 65 66 69 6e 65  se FIXME.(define
0880: 20 2a 65 6e 76 2d 76 61 72 73 2d 62 79 2d 72 75   *env-vars-by-ru
0890: 6e 2d 69 64 2a 20 28 6d 61 6b 65 2d 68 61 73 68  n-id* (make-hash
08a0: 2d 74 61 62 6c 65 29 29 0a 28 64 65 66 69 6e 65  -table)).(define
08b0: 20 2a 63 75 72 72 65 6e 74 2d 72 75 6e 2d 6e 61   *current-run-na
08c0: 6d 65 2a 20 20 20 23 66 29 0a 0a 28 64 65 66 69  me*   #f)..(defi
08d0: 6e 65 20 28 73 65 74 2d 6d 65 67 61 74 65 73 74  ne (set-megatest
08e0: 2d 65 6e 76 2d 76 61 72 73 20 64 62 20 72 75 6e  -env-vars db run
08f0: 2d 69 64 29 0a 20 20 28 6c 65 74 20 28 28 6b 65  -id).  (let ((ke
0900: 79 73 20 28 64 62 3a 67 65 74 2d 6b 65 79 73 20  ys (db:get-keys 
0910: 64 62 29 29 0a 09 28 76 61 6c 73 20 28 68 61 73  db))..(vals (has
0920: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61  h-table-ref/defa
0930: 75 6c 74 20 2a 65 6e 76 2d 76 61 72 73 2d 62 79  ult *env-vars-by
0940: 2d 72 75 6e 2d 69 64 2a 20 72 75 6e 2d 69 64 20  -run-id* run-id 
0950: 23 66 29 29 29 0a 20 20 20 20 3b 3b 20 67 65 74  #f))).    ;; get
0960: 20 74 68 65 20 69 6e 66 6f 20 66 72 6f 6d 20 74   the info from t
0970: 68 65 20 64 62 20 61 6e 64 20 70 75 74 20 69 74  he db and put it
0980: 20 69 6e 20 74 68 65 20 63 61 63 68 65 0a 20 20   in the cache.  
0990: 20 20 28 69 66 20 28 6e 6f 74 20 76 61 6c 73 29    (if (not vals)
09a0: 0a 09 28 6c 65 74 20 28 28 68 74 20 28 6d 61 6b  ..(let ((ht (mak
09b0: 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a  e-hash-table))).
09c0: 09 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73  .  (hash-table-s
09d0: 65 74 21 20 2a 65 6e 76 2d 76 61 72 73 2d 62 79  et! *env-vars-by
09e0: 2d 72 75 6e 2d 69 64 2a 20 72 75 6e 2d 69 64 20  -run-id* run-id 
09f0: 68 74 29 0a 09 20 20 28 73 65 74 21 20 76 61 6c  ht)..  (set! val
0a00: 73 20 68 74 29 0a 09 20 20 28 66 6f 72 2d 65 61  s ht)..  (for-ea
0a10: 63 68 0a 09 20 20 20 28 6c 61 6d 62 64 61 20 28  ch..   (lambda (
0a20: 6b 65 79 29 0a 09 20 20 20 20 20 28 73 71 6c 69  key)..     (sqli
0a30: 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77  te3:for-each-row
0a40: 0a 09 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20  ..      (lambda 
0a50: 28 76 61 6c 29 0a 09 09 28 68 61 73 68 2d 74 61  (val)...(hash-ta
0a60: 62 6c 65 2d 73 65 74 21 20 76 61 6c 73 20 6b 65  ble-set! vals ke
0a70: 79 20 76 61 6c 29 29 0a 09 20 20 20 20 20 20 64  y val))..      d
0a80: 62 20 0a 09 20 20 20 20 20 20 28 63 6f 6e 63 20  b ..      (conc 
0a90: 22 53 45 4c 45 43 54 20 22 20 28 6b 65 79 3a 67  "SELECT " (key:g
0aa0: 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79  et-fieldname key
0ab0: 29 20 22 20 46 52 4f 4d 20 72 75 6e 73 20 57 48  ) " FROM runs WH
0ac0: 45 52 45 20 69 64 3d 3f 3b 22 29 0a 09 20 20 20  ERE id=?;")..   
0ad0: 20 20 20 72 75 6e 2d 69 64 29 29 0a 09 20 20 20     run-id))..   
0ae0: 6b 65 79 73 29 29 29 0a 20 20 20 20 3b 3b 20 66  keys))).    ;; f
0af0: 72 6f 6d 20 74 68 65 20 63 61 63 68 65 64 20 64  rom the cached d
0b00: 61 74 61 20 73 65 74 20 74 68 65 20 76 61 72 73  ata set the vars
0b10: 0a 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65  .    (hash-table
0b20: 2d 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 76  -for-each.     v
0b30: 61 6c 73 0a 20 20 20 20 20 28 6c 61 6d 62 64 61  als.     (lambda
0b40: 20 28 6b 65 79 20 76 61 6c 29 0a 20 20 20 20 20   (key val).     
0b50: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32    (debug:print 2
0b60: 20 22 73 65 74 65 6e 76 20 22 20 28 6b 65 79 3a   "setenv " (key:
0b70: 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65  get-fieldname ke
0b80: 79 29 20 22 20 22 20 76 61 6c 29 0a 20 20 20 20  y) " " val).    
0b90: 20 20 20 28 73 65 74 65 6e 76 20 28 6b 65 79 3a     (setenv (key:
0ba0: 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65  get-fieldname ke
0bb0: 79 29 20 76 61 6c 29 29 29 0a 20 20 20 20 28 61  y) val))).    (a
0bc0: 6c 69 73 74 2d 3e 65 6e 76 2d 76 61 72 73 20 28  list->env-vars (
0bd0: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64  hash-table-ref/d
0be0: 65 66 61 75 6c 74 20 2a 63 6f 6e 66 69 67 64 61  efault *configda
0bf0: 74 2a 20 22 65 6e 76 2d 6f 76 65 72 72 69 64 65  t* "env-override
0c00: 22 20 27 28 29 29 29 0a 20 20 20 20 3b 3b 20 4c  " '())).    ;; L
0c10: 65 74 73 20 75 73 65 20 74 68 69 73 20 61 73 20  ets use this as 
0c20: 61 6e 20 6f 70 70 6f 72 74 75 6e 69 74 79 20 74  an opportunity t
0c30: 6f 20 70 75 74 20 4d 54 5f 52 55 4e 4e 41 4d 45  o put MT_RUNNAME
0c40: 20 69 6e 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d   in the environm
0c50: 65 6e 74 0a 20 20 20 20 28 69 66 20 28 6e 6f 74  ent.    (if (not
0c60: 20 2a 63 75 72 72 65 6e 74 2d 72 75 6e 2d 6e 61   *current-run-na
0c70: 6d 65 2a 29 0a 09 28 73 71 6c 69 74 65 33 3a 66  me*)..(sqlite3:f
0c80: 6f 72 2d 65 61 63 68 2d 72 6f 77 0a 09 20 28 6c  or-each-row.. (l
0c90: 61 6d 62 64 61 20 28 72 75 6e 6e 61 6d 65 29 0a  ambda (runname).
0ca0: 09 20 20 20 28 73 65 74 21 20 2a 63 75 72 72 65  .   (set! *curre
0cb0: 6e 74 2d 72 75 6e 2d 6e 61 6d 65 2a 20 72 75 6e  nt-run-name* run
0cc0: 6e 61 6d 65 29 29 0a 0a 09 20 64 62 0a 09 20 22  name))... db.. "
0cd0: 53 45 4c 45 43 54 20 72 75 6e 6e 61 6d 65 20 46  SELECT runname F
0ce0: 52 4f 4d 20 72 75 6e 73 20 57 48 45 52 45 20 69  ROM runs WHERE i
0cf0: 64 3d 3f 3b 22 0a 09 20 72 75 6e 2d 69 64 29 29  d=?;".. run-id))
0d00: 0a 20 20 20 20 28 73 65 74 65 6e 76 20 22 4d 54  .    (setenv "MT
0d10: 5f 52 55 4e 4e 41 4d 45 22 20 2a 63 75 72 72 65  _RUNNAME" *curre
0d20: 6e 74 2d 72 75 6e 2d 6e 61 6d 65 2a 29 0a 20 20  nt-run-name*).  
0d30: 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55    (setenv "MT_RU
0d40: 4e 5f 41 52 45 41 5f 48 4f 4d 45 22 20 2a 74 6f  N_AREA_HOME" *to
0d50: 70 70 61 74 68 2a 29 0a 20 20 20 20 29 29 0a 0a  ppath*).    ))..
0d60: 28 64 65 66 69 6e 65 20 28 73 65 74 2d 69 74 65  (define (set-ite
0d70: 6d 2d 65 6e 76 2d 76 61 72 73 20 69 74 65 6d 64  m-env-vars itemd
0d80: 61 74 29 0a 20 20 28 66 6f 72 2d 65 61 63 68 20  at).  (for-each 
0d90: 28 6c 61 6d 62 64 61 20 28 69 74 65 6d 29 0a 09  (lambda (item)..
0da0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
0db0: 6e 74 20 32 20 22 73 65 74 65 6e 76 20 22 20 28  nt 2 "setenv " (
0dc0: 63 61 72 20 69 74 65 6d 29 20 22 20 22 20 28 63  car item) " " (c
0dd0: 61 64 72 20 69 74 65 6d 29 29 0a 09 20 20 20 20  adr item))..    
0de0: 20 20 28 73 65 74 65 6e 76 20 28 63 61 72 20 69    (setenv (car i
0df0: 74 65 6d 29 20 28 63 61 64 72 20 69 74 65 6d 29  tem) (cadr item)
0e00: 29 29 0a 09 20 20 20 20 69 74 65 6d 64 61 74 29  ))..    itemdat)
0e10: 29 0a 0a 28 64 65 66 69 6e 65 20 2a 6c 61 73 74  )..(define *last
0e20: 2d 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 74 65 73  -num-running-tes
0e30: 74 73 2a 20 30 29 0a 28 64 65 66 69 6e 65 20 28  ts* 0).(define (
0e40: 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72  runs:can-run-mor
0e50: 65 2d 74 65 73 74 73 20 64 62 20 74 65 73 74 2d  e-tests db test-
0e60: 72 65 63 6f 72 64 29 0a 20 20 28 6c 65 74 2a 20  record).  (let* 
0e70: 28 28 74 63 6f 6e 66 69 67 20 20 20 20 20 20 20  ((tconfig       
0e80: 20 20 20 20 20 20 20 20 20 20 28 74 65 73 74 73            (tests
0e90: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74  :testqueue-get-t
0ea0: 65 73 74 63 6f 6e 66 69 67 20 74 65 73 74 2d 72  estconfig test-r
0eb0: 65 63 6f 72 64 29 29 0a 09 20 28 6a 6f 62 67 72  ecord)).. (jobgr
0ec0: 6f 75 70 20 20 20 20 20 20 20 20 20 20 20 20 20  oup             
0ed0: 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75     (config-looku
0ee0: 70 20 74 63 6f 6e 66 69 67 20 22 72 65 71 75 69  p tconfig "requi
0ef0: 72 65 6d 65 6e 74 73 22 20 22 6a 6f 62 67 72 6f  rements" "jobgro
0f00: 75 70 22 29 29 0a 09 20 28 6e 75 6d 2d 72 75 6e  up")).. (num-run
0f10: 6e 69 6e 67 20 20 20 20 20 20 20 20 20 20 20 20  ning            
0f20: 20 28 64 62 3a 67 65 74 2d 63 6f 75 6e 74 2d 74   (db:get-count-t
0f30: 65 73 74 73 2d 72 75 6e 6e 69 6e 67 20 64 62 29  ests-running db)
0f40: 29 0a 09 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67  ).. (num-running
0f50: 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 28 64 62  -in-jobgroup (db
0f60: 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 65 73 74 73  :get-count-tests
0f70: 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67  -running-in-jobg
0f80: 72 6f 75 70 20 64 62 20 6a 6f 62 67 72 6f 75 70  roup db jobgroup
0f90: 29 29 0a 09 20 28 6d 61 78 2d 63 6f 6e 63 75 72  )).. (max-concur
0fa0: 72 65 6e 74 2d 6a 6f 62 73 20 20 20 20 20 28 63  rent-jobs     (c
0fb0: 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f  onfig-lookup *co
0fc0: 6e 66 69 67 64 61 74 2a 20 22 73 65 74 75 70 22  nfigdat* "setup"
0fd0: 20 20 20 20 20 22 6d 61 78 5f 63 6f 6e 63 75 72       "max_concur
0fe0: 72 65 6e 74 5f 6a 6f 62 73 22 29 29 0a 09 20 28  rent_jobs")).. (
0ff0: 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 20  job-group-limit 
1000: 20 20 20 20 20 20 20 20 28 63 6f 6e 66 69 67 2d          (config-
1010: 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61  lookup *configda
1020: 74 2a 20 22 6a 6f 62 67 72 6f 75 70 73 22 20 6a  t* "jobgroups" j
1030: 6f 62 67 72 6f 75 70 29 29 29 0a 20 20 20 20 28  obgroup))).    (
1040: 69 66 20 28 6e 6f 74 20 28 65 71 3f 20 2a 6c 61  if (not (eq? *la
1050: 73 74 2d 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 74  st-num-running-t
1060: 65 73 74 73 2a 20 6e 75 6d 2d 72 75 6e 6e 69 6e  ests* num-runnin
1070: 67 29 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 28  g))..(begin..  (
1080: 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 6d  debug:print 2 "m
1090: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f  ax-concurrent-jo
10a0: 62 73 3a 20 22 20 6d 61 78 2d 63 6f 6e 63 75 72  bs: " max-concur
10b0: 72 65 6e 74 2d 6a 6f 62 73 20 22 2c 20 6e 75 6d  rent-jobs ", num
10c0: 2d 72 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d  -running: " num-
10d0: 72 75 6e 6e 69 6e 67 29 0a 09 20 20 28 73 65 74  running)..  (set
10e0: 21 20 2a 6c 61 73 74 2d 6e 75 6d 2d 72 75 6e 6e  ! *last-num-runn
10f0: 69 6e 67 2d 74 65 73 74 73 2a 20 6e 75 6d 2d 72  ing-tests* num-r
1100: 75 6e 6e 69 6e 67 29 29 29 0a 20 20 20 20 28 69  unning))).    (i
1110: 66 20 28 6e 6f 74 20 28 65 71 3f 20 30 20 2a 67  f (not (eq? 0 *g
1120: 6c 6f 62 61 6c 65 78 69 74 73 74 61 74 75 73 2a  lobalexitstatus*
1130: 29 29 0a 09 23 66 0a 09 28 6c 65 74 20 28 28 63  ))..#f..(let ((c
1140: 61 6e 2d 6e 6f 74 2d 72 75 6e 2d 6d 6f 72 65 20  an-not-run-more 
1150: 28 63 6f 6e 64 0a 09 09 09 09 20 3b 3b 20 69 66  (cond..... ;; if
1160: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d   max-concurrent-
1170: 6a 6f 62 73 20 69 73 20 73 65 74 20 61 6e 64 20  jobs is set and 
1180: 74 68 65 20 6e 75 6d 62 65 72 20 72 75 6e 6e 69  the number runni
1190: 6e 67 20 69 73 20 67 72 65 61 74 65 72 20 0a 09  ng is greater ..
11a0: 09 09 09 20 3b 3b 20 74 68 61 6e 20 69 74 20 74  ... ;; than it t
11b0: 68 61 6e 20 63 61 6e 6e 6f 74 20 72 75 6e 20 6d  han cannot run m
11c0: 6f 72 65 20 6a 6f 62 73 0a 09 09 09 09 20 28 28  ore jobs..... ((
11d0: 61 6e 64 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65  and max-concurre
11e0: 6e 74 2d 6a 6f 62 73 0a 09 09 09 09 20 20 20 20  nt-jobs.....    
11f0: 20 20 20 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62     (string->numb
1200: 65 72 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e  er max-concurren
1210: 74 2d 6a 6f 62 73 29 0a 09 09 09 09 20 20 20 20  t-jobs).....    
1220: 20 20 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e 69     (>= num-runni
1230: 6e 67 20 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62  ng (string->numb
1240: 65 72 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e  er max-concurren
1250: 74 2d 6a 6f 62 73 29 29 29 0a 09 09 09 09 20 20  t-jobs))).....  
1260: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22  (debug:print 0 "
1270: 57 41 52 4e 49 4e 47 3a 20 4d 61 78 20 72 75 6e  WARNING: Max run
1280: 6e 69 6e 67 20 6a 6f 62 73 20 65 78 63 65 65 64  ning jobs exceed
1290: 65 64 2c 20 63 75 72 72 65 6e 74 20 6e 75 6d 62  ed, current numb
12a0: 65 72 20 72 75 6e 6e 69 6e 67 3a 20 22 20 6e 75  er running: " nu
12b0: 6d 2d 72 75 6e 6e 69 6e 67 20 0a 09 09 09 09 09  m-running ......
12c0: 20 20 20 20 20 20 20 22 2c 20 6d 61 78 5f 63 6f         ", max_co
12d0: 6e 63 75 72 72 65 6e 74 5f 6a 6f 62 73 3a 20 22  ncurrent_jobs: "
12e0: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d   max-concurrent-
12f0: 6a 6f 62 73 29 0a 09 09 09 09 20 20 23 74 29 0a  jobs).....  #t).
1300: 09 09 09 09 20 3b 3b 20 69 66 20 6a 6f 62 2d 67  .... ;; if job-g
1310: 72 6f 75 70 2d 6c 69 6d 69 74 20 69 73 20 73 65  roup-limit is se
1320: 74 20 61 6e 64 20 6e 75 6d 62 65 72 20 6f 66 20  t and number of 
1330: 6a 6f 62 73 20 69 6e 20 74 68 65 20 67 72 6f 75  jobs in the grou
1340: 70 20 69 73 20 67 72 65 61 74 65 72 0a 09 09 09  p is greater....
1350: 09 20 3b 3b 20 74 68 61 6e 20 74 68 65 20 6c 69  . ;; than the li
1360: 6d 69 74 20 74 68 65 6e 20 63 61 6e 6e 6f 74 20  mit then cannot 
1370: 72 75 6e 20 6d 6f 72 65 20 6a 6f 62 73 20 6f 66  run more jobs of
1380: 20 74 68 69 73 20 6b 69 6e 64 0a 09 09 09 09 20   this kind..... 
1390: 28 28 61 6e 64 20 6a 6f 62 2d 67 72 6f 75 70 2d  ((and job-group-
13a0: 6c 69 6d 69 74 0a 09 09 09 09 20 20 20 20 20 20  limit.....      
13b0: 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67   (>= num-running
13c0: 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 6a 6f 62  -in-jobgroup job
13d0: 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 29 29 0a 09  -group-limit))..
13e0: 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e  ...  (debug:prin
13f0: 74 20 31 20 22 57 41 52 4e 49 4e 47 3a 20 6e 75  t 1 "WARNING: nu
1400: 6d 62 65 72 20 6f 66 20 6a 6f 62 73 20 22 20 6e  mber of jobs " n
1410: 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f  um-running-in-jo
1420: 62 67 72 6f 75 70 20 0a 09 09 09 09 09 20 20 20  bgroup ......   
1430: 20 20 20 20 22 20 69 6e 20 22 20 6a 6f 62 67 72      " in " jobgr
1440: 6f 75 70 20 22 20 65 78 63 65 65 64 65 64 2c 20  oup " exceeded, 
1450: 77 69 6c 6c 20 6e 6f 74 20 72 75 6e 20 22 20 28  will not run " (
1460: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
1470: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73  get-testname tes
1480: 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 09 09 20  t-record))..... 
1490: 20 23 74 29 0a 09 09 09 09 20 28 65 6c 73 65 20   #t)..... (else 
14a0: 23 66 29 29 29 29 0a 09 20 20 28 6e 6f 74 20 63  #f))))..  (not c
14b0: 61 6e 2d 6e 6f 74 2d 72 75 6e 2d 6d 6f 72 65 29  an-not-run-more)
14c0: 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d  ))))..;;========
14d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
14e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
14f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1500: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b  ==============.;
1510: 3b 20 4e 65 77 20 6d 65 74 68 6f 64 6f 6c 6f 67  ; New methodolog
1520: 79 2e 20 54 68 65 73 65 20 72 6f 75 74 69 6e 65  y. These routine
1530: 73 20 77 69 6c 6c 20 72 65 70 6c 61 63 65 20 74  s will replace t
1540: 68 65 20 61 62 6f 76 65 20 69 6e 20 74 69 6d 65  he above in time
1550: 2e 20 46 6f 72 0a 3b 3b 20 6e 6f 77 20 74 68 65  . For.;; now the
1560: 20 63 6f 64 65 20 69 73 20 64 75 70 6c 69 63 61   code is duplica
1570: 74 65 64 2e 20 54 68 69 73 20 73 74 75 66 66 20  ted. This stuff 
1580: 69 73 20 69 6e 69 74 69 61 6c 6c 79 20 75 73 65  is initially use
1590: 64 20 69 6e 20 74 68 65 20 6d 6f 6e 69 74 6f 72  d in the monitor
15a0: 0a 3b 3b 20 62 61 73 65 64 20 63 6f 64 65 2e 0a  .;; based code..
15b0: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;;==============
15c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
15d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
15e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
15f0: 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 72 65 67  ========..;; reg
1600: 69 73 74 65 72 20 61 20 74 65 73 74 20 72 75 6e  ister a test run
1610: 20 77 69 74 68 20 74 68 65 20 64 62 0a 28 64 65   with the db.(de
1620: 66 69 6e 65 20 28 72 75 6e 73 3a 72 65 67 69 73  fine (runs:regis
1630: 74 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 20  ter-run db keys 
1640: 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d  keyvallst runnam
1650: 65 20 73 74 61 74 65 20 73 74 61 74 75 73 20 75  e state status u
1660: 73 65 72 29 0a 20 20 28 64 65 62 75 67 3a 70 72  ser).  (debug:pr
1670: 69 6e 74 20 33 20 22 72 75 6e 73 3a 72 65 67 69  int 3 "runs:regi
1680: 73 74 65 72 2d 72 75 6e 2c 20 6b 65 79 73 3a 20  ster-run, keys: 
1690: 22 20 6b 65 79 73 20 22 20 6b 65 79 76 61 6c 6c  " keys " keyvall
16a0: 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 20  st: " keyvallst 
16b0: 22 20 72 75 6e 6e 61 6d 65 3a 20 22 20 72 75 6e  " runname: " run
16c0: 6e 61 6d 65 20 22 20 73 74 61 74 65 3a 20 22 20  name " state: " 
16d0: 73 74 61 74 65 20 22 20 73 74 61 74 75 73 3a 20  state " status: 
16e0: 22 20 73 74 61 74 75 73 20 22 20 75 73 65 72 3a  " status " user:
16f0: 20 22 20 75 73 65 72 29 0a 20 20 28 6c 65 74 2a   " user).  (let*
1700: 20 28 28 6b 65 79 73 74 72 20 20 20 20 28 6b 65   ((keystr    (ke
1710: 79 73 2d 3e 6b 65 79 73 74 72 20 6b 65 79 73 29  ys->keystr keys)
1720: 29 0a 09 20 28 63 6f 6d 6d 61 20 20 20 20 20 28  ).. (comma     (
1730: 69 66 20 28 3e 20 28 6c 65 6e 67 74 68 20 6b 65  if (> (length ke
1740: 79 73 29 20 30 29 20 22 2c 22 20 22 22 29 29 0a  ys) 0) "," "")).
1750: 09 20 28 61 6e 64 73 74 72 20 20 20 20 28 69 66  . (andstr    (if
1760: 20 28 3e 20 28 6c 65 6e 67 74 68 20 6b 65 79 73   (> (length keys
1770: 29 20 30 29 20 22 20 41 4e 44 20 22 20 22 22 29  ) 0) " AND " "")
1780: 29 0a 09 20 28 76 61 6c 73 6c 6f 74 73 20 20 28  ).. (valslots  (
1790: 6b 65 79 73 2d 3e 76 61 6c 73 6c 6f 74 73 20 6b  keys->valslots k
17a0: 65 79 73 29 29 20 3b 3b 20 3f 2c 3f 2c 3f 20 2e  eys)) ;; ?,?,? .
17b0: 2e 2e 0a 09 20 28 6b 65 79 76 61 6c 73 20 20 20  .... (keyvals   
17c0: 28 6d 61 70 20 63 61 64 72 20 6b 65 79 76 61 6c  (map cadr keyval
17d0: 6c 73 74 29 29 0a 09 20 28 61 6c 6c 76 61 6c 73  lst)).. (allvals
17e0: 20 20 20 28 61 70 70 65 6e 64 20 28 6c 69 73 74     (append (list
17f0: 20 72 75 6e 6e 61 6d 65 20 73 74 61 74 65 20 73   runname state s
1800: 74 61 74 75 73 20 75 73 65 72 29 20 6b 65 79 76  tatus user) keyv
1810: 61 6c 73 29 29 0a 09 20 28 71 72 79 76 61 6c 73  als)).. (qryvals
1820: 20 20 20 28 61 70 70 65 6e 64 20 28 6c 69 73 74     (append (list
1830: 20 72 75 6e 6e 61 6d 65 29 20 6b 65 79 76 61 6c   runname) keyval
1840: 73 29 29 0a 09 20 28 6b 65 79 3d 3f 73 74 72 20  s)).. (key=?str 
1850: 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70   (string-intersp
1860: 65 72 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 64  erse (map (lambd
1870: 61 20 28 6b 29 28 63 6f 6e 63 20 28 6b 65 79 3a  a (k)(conc (key:
1880: 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 29  get-fieldname k)
1890: 20 22 3d 3f 22 29 29 20 6b 65 79 73 29 20 22 20   "=?")) keys) " 
18a0: 41 4e 44 20 22 29 29 29 0a 20 20 20 20 28 64 65  AND "))).    (de
18b0: 62 75 67 3a 70 72 69 6e 74 20 33 20 22 6b 65 79  bug:print 3 "key
18c0: 73 3a 20 22 20 6b 65 79 73 20 22 20 61 6c 6c 76  s: " keys " allv
18d0: 61 6c 73 3a 20 22 20 61 6c 6c 76 61 6c 73 20 22  als: " allvals "
18e0: 20 6b 65 79 76 61 6c 73 3a 20 22 20 6b 65 79 76   keyvals: " keyv
18f0: 61 6c 73 29 0a 20 20 20 20 28 64 65 62 75 67 3a  als).    (debug:
1900: 70 72 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 75  print 2 "NOTE: u
1910: 73 69 6e 67 20 74 61 72 67 65 74 20 22 20 28 73  sing target " (s
1920: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73  tring-interspers
1930: 65 20 6b 65 79 76 61 6c 73 20 22 2f 22 29 20 22  e keyvals "/") "
1940: 20 66 6f 72 20 74 68 69 73 20 72 75 6e 22 29 0a   for this run").
1950: 20 20 20 20 28 69 66 20 28 61 6e 64 20 72 75 6e      (if (and run
1960: 6e 61 6d 65 20 28 6e 75 6c 6c 3f 20 28 66 69 6c  name (null? (fil
1970: 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29 28  ter (lambda (x)(
1980: 6e 6f 74 20 78 29 29 20 6b 65 79 76 61 6c 73 29  not x)) keyvals)
1990: 29 29 20 3b 3b 20 74 68 65 72 65 20 6d 75 73 74  )) ;; there must
19a0: 20 62 65 20 61 20 62 65 74 74 65 72 20 77 61 79   be a better way
19b0: 20 74 6f 20 22 61 70 70 6c 79 20 61 6e 64 22 0a   to "apply and".
19c0: 09 28 6c 65 74 20 28 28 72 65 73 20 23 66 29 29  .(let ((res #f))
19d0: 0a 09 20 20 28 61 70 70 6c 79 20 73 71 6c 69 74  ..  (apply sqlit
19e0: 65 33 3a 65 78 65 63 75 74 65 20 64 62 20 28 63  e3:execute db (c
19f0: 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 49  onc "INSERT OR I
1a00: 47 4e 4f 52 45 20 49 4e 54 4f 20 72 75 6e 73 20  GNORE INTO runs 
1a10: 28 72 75 6e 6e 61 6d 65 2c 73 74 61 74 65 2c 73  (runname,state,s
1a20: 74 61 74 75 73 2c 6f 77 6e 65 72 2c 65 76 65 6e  tatus,owner,even
1a30: 74 5f 74 69 6d 65 22 20 63 6f 6d 6d 61 20 6b 65  t_time" comma ke
1a40: 79 73 74 72 20 22 29 20 56 41 4c 55 45 53 20 28  ystr ") VALUES (
1a50: 3f 2c 3f 2c 3f 2c 3f 2c 73 74 72 66 74 69 6d 65  ?,?,?,?,strftime
1a60: 28 27 25 73 27 2c 27 6e 6f 77 27 29 22 20 63 6f  ('%s','now')" co
1a70: 6d 6d 61 20 76 61 6c 73 6c 6f 74 73 20 22 29 3b  mma valslots ");
1a80: 22 29 0a 09 09 20 61 6c 6c 76 61 6c 73 29 0a 09  ")... allvals)..
1a90: 20 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 33    (apply sqlite3
1aa0: 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 20 0a 09  :for-each-row ..
1ab0: 20 20 20 28 6c 61 6d 62 64 61 20 28 69 64 29 0a     (lambda (id).
1ac0: 09 20 20 20 20 20 28 73 65 74 21 20 72 65 73 20  .     (set! res 
1ad0: 69 64 29 29 0a 09 20 20 20 64 62 0a 09 20 20 20  id))..   db..   
1ae0: 28 6c 65 74 20 28 28 71 72 79 20 28 63 6f 6e 63  (let ((qry (conc
1af0: 20 22 53 45 4c 45 43 54 20 69 64 20 46 52 4f 4d   "SELECT id FROM
1b00: 20 72 75 6e 73 20 57 48 45 52 45 20 28 72 75 6e   runs WHERE (run
1b10: 6e 61 6d 65 3d 3f 20 22 20 61 6e 64 73 74 72 20  name=? " andstr 
1b20: 6b 65 79 3d 3f 73 74 72 20 22 29 3b 22 29 29 29  key=?str ");")))
1b30: 0a 09 20 20 20 20 20 3b 28 64 65 62 75 67 3a 70  ..     ;(debug:p
1b40: 72 69 6e 74 20 34 20 22 71 72 79 3a 20 22 20 71  rint 4 "qry: " q
1b50: 72 79 29 20 0a 09 20 20 20 20 20 71 72 79 29 0a  ry) ..     qry).
1b60: 09 20 20 20 71 72 79 76 61 6c 73 29 0a 09 20 20  .   qryvals)..  
1b70: 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65  (sqlite3:execute
1b80: 20 64 62 20 22 55 50 44 41 54 45 20 72 75 6e 73   db "UPDATE runs
1b90: 20 53 45 54 20 73 74 61 74 65 3d 3f 2c 73 74 61   SET state=?,sta
1ba0: 74 75 73 3d 3f 20 57 48 45 52 45 20 69 64 3d 3f  tus=? WHERE id=?
1bb0: 3b 22 20 73 74 61 74 65 20 73 74 61 74 75 73 20  ;" state status 
1bc0: 72 65 73 29 0a 09 20 20 72 65 73 29 20 0a 09 28  res)..  res) ..(
1bd0: 62 65 67 69 6e 0a 09 20 20 28 64 65 62 75 67 3a  begin..  (debug:
1be0: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20  print 0 "ERROR: 
1bf0: 43 61 6c 6c 65 64 20 77 69 74 68 6f 75 74 20 61  Called without a
1c00: 6c 6c 20 6e 65 63 65 73 73 61 72 79 20 6b 65 79  ll necessary key
1c10: 73 22 29 0a 09 20 20 23 66 29 29 29 29 0a 0a 3b  s")..  #f))))..;
1c20: 3b 20 54 68 69 73 20 69 73 20 61 20 64 75 70 6c  ; This is a dupl
1c30: 69 63 61 74 65 20 6f 66 20 72 75 6e 2d 74 65 73  icate of run-tes
1c40: 74 73 20 28 77 68 69 63 68 20 68 61 73 20 62 65  ts (which has be
1c50: 65 6e 20 64 65 70 72 65 63 61 74 65 64 29 2e 20  en deprecated). 
1c60: 55 73 65 20 74 68 69 73 20 6f 6e 65 20 69 6e 73  Use this one ins
1c70: 74 65 61 64 20 6f 66 20 72 75 6e 20 74 65 73 74  tead of run test
1c80: 73 2e 0a 3b 3b 20 6b 65 79 76 61 6c 73 0a 28 64  s..;; keyvals.(d
1c90: 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 75 6e 2d  efine (runs:run-
1ca0: 74 65 73 74 73 20 74 61 72 67 65 74 20 72 75 6e  tests target run
1cb0: 6e 61 6d 65 20 74 65 73 74 2d 70 61 74 74 73 20  name test-patts 
1cc0: 75 73 65 72 20 66 6c 61 67 73 29 0a 20 20 28 6c  user flags).  (l
1cd0: 65 74 2a 20 28 28 64 62 20 20 20 20 20 20 20 20  et* ((db        
1ce0: 20 20 23 66 29 0a 09 20 28 6b 65 79 73 20 20 20    #f).. (keys   
1cf0: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
1d00: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 6b 65 79 73  lose db:get-keys
1d10: 20 64 62 29 29 0a 09 20 28 6b 65 79 76 61 6c 6c   db)).. (keyvall
1d20: 73 74 20 20 20 28 6b 65 79 73 3a 74 61 72 67 65  st   (keys:targe
1d30: 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 79 73 20 74  t->keyval keys t
1d40: 61 72 67 65 74 29 29 0a 09 20 28 72 75 6e 2d 69  arget)).. (run-i
1d50: 64 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e  d      (open-run
1d60: 2d 63 6c 6f 73 65 20 72 75 6e 73 3a 72 65 67 69  -close runs:regi
1d70: 73 74 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73  ster-run db keys
1d80: 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61   keyvallst runna
1d90: 6d 65 20 22 6e 65 77 22 20 22 6e 2f 61 22 20 75  me "new" "n/a" u
1da0: 73 65 72 29 29 20 20 3b 3b 20 20 74 65 73 74 2d  ser))  ;;  test-
1db0: 6e 61 6d 65 29 29 29 0a 09 20 28 64 65 66 65 72  name))).. (defer
1dc0: 72 65 64 20 20 20 20 27 28 29 29 20 3b 3b 20 64  red    '()) ;; d
1dd0: 65 6c 61 79 20 72 75 6e 6e 69 6e 67 20 74 68 65  elay running the
1de0: 73 65 20 73 69 6e 63 65 20 74 68 65 79 20 68 61  se since they ha
1df0: 76 65 20 61 20 77 61 69 74 6f 6e 20 63 6c 61 75  ve a waiton clau
1e00: 73 65 0a 09 20 3b 3b 20 6b 65 65 70 67 6f 69 6e  se.. ;; keepgoin
1e10: 67 20 69 73 20 74 68 65 20 64 65 66 61 63 74 6f  g is the defacto
1e20: 20 6d 6f 64 61 6c 69 74 79 20 6e 6f 77 2c 20 77   modality now, w
1e30: 69 6c 6c 20 61 64 64 20 68 69 74 2d 6e 2d 72 75  ill add hit-n-ru
1e40: 6e 20 61 20 62 69 74 20 6c 61 74 65 72 0a 09 20  n a bit later.. 
1e50: 3b 3b 20 28 6b 65 65 70 67 6f 69 6e 67 20 20 20  ;; (keepgoing   
1e60: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f  (hash-table-ref/
1e70: 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d  default flags "-
1e80: 6b 65 65 70 67 6f 69 6e 67 22 20 23 66 29 29 0a  keepgoing" #f)).
1e90: 09 20 28 74 65 73 74 2d 6e 61 6d 65 73 20 20 27  . (test-names  '
1ea0: 28 29 29 0a 09 20 28 72 75 6e 63 6f 6e 66 69 67  ()).. (runconfig
1eb0: 66 20 20 20 28 63 6f 6e 63 20 20 2a 74 6f 70 70  f   (conc  *topp
1ec0: 61 74 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 69 67  ath* "/runconfig
1ed0: 73 2e 63 6f 6e 66 69 67 22 29 29 0a 09 20 28 72  s.config")).. (r
1ee0: 65 71 75 69 72 65 64 2d 74 65 73 74 73 20 27 28  equired-tests '(
1ef0: 29 29 0a 09 20 28 74 65 73 74 2d 72 65 63 6f 72  )).. (test-recor
1f00: 64 73 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61  ds (make-hash-ta
1f10: 62 6c 65 29 29 29 0a 0a 20 20 20 20 28 6f 70 65  ble)))..    (ope
1f20: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 73 65 74 2d  n-run-close set-
1f30: 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72  megatest-env-var
1f40: 73 20 64 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20  s db run-id) ;; 
1f50: 74 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65  these may be nee
1f60: 64 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63  ded by the launc
1f70: 68 69 6e 67 20 70 72 6f 63 65 73 73 0a 0a 20 20  hing process..  
1f80: 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73    (if (file-exis
1f90: 74 73 3f 20 72 75 6e 63 6f 6e 66 69 67 66 29 0a  ts? runconfigf).
1fa0: 09 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65  .(open-run-close
1fb0: 20 73 65 74 75 70 2d 65 6e 76 2d 64 65 66 61 75   setup-env-defau
1fc0: 6c 74 73 20 64 62 20 72 75 6e 63 6f 6e 66 69 67  lts db runconfig
1fd0: 66 20 72 75 6e 2d 69 64 20 2a 61 6c 72 65 61 64  f run-id *alread
1fe0: 79 2d 73 65 65 6e 2d 72 75 6e 63 6f 6e 66 69 67  y-seen-runconfig
1ff0: 2d 69 6e 66 6f 2a 20 22 70 72 65 2d 6c 61 75 6e  -info* "pre-laun
2000: 63 68 2d 65 6e 76 2d 76 61 72 73 22 29 0a 09 28  ch-env-vars")..(
2010: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57  debug:print 0 "W
2020: 41 52 4e 49 4e 47 3a 20 59 6f 75 20 64 6f 20 6e  ARNING: You do n
2030: 6f 74 20 68 61 76 65 20 61 20 72 75 6e 20 63 6f  ot have a run co
2040: 6e 66 69 67 20 66 69 6c 65 3a 20 22 20 72 75 6e  nfig file: " run
2050: 63 6f 6e 66 69 67 66 29 29 0a 20 20 20 20 0a 20  configf)).    . 
2060: 20 20 20 3b 3b 20 6c 6f 6f 6b 20 75 70 20 61 6c     ;; look up al
2070: 6c 20 74 65 73 74 73 20 6d 61 74 63 68 69 6e 67  l tests matching
2080: 20 74 68 65 20 63 6f 6d 6d 61 20 73 65 70 61 72   the comma separ
2090: 61 74 65 64 20 6c 69 73 74 20 6f 66 20 67 6c 6f  ated list of glo
20a0: 62 73 20 69 6e 0a 20 20 20 20 3b 3b 20 74 65 73  bs in.    ;; tes
20b0: 74 2d 70 61 74 74 73 20 28 75 73 69 6e 67 20 25  t-patts (using %
20c0: 20 61 73 20 77 69 6c 64 63 61 72 64 29 0a 20 20   as wildcard).  
20d0: 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20    (for-each .   
20e0: 20 20 28 6c 61 6d 62 64 61 20 28 70 61 74 74 29    (lambda (patt)
20f0: 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 74  .       (let ((t
2100: 65 73 74 73 20 28 67 6c 6f 62 20 28 63 6f 6e 63  ests (glob (conc
2110: 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73   *toppath* "/tes
2120: 74 73 2f 22 20 28 73 74 72 69 6e 67 2d 74 72 61  ts/" (string-tra
2130: 6e 73 6c 61 74 65 20 70 61 74 74 20 22 25 22 20  nslate patt "%" 
2140: 22 2a 22 29 29 29 29 29 0a 09 20 28 73 65 74 21  "*"))))).. (set!
2150: 20 74 65 73 74 73 20 28 66 69 6c 74 65 72 20 28   tests (filter (
2160: 6c 61 6d 62 64 61 20 28 74 65 73 74 29 28 66 69  lambda (test)(fi
2170: 6c 65 2d 65 78 69 73 74 73 3f 20 28 63 6f 6e 63  le-exists? (conc
2180: 20 74 65 73 74 20 22 2f 74 65 73 74 63 6f 6e 66   test "/testconf
2190: 69 67 22 29 29 29 20 74 65 73 74 73 29 29 0a 09  ig"))) tests))..
21a0: 20 28 73 65 74 21 20 74 65 73 74 2d 6e 61 6d 65   (set! test-name
21b0: 73 20 28 61 70 70 65 6e 64 20 74 65 73 74 2d 6e  s (append test-n
21c0: 61 6d 65 73 20 0a 09 09 09 09 20 20 28 6d 61 70  ames .....  (map
21d0: 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 70 29   (lambda (testp)
21e0: 0a 09 09 09 09 09 20 28 6c 61 73 74 20 28 73 74  ...... (last (st
21f0: 72 69 6e 67 2d 73 70 6c 69 74 20 74 65 73 74 70  ring-split testp
2200: 20 22 2f 22 29 29 29 0a 09 09 09 09 20 20 20 20   "/"))).....    
2210: 20 20 20 74 65 73 74 73 29 29 29 29 29 0a 20 20     tests))))).  
2220: 20 20 20 28 69 66 20 74 65 73 74 2d 70 61 74 74     (if test-patt
2230: 73 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20  s (string-split 
2240: 74 65 73 74 2d 70 61 74 74 73 20 22 2c 22 29 28  test-patts ",")(
2250: 6c 69 73 74 20 22 25 22 29 29 29 0a 0a 20 20 20  list "%")))..   
2260: 20 20 3b 3b 20 6e 6f 77 20 72 65 6d 6f 76 65 20    ;; now remove 
2270: 64 75 70 6c 69 63 61 74 65 73 0a 20 20 20 20 28  duplicates.    (
2280: 73 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20  set! test-names 
2290: 28 64 65 6c 65 74 65 2d 64 75 70 6c 69 63 61 74  (delete-duplicat
22a0: 65 73 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a  es test-names)).
22b0: 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  .    (debug:prin
22c0: 74 20 30 20 22 49 4e 46 4f 3a 20 74 65 73 74 20  t 0 "INFO: test 
22d0: 6e 61 6d 65 73 20 22 20 74 65 73 74 2d 6e 61 6d  names " test-nam
22e0: 65 73 29 0a 0a 20 20 20 20 3b 3b 20 6f 6e 20 74  es)..    ;; on t
22f0: 68 65 20 66 69 72 73 74 20 70 61 73 73 20 6f 72  he first pass or
2300: 20 63 61 6c 6c 20 74 6f 20 72 75 6e 2d 74 65 73   call to run-tes
2310: 74 73 20 73 65 74 20 46 41 49 4c 53 20 74 6f 20  ts set FAILS to 
2320: 4e 4f 54 5f 53 54 41 52 54 45 44 20 69 66 0a 20  NOT_STARTED if. 
2330: 20 20 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67     ;; -keepgoing
2340: 20 69 73 20 73 70 65 63 69 66 69 65 64 0a 20 20   is specified.  
2350: 20 20 28 69 66 20 28 65 71 3f 20 2a 70 61 73 73    (if (eq? *pass
2360: 6e 75 6d 2a 20 30 29 0a 09 28 62 65 67 69 6e 0a  num* 0)..(begin.
2370: 09 20 20 3b 3b 20 68 61 76 65 20 74 6f 20 64 65  .  ;; have to de
2380: 6c 65 74 65 20 74 65 73 74 20 72 65 63 6f 72 64  lete test record
2390: 73 20 77 68 65 72 65 20 4e 4f 54 5f 53 54 41 52  s where NOT_STAR
23a0: 54 45 44 20 73 69 6e 63 65 20 74 68 65 79 20 63  TED since they c
23b0: 61 6e 20 63 61 75 73 65 20 2d 6b 65 65 70 67 6f  an cause -keepgo
23c0: 69 6e 67 20 74 6f 20 0a 09 20 20 3b 3b 20 67 65  ing to ..  ;; ge
23d0: 74 20 73 74 75 63 6b 20 64 75 65 20 74 6f 20 62  t stuck due to b
23e0: 65 63 6f 6d 69 6e 67 20 69 6e 61 63 63 65 73 73  ecoming inaccess
23f0: 69 62 6c 65 20 66 72 6f 6d 20 61 20 66 61 69 6c  ible from a fail
2400: 65 64 20 74 65 73 74 2e 20 49 2e 65 2e 20 69 66  ed test. I.e. if
2410: 20 74 65 73 74 20 42 20 64 65 70 65 6e 64 73 20   test B depends 
2420: 0a 09 20 20 3b 3b 20 6f 6e 20 74 65 73 74 20 41  ..  ;; on test A
2430: 20 62 75 74 20 74 65 73 74 20 42 20 72 65 61 63   but test B reac
2440: 68 65 64 20 74 68 65 20 70 6f 69 6e 74 20 6f 6e  hed the point on
2450: 20 62 65 69 6e 67 20 72 65 67 69 73 74 65 72 65   being registere
2460: 64 20 61 73 20 4e 4f 54 5f 53 54 41 52 54 45 44  d as NOT_STARTED
2470: 20 61 6e 64 20 74 65 73 74 0a 09 20 20 3b 3b 20   and test..  ;; 
2480: 41 20 66 61 69 6c 65 64 20 66 6f 72 20 73 6f 6d  A failed for som
2490: 65 20 72 65 61 73 6f 6e 20 74 68 65 6e 20 6f 6e  e reason then on
24a0: 20 72 65 2d 72 75 6e 20 75 73 69 6e 67 20 2d 6b   re-run using -k
24b0: 65 65 70 67 6f 69 6e 67 20 74 68 65 20 72 75 6e  eepgoing the run
24c0: 20 63 61 6e 20 6e 65 76 65 72 20 63 6f 6d 70 6c   can never compl
24d0: 65 74 65 2e 0a 09 20 20 28 6f 70 65 6e 2d 72 75  ete...  (open-ru
24e0: 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74  n-close db:delet
24f0: 65 2d 74 65 73 74 73 2d 69 6e 2d 73 74 61 74 65  e-tests-in-state
2500: 20 64 62 20 72 75 6e 2d 69 64 20 22 4e 4f 54 5f   db run-id "NOT_
2510: 53 54 41 52 54 45 44 22 29 0a 09 20 20 28 6f 70  STARTED")..  (op
2520: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a  en-run-close db:
2530: 73 65 74 2d 74 65 73 74 73 2d 73 74 61 74 65 2d  set-tests-state-
2540: 73 74 61 74 75 73 20 64 62 20 72 75 6e 2d 69 64  status db run-id
2550: 20 74 65 73 74 2d 6e 61 6d 65 73 20 23 66 20 22   test-names #f "
2560: 46 41 49 4c 22 20 22 4e 4f 54 5f 53 54 41 52 54  FAIL" "NOT_START
2570: 45 44 22 20 22 46 41 49 4c 22 29 29 29 0a 0a 20  ED" "FAIL"))).. 
2580: 20 20 20 3b 3b 20 66 72 6f 6d 20 68 65 72 65 20     ;; from here 
2590: 6f 6e 20 6f 75 74 20 74 68 65 20 64 62 20 77 69  on out the db wi
25a0: 6c 6c 20 62 65 20 6f 70 65 6e 65 64 20 61 6e 64  ll be opened and
25b0: 20 63 6c 6f 73 65 64 20 6f 6e 20 65 76 65 72 79   closed on every
25c0: 20 63 61 6c 6c 20 72 75 6e 73 3a 72 75 6e 2d 74   call runs:run-t
25d0: 65 73 74 73 2d 71 75 65 75 65 0a 20 20 20 20 3b  ests-queue.    ;
25e0: 3b 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c  ; (sqlite3:final
25f0: 69 7a 65 21 20 64 62 29 20 0a 20 20 20 20 3b 3b  ize! db) .    ;;
2600: 20 6e 6f 77 20 61 64 64 20 6e 6f 6e 2d 64 69 72   now add non-dir
2610: 65 63 74 6c 79 20 72 65 66 65 72 65 6e 63 65 64  ectly referenced
2620: 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 28 69   dependencies (i
2630: 2e 65 2e 20 77 61 69 74 6f 6e 29 0a 20 20 20 20  .e. waiton).    
2640: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20  (if (not (null? 
2650: 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 28 6c  test-names))..(l
2660: 65 74 20 6c 6f 6f 70 20 28 28 68 65 64 20 28 63  et loop ((hed (c
2670: 61 72 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a  ar test-names)).
2680: 09 09 20 20 20 28 74 61 6c 20 28 63 64 72 20 74  ..   (tal (cdr t
2690: 65 73 74 2d 6e 61 6d 65 73 29 29 29 20 20 20 20  est-names)))    
26a0: 20 20 20 20 20 3b 3b 20 27 72 65 74 75 72 6e 2d       ;; 'return-
26b0: 70 72 6f 63 73 20 74 65 6c 6c 73 20 74 68 65 20  procs tells the 
26c0: 63 6f 6e 66 69 67 20 72 65 61 64 65 72 20 74 6f  config reader to
26d0: 20 70 72 65 70 20 72 75 6e 6e 69 6e 67 20 73 79   prep running sy
26e0: 73 74 65 6d 20 62 75 74 20 72 65 74 75 72 6e 20  stem but return 
26f0: 61 20 70 72 6f 63 0a 09 20 20 28 64 65 62 75 67  a proc..  (debug
2700: 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20  :print 4 "INFO: 
2710: 68 65 64 3d 22 20 68 65 64 20 22 20 61 74 20 74  hed=" hed " at t
2720: 6f 70 20 6f 66 20 6c 6f 6f 70 22 29 0a 09 20 20  op of loop")..  
2730: 28 6c 65 74 2a 20 28 28 63 6f 6e 66 69 67 20 20  (let* ((config  
2740: 28 74 65 73 74 73 3a 67 65 74 2d 74 65 73 74 63  (tests:get-testc
2750: 6f 6e 66 69 67 20 68 65 64 20 27 72 65 74 75 72  onfig hed 'retur
2760: 6e 2d 70 72 6f 63 73 29 29 0a 09 09 20 28 77 61  n-procs))... (wa
2770: 69 74 6f 6e 73 20 28 69 66 20 63 6f 6e 66 69 67  itons (if config
2780: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 28   (string-split (
2790: 6c 65 74 20 28 28 77 20 28 63 6f 6e 66 69 67 2d  let ((w (config-
27a0: 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 20 22 72  lookup config "r
27b0: 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 77 61  equirements" "wa
27c0: 69 74 6f 6e 22 29 29 29 0a 09 09 09 09 09 09 20  iton")))....... 
27d0: 20 20 20 20 28 69 66 20 77 20 77 20 22 22 29 29      (if w w ""))
27e0: 29 0a 09 09 09 20 20 20 20 20 20 28 62 65 67 69  )....      (begi
27f0: 6e 0a 09 09 09 09 28 64 65 62 75 67 3a 70 72 69  n.....(debug:pri
2800: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 6e 6f 6e  nt 0 "ERROR: non
2810: 2d 65 78 69 73 74 65 6e 74 20 72 65 71 75 69 72  -existent requir
2820: 65 64 20 74 65 73 74 20 5c 22 22 20 68 65 64 20  ed test \"" hed 
2830: 22 5c 22 22 29 0a 20 20 20 20 20 20 20 20 20 20  "\"").          
2840: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
2850: 20 20 20 20 20 20 28 69 66 20 64 62 20 28 73 71        (if db (sq
2860: 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20  lite3:finalize! 
2870: 64 62 29 29 0a 09 09 09 09 28 65 78 69 74 20 31  db)).....(exit 1
2880: 29 29 29 29 29 0a 09 20 20 20 20 3b 3b 20 63 68  )))))..    ;; ch
2890: 65 63 6b 20 66 6f 72 20 68 65 64 20 69 6e 20 77  eck for hed in w
28a0: 61 69 74 6f 6e 73 20 3d 3e 20 74 68 69 73 20 77  aitons => this w
28b0: 6f 75 6c 64 20 62 65 20 63 69 72 63 75 6c 61 72  ould be circular
28c0: 2c 20 72 65 6d 6f 76 65 20 69 74 20 61 6e 64 20  , remove it and 
28d0: 69 73 73 75 65 20 61 6e 0a 09 20 20 20 20 3b 3b  issue an..    ;;
28e0: 20 65 72 72 6f 72 0a 09 20 20 20 20 28 69 66 20   error..    (if 
28f0: 28 6d 65 6d 62 65 72 20 68 65 64 20 77 61 69 74  (member hed wait
2900: 6f 6e 73 29 0a 09 09 28 62 65 67 69 6e 0a 09 09  ons)...(begin...
2910: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
2920: 20 22 45 52 52 4f 52 3a 20 74 65 73 74 20 22 20   "ERROR: test " 
2930: 68 65 64 20 22 20 68 61 73 20 6c 69 73 74 65 64  hed " has listed
2940: 20 69 74 73 65 6c 66 20 61 73 20 61 20 77 61 69   itself as a wai
2950: 74 6f 6e 2c 20 70 6c 65 61 73 65 20 63 6f 72 72  ton, please corr
2960: 65 63 74 20 74 68 69 73 21 22 29 0a 09 09 20 20  ect this!")...  
2970: 28 73 65 74 21 20 77 61 69 74 6f 6e 73 20 28 66  (set! waitons (f
2980: 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78  ilter (lambda (x
2990: 29 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 78 20  )(not (equal? x 
29a0: 68 65 64 29 29 29 20 77 61 69 74 6f 6e 73 29 29  hed))) waitons))
29b0: 29 29 0a 09 20 20 20 20 0a 09 20 20 20 20 3b 3b  ))..    ..    ;;
29c0: 20 28 69 74 65 6d 73 20 20 20 28 69 74 65 6d 73   (items   (items
29d0: 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d  :get-items-from-
29e0: 63 6f 6e 66 69 67 20 63 6f 6e 66 69 67 29 29 29  config config)))
29f0: 0a 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28  ..    (if (not (
2a00: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64  hash-table-ref/d
2a10: 65 66 61 75 6c 74 20 74 65 73 74 2d 72 65 63 6f  efault test-reco
2a20: 72 64 73 20 68 65 64 20 23 66 29 29 0a 09 09 28  rds hed #f))...(
2a30: 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20  hash-table-set! 
2a40: 74 65 73 74 2d 72 65 63 6f 72 64 73 0a 09 09 09  test-records....
2a50: 09 20 68 65 64 20 28 76 65 63 74 6f 72 20 68 65  . hed (vector he
2a60: 64 20 20 20 20 20 3b 3b 20 30 0a 09 09 09 09 09  d     ;; 0......
2a70: 20 20 20 20 20 63 6f 6e 66 69 67 20 20 3b 3b 20       config  ;; 
2a80: 31 0a 09 09 09 09 09 20 20 20 20 20 77 61 69 74  1......     wait
2a90: 6f 6e 73 20 3b 3b 20 32 0a 09 09 09 09 09 20 20  ons ;; 2......  
2aa0: 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75     (config-looku
2ab0: 70 20 63 6f 6e 66 69 67 20 22 72 65 71 75 69 72  p config "requir
2ac0: 65 6d 65 6e 74 73 22 20 22 70 72 69 6f 72 69 74  ements" "priorit
2ad0: 79 22 29 20 20 20 20 20 3b 3b 20 70 72 69 6f 72  y")     ;; prior
2ae0: 69 74 79 20 33 0a 09 09 09 09 09 20 20 20 20 20  ity 3......     
2af0: 28 6c 65 74 20 28 28 69 74 65 6d 73 20 20 20 20  (let ((items    
2b00: 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65    (hash-table-re
2b10: 66 2f 64 65 66 61 75 6c 74 20 63 6f 6e 66 69 67  f/default config
2b20: 20 22 69 74 65 6d 73 22 20 23 66 29 29 20 3b 3b   "items" #f)) ;;
2b30: 20 69 74 65 6d 73 20 34 0a 09 09 09 09 09 09 20   items 4....... 
2b40: 20 20 28 69 74 65 6d 73 74 61 62 6c 65 20 28 68    (itemstable (h
2b50: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65  ash-table-ref/de
2b60: 66 61 75 6c 74 20 63 6f 6e 66 69 67 20 22 69 74  fault config "it
2b70: 65 6d 73 74 61 62 6c 65 22 20 23 66 29 29 29 20  emstable" #f))) 
2b80: 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20  ......       ;; 
2b90: 69 66 20 65 69 74 68 65 72 20 69 74 65 6d 73 20  if either items 
2ba0: 6f 72 20 69 74 65 6d 73 20 74 61 62 6c 65 20 69  or items table i
2bb0: 73 20 61 20 70 72 6f 63 20 72 65 74 75 72 6e 20  s a proc return 
2bc0: 69 74 20 73 6f 20 74 65 73 74 20 72 75 6e 6e 69  it so test runni
2bd0: 6e 67 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b  ng......       ;
2be0: 3b 20 70 72 6f 63 65 73 73 20 63 61 6e 20 6b 6e  ; process can kn
2bf0: 6f 77 20 74 6f 20 63 61 6c 6c 20 69 74 65 6d 73  ow to call items
2c00: 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d  :get-items-from-
2c10: 63 6f 6e 66 69 67 0a 09 09 09 09 09 20 20 20 20  config......    
2c20: 20 20 20 3b 3b 20 69 66 20 65 69 74 68 65 72 20     ;; if either 
2c30: 69 73 20 61 20 6c 69 73 74 20 61 6e 64 20 6e 6f  is a list and no
2c40: 6e 65 20 69 73 20 61 20 70 72 6f 63 20 67 6f 20  ne is a proc go 
2c50: 61 68 65 61 64 20 61 6e 64 20 63 61 6c 6c 20 67  ahead and call g
2c60: 65 74 2d 69 74 65 6d 73 0a 09 09 09 09 09 20 20  et-items......  
2c70: 20 20 20 20 20 3b 3b 20 6f 74 68 65 72 77 69 73       ;; otherwis
2c80: 65 20 72 65 74 75 72 6e 20 23 66 20 2d 20 74 68  e return #f - th
2c90: 69 73 20 69 73 20 6e 6f 74 20 61 6e 20 69 74 65  is is not an ite
2ca0: 72 61 74 65 64 20 74 65 73 74 0a 09 09 09 09 09  rated test......
2cb0: 20 20 20 20 20 20 20 28 63 6f 6e 64 0a 09 09 09         (cond....
2cc0: 09 09 09 28 28 70 72 6f 63 65 64 75 72 65 3f 20  ...((procedure? 
2cd0: 69 74 65 6d 73 29 20 20 20 20 20 20 0a 09 09 09  items)      ....
2ce0: 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ... (debug:print
2cf0: 20 34 20 22 49 4e 46 4f 3a 20 69 74 65 6d 73 20   4 "INFO: items 
2d00: 69 73 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20  is a procedure, 
2d10: 77 69 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72 22  will calc later"
2d20: 29 0a 09 09 09 09 09 09 20 69 74 65 6d 73 29 20  )....... items) 
2d30: 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 63 61             ;; ca
2d40: 6c 63 20 6c 61 74 65 72 0a 09 09 09 09 09 09 28  lc later.......(
2d50: 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d  (procedure? item
2d60: 73 74 61 62 6c 65 29 0a 09 09 09 09 09 09 20 28  stable)....... (
2d70: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49  debug:print 4 "I
2d80: 4e 46 4f 3a 20 69 74 65 6d 73 74 61 62 6c 65 20  NFO: itemstable 
2d90: 69 73 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20  is a procedure, 
2da0: 77 69 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72 22  will calc later"
2db0: 29 0a 09 09 09 09 09 09 20 69 74 65 6d 73 74 61  )....... itemsta
2dc0: 62 6c 65 29 20 20 20 20 20 20 20 3b 3b 20 63 61  ble)       ;; ca
2dd0: 6c 63 20 6c 61 74 65 72 0a 09 09 09 09 09 09 28  lc later.......(
2de0: 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20  (filter (lambda 
2df0: 28 78 29 0a 09 09 09 09 09 09 09 20 20 20 28 6c  (x)........   (l
2e00: 65 74 20 28 28 76 61 6c 20 28 63 61 72 20 78 29  et ((val (car x)
2e10: 29 29 0a 09 09 09 09 09 09 09 20 20 20 20 20 28  ))........     (
2e20: 69 66 20 28 70 72 6f 63 65 64 75 72 65 3f 20 76  if (procedure? v
2e30: 61 6c 29 20 76 61 6c 20 23 66 29 29 29 0a 09 09  al) val #f)))...
2e40: 09 09 09 09 09 20 28 61 70 70 65 6e 64 20 28 69  ..... (append (i
2e50: 66 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20  f (list? items) 
2e60: 69 74 65 6d 73 20 27 28 29 29 0a 09 09 09 09 09  items '())......
2e70: 09 09 09 20 28 69 66 20 28 6c 69 73 74 3f 20 69  ... (if (list? i
2e80: 74 65 6d 73 74 61 62 6c 65 29 20 69 74 65 6d 73  temstable) items
2e90: 74 61 62 6c 65 20 27 28 29 29 29 29 0a 09 09 09  table '())))....
2ea0: 09 09 09 20 27 68 61 76 65 2d 70 72 6f 63 65 64  ... 'have-proced
2eb0: 75 72 65 29 0a 09 09 09 09 09 09 28 28 6f 72 20  ure).......((or 
2ec0: 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 28 6c 69  (list? items)(li
2ed0: 73 74 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 29  st? itemstable))
2ee0: 20 3b 3b 20 63 61 6c 63 20 6e 6f 77 0a 09 09 09   ;; calc now....
2ef0: 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74  ... (debug:print
2f00: 20 34 20 22 49 4e 46 4f 3a 20 69 74 65 6d 73 20   4 "INFO: items 
2f10: 61 6e 64 20 69 74 65 6d 73 74 61 62 6c 65 20 61  and itemstable a
2f20: 72 65 20 6c 69 73 74 73 2c 20 63 61 6c 63 20 6e  re lists, calc n
2f30: 6f 77 5c 6e 22 0a 09 09 09 09 09 09 09 20 20 20  ow\n"........   
2f40: 20 20 20 22 20 20 20 20 69 74 65 6d 73 3a 20 22     "    items: "
2f50: 20 69 74 65 6d 73 20 22 20 69 74 65 6d 73 74 61   items " itemsta
2f60: 62 6c 65 3a 20 22 20 69 74 65 6d 73 74 61 62 6c  ble: " itemstabl
2f70: 65 29 0a 09 09 09 09 09 09 20 28 69 74 65 6d 73  e)....... (items
2f80: 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d  :get-items-from-
2f90: 63 6f 6e 66 69 67 20 63 6f 6e 66 69 67 29 29 0a  config config)).
2fa0: 09 09 09 09 09 09 28 65 6c 73 65 20 23 66 29 29  ......(else #f))
2fb0: 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  )               
2fc0: 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 6e              ;; n
2fd0: 6f 74 20 69 74 65 72 61 74 65 64 0a 09 09 09 09  ot iterated.....
2fe0: 09 20 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b  .     #f      ;;
2ff0: 20 69 74 65 6d 73 64 61 74 20 35 0a 09 09 09 09   itemsdat 5.....
3000: 09 20 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b  .     #f      ;;
3010: 20 73 70 61 72 65 20 2d 20 75 73 65 64 20 66 6f   spare - used fo
3020: 72 20 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 09  r item-path.....
3030: 09 20 20 20 20 20 29 29 29 0a 09 20 20 20 20 28  .     )))..    (
3040: 66 6f 72 2d 65 61 63 68 20 0a 09 20 20 20 20 20  for-each ..     
3050: 28 6c 61 6d 62 64 61 20 28 77 61 69 74 6f 6e 29  (lambda (waiton)
3060: 0a 09 20 20 20 20 20 20 20 28 69 66 20 28 61 6e  ..       (if (an
3070: 64 20 77 61 69 74 6f 6e 20 28 6e 6f 74 20 28 6d  d waiton (not (m
3080: 65 6d 62 65 72 20 77 61 69 74 6f 6e 20 74 65 73  ember waiton tes
3090: 74 2d 6e 61 6d 65 73 29 29 29 0a 09 09 20 20 20  t-names)))...   
30a0: 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20 28 73  (begin...     (s
30b0: 65 74 21 20 72 65 71 75 69 72 65 64 2d 74 65 73  et! required-tes
30c0: 74 73 20 28 63 6f 6e 73 20 77 61 69 74 6f 6e 20  ts (cons waiton 
30d0: 72 65 71 75 69 72 65 64 2d 74 65 73 74 73 29 29  required-tests))
30e0: 0a 09 09 20 20 20 20 20 28 73 65 74 21 20 74 65  ...     (set! te
30f0: 73 74 2d 6e 61 6d 65 73 20 28 63 6f 6e 73 20 77  st-names (cons w
3100: 61 69 74 6f 6e 20 74 65 73 74 2d 6e 61 6d 65 73  aiton test-names
3110: 29 29 29 29 29 20 3b 3b 20 77 61 73 20 61 6e 20  ))))) ;; was an 
3120: 61 70 70 65 6e 64 2c 20 6e 6f 77 20 61 20 63 6f  append, now a co
3130: 6e 73 0a 09 20 20 20 20 20 77 61 69 74 6f 6e 73  ns..     waitons
3140: 29 0a 09 20 20 20 20 28 6c 65 74 20 28 28 72 65  )..    (let ((re
3150: 6d 74 65 73 74 73 20 28 64 65 6c 65 74 65 2d 64  mtests (delete-d
3160: 75 70 6c 69 63 61 74 65 73 20 28 61 70 70 65 6e  uplicates (appen
3170: 64 20 77 61 69 74 6f 6e 73 20 74 61 6c 29 29 29  d waitons tal)))
3180: 29 0a 09 20 20 20 20 20 20 28 69 66 20 28 6e 6f  )..      (if (no
3190: 74 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74  t (null? remtest
31a0: 73 29 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63  s))...  (loop (c
31b0: 61 72 20 72 65 6d 74 65 73 74 73 29 28 63 64 72  ar remtests)(cdr
31c0: 20 72 65 6d 74 65 73 74 73 29 29 29 29 29 29 29   remtests)))))))
31d0: 0a 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28  ..    (if (not (
31e0: 6e 75 6c 6c 3f 20 72 65 71 75 69 72 65 64 2d 74  null? required-t
31f0: 65 73 74 73 29 29 0a 09 28 64 65 62 75 67 3a 70  ests))..(debug:p
3200: 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 41 64  rint 1 "INFO: Ad
3210: 64 69 6e 67 20 22 20 72 65 71 75 69 72 65 64 2d  ding " required-
3220: 74 65 73 74 73 20 22 20 74 6f 20 74 68 65 20 72  tests " to the r
3230: 75 6e 20 71 75 65 75 65 22 29 29 0a 20 20 20 20  un queue")).    
3240: 3b 3b 20 4e 4f 54 45 3a 20 74 68 65 73 65 20 61  ;; NOTE: these a
3250: 72 65 20 61 6c 6c 20 70 61 72 65 6e 74 20 74 65  re all parent te
3260: 73 74 73 2c 20 69 74 65 6d 73 20 61 72 65 20 6e  sts, items are n
3270: 6f 74 20 65 78 70 61 6e 64 65 64 20 79 65 74 2e  ot expanded yet.
3280: 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e  .    (debug:prin
3290: 74 20 34 20 22 49 4e 46 4f 3a 20 74 65 73 74 2d  t 4 "INFO: test-
32a0: 72 65 63 6f 72 64 73 3d 22 20 28 68 61 73 68 2d  records=" (hash-
32b0: 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65 73  table->alist tes
32c0: 74 2d 72 65 63 6f 72 64 73 29 29 0a 20 20 20 20  t-records)).    
32d0: 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d  (runs:run-tests-
32e0: 71 75 65 75 65 20 72 75 6e 2d 69 64 20 72 75 6e  queue run-id run
32f0: 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64  name test-record
3300: 73 20 6b 65 79 76 61 6c 6c 73 74 20 66 6c 61 67  s keyvallst flag
3310: 73 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72  s).    (debug:pr
3320: 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 72 75 6e  int 1 "INFO: run
3330: 6e 69 6e 67 20 71 75 65 75 65 20 6f 6e 65 20 6d  ning queue one m
3340: 6f 72 65 20 74 69 6d 65 20 74 6f 20 63 61 74 63  ore time to catc
3350: 68 20 61 6e 79 20 63 68 61 6e 67 65 64 20 74 65  h any changed te
3360: 73 74 20 73 74 61 74 65 73 22 29 0a 20 20 20 20  st states").    
3370: 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d  (runs:run-tests-
3380: 71 75 65 75 65 20 72 75 6e 2d 69 64 20 72 75 6e  queue run-id run
3390: 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64  name test-record
33a0: 73 20 6b 65 79 76 61 6c 6c 73 74 20 66 6c 61 67  s keyvallst flag
33b0: 73 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72  s).    (debug:pr
33c0: 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 41 6c 6c  int 4 "INFO: All
33d0: 20 64 6f 6e 65 20 62 79 20 68 65 72 65 22 29 29   done by here"))
33e0: 29 0a 0a 3b 3b 20 74 65 73 74 2d 72 65 63 6f 72  )..;; test-recor
33f0: 64 73 20 69 73 20 61 20 68 61 73 68 20 74 61 62  ds is a hash tab
3400: 6c 65 20 74 65 73 74 6e 61 6d 65 3a 69 74 65 6d  le testname:item
3410: 5f 70 61 74 68 20 3d 3e 20 76 65 63 74 6f 72 20  _path => vector 
3420: 3c 20 74 65 73 74 6e 61 6d 65 20 74 65 73 74 63  < testname testc
3430: 6f 6e 66 69 67 20 77 61 69 74 6f 6e 73 20 70 72  onfig waitons pr
3440: 69 6f 72 69 74 79 20 69 74 65 6d 73 2d 69 6e 66  iority items-inf
3450: 6f 20 2e 2e 2e 20 3e 0a 28 64 65 66 69 6e 65 20  o ... >.(define 
3460: 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d  (runs:run-tests-
3470: 71 75 65 75 65 20 72 75 6e 2d 69 64 20 72 75 6e  queue run-id run
3480: 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64  name test-record
3490: 73 20 6b 65 79 76 61 6c 6c 73 74 20 66 6c 61 67  s keyvallst flag
34a0: 73 29 0a 20 20 20 20 3b 3b 20 41 74 20 74 68 69  s).    ;; At thi
34b0: 73 20 70 6f 69 6e 74 20 74 68 65 20 6c 69 73 74  s point the list
34c0: 20 6f 66 20 70 61 72 65 6e 74 20 74 65 73 74 73   of parent tests
34d0: 20 69 73 20 65 78 70 61 6e 64 65 64 20 0a 20 20   is expanded .  
34e0: 20 20 3b 3b 20 4e 42 2f 2f 20 53 68 6f 75 6c 64    ;; NB// Should
34f0: 20 65 78 70 61 6e 64 20 69 74 65 6d 73 20 68 65   expand items he
3500: 72 65 20 61 6e 64 20 74 68 65 6e 20 69 6e 73 65  re and then inse
3510: 72 74 20 69 6e 74 6f 20 74 68 65 20 72 75 6e 20  rt into the run 
3520: 71 75 65 75 65 2e 0a 20 20 28 64 65 62 75 67 3a  queue..  (debug:
3530: 70 72 69 6e 74 20 35 20 22 74 65 73 74 2d 72 65  print 5 "test-re
3540: 63 6f 72 64 73 3a 20 22 20 74 65 73 74 2d 72 65  cords: " test-re
3550: 63 6f 72 64 73 20 22 2c 20 6b 65 79 76 61 6c 6c  cords ", keyvall
3560: 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 20  st: " keyvallst 
3570: 22 20 66 6c 61 67 73 3a 20 22 20 28 68 61 73 68  " flags: " (hash
3580: 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 66 6c  -table->alist fl
3590: 61 67 73 29 29 0a 20 20 28 6c 65 74 20 28 28 73  ags)).  (let ((s
35a0: 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73  orted-test-names
35b0: 20 28 74 65 73 74 73 3a 73 6f 72 74 2d 62 79 2d   (tests:sort-by-
35c0: 70 72 69 6f 72 69 74 79 2d 61 6e 64 2d 77 61 69  priority-and-wai
35d0: 74 6f 6e 20 74 65 73 74 2d 72 65 63 6f 72 64 73  ton test-records
35e0: 29 29 0a 09 28 69 74 65 6d 2d 70 61 74 74 73 20  ))..(item-patts 
35f0: 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 62         (hash-tab
3600: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66  le-ref/default f
3610: 6c 61 67 73 20 22 2d 69 74 65 6d 70 61 74 74 22  lags "-itempatt"
3620: 20 23 66 29 29 0a 09 28 74 65 73 74 2d 72 65 67   #f))..(test-reg
3630: 69 73 74 65 72 79 20 20 20 20 28 6d 61 6b 65 2d  istery    (make-
3640: 68 61 73 68 2d 74 61 62 6c 65 29 29 0a 09 28 6e  hash-table))..(n
3650: 75 6d 2d 72 65 74 72 69 65 73 20 20 20 20 20 20  um-retries      
3660: 20 20 30 29 0a 09 28 6d 61 78 2d 72 65 74 72 69    0)..(max-retri
3670: 65 73 20 20 20 20 20 20 20 28 63 6f 6e 66 69 67  es       (config
3680: 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64  -lookup *configd
3690: 61 74 2a 20 22 73 65 74 75 70 22 20 22 6d 61 78  at* "setup" "max
36a0: 72 65 74 72 69 65 73 22 29 29 29 0a 20 20 20 20  retries"))).    
36b0: 28 73 65 74 21 20 6d 61 78 2d 72 65 74 72 69 65  (set! max-retrie
36c0: 73 20 28 69 66 20 28 61 6e 64 20 6d 61 78 2d 72  s (if (and max-r
36d0: 65 74 72 69 65 73 20 28 73 74 72 69 6e 67 2d 3e  etries (string->
36e0: 6e 75 6d 62 65 72 20 6d 61 78 2d 72 65 74 72 69  number max-retri
36f0: 65 73 29 29 28 73 74 72 69 6e 67 2d 3e 6e 75 6d  es))(string->num
3700: 62 65 72 20 6d 61 78 2d 72 65 74 72 69 65 73 29  ber max-retries)
3710: 20 31 30 30 29 29 0a 20 20 20 20 28 69 66 20 28   100)).    (if (
3720: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 73 6f 72 74 65  not (null? sorte
3730: 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09  d-test-names))..
3740: 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68 65 64 20  (let loop ((hed 
3750: 20 20 20 20 20 20 20 20 28 63 61 72 20 73 6f 72          (car sor
3760: 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29  ted-test-names))
3770: 0a 09 09 20 20 20 28 74 61 6c 20 20 20 20 20 20  ...   (tal      
3780: 20 20 20 28 63 64 72 20 73 6f 72 74 65 64 2d 74     (cdr sorted-t
3790: 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 09 20 20  est-names))...  
37a0: 20 28 72 65 72 75 6e 73 20 20 20 20 20 20 27 28   (reruns      '(
37b0: 29 29 29 0a 09 20 20 28 69 66 20 28 6e 6f 74 20  )))..  (if (not 
37c0: 28 6e 75 6c 6c 3f 20 72 65 72 75 6e 73 29 29 28  (null? reruns))(
37d0: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49  debug:print 4 "I
37e0: 4e 46 4f 3a 20 72 65 72 75 6e 73 3d 22 20 72 65  NFO: reruns=" re
37f0: 72 75 6e 73 29 29 0a 09 20 20 28 6c 65 74 2a 20  runs))..  (let* 
3800: 28 28 74 65 73 74 2d 72 65 63 6f 72 64 20 28 68  ((test-record (h
3810: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 20 74 65  ash-table-ref te
3820: 73 74 2d 72 65 63 6f 72 64 73 20 68 65 64 29 29  st-records hed))
3830: 0a 09 09 20 28 74 65 73 74 2d 6e 61 6d 65 20 20  ... (test-name  
3840: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75   (tests:testqueu
3850: 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74  e-get-testname t
3860: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 20  est-record))... 
3870: 28 74 63 6f 6e 66 69 67 20 20 20 20 20 28 74 65  (tconfig     (te
3880: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65  sts:testqueue-ge
3890: 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 74 65 73  t-testconfig tes
38a0: 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 28 74  t-record))... (t
38b0: 65 73 74 6d 6f 64 65 20 20 20 20 28 6c 65 74 20  estmode    (let 
38c0: 28 28 6d 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b  ((m (config-look
38d0: 75 70 20 74 63 6f 6e 66 69 67 20 22 72 65 71 75  up tconfig "requ
38e0: 69 72 65 6d 65 6e 74 73 22 20 22 6d 6f 64 65 22  irements" "mode"
38f0: 29 29 29 0a 09 09 09 09 28 69 66 20 6d 20 28 73  ))).....(if m (s
3900: 74 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c 20 6d 29  tring->symbol m)
3910: 20 27 6e 6f 72 6d 61 6c 29 29 29 0a 09 09 20 28   'normal)))... (
3920: 77 61 69 74 6f 6e 73 20 20 20 20 20 28 74 65 73  waitons     (tes
3930: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74  ts:testqueue-get
3940: 2d 77 61 69 74 6f 6e 73 20 20 20 20 74 65 73 74  -waitons    test
3950: 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 28 70 72  -record))... (pr
3960: 69 6f 72 69 74 79 20 20 20 20 28 74 65 73 74 73  iority    (tests
3970: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 70  :testqueue-get-p
3980: 72 69 6f 72 69 74 79 20 20 20 74 65 73 74 2d 72  riority   test-r
3990: 65 63 6f 72 64 29 29 0a 09 09 20 28 69 74 65 6d  ecord))... (item
39a0: 64 61 74 20 20 20 20 20 28 74 65 73 74 73 3a 74  dat     (tests:t
39b0: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65  estqueue-get-ite
39c0: 6d 64 61 74 20 20 20 20 74 65 73 74 2d 72 65 63  mdat    test-rec
39d0: 6f 72 64 29 29 20 3b 3b 20 69 74 65 6d 64 61 74  ord)) ;; itemdat
39e0: 20 63 61 6e 20 62 65 20 61 20 73 74 72 69 6e 67   can be a string
39f0: 2c 20 6c 69 73 74 20 6f 72 20 23 66 0a 09 09 20  , list or #f... 
3a00: 28 69 74 65 6d 73 20 20 20 20 20 20 20 28 74 65  (items       (te
3a10: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65  sts:testqueue-ge
3a20: 74 2d 69 74 65 6d 73 20 20 20 20 20 20 74 65 73  t-items      tes
3a30: 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 28 69  t-record))... (i
3a40: 74 65 6d 2d 70 61 74 68 20 20 20 28 69 74 65 6d  tem-path   (item
3a50: 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d  -list->path item
3a60: 64 61 74 29 29 0a 09 09 20 28 6e 65 77 74 61 6c  dat))... (newtal
3a70: 20 20 20 20 20 20 28 61 70 70 65 6e 64 20 74 61        (append ta
3a80: 6c 20 28 6c 69 73 74 20 68 65 64 29 29 29 0a 09  l (list hed)))..
3a90: 09 20 28 63 61 6c 63 2d 66 61 69 6c 73 20 20 28  . (calc-fails  (
3aa0: 6c 61 6d 62 64 61 20 28 70 72 65 72 65 71 73 2d  lambda (prereqs-
3ab0: 6e 6f 74 2d 6d 65 74 29 0a 09 09 09 09 28 66 69  not-met).....(fi
3ac0: 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 74 65  lter (lambda (te
3ad0: 73 74 29 0a 09 09 09 09 09 20 20 28 61 6e 64 20  st)......  (and 
3ae0: 28 76 65 63 74 6f 72 3f 20 74 65 73 74 29 20 3b  (vector? test) ;
3af0: 3b 20 6e 6f 74 20 28 73 74 72 69 6e 67 3f 20 74  ; not (string? t
3b00: 65 73 74 29 29 0a 09 09 09 09 09 20 20 20 20 20  est))......     
3b10: 20 20 28 65 71 75 61 6c 3f 20 28 64 62 3a 74 65    (equal? (db:te
3b20: 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74 65 73  st-get-state tes
3b30: 74 29 20 22 43 4f 4d 50 4c 45 54 45 44 22 29 0a  t) "COMPLETED").
3b40: 09 09 09 09 09 20 20 20 20 20 20 20 28 6e 6f 74  .....       (not
3b50: 20 28 6d 65 6d 62 65 72 20 28 64 62 3a 74 65 73   (member (db:tes
3b60: 74 2d 67 65 74 2d 73 74 61 74 75 73 20 74 65 73  t-get-status tes
3b70: 74 29 0a 09 09 09 09 09 09 09 20 20 20 20 27 28  t)........    '(
3b80: 22 50 41 53 53 22 20 22 57 41 52 4e 22 20 22 43  "PASS" "WARN" "C
3b90: 48 45 43 4b 22 20 22 57 41 49 56 45 44 22 29 29  HECK" "WAIVED"))
3ba0: 29 29 29 0a 09 09 09 09 09 70 72 65 72 65 71 73  )))......prereqs
3bb0: 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a 09 09 20 28  -not-met)))... (
3bc0: 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 74  calc-not-complet
3bd0: 65 64 20 28 6c 61 6d 62 64 61 20 28 70 72 65 72  ed (lambda (prer
3be0: 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09 09  eqs-not-met)....
3bf0: 09 20 20 20 20 20 20 20 28 66 69 6c 74 65 72 0a  .       (filter.
3c00: 09 09 09 09 09 28 6c 61 6d 62 64 61 20 28 74 29  .....(lambda (t)
3c10: 0a 09 09 09 09 09 20 20 28 6f 72 20 28 6e 6f 74  ......  (or (not
3c20: 20 28 76 65 63 74 6f 72 3f 20 74 29 29 0a 09 09   (vector? t))...
3c30: 09 09 09 20 20 20 20 20 20 28 6e 6f 74 20 28 65  ...      (not (e
3c40: 71 75 61 6c 3f 20 22 43 4f 4d 50 4c 45 54 45 44  qual? "COMPLETED
3c50: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73  " (db:test-get-s
3c60: 74 61 74 65 20 74 29 29 29 29 29 0a 09 09 09 09  tate t))))).....
3c70: 09 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74  .prereqs-not-met
3c80: 29 29 29 0a 09 09 20 28 70 72 65 74 74 79 2d 73  )))... (pretty-s
3c90: 74 72 69 6e 67 20 28 6c 61 6d 62 64 61 20 28 6c  tring (lambda (l
3ca0: 73 74 29 0a 09 09 09 09 20 20 28 6d 61 70 20 28  st).....  (map (
3cb0: 6c 61 6d 62 64 61 20 28 74 29 0a 09 09 09 09 09  lambda (t)......
3cc0: 20 28 69 66 20 28 6e 6f 74 20 28 76 65 63 74 6f   (if (not (vecto
3cd0: 72 3f 20 74 29 29 0a 09 09 09 09 09 20 20 20 20  r? t))......    
3ce0: 20 28 63 6f 6e 63 20 74 29 0a 09 09 09 09 09 20   (conc t)...... 
3cf0: 20 20 20 20 28 63 6f 6e 63 20 28 64 62 3a 74 65      (conc (db:te
3d00: 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20  st-get-testname 
3d10: 74 29 20 22 3a 22 20 28 64 62 3a 74 65 73 74 2d  t) ":" (db:test-
3d20: 67 65 74 2d 73 74 61 74 65 20 74 29 20 22 2f 22  get-state t) "/"
3d30: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74   (db:test-get-st
3d40: 61 74 75 73 20 74 29 29 29 29 0a 09 09 09 09 20  atus t))))..... 
3d50: 20 20 20 20 20 20 6c 73 74 29 29 29 29 0a 09 20        lst)))).. 
3d60: 20 20 20 0a 09 20 20 20 20 28 64 65 62 75 67 3a     ..    (debug:
3d70: 70 72 69 6e 74 20 36 0a 09 09 09 20 22 74 65 73  print 6.... "tes
3d80: 74 2d 6e 61 6d 65 3a 20 22 20 74 65 73 74 2d 6e  t-name: " test-n
3d90: 61 6d 65 0a 09 09 09 20 22 5c 6e 20 20 68 65 64  ame.... "\n  hed
3da0: 3a 20 20 20 20 20 20 20 20 20 22 20 68 65 64 0a  :         " hed.
3db0: 09 09 09 20 22 5c 6e 20 20 69 74 65 6d 64 61 74  ... "\n  itemdat
3dc0: 3a 20 20 20 20 20 22 20 69 74 65 6d 64 61 74 0a  :     " itemdat.
3dd0: 09 09 09 20 22 5c 6e 20 20 69 74 65 6d 73 3a 20  ... "\n  items: 
3de0: 20 20 20 20 20 20 22 20 69 74 65 6d 73 0a 09 09        " items...
3df0: 09 20 22 5c 6e 20 20 69 74 65 6d 2d 70 61 74 68  . "\n  item-path
3e00: 3a 20 20 20 22 20 69 74 65 6d 2d 70 61 74 68 0a  :   " item-path.
3e10: 09 09 09 20 22 5c 6e 20 20 77 61 69 74 6f 6e 73  ... "\n  waitons
3e20: 3a 20 20 20 20 20 22 20 77 61 69 74 6f 6e 73 0a  :     " waitons.
3e30: 09 09 09 20 22 5c 6e 20 20 6e 75 6d 2d 72 65 74  ... "\n  num-ret
3e40: 72 69 65 73 3a 20 22 20 6e 75 6d 2d 72 65 74 72  ries: " num-retr
3e50: 69 65 73 29 0a 0a 09 20 20 20 20 3b 3b 20 63 68  ies)...    ;; ch
3e60: 65 63 6b 20 66 6f 72 20 68 65 64 20 69 6e 20 77  eck for hed in w
3e70: 61 69 74 6f 6e 73 20 3d 3e 20 74 68 69 73 20 77  aitons => this w
3e80: 6f 75 6c 64 20 62 65 20 63 69 72 63 75 6c 61 72  ould be circular
3e90: 2c 20 72 65 6d 6f 76 65 20 69 74 20 61 6e 64 20  , remove it and 
3ea0: 69 73 73 75 65 20 61 6e 0a 09 20 20 20 20 3b 3b  issue an..    ;;
3eb0: 20 65 72 72 6f 72 0a 09 20 20 20 20 28 69 66 20   error..    (if 
3ec0: 28 6d 65 6d 62 65 72 20 74 65 73 74 2d 6e 61 6d  (member test-nam
3ed0: 65 20 77 61 69 74 6f 6e 73 29 0a 09 09 28 62 65  e waitons)...(be
3ee0: 67 69 6e 0a 09 09 20 20 28 64 65 62 75 67 3a 70  gin...  (debug:p
3ef0: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 74  rint 0 "ERROR: t
3f00: 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20  est " test-name 
3f10: 22 20 68 61 73 20 6c 69 73 74 65 64 20 69 74 73  " has listed its
3f20: 65 6c 66 20 61 73 20 61 20 77 61 69 74 6f 6e 2c  elf as a waiton,
3f30: 20 70 6c 65 61 73 65 20 63 6f 72 72 65 63 74 20   please correct 
3f40: 74 68 69 73 21 22 29 0a 09 09 20 20 28 73 65 74  this!")...  (set
3f50: 21 20 77 61 69 74 6f 6e 20 28 66 69 6c 74 65 72  ! waiton (filter
3f60: 20 28 6c 61 6d 62 64 61 20 28 78 29 28 6e 6f 74   (lambda (x)(not
3f70: 20 28 65 71 75 61 6c 3f 20 78 20 68 65 64 29 29   (equal? x hed))
3f80: 29 20 77 61 69 74 6f 6e 73 29 29 29 29 0a 0a 09  ) waitons))))...
3f90: 20 20 20 20 28 63 6f 6e 64 0a 09 20 20 20 20 20      (cond..     
3fa0: 28 28 6e 6f 74 20 69 74 65 6d 73 29 20 3b 3b 20  ((not items) ;; 
3fb0: 77 68 65 6e 20 66 61 6c 73 65 20 74 68 65 20 74  when false the t
3fc0: 65 73 74 20 69 73 20 6f 6b 20 74 6f 20 62 65 20  est is ok to be 
3fd0: 68 61 6e 64 65 64 20 6f 66 66 20 74 6f 20 6c 61  handed off to la
3fe0: 75 6e 63 68 20 28 62 75 74 20 6e 6f 74 20 62 65  unch (but not be
3ff0: 66 6f 72 65 29 0a 09 20 20 20 20 20 20 28 6c 65  fore)..      (le
4000: 74 2a 20 28 28 68 61 76 65 2d 72 65 73 6f 75 72  t* ((have-resour
4010: 63 65 73 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63  ces  (open-run-c
4020: 6c 6f 73 65 20 72 75 6e 73 3a 63 61 6e 2d 72 75  lose runs:can-ru
4030: 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 23 66 20  n-more-tests #f 
4040: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 20 3b 3b  test-record)) ;;
4050: 20 6c 6f 6f 6b 20 61 74 20 74 68 65 20 74 65 73   look at the tes
4060: 74 20 6a 6f 62 67 72 6f 75 70 20 61 6e 64 20 74  t jobgroup and t
4070: 6f 74 20 6a 6f 62 73 20 72 75 6e 6e 69 6e 67 0a  ot jobs running.
4080: 09 09 20 20 20 20 20 28 70 72 65 72 65 71 73 2d  ..     (prereqs-
4090: 6e 6f 74 2d 6d 65 74 20 28 6f 70 65 6e 2d 72 75  not-met (open-ru
40a0: 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 70  n-close db:get-p
40b0: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 23  rereqs-not-met #
40c0: 66 20 72 75 6e 2d 69 64 20 77 61 69 74 6f 6e 73  f run-id waitons
40d0: 20 69 74 65 6d 2d 70 61 74 68 20 6d 6f 64 65 3a   item-path mode:
40e0: 20 74 65 73 74 6d 6f 64 65 29 29 0a 09 09 20 20   testmode))...  
40f0: 20 20 20 28 66 61 69 6c 73 20 20 20 20 20 20 20     (fails       
4100: 20 20 20 20 28 63 61 6c 63 2d 66 61 69 6c 73 20      (calc-fails 
4110: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29  prereqs-not-met)
4120: 29 0a 09 09 20 20 20 20 20 28 6e 6f 6e 2d 63 6f  )...     (non-co
4130: 6d 70 6c 65 74 65 64 20 20 20 28 63 61 6c 63 2d  mpleted   (calc-
4140: 6e 6f 74 2d 63 6f 6d 70 6c 65 74 65 64 20 70 72  not-completed pr
4150: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 29  ereqs-not-met)))
4160: 0a 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20  ...(debug:print 
4170: 38 20 22 49 4e 46 4f 3a 20 68 61 76 65 2d 72 65  8 "INFO: have-re
4180: 73 6f 75 72 63 65 73 3a 20 22 20 68 61 76 65 2d  sources: " have-
4190: 72 65 73 6f 75 72 63 65 73 20 22 20 70 72 65 72  resources " prer
41a0: 65 71 73 2d 6e 6f 74 2d 6d 65 74 3a 20 22 20 0a  eqs-not-met: " .
41b0: 09 09 09 20 20 20 20 20 28 73 74 72 69 6e 67 2d  ...     (string-
41c0: 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09 09 09  intersperse ....
41d0: 20 20 20 20 20 20 28 6d 61 70 20 28 6c 61 6d 62        (map (lamb
41e0: 64 61 20 28 74 29 0a 09 09 09 09 20 20 20 20 20  da (t).....     
41f0: 28 69 66 20 28 76 65 63 74 6f 72 3f 20 74 29 0a  (if (vector? t).
4200: 09 09 09 09 09 20 28 63 6f 6e 63 20 28 64 62 3a  ..... (conc (db:
4210: 74 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74  test-get-state t
4220: 29 20 22 2f 22 20 28 64 62 3a 74 65 73 74 2d 67  ) "/" (db:test-g
4230: 65 74 2d 73 74 61 74 75 73 20 74 29 29 0a 09 09  et-status t))...
4240: 09 09 09 20 28 63 6f 6e 63 20 22 20 57 41 52 4e  ... (conc " WARN
4250: 49 4e 47 3a 20 74 20 69 73 20 6e 6f 74 20 61 20  ING: t is not a 
4260: 76 65 63 74 6f 72 3d 22 20 74 20 29 29 29 0a 09  vector=" t )))..
4270: 09 09 09 20 20 20 70 72 65 72 65 71 73 2d 6e 6f  ...   prereqs-no
4280: 74 2d 6d 65 74 29 20 22 2c 20 22 29 20 22 20 66  t-met) ", ") " f
4290: 61 69 6c 73 3a 20 22 20 66 61 69 6c 73 29 0a 09  ails: " fails)..
42a0: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20  .(debug:print 4 
42b0: 22 49 4e 46 4f 3a 20 68 65 64 3d 22 20 68 65 64  "INFO: hed=" hed
42c0: 29 0a 09 09 3b 3b 20 44 6f 6e 27 74 20 6b 6e 6f  )...;; Don't kno
42d0: 77 20 61 74 20 74 68 69 73 20 74 69 6d 65 20 69  w at this time i
42e0: 66 20 74 68 65 20 74 65 73 74 20 68 61 76 65 20  f the test have 
42f0: 62 65 65 6e 20 6c 61 75 6e 63 68 65 64 20 61 74  been launched at
4300: 20 73 6f 6d 65 20 74 69 6d 65 20 69 6e 20 74 68   some time in th
4310: 65 20 70 61 73 74 0a 09 09 3b 3b 20 69 2e 65 2e  e past...;; i.e.
4320: 20 69 73 20 74 68 69 73 20 61 20 72 65 2d 6c 61   is this a re-la
4330: 75 6e 63 68 3f 0a 09 09 28 63 6f 6e 64 0a 09 09  unch?...(cond...
4340: 20 28 28 6e 6f 74 20 28 70 61 74 74 2d 6c 69 73   ((not (patt-lis
4350: 74 2d 6d 61 74 63 68 20 69 74 65 6d 2d 70 61 74  t-match item-pat
4360: 68 20 69 74 65 6d 2d 70 61 74 74 73 29 29 0a 09  h item-patts))..
4370: 09 20 20 3b 3b 20 65 6c 73 65 20 74 68 65 20 72  .  ;; else the r
4380: 75 6e 20 69 73 20 73 74 75 63 6b 2c 20 74 65 6d  un is stuck, tem
4390: 70 6f 72 61 72 69 6c 79 20 6f 72 20 70 65 72 6d  porarily or perm
43a0: 61 6e 65 6e 74 6c 79 0a 09 09 20 20 3b 3b 20 62  anently...  ;; b
43b0: 75 74 20 73 68 6f 75 6c 64 20 63 68 65 63 6b 20  ut should check 
43c0: 69 66 20 69 74 20 69 73 20 64 75 65 20 74 6f 20  if it is due to 
43d0: 6c 61 63 6b 20 6f 66 20 72 65 73 6f 75 72 63 65  lack of resource
43e0: 73 20 76 73 2e 20 70 72 65 72 65 71 75 69 73 69  s vs. prerequisi
43f0: 74 65 73 0a 09 09 20 20 28 64 65 62 75 67 3a 70  tes...  (debug:p
4400: 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 53 6b  rint 1 "INFO: Sk
4410: 69 70 70 69 6e 67 20 22 20 28 74 65 73 74 73 3a  ipping " (tests:
4420: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65  testqueue-get-te
4430: 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f  stname test-reco
4440: 72 64 29 20 22 20 22 20 69 74 65 6d 2d 70 61 74  rd) " " item-pat
4450: 68 20 22 20 61 73 20 69 74 20 64 6f 65 73 6e 27  h " as it doesn'
4460: 74 20 6d 61 74 63 68 20 22 20 69 74 65 6d 2d 70  t match " item-p
4470: 61 74 74 73 29 0a 09 09 20 20 28 69 66 20 28 6e  atts)...  (if (n
4480: 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a  ot (null? tal)).
4490: 09 09 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63  ..      (loop (c
44a0: 61 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29  ar tal)(cdr tal)
44b0: 20 72 65 72 75 6e 73 29 29 29 0a 09 09 20 28 28   reruns)))... ((
44c0: 6e 6f 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d  not (hash-table-
44d0: 72 65 66 2f 64 65 66 61 75 6c 74 20 74 65 73 74  ref/default test
44e0: 2d 72 65 67 69 73 74 65 72 79 20 28 63 6f 6e 63  -registery (conc
44f0: 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69   test-name "/" i
4500: 74 65 6d 2d 70 61 74 68 29 20 23 66 29 29 0a 09  tem-path) #f))..
4510: 09 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f  .  (open-run-clo
4520: 73 65 20 64 62 3a 74 65 73 74 73 2d 72 65 67 69  se db:tests-regi
4530: 73 74 65 72 2d 74 65 73 74 20 23 66 20 72 75 6e  ster-test #f run
4540: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74  -id test-name it
4550: 65 6d 2d 70 61 74 68 29 0a 09 09 20 20 28 68 61  em-path)...  (ha
4560: 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 65  sh-table-set! te
4570: 73 74 2d 72 65 67 69 73 74 65 72 79 20 28 63 6f  st-registery (co
4580: 6e 63 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22  nc test-name "/"
4590: 20 69 74 65 6d 2d 70 61 74 68 29 20 23 74 29 0a   item-path) #t).
45a0: 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e  ..  (loop (car n
45b0: 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61  ewtal)(cdr newta
45c0: 6c 29 20 72 65 72 75 6e 73 29 29 0a 09 09 20 28  l) reruns))... (
45d0: 28 6e 6f 74 20 68 61 76 65 2d 72 65 73 6f 75 72  (not have-resour
45e0: 63 65 73 29 20 3b 3b 20 73 69 6d 70 6c 79 20 74  ces) ;; simply t
45f0: 72 79 20 61 67 61 69 6e 20 61 66 74 65 72 20 77  ry again after w
4600: 61 69 74 69 6e 67 20 61 20 73 65 63 6f 6e 64 0a  aiting a second.
4610: 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65  ..  (thread-slee
4620: 70 21 20 28 2b 20 31 20 2a 67 6c 6f 62 61 6c 2d  p! (+ 1 *global-
4630: 64 65 6c 74 61 2a 29 29 0a 09 09 20 20 28 64 65  delta*))...  (de
4640: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e 46  bug:print 1 "INF
4650: 4f 3a 20 6e 6f 20 72 65 73 6f 75 72 63 65 73 20  O: no resources 
4660: 74 6f 20 72 75 6e 20 6e 65 77 20 74 65 73 74 73  to run new tests
4670: 2c 20 77 61 69 74 69 6e 67 20 2e 2e 2e 22 29 0a  , waiting ...").
4680: 09 09 20 20 3b 3b 20 63 6f 75 6c 64 20 68 61 76  ..  ;; could hav
4690: 65 20 64 6f 6e 65 20 68 65 64 20 74 61 6c 20 68  e done hed tal h
46a0: 65 72 65 20 62 75 74 20 64 6f 69 6e 67 20 63 61  ere but doing ca
46b0: 72 2f 63 64 72 20 6f 66 20 6e 65 77 74 61 6c 20  r/cdr of newtal 
46c0: 74 6f 20 72 6f 74 61 74 65 20 74 65 73 74 73 0a  to rotate tests.
46d0: 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e  ..  (loop (car n
46e0: 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61  ewtal)(cdr newta
46f0: 6c 29 20 72 65 72 75 6e 73 29 29 0a 09 09 20 28  l) reruns))... (
4700: 28 61 6e 64 20 68 61 76 65 2d 72 65 73 6f 75 72  (and have-resour
4710: 63 65 73 0a 09 09 20 20 20 20 20 20 20 28 6f 72  ces...       (or
4720: 20 28 6e 75 6c 6c 3f 20 70 72 65 72 65 71 73 2d   (null? prereqs-
4730: 6e 6f 74 2d 6d 65 74 29 0a 09 09 09 20 20 20 28  not-met)....   (
4740: 61 6e 64 20 28 65 71 3f 20 74 65 73 74 6d 6f 64  and (eq? testmod
4750: 65 20 27 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09  e 'toplevel)....
4760: 09 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70  .(null? non-comp
4770: 6c 65 74 65 64 29 29 29 29 0a 09 09 20 20 3b 3b  leted))))...  ;;
4780: 20 6e 6f 20 6c 6f 6f 70 20 68 65 72 65 2c 20 6a   no loop here, j
4790: 75 73 74 20 64 72 6f 70 20 74 68 6f 75 67 68 20  ust drop though 
47a0: 61 6e 64 20 75 73 65 20 74 68 65 20 6c 6f 6f 70  and use the loop
47b0: 20 61 74 20 74 68 65 20 62 6f 74 74 6f 6d 20 0a   at the bottom .
47c0: 09 09 20 20 28 72 75 6e 3a 74 65 73 74 20 72 75  ..  (run:test ru
47d0: 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 6b 65 79  n-id runname key
47e0: 76 61 6c 6c 73 74 20 74 65 73 74 2d 72 65 63 6f  vallst test-reco
47f0: 72 64 20 66 6c 61 67 73 20 23 66 29 29 0a 09 09  rd flags #f))...
4800: 20 28 65 6c 73 65 20 3b 3b 20 6d 75 73 74 20 62   (else ;; must b
4810: 65 20 77 65 20 68 61 76 65 20 75 6e 6d 65 74 20  e we have unmet 
4820: 70 72 65 72 65 71 75 69 73 69 74 65 73 0a 09 09  prerequisites...
4830: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74      (debug:print
4840: 20 34 20 22 46 41 49 4c 53 3a 20 22 20 66 61 69   4 "FAILS: " fai
4850: 6c 73 29 0a 09 09 20 20 20 20 3b 3b 20 49 66 20  ls)...    ;; If 
4860: 6f 6e 65 20 6f 72 20 6d 6f 72 65 20 6f 66 20 74  one or more of t
4870: 68 65 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d  he prereqs-not-m
4880: 65 74 20 61 72 65 20 46 41 49 4c 20 74 68 65 6e  et are FAIL then
4890: 20 77 65 20 63 61 6e 20 69 73 73 75 65 0a 09 09   we can issue...
48a0: 20 20 20 20 3b 3b 20 61 20 6d 65 73 73 61 67 65      ;; a message
48b0: 20 61 6e 64 20 64 72 6f 70 20 68 65 64 20 66 72   and drop hed fr
48c0: 6f 6d 20 74 68 65 20 69 74 65 6d 73 20 74 6f 20  om the items to 
48d0: 62 65 20 70 72 6f 63 65 73 73 65 64 2e 0a 09 09  be processed....
48e0: 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 66      (if (null? f
48f0: 61 69 6c 73 29 0a 09 09 09 28 62 65 67 69 6e 0a  ails)....(begin.
4900: 09 09 09 20 20 3b 3b 20 63 6f 75 6c 64 6e 27 74  ...  ;; couldn't
4910: 20 72 75 6e 2c 20 74 61 6b 65 20 61 20 62 72 65   run, take a bre
4920: 61 74 68 65 72 0a 09 09 09 20 20 28 64 65 62 75  ather....  (debu
4930: 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a  g:print 4 "INFO:
4940: 20 53 68 6f 75 6c 64 6e 27 74 20 72 65 61 6c 6c   Shouldn't reall
4950: 79 20 67 65 74 20 68 65 72 65 2c 20 72 61 63 65  y get here, race
4960: 20 63 6f 6e 64 69 74 69 6f 6e 3f 20 55 6e 61 62   condition? Unab
4970: 6c 65 20 74 6f 20 6c 61 75 6e 63 68 20 6d 6f 72  le to launch mor
4980: 65 20 74 65 73 74 73 20 61 74 20 74 68 69 73 20  e tests at this 
4990: 6d 6f 6d 65 6e 74 2c 20 6b 69 6c 6c 69 6e 67 20  moment, killing 
49a0: 74 69 6d 65 20 2e 2e 2e 22 29 0a 09 09 09 20 20  time ...")....  
49b0: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28  (thread-sleep! (
49c0: 2b 20 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74  + 1 *global-delt
49d0: 61 2a 29 29 20 3b 3b 20 6c 6f 6e 67 20 73 6c 65  a*)) ;; long sle
49e0: 65 70 20 68 65 72 65 20 2d 20 6e 6f 20 72 65 73  ep here - no res
49f0: 6f 75 72 63 65 73 2c 20 6d 61 79 20 61 73 20 77  ources, may as w
4a00: 65 6c 6c 20 62 65 20 70 61 74 69 65 6e 74 0a 09  ell be patient..
4a10: 09 09 20 20 3b 3b 20 77 65 20 6d 61 64 65 20 6e  ..  ;; we made n
4a20: 65 77 20 74 61 6c 20 62 79 20 73 74 69 63 6b 69  ew tal by sticki
4a30: 6e 67 20 68 65 64 20 61 74 20 74 68 65 20 62 61  ng hed at the ba
4a40: 63 6b 20 6f 66 20 74 68 65 20 6c 69 73 74 0a 09  ck of the list..
4a50: 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e  ..  (loop (car n
4a60: 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61  ewtal)(cdr newta
4a70: 6c 29 20 72 65 72 75 6e 73 29 29 0a 09 09 09 3b  l) reruns))....;
4a80: 3b 20 74 68 65 20 77 61 69 74 6f 6e 20 69 73 20  ; the waiton is 
4a90: 46 41 49 4c 20 73 6f 20 6e 6f 20 70 6f 69 6e 74  FAIL so no point
4aa0: 20 69 6e 20 74 72 79 69 6e 67 20 74 6f 20 72 75   in trying to ru
4ab0: 6e 20 68 65 64 20 65 76 65 72 20 61 67 61 69 6e  n hed ever again
4ac0: 0a 09 09 09 28 69 66 20 28 6e 6f 74 20 28 6e 75  ....(if (not (nu
4ad0: 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 09 20 20 20  ll? tal))....   
4ae0: 20 28 69 66 20 28 76 65 63 74 6f 72 3f 20 68 65   (if (vector? he
4af0: 64 29 0a 09 09 09 09 28 62 65 67 69 6e 20 28 64  d).....(begin (d
4b00: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 57 41  ebug:print 1 "WA
4b10: 52 4e 3a 20 44 72 6f 70 70 69 6e 67 20 74 65 73  RN: Dropping tes
4b20: 74 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74  t " (db:test-get
4b30: 2d 74 65 73 74 6e 61 6d 65 20 68 65 64 29 20 22  -testname hed) "
4b40: 2f 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  /" (db:test-get-
4b50: 69 74 65 6d 2d 70 61 74 68 20 68 65 64 29 0a 09  item-path hed)..
4b60: 09 09 09 09 09 20 20 20 20 22 20 66 72 6f 6d 20  .....    " from 
4b70: 74 68 65 20 6c 61 75 6e 63 68 20 6c 69 73 74 20  the launch list 
4b80: 61 73 20 69 74 20 68 61 73 20 70 72 65 72 65 71  as it has prereq
4b90: 75 69 73 74 65 73 20 74 68 61 74 20 61 72 65 20  uistes that are 
4ba0: 46 41 49 4c 22 29 0a 09 09 09 09 20 20 20 20 20  FAIL").....     
4bb0: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c    (loop (car tal
4bc0: 29 28 63 64 72 20 74 61 6c 29 20 28 63 6f 6e 73  )(cdr tal) (cons
4bd0: 20 68 65 64 20 72 65 72 75 6e 73 29 29 29 0a 09   hed reruns)))..
4be0: 09 09 09 28 62 65 67 69 6e 0a 09 09 09 09 20 20  ...(begin.....  
4bf0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22  (debug:print 1 "
4c00: 57 41 52 4e 3a 20 54 65 73 74 20 6e 6f 74 20 70  WARN: Test not p
4c10: 72 6f 63 65 73 73 65 64 20 63 6f 72 72 65 63 74  rocessed correct
4c20: 6c 79 2e 20 43 6f 75 6c 64 20 62 65 20 61 20 72  ly. Could be a r
4c30: 61 63 65 20 63 6f 6e 64 69 74 69 6f 6e 20 69 6e  ace condition in
4c40: 20 79 6f 75 72 20 74 65 73 74 20 69 6d 70 6c 65   your test imple
4c50: 6d 65 6e 74 61 74 69 6f 6e 3f 20 22 20 68 65 64  mentation? " hed
4c60: 29 20 3b 3b 20 20 22 20 61 73 20 69 74 20 68 61  ) ;;  " as it ha
4c70: 73 20 70 72 65 72 65 71 75 69 73 74 65 73 20 74  s prerequistes t
4c80: 68 61 74 20 61 72 65 20 46 41 49 4c 2e 20 28 4e  hat are FAIL. (N
4c90: 4f 54 45 3a 20 68 65 64 20 69 73 20 6e 6f 74 20  OTE: hed is not 
4ca0: 61 20 76 65 63 74 6f 72 29 22 29 0a 09 09 09 09  a vector)").....
4cb0: 20 20 28 6c 6f 6f 70 20 68 65 64 20 74 61 6c 20    (loop hed tal 
4cc0: 72 65 72 75 6e 73 29 29 29 29 29 29 29 29 29 0a  reruns))))))))).
4cd0: 09 20 20 20 20 20 0a 09 20 20 20 20 20 3b 3b 20  .     ..     ;; 
4ce0: 63 61 73 65 20 77 68 65 72 65 20 61 6e 20 69 74  case where an it
4cf0: 65 6d 73 20 63 61 6d 65 20 69 6e 20 61 73 20 61  ems came in as a
4d00: 20 6c 69 73 74 20 62 65 65 6e 20 70 72 6f 63 65   list been proce
4d10: 73 73 65 64 0a 09 20 20 20 20 20 28 28 61 6e 64  ssed..     ((and
4d20: 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 20   (list? items)  
4d30: 20 20 20 3b 3b 20 74 68 75 73 20 77 65 20 6b 6e     ;; thus we kn
4d40: 6f 77 20 6f 75 72 20 69 74 65 6d 73 20 61 72 65  ow our items are
4d50: 20 61 6c 72 65 61 64 79 20 63 61 6c 63 75 6c 61   already calcula
4d60: 74 65 64 0a 09 09 20 20 20 28 6e 6f 74 20 20 20  ted...   (not   
4d70: 69 74 65 6d 64 61 74 29 29 20 3b 3b 20 61 6e 64  itemdat)) ;; and
4d80: 20 6e 6f 74 20 79 65 74 20 65 78 70 61 6e 64 65   not yet expande
4d90: 64 20 69 6e 74 6f 20 74 68 65 20 6c 69 73 74 20  d into the list 
4da0: 6f 66 20 74 68 69 6e 67 73 20 74 6f 20 62 65 20  of things to be 
4db0: 64 6f 6e 65 0a 09 20 20 20 20 20 20 28 69 66 20  done..      (if 
4dc0: 28 61 6e 64 20 28 3e 3d 20 2a 76 65 72 62 6f 73  (and (>= *verbos
4dd0: 69 74 79 2a 20 31 29 0a 09 09 20 20 20 20 20 20  ity* 1)...      
4de0: 20 28 3e 20 28 6c 65 6e 67 74 68 20 69 74 65 6d   (> (length item
4df0: 73 29 20 30 29 0a 09 09 20 20 20 20 20 20 20 28  s) 0)...       (
4e00: 3e 20 28 6c 65 6e 67 74 68 20 28 63 61 72 20 69  > (length (car i
4e10: 74 65 6d 73 29 29 20 30 29 29 0a 09 09 20 20 28  tems)) 0))...  (
4e20: 70 70 20 69 74 65 6d 73 29 29 0a 09 20 20 20 20  pp items))..    
4e30: 20 20 3b 3b 20 28 69 66 20 28 3e 3d 20 2a 76 65    ;; (if (>= *ve
4e40: 72 62 6f 73 69 74 79 2a 20 35 29 0a 09 20 20 20  rbosity* 5)..   
4e50: 20 20 20 3b 3b 20 20 20 20 20 28 62 65 67 69 6e     ;;     (begin
4e60: 0a 09 20 20 20 20 20 20 3b 3b 20 20 20 20 20 20  ..      ;;      
4e70: 20 28 70 72 69 6e 74 20 22 69 74 65 6d 73 3a 20   (print "items: 
4e80: 22 29 20 20 20 20 20 28 70 70 20 28 69 74 65 6d  ")     (pp (item
4e90: 2d 61 73 73 6f 63 2d 3e 69 74 65 6d 2d 6c 69 73  -assoc->item-lis
4ea0: 74 20 69 74 65 6d 73 29 29 0a 09 20 20 20 20 20  t items))..     
4eb0: 20 3b 3b 20 20 20 20 20 20 20 28 70 72 69 6e 74   ;;       (print
4ec0: 20 22 69 74 65 6d 73 74 61 62 6c 65 3a 20 22 29   "itemstable: ")
4ed0: 28 70 70 20 28 69 74 65 6d 2d 74 61 62 6c 65 2d  (pp (item-table-
4ee0: 3e 69 74 65 6d 2d 6c 69 73 74 20 69 74 65 6d 73  >item-list items
4ef0: 74 61 62 6c 65 29 29 29 29 0a 09 20 20 20 20 20  table))))..     
4f00: 20 28 66 6f 72 2d 65 61 63 68 0a 09 20 20 20 20   (for-each..    
4f10: 20 20 20 28 6c 61 6d 62 64 61 20 28 6d 79 2d 69     (lambda (my-i
4f20: 74 65 6d 64 61 74 29 0a 09 09 20 28 6c 65 74 2a  temdat)... (let*
4f30: 20 28 28 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f   ((new-test-reco
4f40: 72 64 20 28 6c 65 74 20 28 28 6e 65 77 72 65 63  rd (let ((newrec
4f50: 20 28 6d 61 6b 65 2d 74 65 73 74 73 3a 74 65 73   (make-tests:tes
4f60: 74 71 75 65 75 65 29 29 29 0a 09 09 09 09 09 20  tqueue)))...... 
4f70: 20 20 28 76 65 63 74 6f 72 2d 63 6f 70 79 21 20    (vector-copy! 
4f80: 74 65 73 74 2d 72 65 63 6f 72 64 20 6e 65 77 72  test-record newr
4f90: 65 63 29 0a 09 09 09 09 09 20 20 20 6e 65 77 72  ec)......   newr
4fa0: 65 63 29 29 0a 09 09 09 28 6d 79 2d 69 74 65 6d  ec))....(my-item
4fb0: 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74  -path (item-list
4fc0: 2d 3e 70 61 74 68 20 6d 79 2d 69 74 65 6d 64 61  ->path my-itemda
4fd0: 74 29 29 29 0a 09 09 20 20 20 28 69 66 20 28 70  t)))...   (if (p
4fe0: 61 74 74 2d 6c 69 73 74 2d 6d 61 74 63 68 20 6d  att-list-match m
4ff0: 79 2d 69 74 65 6d 2d 70 61 74 68 20 69 74 65 6d  y-item-path item
5000: 2d 70 61 74 74 73 29 20 20 20 20 20 20 20 20 20  -patts)         
5010: 20 20 3b 3b 20 79 65 73 2c 20 77 65 20 77 61 6e    ;; yes, we wan
5020: 74 20 74 6f 20 70 72 6f 63 65 73 73 20 74 68 69  t to process thi
5030: 73 20 69 74 65 6d 2c 20 4e 4f 54 45 3a 20 53 68  s item, NOTE: Sh
5040: 6f 75 6c 64 20 6e 6f 74 20 6e 65 65 64 20 74 68  ould not need th
5050: 69 73 20 63 68 65 63 6b 20 68 65 72 65 21 0a 09  is check here!..
5060: 09 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 6e  .       (let ((n
5070: 65 77 74 65 73 74 6e 61 6d 65 20 28 63 6f 6e 63  ewtestname (conc
5080: 20 68 65 64 20 22 2f 22 20 6d 79 2d 69 74 65 6d   hed "/" my-item
5090: 2d 70 61 74 68 29 29 29 20 20 20 20 3b 3b 20 74  -path)))    ;; t
50a0: 65 73 74 20 6e 61 6d 65 73 20 61 72 65 20 75 6e  est names are un
50b0: 69 71 75 65 20 6f 6e 20 74 65 73 74 6e 61 6d 65  ique on testname
50c0: 2f 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 20 28  /item-path.... (
50d0: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
50e0: 73 65 74 2d 69 74 65 6d 73 21 20 20 20 20 20 6e  set-items!     n
50f0: 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 23  ew-test-record #
5100: 66 29 0a 09 09 09 20 28 74 65 73 74 73 3a 74 65  f).... (tests:te
5110: 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d  stqueue-set-item
5120: 64 61 74 21 20 20 20 6e 65 77 2d 74 65 73 74 2d  dat!   new-test-
5130: 72 65 63 6f 72 64 20 6d 79 2d 69 74 65 6d 64 61  record my-itemda
5140: 74 29 0a 09 09 09 20 28 74 65 73 74 73 3a 74 65  t).... (tests:te
5150: 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d  stqueue-set-item
5160: 5f 70 61 74 68 21 20 6e 65 77 2d 74 65 73 74 2d  _path! new-test-
5170: 72 65 63 6f 72 64 20 6d 79 2d 69 74 65 6d 2d 70  record my-item-p
5180: 61 74 68 29 0a 09 09 09 20 28 68 61 73 68 2d 74  ath).... (hash-t
5190: 61 62 6c 65 2d 73 65 74 21 20 74 65 73 74 2d 72  able-set! test-r
51a0: 65 63 6f 72 64 73 20 6e 65 77 74 65 73 74 6e 61  ecords newtestna
51b0: 6d 65 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f  me new-test-reco
51c0: 72 64 29 0a 09 09 09 20 28 73 65 74 21 20 74 61  rd).... (set! ta
51d0: 6c 20 28 63 6f 6e 73 20 6e 65 77 74 65 73 74 6e  l (cons newtestn
51e0: 61 6d 65 20 74 61 6c 29 29 29 29 29 29 20 3b 3b  ame tal)))))) ;;
51f0: 20 73 69 6e 63 65 20 74 68 65 73 65 20 61 72 65   since these are
5200: 20 69 74 65 6d 69 7a 65 64 20 63 72 65 61 74 65   itemized create
5210: 20 6e 65 77 20 74 65 73 74 20 6e 61 6d 65 73 20   new test names 
5220: 74 65 73 74 6e 61 6d 65 2f 69 74 65 6d 70 61 74  testname/itempat
5230: 68 0a 09 20 20 20 20 20 20 20 69 74 65 6d 73 29  h..       items)
5240: 0a 09 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74  ..      (if (not
5250: 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09   (null? tal))...
5260: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c    (loop (car tal
5270: 29 28 63 64 72 20 74 61 6c 29 20 72 65 72 75 6e  )(cdr tal) rerun
5280: 73 29 29 29 0a 0a 09 20 20 20 20 20 3b 3b 20 69  s)))...     ;; i
5290: 66 20 69 74 65 6d 73 20 69 73 20 61 20 70 72 6f  f items is a pro
52a0: 63 20 74 68 65 6e 20 6e 65 65 64 20 74 6f 20 72  c then need to r
52b0: 75 6e 20 69 74 65 6d 73 3a 67 65 74 2d 69 74 65  un items:get-ite
52c0: 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 2c 20  ms-from-config, 
52d0: 67 65 74 20 74 68 65 20 6c 69 73 74 20 61 6e 64  get the list and
52e0: 20 6c 6f 6f 70 20 0a 09 20 20 20 20 20 3b 3b 20   loop ..     ;; 
52f0: 20 20 20 2d 20 62 75 74 20 6f 6e 6c 79 20 64 6f     - but only do
5300: 20 74 68 61 74 20 69 66 20 72 65 73 6f 75 72 63   that if resourc
5310: 65 73 20 65 78 69 73 74 20 74 6f 20 6b 69 63 6b  es exist to kick
5320: 20 6f 66 66 20 74 68 65 20 6a 6f 62 0a 09 20 20   off the job..  
5330: 20 20 20 28 28 6f 72 20 28 70 72 6f 63 65 64 75     ((or (procedu
5340: 72 65 3f 20 69 74 65 6d 73 29 28 65 71 3f 20 69  re? items)(eq? i
5350: 74 65 6d 73 20 27 68 61 76 65 2d 70 72 6f 63 65  tems 'have-proce
5360: 64 75 72 65 29 29 0a 09 20 20 20 20 20 20 28 6c  dure))..      (l
5370: 65 74 20 28 28 63 61 6e 2d 72 75 6e 2d 6d 6f 72  et ((can-run-mor
5380: 65 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63  e    (open-run-c
5390: 6c 6f 73 65 20 72 75 6e 73 3a 63 61 6e 2d 72 75  lose runs:can-ru
53a0: 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 23 66 20  n-more-tests #f 
53b0: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 29 0a 09  test-record)))..
53c0: 09 28 69 66 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72  .(if can-run-mor
53d0: 65 0a 09 09 20 20 20 20 28 6c 65 74 2a 20 28 28  e...    (let* ((
53e0: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20  prereqs-not-met 
53f0: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
5400: 64 62 3a 67 65 74 2d 70 72 65 72 65 71 73 2d 6e  db:get-prereqs-n
5410: 6f 74 2d 6d 65 74 20 23 66 20 72 75 6e 2d 69 64  ot-met #f run-id
5420: 20 77 61 69 74 6f 6e 73 20 69 74 65 6d 2d 70 61   waitons item-pa
5430: 74 68 20 6d 6f 64 65 3a 20 74 65 73 74 6d 6f 64  th mode: testmod
5440: 65 29 29 0a 09 09 09 20 20 20 28 66 61 69 6c 73  e))....   (fails
5450: 20 20 20 20 20 20 20 20 20 20 20 28 63 61 6c 63             (calc
5460: 2d 66 61 69 6c 73 20 70 72 65 72 65 71 73 2d 6e  -fails prereqs-n
5470: 6f 74 2d 6d 65 74 29 29 0a 09 09 09 20 20 20 28  ot-met))....   (
5480: 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 20 20 20  non-completed   
5490: 28 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65  (calc-not-comple
54a0: 74 65 64 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d  ted prereqs-not-
54b0: 6d 65 74 29 29 29 0a 09 09 20 20 20 20 20 20 28  met)))...      (
54c0: 64 65 62 75 67 3a 70 72 69 6e 74 20 38 20 22 49  debug:print 8 "I
54d0: 4e 46 4f 3a 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72  NFO: can-run-mor
54e0: 65 3a 20 22 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72  e: " can-run-mor
54f0: 65 0a 09 09 09 09 20 20 20 22 5c 6e 20 74 65 73  e.....   "\n tes
5500: 74 6e 61 6d 65 3a 20 20 20 20 20 20 20 20 22 20  tname:        " 
5510: 68 65 64 0a 09 09 09 09 20 20 20 22 5c 6e 20 70  hed.....   "\n p
5520: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 3a 20  rereqs-not-met: 
5530: 22 20 28 70 72 65 74 74 79 2d 73 74 72 69 6e 67  " (pretty-string
5540: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74   prereqs-not-met
5550: 29 0a 09 09 09 09 20 20 20 22 5c 6e 20 6e 6f 6e  ).....   "\n non
5560: 2d 63 6f 6d 70 6c 65 74 65 64 3a 20 20 20 22 20  -completed:   " 
5570: 28 70 72 65 74 74 79 2d 73 74 72 69 6e 67 20 6e  (pretty-string n
5580: 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 20 0a 09  on-completed) ..
5590: 09 09 09 20 20 20 22 5c 6e 20 66 61 69 6c 73 3a  ...   "\n fails:
55a0: 20 20 20 20 20 20 20 20 20 20 20 22 20 28 70 72             " (pr
55b0: 65 74 74 79 2d 73 74 72 69 6e 67 20 66 61 69 6c  etty-string fail
55c0: 73 29 0a 09 09 09 09 20 20 20 22 5c 6e 20 74 65  s).....   "\n te
55d0: 73 74 6d 6f 64 65 3a 20 20 20 20 20 20 20 20 22  stmode:        "
55e0: 20 74 65 73 74 6d 6f 64 65 0a 09 09 09 09 20 20   testmode.....  
55f0: 20 22 5c 6e 20 6e 75 6d 2d 72 65 74 72 69 65 73   "\n num-retries
5600: 3a 20 20 20 20 20 22 20 6e 75 6d 2d 72 65 74 72  :     " num-retr
5610: 69 65 73 0a 09 09 09 09 20 20 20 22 5c 6e 20 28  ies.....   "\n (
5620: 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 74 6f  eq? testmode 'to
5630: 70 6c 65 76 65 6c 29 3a 20 22 20 28 65 71 3f 20  plevel): " (eq? 
5640: 74 65 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76  testmode 'toplev
5650: 65 6c 29 0a 09 09 09 09 20 20 20 22 5c 6e 20 28  el).....   "\n (
5660: 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65  null? non-comple
5670: 74 65 64 29 3a 20 20 20 20 22 20 28 6e 75 6c 6c  ted):    " (null
5680: 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29  ? non-completed)
5690: 0a 09 09 09 09 20 20 20 22 5c 6e 20 72 65 72 75  .....   "\n reru
56a0: 6e 73 3a 20 22 20 72 65 72 75 6e 73 29 0a 09 09  ns: " reruns)...
56b0: 20 20 20 20 20 20 28 63 6f 6e 64 20 0a 09 09 20        (cond ... 
56c0: 20 20 20 20 20 20 28 28 6f 72 20 28 6e 75 6c 6c        ((or (null
56d0: 3f 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65  ? prereqs-not-me
56e0: 74 29 20 3b 3b 20 61 6c 6c 20 70 72 65 72 65 71  t) ;; all prereq
56f0: 73 20 6d 65 74 2c 20 66 69 72 65 20 6f 66 66 20  s met, fire off 
5700: 74 68 65 20 74 65 73 74 0a 09 09 09 20 20 20 20  the test....    
5710: 3b 3b 20 6f 72 2c 20 69 66 20 69 74 20 69 73 20  ;; or, if it is 
5720: 61 20 27 74 6f 70 6c 65 76 65 6c 20 74 65 73 74  a 'toplevel test
5730: 20 61 6e 64 20 61 6c 6c 20 70 72 65 72 65 71 73   and all prereqs
5740: 20 6e 6f 74 20 6d 65 74 20 61 72 65 20 43 4f 4d   not met are COM
5750: 50 4c 45 54 45 44 20 74 68 65 6e 20 6c 61 75 6e  PLETED then laun
5760: 63 68 0a 09 09 09 20 20 20 20 28 61 6e 64 20 28  ch....    (and (
5770: 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 74 6f  eq? testmode 'to
5780: 70 6c 65 76 65 6c 29 0a 09 09 09 09 20 28 6e 75  plevel)..... (nu
5790: 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65  ll? non-complete
57a0: 64 29 29 29 0a 09 09 09 28 6c 65 74 20 28 28 74  d)))....(let ((t
57b0: 65 73 74 2d 6e 61 6d 65 20 28 74 65 73 74 73 3a  est-name (tests:
57c0: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65  testqueue-get-te
57d0: 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f  stname test-reco
57e0: 72 64 29 29 29 0a 09 09 09 20 20 28 73 65 74 65  rd)))....  (sete
57f0: 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d 45  nv "MT_TEST_NAME
5800: 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b 20  " test-name) ;; 
5810: 0a 09 09 09 20 20 28 73 65 74 65 6e 76 20 22 4d  ....  (setenv "M
5820: 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20 72 75 6e  T_RUNNAME"   run
5830: 6e 61 6d 65 29 0a 09 09 09 20 20 28 6f 70 65 6e  name)....  (open
5840: 2d 72 75 6e 2d 63 6c 6f 73 65 20 73 65 74 2d 6d  -run-close set-m
5850: 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73  egatest-env-vars
5860: 20 23 66 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74   #f run-id) ;; t
5870: 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64  hese may be need
5880: 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68  ed by the launch
5890: 69 6e 67 20 70 72 6f 63 65 73 73 0a 09 09 09 20  ing process.... 
58a0: 20 28 6c 65 74 20 28 28 69 74 65 6d 73 2d 6c 69   (let ((items-li
58b0: 73 74 20 28 69 74 65 6d 73 3a 67 65 74 2d 69 74  st (items:get-it
58c0: 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20  ems-from-config 
58d0: 74 63 6f 6e 66 69 67 29 29 29 0a 09 09 09 20 20  tconfig)))....  
58e0: 20 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74 65    (if (list? ite
58f0: 6d 73 2d 6c 69 73 74 29 0a 09 09 09 09 28 62 65  ms-list).....(be
5900: 67 69 6e 0a 09 09 09 09 20 20 28 74 65 73 74 73  gin.....  (tests
5910: 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69  :testqueue-set-i
5920: 74 65 6d 73 21 20 74 65 73 74 2d 72 65 63 6f 72  tems! test-recor
5930: 64 20 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09 09  d items-list)...
5940: 09 09 20 20 28 6c 6f 6f 70 20 68 65 64 20 74 61  ..  (loop hed ta
5950: 6c 20 72 65 72 75 6e 73 29 29 0a 09 09 09 09 28  l reruns)).....(
5960: 62 65 67 69 6e 0a 09 09 09 09 20 20 28 64 65 62  begin.....  (deb
5970: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f  ug:print 0 "ERRO
5980: 52 3a 20 54 68 65 20 70 72 6f 63 20 66 72 6f 6d  R: The proc from
5990: 20 72 65 61 64 69 6e 67 20 74 68 65 20 73 65 74   reading the set
59a0: 75 70 20 64 69 64 20 6e 6f 74 20 79 69 65 6c 64  up did not yield
59b0: 20 61 20 6c 69 73 74 20 2d 20 70 6c 65 61 73 65   a list - please
59c0: 20 72 65 70 6f 72 74 20 74 68 69 73 22 29 0a 09   report this")..
59d0: 09 09 09 20 20 28 65 78 69 74 20 31 29 29 29 29  ...  (exit 1))))
59e0: 29 29 0a 09 09 20 20 20 20 20 20 20 28 28 6e 75  ))...       ((nu
59f0: 6c 6c 3f 20 66 61 69 6c 73 29 0a 09 09 09 28 64  ll? fails)....(d
5a00: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e  ebug:print 4 "IN
5a10: 46 4f 3a 20 66 61 69 6c 73 20 69 73 20 6e 75 6c  FO: fails is nul
5a20: 6c 2c 20 6d 6f 76 69 6e 67 20 6f 6e 20 69 6e 20  l, moving on in 
5a30: 74 68 65 20 71 75 65 75 65 20 62 75 74 20 6b 65  the queue but ke
5a40: 65 70 69 6e 67 20 22 20 68 65 64 20 22 20 66 6f  eping " hed " fo
5a50: 72 20 6e 6f 77 22 29 0a 09 09 09 28 6c 6f 6f 70  r now")....(loop
5a60: 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64   (car newtal)(cd
5a70: 72 20 6e 65 77 74 61 6c 29 20 72 65 72 75 6e 73  r newtal) reruns
5a80: 29 29 20 3b 3b 20 61 6e 20 69 73 73 75 65 20 77  )) ;; an issue w
5a90: 69 74 68 20 70 72 65 72 65 71 73 20 6e 6f 74 20  ith prereqs not 
5aa0: 79 65 74 20 6d 65 74 3f 0a 09 09 20 20 20 20 20  yet met?...     
5ab0: 20 20 28 28 61 6e 64 20 28 6e 6f 74 20 28 6e 75    ((and (not (nu
5ac0: 6c 6c 3f 20 66 61 69 6c 73 29 29 28 65 71 3f 20  ll? fails))(eq? 
5ad0: 74 65 73 74 6d 6f 64 65 20 27 6e 6f 72 6d 61 6c  testmode 'normal
5ae0: 29 29 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69  ))....(debug:pri
5af0: 6e 74 20 31 20 22 49 4e 46 4f 3a 20 74 65 73 74  nt 1 "INFO: test
5b00: 20 22 20 20 68 65 64 20 22 20 28 6d 6f 64 65 3d   "  hed " (mode=
5b10: 22 20 74 65 73 74 6d 6f 64 65 20 22 29 20 68 61  " testmode ") ha
5b20: 73 20 66 61 69 6c 65 64 20 70 72 65 72 65 71 75  s failed prerequ
5b30: 69 73 69 74 65 28 73 29 3b 20 22 0a 09 09 09 09  isite(s); ".....
5b40: 20 20 20 20 20 28 73 74 72 69 6e 67 2d 69 6e 74       (string-int
5b50: 65 72 73 70 65 72 73 65 20 28 6d 61 70 20 28 6c  ersperse (map (l
5b60: 61 6d 62 64 61 20 28 74 29 28 63 6f 6e 63 20 28  ambda (t)(conc (
5b70: 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74  db:test-get-test
5b80: 6e 61 6d 65 20 74 29 20 22 3a 22 20 28 64 62 3a  name t) ":" (db:
5b90: 74 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74  test-get-state t
5ba0: 29 22 2f 22 28 64 62 3a 74 65 73 74 2d 67 65 74  )"/"(db:test-get
5bb0: 2d 73 74 61 74 75 73 20 74 29 29 29 20 66 61 69  -status t))) fai
5bc0: 6c 73 29 20 22 2c 20 22 29 0a 09 09 09 09 20 20  ls) ", ").....  
5bd0: 20 20 20 22 2c 20 72 65 6d 6f 76 69 6e 67 20 69     ", removing i
5be0: 74 20 66 72 6f 6d 20 74 6f 2d 64 6f 20 6c 69 73  t from to-do lis
5bf0: 74 22 29 0a 09 09 09 28 69 66 20 28 6e 6f 74 20  t")....(if (not 
5c00: 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 09  (null? tal))....
5c10: 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74      (loop (car t
5c20: 61 6c 29 28 63 64 72 20 74 61 6c 29 28 63 6f 6e  al)(cdr tal)(con
5c30: 73 20 68 65 64 20 72 65 72 75 6e 73 29 29 29 29  s hed reruns))))
5c40: 0a 09 09 20 20 20 20 20 20 20 28 65 6c 73 65 0a  ...       (else.
5c50: 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20  ...(debug:print 
5c60: 38 20 22 45 52 52 4f 52 3a 20 4e 6f 20 68 61 6e  8 "ERROR: No han
5c70: 64 6c 65 72 20 66 6f 72 20 74 68 69 73 20 63 6f  dler for this co
5c80: 6e 64 69 74 69 6f 6e 2e 22 29 0a 09 09 09 3b 3b  ndition.")....;;
5c90: 20 09 20 20 20 20 20 22 5c 6e 20 20 68 65 64 3a   .     "\n  hed:
5ca0: 20 20 20 20 20 20 20 20 20 20 20 20 22 20 68 65              " he
5cb0: 64 20 0a 09 09 09 3b 3b 20 09 20 20 20 20 20 22  d ....;; .     "
5cc0: 5c 6e 20 66 61 69 6c 73 3a 20 20 20 20 20 20 20  \n fails:       
5cd0: 20 20 20 20 22 20 28 73 74 72 69 6e 67 2d 69 6e      " (string-in
5ce0: 74 65 72 73 70 65 72 73 65 20 28 6d 61 70 20 64  tersperse (map d
5cf0: 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e  b:test-get-testn
5d00: 61 6d 65 20 66 61 69 6c 73 29 20 22 2c 22 29 0a  ame fails) ",").
5d10: 09 09 09 3b 3b 20 09 20 20 20 20 20 22 5c 6e 20  ...;; .     "\n 
5d20: 74 65 73 74 6d 6f 64 65 3a 20 20 20 20 20 20 20  testmode:       
5d30: 20 22 20 74 65 73 74 6d 6f 64 65 0a 09 09 09 3b   " testmode....;
5d40: 3b 20 09 20 20 20 20 20 22 5c 6e 20 70 72 65 72  ; .     "\n prer
5d50: 65 71 73 2d 6e 6f 74 2d 6d 65 74 3a 20 22 20 28  eqs-not-met: " (
5d60: 70 72 65 74 74 79 2d 73 74 72 69 6e 67 20 70 72  pretty-string pr
5d70: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09  ereqs-not-met)..
5d80: 09 09 3b 3b 20 09 20 20 20 20 20 22 5c 6e 20 69  ..;; .     "\n i
5d90: 74 65 6d 73 3a 20 20 20 20 20 20 20 20 20 20 20  tems:           
5da0: 22 20 69 74 65 6d 73 29 0a 09 09 09 28 6c 6f 6f  " items)....(loo
5db0: 70 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63  p (car newtal)(c
5dc0: 64 72 20 6e 65 77 74 61 6c 29 20 72 65 72 75 6e  dr newtal) rerun
5dd0: 73 29 29 29 29 0a 09 09 20 20 20 20 3b 3b 20 69  s))))...    ;; i
5de0: 66 20 63 61 6e 27 74 20 72 75 6e 20 6d 6f 72 65  f can't run more
5df0: 20 6a 75 73 74 20 6c 6f 6f 70 20 77 69 74 68 20   just loop with 
5e00: 6e 65 78 74 20 70 6f 73 73 69 62 6c 65 20 74 65  next possible te
5e10: 73 74 0a 09 09 20 20 20 20 28 62 65 67 69 6e 0a  st...    (begin.
5e20: 09 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70  ..      (debug:p
5e30: 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 70 72  rint 4 "INFO: pr
5e40: 6f 63 65 73 73 69 6e 67 20 74 68 65 20 63 61 73  ocessing the cas
5e50: 65 20 77 69 74 68 20 61 20 6c 61 6d 62 64 61 20  e with a lambda 
5e60: 66 6f 72 20 69 74 65 6d 73 20 6f 72 20 27 68 61  for items or 'ha
5e70: 76 65 2d 70 72 6f 63 65 64 75 72 65 2e 20 4d 6f  ve-procedure. Mo
5e80: 76 69 6e 67 20 74 68 72 6f 75 67 68 20 74 68 65  ving through the
5e90: 20 71 75 65 75 65 20 77 69 74 68 6f 75 74 20 64   queue without d
5ea0: 72 6f 70 70 69 6e 67 20 22 20 68 65 64 29 0a 09  ropping " hed)..
5eb0: 09 20 20 20 20 20 20 28 74 68 72 65 61 64 2d 73  .      (thread-s
5ec0: 6c 65 65 70 21 20 28 2b 20 31 20 2a 67 6c 6f 62  leep! (+ 1 *glob
5ed0: 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09 20 20  al-delta*))...  
5ee0: 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e      (loop (car n
5ef0: 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61  ewtal)(cdr newta
5f00: 6c 29 20 72 65 72 75 6e 73 29 29 29 29 29 0a 09  l) reruns)))))..
5f10: 20 20 20 20 20 0a 09 20 20 20 20 20 3b 3b 20 74       ..     ;; t
5f20: 68 69 73 20 63 61 73 65 20 73 68 6f 75 6c 64 20  his case should 
5f30: 6e 6f 74 20 68 61 70 70 65 6e 2c 20 61 64 64 65  not happen, adde
5f40: 64 20 74 6f 20 68 65 6c 70 20 63 61 74 63 68 20  d to help catch 
5f50: 61 6e 79 20 62 75 67 73 0a 09 20 20 20 20 20 28  any bugs..     (
5f60: 28 61 6e 64 20 28 6c 69 73 74 3f 20 69 74 65 6d  (and (list? item
5f70: 73 29 20 69 74 65 6d 64 61 74 29 0a 09 20 20 20  s) itemdat)..   
5f80: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
5f90: 30 20 22 45 52 52 4f 52 3a 20 53 68 6f 75 6c 64  0 "ERROR: Should
5fa0: 20 6e 6f 74 20 68 61 76 65 20 61 20 6c 69 73 74   not have a list
5fb0: 20 6f 66 20 69 74 65 6d 73 20 69 6e 20 61 20 74   of items in a t
5fc0: 65 73 74 20 61 6e 64 20 74 68 65 20 69 74 65 6d  est and the item
5fd0: 73 70 61 74 68 20 73 65 74 20 2d 20 70 6c 65 61  spath set - plea
5fe0: 73 65 20 72 65 70 6f 72 74 20 74 68 69 73 22 29  se report this")
5ff0: 0a 09 20 20 20 20 20 20 28 65 78 69 74 20 31 29  ..      (exit 1)
6000: 29 29 29 0a 09 20 20 0a 09 20 20 3b 3b 20 77 65  )))..  ..  ;; we
6010: 20 67 65 74 20 68 65 72 65 20 6f 6e 20 22 64 72   get here on "dr
6020: 6f 70 20 74 68 72 6f 75 67 68 22 20 2d 20 6c 6f  op through" - lo
6030: 6f 70 20 66 6f 72 20 6e 65 78 74 20 74 65 73 74  op for next test
6040: 20 69 6e 20 71 75 65 75 65 0a 09 20 20 28 69 66   in queue..  (if
6050: 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 0a 09 20 20   (null? tal)..  
6060: 20 20 20 20 28 62 65 67 69 6e 0a 09 09 3b 3b 20      (begin...;; 
6070: 46 49 58 4d 45 21 21 21 21 20 54 48 49 53 20 53  FIXME!!!! THIS S
6080: 48 4f 55 4c 44 20 4e 4f 54 20 52 45 51 55 49 52  HOULD NOT REQUIR
6090: 45 20 41 4e 20 45 58 49 54 21 21 21 21 21 21 21  E AN EXIT!!!!!!!
60a0: 0a 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20  ...(debug:print 
60b0: 31 20 22 49 4e 46 4f 3a 20 41 6c 6c 20 74 65 73  1 "INFO: All tes
60c0: 74 73 20 6c 61 75 6e 63 68 65 64 22 29 0a 09 09  ts launched")...
60d0: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 30  (thread-sleep! 0
60e0: 2e 35 29 0a 09 09 3b 3b 20 46 49 58 4d 45 21 20  .5)...;; FIXME! 
60f0: 54 68 69 73 20 68 61 72 73 68 20 65 78 69 74 20  This harsh exit 
6100: 73 68 6f 75 6c 64 20 6e 6f 74 20 62 65 20 6e 65  should not be ne
6110: 63 65 73 73 61 72 79 2e 2e 2e 2e 0a 09 09 3b 3b  cessary.......;;
6120: 20 28 69 66 20 28 6e 6f 74 20 2a 72 75 6e 72 65   (if (not *runre
6130: 6d 6f 74 65 2a 29 28 65 78 69 74 29 29 20 3b 3b  mote*)(exit)) ;;
6140: 20 0a 09 09 23 66 29 20 3b 3b 20 72 65 74 75 72   ...#f) ;; retur
6150: 6e 20 61 20 23 66 20 61 73 20 61 20 68 69 6e 74  n a #f as a hint
6160: 20 74 68 61 74 20 77 65 20 61 72 65 20 64 6f 6e   that we are don
6170: 65 0a 09 20 20 20 20 20 20 3b 3b 20 48 65 72 65  e..      ;; Here
6180: 20 77 65 20 6e 65 65 64 20 74 6f 20 63 68 65 63   we need to chec
6190: 6b 20 74 68 61 74 20 61 6c 6c 20 74 68 65 20 74  k that all the t
61a0: 65 73 74 73 20 72 65 6d 61 69 6e 69 6e 67 20 74  ests remaining t
61b0: 6f 20 62 65 20 72 75 6e 20 61 72 65 20 65 6c 69  o be run are eli
61c0: 67 69 62 6c 65 20 74 6f 20 72 75 6e 0a 09 20 20  gible to run..  
61d0: 20 20 20 20 3b 3b 20 61 6e 64 20 61 72 65 20 6e      ;; and are n
61e0: 6f 74 20 62 6c 6f 63 6b 65 64 20 62 79 20 66 61  ot blocked by fa
61f0: 69 6c 65 64 0a 09 20 20 20 20 20 20 28 6c 65 74  iled..      (let
6200: 2a 20 28 28 6e 65 77 6c 73 74 20 28 6f 70 65 6e  * ((newlst (open
6210: 2d 72 75 6e 2d 63 6c 6f 73 65 20 74 65 73 74 73  -run-close tests
6220: 3a 66 69 6c 74 65 72 2d 6e 6f 6e 2d 72 75 6e 6e  :filter-non-runn
6230: 61 62 6c 65 20 23 66 20 72 75 6e 2d 69 64 20 74  able #f run-id t
6240: 61 6c 20 74 65 73 74 2d 72 65 63 6f 72 64 73 29  al test-records)
6250: 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f 74 20 46 41  ) ;; i.e. not FA
6260: 49 4c 2c 20 57 41 49 56 45 44 2c 20 49 4e 43 4f  IL, WAIVED, INCO
6270: 4d 50 4c 45 54 45 2c 20 50 41 53 53 2c 20 4b 49  MPLETE, PASS, KI
6280: 4c 4c 45 44 2c 0a 09 09 20 20 20 20 20 28 6a 75  LLED,...     (ju
6290: 6e 6b 65 64 20 28 6c 73 65 74 2d 64 69 66 66 65  nked (lset-diffe
62a0: 72 65 6e 63 65 20 65 71 75 61 6c 3f 20 74 61 6c  rence equal? tal
62b0: 20 6e 65 77 6c 73 74 29 29 29 0a 09 09 28 64 65   newlst)))...(de
62c0: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46  bug:print 4 "INF
62d0: 4f 3a 20 66 75 6c 6c 20 64 72 6f 70 20 74 68 72  O: full drop thr
62e0: 6f 75 67 68 2c 20 69 66 20 72 65 72 75 6e 73 20  ough, if reruns 
62f0: 69 73 20 6c 65 73 73 20 74 68 61 6e 20 31 30 30  is less than 100
6300: 20 77 65 20 77 69 6c 6c 20 66 6f 72 63 65 20 72   we will force r
6310: 65 74 72 79 20 74 68 65 6d 3a 20 22 20 72 65 72  etry them: " rer
6320: 75 6e 73 29 0a 09 09 28 69 66 20 28 3c 20 6e 75  uns)...(if (< nu
6330: 6d 2d 72 65 74 72 69 65 73 20 6d 61 78 2d 72 65  m-retries max-re
6340: 74 72 69 65 73 29 0a 09 09 20 20 20 20 28 73 65  tries)...    (se
6350: 74 21 20 6e 65 77 6c 73 74 20 28 61 70 70 65 6e  t! newlst (appen
6360: 64 20 72 65 72 75 6e 73 20 6e 65 77 6c 73 74 29  d reruns newlst)
6370: 29 29 0a 09 09 28 73 65 74 21 20 6e 75 6d 2d 72  ))...(set! num-r
6380: 65 74 72 69 65 73 20 28 2b 20 6e 75 6d 2d 72 65  etries (+ num-re
6390: 74 72 69 65 73 20 31 29 29 0a 09 09 28 74 68 72  tries 1))...(thr
63a0: 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62  ead-sleep! *glob
63b0: 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 28 69 66  al-delta*)...(if
63c0: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 6e 65 77   (not (null? new
63d0: 6c 73 74 29 29 0a 09 09 20 20 20 20 3b 3b 20 73  lst))...    ;; s
63e0: 69 6e 63 65 20 72 65 72 75 6e 73 20 68 61 76 65  ince reruns have
63f0: 20 62 65 65 6e 20 74 61 63 6b 65 64 20 6f 6e 20   been tacked on 
6400: 74 6f 20 6e 65 77 6c 73 74 20 63 72 65 61 74 65  to newlst create
6410: 20 6e 65 77 20 72 65 72 75 6e 73 20 66 72 6f 6d   new reruns from
6420: 20 6a 75 6e 6b 65 64 0a 09 09 20 20 20 20 28 6c   junked...    (l
6430: 6f 6f 70 20 28 63 61 72 20 6e 65 77 6c 73 74 29  oop (car newlst)
6440: 28 63 64 72 20 6e 65 77 6c 73 74 29 28 64 65 6c  (cdr newlst)(del
6450: 65 74 65 2d 64 75 70 6c 69 63 61 74 65 73 20 6a  ete-duplicates j
6460: 75 6e 6b 65 64 29 29 29 29 29 29 29 29 29 0a 0a  unked)))))))))..
6470: 3b 3b 20 70 61 72 65 6e 74 2d 74 65 73 74 20 69  ;; parent-test i
6480: 73 20 74 68 65 72 65 20 61 73 20 61 20 70 6c 61  s there as a pla
6490: 63 65 68 6f 6c 64 65 72 20 66 6f 72 20 77 68 65  ceholder for whe
64a0: 6e 20 70 61 72 65 6e 74 2d 74 65 73 74 73 20 63  n parent-tests c
64b0: 61 6e 20 62 65 20 72 75 6e 20 61 73 20 61 20 73  an be run as a s
64c0: 65 74 75 70 20 73 74 65 70 0a 28 64 65 66 69 6e  etup step.(defin
64d0: 65 20 28 72 75 6e 3a 74 65 73 74 20 72 75 6e 2d  e (run:test run-
64e0: 69 64 20 72 75 6e 6e 61 6d 65 20 6b 65 79 76 61  id runname keyva
64f0: 6c 6c 73 74 20 74 65 73 74 2d 72 65 63 6f 72 64  llst test-record
6500: 20 66 6c 61 67 73 20 70 61 72 65 6e 74 2d 74 65   flags parent-te
6510: 73 74 29 0a 20 20 3b 3b 20 41 6c 6c 20 74 68 65  st).  ;; All the
6520: 73 65 20 76 61 72 73 20 6d 69 67 68 74 20 62 65  se vars might be
6530: 20 72 65 66 65 72 65 6e 63 65 64 20 62 79 20 74   referenced by t
6540: 68 65 20 74 65 73 74 63 6f 6e 66 69 67 20 66 69  he testconfig fi
6550: 6c 65 20 72 65 61 64 65 72 0a 20 20 28 6c 65 74  le reader.  (let
6560: 2a 20 28 28 74 65 73 74 2d 6e 61 6d 65 20 20 20  * ((test-name   
6570: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75   (tests:testqueu
6580: 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 20  e-get-testname  
6590: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09   test-record))..
65a0: 20 28 74 65 73 74 2d 77 61 69 74 6f 6e 73 20 28   (test-waitons (
65b0: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d  tests:testqueue-
65c0: 67 65 74 2d 77 61 69 74 6f 6e 73 20 20 20 20 74  get-waitons    t
65d0: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28  est-record)).. (
65e0: 74 65 73 74 2d 63 6f 6e 66 20 20 20 20 28 74 65  test-conf    (te
65f0: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65  sts:testqueue-ge
6600: 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 74 65 73  t-testconfig tes
6610: 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 69 74  t-record)).. (it
6620: 65 6d 64 61 74 20 20 20 20 20 20 28 74 65 73 74  emdat      (test
6630: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d  s:testqueue-get-
6640: 69 74 65 6d 64 61 74 20 20 20 20 74 65 73 74 2d  itemdat    test-
6650: 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65 73 74  record)).. (test
6660: 2d 70 61 74 68 20 20 20 20 28 63 6f 6e 63 20 2a  -path    (conc *
6670: 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73  toppath* "/tests
6680: 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29 29 20 3b  /" test-name)) ;
6690: 3b 20 63 6f 75 6c 64 20 75 73 65 20 74 65 73 74  ; could use test
66a0: 73 3a 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67  s:get-testconfig
66b0: 20 68 65 72 65 20 2e 2e 2e 0a 09 20 28 66 6f 72   here ..... (for
66c0: 63 65 20 20 20 20 20 20 20 20 28 68 61 73 68 2d  ce        (hash-
66d0: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c  table-ref/defaul
66e0: 74 20 66 6c 61 67 73 20 22 2d 66 6f 72 63 65 22  t flags "-force"
66f0: 20 23 66 29 29 0a 09 20 28 72 65 72 75 6e 20 20   #f)).. (rerun  
6700: 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c        (hash-tabl
6710: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c  e-ref/default fl
6720: 61 67 73 20 22 2d 72 65 72 75 6e 22 20 23 66 29  ags "-rerun" #f)
6730: 29 0a 09 20 28 6b 65 65 70 67 6f 69 6e 67 20 20  ).. (keepgoing  
6740: 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65    (hash-table-re
6750: 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20  f/default flags 
6760: 22 2d 6b 65 65 70 67 6f 69 6e 67 22 20 23 66 29  "-keepgoing" #f)
6770: 29 0a 09 20 28 69 74 65 6d 2d 70 61 74 68 20 20  ).. (item-path  
6780: 20 20 20 22 22 29 0a 09 20 28 64 62 20 20 20 20     "").. (db    
6790: 20 20 20 20 20 20 20 23 66 29 29 0a 20 20 20 20         #f)).    
67a0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 0a 09  (debug:print 4..
67b0: 09 20 22 74 65 73 74 2d 63 6f 6e 66 69 67 3a 20  . "test-config: 
67c0: 22 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61  " (hash-table->a
67d0: 6c 69 73 74 20 74 65 73 74 2d 63 6f 6e 66 29 0a  list test-conf).
67e0: 09 09 20 22 5c 6e 20 20 20 69 74 65 6d 64 61 74  .. "\n   itemdat
67f0: 3a 20 22 20 69 74 65 6d 64 61 74 0a 09 09 20 29  : " itemdat... )
6800: 0a 20 20 20 20 3b 3b 20 73 65 74 74 69 6e 67 20  .    ;; setting 
6810: 69 74 65 6d 64 61 74 20 74 6f 20 61 20 6c 69 73  itemdat to a lis
6820: 74 20 69 66 20 69 74 20 69 73 20 23 66 0a 20 20  t if it is #f.  
6830: 20 20 28 69 66 20 28 6e 6f 74 20 69 74 65 6d 64    (if (not itemd
6840: 61 74 29 28 73 65 74 21 20 69 74 65 6d 64 61 74  at)(set! itemdat
6850: 20 27 28 29 29 29 0a 20 20 20 20 28 73 65 74 21   '())).    (set!
6860: 20 69 74 65 6d 2d 70 61 74 68 20 28 69 74 65 6d   item-path (item
6870: 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d  -list->path item
6880: 64 61 74 29 29 0a 20 20 20 20 28 64 65 62 75 67  dat)).    (debug
6890: 3a 70 72 69 6e 74 20 32 20 22 41 74 74 65 6d 70  :print 2 "Attemp
68a0: 74 69 6e 67 20 74 6f 20 6c 61 75 6e 63 68 20 74  ting to launch t
68b0: 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20  est " test-name 
68c0: 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65 6d  (if (equal? item
68d0: 2d 70 61 74 68 20 22 2f 22 29 20 22 2f 22 20 69  -path "/") "/" i
68e0: 74 65 6d 2d 70 61 74 68 29 29 0a 20 20 20 20 28  tem-path)).    (
68f0: 73 65 74 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f  setenv "MT_TEST_
6900: 4e 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65 29  NAME" test-name)
6910: 20 3b 3b 20 0a 20 20 20 20 28 73 65 74 65 6e 76   ;; .    (setenv
6920: 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20   "MT_RUNNAME"   
6930: 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20 28 6f 70  runname).    (op
6940: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 73 65 74  en-run-close set
6950: 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61  -megatest-env-va
6960: 72 73 20 64 62 20 72 75 6e 2d 69 64 29 20 3b 3b  rs db run-id) ;;
6970: 20 74 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65   these may be ne
6980: 65 64 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e  eded by the laun
6990: 63 68 69 6e 67 20 70 72 6f 63 65 73 73 0a 20 20  ching process.  
69a0: 20 20 28 63 68 61 6e 67 65 2d 64 69 72 65 63 74    (change-direct
69b0: 6f 72 79 20 2a 74 6f 70 70 61 74 68 2a 29 0a 0a  ory *toppath*)..
69c0: 20 20 20 20 3b 3b 20 48 65 72 65 20 69 73 20 77      ;; Here is w
69d0: 68 65 72 65 20 74 68 65 20 74 65 73 74 5f 6d 65  here the test_me
69e0: 74 61 20 74 61 62 6c 65 20 69 73 20 62 65 73 74  ta table is best
69f0: 20 75 70 64 61 74 65 64 0a 20 20 20 20 3b 3b 20   updated.    ;; 
6a00: 59 65 73 2c 20 61 6e 6f 74 68 65 72 20 75 73 65  Yes, another use
6a10: 20 6f 66 20 61 20 67 6c 6f 62 61 6c 20 66 6f 72   of a global for
6a20: 20 63 61 63 68 69 6e 67 2e 20 4e 65 65 64 20 61   caching. Need a
6a30: 20 62 65 74 74 65 72 20 77 61 79 3f 0a 20 20 20   better way?.   
6a40: 20 28 69 66 20 28 6e 6f 74 20 28 68 61 73 68 2d   (if (not (hash-
6a50: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c  table-ref/defaul
6a60: 74 20 2a 74 65 73 74 2d 6d 65 74 61 2d 75 70 64  t *test-meta-upd
6a70: 61 74 65 64 2a 20 74 65 73 74 2d 6e 61 6d 65 20  ated* test-name 
6a80: 23 66 29 29 0a 20 20 20 20 20 20 20 20 28 62 65  #f)).        (be
6a90: 67 69 6e 0a 09 20 20 20 28 68 61 73 68 2d 74 61  gin..   (hash-ta
6aa0: 62 6c 65 2d 73 65 74 21 20 2a 74 65 73 74 2d 6d  ble-set! *test-m
6ab0: 65 74 61 2d 75 70 64 61 74 65 64 2a 20 74 65 73  eta-updated* tes
6ac0: 74 2d 6e 61 6d 65 20 23 74 29 0a 20 20 20 20 20  t-name #t).     
6ad0: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d        (open-run-
6ae0: 63 6c 6f 73 65 20 72 75 6e 73 3a 75 70 64 61 74  close runs:updat
6af0: 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20 74  e-test_meta db t
6b00: 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f  est-name test-co
6b10: 6e 66 29 29 29 0a 20 20 20 20 0a 20 20 20 20 3b  nf))).    .    ;
6b20: 3b 20 28 6c 61 6d 62 64 61 20 28 69 74 65 6d 64  ; (lambda (itemd
6b30: 61 74 29 20 3b 3b 3b 20 28 28 72 69 70 65 6e 65  at) ;;; ((ripene
6b40: 73 73 20 22 6f 76 65 72 72 69 70 65 22 29 20 28  ss "overripe") (
6b50: 74 65 6d 70 65 72 61 74 75 72 65 20 22 63 6f 6f  temperature "coo
6b60: 6c 22 29 20 28 73 65 61 73 6f 6e 20 22 73 75 6d  l") (season "sum
6b70: 6d 65 72 22 29 29 0a 20 20 20 20 28 6c 65 74 2a  mer")).    (let*
6b80: 20 28 28 6e 65 77 2d 74 65 73 74 2d 70 61 74 68   ((new-test-path
6b90: 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70   (string-intersp
6ba0: 65 72 73 65 20 28 63 6f 6e 73 20 74 65 73 74 2d  erse (cons test-
6bb0: 70 61 74 68 20 28 6d 61 70 20 63 61 64 72 20 69  path (map cadr i
6bc0: 74 65 6d 64 61 74 29 29 20 22 2f 22 29 29 0a 09  temdat)) "/"))..
6bd0: 20 20 20 28 6e 65 77 2d 74 65 73 74 2d 6e 61 6d     (new-test-nam
6be0: 65 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74  e (if (equal? it
6bf0: 65 6d 2d 70 61 74 68 20 22 22 29 20 74 65 73 74  em-path "") test
6c00: 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74  -name (conc test
6c10: 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70  -name "/" item-p
6c20: 61 74 68 29 29 29 20 3b 3b 20 6a 75 73 74 20 6e  ath))) ;; just n
6c30: 65 65 64 20 69 74 20 74 6f 20 62 65 20 75 6e 69  eed it to be uni
6c40: 71 75 65 0a 09 20 20 20 28 74 65 73 74 2d 69 64  que..   (test-id
6c50: 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e         (open-run
6c60: 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65  -close db:get-te
6c70: 73 74 2d 69 64 20 64 62 20 20 72 75 6e 2d 69 64  st-id db  run-id
6c80: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d   test-name item-
6c90: 70 61 74 68 29 29 0a 09 20 20 20 28 74 65 73 74  path))..   (test
6ca0: 64 61 74 20 20 20 20 20 20 20 28 6f 70 65 6e 2d  dat       (open-
6cb0: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
6cc0: 2d 74 65 73 74 2d 69 6e 66 6f 2d 62 79 2d 69 64  -test-info-by-id
6cd0: 20 64 62 20 74 65 73 74 2d 69 64 29 29 29 0a 20   db test-id))). 
6ce0: 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 74 65       (if (not te
6cf0: 73 74 64 61 74 29 0a 09 20 20 28 62 65 67 69 6e  stdat)..  (begin
6d00: 0a 09 20 20 20 20 3b 3b 20 65 6e 73 75 72 65 20  ..    ;; ensure 
6d10: 74 68 61 74 20 74 68 65 20 70 61 74 68 20 65 78  that the path ex
6d20: 69 73 74 73 20 62 65 66 6f 72 65 20 72 65 67 69  ists before regi
6d30: 73 74 65 72 69 6e 67 20 74 68 65 20 74 65 73 74  stering the test
6d40: 0a 09 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 43  ..    ;; NOPE: C
6d50: 61 6e 6e 6f 74 21 20 44 6f 6e 27 74 20 6b 6e 6f  annot! Don't kno
6d60: 77 20 79 65 74 20 77 68 69 63 68 20 64 69 73 6b  w yet which disk
6d70: 20 61 72 65 61 20 77 69 6c 6c 20 62 65 20 61 73   area will be as
6d80: 73 69 67 6e 65 64 2e 2e 2e 2e 0a 09 20 20 20 20  signed......    
6d90: 3b 3b 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63  ;; (system (conc
6da0: 20 22 6d 6b 64 69 72 20 2d 70 20 22 20 6e 65 77   "mkdir -p " new
6db0: 2d 74 65 73 74 2d 70 61 74 68 29 29 0a 09 20 20  -test-path))..  
6dc0: 20 20 3b 3b 0a 09 20 20 20 20 3b 3b 20 28 6f 70    ;;..    ;; (op
6dd0: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 74 65 73  en-run-close tes
6de0: 74 73 3a 72 65 67 69 73 74 65 72 2d 74 65 73 74  ts:register-test
6df0: 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d   db run-id test-
6e00: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a  name item-path).
6e10: 09 20 20 20 20 3b 3b 0a 09 20 20 20 20 3b 3b 20  .    ;;..    ;; 
6e20: 4e 42 2f 2f 20 66 6f 72 20 74 68 65 20 61 62 6f  NB// for the abo
6e30: 76 65 20 6c 69 6e 65 2e 20 49 20 77 61 6e 74 20  ve line. I want 
6e40: 74 68 65 20 74 65 73 74 20 74 6f 20 62 65 20 72  the test to be r
6e50: 65 67 69 73 74 65 72 65 64 20 6c 6f 6e 67 20 62  egistered long b
6e60: 65 66 6f 72 65 20 74 68 69 73 20 72 6f 75 74 69  efore this routi
6e70: 6e 65 20 67 65 74 73 20 63 61 6c 6c 65 64 21 0a  ne gets called!.
6e80: 09 20 20 20 20 3b 3b 0a 09 20 20 20 20 28 73 65  .    ;;..    (se
6e90: 74 21 20 74 65 73 74 2d 69 64 20 28 6f 70 65 6e  t! test-id (open
6ea0: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65  -run-close db:ge
6eb0: 74 2d 74 65 73 74 2d 69 64 20 64 62 20 72 75 6e  t-test-id db run
6ec0: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74  -id test-name it
6ed0: 65 6d 2d 70 61 74 68 29 29 0a 09 20 20 20 20 28  em-path))..    (
6ee0: 69 66 20 28 6e 6f 74 20 74 65 73 74 2d 69 64 29  if (not test-id)
6ef0: 0a 09 09 28 62 65 67 69 6e 0a 09 09 20 20 28 64  ...(begin...  (d
6f00: 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 57 41  ebug:print 2 "WA
6f10: 52 4e 3a 20 54 65 73 74 20 6e 6f 74 20 70 72 65  RN: Test not pre
6f20: 2d 63 72 65 61 74 65 64 3f 20 74 65 73 74 2d 6e  -created? test-n
6f30: 61 6d 65 3d 22 20 74 65 73 74 2d 6e 61 6d 65 20  ame=" test-name 
6f40: 22 2c 20 69 74 65 6d 2d 70 61 74 68 3d 22 20 69  ", item-path=" i
6f50: 74 65 6d 2d 70 61 74 68 20 22 2c 20 72 75 6e 2d  tem-path ", run-
6f60: 69 64 3d 22 20 72 75 6e 2d 69 64 29 0a 09 09 20  id=" run-id)... 
6f70: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
6f80: 20 64 62 3a 74 65 73 74 73 2d 72 65 67 69 73 74   db:tests-regist
6f90: 65 72 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69  er-test db run-i
6fa0: 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d  d test-name item
6fb0: 2d 70 61 74 68 29 0a 09 09 20 20 28 73 65 74 21  -path)...  (set!
6fc0: 20 74 65 73 74 2d 69 64 20 28 6f 70 65 6e 2d 72   test-id (open-r
6fd0: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d  un-close db:get-
6fe0: 74 65 73 74 2d 69 64 20 64 62 20 72 75 6e 2d 69  test-id db run-i
6ff0: 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d  d test-name item
7000: 2d 70 61 74 68 29 29 29 29 0a 09 20 20 20 20 28  -path))))..    (
7010: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49  debug:print 4 "I
7020: 4e 46 4f 3a 20 74 65 73 74 2d 69 64 3d 22 20 74  NFO: test-id=" t
7030: 65 73 74 2d 69 64 20 22 2c 20 72 75 6e 2d 69 64  est-id ", run-id
7040: 3d 22 20 72 75 6e 2d 69 64 20 22 2c 20 74 65 73  =" run-id ", tes
7050: 74 2d 6e 61 6d 65 3d 22 20 74 65 73 74 2d 6e 61  t-name=" test-na
7060: 6d 65 20 22 2c 20 69 74 65 6d 2d 70 61 74 68 3d  me ", item-path=
7070: 5c 22 22 20 69 74 65 6d 2d 70 61 74 68 20 22 5c  \"" item-path "\
7080: 22 22 29 0a 09 20 20 20 20 28 73 65 74 21 20 74  "")..    (set! t
7090: 65 73 74 64 61 74 20 28 6f 70 65 6e 2d 72 75 6e  estdat (open-run
70a0: 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65  -close db:get-te
70b0: 73 74 2d 69 6e 66 6f 2d 62 79 2d 69 64 20 64 62  st-info-by-id db
70c0: 20 74 65 73 74 2d 69 64 29 29 29 29 0a 20 20 20   test-id)))).   
70d0: 20 20 20 28 73 65 74 21 20 74 65 73 74 2d 69 64     (set! test-id
70e0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64   (db:test-get-id
70f0: 20 74 65 73 74 64 61 74 29 29 0a 20 20 20 20 20   testdat)).     
7100: 20 28 63 68 61 6e 67 65 2d 64 69 72 65 63 74 6f   (change-directo
7110: 72 79 20 74 65 73 74 2d 70 61 74 68 29 0a 20 20  ry test-path).  
7120: 20 20 20 20 28 63 61 73 65 20 28 69 66 20 66 6f      (case (if fo
7130: 72 63 65 20 3b 3b 20 28 61 72 67 73 3a 67 65 74  rce ;; (args:get
7140: 2d 61 72 67 20 22 2d 66 6f 72 63 65 22 29 0a 09  -arg "-force")..
7150: 09 27 4e 4f 54 5f 53 54 41 52 54 45 44 0a 09 09  .'NOT_STARTED...
7160: 28 69 66 20 74 65 73 74 64 61 74 0a 09 09 20 20  (if testdat...  
7170: 20 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62 6f    (string->symbo
7180: 6c 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  l (test:get-stat
7190: 65 20 74 65 73 74 64 61 74 29 29 0a 09 09 20 20  e testdat))...  
71a0: 20 20 27 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73    'failed-to-ins
71b0: 65 72 74 29 29 0a 09 28 28 66 61 69 6c 65 64 2d  ert))..((failed-
71c0: 74 6f 2d 69 6e 73 65 72 74 29 0a 09 20 28 64 65  to-insert).. (de
71d0: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52  bug:print 0 "ERR
71e0: 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 69 6e  OR: Failed to in
71f0: 73 65 72 74 20 74 68 65 20 72 65 63 6f 72 64 20  sert the record 
7200: 69 6e 74 6f 20 74 68 65 20 64 62 22 29 29 0a 09  into the db"))..
7210: 28 28 4e 4f 54 5f 53 54 41 52 54 45 44 20 43 4f  ((NOT_STARTED CO
7220: 4d 50 4c 45 54 45 44 29 0a 09 20 28 6c 65 74 20  MPLETED).. (let 
7230: 28 28 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09  ((runflag #f))..
7240: 20 20 20 28 63 6f 6e 64 0a 09 20 20 20 20 3b 3b     (cond..    ;;
7250: 20 2d 66 6f 72 63 65 2c 20 72 75 6e 20 6e 6f 20   -force, run no 
7260: 6d 61 74 74 65 72 20 77 68 61 74 0a 09 20 20 20  matter what..   
7270: 20 28 66 6f 72 63 65 20 28 73 65 74 21 20 72 75   (force (set! ru
7280: 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20  nflag #t))..    
7290: 3b 3b 20 4e 4f 54 5f 53 54 41 52 54 45 44 2c 20  ;; NOT_STARTED, 
72a0: 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77 68  run no matter wh
72b0: 61 74 0a 09 20 20 20 20 28 28 65 71 75 61 6c 3f  at..    ((equal?
72c0: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65   (test:get-state
72d0: 20 74 65 73 74 64 61 74 29 20 22 4e 4f 54 5f 53   testdat) "NOT_S
72e0: 54 41 52 54 45 44 22 29 28 73 65 74 21 20 72 75  TARTED")(set! ru
72f0: 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20  nflag #t))..    
7300: 3b 3b 20 6e 6f 74 20 2d 72 65 72 75 6e 20 61 6e  ;; not -rerun an
7310: 64 20 50 41 53 53 2c 20 57 41 52 4e 20 6f 72 20  d PASS, WARN or 
7320: 43 48 45 43 4b 2c 20 64 6f 20 6e 6f 20 72 75 6e  CHECK, do no run
7330: 0a 09 20 20 20 20 28 28 61 6e 64 20 28 6f 72 20  ..    ((and (or 
7340: 28 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09 20 20  (not rerun)...  
7350: 20 20 20 20 6b 65 65 70 67 6f 69 6e 67 29 0a 09      keepgoing)..
7360: 09 20 20 3b 3b 20 52 65 71 75 69 72 65 20 74 6f  .  ;; Require to
7370: 20 66 6f 72 63 65 20 72 65 2d 72 75 6e 20 66 6f   force re-run fo
7380: 72 20 43 4f 4d 50 4c 45 54 45 44 20 6f 72 20 2a  r COMPLETED or *
7390: 61 6e 79 74 68 69 6e 67 2a 20 2b 20 50 41 53 53  anything* + PASS
73a0: 2c 57 41 52 4e 20 6f 72 20 43 48 45 43 4b 0a 09  ,WARN or CHECK..
73b0: 09 20 20 28 6f 72 20 28 6d 65 6d 62 65 72 20 28  .  (or (member (
73c0: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20  test:get-status 
73d0: 74 65 73 74 64 61 74 29 20 27 28 22 50 41 53 53  testdat) '("PASS
73e0: 22 20 22 57 41 52 4e 22 20 22 43 48 45 43 4b 22  " "WARN" "CHECK"
73f0: 29 29 0a 09 09 20 20 20 20 20 20 28 6d 65 6d 62  ))...      (memb
7400: 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61  er (test:get-sta
7410: 74 65 20 20 74 65 73 74 64 61 74 29 20 27 28 22  te  testdat) '("
7420: 43 4f 4d 50 4c 45 54 45 44 22 29 29 29 29 20 0a  COMPLETED")))) .
7430: 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69  .     (debug:pri
7440: 6e 74 20 32 20 22 49 4e 46 4f 3a 20 72 75 6e 6e  nt 2 "INFO: runn
7450: 69 6e 67 20 74 65 73 74 20 22 20 74 65 73 74 2d  ing test " test-
7460: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61  name "/" item-pa
7470: 74 68 20 22 20 73 75 70 70 72 65 73 73 65 64 20  th " suppressed 
7480: 61 73 20 69 74 20 69 73 20 22 20 28 74 65 73 74  as it is " (test
7490: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64  :get-state testd
74a0: 61 74 29 20 22 20 61 6e 64 20 22 20 28 74 65 73  at) " and " (tes
74b0: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73  t:get-status tes
74c0: 74 64 61 74 29 29 0a 09 20 20 20 20 20 28 73 65  tdat))..     (se
74d0: 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 0a  t! runflag #f)).
74e0: 09 20 20 20 20 3b 3b 20 2d 72 65 72 75 6e 20 61  .    ;; -rerun a
74f0: 6e 64 20 73 74 61 74 75 73 20 69 73 20 6f 6e 65  nd status is one
7500: 20 6f 66 20 74 68 65 20 73 70 65 63 69 66 65 64   of the specifed
7510: 2c 20 72 75 6e 20 69 74 0a 09 20 20 20 20 28 28  , run it..    ((
7520: 61 6e 64 20 72 65 72 75 6e 0a 09 09 20 20 28 6c  and rerun...  (l
7530: 65 74 2a 20 28 28 72 65 72 75 6e 6c 73 74 20 20  et* ((rerunlst  
7540: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 72   (string-split r
7550: 65 72 75 6e 20 22 2c 22 29 29 0a 09 09 09 20 28  erun ",")).... (
7560: 6d 75 73 74 2d 72 65 72 75 6e 20 28 6d 65 6d 62  must-rerun (memb
7570: 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61  er (test:get-sta
7580: 74 75 73 20 74 65 73 74 64 61 74 29 20 72 65 72  tus testdat) rer
7590: 75 6e 6c 73 74 29 29 29 0a 09 09 20 20 20 20 28  unlst)))...    (
75a0: 64 65 62 75 67 3a 70 72 69 6e 74 20 33 20 22 49  debug:print 3 "I
75b0: 4e 46 4f 3a 20 2d 72 65 72 75 6e 20 6c 69 73 74  NFO: -rerun list
75c0: 3a 20 22 20 72 65 72 75 6e 20 22 2c 20 74 65 73  : " rerun ", tes
75d0: 74 2d 73 74 61 74 75 73 3a 20 22 20 28 74 65 73  t-status: " (tes
75e0: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73  t:get-status tes
75f0: 74 64 61 74 29 22 2c 20 6d 75 73 74 2d 72 65 72  tdat)", must-rer
7600: 75 6e 3a 20 22 20 6d 75 73 74 2d 72 65 72 75 6e  un: " must-rerun
7610: 29 0a 09 09 20 20 20 20 6d 75 73 74 2d 72 65 72  )...    must-rer
7620: 75 6e 29 29 0a 09 20 20 20 20 20 28 64 65 62 75  un))..     (debu
7630: 67 3a 70 72 69 6e 74 20 32 20 22 49 4e 46 4f 3a  g:print 2 "INFO:
7640: 20 52 65 72 75 6e 20 66 6f 72 63 65 64 20 66 6f   Rerun forced fo
7650: 72 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61  r test " test-na
7660: 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68  me "/" item-path
7670: 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 75  )..     (set! ru
7680: 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20  nflag #t))..    
7690: 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 2c 20 64  ;; -keepgoing, d
76a0: 6f 20 6e 6f 74 20 72 65 72 75 6e 20 46 41 49 4c  o not rerun FAIL
76b0: 0a 09 20 20 20 20 28 28 61 6e 64 20 6b 65 65 70  ..    ((and keep
76c0: 67 6f 69 6e 67 0a 09 09 20 20 28 6d 65 6d 62 65  going...  (membe
76d0: 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  r (test:get-stat
76e0: 75 73 20 74 65 73 74 64 61 74 29 20 27 28 22 46  us testdat) '("F
76f0: 41 49 4c 22 29 29 29 0a 09 20 20 20 20 20 28 73  AIL")))..     (s
7700: 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29  et! runflag #f))
7710: 0a 09 20 20 20 20 28 28 61 6e 64 20 28 6e 6f 74  ..    ((and (not
7720: 20 72 65 72 75 6e 29 0a 09 09 20 20 28 6d 65 6d   rerun)...  (mem
7730: 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74  ber (test:get-st
7740: 61 74 75 73 20 74 65 73 74 64 61 74 29 20 27 28  atus testdat) '(
7750: 22 46 41 49 4c 22 20 22 6e 2f 61 22 29 29 29 0a  "FAIL" "n/a"))).
7760: 09 20 20 20 20 20 28 73 65 74 21 20 72 75 6e 66  .     (set! runf
7770: 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 28 65  lag #t))..    (e
7780: 6c 73 65 20 28 73 65 74 21 20 72 75 6e 66 6c 61  lse (set! runfla
7790: 67 20 23 66 29 29 29 0a 09 20 20 20 28 64 65 62  g #f)))..   (deb
77a0: 75 67 3a 70 72 69 6e 74 20 36 20 22 52 55 4e 4e  ug:print 6 "RUNN
77b0: 49 4e 47 20 3d 3e 20 72 75 6e 66 6c 61 67 3a 20  ING => runflag: 
77c0: 22 20 72 75 6e 66 6c 61 67 20 22 20 53 54 41 54  " runflag " STAT
77d0: 45 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73  E: " (test:get-s
77e0: 74 61 74 65 20 74 65 73 74 64 61 74 29 20 22 20  tate testdat) " 
77f0: 53 54 41 54 55 53 3a 20 22 20 28 74 65 73 74 3a  STATUS: " (test:
7800: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64  get-status testd
7810: 61 74 29 29 0a 09 20 20 20 28 69 66 20 28 6e 6f  at))..   (if (no
7820: 74 20 72 75 6e 66 6c 61 67 29 0a 09 20 20 20 20  t runflag)..    
7830: 20 20 20 28 69 66 20 28 6e 6f 74 20 70 61 72 65     (if (not pare
7840: 6e 74 2d 74 65 73 74 29 0a 09 09 20 20 20 28 64  nt-test)...   (d
7850: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f  ebug:print 1 "NO
7860: 54 45 3a 20 4e 6f 74 20 73 74 61 72 74 69 6e 67  TE: Not starting
7870: 20 74 65 73 74 20 22 20 6e 65 77 2d 74 65 73 74   test " new-test
7880: 2d 6e 61 6d 65 20 22 20 61 73 20 69 74 20 69 73  -name " as it is
7890: 20 73 74 61 74 65 20 5c 22 22 20 28 74 65 73 74   state \"" (test
78a0: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64  :get-state testd
78b0: 61 74 29 20 0a 09 09 09 09 22 5c 22 20 61 6e 64  at) ....."\" and
78c0: 20 73 74 61 74 75 73 20 5c 22 22 20 28 74 65 73   status \"" (tes
78d0: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73  t:get-status tes
78e0: 74 64 61 74 29 20 22 5c 22 2c 20 75 73 65 20 2d  tdat) "\", use -
78f0: 72 65 72 75 6e 20 5c 22 22 20 28 74 65 73 74 3a  rerun \"" (test:
7900: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64  get-status testd
7910: 61 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20  at).            
7920: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
7930: 20 20 20 20 22 5c 22 20 6f 72 20 2d 66 6f 72 63      "\" or -forc
7940: 65 20 74 6f 20 6f 76 65 72 72 69 64 65 22 29 29  e to override"))
7950: 0a 09 20 20 20 20 20 20 20 3b 3b 20 4e 4f 54 45  ..       ;; NOTE
7960: 3a 20 4e 6f 20 6c 6f 6e 67 65 72 20 62 65 20 63  : No longer be c
7970: 68 65 63 6b 69 6e 67 20 70 72 65 72 65 71 75 69  hecking prerequi
7980: 73 69 74 65 73 20 68 65 72 65 21 20 57 69 6c 6c  sites here! Will
7990: 20 6e 65 76 65 72 20 67 65 74 20 68 65 72 65 20   never get here 
79a0: 75 6e 6c 65 73 73 20 70 72 65 72 65 71 73 20 61  unless prereqs a
79b0: 72 65 0a 09 20 20 20 20 20 20 20 3b 3b 20 20 20  re..       ;;   
79c0: 20 20 20 20 61 6c 72 65 61 64 79 20 6d 65 74 2e      already met.
79d0: 0a 09 20 20 20 20 20 20 20 28 69 66 20 28 6e 6f  ..       (if (no
79e0: 74 20 28 6c 61 75 6e 63 68 2d 74 65 73 74 20 23  t (launch-test #
79f0: 66 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65  f run-id runname
7a00: 20 74 65 73 74 2d 63 6f 6e 66 20 6b 65 79 76 61   test-conf keyva
7a10: 6c 6c 73 74 20 74 65 73 74 2d 6e 61 6d 65 20 74  llst test-name t
7a20: 65 73 74 2d 70 61 74 68 20 69 74 65 6d 64 61 74  est-path itemdat
7a30: 20 66 6c 61 67 73 29 29 0a 09 09 20 20 20 28 62   flags))...   (b
7a40: 65 67 69 6e 0a 09 09 20 20 20 20 20 28 70 72 69  egin...     (pri
7a50: 6e 74 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65  nt "ERROR: Faile
7a60: 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 68 65 20  d to launch the 
7a70: 74 65 73 74 2e 20 45 78 69 74 69 6e 67 20 61 73  test. Exiting as
7a80: 20 73 6f 6f 6e 20 61 73 20 70 6f 73 73 69 62 6c   soon as possibl
7a90: 65 22 29 0a 09 09 20 20 20 20 20 28 73 65 74 21  e")...     (set!
7aa0: 20 2a 67 6c 6f 62 61 6c 65 78 69 74 73 74 61 74   *globalexitstat
7ab0: 75 73 2a 20 31 29 20 3b 3b 20 0a 09 09 20 20 20  us* 1) ;; ...   
7ac0: 20 20 28 70 72 6f 63 65 73 73 2d 73 69 67 6e 61    (process-signa
7ad0: 6c 20 28 63 75 72 72 65 6e 74 2d 70 72 6f 63 65  l (current-proce
7ae0: 73 73 2d 69 64 29 20 73 69 67 6e 61 6c 2f 6b 69  ss-id) signal/ki
7af0: 6c 6c 29 29 29 29 29 29 0a 09 28 28 4b 49 4c 4c  ll))))))..((KILL
7b00: 45 44 29 20 0a 09 20 28 64 65 62 75 67 3a 70 72  ED) .. (debug:pr
7b10: 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 22 20 6e  int 1 "NOTE: " n
7b20: 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 69  ew-test-name " i
7b30: 73 20 61 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e  s already runnin
7b40: 67 20 6f 72 20 77 61 73 20 65 78 70 6c 69 63 74  g or was explict
7b50: 6c 79 20 6b 69 6c 6c 65 64 2c 20 75 73 65 20 2d  ly killed, use -
7b60: 66 6f 72 63 65 20 74 6f 20 6c 61 75 6e 63 68 20  force to launch 
7b70: 69 74 2e 22 29 29 0a 09 28 28 4c 41 55 4e 43 48  it."))..((LAUNCH
7b80: 45 44 20 52 45 4d 4f 54 45 48 4f 53 54 53 54 41  ED REMOTEHOSTSTA
7b90: 52 54 20 52 55 4e 4e 49 4e 47 29 20 20 0a 09 20  RT RUNNING)  .. 
7ba0: 28 69 66 20 28 3e 20 28 2d 20 28 63 75 72 72 65  (if (> (- (curre
7bb0: 6e 74 2d 73 65 63 6f 6e 64 73 29 28 2b 20 28 64  nt-seconds)(+ (d
7bc0: 62 3a 74 65 73 74 2d 67 65 74 2d 65 76 65 6e 74  b:test-get-event
7bd0: 5f 74 69 6d 65 20 74 65 73 74 64 61 74 29 0a 09  _time testdat)..
7be0: 09 09 09 20 20 20 20 20 20 20 28 64 62 3a 74 65  ...       (db:te
7bf0: 73 74 2d 67 65 74 2d 72 75 6e 5f 64 75 72 61 74  st-get-run_durat
7c00: 69 6f 6e 20 74 65 73 74 64 61 74 29 29 29 0a 09  ion testdat)))..
7c10: 09 36 30 30 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f  .600) ;; i.e. no
7c20: 20 75 70 64 61 74 65 20 66 6f 72 20 6d 6f 72 65   update for more
7c30: 20 74 68 61 6e 20 36 30 30 20 73 65 63 6f 6e 64   than 600 second
7c40: 73 0a 09 20 20 20 20 20 28 62 65 67 69 6e 0a 09  s..     (begin..
7c50: 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72         (debug:pr
7c60: 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20  int 0 "WARNING: 
7c70: 54 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65  Test " test-name
7c80: 20 22 20 61 70 70 65 61 72 73 20 74 6f 20 62 65   " appears to be
7c90: 20 64 65 61 64 2e 20 46 6f 72 63 69 6e 67 20 69   dead. Forcing i
7ca0: 74 20 74 6f 20 73 74 61 74 65 20 49 4e 43 4f 4d  t to state INCOM
7cb0: 50 4c 45 54 45 20 61 6e 64 20 73 74 61 74 75 73  PLETE and status
7cc0: 20 53 54 55 43 4b 2f 44 45 41 44 22 29 0a 09 20   STUCK/DEAD").. 
7cd0: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d        (open-run-
7ce0: 63 6c 6f 73 65 20 74 65 73 74 73 3a 74 65 73 74  close tests:test
7cf0: 2d 73 65 74 2d 73 74 61 74 75 73 21 20 64 62 20  -set-status! db 
7d00: 74 65 73 74 2d 69 64 20 22 49 4e 43 4f 4d 50 4c  test-id "INCOMPL
7d10: 45 54 45 22 20 22 53 54 55 43 4b 2f 44 45 41 44  ETE" "STUCK/DEAD
7d20: 22 20 22 54 65 73 74 20 69 73 20 73 74 75 63 6b  " "Test is stuck
7d30: 20 6f 72 20 64 65 61 64 22 20 23 66 29 29 0a 09   or dead" #f))..
7d40: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e       (debug:prin
7d50: 74 20 32 20 22 4e 4f 54 45 3a 20 22 20 74 65 73  t 2 "NOTE: " tes
7d60: 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72 65  t-name " is alre
7d70: 61 64 79 20 72 75 6e 6e 69 6e 67 22 29 29 29 0a  ady running"))).
7d80: 09 28 65 6c 73 65 20 20 20 20 20 20 20 28 64 65  .(else       (de
7d90: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52  bug:print 0 "ERR
7da0: 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c 61  OR: Failed to la
7db0: 75 6e 63 68 20 74 65 73 74 20 22 20 6e 65 77 2d  unch test " new-
7dc0: 74 65 73 74 2d 6e 61 6d 65 20 22 2e 20 55 6e 72  test-name ". Unr
7dd0: 65 63 6f 67 6e 69 73 65 64 20 73 74 61 74 65 20  ecognised state 
7de0: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74  " (test:get-stat
7df0: 65 20 74 65 73 74 64 61 74 29 29 29 29 29 29 29  e testdat)))))))
7e00: 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ..;;============
7e10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7e20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7e30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7e40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 45 4e  ==========.;; EN
7e50: 44 20 4f 46 20 4e 45 57 20 53 54 55 46 46 0a 3b  D OF NEW STUFF.;
7e60: 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;===============
7e70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7e80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7e90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7ea0: 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65  =======..(define
7eb0: 20 28 67 65 74 2d 64 69 72 2d 75 70 2d 6e 20 64   (get-dir-up-n d
7ec0: 69 72 20 2e 20 70 61 72 61 6d 73 29 20 0a 20 20  ir . params) .  
7ed0: 28 6c 65 74 20 28 28 64 70 61 72 74 73 20 20 28  (let ((dparts  (
7ee0: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 64 69 72  string-split dir
7ef0: 20 22 2f 22 29 29 0a 09 28 63 6f 75 6e 74 20 20   "/"))..(count  
7f00: 20 28 69 66 20 28 6e 75 6c 6c 3f 20 70 61 72 61   (if (null? para
7f10: 6d 73 29 20 31 20 28 63 61 72 20 70 61 72 61 6d  ms) 1 (car param
7f20: 73 29 29 29 29 0a 20 20 20 20 28 63 6f 6e 63 20  s)))).    (conc 
7f30: 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 65  "/" (string-inte
7f40: 72 73 70 65 72 73 65 20 0a 09 20 20 20 20 20 20  rsperse ..      
7f50: 20 28 74 61 6b 65 20 64 70 61 72 74 73 20 28 2d   (take dparts (-
7f60: 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73 29   (length dparts)
7f70: 20 63 6f 75 6e 74 29 29 0a 09 20 20 20 20 20 20   count))..      
7f80: 20 22 2f 22 29 29 29 29 0a 3b 3b 20 52 65 6d 6f   "/")))).;; Remo
7f90: 76 65 20 72 75 6e 73 0a 3b 3b 20 66 69 65 6c 64  ve runs.;; field
7fa0: 73 20 61 72 65 20 70 61 73 73 69 6e 67 20 69 6e  s are passing in
7fb0: 20 74 68 72 6f 75 67 68 20 0a 3b 3b 20 61 63 74   through .;; act
7fc0: 69 6f 6e 3a 0a 3b 3b 20 20 20 20 27 72 65 6d 6f  ion:.;;    'remo
7fd0: 76 65 2d 72 75 6e 73 0a 3b 3b 20 20 20 20 27 73  ve-runs.;;    's
7fe0: 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73 0a  et-state-status.
7ff0: 3b 3b 0a 3b 3b 20 4e 42 2f 2f 20 73 68 6f 75 6c  ;;.;; NB// shoul
8000: 64 20 70 61 73 73 20 69 6e 20 6b 65 79 73 3f 0a  d pass in keys?.
8010: 3b 3b 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73  ;;.(define (runs
8020: 3a 6f 70 65 72 61 74 65 2d 6f 6e 20 61 63 74 69  :operate-on acti
8030: 6f 6e 20 72 75 6e 6e 61 6d 65 70 61 74 74 20 74  on runnamepatt t
8040: 65 73 74 70 61 74 74 20 69 74 65 6d 70 61 74 74  estpatt itempatt
8050: 20 23 21 6b 65 79 20 28 73 74 61 74 65 20 23 66   #!key (state #f
8060: 29 28 73 74 61 74 75 73 20 23 66 29 28 6e 65 77  )(status #f)(new
8070: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 20 23 66  -state-status #f
8080: 29 29 0a 20 20 28 6c 65 74 2a 20 28 28 64 62 20  )).  (let* ((db 
8090: 20 20 20 20 20 20 20 20 20 20 23 66 29 0a 09 20            #f).. 
80a0: 28 6b 65 79 73 20 20 20 20 20 20 20 20 20 28 6f  (keys         (o
80b0: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62  pen-run-close db
80c0: 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09  :get-keys db))..
80d0: 20 28 72 75 6e 64 61 74 20 20 20 20 20 20 20 28   (rundat       (
80e0: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72  open-run-close r
80f0: 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d  uns:get-runs-by-
8100: 70 61 74 74 20 64 62 20 6b 65 79 73 20 72 75 6e  patt db keys run
8110: 6e 61 6d 65 70 61 74 74 29 29 0a 09 20 28 68 65  namepatt)).. (he
8120: 61 64 65 72 20 20 20 20 20 20 20 28 76 65 63 74  ader       (vect
8130: 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 30 29  or-ref rundat 0)
8140: 29 0a 09 20 28 72 75 6e 73 20 20 20 20 20 20 20  ).. (runs       
8150: 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75    (vector-ref ru
8160: 6e 64 61 74 20 31 29 29 0a 09 20 28 73 74 61 74  ndat 1)).. (stat
8170: 65 73 20 20 20 20 20 20 20 28 69 66 20 73 74 61  es       (if sta
8180: 74 65 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69  te  (string-spli
8190: 74 20 73 74 61 74 65 20 20 22 2c 22 29 20 27 28  t state  ",") '(
81a0: 29 29 29 0a 09 20 28 73 74 61 74 75 73 65 73 20  ))).. (statuses 
81b0: 20 20 20 20 28 69 66 20 73 74 61 74 75 73 20 28      (if status (
81c0: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 73 74 61  string-split sta
81d0: 74 75 73 20 22 2c 22 29 20 27 28 29 29 29 0a 09  tus ",") '()))..
81e0: 20 28 73 74 61 74 65 2d 73 74 61 74 75 73 20 28   (state-status (
81f0: 69 66 20 28 73 74 72 69 6e 67 3f 20 6e 65 77 2d  if (string? new-
8200: 73 74 61 74 65 2d 73 74 61 74 75 73 29 20 28 73  state-status) (s
8210: 74 72 69 6e 67 2d 73 70 6c 69 74 20 6e 65 77 2d  tring-split new-
8220: 73 74 61 74 65 2d 73 74 61 74 75 73 20 22 2c 22  state-status ","
8230: 29 20 27 28 23 66 20 23 66 29 29 29 29 0a 20 20  ) '(#f #f)))).  
8240: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32    (debug:print 2
8250: 20 22 48 65 61 64 65 72 3a 20 22 20 68 65 61 64   "Header: " head
8260: 65 72 20 22 20 61 63 74 69 6f 6e 3a 20 22 20 61  er " action: " a
8270: 63 74 69 6f 6e 20 22 20 6e 65 77 2d 73 74 61 74  ction " new-stat
8280: 65 2d 73 74 61 74 75 73 3a 20 22 20 6e 65 77 2d  e-status: " new-
8290: 73 74 61 74 65 2d 73 74 61 74 75 73 29 0a 20 20  state-status).  
82a0: 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 20    (for-each.    
82b0: 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a 20   (lambda (run). 
82c0: 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 75 6e        (let ((run
82d0: 6b 65 79 20 28 73 74 72 69 6e 67 2d 69 6e 74 65  key (string-inte
82e0: 72 73 70 65 72 73 65 20 28 6d 61 70 20 28 6c 61  rsperse (map (la
82f0: 6d 62 64 61 20 28 6b 29 0a 09 09 09 09 09 09 28  mbda (k).......(
8300: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d  db:get-value-by-
8310: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65  header run heade
8320: 72 20 28 76 65 63 74 6f 72 2d 72 65 66 20 6b 20  r (vector-ref k 
8330: 30 29 29 29 20 6b 65 79 73 29 20 22 2f 22 29 29  0))) keys) "/"))
8340: 0a 09 20 20 20 20 20 28 64 69 72 73 2d 74 6f 2d  ..     (dirs-to-
8350: 72 65 6d 6f 76 65 20 28 6d 61 6b 65 2d 68 61 73  remove (make-has
8360: 68 2d 74 61 62 6c 65 29 29 29 0a 09 20 28 6c 65  h-table))).. (le
8370: 74 2a 20 28 28 72 75 6e 2d 69 64 20 20 20 20 28  t* ((run-id    (
8380: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d  db:get-value-by-
8390: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65  header run heade
83a0: 72 20 22 69 64 22 29 29 0a 09 09 28 72 75 6e 2d  r "id"))...(run-
83b0: 73 74 61 74 65 20 28 64 62 3a 67 65 74 2d 76 61  state (db:get-va
83c0: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75  lue-by-header ru
83d0: 6e 20 68 65 61 64 65 72 20 22 73 74 61 74 65 22  n header "state"
83e0: 29 29 0a 09 09 28 74 65 73 74 73 20 20 20 20 20  ))...(tests     
83f0: 28 69 66 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f  (if (not (equal?
8400: 20 72 75 6e 2d 73 74 61 74 65 20 22 6c 6f 63 6b   run-state "lock
8410: 65 64 22 29 29 0a 09 09 09 20 20 20 20 20 20 20  ed"))....       
8420: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
8430: 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72  db:get-tests-for
8440: 2d 72 75 6e 20 64 62 20 28 64 62 3a 67 65 74 2d  -run db (db:get-
8450: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20  value-by-header 
8460: 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 22 29  run header "id")
8470: 0a 09 09 09 09 09 09 20 20 20 20 20 20 74 65 73  .......      tes
8480: 74 70 61 74 74 20 69 74 65 6d 70 61 74 74 20 73  tpatt itempatt s
8490: 74 61 74 65 73 20 73 74 61 74 75 73 65 73 0a 09  tates statuses..
84a0: 09 09 09 09 09 20 20 20 20 20 20 6e 6f 74 2d 69  .....      not-i
84b0: 6e 3a 20 20 23 66 0a 09 09 09 09 09 09 20 20 20  n:  #f.......   
84c0: 20 20 20 73 6f 72 74 2d 62 79 3a 20 28 63 61 73     sort-by: (cas
84d0: 65 20 61 63 74 69 6f 6e 0a 09 09 09 09 09 09 09  e action........
84e0: 09 20 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29  . ((remove-runs)
84f0: 20 27 72 75 6e 64 69 72 29 0a 09 09 09 09 09 09   'rundir).......
8500: 09 09 20 28 65 6c 73 65 20 20 20 20 20 20 20 20  .. (else        
8510: 20 20 27 65 76 65 6e 74 5f 74 69 6d 65 29 29 29    'event_time)))
8520: 0a 09 09 09 20 20 20 20 20 20 20 27 28 29 29 29  ....       '()))
8530: 0a 09 09 28 6c 61 73 74 74 70 61 74 68 20 22 2f  ...(lasttpath "/
8540: 64 6f 65 73 2f 6e 6f 74 2f 65 78 69 73 74 2f 49  does/not/exist/I
8550: 2f 68 6f 70 65 22 29 29 0a 0a 09 20 20 20 28 69  /hope"))...   (i
8560: 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 65  f (not (null? te
8570: 73 74 73 29 29 0a 09 20 20 20 20 20 20 20 28 62  sts))..       (b
8580: 65 67 69 6e 0a 09 09 20 28 63 61 73 65 20 61 63  egin... (case ac
8590: 74 69 6f 6e 0a 09 09 20 20 20 28 28 72 65 6d 6f  tion...   ((remo
85a0: 76 65 2d 72 75 6e 73 29 0a 09 09 20 20 20 20 28  ve-runs)...    (
85b0: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52  debug:print 1 "R
85c0: 65 6d 6f 76 69 6e 67 20 74 65 73 74 73 20 66 6f  emoving tests fo
85d0: 72 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20  r run: " runkey 
85e0: 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75  " " (db:get-valu
85f0: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20  e-by-header run 
8600: 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22  header "runname"
8610: 29 29 29 0a 09 09 20 20 20 28 28 73 65 74 2d 73  )))...   ((set-s
8620: 74 61 74 65 2d 73 74 61 74 75 73 29 0a 09 09 20  tate-status)... 
8630: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
8640: 31 20 22 4d 6f 64 69 66 79 69 6e 67 20 73 74 61  1 "Modifying sta
8650: 74 65 20 61 6e 64 20 73 74 61 75 73 20 66 6f 72  te and staus for
8660: 20 74 65 73 74 73 20 66 6f 72 20 72 75 6e 3a 20   tests for run: 
8670: 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62  " runkey " " (db
8680: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65  :get-value-by-he
8690: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20  ader run header 
86a0: 22 72 75 6e 6e 61 6d 65 22 29 29 29 0a 09 09 20  "runname")))... 
86b0: 20 20 28 65 6c 73 65 0a 09 09 20 20 20 20 28 70    (else...    (p
86c0: 72 69 6e 74 20 22 49 4e 46 4f 3a 20 61 63 74 69  rint "INFO: acti
86d0: 6f 6e 20 6e 6f 74 20 72 65 63 6f 67 6e 69 73 65  on not recognise
86e0: 64 20 22 20 61 63 74 69 6f 6e 29 29 29 0a 09 09  d " action)))...
86f0: 20 28 66 6f 72 2d 65 61 63 68 0a 09 09 20 20 28   (for-each...  (
8700: 6c 61 6d 62 64 61 20 28 74 65 73 74 29 0a 09 09  lambda (test)...
8710: 20 20 20 20 28 6c 65 74 2a 20 28 28 69 74 65 6d      (let* ((item
8720: 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67  -path (db:test-g
8730: 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73  et-item-path tes
8740: 74 29 29 0a 09 09 09 20 20 20 28 74 65 73 74 2d  t))....   (test-
8750: 6e 61 6d 65 20 28 64 62 3a 74 65 73 74 2d 67 65  name (db:test-ge
8760: 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29  t-testname test)
8770: 29 0a 09 09 09 20 20 20 28 72 75 6e 2d 64 69 72  )....   (run-dir
8780: 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d     (db:test-get-
8790: 72 75 6e 64 69 72 20 74 65 73 74 29 29 0a 09 09  rundir test))...
87a0: 09 20 20 20 28 74 65 73 74 2d 69 64 20 20 20 28  .   (test-id   (
87b0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74  db:test-get-id t
87c0: 65 73 74 29 29 29 0a 09 09 20 20 20 20 20 20 3b  est)))...      ;
87d0: 3b 20 20 20 28 74 64 62 20 20 20 20 20 20 20 28  ;   (tdb       (
87e0: 64 62 3a 6f 70 65 6e 2d 74 65 73 74 2d 64 62 20  db:open-test-db 
87f0: 72 75 6e 2d 64 69 72 29 29 29 0a 09 09 20 20 20  run-dir)))...   
8800: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20     (debug:print 
8810: 31 20 22 20 20 22 20 28 64 62 3a 74 65 73 74 2d  1 "  " (db:test-
8820: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73  get-testname tes
8830: 74 29 20 22 20 69 64 3a 20 22 20 28 64 62 3a 74  t) " id: " (db:t
8840: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29  est-get-id test)
8850: 20 22 20 22 20 69 74 65 6d 2d 70 61 74 68 20 22   " " item-path "
8860: 20 61 63 74 69 6f 6e 3a 20 22 20 61 63 74 69 6f   action: " actio
8870: 6e 29 0a 09 09 20 20 20 20 20 20 28 63 61 73 65  n)...      (case
8880: 20 61 63 74 69 6f 6e 0a 09 09 09 28 28 72 65 6d   action....((rem
8890: 6f 76 65 2d 72 75 6e 73 29 20 3b 3b 20 74 68 65  ove-runs) ;; the
88a0: 20 74 64 62 20 69 73 20 66 6f 72 20 66 75 74 75   tdb is for futu
88b0: 72 65 20 70 6f 73 73 69 62 6c 65 2e 20 0a 09 09  re possible. ...
88c0: 09 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73  . (open-run-clos
88d0: 65 20 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74  e db:delete-test
88e0: 2d 72 65 63 6f 72 64 73 20 64 62 20 23 66 20 28  -records db #f (
88f0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74  db:test-get-id t
8900: 65 73 74 29 29 0a 09 09 09 20 28 64 65 62 75 67  est)).... (debug
8910: 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20  :print 1 "INFO: 
8920: 41 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 72 65  Attempting to re
8930: 6d 6f 76 65 20 64 69 72 20 22 20 72 75 6e 2d 64  move dir " run-d
8940: 69 72 29 0a 09 09 09 20 28 69 66 20 28 61 6e 64  ir).... (if (and
8950: 20 28 3e 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67   (> (string-leng
8960: 74 68 20 72 75 6e 2d 64 69 72 29 20 35 29 0a 09  th run-dir) 5)..
8970: 09 09 09 20 20 28 66 69 6c 65 2d 65 78 69 73 74  ...  (file-exist
8980: 73 3f 20 72 75 6e 2d 64 69 72 29 29 20 3b 3b 20  s? run-dir)) ;; 
8990: 62 61 64 20 68 65 75 72 69 73 74 69 63 20 62 75  bad heuristic bu
89a0: 74 20 73 68 6f 75 6c 64 20 70 72 65 76 65 6e 74  t should prevent
89b0: 20 2f 74 6d 70 20 2f 68 6f 6d 65 20 65 74 63 2e   /tmp /home etc.
89c0: 0a 09 09 09 20 20 20 20 20 28 6c 65 74 2a 20 28  ....     (let* (
89d0: 28 72 65 61 6c 70 61 74 68 20 28 72 65 73 6f 6c  (realpath (resol
89e0: 76 65 2d 70 61 74 68 6e 61 6d 65 20 72 75 6e 2d  ve-pathname run-
89f0: 64 69 72 29 29 29 0a 09 09 09 20 20 20 20 20 20  dir)))....      
8a00: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20   (debug:print 1 
8a10: 22 49 4e 46 4f 3a 20 52 65 61 6c 20 70 61 74 68  "INFO: Real path
8a20: 20 6f 66 20 69 73 20 22 20 72 65 61 6c 70 61 74   of is " realpat
8a30: 68 29 0a 09 09 09 20 20 20 20 20 20 20 28 69 66  h)....       (if
8a40: 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 72   (file-exists? r
8a50: 65 61 6c 70 61 74 68 29 0a 09 09 09 09 20 20 20  ealpath).....   
8a60: 28 69 66 20 28 3e 20 28 73 79 73 74 65 6d 20 28  (if (> (system (
8a70: 63 6f 6e 63 20 22 72 6d 20 2d 72 66 20 22 20 72  conc "rm -rf " r
8a80: 65 61 6c 70 61 74 68 29 29 20 30 29 0a 09 09 09  ealpath)) 0)....
8a90: 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70  .       (debug:p
8aa0: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 54  rint 0 "ERROR: T
8ab0: 68 65 72 65 20 77 61 73 20 61 20 70 72 6f 62 6c  here was a probl
8ac0: 65 6d 20 72 65 6d 6f 76 69 6e 67 20 22 20 72 65  em removing " re
8ad0: 61 6c 70 61 74 68 20 22 20 77 69 74 68 20 72 6d  alpath " with rm
8ae0: 20 2d 66 22 29 29 0a 09 09 09 09 20 20 20 28 64   -f")).....   (d
8af0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41  ebug:print 0 "WA
8b00: 52 4e 49 4e 47 3a 20 74 65 73 74 20 72 75 6e 20  RNING: test run 
8b10: 64 69 72 20 22 20 72 65 61 6c 70 61 74 68 20 22  dir " realpath "
8b20: 20 61 70 70 65 61 72 73 20 74 6f 20 6e 6f 74 20   appears to not 
8b30: 65 78 69 73 74 22 29 29 0a 09 09 09 20 20 20 20  exist"))....    
8b40: 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69     (if (file-exi
8b50: 73 74 73 3f 20 72 75 6e 2d 64 69 72 29 20 3b 3b  sts? run-dir) ;;
8b60: 20 74 68 65 20 6c 69 6e 6b 0a 09 09 09 09 20 20   the link.....  
8b70: 20 28 69 66 20 28 73 79 6d 62 6f 6c 69 63 2d 6c   (if (symbolic-l
8b80: 69 6e 6b 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09  ink? run-dir)...
8b90: 09 09 20 20 20 20 20 20 20 28 64 65 6c 65 74 65  ..       (delete
8ba0: 2d 66 69 6c 65 20 72 75 6e 2d 64 69 72 29 0a 09  -file run-dir)..
8bb0: 09 09 09 20 20 20 20 20 20 20 28 69 66 20 28 64  ...       (if (d
8bc0: 69 72 65 63 74 6f 72 79 3f 20 72 75 6e 2d 64 69  irectory? run-di
8bd0: 72 29 0a 09 09 09 09 09 20 20 20 28 69 66 20 28  r)......   (if (
8be0: 3e 20 28 64 69 72 65 63 74 6f 72 79 2d 66 6f 6c  > (directory-fol
8bf0: 64 20 28 6c 61 6d 62 64 61 20 28 66 20 78 29 28  d (lambda (f x)(
8c00: 2b 20 31 20 78 29 29 20 30 20 72 75 6e 2d 64 69  + 1 x)) 0 run-di
8c10: 72 29 20 30 29 0a 09 09 09 09 09 20 20 20 20 20  r) 0)......     
8c20: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30    (debug:print 0
8c30: 20 22 57 41 52 4e 49 4e 47 3a 20 72 65 66 75 73   "WARNING: refus
8c40: 69 6e 67 20 74 6f 20 72 65 6d 6f 76 65 20 22 20  ing to remove " 
8c50: 72 75 6e 2d 64 69 72 20 22 20 61 73 20 69 74 20  run-dir " as it 
8c60: 69 73 20 6e 6f 74 20 65 6d 70 74 79 22 29 0a 09  is not empty")..
8c70: 09 09 09 09 20 20 20 20 20 20 20 28 64 65 6c 65  ....       (dele
8c80: 74 65 2d 64 69 72 65 63 74 6f 72 79 20 72 75 6e  te-directory run
8c90: 2d 64 69 72 29 29 20 3b 3b 20 69 74 20 73 68 6f  -dir)) ;; it sho
8ca0: 75 6c 64 20 62 65 20 65 6d 70 74 79 20 62 79 20  uld be empty by 
8cb0: 68 65 72 65 20 42 55 47 20 42 55 47 2c 20 61 64  here BUG BUG, ad
8cc0: 64 20 65 72 72 6f 72 20 63 61 74 63 68 0a 09 09  d error catch...
8cd0: 09 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 69  ...   (debug:pri
8ce0: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 72 65 66  nt 0 "ERROR: ref
8cf0: 75 73 69 6e 67 20 74 6f 20 72 65 6d 6f 76 65 20  using to remove 
8d00: 22 20 72 75 6e 2d 64 69 72 20 22 20 61 73 20 69  " run-dir " as i
8d10: 74 20 69 73 20 6e 65 69 74 68 65 72 20 61 20 73  t is neither a s
8d20: 79 6d 6c 69 6e 6b 20 6e 6f 72 20 61 20 64 69 72  ymlink nor a dir
8d30: 65 63 74 6f 72 79 22 29 0a 09 09 09 09 09 20 20  ectory")......  
8d40: 20 29 29 29 29 0a 09 09 09 20 20 20 20 20 28 64   ))))....     (d
8d50: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41  ebug:print 0 "WA
8d60: 52 4e 49 4e 47 3a 20 64 69 72 65 63 74 6f 72 79  RNING: directory
8d70: 20 61 6c 72 65 61 64 79 20 72 65 6d 6f 76 65 64   already removed
8d80: 20 22 20 72 75 6e 2d 64 69 72 29 29 29 0a 09 09   " run-dir)))...
8d90: 09 28 28 73 65 74 2d 73 74 61 74 65 2d 73 74 61  .((set-state-sta
8da0: 74 75 73 29 0a 09 09 09 20 28 64 65 62 75 67 3a  tus).... (debug:
8db0: 70 72 69 6e 74 20 32 20 22 49 4e 46 4f 3a 20 6e  print 2 "INFO: n
8dc0: 65 77 20 73 74 61 74 65 20 22 20 28 63 61 72 20  ew state " (car 
8dd0: 73 74 61 74 65 2d 73 74 61 74 75 73 29 20 22 2c  state-status) ",
8de0: 20 6e 65 77 20 73 74 61 74 75 73 20 22 20 28 63   new status " (c
8df0: 61 64 72 20 73 74 61 74 65 2d 73 74 61 74 75 73  adr state-status
8e00: 29 29 0a 09 09 09 20 28 6f 70 65 6e 2d 72 75 6e  )).... (open-run
8e10: 2d 63 6c 6f 73 65 20 64 62 3a 74 65 73 74 2d 73  -close db:test-s
8e20: 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73 2d  et-state-status-
8e30: 62 79 2d 69 64 20 64 62 20 28 64 62 3a 74 65 73  by-id db (db:tes
8e40: 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29 20 28  t-get-id test) (
8e50: 63 61 72 20 73 74 61 74 65 2d 73 74 61 74 75 73  car state-status
8e60: 29 28 63 61 64 72 20 73 74 61 74 65 2d 73 74 61  )(cadr state-sta
8e70: 74 75 73 29 20 23 66 29 29 29 29 29 0a 09 09 20  tus) #f)))))... 
8e80: 20 74 65 73 74 73 29 29 29 0a 09 20 20 20 0a 09   tests)))..   ..
8e90: 20 20 20 3b 3b 20 72 65 6d 6f 76 65 20 74 68 65     ;; remove the
8ea0: 20 72 75 6e 20 69 66 20 7a 65 72 6f 20 74 65 73   run if zero tes
8eb0: 74 73 20 72 65 6d 61 69 6e 0a 09 20 20 20 28 69  ts remain..   (i
8ec0: 66 20 28 65 71 3f 20 61 63 74 69 6f 6e 20 27 72  f (eq? action 'r
8ed0: 65 6d 6f 76 65 2d 72 75 6e 73 29 0a 09 20 20 20  emove-runs)..   
8ee0: 20 20 20 20 28 6c 65 74 20 28 28 72 65 6d 74 65      (let ((remte
8ef0: 73 74 73 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c  sts (open-run-cl
8f00: 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 73  ose db:get-tests
8f10: 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 62 3a  -for-run db (db:
8f20: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61  get-value-by-hea
8f30: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22  der run header "
8f40: 69 64 22 29 20 23 66 20 23 66 20 27 28 22 44 45  id") #f #f '("DE
8f50: 4c 45 54 45 44 22 29 20 27 28 22 6e 2f 61 22 29  LETED") '("n/a")
8f60: 20 6e 6f 74 2d 69 6e 3a 20 23 74 29 29 29 0a 09   not-in: #t)))..
8f70: 09 20 28 69 66 20 28 6e 75 6c 6c 3f 20 72 65 6d  . (if (null? rem
8f80: 74 65 73 74 73 29 20 3b 3b 20 6e 6f 20 6d 6f 72  tests) ;; no mor
8f90: 65 20 74 65 73 74 73 20 72 65 6d 61 69 6e 69 6e  e tests remainin
8fa0: 67 0a 09 09 20 20 20 20 20 28 6c 65 74 2a 20 28  g...     (let* (
8fb0: 28 64 70 61 72 74 73 20 20 28 73 74 72 69 6e 67  (dparts  (string
8fc0: 2d 73 70 6c 69 74 20 6c 61 73 74 74 70 61 74 68  -split lasttpath
8fd0: 20 22 2f 22 29 29 0a 09 09 09 20 20 20 20 28 72   "/"))....    (r
8fe0: 75 6e 70 61 74 68 20 28 63 6f 6e 63 20 22 2f 22  unpath (conc "/"
8ff0: 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70   (string-intersp
9000: 65 72 73 65 20 0a 09 09 09 09 09 09 28 74 61 6b  erse .......(tak
9010: 65 20 64 70 61 72 74 73 20 28 2d 20 28 6c 65 6e  e dparts (- (len
9020: 67 74 68 20 64 70 61 72 74 73 29 20 31 29 29 0a  gth dparts) 1)).
9030: 09 09 09 09 09 09 22 2f 22 29 29 29 29 0a 09 09  ......"/"))))...
9040: 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72         (debug:pr
9050: 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20  int 1 "Removing 
9060: 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20  run: " runkey " 
9070: 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d  " (db:get-value-
9080: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65  by-header run he
9090: 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 20  ader "runname") 
90a0: 22 20 61 6e 64 20 72 65 6c 61 74 65 64 20 72 65  " and related re
90b0: 63 6f 72 64 22 29 0a 09 09 20 20 20 20 20 20 20  cord")...       
90c0: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
90d0: 64 62 3a 64 65 6c 65 74 65 2d 72 75 6e 20 64 62  db:delete-run db
90e0: 20 72 75 6e 2d 69 64 29 0a 09 09 20 20 20 20 20   run-id)...     
90f0: 20 20 3b 3b 20 54 68 69 73 20 69 73 20 61 20 70    ;; This is a p
9100: 72 65 74 74 79 20 67 6f 6f 64 20 70 6c 61 63 65  retty good place
9110: 20 74 6f 20 70 75 72 67 65 20 6f 6c 64 20 44 45   to purge old DE
9120: 4c 45 54 45 44 20 74 65 73 74 73 0a 09 09 20 20  LETED tests...  
9130: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63       (open-run-c
9140: 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 2d 74  lose db:delete-t
9150: 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20  ests-for-run db 
9160: 72 75 6e 2d 69 64 29 0a 09 09 20 20 20 20 20 20  run-id)...      
9170: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
9180: 20 64 62 3a 64 65 6c 65 74 65 2d 6f 6c 64 2d 64   db:delete-old-d
9190: 65 6c 65 74 65 64 2d 74 65 73 74 2d 72 65 63 6f  eleted-test-reco
91a0: 72 64 73 20 64 62 29 0a 09 09 20 20 20 20 20 20  rds db)...      
91b0: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
91c0: 20 64 62 3a 73 65 74 2d 76 61 72 20 64 62 20 22   db:set-var db "
91d0: 44 45 4c 45 54 45 44 5f 54 45 53 54 53 22 20 28  DELETED_TESTS" (
91e0: 63 75 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73 29  current-seconds)
91f0: 29 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 6e 65  )...       ;; ne
9200: 65 64 20 74 6f 20 66 69 67 75 72 65 20 6f 75 74  ed to figure out
9210: 20 74 68 65 20 70 61 74 68 20 74 6f 20 74 68 65   the path to the
9220: 20 72 75 6e 20 64 69 72 20 61 6e 64 20 72 65 6d   run dir and rem
9230: 6f 76 65 20 69 74 20 69 66 20 65 6d 70 74 79 0a  ove it if empty.
9240: 09 09 20 20 20 20 20 20 20 3b 3b 20 20 20 20 28  ..       ;;    (
9250: 69 66 20 28 6e 75 6c 6c 3f 20 28 67 6c 6f 62 20  if (null? (glob 
9260: 28 63 6f 6e 63 20 72 75 6e 70 61 74 68 20 22 2f  (conc runpath "/
9270: 2a 22 29 29 29 0a 09 09 20 20 20 20 20 20 20 3b  *")))...       ;
9280: 3b 20 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a  ;        (begin.
9290: 09 09 20 20 20 20 20 20 20 3b 3b 20 09 20 28 64  ..       ;; . (d
92a0: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65  ebug:print 1 "Re
92b0: 6d 6f 76 69 6e 67 20 72 75 6e 20 64 69 72 20 22  moving run dir "
92c0: 20 72 75 6e 70 61 74 68 29 0a 09 09 20 20 20 20   runpath)...    
92d0: 20 20 20 3b 3b 20 09 20 28 73 79 73 74 65 6d 20     ;; . (system 
92e0: 28 63 6f 6e 63 20 22 72 6d 64 69 72 20 2d 70 20  (conc "rmdir -p 
92f0: 22 20 72 75 6e 70 61 74 68 29 29 29 29 0a 09 09  " runpath))))...
9300: 20 20 20 20 20 20 20 29 29 29 29 29 0a 09 20 29         ))))).. )
9310: 29 0a 20 20 20 20 20 72 75 6e 73 29 29 29 0a 0a  ).     runs)))..
9320: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ;;==============
9330: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9340: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9350: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9360: 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 75 74  ========.;; Rout
9370: 69 6e 65 73 20 66 6f 72 20 6d 61 6e 69 70 75 6c  ines for manipul
9380: 61 74 69 6e 67 20 72 75 6e 73 0a 3b 3b 3d 3d 3d  ating runs.;;===
9390: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
93a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
93b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
93c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
93d0: 3d 3d 3d 0a 0a 3b 3b 20 53 69 6e 63 65 20 6d 61  ===..;; Since ma
93e0: 6e 79 20 63 61 6c 6c 73 20 74 6f 20 61 20 72 75  ny calls to a ru
93f0: 6e 20 72 65 71 75 69 72 65 20 70 72 65 74 74 79  n require pretty
9400: 20 6d 75 63 68 20 74 68 65 20 73 61 6d 65 20 73   much the same s
9410: 65 74 75 70 20 0a 3b 3b 20 74 68 69 73 20 77 72  etup .;; this wr
9420: 61 70 70 65 72 20 69 73 20 75 73 65 64 20 74 6f  apper is used to
9430: 20 72 65 64 75 63 65 20 74 68 65 20 72 65 70 6c   reduce the repl
9440: 69 63 61 74 69 6f 6e 20 6f 66 20 63 6f 64 65 0a  ication of code.
9450: 28 64 65 66 69 6e 65 20 28 67 65 6e 65 72 61 6c  (define (general
9460: 2d 72 75 6e 2d 63 61 6c 6c 20 73 77 69 74 63 68  -run-call switch
9470: 6e 61 6d 65 20 61 63 74 69 6f 6e 2d 64 65 73 63  name action-desc
9480: 20 70 72 6f 63 29 0a 20 20 28 6c 65 74 20 28 28   proc).  (let ((
9490: 72 75 6e 6e 61 6d 65 20 28 61 72 67 73 3a 67 65  runname (args:ge
94a0: 74 2d 61 72 67 20 22 3a 72 75 6e 6e 61 6d 65 22  t-arg ":runname"
94b0: 29 29 0a 09 28 74 61 72 67 65 74 20 20 28 69 66  ))..(target  (if
94c0: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
94d0: 2d 74 61 72 67 65 74 22 29 0a 09 09 20 20 20 20  -target")...    
94e0: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
94f0: 2d 74 61 72 67 65 74 22 29 0a 09 09 20 20 20 20  -target")...    
9500: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
9510: 2d 72 65 71 74 61 72 67 22 29 29 29 0a 09 28 74  -reqtarg")))..(t
9520: 68 31 20 20 20 20 20 23 66 29 29 0a 20 20 20 20  h1     #f)).    
9530: 28 63 6f 6e 64 0a 20 20 20 20 20 28 28 6e 6f 74  (cond.     ((not
9540: 20 74 61 72 67 65 74 29 0a 20 20 20 20 20 20 28   target).      (
9550: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45  debug:print 0 "E
9560: 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67 20 72 65  RROR: Missing re
9570: 71 75 69 72 65 64 20 70 61 72 61 6d 65 74 65 72  quired parameter
9580: 20 66 6f 72 20 22 20 73 77 69 74 63 68 6e 61 6d   for " switchnam
9590: 65 20 22 2c 20 79 6f 75 20 6d 75 73 74 20 73 70  e ", you must sp
95a0: 65 63 69 66 79 20 74 68 65 20 74 61 72 67 65 74  ecify the target
95b0: 20 77 69 74 68 20 2d 74 61 72 67 65 74 22 29 0a   with -target").
95c0: 20 20 20 20 20 20 28 65 78 69 74 20 33 29 29 0a        (exit 3)).
95d0: 20 20 20 20 20 28 28 6e 6f 74 20 72 75 6e 6e 61       ((not runna
95e0: 6d 65 29 0a 20 20 20 20 20 20 28 64 65 62 75 67  me).      (debug
95f0: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a  :print 0 "ERROR:
9600: 20 4d 69 73 73 69 6e 67 20 72 65 71 75 69 72 65   Missing require
9610: 64 20 70 61 72 61 6d 65 74 65 72 20 66 6f 72 20  d parameter for 
9620: 22 20 73 77 69 74 63 68 6e 61 6d 65 20 22 2c 20  " switchname ", 
9630: 79 6f 75 20 6d 75 73 74 20 73 70 65 63 69 66 79  you must specify
9640: 20 74 68 65 20 72 75 6e 20 6e 61 6d 65 20 77 69   the run name wi
9650: 74 68 20 3a 72 75 6e 6e 61 6d 65 20 72 75 6e 6e  th :runname runn
9660: 61 6d 65 22 29 0a 20 20 20 20 20 20 28 65 78 69  ame").      (exi
9670: 74 20 33 29 29 0a 20 20 20 20 20 28 65 6c 73 65  t 3)).     (else
9680: 0a 20 20 20 20 20 20 28 6c 65 74 20 28 28 64 62  .      (let ((db
9690: 20 20 20 23 66 29 0a 09 20 20 20 20 28 6b 65 79     #f)..    (key
96a0: 73 20 23 66 29 29 0a 09 28 69 66 20 28 6e 6f 74  s #f))..(if (not
96b0: 20 28 73 65 74 75 70 2d 66 6f 72 2d 72 75 6e 29   (setup-for-run)
96c0: 29 0a 09 20 20 20 20 28 62 65 67 69 6e 20 0a 09  )..    (begin ..
96d0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69        (debug:pri
96e0: 6e 74 20 30 20 22 46 61 69 6c 65 64 20 74 6f 20  nt 0 "Failed to 
96f0: 73 65 74 75 70 2c 20 65 78 69 74 69 6e 67 22 29  setup, exiting")
9700: 0a 09 20 20 20 20 20 20 28 65 78 69 74 20 31 29  ..      (exit 1)
9710: 29 29 0a 09 28 69 66 20 28 61 72 67 73 3a 67 65  ))..(if (args:ge
9720: 74 2d 61 72 67 20 22 2d 73 65 72 76 65 72 22 29  t-arg "-server")
9730: 0a 09 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d  ..    (open-run-
9740: 63 6c 6f 73 65 20 73 65 72 76 65 72 3a 73 74 61  close server:sta
9750: 72 74 20 64 62 20 28 61 72 67 73 3a 67 65 74 2d  rt db (args:get-
9760: 61 72 67 20 22 2d 73 65 72 76 65 72 22 29 29 0a  arg "-server")).
9770: 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6f  .    (if (not (o
9780: 72 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20  r (args:get-arg 
9790: 22 2d 72 75 6e 61 6c 6c 22 29 20 20 20 20 20 3b  "-runall")     ;
97a0: 3b 20 72 75 6e 61 6c 6c 20 61 6e 64 20 72 75 6e  ; runall and run
97b0: 74 65 73 74 73 20 61 72 65 20 61 6c 6c 6f 77 65  tests are allowe
97c0: 64 20 74 6f 20 62 65 20 73 65 72 76 65 72 73 0a  d to be servers.
97d0: 09 09 09 20 28 61 72 67 73 3a 67 65 74 2d 61 72  ... (args:get-ar
97e0: 67 20 22 2d 72 75 6e 74 65 73 74 73 22 29 29 29  g "-runtests")))
97f0: 0a 09 09 28 73 65 72 76 65 72 3a 63 6c 69 65 6e  ...(server:clien
9800: 74 2d 73 65 74 75 70 29 29 29 0a 09 28 73 65 74  t-setup)))..(set
9810: 21 20 6b 65 79 73 20 28 6f 70 65 6e 2d 72 75 6e  ! keys (open-run
9820: 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 6b 65  -close db:get-ke
9830: 79 73 20 64 62 29 29 0a 09 3b 3b 20 68 61 76 65  ys db))..;; have
9840: 20 65 6e 6f 75 67 68 20 74 6f 20 70 72 6f 63 65   enough to proce
9850: 73 73 20 2d 74 61 72 67 65 74 20 6f 72 20 2d 72  ss -target or -r
9860: 65 71 74 61 72 67 20 68 65 72 65 0a 09 28 69 66  eqtarg here..(if
9870: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
9880: 2d 72 65 71 74 61 72 67 22 29 0a 09 20 20 20 20  -reqtarg")..    
9890: 28 6c 65 74 2a 20 28 28 72 75 6e 63 6f 6e 66 69  (let* ((runconfi
98a0: 67 66 20 28 63 6f 6e 63 20 20 2a 74 6f 70 70 61  gf (conc  *toppa
98b0: 74 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 69 67 73  th* "/runconfigs
98c0: 2e 63 6f 6e 66 69 67 22 29 29 20 3b 3b 20 44 4f  .config")) ;; DO
98d0: 20 4e 4f 54 20 45 56 41 4c 55 41 54 45 20 41 4c   NOT EVALUATE AL
98e0: 4c 20 0a 09 09 20 20 20 28 72 75 6e 63 6f 6e 66  L ...   (runconf
98f0: 69 67 20 20 28 72 65 61 64 2d 63 6f 6e 66 69 67  ig  (read-config
9900: 20 72 75 6e 63 6f 6e 66 69 67 66 20 23 66 20 23   runconfigf #f #
9910: 66 20 65 6e 76 69 72 6f 6e 2d 70 61 74 74 3a 20  f environ-patt: 
9920: 23 66 29 29 29 20 0a 09 20 20 20 20 20 20 28 69  #f))) ..      (i
9930: 66 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65  f (hash-table-re
9940: 66 2f 64 65 66 61 75 6c 74 20 72 75 6e 63 6f 6e  f/default runcon
9950: 66 69 67 20 28 61 72 67 73 3a 67 65 74 2d 61 72  fig (args:get-ar
9960: 67 20 22 2d 72 65 71 74 61 72 67 22 29 20 23 66  g "-reqtarg") #f
9970: 29 0a 09 09 20 20 28 6b 65 79 73 3a 74 61 72 67  )...  (keys:targ
9980: 65 74 2d 73 65 74 2d 61 72 67 73 20 6b 65 79 73  et-set-args keys
9990: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22   (args:get-arg "
99a0: 2d 72 65 71 74 61 72 67 22 29 20 61 72 67 73 3a  -reqtarg") args:
99b0: 61 72 67 2d 68 61 73 68 29 0a 09 09 20 20 28 62  arg-hash)...  (b
99c0: 65 67 69 6e 0a 09 09 20 20 20 20 28 64 65 62 75  egin...    (debu
99d0: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52  g:print 0 "ERROR
99e0: 3a 20 5b 22 20 28 61 72 67 73 3a 67 65 74 2d 61  : [" (args:get-a
99f0: 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 20 22  rg "-reqtarg") "
9a00: 5d 20 6e 6f 74 20 66 6f 75 6e 64 20 69 6e 20 22  ] not found in "
9a10: 20 72 75 6e 63 6f 6e 66 69 67 66 29 0a 09 09 20   runconfigf)... 
9a20: 20 20 20 28 69 66 20 64 62 20 28 73 71 6c 69 74     (if db (sqlit
9a30: 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 29  e3:finalize! db)
9a40: 29 0a 09 09 20 20 20 20 28 65 78 69 74 20 31 29  )...    (exit 1)
9a50: 29 29 29 0a 09 20 20 20 20 28 69 66 20 28 61 72  )))..    (if (ar
9a60: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72  gs:get-arg "-tar
9a70: 67 65 74 22 29 0a 09 09 28 6b 65 79 73 3a 74 61  get")...(keys:ta
9a80: 72 67 65 74 2d 73 65 74 2d 61 72 67 73 20 6b 65  rget-set-args ke
9a90: 79 73 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67  ys (args:get-arg
9aa0: 20 22 2d 74 61 72 67 65 74 22 20 61 72 67 73 3a   "-target" args:
9ab0: 61 72 67 2d 68 61 73 68 29 20 61 72 67 73 3a 61  arg-hash) args:a
9ac0: 72 67 2d 68 61 73 68 29 29 29 0a 09 28 69 66 20  rg-hash)))..(if 
9ad0: 28 6e 6f 74 20 28 63 61 72 20 2a 63 6f 6e 66 69  (not (car *confi
9ae0: 67 69 6e 66 6f 2a 29 29 0a 09 20 20 20 20 28 62  ginfo*))..    (b
9af0: 65 67 69 6e 0a 09 20 20 20 20 20 20 28 64 65 62  egin..      (deb
9b00: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f  ug:print 0 "ERRO
9b10: 52 3a 20 41 74 74 65 6d 70 74 65 64 20 74 6f 20  R: Attempted to 
9b20: 22 20 61 63 74 69 6f 6e 2d 64 65 73 63 20 22 20  " action-desc " 
9b30: 62 75 74 20 72 75 6e 20 61 72 65 61 20 63 6f 6e  but run area con
9b40: 66 69 67 20 66 69 6c 65 20 6e 6f 74 20 66 6f 75  fig file not fou
9b50: 6e 64 22 29 0a 09 20 20 20 20 20 20 28 65 78 69  nd")..      (exi
9b60: 74 20 31 29 29 0a 09 20 20 20 20 3b 3b 20 45 78  t 1))..    ;; Ex
9b70: 74 72 61 63 74 20 6f 75 74 20 73 74 75 66 66 20  tract out stuff 
9b80: 6e 65 65 64 65 64 20 69 6e 20 6d 6f 73 74 20 6f  needed in most o
9b90: 72 20 6d 61 6e 79 20 63 61 6c 6c 73 0a 09 20 20  r many calls..  
9ba0: 20 20 3b 3b 20 68 65 72 65 20 74 68 65 6e 20 63    ;; here then c
9bb0: 61 6c 6c 20 70 72 6f 63 0a 09 20 20 20 20 28 6c  all proc..    (l
9bc0: 65 74 2a 20 28 28 6b 65 79 6e 61 6d 65 73 20 20  et* ((keynames  
9bd0: 20 28 6d 61 70 20 6b 65 79 3a 67 65 74 2d 66 69   (map key:get-fi
9be0: 65 6c 64 6e 61 6d 65 20 6b 65 79 73 29 29 0a 09  eldname keys))..
9bf0: 09 20 20 20 28 6b 65 79 76 61 6c 6c 73 74 20 20  .   (keyvallst  
9c00: 28 6b 65 79 73 2d 3e 76 61 6c 6c 69 73 74 20 6b  (keys->vallist k
9c10: 65 79 73 20 23 74 29 29 29 0a 09 20 20 20 20 20  eys #t)))..     
9c20: 20 28 70 72 6f 63 20 74 61 72 67 65 74 20 72 75   (proc target ru
9c30: 6e 6e 61 6d 65 20 6b 65 79 73 20 6b 65 79 6e 61  nname keys keyna
9c40: 6d 65 73 20 6b 65 79 76 61 6c 6c 73 74 29 29 29  mes keyvallst)))
9c50: 0a 09 28 69 66 20 74 68 31 20 28 74 68 72 65 61  ..(if th1 (threa
9c60: 64 2d 6a 6f 69 6e 21 20 74 68 31 29 29 0a 09 28  d-join! th1))..(
9c70: 69 66 20 64 62 20 28 73 71 6c 69 74 65 33 3a 66  if db (sqlite3:f
9c80: 69 6e 61 6c 69 7a 65 21 20 64 62 29 29 0a 09 28  inalize! db))..(
9c90: 73 65 74 21 20 2a 64 69 64 73 6f 6d 65 74 68 69  set! *didsomethi
9ca0: 6e 67 2a 20 23 74 29 29 29 29 29 29 0a 0a 3b 3b  ng* #t))))))..;;
9cb0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9cc0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9cd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9ce0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9cf0: 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4c 6f 63 6b 2f 75  ======.;; Lock/u
9d00: 6e 6c 6f 63 6b 20 72 75 6e 73 0a 3b 3b 3d 3d 3d  nlock runs.;;===
9d10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9d20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9d30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9d40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9d50: 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65 20 28 72 75  ===..(define (ru
9d60: 6e 73 3a 68 61 6e 64 6c 65 2d 6c 6f 63 6b 69 6e  ns:handle-lockin
9d70: 67 20 74 61 72 67 65 74 20 6b 65 79 73 20 72 75  g target keys ru
9d80: 6e 6e 61 6d 65 20 6c 6f 63 6b 20 75 6e 6c 6f 63  nname lock unloc
9d90: 6b 20 75 73 65 72 29 0a 20 20 28 6c 65 74 2a 20  k user).  (let* 
9da0: 28 28 64 62 20 20 20 20 20 20 20 23 66 29 0a 09  ((db       #f)..
9db0: 20 28 72 75 6e 64 61 74 20 20 20 28 6f 70 65 6e   (rundat   (open
9dc0: 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 3a  -run-close runs:
9dd0: 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74 74  get-runs-by-patt
9de0: 20 64 62 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65   db keys runname
9df0: 29 29 0a 09 20 28 68 65 61 64 65 72 20 20 20 28  )).. (header   (
9e00: 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61  vector-ref runda
9e10: 74 20 30 29 29 0a 09 20 28 72 75 6e 73 20 20 20  t 0)).. (runs   
9e20: 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75    (vector-ref ru
9e30: 6e 64 61 74 20 31 29 29 29 0a 20 20 20 20 28 66  ndat 1))).    (f
9e40: 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 61 20  or-each (lambda 
9e50: 28 72 75 6e 29 0a 09 09 28 6c 65 74 20 28 28 72  (run)...(let ((r
9e60: 75 6e 2d 69 64 20 28 64 62 3a 67 65 74 2d 76 61  un-id (db:get-va
9e70: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75  lue-by-header ru
9e80: 6e 20 68 65 61 64 65 72 20 22 69 64 22 29 29 29  n header "id")))
9e90: 0a 09 09 20 20 28 69 66 20 28 6f 72 20 6c 6f 63  ...  (if (or loc
9ea0: 6b 0a 09 09 09 20 20 28 61 6e 64 20 75 6e 6c 6f  k....  (and unlo
9eb0: 63 6b 0a 09 09 09 20 20 20 20 20 20 20 28 62 65  ck....       (be
9ec0: 67 69 6e 0a 09 09 09 09 20 28 70 72 69 6e 74 20  gin..... (print 
9ed0: 22 44 6f 20 79 6f 75 20 72 65 61 6c 6c 79 20 77  "Do you really w
9ee0: 69 73 68 20 74 6f 20 75 6e 6c 6f 63 6b 20 72 75  ish to unlock ru
9ef0: 6e 20 22 20 72 75 6e 2d 69 64 20 22 3f 5c 6e 20  n " run-id "?\n 
9f00: 20 20 79 2f 6e 3a 20 22 29 0a 09 09 09 09 20 28    y/n: ")..... (
9f10: 65 71 75 61 6c 3f 20 22 79 22 20 28 72 65 61 64  equal? "y" (read
9f20: 2d 6c 69 6e 65 29 29 29 29 29 0a 09 09 20 20 20  -line)))))...   
9f30: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f     (open-run-clo
9f40: 73 65 20 64 62 3a 6c 6f 63 6b 2f 75 6e 6c 6f 63  se db:lock/unloc
9f50: 6b 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 20  k-run db run-id 
9f60: 6c 6f 63 6b 20 75 6e 6c 6f 63 6b 20 75 73 65 72  lock unlock user
9f70: 29 0a 09 09 20 20 20 20 20 20 28 64 65 62 75 67  )...      (debug
9f80: 3a 70 72 69 6e 74 20 30 20 22 49 4e 46 4f 3a 20  :print 0 "INFO: 
9f90: 53 6b 69 70 70 69 6e 67 20 6c 6f 63 6b 2f 75 6e  Skipping lock/un
9fa0: 6c 6f 63 6b 20 6f 6e 20 22 20 72 75 6e 2d 69 64  lock on " run-id
9fb0: 29 29 29 29 0a 09 20 20 20 20 20 20 72 75 6e 73  ))))..      runs
9fc0: 29 29 29 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ))).;;==========
9fd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9fe0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
9ff0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a000: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20  ============.;; 
a010: 52 6f 6c 6c 75 70 20 72 75 6e 73 0a 3b 3b 3d 3d  Rollup runs.;;==
a020: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a030: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a040: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a050: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
a060: 3d 3d 3d 3d 0a 0a 3b 3b 20 55 70 64 61 74 65 20  ====..;; Update 
a070: 74 68 65 20 74 65 73 74 5f 6d 65 74 61 20 74 61  the test_meta ta
a080: 62 6c 65 20 66 6f 72 20 74 68 69 73 20 74 65 73  ble for this tes
a090: 74 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a  t.(define (runs:
a0a0: 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 61  update-test_meta
a0b0: 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 65   db test-name te
a0c0: 73 74 2d 63 6f 6e 66 29 0a 20 20 28 6c 65 74 20  st-conf).  (let 
a0d0: 28 28 63 75 72 72 72 65 63 6f 72 64 20 28 6f 70  ((currrecord (op
a0e0: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a  en-run-close db:
a0f0: 74 65 73 74 6d 65 74 61 2d 67 65 74 2d 72 65 63  testmeta-get-rec
a100: 6f 72 64 20 64 62 20 74 65 73 74 2d 6e 61 6d 65  ord db test-name
a110: 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74  ))).    (if (not
a120: 20 63 75 72 72 72 65 63 6f 72 64 29 0a 09 28 62   currrecord)..(b
a130: 65 67 69 6e 0a 09 20 20 28 73 65 74 21 20 63 75  egin..  (set! cu
a140: 72 72 72 65 63 6f 72 64 20 28 6d 61 6b 65 2d 76  rrrecord (make-v
a150: 65 63 74 6f 72 20 31 30 20 23 66 29 29 0a 09 20  ector 10 #f)).. 
a160: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
a170: 20 64 62 3a 74 65 73 74 6d 65 74 61 2d 61 64 64   db:testmeta-add
a180: 2d 72 65 63 6f 72 64 20 64 62 20 74 65 73 74 2d  -record db test-
a190: 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 66 6f 72  name))).    (for
a1a0: 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d  -each .     (lam
a1b0: 62 64 61 20 28 6b 65 79 29 0a 20 20 20 20 20 20  bda (key).      
a1c0: 20 28 6c 65 74 2a 20 28 28 69 64 78 20 28 63 61   (let* ((idx (ca
a1d0: 64 72 20 6b 65 79 29 29 0a 09 20 20 20 20 20 20  dr key))..      
a1e0: 28 66 6c 64 20 28 63 61 72 20 20 6b 65 79 29 29  (fld (car  key))
a1f0: 0a 09 20 20 20 20 20 20 28 76 61 6c 20 28 63 6f  ..      (val (co
a200: 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 65 73 74  nfig-lookup test
a210: 2d 63 6f 6e 66 20 22 74 65 73 74 5f 6d 65 74 61  -conf "test_meta
a220: 22 20 66 6c 64 29 29 29 0a 09 20 3b 3b 20 28 64  " fld))).. ;; (d
a230: 65 62 75 67 3a 70 72 69 6e 74 20 35 20 22 69 64  ebug:print 5 "id
a240: 78 3a 20 22 20 69 64 78 20 22 20 66 6c 64 3a 20  x: " idx " fld: 
a250: 22 20 66 6c 64 20 22 20 76 61 6c 3a 20 22 20 76  " fld " val: " v
a260: 61 6c 29 0a 09 20 28 69 66 20 28 61 6e 64 20 76  al).. (if (and v
a270: 61 6c 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20  al (not (equal? 
a280: 28 76 65 63 74 6f 72 2d 72 65 66 20 63 75 72 72  (vector-ref curr
a290: 72 65 63 6f 72 64 20 69 64 78 29 20 76 61 6c 29  record idx) val)
a2a0: 29 29 0a 09 20 20 20 20 20 28 62 65 67 69 6e 0a  ))..     (begin.
a2b0: 09 20 20 20 20 20 20 20 28 70 72 69 6e 74 20 22  .       (print "
a2c0: 55 70 64 61 74 69 6e 67 20 22 20 74 65 73 74 2d  Updating " test-
a2d0: 6e 61 6d 65 20 22 20 22 20 66 6c 64 20 22 20 74  name " " fld " t
a2e0: 6f 20 22 20 76 61 6c 29 0a 09 20 20 20 20 20 20  o " val)..      
a2f0: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65   (open-run-close
a300: 20 64 62 3a 74 65 73 74 6d 65 74 61 2d 75 70 64   db:testmeta-upd
a310: 61 74 65 2d 66 69 65 6c 64 20 64 62 20 74 65 73  ate-field db tes
a320: 74 2d 6e 61 6d 65 20 66 6c 64 20 76 61 6c 29 29  t-name fld val))
a330: 29 29 29 0a 20 20 20 20 20 27 28 28 22 61 75 74  ))).     '(("aut
a340: 68 6f 72 22 20 32 29 28 22 6f 77 6e 65 72 22 20  hor" 2)("owner" 
a350: 33 29 28 22 64 65 73 63 72 69 70 74 69 6f 6e 22  3)("description"
a360: 20 34 29 28 22 72 65 76 69 65 77 65 64 22 20 35   4)("reviewed" 5
a370: 29 28 22 74 61 67 73 22 20 39 29 29 29 29 29 0a  )("tags" 9))))).
a380: 0a 3b 3b 20 55 70 64 61 74 65 20 74 65 73 74 5f  .;; Update test_
a390: 6d 65 74 61 20 66 6f 72 20 61 6c 6c 20 74 65 73  meta for all tes
a3a0: 74 73 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73  ts.(define (runs
a3b0: 3a 75 70 64 61 74 65 2d 61 6c 6c 2d 74 65 73 74  :update-all-test
a3c0: 5f 6d 65 74 61 20 64 62 29 0a 20 20 28 6c 65 74  _meta db).  (let
a3d0: 20 28 28 74 65 73 74 2d 6e 61 6d 65 73 20 28 67   ((test-names (g
a3e0: 65 74 2d 61 6c 6c 2d 6c 65 67 61 6c 2d 74 65 73  et-all-legal-tes
a3f0: 74 73 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65  ts))).    (for-e
a400: 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64  ach .     (lambd
a410: 61 20 28 74 65 73 74 2d 6e 61 6d 65 29 0a 20 20  a (test-name).  
a420: 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73       (let* ((tes
a430: 74 2d 70 61 74 68 20 20 20 20 28 63 6f 6e 63 20  t-path    (conc 
a440: 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74  *toppath* "/test
a450: 73 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29 29 0a  s/" test-name)).
a460: 09 20 20 20 20 20 20 28 74 65 73 74 2d 63 6f 6e  .      (test-con
a470: 66 69 67 66 20 28 63 6f 6e 63 20 74 65 73 74 2d  figf (conc test-
a480: 70 61 74 68 20 22 2f 74 65 73 74 63 6f 6e 66 69  path "/testconfi
a490: 67 22 29 29 0a 09 20 20 20 20 20 20 28 74 65 73  g"))..      (tes
a4a0: 74 65 78 69 73 74 73 20 20 20 28 61 6e 64 20 28  texists   (and (
a4b0: 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 74 65 73  file-exists? tes
a4c0: 74 2d 63 6f 6e 66 69 67 66 29 28 66 69 6c 65 2d  t-configf)(file-
a4d0: 72 65 61 64 2d 61 63 63 65 73 73 3f 20 74 65 73  read-access? tes
a4e0: 74 2d 63 6f 6e 66 69 67 66 29 29 29 0a 09 20 20  t-configf)))..  
a4f0: 20 20 20 20 3b 3b 20 72 65 61 64 20 63 6f 6e 66      ;; read conf
a500: 69 67 73 20 77 69 74 68 20 74 72 69 63 6b 73 20  igs with tricks 
a510: 74 75 72 6e 65 64 20 6f 66 66 20 28 69 2e 65 2e  turned off (i.e.
a520: 20 6e 6f 20 73 79 73 74 65 6d 29 0a 09 20 20 20   no system)..   
a530: 20 20 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 20     (test-conf   
a540: 20 28 69 66 20 74 65 73 74 65 78 69 73 74 73 20   (if testexists 
a550: 28 72 65 61 64 2d 63 6f 6e 66 69 67 20 74 65 73  (read-config tes
a560: 74 2d 63 6f 6e 66 69 67 66 20 23 66 20 23 66 29  t-configf #f #f)
a570: 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65  (make-hash-table
a580: 29 29 29 29 0a 09 20 3b 3b 20 75 73 65 20 74 68  )))).. ;; use th
a590: 65 20 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65  e open-run-close
a5a0: 20 69 6e 73 74 65 61 64 20 6f 66 20 70 61 73 73   instead of pass
a5b0: 69 6e 67 20 69 6e 20 64 62 0a 09 20 28 72 75 6e  ing in db.. (run
a5c0: 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65  s:update-test_me
a5d0: 74 61 20 23 66 20 74 65 73 74 2d 6e 61 6d 65 20  ta #f test-name 
a5e0: 74 65 73 74 2d 63 6f 6e 66 29 29 29 0a 20 20 20  test-conf))).   
a5f0: 20 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a    test-names))).
a600: 0a 3b 3b 20 54 68 69 73 20 63 6f 75 6c 64 20 70  .;; This could p
a610: 72 6f 62 61 62 6c 79 20 62 65 20 72 65 66 61 63  robably be refac
a620: 74 6f 72 65 64 20 69 6e 74 6f 20 6f 6e 65 20 63  tored into one c
a630: 6f 6d 70 6c 65 78 20 71 75 65 72 79 20 2e 2e 2e  omplex query ...
a640: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 72  .(define (runs:r
a650: 6f 6c 6c 75 70 2d 72 75 6e 20 6b 65 79 73 20 6b  ollup-run keys k
a660: 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65  eyvallst runname
a670: 20 75 73 65 72 29 20 3b 3b 20 77 61 73 20 74 61   user) ;; was ta
a680: 72 67 65 74 2c 20 6e 6f 77 20 6b 65 79 76 61 6c  rget, now keyval
a690: 6c 73 74 0a 20 20 28 64 65 62 75 67 3a 70 72 69  lst.  (debug:pri
a6a0: 6e 74 20 34 20 22 72 75 6e 73 3a 72 6f 6c 6c 75  nt 4 "runs:rollu
a6b0: 70 2d 72 75 6e 2c 20 6b 65 79 73 3a 20 22 20 6b  p-run, keys: " k
a6c0: 65 79 73 20 22 20 6b 65 79 76 61 6c 6c 73 74 3a  eys " keyvallst:
a6d0: 20 22 20 6b 65 79 76 61 6c 6c 73 74 20 22 20 3a   " keyvallst " :
a6e0: 72 75 6e 6e 61 6d 65 20 22 20 72 75 6e 6e 61 6d  runname " runnam
a6f0: 65 20 22 20 75 73 65 72 3a 20 22 20 75 73 65 72  e " user: " user
a700: 29 0a 20 20 28 6c 65 74 2a 20 28 28 64 62 20 20  ).  (let* ((db  
a710: 20 20 20 20 20 20 20 20 20 20 20 20 23 66 29 20              #f) 
a720: 3b 3b 20 28 6b 65 79 76 61 6c 6c 6c 73 74 20 20  ;; (keyvalllst  
a730: 20 20 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74      (keys:target
a740: 2d 3e 6b 65 79 76 61 6c 20 6b 65 79 73 20 74 61  ->keyval keys ta
a750: 72 67 65 74 29 29 0a 09 20 28 6e 65 77 2d 72 75  rget)).. (new-ru
a760: 6e 2d 69 64 20 20 20 20 20 20 28 6f 70 65 6e 2d  n-id      (open-
a770: 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 3a 72  run-close runs:r
a780: 65 67 69 73 74 65 72 2d 72 75 6e 20 64 62 20 6b  egister-run db k
a790: 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75  eys keyvallst ru
a7a0: 6e 6e 61 6d 65 20 22 6e 65 77 22 20 22 6e 2f 61  nname "new" "n/a
a7b0: 22 20 75 73 65 72 29 29 0a 09 20 28 70 72 65 76  " user)).. (prev
a7c0: 2d 74 65 73 74 73 20 20 20 20 20 20 28 6f 70 65  -tests      (ope
a7d0: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 74 65 73 74  n-run-close test
a7e0: 3a 67 65 74 2d 6d 61 74 63 68 69 6e 67 2d 70 72  :get-matching-pr
a7f0: 65 76 69 6f 75 73 2d 74 65 73 74 2d 72 75 6e 2d  evious-test-run-
a800: 72 65 63 6f 72 64 73 20 64 62 20 6e 65 77 2d 72  records db new-r
a810: 75 6e 2d 69 64 20 22 25 22 20 22 25 22 29 29 0a  un-id "%" "%")).
a820: 09 20 28 63 75 72 72 2d 74 65 73 74 73 20 20 20  . (curr-tests   
a830: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f     (open-run-clo
a840: 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 73 2d  se db:get-tests-
a850: 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77 2d 72  for-run db new-r
a860: 75 6e 2d 69 64 20 22 25 22 20 22 25 22 20 27 28  un-id "%" "%" '(
a870: 29 20 27 28 29 29 29 0a 09 20 28 63 75 72 72 2d  ) '())).. (curr-
a880: 74 65 73 74 73 2d 68 61 73 68 20 28 6d 61 6b 65  tests-hash (make
a890: 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 20  -hash-table))). 
a8a0: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f     (open-run-clo
a8b0: 73 65 20 64 62 3a 75 70 64 61 74 65 2d 72 75 6e  se db:update-run
a8c0: 2d 65 76 65 6e 74 5f 74 69 6d 65 20 64 62 20 6e  -event_time db n
a8d0: 65 77 2d 72 75 6e 2d 69 64 29 0a 20 20 20 20 3b  ew-run-id).    ;
a8e0: 3b 20 69 6e 64 65 78 20 74 68 65 20 61 6c 72 65  ; index the alre
a8f0: 61 64 79 20 73 61 76 65 64 20 74 65 73 74 73 20  ady saved tests 
a900: 62 79 20 74 65 73 74 6e 61 6d 65 20 61 6e 64 20  by testname and 
a910: 69 74 65 6d 64 61 74 20 69 6e 20 63 75 72 72 2d  itemdat in curr-
a920: 74 65 73 74 73 2d 68 61 73 68 0a 20 20 20 20 28  tests-hash.    (
a930: 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 28 6c  for-each.     (l
a940: 61 6d 62 64 61 20 28 74 65 73 74 64 61 74 29 0a  ambda (testdat).
a950: 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74         (let* ((t
a960: 65 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 65 73  estname  (db:tes
a970: 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74  t-get-testname t
a980: 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20  estdat))..      
a990: 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74  (item-path (db:t
a9a0: 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74  est-get-item-pat
a9b0: 68 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20  h testdat))..   
a9c0: 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 63     (full-name (c
a9d0: 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22  onc testname "/"
a9e0: 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 09 20   item-path))).. 
a9f0: 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21  (hash-table-set!
aa00: 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68   curr-tests-hash
aa10: 20 66 75 6c 6c 2d 6e 61 6d 65 20 74 65 73 74 64   full-name testd
aa20: 61 74 29 29 29 0a 20 20 20 20 20 63 75 72 72 2d  at))).     curr-
aa30: 74 65 73 74 73 29 0a 20 20 20 20 3b 3b 20 4e 4f  tests).    ;; NO
aa40: 50 45 3a 20 4e 6f 6e 2d 6f 70 74 69 6d 61 6c 20  PE: Non-optimal 
aa50: 61 70 70 72 6f 61 63 68 2e 20 54 72 79 20 74 68  approach. Try th
aa60: 69 73 20 69 6e 73 74 65 61 64 2e 0a 20 20 20 20  is instead..    
aa70: 3b 3b 20 20 20 31 2e 20 74 65 73 74 73 20 61 72  ;;   1. tests ar
aa80: 65 20 72 65 63 65 69 76 65 64 20 69 6e 20 61 20  e received in a 
aa90: 6c 69 73 74 2c 20 6d 6f 73 74 20 72 65 63 65 6e  list, most recen
aaa0: 74 20 66 69 72 73 74 0a 20 20 20 20 3b 3b 20 20  t first.    ;;  
aab0: 20 32 2e 20 72 65 70 6c 61 63 65 20 74 68 65 20   2. replace the 
aac0: 72 6f 6c 6c 75 70 20 74 65 73 74 20 77 69 74 68  rollup test with
aad0: 20 74 68 65 20 6e 65 77 20 2a 61 6c 77 61 79 73   the new *always
aae0: 2a 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20  *.    (for-each 
aaf0: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74  .     (lambda (t
ab00: 65 73 74 64 61 74 29 0a 20 20 20 20 20 20 20 28  estdat).       (
ab10: 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 20  let* ((testname 
ab20: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65   (db:test-get-te
ab30: 73 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29  stname testdat))
ab40: 0a 09 20 20 20 20 20 20 28 69 74 65 6d 2d 70 61  ..      (item-pa
ab50: 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  th (db:test-get-
ab60: 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 64 61  item-path testda
ab70: 74 29 29 0a 09 20 20 20 20 20 20 28 66 75 6c 6c  t))..      (full
ab80: 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74  -name (conc test
ab90: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61  name "/" item-pa
aba0: 74 68 29 29 0a 09 20 20 20 20 20 20 28 70 72 65  th))..      (pre
abb0: 76 2d 74 65 73 74 2d 64 61 74 20 28 68 61 73 68  v-test-dat (hash
abc0: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75  -table-ref/defau
abd0: 6c 74 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61  lt curr-tests-ha
abe0: 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 23 66 29  sh full-name #f)
abf0: 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d 73  )..      (test-s
ac00: 74 65 70 73 20 20 20 20 20 20 28 6f 70 65 6e 2d  teps      (open-
ac10: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
ac20: 2d 73 74 65 70 73 2d 66 6f 72 2d 74 65 73 74 20  -steps-for-test 
ac30: 64 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  db (db:test-get-
ac40: 69 64 20 74 65 73 74 64 61 74 29 29 29 0a 09 20  id testdat))).. 
ac50: 20 20 20 20 20 28 6e 65 77 2d 74 65 73 74 2d 72       (new-test-r
ac60: 65 63 6f 72 64 20 23 66 29 29 0a 09 20 3b 3b 20  ecord #f)).. ;; 
ac70: 72 65 70 6c 61 63 65 20 74 68 65 73 65 20 77 69  replace these wi
ac80: 74 68 20 69 6e 73 65 72 74 20 2e 2e 2e 20 73 65  th insert ... se
ac90: 6c 65 63 74 0a 09 20 28 61 70 70 6c 79 20 73 71  lect.. (apply sq
aca0: 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09  lite3:execute ..
acb0: 09 64 62 20 0a 09 09 28 63 6f 6e 63 20 22 49 4e  .db ...(conc "IN
acc0: 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20  SERT OR REPLACE 
acd0: 49 4e 54 4f 20 74 65 73 74 73 20 28 72 75 6e 5f  INTO tests (run_
ace0: 69 64 2c 74 65 73 74 6e 61 6d 65 2c 73 74 61 74  id,testname,stat
acf0: 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74  e,status,event_t
ad00: 69 6d 65 2c 68 6f 73 74 2c 63 70 75 6c 6f 61 64  ime,host,cpuload
ad10: 2c 64 69 73 6b 66 72 65 65 2c 75 6e 61 6d 65 2c  ,diskfree,uname,
ad20: 72 75 6e 64 69 72 2c 69 74 65 6d 5f 70 61 74 68  rundir,item_path
ad30: 2c 72 75 6e 5f 64 75 72 61 74 69 6f 6e 2c 66 69  ,run_duration,fi
ad40: 6e 61 6c 5f 6c 6f 67 66 2c 63 6f 6d 6d 65 6e 74  nal_logf,comment
ad50: 29 20 22 0a 09 09 20 20 20 20 20 20 22 56 41 4c  ) "...      "VAL
ad60: 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f  UES (?,?,?,?,?,?
ad70: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f  ,?,?,?,?,?,?,?,?
ad80: 29 3b 22 29 0a 09 09 6e 65 77 2d 72 75 6e 2d 69  );")...new-run-i
ad90: 64 20 28 63 64 64 72 20 28 76 65 63 74 6f 72 2d  d (cddr (vector-
ada0: 3e 6c 69 73 74 20 74 65 73 74 64 61 74 29 29 29  >list testdat)))
adb0: 0a 09 20 28 73 65 74 21 20 6e 65 77 2d 74 65 73  .. (set! new-tes
adc0: 74 64 61 74 20 28 63 61 72 20 28 6f 70 65 6e 2d  tdat (car (open-
add0: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74  run-close db:get
ade0: 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64  -tests-for-run d
adf0: 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 74 65 73  b new-run-id tes
ae00: 74 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 20  tname item-path 
ae10: 27 28 29 20 27 28 29 29 29 29 0a 09 20 28 68 61  '() '()))).. (ha
ae20: 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 75  sh-table-set! cu
ae30: 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75  rr-tests-hash fu
ae40: 6c 6c 2d 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74  ll-name new-test
ae50: 64 61 74 29 20 3b 3b 20 74 68 69 73 20 63 6f 75  dat) ;; this cou
ae60: 6c 64 20 62 65 20 63 6f 6e 66 75 73 69 6e 67 2c  ld be confusing,
ae70: 20 77 68 69 63 68 20 72 65 63 6f 72 64 20 73 68   which record sh
ae80: 6f 75 6c 64 20 67 6f 20 69 6e 74 6f 20 74 68 65  ould go into the
ae90: 20 6c 6f 6f 6b 75 70 20 74 61 62 6c 65 3f 0a 09   lookup table?..
aea0: 20 3b 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61 74   ;; Now duplicat
aeb0: 65 20 74 68 65 20 74 65 73 74 20 73 74 65 70 73  e the test steps
aec0: 0a 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20  .. (debug:print 
aed0: 34 20 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 72  4 "Copying recor
aee0: 64 73 20 69 6e 20 74 65 73 74 5f 73 74 65 70 73  ds in test_steps
aef0: 20 66 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20   from test_id=" 
af00: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20  (db:test-get-id 
af10: 74 65 73 74 64 61 74 29 20 22 20 74 6f 20 22 20  testdat) " to " 
af20: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20  (db:test-get-id 
af30: 6e 65 77 2d 74 65 73 74 64 61 74 29 29 0a 09 20  new-testdat)).. 
af40: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20  (open-run-close 
af50: 0a 09 20 20 28 6c 61 6d 62 64 61 20 28 29 0a 09  ..  (lambda ()..
af60: 20 20 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65      (sqlite3:exe
af70: 63 75 74 65 20 0a 09 20 20 20 20 20 64 62 20 0a  cute ..     db .
af80: 09 20 20 20 20 20 28 63 6f 6e 63 20 22 49 4e 53  .     (conc "INS
af90: 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49  ERT OR REPLACE I
afa0: 4e 54 4f 20 74 65 73 74 5f 73 74 65 70 73 20 28  NTO test_steps (
afb0: 74 65 73 74 5f 69 64 2c 73 74 65 70 6e 61 6d 65  test_id,stepname
afc0: 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c 65 76  ,state,status,ev
afd0: 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74  ent_time,comment
afe0: 29 20 22 0a 09 09 20 20 20 22 53 45 4c 45 43 54  ) "...   "SELECT
aff0: 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d   " (db:test-get-
b000: 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20  id new-testdat) 
b010: 22 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 74 65  ",stepname,state
b020: 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69  ,status,event_ti
b030: 6d 65 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20  me,comment FROM 
b040: 74 65 73 74 5f 73 74 65 70 73 20 57 48 45 52 45  test_steps WHERE
b050: 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20   test_id=?;").. 
b060: 20 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74      (db:test-get
b070: 2d 69 64 20 74 65 73 74 64 61 74 29 29 0a 09 20  -id testdat)).. 
b080: 20 20 20 3b 3b 20 4e 6f 77 20 64 75 70 6c 69 63     ;; Now duplic
b090: 61 74 65 20 74 68 65 20 74 65 73 74 20 64 61 74  ate the test dat
b0a0: 61 0a 09 20 20 20 20 28 64 65 62 75 67 3a 70 72  a..    (debug:pr
b0b0: 69 6e 74 20 34 20 22 43 6f 70 79 69 6e 67 20 72  int 4 "Copying r
b0c0: 65 63 6f 72 64 73 20 69 6e 20 74 65 73 74 5f 64  ecords in test_d
b0d0: 61 74 61 20 66 72 6f 6d 20 74 65 73 74 5f 69 64  ata from test_id
b0e0: 3d 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d  =" (db:test-get-
b0f0: 69 64 20 74 65 73 74 64 61 74 29 20 22 20 74 6f  id testdat) " to
b100: 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d   " (db:test-get-
b110: 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 29  id new-testdat))
b120: 0a 09 20 20 20 20 28 73 71 6c 69 74 65 33 3a 65  ..    (sqlite3:e
b130: 78 65 63 75 74 65 20 0a 09 20 20 20 20 20 64 62  xecute ..     db
b140: 20 0a 09 20 20 20 20 20 28 63 6f 6e 63 20 22 49   ..     (conc "I
b150: 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45  NSERT OR REPLACE
b160: 20 49 4e 54 4f 20 74 65 73 74 5f 64 61 74 61 20   INTO test_data 
b170: 28 74 65 73 74 5f 69 64 2c 63 61 74 65 67 6f 72  (test_id,categor
b180: 79 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65  y,variable,value
b190: 2c 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e  ,expected,tol,un
b1a0: 69 74 73 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09  its,comment) "..
b1b0: 09 20 20 20 22 53 45 4c 45 43 54 20 22 20 28 64  .   "SELECT " (d
b1c0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65  b:test-get-id ne
b1d0: 77 2d 74 65 73 74 64 61 74 29 20 22 2c 63 61 74  w-testdat) ",cat
b1e0: 65 67 6f 72 79 2c 76 61 72 69 61 62 6c 65 2c 76  egory,variable,v
b1f0: 61 6c 75 65 2c 65 78 70 65 63 74 65 64 2c 74 6f  alue,expected,to
b200: 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65 6e 74 20  l,units,comment 
b210: 46 52 4f 4d 20 74 65 73 74 5f 64 61 74 61 20 57  FROM test_data W
b220: 48 45 52 45 20 74 65 73 74 5f 69 64 3d 3f 3b 22  HERE test_id=?;"
b230: 29 0a 09 20 20 20 20 20 28 64 62 3a 74 65 73 74  )..     (db:test
b240: 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29  -get-id testdat)
b250: 29 29 29 0a 09 20 29 29 0a 20 20 20 20 20 70 72  ))).. )).     pr
b260: 65 76 2d 74 65 73 74 73 29 29 29 0a 09 20 0a 20  ev-tests))).. . 
b270: 20 20 20 20 0a                                       .